From: Paul Durrant <xadimgnik@gmail.com>
To: "'Denis Kirjanov'" <kda@linux-powerpc.org>, <netdev@vger.kernel.org>
Cc: <jgross@suse.com>, <ilias.apalodimas@linaro.org>, <wei.liu@kernel.org>
Subject: RE: [PATCH net-next v4] xen networking: add basic XDP support for xen-netfront
Date: Wed, 18 Mar 2020 10:27:26 -0000 [thread overview]
Message-ID: <006201d5fd0f$d2f25010$78d6f030$@xen.org> (raw)
In-Reply-To: <1584364176-23346-1-git-send-email-kda@linux-powerpc.org>
> -----Original Message-----
> From: Denis Kirjanov <kda@linux-powerpc.org>
> Sent: 16 March 2020 13:10
> To: netdev@vger.kernel.org
> Cc: jgross@suse.com; ilias.apalodimas@linaro.org; wei.liu@kernel.org; paul@xen.org; Denis Kirjanov
> <kda@linux-powerpc.org>
> Subject: [PATCH net-next v4] xen networking: add basic XDP support for xen-netfront
>
> The patch adds a basic XDP processing to xen-netfront driver.
>
> We ran an XDP program for an RX response received from netback
> driver. Also we request xen-netback to adjust data offset for
> bpf_xdp_adjust_head() header space for custom headers.
>
> v4:
> - added verbose patch descriprion
> - don't expose the XDP headroom offset to the domU guest
> - add a modparam to netback to toggle XDP offset
> - don't process jumbo frames for now
>
> v3:
> - added XDP_TX support (tested with xdping echoserver)
> - added XDP_REDIRECT support (tested with modified xdp_redirect_kern)
> - moved xdp negotiation to xen-netback
>
> v2:
> - avoid data copying while passing to XDP
> - tell xen-netback that we need the headroom space
>
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
> ---
> drivers/net/xen-netback/common.h | 2 +
> drivers/net/xen-netback/netback.c | 7 ++
> drivers/net/xen-netback/rx.c | 7 +-
> drivers/net/xen-netback/xenbus.c | 28 +++++
> drivers/net/xen-netfront.c | 240 +++++++++++++++++++++++++++++++++++++-
> 5 files changed, 282 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
> index 05847eb..4a148d6 100644
> --- a/drivers/net/xen-netback/common.h
> +++ b/drivers/net/xen-netback/common.h
> @@ -280,6 +280,7 @@ struct xenvif {
> u8 ip_csum:1;
> u8 ipv6_csum:1;
> u8 multicast_control:1;
> + u8 xdp_enabled:1;
>
> /* Is this interface disabled? True when backend discovers
> * frontend is rogue.
> @@ -395,6 +396,7 @@ static inline pending_ring_idx_t nr_pending_reqs(struct xenvif_queue *queue)
> irqreturn_t xenvif_interrupt(int irq, void *dev_id);
>
> extern bool separate_tx_rx_irq;
> +extern bool provides_xdp_headroom;
>
> extern unsigned int rx_drain_timeout_msecs;
> extern unsigned int rx_stall_timeout_msecs;
> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
> index 315dfc6..6dfca72 100644
> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -96,6 +96,13 @@
> module_param_named(hash_cache_size, xenvif_hash_cache_size, uint, 0644);
> MODULE_PARM_DESC(hash_cache_size, "Number of flows in the hash cache");
>
> +/* The module parameter tells that we have to put data
> + * for xen-netfront with the XDP_PACKET_HEADROOM offset
> + * needed for XDP processing
> + */
> +bool provides_xdp_headroom = true;
> +module_param(provides_xdp_headroom, bool, 0644);
> +
> static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx,
> u8 status);
>
> diff --git a/drivers/net/xen-netback/rx.c b/drivers/net/xen-netback/rx.c
> index ef58870..aba826b 100644
> --- a/drivers/net/xen-netback/rx.c
> +++ b/drivers/net/xen-netback/rx.c
> @@ -33,6 +33,11 @@
> #include <xen/xen.h>
> #include <xen/events.h>
>
> +static inline int xenvif_rx_xdp_offset(struct xenvif *vif)
> +{
> + return (vif->xdp_enabled ? XDP_PACKET_HEADROOM : 0);
> +}
> +
No need for the brackets here.
[snip]
> @@ -167,6 +175,9 @@ struct netfront_rx_info {
> struct xen_netif_extra_info extras[XEN_NETIF_EXTRA_TYPE_MAX - 1];
> };
>
> +static int xennet_xdp_xmit(struct net_device *dev, int n,
> + struct xdp_frame **frames, u32 flags);
> +
> static void skb_entry_set_link(union skb_entry *list, unsigned short id)
> {
> list->link = id;
> @@ -406,7 +417,8 @@ static void xennet_tx_buf_gc(struct netfront_queue *queue)
> queue->grant_tx_ref[id] = GRANT_INVALID_REF;
> queue->grant_tx_page[id] = NULL;
> add_id_to_freelist(&queue->tx_skb_freelist, queue->tx_skbs, id);
> - dev_kfree_skb_irq(skb);
> + if (skb)
> + dev_kfree_skb_irq(skb);
Can you drop this? I said previously that it is unnecessary.
Paul
next prev parent reply other threads:[~2020-03-18 10:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-16 13:09 [PATCH net-next v4] xen networking: add basic XDP support for xen-netfront Denis Kirjanov
2020-03-16 15:44 ` Jesper Dangaard Brouer
2020-03-18 12:31 ` Denis Kirjanov
2020-03-16 15:52 ` Jesper Dangaard Brouer
2020-03-18 12:30 ` Denis Kirjanov
2020-03-18 10:27 ` Paul Durrant [this message]
2020-03-18 11:16 ` Jürgen Groß
2020-03-18 12:50 ` Denis Kirjanov
2020-03-18 13:11 ` Jürgen Groß
2020-03-23 10:15 ` Denis Kirjanov
2020-03-23 10:27 ` Jürgen Groß
2020-03-23 10:49 ` Denis Kirjanov
2020-03-23 11:00 ` Jürgen Groß
2020-03-30 12:16 ` Denis Kirjanov
2020-03-30 12:55 ` Jürgen Groß
2020-03-30 13:09 ` Denis Kirjanov
2020-03-30 13:13 ` Jürgen Groß
2020-03-30 13:18 ` Denis Kirjanov
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='006201d5fd0f$d2f25010$78d6f030$@xen.org' \
--to=xadimgnik@gmail.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jgross@suse.com \
--cc=kda@linux-powerpc.org \
--cc=netdev@vger.kernel.org \
--cc=paul@xen.org \
--cc=wei.liu@kernel.org \
/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).