[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW79-7qDvBA+8yFkPVamigTx6oUdwb0NO6Dhvv22jsQ69g@mail.gmail.com>
Date: Thu, 31 May 2018 09:16:46 -0700
From: Song Liu <liu.song.a23@...il.com>
To: Jesper Dangaard Brouer <brouer@...hat.com>
Cc: Networking <netdev@...r.kernel.org>,
Daniel Borkmann <borkmann@...earbox.net>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Song Liu <songliubraving@...com>,
John Fastabend <john.fastabend@...il.com>
Subject: Re: [bpf-next V2 PATCH 7/8] bpf/xdp: non-map redirect can avoid
calling ndo_xdp_flush
On Thu, May 31, 2018 at 2:00 AM, Jesper Dangaard Brouer
<brouer@...hat.com> wrote:
> This is the first real user of the XDP_XMIT_FLUSH flag.
>
> As pointed out many times, XDP_REDIRECT without using BPF maps is
> significant slower than the map variant. This is primary due to the
> lack of bulking, as the ndo_xdp_flush operation is required after each
> frame (to avoid frames hanging on the egress device).
>
> It is still possible to optimize this case. Instead of invoking two
> NDO indirect calls, which are very expensive with CONFIG_RETPOLINE,
> instead instruct ndo_xdp_xmit to flush via XDP_XMIT_FLUSH flag.
>
> Signed-off-by: Jesper Dangaard Brouer <brouer@...hat.com>
Acked-by: Song Liu <songliubraving@...com>
> ---
> net/core/filter.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 6a21dbcad350..6981b4608979 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -3056,10 +3056,9 @@ static int __bpf_tx_xdp(struct net_device *dev,
> if (unlikely(!xdpf))
> return -EOVERFLOW;
>
> - sent = dev->netdev_ops->ndo_xdp_xmit(dev, 1, &xdpf, 0);
> + sent = dev->netdev_ops->ndo_xdp_xmit(dev, 1, &xdpf, XDP_XMIT_FLUSH);
> if (sent <= 0)
> return sent;
> - dev->netdev_ops->ndo_xdp_flush(dev);
> return 0;
> }
>
>
Powered by blists - more mailing lists