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 BB7C341CAE; Thu, 16 Feb 2023 09:33:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07DC74114A; Thu, 16 Feb 2023 09:33:03 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id D641440EE3 for ; Thu, 16 Feb 2023 09:33:00 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KNTgwVBsZp5ReIrAokCMuoh+7bI8Jf9X9mUMgATSWZ9wEEnNrOIBJnZeI4Yjc3mK+gvTfXH6cyN7h6wqTLCAt92jzidlO8w3JISfob4e2zzGCrVO9Ka8ruV2XJ+h2joqdhieGod4cMs89JLyzY7u421QMS0G55AFQfi6Q4eahvMibEoR8fAqhryfuLCHFBabieyLXK33SgZiBCWxt78E47pbL3qpqhUGJFi6J5+5EYFCqApswLv0q0XKPyqkbKeNPMJTWwuEPg7L2HxErWtko4+K2SFX50C9HPw766LzxmXlYlxWh1e6mUIUQ7ujqk1nKvUkFgL8Lg3CXAYxd/Q9tg== 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=QqlHU8PiErF99ApbxHTGYPmhqDrt95mmS13ODyknW6E=; b=BV1C2e77Itk8EYBcwd0FxIW24xE2XYptM/CVY0VUUBQiStYEsMpkG9fVHoC3e3w8UK9DlU7K15bQzcFw9Vs+ps8kkrO6nfwopH/rwXGhh9EwL7TR3gZBmIROUKA8/c84RIGV+iT3ICP5vyGVhRuM041gH4dFRQtZamw9QlJASSOkw/DBdG/pHl2vOFIQed+YZivuuFK5RD7mxHj8G7xP24ls31yZRYhhIoTNbQ3XGnQWZjOaRZtfbd96uHGhBmSoJy2/lWmdeTTgWQSWKNHwGgZ1craEEaV9n/pfYwdIwW28hZAXktmXBVYAR1I5rL+ZQkhkNzAR+UFXgTygMSYGwA== 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=QqlHU8PiErF99ApbxHTGYPmhqDrt95mmS13ODyknW6E=; b=dt/+UFs499b9PwwSGKcJzpl5/XNeR/Pe03qyNIXnYx14bIrU/ymQBeNkPDWPsvn19wbSP42TZHmf9Xz9wC6oSYb+itw5ihUsiyVSjJyHDoQ1AaHGFlHm8DCII1eP6gZsPyFIQMA9d/FKxCr7dFz8nvceEcAczdymf9lmh981BLI= 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 SJ2PR13MB6144.namprd13.prod.outlook.com (2603:10b6:a03:4fc::11) 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 08:32: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%5]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 08:32:59 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Long Wu , Chaoyong He Subject: [PATCH v2 1/2] net/bonding: add independent LACP sending function Date: Thu, 16 Feb 2023 16:32:30 +0800 Message-Id: <20230216083231.4721-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20230216083231.4721-1-chaoyong.he@corigine.com> References: <20230216071514.29418-1-chaoyong.he@corigine.com> <20230216083231.4721-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2P153CA0053.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::22) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SJ2PR13MB6144:EE_ X-MS-Office365-Filtering-Correlation-Id: 30177911-712f-489d-3548-08db0ff868d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fZE/OSS2anwSBNCDl2xcWDBamokEFjw1URl77FpkYm0/9+YRJEbWtGTekFc/diIQ5tpcQzBELSNM0+ZjtT97WSm+yjAYnlBw0hyb9jLxDtznGcXJZblJ9Cp3+LD4/zOF+7k0MxE3jQtuo4ln7qywm5uX6W19C581htJxaXz8W69jLdnRcLa8jyN7/TXNeUS/XlviCUSxtvYiULkpan8NC1ba2kV0UW50/Aw7M1aiYruojwyGFsl4l+QljPNaZXlgX+Gz/bbrJ+KE0Lp+mW23eFoTg7mMa0UNuV1NkI88BwmwIbPwiFVPbOeZkkMYiPHxku1O4TaP4S1wsrFdpAXIDnuk6iIKsp2S/6gUjrjyhbVXjYSbRCKfO+Pi6zlKXBMfC8LMmFDmvicW/hZ5Myjk4GqTfe4TuJP8jLDCMah7sxFIVPDZSQIwqXxl2Dk1BN/8ra9a+vEPhtNR75P5un9paDNC1q4JvcaYobKXSTeZYSAd96Pylojw6CJKGd3cOzzRxLLribtQNRiRXEpyf2Kfp5QOQtyWEoifAHXsVTUto2wdMolLDJrCuKUY7Cd5VpiALD1eP7rL8F0D2zeabsUfISQAdzuDxhgUap5uEabCFV/SpbS0QbUrTzAlbEQL68IvUnSt1b+i2crL1fYQumhUDsv7GaqSfBytl5/Ew5UYnBqRjQZQqajmCd8bqEvbUTylj3kVb+HD+c+StKrseblZsg== 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)(376002)(136003)(366004)(39840400004)(396003)(451199018)(38100700002)(26005)(1076003)(107886003)(6666004)(6506007)(186003)(38350700002)(6512007)(36756003)(2906002)(83380400001)(86362001)(52116002)(54906003)(6916009)(66946007)(8676002)(66556008)(66476007)(66574015)(8936002)(2616005)(6486002)(41300700001)(478600001)(44832011)(316002)(4326008)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?L3c4WWI5SDh6NlZuOW4wOXdSLzlwdVZjUU9RdzNXdVBzT0RXVEhNWEo2MGpB?= =?utf-8?B?cTJxUWZhazh5c2lEa1ZSazlRa3FCRmZaRjk2WFRVM0ZRZ0l6RFV4L0cyZC91?= =?utf-8?B?MTA4M1dpbitUV2xHRzQwU0dFbkdRRjJMTnpaRW45VVI1VUhjcGhZRHN4YzJu?= =?utf-8?B?WFQwMHFWRTliTnIyQStvMkpDNmdwSkE0L3dGQTJySnUxdytMYjlMK1JoTDNQ?= =?utf-8?B?TW50SjFDNDVrV3hZbExFU2NXeTlCV245QXMwdUt6LzlFZ1N6blNNZzBFcUJU?= =?utf-8?B?S2t6azl1ZGpFV053WThTNkhKWkdwSlp6UHpZYTA0NFFNakd0OEpEZ0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oZmc5cURZdEhVMXAzZUsrc1RoV2laN0E5MjRhd3d1L2c3WGptQm9i?= =?utf-8?B?N0E9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30177911-712f-489d-3548-08db0ff868d3 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 08:32:59.0861 (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: +J8r9ab4I8kgmZ1MkvNOu2RJ3HJlikCBp3N/wMXbL7j5JAiArtnxhFYObG67f2Z0DWyAp6bhLNhxUJcuCr8rhTHnoBRIyJWQw5hE32ORjU0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR13MB6144 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 ++++++++ drivers/net/bonding/version.map | 2 + 3 files changed, 79 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_ */ diff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map index 9333923b4e..0284b11a6a 100644 --- a/drivers/net/bonding/version.map +++ b/drivers/net/bonding/version.map @@ -6,11 +6,13 @@ DPDK_23 { rte_eth_bond_8023ad_conf_get; rte_eth_bond_8023ad_dedicated_queues_disable; rte_eth_bond_8023ad_dedicated_queues_enable; + rte_eth_bond_8023ad_dedicated_queues_get; rte_eth_bond_8023ad_ext_collect; rte_eth_bond_8023ad_ext_collect_get; rte_eth_bond_8023ad_ext_distrib; rte_eth_bond_8023ad_ext_distrib_get; rte_eth_bond_8023ad_ext_slowtx; + rte_eth_bond_8023ad_lacp_send_one; rte_eth_bond_8023ad_setup; rte_eth_bond_8023ad_slave_info; rte_eth_bond_active_slaves_get; -- 2.29.3