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 apps according to new return type.
Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
addr.addr_bytes[2], addr.addr_bytes[3],
addr.addr_bytes[4], addr.addr_bytes[5]);
addr.addr_bytes[2], addr.addr_bytes[3],
addr.addr_bytes[4], addr.addr_bytes[5]);
- rte_eth_promiscuous_enable(port_id);
+ ret = rte_eth_promiscuous_enable(port_id);
+ if (ret != 0) {
+ rte_exit(EXIT_FAILURE,
+ "promiscuous mode enable failed: %s\n",
+ rte_strerror(-ret));
+ return ret;
+ }
- rte_eth_promiscuous_enable(i);
+ ret = rte_eth_promiscuous_enable(i);
+ if (ret != 0) {
+ evt_err("Failed to enable promiscuous mode for eth port [%d]: %s",
+ i, rte_strerror(-ret));
+ return ret;
+ }
- rte_eth_promiscuous_enable(i);
+ ret = rte_eth_promiscuous_enable(i);
+ if (ret != 0) {
+ evt_err("Failed to enable promiscuous mode for eth port [%d]: %s",
+ i, rte_strerror(-ret));
+ return ret;
+ }
if (ret < 0)
rte_panic("Cannot init NIC port %u (%d)\n", port, ret);
if (ret < 0)
rte_panic("Cannot init NIC port %u (%d)\n", port, ret);
- rte_eth_promiscuous_enable(port);
+ ret = rte_eth_promiscuous_enable(port);
+ if (ret != 0)
+ rte_panic("Cannot enable promiscuous mode for port %u: %s\n",
+ port, rte_strerror(-ret));
/* Init RX queues */
ret = rte_eth_rx_queue_setup(
/* Init RX queues */
ret = rte_eth_rx_queue_setup(
addr.addr_bytes[4], addr.addr_bytes[5]);
/* Enable RX in promiscuous mode for the Ethernet device. */
addr.addr_bytes[4], addr.addr_bytes[5]);
/* Enable RX in promiscuous mode for the Ethernet device. */
- rte_eth_promiscuous_enable(port);
+ retval = rte_eth_promiscuous_enable(port);
+ if (retval != 0)
+ return retval;
addr.addr_bytes[4], addr.addr_bytes[5]);
/* Enable RX in promiscuous mode for the Ethernet device. */
addr.addr_bytes[4], addr.addr_bytes[5]);
/* Enable RX in promiscuous mode for the Ethernet device. */
- rte_eth_promiscuous_enable(port);
+ retval = rte_eth_promiscuous_enable(port);
+ if (retval != 0)
+ return retval;
test_roundrobin_verify_promiscuous_enable_disable(void)
{
int i, promiscuous_en;
test_roundrobin_verify_promiscuous_enable_disable(void)
{
int i, promiscuous_en;
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_ROUND_ROBIN, 0, 4, 1),
"Failed to initialize bonded device with slaves");
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_ROUND_ROBIN, 0, 4, 1),
"Failed to initialize bonded device with slaves");
- rte_eth_promiscuous_enable(test_params->bonded_port_id);
+ ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed to enable promiscuous mode for port %d: %s",
+ test_params->bonded_port_id, rte_strerror(-ret));
promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
TEST_ASSERT_EQUAL(promiscuous_en, 1,
promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
TEST_ASSERT_EQUAL(promiscuous_en, 1,
test_params->slave_port_ids[i]);
}
test_params->slave_port_ids[i]);
}
- rte_eth_promiscuous_disable(test_params->bonded_port_id);
+ ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed to disable promiscuous mode for port %d: %s",
+ test_params->bonded_port_id, rte_strerror(-ret));
promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
TEST_ASSERT_EQUAL(promiscuous_en, 0,
promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
TEST_ASSERT_EQUAL(promiscuous_en, 0,
test_activebackup_verify_promiscuous_enable_disable(void)
{
int i, primary_port, promiscuous_en;
test_activebackup_verify_promiscuous_enable_disable(void)
{
int i, primary_port, promiscuous_en;
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
"failed to get primary slave for bonded port (%d)",
test_params->bonded_port_id);
"failed to get primary slave for bonded port (%d)",
test_params->bonded_port_id);
- rte_eth_promiscuous_enable(test_params->bonded_port_id);
+ ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed to enable promiscuous mode for port %d: %s",
+ test_params->bonded_port_id, rte_strerror(-ret));
TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
"Port (%d) promiscuous mode not enabled",
TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
"Port (%d) promiscuous mode not enabled",
- rte_eth_promiscuous_disable(test_params->bonded_port_id);
+ ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed to disable promiscuous mode for port %d: %s",
+ test_params->bonded_port_id, rte_strerror(-ret));
TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
"Port (%d) promiscuous mode not disabled\n",
TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
"Port (%d) promiscuous mode not disabled\n",
test_balance_verify_promiscuous_enable_disable(void)
{
int i;
test_balance_verify_promiscuous_enable_disable(void)
{
int i;
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BALANCE, 0, 4, 1),
"Failed to initialise bonded device");
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BALANCE, 0, 4, 1),
"Failed to initialise bonded device");
- rte_eth_promiscuous_enable(test_params->bonded_port_id);
+ ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed to enable promiscuous mode for port %d: %s",
+ test_params->bonded_port_id, rte_strerror(-ret));
TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
"Port (%d) promiscuous mode not enabled",
TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
"Port (%d) promiscuous mode not enabled",
test_params->slave_port_ids[i]);
}
test_params->slave_port_ids[i]);
}
- rte_eth_promiscuous_disable(test_params->bonded_port_id);
+ ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed to disable promiscuous mode for port %d: %s",
+ test_params->bonded_port_id, rte_strerror(-ret));
TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
"Port (%d) promiscuous mode not disabled",
TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
"Port (%d) promiscuous mode not disabled",
test_broadcast_verify_promiscuous_enable_disable(void)
{
int i;
test_broadcast_verify_promiscuous_enable_disable(void)
{
int i;
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BROADCAST, 0, 4, 1),
"Failed to initialise bonded device");
/* Initialize bonded device with 4 slaves in round robin mode */
TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
BONDING_MODE_BROADCAST, 0, 4, 1),
"Failed to initialise bonded device");
- rte_eth_promiscuous_enable(test_params->bonded_port_id);
+ ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed to enable promiscuous mode for port %d: %s",
+ test_params->bonded_port_id, rte_strerror(-ret));
TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
test_params->slave_port_ids[i]);
}
test_params->slave_port_ids[i]);
}
- rte_eth_promiscuous_disable(test_params->bonded_port_id);
+ ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed to disable promiscuous mode for port %d: %s",
+ test_params->bonded_port_id, rte_strerror(-ret));
TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
"Port (%d) promiscuous mode not disabled",
TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
"Port (%d) promiscuous mode not disabled",
test_tlb_verify_promiscuous_enable_disable(void)
{
int i, primary_port, promiscuous_en;
test_tlb_verify_promiscuous_enable_disable(void)
{
int i, primary_port, promiscuous_en;
/* Initialize bonded device with 4 slaves in transmit load balancing mode */
TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(
/* Initialize bonded device with 4 slaves in transmit load balancing mode */
TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(
"failed to get primary slave for bonded port (%d)",
test_params->bonded_port_id);
"failed to get primary slave for bonded port (%d)",
test_params->bonded_port_id);
- rte_eth_promiscuous_enable(test_params->bonded_port_id);
+ ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed to enable promiscuous mode for port %d: %s",
+ test_params->bonded_port_id, rte_strerror(-ret));
promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
TEST_ASSERT_EQUAL(promiscuous_en, (int)1,
promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
TEST_ASSERT_EQUAL(promiscuous_en, (int)1,
- rte_eth_promiscuous_disable(test_params->bonded_port_id);
+ ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed to disable promiscuous mode for port %d: %s\n",
+ test_params->bonded_port_id, rte_strerror(-ret));
promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
TEST_ASSERT_EQUAL(promiscuous_en, (int)0,
promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
TEST_ASSERT_EQUAL(promiscuous_en, (int)0,
initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm)
{
uint8_t i;
initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm)
{
uint8_t i;
RTE_VERIFY(test_params.bonded_port_id != INVALID_PORT_ID);
RTE_VERIFY(test_params.bonded_port_id != INVALID_PORT_ID);
/* Reset mode 4 configuration */
rte_eth_bond_8023ad_setup(test_params.bonded_port_id, NULL);
/* Reset mode 4 configuration */
rte_eth_bond_8023ad_setup(test_params.bonded_port_id, NULL);
- rte_eth_promiscuous_disable(test_params.bonded_port_id);
+ ret = rte_eth_promiscuous_disable(test_params.bonded_port_id);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed disable promiscuous mode for port %d: %s",
+ test_params.bonded_port_id, rte_strerror(-ret));
if (external_sm) {
struct rte_eth_bond_8023ad_conf conf;
if (external_sm) {
struct rte_eth_bond_8023ad_conf conf;
/* First try with promiscuous mode enabled.
* Add 2 packets to each slave. First with bonding MAC address, second with
* different. Check if we received all of them. */
/* First try with promiscuous mode enabled.
* Add 2 packets to each slave. First with bonding MAC address, second with
* different. Check if we received all of them. */
- rte_eth_promiscuous_enable(test_params.bonded_port_id);
+ retval = rte_eth_promiscuous_enable(test_params.bonded_port_id);
+ TEST_ASSERT_SUCCESS(retval,
+ "Failed to enable promiscuous mode for port %d: %s",
+ test_params.bonded_port_id, rte_strerror(-retval));
expected_pkts_cnt = 0;
FOR_EACH_SLAVE(i, slave) {
expected_pkts_cnt = 0;
FOR_EACH_SLAVE(i, slave) {
/* Now, disable promiscuous mode. When promiscuous mode is disabled we
* expect to receive only packets that are directed to bonding port. */
/* Now, disable promiscuous mode. When promiscuous mode is disabled we
* expect to receive only packets that are directed to bonding port. */
- rte_eth_promiscuous_disable(test_params.bonded_port_id);
+ retval = rte_eth_promiscuous_disable(test_params.bonded_port_id);
+ TEST_ASSERT_SUCCESS(retval,
+ "Failed to disable promiscuous mode for port %d: %s",
+ test_params.bonded_port_id, rte_strerror(-retval));
expected_pkts_cnt = 0;
FOR_EACH_SLAVE(i, slave) {
expected_pkts_cnt = 0;
FOR_EACH_SLAVE(i, slave) {
ret, portid);
/* always eanble promiscuous */
ret, portid);
/* always eanble promiscuous */
- rte_eth_promiscuous_enable(portid);
+ ret = rte_eth_promiscuous_enable(portid);
+ if (ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_promiscuous_enable: err=%s, port=%d\n",
+ rte_strerror(-ret), portid);
lcore_conf[slave_id].portlist[num++] = portid;
lcore_conf[slave_id].nb_ports++;
lcore_conf[slave_id].portlist[num++] = portid;
lcore_conf[slave_id].nb_ports++;