Skip to content

Commit

Permalink
app/testpmd: fix MAC address after port reset
Browse files Browse the repository at this point in the history
[ upstream commit 5ffc4a2 ]

MAC address of each port in global variable ports hasn't been updated
after resetting. It was the initial one after resetting VF MAC address.
This patch gets correct port MAC address when starting port.

Fixes: a5279d2 ("app/testpmd: check status of getting MAC address")

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Aman Deep Singh <aman.deep.singh@intel.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
  • Loading branch information
Yuying2intel authored and cpaelzer committed Aug 10, 2021
1 parent 7ec9ebd commit f9aae4b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/test-pmd/testpmd.c
Expand Up @@ -2317,7 +2317,6 @@ start_port(portid_t pid)
portid_t pi;
queueid_t qi;
struct rte_port *port;
struct rte_ether_addr mac_addr;
struct rte_eth_hairpin_cap cap;

if (port_id_is_invalid(pid, ENABLED_WARN))
Expand Down Expand Up @@ -2481,11 +2480,14 @@ start_port(portid_t pid)
RTE_PORT_HANDLING, RTE_PORT_STARTED) == 0)
printf("Port %d can not be set into started\n", pi);

if (eth_macaddr_get_print_err(pi, &mac_addr) == 0)
if (eth_macaddr_get_print_err(pi, &port->eth_addr) == 0)
printf("Port %d: %02X:%02X:%02X:%02X:%02X:%02X\n", pi,
mac_addr.addr_bytes[0], mac_addr.addr_bytes[1],
mac_addr.addr_bytes[2], mac_addr.addr_bytes[3],
mac_addr.addr_bytes[4], mac_addr.addr_bytes[5]);
port->eth_addr.addr_bytes[0],
port->eth_addr.addr_bytes[1],
port->eth_addr.addr_bytes[2],
port->eth_addr.addr_bytes[3],
port->eth_addr.addr_bytes[4],
port->eth_addr.addr_bytes[5]);

/* at least one port started, need checking link status */
need_check_link_status = 1;
Expand Down

0 comments on commit f9aae4b

Please sign in to comment.