2018-04-24 18:56 GMT+02:00 Willem de Bruijn <willemdebruijn.ker...@gmail.com>:
> On Mon, Apr 23, 2018 at 9:56 AM, Björn Töpel <bjorn.to...@gmail.com> wrote:
>> From: Björn Töpel <bjorn.to...@intel.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.to...@intel.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

Reply via email to