From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stephen@networkplumber.org>
Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com
 [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id A098098
 for <dev@dpdk.org>; Tue, 21 Aug 2018 17:45:18 +0200 (CEST)
Received: by mail-pg1-f195.google.com with SMTP id a11-v6so8640131pgw.6
 for <dev@dpdk.org>; Tue, 21 Aug 2018 08:45:18 -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=dMbA1glzFBgl06m7iI1DvA4pllQNgt7KVOXGY9ZR5t4=;
 b=yOh3Ng9j4OB00RzL6tkNH8RjnX8uDtdwohQAuOX1UC4EQCynamHKsY4kHAsHqnu6S/
 b3K+/ua54JFYtOZ+X1D7AcfptW1GKJO67DSIL+rDNKoa8U6lUxuXT1l+zjuCDLpqZ/oN
 +adIHH+1YxgEwHF5WSdfrI8ZRZq0x4fsMauaEfBxomJeuxf1znoortgtqLeXuPC9ANWH
 r7rO6wU4p3P07nHDvaI3/VhzbltLN0UNjLGoAgJ3znGtHjbJ8euF0a9PbrWFz8qYCvqP
 +vI2qj2MXcQ2rwifZbAf0SqrAWRJMcL5YgnJEQTgafi70D21NTnj9eNZJi9EtD75aR80
 tbYw==
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=dMbA1glzFBgl06m7iI1DvA4pllQNgt7KVOXGY9ZR5t4=;
 b=OXZDIGLmTiQMuyC7xnL7/6nBxSVFLxkhFQpcOjcC/SfzPWp02lb+t4VWCEApikFMyC
 SOV03pwYgULN7zMgjqAVEB/6OtYAuWfM+Y1QGGJAL8+ZBx149OmL1oWLQXgGc+ZW8nf+
 8Pm0biQPxFO1M5xg/KUHLcmofg37lVWoJ5VWlGcVm9t6XNips7DUCArC1dBlRag/wwL7
 h4kykmtsUL+f0yKb9RGrEWaUMo/603fF1aZy//Nk40HJvam5c1yi5+xH9MillHhUK/oH
 Ddc4xIAFCIuuG22TcYPkfJ/qMi33Mb88f6zkMDZw9VJHiq77JYYTi3jUroDUto0rTUof
 aTPA==
X-Gm-Message-State: APzg51CR5iVpFoiV2gElTJT/8se5kJOgXWxw0YdNaNSiVIMw53BfJqft
 5TBIFk20/OYmGcN/sDFwuQmdgw==
X-Google-Smtp-Source: ANB0VdYN4aMDlI5uoWs8CeVvLTvzwzNd//1qFKdTRIBniXV6AeWQABDpBe7t7eNmIAgJwrql1sLpsA==
X-Received: by 2002:a65:65c6:: with SMTP id
 y6-v6mr2291077pgv.436.1534866317660; 
 Tue, 21 Aug 2018 08:45:17 -0700 (PDT)
Received: from xeon-e3 (204-195-22-127.wavecable.com. [204.195.22.127])
 by smtp.gmail.com with ESMTPSA id c11-v6sm7478567pgc.70.2018.08.21.08.45.17
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Tue, 21 Aug 2018 08:45:17 -0700 (PDT)
Date: Tue, 21 Aug 2018 08:45:15 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: matan@mellanox.com
Cc: dev@dpdk.org
Message-ID: <20180821084515.2a802429@xeon-e3>
In-Reply-To: <20180816224409.5719-2-stephen@networkplumber.org>
References: <20180814001926.19630-1-stephen@networkplumber.org>
 <20180816224409.5719-1-stephen@networkplumber.org>
 <20180816224409.5719-2-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
Subject: [dpdk-dev] [PATCH v3] ethdev: silence error message on
	rte_eth_dev_owner_unset
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 21 Aug 2018 15:45:18 -0000

=46rom 74ad4c60262b1451a5a2fabf79a2df89c6c5373d Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Thu, 16 Aug 2018 15:37:14 -0700
Subject: [PATCH 1/5] ethdev: silence error message on rte_eth_dev_owner_uns=
et

The rte_eth_dev_owner_unset function always generates a log
message because the unset value for owner id is 0.

Also, when rte_eth_dev_owner_delete is called with a valid
owner id, the log message should be at NOTICE not ERROR
severity.

Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v3 - handle rte_eth_dev_owner_delete
     leave other cleanups to later patch series

 lib/librte_ethdev/rte_ethdev.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 4c320250589a..56dd9c2e83d9 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -393,11 +393,8 @@ static int
 rte_eth_is_valid_owner_id(uint64_t owner_id)
 {
 	if (owner_id =3D=3D RTE_ETH_DEV_NO_OWNER ||
-	    rte_eth_dev_shared_data->next_owner_id <=3D owner_id) {
-		RTE_ETHDEV_LOG(ERR, "Invalid owner_id=3D%016"PRIx64"\n",
-			owner_id);
+	    rte_eth_dev_shared_data->next_owner_id <=3D owner_id)
 		return 0;
-	}
 	return 1;
 }
=20
@@ -444,8 +441,12 @@ _rte_eth_dev_owner_set(const uint16_t port_id, const u=
int64_t old_owner_id,
 	}
=20
 	if (!rte_eth_is_valid_owner_id(new_owner->id) &&
-	    !rte_eth_is_valid_owner_id(old_owner_id))
+	    !rte_eth_is_valid_owner_id(old_owner_id)) {
+		RTE_ETHDEV_LOG(ERR,
+			       "Invalid owner old_id=3D%016"PRIx64" new_id=3D%016"PRIx64"\n",
+			       old_owner_id, new_owner->id);
 		return -EINVAL;
+	}
=20
 	port_owner =3D &rte_eth_devices[port_id].data->owner;
 	if (port_owner->id !=3D old_owner_id) {
@@ -516,9 +517,13 @@ rte_eth_dev_owner_delete(const uint64_t owner_id)
 			if (rte_eth_devices[port_id].data->owner.id =3D=3D owner_id)
 				memset(&rte_eth_devices[port_id].data->owner, 0,
 				       sizeof(struct rte_eth_dev_owner));
-		RTE_ETHDEV_LOG(ERR,
+		RTE_ETHDEV_LOG(NOTICE,
 			"All port owners owned by %016"PRIx64" identifier have removed\n",
 			owner_id);
+	} else {
+		RTE_ETHDEV_LOG(ERR,
+			       "Invalid owner id=3D%016"PRIx64"\n",
+			       owner_id);
 	}
=20
 	rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
--=20
2.18.0