linux/drivers
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
..
accessibility
acpi libnvdimm for 4.5 2016-01-13 19:15:14 -08:00
amba
android
ata Merge branch 'for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2016-01-11 19:33:59 -08:00
atm
auxdisplay
base linux-kselftest-4.5-rc1 2016-01-17 13:31:50 -08:00
bcma GPIO bulk updates for the v4.5 kernel cycle: 2016-01-17 12:32:01 -08:00
block mm, dax, pmem: introduce pfn_t 2016-01-15 17:56:32 -08:00
bluetooth Bluetooth: btmrvl: don't send data to firmware while processing suspend 2016-01-06 16:37:14 +01:00
bus
cdrom cdrom: don't open-code memdup_user() 2016-01-06 08:25:24 -05:00
char Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2016-01-17 19:13:15 -08:00
clk clk: remove duplicated COMMON_CLK_NXP record from clk/Kconfig 2016-01-13 18:09:52 -08:00
clocksource Merge branches 'clockevents/4.4-fixes' and 'clockevents/4.5-fixes' of http://git.linaro.org/people/daniel.lezcano/linux into timers/urgent 2016-01-12 11:01:12 +01:00
connector connector: bump skb->users before callback invocation 2016-01-04 21:46:45 -05:00
cpufreq powerpc updates for 4.5 2016-01-15 13:18:47 -08:00
cpuidle powerpc updates for 4.5 2016-01-15 13:18:47 -08:00
crypto powerpc updates for 4.5 2016-01-15 13:18:47 -08:00
dca
devfreq
dio
dma sound updates for 4.5-rc1 2016-01-17 12:05:31 -08:00
dma-buf
edac
eisa
extcon
firewire
firmware Merge branch 'dmi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2016-01-15 18:12:18 -08:00
fmc
fpga
gpio GPIO bulk updates for the v4.5 kernel cycle: 2016-01-17 12:32:01 -08:00
gpu virtio: barrier rework+fixes 2016-01-18 16:44:24 -08:00
hid GPIO bulk updates for the v4.5 kernel cycle: 2016-01-17 12:32:01 -08:00
hsi HSI: omap_ssi_port: fix handling of_get_named_gpio result 2016-01-07 16:07:54 +01:00
hv char/misc patches for 4.5-rc1 2016-01-13 10:23:36 -08:00
hwmon Merge git://www.linux-watchdog.org/linux-watchdog 2016-01-17 12:15:38 -08:00
hwspinlock
hwtracing
i2c Merge branch 'i2c/for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2016-01-14 11:25:37 -08:00
ide drivers/ide: make ide-scan-pci.c driver explicitly non-modular 2016-01-18 14:12:33 -05:00
idle
iio include/linux/kernel.h: change abs() macro so it uses consistent return type 2016-01-16 11:17:22 -08:00
infiniband net/mlx5_core: Fix trimming down IRQ number 2016-01-17 12:08:04 -05:00
input GPIO bulk updates for the v4.5 kernel cycle: 2016-01-17 12:32:01 -08:00
iommu Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-01-11 16:26:03 -08:00
ipack
irqchip Merge branches 'clockevents/4.4-fixes' and 'clockevents/4.5-fixes' of http://git.linaro.org/people/daniel.lezcano/linux into timers/urgent 2016-01-12 11:01:12 +01:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-01-11 23:55:43 -05:00
leds GPIO bulk updates for the v4.5 kernel cycle: 2016-01-17 12:32:01 -08:00
lguest lguest: Map switcher text R/O 2016-01-12 12:17:28 +01:00
lightnvm
macintosh
mailbox
mcb
md md updates for 4.5 2016-01-15 12:28:00 -08:00
media fbdev changes for 4.5 2016-01-18 11:58:31 -08:00
memory
memstick
message
mfd GPIO bulk updates for the v4.5 kernel cycle: 2016-01-17 12:32:01 -08:00
misc virtio: barrier rework+fixes 2016-01-18 16:44:24 -08:00
mmc Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32 2016-01-18 12:50:55 -08:00
mtd MTD updates for v4.5: 2016-01-13 11:25:54 -08:00
net macvlan: make operstate and carrier more accurate 2016-01-29 12:15:45 -08:00
nfc
ntb
nubus
nvdimm mm, dax, pmem: introduce {get|put}_dev_pagemap() for dax-gup 2016-01-15 17:56:32 -08:00
nvme
nvmem
of of: of_mdio: Add a whitelist of PHY compatibilities. 2016-01-28 22:53:16 -08:00
oprofile
parisc parisc: Initialize PCI bridge cache line and default latency 2016-01-12 22:03:21 +01:00
parport parport: avoid assignment in if 2016-01-03 16:32:59 -08:00
pci sound updates for 4.5-rc1 2016-01-17 12:05:31 -08:00
pcmcia
perf
phy
pinctrl GPIO bulk updates for the v4.5 kernel cycle: 2016-01-17 12:32:01 -08:00
platform Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2016-01-17 13:40:25 -08:00
pnp PNP: respect PNP_DRIVER_RES_DO_NOT_CHANGE when detaching 2016-01-04 22:12:42 +01:00
power power: bq27xxx_battery: Fix bq27541 AveragePower register address 2016-01-14 01:03:18 +01:00
powercap Merge branch 'powercap' 2016-01-12 01:12:40 +01:00
pps
ps3
ptp
pwm
rapidio
ras
regulator regulator: Update for v4.5 2016-01-15 12:14:47 -08:00
remoteproc virtio: make find_vqs() checkpatch.pl-friendly 2016-01-12 20:47:06 +02:00
reset
rpmsg virtio: make find_vqs() checkpatch.pl-friendly 2016-01-12 20:47:06 +02:00
rtc RTC for 4.5 2016-01-18 12:10:45 -08:00
s390 virtio: barrier rework+fixes 2016-01-18 16:44:24 -08:00
sbus convert a bunch of open-coded instances of memdup_user_nul() 2016-01-04 10:26:58 -05:00
scsi SCSI misc on 20160113 2016-01-13 19:37:36 -08:00
sfi
sh
sn
soc powerpc updates for 4.5 2016-01-15 13:18:47 -08:00
spi powerpc updates for 4.5 2016-01-15 13:18:47 -08:00
spmi
ssb
staging kmemcg: account certain kmem allocations to memcg 2016-01-14 16:00:49 -08:00
target
tc
thermal
thunderbolt
tty GPIO bulk updates for the v4.5 kernel cycle: 2016-01-17 12:32:01 -08:00
uio
usb powerpc updates for 4.5 2016-01-15 13:18:47 -08:00
uwb
vfio vfio/iommu_type1: make use of info.flags 2016-01-04 12:55:44 -07:00
vhost
video fbdev changes for 4.5 2016-01-18 11:58:31 -08:00
virt
virtio virtio: make find_vqs() checkpatch.pl-friendly 2016-01-12 20:47:06 +02:00
vlynq
vme
w1
watchdog watchdog: asm9260: remove __init and __exit annotations 2016-01-11 22:48:05 +01:00
xen virtio: barrier rework+fixes 2016-01-18 16:44:24 -08:00
zorro
Kconfig
Makefile