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 3297A43795; Tue, 26 Dec 2023 08:29:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A7D88402E1; Tue, 26 Dec 2023 08:28:53 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2139.outbound.protection.outlook.com [40.107.212.139]) by mails.dpdk.org (Postfix) with ESMTP id 76C18402E8 for ; Tue, 26 Dec 2023 08:28:50 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JQXP9ujeB5Z6DXM+jnkC6pU+hShy9icwdPBvbDVDm4tDAw4y4/t8+OjswQjAAVMXLzULzfnd7i+x8AL3tl417W+E1af0mEcBlX4QXp9bAlraUfjC7UfXr87nqg6RQ5aVq1itsv6N/sOrJQ4mhB7PapS9QyOkeJSTFspTaqgDTx6HLnwn0X9ukRQ/iP0HbSDd2DqRVODKcEj3fZ4XEh3l16eILr8mhpvD90SdwIZHNqyWPT7AozY2GdMCypOEq2sxfSyRUW3s3HsA0ki5jBq/39dchP6sDV8xVV4Y6F4gNBrWUbdSowoPGyUHCDZswg/1jUrTO5iLb9ETJHbCQGLqxg== 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=R3Mlt/gSONk5a0c41z34AnTLaU7H+JWmulWXNDmQcV6aIH2UkXZ9J7wd2XOeaSzJeJjjWh98vtPqHWEqBnn7xM/xG6GC20Po090BX8jNIvjQ/e0zYQIawBumDWmabrYov30b1Ll8fU+Zv6aHML1j/hFGVbvoLui1ZQM27ll+s/fQUmx9wvu8Ms9YYN4S0C+5QdX1v1vGcZuoLHs/ysLYIrLAQj1bLLjk9rQaCDVwOpltUfMz8fuJaoUkcoRdPgA+uxzySw0jX4cmpVPl3zlgeee8ZSt1a3n14Qz4GPFWBfzQw7s6hYyhPWEhFPlY6VwtAm2g7Ier621l7Har6g4Nzw== 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=MD7ZSiz3NfvBs3nh9dR+c7hGAKcyNtfqcab8eAvEIJPzvvihtZSUIdwmyWfVrsZpYomtARK3Yvm6VU8PgCnM3YSgJZU05jH+poZ4kpLoWBo0FnOWqZH0EcuHximwiW+0no8ZbXw1LNAiNkyNsioZu95hhrRSChr191qUt6mSgEg= 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 CH3PR13MB6506.namprd13.prod.outlook.com (2603:10b6:610:1a3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Tue, 26 Dec 2023 07:28:49 +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.027; Tue, 26 Dec 2023 07:28:48 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , James Hershaw , Peng Zhang Subject: [PATCH v6 03/14] net/bonding: add bonding port arguments Date: Tue, 26 Dec 2023 15:28:13 +0800 Message-Id: <20231226072824.3163121-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231226072824.3163121-1-chaoyong.he@corigine.com> References: <20231226023745.3144143-1-chaoyong.he@corigine.com> <20231226072824.3163121-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0239.namprd03.prod.outlook.com (2603:10b6:a03:39f::34) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH3PR13MB6506:EE_ X-MS-Office365-Filtering-Correlation-Id: bbd17b2f-fffa-4a0c-94ab-08dc05e44d3e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qgVWiT6sNSUmld1ayVHR0pQ8dBDa8TYEvxYebTz7LE5wbzhc0FVKbzJ0FUtBvo09YL25e7E9G8raGyrp1XlmZf1fK62aVD2ZxG2sjkQsB2B6pPXmdxuN1G6py0G6uoC/FHNrAkwkzO7wi6ebC1g9ziZFhvotC+h7e/4L/gfpjjWsUFhhR5c3yV0daj7hIgJ5bBgFQkh3Tsov3wmAqNgr76ES67CDoTa9+9oe9Kuwj7cju7X89nKknV4sMPtTTD2aDX4eiADfvj4yEQzhu1PNt/0yOIgOF1K0vmQJoPBnTsQmL8lNPyFXux2U0J8fFCiKmiXhDfp0D/GFvv3KdPiFbhDNZvlIedjzT4UCUia4FfrmJMrL9OhSa7OgOZ7d0Tk06fTnpF7Gug+NxRHjlptrPb/wN8znP4t0wQMP1acmQ60tsqiNQzFH5hiWl0gWOMzAiVSGZAvnfg3LN2jDGlZ5XdcrdXqkowcCLoD7j9ea9kG+7jiO2athcL9Kkj1ccIWIN8eS7G70ICAxDMkNbi2Aes8rE4QOYZo2IRFI/xY9GcqEYHkAlshZuSLV7wqHexnjGXt6kp0NadKHhcqvfUY+pWoP1rklWp0fJejZRczUvR5bOTQ58IPfI0aoKPW/DAfrwRX3ijELPjTf/6hOfaiho8QN829NvsYoX8eiKRN2CgI= 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)(376002)(346002)(136003)(396003)(366004)(39840400004)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(107886003)(26005)(1076003)(52116002)(6666004)(2616005)(6512007)(83380400001)(5660300002)(44832011)(4326008)(8676002)(41300700001)(2906002)(8936002)(6486002)(478600001)(316002)(6916009)(54906003)(66476007)(66556008)(66946007)(6506007)(86362001)(36756003)(38100700002)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1HTsGMdknv0OEhTtRn8Pn6Hq/JTulWQvEvnFIZAH8ftTy6MvK8++gVngiigW?= =?us-ascii?Q?lh05SDeftLMLFM6lzHg+A1tYYb0NgT0Sntf3wV/zWIegVCAFuJ+bEOCKSE5v?= =?us-ascii?Q?b+ZePLv0BWEA11jxUOul91mJHEbCIcgAXwrwaujOEzzR+aOd2rrI+TIdQdZU?= =?us-ascii?Q?eKUjFxmc0t6uhu+RBjabZ0J3ni7Bnenqe+hC8uDS94qKc6AiIbPMDt5gqt5d?= =?us-ascii?Q?6Qs3W8WEmKhkp1YoshnWr6cz7kyAMmywmAIi3C90Q+od3ATsalUJns4nr1/p?= =?us-ascii?Q?uPUTvKPI2lJeP1Qhdc0t9/KyjANPXr4bzXqInXCkmDCtxayWt3ipQOE3UOV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AmYLPf9anGae75T8gb6hgEcLeSh8BA1?= =?us-ascii?Q?hCMICRdr1JsSWzfSLPyovmHQVFC7pnnf5cabyEL8YSw6/HlwVqAlpnIUiwLk?= =?us-ascii?Q?rMDQy11bkAcr9Qy1Xg5i2+o8C+xyjlnHIscJpre4VgGazIu5Mf27PjbKh+a7?= =?us-ascii?Q?RcAX0IZ13L8P6SBk7FTB3xpC63Brc4ESY+hCGbr+KcJysszukqWSQpoQOwZu?= =?us-ascii?Q?0SEsYOqDGiZ6NRoKBpP6PMS+erToKJdX0FCB7IgcGP80+uuPjIksKS9lQtaq?= =?us-ascii?Q?Rvgyp47CBDlY7WSrp6QgGNvnOsjJEVG0r/Ph3qqI6dfj9tmGlDeYBhX2AONa?= =?us-ascii?Q?6WGmNGYwtt2vY+bXXzKjEWIagd9Gr+88zZPfFt9D7pdbX3gX0JvfRpTIXQgO?= =?us-ascii?Q?Lg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: bbd17b2f-fffa-4a0c-94ab-08dc05e44d3e X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2023 07:28:48.9333 (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: lXEhha89PsMCc1haV0KJODgPh9IPPZnMlxq6xwBY7faPbWQUpM4/8u8P/dEaQkoaJOlExYXhVwxcieVOifksHtcDcXic4B/IeHb6CiX/qrg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR13MB6506 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