From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id B963B1B3A4 for ; Tue, 10 Jul 2018 16:11:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2018 07:11:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,334,1526367600"; d="scan'208";a="73647623" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.237.220.102]) ([10.237.220.102]) by orsmga002.jf.intel.com with ESMTP; 10 Jul 2018 07:11:43 -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> <20180709033706.27858-1-qi.z.zhang@intel.com> <20180709033706.27858-7-qi.z.zhang@intel.com> From: "Burakov, Anatoly" Message-ID: <9918eb67-0914-ee58-d2e6-6fe82ae1d466@intel.com> Date: Tue, 10 Jul 2018 15:11:43 +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: <20180709033706.27858-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 v10 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: Tue, 10 Jul 2018 14:11:49 -0000 On 09-Jul-18 4:36 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 > --- > + > + 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) { > + RTE_LOG(ERR, EAL, "cannot send request to primary"); > + return ret; > + } > + > + resp = (struct eal_dev_mp_req *)mp_reply.msgs[0].param; This looks like a potential buffer overflow - you don't check if there's a first message to read a response from. > + req->result = resp->result; > + > + return ret; > } > > int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req) > -- Thanks, Anatoly