bnx2x: allow adding VLANs while interface is down 87/33387/2
authorMichal Schmidt <mschmidt@redhat.com>
Mon, 5 Dec 2016 21:26:47 +0000 (14:26 -0700)
committerYunhong Jiang <yunhong.jiang@intel.com>
Fri, 14 Apr 2017 11:05:01 +0000 (07:05 -0400)
commit9cc2aef71f0cee55d641143c136e519df55738a4
treecdceed153851d502b5ee7bdf247d5e8bc9efa6b2
parent4d13fcf59772c5dd2f577aedc1f3a1ab0c35c1d1
bnx2x: allow adding VLANs while interface is down

BugLink: http://bugs.launchpad.net/bugs/1616107
Since implementing VLAN filtering in commit 05cc5a39ddb74
("bnx2x: add vlan filtering offload") bnx2x refuses to add a VLAN while
the interface is down:

  # ip link add link enp3s0f0 enp3s0f0_10 type vlan id 10
  RTNETLINK answers: Bad address

and in dmesg (with bnx2x.debug=0x20):
  bnx2x: [bnx2x_vlan_rx_add_vid:12941(enp3s0f0)]Ignoring VLAN
  configuration the interface is down

Other drivers have no problem with this.
Fix this peculiar behavior in the following way:
 - Accept requests to add/kill VID regardless of the device state.
   Maintain the requested list of VIDs in the bp->vlan_reg list.
 - If the device is up, try to configure the VID list into the hardware.
   If we run out of VLAN credits or encounter a failure configuring an
   entry, fall back to accepting all VLANs.
   If we successfully configure all entries from the list, turn the
   fallback off.
 - Use the same code for reconfiguring VLANs during NIC load.

Have to change the signed-off-by line to avoid spam to original people.

S1gned off by: Michal Schmidt <mschmidt@redhat.com>
@cked: Yuval Mintz <Yuval.Mintz@qlogic.com>
S1gned off by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a02cc9d3cc9f98905df214d4a57e5918473260ea)
S1gned off by: Tim Gardner <tim.gardner@canonical.com>
@cked: Seth Forshee <seth.forshee@canonical.com>
S1gned off by: Luis Henriques <luis.henriques@canonical.com>

Upstream status: Backport

Change-Id: Ibcc668daf4815bc984e2611d8c08856a0a7973f1
Backport-by: Yunhong Jiang <yunhong.jiang@linux.intel.com>
Signed-off-by: Yunhong Jiang <yunhong.jiang@linux.intel.com>
kernel/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c