[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJ+HfNghYw0ny7V+HX21W2qAr0kjAuDFU48A9o0e4ap1CZgDTQ@mail.gmail.com>
Date: Fri, 18 May 2018 06:23:47 +0200
From: Björn Töpel <bjorn.topel@...il.com>
To: Jesper Dangaard Brouer <brouer@...hat.com>
Cc: Magnus Karlsson <magnus.karlsson@...il.com>,
"Karlsson, Magnus" <magnus.karlsson@...el.com>,
"Duyck, Alexander H" <alexander.h.duyck@...el.com>,
Alexander Duyck <alexander.duyck@...il.com>,
John Fastabend <john.fastabend@...il.com>,
Alexei Starovoitov <ast@...com>,
Willem de Bruijn <willemdebruijn.kernel@...il.com>,
Daniel Borkmann <daniel@...earbox.net>,
"Michael S. Tsirkin" <mst@...hat.com>,
Netdev <netdev@...r.kernel.org>, michael.lundkvist@...csson.com,
"Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
"Singhai, Anjali" <anjali.singhai@...el.com>,
"Zhang, Qi Z" <qi.z.zhang@...el.com>,
intel-wired-lan <intel-wired-lan@...ts.osuosl.org>
Subject: Re: [RFC PATCH bpf-next 12/12] i40e: implement Tx zero-copy
2018-05-17 23:31 GMT+02:00 Jesper Dangaard Brouer <brouer@...hat.com>:
>
> On Tue, 15 May 2018 21:06:15 +0200 Björn Töpel <bjorn.topel@...il.com> wrote:
>
>> From: Magnus Karlsson <magnus.karlsson@...el.com>
>>
>> Here, the zero-copy ndo is implemented. As a shortcut, the existing
>> XDP Tx rings are used for zero-copy. This means that and XDP program
>> cannot redirect to an AF_XDP enabled XDP Tx ring.
>
> This "shortcut" is not acceptable, and completely broken. The
> XDP_REDIRECT queue_index is based on smp_processor_id(), and can easily
> clash with the configured XSK queue_index. Provided a bit more code
> context below...
>
Yes, and this is the reason we need to go for a solution with
dedicated Tx rings. Again, we chose not to, and simply drops
XDP_REDIRECT where the AF_XDP queue id clashes with the processor id.
The queue id hijacked by AF_XDP's egress side.
> On Tue, 15 May 2018 21:06:15 +0200
> Björn Töpel <bjorn.topel@...il.com> wrote:
>
> int i40e_xdp_xmit(struct net_device *dev, struct xdp_frame *xdpf)
> {
> struct i40e_netdev_priv *np = netdev_priv(dev);
> unsigned int queue_index = smp_processor_id();
> struct i40e_vsi *vsi = np->vsi;
> int err;
>
> if (test_bit(__I40E_VSI_DOWN, vsi->state))
> return -ENETDOWN;
>
>> @@ -4025,6 +4158,9 @@ int i40e_xdp_xmit(struct net_device *dev, struct xdp_frame *xdpf)
>> if (!i40e_enabled_xdp_vsi(vsi) || queue_index >= vsi->num_queue_pairs)
>> return -ENXIO;
>>
>> + if (vsi->xdp_rings[queue_index]->xsk_umem)
>> + return -ENXIO;
>> +
>
> Using the sane errno makes this impossible to debug (via the tracepoints).
>
The rationale was that the situation was similar to an incorrectly
configured receiving (from an XDP_REDIRECT perspective) interface.
We'll rework this! Thanks for looking into this, Jesper!
Björn
>> err = i40e_xmit_xdp_ring(xdpf, vsi->xdp_rings[queue_index]);
>> if (err != I40E_XDP_TX)
>> return -ENOSPC;
>> @@ -4048,5 +4184,34 @@ void i40e_xdp_flush(struct net_device *dev)
>> if (!i40e_enabled_xdp_vsi(vsi) || queue_index >= vsi->num_queue_pairs)
>> return;
>>
>> + if (vsi->xdp_rings[queue_index]->xsk_umem)
>> + return;
>> +
>> i40e_xdp_ring_update_tail(vsi->xdp_rings[queue_index]);
>> }
>
>
>
> --
> Best regards,
> Jesper Dangaard Brouer
> MSc.CS, Principal Kernel Engineer at Red Hat
> LinkedIn: http://www.linkedin.com/in/brouer
Powered by blists - more mailing lists