[v2,1/3] common/cnxk: dma result to an offset of the event

Message ID 20240209194347.2734024-1-amitprakashs@marvell.com (mailing list archive)
State Superseded
Delegated to: Jerin Jacob
Headers
Series [v2,1/3] common/cnxk: dma result to an offset of the event |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Amit Prakash Shukla Feb. 9, 2024, 7:43 p.m. UTC
  Adds support to configure writing result to offset of the DMA
response event.

Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
---
v2:
- Added dual workslot enqueue support.
- Fixed compilation error.

 drivers/common/cnxk/roc_dpi.c       |  6 +++++-
 drivers/common/cnxk/roc_dpi.h       |  2 +-
 drivers/common/cnxk/roc_dpi_priv.h  |  4 ++++
 drivers/common/cnxk/roc_idev.c      | 20 ++++++++++++++++++++
 drivers/common/cnxk/roc_idev_priv.h |  3 +++
 5 files changed, 33 insertions(+), 2 deletions(-)
  

Comments

Jerin Jacob Feb. 25, 2024, 3:22 p.m. UTC | #1
On Sat, Feb 10, 2024 at 1:14 AM Amit Prakash Shukla
<amitprakashs@marvell.com> wrote:
>
> Adds support to configure writing result to offset of the DMA
> response event.
>
> Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
> ---
> v2:
> - Added dual workslot enqueue support.
> - Fixed compilation error.


Please rebase to next-eventdev. It has the following build issue now.

FAILED: drivers/libtmp_rte_dma_cnxk.a.p/dma_cnxk_cnxk_dmadev.c.o
ccache gcc -Idrivers/libtmp_rte_dma_cnxk.a.p -Idrivers -I../drivers
-Idrivers/dma/cnxk -I../drivers/dma/cnxk -Ilib/dmadev -I../lib/dmadev
-I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include
-Ilib/eal/linux/include -I../l
ib/eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include
-Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal
-Ilib/kvargs -I../lib/kvargs -Ilib/log -I../lib/log -Ilib/metrics
-I../lib/metrics -Ilib/telemetry -I../lib/t
elemetry -Idrivers/bus/pci -I../drivers/bus/pci
-I../drivers/bus/pci/linux -Ilib/pci -I../lib/pci
-Idrivers/common/cnxk -I../drivers/common/cnxk -Ilib/net -I../lib/net
-Ilib/ethdev -I../lib/ethdev -Ilib/meter -I../lib/meter -Ilib/mbuf -I
../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring
-Ilib/security -I../lib/security -Ilib/cryptodev -I../lib/cryptodev
-Ilib/rcu -I../lib/rcu -fdiagnostics-color=always
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra
-Werror -std=c11 -O2 -g -include rte_config.h -Wcast-qual -Wdeprecated
-Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs -Wold-style-definition
-Wpointer-arith -Wsign-compare -Wst
rict-prototypes -Wundef -Wwrite-strings -Wno-address-of-packed-member
-Wno-packed-not-aligned -Wno-missing-field-initializers
-Wno-zero-length-bounds -D_GNU_SOURCE -fPIC -march=native -mrtm
-DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -
Wno-format-truncation -Wno-uninitialized
-DRTE_LOG_DEFAULT_LOGTYPE=pmd.dma.cnxk -MD -MQ
drivers/libtmp_rte_dma_cnxk.a.p/dma_cnxk_cnxk_dmadev.c.o -MF
drivers/libtmp_rte_dma_cnxk.a.p/dma_cnxk_cnxk_dmadev.c.o.d -o
drivers/libtmp_rte_dma_cnx
k.a.p/dma_cnxk_cnxk_dmadev.c.o -c ../drivers/dma/cnxk/cnxk_dmadev.c
../drivers/dma/cnxk/cnxk_dmadev.c: In function ‘cnxk_dmadev_probe’:
../drivers/dma/cnxk/cnxk_dmadev.c:595:14: error: too few arguments to
function ‘roc_dpi_dev_init’
  595 |         rc = roc_dpi_dev_init(rdpi);
      |              ^~~~~~~~~~~~~~~~
In file included from ../drivers/common/cnxk/roc_api.h:99,
                 from ../drivers/dma/cnxk/cnxk_dmadev.h:20,
                 from ../drivers/dma/cnxk/cnxk_dmadev.c:5:
../drivers/common/cnxk/roc_dpi.h:14:15: note: declared here
   14 | int __roc_api roc_dpi_dev_init(struct roc_dpi *roc_dpi, uint8_t offset);
  

Patch

