netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: sameehj@amazon.com
Cc: "Wei Liu" <wei.liu@kernel.org>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	"Haiyang Zhang" <haiyangz@microsoft.com>,
	"Stephen Hemminger" <sthemmin@microsoft.com>,
	"Jesper Dangaard Brouer" <brouer@redhat.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org, zorik@amazon.com,
	akiyano@amazon.com, gtzalik@amazon.com,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	"Daniel Borkmann" <borkmann@iogearbox.net>,
	"Alexei Starovoitov" <alexei.starovoitov@gmail.com>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Alexander Duyck" <alexander.duyck@gmail.com>,
	"Jeff Kirsher" <jeffrey.t.kirsher@intel.com>,
	"David Ahern" <dsahern@gmail.com>,
	"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Lorenzo Bianconi" <lorenzo@kernel.org>,
	"Saeed Mahameed" <saeedm@mellanox.com>,
	steffen.klassert@secunet.com
Subject: [PATCH net-next 12/33] hv_netvsc: add XDP frame size to driver
Date: Wed, 22 Apr 2020 18:08:22 +0200	[thread overview]
Message-ID: <158757170200.1370371.9930519336386674467.stgit@firesoul> (raw)
In-Reply-To: <158757160439.1370371.13213378122947426220.stgit@firesoul>

The hyperv NIC drivers XDP implementation is rather disappointing as it
will be a slowdown to enable XDP on this driver, given it will allocate a
new page for each packet and copy over the payload, before invoking the
XDP BPF-prog.

The positive thing it that its easy to determine the xdp.frame_sz.

The XDP implementation for hv_netvsc transparently passes xdp_prog
to the associated VF NIC. Many of the Azure VMs are using SRIOV, so
majority of the data are actually processed directly on the VF driver's XDP
path. So the overhead of the synthetic data path (hv_netvsc) is minimal.

Then XDP is enabled on this driver, XDP_PASS and XDP_TX will create the
SKB via build_skb (based on the newly allocated page). Now using XDP
frame_sz this will provide more skb_tailroom, which netstack can use for
SKB coalescing (e.g tcp_try_coalesce -> skb_try_coalesce).

Cc: Wei Liu <wei.liu@kernel.org>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
 drivers/net/hyperv/netvsc_bpf.c |    1 +
 drivers/net/hyperv/netvsc_drv.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hyperv/netvsc_bpf.c b/drivers/net/hyperv/netvsc_bpf.c
