app/regex: fix mbuf size for multi segemnt buffers
PATCH 1/1 app/regex: fix mbuf size for multi segemnt buffers
When allocating multi segmented buffers, and in case there is a remainder in total buf len, the actual job len might be more than expected job_len.
This adds additional space in the mbuf in the multi seg case, to allow the remaining memory to be stored in one segment.
Signed-off-by Raslan Darawsheh <[email protected]>
Acked-by Ori Kam <[email protected]>
--- app/test-regex/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-regex/main.c +2 -2
@@ -412,8 +412,8 @@ run_regex(void *args) mbuf_mp =rte_pktmbuf_pool_create (mbuf_pool,rte_align32pow2 (nb_jobs * nb_qps * nb_segs),0 ,0 , (nb_segs ==1 ) ?MBUF_SIZE : - (rte_align32pow2 (job_len) / nb_segs + -RTE_PKTMBUF_HEADROOM ), + (rte_align32pow2 (job_len + (data_len % nb_jobs)) / + nb_segs +RTE_PKTMBUF_HEADROOM ),rte_socket_id ());if (mbuf_mp ==NULL ) {printf ("Error, can't create memory pool\n" );
Signature · 1 line
2.25.1
05/07/2022 10:09, Raslan Darawsheh:
Quoted 7 lines
When allocating multi segmented buffers, and in case there is a remainder in total buf len, the actual job len might be more than expected
job_len.This adds additional space in the mbuf in the multi seg case, to allow the remaining memory to be stored in one segment.
Quoted 6 lines
Signed-off-by Raslan Darawsheh <[email protected]>Acked-by Ori Kam <[email protected]>
Applied (with fixed typo in title), thanks.