DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: Neil Horman <nhorman@tuxdriver.com>,
	John McNamara <john.mcnamara@intel.com>,
	Marko Kovacevic <marko.kovacevic@intel.com>,
	Bernard Iremonger <bernard.iremonger@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@intel.com>
Cc: <dev@dpdk.org>, Igor Romanov <igor.romanov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 1/7] ethdev: change MAC addr get function return value to int
Date: Tue, 10 Sep 2019 09:52:15 +0100	[thread overview]
Message-ID: <1568105541-7399-2-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1568105541-7399-1-git-send-email-arybchenko@solarflare.com>

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

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

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 +++
 doc/guides/sample_app_ug/flow_classify.rst | 4 +++-
 lib/librte_ethdev/rte_ethdev.c             | 6 ++++--
 lib/librte_ethdev/rte_ethdev.h             | 5 ++++-
 5 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 43b15ec2f..61ba2e0bc 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_macaddr_get``
   - ``rte_eth_dev_owner_delete``
 
 * ethdev: New offload flags ``DEV_RX_OFFLOAD_RSS_HASH`` and
diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index 3ff1296a2..033ed54f4 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -112,6 +112,9 @@ API Changes
   return value from ``void`` to ``int`` to provide a way to report various
   error conditions.
 
+* ethdev: changed ``rte_eth_macaddr_get`` return value from ``void`` to
+  ``int`` to provide a way to report various error conditions.
+
 
 ABI Changes
 -----------
diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst
index 7c2b6dcf8..bc234b50a 100644
--- a/doc/guides/sample_app_ug/flow_classify.rst
+++ b/doc/guides/sample_app_ug/flow_classify.rst
@@ -306,7 +306,9 @@ Forwarding application is shown below:
             return retval;
 
         /* Display the port MAC address. */
-        rte_eth_macaddr_get(port, &addr);
+        retval = rte_eth_macaddr_get(port, &addr);
+        if (retval < 0)
+            return retval;
         printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
                " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n",
                port,
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index b9fa5f562..29ecb9274 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -2702,14 +2702,16 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,
 	return j;
 }
 
-void
+int
 rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr)
 {
 	struct rte_eth_dev *dev;
 
-	RTE_ETH_VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 	rte_ether_addr_copy(&dev->data->mac_addrs[0], mac_addr);
+
+	return 0;
 }
 
 
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index aba5b4c86..9c213e072 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -2361,8 +2361,11 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
  * @param mac_addr
  *   A pointer to a structure of type *ether_addr* to be filled with
  *   the Ethernet address of the Ethernet device.
+ * @return
+ *   - (0) if successful
+ *   - (-ENODEV) if *port_id* invalid.
  */
-void rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr);
+int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr);
 
 /**
  * Retrieve the contextual information of an Ethernet device.
-- 
2.17.1


  reply	other threads:[~2019-09-10  8:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-10  8:52 [dpdk-dev] [PATCH 0/7] " Andrew Rybchenko
2019-09-10  8:52 ` Andrew Rybchenko [this message]
2019-09-10  8:52 ` [dpdk-dev] [PATCH 2/7] app/testpmd: check status of getting MAC address Andrew Rybchenko
2019-09-10  8:52 ` [dpdk-dev] [PATCH 3/7] app/pdump: " Andrew Rybchenko
2019-09-10  8:52 ` [dpdk-dev] [PATCH 4/7] app/test: " Andrew Rybchenko
2019-09-10  8:52 ` [dpdk-dev] [PATCH 5/7] app/test: check status of getting MAC address in bonding Andrew Rybchenko
2019-09-10  8:52 ` [dpdk-dev] [PATCH 6/7] examples: check status of getting MAC address Andrew Rybchenko
2019-09-10  8:52 ` [dpdk-dev] [PATCH 7/7] examples/bond: " Andrew Rybchenko
2019-09-24 13:23 ` [dpdk-dev] [PATCH 0/7] ethdev: change MAC addr get function return value to int Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1568105541-7399-2-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=igor.romanov@oktetlabs.ru \
    --cc=john.mcnamara@intel.com \
    --cc=marko.kovacevic@intel.com \
    --cc=nhorman@tuxdriver.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).