DPDK patches and discussions
 help / color / mirror / Atom feed
From: Julien Meunier <julien.meunier@nokia.com>
To: Pablo de Lara <pablo.de.lara.guarch@intel.com>,
	Declan Doherty <declan.doherty@intel.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] cryptodev: fix pmd allocation on multi-process
Date: Wed, 7 Aug 2019 11:39:23 +0300	[thread overview]
Message-ID: <20190807083924.39191-1-julien.meunier@nokia.com> (raw)

Primary process is responsible to initialize the data struct of each
crypto devices.

Secondary process should not override this data during the
initialization.

Fixes: d11b0f30df88 ("cryptodev: introduce API and framework for crypto devices")
Cc: stable@dpdk.org

Signed-off-by: Julien Meunier <julien.meunier@nokia.com>
---
 lib/librte_cryptodev/rte_cryptodev.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 43bc335..b16ef7b 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -725,12 +725,14 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id)
 
 		cryptodev->data = *cryptodev_data;
 
-		strlcpy(cryptodev->data->name, name,
-			RTE_CRYPTODEV_NAME_MAX_LEN);
+		if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+			strlcpy(cryptodev->data->name, name,
+				RTE_CRYPTODEV_NAME_MAX_LEN);
 
-		cryptodev->data->dev_id = dev_id;
-		cryptodev->data->socket_id = socket_id;
-		cryptodev->data->dev_started = 0;
+			cryptodev->data->dev_id = dev_id;
+			cryptodev->data->socket_id = socket_id;
+			cryptodev->data->dev_started = 0;
+		}
 
 		/* init user callbacks */
 		TAILQ_INIT(&(cryptodev->link_intr_cbs));
-- 
2.10.2


             reply	other threads:[~2019-08-07  8:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07  8:39 Julien Meunier [this message]
2019-09-19 14:54 ` Akhil Goyal
2019-10-03 14:19   ` Akhil Goyal

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=20190807083924.39191-1-julien.meunier@nokia.com \
    --to=julien.meunier@nokia.com \
    --cc=anatoly.burakov@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=pablo.de.lara.guarch@intel.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).