From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 334DFA2EEB for ; Tue, 10 Sep 2019 10:53:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6506F1EE15; Tue, 10 Sep 2019 10:53:15 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 31CC81EBB9 for ; Tue, 10 Sep 2019 10:53:08 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id D31E7480075; Tue, 10 Sep 2019 08:53:06 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 10 Sep 2019 01:53:03 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 10 Sep 2019 01:53:03 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x8A8r2c8024705; Tue, 10 Sep 2019 09:53:02 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 076C41613D1; Tue, 10 Sep 2019 09:53:02 +0100 (BST) From: Andrew Rybchenko To: Neil Horman , John McNamara , Marko Kovacevic , Bernard Iremonger , Thomas Monjalon , Ferruh Yigit CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:52:15 +0100 Message-ID: <1568105541-7399-2-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568105541-7399-1-git-send-email-arybchenko@solarflare.com> References: <1568105541-7399-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24898.005 X-TM-AS-Result: No-0.118400-4.000000-10 X-TMASE-MatchedRID: ZfJhYitF+JEwpyA3tQmxTTKVTrGMDe/D0mSc1YzbC53iYlKox3ryNARj Z4/TzBlyzFlXLlUThJWFdUQ7gIlm0MfgFvmHWcDxnFVnNmvv47tLXPA26IG0hN9RlPzeVuQQ3AE qvnWPfyoP8SQMpzefds/SFFe7HAXI1olhffxqhYGcxB01DrjF90qAhuLHn5fEV8ukjx868O7xt/ fflIv7Xe7qUsCdUA4McnCrT5FxoAc7lyyjhh8Q7DIjK23O9D33N1hr79TRdfkgUEQTkIWiYlymR v3NQjsENtOBk4dlDoSbu+FyWYBKSh8TzIzimOwPC24oEZ6SpSmb4wHqRpnaDpNn7xqcBGZOxpO4 YGynE+dFQn49P1fyeripyJD7rvGp2nP91zQP5KFXvczRLXjxhTQ4+y0a0EUdbWowuLL1CNNxvRD YOS/Z6uQDw6tgd3AMZ9iVj/KhX/RSnoQc5vb5zuQdkM7ndBLCN+XOQZygrvY= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--0.118400-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568105587-3eCTJEl_GB-w Subject: [dpdk-dev] [PATCH 1/7] ethdev: change MAC addr get function return value to int X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Igor Romanov 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 Signed-off-by: Andrew Rybchenko --- 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