Previously, rx_dropped could be updated incorrectly, e.g. if the XDP
program redirected the frame to a socket bound to a different queue
than where the XDP program was executing.
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
if (xs->dev != xdp->rxq->dev || xs->queue_id != xdp->rxq->queue_index)
return -EINVAL;
- if (!xskq_peek_id(xs->umem->fq, &id))
+ if (!xskq_peek_id(xs->umem->fq, &id)) {
+ xs->rx_dropped++;
return -ENOSPC;
+ }
buffer = xdp_umem_get_data_with_headroom(xs->umem, id);
memcpy(buffer, xdp->data, len);
xs->umem->frame_headroom);
if (!err)
xskq_discard_id(xs->umem->fq);
+ else
+ xs->rx_dropped++;
return err;
}
err = __xsk_rcv(xs, xdp);
if (likely(!err))
xdp_return_buff(xdp);
- else
- xs->rx_dropped++;
return err;
}
err = __xsk_rcv(xs, xdp);
if (!err)
xsk_flush(xs);
- else
- xs->rx_dropped++;
return err;
}