DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nagadheeraj Rottela <rnagadheeraj@marvell.com>
To: <gakhil@marvell.com>, <fanzhang.oss@gmail.com>, <ashishg@marvell.com>
Cc: <dev@dpdk.org>, Nagadheeraj Rottela <rnagadheeraj@marvell.com>
Subject: [PATCH v5 1/7] crypto/nitrox: move common code
Date: Sat, 2 Mar 2024 15:08:07 +0530	[thread overview]
Message-ID: <20240302093813.14922-2-rnagadheeraj@marvell.com> (raw)
In-Reply-To: <20240302093813.14922-1-rnagadheeraj@marvell.com>

A new compressdev Nitrox PMD will be added in next few patches.
This patch moves some of the common code which is shared across
Nitrox crypto and compress drivers to drivers/common/nitrox folder.

Signed-off-by: Nagadheeraj Rottela <rnagadheeraj@marvell.com>
---
 MAINTAINERS                                    |  1 +
 drivers/common/nitrox/meson.build              | 18 ++++++++++++++++++
 drivers/{crypto => common}/nitrox/nitrox_csr.h |  0
 .../{crypto => common}/nitrox/nitrox_device.c  | 14 ++++++++++++++
 .../{crypto => common}/nitrox/nitrox_device.h  |  1 -
 drivers/{crypto => common}/nitrox/nitrox_hal.c |  0
 drivers/{crypto => common}/nitrox/nitrox_hal.h |  0
 .../{crypto => common}/nitrox/nitrox_logs.c    |  0
 .../{crypto => common}/nitrox/nitrox_logs.h    |  0
 drivers/{crypto => common}/nitrox/nitrox_qp.c  |  2 +-
 drivers/{crypto => common}/nitrox/nitrox_qp.h  | 11 ++++++++++-
 drivers/common/nitrox/version.map              |  9 +++++++++
 drivers/crypto/nitrox/meson.build              | 11 +++++------
 drivers/meson.build                            |  1 +
 14 files changed, 59 insertions(+), 9 deletions(-)
 create mode 100644 drivers/common/nitrox/meson.build
 rename drivers/{crypto => common}/nitrox/nitrox_csr.h (100%)
 rename drivers/{crypto => common}/nitrox/nitrox_device.c (92%)
 rename drivers/{crypto => common}/nitrox/nitrox_device.h (94%)
 rename drivers/{crypto => common}/nitrox/nitrox_hal.c (100%)
 rename drivers/{crypto => common}/nitrox/nitrox_hal.h (100%)
 rename drivers/{crypto => common}/nitrox/nitrox_logs.c (100%)
 rename drivers/{crypto => common}/nitrox/nitrox_logs.h (100%)
 rename drivers/{crypto => common}/nitrox/nitrox_qp.c (99%)
 rename drivers/{crypto => common}/nitrox/nitrox_qp.h (91%)
 create mode 100644 drivers/common/nitrox/version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 962c359cdd..d6abebc55c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1142,6 +1142,7 @@ Marvell Nitrox
 M: Nagadheeraj Rottela <rnagadheeraj@marvell.com>
 M: Srikanth Jampala <jsrikanth@marvell.com>
 F: drivers/crypto/nitrox/
+F: drivers/common/nitrox/
 F: doc/guides/cryptodevs/nitrox.rst
 F: doc/guides/cryptodevs/features/nitrox.ini
 
diff --git a/drivers/common/nitrox/meson.build b/drivers/common/nitrox/meson.build
new file mode 100644
index 0000000000..99fadbbfc9
--- /dev/null
+++ b/drivers/common/nitrox/meson.build
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2024 Marvell.
+
+if not is_linux
+    build = false
+    reason = 'only supported on Linux'
+endif
+
+deps += ['bus_pci']
+
+sources += files(
+        'nitrox_device.c',
+        'nitrox_hal.c',
+        'nitrox_logs.c',
+        'nitrox_qp.c',
+)
+
+includes += include_directories('../../crypto/nitrox')
diff --git a/drivers/crypto/nitrox/nitrox_csr.h b/drivers/common/nitrox/nitrox_csr.h
similarity index 100%
rename from drivers/crypto/nitrox/nitrox_csr.h
rename to drivers/common/nitrox/nitrox_csr.h
diff --git a/drivers/crypto/nitrox/nitrox_device.c b/drivers/common/nitrox/nitrox_device.c
similarity index 92%
rename from drivers/crypto/nitrox/nitrox_device.c
rename to drivers/common/nitrox/nitrox_device.c
index 5b319dd681..b2f638ec8a 100644
--- a/drivers/crypto/nitrox/nitrox_device.c
+++ b/drivers/common/nitrox/nitrox_device.c
@@ -120,5 +120,19 @@ static struct rte_pci_driver nitrox_pmd = {
 	.remove         = nitrox_pci_remove,
 };
 
