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 10467A0471 for ; Mon, 9 Sep 2019 14:00:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 17E2B1ED3A; Mon, 9 Sep 2019 13:59:34 +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 256F61EC8A for ; Mon, 9 Sep 2019 13:59:11 +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 DD770B40069; Mon, 9 Sep 2019 11:59: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; Mon, 9 Sep 2019 04:59: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; Mon, 9 Sep 2019 04:59: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 x89Bx39o027773; Mon, 9 Sep 2019 12:59:03 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 60C681613D1; Mon, 9 Sep 2019 12:59:03 +0100 (BST) From: Andrew Rybchenko To: Ferruh Yigit CC: , Ivan Ilchenko Date: Mon, 9 Sep 2019 12:58:48 +0100 Message-ID: <1568030331-16526-12-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568030331-16526-1-git-send-email-arybchenko@solarflare.com> References: <1567699852-31693-1-git-send-email-arybchenko@solarflare.com> <1568030331-16526-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24898.005 X-TM-AS-Result: No-2.102900-4.000000-10 X-TMASE-MatchedRID: m3UrM73BECPbS0m47m6fSn84FZpy/6JVWw/S0HB7eoOBzO52zKOpBbSz HnxqKzJVyOrHSvvEufhw5T4Iaj538mJZXQNDzktSutvHF25zoU/Lvfc3C6SWwlzv/y1NmdYq4tJ 1U/a1mfn5pK34ToPSRVbUzEb3S0GPa/3oK40sUSqeAiCmPx4NwBnUJ0Ek6yhjxEHRux+uk8hxKp vEGAbTDonB/qrt45nI6+OLvwvWuW6RD9R8sqUh1bZXDE4WrQIfSIobZ1A4i4EhNY5B3kiTi0RlL MXmEBrY1YBvRWmgSjMtziGBPos3YZN1JFeUKeMEiOOUXfTkScBZSbxIRLLN380Goa3UM++8 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.102900-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568030350-dwfqvWaWwjjz Subject: [dpdk-dev] [PATCH v2 11/13] kni: check code of promiscuous mode switch 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_promiscuous_enable()/rte_eth_promiscuous_disable() return value was changed from void to int, so modify usage of these functions across lib/librte_kni according to new return type. Signed-off-by: Ivan Ilchenko Signed-off-by: Andrew Rybchenko --- app/test/test_kni.c | 7 ++++++- examples/kni/main.c | 9 +++++++-- lib/librte_kni/rte_kni.c | 14 +++++++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/test/test_kni.c b/app/test/test_kni.c index 2c333748db..e47ab36e02 100644 --- a/app/test/test_kni.c +++ b/app/test/test_kni.c @@ -601,7 +601,12 @@ test_kni(void) printf("fail to start port %d\n", port_id); return -1; } - rte_eth_promiscuous_enable(port_id); + ret = rte_eth_promiscuous_enable(port_id); + if (ret != 0) { + printf("fail to enable promiscuous mode for port %d: %s\n", + port_id, rte_strerror(-ret)); + return -1; + } /* basic test of kni processing */ fd = fopen(KNI_MODULE_PARAM_LO, "r"); diff --git a/examples/kni/main.c b/examples/kni/main.c index e43f174479..1069fd08bb 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -636,8 +636,13 @@ init_port(uint16_t port) rte_exit(EXIT_FAILURE, "Could not start port%u (%d)\n", (unsigned)port, ret); - if (promiscuous_on) - rte_eth_promiscuous_enable(port); + if (promiscuous_on) { + ret = rte_eth_promiscuous_enable(port); + if (ret != 0) + rte_exit(EXIT_FAILURE, + "Could not enable promiscuous mode for port%u: %s\n", + port, rte_strerror(-ret)); + } } /* Check the link status of all ports in up to 9s, and print them finally */ diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index 4b51fb4fed..04806ebb40 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -472,6 +472,8 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]) static int kni_config_promiscusity(uint16_t port_id, uint8_t to_on) { + int ret; + if (!rte_eth_dev_is_valid_port(port_id)) { RTE_LOG(ERR, KNI, "Invalid port id %d\n", port_id); return -EINVAL; @@ -481,11 +483,17 @@ kni_config_promiscusity(uint16_t port_id, uint8_t to_on) port_id, to_on); if (to_on) - rte_eth_promiscuous_enable(port_id); + ret = rte_eth_promiscuous_enable(port_id); else - rte_eth_promiscuous_disable(port_id); + ret = rte_eth_promiscuous_disable(port_id); - return 0; + if (ret != 0) + RTE_LOG(ERR, KNI, + "Failed to %s promiscuous mode for port %u: %s\n", + to_on ? "enable" : "disable", port_id, + rte_strerror(-ret)); + + return ret; } int -- 2.17.1