netdevsim: Implement legacy/switchdev mode for VFs
authorDmytro Linkin <dlinkin@nvidia.com>
Wed, 2 Jun 2021 12:17:18 +0000 (15:17 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Jun 2021 21:08:36 +0000 (14:08 -0700)
commit160dc373eead2143ea51b7f8e2a6bf1e383f24f8
treea50a402872175616256e01e148bed6d34152bfbe
parent92ba1f29e6e2f16eb93a0a2c7c01985920b89222
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>
drivers/net/netdevsim/bus.c
drivers/net/netdevsim/dev.c
drivers/net/netdevsim/netdev.c
drivers/net/netdevsim/netdevsim.h