diff --git a/drivers/common/cnxk/roc_dpi.c b/drivers/common/cnxk/roc_dpi.c
index c241168294..1ee777d779 100644
--- a/drivers/common/cnxk/roc_dpi.c
+++ b/drivers/common/cnxk/roc_dpi.c
@@ -83,6 +83,9 @@  roc_dpi_configure(struct roc_dpi *roc_dpi, uint32_t chunk_sz, uint64_t aura, uin
 	mbox_msg.s.aura = aura;
 	mbox_msg.s.sso_pf_func = idev_sso_pffunc_get();
 	mbox_msg.s.npa_pf_func = idev_npa_pffunc_get();
+	mbox_msg.s.wqecsoff = idev_dma_cs_offset_get();
+	if (mbox_msg.s.wqecsoff)
+		mbox_msg.s.wqecs = 1;
 
 	rc = send_msg_to_pf(&pci_dev->addr, (const char *)&mbox_msg,
 			    sizeof(dpi_mbox_msg_t));
@@ -94,7 +97,7 @@  roc_dpi_configure(struct roc_dpi *roc_dpi, uint32_t chunk_sz, uint64_t aura, uin
 }
 
 int
-roc_dpi_dev_init(struct roc_dpi *roc_dpi)
+roc_dpi_dev_init(struct roc_dpi *roc_dpi, uint8_t offset)
 {
 	struct plt_pci_device *pci_dev = roc_dpi->pci_dev;
 	uint16_t vfid;
@@ -103,6 +106,7 @@  roc_dpi_dev_init(struct roc_dpi *roc_dpi)
 	vfid = ((pci_dev->addr.devid & 0x1F) << 3) | (pci_dev->addr.function & 0x7);
 	vfid -= 1;
 	roc_dpi->vfid = vfid;
+	idev_dma_cs_offset_set(offset);
 
 	return 0;
 }
diff --git a/drivers/common/cnxk/roc_dpi.h b/drivers/common/cnxk/roc_dpi.h
index 4ebde5b8a6..978e2badb2 100644
--- a/drivers/common/cnxk/roc_dpi.h
+++ b/drivers/common/cnxk/roc_dpi.h
@@ -11,7 +11,7 @@  struct roc_dpi {
 	uint16_t vfid;
 } __plt_cache_aligned;
 
-int __roc_api roc_dpi_dev_init(struct roc_dpi *roc_dpi);
+int __roc_api roc_dpi_dev_init(struct roc_dpi *roc_dpi, uint8_t offset);
 int __roc_api roc_dpi_dev_fini(struct roc_dpi *roc_dpi);
 
 int __roc_api roc_dpi_configure(struct roc_dpi *dpi, uint32_t chunk_sz, uint64_t aura,
diff --git a/drivers/common/cnxk/roc_dpi_priv.h b/drivers/common/cnxk/roc_dpi_priv.h
index 518a3e7351..52962c8bc0 100644
--- a/drivers/common/cnxk/roc_dpi_priv.h
+++ b/drivers/common/cnxk/roc_dpi_priv.h
@@ -31,6 +31,10 @@  typedef union dpi_mbox_msg_t {
 		uint64_t sso_pf_func : 16;
 		/* NPA PF function */
 		uint64_t npa_pf_func : 16;
+		/* WQE queue DMA completion status enable */
+		uint64_t wqecs : 1;
+		/* WQE queue DMA completion status offset */
+		uint64_t wqecsoff : 8;
 	} s;
 } dpi_mbox_msg_t;
 
diff --git a/drivers/common/cnxk/roc_idev.c b/drivers/common/cnxk/roc_idev.c
index e6c6b34d78..7b922c8bae 100644
--- a/drivers/common/cnxk/roc_idev.c
+++ b/drivers/common/cnxk/roc_idev.c
@@ -301,6 +301,26 @@  idev_sso_set(struct roc_sso *sso)
 		__atomic_store_n(&idev->sso, sso, __ATOMIC_RELEASE);
 }
 
+void
+idev_dma_cs_offset_set(uint8_t offset)
+{
+	struct idev_cfg *idev = idev_get_cfg();
+
+	if (idev != NULL)
+		idev->dma_cs_offset = offset;
+}
+
+uint8_t
+idev_dma_cs_offset_get(void)
+{
+	struct idev_cfg *idev = idev_get_cfg();
+
+	if (idev != NULL)
+		return idev->dma_cs_offset;
+
+	return 0;
+}
+
 uint64_t
 roc_idev_nix_inl_meta_aura_get(void)
 {
diff --git a/drivers/common/cnxk/roc_idev_priv.h b/drivers/common/cnxk/roc_idev_priv.h
index 80f8465e1c..cf63c58d92 100644
--- a/drivers/common/cnxk/roc_idev_priv.h
+++ b/drivers/common/cnxk/roc_idev_priv.h
@@ -37,6 +37,7 @@  struct idev_cfg {
 	struct roc_nix_list roc_nix_list;
 	plt_spinlock_t nix_inl_dev_lock;
 	plt_spinlock_t npa_dev_lock;
+	uint8_t dma_cs_offset;
 };
 
 /* Generic */
@@ -55,6 +56,8 @@  void idev_sso_pffunc_set(uint16_t sso_pf_func);
 uint16_t idev_sso_pffunc_get(void);
 struct roc_sso *idev_sso_get(void);
 void idev_sso_set(struct roc_sso *sso);
+void idev_dma_cs_offset_set(uint8_t offset);
+uint8_t idev_dma_cs_offset_get(void);
 
 /* idev lmt */
 uint16_t idev_lmt_pffunc_get(void);