Skip to content

Commit ec145a1

Browse files
michalQbanguy11
authored andcommitted
ice: respect netif readiness in AF_XDP ZC related ndo's
Address a scenario in which XSK ZC Tx produces descriptors to XDP Tx ring when link is either not yet fully initialized or process of stopping the netdev has already started. To avoid this, add checks against carrier readiness in ice_xsk_wakeup() and in ice_xmit_zc(). One could argue that bailing out early in ice_xsk_wakeup() would be sufficient but given the fact that we produce Tx descriptors on behalf of NAPI that is triggered for Rx traffic, the latter is also needed. Bringing link up is an asynchronous event executed within ice_service_task so even though interface has been brought up there is still a time frame where link is not yet ok. Without this patch, when AF_XDP ZC Tx is used simultaneously with stack Tx, Tx timeouts occur after going through link flap (admin brings interface down then up again). HW seem to be unable to transmit descriptor to the wire after HW tail register bump which in turn causes bit __QUEUE_STATE_STACK_XOFF to be set forever as netdev_tx_completed_queue() sees no cleaned bytes on the input. Fixes: 126cdfe ("ice: xsk: Improve AF_XDP ZC Tx and use batching API") Fixes: 2d4238f ("ice: Add support for AF_XDP") Reviewed-by: Shannon Nelson <[email protected]> Tested-by: Chandan Kumar Rout <[email protected]> (A Contingent Worker at Intel) Signed-off-by: Michal Kubiak <[email protected]> Signed-off-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 039564d commit ec145a1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/net/ethernet/intel/ice/ice_xsk.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,10 @@ bool ice_xmit_zc(struct ice_tx_ring *xdp_ring)
10481048

10491049
ice_clean_xdp_irq_zc(xdp_ring);
10501050

1051+
if (!netif_carrier_ok(xdp_ring->vsi->netdev) ||
1052+
!netif_running(xdp_ring->vsi->netdev))
1053+
return true;
1054+
10511055
budget = ICE_DESC_UNUSED(xdp_ring);
10521056
budget = min_t(u16, budget, ICE_RING_QUARTER(xdp_ring));
10531057

@@ -1091,7 +1095,7 @@ ice_xsk_wakeup(struct net_device *netdev, u32 queue_id,
10911095
struct ice_vsi *vsi = np->vsi;
10921096
struct ice_tx_ring *ring;
10931097

1094-
if (test_bit(ICE_VSI_DOWN, vsi->state))
1098+
if (test_bit(ICE_VSI_DOWN, vsi->state) || !netif_carrier_ok(netdev))
10951099
return -ENETDOWN;
10961100

10971101
if (!ice_is_xdp_ena_vsi(vsi))

0 commit comments

Comments
 (0)