From: Song Liu <liu.song.a23@gmail.com>
To: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: Networking <netdev@vger.kernel.org>,
Daniel Borkmann <borkmann@iogearbox.net>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Song Liu <songliubraving@fb.com>,
John Fastabend <john.fastabend@gmail.com>
Subject: Re: [bpf-next V2 PATCH 4/8] tun: implement flush flag for ndo_xdp_xmit
Date: Thu, 31 May 2018 09:14:53 -0700 [thread overview]
Message-ID: <CAPhsuW4vW4RjT4dTT+GgPGePA1wVpmbRD9ZmV3yrMMKN5_TX2g@mail.gmail.com> (raw)
In-Reply-To: <152775720301.24817.4050947353101519726.stgit@firesoul>
On Thu, May 31, 2018 at 2:00 AM, Jesper Dangaard Brouer
<brouer@redhat.com> wrote:
> When passed the XDP_XMIT_FLUSH flag tun_xdp_xmit now performs the same
> kind of socket wake up as in tun_xdp_flush(). The wake up code from
> tun_xdp_flush is generalized and shared with tun_xdp_xmit.
>
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Song Liu <songliubraving@fb.com>
> ---
> drivers/net/tun.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index b182b8cdd219..d82a05fb0594 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -1285,6 +1285,14 @@ static const struct net_device_ops tun_netdev_ops = {
> .ndo_get_stats64 = tun_net_get_stats64,
> };
>
> +static void __tun_xdp_flush_tfile(struct tun_file *tfile)
> +{
> + /* Notify and wake up reader process */
> + if (tfile->flags & TUN_FASYNC)
> + kill_fasync(&tfile->fasync, SIGIO, POLL_IN);
> + tfile->socket.sk->sk_data_ready(tfile->socket.sk);
> +}
> +
> static int tun_xdp_xmit(struct net_device *dev, int n,
> struct xdp_frame **frames, u32 flags)
> {
> @@ -1295,7 +1303,7 @@ static int tun_xdp_xmit(struct net_device *dev, int n,
> int cnt = n;
> int i;
>
> - if (unlikely(flags & ~XDP_XMIT_FLAGS_NONE))
> + if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))
> return -EINVAL;
>
> rcu_read_lock();
> @@ -1325,6 +1333,9 @@ static int tun_xdp_xmit(struct net_device *dev, int n,
> }
> spin_unlock(&tfile->tx_ring.producer_lock);
>
> + if (flags & XDP_XMIT_FLUSH)
> + __tun_xdp_flush_tfile(tfile);
> +
> rcu_read_unlock();
> return cnt - drops;
> }
> @@ -1353,11 +1364,7 @@ static void tun_xdp_flush(struct net_device *dev)
>
> tfile = rcu_dereference(tun->tfiles[smp_processor_id() %
> numqueues]);
> - /* Notify and wake up reader process */
> - if (tfile->flags & TUN_FASYNC)
> - kill_fasync(&tfile->fasync, SIGIO, POLL_IN);
> - tfile->socket.sk->sk_data_ready(tfile->socket.sk);
> -
> + __tun_xdp_flush_tfile(tfile);
> out:
> rcu_read_unlock();
> }
>
next prev parent reply other threads:[~2018-05-31 16:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-31 8:59 [bpf-next V2 PATCH 0/8] bpf/xdp: add flags argument to ndo_xdp_xmit and flag flush operation Jesper Dangaard Brouer
2018-05-31 8:59 ` [bpf-next V2 PATCH 1/8] xdp: add flags argument to ndo_xdp_xmit API Jesper Dangaard Brouer
2018-05-31 8:59 ` [bpf-next V2 PATCH 2/8] i40e: implement flush flag for ndo_xdp_xmit Jesper Dangaard Brouer
2018-06-04 13:11 ` Daniel Borkmann
2018-05-31 8:59 ` [bpf-next V2 PATCH 3/8] ixgbe: " Jesper Dangaard Brouer
2018-05-31 16:14 ` Song Liu
2018-06-04 13:19 ` Daniel Borkmann
2018-06-04 13:53 ` Jesper Dangaard Brouer
2018-05-31 9:00 ` [bpf-next V2 PATCH 4/8] tun: " Jesper Dangaard Brouer
2018-05-31 16:14 ` Song Liu [this message]
2018-05-31 9:00 ` [bpf-next V2 PATCH 5/8] virtio_net: " Jesper Dangaard Brouer
2018-05-31 16:15 ` Song Liu
2018-05-31 9:00 ` [bpf-next V2 PATCH 6/8] xdp: done implementing ndo_xdp_xmit flush flag for all drivers Jesper Dangaard Brouer
2018-05-31 16:16 ` Song Liu
2018-05-31 9:00 ` [bpf-next V2 PATCH 7/8] bpf/xdp: non-map redirect can avoid calling ndo_xdp_flush Jesper Dangaard Brouer
2018-05-31 16:16 ` Song Liu
2018-05-31 9:00 ` [bpf-next V2 PATCH 8/8] bpf/xdp: devmap " Jesper Dangaard Brouer
2018-05-31 16:06 ` Song Liu
2018-06-03 15:17 ` [bpf-next V2 PATCH 0/8] bpf/xdp: add flags argument to ndo_xdp_xmit and flag flush operation Alexei Starovoitov
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=CAPhsuW4vW4RjT4dTT+GgPGePA1wVpmbRD9ZmV3yrMMKN5_TX2g@mail.gmail.com \
--to=liu.song.a23@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=borkmann@iogearbox.net \
--cc=brouer@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.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).