ice: xsk: allow empty Rx descriptors on XSK ZC data path

Commit ac6f733a7b ("ice: allow empty Rx descriptors") stated that ice
HW can produce empty descriptors that are valid and they should be
processed.

Add this support to xsk ZC path to avoid potential processing problems.

Fixes: 2d4238f556 ("ice: Add support for AF_XDP")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Tested-by: Kiran Bhandare <kiranx.bhandare@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
Maciej Fijalkowski 2021-12-13 16:31:10 +01:00 committed by Tony Nguyen
parent 8b51a13c37
commit 8bea15ab74
1 changed files with 10 additions and 4 deletions

View File

@ -538,12 +538,18 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget)
*/ */
dma_rmb(); dma_rmb();
xdp = *ice_xdp_buf(rx_ring, rx_ring->next_to_clean);
size = le16_to_cpu(rx_desc->wb.pkt_len) & size = le16_to_cpu(rx_desc->wb.pkt_len) &
ICE_RX_FLX_DESC_PKT_LEN_M; ICE_RX_FLX_DESC_PKT_LEN_M;
if (!size) if (!size) {
break; xdp->data = NULL;
xdp->data_end = NULL;
xdp->data_hard_start = NULL;
xdp->data_meta = NULL;
goto construct_skb;
}
xdp = *ice_xdp_buf(rx_ring, rx_ring->next_to_clean);
xsk_buff_set_size(xdp, size); xsk_buff_set_size(xdp, size);
xsk_buff_dma_sync_for_cpu(xdp, rx_ring->xsk_pool); xsk_buff_dma_sync_for_cpu(xdp, rx_ring->xsk_pool);
@ -561,7 +567,7 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget)
ice_bump_ntc(rx_ring); ice_bump_ntc(rx_ring);
continue; continue;
} }
construct_skb:
/* XDP_PASS path */ /* XDP_PASS path */
skb = ice_construct_skb_zc(rx_ring, xdp); skb = ice_construct_skb_zc(rx_ring, xdp);
if (!skb) { if (!skb) {