bnxt_en: Refactor bnxt_tx_int()
authorMichael Chan <michael.chan@broadcom.com>
Tue, 14 Nov 2023 00:16:14 +0000 (16:16 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Nov 2023 10:07:39 +0000 (10:07 +0000)
bnxt_tx_int() processes the only one TX ring from the bnxt_napi pointer.
To prepare for more TX rings associated with the bnxt_napi structure,
add a new __bnxt_tx_int() function that takes the bnxt_tx_ring_info
pointer to process that one TX ring.  No functional change.

Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index a4f7fa17daf8eb1646050e3d007936418bde36e1..ad56ca9d3ceb9b98da6cdb78af411c002b221af6 100644 (file)
@@ -687,14 +687,14 @@ tx_kick_pending:
        return NETDEV_TX_OK;
 }
 
-static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
+static void __bnxt_tx_int(struct bnxt *bp, struct bnxt_tx_ring_info *txr,
+                         int budget)
 {
-       struct bnxt_tx_ring_info *txr = bnapi->tx_ring;
        struct netdev_queue *txq = netdev_get_tx_queue(bp->dev, txr->txq_index);
-       u16 hw_cons = txr->tx_hw_cons;
-       u16 cons = txr->tx_cons;
        struct pci_dev *pdev = bp->pdev;
+       u16 hw_cons = txr->tx_hw_cons;
        unsigned int tx_bytes = 0;
+       u16 cons = txr->tx_cons;
        int tx_pkts = 0;
 
        while (cons != hw_cons) {
@@ -749,7 +749,6 @@ next_tx_int:
                dev_consume_skb_any(skb);
        }
 
-       bnapi->events &= ~BNXT_TX_CMP_EVENT;
        WRITE_ONCE(txr->tx_cons, cons);
 
        __netif_txq_completed_wake(txq, tx_pkts, tx_bytes,
@@ -757,6 +756,14 @@ next_tx_int:
                                   READ_ONCE(txr->dev_state) == BNXT_DEV_STATE_CLOSING);
 }
 
+static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
+{
+       struct bnxt_tx_ring_info *txr = bnapi->tx_ring;
+
+       __bnxt_tx_int(bp, txr, budget);
+       bnapi->events &= ~BNXT_TX_CMP_EVENT;
+}
+
 static struct page *__bnxt_alloc_rx_page(struct bnxt *bp, dma_addr_t *mapping,
                                         struct bnxt_rx_ring_info *rxr,
                                         unsigned int *offset,