Source
netdev_err(failover_dev, "Device %s is VLAN challenged and failover device has VLAN set up\n",
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, Intel Corporation. */
/* This provides a net_failover interface for paravirtual drivers to
* provide an alternate datapath by exporting APIs to create and
* destroy a upper 'net_failover' netdev. The upper dev manages the
* original paravirtual interface as a 'standby' netdev and uses the
* generic failover infrastructure to register and manage a direct
* attached VF as a 'primary' netdev. This enables live migration of
* a VM with direct attached VF by failing over to the paravirtual
* datapath when the VF is unplugged.
*
* Some of the netdev management routines are based on bond/team driver as
* this driver provides active-backup functionality similar to those drivers.
*/
static bool net_failover_xmit_ready(struct net_device *dev)
{
return netif_running(dev) && netif_carrier_ok(dev);
}
static int net_failover_open(struct net_device *dev)
{
struct net_failover_info *nfo_info = netdev_priv(dev);
struct net_device *primary_dev, *standby_dev;
int err;
primary_dev = rtnl_dereference(nfo_info->primary_dev);
if (primary_dev) {
err = dev_open(primary_dev, NULL);
if (err)
goto err_primary_open;
}
standby_dev = rtnl_dereference(nfo_info->standby_dev);
if (standby_dev) {
err = dev_open(standby_dev, NULL);
if (err)
goto err_standby_open;
}
if ((primary_dev && net_failover_xmit_ready(primary_dev)) ||
(standby_dev && net_failover_xmit_ready(standby_dev))) {
netif_carrier_on(dev);
netif_tx_wake_all_queues(dev);
}
return 0;
err_standby_open: