Re: [PATCH net-next v12 0/5] Enable virtio_net to act as a standby for a passthru device
From: Sridhar Samudrala Date: Thu, 24 May 2018 09:55:12 -0700 > The main motivation for this patch is to enable cloud service providers > to provide an accelerated datapath to virtio-net enabled VMs in a > transparent manner with no/minimal guest userspace changes. This also > enables hypervisor controlled live migration to be supported with VMs that > have direct attached SR-IOV VF devices. ... Series applied, thank you.
Re: [PATCH net-next v12 0/5] Enable virtio_net to act as a standby for a passthru device
On Thu, May 24, 2018 at 09:55:12AM -0700, Sridhar Samudrala wrote: > The main motivation for this patch is to enable cloud service providers > to provide an accelerated datapath to virtio-net enabled VMs in a > transparent manner with no/minimal guest userspace changes. This also > enables hypervisor controlled live migration to be supported with VMs that > have direct attached SR-IOV VF devices. > > Patch 1 introduces a failover module that provides a generic interface for > paravirtual drivers to listen for netdev register/unregister/link change > events from pci ethernet devices with the same MAC and takeover their > datapath. The notifier and event handling code is based on the existing > netvsc implementation. > > Patch 2 refactors netvsc to use the registration/notification framework > introduced by failover module. > > Patch 3 introduces a net_failover driver that provides an automated > failover mechanism to paravirtual drivers via APIs to create and destroy > a failover master netdev and mananges a primary and standby slave netdevs > that get registered via the generic failover infrastructure. > > Patch 4 introduces a new feature bit VIRTIO_NET_F_STANDBY to virtio-net > that can be used by hypervisor to indicate that virtio_net interface > should act as a standby for another device with the same MAC address. > > Patch 5 extends virtio_net to use alternate datapath when available and > registered. When STANDBY feature is enabled, virtio_net driver uese the > net_failover API to create an additional 'failover' netdev that acts as > a master device and controls 2 slave devices. The original virtio_net > netdev is registered as 'standby' netdev and a passthru/vf device with > the same MAC gets registered as 'primary' netdev. Both 'standby' and > 'failover' netdevs are associated with the same 'pci' device. The user > accesses the network interface via 'failover' netdev. The 'failover' > netdev chooses 'primary' netdev as default for transmits when it is > available with link up and running. > > As this patch series is initially focusing on usecases where hypervisor > fully controls the VM networking and the guest is not expected to directly > configure any hardware settings, it doesn't expose all the ndo/ethtool ops > that are supported by virtio_net at this time. To support additional usecases, > it should be possible to enable additional ops later by caching the state > in failover netdev and replaying when the 'primary' netdev gets registered. > > At the time of live migration, the hypervisor needs to unplug the VF device > from the guest on the source host and reset the MAC filter of the VF to > initiate failover of datapath to virtio before starting the migration. After > the migration is completed, the destination hypervisor sets the MAC filter > on the VF and plugs it back to the guest to switch over to VF datapath. > > This patch is based on the discussion initiated by Jesse on this thread. > https://marc.info/?l=linux-virtualization&m=151189725224231&w=2 Series: Acked-by: Michael S. Tsirkin > v12: > - Tested live migration with virtio-net/AVF(i40evf) configured in failover > mode while running iperf in background. Tried static ip and dhcp > configurations using 'network' scripts and Network Manager. > - Build tested netvsc module. > Updates: > - Extended generic failover module to do common functions like setting > FAILOVER_SLAVE flag, registering rx-handler and linking to upper dev in > the generic register/unregister handlers. > This required adding 3 additional failover ops pre_register, pre_unregister > and handle_frame. netvsc and net_failover drivers are updated to support > these ops. > > v11: > - Split net_failover module into 2 components. > 1. 'failover' module that provides generic failover infrastructure > to register a failover instance and listen for slave events. > 2. 'net_failover' driver that provides APIs to create/destroy upper > netdev and supports 3-netdev model used by virtio-net. > - Added documentation > > v10: > - fix net_failover_open() to update failover CARRIER correctly based on > standby and primary states. > - fix net_failover_handle_frame() to handle frames received on standby > when primary is present. > - replace netdev_upper_dev_link with netdev_master_upper_dev_link and > handle lower dev state changes. > - fix net_failver_create() and net_failover_register() interfaces to > use ERR_PTR and avoid arg ** > - disable setting mac address when virtio-net in STANDBY mode > - document exported symbols > - added entry to MAINTAINERS file > > v9: > Select NET_FAILOVER automatically when VIRTIO_NET/HYPERV_NET > are enabled. (stephen) > > v8: > - Made the failover managment routines more robust by updating the feature > bits/other fields in the failover netdev when slave netdevs are > registered/unregistered. (mst) > - added support for handling vlans. > - Limited the changes in netvsc to only use the n
[PATCH net-next v12 0/5] Enable virtio_net to act as a standby for a passthru device
The main motivation for this patch is to enable cloud service providers to provide an accelerated datapath to virtio-net enabled VMs in a transparent manner with no/minimal guest userspace changes. This also enables hypervisor controlled live migration to be supported with VMs that have direct attached SR-IOV VF devices. Patch 1 introduces a failover module that provides a generic interface for paravirtual drivers to listen for netdev register/unregister/link change events from pci ethernet devices with the same MAC and takeover their datapath. The notifier and event handling code is based on the existing netvsc implementation. Patch 2 refactors netvsc to use the registration/notification framework introduced by failover module. Patch 3 introduces a net_failover driver that provides an automated failover mechanism to paravirtual drivers via APIs to create and destroy a failover master netdev and mananges a primary and standby slave netdevs that get registered via the generic failover infrastructure. Patch 4 introduces a new feature bit VIRTIO_NET_F_STANDBY to virtio-net that can be used by hypervisor to indicate that virtio_net interface should act as a standby for another device with the same MAC address. Patch 5 extends virtio_net to use alternate datapath when available and registered. When STANDBY feature is enabled, virtio_net driver uese the net_failover API to create an additional 'failover' netdev that acts as a master device and controls 2 slave devices. The original virtio_net netdev is registered as 'standby' netdev and a passthru/vf device with the same MAC gets registered as 'primary' netdev. Both 'standby' and 'failover' netdevs are associated with the same 'pci' device. The user accesses the network interface via 'failover' netdev. The 'failover' netdev chooses 'primary' netdev as default for transmits when it is available with link up and running. As this patch series is initially focusing on usecases where hypervisor fully controls the VM networking and the guest is not expected to directly configure any hardware settings, it doesn't expose all the ndo/ethtool ops that are supported by virtio_net at this time. To support additional usecases, it should be possible to enable additional ops later by caching the state in failover netdev and replaying when the 'primary' netdev gets registered. At the time of live migration, the hypervisor needs to unplug the VF device from the guest on the source host and reset the MAC filter of the VF to initiate failover of datapath to virtio before starting the migration. After the migration is completed, the destination hypervisor sets the MAC filter on the VF and plugs it back to the guest to switch over to VF datapath. This patch is based on the discussion initiated by Jesse on this thread. https://marc.info/?l=linux-virtualization&m=151189725224231&w=2 v12: - Tested live migration with virtio-net/AVF(i40evf) configured in failover mode while running iperf in background. Tried static ip and dhcp configurations using 'network' scripts and Network Manager. - Build tested netvsc module. Updates: - Extended generic failover module to do common functions like setting FAILOVER_SLAVE flag, registering rx-handler and linking to upper dev in the generic register/unregister handlers. This required adding 3 additional failover ops pre_register, pre_unregister and handle_frame. netvsc and net_failover drivers are updated to support these ops. v11: - Split net_failover module into 2 components. 1. 'failover' module that provides generic failover infrastructure to register a failover instance and listen for slave events. 2. 'net_failover' driver that provides APIs to create/destroy upper netdev and supports 3-netdev model used by virtio-net. - Added documentation v10: - fix net_failover_open() to update failover CARRIER correctly based on standby and primary states. - fix net_failover_handle_frame() to handle frames received on standby when primary is present. - replace netdev_upper_dev_link with netdev_master_upper_dev_link and handle lower dev state changes. - fix net_failver_create() and net_failover_register() interfaces to use ERR_PTR and avoid arg ** - disable setting mac address when virtio-net in STANDBY mode - document exported symbols - added entry to MAINTAINERS file v9: Select NET_FAILOVER automatically when VIRTIO_NET/HYPERV_NET are enabled. (stephen) v8: - Made the failover managment routines more robust by updating the feature bits/other fields in the failover netdev when slave netdevs are registered/unregistered. (mst) - added support for handling vlans. - Limited the changes in netvsc to only use the notifier/event/lookups from the failover module. The slave register/unregister/link-change handlers are only updated to use the getbymac routine to get the upper netdev. There is no change in their functionality. (stephen) - renamed structs/function/file names to use net_failover prefix.