net/sfc: add Rx datapath method to get pushed buffers count
[dpdk.git] / drivers / net / cnxk / cnxk_ptp.c
index 52f6eb1..449489f 100644 (file)
@@ -4,6 +4,23 @@
 
 #include "cnxk_ethdev.h"
 
+int
+cnxk_nix_read_clock(struct rte_eth_dev *eth_dev, uint64_t *clock)
+{
+       struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+       /* This API returns the raw PTP HI clock value. Since LFs do not
+        * have direct access to PTP registers and it requires mbox msg
+        * to AF for this value. In fastpath reading this value for every
+        * packet (which involes mbox call) becomes very expensive, hence
+        * we should be able to derive PTP HI clock value from tsc by
+        * using freq_mult and clk_delta calculated during configure stage.
+        */
+       *clock = (rte_get_tsc_cycles() + dev->clk_delta) * dev->clk_freq_mult;
+
+       return 0;
+}
+
 /* This function calculates two parameters "clk_freq_mult" and
  * "clk_delta" which is useful in deriving PTP HI clock from
  * timestamp counter (tsc) value.