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 5CD0C426BB; Thu, 5 Oct 2023 04:40:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 38B0E4067A; Thu, 5 Oct 2023 04:40:47 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2127.outbound.protection.outlook.com [40.107.220.127]) by mails.dpdk.org (Postfix) with ESMTP id 1F7C9402D8 for ; Thu, 5 Oct 2023 04:40:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eDJh/IP96EaszzfUuBpzHhrVNUpHJh8gUGflO94UYlExPGEjBzCPRzQCRkX718N4Oz7g0UADlQQWo0PW7xRNOP4uH3RH4aoEnnFU2Fh8dw7EaAr2aXq7ZYyuRO0Il9ssNFQ6/mGT9ToTk9NVmjscciMI/yVQMwBFtT6sDIyxEaq4NNsOcZKOzYxZcXIhVnbJKKM1zqVG5o8LA2ok4AwWNPJMQ41ufmVn3sp5lJ+fKJ7S0MJdRfrzYJZdevNmycBaY3r0+fLs6BLQCOHTJyrKZQirA1F/IwYMlI9aUyYgkd7w5T3zbQwjmcZrt61ltOISxOxR4kFhTJHPXSBJeq5Nzg== 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=E99o4Qob2A2NcrvJ1Qvv5PJDKJQNgSy11m6Te1YMx6k=; b=lm1lodA24z3JUA3AgZD3121nazv51g8QlW7tIskrw4hY4+PyeLJ8OL53b5cAvQysyIJo8QmagJlYz7huNgkOKc44U9B1eY0fhSV1p24l3p/bsgDwkqt1s5inbqq7yHugi19Vp2lCby8oyYX8qLNzRdJbiCrUmMKGDph5JB8GbfcjrkBbbQPHW+KqwD/hI1GfHR6mZ1qVChAniJO85Dqb53JJLVuMJOQg/QBhLqmsvEl4F+4TxF60tDcDYflwigHOW9M0GOwvU3w5jfjeor5YGJEoe5roUwfYJNta1ym8Ree2cZwZapXOFqLjrr4jgJLd+vh6t3F5rOIllCfVOqNKxQ== 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=E99o4Qob2A2NcrvJ1Qvv5PJDKJQNgSy11m6Te1YMx6k=; b=V8/Zwz0DHMpBdzTB02b2RMUU0L9a82Y2GfV/8qKgMJpimiFXnrxYKu30s2Obn5beiEQtTNUwlRrn9vKY40kiJwbLYIQyekNwVFWRAdEpvI6uSfEwAZ3Y3NhFTkrkWqzCO9VQ1IwjZhxQH5eayzmI8t8CeQwd5bQPJChGuI7rdFw= 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 PH0PR13MB4780.namprd13.prod.outlook.com (2603:10b6:510:79::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.28; Thu, 5 Oct 2023 02:40:42 +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; Thu, 5 Oct 2023 02:40:42 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , James Hershaw , Chaoyong He Subject: [PATCH 4/8] net/bonding: add bonding port arguments Date: Thu, 5 Oct 2023 10:40:08 +0800 Message-Id: <20231005024012.1279810-5-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231005024012.1279810-1-chaoyong.he@corigine.com> References: <20231005024012.1279810-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: PH0PR07CA0064.namprd07.prod.outlook.com (2603:10b6:510:f::9) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB4780:EE_ X-MS-Office365-Filtering-Correlation-Id: 57b05123-cec7-4517-fea0-08dbc54c77f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A8nq81rcgIL1XUouD2sgCzgwywVpQ6hptJIOfU0tKQVtiCy+G8RP0EHUC1A7gtvXhAV7eRRHTHDND+F54aePpLkiISihhAJYuhsMJhyQp7Tq0ASXqdCiMfXdUsXy9N9FVLtTZOJvYfs0DSGij2DgbNHt7NmMlV0C588UEaF/j/CzLk3RgB6GFCaGrdUpn1bfnUe4RRst23g+15hICBTKQa0buoqpXJno4s8UwUsnUTTitPkYK/I4jTvvtomVixN2ve0ZCprh438Ml9cEynqI723XKj/UpRME2eb3yOgpM5KVaKPEVpuw3ch4iosQTo2/T4TtF+TFxjUthfvQy+ooQtMpmQWzhJYXy2enZ2JHTGfDAFqsgVde0q7dZXn8+cu3iVWoZqLXaOy2nyA9c4xNExrFaYDHGTS/XwzDd98cEosr00n35Si1NEG0VDG3xpXiRw48Lc2w/Ok2olis7pJqVXFKdsvj2mRENudV7h7VbkqdcnZmLnVBtyabGJ/oxiDK8Sq/8ULIP8mEwIamU9Mh7B4O7OIQUzqoLXvRVJ7WtmttcmcY9h9I2mIuZfB6rT5baO+yhBGC5NLG5Vi8HrehOTb82HOejYPXH9bjCgoyGRTDSOVMU5JipnnqVCYtt0ddfvwO9bV3txgh59xxB+OmwzJHfzHhHMCVxShJD1gwN/E= 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)(366004)(376002)(346002)(136003)(39830400003)(396003)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(8676002)(107886003)(2616005)(66476007)(4326008)(38100700002)(54906003)(316002)(478600001)(8936002)(66556008)(66946007)(38350700002)(2906002)(6916009)(86362001)(41300700001)(6486002)(6506007)(5660300002)(52116002)(83380400001)(6512007)(1076003)(6666004)(26005)(44832011)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?C9wGbArqkEKisBAX9uAUYGJ9ysDqpWbEABGFdgeG2EhMX1eYwwjdlIjoXtha?= =?us-ascii?Q?iXW6ZLkyZEiQrGGndXsmt79xVvNfdq9YJABGbt1URJaFR/4P7iLOo9aoz43S?= =?us-ascii?Q?ENxela6yIZ8Of6h0bsJd/fd/eDnx3VUIetOhRNwFg48uMf6PwY8WrZgo1tsJ?= =?us-ascii?Q?HxG/ORZIBs2A9J1+uiRP0qQ971xmDHVvPmKwcnWoMULdCCPs2q6jnHtx+cqm?= =?us-ascii?Q?c2cf82VfkP5q3tazuoxYliIe3083VyAVtKtCuHeoaSa7HO3oq2CUhEP12nwJ?= =?us-ascii?Q?JtOyU6U0uHr07/jC6s+3jSrFf41Qg4JuLOVk7MeQghzf0gPGSClD+rp5U/xs?= =?us-ascii?Q?R4x3A9wsOKeWVGTer9NIY4pLMJII6Fbf9KkXovRA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EAd+Y1RTT/K4q+mIOYJ3b4mqjIx0vrgDxky39zm9ljnWu2d23uP2f8O7w4zR?= =?us-ascii?Q?2RUGe2svUb2Ony4RHFKGYhIqz5W+YKv/bU2OKtgm3xOqc2LThFXAtrIhN1QB?= =?us-ascii?Q?jdMwOUIvyhu6kizKuKIixa4j40Vn+YeS6jYwe0H8xJyHDMDVYq3Cg6kwCAYt?= =?us-ascii?Q?eolySS25YZaESU6GuEe3BMBpR36aXz7jMuQRSGd4DQWvMjr1pPIsYxERfgAP?= =?us-ascii?Q?dRAwda2++bRAKu5D+JDmqA/pniQUM9N3Dl6e7tjkv1m50Z40E2mC4a0iI0TH?= =?us-ascii?Q?Mbbl6ScbKFOt9ChMzRF840y2R5IjMw0gwtdSsWrQpbdp9XlWsSlmyvyZeLE/?= =?us-ascii?Q?Cw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57b05123-cec7-4517-fea0-08dbc54c77f2 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2023 02:40:42.6487 (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: Kg2MpBL4I40VeVcwwu5OV3Sl7hvBXCZ3rD0PExRIbxskke/286V2BbTbRl+4sD0BgR8oX3kH5O28okrW7Acv46V3stSlqE90MrUPUPCIACc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB4780 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 | 28 ++++++++++++ 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, 156 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h index 1344f8c002..b217d98c31 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") @@ -320,6 +322,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..2ae2f28ec1 100644 --- a/drivers/net/bonding/rte_eth_bond.h +++ b/drivers/net/bonding/rte_eth_bond.h @@ -385,6 +385,34 @@ 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 member notification. + * + * @param bonding_port_id + * Port ID of bonding device. + * @param notify_member + * The flag of enable bond member notification + * + * @return + * 0 on success, negative value otherwise. + */ +int +rte_eth_bond_notify_member_flag_set(uint16_t bonding_port_id, bool notify_member); + +/** + * 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