From patchwork Tue Sep 10 08:52:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59084 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org 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 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. From patchwork Tue Sep 10 08:52:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59086 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C70AD1EE3A; Tue, 10 Sep 2019 10:53:20 +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 8CC951EB87 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 5ECE548005F; Tue, 10 Sep 2019 08:53:07 +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:05 -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 x8A8r2w6024713; 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 7DF1F1613D1; Tue, 10 Sep 2019 09:53:02 +0100 (BST) From: Andrew Rybchenko To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:52:16 +0100 Message-ID: <1568105541-7399-3-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 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24898.005 X-TM-AS-Result: No-4.962600-4.000000-10 X-TMASE-MatchedRID: dKAjOXhtwHQfKML5AJtfLe1rOTqE/7IT3V4UShoTXafAlr9zf1x/liXD Fxgit6TpPqH3M3bmiaYDfZ2MQc5YmiHhSBQfglfsA9lly13c/gEvV5f7P0HVDPI35cQSjJK+ZeB 4wkR7kKb4AkYgG/wGtzG1wXUvEQeTaTkWqXcVprv1xv2JHBkcH29Xf86cwKVa1y0aXF5eX+iCoR dhd0kkJkkvdTTC5Z2VXlG4YAM40y66wtuwih3AcSAI8aJmq0jwLSi9nvTJ4eibKItl61J/yZ+in TK0bC9eKrauXd3MZDUSM49YGvhp6PaWjebFeT77oRkhPvSh5suysnqF7O5hczD+w/J8tOCakaVr IEYXUx+60lFHt9cAwf4LApwXzcG4p1w+94atdHaxoYIrU8aQ+DigZBQJvBjlD6DuZ3COjrnoW0N kKZgEnW3LgNyHejuiQwymtxuJ6y0= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--4.962600-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568105588-f2l4sKRox9N4 Subject: [dpdk-dev] [PATCH 2/7] app/testpmd: check status of getting MAC address 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 Add a wrapper for rte_eth_macaddr_get() that prints an error and returns a status code if the function fails. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- app/test-pmd/config.c | 14 +++++++++----- app/test-pmd/testpmd.c | 13 +++++++++---- app/test-pmd/testpmd.h | 2 ++ app/test-pmd/util.c | 13 +++++++++++++ 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 33a4e9827..957c61fbe 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -454,9 +454,11 @@ device_infos_display(const char *identifier) /* List ports with matching device name */ RTE_ETH_FOREACH_DEV_OF(port_id, dev) { - rte_eth_macaddr_get(port_id, &mac_addr); printf("\n\tPort id: %-2d", port_id); - print_ethaddr("\n\tMAC address: ", &mac_addr); + if (eth_macaddr_get_print_err(port_id, + &mac_addr) == 0) + print_ethaddr("\n\tMAC address: ", + &mac_addr); rte_eth_dev_get_name_by_port(port_id, name); printf("\n\tDevice name: %s", name); printf("\n"); @@ -494,8 +496,8 @@ port_infos_display(portid_t port_id) printf("\n%s Infos for port %-2d %s\n", info_border, port_id, info_border); - rte_eth_macaddr_get(port_id, &mac_addr); - print_ethaddr("MAC address: ", &mac_addr); + if (eth_macaddr_get_print_err(port_id, &mac_addr) == 0) + print_ethaddr("MAC address: ", &mac_addr); rte_eth_dev_get_name_by_port(port_id, name); printf("\nDevice name: %s", name); printf("\nDriver name: %s", dev_info.driver_name); @@ -646,7 +648,9 @@ port_summary_display(portid_t port_id) return; rte_eth_dev_get_name_by_port(port_id, name); - rte_eth_macaddr_get(port_id, &mac_addr); + ret = eth_macaddr_get_print_err(port_id, &mac_addr); + if (ret != 0) + return; printf("%-4d %02X:%02X:%02X:%02X:%02X:%02X %-12s %-14s %-8s %uMbps\n", port_id, mac_addr.addr_bytes[0], mac_addr.addr_bytes[1], diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 0f6e27962..1e3dc44a1 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2209,8 +2209,8 @@ start_port(portid_t pid) RTE_PORT_HANDLING, RTE_PORT_STARTED) == 0) printf("Port %d can not be set into started\n", pi); - rte_eth_macaddr_get(pi, &mac_addr); - printf("Port %d: %02X:%02X:%02X:%02X:%02X:%02X\n", pi, + if (eth_macaddr_get_print_err(pi, &mac_addr) == 0) + printf("Port %d: %02X:%02X:%02X:%02X:%02X:%02X\n", pi, mac_addr.addr_bytes[0], mac_addr.addr_bytes[1], mac_addr.addr_bytes[2], mac_addr.addr_bytes[3], mac_addr.addr_bytes[4], mac_addr.addr_bytes[5]); @@ -2984,7 +2984,9 @@ init_port_config(void) rxtx_port_config(port); - rte_eth_macaddr_get(pid, &port->eth_addr); + ret = eth_macaddr_get_print_err(pid, &port->eth_addr); + if (ret != 0) + return; map_port_queue_stats_mapping_registers(pid, port); #if defined RTE_LIBRTE_IXGBE_PMD && defined RTE_LIBRTE_IXGBE_BYPASS @@ -3187,7 +3189,10 @@ init_port_dcb_config(portid_t pid, for (i = 0; i < RTE_DIM(vlan_tags); i++) rx_vft_set(pid, vlan_tags[i], 1); - rte_eth_macaddr_get(pid, &rte_port->eth_addr); + retval = eth_macaddr_get_print_err(pid, &rte_port->eth_addr); + if (retval != 0) + return retval; + map_port_queue_stats_mapping_registers(pid, rte_port); rte_port->dcb_flag = 1; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index c039e2961..f8ebe71ac 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -827,6 +827,8 @@ int eth_dev_info_get_print_err(uint16_t port_id, void eth_set_promisc_mode(uint16_t port_id, int enable); void eth_set_allmulticast_mode(uint16_t port, int enable); int eth_link_get_nowait_print_err(uint16_t port_id, struct rte_eth_link *link); +int eth_macaddr_get_print_err(uint16_t port_id, + struct rte_ether_addr *mac_addr); /* Functions to manage the set of filtered Multicast MAC addresses */ diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 6c24bf8d9..47f86a5d8 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -291,3 +291,16 @@ eth_link_get_nowait_print_err(uint16_t port_id, return ret; } + +int +eth_macaddr_get_print_err(uint16_t port_id, struct rte_ether_addr *mac_addr) +{ + int ret; + + ret = rte_eth_macaddr_get(port_id, mac_addr); + if (ret != 0) + printf("Error getting device (port %u) mac address: %s\n", + port_id, rte_strerror(-ret)); + + return ret; +} From patchwork Tue Sep 10 08:52:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59083 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D80921ED69; Tue, 10 Sep 2019 10:53:12 +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 36C4D1EBBD 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 0AD3648005F; Tue, 10 Sep 2019 08:53:07 +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:04 -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:04 -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 x8A8r3Zq024721; Tue, 10 Sep 2019 09:53:03 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id EDA3C1613D1; Tue, 10 Sep 2019 09:53:02 +0100 (BST) From: Andrew Rybchenko To: Reshma Pattan CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:52:17 +0100 Message-ID: <1568105541-7399-4-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 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24898.005 X-TM-AS-Result: No-0.742000-4.000000-10 X-TMASE-MatchedRID: b9G8HiAV2WLNQetBFGxSlJzEHTUOuMX3Y/L2/AZJAWThWjjGhpcHL1Me 5Blkpry7rdoLblq9S5qVSb9bh6Zf64zQp7mciZRIngIgpj8eDcAZ1CdBJOsoY9mzcdRxL+xwKra uXd3MZDUCSvJmQ4iQ+q7JBgYEoS+708td3gMIWTMfOpERMeSVm5iLXY7S7L7MgmXINmCYVAAYNe RtT1zBNpY8nXsPS1JTpwssfM2Yr5DAhs1woh/pKjigZBQJvBjlD6DuZ3COjrnoW0NkKZgEncpMv D+U2DDy X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--0.742000-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568105587-qr_wzV7_Fzss Subject: [dpdk-dev] [PATCH 3/7] app/pdump: check status of getting MAC address 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 The return value of rte_eth_macaddr_get() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- app/pdump/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index 9d6be8ed1..903d02f48 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -606,7 +606,10 @@ configure_vdev(uint16_t port_id) if (ret < 0) rte_exit(EXIT_FAILURE, "dev start failed\n"); - rte_eth_macaddr_get(port_id, &addr); + ret = rte_eth_macaddr_get(port_id, &addr); + if (ret != 0) + rte_exit(EXIT_FAILURE, "macaddr get failed\n"); + printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", port_id, From patchwork Tue Sep 10 08:52:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59085 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 83D921EE27; Tue, 10 Sep 2019 10:53:18 +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 57FDB1EBC2 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 34A0B48005F; Tue, 10 Sep 2019 08:53:07 +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:04 -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:04 -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 x8A8r3vb024729; Tue, 10 Sep 2019 09:53:03 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 65AA71613D1; Tue, 10 Sep 2019 09:53:03 +0100 (BST) From: Andrew Rybchenko To: Nikhil Rao CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:52:18 +0100 Message-ID: <1568105541-7399-5-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 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24898.005 X-TM-AS-Result: No-1.013400-4.000000-10 X-TMASE-MatchedRID: 3VvmmxedNeLNQetBFGxSlJzEHTUOuMX3Y/L2/AZJAWSYkF7ZtFfCU3a+ ugDVDnv+eTDIGcrB15AJwgMHF6GFiSHhSBQfglfsA9lly13c/gE4QBHfUycCCGtEzrC9eANpDYo fQuAXb7jqo5wffCoKgIAy6p60ZV62fJ5/bZ6npdiujVRFkkVsmzmKJhoOaMS7kvqYQfxjtRkf2s 6oDK0i0F6VPd7JuLQ87buK+9JzMU8pYsSMjENFM5zbGkm6Gx55EM3insA3blc4xn/BsBDa/fDsn HBTQS9kyoRE4tv/7I7j/Qm+fSvAAma0vgPD7M1vmFd/HOChTo8= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.013400-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568105587-m4VuPUX1kieA Subject: [dpdk-dev] [PATCH 4/7] app/test: check status of getting MAC address 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 The return value of rte_eth_macaddr_get() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- app/test/test_event_eth_rx_adapter.c | 4 +++- app/test/test_event_eth_tx_adapter.c | 4 +++- app/test/test_pmd_perf.c | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c index 6254fcd33..dd3bce71b 100644 --- a/app/test/test_event_eth_rx_adapter.c +++ b/app/test/test_event_eth_rx_adapter.c @@ -81,7 +81,9 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf, /* Display the port MAC address. */ struct rte_ether_addr addr; - 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", (unsigned int)port, diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c index 73f6afea2..3af749280 100644 --- a/app/test/test_event_eth_tx_adapter.c +++ b/app/test/test_event_eth_tx_adapter.c @@ -85,7 +85,9 @@ port_init_common(uint8_t port, const struct rte_eth_conf *port_conf, /* Display the port MAC address. */ struct rte_ether_addr addr; - 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", (unsigned int)port, diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 36b06ce5d..d61be58bb 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -724,7 +724,12 @@ test_pmd_perf(void) "Cannot configure device: err=%d, port=%d\n", ret, portid); - rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "Cannot get mac address: err=%d, port=%d\n", + ret, portid); + printf("Port %u ", portid); print_ethaddr("Address:", &ports_eth_addr[portid]); printf("\n"); From patchwork Tue Sep 10 08:52:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59087 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CF0071EE5B; Tue, 10 Sep 2019 10:53:22 +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 829621EB66 for ; Tue, 10 Sep 2019 10:53:09 +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-us4.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 1214ABC006A; Tue, 10 Sep 2019 08:53:08 +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:05 -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:04 -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 x8A8r3Ll024737; Tue, 10 Sep 2019 09:53:03 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id B36E01613D1; Tue, 10 Sep 2019 09:53:03 +0100 (BST) From: Andrew Rybchenko To: Chas Williams CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:52:19 +0100 Message-ID: <1568105541-7399-6-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 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24898.005 X-TM-AS-Result: No-1.925300-4.000000-10 X-TMASE-MatchedRID: Wn2D/DSOcBHNQetBFGxSlJzEHTUOuMX3Y/L2/AZJAWSYkF7ZtFfCU2ah 6lYlTZIZfGzuoVn0Vs6PQi9XuOWoOOG1W8jesiDJimHWEC28pk34uJ1REX4MHe5vmGkDDWSWEvf XVFdC2JIvvcHel1iRalRTz4CURzaWyGOiXr1rOL51e7Xbb6Im2g5E5zpXZv3GHApIKLQpe4RWkj /w6AJ3hF7TlACxZgxSgB7vXQad2cLXQbkPFHZM3xo8wYJxWb0ONV9S7O+u3KZt/CaXU0F5uXnUb FaXoymeNiFFPm3DVxhV+9a+ZVGpWR8TzIzimOwPbdTuPa9VRGvEQdG7H66TyJ8TMnmE+d0Z2LUp FDWWJmWPav2k2krYqeiysnWhGSmAXXOjXMVXuN80whpgaPRradc2wK89n8uIr2W5Xbwvu1uD6Wy 1q4QyENAUlPjzyh2Zk3UkV5Qp4wSI45Rd9ORJwFlJvEhEss3fvN+d4ahMo5NWXGvUUmKP2w== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.925300-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568105588-PWz9mIn8r6Ns Subject: [dpdk-dev] [PATCH 5/7] app/test: check status of getting MAC address in bonding 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 The return value of rte_eth_macaddr_get() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- app/test/test_link_bonding.c | 304 +++++++++++++++++++++-------- app/test/test_link_bonding_mode4.c | 14 +- 2 files changed, 237 insertions(+), 81 deletions(-) diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index d0d6fc23d..a9b9d0c42 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -399,9 +399,11 @@ test_remove_slave_from_bonded_device(void) mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = test_params->bonded_slave_count-1; - rte_eth_macaddr_get( + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get( test_params->slave_port_ids[test_params->bonded_slave_count-1], - &read_mac_addr); + &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[test_params->bonded_slave_count-1]); TEST_ASSERT_SUCCESS(memcmp(mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "bonded port mac address not set to that of primary port\n"); @@ -763,13 +765,17 @@ test_set_primary_slave(void) expected_mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = i; /* Check primary slave MAC */ - rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(expected_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "bonded port mac address not set to that of primary port\n"); /* Check bonded MAC */ - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&read_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "bonded port mac address not set to that of primary port\n"); @@ -777,8 +783,10 @@ test_set_primary_slave(void) /* Check other slaves MACs */ for (j = 0; j < 4; j++) { if (j != i) { - rte_eth_macaddr_get(test_params->slave_port_ids[j], - &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[j], + &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[j]); TEST_ASSERT_SUCCESS(memcmp(expected_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port mac address not set to that of primary " @@ -843,13 +851,17 @@ test_set_explicit_bonded_mac(void) } /* Check bonded MAC */ - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "bonded port mac address not set to that of primary port"); /* Check other slaves MACs */ for (i = 0; i < 4; i++) { - rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port mac address not set to that of primary port"); @@ -973,24 +985,32 @@ test_set_bonded_port_initialization_mac_assignment(void) slave_port_ids[i], 1); } - rte_eth_macaddr_get(bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "bonded port mac address not as expected"); - rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 0 mac address not as expected"); slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; - rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 1 mac address not as expected"); slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 2 + 100; - rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr), + "Failed to get mac address (port %d)", + slave_port_ids[2]); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 2 mac address not as expected"); @@ -1009,24 +1029,32 @@ test_set_bonded_port_initialization_mac_assignment(void) "Failed to start bonded pmd eth device %d.", bonded_port_id); - rte_eth_macaddr_get(bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "bonded port mac address not as expected"); slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 0 + 100; - rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 0 mac address not as expected"); slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; - rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 1 mac address not as expected"); - rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr), + "Failed to get mac address (port %d)", + slave_port_ids[2]); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 2 mac address not as expected"); @@ -1052,19 +1080,25 @@ test_set_bonded_port_initialization_mac_assignment(void) slave_count, 0); slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 0 + 100; - rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 0 mac address not as expected"); slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; - rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 1 mac address not as expected"); slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 2 + 100; - rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr), + "Failed to get mac address (port %d)", + slave_port_ids[2]); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 2 mac address not as expected"); @@ -1688,8 +1722,12 @@ test_roundrobin_verify_mac_assignment(void) int i; - rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); - rte_eth_macaddr_get(test_params->slave_port_ids[2], &expected_mac_addr_2); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[2], &expected_mac_addr_2), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[2]); /* Initialize bonded device with 4 slaves in round robin mode */ TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( @@ -1698,7 +1736,9 @@ test_roundrobin_verify_mac_assignment(void) /* Verify that all MACs are the same as first slave added to bonded dev */ for (i = 0; i < test_params->bonded_slave_count; i++) { - rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", @@ -1712,7 +1752,9 @@ test_roundrobin_verify_mac_assignment(void) test_params->bonded_port_id, test_params->slave_port_ids[i]); for (i = 0; i < test_params->bonded_slave_count; i++) { - rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address has changed to that of primary" @@ -1727,14 +1769,18 @@ test_roundrobin_verify_mac_assignment(void) TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id), "Failed to start bonded device"); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS( memcmp(&expected_mac_addr_2, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of new primary port", test_params->slave_port_ids[i]); for (i = 0; i < test_params->bonded_slave_count; i++) { - rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_2, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of new primary" @@ -1747,14 +1793,18 @@ test_roundrobin_verify_mac_assignment(void) (struct rte_ether_addr *)bonded_mac), "Failed to set MAC"); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of new primary port", test_params->slave_port_ids[i]); for (i = 0; i < test_params->bonded_slave_count; i++) { - rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to" " that of new primary port\n", test_params->slave_port_ids[i]); @@ -2278,8 +2328,12 @@ test_activebackup_verify_mac_assignment(void) struct rte_ether_addr read_mac_addr; struct rte_ether_addr expected_mac_addr_0, expected_mac_addr_1; - rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); /* Initialize bonded device with 2 slaves in active backup mode */ TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( @@ -2288,19 +2342,25 @@ test_activebackup_verify_mac_assignment(void) /* Verify that bonded MACs is that of first slave and that the other slave * MAC hasn't been changed */ - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", test_params->slave_port_ids[0]); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not as expected", @@ -2312,19 +2372,25 @@ test_activebackup_verify_mac_assignment(void) "Failed to set bonded port (%d) primary port to (%d)", test_params->bonded_port_id, test_params->slave_port_ids[1]); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", test_params->slave_port_ids[0]); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not as expected", @@ -2338,19 +2404,25 @@ test_activebackup_verify_mac_assignment(void) TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id), "Failed to start device"); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not as expected", test_params->slave_port_ids[0]); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", @@ -2362,19 +2434,25 @@ test_activebackup_verify_mac_assignment(void) (struct rte_ether_addr *)bonded_mac), "failed to set MAC address"); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of bonded port", test_params->bonded_port_id); - rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not as expected", test_params->slave_port_ids[0]); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of bonded port", @@ -3181,8 +3259,12 @@ test_balance_verify_mac_assignment(void) struct rte_ether_addr read_mac_addr; struct rte_ether_addr expected_mac_addr_0, expected_mac_addr_1; - rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); /* Initialize bonded device with 2 slaves in active backup mode */ TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( @@ -3191,19 +3273,25 @@ test_balance_verify_mac_assignment(void) /* Verify that bonded MACs is that of first slave and that the other slave * MAC hasn't been changed */ - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", test_params->slave_port_ids[0]); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", @@ -3215,19 +3303,25 @@ test_balance_verify_mac_assignment(void) "Failed to set bonded port (%d) primary port to (%d)\n", test_params->bonded_port_id, test_params->slave_port_ids[1]); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", test_params->slave_port_ids[0]); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", @@ -3241,19 +3335,25 @@ test_balance_verify_mac_assignment(void) TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id), "Failed to start bonded device"); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", test_params->slave_port_ids[0]); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", @@ -3265,19 +3365,25 @@ test_balance_verify_mac_assignment(void) (struct rte_ether_addr *)bonded_mac), "failed to set MAC"); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of bonded port", test_params->bonded_port_id); - rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not as expected\n", test_params->slave_port_ids[0]); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of bonded port", @@ -3777,8 +3883,12 @@ test_broadcast_verify_mac_assignment(void) int i; - rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); - rte_eth_macaddr_get(test_params->slave_port_ids[2], &expected_mac_addr_1); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[2], &expected_mac_addr_1), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[2]); /* Initialize bonded device with 4 slaves in round robin mode */ TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( @@ -3788,7 +3898,9 @@ test_broadcast_verify_mac_assignment(void) /* Verify that all MACs are the same as first slave added to bonded * device */ for (i = 0; i < test_params->bonded_slave_count; i++) { - rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", @@ -3802,7 +3914,9 @@ test_broadcast_verify_mac_assignment(void) test_params->bonded_port_id, test_params->slave_port_ids[i]); for (i = 0; i < test_params->bonded_slave_count; i++) { - rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address has changed to that of primary " @@ -3818,14 +3932,18 @@ test_broadcast_verify_mac_assignment(void) TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id), "Failed to start bonded device"); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of new primary port", test_params->slave_port_ids[i]); for (i = 0; i < test_params->bonded_slave_count; i++) { - rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of new primary " @@ -3838,7 +3956,9 @@ test_broadcast_verify_mac_assignment(void) (struct rte_ether_addr *)bonded_mac), "Failed to set MAC address"); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of new primary port", @@ -3846,7 +3966,9 @@ test_broadcast_verify_mac_assignment(void) for (i = 0; i < test_params->bonded_slave_count; i++) { - rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[i]); TEST_ASSERT_SUCCESS(memcmp(bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of new primary " @@ -4274,8 +4396,12 @@ test_tlb_verify_mac_assignment(void) struct rte_ether_addr read_mac_addr; struct rte_ether_addr expected_mac_addr_0, expected_mac_addr_1; - rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); /* Initialize bonded device with 2 slaves in active backup mode */ TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves( @@ -4284,19 +4410,25 @@ test_tlb_verify_mac_assignment(void) /* Verify that bonded MACs is that of first slave and that the other slave * MAC hasn't been changed */ - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", test_params->slave_port_ids[0]); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not as expected", @@ -4308,19 +4440,25 @@ test_tlb_verify_mac_assignment(void) "Failed to set bonded port (%d) primary port to (%d)", test_params->bonded_port_id, test_params->slave_port_ids[1]); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", test_params->slave_port_ids[0]); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not as expected", @@ -4334,19 +4472,25 @@ test_tlb_verify_mac_assignment(void) TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id), "Failed to start device"); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of primary port", test_params->bonded_port_id); - rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not as expected", test_params->slave_port_ids[0]); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_1, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of primary port", @@ -4359,19 +4503,25 @@ test_tlb_verify_mac_assignment(void) (struct rte_ether_addr *)bonded_mac), "failed to set MAC address"); - rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->bonded_port_id); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "bonded port (%d) mac address not set to that of bonded port", test_params->bonded_port_id); - rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[0], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[0]); TEST_ASSERT_SUCCESS(memcmp(&expected_mac_addr_0, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not as expected", test_params->slave_port_ids[0]); - rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr); + TEST_ASSERT_SUCCESS(rte_eth_macaddr_get(test_params->slave_port_ids[1], &read_mac_addr), + "Failed to get mac address (port %d)", + test_params->slave_port_ids[1]); TEST_ASSERT_SUCCESS(memcmp(&bonded_mac, &read_mac_addr, sizeof(read_mac_addr)), "slave port (%d) mac address not set to that of bonded port", diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 70b95d040..ff54d7b91 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -225,6 +225,7 @@ static int add_slave(struct slave_conf *slave, uint8_t start) { struct rte_ether_addr addr, addr_check; + int retval; /* Some sanity check */ RTE_VERIFY(test_params.slave_ports <= slave && @@ -252,7 +253,9 @@ add_slave(struct slave_conf *slave, uint8_t start) "Failed to start slave %u", slave->port_id); } - rte_eth_macaddr_get(slave->port_id, &addr_check); + retval = rte_eth_macaddr_get(slave->port_id, &addr_check); + TEST_ASSERT_SUCCESS(retval, "Failed to get slave mac address: %s", + strerror(-retval)); TEST_ASSERT_EQUAL(rte_is_same_ether_addr(&addr, &addr_check), 1, "Slave MAC address is not as expected"); @@ -816,7 +819,9 @@ test_mode4_rx(void) retval = bond_handshake(); TEST_ASSERT_SUCCESS(retval, "Initial handshake failed"); - rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac); + retval = rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac); + TEST_ASSERT_SUCCESS(retval, "Failed to get mac address: %s", + strerror(-retval)); rte_ether_addr_copy(&bonded_mac, &dst_mac); /* Assert that dst address is not bonding address. Do not set the @@ -1002,8 +1007,9 @@ test_mode4_tx_burst(void) retval = bond_handshake(); TEST_ASSERT_SUCCESS(retval, "Initial handshake failed"); - rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac); - + retval = rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac); + TEST_ASSERT_SUCCESS(retval, "Failed to get mac address: %s", + strerror(-retval)); /* Prepare burst */ for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) { dst_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = pkts_cnt; From patchwork Tue Sep 10 08:52:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59089 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 079271EF2B; Tue, 10 Sep 2019 10:53:26 +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 C4D011EB66 for ; Tue, 10 Sep 2019 10:53:10 +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 337DEB40057; Tue, 10 Sep 2019 08:53:09 +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:06 -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:05 -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 x8A8r4Oe024747; Tue, 10 Sep 2019 09:53:04 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 94F6D1613D1; Tue, 10 Sep 2019 09:53:04 +0100 (BST) From: Andrew Rybchenko To: Nicolas Chautru , David Hunt , Marko Kovacevic , Ori Kam , Bruce Richardson , "Pablo de Lara" , Radu Nicolau , Akhil Goyal , Tomasz Kantecki , Harry van Haaren , Bernard Iremonger , Konstantin Ananyev , Cristian Dumitrescu , Ferruh Yigit , Declan Doherty , Anatoly Burakov , Reshma Pattan , "John McNamara" , Xiaoyun Li , "Byron Marohn" , Maxime Coquelin , Tiwei Bie , Zhihong Wang CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:52:20 +0100 Message-ID: <1568105541-7399-7-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 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24898.005 X-TM-AS-Result: No-3.184100-4.000000-10 X-TMASE-MatchedRID: EFjG5YUonrrNQetBFGxSlJzEHTUOuMX3Y/L2/AZJAWThWjjGhpcHL/g6 LXb1p9ONtUwBxC2gbtu8xfjW6NxdqLSjhdlVDD2OBi0Si9jXsY3VAbSP+BxqRAaYevV4zG3ZBX9 XF9Y8qoAqivK4V2+glyxj3HPErAuEcj8zE1EjtSR1e7Xbb6Im2uRjZuXE0WlHUmrBgJDUGKyi6E ixPwQMWeSQpA3wC9vBihlKDlLlrvK39BLh6Bkc7oph1hAtvKZNTJYvCNRUoW7wJYZa/L83HU8fY 4SH/55skslAOlRjyt81RmHEdpg+NXmWgSzuxA1Sx5sgyUhLCNunU+NxqV3DDcNWm4M1rA2m+WAX 4qDxTxHJhrW9YuOg0fHfq07sOgP2qnqPx90CnBVhXXywTJLpfENWaKIdBIV4GDt/hPCfr1bGXVT aHB60jwpr4p4pYh/K+col1/2+awUkvWcS9N/WB+hsg0dmQfnGIVx4lWxn7mP2u2oLJUFmGJt+dM PP5rY5FN+uwVQcBUmAMuqetGVetksDkkP3zIjq3QfwsVk0UbvqwGfCk7KUs9CZEhCDqhZ2GdI7H c5mNMw55KKUBq9VgK2hzqA4VPGLV4nLRbzz1BTDbqf9UK9uUgE1dsJuKSskMTPcBGGexf89N4md 5g6Ppw9cvEd/Et5dVEc5IqztENReYfSkFq6uAb7jE6+wkCSeftwZ3X11IV0= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--3.184100-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568105590-TSFRuddou8hw Subject: [dpdk-dev] [PATCH 6/7] examples: check status of getting MAC address 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 The return value of rte_eth_macaddr_get() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- examples/bbdev_app/main.c | 8 +++++++- examples/distributor/main.c | 8 +++++++- examples/ethtool/ethtool-app/main.c | 18 ++++++++++++++++-- examples/ethtool/lib/rte_ethtool.c | 7 ++++++- examples/eventdev_pipeline/main.c | 8 +++++++- examples/flow_classify/flow_classify.c | 5 ++++- examples/ip_fragmentation/main.c | 9 ++++++++- examples/ip_pipeline/cli.c | 8 +++++++- examples/ip_reassembly/main.c | 9 ++++++++- examples/ipsec-secgw/ipsec-secgw.c | 7 ++++++- examples/ipv4_multicast/main.c | 7 ++++++- examples/kni/main.c | 6 +++++- examples/l2fwd-cat/l2fwd-cat.c | 5 ++++- examples/l2fwd-crypto/main.c | 8 +++++++- examples/l2fwd-jobstats/main.c | 7 ++++++- examples/l2fwd-keepalive/main.c | 7 ++++++- examples/l2fwd/main.c | 7 ++++++- examples/l3fwd-acl/main.c | 7 ++++++- examples/l3fwd-power/main.c | 7 ++++++- examples/l3fwd-vf/main.c | 7 ++++++- examples/l3fwd/main.c | 7 ++++++- examples/link_status_interrupt/main.c | 6 +++++- .../client_server_mp/mp_server/main.c | 8 +++++++- examples/packet_ordering/main.c | 8 +++++++- .../performance-thread/l3fwd-thread/main.c | 7 ++++++- examples/ptpclient/ptpclient.c | 11 ++++++++++- examples/quota_watermark/qw/main.c | 10 +++++++++- examples/rxtx_callbacks/main.c | 7 ++++++- examples/server_node_efd/server/main.c | 9 ++++++++- examples/skeleton/basicfwd.c | 5 ++++- examples/tep_termination/vxlan_setup.c | 5 ++++- examples/vhost/main.c | 9 ++++++++- examples/vm_power_manager/guest_cli/main.c | 11 +++++++++-- .../guest_cli/vm_power_cli_guest.c | 17 ++++++++++++++--- .../guest_cli/vm_power_cli_guest.h | 2 +- examples/vm_power_manager/main.c | 8 +++++++- examples/vmdq/main.c | 7 ++++++- examples/vmdq_dcb/main.c | 7 ++++++- 38 files changed, 257 insertions(+), 42 deletions(-) diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index 349876589..fb38dc3a7 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -490,7 +490,13 @@ initialize_ports(struct app_config_params *app_params, return ret; } - rte_eth_macaddr_get(port_id, &bbdev_port_eth_addr); + ret = rte_eth_macaddr_get(port_id, &bbdev_port_eth_addr); + if (ret < 0) { + printf("rte_eth_macaddr_get: err=%d, queue=%u\n", + ret, q); + return -1; + } + print_mac(port_id, &bbdev_port_eth_addr); return 0; diff --git a/examples/distributor/main.c b/examples/distributor/main.c index 49b4e611f..567c5e989 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -192,7 +192,13 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) } struct rte_ether_addr addr; - rte_eth_macaddr_get(port, &addr); + retval = rte_eth_macaddr_get(port, &addr); + if (retval < 0) { + printf("Failed to get MAC address (port %u): %s\n", + port, rte_strerror(-retval)); + return retval; + } + printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", port, diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c index 774df7eb1..29891012a 100644 --- a/examples/ethtool/ethtool-app/main.c +++ b/examples/ethtool/ethtool-app/main.c @@ -156,7 +156,12 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports) "%s:%i: rte_eth_dev_start failed", __FILE__, __LINE__ ); - rte_eth_macaddr_get(idx_port, &ptr_port->mac_addr); + ret = rte_eth_macaddr_get(idx_port, &ptr_port->mac_addr); + if (ret != 0) + rte_exit(EXIT_FAILURE, + "rte_eth_macaddr_get failed (port %u): %s\n", + idx_port, rte_strerror(-ret)); + rte_spinlock_init(&ptr_port->lock); } } @@ -182,6 +187,7 @@ static int slave_main(__attribute__((unused)) void *ptr_data) uint16_t cnt_sent; uint16_t idx_port; uint16_t lock_result; + int ret; while (app_cfg.exit_now == 0) { for (idx_port = 0; idx_port < app_cfg.cnt_ports; idx_port++) { @@ -198,8 +204,16 @@ static int slave_main(__attribute__((unused)) void *ptr_data) /* MAC address was updated */ if (ptr_port->port_dirty == 1) { - rte_eth_macaddr_get(ptr_port->idx_port, + ret = rte_eth_macaddr_get(ptr_port->idx_port, &ptr_port->mac_addr); + if (ret != 0) { + rte_spinlock_unlock(&ptr_port->lock); + printf("Failed to get MAC address (port %u): %s", + ptr_port->idx_port, + rte_strerror(-ret)); + return ret; + } + ptr_port->port_dirty = 0; } diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index 8393b0d60..667d7eaf2 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -314,10 +314,15 @@ rte_ethtool_net_stop(uint16_t port_id) int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct rte_ether_addr *addr) { + int ret; + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); if (addr == NULL) return -EINVAL; - rte_eth_macaddr_get(port_id, addr); + + ret = rte_eth_macaddr_get(port_id, addr); + if (ret != 0) + return ret; return 0; } diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c index c734c7750..f77830282 100644 --- a/examples/eventdev_pipeline/main.c +++ b/examples/eventdev_pipeline/main.c @@ -324,7 +324,13 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) /* Display the port MAC address. */ struct rte_ether_addr addr; - rte_eth_macaddr_get(port, &addr); + retval = rte_eth_macaddr_get(port, &addr); + if (retval != 0) { + printf("Failed to get MAC address (port %u): %s\n", + port, rte_strerror(-retval)); + return retval; + } + printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", (unsigned int)port, diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index ae0faf621..1c12bbb2f 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -242,7 +242,10 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) 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/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index f90edc5a2..104612339 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -992,7 +992,14 @@ main(int argc, char **argv) ret, portid); } - rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + if (ret < 0) { + printf("\n"); + rte_exit(EXIT_FAILURE, + "rte_eth_macaddr_get: err=%d, port=%d\n", + ret, portid); + } + print_ethaddr(" Address:", &ports_eth_addr[portid]); printf("\n"); diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index 4930310cc..02dc11495 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -253,7 +253,13 @@ print_link_info(struct link *link, char *out, size_t out_size) memset(&stats, 0, sizeof(stats)); rte_eth_stats_get(link->port_id, &stats); - rte_eth_macaddr_get(link->port_id, &mac_addr); + ret = rte_eth_macaddr_get(link->port_id, &mac_addr); + if (ret != 0) { + snprintf(out, out_size, "\n%s: MAC address get failed: %s", + link->name, rte_strerror(-ret)); + return; + } + ret = rte_eth_link_get(link->port_id, ð_link); if (ret < 0) { snprintf(out, out_size, "\n%s: link get failed: %s", diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index c822c8c58..d59e6d02f 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -1132,7 +1132,14 @@ main(int argc, char **argv) ret, portid); } - rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + if (ret < 0) { + printf("\n"); + rte_exit(EXIT_FAILURE, + "rte_eth_macaddr_get: err=%d, port=%d\n", + ret, portid); + } + print_ethaddr(" Address:", &ports_eth_addr[portid]); printf("\n"); diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 2520e5108..5514f4ba5 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1931,7 +1931,12 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) printf("Configuring device port %u:\n", portid); - rte_eth_macaddr_get(portid, ðaddr); + ret = rte_eth_macaddr_get(portid, ðaddr); + if (ret != 0) + rte_exit(EXIT_FAILURE, + "Error getting MAC address (port %u): %s\n", + portid, rte_strerror(-ret)); + ethaddr_tbl[portid].src = ETHADDR_TO_UINT64(ðaddr); print_ethaddr("Address: ", ðaddr); printf("\n"); diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 6b165f2f0..63333b5b6 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -739,7 +739,12 @@ main(int argc, char **argv) "Cannot adjust number of descriptors: err=%d, port=%d\n", ret, portid); - rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "Cannot get MAC address: err=%d, port=%d\n", + ret, portid); + print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); diff --git a/examples/kni/main.c b/examples/kni/main.c index 8eb5b610e..c576fc767 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -940,8 +940,12 @@ kni_alloc(uint16_t port_id) port_id, strerror(-ret)); /* Get the interface default mac address */ - rte_eth_macaddr_get(port_id, + ret = rte_eth_macaddr_get(port_id, (struct rte_ether_addr *)&conf.mac_addr); + if (ret != 0) + rte_exit(EXIT_FAILURE, + "Failed to get MAC address (port %u): %s\n", + port_id, rte_strerror(-ret)); rte_eth_dev_get_mtu(port_id, &conf.mtu); diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c index b15f0330b..6838f288c 100644 --- a/examples/l2fwd-cat/l2fwd-cat.c +++ b/examples/l2fwd-cat/l2fwd-cat.c @@ -74,7 +74,10 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) /* Display the port MAC address. */ struct rte_ether_addr addr; - 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/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 7c84b40ff..61d78295d 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -2589,7 +2589,13 @@ initialize_ports(struct l2fwd_crypto_options *options) return -1; } - rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]); + retval = rte_eth_macaddr_get(portid, + &l2fwd_ports_eth_addr[portid]); + if (retval < 0) { + printf("rte_eth_macaddr_get :err=%d, port=%u\n", + retval, portid); + return -1; + } printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n", portid, diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 4f930d097..f975aa12d 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -872,7 +872,12 @@ main(int argc, char **argv) "Cannot adjust number of descriptors: err=%d, port=%u\n", ret, portid); - rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]); + ret = rte_eth_macaddr_get(portid, + &l2fwd_ports_eth_addr[portid]); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "Cannot get MAC address: err=%d, port=%u\n", + ret, portid); /* init one RX queue */ fflush(stdout); diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 21278eed7..b36834974 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -665,7 +665,12 @@ main(int argc, char **argv) "Cannot adjust number of descriptors: err=%d, port=%u\n", ret, portid); - rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]); + ret = rte_eth_macaddr_get(portid, + &l2fwd_ports_eth_addr[portid]); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "Cannot mac address: err=%d, port=%u\n", + ret, portid); /* init one RX queue */ fflush(stdout); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 6b9f09a4d..d7bcbfae7 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -665,7 +665,12 @@ main(int argc, char **argv) "Cannot adjust number of descriptors: err=%d, port=%u\n", ret, portid); - rte_eth_macaddr_get(portid,&l2fwd_ports_eth_addr[portid]); + ret = rte_eth_macaddr_get(portid, + &l2fwd_ports_eth_addr[portid]); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "Cannot get MAC address: err=%d, port=%u\n", + ret, portid); /* init one RX queue */ fflush(stdout); diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 0abb8cb5e..fa92a2829 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -1968,7 +1968,12 @@ main(int argc, char **argv) "rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%d\n", ret, portid); - rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "rte_eth_macaddr_get: err=%d, port=%d\n", + ret, portid); + print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 2e3b1d3c6..a03f64a1a 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -2323,7 +2323,12 @@ main(int argc, char **argv) "Cannot adjust number of descriptors: err=%d, port=%d\n", ret, portid); - rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "Cannot get MAC address: err=%d, port=%d\n", + ret, portid); + print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 572e74cf5..ff6c9e2f1 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -985,7 +985,12 @@ main(int argc, char **argv) "Cannot adjust number of descriptors: err=%d, port=%d\n", ret, portid); - rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "Cannot get MAC address: err=%d, port=%d\n", + ret, portid); + print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 7253acac4..4dea12a65 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -917,7 +917,12 @@ main(int argc, char **argv) "Cannot adjust number of descriptors: err=%d, " "port=%d\n", ret, portid); - rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "Cannot get MAC address: err=%d, port=%d\n", + ret, portid); + print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); print_ethaddr("Destination:", diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index a0b75d9f6..a924aa231 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -657,8 +657,12 @@ main(int argc, char **argv) rte_eth_dev_callback_register(portid, RTE_ETH_EVENT_INTR_LSC, lsi_event_callback, NULL); - rte_eth_macaddr_get(portid, + ret = rte_eth_macaddr_get(portid, &lsi_ports_eth_addr[portid]); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "rte_eth_macaddr_get: err=%d, port=%u\n", + ret, (unsigned int)portid); /* init one RX queue */ fflush(stdout); diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c index 015053370..802e29d10 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -61,12 +61,18 @@ get_printable_mac_addr(uint16_t port) { static const char err_address[] = "00:00:00:00:00:00"; static char addresses[RTE_MAX_ETHPORTS][sizeof(err_address)]; + int ret; if (unlikely(port >= RTE_MAX_ETHPORTS)) return err_address; if (unlikely(addresses[port][0]=='\0')){ struct rte_ether_addr mac; - rte_eth_macaddr_get(port, &mac); + ret = rte_eth_macaddr_get(port, &mac); + if (ret != 0) { + printf("Failed to get MAC address (port %u): %s\n", + port, rte_strerror(-ret)); + return err_address; + } snprintf(addresses[port], sizeof(addresses[port]), "%02x:%02x:%02x:%02x:%02x:%02x\n", mac.addr_bytes[0], mac.addr_bytes[1], mac.addr_bytes[2], diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c index 132f582a9..b397b318e 100644 --- a/examples/packet_ordering/main.c +++ b/examples/packet_ordering/main.c @@ -322,7 +322,13 @@ configure_eth_port(uint16_t port_id) if (ret < 0) return ret; - rte_eth_macaddr_get(port_id, &addr); + ret = rte_eth_macaddr_get(port_id, &addr); + if (ret != 0) { + printf("Failed to get MAC address (port %u): %s\n", + port_id, rte_strerror(-ret)); + return ret; + } + printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", port_id, diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index de0521922..122c63244 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -3602,7 +3602,12 @@ main(int argc, char **argv) "rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%d\n", ret, portid); - rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + ret = rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "rte_eth_macaddr_get: err=%d, port=%d\n", + ret, portid); + print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); print_ethaddr("Destination:", diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 6e273f644..a1a7ae699 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -378,6 +378,7 @@ static void parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) { struct rte_ether_hdr *eth_hdr; + struct rte_ether_addr eth_addr; struct ptp_header *ptp_hdr; struct clock_id *client_clkid; struct ptp_message *ptp_msg; @@ -387,6 +388,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) size_t pkt_size; int wait_us; struct rte_mbuf *m = ptp_data->m; + int ret; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) @@ -407,6 +409,13 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) (((uint64_t)ntohs(origin_tstamp->sec_msb)) << 32); if (ptp_data->seqID_FOLLOWUP == ptp_data->seqID_SYNC) { + ret = rte_eth_macaddr_get(ptp_data->portid, ð_addr); + if (ret != 0) { + printf("\nCore %u: port %u failed to get MAC address: %s\n", + rte_lcore_id(), ptp_data->portid, + rte_strerror(-ret)); + return; + } created_pkt = rte_pktmbuf_alloc(mbuf_pool); pkt_size = sizeof(struct rte_ether_hdr) + @@ -414,7 +423,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); - rte_eth_macaddr_get(ptp_data->portid, ð_hdr->s_addr); + rte_ether_addr_copy(ð_addr, ð_hdr->s_addr); /* Set multicast address 01-1B-19-00-00-00. */ rte_ether_addr_copy(ð_multicast, ð_hdr->d_addr); diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index a61360b99..c985eed24 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -52,11 +52,20 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) struct ether_fc_frame *pause_frame; struct rte_ether_hdr *hdr; struct rte_ether_addr mac_addr; + int ret; RTE_LOG_DP(DEBUG, USER1, "Sending PAUSE frame (duration=%d) on port %d\n", duration, port_id); + ret = rte_eth_macaddr_get(port_id, &mac_addr); + if (ret != 0) { + RTE_LOG_DP(ERR, USER1, + "Failed to get MAC address (port %u): %s\n", + port_id, rte_strerror(-ret)); + return; + } + /* Get a mbuf from the pool */ mbuf = rte_pktmbuf_alloc(mbuf_pool); if (unlikely(mbuf == NULL)) @@ -66,7 +75,6 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); pause_frame = (struct ether_fc_frame *) &hdr[1]; - rte_eth_macaddr_get(port_id, &mac_addr); rte_ether_addr_copy(&mac_addr, &hdr->s_addr); void *tmp = &hdr->d_addr.addr_bytes[0]; diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index 5d545115c..07e95e8d1 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -188,7 +188,12 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) struct rte_ether_addr addr; - rte_eth_macaddr_get(port, &addr); + retval = rte_eth_macaddr_get(port, &addr); + if (retval < 0) { + printf("Failed to get MAC address on port %u: %s\n", + port, rte_strerror(-retval)); + return retval; + } printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", (unsigned)port, diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c index 7b4657e42..455bdc063 100644 --- a/examples/server_node_efd/server/main.c +++ b/examples/server_node_efd/server/main.c @@ -69,11 +69,18 @@ get_printable_mac_addr(uint16_t port) static const char err_address[] = "00:00:00:00:00:00"; static char addresses[RTE_MAX_ETHPORTS][sizeof(err_address)]; struct rte_ether_addr mac; + int ret; if (unlikely(port >= RTE_MAX_ETHPORTS)) return err_address; if (unlikely(addresses[port][0] == '\0')) { - rte_eth_macaddr_get(port, &mac); + ret = rte_eth_macaddr_get(port, &mac); + if (ret != 0) { + printf("Failed to get MAC address (port %u): %s\n", + port, rte_strerror(-ret)); + return err_address; + } + snprintf(addresses[port], sizeof(addresses[port]), "%02x:%02x:%02x:%02x:%02x:%02x\n", mac.addr_bytes[0], mac.addr_bytes[1], diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c index 8f1805aeb..73d313b84 100644 --- a/examples/skeleton/basicfwd.c +++ b/examples/skeleton/basicfwd.c @@ -89,7 +89,10 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) /* Display the port MAC address. */ struct rte_ether_addr addr; - 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/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 8d6514dd8..f9f857c09 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -182,7 +182,10 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool) retval = rte_eth_dev_udp_tunnel_port_add(port, &tunnel_udp); if (retval < 0) return retval; - rte_eth_macaddr_get(port, &ports_eth_addr[port]); + retval = rte_eth_macaddr_get(port, &ports_eth_addr[port]); + if (retval < 0) + return retval; + RTE_LOG(INFO, PORT, "Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", port, diff --git a/examples/vhost/main.c b/examples/vhost/main.c index b5632d771..ab649bf14 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -346,7 +346,14 @@ port_init(uint16_t port) } } - rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]); + retval = rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]); + if (retval < 0) { + RTE_LOG(ERR, VHOST_PORT, + "Failed to get MAC address on port %u: %s\n", + port, rte_strerror(-retval)); + return retval; + } + RTE_LOG(INFO, VHOST_PORT, "Max virtio devices supported: %u\n", num_devices); RTE_LOG(INFO, VHOST_PORT, "Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", diff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c index 2094145eb..f63b3c988 100644 --- a/examples/vm_power_manager/guest_cli/main.c +++ b/examples/vm_power_manager/guest_cli/main.c @@ -55,7 +55,11 @@ parse_args(int argc, char **argv) int i, cnt, idx; policy = get_policy(); - set_policy_defaults(policy); + ret = set_policy_defaults(policy); + if (ret != 0) { + printf("Failed to set policy defaults\n"); + return -1; + } argvopt = argv; @@ -120,7 +124,10 @@ parse_args(int argc, char **argv) for (i = 0; i < MAX_VCPU_PER_VM; i++) { if (ports[i]) { printf("***Using port %d\n", i); - set_policy_mac(i, idx++); + if (set_policy_mac(i, idx++) != 0) { + printf("Cannot set policy MAC"); + return -1; + } } } policy->nb_mac_to_monitor = idx; diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c index 78c3aa0a1..77e54401a 100644 --- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c +++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c @@ -51,9 +51,15 @@ set_policy_mac(int port, int idx) { struct channel_packet *policy; union PFID pfid; + int ret; /* Use port MAC address as the vfid */ - rte_eth_macaddr_get(port, &pfid.addr); + ret = rte_eth_macaddr_get(port, &pfid.addr); + if (retval != 0) { + printf("Failed to get device (port %u) MAC address: %s\n", + port, rte_strerror(-retval)); + return retval; + } printf("Port %u MAC: %02" PRIx8 ":%02" PRIx8 ":%02" PRIx8 ":" "%02" PRIx8 ":%02" PRIx8 ":%02" PRIx8 "\n", @@ -66,10 +72,15 @@ set_policy_mac(int port, int idx) return 0; } -void +int set_policy_defaults(struct channel_packet *pkt) { - set_policy_mac(0, 0); + int ret; + + ret = set_policy_mac(0, 0); + if (ret != 0) + return ret; + pkt->nb_mac_to_monitor = 1; pkt->t_boost_status.tbEnabled = false; diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h index fd77f6a69..0c2cc1374 100644 --- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h +++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h @@ -15,7 +15,7 @@ struct channel_packet *get_policy(void); int set_policy_mac(int port, int idx); -void set_policy_defaults(struct channel_packet *pkt); +int set_policy_defaults(struct channel_packet *pkt); void run_cli(__attribute__((unused)) void *arg); diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index 288a2462a..02b4cc450 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -112,7 +112,13 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) /* Display the port MAC address. */ struct rte_ether_addr addr; - rte_eth_macaddr_get(port, &addr); + retval = rte_eth_macaddr_get(port, &addr); + if (retval != 0) { + printf("Failed to get device (port %u) MAC address: %s\n", + port, rte_strerror(-retval)); + return retval; + } + printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", (unsigned int)port, diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 91f9a9904..6e6fc91ec 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -276,7 +276,12 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; } - rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]); + retval = rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]); + if (retval < 0) { + printf("port %d MAC address get failed: %s\n", port, + rte_strerror(-retval)); + return retval; + } printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", (unsigned)port, diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 2122e41f5..594c4f195 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -333,7 +333,12 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; } - rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]); + retval = rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]); + if (retval < 0) { + printf("port %d MAC address get failed: %s\n", port, + rte_strerror(-retval)); + return retval; + } printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", (unsigned)port, From patchwork Tue Sep 10 08:52:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59088 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 40B741EF20; Tue, 10 Sep 2019 10:53:24 +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 311DB1EBD2 for ; Tue, 10 Sep 2019 10:53:10 +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 EF39FB40057; Tue, 10 Sep 2019 08:53:08 +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:06 -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:06 -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 x8A8r4xY024751; Tue, 10 Sep 2019 09:53:05 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id E5F011613D1; Tue, 10 Sep 2019 09:53:04 +0100 (BST) From: Andrew Rybchenko To: Chas Williams CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:52:21 +0100 Message-ID: <1568105541-7399-8-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 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24898.005 X-TM-AS-Result: No-2.003600-4.000000-10 X-TMASE-MatchedRID: MRojtx73vL7NQetBFGxSlJzEHTUOuMX39teeW6UfkyAHZBaLwEXlKCzy bVqWyY2N+aSt+E6D0kXoRyzm1ypDijPDK33fd2NSTWuFDn5CUjRAbSn2l83OUbqln+jYe7ZhQtu FUiSMVEjVPGtJpQStsDEUEo62KQrYLvv2cUtLK/uhLSC6hXpJl1IOc8QjxyVt27KSseGDg91moe pWJU2SGfqgpAKmfb8+5dAcjqNCUH3RQdw4XFGJY07CajSVoNFscsjLQ6Lp2zC5ZjHyzYrpGhLjB 1Nuqu454vM1YF6AJbbCCfuIMF6xLSdET58jp62SHl11wdxn70vmUHUbYfgsUd9OavgXA0U3Hfox 2xtrYDIYjJLmmd66utCx5lUNzF/6Dio24RMqbthd/Q1tNPUIuApXMBSsm62CvU24pLfQFmdAgUh ku2yAbQNQf6dUs3KIKyog/1PG+0kxvqnnvSKWdw== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.003600-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568105589-e2FsZ3GD-gQg Subject: [dpdk-dev] [PATCH 7/7] examples/bond: check status of getting MAC address 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 The return value of rte_eth_macaddr_get() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- examples/bond/main.c | 58 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/examples/bond/main.c b/examples/bond/main.c index 39214cfee..ee8fa2d27 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -208,7 +208,12 @@ slave_port_init(uint16_t portid, struct rte_mempool *mbuf_pool) struct rte_ether_addr addr; - rte_eth_macaddr_get(portid, &addr); + retval = rte_eth_macaddr_get(portid, &addr); + if (retval != 0) + rte_exit(retval, + "Mac address get port %d failed (res=%d)", + portid, retval); + printf("Port %u MAC: ", portid); PRINT_MAC(addr); printf("\n"); @@ -309,7 +314,11 @@ bond_port_init(struct rte_mempool *mbuf_pool) struct rte_ether_addr addr; - rte_eth_macaddr_get(BOND_PORT, &addr); + retval = rte_eth_macaddr_get(BOND_PORT, &addr); + if (retval != 0) + rte_exit(retval, "port %u: Mac address get failed (res=%d)", + BOND_PORT, retval); + printf("Port %u MAC: ", (unsigned)BOND_PORT); PRINT_MAC(addr); printf("\n"); @@ -355,6 +364,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) struct rte_mbuf *pkts[MAX_PKT_BURST] __rte_cache_aligned; struct rte_ether_addr d_addr; + struct rte_ether_addr bond_mac_addr; struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; struct rte_ipv4_hdr *ipv4_hdr; @@ -364,6 +374,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) uint32_t bond_ip; int i = 0; uint8_t is_free; + int ret; bond_ip = BOND_IP_1 | (BOND_IP_2 << 8) | (BOND_IP_3 << 16) | (BOND_IP_4 << 24); @@ -381,6 +392,15 @@ static int lcore_main(__attribute__((unused)) void *arg1) continue; } + ret = rte_eth_macaddr_get(BOND_PORT, &bond_mac_addr); + if (ret != 0) { + printf("Bond (port %u) MAC address get failed: %s.\n" + "%u packets dropped", BOND_PORT, strerror(-ret), + rx_cnt); + rte_pktmbuf_free(pkts[i]); + continue; + } + /* Search incoming data for ARP packets and prepare response */ for (i = 0; i < rx_cnt; i++) { if (rte_spinlock_trylock(&global_flag_stru_p->lock) == 1) { @@ -407,11 +427,11 @@ static int lcore_main(__attribute__((unused)) void *arg1) arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); - rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); + rte_ether_addr_copy(&bond_mac_addr, ð_hdr->s_addr); rte_ether_addr_copy(&arp_hdr->arp_data.arp_sha, &arp_hdr->arp_data.arp_tha); arp_hdr->arp_data.arp_tip = arp_hdr->arp_data.arp_sip; - rte_eth_macaddr_get(BOND_PORT, &d_addr); + rte_ether_addr_copy(&bond_mac_addr, &d_addr); rte_ether_addr_copy(&d_addr, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = bond_ip; rte_eth_tx_burst(BOND_PORT, 0, &pkts[i], 1); @@ -428,7 +448,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) ipv4_hdr = (struct rte_ipv4_hdr *)((char *)(eth_hdr + 1) + offset); if (ipv4_hdr->dst_addr == bond_ip) { rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); - rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); + rte_ether_addr_copy(&bond_mac_addr, ð_hdr->s_addr); ipv4_hdr->dst_addr = ipv4_hdr->src_addr; ipv4_hdr->src_addr = bond_ip; rte_eth_tx_burst(BOND_PORT, 0, &pkts[i], 1); @@ -468,12 +488,14 @@ static void cmd_obj_send_parsed(void *parsed_result, struct cmd_obj_send_result *res = parsed_result; char ip_str[INET6_ADDRSTRLEN]; + struct rte_ether_addr bond_mac_addr; struct rte_mbuf *created_pkt; struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; uint32_t bond_ip; size_t pkt_size; + int ret; if (res->ip.family == AF_INET) get_string(res, ip_str, INET_ADDRSTRLEN); @@ -483,6 +505,13 @@ static void cmd_obj_send_parsed(void *parsed_result, bond_ip = BOND_IP_1 | (BOND_IP_2 << 8) | (BOND_IP_3 << 16) | (BOND_IP_4 << 24); + ret = rte_eth_macaddr_get(BOND_PORT, &bond_mac_addr); + if (ret != 0) { + cmdline_printf(cl, + "Failed to get bond (port %u) MAC address: %s\n", + BOND_PORT, strerror(-ret)); + } + created_pkt = rte_pktmbuf_alloc(mbuf_pool); if (created_pkt == NULL) { cmdline_printf(cl, "Failed to allocate mbuf\n"); @@ -494,7 +523,7 @@ static void cmd_obj_send_parsed(void *parsed_result, created_pkt->pkt_len = pkt_size; eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); - rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); + rte_ether_addr_copy(&bond_mac_addr, ð_hdr->s_addr); memset(ð_hdr->d_addr, 0xFF, RTE_ETHER_ADDR_LEN); eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP); @@ -506,7 +535,7 @@ static void cmd_obj_send_parsed(void *parsed_result, arp_hdr->arp_plen = sizeof(uint32_t); arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REQUEST); - rte_eth_macaddr_get(BOND_PORT, &arp_hdr->arp_data.arp_sha); + rte_ether_addr_copy(&bond_mac_addr, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = bond_ip; memset(&arp_hdr->arp_data.arp_tha, 0, RTE_ETHER_ADDR_LEN); arp_hdr->arp_data.arp_tip = @@ -721,13 +750,20 @@ static void cmd_show_parsed(__attribute__((unused)) void *parsed_result, uint16_t slaves[16] = {0}; uint8_t len = 16; struct rte_ether_addr addr; - uint16_t i = 0; + uint16_t i; + int ret; + + for (i = 0; i < slaves_count; i++) { + ret = rte_eth_macaddr_get(i, &addr); + if (ret != 0) { + cmdline_printf(cl, + "Failed to get port %u MAC address: %s\n", + i, strerror(-ret)); + continue; + } - while (i < slaves_count) { - rte_eth_macaddr_get(i, &addr); PRINT_MAC(addr); printf("\n"); - i++; } rte_spinlock_trylock(&global_flag_stru_p->lock);