Skip to content

Commit f629411

Browse files
dbavatargregkh
authored andcommitted
bonding: send learning packets for vlans on slave
[ Upstream commit 21706ee ] There was a regression at some point from the intended functionality of commit f60c370 ("bonding: Fix alb mode to only use first level vlans.") Given the return value vlan_get_encap_level() we need to store the nest level of the bond device, and then compare the vlan's encap level to this. Without this, this check always fails and learning packets are never sent. In addition, this same commit caused a regression in the behavior of balance_alb, which requires learning packets be sent for all interfaces using the slave's mac in order to load balance properly. For vlan's that have not set a user mac, we can send after checking one bit. Otherwise we need send the set mac, albeit defeating rx load balancing for that vlan. Signed-off-by: Debabrata Banerjee <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2eca993 commit f629411

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

drivers/net/bonding/bond_alb.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,10 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[],
943943
skb->priority = TC_PRIO_CONTROL;
944944
skb->dev = slave->dev;
945945

946+
netdev_dbg(slave->bond->dev,
947+
"Send learning packet: dev %s mac %pM vlan %d\n",
948+
slave->dev->name, mac_addr, vid);
949+
946950
if (vid)
947951
__vlan_hwaccel_put_tag(skb, vlan_proto, vid);
948952

@@ -965,14 +969,13 @@ static int alb_upper_dev_walk(struct net_device *upper, void *_data)
965969
u8 *mac_addr = data->mac_addr;
966970
struct bond_vlan_tag *tags;
967971

968-
if (is_vlan_dev(upper) && vlan_get_encap_level(upper) == 0) {
969-
if (strict_match &&
970-
ether_addr_equal_64bits(mac_addr,
971-
upper->dev_addr)) {
972+
if (is_vlan_dev(upper) &&
973+
bond->nest_level == vlan_get_encap_level(upper) - 1) {
974+
if (upper->addr_assign_type == NET_ADDR_STOLEN) {
972975
alb_send_lp_vid(slave, mac_addr,
973976
vlan_dev_vlan_proto(upper),
974977
vlan_dev_vlan_id(upper));
975-
} else if (!strict_match) {
978+
} else {
976979
alb_send_lp_vid(slave, upper->dev_addr,
977980
vlan_dev_vlan_proto(upper),
978981
vlan_dev_vlan_id(upper));

drivers/net/bonding/bond_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
17341734
if (bond_mode_uses_xmit_hash(bond))
17351735
bond_update_slave_arr(bond, NULL);
17361736

1737+
bond->nest_level = dev_get_nest_level(bond_dev);
1738+
17371739
netdev_info(bond_dev, "Enslaving %s as %s interface with %s link\n",
17381740
slave_dev->name,
17391741
bond_is_active_slave(new_slave) ? "an active" : "a backup",

include/net/bonding.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ struct bonding {
198198
struct slave __rcu *primary_slave;
199199
struct bond_up_slave __rcu *slave_arr; /* Array of usable slaves */
200200
bool force_primary;
201+
u32 nest_level;
201202
s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
202203
int (*recv_probe)(const struct sk_buff *, struct bonding *,
203204
struct slave *);

0 commit comments

Comments
 (0)