Skip to content

Commit

Permalink
app/crypto-perf: fix next segment mbuf
Browse files Browse the repository at this point in the history
[ upstream commit 06a109ca5dc551631d9251e81966a4bc52f98c5a ]

In fill_multi_seg_mbuf(), when remaining_segments is 0,
rte_mbuf m's next should pointer to NULL instead of a
new rte_mbuf, that causes setting m->next as NULL out
of the while loop to the invalid mbuf.

This commit fixes the invalid mbuf next operation.

Fixes: bf9d670 ("app/crypto-perf: use single mempool")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Ciara Power <ciara.power@intel.com>
  • Loading branch information
smou-mlnx authored and bluca committed Mar 7, 2024
1 parent 3d8b880 commit ebfa161
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions app/test-crypto-perf/cperf_test_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,
{
uint16_t mbuf_hdr_size = sizeof(struct rte_mbuf);
uint16_t remaining_segments = segments_nb;
struct rte_mbuf *next_mbuf;
rte_iova_t next_seg_phys_addr = rte_mempool_virt2iova(obj) +
mbuf_offset + mbuf_hdr_size;

Expand All @@ -70,15 +69,15 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,
m->nb_segs = segments_nb;
m->port = 0xff;
rte_mbuf_refcnt_set(m, 1);
next_mbuf = (struct rte_mbuf *) ((uint8_t *) m +
mbuf_hdr_size + segment_sz);
m->next = next_mbuf;
m = next_mbuf;
remaining_segments--;

remaining_segments--;
if (remaining_segments > 0) {
m->next = (struct rte_mbuf *)((uint8_t *) m + mbuf_hdr_size + segment_sz);
m = m->next;
} else {
m->next = NULL;
}
} while (remaining_segments > 0);

m->next = NULL;
}

static void
Expand Down

0 comments on commit ebfa161

Please sign in to comment.