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 78357A00C3; Sun, 5 Jun 2022 05:08:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A18014021E; Sun, 5 Jun 2022 05:08:23 +0200 (CEST) Received: from m12-13.163.com (m12-13.163.com [220.181.12.13]) by mails.dpdk.org (Postfix) with ESMTP id C028640041; Sun, 5 Jun 2022 05:08:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=wljAT hYKkoJC3I2shNavvJPQdCvbsTM1m3IZBQKXVaE=; b=ggr0ilW2cNGnonsXQcBnT wgndwHTN82+m6pnjj74HNIZAUI+h98JGsxhIZue451z5/OoeR0QA4g1ZVbOIQ0l0 GXP0t+YSsVOFPoJiSFeM77rTcQ+Lcj6WSXJUaQQGjenw57SKswYvO6sv42LEWC4B hskPA8OPP/x8P1nyfucMsk= Received: from DESKTOP-ONA2IA7.localdomain (unknown [112.17.247.75]) by smtp9 (Coremail) with SMTP id DcCowABHvOH7HZxiKDE5HA--.15326S4; Sun, 05 Jun 2022 11:08:09 +0800 (CST) From: Gaoxiang Liu To: chas3@att.com, humin29@huawei.com Cc: dev@dpdk.org, liugaoxiang@huawei.com, Gaoxiang Liu , stable@dpdk.org Subject: [PATCH] net/bonding: failover of LACP with mode 4 takes long time Date: Sun, 5 Jun 2022 11:07:37 +0800 Message-Id: <20220605030737.4670-1-gaoxiangliu0@163.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: DcCowABHvOH7HZxiKDE5HA--.15326S4 X-Coremail-Antispam: 1Uf129KBjvJXoWxJFWDurW3CrWxAr4xtw1kKrg_yoW5Wr1fpF 47C34YgF97ArWDZ3WxXa1xurs8Cr1xZ3WUGryrA3s0kan5Zryrur1xtFyv9Fy0k3s5urs8 AFWYkw1qvF4kGrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRBT59UUUUU= X-Originating-IP: [112.17.247.75] X-CM-SenderInfo: xjdr5xxdqjzxjxq6il2tof0z/1tbiPhoXOlxBsh+m5wAAs4 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 When the primary port of bond slaves with bond mode 4 linked down, the system id of the other slave ports channged. It may cause some switches to renegotiate, and the process takes a few seconds. It is not acceptable for any Telcos. We need sub-second switchover time like in linux. Set the mac of the bond port to the slave port's system to solve the problem. Bugzilla ID: 551 Fixes: 46fb43683679 ("bond: add mode 4") Cc: stable@dpdk.org Signed-off-by: Gaoxiang Liu --- drivers/net/bonding/rte_eth_bond_8023ad.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index b3cddd8a20..b393148238 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -866,7 +866,6 @@ bond_mode_8023ad_periodic_cb(void *arg) struct bond_dev_private *internals = bond_dev->data->dev_private; struct port *port; struct rte_eth_link link_info; - struct rte_ether_addr slave_addr; struct rte_mbuf *lacp_pkt = NULL; uint16_t slave_id; uint16_t i; @@ -893,7 +892,6 @@ bond_mode_8023ad_periodic_cb(void *arg) key = 0; } - rte_eth_macaddr_get(slave_id, &slave_addr); port = &bond_mode_8023ad_ports[slave_id]; key = rte_cpu_to_be_16(key); @@ -905,8 +903,8 @@ bond_mode_8023ad_periodic_cb(void *arg) SM_FLAG_SET(port, NTT); } - if (!rte_is_same_ether_addr(&port->actor.system, &slave_addr)) { - rte_ether_addr_copy(&slave_addr, &port->actor.system); + if (!rte_is_same_ether_addr(&internals->mode4.mac_addr, &port->actor.system)) { + rte_ether_addr_copy(&internals->mode4.mac_addr, &port->actor.system); if (port->aggregator_port_id == slave_id) SM_FLAG_SET(port, NTT); } @@ -1178,15 +1176,15 @@ bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev) bond_mode_8023ad_stop(bond_dev); + rte_eth_macadd_get(internals->port_id, &internals->mode4.mac_addr); for (i = 0; i < internals->active_slave_count; i++) { slave_id = internals->active_slaves[i]; slave = &bond_mode_8023ad_ports[slave_id]; - rte_eth_macaddr_get(slave_id, &slave_addr); - if (rte_is_same_ether_addr(&slave_addr, &slave->actor.system)) + if (rte_is_same_ether_addr(&internals->mode4.mac_addr, &slave->actor.system)) continue; - rte_ether_addr_copy(&slave_addr, &slave->actor.system); + rte_ether_addr_copy(&internals->mode4.mac_addr, &slave->actor.system); /* Do nothing if this port is not an aggregator. In other case * Set NTT flag on every port that use this aggregator. */ if (slave->aggregator_port_id != slave_id) -- 2.32.0