From: Raslan Darawsheh <rasland@nvidia.com>
To: <dev@dpdk.org>, <thomas@monjalon.net>
Cc: <ggribbon@nvidia.com>, <stable@dpdk.org>, Ori Kam <orika@nvidia.com>
Subject: [PATCH] app/regex: fix mbuf size for multi segemnt buffers
Date: Tue, 5 Jul 2022 11:09:16 +0300 [thread overview]
Message-ID: <20220705080917.13784-1-rasland@nvidia.com> (raw)
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.
Fixes: c1d1b94eec58 ("app/regex: fix number of matches")
Cc: ggribbon@nvidia.com
Cc: stable@dpdk.org
Signed-off-by: Raslan Darawsheh <rasland@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
app/test-regex/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/test-regex/main.c b/app/test-regex/main.c
index 7c014b2210..db6a315abe 100644
--- a/app/test-regex/main.c
+++ b/app/test-regex/main.c
@@ -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");
--
2.25.1
next reply other threads:[~2022-07-05 8:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-05 8:09 Raslan Darawsheh [this message]
2022-07-05 20:20 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220705080917.13784-1-rasland@nvidia.com \
--to=rasland@nvidia.com \
--cc=dev@dpdk.org \
--cc=ggribbon@nvidia.com \
--cc=orika@nvidia.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).