Skip to content

Commit

Permalink
app/testpmd: check stopping port is not in bonding
Browse files Browse the repository at this point in the history
Add new function port_is_bonding_slave
Use this function in stop_port and close_port functions.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
  • Loading branch information
bairemon authored and Thomas Monjalon committed Jun 16, 2016
1 parent a8ef3e3 commit 0e545d3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/test-pmd/testpmd.c
Expand Up @@ -1449,6 +1449,11 @@ stop_port(portid_t pid)
continue;
}

if (port_is_bonding_slave(pi)) {
printf("Please remove port %d from bonded device.\n", pi);
continue;
}

port = &ports[pi];
if (rte_atomic16_cmpset(&(port->port_status), RTE_PORT_STARTED,
RTE_PORT_HANDLING) == 0)
Expand Down Expand Up @@ -1487,6 +1492,11 @@ close_port(portid_t pid)
continue;
}

if (port_is_bonding_slave(pi)) {
printf("Please remove port %d from bonded device.\n", pi);
continue;
}

port = &ports[pi];
if (rte_atomic16_cmpset(&(port->port_status),
RTE_PORT_CLOSED, RTE_PORT_CLOSED) == 1) {
Expand Down Expand Up @@ -1824,6 +1834,14 @@ void clear_port_slave_flag(portid_t slave_pid)
port->slave_flag = 0;
}

uint8_t port_is_bonding_slave(portid_t slave_pid)
{
struct rte_port *port;

port = &ports[slave_pid];
return port->slave_flag;
}

const uint16_t vlan_tags[] = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
Expand Down
2 changes: 2 additions & 0 deletions app/test-pmd/testpmd.h
Expand Up @@ -532,6 +532,8 @@ void dev_set_link_down(portid_t pid);
void init_port_config(void);
void set_port_slave_flag(portid_t slave_pid);
void clear_port_slave_flag(portid_t slave_pid);
uint8_t port_is_bonding_slave(portid_t slave_pid);

int init_port_dcb_config(portid_t pid, enum dcb_mode_enable dcb_mode,
enum rte_eth_nb_tcs num_tcs,
uint8_t pfc_en);
Expand Down

0 comments on commit 0e545d3

Please sign in to comment.