From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E482A2EDB for ; Fri, 6 Sep 2019 09:39:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 88C9E1F2B1; Fri, 6 Sep 2019 09:33:44 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id A28B01F186 for ; Fri, 6 Sep 2019 09:32:06 +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-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id A2167400069; Fri, 6 Sep 2019 07:32:05 +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; Fri, 6 Sep 2019 00:32:00 -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; Fri, 6 Sep 2019 00:31:59 -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 x867Vwfl027800; Fri, 6 Sep 2019 08:31:58 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id DB9171613D1; Fri, 6 Sep 2019 08:31:58 +0100 (BST) From: Andrew Rybchenko To: Marko Kovacevic , Ori Kam , Bruce Richardson , Pablo de Lara , Radu Nicolau , Akhil Goyal , Tomasz Kantecki CC: , Ivan Ilchenko Date: Fri, 6 Sep 2019 08:31:05 +0100 Message-ID: <1567755066-31389-54-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1567755066-31389-1-git-send-email-arybchenko@solarflare.com> References: <1566915962-5472-1-git-send-email-arybchenko@solarflare.com> <1567755066-31389-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24892.005 X-TM-AS-Result: No-4.312700-4.000000-10 X-TMASE-MatchedRID: eHJXlKx9HErDOgXZFRFV8+b3p4cnIXGNAPiR4btCEeZ+SLLtNOiBhvFo O2munXhOyOrHSvvEufhw5T4Iaj538mJZXQNDzktSGjzBgnFZvQ5KgIbix5+XxEFungmhsSsCUl0 3SIY6fe0vNUCPMwUWx3bryR8otWaR/MSiuOz98mWInASnzB5VfH2bm0NxvlJhHWtVZN0asTiRkq tbv8KERgZ5qKpZonVNSPgILy+ax0vs708UolyRv54CIKY/Hg3AGdQnQSTrKGPEQdG7H66TyJ8TM nmE+d0Z7S5xASvaT06d+XE7FyZo+07GLYo0ieBFfJv6VI3tjPlHDnL6mNOrGd0Dmk2vylgBrkzy JNfEQHE4MDu1gm8Dd7YO1H6wBWHzk3UkV5Qp4wSI45Rd9ORJwFlJvEhEss3fvN+d4ahMo5NWXGv UUmKP2w== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--4.312700-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24892.005 X-MDID: 1567755126-BaikahEiy8uD Subject: [dpdk-dev] [PATCH v3 53/54] examples/ethtool: check status of getting ethdev info 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: Ivan Ilchenko rte_eth_dev_info_get() return value was changed from void to int, so this patch modify rte_eth_dev_info_get() usage across examples/ethtool according to its new return type. Signed-off-by: Ivan Ilchenko Signed-off-by: Andrew Rybchenko --- examples/ethtool/ethtool-app/main.c | 8 +++++++- examples/ethtool/lib/rte_ethtool.c | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c index 3d2a70d524..774df7eb10 100644 --- a/examples/ethtool/ethtool-app/main.c +++ b/examples/ethtool/ethtool-app/main.c @@ -95,6 +95,7 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports) char str_name[16]; uint16_t nb_rxd = PORT_RX_QUEUE_SIZE; uint16_t nb_txd = PORT_TX_QUEUE_SIZE; + int ret; memset(&cfg_port, 0, sizeof(cfg_port)); cfg_port.txmode.mq_mode = ETH_MQ_TX_NONE; @@ -102,7 +103,12 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports) for (idx_port = 0; idx_port < cnt_ports; idx_port++) { struct app_port *ptr_port = &app_cfg->ports[idx_port]; - rte_eth_dev_info_get(idx_port, &dev_info); + ret = rte_eth_dev_info_get(idx_port, &dev_info); + if (ret != 0) + rte_exit(EXIT_FAILURE, + "Error during getting device (port %u) info: %s\n", + idx_port, strerror(-ret)); + size_pktpool = dev_info.rx_desc_lim.nb_max + dev_info.tx_desc_lim.nb_max + PKTPOOL_EXTRA_SIZE; diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index fd1692daae..43cacc0579 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -41,7 +41,13 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo) printf("Insufficient fw version buffer size, " "the minimum size should be %d\n", ret); - rte_eth_dev_info_get(port_id, &dev_info); + ret = rte_eth_dev_info_get(port_id, &dev_info); + if (ret != 0) { + printf("Error during getting device (port %u) info: %s\n", + port_id, strerror(-ret)); + + return ret; + } strlcpy(drvinfo->driver, dev_info.driver_name, sizeof(drvinfo->driver)); @@ -370,8 +376,12 @@ rte_ethtool_net_set_rx_mode(uint16_t port_id) uint16_t num_vfs; struct rte_eth_dev_info dev_info; uint16_t vf; + int ret; + + ret = rte_eth_dev_info_get(port_id, &dev_info); + if (ret != 0) + return ret; - rte_eth_dev_info_get(port_id, &dev_info); num_vfs = dev_info.max_vfs; /* Set VF vf_rx_mode, VF unsupport status is discard */ @@ -397,11 +407,14 @@ rte_ethtool_get_ringparam(uint16_t port_id, struct rte_eth_rxq_info rx_qinfo; struct rte_eth_txq_info tx_qinfo; int stat; + int ret; if (ring_param == NULL) return -EINVAL; - rte_eth_dev_info_get(port_id, &dev_info); + ret = rte_eth_dev_info_get(port_id, &dev_info); + if (ret != 0) + return ret; stat = rte_eth_rx_queue_info_get(port_id, 0, &rx_qinfo); if (stat != 0) -- 2.17.1