From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Burakov, Anatoly" Subject: Re: [PATCH v11 06/19] eal: support attach or detach share device from secondary Date: Wed, 11 Jul 2018 13:34:00 +0100 Message-ID: <45604110-529a-423b-1b56-5af4aec34b54@intel.com> References: <20180607123849.14439-1-qi.z.zhang@intel.com> <20180711030917.181098-1-qi.z.zhang@intel.com> <20180711030917.181098-7-qi.z.zhang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: konstantin.ananyev@intel.com, dev@dpdk.org, bruce.richardson@intel.com, ferruh.yigit@intel.com, benjamin.h.shelton@intel.com, narender.vangati@intel.com To: Qi Zhang , thomas@monjalon.net Return-path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id DFE821B5A1 for ; Wed, 11 Jul 2018 14:34:03 +0200 (CEST) In-Reply-To: <20180711030917.181098-7-qi.z.zhang@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > --- > 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. > + 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 :) > + > + 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