On 19-Jul-19 2:38 PM, Olivier Matz wrote:
When using iova contiguous memory and objets smaller than page size,
ensure that objects are not located across several pages.
Signed-off-by: Vamsi Krishna Attunuru <vattun...@marvell.com>
Signed-off-by: Olivier Matz <olivier.m...@6wind.com>
---
<snip>
total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size;
- for (off = 0, i = 0; off + total_elt_sz <= len && i < max_objs; i++) {
+ for (off = 0, i = 0; i < max_objs; i++) {
+ /* align offset to next page start if required */
+ if (mempool_check_obj_bounds((char *)vaddr + off,
+ pg_sz, total_elt_sz) < 0) {
+ off += RTE_PTR_ALIGN_CEIL((char *)vaddr + off, pg_sz) -
+ ((char *)vaddr + off);
Same here, PTR_ALIGN plus PTR_SUB. It's perhaps not as cool as a
one-liner, but this is not a hot path :)
--
Thanks,
Anatoly