From patchwork Sat Oct 14 13:27:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aviad Yehezkel X-Patchwork-Id: 30393 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ED5CD1B621; Sat, 14 Oct 2017 15:28:08 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 789FD1B61E for ; Sat, 14 Oct 2017 15:28:07 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from aviadye@dev.mellanox.co.il) with ESMTPS (AES256-SHA encrypted); 14 Oct 2017 15:28:03 +0200 Received: from l-vmw-rdcore-205.mtl.labs.mlnx (l-vmw-rdcore-205.mtl.labs.mlnx [10.7.66.205]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v9EDS3RG026787; Sat, 14 Oct 2017 16:28:03 +0300 From: aviadye@dev.mellanox.co.il To: dev@dpdk.org, sergio.gonzalez.monroy@intel.com, pablo.de.lara.guarch@intel.com, aviadye@mellanox.com Cc: borisp@mellanox.com, akhil.goyal@nxp.com, hemant.agrawal@nxp.com, radu.nicolau@intel.com, declan.doherty@intel.com, aviadye@dev.mellanox.co.il, liranl@mellanox.com, nelio.laranjeiro@6wind.com, thomas@monjalon.net Date: Sat, 14 Oct 2017 16:27:54 +0300 Message-Id: <1507987683-12315-2-git-send-email-aviadye@dev.mellanox.co.il> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507987683-12315-1-git-send-email-aviadye@dev.mellanox.co.il> References: <1507987683-12315-1-git-send-email-aviadye@dev.mellanox.co.il> Subject: [dpdk-dev] [PATCH 02/11] examples/ipsec-secgw: Fixed init of aead crypto devices X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Aviad Yehezkel This was broken since new aead xfrom was introduced Signed-off-by: Aviad Yehezkel Tested-by: Aviad Yehezkel --- 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 {