[01/20] crypto/cnxk: add driver skeleton

Message ID 1622652221-22732-2-git-send-email-anoobj@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series Add Marvell CNXK crypto PMDs |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing fail build patch failure

Commit Message

Anoob Joseph June 2, 2021, 4:43 p.m. UTC
  From: Ankur Dwivedi <adwivedi@marvell.com>

Add driver skeleton for crypto_cn9k & crypto_cn10k PMDs leveraging cnxk
common framework.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Archana Muniganti <marchana@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
 MAINTAINERS                              |  9 +++++++
 doc/guides/cryptodevs/features/cn10k.ini | 21 ++++++++++++++++
 doc/guides/cryptodevs/features/cn9k.ini  | 21 ++++++++++++++++
 drivers/crypto/cnxk/cn10k_cryptodev.c    | 42 ++++++++++++++++++++++++++++++++
 drivers/crypto/cnxk/cn10k_cryptodev.h    | 13 ++++++++++
 drivers/crypto/cnxk/cn9k_cryptodev.c     | 40 ++++++++++++++++++++++++++++++
 drivers/crypto/cnxk/cn9k_cryptodev.h     | 13 ++++++++++
 drivers/crypto/cnxk/meson.build          | 16 ++++++++++++
 drivers/crypto/cnxk/version.map          |  3 +++
 drivers/crypto/meson.build               |  1 +
 10 files changed, 179 insertions(+)
 create mode 100644 doc/guides/cryptodevs/features/cn10k.ini
 create mode 100644 doc/guides/cryptodevs/features/cn9k.ini
 create mode 100644 drivers/crypto/cnxk/cn10k_cryptodev.c
 create mode 100644 drivers/crypto/cnxk/cn10k_cryptodev.h
 create mode 100644 drivers/crypto/cnxk/cn9k_cryptodev.c
 create mode 100644 drivers/crypto/cnxk/cn9k_cryptodev.h
 create mode 100644 drivers/crypto/cnxk/meson.build
 create mode 100644 drivers/crypto/cnxk/version.map
  

Comments

Akhil Goyal June 16, 2021, 7:28 a.m. UTC | #1
> 
> +Marvell cnxk
This should be Marvell cnxk crypto as we have net and event PMD
with the same name.

> +M: Ankur Dwivedi <adwivedi@marvell.com>
> +M: Anoob Joseph <anoobj@marvell.com>
> +M: Tejasree Kondoj <ktejasree@marvell.com>
> +F: drivers/crypto/cnxk/
> +F: doc/guides/cryptodevs/cnxk.rst
> +F: doc/guides/cryptodevs/features/cn9k.ini
> +F: doc/guides/cryptodevs/features/cn10k.ini
> +
  
Anoob Joseph June 16, 2021, 7:37 a.m. UTC | #2
Hi Akhil,

> >
> > +Marvell cnxk
> This should be Marvell cnxk crypto as we have net and event PMD with the same
> name.

[Anoob] Mempool & event already follows this convention for Marvell cnxk. Net driver (which is in pipeline) is also adding the same. Marvell OCTEON TX2 all drivers followed the same convention as well. Just changing to 'Marvell cnxk crypto' here might make it stand out.

I don't mind making the change here if you can confirm it's okay.

> 
> > +M: Ankur Dwivedi <adwivedi@marvell.com>
> > +M: Anoob Joseph <anoobj@marvell.com>
> > +M: Tejasree Kondoj <ktejasree@marvell.com>
> > +F: drivers/crypto/cnxk/
> > +F: doc/guides/cryptodevs/cnxk.rst
> > +F: doc/guides/cryptodevs/features/cn9k.ini
> > +F: doc/guides/cryptodevs/features/cn10k.ini
> > +

Thanks,
Anoob
  
