]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
bnxt_en: Optimize xmit_more TX path
authorMichael Chan <michael.chan@broadcom.com>
Tue, 14 Nov 2023 00:16:21 +0000 (16:16 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Nov 2023 10:07:40 +0000 (10:07 +0000)
Now that we use the cumulative consumer index scheme for TX completion,
we don't need to have one TX completion per TX packet in the xmit_more
code path.  Set the TX_BD_FLAGS_NO_CMPL flag if xmit_more is true.
Fallback to one interrupt per packet if the ring is filled beyond
bp->tx_wake_thresh.

Also, move the wmb() to bnxt_txr_db_kick().  When xmit_more is true,
we'll skip the bnxt_txr_db_kick() call and there is no need to call
wmb() to sync. the TX BD data.

Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@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 d1af1d2ff8002dc8de116344a78f082ce0cadf95..e6ac1bd21bb3eb92ad42bf3f20046eda5693dd85 100644 (file)
@@ -381,6 +381,8 @@ static u16 bnxt_xmit_get_cfa_action(struct sk_buff *skb)
 static void bnxt_txr_db_kick(struct bnxt *bp, struct bnxt_tx_ring_info *txr,
                             u16 prod)
 {
+       /* Sync BD data before updating doorbell */
+       wmb();
        bnxt_db_write(bp, &txr->tx_db, prod);
        txr->kick_pending = 0;
 }
@@ -388,7 +390,7 @@ static void bnxt_txr_db_kick(struct bnxt *bp, struct bnxt_tx_ring_info *txr,
 static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct bnxt *bp = netdev_priv(dev);
-       struct tx_bd *txbd;
+       struct tx_bd *txbd, *txbd0;
        struct tx_bd_ext *txbd1;
        struct netdev_queue *txq;
        int i;
@@ -602,6 +604,7 @@ normal_tx:
        txbd1->tx_bd_cfa_meta = cpu_to_le32(vlan_tag_flags);
        txbd1->tx_bd_cfa_action =
                        cpu_to_le32(cfa_action << TX_BD_CFA_ACTION_SHIFT);
+       txbd0 = txbd;
        for (i = 0; i < last_frag; i++) {
                skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
@@ -633,16 +636,17 @@ normal_tx:
 
        skb_tx_timestamp(skb);
 
-       /* Sync BD data before updating doorbell */
-       wmb();
-
        prod = NEXT_TX(prod);
        WRITE_ONCE(txr->tx_prod, prod);
 
-       if (!netdev_xmit_more() || netif_xmit_stopped(txq))
+       if (!netdev_xmit_more() || netif_xmit_stopped(txq)) {
                bnxt_txr_db_kick(bp, txr, prod);
-       else
+       } else {
+               if (free_size >= bp->tx_wake_thresh)
+                       txbd0->tx_bd_len_flags_type |=
+                               cpu_to_le32(TX_BD_FLAGS_NO_CMPL);
                txr->kick_pending = 1;
+       }
 
 tx_done: