Thread (70 messages) 70 messages, 8 authors, 2019-03-28

Re: [PATCH 02/11] examples/ipsec-secgw: Fixed init of aead crypto devices

From: Aviad Yehezkel <hidden>
Date: 2017-10-15 12:54:10


On 10/14/2017 4:27 PM, aviadye@dev.mellanox.co.il wrote:
quoted hunk ↗ jump to hunk
From: Aviad Yehezkel <redacted>

This was broken since new aead xfrom was introduced

Signed-off-by: Aviad Yehezkel <redacted>
---
  examples/ipsec-secgw/ipsec-secgw.c | 29 +++++++++++++++++++----------
  examples/ipsec-secgw/ipsec.h       |  1 +
  2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 99dc270..7bf692c 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1113,7 +1113,8 @@ add_mapping(struct rte_hash *map, const char *str, uint16_t cdev_id,
  		uint16_t qp, struct lcore_params *params,
  		struct ipsec_ctx *ipsec_ctx,
  		const struct rte_cryptodev_capabilities *cipher,
-		const struct rte_cryptodev_capabilities *auth)
+		const struct rte_cryptodev_capabilities *auth,
+		const struct rte_cryptodev_capabilities *aead)
  {
  	int32_t ret = 0;
  	unsigned long i;
@@ -1124,6 +1125,8 @@ add_mapping(struct rte_hash *map, const char *str, uint16_t cdev_id,
  		key.cipher_algo = cipher->sym.cipher.algo;
  	if (auth)
  		key.auth_algo = auth->sym.auth.algo;
+	if (aead)
+		key.aead_algo = aead->sym.aead.algo;
  
  	ret = rte_hash_lookup(map, &key);
  	if (ret != -ENOENT)
@@ -1192,19 +1195,25 @@ add_cdev_mapping(struct rte_cryptodev_info *dev_info, uint16_t cdev_id,
  		if (i->op != RTE_CRYPTO_OP_TYPE_SYMMETRIC)
  			continue;
  
-		if (i->sym.xform_type != RTE_CRYPTO_SYM_XFORM_CIPHER)
+		if (i->sym.xform_type == RTE_CRYPTO_SYM_XFORM_AEAD) {
+			ret |= add_mapping(map, str, cdev_id, qp, params,
+					ipsec_ctx, NULL, NULL, i);
  			continue;
+		}
  
-		for (j = dev_info->capabilities;
-				j->op != RTE_CRYPTO_OP_TYPE_UNDEFINED; j++) {
-			if (j->op != RTE_CRYPTO_OP_TYPE_SYMMETRIC)
-				continue;
+		if (i->sym.xform_type == RTE_CRYPTO_SYM_XFORM_CIPHER) {
+			for (j = dev_info->capabilities;
+					j->op != RTE_CRYPTO_OP_TYPE_UNDEFINED; j++) {
+				if (j->op != RTE_CRYPTO_OP_TYPE_SYMMETRIC)
+					continue;
  
-			if (j->sym.xform_type != RTE_CRYPTO_SYM_XFORM_AUTH)
-				continue;
+				if (j->sym.xform_type != RTE_CRYPTO_SYM_XFORM_AUTH)
+					continue;
  
-			ret |= add_mapping(map, str, cdev_id, qp, params,
-					ipsec_ctx, i, j);
+				ret |= add_mapping(map, str, cdev_id, qp, params,
+						ipsec_ctx, i, j, NULL);
+			}
+			continue;
  		}
  	}
  
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index da1fb1b..7d057ae 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -150,6 +150,7 @@ struct cdev_key {
  	uint16_t lcore_id;
  	uint8_t cipher_algo;
  	uint8_t auth_algo;
+	uint8_t aead_algo;
  };
  
  struct socket_ctx {
Tested-by: Aviad Yehezkel <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help