Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/qeth: Don't call dev_close/dev_open (DOWN/UP)

dev_close() and dev_open() are issued to change the interface state to DOWN
or UP (dev->flags IFF_UP). When the netdev is set DOWN it loses e.g its
Ipv6 addresses and routes. We don't want this in cases of device recovery
(triggered by hardware or software) or when the qeth device is set
offline.

Setting a qeth device offline or online and device recovery actions call
netif_device_detach() and/or netif_device_attach(). That will reset or
set the LOWER_UP indication i.e. change the dev->state Bit
__LINK_STATE_PRESENT. That is enough to e.g. cause bond failovers, and
still preserves the interface settings that are handled by the network
stack.

Don't call dev_open() nor dev_close() from the qeth device driver. Let the
network stack handle this.

Fixes: d4560150cb47 ("s390/qeth: call dev_close() during recovery")
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Alexandra Winter and committed by
David S. Miller
1cfef80d 666c135b

+11 -9
-1
drivers/s390/net/qeth_core.h
··· 716 716 u16 chid; 717 717 u8 ids_valid:1; /* cssid,iid,chid */ 718 718 u8 dev_addr_is_registered:1; 719 - u8 open_when_online:1; 720 719 u8 promisc_mode:1; 721 720 u8 use_v1_blkt:1; 722 721 u8 is_vm_nic:1;
-2
drivers/s390/net/qeth_core_main.c
··· 5373 5373 qeth_clear_ipacmd_list(card); 5374 5374 5375 5375 rtnl_lock(); 5376 - card->info.open_when_online = card->dev->flags & IFF_UP; 5377 - dev_close(card->dev); 5378 5376 netif_device_detach(card->dev); 5379 5377 netif_carrier_off(card->dev); 5380 5378 rtnl_unlock();
+6 -3
drivers/s390/net/qeth_l2_main.c
··· 2388 2388 qeth_enable_hw_features(dev); 2389 2389 qeth_l2_enable_brport_features(card); 2390 2390 2391 - if (card->info.open_when_online) { 2392 - card->info.open_when_online = 0; 2393 - dev_open(dev, NULL); 2391 + if (netif_running(dev)) { 2392 + local_bh_disable(); 2393 + napi_schedule(&card->napi); 2394 + /* kick-start the NAPI softirq: */ 2395 + local_bh_enable(); 2396 + qeth_l2_set_rx_mode(dev); 2394 2397 } 2395 2398 rtnl_unlock(); 2396 2399 }
+5 -3
drivers/s390/net/qeth_l3_main.c
··· 2018 2018 netif_device_attach(dev); 2019 2019 qeth_enable_hw_features(dev); 2020 2020 2021 - if (card->info.open_when_online) { 2022 - card->info.open_when_online = 0; 2023 - dev_open(dev, NULL); 2021 + if (netif_running(dev)) { 2022 + local_bh_disable(); 2023 + napi_schedule(&card->napi); 2024 + /* kick-start the NAPI softirq: */ 2025 + local_bh_enable(); 2024 2026 } 2025 2027 rtnl_unlock(); 2026 2028 }