[1/2] ethdev: silence error message on rte_eth_dev_owner_unset

Message ID 20180816224409.5719-2-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: minor ownership changes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Stephen Hemminger Aug. 16, 2018, 10:44 p.m. UTC
  The rte_eth_dev_owner_unset function always generates a log
message because the unset value for owner id is 0.

Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_ethdev/rte_ethdev.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
  

Comments

Matan Azrad Aug. 21, 2018, 10:04 a.m. UTC | #1
Hi Stephen

From: Stephen Hemminger
> The rte_eth_dev_owner_unset function always generates a log message
> because the unset value for owner id is 0.
> 
> Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/librte_ethdev/rte_ethdev.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index 4c320250589a..f09bf8bc8b01 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 == RTE_ETH_DEV_NO_OWNER ||
> -	    rte_eth_dev_shared_data->next_owner_id <= owner_id) {
> -		RTE_ETHDEV_LOG(ERR, "Invalid owner_id=%016"PRIx64"\n",
> -			owner_id);
> +	    rte_eth_dev_shared_data->next_owner_id <= owner_id)
>  		return 0;
> -	}
>  	return 1;
>  }

When you remove the log from this function you remove the error log also from
rte_eth_dev_owner_delete, so please add the missing error print there too.

> 
> @@ -444,8 +441,12 @@ _rte_eth_dev_owner_set(const uint16_t port_id,
> const uint64_t old_owner_id,
>  	}
> 
>  	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=%016"PRIx64"
> new_id=%016"PRIx64"\n",
> +			       old_owner_id, new_owner->id);
>  		return -EINVAL;
> +	}
> 
>  	port_owner = &rte_eth_devices[port_id].data->owner;
>  	if (port_owner->id != old_owner_id) {
> --
> 2.18.0
  

Patch

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 4c320250589a..f09bf8bc8b01 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 == RTE_ETH_DEV_NO_OWNER ||
-	    rte_eth_dev_shared_data->next_owner_id <= owner_id) {
-		RTE_ETHDEV_LOG(ERR, "Invalid owner_id=%016"PRIx64"\n",
-			owner_id);
+	    rte_eth_dev_shared_data->next_owner_id <= owner_id)
 		return 0;
-	}
 	return 1;
 }
 
@@ -444,8 +441,12 @@  _rte_eth_dev_owner_set(const uint16_t port_id, const uint64_t old_owner_id,
 	}
 
 	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=%016"PRIx64" new_id=%016"PRIx64"\n",
+			       old_owner_id, new_owner->id);
 		return -EINVAL;
+	}
 
 	port_owner = &rte_eth_devices[port_id].data->owner;
 	if (port_owner->id != old_owner_id) {