net/cnxk: fix RSS RETA table update
[dpdk.git] / drivers / net / cnxk / cn10k_ethdev.c
index c6890f3..e57847e 100644 (file)
@@ -428,6 +428,27 @@ cn10k_nix_timesync_disable(struct rte_eth_dev *eth_dev)
        return 0;
 }
 
+static int
+cn10k_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
+                                    struct timespec *timestamp)
+{
+       struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+       struct cnxk_timesync_info *tstamp = &dev->tstamp;
+       uint64_t ns;
+
+       if (*tstamp->tx_tstamp == 0)
+               return -EINVAL;
+
+       *tstamp->tx_tstamp = ((*tstamp->tx_tstamp >> 32) * NSEC_PER_SEC) +
+               (*tstamp->tx_tstamp & 0xFFFFFFFFUL);
+       ns = rte_timecounter_update(&dev->tx_tstamp_tc, *tstamp->tx_tstamp);
+       *timestamp = rte_ns_to_timespec(ns);
+       *tstamp->tx_tstamp = 0;
+       rte_wmb();
+
+       return 0;
+}
+
 static int
 cn10k_nix_dev_start(struct rte_eth_dev *eth_dev)
 {
@@ -499,6 +520,8 @@ nix_eth_dev_ops_override(void)
        cnxk_eth_dev_ops.timesync_disable = cn10k_nix_timesync_disable;
        cnxk_eth_dev_ops.rx_metadata_negotiate =
                cn10k_nix_rx_metadata_negotiate;
+       cnxk_eth_dev_ops.timesync_read_tx_timestamp =
+               cn10k_nix_timesync_read_tx_timestamp;
 }
 
 static void