DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] event/cnxk: add event port flow context APIs
@ 2023-08-29 18:19 pbhagavatula
  2023-09-19 13:41 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: pbhagavatula @ 2023-08-29 18:19 UTC (permalink / raw)
  To: jerinj, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
	Satha Rao, Pavan Nikhilesh, Shijith Thotton
  Cc: dev

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Add event port flow context status APIs.
- rte_pmd_cnxk_eventdev_wait_head() - Allows application to wait
  for the flow context currently held by the event port to become
  the HEAD of the flow chain.
- rte_pmd_cnxk_eventdev_is_head() - Allows application to test if
  the flow context currently held by the event port is the HEAD
  of the flow chain.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 doc/api/doxy-api-index.md                  |  1 +
 doc/api/doxy-api.conf.in                   |  1 +
 drivers/common/cnxk/roc_sso_dp.h           |  8 ++++
 drivers/event/cnxk/cn10k_eventdev.h        |  4 +-
 drivers/event/cnxk/cnxk_worker.c           | 49 +++++++++++++++++++++
 drivers/event/cnxk/meson.build             |  2 +
 drivers/event/cnxk/rte_pmd_cnxk_eventdev.h | 50 ++++++++++++++++++++++
 drivers/event/cnxk/version.map             |  9 ++++
 8 files changed, 122 insertions(+), 2 deletions(-)
 create mode 100644 drivers/event/cnxk/cnxk_worker.c
 create mode 100644 drivers/event/cnxk/rte_pmd_cnxk_eventdev.h
 create mode 100644 drivers/event/cnxk/version.map

diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index fdeda13932..3891b6134d 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -48,6 +48,7 @@ The public API headers are grouped by topics:
   [iavf](@ref rte_pmd_iavf.h),
   [bnxt](@ref rte_pmd_bnxt.h),
   [cnxk](@ref rte_pmd_cnxk.h),
+  [cnxk_eventdev](@ref rte_pmd_cnxk_eventdev.h),
   [cnxk_mempool](@ref rte_pmd_cnxk_mempool.h),
   [dpaa](@ref rte_pmd_dpaa.h),
   [dpaa2](@ref rte_pmd_dpaa2.h),
diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in
index a88accd907..2a25fac6bf 100644
--- a/doc/api/doxy-api.conf.in
+++ b/doc/api/doxy-api.conf.in
@@ -9,6 +9,7 @@ INPUT                   = @TOPDIR@/doc/api/doxy-api-index.md \
                           @TOPDIR@/drivers/crypto/scheduler \
                           @TOPDIR@/drivers/dma/dpaa2 \
                           @TOPDIR@/drivers/event/dlb2 \
+                          @TOPDIR@/drivers/event/cnxk \
                           @TOPDIR@/drivers/mempool/cnxk \
                           @TOPDIR@/drivers/mempool/dpaa2 \
                           @TOPDIR@/drivers/net/ark \
diff --git a/drivers/common/cnxk/roc_sso_dp.h b/drivers/common/cnxk/roc_sso_dp.h
index 9d30286d2f..158532d472 100644
--- a/drivers/common/cnxk/roc_sso_dp.h
+++ b/drivers/common/cnxk/roc_sso_dp.h
@@ -30,4 +30,12 @@ roc_sso_hws_head_wait(uintptr_t base)
 	return tag;
 }
 
+static __plt_always_inline uint8_t
+roc_sso_hws_is_head(uintptr_t base)
+{
+	uintptr_t tag_op = base + SSOW_LF_GWS_TAG;
+
+	return !!(plt_read64(tag_op) & BIT_ULL(35));
+}
+
 #endif /* _ROC_SSO_DP_H_ */
