From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Saeed Mahameed <saeedm@mellanox.com>
Cc: Daniel Borkmann <borkmann@iogearbox.net>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
netdev@vger.kernel.org, dsahern@gmail.com, gospo@broadcom.com,
bjorn.topel@intel.com, michael.chan@broadcom.com,
brouer@redhat.com
Subject: Re: [bpf-next V1-RFC PATCH 12/14] xdp: generic XDP handling of xdp_rxq_info
Date: Mon, 18 Dec 2017 10:47:49 +0100 [thread overview]
Message-ID: <20171218104749.3cb23edf@redhat.com> (raw)
In-Reply-To: <fbf83e88-0c0c-22fb-998b-ee46d3002604@mellanox.com>
On Wed, 13 Dec 2017 14:50:07 -0800
Saeed Mahameed <saeedm@mellanox.com> wrote:
> On 12/13/2017 3:20 AM, Jesper Dangaard Brouer wrote:
> > Hook points for xdp_rxq_info:
> > * init+reg: netif_alloc_rx_queues
> > * unreg : netif_free_rx_queues
> >
> > The net_device have some members (num_rx_queues + real_num_rx_queues)
> > and data-area (dev->_rx with struct netdev_rx_queue's) that were
> > primarily used for exporting information about RPS (CONFIG_RPS) queues
> > to sysfs (CONFIG_SYSFS).
> >
> > For generic XDP extend struct netdev_rx_queue with the xdp_rxq_info,
> > and remove some of the CONFIG_SYSFS ifdefs.
> >
> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > ---
> > include/linux/netdevice.h | 2 ++
> > net/core/dev.c | 60 ++++++++++++++++++++++++++++++++++++++-------
> > 2 files changed, 52 insertions(+), 10 deletions(-)
> >
> > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> > index cc4ce7456e38..43595b037872 100644
> > --- a/include/linux/netdevice.h
> > +++ b/include/linux/netdevice.h
> > @@ -44,6 +44,7 @@
> > #include <net/dcbnl.h>
> > #endif
> > #include <net/netprio_cgroup.h>
> > +#include <net/xdp.h>
> >
> > #include <linux/netdev_features.h>
> > #include <linux/neighbour.h>
> > @@ -686,6 +687,7 @@ struct netdev_rx_queue {
> > #endif
> > struct kobject kobj;
> > struct net_device *dev;
> > + struct xdp_rxq_info xdp_rxq;
> > } ____cacheline_aligned_in_smp;
> >
>
> Instead of duplicating this xdp_rxq_info and have 2 instances of it for
> drivers that do support XDP (the generic one and the driver internal
> xdp_rxq_info), drivers can use the generic netdev_rx_queue.xdp_rxq to
> register their own xdp_rxq_info.
> I suggest the following API for drivers to use:
>
> xdp_rxq_info_reg(netdev, rxq_index)
> {
> rxqueue = dev->_rx + rxq_index;
> xdp_rxq = rxqueue.xdp_rxq;
> xdp_rxq_info_init(xdp_rxq);
> xdp_rxq.dev = netdev;
> xdp_rxq.queue_index = rxq_index;
> }
>
> xdp_rxq_info_unreg(netdev, rxq_index)
> {
> ...
> }
>
> This way you can avoid the xdp_rxq_info structure management by the
> drivers them selves and reduce duplicated code to init, fill the
> xdp_rxq_info per driver.
Having the xdp_rxq_info struct memory associated with the net_device,
and not the drivers RX-rings, make it harder for the drivers to use
this API. Because drivers (e.g. i40e) to minimize "downtime" when
e.g. changing numbers of queues (ethtool set_channels) allocate and
setup new (RX+TX+XDP_TX)-rings _before_ taking down current RX-rings.
Thus, you have the problem of driver wanting to register two
xdp_rxq_info's at the same time, before unregistering the old.
Another issue I've seen is that, drivers do funny tricks, and you
cannot always assuming that rxq_index would be valid and bind directly
to dev->_rx + rxq_index. E.g. in the i40e driver they have
vsi->num_queue_pairs they iterate over, and one of the
vsi->rx_rings[i] is a special flow-director (FDIR) ring that comes in
the end of the rx_rings[] array but internally have queue_index zero.
I was also hoping to unifying/integrating the generic-XDP REDIRECT
code path, by assigning the net_device stored xdp_rxq_info another
qtype "SKB-MODE-TYPE". Allowing us to share more of the native-XDP
redirect-code path with SKB-XDP frames from generic-XDP.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
next prev parent reply other threads:[~2017-12-18 9:47 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 11:19 [bpf-next V1-RFC PATCH 00/14] xdp: new XDP rx-queue info concept Jesper Dangaard Brouer
2017-12-13 11:19 ` [bpf-next V1-RFC PATCH 01/14] xdp: base API for " Jesper Dangaard Brouer
2017-12-14 2:34 ` David Ahern
2017-12-18 10:55 ` Jesper Dangaard Brouer
2017-12-18 13:23 ` David Ahern
2017-12-18 15:52 ` Jesper Dangaard Brouer
2017-12-21 16:59 ` Jesper Dangaard Brouer
2017-12-13 11:19 ` [bpf-next V1-RFC PATCH 02/14] xdp/mlx5: setup xdp_rxq_info and extend with qtype Jesper Dangaard Brouer
2017-12-13 12:27 ` Tariq Toukan
2017-12-13 13:44 ` Jesper Dangaard Brouer
2017-12-13 23:03 ` Saeed Mahameed
2017-12-14 6:46 ` Jesper Dangaard Brouer
2017-12-13 11:19 ` [bpf-next V1-RFC PATCH 03/14] i40e: setup xdp_rxq_info Jesper Dangaard Brouer
2017-12-18 10:52 ` [Intel-wired-lan] " Björn Töpel
2017-12-18 13:05 ` Jesper Dangaard Brouer
2017-12-13 11:19 ` [bpf-next V1-RFC PATCH 04/14] ixgbe: " Jesper Dangaard Brouer
2017-12-13 11:19 ` [bpf-next V1-RFC PATCH 05/14] xdp/qede: setup xdp_rxq_info and intro xdp_rxq_info_is_reg Jesper Dangaard Brouer
2017-12-13 11:19 ` [bpf-next V1-RFC PATCH 06/14] mlx4: setup xdp_rxq_info Jesper Dangaard Brouer
2017-12-13 12:42 ` Tariq Toukan
2017-12-13 14:00 ` Jesper Dangaard Brouer
2017-12-13 11:19 ` [bpf-next V1-RFC PATCH 07/14] bnxt_en: " Jesper Dangaard Brouer
2017-12-13 11:20 ` [bpf-next V1-RFC PATCH 08/14] nfp: " Jesper Dangaard Brouer
2017-12-14 2:34 ` Jakub Kicinski
2017-12-18 20:25 ` Jesper Dangaard Brouer
2017-12-13 11:20 ` [bpf-next V1-RFC PATCH 09/14] thunderx: " Jesper Dangaard Brouer
2017-12-13 11:20 ` [bpf-next V1-RFC PATCH 10/14] tun: " Jesper Dangaard Brouer
2017-12-20 7:48 ` Jason Wang
2017-12-21 15:42 ` Jesper Dangaard Brouer
2017-12-13 11:20 ` [bpf-next V1-RFC PATCH 11/14] virtio_net: " Jesper Dangaard Brouer
2017-12-13 11:20 ` [bpf-next V1-RFC PATCH 12/14] xdp: generic XDP handling of xdp_rxq_info Jesper Dangaard Brouer
2017-12-13 22:50 ` Saeed Mahameed
2017-12-18 9:47 ` Jesper Dangaard Brouer [this message]
2017-12-13 11:20 ` [bpf-next V1-RFC PATCH 13/14] bpf: finally expose xdp_rxq_info to XDP bpf-programs Jesper Dangaard Brouer
2017-12-13 11:20 ` [bpf-next V1-RFC PATCH 14/14] samples/bpf: program demonstrating access to xdp_rxq_info 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=20171218104749.3cb23edf@redhat.com \
--to=brouer@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bjorn.topel@intel.com \
--cc=borkmann@iogearbox.net \
--cc=dsahern@gmail.com \
--cc=gospo@broadcom.com \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@mellanox.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).