DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Ophir Munk <ophirmu@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"gaetan.rivet@6wind.com" <gaetan.rivet@6wind.com>,
	"qi.z.zhang@intel.com" <qi.z.zhang@intel.com>,
	"ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
	"ktraynor@redhat.com" <ktraynor@redhat.com>,
	Shahaf Shuler <shahafs@mellanox.com>,
	Olga Shern <olgas@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH v2 2/4] devargs: simplify parameters of removal function
Date: Thu, 27 Sep 2018 23:31:50 +0200	[thread overview]
Message-ID: <4883182.eS8zcPg0Ii@xps> (raw)
In-Reply-To: <VI1PR0502MB37437AA3D5F7C6131ECADD0CD1140@VI1PR0502MB3743.eurprd05.prod.outlook.com>

Hi,

27/09/2018 10:24, Ophir Munk:
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > The function rte_devargs_remove(), which is intended to be internal, can
> > take a devargs structure as argument.
> > The matching is still using string comparison of bus name and device name.
> > It is simpler and may allow a different devargs matching in future.
[...]
> > --- a/lib/librte_eal/common/eal_common_dev.c
> > +++ b/lib/librte_eal/common/eal_common_dev.c
> > @@ -186,7 +186,7 @@ int __rte_experimental rte_eal_hotplug_add(const
> > char *busname, const char *devn
> >  	return 0;
> > 
> >  err_devarg:
> > -	if (rte_devargs_remove(busname, devname)) {
> > +	if (rte_devargs_remove(da)) {
> 
> Can you please explain why calling with 'da' parameter
> (which may have different internal fields of busname and devname
> than the explicit busname and devname parameters) - is correct?

Before devargs is parsed and inserted in the global list,
devargs values are NULL, so nothing is found (as before this patch).
rte_devargs_remove(da) will have no effect and will return 1,
so the devargs will be freed by code in the if block.

When devargs is inserted in the list, it will have the values
of busname and devname, so it is the same as before this patch.

However, there may be an issue dereferencing devargs->bus->name
when devargs is not parsed. I must add this code in rte_devargs_remove:
    if (devargs->bus == NULL)
        return 1;

[...]
> > @@ -227,7 +227,7 @@ rte_eal_hotplug_remove(const char *busname,
> > const char *devname)
> >  	if (ret)
> >  		RTE_LOG(ERR, EAL, "Driver cannot detach the device
> > (%s)\n",
> >  			dev->name);
> > -	rte_devargs_remove(busname, devname);
> > +	rte_devargs_remove(dev->devargs);
> 
> Can you please explain why calling with 'dev->devargs' parameter
> (which may have different internal fields of busname and devname
> than the explicit busname and devname parameters) - is correct?

The device is found by checking the busname and devname.
I don't see how the devargs values may be different.

  reply	other threads:[~2018-09-27 21:31 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-07 22:27 [dpdk-dev] [RFC] eal: simplify parameters of hotplug functions Thomas Monjalon
2018-09-26 21:47 ` [dpdk-dev] [PATCH v2 0/4] eal: simplify devargs and " Thomas Monjalon
2018-09-26 21:47   ` [dpdk-dev] [PATCH v2 1/4] devargs: remove deprecated functions Thomas Monjalon
2018-09-26 21:47   ` [dpdk-dev] [PATCH v2 2/4] devargs: simplify parameters of removal function Thomas Monjalon
2018-09-27  8:24     ` Ophir Munk
2018-09-27 21:31       ` Thomas Monjalon [this message]
2018-09-26 21:47   ` [dpdk-dev] [PATCH v2 3/4] eal: remove experimental flag of hotplug functions Thomas Monjalon
2018-09-26 21:47   ` [dpdk-dev] [PATCH v2 4/4] eal: simplify parameters " Thomas Monjalon
2018-09-28 16:21 ` [dpdk-dev] [PATCH v3 0/4] eal: simplify devargs and " Thomas Monjalon
2018-09-28 16:21   ` [dpdk-dev] [PATCH v3 1/4] devargs: remove deprecated functions Thomas Monjalon
2018-10-01 11:24     ` Andrew Rybchenko
2018-10-01 17:10       ` Thomas Monjalon
2018-09-28 16:21   ` [dpdk-dev] [PATCH v3 2/4] devargs: simplify parameters of removal function Thomas Monjalon
2018-10-01 11:25     ` Andrew Rybchenko
2018-10-01 19:47       ` Thomas Monjalon
2018-09-28 16:21   ` [dpdk-dev] [PATCH v3 3/4] eal: remove experimental flag of hotplug functions Thomas Monjalon
2018-10-01 11:26     ` Andrew Rybchenko
2018-10-01 19:54       ` Thomas Monjalon
2018-10-02 10:28     ` Ferruh Yigit
2018-10-03  8:42       ` Thomas Monjalon
2018-09-28 16:21   ` [dpdk-dev] [PATCH v3 4/4] eal: simplify parameters " Thomas Monjalon
2018-10-01 11:26     ` Andrew Rybchenko
2018-10-01 20:03       ` Thomas Monjalon
2018-10-01 20:52 ` [dpdk-dev] [PATCH v4 0/4] eal: simplify devargs and " Thomas Monjalon
2018-10-01 20:52   ` [dpdk-dev] [PATCH v4 1/4] devargs: remove deprecated functions Thomas Monjalon
2018-10-01 20:52   ` [dpdk-dev] [PATCH v4 2/4] devargs: simplify parameters of removal function Thomas Monjalon
2018-10-01 20:52   ` [dpdk-dev] [PATCH v4 3/4] eal: remove experimental flag of hotplug functions Thomas Monjalon
2018-10-01 20:52   ` [dpdk-dev] [PATCH v4 4/4] eal: simplify parameters " Thomas Monjalon
2018-10-03 23:10 ` [dpdk-dev] [PATCH v5 0/5] eal: simplify devargs and " Thomas Monjalon
2018-10-03 23:10   ` [dpdk-dev] [PATCH v5 1/5] devargs: remove deprecated functions Thomas Monjalon
2018-10-04  9:19     ` Gaëtan Rivet
2018-10-03 23:10   ` [dpdk-dev] [PATCH v5 2/5] devargs: simplify parameters of removal function Thomas Monjalon
2018-10-04  9:21     ` Gaëtan Rivet
2018-10-03 23:10   ` [dpdk-dev] [PATCH v5 3/5] eal: add bus pointer in device structure Thomas Monjalon
2018-10-04  9:31     ` Gaëtan Rivet
2018-10-04  9:48       ` Thomas Monjalon
2018-10-03 23:10   ` [dpdk-dev] [PATCH v5 4/5] eal: remove experimental flag of hotplug functions Thomas Monjalon
2018-10-04  9:33     ` Gaëtan Rivet
2018-10-03 23:10   ` [dpdk-dev] [PATCH v5 5/5] eal: simplify parameters " Thomas Monjalon
2018-10-04  9:44     ` Gaëtan Rivet
2018-10-04 11:46       ` Thomas Monjalon
2018-10-04 11:51         ` Gaëtan Rivet
2018-10-07  9:32 ` [dpdk-dev] [PATCH v6 0/5] eal: simplify devargs and " Thomas Monjalon
2018-10-07  9:32   ` [dpdk-dev] [PATCH v6 1/5] devargs: remove deprecated functions Thomas Monjalon
2018-10-07  9:32   ` [dpdk-dev] [PATCH v6 2/5] devargs: simplify parameters of removal function Thomas Monjalon
2018-10-07  9:32   ` [dpdk-dev] [PATCH v6 3/5] eal: add bus pointer in device structure Thomas Monjalon
2018-10-07  9:32   ` [dpdk-dev] [PATCH v6 4/5] eal: remove experimental flag of hotplug functions Thomas Monjalon
2018-10-07  9:32   ` [dpdk-dev] [PATCH v6 5/5] eal: simplify parameters " Thomas Monjalon
2018-10-08 21:45   ` [dpdk-dev] [PATCH v6 0/5] eal: simplify devargs and " Stephen Hemminger
2018-10-11 12:10     ` Thomas Monjalon

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=4883182.eS8zcPg0Ii@xps \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=gaetan.rivet@6wind.com \
    --cc=ktraynor@redhat.com \
    --cc=olgas@mellanox.com \
    --cc=ophirmu@mellanox.com \
    --cc=qi.z.zhang@intel.com \
    --cc=shahafs@mellanox.com \
    /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).