From mboxrd@z Thu Jan 1 00:00:00 1970 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) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2018 05:34:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,338,1526367600"; d="scan'208";a="71419851" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.237.220.102]) ([10.237.220.102]) by fmsmga001.fm.intel.com with ESMTP; 11 Jul 2018 05:34:00 -0700 To: Qi Zhang , thomas@monjalon.net 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 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> From: "Burakov, Anatoly" Message-ID: <45604110-529a-423b-1b56-5af4aec34b54@intel.com> Date: Wed, 11 Jul 2018 13:34:00 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 MIME-Version: 1.0 In-Reply-To: <20180711030917.181098-7-qi.z.zhang@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v11 06/19] eal: support attach or detach share device from secondary X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 12:34:04 -0000 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