Skip to contentSkip to conversation

ethdev: fix rte_eth_dev_owner_unset

PATCH In review Stephen Hemminger 3 participants 18 messages Aug 14, 2018 – Aug 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethdev: fix rte_eth_dev_owner_unset

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.

Move the validation of owner into set and unset as separate calls.

Fixes 5b7ba31148a8 ("ethdev: add port ownership")
---
 lib/librte_ethdev/rte_ethdev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
lib/librte_ethdev/rte_ethdev.c +6 -4
index 4c320250589a..9398550a1189 100644
@@ -443,10 +443,6 @@ _rte_eth_dev_owner_set(const uint16_t port_id, const uint64_t old_owner_id,
 		return -ENODEV;
 	}
 
-	if (!rte_eth_is_valid_owner_id(new_owner->id) &&
-	    !rte_eth_is_valid_owner_id(old_owner_id))
-		return -EINVAL;
-
 	port_owner = &rte_eth_devices[port_id].data->owner;
 	if (port_owner->id != old_owner_id) {
 		RTE_ETHDEV_LOG(ERR,
@@ -475,6 +471,9 @@ rte_eth_dev_owner_set(const uint16_t port_id,
 {
 	int ret;
 
+	if (!rte_eth_is_valid_owner_id(owner->id))
+		return -EINVAL;
+
 	rte_eth_dev_shared_data_prepare();
 
 	rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
@@ -492,6 +491,9 @@ rte_eth_dev_owner_unset(const uint16_t port_id, const uint64_t owner_id)
 			{.id = RTE_ETH_DEV_NO_OWNER, .name = ""};
 	int ret;
 
+	if (!rte_eth_is_valid_owner_id(owner_id))
+		return -EINVAL;
+
 	rte_eth_dev_shared_data_prepare();
 
 	rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
Signature · 1 line
2.18.0
#1 lore raw

Hi Stephen

From: Stephen Hemminger

Quoted 4 lines

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.

Quoted 46 lines

Move the validation of owner into set and unset as separate calls.

Fixes 5b7ba31148a8 ("ethdev: add port ownership")
---
 lib/librte_ethdev/rte_ethdev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
lib/librte_ethdev/rte_ethdev.c +0 -4
index 4c320250589a..9398550a1189 100644
@@ -443,10 +443,6 @@ _rte_eth_dev_owner_set(const uint16_t port_id,
 const uint64_t old_owner_id,
 		return -ENODEV;
 	}
 
-	if (!rte_eth_is_valid_owner_id(new_owner->id) &&
-	    !rte_eth_is_valid_owner_id(old_owner_id))
-		return -EINVAL;
-
 	port_owner = &rte_eth_devices[port_id].data->owner;
 	if (port_owner->id != old_owner_id) {
lib/librte_ethdev/rte_ethdev.c +6 -0
 		RTE_ETHDEV_LOG(ERR,
@@ -475,6 +471,9 @@ rte_eth_dev_owner_set(const uint16_t port_id,  {
 	int ret;
 
+	if (!rte_eth_is_valid_owner_id(owner->id))
+		return -EINVAL;
+
 	rte_eth_dev_shared_data_prepare();
 
 	rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
@@ -492,6 +491,9 @@ rte_eth_dev_owner_unset(const uint16_t port_id,
 const uint64_t owner_id)
 			{.id = RTE_ETH_DEV_NO_OWNER, .name = ""};
 	int ret;
 
+	if (!rte_eth_is_valid_owner_id(owner_id))
+		return -EINVAL;
+
 	rte_eth_dev_shared_data_prepare();
 

rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
--
2.18.0

#2 lore raw
Quoted 11 lines · On Tue, 14 Aug 2018 05:52:20 +0000 Matan Azrad <[email protected]> wrote:

Hi Stephen

From: Stephen Hemminger

Quoted 4 lines

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;

The failsafe driver never checks the return value, and therefore doesn't see that it never clears ownership.

#3 lore raw

Hi Stephen

From: Stephen Hemminger

Quoted 28 lines
Quoted 11 lines · On Tue, 14 Aug 2018 05:52:20 +0000 Matan Azrad <[email protected]> wrote:

Hi Stephen

From: Stephen Hemminger

Quoted 4 lines

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)

Quoted 5 lines
	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.

Quoted 2 lines

The failsafe driver never checks the return value, and therefore doesn't see that it never clears ownership.

#4 lore raw
Quoted 37 lines · Matan Azrad

Hi Stephen

From: Stephen Hemminger

Quoted 28 lines
Quoted 11 lines · On Tue, 14 Aug 2018 05:52:20 +0000 Matan Azrad <[email protected]> wrote:

Hi Stephen

From: Stephen Hemminger

Quoted 4 lines

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)

Quoted 5 lines
	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;
Quoted 3 lines

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.

#5 lore raw
Quoted 38 lines · On Fri, 24 Aug 2018 14:55:56 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 37 lines · Matan Azrad

Hi Stephen

From: Stephen Hemminger

Quoted 33 lines
Quoted 11 lines · On Tue, 14 Aug 2018 05:52:20 +0000 Matan Azrad <[email protected]> wrote:

Hi Stephen

From: Stephen Hemminger

Quoted 4 lines

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;
Quoted 6 lines
Quoted 3 lines

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.

#6 lore raw

cover ethdev: minor ownership changes

In reply to Stephen Hemminger

While debugging something else noticed that unset always logged an error.

Stephen Hemminger (2):
ethdev: silence error message on rte_eth_dev_owner_unset
ethdev: make rte_eth_is_valid_owner_id return bool

 lib/librte_ethdev/rte_ethdev.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
Signature · 1 line
2.18.0
#7 lore raw

PATCH 1/2 ethdev: silence error message on rte_eth_dev_owner_unset

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")
---
 lib/librte_ethdev/rte_ethdev.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
lib/librte_ethdev/rte_ethdev.c +6 -5
index 4c320250589a..f09bf8bc8b01 100644
@@ -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) {
Signature · 1 line
2.18.0
#8 lore raw

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

Hi Stephen

From: Stephen Hemminger

Quoted 14 lines

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")
---
 lib/librte_ethdev/rte_ethdev.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
lib/librte_ethdev/rte_ethdev.c +0 -0
index 4c320250589a..f09bf8bc8b01 100644

lib/librte_ethdev/rte_ethdev.c static int · line 398

Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +1 -4
@@ -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.

Quoted 19 lines
lib/librte_ethdev/rte_ethdev.c +5 -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;
+	}
 
lib/librte_ethdev/rte_ethdev.c +0 -1
 	port_owner = &rte_eth_devices[port_id].data->owner;
 	if (port_owner->id != old_owner_id) {
--

2.18.0

#9 lore raw

PATCH v3 1/1 ethdev: silence error message on rte_eth_dev_owner_unset

In reply to Stephen Hemminger

From 74ad4c60262b1451a5a2fabf79a2df89c6c5373d Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <[email protected]>
Date: Thu, 16 Aug 2018 15:37:14 -0700
Subject: [PATCH 1/5] ethdev: silence error message on rte_eth_dev_owner_unset

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")

---
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(-)
lib/librte_ethdev/rte_ethdev.c +11 -6
index 4c320250589a..56dd9c2e83d9 100644
@@ -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) {
@@ -516,9 +517,13 @@ rte_eth_dev_owner_delete(const uint64_t owner_id)
 			if (rte_eth_devices[port_id].data->owner.id == 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=%016"PRIx64"\n",
+			       owner_id);
 	}
 
 	rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
Signature · 1 line
2.18.0
Acked-by on v3 1/1
#10 lore raw

Re: [PATCH v3] ethdev: silence error message on rte_eth_dev_owner_unset

Hi

From: Stephen Hemminger

Quoted 73 lines

From 74ad4c60262b1451a5a2fabf79a2df89c6c5373d Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <[email protected]>
Date: Thu, 16 Aug 2018 15:37:14 -0700
Subject: [PATCH 1/5] ethdev: silence error message on rte_eth_dev_owner_unset

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")

---
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(-)
lib/librte_ethdev/rte_ethdev.c +6 -5
index 4c320250589a..56dd9c2e83d9 100644
@@ -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;
+	}
 
lib/librte_ethdev/rte_ethdev.c +5 -2
 	port_owner = &rte_eth_devices[port_id].data->owner;
 	if (port_owner->id != 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 ==
 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=%016"PRIx64"\n",
+			       owner_id);
 	}
 
 	rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
--
Quoted 2 lines

2.18.0

I think the title should be:
ethdev: fix port ownership logs

while adding the fixes commits (at list 2 because of the NOTICE change) and updating stable.

Besides that,

Applied
#11 lore raw

Re: [PATCH v3] ethdev: silence error message on rte_eth_dev_owner_unset

Quoted 17 lines · Matan Azrad

Hi

From: Stephen Hemminger

Quoted 14 lines

From 74ad4c60262b1451a5a2fabf79a2df89c6c5373d Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <[email protected]>
Date: Thu, 16 Aug 2018 15:37:14 -0700
Subject: [PATCH 1/5] ethdev: silence error message on rte_eth_dev_owner_unset

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")

<...>

Quoted 8 lines

I think the title should be:
ethdev: fix port ownership logs

while adding the fixes commits (at list 2 because of the NOTICE change) and updating stable.

Besides that,

Applied to dpdk-next-net/master, thanks.

(Used suggested title.)

#12 lore raw

PATCH 2/2 ethdev: make rte_eth_is_valid_owner_id return bool

In reply to Stephen Hemminger

Function is boolean so use that.

---
 lib/librte_ethdev/rte_ethdev.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
lib/librte_ethdev/rte_ethdev.c +3 -5
index f09bf8bc8b01..f0336736b7c1 100644
@@ -389,13 +389,11 @@ rte_eth_dev_is_valid_port(uint16_t port_id)
 		return 1;
 }
 
-static int
+static bool
 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)
-		return 0;
-	return 1;
+	return !(owner_id == RTE_ETH_DEV_NO_OWNER ||
+		 rte_eth_dev_shared_data->next_owner_id <= owner_id);
 }
 
 uint64_t
