[PATCH] app/testpmd: fix closing softnic port before ethdev ports

Dumitrescu, Cristian cristian.dumitrescu at intel.com
Thu Mar 9 20:08:11 CET 2023


> -----Original Message-----
> From: Jangra, Yogesh <yogesh.jangra at intel.com>
> Sent: Thursday, March 9, 2023 2:43 PM
> To: dev at dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu at intel.com>; Jangra, Yogesh
> <yogesh.jangra at intel.com>; R, Kamalakannan <kamalakannan.r at intel.com>;
> Suresh Narayane, Harshad <harshad.suresh.narayane at intel.com>
> Subject: [PATCH] app/testpmd: fix closing softnic port before ethdev ports
> 
> SoftNIC runs on the sevice core, it uses the resources from the testpmd
> application. When we run quit command, the testpmd application stops
> ethdev ports first, SoftNIC will try to access the port and sometimes
> that result in segmentation error.This fix will first close the SoftNIC port.
> 
> Signed-off-by: Yogesh Jangra <yogesh.jangra at intel.com>
> Signed-off-by: Kamalakannan R <kamalakannan.r at intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
> ---
>  app/test-pmd/testpmd.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 0032696608..aa831b2389 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -3767,6 +3767,21 @@ pmd_test_exit(void)
>  #endif
>  	if (ports != NULL) {
>  		no_link_check = 1;
> +
> +		/*
> +		 * SoftNIC runs on the sevice core, it uses the resources from
> +		 * the testpmd application. When we run quit command, the
> testpmd
> +		 * application stops ethdev ports first, SoftNIC will try to
> +		 * access the port and sometimes that result in segmentation
> +		 * error. So first closing the SoftNIC port.
> +		 */
> +		RTE_ETH_FOREACH_DEV(pt_id) {
> +			if (!strcmp(ports[pt_id].dev_info.driver_name,
> "net_softnic")) {
> +				stop_port(pt_id);
> +				close_port(pt_id);
> +			}
> +		}
> +
>  		RTE_ETH_FOREACH_DEV(pt_id) {
>  			printf("\nStopping port %d...\n", pt_id);
>  			fflush(stdout);
> --
> 2.25.1

Adding Aman and Yuying, the test-pmd maintainers.

Aman and Yuying, can you please review this patch when you get a chance, thank you!


More information about the dev mailing list