Akhil Goyal June 16, 2021, 7:47 a.m. UTC | #3
> Hi Akhil,
> 
> > >
> > > +Marvell cnxk
> > This should be Marvell cnxk crypto as we have net and event PMD with the
> same
> > name.
> 
> [Anoob] Mempool & event already follows this convention for Marvell cnxk.
> Net driver (which is in pipeline) is also adding the same. Marvell OCTEON TX2
> all drivers followed the same convention as well. Just changing to 'Marvell
> cnxk crypto' here might make it stand out.
> 
> I don't mind making the change here if you can confirm it's okay.

I think there is no convention followed here,
In case of Octeontx2, I see following in MAINTAINERS
Marvell OCTEON TX2 crypto
Marvell OCTEON TX2 regex
Marvell OCTEON TX2   -------------mempool missing here
Marvell OCTEON TX2 DMA
Marvell OCTEON TX2 EP
Marvell OCTEON TX2   ------------ event missing here
Marvell OCTEON TX2   ------------ net missing here.

I believe it is better to add crypto here when we have same PMD name for all
Subsystems. It is convenient that way.
@Thomas Monjalon Can you suggest?

Regards,
Akhil
  
Akhil Goyal June 16, 2021, 7:58 p.m. UTC | #4
> From: Ankur Dwivedi <adwivedi@marvell.com>
> 
> Add driver skeleton for crypto_cn9k & crypto_cn10k PMDs leveraging cnxk
> common framework.
> 
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
> Signed-off-by: Anoob Joseph <anoobj@marvell.com>
> Signed-off-by: Archana Muniganti <marchana@marvell.com>
> Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
> ---
>  MAINTAINERS                              |  9 +++++++
>  doc/guides/cryptodevs/features/cn10k.ini | 21 ++++++++++++++++
>  doc/guides/cryptodevs/features/cn9k.ini  | 21 ++++++++++++++++
>  drivers/crypto/cnxk/cn10k_cryptodev.c    | 42
> ++++++++++++++++++++++++++++++++
>  drivers/crypto/cnxk/cn10k_cryptodev.h    | 13 ++++++++++
>  drivers/crypto/cnxk/cn9k_cryptodev.c     | 40
> ++++++++++++++++++++++++++++++
>  drivers/crypto/cnxk/cn9k_cryptodev.h     | 13 ++++++++++
>  drivers/crypto/cnxk/meson.build          | 16 ++++++++++++
>  drivers/crypto/cnxk/version.map          |  3 +++
>  drivers/crypto/meson.build               |  1 +
>  10 files changed, 179 insertions(+)
>  create mode 100644 doc/guides/cryptodevs/features/cn10k.ini
>  create mode 100644 doc/guides/cryptodevs/features/cn9k.ini
>  create mode 100644 drivers/crypto/cnxk/cn10k_cryptodev.c
>  create mode 100644 drivers/crypto/cnxk/cn10k_cryptodev.h
>  create mode 100644 drivers/crypto/cnxk/cn9k_cryptodev.c
>  create mode 100644 drivers/crypto/cnxk/cn9k_cryptodev.h
>  create mode 100644 drivers/crypto/cnxk/meson.build
>  create mode 100644 drivers/crypto/cnxk/version.map
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 5877a16..ecfd1a4 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1080,6 +1080,15 @@ F: drivers/crypto/octeontx2/
>  F: doc/guides/cryptodevs/octeontx2.rst
>  F: doc/guides/cryptodevs/features/octeontx2.ini
> 
> +Marvell cnxk
> +M: Ankur Dwivedi <adwivedi@marvell.com>
> +M: Anoob Joseph <anoobj@marvell.com>
> +M: Tejasree Kondoj <ktejasree@marvell.com>
> +F: drivers/crypto/cnxk/
> +F: doc/guides/cryptodevs/cnxk.rst

File added in the MAINTAINERS but is not part of patch.

> +F: doc/guides/cryptodevs/features/cn9k.ini
> +F: doc/guides/cryptodevs/features/cn10k.ini
> +
  

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 5877a16..ecfd1a4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1080,6 +1080,15 @@  F: drivers/crypto/octeontx2/
 F: doc/guides/cryptodevs/octeontx2.rst
 F: doc/guides/cryptodevs/features/octeontx2.ini
 
