fix macvlan over alb bond support
Subsystems (4)
v3 cover fix macvlan over alb bond support
Currently, the macvlan over alb bond is broken after commit 14af9963ba1e ("bonding: Support macvlans on top of tlb/rlb mode bonds"). Fix this and add relate tests.
Hangbin Liu (3):
bonding: fix macvlan over alb bond support
selftest: bond: add new topo bond_topo_2d1c.sh
selftests: bonding: add macvlan over bond testing
drivers/net/bonding/bond_alb.c | 6 +- include/net/bonding.h | 11 +- .../selftests/drivers/net/bonding/Makefile | 4 +- .../drivers/net/bonding/bond_macvlan.sh | 99 +++++++++++ .../drivers/net/bonding/bond_options.sh | 3 - .../drivers/net/bonding/bond_topo_2d1c.sh | 158 ++++++++++++++++++ .../drivers/net/bonding/bond_topo_3d1c.sh | 118 +------------ 7 files changed, 272 insertions(+), 127 deletions(-) create mode 100755 tools/testing/selftests/drivers/net/bonding/bond_macvlan.sh create mode 100644 tools/testing/selftests/drivers/net/bonding/bond_topo_2d1c.sh
Signature · 1 line
2.41.0
PATCH v3 1/3 bonding: fix macvlan over alb bond support
The commit 14af9963ba1e ("bonding: Support macvlans on top of tlb/rlb mode bonds") aims to enable the use of macvlans on top of rlb bond mode. However, the current rlb bond mode only handles ARP packets to update remote neighbor entries. This causes an issue when a macvlan is on top of the bond, and remote devices send packets to the macvlan using the bond's MAC address as the destination. After delivering the packets to the macvlan, the macvlan will rejects them as the MAC address is incorrect. Consequently, this commit makes macvlan over bond non-functional.
To address this problem, one potential solution is to check for the presence of a macvlan port on the bond device using netif_is_macvlan_port(bond->dev) and return NULL in the rlb_arp_xmit() function. However, this approach doesn't fully resolve the situation when a VLAN exists between the bond and macvlan.
So let's just do a partial revert for commit 14af9963ba1e in rlb_arp_xmit(). As the comment said, Don't modify or load balance ARPs that do not originate locally.
---
v3: no update
v2: update comment message in rlb_arp_xmit.
--- drivers/net/bonding/bond_alb.c | 6 +++--- include/net/bonding.h | 11 +---------- 2 files changed, 4 insertions(+), 13 deletions(-)
drivers/net/bonding/bond_alb.c +3 -3
@@ -660,10 +660,10 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)return NULL ; arp = (struct arp_pkt *)skb_network_header (skb); -/* Don't modify or load balance ARPs that do not originate locally -* (e.g.,arrive via a bridge). +/* Don't modify or load balance ARPs that do not originate +* from the bond itself or a VLAN directly above the bond. */ -if (!bond_slave_has_mac_rx (bond, arp->mac_src)) +if (!bond_slave_has_mac_rcu (bond, arp->mac_src))return NULL ; dev =ip_dev_find (dev_net (bond->dev), arp->ip_src);
include/net/bonding.h +1 -10
@@ -722,23 +722,14 @@ static inline struct slave *bond_slave_has_mac(struct bonding *bond, }/* Caller must hold rcu_read_lock() for read */ -static inline bool bond_slave_has_mac_rx (struct bonding *bond,const u8 *mac) +static inline bool bond_slave_has_mac_rcu (struct bonding *bond,const u8 *mac) {struct list_head *iter;struct slave *tmp; -struct netdev_hw_addr *ha;bond_for_each_slave_rcu (bond, tmp, iter)if (ether_addr_equal_64bits (mac, tmp->dev->dev_addr))return true; - -if (netdev_uc_empty (bond->dev)) -return false; - -netdev_for_each_uc_addr (ha, bond->dev) -if (ether_addr_equal_64bits (mac, ha->addr)) -return true; -return false; }
Signature · 1 line
2.41.0
PATCH v3 2/3 selftest: bond: add new topo bond_topo_2d1c.sh
In reply to Hangbin LiuAdd a new testing topo bond_topo_2d1c.sh which is used more commonly. Make bond_topo_3d1c.sh just source bond_topo_2d1c.sh and add the extra link.
---
v3: add bond_topo_2d1c.sh to Makefile
v2: no update
--- .../selftests/drivers/net/bonding/Makefile | 1 + .../drivers/net/bonding/bond_options.sh | 3 - .../drivers/net/bonding/bond_topo_2d1c.sh | 158 ++++++++++++++++++ .../drivers/net/bonding/bond_topo_3d1c.sh | 118 +------------ 4 files changed, 167 insertions(+), 113 deletions(-) create mode 100644 tools/testing/selftests/drivers/net/bonding/bond_topo_2d1c.sh
tools/testing/selftests/drivers/net/bonding/Makefile +1 -0
@@ -13,6 +13,7 @@ TEST_PROGS := \ TEST_FILES := \ lag_lib.sh \ + bond_topo_2d1c.sh \ bond_topo_3d1c.sh \ net_forwarding_lib.sh
tools/testing/selftests/drivers/net/bonding/bond_options.sh +0 -3
@@ -9,10 +9,7 @@ ALL_TESTS=" num_grat_arp " -REQUIRE_MZ=no -NUM_NETIFS=0 lib_dir=$(dirname "$0") -source ${lib_dir}/net_forwarding_lib.sh source ${lib_dir}/bond_topo_3d1c.sh skip_prio()
tools/testing/selftests/drivers/net/bonding/bond_topo_2d1c.sh new file +158 -0
158 lines not on this page · raw message
tools/testing/selftests/drivers/net/bonding/bond_topo_3d1c.sh +8 -110
129 lines not on this page · raw message
Signature · 1 line
2.41.0
PATCH v3 3/3 selftests: bonding: add macvlan over bond testing
In reply to Hangbin LiuAdd a macvlan over bonding test with mode active-backup, balance-tlb and balance-alb.
]# ./bond_macvlan.sh
TEST: active-backup: IPv4: client->server [ OK ]
TEST: active-backup: IPv6: client->server [ OK ]
TEST: active-backup: IPv4: client->macvlan_1 [ OK ]
TEST: active-backup: IPv6: client->macvlan_1 [ OK ]
TEST: active-backup: IPv4: client->macvlan_2 [ OK ]
TEST: active-backup: IPv6: client->macvlan_2 [ OK ]
TEST: active-backup: IPv4: macvlan_1->macvlan_2 [ OK ]
TEST: active-backup: IPv6: macvlan_1->macvlan_2 [ OK ]
TEST: active-backup: IPv4: server->client [ OK ]
TEST: active-backup: IPv6: server->client [ OK ]
TEST: active-backup: IPv4: macvlan_1->client [ OK ]
TEST: active-backup: IPv6: macvlan_1->client [ OK ]
TEST: active-backup: IPv4: macvlan_2->client [ OK ]
TEST: active-backup: IPv6: macvlan_2->client [ OK ]
TEST: active-backup: IPv4: macvlan_2->macvlan_2 [ OK ]
TEST: active-backup: IPv6: macvlan_2->macvlan_2 [ OK ]
[...]
TEST: balance-alb: IPv4: client->server [ OK ]
TEST: balance-alb: IPv6: client->server [ OK ]
TEST: balance-alb: IPv4: client->macvlan_1 [ OK ]
TEST: balance-alb: IPv6: client->macvlan_1 [ OK ]
TEST: balance-alb: IPv4: client->macvlan_2 [ OK ]
TEST: balance-alb: IPv6: client->macvlan_2 [ OK ]
TEST: balance-alb: IPv4: macvlan_1->macvlan_2 [ OK ]
TEST: balance-alb: IPv6: macvlan_1->macvlan_2 [ OK ]
TEST: balance-alb: IPv4: server->client [ OK ]
TEST: balance-alb: IPv6: server->client [ OK ]
TEST: balance-alb: IPv4: macvlan_1->client [ OK ]
TEST: balance-alb: IPv6: macvlan_1->client [ OK ]
TEST: balance-alb: IPv4: macvlan_2->client [ OK ]
TEST: balance-alb: IPv6: macvlan_2->client [ OK ]
TEST: balance-alb: IPv4: macvlan_2->macvlan_2 [ OK ]
TEST: balance-alb: IPv6: macvlan_2->macvlan_2 [ OK ]
---
v3: add the script to Makefile
v2: no update
--- .../selftests/drivers/net/bonding/Makefile | 3 +- .../drivers/net/bonding/bond_macvlan.sh | 99 +++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100755 tools/testing/selftests/drivers/net/bonding/bond_macvlan.sh
tools/testing/selftests/drivers/net/bonding/Makefile +2 -1
@@ -9,7 +9,8 @@ TEST_PROGS := \ mode-1-recovery-updelay.sh \ mode-2-recovery-updelay.sh \ bond_options.sh \ - bond-eth-type-change.sh + bond-eth-type-change.sh \ + bond_macvlan.sh TEST_FILES := \ lag_lib.sh \
tools/testing/selftests/drivers/net/bonding/bond_macvlan.sh new file +99 -0
99 lines not on this page · raw message
Signature · 1 line
2.41.0
Quoted 8 lines · Hangbin Liu
Currently, the macvlan over alb bond is broken after commit
14af9963ba1e("bonding: Support macvlans on top of tlb/rlb mode bonds"). Fix this and add relate tests.Hangbin Liu (3):
bonding: fix macvlan over alb bond support
selftest: bond: add new topobond_topo_2d1c.sh
selftests: bonding: add macvlan over bond testing
For the series:
Quoted 15 lines
drivers/net/bonding/bond_alb.c | 6 +- include/net/bonding.h | 11 +- .../selftests/drivers/net/bonding/Makefile | 4 +- .../drivers/net/bonding/bond_macvlan.sh | 99 +++++++++++ .../drivers/net/bonding/bond_options.sh | 3 - .../drivers/net/bonding/bond_topo_2d1c.sh | 158 ++++++++++++++++++ .../drivers/net/bonding/bond_topo_3d1c.sh | 118 +------------ 7 files changed, 272 insertions(+), 127 deletions(-)create mode 100755
tools/testing/selftests/drivers/net/bonding/bond_macvlan.shcreate mode 100644tools/testing/selftests/drivers/net/bonding/bond_topo_2d1c.shSignature · 1 line
2.41.0
This series was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 10 lines · On Wed, 23 Aug 2023 15:19:03 +0800 you wrote:
Currently, the macvlan over alb bond is broken after commit
14af9963ba1e("bonding: Support macvlans on top of tlb/rlb mode bonds"). Fix this and add relate tests.Hangbin Liu (3):
bonding: fix macvlan over alb bond support
selftest: bond: add new topobond_topo_2d1c.sh
selftests: bonding: add macvlan over bond testing[...]
Here is the summary with links:
- [PATCHv3,net,1/3] bonding: fix macvlan over alb bond support
https://git.kernel.org/netdev/net/c/e74216b8def3 - [PATCHv3,net,2/3] selftest: bond: add new topo bond_topo_2d1c.sh https://git.kernel.org/netdev/net/c/27aa43f83c83 - [PATCHv3,net,3/3] selftests: bonding: add macvlan over bond testing https://git.kernel.org/netdev/net/c/246af950b940
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html