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 438CC45B67; Fri, 18 Oct 2024 04:59:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BBA6C4027C; Fri, 18 Oct 2024 04:59:21 +0200 (CEST) Received: from mail-oo1-f45.google.com (mail-oo1-f45.google.com [209.85.161.45]) by mails.dpdk.org (Postfix) with ESMTP id 9CC3140265 for ; Fri, 18 Oct 2024 04:59:20 +0200 (CEST) Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-5eb858c4d20so493155eaf.1 for ; Thu, 17 Oct 2024 19:59:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1729220359; x=1729825159; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=u1RuKKmeVkpsZlkR5cOK7STRvYFdqb7gbfFjhnaF610=; b=0cz1uLzzoirNh2jAw1vPA+DEprmZ/mFDXf65dr+Rco/rOIRIf/X4sty0Bz70IDabcL x+YnclFKe/v+Ff6GbAeAYb/OeLyWZeGV8/XG7GSYFLAWoLbl36fEubTqJPLB1TovBaK6 96SKVJ1d0HnWno3NgpqALZ4MSxTtAnmuS8i/opot0pdR527bNp1IuC2m6W7V9NZm082b 9QyhgWgzFBwIBCZ3TGnzdvWwVHQxY8AmZOwcr0hd4TPwhA7Nvwd3ASqyXO23xXnNbnSz H79gsytsbR++Zg8b7RN5EJzghzr6vMi3rzopPZLRDMMc0FOZmZ8TuqyrYH9oyTVMZvZY HJ+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729220359; x=1729825159; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u1RuKKmeVkpsZlkR5cOK7STRvYFdqb7gbfFjhnaF610=; b=W13y6VKwbQRYBca6S1jOw0K1Qcv8AupR4zwGMVb5Nccmo9jCDEAgcfUcw95o8wMq2C 720w5hRWUBLBZSf2l6ccSeYp63Ws1vMSlV3ZonglfKewctYOPTg+Bm/bbpkVhZDJfysK BLFJjh8dT4G3Mn7xGX32M0/eKiFPJtwF9uuR7Pno9QeAd7nNpDx3dvOamfruBzwFOrFA 0ppXyMTuiI6QEz5+gTZ0EsU7eP4V50W2YQgV5/GMXm9ny0j/oAT36mmDoYJDp8i1vS0I +km7lmoXTMMFKjtaQLM/+drrg9uuKPobpM8nCvzNxwiojnaf8gpruAW3bt2YKJ2yJ35J kJ/w== X-Gm-Message-State: AOJu0Yx7sCwsWDvTaPQYQfk4w4bVmmLo+xa7GElwqQ09dweGBuWRYI2x h/iMXzPwIVmLRnDCm7GdCudECfDqKVr4ojb1i+rtK3TmMGYEhZrSe8wdApTCUxU= X-Google-Smtp-Source: AGHT+IEV+Hww7x+n3gHwLXacKKh1Wq7vl0nmY+pqMqaOe72Jl012nSZjtWrbl6QP3lDs1jObrpanzw== X-Received: by 2002:a05:6870:2254:b0:277:e2fb:4035 with SMTP id 586e51a60fabf-2892c3612a1mr841139fac.27.1729220359207; Thu, 17 Oct 2024 19:59:19 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ea333bea3sm399710b3a.57.2024.10.17.19.59.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 19:59:18 -0700 (PDT) Date: Thu, 17 Oct 2024 19:59:16 -0700 From: Stephen Hemminger To: Chaoyong He Cc: dev@dpdk.org, oss-drivers@corigine.com, Long Wu , Morten =?UTF-8?B?QnLDuHJ1cA==?= Subject: Re: [PATCH v2] examples/l3fwd: support setting the data size of mbuf Message-ID: <20241017195916.656dacc6@hermes.local> In-Reply-To: <20241018024253.4075609-1-chaoyong.he@corigine.com> References: <20241016082232.4005800-1-chaoyong.he@corigine.com> <20241018024253.4075609-1-chaoyong.he@corigine.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 On Fri, 18 Oct 2024 10:42:53 +0800 Chaoyong He wrote: > From: Long Wu >=20 > The previous code used a macro as the data size for mbuf > to create the mempool and users cannot modify the size. >=20 > 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'. >=20 > Examples: > dpdk-l3fwd -l 0-3 -- -p 0x03 --mbuf-size=3D4096 >=20 > Signed-off-by: Long Wu > Reviewed-by: Chaoyong He > Acked-by: Morten Br=C3=B8rup >=20 > --- > v2: > * Modify some logic following the advices of reviewer. > * Add the 'Acked-by' tag. > --- > doc/guides/sample_app_ug/l3_forward.rst | 2 ++ > examples/l3fwd/main.c | 31 ++++++++++++++++++++++--- > 2 files changed, 30 insertions(+), 3 deletions(-) >=20 > diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_= app_ug/l3_forward.rst > index 1cc2c1dd1d..5afbbb242b 100644 > --- a/doc/guides/sample_app_ug/l3_forward.rst > +++ b/doc/guides/sample_app_ug/l3_forward.rst > @@ -143,6 +143,8 @@ Where, > * ``--alg=3D:`` optional, ACL classify method to use, one of: > ``scalar|sse|avx2|neon|altivec|avx512x16|avx512x32`` > =20 > +* ``--mbuf-size=3DN:`` Optional, Set the data size of mbuf to N bytes. > + > * ``-E:`` Optional, enable exact match, > legacy flag, please use ``--lookup=3Dem`` instead. > =20 > diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c > index 01b763e5ba..ed5d0c2608 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_data_size =3D RTE_MBUF_DEFAULT_DATAROOM; > static struct rte_mempool *pktmbuf_pool[RTE_MAX_ETHPORTS][NB_SOCKETS]; > static uint8_t lkp_per_socket[NB_SOCKETS]; > =20 > @@ -448,7 +449,8 @@ print_usage(const char *prgname) > " One is ACL entry at while line leads with charact= er '%c',\n" > " another is route entry at while line leads with c= haracter '%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); > } > @@ -667,6 +669,22 @@ parse_lookup(const char *optarg) > return 0; > } > =20 > +static void > +parse_mbuf_data_size(const char *optarg) > +{ > + char *end =3D NULL; > + > + mbuf_data_size =3D strtoul(optarg, &end, 10); > + if ((optarg[0] =3D=3D '\0') || (end =3D=3D NULL) || (*end !=3D '\0')) > + rte_exit(EXIT_FAILURE, "Invalid mbuf data size: %s\n", optarg); > + > + if (mbuf_data_size < RTE_ETHER_MIN_LEN || > + mbuf_data_size > 0xFFFF - RTE_PKTMBUF_HEADROOM) For clarity replace 0xffff with UINT16_MAX (which is data_len) > + rte_exit(EXIT_FAILURE, > + "mbuf-size should be >=3D %u and <=3D %u\n", > + RTE_ETHER_MIN_LEN, 0xFFFF - RTE_PKTMBUF_HEADROOM); > +} > + Not sure why this is needed? What is the problem with the original code? Are you trying to force packets to be segmented?