DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
* [dpdk-dev] [PATCH 0/1] ethdev: change owner delete function return value to int
@ 2019-09-10  9:02 Andrew Rybchenko
  2019-09-10  9:02 ` [dpdk-dev] [PATCH 1/1] " Andrew Rybchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Rybchenko @ 2019-09-10  9:02 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit; +Cc: dev, Igor Romanov

It is the seventh patch series to get rid of void returning functions
in ethdev in accordance with deprecation notice [1].

It should be applied on top of [2], [3], [4], [5], [6] and [7].
It can be applied separately with simple merge coflicts resolved
in documentation.

Functions which return void are bad since they do not provide explicit
information to the caller if everything is OK or not.

[1] https://patches.dpdk.org/patch/56969/
[2] https://patches.dpdk.org/project/dpdk/list/?series=6279
[3] https://patches.dpdk.org/project/dpdk/list/?series=6334
[4] https://patches.dpdk.org/project/dpdk/list/?series=6335
[5] https://patches.dpdk.org/project/dpdk/list/?series=6308
[6] https://patches.dpdk.org/project/dpdk/list/?series=6350
[7] https://patches.dpdk.org/project/dpdk/list/?series=6355

Igor Romanov (1):
  ethdev: change owner delete function return value to int

 doc/guides/rel_notes/deprecation.rst   | 1 -
 doc/guides/rel_notes/release_19_11.rst | 3 +++
 drivers/net/netvsc/hn_ethdev.c         | 5 ++++-
 lib/librte_ethdev/rte_ethdev.c         | 6 +++++-
 lib/librte_ethdev/rte_ethdev.h         | 4 +++-
 5 files changed, 15 insertions(+), 4 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [dpdk-dev] [PATCH 1/1] ethdev: change owner delete function return value to int
  2019-09-10  9:02 [dpdk-dev] [PATCH 0/1] ethdev: change owner delete function return value to int Andrew Rybchenko
@ 2019-09-10  9:02 ` " Andrew Rybchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Rybchenko @ 2019-09-10  9:02 UTC (permalink / raw)
  To: Neil Horman, John McNamara, Marko Kovacevic, Stephen Hemminger,
	K. Y. Srinivasan, Haiyang Zhang, Thomas Monjalon, Ferruh Yigit
  Cc: dev, Igor Romanov

From: Igor Romanov <igor.romanov@oktetlabs.ru>

Change rte_eth_dev_owner_delete() return value from void to int
and return negative errno values in case of error conditions.

Right now there is only one error case for rte_eth_dev_owner_delete() -
invalid owner, but it still makes sense to return error to catch bugs
in the code which uses the function.

Also update the usage of the function in drivers/netvsc
according to the new return type.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 doc/guides/rel_notes/deprecation.rst   | 1 -
 doc/guides/rel_notes/release_19_11.rst | 3 +++
 drivers/net/netvsc/hn_ethdev.c         | 5 ++++-
 lib/librte_ethdev/rte_ethdev.c         | 6 +++++-
 lib/librte_ethdev/rte_ethdev.h         | 4 +++-
 5 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 61ba2e0bc..237813b64 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -90,7 +90,6 @@ Deprecation Notices
 
   - ``rte_eth_dev_stop``
   - ``rte_eth_dev_close``
-  - ``rte_eth_dev_owner_delete``
 
 * ethdev: New offload flags ``DEV_RX_OFFLOAD_RSS_HASH`` and
   ``DEV_RX_OFFLOAD_FLOW_MARK`` will be added in 19.11.
diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index 033ed54f4..54950277b 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -115,6 +115,9 @@ API Changes
 * ethdev: changed ``rte_eth_macaddr_get`` return value from ``void`` to
   ``int`` to provide a way to report various error conditions.
 
+* ethdev: changed ``rte_eth_dev_owner_delete`` return value from ``void`` to
+  ``int`` to provide a way to report various error conditions.
+
 
 ABI Changes
 -----------
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index ca96e80a4..eed8dece9 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -1004,6 +1004,7 @@ static int
 eth_hn_dev_uninit(struct rte_eth_dev *eth_dev)
 {
 	struct hn_data *hv = eth_dev->data->dev_private;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -1021,7 +1022,9 @@ eth_hn_dev_uninit(struct rte_eth_dev *eth_dev)
 	hn_tx_pool_uninit(eth_dev);
 	rte_vmbus_chan_close(hv->primary->chan);
 	rte_free(hv->primary);
-	rte_eth_dev_owner_delete(hv->owner.id);
+	ret = rte_eth_dev_owner_delete(hv->owner.id);
+	if (ret != 0)
+		return ret;
 
 	return 0;
 }
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 29ecb9274..e50bac847 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -687,10 +687,11 @@ rte_eth_dev_owner_unset(const uint16_t port_id, const uint64_t owner_id)
 	return ret;
 }
 
-void
+int
 rte_eth_dev_owner_delete(const uint64_t owner_id)
 {
 	uint16_t port_id;
+	int ret = 0;
 
 	rte_eth_dev_shared_data_prepare();
 
@@ -708,9 +709,12 @@ rte_eth_dev_owner_delete(const uint64_t owner_id)
 		RTE_ETHDEV_LOG(ERR,
 			       "Invalid owner id=%016"PRIx64"\n",
 			       owner_id);
+		ret = -EINVAL;
 	}
 
 	rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
+
+	return ret;
 }
 
 int
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 9c213e072..d937fb429 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1566,9 +1566,11 @@ int rte_eth_dev_owner_unset(const uint16_t port_id,
  *
  * @param	owner_id
  *  The owner identifier.
+ * @return
+ *  0 on success, negative errno value on error.
  */
 __rte_experimental
-void rte_eth_dev_owner_delete(const uint64_t owner_id);
+int rte_eth_dev_owner_delete(const uint64_t owner_id);
 
 /**
  * @warning
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10  9:02 [dpdk-dev] [PATCH 0/1] ethdev: change owner delete function return value to int Andrew Rybchenko
2019-09-10  9:02 ` [dpdk-dev] [PATCH 1/1] " Andrew Rybchenko

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox