AF_XDP-interaction: Move refill of fill-queue to after RX processing

The root cause of the slowdown on the first packet with timestamps,
as primary related to refilling the fill-queue, which happend before
process_packet.

Primary cause, as first packet still see a slowdown of around 4 usec
while it was around 9 usec before.

In commit 5df5332f23 ("AF_XDP-interaction: config AF_XDP frame_headroom")
the fill-queue size was increase to be larger.  This caused the
first call to handle_receive_packets() to refill too many frames
into the fill-queue.

Patch split out refill into function restock_receive_fill_queue()
which is now called *after* process_packet step, but before
releasing RX packets via xsk_ring_cons__release(&xsk->rx).

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
This commit is contained in:
Jesper Dangaard Brouer
2021-11-04 13:49:20 +01:00
parent 6016a13008
commit 556d6fd47b
2 changed files with 36 additions and 14 deletions

View File

@@ -110,6 +110,11 @@ int xdp_sock_prog(struct xdp_md *ctx)
if (!pkt_count)
return XDP_ABORTED;
__u64 cnt = (*pkt_count)++;
// if (cnt == 0) {
// if (bpf_ktime_get_ns() == 42)
// return XDP_ABORTED;
// cnt++;
// }
/* Notice how two different xdp_hints meta-data are used */
if ((cnt % 2) == 0) {