[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ+HfNjt_ZaK+CUbtwfoD0FXOzra8BnqFtd+CbQEr-DvSfgC+g@mail.gmail.com>
Date: Tue, 24 Apr 2018 20:32:51 +0200
From: Björn Töpel <bjorn.topel@...il.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: "Karlsson, Magnus" <magnus.karlsson@...el.com>,
Alexander Duyck <alexander.h.duyck@...el.com>,
Alexander Duyck <alexander.duyck@...il.com>,
John Fastabend <john.fastabend@...il.com>,
Alexei Starovoitov <ast@...com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Daniel Borkmann <daniel@...earbox.net>,
"Michael S. Tsirkin" <mst@...hat.com>,
Network Development <netdev@...r.kernel.org>,
Björn Töpel <bjorn.topel@...el.com>,
michael.lundkvist@...csson.com,
"Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
"Singhai, Anjali" <anjali.singhai@...el.com>,
"Zhang, Qi Z" <qi.z.zhang@...el.com>
Subject: Re: [PATCH bpf-next 07/15] xsk: add Rx receive functions and poll support
2018-04-24 18:56 GMT+02:00 Willem de Bruijn <willemdebruijn.kernel@...il.com>:
> On Mon, Apr 23, 2018 at 9:56 AM, Björn Töpel <bjorn.topel@...il.com> wrote:
>> From: Björn Töpel <bjorn.topel@...el.com>
>>
>> Here the actual receive functions of AF_XDP are implemented, that in a
>> later commit, will be called from the XDP layers.
>>
>> There's one set of functions for the XDP_DRV side and another for
>> XDP_SKB (generic).
>>
>> Support for the poll syscall is also implemented.
>>
>> Signed-off-by: Björn Töpel <bjorn.topel@...el.com>
>> ---
>
>> +/* Common functions operating for both RXTX and umem queues */
>> +
>> +static inline u32 xskq_nb_avail(struct xsk_queue *q, u32 dcnt)
>> +{
>> + u32 entries = q->prod_tail - q->cons_tail;
>> +
>> + if (entries == 0) {
>> + /* Refresh the local pointer */
>> + q->prod_tail = READ_ONCE(q->ring->producer);
>> + }
>> +
>> + entries = q->prod_tail - q->cons_tail;
>
> Probably meant to be inside the branch? Though I see the same
> pattern in the userspace example program.
>
Yes! Nasty C&P going on here... :-(
>> +static inline u32 *xskq_validate_id(struct xsk_queue *q)
>> +{
>> + while (q->cons_tail != q->cons_head) {
>> + struct xdp_umem_ring *ring = (struct xdp_umem_ring *)q->ring;
>> + unsigned int idx = q->cons_tail & q->ring_mask;
>> +
>> + if (xskq_is_valid_id(q, ring->desc[idx]))
>> + return &ring->desc[idx];
>
> Missing a q->cons_tail increment in this loop?
Indeed! Good catch! Thanks!
Björn
Powered by blists - more mailing lists