From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 6740BA2E1B
	for <public@inbox.dpdk.org>; Tue,  3 Sep 2019 16:11:00 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id B3E831ECCD;
	Tue,  3 Sep 2019 15:59:55 +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 0D71D1EAAE
 for <dev@dpdk.org>; Tue,  3 Sep 2019 15:58:13 +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 9B6DEBC005E;
 Tue,  3 Sep 2019 13:58:11 +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, 3 Sep 2019 06:58:08 -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, 3 Sep 2019 06:58:08 -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 x83Dw6ww000726;
 Tue, 3 Sep 2019 14:58:06 +0100
Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1])
 by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id DE1241613D1;
 Tue,  3 Sep 2019 14:58:06 +0100 (BST)
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
CC: <dev@dpdk.org>, Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>
Date: Tue, 3 Sep 2019 14:57:26 +0100
Message-ID: <1567519051-28189-53-git-send-email-arybchenko@solarflare.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1567519051-28189-1-git-send-email-arybchenko@solarflare.com>
References: <1566915962-5472-1-git-send-email-arybchenko@solarflare.com>
 <1567519051-28189-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-24886.005
X-TM-AS-Result: No-2.220300-4.000000-10
X-TMASE-MatchedRID: JJf+xfeHh43DOgXZFRFV8+b3p4cnIXGNAPiR4btCEeZ+SLLtNOiBhrny
 O1e9qRizrdoLblq9S5qnJ7eS8LcE2Rf+TLxNffg6UyxW4vmvLt2ByxVkfd04JEUf4hgvt6xq+3n
 5TORW5Is6w/ejczwdN3GGEKfcJAliCWJZymXNAFfHmyDJSEsI28MA9JsxaUa3eoHKBqqMb3GjxY
 yRBa/qJcFwgTvxipFajoczmuoPCq05l8HgkvZCyaVkNovSzDSRJfAmeSigXHwYev67myyhtB8RW
 Z419oquT1U+566F0BpmqTXl2g5/KKuckqlg4XmJqoT84JrYyt+F15h6/oibNbKsWJ44GuEGPNxa
 u39/BitFwHZmk+dWMmhnUCrcDtVn
X-TM-AS-User-Approved-Sender: No
X-TM-AS-User-Blocked-Sender: No
X-TMASE-Result: 10--2.220300-4.000000
X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24886.005
X-MDID: 1567519092-tvO1SrO3JEHN
Subject: [dpdk-dev] [PATCH v2 52/54] examples/kni: 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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>

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/kni according to its new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 examples/kni/main.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/examples/kni/main.c b/examples/kni/main.c
index 17f695e..e43f174 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -595,7 +595,13 @@ struct kni_interface_stats {
 	/* Initialise device and RX/TX queues */
 	RTE_LOG(INFO, APP, "Initialising port %u ...\n", (unsigned)port);
 	fflush(stdout);
-	rte_eth_dev_info_get(port, &dev_info);
+
+	ret = rte_eth_dev_info_get(port, &dev_info);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Error during getting device (port %u) info: %s\n",
+			port, strerror(-ret));
+
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
 		local_port_conf.txmode.offloads |=
 			DEV_TX_OFFLOAD_MBUF_FAST_FREE;
@@ -780,7 +786,15 @@ struct kni_interface_stats {
 				"for port%u (%d)\n", (unsigned int)port_id,
 				ret);
 
-	rte_eth_dev_info_get(port_id, &dev_info);
+	ret = rte_eth_dev_info_get(port_id, &dev_info);
+	if (ret != 0) {
+		RTE_LOG(ERR, APP,
+			"Error during getting device (port %u) info: %s\n",
+			port_id, strerror(-ret));
+
+		return ret;
+	}
+
 	rxq_conf = dev_info.default_rxconf;
 	rxq_conf.offloads = conf.rxmode.offloads;
 	ret = rte_eth_rx_queue_setup(port_id, 0, nb_rxd,
@@ -869,6 +883,7 @@ struct kni_interface_stats {
 	struct rte_kni *kni;
 	struct rte_kni_conf conf;
 	struct kni_port_params **params = kni_port_params_array;
+	int ret;
 
 	if (port_id >= RTE_MAX_ETHPORTS || !params[port_id])
 		return -1;
@@ -898,7 +913,11 @@ struct kni_interface_stats {
 			struct rte_kni_ops ops;
 			struct rte_eth_dev_info dev_info;
 
-			rte_eth_dev_info_get(port_id, &dev_info);
+			ret = rte_eth_dev_info_get(port_id, &dev_info);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"Error during getting device (port %u) info: %s\n",
+					port_id, strerror(-ret));
 
 			/* Get the interface default mac address */
 			rte_eth_macaddr_get(port_id,
-- 
1.8.3.1