public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Debabrata Banerjee <dbanerje@akamai.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 4.9 22/33] bonding: send learning packets for vlans on slave
Date: Fri, 18 May 2018 10:16:01 +0200	[thread overview]
Message-ID: <20180518081535.982853490@linuxfoundation.org> (raw)
In-Reply-To: <20180518081535.096308218@linuxfoundation.org>

4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Debabrata Banerjee <dbanerje@akamai.com>

[ Upstream commit 21706ee8a47d3ede7fdae0be6d7c0a0e31a83229 ]

There was a regression at some point from the intended functionality of
commit f60c3704e87d ("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 <dbanerje@akamai.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/bonding/bond_alb.c  |   13 ++++++++-----
 drivers/net/bonding/bond_main.c |    2 ++
 include/net/bonding.h           |    1 +
 3 files changed, 11 insertions(+), 5 deletions(-)

--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -944,6 +944,10 @@ static void alb_send_lp_vid(struct slave
 	skb->priority = TC_PRIO_CONTROL;
 	skb->dev = slave->dev;
 
+	netdev_dbg(slave->bond->dev,
+		   "Send learning packet: dev %s mac %pM vlan %d\n",
+		   slave->dev->name, mac_addr, vid);
+
 	if (vid)
 		__vlan_hwaccel_put_tag(skb, vlan_proto, vid);
 
@@ -966,14 +970,13 @@ static void alb_send_learning_packets(st
 	 */
 	rcu_read_lock();
 	netdev_for_each_all_upper_dev_rcu(bond->dev, upper, iter) {
-		if (is_vlan_dev(upper) && vlan_get_encap_level(upper) == 0) {
-			if (strict_match &&
-			    ether_addr_equal_64bits(mac_addr,
-						    upper->dev_addr)) {
+		if (is_vlan_dev(upper) &&
+		    bond->nest_level == vlan_get_encap_level(upper) - 1) {
+			if (upper->addr_assign_type == NET_ADDR_STOLEN) {
 				alb_send_lp_vid(slave, mac_addr,
 						vlan_dev_vlan_proto(upper),
 						vlan_dev_vlan_id(upper));
-			} else if (!strict_match) {
+			} else {
 				alb_send_lp_vid(slave, upper->dev_addr,
 						vlan_dev_vlan_proto(upper),
 						vlan_dev_vlan_id(upper));
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1732,6 +1732,8 @@ int bond_enslave(struct net_device *bond
 	if (bond_mode_uses_xmit_hash(bond))
 		bond_update_slave_arr(bond, NULL);
 
+	bond->nest_level = dev_get_nest_level(bond_dev);
+
 	netdev_info(bond_dev, "Enslaving %s as %s interface with %s link\n",
 		    slave_dev->name,
 		    bond_is_active_slave(new_slave) ? "an active" : "a backup",
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -197,6 +197,7 @@ struct bonding {
 	struct   slave __rcu *primary_slave;
 	struct   bond_up_slave __rcu *slave_arr; /* Array of usable slaves */
 	bool     force_primary;
+	u32      nest_level;
 	s32      slave_cnt; /* never change this value outside the attach/detach wrappers */
 	int     (*recv_probe)(const struct sk_buff *, struct bonding *,
 			      struct slave *);

  parent reply	other threads:[~2018-05-18  8:23 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18  8:15 [PATCH 4.9 00/33] 4.9.101-stable review Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 01/33] 8139too: Use disable_irq_nosync() in rtl8139_poll_controller() Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 02/33] bridge: check iface upper dev when setting master via ioctl Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 03/33] dccp: fix tasklet usage Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 04/33] ipv4: fix memory leaks in udp_sendmsg, ping_v4_sendmsg Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 05/33] llc: better deal with too small mtu Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 06/33] net: ethernet: sun: niu set correct packet size in skb Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 07/33] net: ethernet: ti: cpsw: fix packet leaking in dual_mac mode Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 08/33] net/mlx4_en: Verify coalescing parameters are in range Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 09/33] net/mlx5: E-Switch, Include VF RDMA stats in vport statistics Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 10/33] net_sched: fq: take care of throttled flows before reuse Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 11/33] net: support compat 64-bit time in {s,g}etsockopt Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 12/33] openvswitch: Dont swap table in nlattr_set() after OVS_ATTR_NESTED is found Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 13/33] qmi_wwan: do not steal interfaces from class drivers Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 14/33] r8169: fix powering up RTL8168h Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 15/33] sctp: handle two v4 addrs comparison in sctp_inet6_cmp_addr Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 16/33] sctp: remove sctp_chunk_put from fail_mark err path in sctp_ulpevent_make_rcvmsg Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 17/33] sctp: use the old asoc when making the cookie-ack chunk in dupcook_d Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 18/33] tcp_bbr: fix to zero idle_restart only upon S/ACKed data Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 19/33] tg3: Fix vunmap() BUG_ON() triggered from tg3_free_consistent() Greg Kroah-Hartman
2018-05-18  8:15 ` [PATCH 4.9 20/33] bonding: do not allow rlb updates to invalid mac Greg Kroah-Hartman
2018-05-18  8:16 ` [PATCH 4.9 21/33] net/mlx5: Avoid cleaning flow steering table twice during error flow Greg Kroah-Hartman
2018-05-18  8:16 ` Greg Kroah-Hartman [this message]
2018-05-18  8:16 ` [PATCH 4.9 23/33] tcp: ignore Fast Open on repair mode Greg Kroah-Hartman
2018-05-18  8:16 ` [PATCH 4.9 24/33] sctp: fix the issue that the cookie-ack with auth cant get processed Greg Kroah-Hartman
2018-05-18  8:16 ` [PATCH 4.9 25/33] sctp: delay the authentication for the duplicated cookie-echo chunk Greg Kroah-Hartman
2018-05-18  8:16 ` [PATCH 4.9 26/33] serial: sccnxp: Fix error handling in sccnxp_probe() Greg Kroah-Hartman
2018-05-18  8:16 ` [PATCH 4.9 27/33] futex: Remove duplicated code and fix undefined behaviour Greg Kroah-Hartman
2018-05-18  8:30   ` Jiri Slaby
2018-05-18  9:01     ` Greg Kroah-Hartman
2018-05-18  8:16 ` [PATCH 4.9 28/33] xfrm: fix xfrm_do_migrate() with AEAD e.g(AES-GCM) Greg Kroah-Hartman
2018-05-18  8:16 ` [PATCH 4.9 29/33] lockd: lost rollback of set_grace_period() in lockd_down_net() Greg Kroah-Hartman
2018-05-18  8:16 ` [PATCH 4.9 30/33] Revert "ARM: dts: imx6qdl-wandboard: Fix audio channel swap" Greg Kroah-Hartman
2018-05-18  8:16 ` [PATCH 4.9 31/33] l2tp: revert "l2tp: fix missing print session offset info" Greg Kroah-Hartman
2018-05-18  8:16 ` [PATCH 4.9 32/33] nfp: TX time stamp packets before HW doorbell is rung Greg Kroah-Hartman
2018-05-18  8:16 ` [PATCH 4.9 33/33] proc: do not access cmdline nor environ from file-backed areas Greg Kroah-Hartman
2018-05-18 13:20 ` [PATCH 4.9 00/33] 4.9.101-stable review Guenter Roeck
2018-05-18 14:05 ` kernelci.org bot
2018-05-18 19:02 ` Naresh Kamboju
2018-05-18 20:47 ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180518081535.982853490@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=dbanerje@akamai.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox