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 33ED445B42; Tue, 15 Oct 2024 10:21:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BC5B402DE; Tue, 15 Oct 2024 10:21:05 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2051.outbound.protection.outlook.com [40.107.22.51]) by mails.dpdk.org (Postfix) with ESMTP id EB2D540270 for ; Tue, 15 Oct 2024 10:21:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wTJzkQexUdhZud0mW3Bn7TUUkFBY3SdVSI7HXvJR747ySYmk2d9mIC4Xij49GOoFTHo9m78tA0Qz7noIdfvHA/FTI9LzF/bCChZt5Ke4ABINlsn84D2ebZWkggErgmOxVymgp3d6t0l4LUCIyJJUbjXcjldcpUSggHGdrdjkdaE555AzpAIFiEs5cb4MXPQkuM0d9qJEN0iZ/r+qrFeNeK0AaGI/s8l63R3XftokL0so2A2A1oYieDtyHbBoBEIin+KogsN6xu1yzdrY0Q5vx/AEqqHsvkKcw8CLEIVKTqXBCvqBha+DVBn/iXBuWi1M1HzC5IWoI8NnzQZbvTzkVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=rj2Ztiog6WiHhsM+gfkliGrCU4fbJZ5QZf4fhPeNGJU=; b=gpKmEiG4Ywq1KRwptH+cXcj5VxHzlbX3yjCl1Xwp9Eg8y+Ryc6rnlVCkfySjX5zfY1EIp0/OibzbUqvm3DfnCAXwzLVha6saPEDAMDQwV/B5ciGA/80pIJD+F4aok1//kFB4nBMDnfb0UhV1lbDjCeIxqty88Xd8uceCO9yLUjhm022Nb+K5WVjNf8Igx0K/TUhfRSIqKK5QxZZq/Hu79zQuCzSjmTjY2PHHhRI/MJjQifw418cXkRRG1FBXJX/pQyVI1TWJGKi7s7edo5FMhizGUzIJmuV5NaW9qn4ER7mseaLrdPyfNG0sWfdf5sNJKChszlGehTDp4GJjBoJPpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=att.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rj2Ztiog6WiHhsM+gfkliGrCU4fbJZ5QZf4fhPeNGJU=; b=dqeTqVmfjGvYF+Ke+d1C1BAY4wMixxVP/5LK5F59zF+dRQvml82sZOePdaokGwLaYgAyTkfB0tc/IrtP+4CrLr8uu1Orie4PsIQ1LnMJqnewP0yYmG0tbZvWApbCz9w67XiATiL29vtLYtg/HHIKTdKXkUzYR2P5fsS/cKasccLWezfXeHe+caMdFwCcMfsxhD2eXwDRA3aF/R421Ov2nwsiKc6nTrQy4B3Q+mSeroNlP9tO/ijfExRZ5F4QCwN9ztGGjT/UOH+jQLhicdS3B0n6KLGhwfl6X6zHEQsPpgkAfLRy+j9aQobTCKZmuTI56/HydOYu01y6W7JiklBUHg== Received: from DU2PR04CA0352.eurprd04.prod.outlook.com (2603:10a6:10:2b4::23) by PA4PR07MB7344.eurprd07.prod.outlook.com (2603:10a6:102:fb::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 08:21:01 +0000 Received: from DB1PEPF000509F8.eurprd02.prod.outlook.com (2603:10a6:10:2b4:cafe::69) by DU2PR04CA0352.outlook.office365.com (2603:10a6:10:2b4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 08:21:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by DB1PEPF000509F8.mail.protection.outlook.com (10.167.242.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 08:21:01 +0000 Received: from seroius18814.sero.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 15 Oct 2024 10:21:00 +0200 Received: from seroiuts03116.sero.gic.ericsson.se (seroiuts03116.sero.gic.ericsson.se [10.210.134.60]) by seroius18814.sero.gic.ericsson.se (Postfix) with ESMTP id 0AA794020C05; Tue, 15 Oct 2024 10:21:00 +0200 (CEST) Received: by seroiuts03116.sero.gic.ericsson.se (Postfix, from userid 7401342) id E9E0560424AF; Tue, 15 Oct 2024 10:20:59 +0200 (CEST) From: To: CC: , , Vignesh PS Subject: [PATCH v2] net/bonding: add user callback for bond xmit policy Date: Tue, 15 Oct 2024 10:20:49 +0200 Message-ID: <20241015082049.3910138-1-vignesh.purushotham.srinivas@ericsson.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509F8:EE_|PA4PR07MB7344:EE_ X-MS-Office365-Filtering-Correlation-Id: d70c6ae6-e584-49dc-f12b-08dcecf24dd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Lm/dCV2ih6I++WtV/o+hpSMTPdQwQaRLCdFTaodLoYJsj5n0guoGUQgQz9dg?= =?us-ascii?Q?f9RmDddgEXgEWEtPhilqoGpNSIR7AEgt+lmx4iJUmrIM43aEcI1qznm+dNIN?= =?us-ascii?Q?BUQLw9vrUXQzWBBov9+IqfSNHC+Jgc7cf+3zhdZuhq7LvRgGey6dCSpJuoYm?= =?us-ascii?Q?XA86BVgmLT2RvqnTAWYgdSop/La+poGoRfWe/0a/YqNmcG6Sr/NGASBg/Spf?= =?us-ascii?Q?8HGwUciEvpp9k9JQu/YZPqRTvrj0ejCF7/auszcinYzteetP3tWgzUXuuOTQ?= =?us-ascii?Q?xTGIHR3GKV6MWE18FRMJTcRGHuS3KIOK5rjrbdWK1yo0RxgsPix0WIBccVmU?= =?us-ascii?Q?TTKfB51K7NnNMgCbuC5gp6wFbyKVbjTlv64WwPTHD1Y6aYGhrKFufFBaZ/gZ?= =?us-ascii?Q?Svk+YF6B4sAh3S2rtLuf/1pVVQ0bibCLccZcATearqrntMu88jh/ErubjTPQ?= =?us-ascii?Q?Jy2kKKum4RYOUucgjsuSzlbs97kyDhOdpglhwp/T3ZZgHWC0JXBMCJjW7v3a?= =?us-ascii?Q?GJhBOOUg6AbALIqeDZ1bTbezxfjW358cTl4SiiDAJ8RXhjoBtPUVZrE88jd9?= =?us-ascii?Q?pxnJ/xqqX4O0L5DIBlXNmyG7HH9lWNgtPG4EWuCGoMmyuzkDwK8cL6sqzWCk?= =?us-ascii?Q?tUG3+kwHxze7nWWsDUVgLiP2DgXfqTy02fMuFuizBRlyk5D2vZPzC7y2um21?= =?us-ascii?Q?78IM0eoBFrciAhvKc99btXjobIU4zj8vCEj37CKZoqH50Xv8lvtkHHW7MGN6?= =?us-ascii?Q?VM4NbTLOlHInd5CHLi21ygEqkqoblZcJnlOwgLttpzvtShtP7eErr/WL6aWZ?= =?us-ascii?Q?zWRZn2N0jnDDVGkVkNHZ5vdDa4uW/mgtU5aiwOlzdFnLMX4Avx7PVRCRjHnN?= =?us-ascii?Q?FrDIPKtCYiwgCytAgW0Hl1Ruguu+8X3tGWZe1DohiUnUqUn3Rifx6O2cQt08?= =?us-ascii?Q?WND/o6GhcPKYhfJTgwyrJmjsoGLv+iJKfyW9YgAxvmt4d8d5sHzGR4Omy0hT?= =?us-ascii?Q?aSt7Z1MFf4Lb4eiKl0dwREUTZZv3n6v9oCNYbXu+lKcvgFhnDxcJ4SB+8Cna?= =?us-ascii?Q?k8Ax7dd64p1MAtkj2aLF765MeysHvpy/sLSQna24vgsu7qHG1j6tdr+ni4Ri?= =?us-ascii?Q?QTs+aK8100KssqtcFCk/fVxpYjoKQRY8XTV5Fn/XBYTXlxzzzV9CrmktT0Ar?= =?us-ascii?Q?1f4D+93qSlFUOwjDCKXubXTZzvLUzFv3YrJLbSymoeOXj/zm8XjyTcNyUKMJ?= =?us-ascii?Q?aPUTtZ3RA+f2o7ur/w6vVYOUdSABGnV8ZZInWdWLrcmh0HGf1X+tGNmjQ2ks?= =?us-ascii?Q?1G//unN3hJIovqyhYM+5cQw07gvOqTYVavMax6pJWEV9e3tOA6blSjUYUCdF?= =?us-ascii?Q?7uCRszvFHRq8s1rgxP0/aVlZBA7X?= X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 08:21:01.1093 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d70c6ae6-e584-49dc-f12b-08dcecf24dd5 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509F8.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR07MB7344 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: Vignesh PS Add support to bonding PMD to allow user callback function registration for TX transmit policy. Signed-off-by: Vignesh PS --- .mailmap | 1 + drivers/net/bonding/eth_bond_private.h | 6 ++---- drivers/net/bonding/rte_eth_bond.h | 17 +++++++++++++++++ drivers/net/bonding/rte_eth_bond_api.c | 15 +++++++++++++++ drivers/net/bonding/rte_eth_bond_args.c | 2 ++ drivers/net/bonding/rte_eth_bond_pmd.c | 2 +- drivers/net/bonding/version.map | 1 + 7 files changed, 39 insertions(+), 5 deletions(-) diff --git a/.mailmap b/.mailmap index f51b1dda5d..16ebc28a5a 100644 --- a/.mailmap +++ b/.mailmap @@ -1556,6 +1556,7 @@ Viacheslav Ovsiienko Victor Kaplansky Victor Raj Vidya Sagar Velumuri +Vignesh PS Vignesh Sridhar Vijayakumar Muthuvel Manickam Vijaya Mohan Guvva diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h index 378bbba4e6..9d4483a972 100644 --- a/drivers/net/bonding/eth_bond_private.h +++ b/drivers/net/bonding/eth_bond_private.h @@ -32,6 +32,7 @@ #define PMD_BOND_XMIT_POLICY_LAYER2_KVARG ("l2") #define PMD_BOND_XMIT_POLICY_LAYER23_KVARG ("l23") #define PMD_BOND_XMIT_POLICY_LAYER34_KVARG ("l34") +#define PMD_BOND_XMIT_POLICY_USER_KVARG ("user") extern int bond_logtype; #define RTE_LOGTYPE_BOND bond_logtype @@ -101,9 +102,6 @@ struct rte_flow { uint8_t rule_data[]; }; -typedef void (*burst_xmit_hash_t)(struct rte_mbuf **buf, uint16_t nb_pkts, - uint16_t member_count, uint16_t *members); - /** Link Bonding PMD device private configuration Structure */ struct bond_dev_private { uint16_t port_id; /**< Port Id of Bonding Port */ @@ -118,7 +116,7 @@ struct bond_dev_private { /**< Flag for whether primary port is user defined or not */ uint8_t balance_xmit_policy; - /**< Transmit policy - l2 / l23 / l34 for operation in balance mode */ + /**< Transmit policy - l2 / l23 / l34 / user for operation in balance mode */ burst_xmit_hash_t burst_xmit_hash; /**< Transmit policy hash function */ diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h index e59ff8793e..2244b39bb9 100644 --- a/drivers/net/bonding/rte_eth_bond.h +++ b/drivers/net/bonding/rte_eth_bond.h @@ -91,6 +91,11 @@ extern "C" { /**< Layer 2+3 (Ethernet MAC + IP Addresses) transmit load balancing */ #define BALANCE_XMIT_POLICY_LAYER34 (2) /**< Layer 3+4 (IP Addresses + UDP Ports) transmit load balancing */ +#define BALANCE_XMIT_POLICY_USER (3) +/**< User callback function to transmit load balancing */ + +typedef void (*burst_xmit_hash_t)(struct rte_mbuf **buf, uint16_t nb_pkts, + uint16_t member_count, uint16_t *members); /** * Create a bonding rte_eth_dev device @@ -351,6 +356,18 @@ 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); +/** + * Register transmit callback function for bonded device to use when it is operating in + * balance mode. The callback is ignored in other modes of operation. + * + * @param cb_fn User defined callback function to determine the xmit members + * + * @return + * 0 on success, negative value otherwise. + */ +__rte_experimental +int +rte_eth_bond_xmit_policy_cb_register(burst_xmit_hash_t cb_fn); #ifdef __cplusplus } diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index ffc1322047..351f2c99dc 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -15,6 +15,8 @@ #include "eth_bond_private.h" #include "eth_bond_8023ad_private.h" +static burst_xmit_hash_t burst_xmit_user_hash; + int check_for_bonding_ethdev(const struct rte_eth_dev *eth_dev) { @@ -972,6 +974,13 @@ rte_eth_bond_mac_address_reset(uint16_t bonding_port_id) return 0; } +int +rte_eth_bond_xmit_policy_cb_register(burst_xmit_hash_t cb_fn) +{ + burst_xmit_user_hash = cb_fn; + return 0; +} + int rte_eth_bond_xmit_policy_set(uint16_t bonding_port_id, uint8_t policy) { @@ -995,6 +1004,12 @@ rte_eth_bond_xmit_policy_set(uint16_t bonding_port_id, uint8_t policy) internals->balance_xmit_policy = policy; internals->burst_xmit_hash = burst_xmit_l34_hash; break; + case BALANCE_XMIT_POLICY_USER: + if (burst_xmit_user_hash == NULL) + return -1; + internals->balance_xmit_policy = policy; + internals->burst_xmit_hash = burst_xmit_user_hash; + break; default: return -1; diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c index bdec5d61d4..eaa313bf73 100644 --- a/drivers/net/bonding/rte_eth_bond_args.c +++ b/drivers/net/bonding/rte_eth_bond_args.c @@ -261,6 +261,8 @@ bond_ethdev_parse_balance_xmit_policy_kvarg(const char *key __rte_unused, *xmit_policy = BALANCE_XMIT_POLICY_LAYER23; else if (strcmp(PMD_BOND_XMIT_POLICY_LAYER34_KVARG, value) == 0) *xmit_policy = BALANCE_XMIT_POLICY_LAYER34; + else if (strcmp(PMD_BOND_XMIT_POLICY_USER_KVARG, value) == 0) + *xmit_policy = BALANCE_XMIT_POLICY_USER; else return -1; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 34131f0e35..9372ddb027 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -4251,7 +4251,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_bonding, "member= " "primary= " "mode=[0-6] " - "xmit_policy=[l2 | l23 | l34] " + "xmit_policy=[l2 | l23 | l34 | user] " "agg_mode=[count | stable | bandwidth] " "socket_id= " "mac= " diff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map index a309469b1f..f407bb0ace 100644 --- a/drivers/net/bonding/version.map +++ b/drivers/net/bonding/version.map @@ -35,4 +35,5 @@ EXPERIMENTAL { rte_eth_bond_member_add; rte_eth_bond_member_remove; rte_eth_bond_members_get; + rte_eth_bond_xmit_policy_cb_register; }; -- 2.34.1