net/vpp: fix detach error handling
When VPP detach fails (e.g. when VPP dies before application), net
framework never finishes.
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464678 (master)
(cherry picked from commit 75da6acb1a
)
Change-Id: I2cbc7bde274e185fdf7f3cf1c7ea3ddd14dcf365
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467139
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
9f7075ea8d
commit
6787994d30
@ -131,6 +131,7 @@ static struct spdk_vpp_main {
|
||||
|
||||
struct spdk_poller *vpp_queue_poller;
|
||||
struct spdk_poller *app_queue_poller;
|
||||
struct spdk_poller *timeout_poller;
|
||||
} g_svm;
|
||||
|
||||
struct spdk_vpp_sock_group_impl {
|
||||
@ -1263,8 +1264,13 @@ err:
|
||||
static void
|
||||
_spdk_vpp_application_detached(void *arg)
|
||||
{
|
||||
if (!g_svm.vpp_initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
spdk_poller_unregister(&g_svm.vpp_queue_poller);
|
||||
spdk_poller_unregister(&g_svm.app_queue_poller);
|
||||
spdk_poller_unregister(&g_svm.timeout_poller);
|
||||
|
||||
g_svm.vpp_initialized = false;
|
||||
g_svm.vpp_state = VPP_STATE_START;
|
||||
@ -1276,13 +1282,22 @@ _spdk_vpp_application_detached(void *arg)
|
||||
spdk_net_framework_fini_next();
|
||||
}
|
||||
|
||||
static int
|
||||
_spdk_vpp_application_detached_timeout(void *arg)
|
||||
{
|
||||
if (g_svm.vpp_initialized) {
|
||||
/* We need to finish detach on initial thread */
|
||||
spdk_thread_send_msg(g_svm.init_thread, _spdk_vpp_application_detached, NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
vl_api_application_detach_reply_t_handler(vl_api_application_detach_reply_t *mp)
|
||||
{
|
||||
if (mp->retval) {
|
||||
SPDK_ERRLOG("Application detach from VPP failed (%d).\n", ntohl(mp->retval));
|
||||
g_svm.vpp_state = VPP_STATE_FAILED;
|
||||
return;
|
||||
}
|
||||
|
||||
/* We need to finish detach on initial thread */
|
||||
@ -1305,6 +1320,9 @@ _spdk_vpp_app_detach(void)
|
||||
bmp->context = ntohl(0xfeedface);
|
||||
vl_msg_api_send_shmem(g_svm.vl_input_queue, (u8 *)&bmp);
|
||||
|
||||
g_svm.timeout_poller = spdk_poller_register(_spdk_vpp_application_detached_timeout,
|
||||
NULL, 10000000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user