event/cnxk: add event port flow context APIs

Message ID 20230829181933.5358-1-pbhagavatula@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series event/cnxk: add event port flow context APIs |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Pavan Nikhilesh Bhagavatula Aug. 29, 2023, 6:19 p.m. UTC
  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
  

Comments

Jerin Jacob Sept. 19, 2023, 1:41 p.m. UTC | #1
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
  

Patch

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;
+ };