Signature · 1 line
2.18.0
#13 lore raw

Re: [PATCH 2/2] ethdev: make rte_eth_is_valid_owner_id return bool

From: Stephen Hemminger

Quoted 1 line

Function is boolean so use that.

Ethdev is not using bool type, see also:
rte_eth_dev_is_valid_port
rte_eth_dev_is_removed
rte_eth_dev_pool_ops_supported

I think it should be a full solution to all.

Quoted 27 lines
---
 lib/librte_ethdev/rte_ethdev.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
lib/librte_ethdev/rte_ethdev.c +3 -6
index f09bf8bc8b01..f0336736b7c1 100644
@@ -389,13 +389,11 @@ rte_eth_dev_is_valid_port(uint16_t port_id)
 		return 1;
 }
 
-static int
+static bool
 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)
-		return 0;
-	return 1;
+	return !(owner_id == RTE_ETH_DEV_NO_OWNER ||
+		 rte_eth_dev_shared_data->next_owner_id <= owner_id);
 }
 
 uint64_t
--

2.18.0

#14 lore raw

Re: [PATCH 2/2] ethdev: make rte_eth_is_valid_owner_id return bool

Quoted 11 lines · On Tue, 21 Aug 2018 10:20:43 +0000 Matan Azrad <[email protected]> wrote:

