From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 912D645B56; Wed, 16 Oct 2024 23:18:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 636424021F; Wed, 16 Oct 2024 23:18:36 +0200 (CEST) Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by mails.dpdk.org (Postfix) with ESMTP id 7AD1140144 for ; Wed, 16 Oct 2024 23:18:34 +0200 (CEST) Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2e2e23f2931so228324a91.0 for ; Wed, 16 Oct 2024 14:18:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1729113513; x=1729718313; darn=dpdk.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=aRiyjNXYO6+vySS4MMr9FbSYLtWLdmpGLVCN72y0EIc=; b=EdoPG4IdXkuBuXJc3OLb9wusIZhdmgE5xP8bW8seLAaRC31wAgpF52OPyXyQrvJtRF LMUAqnLXU0b8ovf3QlSnQv6uOXctS+kZai8AsQIgW97RX47Uh3S9ZsXSmigm5LdXmg/O AYWz9I0p7/QcHcnV20qBo6uu7hsU9neKlUyLw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729113513; x=1729718313; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aRiyjNXYO6+vySS4MMr9FbSYLtWLdmpGLVCN72y0EIc=; b=RQX4MCrqZ8s3FMi9663nzsrYyKfQEbXLdyRKQbNSx9S8akXB/bCqUMLUBCUoqEGOPf neuIE7yhqeHnvh8Kh6fFYq0GqjyC/Nl9QpBHG8RZHNvdfvA4PdEvDvvPAPbTuiCK0z6e MtL065kkj9sSIZBZVXavwKrU1VuieBjpJOAy9dnz0n5jiiYKIdm+6w0MkNXkZwS9J9+o 4nNUVLOWvs03LMkIYsmP96POTV7DKdO1LTN2W+7f9cpbqpuZtQIoGHMyUwHvaxB77EVM LPtVI5DHaTU5d6oIAyacH4PsfYGyfEgD5LweA9V8IxmebVvj+fZhC2WoxD/NWGZUTUtw SaUQ== X-Gm-Message-State: AOJu0YzytrJCdt/VFBIi9WfqF89pB2QkGRrl86jKKjsCAJtSf52lp6fk EJXRFTSe28mec6xGdwlHCMnzeVq57ig/yhKkwZx3+oeflg2da/av4WbtuP0IOqzniqZJ7pIynn8 kq0oofF+TMiRs9bYw+JQcXjYZLOCJPal7J7Dv8A== X-Google-Smtp-Source: AGHT+IEnxsV46ByLGIS3Kg6OprbmIhwQRYFpfkygvFHrNHWFIvqnDSlyfcUfwi4dKcU2Tig3HcryZGt7gmk4F87GNYI= X-Received: by 2002:a17:90b:4ac3:b0:2e2:d5fc:2848 with SMTP id 98e67ed59e1d1-2e3151b7972mr21920610a91.4.1729113513431; Wed, 16 Oct 2024 14:18:33 -0700 (PDT) MIME-Version: 1.0 References: <20241016082232.4005800-1-chaoyong.he@corigine.com> In-Reply-To: <20241016082232.4005800-1-chaoyong.he@corigine.com> From: Patrick Robb Date: Wed, 16 Oct 2024 17:17:06 -0400 Message-ID: Subject: Re: [PATCH] examples/l3fwd: support setting the data size of mbuf To: Chaoyong He Cc: dev@dpdk.org, oss-drivers@corigine.com, Long Wu Content-Type: multipart/alternative; boundary="000000000000beb7b506249e9cd7" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --000000000000beb7b506249e9cd7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sorry to interrupt the conversation - obviously the CI testing fail is a false failure and should be ignored by the maintainer here. For those curious, it failed like this, which I have seen previously in a similar case: tester: Pkt number not matched,2000 sent and 1999 received I'm removing this legacy DTS testsuite from our CI testing as it cannot be trusted and also the testsuite has been rewritten recently (and we are switching to the new version). Sorry to be a bother! On Wed, Oct 16, 2024 at 4:22=E2=80=AFAM Chaoyong He wrote: > From: Long Wu > > The previous code used a macro as the data size for mbuf > to create the mempool and users cannot modify the size. > > Now modify the code to support setting the data size of > mbuf by '--mbuf-size' parameter. If user does not add the > parameter in start command line, the default size is still > 'RTE_MBUF_DEFAULT_BUF_SIZE'. > > Examples: > dpdk-l3fwd -l 0-3 -- -p 0x03 --mbuf-size=3D4096 > > Signed-off-by: Long Wu > Reviewed-by: Chaoyong He > --- > examples/l3fwd/main.c | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) > > diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c > index 01b763e5ba..ccce16c6bb 100644 > --- a/examples/l3fwd/main.c > +++ b/examples/l3fwd/main.c > @@ -140,6 +140,7 @@ uint32_t max_pkt_len; > #ifdef RTE_LIB_EVENTDEV > static struct rte_mempool *vector_pool[RTE_MAX_ETHPORTS]; > #endif > +static uint16_t mbuf_seg_size =3D RTE_MBUF_DEFAULT_BUF_SIZE; > static struct rte_mempool *pktmbuf_pool[RTE_MAX_ETHPORTS][NB_SOCKETS]; > static uint8_t lkp_per_socket[NB_SOCKETS]; > > @@ -448,7 +449,8 @@ print_usage(const char *prgname) > " One is ACL entry at while line leads > with character '%c',\n" > " another is route entry at while line > leads with character '%c'.\n" > " --rule_ipv6=3DFILE: Specify the ipv6 rules entries > file.\n" > - " --alg: ACL classify method to use, one of: %s.\n\n", > + " --alg: ACL classify method to use, one of: %s.\n" > + " --mbuf-size=3DN: Set the data size of mbuf to N > bytes.\n\n", > prgname, RX_DESC_DEFAULT, TX_DESC_DEFAULT, > ACL_LEAD_CHAR, ROUTE_LEAD_CHAR, alg); > } > @@ -698,6 +700,7 @@ static const char short_options[] =3D > #define CMD_LINE_OPT_RULE_IPV4 "rule_ipv4" > #define CMD_LINE_OPT_RULE_IPV6 "rule_ipv6" > #define CMD_LINE_OPT_ALG "alg" > +#define CMD_LINE_OPT_MBUF_SIZE "mbuf-size" > > enum { > /* long options mapped to a short option */ > @@ -726,7 +729,8 @@ enum { > CMD_LINE_OPT_LOOKUP_NUM, > CMD_LINE_OPT_ENABLE_VECTOR_NUM, > CMD_LINE_OPT_VECTOR_SIZE_NUM, > - CMD_LINE_OPT_VECTOR_TMO_NS_NUM > + CMD_LINE_OPT_VECTOR_TMO_NS_NUM, > + CMD_LINE_OPT_MBUF_SIZE_NUM, > }; > > static const struct option lgopts[] =3D { > @@ -753,6 +757,7 @@ static const struct option lgopts[] =3D { > {CMD_LINE_OPT_RULE_IPV4, 1, 0, CMD_LINE_OPT_RULE_IPV4_NUM}, > {CMD_LINE_OPT_RULE_IPV6, 1, 0, CMD_LINE_OPT_RULE_IPV6_NUM}, > {CMD_LINE_OPT_ALG, 1, 0, CMD_LINE_OPT_ALG_NUM}, > + {CMD_LINE_OPT_MBUF_SIZE, 1, 0, CMD_LINE_OPT_MBUF_SIZE_NUM}, > {NULL, 0, 0, 0} > }; > > @@ -934,6 +939,12 @@ parse_args(int argc, char **argv) > case CMD_LINE_OPT_ALG_NUM: > l3fwd_set_alg(optarg); > break; > + case CMD_LINE_OPT_MBUF_SIZE_NUM: > + mbuf_seg_size =3D strtoul(optarg, NULL, 10) + > RTE_PKTMBUF_HEADROOM; > + if (mbuf_seg_size <=3D 0 || mbuf_seg_size > 0xFFF= F) > + rte_exit(EXIT_FAILURE, > + "mbuf-size should be > 0 > and < 65536\n"); > + break; > default: > print_usage(prgname); > return -1; > @@ -1034,7 +1045,7 @@ init_mem(uint16_t portid, unsigned int nb_mbuf) > pktmbuf_pool[portid][socketid] =3D > rte_pktmbuf_pool_create(s, nb_mbuf, > MEMPOOL_CACHE_SIZE, 0, > - RTE_MBUF_DEFAULT_BUF_SIZE, > socketid); > + mbuf_seg_size, socketid); > if (pktmbuf_pool[portid][socketid] =3D=3D NULL) > rte_exit(EXIT_FAILURE, > "Cannot init mbuf pool on socket > %d\n", > -- > 2.39.1 > > --000000000000beb7b506249e9cd7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Sorry to interrupt the conversation - obviously=C2=A0the C= I testing fail is a false failure and should=C2=A0be ignored by the maintai= ner here.=C2=A0

