Skip to content

Commit c1056a5

Browse files
Michael Chandavem330
Michael Chan
authored andcommitted
bnxt_en: Optimize xmit_more TX path
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 <[email protected]> Reviewed-by: Pavan Chebbi <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ba09801 commit c1056a5

File tree

1 file changed

+10
-6
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+10
-6
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

+10-6
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,16 @@ static u16 bnxt_xmit_get_cfa_action(struct sk_buff *skb)
381381
static void bnxt_txr_db_kick(struct bnxt *bp, struct bnxt_tx_ring_info *txr,
382382
u16 prod)
383383
{
384+
/* Sync BD data before updating doorbell */
385+
wmb();
384386
bnxt_db_write(bp, &txr->tx_db, prod);
385387
txr->kick_pending = 0;
386388
}
387389

388390
static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
389391
{
390392
struct bnxt *bp = netdev_priv(dev);
391-
struct tx_bd *txbd;
393+
struct tx_bd *txbd, *txbd0;
392394
struct tx_bd_ext *txbd1;
393395
struct netdev_queue *txq;
394396
int i;
@@ -602,6 +604,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
602604
txbd1->tx_bd_cfa_meta = cpu_to_le32(vlan_tag_flags);
603605
txbd1->tx_bd_cfa_action =
604606
cpu_to_le32(cfa_action << TX_BD_CFA_ACTION_SHIFT);
607+
txbd0 = txbd;
605608
for (i = 0; i < last_frag; i++) {
606609
skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
607610

@@ -633,16 +636,17 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
633636

634637
skb_tx_timestamp(skb);
635638

636-
/* Sync BD data before updating doorbell */
637-
wmb();
638-
639639
prod = NEXT_TX(prod);
640640
WRITE_ONCE(txr->tx_prod, prod);
641641

642-
if (!netdev_xmit_more() || netif_xmit_stopped(txq))
642+
if (!netdev_xmit_more() || netif_xmit_stopped(txq)) {
643643
bnxt_txr_db_kick(bp, txr, prod);
644-
else
644+
} else {
645+
if (free_size >= bp->tx_wake_thresh)
646+
txbd0->tx_bd_len_flags_type |=
647+
cpu_to_le32(TX_BD_FLAGS_NO_CMPL);
645648
txr->kick_pending = 1;
649+
}
646650

647651
tx_done:
648652

0 commit comments

Comments
 (0)