diff mbox series

[v3,5/8] drivers/crypto: support security session get size op

Message ID 20211018213452.2734720-6-gakhil@marvell.com (mailing list archive)
State New
Delegated to: akhil goyal
Headers show
Series crypto/security session framework rework | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Akhil Goyal Oct. 18, 2021, 9:34 p.m. UTC
Added the support for rte_security_op.session_get_size()
in all the PMDs which support rte_security sessions and the
op was not supported.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
---
 drivers/crypto/caam_jr/caam_jr.c            | 6 ++++++
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 7 +++++++
 drivers/crypto/dpaa_sec/dpaa_sec.c          | 8 ++++++++
 drivers/crypto/ipsec_mb/pmd_aesni_mb.c      | 7 +++++++
 drivers/crypto/mvsam/rte_mrvl_pmd_ops.c     | 7 +++++++
 drivers/crypto/qat/qat_sym_pmd.c            | 1 +
 drivers/crypto/qat/qat_sym_session.c        | 6 ++++++
 drivers/crypto/qat/qat_sym_session.h        | 3 +++
 8 files changed, 45 insertions(+)
diff mbox series

Patch

diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 298aab154b..44de978d29 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1948,6 +1948,11 @@  caam_jr_security_session_destroy(void *dev __rte_unused, void *sess)
 	return 0;
 }
 
