DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rakesh Kudurumalla <rkudurumalla@marvell.com>
To: Pavan Nikhilesh <pbhagavatula@marvell.com>,
	Shijith Thotton <sthotton@marvell.com>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	"Kiran Kumar K" <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>, <jerinj@marvell.com>,
	Rakesh Kudurumalla <rkudurumalla@marvell.com>
Subject: [PATCH 2/2] event/cnxk: add callback handler to read ptp timestamp
Date: Thu, 24 Feb 2022 13:32:17 +0530	[thread overview]
Message-ID: <20220224080217.2895297-2-rkudurumalla@marvell.com> (raw)
In-Reply-To: <20220224080217.2895297-1-rkudurumalla@marvell.com>

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 <rkudurumalla@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	other threads:[~2022-02-24  8:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24  8:02 [PATCH 1/2] net/cnxk: " Rakesh Kudurumalla
2022-02-24  8:02 ` Rakesh Kudurumalla [this message]
2022-02-24 11:17 ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220224080217.2895297-2-rkudurumalla@marvell.com \
    --to=rkudurumalla@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=pbhagavatula@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=sthotton@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).