diff --git a/drivers/event/cnxk/cn10k_eventdev.h b/drivers/event/cnxk/cn10k_eventdev.h
index 29567728cd..e79b68e0ac 100644
--- a/drivers/event/cnxk/cn10k_eventdev.h
+++ b/drivers/event/cnxk/cn10k_eventdev.h
@@ -10,9 +10,9 @@
 
 struct cn10k_sso_hws {
 	uint64_t base;
-	uint64_t gw_rdata;
-	void *lookup_mem;
 	uint32_t gw_wdata;
+	void *lookup_mem;
+	uint64_t gw_rdata;
 	uint8_t swtag_req;
 	uint8_t hws_id;
 	/* PTP timestamp */
diff --git a/drivers/event/cnxk/cnxk_worker.c b/drivers/event/cnxk/cnxk_worker.c
new file mode 100644
index 0000000000..60876abcff
--- /dev/null
+++ b/drivers/event/cnxk/cnxk_worker.c
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2023 Marvell.
+ */
+
+#include <rte_common.h>
+#include <rte_pmd_cnxk_eventdev.h>
+#include <rte_eventdev.h>
+
+#include "roc_platform.h"
+#include "roc_sso.h"
+#include "roc_sso_dp.h"
+
+struct pwords {
+	uint64_t u[5];
+};
+
+void
+rte_pmd_cnxk_eventdev_wait_head(uint8_t dev, uint8_t port)
+{
+	struct pwords *w = rte_event_fp_ops[dev].data[port];
+	uint8_t vws;
+
+	if (w->u[1] & 0x3) {
+		roc_sso_hws_head_wait(w->u[0]);
+	} else {
+		/* Dual WS case */
+		vws = (w->u[4] >> 8) & 0x1;
+		roc_sso_hws_head_wait(w->u[vws]);
+	}
+}
+
+
+uint8_t
+rte_pmd_cnxk_eventdev_is_head(uint8_t dev, uint8_t port)
+{
+	struct pwords *w = rte_event_fp_ops[dev].data[port];
+	uintptr_t base;
+	uint8_t vws;
+
+	if (w->u[1] & 0x3) {
+		base = w->u[0];
+	} else {
+		/* Dual WS case */
+		vws = (w->u[4] >> 8) & 0x1;
+		base = w->u[vws];
+	}
+
+	return roc_sso_hws_is_head(base);
+}
diff --git a/drivers/event/cnxk/meson.build b/drivers/event/cnxk/meson.build
index 51f1be8848..13281d687f 100644
--- a/drivers/event/cnxk/meson.build
+++ b/drivers/event/cnxk/meson.build
@@ -20,6 +20,7 @@ endif
 
 sources = files(
         'cnxk_eventdev.c',
+        'cnxk_worker.c',
         'cnxk_eventdev_adptr.c',
         'cnxk_eventdev_selftest.c',
         'cnxk_eventdev_stats.c',
@@ -314,6 +315,7 @@ foreach flag: extra_flags
     endif
 endforeach
 
+headers = files('rte_pmd_cnxk_eventdev.h')
 deps += ['bus_pci', 'common_cnxk', 'net_cnxk', 'crypto_cnxk']
 
 require_iova_in_mbuf = false
diff --git a/drivers/event/cnxk/rte_pmd_cnxk_eventdev.h b/drivers/event/cnxk/rte_pmd_cnxk_eventdev.h
new file mode 100644
index 0000000000..b7b56f5fa1
--- /dev/null
+++ b/drivers/event/cnxk/rte_pmd_cnxk_eventdev.h
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2023 Marvell Inc.
+ */
+
+/**
+ * @file rte_pmd_cnxk_eventdev.h
+ * Marvell CNXK eventdev PMD specific functions.
+ *
+ **/
+
+#ifndef _PMD_CNXK_EVENTDEV_H_
+#define _PMD_CNXK_EVENTDEV_H_
+
+#include <rte_common.h>
+#include <rte_compat.h>
+
+/**
+ * Wait for the currently active flow context on the event port to become HEAD
+ * of the flow-chain.
+ *
+ * @param dev
+ *  Event device identifier.
+ *
+ * @param port
+ *   Event port identifier.
+ */
+__rte_experimental
+void
+rte_pmd_cnxk_eventdev_wait_head(uint8_t dev, uint8_t port);
+
+
+/**
+ * Check if the currently active flow context on the event port is the HEAD
+ * of the flow-chain.
+ *
+ * @param dev
+ *  Event device identifier.
+ *
+ * @param port
+ *   Event port identifier.
+ *
+ * @return Status of the currently held flow context
+ *   0 not the head of the flow-chain
+ *   1 head of the flow-chain
+ */
+__rte_experimental
+uint8_t
+rte_pmd_cnxk_eventdev_is_head(uint8_t dev, uint8_t port);
+
+#endif
diff --git a/drivers/event/cnxk/version.map b/drivers/event/cnxk/version.map
new file mode 100644
index 0000000000..9dbf8eb59d
--- /dev/null
+++ b/drivers/event/cnxk/version.map
@@ -0,0 +1,9 @@
+ DPDK_23 {
+	local: *;
+ };
+
+ EXPERIMENTAL {
+	global:
+	rte_pmd_cnxk_eventdev_wait_head;
+	rte_pmd_cnxk_eventdev_is_head;
+ };
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] event/cnxk: add event port flow context APIs
  2023-08-29 18:19 [PATCH] event/cnxk: add event port flow context APIs pbhagavatula
@ 2023-09-19 13:41 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2023-09-19 13:41 UTC (permalink / raw)
  To: pbhagavatula
  Cc: jerinj, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
	Satha Rao, Shijith Thotton, dev

On Tue, Aug 29, 2023 at 11:50 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Add event port flow context status APIs.
> - rte_pmd_cnxk_eventdev_wait_head() - Allows application to wait
>   for the flow context currently held by the event port to become
>   the HEAD of the flow chain.
> - rte_pmd_cnxk_eventdev_is_head() - Allows application to test if
>   the flow context currently held by the event port is the HEAD
>   of the flow chain.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>


Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-net-eventdev/for-main. Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-19 13:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-29 18:19 [PATCH] event/cnxk: add event port flow context APIs pbhagavatula
2023-09-19 13:41 ` Jerin Jacob

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).