For those curious, it failed like this, = which I have=C2=A0seen previously in a similar case:
tester: Pkt = number not matched,2000 sent and 1999 received

I'm removing this legacy DTS testsuite from our CI testing as it canno= t be trusted and also the=C2=A0testsuite has been rewritten recently (and w= e are switching to the new version).

Sorry to be a= bother!

On Wed, Oct 16, 2024 at 4:22=E2=80=AFAM Chaoyong He <chaoyong.he@corigine.com> w= rote:
From: Long= Wu <long.wu@c= origine.com>

The previous code used a macro as the data size for mbuf
to create the mempool and users cannot modify the size.

Now modify the code to support setting the data size of
mbuf by '--mbuf-size' parameter. If user does not add the
parameter in start command line, the default size is still
'RTE_MBUF_DEFAULT_BUF_SIZE'.

Examples:
dpdk-l3fwd -l 0-3 -- -p 0x03 --mbuf-size=3D4096

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
=C2=A0examples/l3fwd/main.c | 17 ++++++++++++++---
=C2=A01 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 01b763e5ba..ccce16c6bb 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -140,6 +140,7 @@ uint32_t max_pkt_len;
=C2=A0#ifdef RTE_LIB_EVENTDEV
=C2=A0static struct rte_mempool *vector_pool[RTE_MAX_ETHPORTS];
=C2=A0#endif
+static uint16_t mbuf_seg_size =3D RTE_MBUF_DEFAULT_BUF_SIZE;
=C2=A0static struct rte_mempool *pktmbuf_pool[RTE_MAX_ETHPORTS][NB_SOCKETS]= ;
=C2=A0static uint8_t lkp_per_socket[NB_SOCKETS];

