From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 2A1501B5CF; Thu, 25 Apr 2019 19:42:42 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D2DB30894F9; Thu, 25 Apr 2019 17:42:41 +0000 (UTC) Received: from [10.36.116.255] (unknown [10.36.116.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7085060BE5; Thu, 25 Apr 2019 17:42:39 +0000 (UTC) From: Kevin Traynor To: Akhil Goyal , "dev@dpdk.org" Cc: Hemant Agrawal , "stable@dpdk.org" References: <20190327114407.13697-1-akhil.goyal@nxp.com> <20190327114407.13697-6-akhil.goyal@nxp.com> Message-ID: Date: Thu, 25 Apr 2019 18:42:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 25 Apr 2019 17:42:41 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH 5/6] crypto/dpaa_sec: fix session qp attach/detach 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: Thu, 25 Apr 2019 17:42:42 -0000 On 25/04/2019 17:24, Kevin Traynor wrote: > On 27/03/2019 11:53, Akhil Goyal wrote: >> session inq and qp are assigned for each core from which the >> packets arrive. This was not correctly handled while supporting >> multiple sessions per queue pair. >> This patch fixes the attach and detach of queues for each core. >> >> Fixes: e79416d10fa3 ("crypto/dpaa_sec: support multiple sessions per queue pair") >> Cc: stable@dpdk.org > > Hi, this will not backport to 18.11 branch as: > 4e694fe51171dcdbe94019189a0240833b45c943 > Author: Akhil Goyal > Date: Wed Jan 9 15:14:17 2019 +0000 > > crypto/dpaa_sec: support same session flows on multi-cores > > was added after 18.11 and dpaa_sec_sym_session_clear() is quite > different. Please send a backport of the bugfix for 18.11 branch, or let > me know if it's not needed. > > thanks, > Kevin. > >> Signed-off-by: Akhil Goyal >> --- >> drivers/crypto/dpaa_sec/dpaa_sec.c | 17 ++++++++++------- >> 1 file changed, 10 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c >> index cb99be4e1..8305f19a3 100644 >> --- a/drivers/crypto/dpaa_sec/dpaa_sec.c >> +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c >> @@ -1,7 +1,7 @@ >> /* SPDX-License-Identifier: BSD-3-Clause >> * >> * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. >> - * Copyright 2017-2018 NXP >> + * Copyright 2017-2019 NXP >> * >> */ >> >> @@ -1940,13 +1940,13 @@ dpaa_sec_attach_rxq(struct dpaa_sec_dev_private *qi) >> { >> unsigned int i; >> >> - for (i = 0; i < qi->max_nb_sessions; i++) { >> + for (i = 0; i < qi->max_nb_sessions * MAX_DPAA_CORES; i++) { >> if (qi->inq_attach[i] == 0) { Btw, without knowing the crypto code, the use of max_nb_sessions in for loops with fixed size arrays being indexed looks suspect to me. In the snippet above unsigned char inq_attach[RTE_DPAA_MAX_RX_QUEUE]; which means inq_attach[4096] At least in one place I can see .max_nb_sessions = MRVL_PMD_DEFAULT_MAX_NB_SESSIONS which makes max_nb_sessions=2048, while MAX_DPAA_CORES=4 >> qi->inq_attach[i] = 1; >> return &qi->inq[i]; >> } >> } >> - DPAA_SEC_WARN("All ses session in use %x", qi->max_nb_sessions); >> + DPAA_SEC_WARN("All session in use %u", qi->max_nb_sessions); >> >> return NULL; >> } >> @@ -2115,7 +2115,7 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev, >> struct rte_cryptodev_sym_session *sess) >> { >> struct dpaa_sec_dev_private *qi = dev->data->dev_private; >> - uint8_t index = dev->driver_id; >> + uint8_t index = dev->driver_id, i; >> void *sess_priv = get_sym_session_private_data(sess, index); >> >> PMD_INIT_FUNC_TRACE(); >> @@ -2125,9 +2125,12 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev, >> if (sess_priv) { >> struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv); >> >> - if (s->inq[rte_lcore_id() % MAX_DPAA_CORES]) >> - dpaa_sec_detach_rxq(qi, >> - s->inq[rte_lcore_id() % MAX_DPAA_CORES]); >> + for (i = 0; i < MAX_DPAA_CORES; i++) { >> + if (s->inq[i]) >> + dpaa_sec_detach_rxq(qi, s->inq[i]); >> + s->inq[i] = NULL; >> + s->qp[i] = NULL; >> + } >> rte_free(s->cipher_key.data); >> rte_free(s->auth_key.data); >> memset(s, 0, sizeof(dpaa_sec_session)); >> > 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 6FB3CA05D3 for ; Thu, 25 Apr 2019 19:42:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4D7011B5D1; Thu, 25 Apr 2019 19:42:43 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 2A1501B5CF; Thu, 25 Apr 2019 19:42:42 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D2DB30894F9; Thu, 25 Apr 2019 17:42:41 +0000 (UTC) Received: from [10.36.116.255] (unknown [10.36.116.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7085060BE5; Thu, 25 Apr 2019 17:42:39 +0000 (UTC) From: Kevin Traynor To: Akhil Goyal , "dev@dpdk.org" Cc: Hemant Agrawal , "stable@dpdk.org" References: <20190327114407.13697-1-akhil.goyal@nxp.com> <20190327114407.13697-6-akhil.goyal@nxp.com> Message-ID: Date: Thu, 25 Apr 2019 18:42:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 25 Apr 2019 17:42:41 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH 5/6] crypto/dpaa_sec: fix session qp attach/detach 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" Message-ID: <20190425174238.KsS84zCKN3tsLHKeaAzUjn-bc7tIy15fRftf1_uHLV4@z> On 25/04/2019 17:24, Kevin Traynor wrote: > On 27/03/2019 11:53, Akhil Goyal wrote: >> session inq and qp are assigned for each core from which the >> packets arrive. This was not correctly handled while supporting >> multiple sessions per queue pair. >> This patch fixes the attach and detach of queues for each core. >> >> Fixes: e79416d10fa3 ("crypto/dpaa_sec: support multiple sessions per queue pair") >> Cc: stable@dpdk.org > > Hi, this will not backport to 18.11 branch as: > 4e694fe51171dcdbe94019189a0240833b45c943 > Author: Akhil Goyal > Date: Wed Jan 9 15:14:17 2019 +0000 > > crypto/dpaa_sec: support same session flows on multi-cores > > was added after 18.11 and dpaa_sec_sym_session_clear() is quite > different. Please send a backport of the bugfix for 18.11 branch, or let > me know if it's not needed. > > thanks, > Kevin. > >> Signed-off-by: Akhil Goyal >> --- >> drivers/crypto/dpaa_sec/dpaa_sec.c | 17 ++++++++++------- >> 1 file changed, 10 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c >> index cb99be4e1..8305f19a3 100644 >> --- a/drivers/crypto/dpaa_sec/dpaa_sec.c >> +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c >> @@ -1,7 +1,7 @@ >> /* SPDX-License-Identifier: BSD-3-Clause >> * >> * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. >> - * Copyright 2017-2018 NXP >> + * Copyright 2017-2019 NXP >> * >> */ >> >> @@ -1940,13 +1940,13 @@ dpaa_sec_attach_rxq(struct dpaa_sec_dev_private *qi) >> { >> unsigned int i; >> >> - for (i = 0; i < qi->max_nb_sessions; i++) { >> + for (i = 0; i < qi->max_nb_sessions * MAX_DPAA_CORES; i++) { >> if (qi->inq_attach[i] == 0) { Btw, without knowing the crypto code, the use of max_nb_sessions in for loops with fixed size arrays being indexed looks suspect to me. In the snippet above unsigned char inq_attach[RTE_DPAA_MAX_RX_QUEUE]; which means inq_attach[4096] At least in one place I can see .max_nb_sessions = MRVL_PMD_DEFAULT_MAX_NB_SESSIONS which makes max_nb_sessions=2048, while MAX_DPAA_CORES=4 >> qi->inq_attach[i] = 1; >> return &qi->inq[i]; >> } >> } >> - DPAA_SEC_WARN("All ses session in use %x", qi->max_nb_sessions); >> + DPAA_SEC_WARN("All session in use %u", qi->max_nb_sessions); >> >> return NULL; >> } >> @@ -2115,7 +2115,7 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev, >> struct rte_cryptodev_sym_session *sess) >> { >> struct dpaa_sec_dev_private *qi = dev->data->dev_private; >> - uint8_t index = dev->driver_id; >> + uint8_t index = dev->driver_id, i; >> void *sess_priv = get_sym_session_private_data(sess, index); >> >> PMD_INIT_FUNC_TRACE(); >> @@ -2125,9 +2125,12 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev, >> if (sess_priv) { >> struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv); >> >> - if (s->inq[rte_lcore_id() % MAX_DPAA_CORES]) >> - dpaa_sec_detach_rxq(qi, >> - s->inq[rte_lcore_id() % MAX_DPAA_CORES]); >> + for (i = 0; i < MAX_DPAA_CORES; i++) { >> + if (s->inq[i]) >> + dpaa_sec_detach_rxq(qi, s->inq[i]); >> + s->inq[i] = NULL; >> + s->qp[i] = NULL; >> + } >> rte_free(s->cipher_key.data); >> rte_free(s->auth_key.data); >> memset(s, 0, sizeof(dpaa_sec_session)); >> >