Skip to content

netdevsim port add, delete support

Parav Pandit netdev oe-kbuild-all 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 2 repliesIn review
  2. v17 patches 2 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7netdevsim: Add support for add and delete of a PCI PF portdrivers/net/netdevsim/Makefile drivers/net/netdevsim/dev.c drivers/net/netdevsim/netdevsim.h +1 more+371 -10 replies
2/7netdevsim: Add support for add and delete PCI SF portdrivers/net/netdevsim/netdevsim.h drivers/net/netdevsim/port_function.c+97 -30 replies
3/7netdevsim: Simulate get hardware address of a PCI portdrivers/net/netdevsim/dev.c drivers/net/netdevsim/netdevsim.h drivers/net/netdevsim/port_function.c+35 -00 replies
4/7netdevsim: Simulate set hardware address of a PCI portdrivers/net/netdevsim/dev.c drivers/net/netdevsim/netdevsim.h drivers/net/netdevsim/port_function.c+26 -00 replies
5/7netdevsim: Simulate port function state for a PCI portdrivers/net/netdevsim/dev.c drivers/net/netdevsim/netdevsim.h drivers/net/netdevsim/port_function.c+28 -00 replies
6/7netdevsim: Simulate port function set state for a PCI portdrivers/net/netdevsim/dev.c drivers/net/netdevsim/netdevsim.h drivers/net/netdevsim/port_function.c+20 -00 replies
7/7netdevsim: Add netdevsim port add test casestools/testing/selftests/drivers/net/netdevsim/devlink.sh+71 -12 replies

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by.

PatchJiri Pirko
1/7
2/7R-b
3/7
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH net-next v2 0/7] netdevsim port add, delete support

This series simulates one or more PCI PF and SF port addition and function configuration functionality.

Example sequence:
Create a device with ID=10 and one physical port.

$ echo "10 1" > /sys/bus/netdevsim/new_device

Add PCI PF port:

$ devlink port add netdevsim/netdevsim10 flavour pcipf pfnum 2
netdevsim/netdevsim10/1: type eth netdev eth1 flavour pcipf controller 0 pfnum 2 external false splittable false
  function:
    hw_addr 00:00:00:00:00:00
$ devlink port add netdevsim/netdevsim10 flavour pcisf pfnum 2
netdevsim/netdevsim10/2: type eth netdev eth2 flavour pcisf controller 0 pfnum 2 sfnum 0 splittable false
  function:
    hw_addr 00:00:00:00:00:00

Show devlink port:

$ devlink port show netdevsim/netdevsim10/2
netdevsim/netdevsim10/2: type eth netdev eth2 flavour pcisf controller 0 pfnum 2 sfnum 0 splittable false
  function:
    hw_addr 00:00:00:00:00:00 state inactive opstate detached

Set the MAC address and activate the function:

$ devlink port function set netdevsim/netdevsim10/2 hw_addr 00:11:22:33:44:55 state active

Show the port and function attributes in JSON format:

$ devlink port show netdevsim/netdevsim10/2 -jp
{
    "port": {
        "netdevsim/netdevsim10/2": {
            "type": "eth",
            "netdev": "eth2",
            "flavour": "pcisf",
            "controller": 0,
            "pfnum": 2,
            "sfnum": 0,
            "splittable": false,
            "function": {
                "hw_addr": "00:11:22:33:44:55",
                "state": "active",
                "opstate": "attached"
            }
        }
    }
}

Delete PCI SF and PF ports:

$ devlink port del netdevsim/netdevsim10/2

Patch summary:
patch-1 adds support for adding/remove PCI PF port patch-2 adds support for adding/remove PCI SF port patch-3 simulates MAC address query patch-4 simulates setting MAC address patch-5 simulates state query
patch-6 simulates setting state
patch-7 adds tests

Parav Pandit (7):
netdevsim: Add support for add and delete of a PCI PF port
netdevsim: Add support for add and delete PCI SF port
netdevsim: Simulate get hardware address of a PCI port
netdevsim: Simulate set hardware address of a PCI port
netdevsim: Simulate port function state for a PCI port
netdevsim: Simulate port function set state for a PCI port
netdevsim: Add netdevsim port add test cases

 drivers/net/netdevsim/Makefile                |   2 +-
 drivers/net/netdevsim/dev.c                   |  14 +
 drivers/net/netdevsim/netdevsim.h             |  38 ++
 drivers/net/netdevsim/port_function.c         | 521 ++++++++++++++++++
 .../drivers/net/netdevsim/devlink.sh          |  72 ++-
 5 files changed, 645 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/netdevsim/port_function.c
Signature · 1 line
2.26.2