+__rte_weak int
+nitrox_sym_pmd_create(struct nitrox_device *ndev)
+{
+	RTE_SET_USED(ndev);
+	return 0;
+}
+
+__rte_weak int
+nitrox_sym_pmd_destroy(struct nitrox_device *ndev)
+{
+	RTE_SET_USED(ndev);
+	return 0;
+}
+
 RTE_PMD_REGISTER_PCI(nitrox, nitrox_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(nitrox, pci_id_nitrox_map);
diff --git a/drivers/crypto/nitrox/nitrox_device.h b/drivers/common/nitrox/nitrox_device.h
similarity index 94%
rename from drivers/crypto/nitrox/nitrox_device.h
rename to drivers/common/nitrox/nitrox_device.h
index 1ff7c59b63..b7c7ffd772 100644
--- a/drivers/crypto/nitrox/nitrox_device.h
+++ b/drivers/common/nitrox/nitrox_device.h
@@ -6,7 +6,6 @@
 #define _NITROX_DEVICE_H_
 
 #include <bus_pci_driver.h>
-#include <rte_cryptodev.h>
 
 struct nitrox_sym_device;
 
diff --git a/drivers/crypto/nitrox/nitrox_hal.c b/drivers/common/nitrox/nitrox_hal.c
similarity index 100%
rename from drivers/crypto/nitrox/nitrox_hal.c
rename to drivers/common/nitrox/nitrox_hal.c
diff --git a/drivers/crypto/nitrox/nitrox_hal.h b/drivers/common/nitrox/nitrox_hal.h
similarity index 100%
rename from drivers/crypto/nitrox/nitrox_hal.h
rename to drivers/common/nitrox/nitrox_hal.h
diff --git a/drivers/crypto/nitrox/nitrox_logs.c b/drivers/common/nitrox/nitrox_logs.c
similarity index 100%
rename from drivers/crypto/nitrox/nitrox_logs.c
rename to drivers/common/nitrox/nitrox_logs.c
diff --git a/drivers/crypto/nitrox/nitrox_logs.h b/drivers/common/nitrox/nitrox_logs.h
similarity index 100%
rename from drivers/crypto/nitrox/nitrox_logs.h
rename to drivers/common/nitrox/nitrox_logs.h
diff --git a/drivers/crypto/nitrox/nitrox_qp.c b/drivers/common/nitrox/nitrox_qp.c
similarity index 99%
rename from drivers/crypto/nitrox/nitrox_qp.c
rename to drivers/common/nitrox/nitrox_qp.c
index 5e85ccbd51..79a26f0024 100644
--- a/drivers/crypto/nitrox/nitrox_qp.c
+++ b/drivers/common/nitrox/nitrox_qp.c
@@ -2,7 +2,7 @@
  * Copyright(C) 2019 Marvell International Ltd.
  */
 
-#include <rte_cryptodev.h>
+#include <rte_memzone.h>
 #include <rte_malloc.h>
 
 #include "nitrox_qp.h"
diff --git a/drivers/crypto/nitrox/nitrox_qp.h b/drivers/common/nitrox/nitrox_qp.h
similarity index 91%
rename from drivers/crypto/nitrox/nitrox_qp.h
rename to drivers/common/nitrox/nitrox_qp.h
index d42d53f92b..23dffd1268 100644
--- a/drivers/crypto/nitrox/nitrox_qp.h
+++ b/drivers/common/nitrox/nitrox_qp.h
@@ -22,6 +22,13 @@ struct rid {
 	struct nitrox_softreq *sr;
 };
 
+struct nitrox_qp_stats {
+	uint64_t enqueued_count;
+	uint64_t dequeued_count;
+	uint64_t enqueue_err_count;
+	uint64_t dequeue_err_count;
+};
+
 struct nitrox_qp {
 	struct command_queue cmdq;
 	struct rid *ridq;
@@ -29,7 +36,7 @@ struct nitrox_qp {
 	uint32_t head;
 	uint32_t tail;
 	struct rte_mempool *sr_mp;
-	struct rte_cryptodev_stats stats;
+	struct nitrox_qp_stats stats;
 	uint16_t qno;
 	rte_atomic16_t pending_count;
 };
@@ -96,9 +103,11 @@ nitrox_qp_dequeue(struct nitrox_qp *qp)
 	rte_atomic16_dec(&qp->pending_count);
 }
 
+__rte_internal
 int nitrox_qp_setup(struct nitrox_qp *qp, uint8_t *bar_addr,
 		    const char *dev_name, uint32_t nb_descriptors,
 		    uint8_t inst_size, int socket_id);
+__rte_internal
 int nitrox_qp_release(struct nitrox_qp *qp, uint8_t *bar_addr);
 
 #endif /* _NITROX_QP_H_ */
diff --git a/drivers/common/nitrox/version.map b/drivers/common/nitrox/version.map
new file mode 100644
index 0000000000..43295171e4
--- /dev/null
+++ b/drivers/common/nitrox/version.map
@@ -0,0 +1,9 @@
+INTERNAL {
+	global:
+
+	nitrox_logtype;
+	nitrox_qp_release;
+	nitrox_qp_setup;
+
+	local: *;
+};
diff --git a/drivers/crypto/nitrox/meson.build b/drivers/crypto/nitrox/meson.build
index 2cc47c4626..f8887713d2 100644
--- a/drivers/crypto/nitrox/meson.build
+++ b/drivers/crypto/nitrox/meson.build
@@ -6,13 +6,12 @@ if not is_linux
     reason = 'only supported on Linux'
 endif
 
-deps += ['bus_pci']
-sources = files(
-        'nitrox_device.c',
-        'nitrox_hal.c',
-        'nitrox_logs.c',
+deps += ['common_nitrox', 'bus_pci', 'cryptodev']
+
+sources += files(
         'nitrox_sym.c',
         'nitrox_sym_capabilities.c',
         'nitrox_sym_reqmgr.c',
-        'nitrox_qp.c',
 )
+
+includes += include_directories('../../common/nitrox')
diff --git a/drivers/meson.build b/drivers/meson.build
index f2be71bc05..9fd66e3264 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -14,6 +14,7 @@ subdirs = [
         'common/cnxk',    # depends on bus.
         'common/mlx5',    # depends on bus.
         'common/nfp',     # depends on bus.
+	'common/nitrox',  # depends on bus.
         'common/qat',     # depends on bus.
         'common/sfc_efx', # depends on bus.
         'mempool',        # depends on common and bus.
-- 
2.42.0


  reply	other threads:[~2024-03-02  9:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-02  9:38 [PATCH 0/7] add Nitrox compress device support Nagadheeraj Rottela
2024-03-02  9:38 ` Nagadheeraj Rottela [this message]
2024-03-02  9:38 ` [PATCH v5 2/7] drivers/compress: add Nitrox driver Nagadheeraj Rottela
2024-03-02  9:38 ` [PATCH v5 3/7] common/nitrox: add compress hardware queue management Nagadheeraj Rottela
2024-03-02  9:38 ` [PATCH v5 4/7] crypto/nitrox: set queue type during queue pair setup Nagadheeraj Rottela
2024-03-02  9:38 ` [PATCH v5 5/7] compress/nitrox: add software queue management Nagadheeraj Rottela
2024-03-02  9:38 ` [PATCH v5 6/7] compress/nitrox: support stateless request Nagadheeraj Rottela
2024-03-02  9:38 ` [PATCH v5 7/7] compress/nitrox: support stateful request Nagadheeraj Rottela
2024-03-04  7:14 ` [PATCH 0/7] add Nitrox compress device support Akhil Goyal

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=20240302093813.14922-2-rnagadheeraj@marvell.com \
    --to=rnagadheeraj@marvell.com \
    --cc=ashishg@marvell.com \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=gakhil@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).