diff options
author | Dmytro Linkin <dlinkin@nvidia.com> | 2021-06-02 15:17:18 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-03 00:08:36 +0300 |
commit | 160dc373eead2143ea51b7f8e2a6bf1e383f24f8 (patch) | |
tree | a50a402872175616256e01e148bed6d34152bfbe /drivers/net/netdevsim/netdev.c | |
parent | 92ba1f29e6e2f16eb93a0a2c7c01985920b89222 (diff) | |
download | linux-160dc373eead2143ea51b7f8e2a6bf1e383f24f8.tar.xz |
netdevsim: Implement legacy/switchdev mode for VFs
Implement callbacks to set/get eswitch mode value. Add helpers to check
current mode.
Instantiate VFs' net devices and devlink ports on switchdev enabling and
remove them on legacy enabling. Changing number of VFs while in
switchdev mode triggers VFs creation/deletion.
Also disable NDO API callback to set VF rate, since it's legacy API.
Switchdev API to set VF rate will be implemented in one of the next
patches.
Signed-off-by: Dmytro Linkin <dlinkin@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netdevsim/netdev.c')
-rw-r--r-- | drivers/net/netdevsim/netdev.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 9352e18b4db9..c3aeb15843e2 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -113,6 +113,11 @@ static int nsim_set_vf_rate(struct net_device *dev, int vf, int min, int max) struct netdevsim *ns = netdev_priv(dev); struct nsim_bus_dev *nsim_bus_dev = ns->nsim_bus_dev; + if (nsim_esw_mode_is_switchdev(ns->nsim_dev)) { + pr_err("Not supported in switchdev mode. Please use devlink API.\n"); + return -EOPNOTSUPP; + } + if (vf >= nsim_bus_dev->num_vfs) return -EINVAL; |