]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
mlx4: handle non-napi callers to napi_poll
authorJonathan Lemon <bsd@fb.com>
Thu, 8 Oct 2020 18:45:26 +0000 (11:45 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:57:23 +0000 (09:57 +0100)
[ Upstream commit b2b8a92733b288128feb57ffa694758cf475106c ]

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>
drivers/net/ethernet/mellanox/mlx4/en_rx.c
drivers/net/ethernet/mellanox/mlx4/en_tx.c

index db3552f2d0877e37ce8dcf215d4c273e91c2326c..f9797e5038841ed70b944ed478b499aa1eb3133e 100644 (file)
@@ -942,6 +942,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) {
index a30edb436f4af11526e04c09623840288ebe4a29..191ead7a7fa59893a306f1ca25f5c8ab603e15f6 100644 (file)
@@ -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);