Implementation of STOP exchange

This implements the STOP.request/indication for all 3 transport mechanisms, the VNF will send the STOP.request to the PNF, indicating it will disconnect, and await a STOP.indication from the PNF

The WLS VNF is reworked to be able to start before the PNF, by calling call rte_eal_init and rte_dev_probe to determine if dpdk has been initialized properly, before calling rte_eal_init in the intended process when it is appropriate to do so
This commit is contained in:
Rúben Soares Silva
2025-10-23 14:08:37 +01:00
parent 3247c2933f
commit e08d904af0
26 changed files with 344 additions and 20 deletions
+57
View File
@@ -1749,6 +1749,62 @@ void vnf_start_thread(void *ptr) {
nfapi_vnf_start((nfapi_vnf_config_t *)ptr);
}
static bool has_stop_ind = false;
static bool waiting_stop_ind = false;
int nr_stop_ind_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_stop_indication_scf_t *resp)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Received NFAPI_STOP_IND idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
has_stop_ind = true;
#ifdef ENABLE_AERIAL
nvIPC_Stop();
#endif
#ifdef ENABLE_SOCKET
nfapi_vnf_p7_stop(get_p7_vnf_config());
#endif
#ifdef ENABLE_WLS
wls_vnf_stop();
#endif
if (!waiting_stop_ind) {
// hasn't been initialized yet, means the PNF stopped before the VNF did
// raise a SIGINT to stop the VNF
raise(SIGINT);
}
return 0;
}
void stop_nr_nfapi_vnf()
{
if (has_stop_ind) {
// If it got here with the STOP.indication flag already set, it means it was triggered by the PNF,
// no need to send a STOP.request
return;
}
#ifdef ENABLE_WLS
wls_vnf_send_stop_request();
#endif
#ifdef ENABLE_AERIAL
nvIPC_send_stop_request();
#endif
#ifdef ENABLE_SOCKET
socket_nfapi_send_stop_request((vnf_t *)config);
#endif
waiting_stop_ind = true;
uint64_t counter = 0;
vnf_p7_t *p7_vnf = get_p7_vnf();
while (p7_vnf->terminate == 0 && counter < 50) {
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "Not terminated yet, counter %ld\n", counter);
usleep(1000);
counter++;
}
if (p7_vnf->terminate == 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "STOP.indication timed out, exiting\n");
nfapi_nr_stop_indication_scf_t msg = {.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION, .header.phy_id = 0};
config->nr_stop_ind(config, 0, &msg);
} else {
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "Terminated, exiting\n");
}
}
void configure_nr_nfapi_vnf(eth_params_t params)
{
#ifndef ENABLE_AERIAL
@@ -1790,6 +1846,7 @@ void configure_nr_nfapi_vnf(eth_params_t params)
config->nr_param_resp = &nr_param_resp_cb;
config->nr_config_resp = &nr_config_resp_cb;
config->nr_start_resp = &nr_start_resp_cb;
config->nr_stop_ind = &nr_stop_ind_cb;
config->nr_error_ind = &nr_error_ind_cb;
config->vendor_ext = &vendor_nr_ext_cb;
config->user_data = vnf;