Skip to contentSkip to conversation

app/testpmd: fix port MAC address after resetting port

PATCH Applied Yuying Zhang 4 participants 4 messages Jul 14, 2021 – Jul 24, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix port MAC address after resetting port

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 a5279d25616d ("app/testpmd: check status of getting MAC address")
---
 app/test-pmd/testpmd.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
app/test-pmd/testpmd.c +7 -5
index 1cdd3cdd12..204e0d52cd 100644
@@ -2456,7 +2456,6 @@ start_port(portid_t pid)
 	int peer_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))
@@ -2627,11 +2626,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;
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw

Hi Yuying,

Quoted 33 lines · Yuying Zhang

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 a5279d25616d ("app/testpmd: check status of getting MAC address")
---
  app/test-pmd/testpmd.c | 12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)
app/test-pmd/testpmd.c +1 -4
index 1cdd3cdd12..204e0d52cd 100644
@@ -2456,7 +2456,6 @@ start_port(portid_t pid)
  	int peer_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))
@@ -2627,11 +2626,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],

app/test-pmd/testpmd.c start_port(portid_t pid) · line 2639

Quoted 10 lines
app/test-pmd/testpmd.c +6 -1
-				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;
Acked-by on v1 1/1
#2 lore raw
In reply to Yuying Zhang
Quoted 12 lines

-----Original Message-----
From: Zhang, Yuying <[email protected]>
Sent: Wednesday, July 14, 2021 10:20
To: [email protected]; Li, Xiaoyun <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: Zhang, Yuying <[email protected]>; [email protected]
Subject: [PATCH v1] app/testpmd: fix port MAC address after resetting port

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.

Quoted 8 lines
Fixes a5279d25616d ("app/testpmd: check status of getting MAC address")
---
 app/test-pmd/testpmd.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)