Skip to content

Commit 9e92883

Browse files
author
Alexei Starovoitov
committed
Merge branch 'xsk: another round of fixes'
Maciej Fijalkowski says: ==================== Hello, yet another fixes for XSK from Magnus and me. Magnus addresses the fact that xp_alloc() can return NULL, so this needs to be handled to avoid clearing entries in the SW ring on driver side. Then he addresses the off-by-one problem in Tx desc cleaning routine for ice ZC driver. From my side, I am adding protection to ZC Rx processing loop so that cleaning of descriptors wouldn't go over already processed entries. Then I also fix an issue with assigning XSK pool to Tx queues. This is directed to bpf tree. Thanks! Maciej Fijalkowski (2): ice: xsk: stop Rx processing when ntc catches ntu ice: xsk: fix indexing in ice_tx_xsk_pool() ==================== Acked-by: Alexander Lobakin <alexandr.lobakin@intel.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2 parents 7df482e + 1ac2524 commit 9e92883

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ static inline struct xsk_buff_pool *ice_tx_xsk_pool(struct ice_tx_ring *ring)
710710
struct ice_vsi *vsi = ring->vsi;
711711
u16 qid;
712712

713-
qid = ring->q_index - vsi->num_xdp_txq;
713+
qid = ring->q_index - vsi->alloc_txq;
714714

715715
if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps))
716716
return NULL;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,9 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget)
608608
*/
609609
dma_rmb();
610610

611+
if (unlikely(rx_ring->next_to_clean == rx_ring->next_to_use))
612+
break;
613+
611614
xdp = *ice_xdp_buf(rx_ring, rx_ring->next_to_clean);
612615

613616
size = le16_to_cpu(rx_desc->wb.pkt_len) &
@@ -754,7 +757,7 @@ static u16 ice_clean_xdp_irq_zc(struct ice_tx_ring *xdp_ring, int napi_budget)
754757
next_dd = next_dd + tx_thresh;
755758
if (next_dd >= desc_cnt)
756759
next_dd = tx_thresh - 1;
757-
} while (budget--);
760+
} while (--budget);
758761

759762
xdp_ring->next_dd = next_dd;
760763

net/xdp/xsk_buff_pool.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,13 @@ u32 xp_alloc_batch(struct xsk_buff_pool *pool, struct xdp_buff **xdp, u32 max)
591591
u32 nb_entries1 = 0, nb_entries2;
592592

593593
if (unlikely(pool->dma_need_sync)) {
594+
struct xdp_buff *buff;
595+
594596
/* Slow path */
595-
*xdp = xp_alloc(pool);
596-
return !!*xdp;
597+
buff = xp_alloc(pool);
598+
if (buff)
599+
*xdp = buff;
600+
return !!buff;
597601
}
598602

599603
if (unlikely(pool->free_list_cnt)) {

0 commit comments

Comments
 (0)