netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next RFCv3 0/6] AF_XDP support for veth.
@ 2018-12-26 20:27 William Tu
  2018-12-26 20:27 ` [PATCH bpf-next RFCv3 1/6] xsk: add xsk_umem_consume_tx_virtual William Tu
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: William Tu @ 2018-12-26 20:27 UTC (permalink / raw)
  To: bjorn.topel, magnus.karlsson, ast, daniel, netdev,
	makita.toshiaki, yihung.wei, magnus.karlsson

The patch series adds AF_XDP support for veth device. The first patch
adds a new API for supporting non-physical NIC device to get
packet's virtual address.  The second patch implements the async xmit
with one extra copy. The third and forth patches implement the zero
copy AF_XDP TX support.  The fifth patch implements the AF_XDP
RX and last patch adds example use cases.

I tested with 2 namespaces, one as sender, the other as receiver.
The packet rate is measure at the receiver side.
  ip netns add at_ns0
  ip link add p0 type veth peer name p1
  ip link set p0 netns at_ns0
  ip link set dev p1 up
  ip netns exec at_ns0 ip link set dev p0 up
  
  # receiver
  ip netns exec at_ns0 xdp_rxq_info --dev p0 --action XDP_DROP

  # receiver with AF_XDP
  ip netns exec at_ns0 xdpsock -i p0 -r -N -z 

  # sender without AF_XDP ZC
  xdpsock -i p1 -t -S

  # sender with AF_XDP
  xdpsock -i p1 -t -N -z

Without AF_XDP: 724 Kpps
With AF_XDP: 1.1 Mpps (with ksoftirqd 100% cpu)
With AF_XDP: 1.4 Mpps (with ksoftirqd 100% cpu)
With both peer running AF_XDP: 2.4Mpps

v2->v3:
- refactor the xsk_umem_consume_tx_virtual, suggested by Björn Töpel
- fix the racy condition by processing tx and its peer's rx napi,
  suggested by Björn Töpel
- add AF_XDP zero copy TX
- add AF_XDP RX

v1->v2:
- refactor the xsk_umem_consume_tx_virtual
- use the umems provided by netdev
- fix bug from locating peer side rq with qid


William Tu (6):
  xsk: add xsk_umem_consume_tx_virtual.
  veth: support AF_XDP TX copy-mode.
  xsk: add new MEM type for virtual device.
  veth: add zero-copy AF_XDP TX support.
  veth: add AF_XDP RX support.
  samples: bpf: add veth AF_XDP example.

 drivers/net/veth.c             | 212 ++++++++++++++++++++++++++++++++++++++++-
 include/net/xdp.h              |   1 +
 include/net/xdp_sock.h         |   7 ++
 net/core/xdp.c                 |   1 +
 net/xdp/xdp_umem.c             |   1 +
 net/xdp/xsk.c                  |  41 ++++++--
 samples/bpf/test_veth_afxdp.sh |  82 ++++++++++++++++
 7 files changed, 336 insertions(+), 9 deletions(-)
 create mode 100755 samples/bpf/test_veth_afxdp.sh

-- 
2.7.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-01-08  7:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26 20:27 [PATCH bpf-next RFCv3 0/6] AF_XDP support for veth William Tu
2018-12-26 20:27 ` [PATCH bpf-next RFCv3 1/6] xsk: add xsk_umem_consume_tx_virtual William Tu
2018-12-26 20:27 ` [PATCH bpf-next RFCv3 2/6] veth: support AF_XDP TX copy-mode William Tu
2019-01-01 13:44   ` Toshiaki Makita
2019-01-05 15:55     ` William Tu
2019-01-08  7:25       ` Toshiaki Makita
2018-12-26 20:27 ` [PATCH bpf-next RFCv3 3/6] xsk: add new MEM type for virtual device William Tu
2018-12-26 20:27 ` [PATCH bpf-next RFCv3 4/6] veth: add zero-copy AF_XDP TX support William Tu
2018-12-26 20:27 ` [PATCH bpf-next RFCv3 5/6] veth: add AF_XDP RX support William Tu
2018-12-26 20:27 ` [PATCH bpf-next RFCv3 6/6] samples: bpf: add veth AF_XDP example William Tu

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).