+Marvell cnxk
+M: Ankur Dwivedi <adwivedi@marvell.com>
+M: Anoob Joseph <anoobj@marvell.com>
+M: Tejasree Kondoj <ktejasree@marvell.com>
+F: drivers/crypto/cnxk/
+F: doc/guides/cryptodevs/cnxk.rst
+F: doc/guides/cryptodevs/features/cn9k.ini
+F: doc/guides/cryptodevs/features/cn10k.ini
+
 Null Crypto
 M: Declan Doherty <declan.doherty@intel.com>
 F: drivers/crypto/null/
diff --git a/doc/guides/cryptodevs/features/cn10k.ini b/doc/guides/cryptodevs/features/cn10k.ini
new file mode 100644
index 0000000..0aa097d
--- /dev/null
+++ b/doc/guides/cryptodevs/features/cn10k.ini
@@ -0,0 +1,21 @@ 
+;
+; Supported features of the 'cn10k' crypto driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+
+;
+; Supported crypto algorithms of 'cn10k' crypto driver.
+;
+[Cipher]
+
+;
+; Supported authentication algorithms of 'cn10k' crypto driver.
+;
+[Auth]
+
+;
+; Supported AEAD algorithms of 'cn10k' crypto driver.
+;
+[AEAD]
diff --git a/doc/guides/cryptodevs/features/cn9k.ini b/doc/guides/cryptodevs/features/cn9k.ini
new file mode 100644
index 0000000..64ee929
--- /dev/null
+++ b/doc/guides/cryptodevs/features/cn9k.ini
@@ -0,0 +1,21 @@ 
+;
+; Supported features of the 'cn9k' crypto driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+
+;
+; Supported crypto algorithms of 'cn9k' crypto driver.
+;
+[Cipher]
+
+;
+; Supported authentication algorithms of 'cn9k' crypto driver.
+;
+[Auth]
+
+;
+; Supported AEAD algorithms of 'cn9k' crypto driver.
+;
+[AEAD]
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c
new file mode 100644
index 0000000..4d2140c
--- /dev/null
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c
@@ -0,0 +1,42 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include <rte_bus_pci.h>
+#include <rte_common.h>
+#include <rte_crypto.h>
+#include <rte_cryptodev.h>
+#include <rte_cryptodev_pmd.h>
+#include <rte_dev.h>
+#include <rte_pci.h>
+
+#include "cn10k_cryptodev.h"
+#include "roc_api.h"
+
+uint8_t cn10k_cryptodev_driver_id;
+
+static struct rte_pci_id pci_id_cpt_table[] = {
+	{
+		RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM,
+			       PCI_DEVID_CN10K_RVU_CPT_VF)
+	},
+	/* sentinel */
+	{
+		.device_id = 0
+	},
+};
+
+static struct rte_pci_driver cn10k_cryptodev_pmd = {
+	.id_table = pci_id_cpt_table,
+	.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA,
+	.probe = NULL,
+	.remove = NULL,
+};
+
+static struct cryptodev_driver cn10k_cryptodev_drv;
+
+RTE_PMD_REGISTER_PCI(CRYPTODEV_NAME_CN10K_PMD, cn10k_cryptodev_pmd);
+RTE_PMD_REGISTER_PCI_TABLE(CRYPTODEV_NAME_CN10K_PMD, pci_id_cpt_table);
+RTE_PMD_REGISTER_KMOD_DEP(CRYPTODEV_NAME_CN10K_PMD, "vfio-pci");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cn10k_cryptodev_drv, cn10k_cryptodev_pmd.driver,
+			       cn10k_cryptodev_driver_id);
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.h b/drivers/crypto/cnxk/cn10k_cryptodev.h
new file mode 100644
index 0000000..61f62ef
--- /dev/null
+++ b/drivers/crypto/cnxk/cn10k_cryptodev.h
@@ -0,0 +1,13 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#ifndef _CN10K_CRYPTODEV_H_
+#define _CN10K_CRYPTODEV_H_
+
+/* Marvell OCTEON CN10K Crypto PMD device name */
+#define CRYPTODEV_NAME_CN10K_PMD crypto_cn10k
+
+extern uint8_t cn10k_cryptodev_driver_id;
+
+#endif /* _CN10K_CRYPTODEV_H_ */
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.c b/drivers/crypto/cnxk/cn9k_cryptodev.c
new file mode 100644
index 0000000..7654c53
--- /dev/null
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.c
@@ -0,0 +1,40 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include <rte_bus_pci.h>
+#include <rte_common.h>
+#include <rte_crypto.h>
+#include <rte_cryptodev.h>
+#include <rte_cryptodev_pmd.h>
+#include <rte_dev.h>
+#include <rte_pci.h>
+
+#include "cn9k_cryptodev.h"
+#include "roc_api.h"
+
+uint8_t cn9k_cryptodev_driver_id;
+
+static struct rte_pci_id pci_id_cpt_table[] = {
+	{
+	},
+	/* sentinel */
+	{
+		.device_id = 0
+	},
+};
+
+static struct rte_pci_driver cn9k_cryptodev_pmd = {
+	.id_table = pci_id_cpt_table,
+	.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA,
+	.probe = NULL,
+	.remove = NULL,
+};
+
+static struct cryptodev_driver cn9k_cryptodev_drv;
+
+RTE_PMD_REGISTER_PCI(CRYPTODEV_NAME_CN9K_PMD, cn9k_cryptodev_pmd);
+RTE_PMD_REGISTER_PCI_TABLE(CRYPTODEV_NAME_CN9K_PMD, pci_id_cpt_table);
+RTE_PMD_REGISTER_KMOD_DEP(CRYPTODEV_NAME_CN9K_PMD, "vfio-pci");
+RTE_PMD_REGISTER_CRYPTO_DRIVER(cn9k_cryptodev_drv, cn9k_cryptodev_pmd.driver,
+			       cn9k_cryptodev_driver_id);
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev.h b/drivers/crypto/cnxk/cn9k_cryptodev.h
new file mode 100644
index 0000000..f6e7965
--- /dev/null
+++ b/drivers/crypto/cnxk/cn9k_cryptodev.h
@@ -0,0 +1,13 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#ifndef _CN9K_CRYPTODEV_H_
+#define _CN9K_CRYPTODEV_H_
+
+/* Marvell OCTEON CN9K Crypto PMD device name */
+#define CRYPTODEV_NAME_CN9K_PMD crypto_cn9k
+
+extern uint8_t cn9k_cryptodev_driver_id;
+
+#endif /* _CN9K_CRYPTODEV_H_ */
diff --git a/drivers/crypto/cnxk/meson.build b/drivers/crypto/cnxk/meson.build
new file mode 100644
index 0000000..197b94c
--- /dev/null
+++ b/drivers/crypto/cnxk/meson.build
@@ -0,0 +1,16 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2021 Marvell.
+#
+
+if not is_linux or not dpdk_conf.get('RTE_ARCH_64')
+	build = false
+	reason = 'only supported on 64-bit Linux'
+	subdir_done()
+endif
+
+sources = files(
+        'cn9k_cryptodev.c',
+        'cn10k_cryptodev.c',
+)
+
+deps += ['bus_pci', 'common_cnxk']
diff --git a/drivers/crypto/cnxk/version.map b/drivers/crypto/cnxk/version.map
new file mode 100644
index 0000000..ee80c51
--- /dev/null
+++ b/drivers/crypto/cnxk/version.map
@@ -0,0 +1,3 @@ 
+INTERNAL {
+	local: *;
+};
diff --git a/drivers/crypto/meson.build b/drivers/crypto/meson.build
index b9fdf93..cb865aa 100644
--- a/drivers/crypto/meson.build
+++ b/drivers/crypto/meson.build
@@ -12,6 +12,7 @@  drivers = [
         'bcmfs',
         'caam_jr',
         'ccp',
+        'cnxk',
         'dpaa_sec',
         'dpaa2_sec',
         'kasumi',