MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mlx5_txpp_read_clock

Function mlx5_txpp_read_clock

dpdk/drivers/net/mlx5/mlx5_txpp.c:969–1010  ·  view source on GitHub ↗

* Read the current clock counter of an Ethernet device * * This returns the current raw clock value of an Ethernet device. It is * a raw amount of ticks, with no given time reference. * The value returned here is from the same clock than the one * filling timestamp field of Rx/Tx packets when using hardware timestamp * offload. Therefore it can be used to compute a precise conversion of * t

Source from the content-addressed store, hash-verified

967 * packet pacing module configured and started (tx_pp devarg)
968 */
969int
970mlx5_txpp_read_clock(struct rte_eth_dev *dev, uint64_t *timestamp)
971{
972 struct mlx5_priv *priv = dev->data->dev_private;
973 struct mlx5_dev_ctx_shared *sh = priv->sh;
974 uint64_t ts;
975 int ret;
976
977 if (sh->txpp.refcnt) {
978 struct mlx5_txpp_wq *wq = &sh->txpp.clock_queue;
979 struct mlx5_cqe *cqe =
980 (struct mlx5_cqe *)(uintptr_t)wq->cq_obj.cqes;
981 union {
982 rte_int128_t u128;
983 struct mlx5_cqe_ts cts;
984 } to;
985
986 mlx5_atomic_read_cqe((rte_int128_t *)&cqe->timestamp, &to.u128);
987 if (to.cts.op_own >> 4) {
988 DRV_LOG(DEBUG, "Clock Queue error sync lost.");
989 __atomic_fetch_add(&sh->txpp.err_clock_queue,
990 1, __ATOMIC_RELAXED);
991 sh->txpp.sync_lost = 1;
992 return -EIO;
993 }
994 ts = rte_be_to_cpu_64(to.cts.timestamp);
995 ts = mlx5_txpp_convert_rx_ts(sh, ts);
996 *timestamp = ts;
997 return 0;
998 }
999 /* Check if we can read timestamp directly from hardware. */
1000 ts = mlx5_read_pcibar_clock(dev);
1001 if (ts != 0) {
1002 *timestamp = ts;
1003 return 0;
1004 }
1005 /* Not supported in isolated mode - kernel does not see the CQEs. */
1006 if (priv->isolated || rte_eal_process_type() != RTE_PROC_PRIMARY)
1007 return -ENOTSUP;
1008 ret = mlx5_read_clock(dev, timestamp);
1009 return ret;
1010}
1011
1012/**
1013 * DPDK callback to clear device extended statistics.

Callers

nothing calls this directly

Calls 5

mlx5_atomic_read_cqeFunction · 0.85
mlx5_txpp_convert_rx_tsFunction · 0.85
mlx5_read_pcibar_clockFunction · 0.85
rte_eal_process_typeFunction · 0.85
mlx5_read_clockFunction · 0.50

Tested by

no test coverage detected