From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 42E314CE4 for ; Fri, 24 Aug 2018 15:55:59 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Aug 2018 06:55:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,281,1531810800"; d="scan'208";a="67582996" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.56]) ([10.237.221.56]) by orsmga007.jf.intel.com with ESMTP; 24 Aug 2018 06:55:56 -0700 To: Matan Azrad , Stephen Hemminger Cc: "dev@dpdk.org" References: <20180814001926.19630-1-stephen@networkplumber.org> <20180814095521.492e575a@xeon-e3> From: Ferruh Yigit Openpgp: preference=signencrypt Message-ID: Date: Fri, 24 Aug 2018 14:55:56 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] ethdev: fix rte_eth_dev_owner_unset 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: Fri, 24 Aug 2018 13:55:59 -0000 On 8/14/2018 8:46 PM, Matan Azrad wrote: > Hi Stephen > > From: Stephen Hemminger >> On Tue, 14 Aug 2018 05:52:20 +0000 >> Matan Azrad wrote: >> >>> Hi Stephen >>> >>> From: Stephen Hemminger >>>> The rte_eth_dev_owner_unset function is unusable because it always >>>> returns -EINVAL. This is because the magic (unowned) value is >>>> flagged as not valid. >>>> >>> >>> It's OK to raise an error when you do unset for unowned device. >>> It means that unset owner should be called for owned device. >>> >> >> Original code was broken. The following would always fail. >> >> rte_eth_dev_owner_new(&owner.id); >> sprintf(owner.name, "example"); >> rte_eth_dev_owner_set(port_id, &owner); >> rte_eth_dev_owner_unset(port_id, owner.id); >> >> That is because of: >> rte_eth_dev_owner_unset(port_id, owner_id) >> _rte_eth_dev_owner_set(port_id, owner_id, &new_owner) >> << new_owner.id == RTE_ETH_DEV_NO_OWNER (0) >> >> >> if (!rte_eth_is_valid_owner_id(new_owner->id) && << >> new_owner->id == RTE_ETH_DEV_NO_OWNER (which is flagged as invalid) >> !rte_eth_is_valid_owner_id(old_owner_id)) >> return -EINVAL; >> > > But both should be invalid the new owner and the old owner(&&) to raise an EINVAL error. > > In the aforementioned check above the old owner should be valid. It looks rte_eth_dev_owner_unset() works, updating patch as rejected.