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 4F47741CAE; Thu, 16 Feb 2023 08:15:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F2BA4113F; Thu, 16 Feb 2023 08:15:36 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2123.outbound.protection.outlook.com [40.107.100.123]) by mails.dpdk.org (Postfix) with ESMTP id A33C8410F1 for ; Thu, 16 Feb 2023 08:15:35 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U9CbSKdB7CmgE+HVDNLM5FzuIyPaGd0fBJGCGFVt4wEES3WDYdb6lgVjDpUS+FP68Fawb4N+yfHLRlSSImjVF32/KMPjnyAH/YtoGRLVcgSVJWMwNkmBuTHbpyKTBHQpso69qheZUu4+HdnZeuPqYJJF82EX99VWphaYAVU31YeNmcXqyFrrWFdEQDQ7DeLsWReew62PpNLbjQSeZqZNuNudbj3oznSS1Scoap8pc3Up+WiDXnrhA/jeojUVEz9JKhLpdOx7kSfyV34/9z6GugIG7EVuMX6YSeFJi20fCCfuwyvna/Jw1DWf0+gYRlMn7BDIdyoSCJmwWCllYEbUpQ== 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=v7ZfmzUAiJFbKKyYhTOlTrnq0Qbl+wDz8tSX4oxKkjI=; b=VpCxsZZKM4ppeNMm0lk740PPFe/9VJSPF+GTySsDNcTpZS+s+yrJdrvVRfVyb8X+LdyGFJSarbqfwPJ1So5wnuttvU74NYrQNGgcUSHXusXKlbrHxva3Knb26Fd7sHFgIU2VwVlsbtogJQ1rdqreSkJjm0DPxjau7LgHLvQ/UixHoTl58IzpEFSkB7nRXlFfi5uV7ph60OVVcAGM7T8dly42SiNoF6W6quwg4IqagI2+3rySCTRDlitahueNs1ox/WSBwOB141J00uUc8YjxpjL1zDw1Z+wTnbHZJiCAteFMpIuRlvtxqcy9c5wDPjxWA/3q0jnLllGyDnw5jCz3aA== 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=v7ZfmzUAiJFbKKyYhTOlTrnq0Qbl+wDz8tSX4oxKkjI=; b=wiGhv+Hf9zaAFC4tbMOHYXSWlcijLyKP635/u6PdPopQIzMPLNoFqnteUpXX1NT+qhtJPxTo4LFsGL8GDmVtFKyLmLWIO5qztrObQ68Ex0mKRSYe6EaJumYh/nDQ882+CXbfd/f+tuDIMC0LafnpvqZ0KIMV3qJlZqAHT/8PX8k= 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 SA0PR13MB6002.namprd13.prod.outlook.com (2603:10b6:806:152::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 07:15:34 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d%5]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 07:15:34 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Long Wu , Chaoyong He Subject: [PATCH 1/2] net/bonding: add independent LACP sending function Date: Thu, 16 Feb 2023 15:15:13 +0800 Message-Id: <20230216071514.29418-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20230216071514.29418-1-chaoyong.he@corigine.com> References: <20230216071514.29418-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0046.apcprd01.prod.exchangelabs.com (2603:1096:4:193::18) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA0PR13MB6002:EE_ X-MS-Office365-Filtering-Correlation-Id: c14dbdea-64d8-4d14-9707-08db0fed9822 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fM3gqpTZK+9tOm5G0fDAmhAnTCHga34owdWzagatqcrVLfkp5wbdgRMbSICOlfwdggAH8X5GfjmeFTFnlkeZDjnnHRYUMmovw2UXMilWnxjoBWTu5oiv068OgpwiZ/vhAQOnOotNOfVtH2RNpePhPomepPcvN9LcWA6SwP407koQLQn9UuNbUnqxb4RmFPjqOhxkupOfy7sr0spSXqdmSBsyCWmD3MzS3WzJymQhZsRNixFBXqRhCwLI8mPRpdN+VfeDmoG84g0/Qw8ATXQKlrXfYy8oNl/2qiHj33pUTGWQC1pDqzX6D07CiIZFZsfwSE2Ykjh9ZBvGrj72WdWTYLjJxba1V9GzEhIsdn97jNaQQ2qcez7eNFS8xK2x5d9MqHRGbB5GNGiEvyIZAFZa93xzJuWGIdFJqsko9lkVALrrkmSrNjEJYPN7GVZ/rcNrE1VssDZReTwFPKq9U1Xi31MC0Atz2tNaSXG/gpryRbSP1fuvGUyx7YlgoiAG6E8qSLdF/jFF63YBiwCljpRhY+n+kpzs5bXDxt4hYqvB9Oe0SF3ZEyP3NGjUrEoRUvR+oFw4mTWQLw1lVhcJDtRDn24Gh9tonjCVwDmHuYHr/+V/THTd1OYsCtgHbJ0R/JeEIZClMLqoIoo6eOgQDbP3tZkZM+2zpnS4rVP9SwfkNFiUzIaksZWa2r8YpbPyoQYMtYzhZIUAqoGzHfPbobyspw== 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)(136003)(376002)(366004)(396003)(39840400004)(451199018)(2906002)(6506007)(1076003)(5660300002)(44832011)(8676002)(4326008)(8936002)(86362001)(66476007)(66946007)(316002)(66556008)(41300700001)(6916009)(54906003)(478600001)(6486002)(52116002)(38350700002)(6666004)(107886003)(38100700002)(26005)(36756003)(186003)(6512007)(2616005)(83380400001)(66574015); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VzR6dU1FUEhxQUxqR24zS1JUQlpIMW5Ydkdsd3FMZ3N1K2xhS2FkOGMrazFK?= =?utf-8?B?Sm9MOFRtbWwwUEtIczhudmYwVXBBb1crZEljZldnYmFpd3RWbk8zNXhYclBT?= =?utf-8?B?MmRtMDAvdlh2blhkZ3hXREhFaHl5M2k1cEE2K2d1YmRYcE1TZHl3amphakU0?= =?utf-8?B?RUlrZ0d1dUtFYWEwKzJxUTFMajdFU1NDTzZqMEFyeGtkb2ZrYWp5ZWhlOHkx?= =?utf-8?B?Nkx6VDNxVFlQWFpOTVI3NWhtK015aDZlM09wOS9XMjFwaEtOUGdYeDZQemc3?= =?utf-8?B?c3plcUZIeTJFTyt5M09kbTRIbWppRkRyKzkwL0xLYWJrY1BsT25yeXBXanhl?= =?utf-8?B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MDJr?= =?utf-8?B?aUE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: c14dbdea-64d8-4d14-9707-08db0fed9822 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 07:15:34.0107 (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: 7vngQ9UAelsQlQPChUatlV+sSylviTyWXBdO9oB37hjR5LDNtJOdx4aM53X1U7i8tjHNVK+MDXpzFGZGK6iAChzxMHsHgIO4XDt3823cRcQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR13MB6002 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 | 19 ++++++++ 2 files changed, 77 insertions(+) diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 4a266bb2ca..4c3b142f6d 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 slave_tx_count; + uint16_t active_slave_count; + uint16_t active_slave_ids[RTE_MAX_ETHPORTS]; + struct bond_tx_queue *bd_tx_q = queue; + struct bond_dev_private *internals = bd_tx_q->dev_private; + + active_slave_count = internals->active_slave_count; + if (unlikely(active_slave_count == 0)) + return; + + rte_memcpy(active_slave_ids, internals->active_slaves, + sizeof(active_slave_ids[0]) * active_slave_count); + + /* Check for LACP control packets and send if available */ + for (i = 0; i < active_slave_count; i++) { + struct rte_mbuf *ctrl_pkt = NULL; + struct port *port = &bond_mode_8023ad_ports[active_slave_ids[i]]; + + if (likely(rte_ring_empty(port->tx_ring))) + continue; + + if (rte_ring_dequeue(port->tx_ring, (void **)&ctrl_pkt) == 0) { + slave_tx_count = rte_eth_tx_prepare(active_slave_ids[i], + bd_tx_q->queue_id, &ctrl_pkt, 1); + slave_tx_count = rte_eth_tx_burst(active_slave_ids[i], + bd_tx_q->queue_id, &ctrl_pkt, slave_tx_count); + /* + * Re-enqueue LAG control plane packets to buffering + * ring if transmission fails so the packet won't lost. + */ + if (slave_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..92b980b825 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.h +++ b/drivers/net/bonding/rte_eth_bond_8023ad.h @@ -331,4 +331,23 @@ 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 + */ +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 + */ +void +rte_eth_bond_8023ad_lacp_send_one(void *queue); + #endif /* RTE_ETH_BOND_8023AD_H_ */ -- 2.29.3