From: Ankur Dwivedi <adwivedi@marvell.com>
To: <stable@dpdk.org>
Cc: Ankur Dwivedi <adwivedi@marvell.com>,
Narayana Prasad Raju Athreya <pathreya@marvell.com>,
Anoob Joseph <anoobj@marvell.com>
Subject: [dpdk-stable] [PATCH 19.11] crypto/octeontx2: fix for multi process
Date: Thu, 22 Oct 2020 11:27:21 +0530 [thread overview]
Message-ID: <20201022055721.3267-1-adwivedi@marvell.com> (raw)
During crypto device probe few functions should be called only
for the primary process. This patch fixes this issue.
Fixes: 818d138bcce9 ("crypto/octeontx2: add init sequence in probe")
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Reviewed-by: Narayana Prasad Raju Athreya <pathreya@marvell.com>
Reviewed-by: Anoob Joseph <anoobj@marvell.com>
---
drivers/crypto/octeontx2/otx2_cryptodev.c | 46 +++++++++++--------
drivers/crypto/octeontx2/otx2_cryptodev.h | 2 +
drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 13 ++++--
3 files changed, 38 insertions(+), 23 deletions(-)
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev.c b/drivers/crypto/octeontx2/otx2_cryptodev.c
index 417eda6de..4626e754e 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev.c
@@ -70,31 +70,34 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
otx2_dev = &vf->otx2_dev;
- /* Initialize the base otx2_dev object */
- ret = otx2_dev_init(pci_dev, otx2_dev);
- if (ret) {
- CPT_LOG_ERR("Could not initialize otx2_dev");
- goto pmd_destroy;
- }
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ /* Initialize the base otx2_dev object */
+ ret = otx2_dev_init(pci_dev, otx2_dev);
+ if (ret) {
+ CPT_LOG_ERR("Could not initialize otx2_dev");
+ goto pmd_destroy;
+ }
- /* Get number of queues available on the device */
- ret = otx2_cpt_available_queues_get(dev, &nb_queues);
- if (ret) {
- CPT_LOG_ERR("Could not determine the number of queues available");
- goto otx2_dev_fini;
- }
+ /* Get number of queues available on the device */
+ ret = otx2_cpt_available_queues_get(dev, &nb_queues);
+ if (ret) {
+ CPT_LOG_ERR("Could not determine the number of queues available");
+ goto otx2_dev_fini;
+ }
- /* Don't exceed the limits set per VF */
- nb_queues = RTE_MIN(nb_queues, OTX2_CPT_MAX_QUEUES_PER_VF);
+ /* Don't exceed the limits set per VF */
+ nb_queues = RTE_MIN(nb_queues, OTX2_CPT_MAX_QUEUES_PER_VF);
- if (nb_queues == 0) {
- CPT_LOG_ERR("No free queues available on the device");
- goto otx2_dev_fini;
- }
+ if (nb_queues == 0) {
+ CPT_LOG_ERR("No free queues available on the device");
+ goto otx2_dev_fini;
+ }
- vf->max_queues = nb_queues;
+ vf->max_queues = nb_queues;
- CPT_LOG_INFO("Max queues supported by device: %d", vf->max_queues);
+ CPT_LOG_INFO("Max queues supported by device: %d",
+ vf->max_queues);
+ }
dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
RTE_CRYPTODEV_FF_HW_ACCELERATED |
@@ -105,6 +108,9 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO |
RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT;
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+ otx2_cpt_set_enqdeq_fns(dev);
+
return 0;
otx2_dev_fini:
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev.h b/drivers/crypto/octeontx2/otx2_cryptodev.h
index c0aa661b3..17c0bee66 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev.h
+++ b/drivers/crypto/octeontx2/otx2_cryptodev.h
@@ -40,4 +40,6 @@ extern int otx2_cpt_logtype;
*/
extern uint8_t otx2_cryptodev_driver_id;
+void otx2_cpt_set_enqdeq_fns(struct rte_cryptodev *dev);
+
#endif /* _OTX2_CRYPTODEV_H_ */
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
index 65101b0d2..b87a16f30 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
@@ -808,6 +808,15 @@ otx2_cpt_dequeue_burst(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops)
return nb_completed;
}
+void
+otx2_cpt_set_enqdeq_fns(struct rte_cryptodev *dev)
+{
+ dev->enqueue_burst = otx2_cpt_enqueue_burst;
+ dev->dequeue_burst = otx2_cpt_dequeue_burst;
+
+ rte_mb();
+}
+
/* PMD ops */
static int
@@ -857,10 +866,8 @@ otx2_cpt_dev_config(struct rte_cryptodev *dev,
goto queues_detach;
}
- dev->enqueue_burst = otx2_cpt_enqueue_burst;
- dev->dequeue_burst = otx2_cpt_dequeue_burst;
+ otx2_cpt_set_enqdeq_fns(dev);
- rte_mb();
return 0;
queues_detach:
--
2.28.0
next reply other threads:[~2020-10-22 5:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-22 5:57 Ankur Dwivedi [this message]
2020-10-27 15:17 ` Luca Boccassi
2020-10-28 6:52 ` [dpdk-stable] [EXT] " Ankur Dwivedi
2020-10-28 9:52 ` Luca Boccassi
2020-11-06 5:21 ` Ankur Dwivedi
2020-11-09 18:53 ` Luca Boccassi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201022055721.3267-1-adwivedi@marvell.com \
--to=adwivedi@marvell.com \
--cc=anoobj@marvell.com \
--cc=pathreya@marvell.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).