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 41F0D45B50; Wed, 16 Oct 2024 10:23:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E42540653; Wed, 16 Oct 2024 10:22:54 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2109.outbound.protection.outlook.com [40.107.236.109]) by mails.dpdk.org (Postfix) with ESMTP id 8A81040647 for ; Wed, 16 Oct 2024 10:22:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UrWbjbwoqfW21kejPj0lx63/+ZXwWhJJw04PTFItF1Rsp38TEgZ7syw1daaHECWYD9Ty7GCTMvXl7xeC8Xpy2eCgJZYDcrQXkiTbdtyVOxxWq85vrJEB7vMoMRm5PTTHFHLbDF37oExZC+6CBLtijbmz1o6pSyLzhw0ymietcitygHR90Hrb5yAC+EHf4i0/vWIyKQ1wIFwv+SzTaXuswD1rlX7+GvBwyl6Vb9K6uZoBMX6XogUBQatO5/TCcLFXpeeHJwlnfxGYzk+MZToTQWofwYhfIY4mypvn5QDWQ3dSbr17tRmXDewTIPYNz1nbRUT0fRE8gTZlrVojrwkcQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=u+s9GFDqfLzqyVfc+5jY8cRfZfSLFLO0K/jUu3s2qkE=; b=VVF6rnnIoxso+58TzNAe5Gme/zjb8SKsPJq7Kyl2Qt8SmW7iVScxoEdOcutqj6HRBYp08/xce8gba3MTM0SjOu+uiLEbmtj2tmcdQtyn/P2AQ+G84AEg355O28BuafjcLmFb2kaigjIgwc48o+9lGCrw46qULSCbtDfDdrLCCQO28Pj4cb3svv3RCVr0GMdMsuQzUlEk90EIdCRa+nbeKZXogXdgDuOsXZArh21Y8XqFv8Obk3aWudMo07ClF/ZBJDEzDBGvdWHXx3MmO9Z92QNoPpVjVniqByQhzHQheLDgR8IZyjaLnr/oiM17p9x4y8u08a8aB5xIvqB5DXG1FQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u+s9GFDqfLzqyVfc+5jY8cRfZfSLFLO0K/jUu3s2qkE=; b=FEEoC93QQLQ1w9nX/JYl0h9/DX8VxR3zEkFlnGBY3Q4Tw46qeZL1/ww9ndoUHxa6Gv0rHdYObhPxB79A36fEm8vcW+FeAAqSJTCqfbqnaLlduOf5djwDHWqxYAlYoVNOamWgHxotgR134PlVbrfgxmuDfaY/guavnwE465Ooe0I= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by PH7PR13MB5596.namprd13.prod.outlook.com (2603:10b6:510:131::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.25; Wed, 16 Oct 2024 08:22:49 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%5]) with mapi id 15.20.8048.020; Wed, 16 Oct 2024 08:22:49 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He Subject: [PATCH] examples/l3fwd: support setting the data size of mbuf Date: Wed, 16 Oct 2024 16:22:32 +0800 Message-Id: <20241016082232.4005800-1-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR01CA0033.apcprd01.prod.exchangelabs.com (2603:1096:4:192::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH7PR13MB5596:EE_ X-MS-Office365-Filtering-Correlation-Id: e9e22e3b-7440-43fc-2b92-08dcedbbb8c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Z1Y/F/ihuFI7BS4BEkRvDPoT5SDa1OGnkJfM+FmBQm67QjEhcZzZp1IXJGAr?= =?us-ascii?Q?AAArw67PMRk9bYNosIMOGOtgSZTHhMiJeiewLN3l+7CLomjYux6aWOxBkVx6?= =?us-ascii?Q?MloAQrwSUwq12VDd+l02KhIGvE8VM0S79wJ1nPGHYvc7Ya2NJO0NPZ+iaxZs?= =?us-ascii?Q?mA1t1mpMqq4jXobOuDFvMXo9Xq3pV4ripIAiIv0qqx+PhUM8Kt/5VFfZKNWx?= =?us-ascii?Q?iQNQgaY+KMkihUpz0xKvWY9Sg1YqYt2+n4g6FmdpY+eLSvK5eGk+RrhwKI3p?= =?us-ascii?Q?lOxsCyCOqiDLqG5g1Em6+DxGlz46JAVHhSE6gQ/1gfXofKt5IibHZzhYIAbs?= =?us-ascii?Q?eP9r8frq5D0ebGgWoNGxMWAFUzpQzEZPJ4HVMZ5EoNS6pbd7HEBVSFhJSpzY?= =?us-ascii?Q?0pm/ukuIS3KWn0+mtu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tf5c+621fjT79FR0IniiLIK1qtMX3VJ5IYdojapg/aNNVw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(366016)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?s7L+MJzydUOEloa6SLxs4faFZZkYKPiOan4Q9p+k4iv2tZw8Ch5FkISMG6MS?= =?us-ascii?Q?N1ACpwaPnJ7H0OyWxzl2FKtI8k6ZKVPzxgLElHy3H+O2GOh0Oz6M+CVO/PEG?= =?us-ascii?Q?+WnmL3GQ91wQfZahqzDN1BG98QRSaMyERtHdLK5BQXmYOGm+qnQTdBHY+X0Y?= =?us-ascii?Q?LQA58CtzDRmw7L0kguWwDfLNfeEVN0LofKw6Nbwxt75GUW5eN8Xpv63f/MuX?= =?us-ascii?Q?+8hoFsTLZN2OvYNblIe5gAsFdd2c+xtqIUa85sAccuZjt6ybxkRJO1sTIoZb?= =?us-ascii?Q?c1o8U9oBLfXmvI+P+LcGx4TWQGBon4VJQq179Qdy7yuH1C1hUlsKoRtueTFX?= =?us-ascii?Q?xYBRy5aK2ljVK1qKzIb5oLgjstzIoWvgaQ3JvBL0Owq6F0pwTltCWMGb5a6s?= =?us-ascii?Q?ns0qzsPl6ZJof/lOq4ypeS9Z7W6WvSf+MRHN1XNLIbpZQwnK4mVfOot6wsiL?= =?us-ascii?Q?FJYVzJygwHJlcDt5bizZwvxsu63/zu1cEaKhrjDamBWiOUynsyFxuPV8YCF3?= =?us-ascii?Q?ls2ftirRAQzXmuOjy1120UfjQDL5+4L6MiTytEBxSiBcmZNcmC/r7rEQizXI?= =?us-ascii?Q?sid2lQPA813R6uLglPEcND90ktrZ7+Z9sqt56upQZe0JPWSa9d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Gs1Y7eIl/fIoP6cajtgZjVV2Rcz9HJ7FElnBXH4l1ZVGDnTbxINO?= =?us-ascii?Q?nUUeo03twHkHbfq1s1RI3B1my1FjNYn0zTyKSxuh6Msg6lDz4VGGPrJyqg0R?= =?us-ascii?Q?Fg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9e22e3b-7440-43fc-2b92-08dcedbbb8c7 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 08:22:49.6096 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +bSjWb4Z+MM9TaZ2RhgW3aIBC4KiYvBFlW1KUt1XWM+9/HpKLpGU7qIzSWv3+jOYzbsGABcIHW3r01Gs7239nK4DVSQToJtTPkleh5VNtpw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB5596 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 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=4096 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 = 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=FILE: 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=N: 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[] = #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[] = { @@ -753,6 +757,7 @@ static const struct option lgopts[] = { {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 = strtoul(optarg, NULL, 10) + RTE_PKTMBUF_HEADROOM; + if (mbuf_seg_size <= 0 || mbuf_seg_size > 0xFFFF) + 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] = 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] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", -- 2.39.1