timestamp resolution for an incoming and outgoing packets
is different for CN10k and CN9K.Added platform specific
callback to retrieve timestamp in correct format when read by
application

Signed-off-by: Rakesh Kudurumalla <rkuduruma...@marvell.com>
---
 drivers/event/cnxk/cn10k_worker.h |  4 ++--
 drivers/event/cnxk/cn9k_worker.h  |  4 ++--
 drivers/net/cnxk/cnxk_ethdev.h    | 28 ----------------------------
 3 files changed, 4 insertions(+), 32 deletions(-)

diff --git a/drivers/event/cnxk/cn10k_worker.h 
b/drivers/event/cnxk/cn10k_worker.h
index e8255eaca2..d288c66cac 100644
--- a/drivers/event/cnxk/cn10k_worker.h
+++ b/drivers/event/cnxk/cn10k_worker.h
@@ -179,7 +179,7 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const 
uint32_t flags,
                /* Extracting tstamp, if PTP enabled*/
                tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *)cqe) +
                                           CNXK_SSO_WQE_SG_PTR);
-               cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, tstamp,
+               cn10k_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, tstamp,
                                        flags & NIX_RX_OFFLOAD_TSTAMP_F,
                                        (uint64_t *)tstamp_ptr);
                wqe[0] = (uint64_t *)mbuf;
@@ -269,7 +269,7 @@ cn10k_sso_hws_get_work(struct cn10k_sso_hws *ws, struct 
rte_event *ev,
                        tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *)
                                                            gw.u64[1]) +
                                                   CNXK_SSO_WQE_SG_PTR);
-                       cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf,
+                       cn10k_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf,
                                                ws->tstamp,
                                                flags & NIX_RX_OFFLOAD_TSTAMP_F,
                                                (uint64_t *)tstamp_ptr);
diff --git a/drivers/event/cnxk/cn9k_worker.h b/drivers/event/cnxk/cn9k_worker.h
index 2107ff7b16..c03b49323d 100644
--- a/drivers/event/cnxk/cn9k_worker.h
+++ b/drivers/event/cnxk/cn9k_worker.h
@@ -205,7 +205,7 @@ cn9k_sso_hws_dual_get_work(uint64_t base, uint64_t 
pair_base,
                        tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *)
                                                            gw.u64[1]) +
                                                   CNXK_SSO_WQE_SG_PTR);
-                       cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf,
+                       cn9k_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf,
                                                dws->tstamp,
                                                flags & NIX_RX_OFFLOAD_TSTAMP_F,
                                                (uint64_t *)tstamp_ptr);
@@ -281,7 +281,7 @@ cn9k_sso_hws_get_work(struct cn9k_sso_hws *ws, struct 
rte_event *ev,
                        tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *)
                                                            gw.u64[1]) +
                                                   CNXK_SSO_WQE_SG_PTR);
-                       cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf,
+                       cn9k_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf,
                                                ws->tstamp,
                                                flags & NIX_RX_OFFLOAD_TSTAMP_F,
                                                (uint64_t *)tstamp_ptr);
diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h
index ce42b8625a..351b9f8fcf 100644
--- a/drivers/net/cnxk/cnxk_ethdev.h
+++ b/drivers/net/cnxk/cnxk_ethdev.h
@@ -714,34 +714,6 @@ cnxk_nix_timestamp_dynfield(struct rte_mbuf *mbuf,
                                 rte_mbuf_timestamp_t *);
 }
 
-static __rte_always_inline void
-cnxk_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf,
-                       struct cnxk_timesync_info *tstamp,
-                       const uint8_t ts_enable, uint64_t *tstamp_ptr)
-{
-       if (ts_enable) {
-               mbuf->pkt_len -= CNXK_NIX_TIMESYNC_RX_OFFSET;
-               mbuf->data_len -= CNXK_NIX_TIMESYNC_RX_OFFSET;
-
-               /* Reading the rx timestamp inserted by CGX, viz at
-                * starting of the packet data.
-                */
-               *cnxk_nix_timestamp_dynfield(mbuf, tstamp) =
-                       rte_be_to_cpu_64(*tstamp_ptr);
-               /* RTE_MBUF_F_RX_IEEE1588_TMST flag needs to be set only in case
-                * PTP packets are received.
-                */
-               if (mbuf->packet_type == RTE_PTYPE_L2_ETHER_TIMESYNC) {
-                       tstamp->rx_tstamp =
-                               *cnxk_nix_timestamp_dynfield(mbuf, tstamp);
-                       tstamp->rx_ready = 1;
-                       mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_PTP |
-                                         RTE_MBUF_F_RX_IEEE1588_TMST |
-                                         tstamp->rx_tstamp_dynflag;
-               }
-       }
-}
-
 static __rte_always_inline uintptr_t
 cnxk_nix_sa_base_get(uint16_t port, const void *lookup_mem)
 {
-- 
2.25.1

Reply via email to