summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorIvan Ilchenko <ivan.ilchenko@oktetlabs.ru>2019-09-14 12:37:27 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2019-10-07 15:00:54 +0200
commit34fc1051066a2cef9775ddba6139c3aae3dd6c2f (patch)
tree018bc5e3ec865e317348ac67aa69daf43e79c495 /app
parentb57e35d6e9eb6ed0a0b7b51b3641f7c6b887a66f (diff)
downloaddpdk-34fc1051066a2cef9775ddba6139c3aae3dd6c2f.zip
dpdk-34fc1051066a2cef9775ddba6139c3aae3dd6c2f.tar.gz
dpdk-34fc1051066a2cef9775ddba6139c3aae3dd6c2f.tar.xz
app/testpmd: check code of promiscuous mode switch
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> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Diffstat (limited to 'app')
-rw-r--r--app/test-pmd/cmdline.c23
-rw-r--r--app/test-pmd/testpmd.c14
-rw-r--r--app/test-pmd/testpmd.h1
-rw-r--r--app/test-pmd/util.c16
4 files changed, 38 insertions, 16 deletions
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b1be6b4..6b9444f 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 de91e1b..2a57978 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2433,13 +2433,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;
@@ -3373,8 +3377,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 d73955d..ab93062 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -824,6 +824,7 @@ 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 009d226..4626751 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));
+}