Adding security ctx to the eth device.
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>
Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
M: Anoob Joseph <anoobj@marvell.com>
T: git://dpdk.org/next/dpdk-next-crypto
F: drivers/common/octeontx2/otx2_sec*
+F: drivers/net/octeontx2/otx2_ethdev_sec*
Mellanox mlx4
M: Matan Azrad <matan@mellanox.com>
otx2_flow_utils.c \
otx2_ethdev_irq.c \
otx2_ethdev_ops.c \
+ otx2_ethdev_sec.c \
otx2_ethdev_debug.c \
otx2_ethdev_devargs.c
'otx2_flow_utils.c',
'otx2_ethdev_irq.c',
'otx2_ethdev_ops.c',
+ 'otx2_ethdev_sec.c',
'otx2_ethdev_debug.c',
'otx2_ethdev_devargs.c'
)
-deps += ['bus_pci', 'common_octeontx2', 'mempool_octeontx2']
+deps += ['bus_pci', 'cryptodev', 'security']
+deps += ['common_octeontx2', 'mempool_octeontx2']
cflags += ['-flax-vector-conversions']
#include <rte_mempool.h>
#include "otx2_ethdev.h"
+#include "otx2_ethdev_sec.h"
static inline uint64_t
nix_get_rx_offload_capa(struct otx2_eth_dev *dev)
dev->hwcap |= OTX2_FIXUP_F_LIMIT_CQ_FULL;
}
+ /* Create security ctx */
+ rc = otx2_eth_sec_ctx_create(eth_dev);
+ if (rc)
+ goto free_mac_addrs;
+ dev->tx_offload_capa |= DEV_TX_OFFLOAD_SECURITY;
+ dev->rx_offload_capa |= DEV_RX_OFFLOAD_SECURITY;
+
/* Initialize rte-flow */
rc = otx2_flow_init(dev);
if (rc)
- goto free_mac_addrs;
+ goto sec_ctx_destroy;
otx2_nix_mc_filter_init(dev);
dev->rx_offload_capa, dev->tx_offload_capa);
return 0;
+sec_ctx_destroy:
+ otx2_eth_sec_ctx_destroy(eth_dev);
free_mac_addrs:
rte_free(eth_dev->data->mac_addrs);
unregister_irq:
if (rc)
otx2_err("Failed to cleanup npa lf, rc=%d", rc);
+ /* Destroy security ctx */
+ otx2_eth_sec_ctx_destroy(eth_dev);
+
rte_free(eth_dev->data->mac_addrs);
eth_dev->data->mac_addrs = NULL;
dev->drv_inited = false;
--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2020 Marvell International Ltd.
+ */
+
+#include <rte_ethdev.h>
+#include <rte_malloc.h>
+#include <rte_security.h>
+
+#include "otx2_ethdev_sec.h"
+
+int
+otx2_eth_sec_ctx_create(struct rte_eth_dev *eth_dev)
+{
+ struct rte_security_ctx *ctx;
+
+ ctx = rte_malloc("otx2_eth_sec_ctx",
+ sizeof(struct rte_security_ctx), 0);
+ if (ctx == NULL)
+ return -ENOMEM;
+
+ /* Populate ctx */
+
+ ctx->device = eth_dev;
+ ctx->sess_cnt = 0;
+
+ eth_dev->security_ctx = ctx;
+
+ return 0;
+}
+
+void
+otx2_eth_sec_ctx_destroy(struct rte_eth_dev *eth_dev)
+{
+ rte_free(eth_dev->security_ctx);
+}
--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (C) 2020 Marvell International Ltd.
+ */
+
+#ifndef __OTX2_ETHDEV_SEC_H__
+#define __OTX2_ETHDEV_SEC_H__
+
+#include <rte_ethdev.h>
+
+int otx2_eth_sec_ctx_create(struct rte_eth_dev *eth_dev);
+
+void otx2_eth_sec_ctx_destroy(struct rte_eth_dev *eth_dev);
+
+#endif /* __OTX2_ETHDEV_SEC_H__ */