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 4FE4E426E6; Sun, 8 Oct 2023 03:52:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2ECB1406BA; Sun, 8 Oct 2023 03:51:38 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2120.outbound.protection.outlook.com [40.107.237.120]) by mails.dpdk.org (Postfix) with ESMTP id 34713402F1 for ; Sun, 8 Oct 2023 03:51:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eco2c4CKi0BW3QUyPtxBoTmD2PC4mbIRSynWjpT6mb256AxGIMPLkzg3f1g6MV1ce1/3eqLwrbBnlMnqoOAq3epPPkZ8J5b+6NRKqR7DQSRQu68MId1S+tdtJiOyq4SZqN15Vh1DSYkPcmk6lGfF+xX6BqeCls9Id33HmD0omvCs0OK5U+mFi4+TIRlpWnKTv65mWi5VoMzflN/fOLLBFYz3BFanuzqKUQYfcLElP3CN9tRdz0PyjuWh1Zt5VnzELXUOxP6NFHmGxVKnmAFpxnbWtxRaUQjgpK1dBAnwVr5+VcMxRNBIM7vHTYqn+/LCd55Ua3DN7clXMEWoNThiPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=bwS4KxFY8DCg389KtohA9DSS4UmpV/wOLzrxSmdnIkk=; b=adF4I77c/CBOyWWN7kjbyxivj0ppx8HlEo8yOUThSDKuEybpaunw7y6Ps+RM1ZB77+WS+n4zENnqODdruVkZzU7VRbrHlZnN+tU1pBaYmCG2LW/u3OunqQ/ndhbIeJxwUsCwCpkJAiKOSmDT3ikeBf546w6FfxrHKLKqrsEXFKqNXBK9UwYVk3f+QRp5yhGLc3jlYU9e6/UM6k0al+3gzYcb0Fa7AhD7cC69sEKj2G8H+5gD7x9YPaAge7WI0xYgaXCdijPzY5jUAZTBaXgr+yGmr1wkqIpsQ/UTZd1XFZtntnbgGNd+lO+VaDTkXi5khKYM4gLrBUgLRMBWIlRQjQ== 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=bwS4KxFY8DCg389KtohA9DSS4UmpV/wOLzrxSmdnIkk=; b=Axm+Mc0twB7LGYHxWrg9kl4QOJfCj8rdy8wHYzp0Zi4mtofm6dxLjQa19Ql19UlfSBlsVguWnjZz+51QP0A14gdyWmxrDOezioKRZjb/bN7pjMHVssXN7X6QOjFZL0evhZo/5bUmwIvL3EaThWOh/p/97yyF8e3s1RjhRCuX2Wk= 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 BLAPR13MB4579.namprd13.prod.outlook.com (2603:10b6:208:327::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.41; Sun, 8 Oct 2023 01:51:33 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::28c0:63e2:ecd1:9314]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::28c0:63e2:ecd1:9314%4]) with mapi id 15.20.6813.027; Sun, 8 Oct 2023 01:51:33 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , James Hershaw , Chaoyong He Subject: [PATCH v3 4/8] net/bonding: add bonding port arguments Date: Sun, 8 Oct 2023 09:50:37 +0800 Message-Id: <20231008015041.1551165-5-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231008015041.1551165-1-chaoyong.he@corigine.com> References: <20231007013440.1309422-1-chaoyong.he@corigine.com> <20231008015041.1551165-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR05CA0173.namprd05.prod.outlook.com (2603:10b6:a03:339::28) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BLAPR13MB4579:EE_ X-MS-Office365-Filtering-Correlation-Id: 249b373c-8207-466d-a88c-08dbc7a1196a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3rsFK9ksCoPaBuDSOFQzJ4z4ku/Pi1YArwCE+1NIaEv3Zy83Za/wy5jb2IsykQ7BAv0Cg121aTbp7Dw/gnhGlIJTE/rZ7GCQmAusmqKRp4I7bUQMYzhn4jw0AtW/uNV07IlRGLr/CyNVf4pweOAGwzkWAxbIvsRbGevFMtVDLOiam+1UQB5zv9oaA9iu/o6Er7zSNKenucKFiLBhAILSw6IV00hMZQSbawaXbX331asoaEL/2uLA6VhU7OEdms3Rurn53qnkmWDCx1qntTsB+mBsOxN1Ysyp5OyMRUfj90GaHpQnu0mUw3Zt+Jzvux3/xndAiFb36uBusedkDz94j9Hf6iVKieZu3iuGfjUEGV+dfDqxBRP6xMOG5cxir4im29v//5ptcnrqbyVTOfRH/X7CngjR2pHyIHBsrsbnUKDhbIX/Y79PKJkk3Z9W446y3sAXprnZHCWYg+AbRzOMDMkOP5dkO/Z593Azb5/US5qis2AX3a0CAVizIa8tX7ePbbZX1E90kcm1ETX9YNZYkovCV9dkDuLnBKbYljGcnXV8qFOyPHoqMNJuTIy3tZUvB2PxFEOeqAq2ewaNnRUer/ow7LTcRfbKZFsoi4rTOBc1T8wCmvRcucJg3+2ZO8DX8xl4mV9Y3QKH2uE3ahL3AP8BRzCTVL4z6dkUeUhQHaQ= 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:(13230031)(39830400003)(376002)(396003)(366004)(136003)(346002)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(41300700001)(1076003)(107886003)(2616005)(316002)(6916009)(66556008)(66946007)(54906003)(66476007)(36756003)(5660300002)(44832011)(83380400001)(38350700002)(38100700002)(86362001)(2906002)(26005)(8676002)(8936002)(4326008)(478600001)(6486002)(6506007)(52116002)(6512007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ttpeZN6+YPZA4ggw3lk0mAjMGMEYSHEKtbgTXPtXLDcV9IIUPkscVnp3ZMgA?= =?us-ascii?Q?dMKbITmC+0RotW/cn1t++cW6p0dI4HpX/IAam8LOYwOiL44DgRzJAEXV+w7i?= =?us-ascii?Q?jnYAqxDNNVl6PLosvbFJqJcUIerBfgqPYNLqiMQadeHxSHwIHixi3Aitn7pr?= =?us-ascii?Q?tl8GqXpI7z+wl6zz8xmpvtpbaUVQjzBWO3LOudGOXM+0Hfcbd4JRZ6Am0Hia?= =?us-ascii?Q?1/d0J3T8o7khF0fsxBl73EwHBY61pktuAXOBpJub4SCmB7lM4YwLL1KRN1Zc?= =?us-ascii?Q?BYEO0Z2vD7Ijh+iPMtI9kyKQq/sDQUyyIm3c0KeVHWDYq6cHWhgStO6JfUh3?= =?us-ascii?Q?O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+xd?= =?us-ascii?Q?c6M2pZCkcheLizvLJjGZbY7EoubfVAEDjqaRXCnUf877jLBiLsDAUPTwShDC?= =?us-ascii?Q?mE5gbX/bR7lI/9Is5lL7QG/FhDmFMp05rHvA5gTJq63jPgWZ5e3IaE8ywup6?= =?us-ascii?Q?J8N3OVQcR/Rd8S9DiNE0PD2MrRn3a4iPuiA+/R7+pFkMeD37EQwN8aJM4Bx1?= =?us-ascii?Q?WmBAuFdlHsugO1N8XCv9p4PyLb3UMoN9Ue47wwORbAvjWV08VFtvi2+YJWpJ?= =?us-ascii?Q?lBHsNVOMP85vki/sgiD05n9l6i6MHoN+252lQsVT5URGjWie/Om+8kc19bfy?= =?us-ascii?Q?dV92U7eCPZrMji+3L1KTZz5bCA2yoZ7zf9Bjx7PMJpvWVtVY3bZABTQGR3L5?= =?us-ascii?Q?OQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 249b373c-8207-466d-a88c-08dbc7a1196a X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2023 01:51:33.6197 (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: wxXfZaH7Hj/23kKl31ug3I3A11/E76onzBMCsi5cTbm7khScSMCzm7O1TrMY5kN9Z1Kn55WCXGF4u8OWad3LgTpUdAbXe0edAGmBLdVkacY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR13MB4579 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 Include the following new arguments for bonding ports: - "notify_member" to enable/disable member notification. - "dedicated_queue" to enable/disable dedicated queue. Add these two arguments in initial argument. Signed-off-by: Long Wu Reviewed-by: James Hershaw Reviewed-by: Chaoyong He --- drivers/net/bonding/eth_bond_private.h | 10 ++++ drivers/net/bonding/rte_eth_bond.h | 14 ++++++ drivers/net/bonding/rte_eth_bond_api.c | 14 ++++++ drivers/net/bonding/rte_eth_bond_args.c | 44 ++++++++++++++++++ drivers/net/bonding/rte_eth_bond_pmd.c | 61 ++++++++++++++++++++++++- 5 files changed, 142 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h index f69e85c199..f9603a0f6b 100644 --- a/drivers/net/bonding/eth_bond_private.h +++ b/drivers/net/bonding/eth_bond_private.h @@ -28,6 +28,8 @@ #define PMD_BOND_LSC_POLL_PERIOD_KVARG ("lsc_poll_period_ms") #define PMD_BOND_LINK_UP_PROP_DELAY_KVARG ("up_delay") #define PMD_BOND_LINK_DOWN_PROP_DELAY_KVARG ("down_delay") +#define PMD_BOND_NOTIFY_MEMBER_KVARG ("notify_member") +#define PMD_BOND_DEDICATED_QUEUE_KVARG ("dedicated_queue") #define PMD_BOND_XMIT_POLICY_LAYER2_KVARG ("l2") #define PMD_BOND_XMIT_POLICY_LAYER23_KVARG ("l23") @@ -319,6 +321,14 @@ int bond_ethdev_parse_time_ms_kvarg(const char *key, const char *value, void *extra_args); +int +bond_ethdev_parse_notify_member_kvarg(const char *key __rte_unused, + const char *value, void *extra_args); + +int +bond_ethdev_parse_dedicated_queue_kvarg(const char *key __rte_unused, + const char *value, void *extra_args); + void bond_tlb_disable(struct bond_dev_private *internals); diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h index 28aa341d2f..3f427b6bab 100644 --- a/drivers/net/bonding/rte_eth_bond.h +++ b/drivers/net/bonding/rte_eth_bond.h @@ -385,6 +385,20 @@ rte_eth_bond_link_up_prop_delay_set(uint16_t bonding_port_id, int rte_eth_bond_link_up_prop_delay_get(uint16_t bonding_port_id); +/** + * Set the flag that whether bonding device enable dedicated queue. + * + * @param bonding_port_id + * Port ID of bonding device. + * @param queue_flag + * The flag of enable bond dedicated queue + * + * @return + * 0 on success, negative value otherwise. + */ +int +rte_eth_bond_dedicated_queue_flag_set(uint16_t bonding_port_id, bool queue_flag); + /** * Set the flag of whether bonding port notifies member ports. * diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 0be580b19b..a042f05a4c 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -1114,6 +1114,20 @@ rte_eth_bond_link_up_prop_delay_get(uint16_t bonding_port_id) return internals->link_up_delay_ms; } +int +rte_eth_bond_dedicated_queue_flag_set(uint16_t bonding_port_id, bool queue_flag) +{ + struct bond_dev_private *internals; + + if (valid_bonding_port_id(bonding_port_id) != 0) + return -1; + + internals = rte_eth_devices[bonding_port_id].data->dev_private; + internals->mode4.dedicated_queues.enabled = queue_flag; + + return 0; +} + int rte_eth_bond_notify_member_flag_set(uint16_t bonding_port_id, bool notify_member) { diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c index bdec5d61d4..8a3e4656ef 100644 --- a/drivers/net/bonding/rte_eth_bond_args.c +++ b/drivers/net/bonding/rte_eth_bond_args.c @@ -20,6 +20,8 @@ const char *pmd_bond_init_valid_arguments[] = { PMD_BOND_MAC_ADDR_KVARG, PMD_BOND_AGG_MODE_KVARG, RTE_DEVARGS_KEY_DRIVER, + PMD_BOND_NOTIFY_MEMBER_KVARG, + PMD_BOND_DEDICATED_QUEUE_KVARG, NULL }; @@ -297,3 +299,45 @@ bond_ethdev_parse_time_ms_kvarg(const char *key __rte_unused, return 0; } + +int +bond_ethdev_parse_notify_member_kvarg(const char *key __rte_unused, + const char *value, void *extra_args) +{ + bool *notify_member; + + if (value == NULL || extra_args == NULL) + return -1; + + notify_member = extra_args; + + if (strcmp("enable", value) == 0) + *notify_member = true; + else if (strcmp("disable", value) == 0) + *notify_member = false; + else + return -1; + + return 0; +} + +int +bond_ethdev_parse_dedicated_queue_kvarg(const char *key __rte_unused, + const char *value, void *extra_args) +{ + bool *dedicated_queue; + + if (value == NULL || extra_args == NULL) + return -1; + + dedicated_queue = extra_args; + + if (strcmp("enable", value) == 0) + *dedicated_queue = true; + else if (strcmp("disable", value) == 0) + *dedicated_queue = false; + else + return -1; + + return 0; +} diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index b99b8b8938..1ebeb270c8 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -4227,6 +4227,63 @@ bond_ethdev_configure(struct rte_eth_dev *dev) return -1; } + /* Parse/set notify member flag */ + arg_count = rte_kvargs_count(kvlist, PMD_BOND_NOTIFY_MEMBER_KVARG); + if (arg_count == 1) { + bool notify_member; + if (rte_kvargs_process(kvlist, + PMD_BOND_NOTIFY_MEMBER_KVARG, + &bond_ethdev_parse_notify_member_kvarg, + ¬ify_member) < 0) { + RTE_BOND_LOG(ERR, + "Invalid notify member value specified" + " for bonding device %s", name); + return -1; + } + + if (rte_eth_bond_notify_member_flag_set(port_id, notify_member) != 0) { + RTE_BOND_LOG(ERR, + "Failed to set notify member (%u) on" + " bonding device %s", notify_member, name); + return -1; + } + } else if (arg_count > 1) { + RTE_BOND_LOG(ERR, + "notify member flag can be specified only once" + " for bonding device %s", name); + return -1; + } + + /* Parse/set dedicated queue flag */ + arg_count = rte_kvargs_count(kvlist, PMD_BOND_DEDICATED_QUEUE_KVARG); + if (arg_count == 1) { + bool dedicated_queue; + if (rte_kvargs_process(kvlist, + PMD_BOND_DEDICATED_QUEUE_KVARG, + &bond_ethdev_parse_dedicated_queue_kvarg, + &dedicated_queue) < 0) { + RTE_BOND_LOG(ERR, + "Invalid dedicated queue flag specified" + " for bonding device %s", name); + return -1; + } + + if (internals->mode == BONDING_MODE_8023AD) { + if (rte_eth_bond_dedicated_queue_flag_set(port_id, dedicated_queue) != 0) { + RTE_BOND_LOG(ERR, + "Failed to enable/disable dedicated" + " queue flag on bonding device %s", + name); + return -1; + } + } + } else if (arg_count > 1) { + RTE_BOND_LOG(ERR, + "dedicated queue flag can be specified only once" + " for bonding device %s", name); + return -1; + } + /* configure members so we can pass mtu setting */ for (i = 0; i < internals->member_count; i++) { struct rte_eth_dev *member_ethdev = @@ -4264,7 +4321,9 @@ RTE_PMD_REGISTER_PARAM_STRING(net_bonding, "mac= " "lsc_poll_period_ms= " "up_delay= " - "down_delay="); + "down_delay=" + "notify_member=[enable | disable] " + "dedicated_queue=[enable | disable] "); /* We can't use RTE_LOG_REGISTER_DEFAULT because of the forced name for * this library, see meson.build. -- 2.39.1