DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, Pavan Nikhilesh <pbhagavatula@marvell.com>
Cc: <dev@dpdk.org>, Harman Kalra <hkalra@marvell.com>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>
Subject: [dpdk-dev] [PATCH v2 4/6] event/octeontx2: add PTP support for SSO
Date: Mon, 3 Jun 2019 16:04:26 +0530
Message-ID: <20190603103429.814-5-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20190603103429.814-1-pbhagavatula@marvell.com>

From: Harman Kalra <hkalra@marvell.com>

Add PTP support for SSO based on rx_offloads of the queue connected to
it.

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 drivers/event/octeontx2/otx2_evdev.c       |  2 ++
 drivers/event/octeontx2/otx2_evdev.h       |  6 ++++++
 drivers/event/octeontx2/otx2_evdev_adptr.c |  1 +
 drivers/event/octeontx2/otx2_worker.h      |  6 ++++++
 drivers/event/octeontx2/otx2_worker_dual.c | 18 ++++++++++++------
 drivers/event/octeontx2/otx2_worker_dual.h |  6 +++++-
 6 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/drivers/event/octeontx2/otx2_evdev.c b/drivers/event/octeontx2/otx2_evdev.c
index 2352895bb..138f4e4fa 100644
--- a/drivers/event/octeontx2/otx2_evdev.c
+++ b/drivers/event/octeontx2/otx2_evdev.c
@@ -1092,6 +1092,7 @@ otx2_sso_port_setup(struct rte_eventdev *event_dev, uint8_t port_id,
 			   sizeof(uintptr_t) * OTX2_SSO_MAX_VHGRP);
 		ws->fc_mem = dev->fc_mem;
 		ws->xaq_lmt = dev->xaq_lmt;
