All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Meunier, Julien (Nokia - FR/Paris-Saclay)" <julien.meunier@nokia.com>
To: Akhil Goyal <akhil.goyal@nxp.com>,
	Pablo de Lara <pablo.de.lara.guarch@intel.com>,
	Declan Doherty <declan.doherty@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] cryptodev: fix invalid dev_id after a pmd close
Date: Tue, 15 Oct 2019 14:39:37 +0000	[thread overview]
Message-ID: <8eded01d-bf6d-8a3c-e8cf-d722adfebffa@nokia.com> (raw)
In-Reply-To: <VE1PR04MB66391CF60B6B43C13E5C3A01E6930@VE1PR04MB6639.eurprd04.prod.outlook.com>

Hi

On 15/10/2019 15:44, Akhil Goyal wrote:
> 
>>
>> Hi Julien
>>
>>>
>>> Each cryptodev are indexed with its dev_id in the global
>>> rte_crypto_devices variable. nb_devs is incremented / decremented each
>>> time a cryptodev is created / deleted. The goal of nb_devs is to prevent
>>> the user to get an invalid dev_id.
>>>
>>> Let's imagine DPDK has configured N cryptodevs. If the cryptodev=1 is
>>> removed at runtime, the latest cryptodev N cannot be accessible, because
>>> nb_devs=N-1.
>>>
>>> In order to prevent this kind of behavior, let's remove the check with
>>> nb_devs and iterate in all the rte_crypto_devices elements: if data is
>>> not NULL, that means a valid cryptodev is available.
>>>
>>> Fixes: d11b0f30df88 ("cryptodev: introduce API and framework for crypto
>>> devices")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Julien Meunier <julien.meunier@nokia.com>
>>> ---
> // snip//
> 
>>> @@ -560,7 +570,13 @@ rte_cryptodev_get_dev_id(const char *name)
>>>   uint8_t
>>>   rte_cryptodev_count(void)
>>>   {
>>> -	return cryptodev_globals.nb_devs;
>>> +	uint8_t i, dev_count = 0;
>>> +
>>> +	for (i = 0; i < RTE_CRYPTO_MAX_DEVS; i++)
>>> +		if (cryptodev_globals.devs[i].data != NULL)
>>> +			dev_count++;
>>> +
>>> +	return dev_count;
>>>   }
>>
>> Why do you want to remove the nb_devs? We can have it updated
>> (incremented/decremented)
>> While allocate/release of the device.
>> The point is, whenever somebody call rte_cryptodev_count() it will do a lookup
>> of valid data
>> pointer.
> 
> Could you please do the requested change. This patch need to be integrated by this week.
> 
> Thanks.
> 
Sorry, I was busy on other tasks. I will propose a new patch today by 
keeping the nb_devs field.

Regards.

-- 
Julien Meunier

  reply	other threads:[~2019-10-15 14:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07  8:39 [dpdk-dev] [PATCH] cryptodev: fix invalid dev_id after a pmd close Julien Meunier
2019-10-03 12:49 ` Akhil Goyal
2019-10-15 13:44   ` Akhil Goyal
2019-10-15 14:39     ` Meunier, Julien (Nokia - FR/Paris-Saclay) [this message]
2019-10-15 16:50 ` [dpdk-dev] [PATCH v2] cryptodev: fix check related to device id Julien Meunier
2019-10-16  7:02   ` Akhil Goyal
2019-10-16  7:16     ` Meunier, Julien (Nokia - FR/Paris-Saclay)
2019-10-16 10:21 ` [dpdk-dev] [PATCH v3] " Julien Meunier
2019-10-16 12:49   ` 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=8eded01d-bf6d-8a3c-e8cf-d722adfebffa@nokia.com \
    --to=julien.meunier@nokia.com \
    --cc=akhil.goyal@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.