nfp: TX time stamp packets before HW doorbell is rung
authorJakub Kicinski <jakub.kicinski@netronome.com>
Wed, 23 Aug 2017 21:41:50 +0000 (14:41 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Aug 2017 05:40:49 +0000 (22:40 -0700)
TX completion may happen any time after HW queue was kicked.
We can't access the skb afterwards.  Move the time stamping
before ringing the doorbell.

Fixes: 4c3523623dc0 ("net: add driver for Netronome NFP4000/NFP6000 NIC VFs")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/nfp_net_common.c

index 1ff0c577819e7de1f45a38dffe5cab707aea71c5..66a09e490cf5a5f2ce19193653910e0fcbe5632e 100644 (file)
@@ -895,6 +895,8 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
 
        netdev_tx_sent_queue(nd_q, txbuf->real_len);
 
+       skb_tx_timestamp(skb);
+
        tx_ring->wr_p += nr_frags + 1;
        if (nfp_net_tx_ring_should_stop(tx_ring))
                nfp_net_tx_ring_stop(nd_q, tx_ring);
@@ -903,8 +905,6 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
        if (!skb->xmit_more || netif_xmit_stopped(nd_q))
                nfp_net_tx_xmit_more_flush(tx_ring);
 
-       skb_tx_timestamp(skb);
-
        return NETDEV_TX_OK;
 
 err_unmap: