Skip to content

Commit 5c12924

Browse files
magnus-karlssonborkmann
authored andcommitted
ixgbe: add support for AF_XDP need_wakeup feature
This patch adds support for the need_wakeup feature of AF_XDP. If the application has told the kernel that it might sleep using the new bind flag XDP_USE_NEED_WAKEUP, the driver will then set this flag if it has no more buffers on the NIC Rx ring and yield to the application. For Tx, it will set the flag if it has no outstanding Tx completion interrupts and return to the application. Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 3d0c5f1 commit 5c12924

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,14 @@ int ixgbe_clean_rx_irq_zc(struct ixgbe_q_vector *q_vector,
547547
q_vector->rx.total_packets += total_rx_packets;
548548
q_vector->rx.total_bytes += total_rx_bytes;
549549

550+
if (xsk_umem_uses_need_wakeup(rx_ring->xsk_umem)) {
551+
if (failure || rx_ring->next_to_clean == rx_ring->next_to_use)
552+
xsk_set_rx_need_wakeup(rx_ring->xsk_umem);
553+
else
554+
xsk_clear_rx_need_wakeup(rx_ring->xsk_umem);
555+
556+
return (int)total_rx_packets;
557+
}
550558
return failure ? budget : (int)total_rx_packets;
551559
}
552560

@@ -615,6 +623,8 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget)
615623
if (tx_desc) {
616624
ixgbe_xdp_ring_update_tail(xdp_ring);
617625
xsk_umem_consume_tx_done(xdp_ring->xsk_umem);
626+
if (xsk_umem_uses_need_wakeup(xdp_ring->xsk_umem))
627+
xsk_clear_tx_need_wakeup(xdp_ring->xsk_umem);
618628
}
619629

620630
return !!budget && work_done;
@@ -688,7 +698,15 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
688698
if (xsk_frames)
689699
xsk_umem_complete_tx(umem, xsk_frames);
690700

701+
if (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem)) {
702+
if (tx_ring->next_to_clean == tx_ring->next_to_use)
703+
xsk_set_tx_need_wakeup(tx_ring->xsk_umem);
704+
else
705+
xsk_clear_tx_need_wakeup(tx_ring->xsk_umem);
706+
}
707+
691708
xmit_done = ixgbe_xmit_zc(tx_ring, q_vector->tx.work_limit);
709+
692710
return budget > 0 && xmit_done;
693711
}
694712

0 commit comments

Comments
 (0)