aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/netdevsim/dev.c
AgeCommit message (Collapse)AuthorFilesLines
2019-08-19Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netDavid S. Miller1-38/+25
Merge conflict of mlx5 resolved using instructions in merge commit 9566e650bf7fdf58384bb06df634f7531ca3a97e. Signed-off-by: David S. Miller <[email protected]>
2019-08-17Documentation: Add description of netdevsim trapsIdo Schimmel1-0/+3
Signed-off-by: Ido Schimmel <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-08-17netdevsim: Add devlink-trap supportIdo Schimmel1-1/+278
Have netdevsim register its trap groups and traps with devlink during initialization and periodically report trapped packets to devlink core. Since netdevsim is not a real device, the trapped packets are emulated using a workqueue that periodically reports a UDP packet with a random 5-tuple from each active packet trap and from each running netdev. Signed-off-by: Ido Schimmel <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-08-15netdevsim: implement support for devlink region and snapshotsJiri Pirko1-1/+62
Implement dummy region of size 32K and allow user to create snapshots or random data using debugfs file trigger. Signed-off-by: Jiri Pirko <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-08-11netdevsim: register couple of devlink paramsJiri Pirko1-1/+71
Register couple of devlink params, one generic, one driver-specific. Make the values available over debugfs. Example: $ echo "111" > /sys/bus/netdevsim/new_device $ devlink dev param netdevsim/netdevsim111: name max_macs type generic values: cmode driverinit value 32 name test1 type driver-specific values: cmode driverinit value true $ cat /sys/kernel/debug/netdevsim/netdevsim111/max_macs 32 $ cat /sys/kernel/debug/netdevsim/netdevsim111/test1 Y $ devlink dev param set netdevsim/netdevsim111 name max_macs cmode driverinit value 16 $ devlink dev param set netdevsim/netdevsim111 name test1 cmode driverinit value false $ devlink dev reload netdevsim/netdevsim111 $ cat /sys/kernel/debug/netdevsim/netdevsim111/max_macs 16 $ cat /sys/kernel/debug/netdevsim/netdevsim111/test1 Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-08-11netdevsim: Restore per-network namespace accounting for fib entriesDavid Ahern1-38/+25
Prior to the commit in the fixes tag, the resource controller in netdevsim tracked fib entries and rules per network namespace. Restore that behavior. Fixes: 5fc494225c1e ("netdevsim: create devlink instance per netdevsim instance") Signed-off-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-06-04netdevsim: implement fake flash updating with notificationsJiri Pirko1-0/+44
Signed-off-by: Jiri Pirko <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-04-26netdevsim: move netdev creation/destruction to dev probeJiri Pirko1-1/+12
Remove the existing way to create netdevsim over rtnetlink and move the netdev creation/destruction to dev probe, so for every probed port, a netdevsim-netdev instance is created. Adjust selftests to work with new interface. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-04-26netdevsim: extend device attrs to support port addition and deletionJiri Pirko1-4/+51
In order to test flows in core, it is beneficial to maintain previously supported possibility to add and delete ports during netdevsim lifetime. Do it by extending device sysfs attrs by "new_port" and "del_port". Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-04-26netdevsim: implement dev probe/remove skeleton with port initializationJiri Pirko1-15/+115
Implement netdevsim bus probing of netdevsim devices. For every probed device create a devlink instance. According to the user-passed value, create a number of ports represented by devlink port instances. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-04-26netdevsim: change debugfs tree topologyJiri Pirko1-3/+7
With the model where dev is represented by devlink and ports are represented by devlink ports, make debugfs file names independent on netdev names. Change the topology to the one illustrated by the following example: $ ls /sys/kernel/debug/netdevsim/ netdevsim1 $ ls /sys/kernel/debug/netdevsim/netdevsim1/ bpf_bind_accept bpf_bind_verifier_delay bpf_bound_progs ports $ ls /sys/kernel/debug/netdevsim/netdevsim1/ports/ 0 1 $ ls /sys/kernel/debug/netdevsim/netdevsim1/ports/0/ bpf_map_accept bpf_offloaded_id bpf_tc_accept bpf_tc_non_bound_accept bpf_xdpdrv_accept bpf_xdpoffload_accept dev ipsec $ ls /sys/kernel/debug/netdevsim/netdevsim1/ports/0/dev -l lrwxrwxrwx 1 root root 0 Apr 13 15:58 /sys/kernel/debug/netdevsim/netdevsim1/ports/0/dev -> ../../../netdevsim1 Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-04-26netdevsim: generate random switch id instead of using dev idJiri Pirko1-0/+3
Current implementation of parent_id/switch_id does not follow the original idea of being unique. The values are "0", "1", etc. Instead of that, generate 32 random bytes. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-04-26netdevsim: merge sdev into devJiri Pirko1-0/+47
As previously introduce dev which is mapped 1:1 to a bus device covers the purpose of the original shared device, merge the sdev code into dev. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-04-26netdevsim: rename dev_init/exit() functions and make them independent on nsJiri Pirko1-19/+13
These functions are going to be called from bus probe/release(), therefore make them independent on ns struct and rename accordingly. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-04-26netdevsim: move device registration and related code to bus.cJiri Pirko1-1/+1
Move netdevsim device registration into bus.c and alongside with that the related sysfs attributes. Introduce new struct nsim_bus_dev to represent a netdevsim device on netdevsim bus. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2019-04-26netdevsim: rename devlink.c to dev.c to contain per-dev(asic) itemsJiri Pirko1-0/+241
The existing devlink.c code is going to be extended to represent asic device on a bus. As this is about more than just devlink, rename the file. Do appropriate prefix renaming alongside with that. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>