From: Vamsi Attunuru <vattun...@marvell.com>

This routine returns true if given rte_eth_dev is security offload
capable and belongs to octeontx2.

Signed-off-by: Anoob Joseph <ano...@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejas...@marvell.com>
Signed-off-by: Vamsi Attunuru <vattun...@marvell.com>
---
 MAINTAINERS                                        |  5 ++++
 drivers/common/octeontx2/Makefile                  |  1 +
 drivers/common/octeontx2/meson.build               |  1 +
 drivers/common/octeontx2/otx2_sec_idev.c           | 28 ++++++++++++++++++++++
 drivers/common/octeontx2/otx2_sec_idev.h           | 12 ++++++++++
 .../octeontx2/rte_common_octeontx2_version.map     |  1 +
 6 files changed, 48 insertions(+)
 create mode 100644 drivers/common/octeontx2/otx2_sec_idev.c
 create mode 100644 drivers/common/octeontx2/otx2_sec_idev.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 94bccae..7b1ea56 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -724,6 +724,11 @@ F: drivers/net/octeontx2/
 F: doc/guides/nics/features/octeontx2*.ini
 F: doc/guides/nics/octeontx2.rst
 
+Marvell OCTEON TX2 - security
+M: Anoob Joseph <ano...@marvell.com>
+T: git://dpdk.org/next/dpdk-next-crypto
+F: drivers/common/octeontx2/otx2_sec*
+
 Mellanox mlx4
 M: Matan Azrad <ma...@mellanox.com>
 M: Shahaf Shuler <shah...@mellanox.com>
diff --git a/drivers/common/octeontx2/Makefile 
b/drivers/common/octeontx2/Makefile
index eaff294..efe3da2 100644
--- a/drivers/common/octeontx2/Makefile
+++ b/drivers/common/octeontx2/Makefile
@@ -31,6 +31,7 @@ SRCS-y += otx2_dev.c
 SRCS-y += otx2_irq.c
 SRCS-y += otx2_mbox.c
 SRCS-y += otx2_common.c
+SRCS-y += otx2_sec_idev.c
 
 LDLIBS += -lrte_eal
 LDLIBS += -lrte_ethdev
diff --git a/drivers/common/octeontx2/meson.build 
b/drivers/common/octeontx2/meson.build
index b791457..996ddba 100644
--- a/drivers/common/octeontx2/meson.build
+++ b/drivers/common/octeontx2/meson.build
@@ -6,6 +6,7 @@ sources= files('otx2_dev.c',
                'otx2_irq.c',
                'otx2_mbox.c',
                'otx2_common.c',
+               'otx2_sec_idev.c',
               )
 
 extra_flags = []
diff --git a/drivers/common/octeontx2/otx2_sec_idev.c 
b/drivers/common/octeontx2/otx2_sec_idev.c
new file mode 100644
index 0000000..532abde
--- /dev/null
+++ b/drivers/common/octeontx2/otx2_sec_idev.c
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#include <rte_bus_pci.h>
+#include <rte_ethdev.h>
+
+#include "otx2_common.h"
+#include "otx2_sec_idev.h"
+
+/**
+ * @internal
+ * Check if rte_eth_dev is security offload capable otx2_eth_dev
+ */
+uint8_t
+otx2_eth_dev_is_sec_capable(struct rte_eth_dev *eth_dev)
+{
+       struct rte_pci_device *pci_dev;
+
+       pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+
+       if (pci_dev->id.device_id == PCI_DEVID_OCTEONTX2_RVU_PF ||
+           pci_dev->id.device_id == PCI_DEVID_OCTEONTX2_RVU_VF ||
+           pci_dev->id.device_id == PCI_DEVID_OCTEONTX2_RVU_AF_VF)
+               return 1;
+
+       return 0;
+}
diff --git a/drivers/common/octeontx2/otx2_sec_idev.h 
b/drivers/common/octeontx2/otx2_sec_idev.h
new file mode 100644
index 0000000..a5d929e
--- /dev/null
+++ b/drivers/common/octeontx2/otx2_sec_idev.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell International Ltd.
+ */
+
+#ifndef _OTX2_SEC_IDEV_H_
+#define _OTX2_SEC_IDEV_H_
+
+#include <rte_ethdev.h>
+
+uint8_t otx2_eth_dev_is_sec_capable(struct rte_eth_dev *eth_dev);
+
+#endif /* _OTX2_SEC_IDEV_H_ */
diff --git a/drivers/common/octeontx2/rte_common_octeontx2_version.map 
b/drivers/common/octeontx2/rte_common_octeontx2_version.map
index a51d719..724fa35 100644
--- a/drivers/common/octeontx2/rte_common_octeontx2_version.map
+++ b/drivers/common/octeontx2/rte_common_octeontx2_version.map
@@ -5,6 +5,7 @@ DPDK_20.0 {
        otx2_dev_fini;
        otx2_dev_priv_init;
        otx2_disable_irqs;
+       otx2_eth_dev_is_sec_capable;
        otx2_intra_dev_get_cfg;
        otx2_logtype_base;
        otx2_logtype_dpi;
-- 
2.7.4

Reply via email to