+		ws->tstamp = dev->tstamp;
 		otx2_write64(val, OTX2_SSOW_GET_BASE_ADDR(
 			     ws->ws_state[0].getwrk_op) + SSOW_LF_GWS_NW_TIM);
 		otx2_write64(val, OTX2_SSOW_GET_BASE_ADDR(
@@ -1104,6 +1105,7 @@ otx2_sso_port_setup(struct rte_eventdev *event_dev, uint8_t port_id,
 			   sizeof(uintptr_t) * OTX2_SSO_MAX_VHGRP);
 		ws->fc_mem = dev->fc_mem;
 		ws->xaq_lmt = dev->xaq_lmt;
+		ws->tstamp = dev->tstamp;
 		otx2_write64(val, base + SSOW_LF_GWS_NW_TIM);
 	}
 
diff --git a/drivers/event/octeontx2/otx2_evdev.h b/drivers/event/octeontx2/otx2_evdev.h
index 8c8ba8bc3..dd493715b 100644
--- a/drivers/event/octeontx2/otx2_evdev.h
+++ b/drivers/event/octeontx2/otx2_evdev.h
@@ -134,6 +134,8 @@ struct otx2_sso_evdev {
 	/* MSIX offsets */
 	uint16_t sso_msixoff[OTX2_SSO_MAX_VHGRP];
 	uint16_t ssow_msixoff[OTX2_SSO_MAX_VHWS];
+	/* PTP timestamp */
+	struct otx2_timesync_info *tstamp;
 } __rte_cache_aligned;
 
 #define OTX2_SSOGWS_OPS \
@@ -158,6 +160,8 @@ struct otx2_ssogws {
 	uint64_t xaq_lmt __rte_cache_aligned;
 	uint64_t *fc_mem;
 	uintptr_t grps_base[OTX2_SSO_MAX_VHGRP];
+	/* PTP timestamp */
+	struct otx2_timesync_info *tstamp;
 } __rte_cache_aligned;
 
 struct otx2_ssogws_state {
@@ -175,6 +179,8 @@ struct otx2_ssogws_dual {
 	uint64_t xaq_lmt __rte_cache_aligned;
 	uint64_t *fc_mem;
 	uintptr_t grps_base[OTX2_SSO_MAX_VHGRP];
+	/* PTP timestamp */
+	struct otx2_timesync_info *tstamp;
 } __rte_cache_aligned;
 
 static inline struct otx2_sso_evdev *
diff --git a/drivers/event/octeontx2/otx2_evdev_adptr.c b/drivers/event/octeontx2/otx2_evdev_adptr.c
index 0656d1081..c2cf4196e 100644
--- a/drivers/event/octeontx2/otx2_evdev_adptr.c
+++ b/drivers/event/octeontx2/otx2_evdev_adptr.c
@@ -275,6 +275,7 @@ otx2_sso_rx_adapter_queue_add(const struct rte_eventdev *event_dev,
 	}
 
 	dev->rx_offloads |= otx2_eth_dev->rx_offload_flags;
+	dev->tstamp = &otx2_eth_dev->tstamp;
 	sso_fastpath_fns_set((struct rte_eventdev *)(uintptr_t)event_dev);
 
 	return 0;
diff --git a/drivers/event/octeontx2/otx2_worker.h b/drivers/event/octeontx2/otx2_worker.h
index 2146587aa..9d116f1ac 100644
--- a/drivers/event/octeontx2/otx2_worker.h
+++ b/drivers/event/octeontx2/otx2_worker.h
@@ -69,6 +69,9 @@ otx2_ssogws_get_work(struct otx2_ssogws *ws, struct rte_event *ev,
 		get_work1 = otx2_wqe_to_mbuf(get_work1, mbuf,
 					     (get_work0 >> 20) & 0xFF, flags,
 					     lookup_mem);
+		/* Extracting tstamp, if PTP enabled*/
+		otx2_nix_mbuf_to_tstamp((struct rte_mbuf *)get_work1,
+					ws->tstamp, flags);
 	}
 
 	ev->event = get_work0;
@@ -127,6 +130,9 @@ otx2_ssogws_get_work_empty(struct otx2_ssogws *ws, struct rte_event *ev,
 		get_work1 = otx2_wqe_to_mbuf(get_work1, mbuf,
 					     (get_work0 >> 20) & 0xFF, flags,
 					     ws->lookup_mem);
+		/* Extracting tstamp, if PTP enabled*/
+		otx2_nix_mbuf_to_tstamp((struct rte_mbuf *)get_work1,
+					ws->tstamp, flags);
 	}
 
 	ev->event = get_work0;
diff --git a/drivers/event/octeontx2/otx2_worker_dual.c b/drivers/event/octeontx2/otx2_worker_dual.c
index b5cf9ac12..cbe03c1bb 100644
--- a/drivers/event/octeontx2/otx2_worker_dual.c
+++ b/drivers/event/octeontx2/otx2_worker_dual.c
@@ -158,7 +158,8 @@ otx2_ssogws_dual_deq_ ##name(void *port, struct rte_event *ev,		\
 									\
 	gw = otx2_ssogws_dual_get_work(&ws->ws_state[ws->vws],		\
 				       &ws->ws_state[!ws->vws], ev,	\
-				       flags, ws->lookup_mem);		\
+				       flags, ws->lookup_mem,		\
+				       ws->tstamp);			\
 	ws->vws = !ws->vws;						\
 									\
 	return gw;							\
@@ -191,13 +192,15 @@ otx2_ssogws_dual_deq_timeout_ ##name(void *port, struct rte_event *ev,	\
 									\
 	gw = otx2_ssogws_dual_get_work(&ws->ws_state[ws->vws],		\
 				       &ws->ws_state[!ws->vws], ev,	\
-				       flags, ws->lookup_mem);		\
+				       flags, ws->lookup_mem,		\
+				       ws->tstamp);			\
 	ws->vws = !ws->vws;						\
 	for (iter = 1; iter < timeout_ticks && (gw == 0); iter++) {	\
 		gw = otx2_ssogws_dual_get_work(&ws->ws_state[ws->vws],	\
 					       &ws->ws_state[!ws->vws],	\
 					       ev, flags,		\
-					       ws->lookup_mem);		\
+					       ws->lookup_mem,		\
+					       ws->tstamp);		\
 		ws->vws = !ws->vws;					\
 	}								\
 									\
