[v2,1/7] crypto/nitrox: move nitrox common code to common folder

Message ID 20240212134743.15153-2-rnagadheeraj@marvell.com (mailing list archive)
State Superseded
Delegated to: akhil goyal
Headers
Series add Nitrox compress device support |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Nagadheeraj Rottela Feb. 12, 2024, 1:47 p.m. UTC
  - The common code will be shared by both crypto and compress Nitrox
  PMD's.

Signed-off-by: Nagadheeraj Rottela <rnagadheeraj@marvell.com>
---
 MAINTAINERS                                   |  1 +
 drivers/common/nitrox/meson.build             | 35 +++++++++++++++++++
 .../{crypto => common}/nitrox/nitrox_csr.h    |  0
 .../{crypto => common}/nitrox/nitrox_device.c | 14 ++++++++
 .../{crypto => common}/nitrox/nitrox_device.h |  0
 .../{crypto => common}/nitrox/nitrox_hal.c    |  0
 .../{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 |  0
 drivers/{crypto => common}/nitrox/nitrox_qp.h |  0
 drivers/crypto/meson.build                    |  1 -
 drivers/crypto/nitrox/meson.build             | 18 ----------
 drivers/meson.build                           |  1 +
 14 files changed, 51 insertions(+), 19 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 (100%)
 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 (100%)
 rename drivers/{crypto => common}/nitrox/nitrox_qp.h (100%)
 delete mode 100644 drivers/crypto/nitrox/meson.build
  

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 5fb3a73f84..22cdaae979 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1136,6 +1136,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..9b1b7bd03b
--- /dev/null
+++ b/drivers/common/nitrox/meson.build
@@ -0,0 +1,35 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2024 Marvell.
+
+if not is_linux
+    build = false
+    reason = 'only supported on Linux'
+endif
+
+nitrox_crypto = true
+nitrox_crypto_path = 'crypto/nitrox'
+nitrox_crypto_relpath = '../../' + nitrox_crypto_path
+
+if disable_drivers.contains(nitrox_crypto_path)
+    nitrox_crypto = false
+endif
+
+deps += ['bus_pci', 'cryptodev']
+sources = files(
+        'nitrox_device.c',
+        'nitrox_hal.c',
+        'nitrox_logs.c',
+        'nitrox_qp.c',
+)
+includes += include_directories(
+        nitrox_crypto_relpath,
+)
+
+if nitrox_crypto
+    foreach f: ['nitrox_sym.c',
+		'nitrox_sym_capabilities.c',
+		'nitrox_sym_reqmgr.c',
+        ]
+        sources += files(join_paths(nitrox_crypto_relpath, f))
+    endforeach
+endif
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 100%
rename from drivers/crypto/nitrox/nitrox_device.h
rename to drivers/common/nitrox/nitrox_device.h
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 100%
rename from drivers/crypto/nitrox/nitrox_qp.c
rename to drivers/common/nitrox/nitrox_qp.c
diff --git a/drivers/crypto/nitrox/nitrox_qp.h b/drivers/common/nitrox/nitrox_qp.h
similarity index 100%
rename from drivers/crypto/nitrox/nitrox_qp.h
rename to drivers/common/nitrox/nitrox_qp.h
diff --git a/drivers/crypto/meson.build b/drivers/crypto/meson.build
index ee5377deff..3167b1ab85 100644
--- a/drivers/crypto/meson.build
+++ b/drivers/crypto/meson.build
@@ -13,7 +13,6 @@  drivers = [
         'ipsec_mb',
         'mlx5',
         'mvsam',
-        'nitrox',
         'null',
         'octeontx',
         'openssl',
diff --git a/drivers/crypto/nitrox/meson.build b/drivers/crypto/nitrox/meson.build
deleted file mode 100644
index 2cc47c4626..0000000000
--- a/drivers/crypto/nitrox/meson.build
+++ /dev/null
@@ -1,18 +0,0 @@ 
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(C) 2019 Marvell International Ltd.
-
-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_sym.c',
-        'nitrox_sym_capabilities.c',
-        'nitrox_sym_reqmgr.c',
-        'nitrox_qp.c',
-)
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.