[dpdk-dev] [PATCH v11 06/19] eal: support attach or detach share device from secondary

Zhang, Qi Z qi.z.zhang at intel.com
Wed Jul 11 14:55:53 CEST 2018



> -----Original Message-----
> From: Burakov, Anatoly
> Sent: Wednesday, July 11, 2018 8:34 PM
> To: Zhang, Qi Z <qi.z.zhang at intel.com>; thomas at monjalon.net
> Cc: Ananyev, Konstantin <konstantin.ananyev at intel.com>; dev at dpdk.org;
> Richardson, Bruce <bruce.richardson at intel.com>; Yigit, Ferruh
> <ferruh.yigit at intel.com>; Shelton, Benjamin H
> <benjamin.h.shelton at intel.com>; Vangati, Narender
> <narender.vangati at intel.com>
> Subject: Re: [PATCH v11 06/19] eal: support attach or detach share device from
> secondary
> 
> On 11-Jul-18 4:09 AM, Qi Zhang wrote:
> > This patch cover the multi-process hotplug case when a device
> > attach/detach request be issued from a secondary process
> >
> > device attach on secondary:
> > a) secondary send sync request to the primary.
> > b) primary receive the request and attach the new device if
> >     failed goto i).
> > c) primary forward attach sync request to all secondary.
> > d) secondary receive the request and attach the device and send a reply.
> > e) primary check the reply if all success goes to j).
> > f) primary send attach rollback sync request to all secondary.
> > g) secondary receive the request and detach the device and send a reply.
> > h) primary receive the reply and detach device as rollback action.
> > i) send attach fail to secondary as a reply of step a), goto k).
> > j) send attach success to secondary as a reply of step a).
> > k) secondary receive reply and return.
> >
> > device detach on secondary:
> > a) secondary send sync request to the primary.
> > b) primary send detach sync request to all secondary.
> > c) secondary detach the device and send a reply.
> > d) primary check the reply if all success goes to g).
> > e) primary send detach rollback sync request to all secondary.
> > f) secondary receive the request and attach back device. goto h).
> > g) primary detach the device if success goto i), else goto e).
> > h) primary send detach fail to secondary as a reply of step a), goto j).
> > i) primary send detach success to secondary as a reply of step a).
> > j) secondary receive reply and return.
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang at intel.com>
> > ---
> >   lib/librte_eal/common/eal_common_dev.c |  20 +++-
> >   lib/librte_eal/common/hotplug_mp.c     | 175
> ++++++++++++++++++++++++++++++++-
> >   2 files changed, 189 insertions(+), 6 deletions(-)
> >
> > diff --git a/lib/librte_eal/common/eal_common_dev.c
> > b/lib/librte_eal/common/eal_common_dev.c
> > index ab2b25558..ee09720c4 100644
> > --- a/lib/librte_eal/common/eal_common_dev.c
> > +++ b/lib/librte_eal/common/eal_common_dev.c
> > @@ -221,7 +221,7 @@ rte_eal_hotplug_add(const char *busname, const
> char *devname,
> >   	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
> >   		/**
> >   		 * If in secondary process, just send IPC request to
> > -		 * primary process
> > +		 * primary process.
> >   		 */
> >   		ret = eal_dev_hotplug_request_to_primary(&req);
> >   		if (ret) {
> > @@ -234,6 +234,7 @@ rte_eal_hotplug_add(const char *busname, const
> char *devname,
> >   				"Failed to hotplug add device\n");
> >   		return req.result;
> >   	}
> > +
> >   	/**
> 
> The above two changes look like unintended noise (or perhaps you meant to
> merge them into one of the previous commits.



> 
> >   	 * attach a device from primary start from here:
> >   	 *
> > @@ -295,6 +296,23 @@ rte_eal_hotplug_remove(const char *busname,
> const char *devname)
> >   	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
> >   		/**
> >   		 * If in secondary process, just send IPC request to
> > +		 * primary process.
> 
> <snip>
> 
> > +	memset(&mp_req, 0, sizeof(mp_req));
> > +	memcpy(mp_req.param, req, sizeof(*req));
> > +	mp_req.len_param = sizeof(*req);
> > +	strlcpy(mp_req.name, EAL_DEV_MP_ACTION_REQUEST,
> > +sizeof(mp_req.name));
> > +
> > +	ret = rte_mp_request_sync(&mp_req, &mp_reply, &ts);
> > +	if (ret || mp_reply.nb_received != 1) {
> > +		RTE_LOG(ERR, EAL, "cannot send request to primary");
> > +		return ret;
> > +	}
> 
> In case of ret = 0 and nb_received = 0, you would be returning 0 as ret = 0. I
> don't think that's what you intended here :)

Ah.. yes, I missed that, thanks
 
> 
> > +
> > +	resp = (struct eal_dev_mp_req *)mp_reply.msgs[0].param;
> > +	req->result = resp->result;
> > +
> > +	return ret;
> >   }
> >
> >   int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req)
> >
> 
> 
> --
> Thanks,
> Anatoly


More information about the dev mailing list