[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210207084412.252259-1-parav@nvidia.com>
Date: Sun, 7 Feb 2021 10:44:05 +0200
From: Parav Pandit <parav@...dia.com>
To: <netdev@...r.kernel.org>, <davem@...emloft.net>, <kuba@...nel.org>
CC: Parav Pandit <parav@...dia.com>
Subject: [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
--
2.26.2
Powered by blists - more mailing lists