Skip to contentSkip to conversation

mlx4: handle non-napi callers to napi_poll

PATCH Applied Jonathan Lemon 3 participants 4 messages Oct 8, 2020 – Oct 12, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mlx4: handle non-napi callers to napi_poll

From: Jonathan Lemon <[email protected]>

netcons calls napi_poll with a budget of 0 to transmit packets. Handle this by:
- skipping RX processing
- do not try to recycle TX packets to the RX cache

---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c | 3 +++
 drivers/net/ethernet/mellanox/mlx4/en_tx.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/en_rx.c +3 -0
index 99d7737e8ad6..502d1b97855c 100644
@@ -943,6 +943,9 @@ int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget)
 	bool clean_complete = true;
 	int done;
 
+	if (!budget)
+		return 0;
+
 	if (priv->tx_ring_num[TX_XDP]) {
 		xdp_tx_cq = priv->tx_cq[TX_XDP][cq->ring];
 		if (xdp_tx_cq->xdp_busy) {
drivers/net/ethernet/mellanox/mlx4/en_tx.c +1 -1
index 45869b29368f..3ddb7268e415 100644
@@ -350,7 +350,7 @@ u32 mlx4_en_recycle_tx_desc(struct mlx4_en_priv *priv,
 		.dma = tx_info->map0_dma,
 	};
 
-	if (!mlx4_en_rx_recycle(ring->recycle_ring, &frame)) {
+	if (!napi_mode || !mlx4_en_rx_recycle(ring->recycle_ring, &frame)) {
 		dma_unmap_page(priv->ddev, tx_info->map0_dma,
 			       PAGE_SIZE, priv->dma_dir);
 		put_page(tx_info->page);
Signature · 1 line
2.24.1
maintainer
#1 lore raw
Quoted 8 lines · On Thu, 8 Oct 2020 11:45:26 -0700 Jonathan Lemon wrote:

From: Jonathan Lemon <[email protected]>

netcons calls napi_poll with a budget of 0 to transmit packets. Handle this by:
- skipping RX processing
- do not try to recycle TX packets to the RX cache

Tariq, Saeed - how does this look to you?

Reviewed-by
#2 lore raw
Quoted 4 lines · Jakub Kicinski
Quoted 2 lines · On Thu, 8 Oct 2020 11:45:26 -0700 Jonathan Lemon wrote:

From: Jonathan Lemon <[email protected]>

Quoted 8 lines
Quoted 6 lines

netcons calls napi_poll with a budget of 0 to transmit packets. Handle this by:
- skipping RX processing
- do not try to recycle TX packets to the RX cache

Tariq, Saeed - how does this look to you?

Thanks,
Tariq

maintainer Applied
#3 lore raw
Quoted 10 lines · On Mon, 12 Oct 2020 09:40:51 +0300 Tariq Toukan wrote:
Quoted 9 lines · Jakub Kicinski
Quoted 7 lines · On Thu, 8 Oct 2020 11:45:26 -0700 Jonathan Lemon wrote:

From: Jonathan Lemon <[email protected]>

netcons calls napi_poll with a budget of 0 to transmit packets. Handle this by:
- skipping RX processing
- do not try to recycle TX packets to the RX cache

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Tariq, Saeed - how does this look to you?

Applied, thanks!