ethdev: change owner delete function to return int
authorIgor Romanov <igor.romanov@oktetlabs.ru>
Tue, 10 Sep 2019 09:02:16 +0000 (10:02 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 7 Oct 2019 13:00:55 +0000 (15:00 +0200)
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
doc/guides/rel_notes/release_19_11.rst
drivers/net/netvsc/hn_ethdev.c
lib/librte_ethdev/rte_ethdev.c
lib/librte_ethdev/rte_ethdev.h

index 743f97f..8f9cd2a 100644 (file)
@@ -91,7 +91,6 @@ Deprecation Notices
   - ``rte_eth_allmulticast_enable`` and ``rte_eth_allmulticast_disable``
   - ``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.
index 1bff872..458601e 100644 (file)
@@ -140,6 +140,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
 -----------
index 7edfe5e..89c769c 100644 (file)
@@ -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;
 }
index 56875bb..2f65143 100644 (file)
@@ -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
index d3f4f25..1bc7e08 100644 (file)
@@ -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