net: cxgb4: generate software timestamp just before the doorbell
authorJason Xing <kernelxing@tencent.com>
Sat, 10 May 2025 13:48:11 +0000 (21:48 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 15 May 2025 02:32:54 +0000 (19:32 -0700)
Make sure the call of skb_tx_timestamp is as close as possible to the
doorbell.

Signed-off-by: Jason Xing <kernelxing@tencent.com>
Link: https://patch.msgid.link/20250510134812.48199-3-kerneljasonxing@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/chelsio/cxgb4/sge.c
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c

index f991a28a71c31c92c3062ad5752007163277e8f5..f2d533acb056fcb4df5545b479771930c3eea8dd 100644 (file)
@@ -1533,7 +1533,6 @@ static netdev_tx_t cxgb4_eth_xmit(struct sk_buff *skb, struct net_device *dev)
        } else {
                q = &adap->sge.ethtxq[qidx + pi->first_qset];
        }
-       skb_tx_timestamp(skb);
 
        reclaim_completed_tx(adap, &q->q, -1, true);
        cntrl = TXPKT_L4CSUM_DIS_F | TXPKT_IPCSUM_DIS_F;
@@ -1706,6 +1705,8 @@ static netdev_tx_t cxgb4_eth_xmit(struct sk_buff *skb, struct net_device *dev)
        cpl->len = htons(skb->len);
        cpl->ctrl1 = cpu_to_be64(cntrl);
 
+       skb_tx_timestamp(skb);
+
        if (immediate) {
                cxgb4_inline_tx_skb(skb, &q->q, sgl);
                dev_consume_skb_any(skb);
@@ -2268,7 +2269,6 @@ static int ethofld_hard_xmit(struct net_device *dev,
 
        d = &eosw_txq->desc[eosw_txq->last_pidx];
        skb = d->skb;
-       skb_tx_timestamp(skb);
 
        wr = (struct fw_eth_tx_eo_wr *)&eohw_txq->q.desc[eohw_txq->q.pidx];
        if (unlikely(eosw_txq->state != CXGB4_EO_STATE_ACTIVE &&
@@ -2373,6 +2373,7 @@ write_wr_headers:
                eohw_txq->vlan_ins++;
 
        txq_advance(&eohw_txq->q, ndesc);
+       skb_tx_timestamp(skb);
        cxgb4_ring_tx_db(adap, &eohw_txq->q, ndesc);
        eosw_txq_advance_index(&eosw_txq->last_pidx, 1, eosw_txq->ndesc);
 
index e8e460a92e0e4cf24d9d063c70a3740feecd5622..4e2096e496844595b94c3d54d5233267eed99a76 100644 (file)
@@ -1640,6 +1640,7 @@ static int chcr_ktls_tunnel_pkt(struct chcr_ktls_info *tx_info,
        cxgb4_write_sgl(skb, &q->q, pos, end, 0, sgl_sdesc->addr);
        sgl_sdesc->skb = skb;
        chcr_txq_advance(&q->q, ndesc);
+       skb_tx_timestamp(skb);
        cxgb4_ring_tx_db(tx_info->adap, &q->q, ndesc);
        return 0;
 }
@@ -1903,7 +1904,6 @@ static int chcr_ktls_sw_fallback(struct sk_buff *skb,
        th = tcp_hdr(nskb);
        skb_offset = skb_tcp_all_headers(nskb);
        data_len = nskb->len - skb_offset;
-       skb_tx_timestamp(nskb);
 
        if (chcr_ktls_tunnel_pkt(tx_info, nskb, q))
                goto out;