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 EB9754378F; Tue, 26 Dec 2023 03:38:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 661BD402DF; Tue, 26 Dec 2023 03:38:16 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id C268E402EC for ; Tue, 26 Dec 2023 03:38:14 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CRBwNh4r5uKW9//EgQZpZRQ5D8/Hote5+EbFedaeqE63VeAGs3ZDMXMCHYZMV5w6glLdHswUBaWn3uVv5Se3xTIl9L5NkkLQqMfaI0zOXqKRi2f2K6Cu6zYT6oVFBy1J3nAhRqDkYEH9GB9UhK2gN02QkDOIhHlH0KVUHTdVNn1vIYJvlRs25Ski+ZLDgTyjlARxu/qu7efhzVaztr4kdSgSX/84cYMt3R7kIbFQZDC5DbUYX9kBRdRO/kreUZquphXfNIoN4E83shUHDTj4gALrXXEV7ihaYm1hLj1Upu3ilN2Hu6QMGAzZfOOTcc+78X04KSxsgvYe6coRLRL12Q== 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=AjX8PEI5ai1ucLQeiDrGhReh+XaOVMxUFKY+zAhWpmo=; b=nf249DkMOCohIACUq1V/JRy5aP16Ybkl0boGgKaqqGLOY1OckHUQx7uuz4aTyOw7JTDlUV8Ioqh4YeYWqjxSUcJao7EVY2REPvtrvmfyq4kMv+e9imHJMwjRBoETj0mX53BYe3xkBVPqATXPQDLuFTW/gn0d2RzwNcwpAmaJWM+ZqJXC4263qfZs8rR3GqQYPVT7bgszICUIj3XMsnbUKyd1oG7galxn8Cjlj4sUg5nNqCEWoJP77Th1PNXU+3LLbib3mczMDIoqdTimlrBgUTRVs6rkCXqbQYhsR7dxfbhWixBn19RI+jbogGIqnsg/rej4AGvy2BRxMUeyohSxMQ== 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=AjX8PEI5ai1ucLQeiDrGhReh+XaOVMxUFKY+zAhWpmo=; b=c/6XsJlnbRmXIzmedGyDTABASVCspRKblrcPSVKg+vVPoXzMijJnbYsvwdnPHR6wH2Xiafa4GLEb/zyDDUum1+Sqj3GzvPyMF3R8er3he5aUd/Wty0DHK/aA8eed8Vb06aZywrq1ItT1QQvg/uHBW+mHjUWZSmv2SROT6B1Y6DM= 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 MW4PR13MB5864.namprd13.prod.outlook.com (2603:10b6:303:1b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Tue, 26 Dec 2023 02:38:13 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b%6]) with mapi id 15.20.7113.026; Tue, 26 Dec 2023 02:38:13 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , James Hershaw , Peng Zhang Subject: [PATCH v5 03/14] net/bonding: add bonding port arguments Date: Tue, 26 Dec 2023 10:37:34 +0800 Message-Id: <20231226023745.3144143-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231226023745.3144143-1-chaoyong.he@corigine.com> References: <20231018074821.1908906-1-chaoyong.he@corigine.com> <20231226023745.3144143-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR01CA0156.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::36) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW4PR13MB5864:EE_ X-MS-Office365-Filtering-Correlation-Id: 76f87700-dc90-4a34-8767-08dc05bbb4c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aBucQLh2EgbDUkS74f7ABXtAg+zAb+7Ry/KXL6FOiLIGJmnAyBCZqJcJZTW6FNjSD58GHu8SoETrmW32o8nXZy64aLGPTNMjYAstlENQE38B5kBNj5l7/AoI2cJoOnx9ytacyA78bOivM3gr4zbZCqXjKKX1pG/eUswn2zoGGxiF9QXIrdaGIlU3X/apJa7HDeJWEk6fartn9V/9vlWd+Z4ndId5KCER84LQ8tGGj7kniMBxqCheI5ZOr9wu3MONGhz1jXZ/tyH5Zr6GXaGj0lJPUFaevJioeyinyrii7jvnzHnyWV7wSz2hSPd0fTa2Me3fVR8GOq7k2iSnqCCY2TG9IgzhRB1FiyEOewPDaJzXA/9fnw5t1pZYprZronOYISpz0P0RE+EbWh7ASjjUhbQY/5wQBCC6MlVsPmwizJEn8hrTTZEsQGvKxNif+jIpRg9L2nfNGvUWV9eUbh50TFfceRtDsv1NmpTZ1gaB0lIiMYUX+ub7oYgOx2MDnr8qU/65uaT4E2AIEbP20nKnuZIv9dcOuq0SQkYgsyGzoswvVqF/7zt8JqU2z3gDh0+jy+ppMwBh1RE9L02EMiQ/LzulhpVe/9z05KPSTuGDRUFOIDxN54J5/M45KgL1awSqIy76Q1l9+4osND4fSFXXSy4Tq98oZ6iT0zK3NkCGBMc= 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)(39840400004)(376002)(396003)(366004)(136003)(346002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(83380400001)(41300700001)(2616005)(38100700002)(26005)(107886003)(1076003)(316002)(4326008)(54906003)(8676002)(2906002)(5660300002)(44832011)(8936002)(478600001)(6512007)(6666004)(6506007)(52116002)(66476007)(66556008)(66946007)(6486002)(6916009)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xQox5lyFg2IP2zmSNhug4s/SxSYPB397hZNwO1bqMyv2t2WViukeocUozB0r?= =?us-ascii?Q?xozxaosXoEyoFgS7i//asO826zG9BV2qBewORtSTv6Uz4lHT/DUlwyRGjJsE?= =?us-ascii?Q?TfRd5C+VikaRsyafSAmLWESePfAWItoBLXPOk0yGgh+0rMXgw5OIzFR5fes4?= =?us-ascii?Q?QrhmO+0uXrGdNEBJ7dyZ29Pg9orbEVPyx9x1nSpsPvqccKQIu/Uu6RvZXvJw?= =?us-ascii?Q?VQ/KG2K9OMR8abQInufW95Uz0XHPStOqcILBzCVX9JJo4Ua8xsiJpWVihTOe?= =?us-ascii?Q?RPoFBEI4d1BGX45ZiXAT8XFHDxeZgK5QZRDsAGzTi72r6yEipskK2CST16Kl?= =?us-ascii?Q?JlqVQyTpevGk+TdI3dLADTyw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JCdv+/jAKN9A/0R37a4CMjv8csLkrE+znK2OC3ro4uFl3U7qbqSuEz+xbQ0?= =?us-ascii?Q?utBLSrPXctdQZEasFQAfq6ROc4fif/SiuWpwAnkp22IlCrzJkIvnWlSMt2IR?= =?us-ascii?Q?NXzgAdpGRt0zusbxzTXvSC2v0P1i9haaWoWiFYGVWCleOYsXBYp2G647IrZG?= =?us-ascii?Q?p5AXbnH9Mrl+s68e005u6sG4vf1albtCZf0Po7CMNV3PuGEosT0kjDaZp4BY?= =?us-ascii?Q?prauCBpA7WsGovoNWB0mdGlWYLt2TGBOJ+AYsy1jMdVbyaUci1Ul6nS0cjDX?= =?us-ascii?Q?l8KPv9WNqOY6oT7jg6jOPWJTO2XXlUPQAX47ZlTsSFJZEu/t9RqS0MhyQynw?= =?us-ascii?Q?wA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76f87700-dc90-4a34-8767-08dc05bbb4c6 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2023 02:38:13.1250 (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: pDDTtv+8CVI7uGJV5W0N/W8rcBLhia99+yfgbSe3q2mDv2d9AIt+bqcKE8/ruAyG0E1JjA6VUI1t7hHbg4AjWEhr5OWGUP8XTNMyi/OelJs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR13MB5864 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: Chaoyong He Reviewed-by: James Hershaw Reviewed-by: Peng Zhang --- 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 9a8bed0346..84dd39b12f 100644 --- a/drivers/net/bonding/rte_eth_bond.h +++ b/drivers/net/bonding/rte_eth_bond.h @@ -351,6 +351,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 83957830a9..32fa761baf 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) { 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 d2c890075a..b3a37a36c8 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -4246,6 +4246,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 = @@ -4283,7 +4340,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