[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190418140614.3973-1-jiri@resnulli.us>
Date: Thu, 18 Apr 2019 16:05:59 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, mlxsw@...lanox.com,
jakub.kicinski@...ronome.com, dsahern@...il.com
Subject: [patch net-next 00/15] netdevsim: impement proper device model
From: Jiri Pirko <jiri@...lanox.com>
Currently the model of netdevsim is a bit odd in multiple ways.
1) devlink instance is not in any way related with actual netdevsim
netdevices. Instead, it is created per-namespace.
2) multi-port netdevsim device is done using "link" attribute.
3) netdevsim bus is there only to have something to bind the netdev to,
it really does not act as a bus.
4) netdevsim instances are created by "ip link add" which is great for
soft devices with no hw backend. The rtnl core allocates netdev and
calls into driver holding rtnl mutex. For hw-backed devices, this
flow is wrong as it breaks order in which things are done.
This patchset adjust netdevsim to fix all above.
In order to support proper devlink and devlink port instances and to be
able to emulate real devices, there is need to implement bus probe and
instantiate everything from there. User can specify device id and port
count to be instantianted. For example:
echo "10 4" > /sys/bus/netdevsim/new_device
Then devlink shows this:
$ devlink dev
netdevsim/netdevsim10
$ devlink port
netdevsim/netdevsim10/0: type eth netdev netdevsim10p1 flavour physical
netdevsim/netdevsim10/1: type eth netdev netdevsim10p2 flavour physical
netdevsim/netdevsim10/2: type eth netdev netdevsim10p3 flavour physical
netdevsim/netdevsim10/3: type eth netdev netdevsim10p4 flavour physical
Debugfs topology is also adjusted a bit. The rest stays the same as
before.
Udev bits are pushed in following pull request:
https://github.com/systemd/systemd/pull/12340
Note that future extensions to allow add and delete ports during
netdevsim life are quite easy to do. There is just needed to pick a
correct interface.
Jiri Pirko (15):
netdevsim: move device registration on bus to be done earlier in init
netdevsim: create devlink instance per netdevsim instance
netdevsim: rename devlink.c to dev.c to contain per-dev(asic) items
netdevsim: put netdevsim bus code into separate file
netdevsim: move device registration and related code to bus.c
netdevsim: add stub netdevsim driver implementation
netdevsim: use ida for bus device ids
netdevsim: add bus attributes to add new and delete devices
netdevsim: rename dev_init/exit() functions and make them independent
on ns
netdevsim: merge sdev into dev
netdevsim: generate random switch id instead of using dev id
netdevsim: change debugfs tree topology
netdevsim: implement dev probe/remove skeleton with port
initialization
netdevsim: move netdev creation/destruction to dev probe
netdevsim: implement ndo_get_devlink_port
drivers/net/netdevsim/Makefile | 2 +-
drivers/net/netdevsim/bpf.c | 92 ++---
drivers/net/netdevsim/bus.c | 305 +++++++++++++++
drivers/net/netdevsim/dev.c | 385 +++++++++++++++++++
drivers/net/netdevsim/devlink.c | 295 ---------------
drivers/net/netdevsim/fib.c | 103 +++--
drivers/net/netdevsim/ipsec.c | 3 +-
drivers/net/netdevsim/netdev.c | 396 +++++---------------
drivers/net/netdevsim/netdevsim.h | 124 +++---
tools/testing/selftests/bpf/test_offload.py | 204 +++++-----
tools/testing/selftests/net/rtnetlink.sh | 8 +-
11 files changed, 1071 insertions(+), 846 deletions(-)
create mode 100644 drivers/net/netdevsim/bus.c
create mode 100644 drivers/net/netdevsim/dev.c
delete mode 100644 drivers/net/netdevsim/devlink.c
--
2.17.2
Powered by blists - more mailing lists