+static unsigned int
+caam_jr_security_session_get_size(void *device __rte_unused)
+{
+	return sizeof(struct caam_jr_session);
+}
 
 static int
 caam_jr_dev_configure(struct rte_cryptodev *dev,
@@ -2042,6 +2047,7 @@  static struct rte_cryptodev_ops caam_jr_ops = {
 static struct rte_security_ops caam_jr_security_ops = {
 	.session_create = caam_jr_security_session_create,
 	.session_update = NULL,
+	.session_get_size = caam_jr_security_session_get_size,
 	.session_stats_get = NULL,
 	.session_destroy = caam_jr_security_session_destroy,
 	.set_pkt_metadata = NULL,
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 51a896c971..9115dd8e70 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -3428,6 +3428,12 @@  dpaa2_sec_security_session_destroy(void *dev __rte_unused, void *sess)
 	}
 	return 0;
 }
+
+static unsigned int
+dpaa2_sec_security_session_get_size(void *device __rte_unused)
+{
+	return sizeof(dpaa2_sec_session);
+}
 #endif
 static int
 dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev,
@@ -3816,6 +3822,7 @@  dpaa2_sec_capabilities_get(void *device __rte_unused)
 static const struct rte_security_ops dpaa2_sec_security_ops = {
 	.session_create = dpaa2_sec_security_session_create,
 	.session_update = NULL,
+	.session_get_size = dpaa2_sec_security_session_get_size,
 	.session_stats_get = NULL,
 	.session_destroy = dpaa2_sec_security_session_destroy,
 	.set_pkt_metadata = NULL,
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 2857b19015..e38ba21e89 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -3148,6 +3148,13 @@  dpaa_sec_security_session_destroy(void *dev __rte_unused, void *sess)
 		free_session_memory((struct rte_cryptodev *)dev, s);
 	return 0;
 }
+
+static unsigned int
+dpaa_sec_security_session_get_size(void *device __rte_unused)
+{
+	return sizeof(dpaa_sec_session);
+}
+
 #endif
 static int
 dpaa_sec_dev_configure(struct rte_cryptodev *dev __rte_unused,
@@ -3406,6 +3413,7 @@  dpaa_sec_capabilities_get(void *device __rte_unused)
 static const struct rte_security_ops dpaa_sec_security_ops = {
 	.session_create = dpaa_sec_security_session_create,
 	.session_update = NULL,
+	.session_get_size = dpaa_sec_security_session_get_size,
 	.session_stats_get = NULL,
 	.session_destroy = dpaa_sec_security_session_destroy,
 	.set_pkt_metadata = NULL,
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index 85397ba7c4..a7b65e565c 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1925,6 +1925,12 @@  aesni_mb_pmd_sec_sess_destroy(void *dev __rte_unused, void *sess_priv)
 	return 0;
 }
 
+static unsigned int
+aesni_mb_pmd_sec_sess_get_size(void *device __rte_unused)
+{
+	return sizeof(struct aesni_mb_session);
+}
+
 /** Get security capabilities for aesni multi-buffer */
 static const struct rte_security_capability *
 aesni_mb_pmd_sec_capa_get(void *device __rte_unused)
@@ -1935,6 +1941,7 @@  aesni_mb_pmd_sec_capa_get(void *device __rte_unused)
 static struct rte_security_ops aesni_mb_pmd_sec_ops = {
 		.session_create = aesni_mb_pmd_sec_sess_create,
 		.session_update = NULL,
+		.session_get_size = aesni_mb_pmd_sec_sess_get_size,
 		.session_stats_get = NULL,
 		.session_destroy = aesni_mb_pmd_sec_sess_destroy,
 		.set_pkt_metadata = NULL,
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
index e04a2c88c7..6ca1bb8b40 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
@@ -932,6 +932,12 @@  mrvl_crypto_pmd_security_session_destroy(void *dev __rte_unused, void *sess)
 	return 0;
 }
 
+static unsigned int
+mrvl_crypto_pmd_security_session_create(void *device __rte_unused)
+{
+	return sizeof(struct mrvl_crypto_session);
+}
+
 static const
 struct rte_security_capability mrvl_crypto_pmd_sec_security_cap[] = {
 	{ /* IPsec Lookaside Protocol offload ESP Tunnel Egress */
@@ -996,6 +1002,7 @@  mrvl_crypto_pmd_security_capabilities_get(void *device __rte_unused)
 struct rte_security_ops mrvl_sec_security_pmd_ops = {
 	.session_create = mrvl_crypto_pmd_security_session_create,
 	.session_update = NULL,
+	.session_get_size = mrvl_crypto_pmd_security_session_get_size,
 	.session_stats_get = NULL,
 	.session_destroy = mrvl_crypto_pmd_security_session_destroy,
 	.set_pkt_metadata = NULL,
diff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c
index d4f087733f..04e97b584a 100644
--- a/drivers/crypto/qat/qat_sym_pmd.c
+++ b/drivers/crypto/qat/qat_sym_pmd.c
@@ -306,6 +306,7 @@  static struct rte_security_ops security_qat_ops = {
 
 		.session_create = qat_security_session_create,
 		.session_update = NULL,
+		.session_get_size = qat_security_session_get_size,
 		.session_stats_get = NULL,
 		.session_destroy = qat_security_session_destroy,
 		.set_pkt_metadata = NULL,
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 2c0e44dff4..cfa7d59914 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -2316,4 +2316,10 @@  qat_security_session_destroy(void *dev __rte_unused, void *sess_priv)
 	}
 	return 0;
 }
+
+unsigned int
+qat_security_session_get_size(void *device __rte_unused)
+{
+	return sizeof(struct qat_sym_session);
+}
 #endif
diff --git a/drivers/crypto/qat/qat_sym_session.h b/drivers/crypto/qat/qat_sym_session.h
index b93dc549ef..ea329c1f71 100644
--- a/drivers/crypto/qat/qat_sym_session.h
+++ b/drivers/crypto/qat/qat_sym_session.h
@@ -169,6 +169,9 @@  qat_security_session_create(void *dev, struct rte_security_session_conf *conf,
 		void *sess, rte_iova_t sess_iova);
 int
 qat_security_session_destroy(void *dev, void *sess);
+unsigned int
+qat_security_session_get_size(void *device __rte_unused);
+
 #endif
 
 #endif /* _QAT_SYM_SESSION_H_ */