]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
eth: fbnic: add software TX timestamping support
authorVadim Fedorenko <vadfed@meta.com>
Tue, 8 Oct 2024 18:14:32 +0000 (11:14 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 10 Oct 2024 10:52:11 +0000 (12:52 +0200)
Add software TX timestamping support. RX software timestamping is
implemented in the core and there is no need to provide special flag
in the driver anymore.

Signed-off-by: Vadim Fedorenko <vadfed@meta.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c

index 5d980e17894141e38c081a0445f5d175e932e5e9..ffc773014e0fdca764a575b9af650941f76a75c6 100644 (file)
@@ -6,6 +6,16 @@
 #include "fbnic_netdev.h"
 #include "fbnic_tlv.h"
 
+static int
+fbnic_get_ts_info(struct net_device *netdev,
+                 struct kernel_ethtool_ts_info *tsinfo)
+{
+       tsinfo->so_timestamping =
+               SOF_TIMESTAMPING_TX_SOFTWARE;
+
+       return 0;
+}
+
 static void
 fbnic_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
 {
@@ -66,6 +76,7 @@ fbnic_get_eth_mac_stats(struct net_device *netdev,
 
 static const struct ethtool_ops fbnic_ethtool_ops = {
        .get_drvinfo            = fbnic_get_drvinfo,
+       .get_ts_info            = fbnic_get_ts_info,
        .get_eth_mac_stats      = fbnic_get_eth_mac_stats,
 };
 
index 6a6d7e22f1a722314d6eee593933e170b7c3fb1b..8337d49bad0bb2453ef17b0e3f66dfab0947da96 100644 (file)
@@ -205,6 +205,9 @@ fbnic_tx_map(struct fbnic_ring *ring, struct sk_buff *skb, __le64 *meta)
 
        ring->tail = tail;
 
+       /* Record SW timestamp */
+       skb_tx_timestamp(skb);
+
        /* Verify there is room for another packet */
        fbnic_maybe_stop_tx(skb->dev, ring, FBNIC_MAX_SKB_DESC);