All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch net-next v2 00/16] netdevsim: impement proper device model
@ 2019-04-20 10:29 Jiri Pirko
  2019-04-20 10:29 ` [patch net-next v2 01/16] netdevsim: move device registration on bus to be done earlier in init Jiri Pirko
                   ` (15 more replies)
  0 siblings, 16 replies; 28+ messages in thread
From: Jiri Pirko @ 2019-04-20 10:29 UTC (permalink / raw)
  To: netdev; +Cc: davem, mlxsw, jakub.kicinski, dsahern

From: Jiri Pirko <jiri@mellanox.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 eni0np1 flavour physical
netdevsim/netdevsim10/1: type eth netdev eni0np2 flavour physical
netdevsim/netdevsim10/2: type eth netdev eni0np3 flavour physical
netdevsim/netdevsim10/3: type eth netdev eni0np4 flavour physical

There is possible to add and delete ports using their indexes
during netdevsim device lifetime like this:

# echo "43" > /sys/bus/netdevsim/devices/netdevsim10/new_port
# echo "0" > /sys/bus/netdevsim/devices/netdevsim10/del_port

Then devlink shows this:

$ devlink port
netdevsim/netdevsim10/1: type eth netdev eni10np2 flavour physical
netdevsim/netdevsim10/2: type eth netdev eni10np3 flavour physical
netdevsim/netdevsim10/3: type eth netdev eni10np4 flavour physical
netdevsim/netdevsim10/43: type eth netdev eni10np44 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

v1->v2:
See individual patches for changelog. The difference is in adding patch
"extend device attrs to support port addition and deletion" and
adjusting selftests.

Jiri Pirko (16):
  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: extend device attrs to support port addition and deletion
  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                 | 339 +++++++++++++++
 drivers/net/netdevsim/dev.c                 | 447 ++++++++++++++++++++
 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           | 130 +++---
 tools/testing/selftests/bpf/test_offload.py | 199 +++++----
 tools/testing/selftests/net/rtnetlink.sh    |   8 +-
 11 files changed, 1181 insertions(+), 833 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


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2019-04-23 19:14 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-20 10:29 [patch net-next v2 00/16] netdevsim: impement proper device model Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 01/16] netdevsim: move device registration on bus to be done earlier in init Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 02/16] netdevsim: create devlink instance per netdevsim instance Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 03/16] netdevsim: rename devlink.c to dev.c to contain per-dev(asic) items Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 04/16] netdevsim: put netdevsim bus code into separate file Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 05/16] netdevsim: move device registration and related code to bus.c Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 06/16] netdevsim: add stub netdevsim driver implementation Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 07/16] netdevsim: use ida for bus device ids Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 08/16] netdevsim: add bus attributes to add new and delete devices Jiri Pirko
2019-04-22 19:23   ` Jakub Kicinski
2019-04-23  6:29     ` Jiri Pirko
2019-04-23 17:06       ` Jakub Kicinski
2019-04-23 19:09         ` Jiri Pirko
2019-04-22 19:23   ` Jakub Kicinski
2019-04-23  6:31     ` Jiri Pirko
2019-04-23 17:08       ` Jakub Kicinski
2019-04-20 10:29 ` [patch net-next v2 09/16] netdevsim: rename dev_init/exit() functions and make them independent on ns Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 10/16] netdevsim: merge sdev into dev Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 11/16] netdevsim: generate random switch id instead of using dev id Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 12/16] netdevsim: change debugfs tree topology Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 13/16] netdevsim: implement dev probe/remove skeleton with port initialization Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 14/16] netdevsim: extend device attrs to support port addition and deletion Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 15/16] netdevsim: move netdev creation/destruction to dev probe Jiri Pirko
2019-04-22 19:31   ` Jakub Kicinski
2019-04-23  7:20     ` Jiri Pirko
2019-04-23 17:05       ` Jakub Kicinski
2019-04-23 19:14         ` Jiri Pirko
2019-04-20 10:29 ` [patch net-next v2 16/16] netdevsim: implement ndo_get_devlink_port Jiri Pirko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.