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 312D643196; Wed, 18 Oct 2023 09:49:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 452F742DD5; Wed, 18 Oct 2023 09:48:54 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2138.outbound.protection.outlook.com [40.107.223.138]) by mails.dpdk.org (Postfix) with ESMTP id CB454427D7 for ; Wed, 18 Oct 2023 09:48:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k4MuCJFjJRTX84y8KuTan+xDgAHxnxviBldjmvKvowBO4cjOCyFOf/DCOKr9gdk2bhUAgQk2eliyRo/xzHSL3XJ0haqXKt90mxhAdNEYtOYVV51oeRKa2kRcBkomaQ7J5RKUOLKguAe2xS2z7i1d2bZbJptn3wMU4qTG7tLyhScmrWN3iQw24/Ifo5/OFwUoaGnvsy48huS7wvTyCVU+ZJylh5G/5wJEsjifx5LLot1EipR90NtRgSZP9hhpeW9GvgWhsuz/V6mPnjo10KcgBAO6reg02RrgO76ozNb0JUglH7EiwDyhyD2sVRomrtGTh1G+SJ3QcpMIYjFvH5Qbow== 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=AR5VQq8aPNf5cG2iOYZG3RLU4ntcserrzy1cYyEeFv4=; b=D00FDP/xvnTnxUz8r5NR6pD6/d7h6s9ipNiR+UXUxjCJvRCaS9fqYyh4cv4oQPZczj/2JYiDhk+16FB8v+AQb0D/d48THdjmW3iScl2euLj3DaCkZ5LkMHnzj5xoPtOxdXX7vrOBy/gsb84+qBcf2fIR3wZONtrsUn3ZZHmXtuK5AlO8dm5EleJRdbFt75bpV0XwyY0RDl5QZXy9O0s6VhcqRmR/oPHAZfe8kqhKLBy7+luUgXWSTmlbz66qKq+E58RYJkEekoQ0bNsRxXB8C7ioCPy/7xMvuf9/z9dBumIcJf90StZ2LJCZ3PHaMsRF4EojeSfQvwyp7dhPZLqvBg== 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=AR5VQq8aPNf5cG2iOYZG3RLU4ntcserrzy1cYyEeFv4=; b=PLwRpd20PzS2zwZMbm8KLpGNZ+KUL+p80bvyDrEVe5qr32/SctqHiJmMGMQSnBYAIglO8UcApsO4mnUGdfZbmV5cP5qU0wF9/aq1SK5t+38T2a/IFonH9IlcO/hQGnV3GaXPdbO0D/OQgNb40OSvJufLvBGlOig/2LEyQd08iGQ= 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 CH0PR13MB5188.namprd13.prod.outlook.com (2603:10b6:610:fd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Wed, 18 Oct 2023 07:48:49 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::142e:d47c:7320:8a9d]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::142e:d47c:7320:8a9d%4]) with mapi id 15.20.6907.021; Wed, 18 Oct 2023 07:48:48 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , James Hershaw , Chaoyong He Subject: [PATCH v4 3/6] net/bonding: add bonding port arguments Date: Wed, 18 Oct 2023 15:48:18 +0800 Message-Id: <20231018074821.1908906-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231018074821.1908906-1-chaoyong.he@corigine.com> References: <20231008015041.1551165-1-chaoyong.he@corigine.com> <20231018074821.1908906-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:195::13) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH0PR13MB5188:EE_ X-MS-Office365-Filtering-Correlation-Id: d3cc9902-ccea-4a3e-a231-08dbcfaeaa1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7UfBVW8bwlRrr/iIKWO8nO64AVLY1O1WZvRKEtom6Njtx13OQsma9RsrV484PE6Mv7KHxvy+2y8vHAgwy2OsiSAKqZ5zqFJEq3EDEBMMQsF1dyJDCMRiOBfw+z/m22CA9yNgnG+bXxtTYmtp71hiQRp6Z4kRXoQh81RYkUag4ZZZkCGOhJYCv8ascrvzC/AeJ5Av3IdfngtNzkKv91mkqF99yPeQWQhDDVMIlFxYu+WzwOVxCAR+IsiZbb9mL0Ava+XoK1TP7kr+907gELm7S7U0UiL3FLYJ8USRCx9xAOs1saFolefdjrFgRhbGqF3eRvdzmim5o0pfjy9fmdceQfAVYxTsPJH7Ol1Kvu5m9J64RcnP9RuuF/aWeODMbU1xTYx1hCdHruNNTWFIlim1V8dF4Q0fSkVj2phV2Ytcv6m3GS1vlv6KT3lTOnL0bd5UorpyQafaBEs806mBjkxH+kvj0nlnk2KP8gpNjheouzRLxvaKy4ORgdcz2ELkTTqMWFo+i66INfcW3wwk8/BG3YKRTQhYRepP6gvFRZ6Zu010+kjnqyRyk1gb8AV3VL82i0b7JW9hRf+ixxCiKVTAAbHdXVEytDpUJ7KX+Xizwvui3gYuVEIxGaXkaDO5mw6za3zKQIw5+bZvSoDnrbk4vAptVFxdV65EatFr5tjHDTw= 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)(136003)(396003)(346002)(376002)(39830400003)(230922051799003)(64100799003)(451199024)(1800799009)(186009)(86362001)(41300700001)(5660300002)(8936002)(4326008)(8676002)(2906002)(44832011)(36756003)(6486002)(478600001)(107886003)(2616005)(1076003)(26005)(52116002)(6512007)(6666004)(83380400001)(6506007)(38350700005)(54906003)(66476007)(66556008)(66946007)(316002)(6916009)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?EV/JJqy4FCXPSaFTBx/Ng4Bdlg0qqENfDDV+LgXWG4lYej+NdG+JImfFTd7S?= =?us-ascii?Q?Fku3kY7xztv3HYi2gf5UAJ9XXlBAcZeuHPenQHiXeDXXOoBJ37LQ7f6lpcIt?= =?us-ascii?Q?vzogiFVxlykP5NErE7TPdZ0WJ9xiRCXK2EuWwxHivtWDHFGjBFHV0QrBiTMV?= =?us-ascii?Q?ESzMfY9sSV9H7BbcXss8InGKiw9Ne3QcQDLWPwQEtz1u0n6hZbAVxP0N60/Q?= =?us-ascii?Q?ig3BEI0Tqfd50AYyoaGllTuq9idJSGS7rW3XVFR41lhDLXM5HbdWQLoJWKAn?= =?us-ascii?Q?utaZsM6hkOWRguDJKHAojDh8VpfxSQYJIIfQRoDFtCzEZH/Av/A3DTnPtEiq?= =?us-ascii?Q?pxFgGVfDA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?us-ascii?Q?SfvfNGlGM10dNCAYkg/7/iuVRFboTIojQfZkMQtLUW4XzgWbWM9M8kRHwnmp?= =?us-ascii?Q?gaGSIURvqNXNtWlZbcom9AFk29c1W+SctF8phSko9lLpbESvXuAcfb5vqKtt?= =?us-ascii?Q?W9laxBevYc6th395TC0trFU700k6E1T0vBQ5Ns4tuGrB0NCggxgg+kwlyiVI?= =?us-ascii?Q?RDpw5c/QWtiC2a29qJJkRoC3WTMkBjwf4JV09EllucrpOpek2vfSmwIkeW8Q?= =?us-ascii?Q?DW2KMVA5nd1Q28663mdT/gsf68lZbil2tTzJBuwRWHX9k3wuz1ypjh4I1pNM?= =?us-ascii?Q?P1yxKQDhvXaSi1b3hs0VheGjQfD/V3ASGsB67EaxZD2zwtXLZF1GCc8EWmyC?= =?us-ascii?Q?Xg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3cc9902-ccea-4a3e-a231-08dbcfaeaa1a X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 07:48:48.9699 (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: 1agvIpQHYFQBxnZ6rx2f0Db69FKSFtRVQFLkSa1J/y+uQQ4lsG1dyEYb/TgkbJYwo6svNVbebvJhapLC7id86LiZsHLGYCK4jQz+5KIaLq4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR13MB5188 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 987269b323..936ab8c3a0 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 317c3c1542..656ddd35a7 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 fc7f0f364f..4bede0aa71 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -4232,6 +4232,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 = @@ -4269,7 +4326,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