[v1] app/testpmd: fix port MAC address after resetting port

Message ID 20210714022027.940655-1-yuying.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v1] app/testpmd: fix port MAC address after resetting port |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot success github build: passed
ci/Intel-compilation success Compilation OK
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-testing fail Testing issues
ci/iol-intel-Performance fail Performance Testing issues

Commit Message

Zhang, Yuying July 14, 2021, 2:20 a.m. UTC
  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")
Cc: stable@dpdk.org

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 app/test-pmd/testpmd.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
  

Comments

Singh, Aman Deep July 14, 2021, 11:43 a.m. UTC | #1
Hi Yuying,

On 7/14/2021 7:50 AM, Yuying Zhang wrote:
> 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")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
> ---
>   app/test-pmd/testpmd.c | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 1cdd3cdd12..204e0d52cd 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -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;

Acked-by: Aman Deep Singh <aman.deep.singh@intel.com>
  
Li, Xiaoyun July 15, 2021, 2:15 a.m. UTC | #2
> -----Original Message-----
> From: Zhang, Yuying <yuying.zhang@intel.com>
> Sent: Wednesday, July 14, 2021 10:20
> To: dev@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: Zhang, Yuying <yuying.zhang@intel.com>; stable@dpdk.org
> 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.
> 
> Fixes: a5279d25616d ("app/testpmd: check status of getting MAC address")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
> ---
>  app/test-pmd/testpmd.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
  
Thomas Monjalon July 24, 2021, 11:29 a.m. UTC | #3
> > 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")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
> 
> Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>

Applied, thanks
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 1cdd3cdd12..204e0d52cd 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -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;