* [dpdk-dev] [PATCH v1 0/2] event/octeontx2: fixes for crypto adapter @ 2021-04-15 19:10 Shijith Thotton 2021-04-15 19:10 ` [dpdk-dev] [PATCH v1 1/2] event/octeontx2: fix crypto adapter queue pair ops Shijith Thotton ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Shijith Thotton @ 2021-04-15 19:10 UTC (permalink / raw) To: dev Cc: Shijith Thotton, Jerin Jacob, Akhil Goyal, Anoob Joseph, Ankur Dwivedi, Pavan Nikhilesh Fixes for OCTEON TX2 crypto adapter implementation. Shijith Thotton (2): event/octeontx2: fix crypto adapter queue pair ops event/octeontx2: configure crypto adapter xaq pool drivers/crypto/octeontx2/otx2_cryptodev_qp.h | 4 +- drivers/event/octeontx2/otx2_evdev_adptr.c | 2 +- .../event/octeontx2/otx2_evdev_crypto_adptr.c | 110 +++++++++++++----- 3 files changed, 84 insertions(+), 32 deletions(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v1 1/2] event/octeontx2: fix crypto adapter queue pair ops 2021-04-15 19:10 [dpdk-dev] [PATCH v1 0/2] event/octeontx2: fixes for crypto adapter Shijith Thotton @ 2021-04-15 19:10 ` Shijith Thotton 2021-04-15 19:10 ` [dpdk-dev] [PATCH v1 2/2] event/octeontx2: configure crypto adapter xaq pool Shijith Thotton 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 0/2] event/octeontx2: fixes for crypto adapter Shijith Thotton 2 siblings, 0 replies; 9+ messages in thread From: Shijith Thotton @ 2021-04-15 19:10 UTC (permalink / raw) To: dev Cc: Shijith Thotton, Jerin Jacob, Akhil Goyal, Anoob Joseph, Ankur Dwivedi, Pavan Nikhilesh Parameter queue_pair_id of crypto adapter queue pair add/del operation can be -1 to select all pre configured crypto queue pairs. Added support for the same in driver. Also added a member in cpt qp structure to indicate binding state of a queue pair to an event queue. Fixes: 29768f78d5a7 ("event/octeontx2: add crypto adapter framework") Signed-off-by: Shijith Thotton <sthotton@marvell.com> --- drivers/crypto/octeontx2/otx2_cryptodev_qp.h | 4 +- .../event/octeontx2/otx2_evdev_crypto_adptr.c | 102 ++++++++++++------ 2 files changed, 75 insertions(+), 31 deletions(-) diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_qp.h b/drivers/crypto/octeontx2/otx2_cryptodev_qp.h index 189fa3db4..95bce3621 100644 --- a/drivers/crypto/octeontx2/otx2_cryptodev_qp.h +++ b/drivers/crypto/octeontx2/otx2_cryptodev_qp.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright (C) 2020 Marvell International Ltd. + * Copyright (C) 2020-2021 Marvell. */ #ifndef _OTX2_CRYPTODEV_QP_H_ @@ -39,6 +39,8 @@ struct otx2_cpt_qp { */ uint8_t ca_enable; /**< Set when queue pair is added to crypto adapter */ + uint8_t qp_ev_bind; + /**< Set when queue pair is bound to event queue */ }; #endif /* _OTX2_CRYPTODEV_QP_H_ */ diff --git a/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c b/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c index 4e8a96cb6..3a96b2e34 100644 --- a/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c +++ b/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c @@ -1,10 +1,11 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright (C) 2020 Marvell International Ltd. + * Copyright (C) 2020-2021 Marvell. */ #include <rte_cryptodev.h> #include <rte_eventdev.h> +#include "otx2_cryptodev.h" #include "otx2_cryptodev_hw_access.h" #include "otx2_cryptodev_qp.h" #include "otx2_cryptodev_mbox.h" @@ -23,30 +24,66 @@ otx2_ca_caps_get(const struct rte_eventdev *dev, return 0; } -int -otx2_ca_qp_add(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev, - int32_t queue_pair_id, const struct rte_event *event) +static int +otx2_ca_qp_sso_link(const struct rte_cryptodev *cdev, struct otx2_cpt_qp *qp, + uint16_t sso_pf_func) { - struct otx2_sso_evdev *sso_evdev = sso_pmd_priv(dev); union otx2_cpt_af_lf_ctl2 af_lf_ctl2; - struct otx2_cpt_qp *qp; int ret; - qp = cdev->data->queue_pairs[queue_pair_id]; - - qp->ca_enable = 1; - rte_memcpy(&qp->ev, event, sizeof(struct rte_event)); - ret = otx2_cpt_af_reg_read(cdev, OTX2_CPT_AF_LF_CTL2(qp->id), - qp->blkaddr, &af_lf_ctl2.u); + qp->blkaddr, &af_lf_ctl2.u); if (ret) return ret; - af_lf_ctl2.s.sso_pf_func = otx2_sso_pf_func_get(); + af_lf_ctl2.s.sso_pf_func = sso_pf_func; ret = otx2_cpt_af_reg_write(cdev, OTX2_CPT_AF_LF_CTL2(qp->id), - qp->blkaddr, af_lf_ctl2.u); - if (ret) - return ret; + qp->blkaddr, af_lf_ctl2.u); + return ret; +} + +static void +otx2_ca_qp_init(struct otx2_cpt_qp *qp, const struct rte_event *event) +{ + if (event) { + qp->qp_ev_bind = 1; + rte_memcpy(&qp->ev, event, sizeof(struct rte_event)); + } else { + qp->qp_ev_bind = 0; + } + qp->ca_enable = 1; +} + +int +otx2_ca_qp_add(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev, + int32_t queue_pair_id, const struct rte_event *event) +{ + struct otx2_sso_evdev *sso_evdev = sso_pmd_priv(dev); + struct otx2_cpt_vf *vf = cdev->data->dev_private; + uint16_t sso_pf_func = otx2_sso_pf_func_get(); + struct otx2_cpt_qp *qp; + uint8_t qp_id; + int ret; + + if (queue_pair_id == -1) { + for (qp_id = 0; qp_id < vf->nb_queues; qp_id++) { + qp = cdev->data->queue_pairs[qp_id]; + ret = otx2_ca_qp_sso_link(cdev, qp, sso_pf_func); + if (ret) { + uint8_t qp_tmp; + for (qp_tmp = 0; qp_tmp < qp_id; qp_tmp++) + otx2_ca_qp_del(dev, cdev, qp_tmp); + return ret; + } + otx2_ca_qp_init(qp, event); + } + } else { + qp = cdev->data->queue_pairs[queue_pair_id]; + ret = otx2_ca_qp_sso_link(cdev, qp, sso_pf_func); + if (ret) + return ret; + otx2_ca_qp_init(qp, event); + } sso_evdev->rx_offloads |= NIX_RX_OFFLOAD_SECURITY_F; sso_fastpath_fns_set((struct rte_eventdev *)(uintptr_t)dev); @@ -58,24 +95,29 @@ int otx2_ca_qp_del(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev, int32_t queue_pair_id) { - union otx2_cpt_af_lf_ctl2 af_lf_ctl2; + struct otx2_cpt_vf *vf = cdev->data->dev_private; struct otx2_cpt_qp *qp; + uint8_t qp_id; int ret; RTE_SET_USED(dev); - qp = cdev->data->queue_pairs[queue_pair_id]; - qp->ca_enable = 0; - memset(&qp->ev, 0, sizeof(struct rte_event)); + ret = 0; + if (queue_pair_id == -1) { + for (qp_id = 0; qp_id < vf->nb_queues; qp_id++) { + qp = cdev->data->queue_pairs[qp_id]; + ret = otx2_ca_qp_sso_link(cdev, qp, 0); + if (ret) + return ret; + qp->ca_enable = 0; + } + } else { + qp = cdev->data->queue_pairs[queue_pair_id]; + ret = otx2_ca_qp_sso_link(cdev, qp, 0); + if (ret) + return ret; + qp->ca_enable = 0; + } - ret = otx2_cpt_af_reg_read(cdev, OTX2_CPT_AF_LF_CTL2(qp->id), - qp->blkaddr, &af_lf_ctl2.u); - if (ret) - return ret; - - af_lf_ctl2.s.sso_pf_func = 0; - ret = otx2_cpt_af_reg_write(cdev, OTX2_CPT_AF_LF_CTL2(qp->id), - qp->blkaddr, af_lf_ctl2.u); - - return ret; + return 0; } -- 2.25.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v1 2/2] event/octeontx2: configure crypto adapter xaq pool 2021-04-15 19:10 [dpdk-dev] [PATCH v1 0/2] event/octeontx2: fixes for crypto adapter Shijith Thotton 2021-04-15 19:10 ` [dpdk-dev] [PATCH v1 1/2] event/octeontx2: fix crypto adapter queue pair ops Shijith Thotton @ 2021-04-15 19:10 ` Shijith Thotton 2021-04-26 10:17 ` Pavan Nikhilesh Bhagavatula 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 0/2] event/octeontx2: fixes for crypto adapter Shijith Thotton 2 siblings, 1 reply; 9+ messages in thread From: Shijith Thotton @ 2021-04-15 19:10 UTC (permalink / raw) To: dev Cc: Shijith Thotton, Jerin Jacob, Akhil Goyal, Anoob Joseph, Ankur Dwivedi, Pavan Nikhilesh Configure xaq pool based on number of in-use crypto queues to avoid CPT add work failure due to xaq buffer run out. This patch configures OTX2_CPT_DEFAULT_CMD_QLEN number of xae entries per queue pair. Fixes: 29768f78d5a7 ("event/octeontx2: add crypto adapter framework") Signed-off-by: Shijith Thotton <sthotton@marvell.com> --- drivers/event/octeontx2/otx2_evdev_adptr.c | 2 +- drivers/event/octeontx2/otx2_evdev_crypto_adptr.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/event/octeontx2/otx2_evdev_adptr.c b/drivers/event/octeontx2/otx2_evdev_adptr.c index d69f269df..d85c3665c 100644 --- a/drivers/event/octeontx2/otx2_evdev_adptr.c +++ b/drivers/event/octeontx2/otx2_evdev_adptr.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(C) 2019 Marvell International Ltd. + * Copyright(C) 2019-2021 Marvell. */ #include "otx2_evdev.h" diff --git a/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c b/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c index 3a96b2e34..79a6d5577 100644 --- a/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c +++ b/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c @@ -88,6 +88,14 @@ otx2_ca_qp_add(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev, sso_evdev->rx_offloads |= NIX_RX_OFFLOAD_SECURITY_F; sso_fastpath_fns_set((struct rte_eventdev *)(uintptr_t)dev); + /* Update crypto adapter xae count */ + if (queue_pair_id == -1) + sso_evdev->adptr_xae_cnt = + vf->nb_queues * OTX2_CPT_DEFAULT_CMD_QLEN; + else + sso_evdev->adptr_xae_cnt += OTX2_CPT_DEFAULT_CMD_QLEN; + sso_xae_reconfigure((struct rte_eventdev *)(uintptr_t)dev); + return 0; } -- 2.25.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v1 2/2] event/octeontx2: configure crypto adapter xaq pool 2021-04-15 19:10 ` [dpdk-dev] [PATCH v1 2/2] event/octeontx2: configure crypto adapter xaq pool Shijith Thotton @ 2021-04-26 10:17 ` Pavan Nikhilesh Bhagavatula 0 siblings, 0 replies; 9+ messages in thread From: Pavan Nikhilesh Bhagavatula @ 2021-04-26 10:17 UTC (permalink / raw) To: Shijith Thotton, dev Cc: Shijith Thotton, Jerin Jacob Kollanukkaran, Akhil Goyal, Anoob Joseph, Ankur Dwivedi >-----Original Message----- >From: Shijith Thotton <sthotton@marvell.com> >Sent: Friday, April 16, 2021 12:40 AM >To: dev@dpdk.org >Cc: Shijith Thotton <sthotton@marvell.com>; Jerin Jacob Kollanukkaran ><jerinj@marvell.com>; Akhil Goyal <gakhil@marvell.com>; Anoob >Joseph <anoobj@marvell.com>; Ankur Dwivedi ><adwivedi@marvell.com>; Pavan Nikhilesh Bhagavatula ><pbhagavatula@marvell.com> >Subject: [PATCH v1 2/2] event/octeontx2: configure crypto adapter xaq >pool > >Configure xaq pool based on number of in-use crypto queues to avoid >CPT >add work failure due to xaq buffer run out. This patch configures >OTX2_CPT_DEFAULT_CMD_QLEN number of xae entries per queue >pair. > >Fixes: 29768f78d5a7 ("event/octeontx2: add crypto adapter >framework") > >Signed-off-by: Shijith Thotton <sthotton@marvell.com> >--- > drivers/event/octeontx2/otx2_evdev_adptr.c | 2 +- > drivers/event/octeontx2/otx2_evdev_crypto_adptr.c | 8 ++++++++ > 2 files changed, 9 insertions(+), 1 deletion(-) > >diff --git a/drivers/event/octeontx2/otx2_evdev_adptr.c >b/drivers/event/octeontx2/otx2_evdev_adptr.c >index d69f269df..d85c3665c 100644 >--- a/drivers/event/octeontx2/otx2_evdev_adptr.c >+++ b/drivers/event/octeontx2/otx2_evdev_adptr.c >@@ -1,5 +1,5 @@ > /* SPDX-License-Identifier: BSD-3-Clause >- * Copyright(C) 2019 Marvell International Ltd. >+ * Copyright(C) 2019-2021 Marvell. > */ > > #include "otx2_evdev.h" >diff --git a/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c >b/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c >index 3a96b2e34..79a6d5577 100644 >--- a/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c >+++ b/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c >@@ -88,6 +88,14 @@ otx2_ca_qp_add(const struct rte_eventdev >*dev, const struct rte_cryptodev *cdev, > sso_evdev->rx_offloads |= NIX_RX_OFFLOAD_SECURITY_F; > sso_fastpath_fns_set((struct rte_eventdev *)(uintptr_t)dev); > >+ /* Update crypto adapter xae count */ >+ if (queue_pair_id == -1) >+ sso_evdev->adptr_xae_cnt = >+ vf->nb_queues * >OTX2_CPT_DEFAULT_CMD_QLEN; This should be sso_evdev->adaptr_xae_cnt += (vf->nb_queues * OTX2_CPT_DEFAULT_CMD_QLEN); >+ else >+ sso_evdev->adptr_xae_cnt += >OTX2_CPT_DEFAULT_CMD_QLEN; >+ sso_xae_reconfigure((struct rte_eventdev *)(uintptr_t)dev); >+ > return 0; > } > >-- >2.25.1 With above changes Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com> ^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v2 0/2] event/octeontx2: fixes for crypto adapter 2021-04-15 19:10 [dpdk-dev] [PATCH v1 0/2] event/octeontx2: fixes for crypto adapter Shijith Thotton 2021-04-15 19:10 ` [dpdk-dev] [PATCH v1 1/2] event/octeontx2: fix crypto adapter queue pair ops Shijith Thotton 2021-04-15 19:10 ` [dpdk-dev] [PATCH v1 2/2] event/octeontx2: configure crypto adapter xaq pool Shijith Thotton @ 2021-04-26 12:21 ` Shijith Thotton 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 1/2] event/octeontx2: fix crypto adapter queue pair ops Shijith Thotton ` (2 more replies) 2 siblings, 3 replies; 9+ messages in thread From: Shijith Thotton @ 2021-04-26 12:21 UTC (permalink / raw) To: dev Cc: Shijith Thotton, Jerin Jacob, Anoob Joseph, Ankur Dwivedi, Pavan Nikhilesh Fixes for OCTEON TX2 crypto adapter implementation. v2: - Fixed adapter xae count updation. Shijith Thotton (2): event/octeontx2: fix crypto adapter queue pair ops event/octeontx2: configure crypto adapter xaq pool drivers/crypto/octeontx2/otx2_cryptodev_qp.h | 4 +- drivers/event/octeontx2/otx2_evdev_adptr.c | 2 +- .../event/octeontx2/otx2_evdev_crypto_adptr.c | 110 +++++++++++++----- 3 files changed, 84 insertions(+), 32 deletions(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v2 1/2] event/octeontx2: fix crypto adapter queue pair ops 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 0/2] event/octeontx2: fixes for crypto adapter Shijith Thotton @ 2021-04-26 12:21 ` Shijith Thotton 2021-04-26 14:44 ` Ankur Dwivedi 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 2/2] event/octeontx2: configure crypto adapter xaq pool Shijith Thotton 2021-04-29 8:50 ` [dpdk-dev] [PATCH v2 0/2] event/octeontx2: fixes for crypto adapter Jerin Jacob 2 siblings, 1 reply; 9+ messages in thread From: Shijith Thotton @ 2021-04-26 12:21 UTC (permalink / raw) To: dev Cc: Shijith Thotton, Jerin Jacob, Anoob Joseph, Ankur Dwivedi, Pavan Nikhilesh Parameter queue_pair_id of crypto adapter queue pair add/del operation can be -1 to select all pre configured crypto queue pairs. Added support for the same in driver. Also added a member in cpt qp structure to indicate binding state of a queue pair to an event queue. Fixes: 29768f78d5a7 ("event/octeontx2: add crypto adapter framework") Signed-off-by: Shijith Thotton <sthotton@marvell.com> --- drivers/crypto/octeontx2/otx2_cryptodev_qp.h | 4 +- .../event/octeontx2/otx2_evdev_crypto_adptr.c | 102 ++++++++++++------ 2 files changed, 75 insertions(+), 31 deletions(-) diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_qp.h b/drivers/crypto/octeontx2/otx2_cryptodev_qp.h index 189fa3db4..95bce3621 100644 --- a/drivers/crypto/octeontx2/otx2_cryptodev_qp.h +++ b/drivers/crypto/octeontx2/otx2_cryptodev_qp.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright (C) 2020 Marvell International Ltd. + * Copyright (C) 2020-2021 Marvell. */ #ifndef _OTX2_CRYPTODEV_QP_H_ @@ -39,6 +39,8 @@ struct otx2_cpt_qp { */ uint8_t ca_enable; /**< Set when queue pair is added to crypto adapter */ + uint8_t qp_ev_bind; + /**< Set when queue pair is bound to event queue */ }; #endif /* _OTX2_CRYPTODEV_QP_H_ */ diff --git a/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c b/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c index 2c9b347f0..ed600a659 100644 --- a/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c +++ b/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c @@ -1,10 +1,11 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright (C) 2020 Marvell International Ltd. + * Copyright (C) 2020-2021 Marvell. */ #include <rte_cryptodev.h> #include <rte_eventdev.h> +#include "otx2_cryptodev.h" #include "otx2_cryptodev_hw_access.h" #include "otx2_cryptodev_qp.h" #include "otx2_cryptodev_mbox.h" @@ -24,30 +25,66 @@ otx2_ca_caps_get(const struct rte_eventdev *dev, return 0; } -int -otx2_ca_qp_add(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev, - int32_t queue_pair_id, const struct rte_event *event) +static int +otx2_ca_qp_sso_link(const struct rte_cryptodev *cdev, struct otx2_cpt_qp *qp, + uint16_t sso_pf_func) { - struct otx2_sso_evdev *sso_evdev = sso_pmd_priv(dev); union otx2_cpt_af_lf_ctl2 af_lf_ctl2; - struct otx2_cpt_qp *qp; int ret; - qp = cdev->data->queue_pairs[queue_pair_id]; - - qp->ca_enable = 1; - rte_memcpy(&qp->ev, event, sizeof(struct rte_event)); - ret = otx2_cpt_af_reg_read(cdev, OTX2_CPT_AF_LF_CTL2(qp->id), - qp->blkaddr, &af_lf_ctl2.u); + qp->blkaddr, &af_lf_ctl2.u); if (ret) return ret; - af_lf_ctl2.s.sso_pf_func = otx2_sso_pf_func_get(); + af_lf_ctl2.s.sso_pf_func = sso_pf_func; ret = otx2_cpt_af_reg_write(cdev, OTX2_CPT_AF_LF_CTL2(qp->id), - qp->blkaddr, af_lf_ctl2.u); - if (ret) - return ret; + qp->blkaddr, af_lf_ctl2.u); + return ret; +} + +static void +otx2_ca_qp_init(struct otx2_cpt_qp *qp, const struct rte_event *event) +{ + if (event) { + qp->qp_ev_bind = 1; + rte_memcpy(&qp->ev, event, sizeof(struct rte_event)); + } else { + qp->qp_ev_bind = 0; + } + qp->ca_enable = 1; +} + +int +otx2_ca_qp_add(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev, + int32_t queue_pair_id, const struct rte_event *event) +{ + struct otx2_sso_evdev *sso_evdev = sso_pmd_priv(dev); + struct otx2_cpt_vf *vf = cdev->data->dev_private; + uint16_t sso_pf_func = otx2_sso_pf_func_get(); + struct otx2_cpt_qp *qp; + uint8_t qp_id; + int ret; + + if (queue_pair_id == -1) { + for (qp_id = 0; qp_id < vf->nb_queues; qp_id++) { + qp = cdev->data->queue_pairs[qp_id]; + ret = otx2_ca_qp_sso_link(cdev, qp, sso_pf_func); + if (ret) { + uint8_t qp_tmp; + for (qp_tmp = 0; qp_tmp < qp_id; qp_tmp++) + otx2_ca_qp_del(dev, cdev, qp_tmp); + return ret; + } + otx2_ca_qp_init(qp, event); + } + } else { + qp = cdev->data->queue_pairs[queue_pair_id]; + ret = otx2_ca_qp_sso_link(cdev, qp, sso_pf_func); + if (ret) + return ret; + otx2_ca_qp_init(qp, event); + } sso_evdev->rx_offloads |= NIX_RX_OFFLOAD_SECURITY_F; sso_fastpath_fns_set((struct rte_eventdev *)(uintptr_t)dev); @@ -59,24 +96,29 @@ int otx2_ca_qp_del(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev, int32_t queue_pair_id) { - union otx2_cpt_af_lf_ctl2 af_lf_ctl2; + struct otx2_cpt_vf *vf = cdev->data->dev_private; struct otx2_cpt_qp *qp; + uint8_t qp_id; int ret; RTE_SET_USED(dev); - qp = cdev->data->queue_pairs[queue_pair_id]; - qp->ca_enable = 0; - memset(&qp->ev, 0, sizeof(struct rte_event)); + ret = 0; + if (queue_pair_id == -1) { + for (qp_id = 0; qp_id < vf->nb_queues; qp_id++) { + qp = cdev->data->queue_pairs[qp_id]; + ret = otx2_ca_qp_sso_link(cdev, qp, 0); + if (ret) + return ret; + qp->ca_enable = 0; + } + } else { + qp = cdev->data->queue_pairs[queue_pair_id]; + ret = otx2_ca_qp_sso_link(cdev, qp, 0); + if (ret) + return ret; + qp->ca_enable = 0; + } - ret = otx2_cpt_af_reg_read(cdev, OTX2_CPT_AF_LF_CTL2(qp->id), - qp->blkaddr, &af_lf_ctl2.u); - if (ret) - return ret; - - af_lf_ctl2.s.sso_pf_func = 0; - ret = otx2_cpt_af_reg_write(cdev, OTX2_CPT_AF_LF_CTL2(qp->id), - qp->blkaddr, af_lf_ctl2.u); - - return ret; + return 0; } -- 2.25.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] event/octeontx2: fix crypto adapter queue pair ops 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 1/2] event/octeontx2: fix crypto adapter queue pair ops Shijith Thotton @ 2021-04-26 14:44 ` Ankur Dwivedi 0 siblings, 0 replies; 9+ messages in thread From: Ankur Dwivedi @ 2021-04-26 14:44 UTC (permalink / raw) To: Shijith Thotton, dev Cc: Shijith Thotton, Jerin Jacob Kollanukkaran, Anoob Joseph, Pavan Nikhilesh Bhagavatula >-----Original Message----- >From: Shijith Thotton <sthotton@marvell.com> >Sent: Monday, April 26, 2021 5:51 PM >To: dev@dpdk.org >Cc: Shijith Thotton <sthotton@marvell.com>; Jerin Jacob Kollanukkaran ><jerinj@marvell.com>; Anoob Joseph <anoobj@marvell.com>; Ankur Dwivedi ><adwivedi@marvell.com>; Pavan Nikhilesh Bhagavatula ><pbhagavatula@marvell.com> >Subject: [PATCH v2 1/2] event/octeontx2: fix crypto adapter queue pair ops > >Parameter queue_pair_id of crypto adapter queue pair add/del operation can >be -1 to select all pre configured crypto queue pairs. Added support for the >same in driver. Also added a member in cpt qp structure to indicate binding >state of a queue pair to an event queue. > >Fixes: 29768f78d5a7 ("event/octeontx2: add crypto adapter framework") > >Signed-off-by: Shijith Thotton <sthotton@marvell.com> Acked-by: Ankur Dwivedi <adwivedi@marvell.com> >--- > drivers/crypto/octeontx2/otx2_cryptodev_qp.h | 4 +- > .../event/octeontx2/otx2_evdev_crypto_adptr.c | 102 ++++++++++++------ > 2 files changed, 75 insertions(+), 31 deletions(-) > >diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_qp.h >b/drivers/crypto/octeontx2/otx2_cryptodev_qp.h >index 189fa3db4..95bce3621 100644 >--- a/drivers/crypto/octeontx2/otx2_cryptodev_qp.h >+++ b/drivers/crypto/octeontx2/otx2_cryptodev_qp.h >@@ -1,5 +1,5 @@ > /* SPDX-License-Identifier: BSD-3-Clause >- * Copyright (C) 2020 Marvell International Ltd. >+ * Copyright (C) 2020-2021 Marvell. > */ > > #ifndef _OTX2_CRYPTODEV_QP_H_ >@@ -39,6 +39,8 @@ struct otx2_cpt_qp { > */ > uint8_t ca_enable; > /**< Set when queue pair is added to crypto adapter */ >+ uint8_t qp_ev_bind; >+ /**< Set when queue pair is bound to event queue */ > }; > > #endif /* _OTX2_CRYPTODEV_QP_H_ */ >diff --git a/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c >b/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c >index 2c9b347f0..ed600a659 100644 >--- a/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c >+++ b/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c >@@ -1,10 +1,11 @@ > /* SPDX-License-Identifier: BSD-3-Clause >- * Copyright (C) 2020 Marvell International Ltd. >+ * Copyright (C) 2020-2021 Marvell. > */ > > #include <rte_cryptodev.h> > #include <rte_eventdev.h> > >+#include "otx2_cryptodev.h" > #include "otx2_cryptodev_hw_access.h" > #include "otx2_cryptodev_qp.h" > #include "otx2_cryptodev_mbox.h" >@@ -24,30 +25,66 @@ otx2_ca_caps_get(const struct rte_eventdev *dev, > return 0; > } > >-int >-otx2_ca_qp_add(const struct rte_eventdev *dev, const struct rte_cryptodev >*cdev, >- int32_t queue_pair_id, const struct rte_event *event) >+static int >+otx2_ca_qp_sso_link(const struct rte_cryptodev *cdev, struct otx2_cpt_qp >*qp, >+ uint16_t sso_pf_func) > { >- struct otx2_sso_evdev *sso_evdev = sso_pmd_priv(dev); > union otx2_cpt_af_lf_ctl2 af_lf_ctl2; >- struct otx2_cpt_qp *qp; > int ret; > >- qp = cdev->data->queue_pairs[queue_pair_id]; >- >- qp->ca_enable = 1; >- rte_memcpy(&qp->ev, event, sizeof(struct rte_event)); >- > ret = otx2_cpt_af_reg_read(cdev, OTX2_CPT_AF_LF_CTL2(qp->id), >- qp->blkaddr, &af_lf_ctl2.u); >+ qp->blkaddr, &af_lf_ctl2.u); > if (ret) > return ret; > >- af_lf_ctl2.s.sso_pf_func = otx2_sso_pf_func_get(); >+ af_lf_ctl2.s.sso_pf_func = sso_pf_func; > ret = otx2_cpt_af_reg_write(cdev, OTX2_CPT_AF_LF_CTL2(qp->id), >- qp->blkaddr, af_lf_ctl2.u); >- if (ret) >- return ret; >+ qp->blkaddr, af_lf_ctl2.u); >+ return ret; >+} >+ >+static void >+otx2_ca_qp_init(struct otx2_cpt_qp *qp, const struct rte_event *event) >+{ >+ if (event) { >+ qp->qp_ev_bind = 1; >+ rte_memcpy(&qp->ev, event, sizeof(struct rte_event)); >+ } else { >+ qp->qp_ev_bind = 0; >+ } >+ qp->ca_enable = 1; >+} >+ >+int >+otx2_ca_qp_add(const struct rte_eventdev *dev, const struct rte_cryptodev >*cdev, >+ int32_t queue_pair_id, const struct rte_event *event) { >+ struct otx2_sso_evdev *sso_evdev = sso_pmd_priv(dev); >+ struct otx2_cpt_vf *vf = cdev->data->dev_private; >+ uint16_t sso_pf_func = otx2_sso_pf_func_get(); >+ struct otx2_cpt_qp *qp; >+ uint8_t qp_id; >+ int ret; >+ >+ if (queue_pair_id == -1) { >+ for (qp_id = 0; qp_id < vf->nb_queues; qp_id++) { >+ qp = cdev->data->queue_pairs[qp_id]; >+ ret = otx2_ca_qp_sso_link(cdev, qp, sso_pf_func); >+ if (ret) { >+ uint8_t qp_tmp; >+ for (qp_tmp = 0; qp_tmp < qp_id; qp_tmp++) >+ otx2_ca_qp_del(dev, cdev, qp_tmp); >+ return ret; >+ } >+ otx2_ca_qp_init(qp, event); >+ } >+ } else { >+ qp = cdev->data->queue_pairs[queue_pair_id]; >+ ret = otx2_ca_qp_sso_link(cdev, qp, sso_pf_func); >+ if (ret) >+ return ret; >+ otx2_ca_qp_init(qp, event); >+ } > > sso_evdev->rx_offloads |= NIX_RX_OFFLOAD_SECURITY_F; > sso_fastpath_fns_set((struct rte_eventdev *)(uintptr_t)dev); @@ - >59,24 +96,29 @@ int otx2_ca_qp_del(const struct rte_eventdev *dev, const >struct rte_cryptodev *cdev, > int32_t queue_pair_id) > { >- union otx2_cpt_af_lf_ctl2 af_lf_ctl2; >+ struct otx2_cpt_vf *vf = cdev->data->dev_private; > struct otx2_cpt_qp *qp; >+ uint8_t qp_id; > int ret; > > RTE_SET_USED(dev); > >- qp = cdev->data->queue_pairs[queue_pair_id]; >- qp->ca_enable = 0; >- memset(&qp->ev, 0, sizeof(struct rte_event)); >+ ret = 0; >+ if (queue_pair_id == -1) { >+ for (qp_id = 0; qp_id < vf->nb_queues; qp_id++) { >+ qp = cdev->data->queue_pairs[qp_id]; >+ ret = otx2_ca_qp_sso_link(cdev, qp, 0); >+ if (ret) >+ return ret; >+ qp->ca_enable = 0; >+ } >+ } else { >+ qp = cdev->data->queue_pairs[queue_pair_id]; >+ ret = otx2_ca_qp_sso_link(cdev, qp, 0); >+ if (ret) >+ return ret; >+ qp->ca_enable = 0; >+ } > >- ret = otx2_cpt_af_reg_read(cdev, OTX2_CPT_AF_LF_CTL2(qp->id), >- qp->blkaddr, &af_lf_ctl2.u); >- if (ret) >- return ret; >- >- af_lf_ctl2.s.sso_pf_func = 0; >- ret = otx2_cpt_af_reg_write(cdev, OTX2_CPT_AF_LF_CTL2(qp->id), >- qp->blkaddr, af_lf_ctl2.u); >- >- return ret; >+ return 0; > } >-- >2.25.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] event/octeontx2: configure crypto adapter xaq pool 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 0/2] event/octeontx2: fixes for crypto adapter Shijith Thotton 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 1/2] event/octeontx2: fix crypto adapter queue pair ops Shijith Thotton @ 2021-04-26 12:21 ` Shijith Thotton 2021-04-29 8:50 ` [dpdk-dev] [PATCH v2 0/2] event/octeontx2: fixes for crypto adapter Jerin Jacob 2 siblings, 0 replies; 9+ messages in thread From: Shijith Thotton @ 2021-04-26 12:21 UTC (permalink / raw) To: dev Cc: Shijith Thotton, Jerin Jacob, Anoob Joseph, Ankur Dwivedi, Pavan Nikhilesh Configure xaq pool based on number of in-use crypto queues to avoid CPT add work failure due to xaq buffer run out. This patch configures OTX2_CPT_DEFAULT_CMD_QLEN number of xae entries per queue pair. Fixes: 29768f78d5a7 ("event/octeontx2: add crypto adapter framework") Signed-off-by: Shijith Thotton <sthotton@marvell.com> Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com> --- drivers/event/octeontx2/otx2_evdev_adptr.c | 2 +- drivers/event/octeontx2/otx2_evdev_crypto_adptr.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/event/octeontx2/otx2_evdev_adptr.c b/drivers/event/octeontx2/otx2_evdev_adptr.c index d69f269df..d85c3665c 100644 --- a/drivers/event/octeontx2/otx2_evdev_adptr.c +++ b/drivers/event/octeontx2/otx2_evdev_adptr.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(C) 2019 Marvell International Ltd. + * Copyright(C) 2019-2021 Marvell. */ #include "otx2_evdev.h" diff --git a/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c b/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c index ed600a659..d9a002625 100644 --- a/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c +++ b/drivers/event/octeontx2/otx2_evdev_crypto_adptr.c @@ -89,6 +89,14 @@ otx2_ca_qp_add(const struct rte_eventdev *dev, const struct rte_cryptodev *cdev, sso_evdev->rx_offloads |= NIX_RX_OFFLOAD_SECURITY_F; sso_fastpath_fns_set((struct rte_eventdev *)(uintptr_t)dev); + /* Update crypto adapter xae count */ + if (queue_pair_id == -1) + sso_evdev->adptr_xae_cnt += + vf->nb_queues * OTX2_CPT_DEFAULT_CMD_QLEN; + else + sso_evdev->adptr_xae_cnt += OTX2_CPT_DEFAULT_CMD_QLEN; + sso_xae_reconfigure((struct rte_eventdev *)(uintptr_t)dev); + return 0; } -- 2.25.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/2] event/octeontx2: fixes for crypto adapter 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 0/2] event/octeontx2: fixes for crypto adapter Shijith Thotton 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 1/2] event/octeontx2: fix crypto adapter queue pair ops Shijith Thotton 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 2/2] event/octeontx2: configure crypto adapter xaq pool Shijith Thotton @ 2021-04-29 8:50 ` Jerin Jacob 2 siblings, 0 replies; 9+ messages in thread From: Jerin Jacob @ 2021-04-29 8:50 UTC (permalink / raw) To: Shijith Thotton Cc: dpdk-dev, Jerin Jacob, Anoob Joseph, Ankur Dwivedi, Pavan Nikhilesh On Mon, Apr 26, 2021 at 5:51 PM Shijith Thotton <sthotton@marvell.com> wrote: > > Fixes for OCTEON TX2 crypto adapter implementation. > > v2: > - Fixed adapter xae count updation. Series applied to dpdk-next-net-eventdev/for-main. Thanks > > Shijith Thotton (2): > event/octeontx2: fix crypto adapter queue pair ops > event/octeontx2: configure crypto adapter xaq pool > > drivers/crypto/octeontx2/otx2_cryptodev_qp.h | 4 +- > drivers/event/octeontx2/otx2_evdev_adptr.c | 2 +- > .../event/octeontx2/otx2_evdev_crypto_adptr.c | 110 +++++++++++++----- > 3 files changed, 84 insertions(+), 32 deletions(-) > > -- > 2.25.1 > ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-04-29 8:50 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-04-15 19:10 [dpdk-dev] [PATCH v1 0/2] event/octeontx2: fixes for crypto adapter Shijith Thotton 2021-04-15 19:10 ` [dpdk-dev] [PATCH v1 1/2] event/octeontx2: fix crypto adapter queue pair ops Shijith Thotton 2021-04-15 19:10 ` [dpdk-dev] [PATCH v1 2/2] event/octeontx2: configure crypto adapter xaq pool Shijith Thotton 2021-04-26 10:17 ` Pavan Nikhilesh Bhagavatula 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 0/2] event/octeontx2: fixes for crypto adapter Shijith Thotton 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 1/2] event/octeontx2: fix crypto adapter queue pair ops Shijith Thotton 2021-04-26 14:44 ` Ankur Dwivedi 2021-04-26 12:21 ` [dpdk-dev] [PATCH v2 2/2] event/octeontx2: configure crypto adapter xaq pool Shijith Thotton 2021-04-29 8:50 ` [dpdk-dev] [PATCH v2 0/2] event/octeontx2: fixes for crypto adapter Jerin Jacob
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).