From: Stephen Hemminger

Quoted 1 line

Function is boolean so use that.

Ethdev is not using bool type, see also:
rte_eth_dev_is_valid_port
rte_eth_dev_is_removed
rte_eth_dev_pool_ops_supported

I think it should be a full solution to all.

Quoted 1 line

I didn't want change type of visible (exported by ABI) functions.

#15 lore raw

Re: [PATCH 2/2] ethdev: make rte_eth_is_valid_owner_id return bool

Hi

From: Stephen Hemminger

Quoted 11 lines
Quoted 8 lines · On Tue, 21 Aug 2018 10:20:43 +0000 Matan Azrad <[email protected]> wrote:

From: Stephen Hemminger

Quoted 1 line

Function is boolean so use that.

Ethdev is not using bool type, see also:
rte_eth_dev_is_valid_port
rte_eth_dev_is_removed
rte_eth_dev_pool_ops_supported

Quoted 6 lines
Quoted 3 lines

I think it should be a full solution to all.

Quoted 1 line

I didn't want change type of visible (exported by ABI) functions.

Since ethdev now is not using bool type I think it's better not to change it only for this API.

#16 lore raw

Re: [PATCH 2/2] ethdev: make rte_eth_is_valid_owner_id return bool

Quoted 14 lines · On Tue, 21 Aug 2018 15:48:19 +0000 Matan Azrad <[email protected]> wrote:

Hi

From: Stephen Hemminger

Quoted 11 lines
Quoted 8 lines · On Tue, 21 Aug 2018 10:20:43 +0000 Matan Azrad <[email protected]> wrote:

From: Stephen Hemminger

Quoted 1 line

Function is boolean so use that.

Ethdev is not using bool type, see also:
rte_eth_dev_is_valid_port
rte_eth_dev_is_removed
rte_eth_dev_pool_ops_supported

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I think it should be a full solution to all.

Quoted 1 line

I didn't want change type of visible (exported by ABI) functions.

Since ethdev now is not using bool type I think it's better not to change it only for this API.

I hate to pick nits but there is already a bool usage in internal function (static) in ethdev.

static bool
is_allocated(const struct rte_eth_dev *ethdev)

{
	return ethdev->data->name[0] != '\0';
}

Using bool functions doesn't really generate different code. It is is more about using modern C conventions.

#17 lore raw

Re: [PATCH 2/2] ethdev: make rte_eth_is_valid_owner_id return bool

From: Stephen Hemminger

Quoted 30 lines
Quoted 14 lines · On Tue, 21 Aug 2018 15:48:19 +0000 Matan Azrad <[email protected]> wrote:

Hi

From: Stephen Hemminger

Quoted 11 lines
Quoted 8 lines · On Tue, 21 Aug 2018 10:20:43 +0000 Matan Azrad <[email protected]> wrote:

From: Stephen Hemminger

Quoted 1 line

Function is boolean so use that.

Ethdev is not using bool type, see also:
rte_eth_dev_is_valid_port
rte_eth_dev_is_removed
rte_eth_dev_pool_ops_supported

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I think it should be a full solution to all.

Quoted 1 line

I didn't want change type of visible (exported by ABI) functions.

Since ethdev now is not using bool type I think it's better not to change it

only for this API.

I hate to pick nits but there is already a bool usage in internal function (static) in ethdev.

Quoted 7 lines

static bool

is_allocated(const struct rte_eth_dev *ethdev) {
	return ethdev->data->name[0] != '\0';
}

Using bool functions doesn't really generate different code. It is is more about using modern C conventions.

Agree, but I think it should be the same API at least as rte_eth_dev_is_valid_port, just for ethdev convention.

Let's give to the maintainer the decision.