patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yongseok Koh <yskoh@mellanox.com>
To: "Pattan, Reshma" <reshma.pattan@intel.com>
Cc: "stable@dpdk.org" <stable@dpdk.org>,
	"Zhang, Pan1" <pan1.zhang@intel.com>
Subject: Re: [dpdk-stable] [ PATCH 17.11 1/2] ethdev: clear ethdev data upon	detach
Date: Tue, 12 Mar 2019 21:53:44 +0000	[thread overview]
Message-ID: <E8C45197-178A-4165-80CE-76DDE87D34AB@mellanox.com> (raw)
In-Reply-To: <3AEA2BF9852C6F48A459DA490692831F2A429CBA@irsmsx110.ger.corp.intel.com>


> On Mar 12, 2019, at 2:31 AM, Pattan, Reshma <reshma.pattan@intel.com> wrote:
> 
> Hi,
> 
>> -----Original Message-----
>> From: Yongseok Koh [mailto:yskoh@mellanox.com]
>> Sent: Monday, March 4, 2019 7:57 PM
>> To: Pattan, Reshma <reshma.pattan@intel.com>
>> Cc: stable@dpdk.org
>> Subject: Re: [dpdk-stable] [ PATCH 17.11 1/2] ethdev: clear ethdev data upon
>> detach
>> 
>> 
>>> On Mar 1, 2019, at 3:53 AM, Reshma Pattan <reshma.pattan@intel.com>
>> wrote:
>>> 
>>> When port is detached its relevant rte_eth_dev_data[port_id] has to be
>>> zeroed, otherwise the next port creations could get wrong port_id.
>>> 
>>> Fixes: 92d94d3744 ("ethdev: attach or detach port")
>>> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
>>> ---
>>> lib/librte_ether/rte_ethdev.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>> 
>>> diff --git a/lib/librte_ether/rte_ethdev.c
>>> b/lib/librte_ether/rte_ethdev.c index 096b35faf..7ba9bc564 100644
>>> --- a/lib/librte_ether/rte_ethdev.c
>>> +++ b/lib/librte_ether/rte_ethdev.c
>>> @@ -443,6 +443,7 @@ rte_eth_dev_detach(uint16_t port_id, char *name)
>>> 		goto err;
>>> 
>>> 	rte_eth_devices[port_id].state = RTE_ETH_DEV_UNUSED;
>>> +	memset(&rte_eth_dev_data[port_id], 0, sizeof(struct
>>> +rte_eth_dev_data));
>> 
>> Hi,
>> 
>> I believe such code is good to have. Before I merge it, I have a question.
>> I wonder what the problem of the current code is.
>> If the state turns into RTE_ETH_DEV_UNUSED, then will the eth_dev be re-
>> initialized next time anyway?
>> 
>> 
> 
> Yes to reuse the UNUSED port next time , its relevant rte_eth_dev_data[] also has to be 0 (which is missing in current code), because attach operation not only checks for UNUSED but also for its relevant data to be  0.
> If state UNUSED, but data still not 0, the attach operation will assume port is under use, so it will assign the next new available port id  which is wrong. So we are now fixing this by zeroing dev data upon detach operation.

applied to stable/17.11

Thanks,
Yongseok

      reply	other threads:[~2019-03-12 21:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 11:53 Reshma Pattan
2019-03-01 11:53 ` [dpdk-stable] [ PATCH 17.11 2/2] app/pdump: remove created vdevs Reshma Pattan
2019-03-04 19:57 ` [dpdk-stable] [ PATCH 17.11 1/2] ethdev: clear ethdev data upon detach Yongseok Koh
2019-03-12  9:31   ` Pattan, Reshma
2019-03-12 21:53     ` Yongseok Koh [this message]

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=E8C45197-178A-4165-80CE-76DDE87D34AB@mellanox.com \
    --to=yskoh@mellanox.com \
    --cc=pan1.zhang@intel.com \
    --cc=reshma.pattan@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).