Skip to content

Commit 8e9d575

Browse files
jlemongregkh
authored andcommitted
mlx4: handle non-napi callers to napi_poll
[ Upstream commit b2b8a92 ] 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 Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 540718f commit 8e9d575

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/net/ethernet/mellanox/mlx4/en_rx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,9 @@ int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget)
943943
bool clean_complete = true;
944944
int done;
945945

946+
if (!budget)
947+
return 0;
948+
946949
if (priv->tx_ring_num[TX_XDP]) {
947950
xdp_tx_cq = priv->tx_cq[TX_XDP][cq->ring];
948951
if (xdp_tx_cq->xdp_busy) {

drivers/net/ethernet/mellanox/mlx4/en_tx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ u32 mlx4_en_recycle_tx_desc(struct mlx4_en_priv *priv,
350350
.dma = tx_info->map0_dma,
351351
};
352352

353-
if (!mlx4_en_rx_recycle(ring->recycle_ring, &frame)) {
353+
if (!napi_mode || !mlx4_en_rx_recycle(ring->recycle_ring, &frame)) {
354354
dma_unmap_page(priv->ddev, tx_info->map0_dma,
355355
PAGE_SIZE, priv->dma_dir);
356356
put_page(tx_info->page);

0 commit comments

Comments
 (0)