From eeb6a6ab83b75a57d62d843acba137d0c4b1ee6c Mon Sep 17 00:00:00 2001 From: Michel Machado Date: Tue, 30 Apr 2024 11:34:16 -0400 Subject: [PATCH] lib/net: fix LACP bonds with multiple ports This commit implements the workaround discussed in issue #686. --- lib/net.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/net.c b/lib/net.c index 6fba1933..fe734bb3 100644 --- a/lib/net.c +++ b/lib/net.c @@ -1548,6 +1548,31 @@ create_bond(struct gatekeeper_if *iface) } } + if (__lacp_enabled(iface) && iface->num_ports > 1) { + /* + * XXX #686 Ensure that all members can receive packets + * destined to the MAC address of the bond. + * + * This must come after adding members. Otherwise, + * rte_eth_dev_mac_addr_add() unfortunately does nothing. + */ + struct rte_ether_addr if_macaddr; + ret = rte_eth_macaddr_get(iface->id, &if_macaddr); + if (unlikely(ret < 0)) { + G_LOG(ERR, "%s(%s): cannot get MAC address (errno=%i): %s\n", + __func__, iface->name, + -ret, rte_strerror(-ret)); + goto close_bond; + } + ret = rte_eth_dev_mac_addr_add(iface->id, &if_macaddr, 0); + if (unlikely(ret < 0)) { + G_LOG(ERR, "%s(%s): cannot add interface MAC address (errno=%i): %s\n", + __func__, iface->name, + -ret, rte_strerror(-ret)); + goto close_bond; + } + } + return 0; close_bond: