[v2] app/testpmd: fix closing softnic port before ethdev ports
Checks
Commit Message
SoftNIC runs on the service 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 results in segmentation
error. This fix will first close the SoftNIC port.
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
Signed-off-by: Kamalakannan R <kamalakannan.r@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
app/test-pmd/testpmd.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
Comments
On 3/9/2023 4:02 PM, Yogesh Jangra wrote:
> SoftNIC runs on the service 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 results in segmentation
> error. This fix will first close the SoftNIC port.
>
> Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
> Signed-off-by: Kamalakannan R <kamalakannan.r@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>
I am cleaning up old patches in patchwork.
NACK to this patch as it is, testpmd should not behave different for any
specific driver/device. This can go out of hand if we open the door.
@@ -3767,6 +3767,21 @@ pmd_test_exit(void)
#endif
if (ports != NULL) {
no_link_check = 1;
+
+ /*
+ * SoftNIC runs on the service 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 results 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);