mbox series

[net-next,v2,0/3] netdevsim: link and forward skbs between ports

Message ID 20231210010448.816126-1-dw@davidwei.uk (mailing list archive)
Headers show
Series netdevsim: link and forward skbs between ports | expand

Message

David Wei Dec. 10, 2023, 1:04 a.m. UTC
This patchset adds the ability to link two netdevsim ports together and
forward skbs between them, similar to veth. The goal is to use netdevsim
for testing features e.g. zero copy Rx using io_uring.

This feature was tested locally on QEMU, and a selftest is included.

---
v1->v2:
- renamed debugfs file from "link" to "peer"
- replaced strstep() with sscanf() for consistency
- increased char[] buf sz to 22 for copying id + port from user
- added err msg w/ expected fmt when linking as a hint to user
- prevent linking port to itself
- protect peer ptr using RCU

David Wei (3):
  netdevsim: allow two netdevsim ports to be connected
  netdevsim: forward skbs from one connected port to another
  netdevsim: add selftest for forwarding skb between connected ports

 drivers/net/netdevsim/bus.c                   |  10 ++
 drivers/net/netdevsim/dev.c                   |  86 ++++++++++++++
 drivers/net/netdevsim/netdev.c                |  29 ++++-
 drivers/net/netdevsim/netdevsim.h             |   3 +
 .../selftests/drivers/net/netdevsim/peer.sh   | 111 ++++++++++++++++++
 5 files changed, 234 insertions(+), 5 deletions(-)
 create mode 100755 tools/testing/selftests/drivers/net/netdevsim/peer.sh