<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Sep 12, 2025 at 8:27 AM Khadem Ullah <<a href="mailto:14pwcse1224@uetpeshawar.edu.pk">14pwcse1224@uetpeshawar.edu.pk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>Hi Stephen,<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 12, 2025, 04:51 Stephen Hemminger <<a href="mailto:stephen@networkplumber.org" target="_blank">stephen@networkplumber.org</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Ok, the Windows #ifdef was confusing me then looked more closely.<br>
This patch is adding a set of rings so that primary and secondary<br>
can communicate, the adding one command.<br>
<br>
The idea is good, but there is a better way to handle this.<br>
There already exists a way for primary and secondary to communicate<br>
through the mp service. This is used for hotplug and pdump and probably<br>
other things as well.<br></blockquote></div></div><div dir="auto">Yeah, agree. Testpmd have also hutplug callbacks, I have tried that too, but it is in lower layer to call any stopping fwd_engines. </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
The communication can be either way, for example I proposed patches<br>
to pdump so that primary can tell secondary to participate.<br>
<br>
<a href="https://patchwork.dpdk.org/project/dpdk/patch/20250814165307.12786-7-stephen@networkplumber.org/" rel="noreferrer noreferrer" target="_blank">https://patchwork.dpdk.org/project/dpdk/patch/20250814165307.12786-7-stephen@networkplumber.org/</a><br>
<br>
This of testpmd can be done in similar way.<br>
The handler in secondary should be able to act same as<br>
when SIGINT is received. Set the flag f_exit which will cause the main<br>
loop to exit.<br>
<br>
This can then happen immediately, and the proc monitor alarm function<br>
is only then needed to handle when primary process crashes.<br></blockquote></div></div><div dir="auto">Yeah, we can try that, my only concern is that if it can handle and stop any numbers of secondary processes fwd_engines as the current solution can stop. </div><div dir="auto"><br></div></div></blockquote><div>Please check the __handle_primary_request in <a href="https://elixir.bootlin.com/dpdk/v25.07/source/lib/eal/common/hotplug_mp.c#L225">https://elixir.bootlin.com/dpdk/v25.07/source/lib/eal/common/hotplug_mp.c#L225</a>, </div><div>testpmd is calling this api during hutplug callbacks. <br></div><div>I had tried a similar one as proposed in pdump but could not call stop_packet_forwarding from this lower layer as given below. </div><div>There is only eal_bus_cleanup(), and local_dev_remove support. We only left with the ring solution</div><div>to used if for IPC as in <a href="https://elixir.bootlin.com/dpdk/v25.07/source/examples/multi_process/simple_mp/main.c#L75">https://elixir.bootlin.com/dpdk/v25.07/source/examples/multi_process/simple_mp/main.c#L75</a></div><div><br><br></div><div>git diff <br>diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c<br>index 0f58a31eb5..9155453efa 100644<br>--- a/app/test-pmd/testpmd.c<br>+++ b/app/test-pmd/testpmd.c<br>@@ -72,6 +72,7 @@<br> #endif<br> #ifdef RTE_NET_MLX5<br> #include "mlx5_testpmd.h"<br>+#include "hotplug_mp.h"<br> #endif<br> <br> #include "testpmd.h"<br>@@ -3634,6 +3635,11 @@ pmd_test_exit(void)<br>                        printf("\nStopping port %d...\n", pt_id);<br>                        fflush(stdout);<br>                        stop_port(pt_id);<br>+                       printf("Stopping secondary process...\n");<br>+                       struct eal_dev_mp_req req;<br>+                       memset(&req, 0, sizeof(req));<br>+                       req.t = ETH_REQ_STOP; //EAL_DEV_REQ_TYPE_DETACH;<br>+                       eal_dev_hotplug_request_to_secondary(&req);<br>                }<br>                RTE_ETH_FOREACH_DEV(pt_id) {<br>                        printf("\nShutting down port %d...\n", pt_id);<br>diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c<br>index 17089ca3db..d324db428f 100644<br>--- a/lib/eal/common/hotplug_mp.c<br>+++ b/lib/eal/common/hotplug_mp.c<br>@@ -239,6 +239,11 @@ static void __handle_primary_request(void *param)<br>        memset(&mp_resp, 0, sizeof(mp_resp));<br> <br>        switch (req->t) {<br>+       case ETH_REQ_STOP:<br>+               printf("__handle_secondary_request called "<br>+                       "for secondary processes fwd_engine stopping...\n");<br>+               //eal_bus_cleanup();<br>+               break;<br>        case EAL_DEV_REQ_TYPE_ATTACH:<br>        case EAL_DEV_REQ_TYPE_DETACH_ROLLBACK:<br>                ret = local_dev_probe(req->devargs, &dev);<br>diff --git a/lib/eal/common/hotplug_mp.h b/lib/eal/common/hotplug_mp.h<br>index 7221284286..7a46285994 100644<br>--- a/lib/eal/common/hotplug_mp.h<br>+++ b/lib/eal/common/hotplug_mp.h<br>@@ -19,6 +19,7 @@ enum eal_dev_req_type {<br>        EAL_DEV_REQ_TYPE_DETACH,<br>        EAL_DEV_REQ_TYPE_ATTACH_ROLLBACK,<br>        EAL_DEV_REQ_TYPE_DETACH_ROLLBACK,<br>+       ETH_REQ_STOP,<br> };<br><br> </div></div><div><br clear="all"></div><br></div>