@@ -234,7 +237,8 @@ otx2_ssogws_dual_deq_seg_ ##name(void *port, struct rte_event *ev,	\
 	gw = otx2_ssogws_dual_get_work(&ws->ws_state[ws->vws],		\
 				       &ws->ws_state[!ws->vws], ev,	\
 				       flags | NIX_RX_MULTI_SEG_F,	\
-				       ws->lookup_mem);			\
+				       ws->lookup_mem,			\
+				       ws->tstamp);			\
 	ws->vws = !ws->vws;						\
 									\
 	return gw;							\
@@ -271,14 +275,16 @@ otx2_ssogws_dual_deq_seg_timeout_ ##name(void *port,			\
 	gw = otx2_ssogws_dual_get_work(&ws->ws_state[ws->vws],		\
 				       &ws->ws_state[!ws->vws], ev,	\
 				       flags | NIX_RX_MULTI_SEG_F,	\
-				       ws->lookup_mem);			\
+				       ws->lookup_mem,			\
+				       ws->tstamp);			\
 	ws->vws = !ws->vws;						\
 	for (iter = 1; iter < timeout_ticks && (gw == 0); iter++) {	\
 		gw = otx2_ssogws_dual_get_work(&ws->ws_state[ws->vws],	\
 					       &ws->ws_state[!ws->vws],	\
 					       ev, flags |		\
 					       NIX_RX_MULTI_SEG_F,	\
-					       ws->lookup_mem);		\
+					       ws->lookup_mem,		\
+					       ws->tstamp);		\
 		ws->vws = !ws->vws;					\
 	}								\
 									\
diff --git a/drivers/event/octeontx2/otx2_worker_dual.h b/drivers/event/octeontx2/otx2_worker_dual.h
index b6e4dd738..855b167ca 100644
--- a/drivers/event/octeontx2/otx2_worker_dual.h
+++ b/drivers/event/octeontx2/otx2_worker_dual.h
@@ -16,7 +16,8 @@ static __rte_always_inline uint16_t
 otx2_ssogws_dual_get_work(struct otx2_ssogws_state *ws,
 			  struct otx2_ssogws_state *ws_pair,
 			  struct rte_event *ev, const uint32_t flags,
-			  const void * const lookup_mem)
+			  const void * const lookup_mem,
+			  struct otx2_timesync_info * const tstamp)
 {
 	const uint64_t set_gw = BIT_ULL(16) | 1;
 	uint64_t get_work0;
@@ -70,6 +71,9 @@ otx2_ssogws_dual_get_work(struct otx2_ssogws_state *ws,
 		get_work1 = otx2_wqe_to_mbuf(get_work1, mbuf,
 					     (get_work0 >> 20) & 0xFF,
 					     flags, lookup_mem);
+		/* Extracting tstamp, if PTP enabled*/
+		otx2_nix_mbuf_to_tstamp((struct rte_mbuf *)get_work1,
+					tstamp, flags);
 	}
 
 	ev->event = get_work0;
-- 
2.21.0


  parent reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 10:34 [dpdk-dev] [PATCH v2 0/6] event/octeontx2: add Rx/Tx adapter support pbhagavatula
2019-06-03 10:34 ` [dpdk-dev] [PATCH v2 1/6] event/octeontx2: add event eth Rx " pbhagavatula
2019-06-17  9:19   ` Jerin Jacob Kollanukkaran
2019-06-03 10:34 ` [dpdk-dev] [PATCH v2 2/6] event/octeontx2: resize SSO inflight event buffers pbhagavatula
2019-06-03 10:34 ` [dpdk-dev] [PATCH v2 3/6] event/octeontx2: add event eth Rx adapter fastpath ops pbhagavatula
2019-06-03 10:34 ` pbhagavatula [this message]
2019-06-03 10:34 ` [dpdk-dev] [PATCH v2 5/6] event/octeontx2: add Tx adadpter support pbhagavatula
2019-06-03 10:34 ` [dpdk-dev] [PATCH v2 6/6] doc: update Marvell OCTEON TX2 documentation pbhagavatula
2019-06-04  9:08   ` Mcnamara, John

Reply instructions:

You may reply publically 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=20190603103429.814-5-pbhagavatula@marvell.com \
    --to=pbhagavatula@marvell.com \
    --cc=dev@dpdk.org \
    --cc=hkalra@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=ndabilpuram@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

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox