From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id E3C315B3E for ; Fri, 24 Aug 2018 16:42:43 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id x6-v6so1189474plv.10 for ; Fri, 24 Aug 2018 07:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7YvthR6WrwTRR7K6fO8AEuFHcIvQkdIx9yJ345Dmqeo=; b=k7abl9p+/QYAqTI1mRzoY0xYSHUySgWe41mJNWKhiAe2QxpopoyK7Rth4JDxy4gQHU 5Hka/u7IYBuHJuuPGrxttzZv4C+AH8T4ltCbl4rlwsk+ag2JcdZ/nTM3ZhEjQ0+Y8EpC Czr2ToYZ0My0vhVqGxSk8IwWFhE6zN2niemEZa3yWEEpDQ823nl/H82DpkCIppW3b+EA DMbfMReCuKX4Lr8KmKJ+HXNEtv83UdPjORB4jskJvE/xtfIwH4m4R9ZYqZqwdHYjY44l r4/qTYJHfRcmuKoYGfgfmV46+xmURrvUS5qqrnrXzwanExNiNszniPy4nKvt3mBjoP1n 9gTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7YvthR6WrwTRR7K6fO8AEuFHcIvQkdIx9yJ345Dmqeo=; b=Hi9WsvtYgjW9INXBJnWnTD0/j5aJ7TGgphwaNR5p+7EVZrSG74Rl/1X4OjHb6HAy9W UNn+0QQzqFuuA1Mmx76tHDhEVoJg34Z9d3NNR1ZUm7FZRDwqUM98290jBwQPIMKz3dHr 64G+RPNONPHC9DwRvnHPCCFKdgTEMTJ45aYWwCUffHWCBaiwIX/Yyz989SwiRRqz6UFD GSj639Hbda2VRo0Y3sPJXzTBVDpIlUuJzu2JK5gNT0GjZnWY2kBHnyRfw/Cygsr/FQhI +nxOlyrJN+gO6dI4oJfL+DGRCekCZ72KVWmDazVpiaJ5BZEL9TBfASYf6+hZuj9CdaVU Gnvg== X-Gm-Message-State: APzg51BZYoOqS0ixVpMBsHt0tOwMTTQxnum0x+BQM2Um5G1yb8Zf49FR uC8mMq6TVDWd0MOY4WUGdKVF2Q== X-Google-Smtp-Source: ANB0VdaxiuGyGUdIRPiPJAT5z7gvbnV+ebps6/UF+/Fuh3ZxO/1z8GSgRkUQ82f2pVz0FFQhCBTYVQ== X-Received: by 2002:a17:902:70cb:: with SMTP id l11-v6mr1968976plt.91.1535121763110; Fri, 24 Aug 2018 07:42:43 -0700 (PDT) Received: from xeon-e3 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id q127-v6sm19375591pgq.11.2018.08.24.07.42.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Aug 2018 07:42:43 -0700 (PDT) Date: Fri, 24 Aug 2018 07:42:36 -0700 From: Stephen Hemminger To: Ferruh Yigit Cc: Matan Azrad , "dev@dpdk.org" Message-ID: <20180824074236.7f979884@xeon-e3> In-Reply-To: References: <20180814001926.19630-1-stephen@networkplumber.org> <20180814095521.492e575a@xeon-e3> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 14:42:44 -0000 On Fri, 24 Aug 2018 14:55:56 +0100 Ferruh Yigit wrote: > 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. > The issue was the incorrect log message, addressed in later patches.