From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id E40B158FA; Tue, 23 Apr 2019 14:30:12 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 7AE541A0037; Tue, 23 Apr 2019 14:30:12 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 5538D1A0153; Tue, 23 Apr 2019 14:30:09 +0200 (CEST) Received: from GDB1.ap.freescale.net (GDB1.ap.freescale.net [10.232.132.179]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id D26F34032B; Tue, 23 Apr 2019 20:30:02 +0800 (SGT) From: Akhil Goyal To: dev@dpdk.org Cc: radu.nicolau@intel.com, konstantin.ananyev@intel.com, Akhil Goyal , roy.fan.zhang@intel.com, stable@dpdk.org Date: Tue, 23 Apr 2019 17:49:59 +0530 Message-Id: <20190423121959.23751-1-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190422143942.26956-1-akhil.goyal@nxp.com> References: <20190422143942.26956-1-akhil.goyal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2] examples/ipsec-secgw: fix pool usage for security session 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: , X-List-Received-Date: Tue, 23 Apr 2019 12:30:13 -0000 Currently, two separate mempools are being used for creating crypto sessions and its private data. crypto sessions are created and initialized separately, so a separate mempool is passed to each API, but in case of security sessions, where only one API create and initialize the private data as well. So if session mempool is passed to create a security session, the mempool element size is not sufficient enough to hold the private data as well. As a perfect solution, the security session create API should take 2 mempools for header and private data and initiatlize accordingly, but that would mean an API breakage, which will be done in the next release cycle. So introducing this patch as a workaround to resolve this issue. Fixes: 261bbff75e34 ("examples: use separate crypto session mempools") Cc: roy.fan.zhang@intel.com Cc: stable@dpdk.org Signed-off-by: Akhil Goyal --- v2: incorporated Konstantin's comments. examples/ipsec-secgw/ipsec-secgw.c | 5 +++-- examples/ipsec-secgw/ipsec.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 2e203393d..478dd80c2 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1791,7 +1791,7 @@ cryptodevs_init(void) rte_eth_dev_get_sec_ctx(port_id)) { int socket_id = rte_eth_dev_socket_id(port_id); - if (!socket_ctx[socket_id].session_pool) { + if (!socket_ctx[socket_id].session_priv_pool) { char mp_name[RTE_MEMPOOL_NAMESIZE]; struct rte_mempool *sess_mp; @@ -1811,7 +1811,8 @@ cryptodevs_init(void) else printf("Allocated session pool " "on socket %d\n", socket_id); - socket_ctx[socket_id].session_pool = sess_mp; + socket_ctx[socket_id].session_priv_pool = + sess_mp; } } } diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index 4352cb842..7b8533077 100644 --- a/examples/ipsec-secgw/ipsec.c +++ b/examples/ipsec-secgw/ipsec.c @@ -102,7 +102,7 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa) set_ipsec_conf(sa, &(sess_conf.ipsec)); sa->sec_session = rte_security_session_create(ctx, - &sess_conf, ipsec_ctx->session_pool); + &sess_conf, ipsec_ctx->session_priv_pool); if (sa->sec_session == NULL) { RTE_LOG(ERR, IPSEC, "SEC Session init failed: err: %d\n", ret); @@ -117,7 +117,7 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa) int ret = 0; sa->sec_session = rte_security_session_create(ctx, - &sess_conf, ipsec_ctx->session_pool); + &sess_conf, ipsec_ctx->session_priv_pool); if (sa->sec_session == NULL) { RTE_LOG(ERR, IPSEC, "SEC Session init failed: err: %d\n", ret); -- 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 27958A05D3 for ; Tue, 23 Apr 2019 14:30:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E59215F19; Tue, 23 Apr 2019 14:30:13 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id E40B158FA; Tue, 23 Apr 2019 14:30:12 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 7AE541A0037; Tue, 23 Apr 2019 14:30:12 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 5538D1A0153; Tue, 23 Apr 2019 14:30:09 +0200 (CEST) Received: from GDB1.ap.freescale.net (GDB1.ap.freescale.net [10.232.132.179]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id D26F34032B; Tue, 23 Apr 2019 20:30:02 +0800 (SGT) From: Akhil Goyal To: dev@dpdk.org Cc: radu.nicolau@intel.com, konstantin.ananyev@intel.com, Akhil Goyal , roy.fan.zhang@intel.com, stable@dpdk.org Date: Tue, 23 Apr 2019 17:49:59 +0530 Message-Id: <20190423121959.23751-1-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190422143942.26956-1-akhil.goyal@nxp.com> References: <20190422143942.26956-1-akhil.goyal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2] examples/ipsec-secgw: fix pool usage for security session 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190423121959.qRA9fWpt_WqgkIUrYhsXLpYC-kgHWakK4r-12RMSTRo@z> Currently, two separate mempools are being used for creating crypto sessions and its private data. crypto sessions are created and initialized separately, so a separate mempool is passed to each API, but in case of security sessions, where only one API create and initialize the private data as well. So if session mempool is passed to create a security session, the mempool element size is not sufficient enough to hold the private data as well. As a perfect solution, the security session create API should take 2 mempools for header and private data and initiatlize accordingly, but that would mean an API breakage, which will be done in the next release cycle. So introducing this patch as a workaround to resolve this issue. Fixes: 261bbff75e34 ("examples: use separate crypto session mempools") Cc: roy.fan.zhang@intel.com Cc: stable@dpdk.org Signed-off-by: Akhil Goyal --- v2: incorporated Konstantin's comments. examples/ipsec-secgw/ipsec-secgw.c | 5 +++-- examples/ipsec-secgw/ipsec.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 2e203393d..478dd80c2 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1791,7 +1791,7 @@ cryptodevs_init(void) rte_eth_dev_get_sec_ctx(port_id)) { int socket_id = rte_eth_dev_socket_id(port_id); - if (!socket_ctx[socket_id].session_pool) { + if (!socket_ctx[socket_id].session_priv_pool) { char mp_name[RTE_MEMPOOL_NAMESIZE]; struct rte_mempool *sess_mp; @@ -1811,7 +1811,8 @@ cryptodevs_init(void) else printf("Allocated session pool " "on socket %d\n", socket_id); - socket_ctx[socket_id].session_pool = sess_mp; + socket_ctx[socket_id].session_priv_pool = + sess_mp; } } } diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index 4352cb842..7b8533077 100644 --- a/examples/ipsec-secgw/ipsec.c +++ b/examples/ipsec-secgw/ipsec.c @@ -102,7 +102,7 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa) set_ipsec_conf(sa, &(sess_conf.ipsec)); sa->sec_session = rte_security_session_create(ctx, - &sess_conf, ipsec_ctx->session_pool); + &sess_conf, ipsec_ctx->session_priv_pool); if (sa->sec_session == NULL) { RTE_LOG(ERR, IPSEC, "SEC Session init failed: err: %d\n", ret); @@ -117,7 +117,7 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa) int ret = 0; sa->sec_session = rte_security_session_create(ctx, - &sess_conf, ipsec_ctx->session_pool); + &sess_conf, ipsec_ctx->session_priv_pool); if (sa->sec_session == NULL) { RTE_LOG(ERR, IPSEC, "SEC Session init failed: err: %d\n", ret); -- 2.17.1