Skip to content

Commit 0bf50ce

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== ice: fix AF_XDP ZC timeout and concurrency issues Maciej Fijalkowski says: Changes included in this patchset address an issue that customer has been facing when AF_XDP ZC Tx sockets were used in combination with flow control and regular Tx traffic. After executing: ethtool --set-priv-flags $dev link-down-on-close on ethtool -A $dev rx on tx on launching multiple ZC Tx sockets on $dev + pinging remote interface (so that regular Tx traffic is present) and then going through down/up of $dev, Tx timeout occurred and then most of the time ice driver was unable to recover from that state. These patches combined together solve the described above issue on customer side. Main focus here is to forbid producing Tx descriptors when either carrier is not yet initialized or process of bringing interface down has already started. v1: https://lore.kernel.org/netdev/[email protected]/ * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ice: xsk: fix txq interrupt mapping ice: add missing WRITE_ONCE when clearing ice_rx_ring::xdp_prog ice: improve updating ice_{t,r}x_ring::xsk_pool ice: toggle netif_carrier when setting up XSK pool ice: modify error handling when setting XSK pool in ndo_bpf ice: replace synchronize_rcu with synchronize_net ice: don't busy wait for Rx queue disable in ice_qp_dis() ice: respect netif readiness in AF_XDP ZC related ndo's ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 89add40 + 963fb46 commit 0bf50ce

File tree

6 files changed

+135
-90
lines changed

6 files changed

+135
-90
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -765,18 +765,17 @@ static inline struct xsk_buff_pool *ice_get_xp_from_qid(struct ice_vsi *vsi,
765765
}
766766

767767
/**
768-
* ice_xsk_pool - get XSK buffer pool bound to a ring
768+
* ice_rx_xsk_pool - assign XSK buff pool to Rx ring
769769
* @ring: Rx ring to use
770770
*
771-
* Returns a pointer to xsk_buff_pool structure if there is a buffer pool
772-
* present, NULL otherwise.
771+
* Sets XSK buff pool pointer on Rx ring.
773772
*/
774-
static inline struct xsk_buff_pool *ice_xsk_pool(struct ice_rx_ring *ring)
773+
static inline void ice_rx_xsk_pool(struct ice_rx_ring *ring)
775774
{
776775
struct ice_vsi *vsi = ring->vsi;
777776
u16 qid = ring->q_index;
778777

779-
return ice_get_xp_from_qid(vsi, qid);
778+
WRITE_ONCE(ring->xsk_pool, ice_get_xp_from_qid(vsi, qid));
780779
}
781780

782781
/**
@@ -801,7 +800,7 @@ static inline void ice_tx_xsk_pool(struct ice_vsi *vsi, u16 qid)
801800
if (!ring)
802801
return;
803802

804-
ring->xsk_pool = ice_get_xp_from_qid(vsi, qid);
803+
WRITE_ONCE(ring->xsk_pool, ice_get_xp_from_qid(vsi, qid));
805804
}
806805

807806
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
536536
return err;
537537
}
538538

539-
ring->xsk_pool = ice_xsk_pool(ring);
539+
ice_rx_xsk_pool(ring);
540540
if (ring->xsk_pool) {
541541
xdp_rxq_info_unreg(&ring->xdp_rxq);
542542

@@ -597,7 +597,7 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
597597
return 0;
598598
}
599599

600-
ok = ice_alloc_rx_bufs_zc(ring, num_bufs);
600+
ok = ice_alloc_rx_bufs_zc(ring, ring->xsk_pool, num_bufs);
601601
if (!ok) {
602602
u16 pf_q = ring->vsi->rxq_map[ring->q_index];
603603

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2948,7 +2948,7 @@ static void ice_vsi_rx_napi_schedule(struct ice_vsi *vsi)
29482948
ice_for_each_rxq(vsi, i) {
29492949
struct ice_rx_ring *rx_ring = vsi->rx_rings[i];
29502950

2951-
if (rx_ring->xsk_pool)
2951+
if (READ_ONCE(rx_ring->xsk_pool))
29522952
napi_schedule(&rx_ring->q_vector->napi);
29532953
}
29542954
}

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ void ice_free_rx_ring(struct ice_rx_ring *rx_ring)
456456
if (rx_ring->vsi->type == ICE_VSI_PF)
457457
if (xdp_rxq_info_is_reg(&rx_ring->xdp_rxq))
458458
xdp_rxq_info_unreg(&rx_ring->xdp_rxq);
459-
rx_ring->xdp_prog = NULL;
459+
WRITE_ONCE(rx_ring->xdp_prog, NULL);
460460
if (rx_ring->xsk_pool) {
461461
kfree(rx_ring->xdp_buf);
462462
rx_ring->xdp_buf = NULL;
@@ -1521,10 +1521,11 @@ int ice_napi_poll(struct napi_struct *napi, int budget)
15211521
* budget and be more aggressive about cleaning up the Tx descriptors.
15221522
*/
15231523
ice_for_each_tx_ring(tx_ring, q_vector->tx) {
1524+
struct xsk_buff_pool *xsk_pool = READ_ONCE(tx_ring->xsk_pool);
15241525
bool wd;
15251526

1526-
if (tx_ring->xsk_pool)
1527-
wd = ice_xmit_zc(tx_ring);
1527+
if (xsk_pool)
1528+
wd = ice_xmit_zc(tx_ring, xsk_pool);
15281529
else if (ice_ring_is_xdp(tx_ring))
15291530
wd = true;
15301531
else
@@ -1550,14 +1551,15 @@ int ice_napi_poll(struct napi_struct *napi, int budget)
15501551
budget_per_ring = budget;
15511552

15521553
ice_for_each_rx_ring(rx_ring, q_vector->rx) {
1554+
struct xsk_buff_pool *xsk_pool = READ_ONCE(rx_ring->xsk_pool);
15531555
int cleaned;
15541556

15551557
/* A dedicated path for zero-copy allows making a single
15561558
* comparison in the irq context instead of many inside the
15571559
* ice_clean_rx_irq function and makes the codebase cleaner.
15581560
*/
15591561
cleaned = rx_ring->xsk_pool ?
1560-
ice_clean_rx_irq_zc(rx_ring, budget_per_ring) :
1562+
ice_clean_rx_irq_zc(rx_ring, xsk_pool, budget_per_ring) :
15611563
ice_clean_rx_irq(rx_ring, budget_per_ring);
15621564
work_done += cleaned;
15631565
/* if we clean as many as budgeted, we must not be done */

0 commit comments

Comments
 (0)