alistair23-linux/drivers/net
Nikolay Aleksandrov de7d244d0a macvlan: make operstate and carrier more accurate
Currently when a macvlan is being initialized and the lower device is
netif_carrier_ok(), the macvlan device doesn't run through
rfc2863_policy() and is left with UNKNOWN operstate. Fix it by adding an
unconditional linkwatch event for the new macvlan device. Similar fix is
already used by the 8021q device (see register_vlan_dev()). Also fix the
inconsistent state when the lower device has been down and its carrier
was changed (when a device is down NETDEV_CHANGE doesn't get generated).
The second issue can be seen f.e. when we have a macvlan on top of a 8021q
device which has been down and its real device has been changing carrier
states, after setting the 8021q device up, the macvlan device will have
the same carrier state as it was before even though the 8021q can now
have a different state.
Example for case 1:
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP mode DEFAULT group default qlen 1000

$ ip l add l eth2 macvl0 type macvlan
$ ip l set macvl0 up
$ ip l sh macvl0
72: macvl0@eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
noqueue state UNKNOWN mode DEFAULT group default
    link/ether f6:0b:54:0a:9d:a3 brd ff:ff:ff:ff:ff:ff

Example for case 2 (order is important):
Prestate: eth2 UP/CARRIER, vlan1 down, vlan1-macvlan down
$ ip l set vlan1-macvlan up
$ ip l sh vlan1-macvlan
71: vlan1-macvlan@vlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether 4a:b8:44:56:b9:b9 brd ff:ff:ff:ff:ff:ff

[ eth2 loses CARRIER before vlan1 has been UP-ed ]

$ ip l sh eth2
4: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast
state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:bf:57:16 brd ff:ff:ff:ff:ff:ff
$ ip l sh vlan1-macvlan
71: vlan1-macvlan@vlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether 4a:b8:44:56:b9:b9 brd ff:ff:ff:ff:ff:ff
$ ip l set vlan1 up
$ ip l sh vlan1
70: vlan1@eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc
noqueue state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:bf:57:16 brd ff:ff:ff:ff:ff:ff
$ ip l sh vlan1-macvlan
71: vlan1-macvlan@vlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether 4a:b8:44:56:b9:b9 brd ff:ff:ff:ff:ff:ff

vlan1-macvlan is still UP, still has carrier and is still in the same
operstate as before. After the patch in case 1 macvl0 has state UP as it
should and in case 2 vlan1-macvlan has state LOWERLAYERDOWN again as it
should. Note that while the lower macvlan device is down their carrier
and thus operstate can go out of sync but that will be fixed once the
lower device goes up again.
This behaviour seems to have been present since beginning of git history.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-01-29 12:15:45 -08:00
..
appletalk
arcnet
bonding Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-01-11 23:55:43 -05:00
caif
can
cris
dsa net: dsa: fix mv88e6xxx switches 2016-01-25 10:49:15 -08:00
ethernet net: cavium: liquidio: use helpers ns_to_timespec64() 2016-01-29 15:14:21 -05:00
fddi defxx: fix build warning 2016-01-25 10:51:52 -08:00
fjes
hamradio
hippi
hyperv hv_netvsc: Fix book keeping of skb during batching process 2016-01-25 10:51:53 -08:00
ieee802154
ipvlan
irda net/irda: bfin_sir: remove duplicate defines 2016-01-21 10:45:45 -08:00
phy net: Fix dependencies for !HAS_IOMEM archs 2016-01-28 16:03:19 -08:00
plip net: plip: use new parport device model 2016-01-09 21:02:05 -05:00
ppp pptp: fix illegal memory access caused by multiple bind()s 2016-01-24 22:18:26 -08:00
slip
team team: Replace rcu_read_lock with a mutex in team_vlan_rx_kill_vid 2016-01-18 11:52:38 -05:00
usb lan78xx: throttle TX path at slower than SuperSpeed USB 2016-01-28 22:51:43 -08:00
vmxnet3
wan x25_asy: Free x25_asy on x25_asy_open() failure. 2016-01-13 11:45:39 -05:00
wimax
wireless Here's a first set of fixes for the 4.5-rc cycle: 2016-01-28 16:05:45 -08:00
xen-netback xen-netback: free queues after freeing the net device 2016-01-15 15:13:19 -05:00
dummy.c
eql.c
geneve.c tunnels: Allow IPv6 UDP checksums to be correctly controlled. 2016-01-21 11:10:40 -08:00
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macvlan.c macvlan: make operstate and carrier more accurate 2016-01-29 12:15:45 -08:00
macvtap.c
Makefile
mdio.c
mii.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tun.c
veth.c
virtio_net.c
vrf.c
vxlan.c tunnels: Allow IPv6 UDP checksums to be correctly controlled. 2016-01-21 11:10:40 -08:00
xen-netfront.c xen-netfront: request Tx response events more often 2016-01-28 16:08:55 -08:00