From: Andrew Rybchenko <arybchenko@solarflare.com>
To: Wenzhuo Lu <wenzhuo.lu@intel.com>,
Jingjing Wu <jingjing.wu@intel.com>,
Bernard Iremonger <bernard.iremonger@intel.com>
Cc: <dev@dpdk.org>, Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 07/13] app/testpmd: check code of promiscuous mode switch
Date: Thu, 5 Sep 2019 17:10:45 +0100 [thread overview]
Message-ID: <1567699852-31693-8-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1567699852-31693-1-git-send-email-arybchenko@solarflare.com>
From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/testpmd
according to new return type.
Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
app/test-pmd/cmdline.c | 23 ++++++++++-------------
app/test-pmd/testpmd.c | 14 +++++++++++---
app/test-pmd/testpmd.h | 2 ++
app/test-pmd/util.c | 16 ++++++++++++++++
4 files changed, 39 insertions(+), 16 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b1be6b4c82..6b9444f42d 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6082,6 +6082,7 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
struct cmd_create_bonded_device_result *res = parsed_result;
char ethdev_name[RTE_ETH_NAME_MAX_LEN];
int port_id;
+ int ret;
if (test_done == 0) {
printf("Please stop forwarding first\n");
@@ -6103,7 +6104,11 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
/* Update number of ports */
nb_ports = rte_eth_dev_count_avail();
reconfig(port_id, res->socket);
- rte_eth_promiscuous_enable(port_id);
+ ret = rte_eth_promiscuous_enable(port_id);
+ if (ret != 0)
+ printf("Failed to enable promiscuous mode for port %u: %s - ignore\n",
+ port_id, rte_strerror(-ret));
+
ports[port_id].need_setup = 0;
ports[port_id].port_status = RTE_PORT_STOPPED;
}
@@ -6525,18 +6530,10 @@ static void cmd_set_promisc_mode_parsed(void *parsed_result,
/* all ports */
if (allports) {
- RTE_ETH_FOREACH_DEV(i) {
- if (enable)
- rte_eth_promiscuous_enable(i);
- else
- rte_eth_promiscuous_disable(i);
- }
- }
- else {
- if (enable)
- rte_eth_promiscuous_enable(res->port_num);
- else
- rte_eth_promiscuous_disable(res->port_num);
+ RTE_ETH_FOREACH_DEV(i)
+ eth_set_promisc_mode(i, enable);
+ } else {
+ eth_set_promisc_mode(res->port_num, enable);
}
}
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index cbf73e6853..6476f97e8d 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2432,13 +2432,17 @@ static void
setup_attached_port(portid_t pi)
{
unsigned int socket_id;
+ int ret;
socket_id = (unsigned)rte_eth_dev_socket_id(pi);
/* if socket_id is invalid, set to the first available socket. */
if (check_socket_id(socket_id) < 0)
socket_id = socket_ids[0];
reconfig(pi, socket_id);
- rte_eth_promiscuous_enable(pi);
+ ret = rte_eth_promiscuous_enable(pi);
+ if (ret != 0)
+ printf("Error during enabling promiscuous mode for port %u: %s - ignore\n",
+ pi, rte_strerror(-ret));
ports_ids[nb_ports++] = pi;
fwd_ports_ids[nb_fwd_ports++] = pi;
@@ -3372,8 +3376,12 @@ main(int argc, char** argv)
rte_exit(EXIT_FAILURE, "Start ports failed\n");
/* set all ports to promiscuous mode by default */
- RTE_ETH_FOREACH_DEV(port_id)
- rte_eth_promiscuous_enable(port_id);
+ RTE_ETH_FOREACH_DEV(port_id) {
+ ret = rte_eth_promiscuous_enable(port_id);
+ if (ret != 0)
+ printf("Error during enabling promiscuous mode for port %u: %s - ignore\n",
+ port_id, rte_strerror(-ret));
+ }
/* Init metrics library */
rte_metrics_init(rte_socket_id());
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index d73955da14..9bdbd6dafe 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -824,6 +824,8 @@ void show_gro(portid_t port_id);
void setup_gso(const char *mode, portid_t port_id);
int eth_dev_info_get_print_err(uint16_t port_id,
struct rte_eth_dev_info *dev_info);
+void eth_set_promisc_mode(uint16_t port_id,
+ int enable);
/* 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 009d226764..4626751343 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -245,3 +245,19 @@ eth_dev_info_get_print_err(uint16_t port_id,
return ret;
}
+
+void
+eth_set_promisc_mode(uint16_t port, int enable)
+{
+ int ret;
+
+ if (enable)
+ ret = rte_eth_promiscuous_enable(port);
+ else
+ ret = rte_eth_promiscuous_disable(port);
+
+ if (ret != 0)
+ printf("Error during %s promiscuous mode for port %u: %s\n",
+ enable ? "enabling" : "disabling",
+ port, rte_strerror(-ret));
+}
--
2.17.1
next prev parent reply other threads:[~2019-09-05 16:12 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
2019-09-05 16:25 ` Gaëtan Rivet
2019-09-05 16:32 ` Andrew Rybchenko
2019-09-05 16:36 ` Stephen Hemminger
2019-09-05 16:38 ` Andrew Rybchenko
2019-09-06 9:24 ` Gaëtan Rivet
2019-09-06 10:08 ` Andrew Rybchenko
2019-09-05 16:40 ` Stephen Hemminger
2019-09-05 16:49 ` Andrew Rybchenko
2019-09-05 17:13 ` Stephen Hemminger
2019-09-05 16:10 ` [dpdk-dev] [PATCH 03/13] net/bonding: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 05/13] ethdev: do nothing if promiscuous mode is applied again Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 06/13] app/pipeline: check code of promiscuous mode switch Andrew Rybchenko
2019-09-05 16:10 ` Andrew Rybchenko [this message]
2019-09-05 16:10 ` [dpdk-dev] [PATCH 08/13] app/eventdev: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 09/13] app/pdump: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 10/13] app/test: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 11/13] kni: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 12/13] test/bonding: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
2019-09-13 15:35 ` Ferruh Yigit
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
2019-09-09 12:48 ` Gaëtan Rivet
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 03/13] net/bonding: " Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
2019-09-10 7:53 ` Matan Azrad
2019-09-13 21:05 ` Andrew Rybchenko
2019-09-11 8:46 ` Hyong Youb Kim (hyonkim)
2019-09-13 21:06 ` Andrew Rybchenko
2019-09-16 6:48 ` Hyong Youb Kim (hyonkim)
2019-09-13 15:34 ` Ferruh Yigit
2019-09-13 15:54 ` Andrew Rybchenko
2019-09-13 16:33 ` Ferruh Yigit
2019-09-13 15:39 ` Ferruh Yigit
2019-09-13 16:05 ` Andrew Rybchenko
2019-09-13 16:34 ` Ferruh Yigit
2019-09-13 19:57 ` Andrew Rybchenko
2019-09-16 13:22 ` Ferruh Yigit
2019-09-16 15:45 ` Andrew Rybchenko
2019-09-16 15:58 ` Ferruh Yigit
2019-09-13 16:43 ` Ferruh Yigit
2019-09-13 20:33 ` Andrew Rybchenko
2019-09-13 16:56 ` Ferruh Yigit
2019-09-13 20:38 ` Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 05/13] ethdev: do nothing if promiscuous mode is applied again Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 06/13] app/pipeline: check code of promiscuous mode switch Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 07/13] app/testpmd: " Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 08/13] app/eventdev: " Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 09/13] app/pdump: " Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 10/13] app/test: " Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 11/13] kni: " Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 12/13] test/bonding: " Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
2019-09-13 16:40 ` Ferruh Yigit
2019-09-13 18:30 ` Andrew Rybchenko
2019-09-13 16:37 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Ferruh Yigit
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 03/13] net/bonding: " Andrew Rybchenko
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 05/13] ethdev: do nothing if promiscuous mode is applied again Andrew Rybchenko
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 06/13] app/pipeline: check code of promiscuous mode switch Andrew Rybchenko
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 07/13] app/testpmd: " Andrew Rybchenko
2019-09-16 13:18 ` Iremonger, Bernard
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 08/13] app/eventdev: " Andrew Rybchenko
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 09/13] app/pdump: " Andrew Rybchenko
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 10/13] app/test: " Andrew Rybchenko
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 11/13] kni: " Andrew Rybchenko
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 12/13] test/bonding: " Andrew Rybchenko
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
2019-09-24 7:31 ` [dpdk-dev] [PATCH v3 00/13] ethdev: change promiscuous mode functions to return status Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1567699852-31693-8-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=Ivan.Ilchenko@oktetlabs.ru \
--cc=bernard.iremonger@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=wenzhuo.lu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).