From: planck kernel size experiment Subject: [PATCH 8/8] virtio_net: remove standby failover support The QEMU command creates exactly one virtio-net device. There is no host passthrough NIC and the STANDBY feature is not part of the appliance ABI. Nevertheless VIRTIO_NET selects NET_FAILOVER, which in turn selects the generic failover core and retains a second virtual-netdevice implementation. Stop advertising STANDBY and remove its probe/remove/error plumbing. This lets Kconfig drop both failover layers; MAC configuration and the ordinary single-device datapath are unchanged. --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -448,7 +448,6 @@ config VIRTIO_NET tristate "Virtio network driver" depends on VIRTIO - select NET_FAILOVER select DIMLIB help This is the virtual network driver for virtio. It can be used with --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -475,9 +474,6 @@ unsigned long guest_offloads; unsigned long guest_offloads_capable; - /* failover when STANDBY feature enabled */ - struct failover *failover; - u64 device_stats_cap; struct virtio_net_rss_config_hdr *rss_hdr; @@ -3591,9 +3587,6 @@ struct sockaddr *addr; struct scatterlist sg; - if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STANDBY)) - return -EOPNOTSUPP; - addr = kmemdup(p, sizeof(*addr), GFP_KERNEL); if (!addr) return -ENOMEM; @@ -6203,7 +6196,6 @@ .ndo_xdp_xmit = virtnet_xdp_xmit, .ndo_xsk_wakeup = virtnet_xsk_wakeup, .ndo_features_check = passthru_features_check, - .ndo_get_phys_port_name = virtnet_get_phys_port_name, .ndo_set_features = virtnet_set_features, .ndo_tx_timeout = virtnet_tx_timeout, }; @@ -6624,12 +6616,6 @@ __virtio_clear_bit(vdev, VIRTIO_NET_F_MTU); } - if (virtio_has_feature(vdev, VIRTIO_NET_F_STANDBY) && - !virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) { - dev_warn(&vdev->dev, "device advertises feature VIRTIO_NET_F_STANDBY but not VIRTIO_NET_F_MAC, disabling standby"); - __virtio_clear_bit(vdev, VIRTIO_NET_F_STANDBY); - } - return 0; } @@ -6956,14 +6942,6 @@ virtnet_init_settings(dev); - if (virtio_has_feature(vdev, VIRTIO_NET_F_STANDBY)) { - vi->failover = net_failover_create(vi->dev); - if (IS_ERR(vi->failover)) { - err = PTR_ERR(vi->failover); - goto free_vqs; - } - } - if (vi->has_rss || vi->has_rss_hash_report) virtnet_init_default_rss(vi); @@ -6976,7 +6954,7 @@ if (err) { pr_debug("virtio_net: registering device failed\n"); rtnl_unlock(); - goto free_failover; + goto free_vqs; } /* Disable config change notification until ndo_open. */ @@ -7075,8 +7053,6 @@ free_unregister_netdev: unregister_netdev(dev); -free_failover: - net_failover_destroy(vi->failover); free_vqs: virtio_reset_device(vdev); free_receive_page_frags(vi); @@ -7124,8 +7100,6 @@ unregister_netdev(vi->dev); - net_failover_destroy(vi->failover); - remove_vq_common(vi); free_netdev(vi->dev); @@ -7179,7 +7153,7 @@ VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, \ VIRTIO_NET_F_CTRL_MAC_ADDR, \ VIRTIO_NET_F_MTU, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, \ - VIRTIO_NET_F_SPEED_DUPLEX, VIRTIO_NET_F_STANDBY, \ + VIRTIO_NET_F_SPEED_DUPLEX, \ VIRTIO_NET_F_RSS, VIRTIO_NET_F_HASH_REPORT, VIRTIO_NET_F_NOTF_COAL, \ VIRTIO_NET_F_VQ_NOTF_COAL, \ VIRTIO_NET_F_GUEST_HDRLEN, VIRTIO_NET_F_DEVICE_STATS