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 550F8426D6; Sat, 7 Oct 2023 03:35:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 50F1B402F2; Sat, 7 Oct 2023 03:35:13 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2091.outbound.protection.outlook.com [40.107.94.91]) by mails.dpdk.org (Postfix) with ESMTP id 6AB2A406FF for ; Sat, 7 Oct 2023 03:35:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mp9zn9XXvwf+z2Dc9luUFXkBj2VR0B+rZRD6YMABIKSGg/Qr/lJRQrwAFbzbBsqbx8xFoT7H6kF0AAb8ADEZVflNvqe686o16DF50uJ+IeDEoFG9L5rArmLAWL4j2wQhnN6I4ERtzEw4v9UKBhd/xFm5GoJqPbgo4Pd6aJ3Y4juQo2kL5sR0fn78D4D4KMzjQmZPN24xYAqnGFp7urzEuUacp0fD1kaUq9uLbx3sav8v8actuldiN3JE5vBGwcOA/u7d6pUwvW+fz6nhVOe2ivxOjJVH2LMB1CMSoZJ8iMxVxqR1Bdrfy90gnKdc8/2C+imznONcKJF8h4mgPnAGGg== 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=jfUFje1UTKAJOptVGmvPeyrtValsBYex9J7ZD9S3J4g=; b=I6wnVoB9yJ/3mkvkAtDLeJbzKvoTYYy1njMDLicJu6P/3wLspAmyU6UomcytSXSM753hXT7Chk14ZAP8rpTLelLuF1qJdH9iwFUV8ZQ1pdJywUDQ+d/nNy9F1nFfgJ2OkmfhbUsv1IjxsEOpEAgnf2P1+L09swA16cqvjByYJxiqoI8Eoi0HYW0Vt/Se5cRPJ+nHFr7kbG1EvkNpTd1/o5V2dYs0JEpysKFbcyB39XbK4T742ayJyQdU9bATEMS44AM4U06n/ZBprc8yYgir2hlDOT56be0QY13N8g72d9U7uyxZBUyUbH4t0SQch5w+tMUM8P4uJEmzFFgbNqXilA== 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=jfUFje1UTKAJOptVGmvPeyrtValsBYex9J7ZD9S3J4g=; b=u/PYHSWZc1KGrYYT3gozZvSWTOENuFtZTiE9nLuF6MDjlMc2K6HJ2rZmOX9XWJaDFS3tQRBW7CkRlJAsPQi9qUId45eIPIC0kSxTzHa5gA38qJ8Jf1wiVu2IcUo4OdqbkCu41hRljAOamvQBbgtbt0aHJ+M9XukOs1t/+aRLaHM= 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 BY3PR13MB4913.namprd13.prod.outlook.com (2603:10b6:a03:364::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.37; Sat, 7 Oct 2023 01:35:09 +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; Sat, 7 Oct 2023 01:35:09 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , James Hershaw , Chaoyong He Subject: [PATCH v2 4/8] net/bonding: add bonding port arguments Date: Sat, 7 Oct 2023 09:34:36 +0800 Message-Id: <20231007013440.1309422-5-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231007013440.1309422-1-chaoyong.he@corigine.com> References: <20231005024012.1279810-1-chaoyong.he@corigine.com> <20231007013440.1309422-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: PH8PR20CA0008.namprd20.prod.outlook.com (2603:10b6:510:23c::18) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BY3PR13MB4913:EE_ X-MS-Office365-Filtering-Correlation-Id: cacfced9-8142-4bcd-1caf-08dbc6d5a457 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4RnSYCDh/61pP8MucuEbFiCzMe366c0HN9bnZo51tmEIzoSOQIXa1BnmxguWSnChAbWPSeQOnuP0PXeZoicAG04az7+Q866GICGXh9BUZEu+hTu2lnvBfwq8T90pPCZFcELBNq+pW0CBBNEodZbw0lxI0z9zpG8aRhr8vvcAljKIMUB0rNHCBXZv/LoxbyqSuNxSQ38jpCHmWOBX7kN+W4qfqsDUXu+8+2dL9exZwRjsNr1BxTp/Lvk/kYEcr7j9sKPOQ6PVbG9WFMWg3Pr3jS0kMTA/IouNSQ9tjnS6kW3xU2Oyuk1J8AEEqa74vLxcvtDn5qOGY5pMPAO2i+JPmadTUWRGRHjyT7soiom2DXRsz21U+Sujtu3GZBcgH9xOBkm4bK4xTzBzyNFBuJWoWHgceC0+fuXIsv6MELaSuJtVxZBMCegCmoFGc44gVXPynhYrDra8Dw1AQ4j39wXM0Mafpp2muoJ39CaBtbkbhfshV1hz4BkdlsfyR9uBI4tf6kDpNjNjcqyuRgwTVQfluavyL+uQl29n5MFzMOK0qYYMvChND3IKznAvhPPoBVPy0i43Vfv+p5W5HFu3RXAyRpov0mviiQi4oxb/4sps8t+h6ak9Zh9x74jZEWFmiQJp9aDyAhIsRGYe6vLSL8NScdKj+zfXNSd+xrq0Ny5VNzY= 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)(136003)(396003)(366004)(376002)(346002)(39830400003)(230922051799003)(186009)(451199024)(1800799009)(64100799003)(2906002)(44832011)(8676002)(8936002)(5660300002)(4326008)(54906003)(41300700001)(66946007)(316002)(6916009)(2616005)(66556008)(66476007)(6666004)(26005)(36756003)(52116002)(107886003)(1076003)(6512007)(6506007)(86362001)(38350700002)(478600001)(38100700002)(83380400001)(6486002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?dKevDt5DA3llqfeCtbMeWMY99qe56QoKM+Al2NMW5gP92KKsSQXs8W0VvzvE?= =?us-ascii?Q?taVxixJDziEYufm44byKYXAhvSf8prblkALdN50Z3eHqYquJKBkujtDHCahS?= =?us-ascii?Q?BplLo6YJ3ySgd9eGhmIQe9HWpRM+oeismuButB6klo20l9aku6btRVZASPgc?= =?us-ascii?Q?85giig5YMo5DdiISR913EvomWUzqynNdme3WaLIR73tfaGEQo7IxIguUeg2d?= =?us-ascii?Q?unH8K+n2GNsh8arunLgqZ2P//NRuXuTBvr2RO7L3aMUbozyMy4WUNkUoUcVl?= =?us-ascii?Q?9/4i6h7iqc+ePplYWd5z3AeN/ZYkrdCYWAQR8mqlI5ClWCms98FvcLdiBjqw?= =?us-ascii?Q?YkIO9aYdwJYH+WkLmBGe4CqOGaC5sVBC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tHgIVvRaUUQjDNd5GM9Eg1JGxtpRG+tlNK/rHdYXCGQ?= =?us-ascii?Q?ukD4ULdcRc1JTxSGI86SlQpiHg+p8BiM54S+5NZTrh9L5Sc4AeWqaxvdiItL?= =?us-ascii?Q?f4kwgUN5AykuivNpCQqBKcKouFwFXUpb7Ls2o1yNxILolNM4T/Vduvy6lq/A?= =?us-ascii?Q?4Qmau0K7lt8fy68dCvSU4o2R87OdTLp6bh6m3ClKo5CDgVibCbB5do1hDvgV?= =?us-ascii?Q?e02FV9JBuRmNiwbof9okNB7obkfCraVspRbIpPrV82YVpLVofB/8xMfWsUsC?= =?us-ascii?Q?nnBJvAphG0L2N2eKZy1T7EjfHpjSICe+6WIUyeQxnD6qTagf5I/3ctBv/Nuv?= =?us-ascii?Q?fA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: cacfced9-8142-4bcd-1caf-08dbc6d5a457 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2023 01:35:09.3724 (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: IXez5rsHzoJmndOMG8jkk1icHGDmI1n/J7K84FhzOsVltwOKJ6RBF3twu5pT/V5yYDfe+jcWfV7YthyuAK07Qo1oo1h4LDx1aoQXSWIgTco= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY3PR13MB4913 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 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..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