netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Wei <dw@davidwei.uk>
To: Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@resnulli.us>,
	Sabrina Dubroca <sd@queasysnail.net>,
	netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH net-next v5 0/5] netdevsim: link and forward skbs between ports
Date: Wed, 27 Dec 2023 17:46:28 -0800	[thread overview]
Message-ID: <20231228014633.3256862-1-dw@davidwei.uk> (raw)

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.

---
v4->v5:
- reduce nsim_dev_list_lock critical section
- fixed missing mutex unlock during unwind ladder
- rework nsim_dev_peer_write synchronization to take devlink lock as
  well as rtnl_lock
- return err msgs to user during linking if port doesn't exist or
  linking to self
- update tx stats outside of RCU lock

v3->v4:
- maintain a mutex protected list of probed nsim_devs instead of using
  nsim_bus_dev
- fixed synchronization issues by taking rtnl_lock
- track tx_dropped skbs

v2->v3:
- take lock when traversing nsim_bus_dev_list
- take device ref when getting a nsim_bus_dev
- return 0 if nsim_dev_peer_read cannot find the port
- address code formatting
- do not hard code values in selftests
- add Makefile for selftests

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 (5):
  netdevsim: maintain a list of probed netdevsims
  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
  netdevsim: add Makefile for selftests

 MAINTAINERS                                   |   1 +
 drivers/net/netdevsim/dev.c                   | 153 ++++++++++++++++--
 drivers/net/netdevsim/netdev.c                |  27 +++-
 drivers/net/netdevsim/netdevsim.h             |   3 +
 .../selftests/drivers/net/netdevsim/Makefile  |  18 +++
 .../selftests/drivers/net/netdevsim/peer.sh   | 124 ++++++++++++++
 6 files changed, 310 insertions(+), 16 deletions(-)
 create mode 100644 tools/testing/selftests/drivers/net/netdevsim/Makefile
 create mode 100755 tools/testing/selftests/drivers/net/netdevsim/peer.sh

-- 
2.39.3


             reply	other threads:[~2023-12-28  1:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28  1:46 David Wei [this message]
2023-12-28  1:46 ` [PATCH net-next v5 1/5] netdevsim: maintain a list of probed netdevsims David Wei
2024-01-02 11:04   ` Jiri Pirko
2024-01-03 21:48     ` David Wei
2023-12-28  1:46 ` [PATCH net-next v5 2/5] netdevsim: allow two netdevsim ports to be connected David Wei
2024-01-02 11:11   ` Jiri Pirko
2024-01-03 21:56     ` David Wei
2024-01-04  9:30       ` Jiri Pirko
2024-01-04  1:39   ` Jakub Kicinski
2024-01-09 16:57     ` David Wei
2024-01-10  1:53       ` Jakub Kicinski
2023-12-28  1:46 ` [PATCH net-next v5 3/5] netdevsim: forward skbs from one connected port to another David Wei
2024-01-02 11:13   ` Jiri Pirko
2024-01-03 22:36     ` David Wei
2024-01-04  9:31       ` Jiri Pirko
2024-01-09 16:58         ` David Wei
2024-01-02 11:20   ` Eric Dumazet
2024-01-03 21:57     ` David Wei
2023-12-28  1:46 ` [PATCH net-next v5 4/5] netdevsim: add selftest for forwarding skb between connected ports David Wei
2023-12-28  1:46 ` [PATCH net-next v5 5/5] netdevsim: add Makefile for selftests David Wei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231228014633.3256862-1-dw@davidwei.uk \
    --to=dw@davidwei.uk \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).