index b86611041db6..1e0c024b0a93 100644
--- a/drivers/net/hyperv/netvsc_bpf.c
+++ b/drivers/net/hyperv/netvsc_bpf.c
@@ -49,6 +49,7 @@ u32 netvsc_run_xdp(struct net_device *ndev, struct netvsc_channel *nvchan,
 	xdp_set_data_meta_invalid(xdp);
 	xdp->data_end = xdp->data + len;
 	xdp->rxq = &nvchan->xdp_rxq;
+	xdp->frame_sz = PAGE_SIZE;
 	xdp->handle = 0;
 
 	memcpy(xdp->data, data, len);
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index d8e86bdbfba1..651344fea0a5 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -794,7 +794,7 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
 	if (xbuf) {
 		unsigned int hdroom = xdp->data - xdp->data_hard_start;
 		unsigned int xlen = xdp->data_end - xdp->data;
-		unsigned int frag_size = netvsc_xdp_fraglen(hdroom + xlen);
+		unsigned int frag_size = xdp->frame_sz;
 
 		skb = build_skb(xbuf, frag_size);
 



  parent reply	other threads:[~2020-04-22 16:08 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <158757160439.1370371.13213378122947426220.stgit@firesoul>
2020-04-22 16:07 ` [PATCH net-next 01/33] xdp: add frame size to xdp_buff Jesper Dangaard Brouer
2020-04-24 14:00   ` Toke Høiland-Jørgensen
2020-04-28 16:06     ` Jesper Dangaard Brouer
2020-04-22 16:07 ` [PATCH net-next 02/33] bnxt: add XDP frame size to driver Jesper Dangaard Brouer
2020-04-22 16:07 ` [PATCH net-next 03/33] sfc: add XDP frame size Jesper Dangaard Brouer
2020-04-22 16:07 ` [PATCH net-next 04/33] mvneta: add XDP frame size to driver Jesper Dangaard Brouer
2020-04-22 16:07 ` [PATCH net-next 05/33] net: netsec: Add support for XDP frame size Jesper Dangaard Brouer
2020-04-22 16:07 ` [PATCH net-next 06/33] net: XDP-generic determining " Jesper Dangaard Brouer
2020-04-24 14:03   ` Toke Høiland-Jørgensen
2020-04-22 16:07 ` [PATCH net-next 07/33] xdp: xdp_frame add member frame_sz and handle in convert_to_xdp_frame Jesper Dangaard Brouer
2020-04-24 14:04   ` Toke Høiland-Jørgensen
2020-04-25  3:24   ` Toshiaki Makita
2020-04-27 15:20     ` Jesper Dangaard Brouer
2020-04-22 16:08 ` [PATCH net-next 08/33] xdp: cpumap redirect use frame_sz and increase skb_tailroom Jesper Dangaard Brouer
2020-04-24 14:04   ` Toke Høiland-Jørgensen
2020-04-22 16:08 ` [PATCH net-next 09/33] veth: adjust hard_start offset on redirect XDP frames Jesper Dangaard Brouer
2020-04-24 14:05   ` Toke Høiland-Jørgensen
2020-04-22 16:08 ` [PATCH net-next 10/33] veth: xdp using frame_sz in veth driver Jesper Dangaard Brouer
2020-04-24 14:07   ` Toke Høiland-Jørgensen
2020-04-25  3:10   ` Toshiaki Makita
2020-04-22 16:08 ` [PATCH net-next 11/33] dpaa2-eth: add XDP frame size Jesper Dangaard Brouer
2020-04-22 16:08 ` Jesper Dangaard Brouer [this message]
2020-04-22 16:57   ` [PATCH net-next 12/33] hv_netvsc: add XDP frame size to driver Haiyang Zhang
2020-04-22 16:08 ` [PATCH net-next 13/33] qlogic/qede: " Jesper Dangaard Brouer
2020-04-22 16:08 ` [PATCH net-next 14/33] net: ethernet: ti: add XDP frame size to driver cpsw Jesper Dangaard Brouer
2020-04-22 20:28   ` Grygorii Strashko
2020-04-22 16:08 ` [PATCH net-next 15/33] ena: add XDP frame size to amazon NIC driver Jesper Dangaard Brouer
2020-04-22 16:08 ` [PATCH net-next 16/33] mlx4: add XDP frame size and adjust max XDP MTU Jesper Dangaard Brouer
2020-04-22 16:08 ` [PATCH net-next 17/33] net: thunderx: add XDP frame size Jesper Dangaard Brouer
2020-04-22 16:08 ` [PATCH net-next 18/33] nfp: add XDP frame size to netronome driver Jesper Dangaard Brouer
2020-04-23  2:43   ` Jakub Kicinski
2020-04-22 16:08 ` [PATCH net-next 19/33] tun: add XDP frame size Jesper Dangaard Brouer
2020-04-27  5:51   ` Jason Wang
2020-05-06 20:30   ` Michael S. Tsirkin
2020-04-22 16:09 ` [PATCH net-next 20/33] vhost_net: also populate " Jesper Dangaard Brouer
2020-04-27  5:50   ` Jason Wang
2020-04-30  9:54     ` Jesper Dangaard Brouer
2020-05-06  6:43       ` Jason Wang
2020-04-22 16:09 ` [PATCH net-next 21/33] virtio_net: add XDP frame size in two code paths Jesper Dangaard Brouer
2020-04-27  7:21   ` Jason Wang
2020-04-27 14:32     ` Jesper Dangaard Brouer
2020-04-28  9:50       ` Jason Wang
2020-04-30 10:14         ` Jesper Dangaard Brouer
2020-05-06  6:38         ` Jason Wang
2020-04-22 16:09 ` [PATCH net-next 22/33] ixgbe: fix XDP redirect on archs with PAGE_SIZE above 4K Jesper Dangaard Brouer
2020-04-22 16:09 ` [PATCH net-next 23/33] ixgbe: add XDP frame size to driver Jesper Dangaard Brouer
2020-04-27 19:51   ` Daniel Borkmann
2020-04-22 16:09 ` [PATCH net-next 24/33] ixgbevf: add XDP frame size to VF driver Jesper Dangaard Brouer
2020-04-22 16:09 ` [PATCH net-next 25/33] i40e: add XDP frame size to driver Jesper Dangaard Brouer
2020-04-22 16:09 ` [PATCH net-next 26/33] ice: " Jesper Dangaard Brouer
2020-04-22 16:09 ` [PATCH net-next 27/33] xdp: for Intel AF_XDP drivers add XDP frame_sz Jesper Dangaard Brouer
2020-04-22 16:09 ` [PATCH net-next 28/33] mlx5: rx queue setup time determine frame_sz for XDP Jesper Dangaard Brouer
2020-04-25  0:58   ` Alexei Starovoitov
2020-04-27 20:22   ` Jesper Dangaard Brouer
2020-04-22 16:09 ` [PATCH net-next 29/33] xdp: allow bpf_xdp_adjust_tail() to grow packet size Jesper Dangaard Brouer
2020-04-24 14:09   ` Toke Høiland-Jørgensen
2020-04-27 19:01   ` Daniel Borkmann
2020-04-28 16:37     ` Jesper Dangaard Brouer
2020-04-28 19:36       ` Daniel Borkmann
2020-04-22 16:09 ` [PATCH net-next 30/33] xdp: clear grow memory in bpf_xdp_adjust_tail() Jesper Dangaard Brouer
2020-04-24 14:09   ` Toke Høiland-Jørgensen
2020-04-27  5:26   ` John Fastabend
2020-04-28 14:50     ` Jesper Dangaard Brouer
2020-04-22 16:09 ` [PATCH net-next 31/33] bpf: add xdp.frame_sz in bpf_prog_test_run_xdp() Jesper Dangaard Brouer
2020-04-22 16:10 ` [PATCH net-next 32/33] selftests/bpf: adjust BPF selftest for xdp_adjust_tail Jesper Dangaard Brouer
2020-04-22 16:10 ` [PATCH net-next 33/33] selftests/bpf: xdp_adjust_tail add grow tail tests Jesper Dangaard Brouer

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=158757170200.1370371.9930519336386674467.stgit@firesoul \
    --to=brouer@redhat.com \
    --cc=akiyano@amazon.com \
    --cc=alexander.duyck@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=borkmann@iogearbox.net \
    --cc=bpf@vger.kernel.org \
    --cc=dsahern@gmail.com \
    --cc=gtzalik@amazon.com \
    --cc=haiyangz@microsoft.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=john.fastabend@gmail.com \
    --cc=kys@microsoft.com \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    --cc=sameehj@amazon.com \
    --cc=steffen.klassert@secunet.com \
    --cc=sthemmin@microsoft.com \
    --cc=toke@redhat.com \
    --cc=wei.liu@kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=zorik@amazon.com \
    /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).