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 5F95041DA2; Wed, 1 Mar 2023 03:49:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD3E241611; Wed, 1 Mar 2023 03:49:02 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2117.outbound.protection.outlook.com [40.107.243.117]) by mails.dpdk.org (Postfix) with ESMTP id 26ABC4067B for ; Wed, 1 Mar 2023 03:49:01 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rry7VLK//i5Wz4AYrMslgLekPst5s8bNPW42BG4rmNKyJBw8hbmtZ5PSS0FcG3F0iHshYztdZmaXlIL6JuhmiQezLBzcYuVHTMIW+DikILDbYK9+eIz4VcxZK+fMpkaCN7uGbjwHA1lV2/LauxBcfqFVU/Lb0/9JRSW+aJ4zGOgaP/aJWKIs+OaBDW+BZcAihcDNbjA/wL5DVL4ehsgURCHF5PI8+830YhQIauzBjIIxtyzVUDKZdcLxJEY/eLQnazn+sqcwM9/87GEsUkHZXkUNI+tIYKk6RohG5x69fqgCSJrjnkuTyLHxGT3FJWamYtW1GZk8QPQg7oQtUcnsFQ== 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=E3tey0IjPtPqb/wBkf0o/YClWkGEfqRMuMwKtc6KKqQ=; b=eDA55VYkovmDzcspYYQt9Um4txqm7EgkDetk1xsU91gHmnu6WN3tnzBXJtbm7ZSKtGnP+7XXPqywOjJfofLISqIbfV5PcjrW789WBZzZkpx6/J5ohDzPYBYaSgzPO+uqYY+tkhSJBBB5CLJRqGB6YYd8X6PVx2uHiefQkWrhpuszkyl7Hlq+qwdNh92HJEea/MBQ+TD0v7aWx9VYZzJitozjIKP2sq6MzdA1xz5oPgJ5gIAYWx/w/nkTbiKsQKid/AoL5BoLBLE/5NfVnE+ei5aImxprEaV96tMVadqkeUx+Sq6jTMjYB+WsRx5aDIZBeWDlH4sF9guJ52I3xKIvKA== 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=E3tey0IjPtPqb/wBkf0o/YClWkGEfqRMuMwKtc6KKqQ=; b=e7SpXXyNbi/ZkKFKH2u1lP9FInSl+QImzWdlBnk9IwwvcTFX8qMow5Gk7sxpPCMQ1SoIC6RvjHKxRcTT+0kF74fzgyEgqUw+yXooR0+fntCJXRqeutG8LNfrmVWI2IMd8NsoaiWwi92S4ZkGLGPgk4Ogn/kRjTVu9DoN30erZNQ= 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 CH0PR13MB4585.namprd13.prod.outlook.com (2603:10b6:610:cb::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.29; Wed, 1 Mar 2023 02:48:59 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d%7]) with mapi id 15.20.6134.030; Wed, 1 Mar 2023 02:48:59 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Long Wu , Chaoyong He Subject: [PATCH v3 1/2] net/bonding: add independent LACP sending function Date: Wed, 1 Mar 2023 10:48:25 +0800 Message-Id: <20230301024826.885727-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230301024826.885727-1-chaoyong.he@corigine.com> References: <20230216083231.4721-1-chaoyong.he@corigine.com> <20230301024826.885727-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2P153CA0008.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::19) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH0PR13MB4585:EE_ X-MS-Office365-Filtering-Correlation-Id: 07d4544f-64ce-414c-45ca-08db19ff81e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hZgTg0ChimtHJCmBtnpWgFZMwO8maUrqg6CKnMslCYhGMY85eDm3YAMQnPvrDa5G2uB/cd25VtQqUikjtQmjlUrQIdyVKFMpepcqqbJytcOG8VoV/bgftl4R/500B9UGMZ5/oyk0WWLglVuAklp25nmEc304c3wEdQG2+JY8g92ovTaACPw1xxcjQVM9IkZ0s4yTIb3DRUMAHNq6Da/1hssNW3OF1x+2+HTH6Sep9szY42ma+Nt6k28xdSn027e8ysO8++Tm+3Sdun7F4NR4yLDN6vi36l10ceaGeIZbno8EQBaThmEG6tlbLeaklwupOuAONBU9Y+11foBwH3hbuG/EhSmu+HIRRbLNTeMjj88XBJyEhnYLNgHQTnSMnvBOuXoC+KhqjGggSr+vsTT2ka/9R84t0tWcfs06nK8ekya3VyNZMNkxXSWNaHwcEjPMvMLjEMdP8HIKeyHLmPhlgz4q8gE7khTzeR4XIQ5w9GkRzOfBrsN8r5YDYhH52Y1MAqmU15QsGRXmJd5hsNFE4ha213A8TdluDKz7sdRLuhdSg1PHsCGNXC88cy+I8mV5lOQdJ0V5BaLBii+xSAhYO1Hx9KOnf24KPFYfXcWpTFr/BVw4vGBUXUEUE+KNX5c7eTxnSD9AwQKudxFbKqxavLzRRJoGho/KWuiVgs/zEd2iGN53YeluIi0dB8QTSGR3Xc+yeej3NlSVkjJGZShvPDFGXFy0gTDxpdBNRTHMvYUpmzZ8zW/nrxWvYby1MYPE 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:(13230025)(4636009)(346002)(366004)(396003)(136003)(376002)(39840400004)(451199018)(66476007)(6506007)(1076003)(66946007)(66556008)(8676002)(4326008)(6916009)(6486002)(316002)(478600001)(5660300002)(36756003)(44832011)(52116002)(66574015)(86362001)(38100700002)(2906002)(54906003)(38350700002)(6666004)(83380400001)(8936002)(107886003)(2616005)(26005)(186003)(41300700001)(6512007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RnVUVEkxTU1GaFRLWVk0UkQ0YlgwZE1TQXdRUHU4ZjJqbG53Tm1VSWszNnUz?= =?utf-8?B?K3FOZ0p1eXpTVjFPQ0dsY3R4T2VDcGtXcjRkY0pTWE02R2VuNlROZWcyOHRw?= =?utf-8?B?WGF1Tmp2eit4ZFVaVFhXc0hkM2poczBBdmhSa2MzSi9vM2ptYlpVRC9Oanly?= =?utf-8?B?dmsyYUpXOHlYak0yc3ErRDRFSHpYL2hoSUNybWRFOWxCNXFmeW5qVEQ5dmVC?= =?utf-8?B?ak51L3pRanZOU3dNOW9zK2JiSTVRWXBHeVZGbmhESnJaRUxraU0yd3NDekxL?= =?utf-8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XYvbVpyZC93TmdrYnBoZUdJenNzMWM0?= =?utf-8?B?emN3V3Yvdzhya25EWUhGTkRtckYvYkZCSVJSdGhrTW9lRndueUtTTzdqeDVn?= =?utf-8?B?U0E9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07d4544f-64ce-414c-45ca-08db19ff81e5 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2023 02:48:59.4072 (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: 9wkXIc41rMwUEwfyXu7r+iVN62ySATgSOoEuDvBh+TUI/3+CcdsowEnJBy+fxlWpq1PmQDNbQVukrC6tgY/+i/dGZL7gnwW8jiM/znKTeHU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR13MB4585 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 Sending LACP control packets depends on calling the bonding port's sending function if we disable dedicated queue. In some cases app would not call the bonding port's sending function if there are only LACP control packets and the negotiation between the two bonding ports will fail. We add the independent LACP sending function for app. App can call it by itself and let the negotiation succeed. Signed-off-by: Long Wu Reviewed-by: Niklas Söderlund Reviewed-by: Chaoyong He --- drivers/net/bonding/rte_eth_bond_8023ad.c | 58 +++++++++++++++++++++++ drivers/net/bonding/rte_eth_bond_8023ad.h | 21 ++++++++ drivers/net/bonding/version.map | 8 ++++ 3 files changed, 87 insertions(+) diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 4a266bb2ca..bedfe89663 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -1757,3 +1757,61 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port) return retval; } + +int +rte_eth_bond_8023ad_dedicated_queues_get(uint16_t port_id) +{ + struct rte_eth_dev *dev; + struct bond_dev_private *internals; + + if (valid_bonded_port_id(port_id) != 0) + return -EINVAL; + + dev = &rte_eth_devices[port_id]; + internals = dev->data->dev_private; + + if (internals->mode != BONDING_MODE_8023AD) + return -EINVAL; + + return internals->mode4.dedicated_queues.enabled; +} + +void +rte_eth_bond_8023ad_lacp_send_one(void *queue) +{ + uint32_t i; + uint16_t member_tx_count; + uint16_t active_member_count; + uint16_t active_member_ids[RTE_MAX_ETHPORTS]; + struct bond_tx_queue *bd_tx_q = queue; + struct bond_dev_private *internals = bd_tx_q->dev_private; + + active_member_count = internals->active_slave_count; + if (unlikely(active_member_count == 0)) + return; + + for (i = 0; i < active_member_count; i++) + active_member_ids[i] = internals->active_slaves[i]; + + /* Check for LACP control packets and send if available */ + for (i = 0; i < active_member_count; i++) { + struct rte_mbuf *ctrl_pkt = NULL; + struct port *port = &bond_mode_8023ad_ports[active_member_ids[i]]; + + if (likely(rte_ring_empty(port->tx_ring))) + continue; + + if (rte_ring_dequeue(port->tx_ring, (void **)&ctrl_pkt) == 0) { + member_tx_count = rte_eth_tx_prepare(active_member_ids[i], + bd_tx_q->queue_id, &ctrl_pkt, 1); + member_tx_count = rte_eth_tx_burst(active_member_ids[i], + bd_tx_q->queue_id, &ctrl_pkt, member_tx_count); + /* + * Re-enqueue LAG control plane packets to buffering + * ring if transmission fails so the packet won't lost. + */ + if (member_tx_count != 1) + rte_ring_enqueue(port->tx_ring, ctrl_pkt); + } + } +} diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h index 7eb392f8c8..29a1610650 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.h +++ b/drivers/net/bonding/rte_eth_bond_8023ad.h @@ -331,4 +331,25 @@ rte_eth_bond_8023ad_agg_selection_get(uint16_t port_id); int rte_eth_bond_8023ad_agg_selection_set(uint16_t port_id, enum rte_bond_8023ad_agg_selection agg_selection); + +/** + * Get LACP dedicated queues enable/disable for 8023ad + * @param port_id Bonding device id + * @return + * 0 - the port is a bonding mode 4 port with disabled dedicated queue + * 1 - the port is a bonding mode 4 port with enabled dedicated queue + * -EINVAL - the port is not a bonding port or the bonding port's mode is not 4 + */ +__rte_experimental +int +rte_eth_bond_8023ad_dedicated_queues_get(uint16_t port_id); + +/** + * Send one LACP packet for bonding port in mode 4 with disabled dedicated queue + * @param queue Bonding port's tx queue + */ +__rte_experimental +void +rte_eth_bond_8023ad_lacp_send_one(void *queue); + #endif /* RTE_ETH_BOND_8023AD_H_ */ diff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map index 9333923b4e..d5db1d15e0 100644 --- a/drivers/net/bonding/version.map +++ b/drivers/net/bonding/version.map @@ -31,3 +31,11 @@ DPDK_23 { local: *; }; + +EXPERIMENTAL { + global: + + # added in 22.11 + rte_eth_bond_8023ad_dedicated_queues_get; + rte_eth_bond_8023ad_lacp_send_one; +}; -- 2.39.1