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 B485E457D5; Thu, 15 Aug 2024 14:10:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CA974027E; Thu, 15 Aug 2024 14:10:20 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2089.outbound.protection.outlook.com [40.107.247.89]) by mails.dpdk.org (Postfix) with ESMTP id E08834025F for ; Thu, 15 Aug 2024 14:10:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VQ6WuMHMroRIJPmXKWv+cAGjt/bk3YNTUABiYH67q5XCG8X8T8bAb+EpAZx6KF42NJFYep5tH2GZzmpz5Pq6cXGJ3bhhQZUPhK89MXZdNwXoE/oK/qp9TPLMU/ADPEUbz1jhuzGQvwH6NhZRXiMoFC92konHUlIc6KE6cDulcluiMXku0sa/bMQ+zbwTSCEOhsemnGcZ6eberigUuVWjGwiy6MtxZr09lLUM2qKm5SYhkqAqzEmC4HWlkDFJXDZk/DSTHDDwkECxSkrguEufCgSB66CapiVnotlcr2syOaBempydj7/NoYazzcECy8IKvoi39ajaYxCaG1+UUhAjCg== 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=9QWBjUIcYzYKyaBsbGx+Bv+3VSSRMc7wHLEL6qJTHBk=; b=NBhQnx65q6RZggBcgu2MBiL549D2e3QMeoMzug7OFiyu2LHculS6HoU8QIlhV5SbQpi8PrD1ruGw4OGUS6i300QEKjQ1bC/1liBJlW+k5vrncs2LXSIjrlCBwkN/k6baxy+NWkCCpbIBRj8YhPcMZOGh9ftpN6IPpU85cU6UP17fASNutBHKLlhQ5NBbbYIVIpAtI04ASD5rU9oeaJfdVA5uiy1j8rY1evsgOD8KYdCcxpyHiE0KfJ/P56LlaY+I1S2/yAVEEFnntw6AJ5gZ47gAc75uQNbRjT5WSC9a9Zox0sT0BRLFPO4PSkzJII5Hx2kY47pI0D9EnMW36H+h5w== 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=9QWBjUIcYzYKyaBsbGx+Bv+3VSSRMc7wHLEL6qJTHBk=; b=LQqap3qkRIP4H8kjKElFHFTqmwNkrs1NMBJLi6w6AQ7gxzMzk1PYuMAHcp08Yq031Q38F/b81m3WQOw2tF1ul0ZX7UbR3DhoTFyT5xF8v9d4gI9FzmI5YLy2KVUzkwZp8e6uNuDdrYy70fd8CEfxvY35ISzc//nfGx7eIF3ez+38sTv6H17eKgDyK3Di/1WZ97ITCdfDTCUNlM5zADe5/3l4nMhKCAia0+jak3eEvBZmPl4QYWTC+cso+jzePHkYpidFf/4YWRCjLJBjSVzkusleJd3ASliyQXNlEITO4UiH0EuFPCEui43S6T+aGk73dNgzsgnKDkPWxN5r9hA2zA== Received: from AS9PR04CA0080.eurprd04.prod.outlook.com (2603:10a6:20b:48b::28) by DB9PR07MB9907.eurprd07.prod.outlook.com (2603:10a6:10:4c6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Thu, 15 Aug 2024 12:10:17 +0000 Received: from AMS0EPF000001A0.eurprd05.prod.outlook.com (2603:10a6:20b:48b:cafe::3f) by AS9PR04CA0080.outlook.office365.com (2603:10a6:20b:48b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.19 via Frontend Transport; Thu, 15 Aug 2024 12:10:17 +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 AMS0EPF000001A0.mail.protection.outlook.com (10.167.16.230) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.8 via Frontend Transport; Thu, 15 Aug 2024 12:10:17 +0000 Received: from seroius18815.sero.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.65) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 15 Aug 2024 14:10:16 +0200 Received: from seroiuts03116.sero.gic.ericsson.se (seroiuts03116.sero.gic.ericsson.se [10.210.134.60]) by seroius18815.sero.gic.ericsson.se (Postfix) with ESMTP id 451C34024CB3; Thu, 15 Aug 2024 14:10:16 +0200 (CEST) Received: by seroiuts03116.sero.gic.ericsson.se (Postfix, from userid 7401342) id 2CCAA6042490; Thu, 15 Aug 2024 14:10:16 +0200 (CEST) From: To: CC: , , Vignesh PS Subject: [PATCH] net/bonding: add user callback for bond xmit policy Date: Thu, 15 Aug 2024 14:10:14 +0200 Message-ID: <20240815121014.612170-1-vignesh.purushotham.srinivas@ericsson.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001A0:EE_|DB9PR07MB9907:EE_ X-MS-Office365-Filtering-Correlation-Id: 276bc672-f799-4530-c53a-08dcbd2339c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?IxEBw9g20Flx/HOSKkgiJl/dnn0ccnnUtqFs4zjItyLid4DPMh/X8LYW/SQN?= =?us-ascii?Q?RHkesB8gbkjl5Nryd02u5+UsOxCPM0G/iDEo1hiSrzvte3igNqhlVPQIBcTX?= =?us-ascii?Q?BJr7VJJPXY3HWhA0IBErYVAp3Bswfyw3j7NqoD6/3DzwFAdjgEPGbibWpcQg?= =?us-ascii?Q?jupdC3UEFAIVNMFL6Sn2V7Z/xVwpNbqbBfX8wd11emtkgOMoz8cSMem9pEkh?= =?us-ascii?Q?lEM22UyDrjGdZW88pq/oxnAUPWW0MOEre9nKgm/YdjUTV7NVp3ikVuZ/MrBF?= =?us-ascii?Q?4ktAml6IC/xq1NdZvhQY4UN/aMdtCCjLnhDe5dfvGSaySrCWTveeYlMSRPCT?= =?us-ascii?Q?LhYScaLurNopL+K5NvARq974MwNEq2EmrEA3VgEttnxaeye1tAGmQX2kd8GO?= =?us-ascii?Q?ullcLDSrrxWeyoIq6CwdT6KP07FF3ToEUiU2PXampbrzhH43tkR31U6Iikmw?= =?us-ascii?Q?DvhFKTD5liAMLPZ/HOMwfUqVRIYcCiRuxkVzOyetyOSKaSHuRR/mb5BJ7bic?= =?us-ascii?Q?0iX3Z5IQ7ZFp7LXO9xMI0QQZ0bGulkng02TCix5aMqEfNXYpha0EEijeoY2c?= =?us-ascii?Q?8xUhYiRg4vsDwaJ7mjfI9UM+rUF2KPoYDcHU/EqeXBw0tHBHCwq5ci/4TAF2?= =?us-ascii?Q?dSd28I5tJ4amNTivVzC1WOp5aQ8qlAvE68EbcjNuQsjK9nHC8Ix8dd/u7IZ3?= =?us-ascii?Q?f1LzjQB7zCPj3JUCuNJPzwu4iwdkKd99LpjQDcC5c01k9+eADHBPb3JLSmDH?= =?us-ascii?Q?ruIXsYvoQfW8Om7yMbO8zUFTzTMBklhhirtSh4tTISK1kRepIhUkNNguImV6?= =?us-ascii?Q?3Y39eNuer63Ygj1iE1GceIqQUHCsPcbiTXFbon8lIFaeLPzOlOmC5tMElmxQ?= =?us-ascii?Q?fchOhbjl8xtBbwC+N9lJrC2b42JydfeYdlXlu2UchiUbWosbrtCIV1U7m8Hu?= =?us-ascii?Q?J34d/3yMY4nmQ6P5O4PF18alWmTpOyGS4Z0ravYXIYHosP0d7AjVWlKcIyFV?= =?us-ascii?Q?VXAmQegdAlLgzC1QeAPnMXfn/+S1g/bVPG0Fjca1c9DjOh5SHRRAy2tCp5y3?= =?us-ascii?Q?ZVxi1vkQ0qm6FLvW24jpeMqXlzv8u7sdHPsFbew3pfHP1oPm7ecv4N0pPeGb?= =?us-ascii?Q?mYAp7tOZsvBDl/9A6kwCMX66/66yvMajfzwCffL0AezNwqyiEocPmQg+mKS/?= =?us-ascii?Q?KlnMa71K7SRKmUr9npypfRrJuUR/JFfuj6WX0kZO9GaiHDHoJBcRbq4PYbK6?= =?us-ascii?Q?5ZogrK2N8fVf7loNLx15FV4dh/bRHKr7j1CPYwkfR1vlyjUihzsrNC8QbWyT?= =?us-ascii?Q?dTDQwahJExnC6fTnx+wJEJPe6xVxij+oLNO11+FOMBlBoNymTbVyQ6t5QiSX?= =?us-ascii?Q?/PJ1x9YyhRiO1IxUk89LpHFLA4aemqBBOEYSdeVuVu7ABmAsjiLzQr3zibUX?= =?us-ascii?Q?uq25tI6mLhUmY/Pw/pb2m+Xmg1EdWpU2?= 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)(36860700013)(376014)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2024 12:10:17.0197 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 276bc672-f799-4530-c53a-08dcbd2339c7 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: AMS0EPF000001A0.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR07MB9907 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 4a508bafad..69b229a5b7 100644 --- a/.mailmap +++ b/.mailmap @@ -1548,6 +1548,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 e688894210..4141b6e09f 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; @@ -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 f10165f2c6..66bc41097a 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 slave_count, uint16_t *slaves); /** * 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 slave + * + * @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 99e496556a..b53038eeda 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 c40d18d128..92b0126a6d 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