@@ -448,7 +449,8 @@ print_usage(const char *prgname)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 One is ACL entry a= t while line leads with character '%c',\n"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 another is route e= ntry at while line leads with character '%c'.\n"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "=C2=A0 --rule= _ipv6=3DFILE: Specify the ipv6 rules entries file.\n"
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"=C2=A0 --alg:= ACL classify method to use, one of: %s.\n\n",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"=C2=A0 --alg:= ACL classify method to use, one of: %s.\n"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"=C2=A0 --mbuf= -size=3DN: Set the data size of mbuf to N bytes.\n\n",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 prgname, RX_DESC_DE= FAULT, TX_DESC_DEFAULT,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ACL_LEAD_CHAR, ROUT= E_LEAD_CHAR, alg);
=C2=A0}
@@ -698,6 +700,7 @@ static const char short_options[] =3D
=C2=A0#define CMD_LINE_OPT_RULE_IPV4 "rule_ipv4"
=C2=A0#define CMD_LINE_OPT_RULE_IPV6 "rule_ipv6"
=C2=A0#define CMD_LINE_OPT_ALG "alg"
+#define CMD_LINE_OPT_MBUF_SIZE "mbuf-size"

=C2=A0enum {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* long options mapped to a short option */
@@ -726,7 +729,8 @@ enum {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 CMD_LINE_OPT_LOOKUP_NUM,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 CMD_LINE_OPT_ENABLE_VECTOR_NUM,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 CMD_LINE_OPT_VECTOR_SIZE_NUM,
-=C2=A0 =C2=A0 =C2=A0 =C2=A0CMD_LINE_OPT_VECTOR_TMO_NS_NUM
+=C2=A0 =C2=A0 =C2=A0 =C2=A0CMD_LINE_OPT_VECTOR_TMO_NS_NUM,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0CMD_LINE_OPT_MBUF_SIZE_NUM,
=C2=A0};

=C2=A0static const struct option lgopts[] =3D {
@@ -753,6 +757,7 @@ static const struct option lgopts[] =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {CMD_LINE_OPT_RULE_IPV4,=C2=A0 =C2=A01, 0, CMD_= LINE_OPT_RULE_IPV4_NUM},
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {CMD_LINE_OPT_RULE_IPV6,=C2=A0 =C2=A01, 0, CMD_= LINE_OPT_RULE_IPV6_NUM},
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {CMD_LINE_OPT_ALG,=C2=A0 =C2=A01, 0, CMD_LINE_O= PT_ALG_NUM},
+=C2=A0 =C2=A0 =C2=A0 =C2=A0{CMD_LINE_OPT_MBUF_SIZE, 1, 0, CMD_LINE_OPT_MBU= F_SIZE_NUM},
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {NULL, 0, 0, 0}
=C2=A0};

@@ -934,6 +939,12 @@ parse_args(int argc, char **argv)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A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0 default:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 print_usage(prgname);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 return -1;
@@ -1034,7 +1045,7 @@ init_mem(uint16_t portid, unsigned int nb_mbuf)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 pktmbuf_pool[portid][socketid] =3D
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rte_pktmbuf_pool_create(s, nb_mbuf,<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MEMPOOL_= CACHE_SIZE, 0,
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_MBUF_= DEFAULT_BUF_SIZE, socketid);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mbuf_seg_= size, socketid);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0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