Commit 152c6bfa authored by Florian Kaltenberger's avatar Florian Kaltenberger

making the nvipc thread affinity configurable and using threadCreate.

removing thread vnf_aerial_p7_start_pthread as it was not doing anything.
parent e3e2e449
......@@ -750,7 +750,7 @@ int main( int argc, char **argv ) {
start_NR_RU();
#ifdef ENABLE_AERIAL
gNB_MAC_INST *nrmac = RC.nrmac[0];
nvIPC_Init(nrmac->eth_params_s.local_if_name);
nvIPC_Init(nrmac->nvipc_params_s);
#endif
if (RC.nb_nr_L1_inst > 0) {
printf("wait RUs\n");
......
......@@ -606,8 +606,12 @@ int stick_this_thread_to_core(int core_id)
void *epoll_recv_task(void *arg)
{
struct epoll_event ev, events[MAX_EVENTS];
//stick_this_thread_to_core(10);
//pthread_setname_np(pthread_self(), "VNF_nvIPC_AERIAL");
LOG_D(NFAPI_VNF,"Aerial recv task start \n");
int epoll_fd = epoll_create1(0);
if (epoll_fd == -1) {
LOG_E(NFAPI_VNF, "%s epoll_create failed\n", __func__);
......@@ -649,19 +653,10 @@ void *epoll_recv_task(void *arg)
return NULL;
}
int create_recv_thread(void)
void create_recv_thread(int8_t affinity)
{
pthread_t thread_id;
void *(*recv_task)(void *);
recv_task = epoll_recv_task;
int ret = pthread_create(&thread_id, NULL, recv_task, NULL);
if (ret != 0) {
LOG_E(NFAPI_VNF, "%s failed, ret = %d\n", __func__, ret);
}
return ret;
threadCreate(&thread_id,epoll_recv_task, NULL, "vnf_nvipc_aerial", affinity, OAI_PRIORITY_RT);
}
int load_hard_code_config(nv_ipc_config_t *config, int module_type, nv_ipc_transport_t _transport)
......@@ -689,20 +684,20 @@ int load_hard_code_config(nv_ipc_config_t *config, int module_type, nv_ipc_trans
return 0;
}
int nvIPC_Init(char* if_name) {
int nvIPC_Init(nvipc_params_t nvipc_params_s) {
//int module, transport;
// Want to use transport SHM, type epoll, module secondary (reads the created shm from cuphycontroller)
load_hard_code_config(&nv_ipc_config, NV_IPC_MODULE_SECONDARY, NV_IPC_TRANSPORT_SHM);
// Create nv_ipc_t instance
LOG_I(NFAPI_VNF, "%s: creatinf IPC interface with prefix %s\n", __func__, if_name);
strcpy(nv_ipc_config.transport_config.shm.prefix,if_name);
LOG_I(NFAPI_VNF, "%s: creatinf IPC interface with prefix %s\n", __func__, nvipc_params_s.nvipc_shm_prefix);
strcpy(nv_ipc_config.transport_config.shm.prefix,nvipc_params_s.nvipc_shm_prefix);
if ((ipc = create_nv_ipc_interface(&nv_ipc_config)) == NULL) {
LOG_E(NFAPI_VNF, "%s: create IPC interface failed\n", __func__);
return -1;
}
LOG_I(NFAPI_VNF, "%s: create IPC interface successful\n", __func__);
sleep(1);
create_recv_thread();
create_recv_thread(nvipc_params_s.nvipc_poll_core);
while(!recv_task_running){usleep(100000);}
aerial_pnf_nr_connection_indication_cb(vnf_config, 1);
return 0;
......
......@@ -55,7 +55,7 @@ int aerial_send_P7_msg_with_data(void *packedBuf,
uint32_t dataLength,
nfapi_p7_message_header_t *header);
void set_config(nfapi_vnf_config_t *conf);
int nvIPC_Init(char *);
int nvIPC_Init(nvipc_params_t);
#endif // OPENAIRINTERFACE_FAPI_NVIPC_H
#endif
......@@ -54,26 +54,7 @@ void *aerial_vnf_nr_aerial_p7_start_thread(void *ptr)
void *aerial_vnf_nr_p7_thread_start(void *ptr)
{
int s;
cpu_set_t cpuset;
//CPU_SET(8, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
printf("failed to set afinity\n");
pthread_attr_t ptAttr;
if (pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0) {
printf("Failed to set pthread sched policy SCHED_RR\n");
}
pthread_attr_setinheritsched(&ptAttr, PTHREAD_EXPLICIT_SCHED);
struct sched_param thread_params;
thread_params.sched_priority = 20;
if (pthread_attr_setschedparam(&ptAttr, &thread_params) != 0) {
printf("failed to set sched param\n");
}
vnf_p7_info *p7_vnf = (vnf_p7_info *)ptr;
init_queue(&gnb_rach_ind_queue);
init_queue(&gnb_rx_ind_queue);
......@@ -81,7 +62,6 @@ void *aerial_vnf_nr_p7_thread_start(void *ptr)
init_queue(&gnb_uci_ind_queue);
init_queue(&gnb_slot_ind_queue);
vnf_p7_info *p7_vnf = (vnf_p7_info *)ptr;
p7_vnf->config->port = p7_vnf->local_port;
p7_vnf->config->sync_indication = &aerial_phy_sync_indication;
p7_vnf->config->slot_indication = &aerial_phy_slot_indication;
......@@ -111,8 +91,11 @@ void *aerial_vnf_nr_p7_thread_start(void *ptr)
p7_vnf->config->codec_config.deallocate = &aerial_vnf_deallocate;
p7_vnf->config->allocate_p7_vendor_ext = &aerial_phy_allocate_p7_vendor_ext;
p7_vnf->config->deallocate_p7_vendor_ext = &aerial_phy_deallocate_p7_vendor_ext;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI P7 start thread %s\n", __FUNCTION__);
threadCreate(&vnf_aerial_p7_start_pthread, &aerial_vnf_nr_aerial_p7_start_thread, p7_vnf->config, "aerial_p7_start", -1, OAI_PRIORITY_RT);
// FK 20240521
// with Aerial, the P7 thread is not doing anything except, so we don't start it anymore.
//threadCreate(&vnf_aerial_p7_start_pthread, &aerial_vnf_nr_aerial_p7_start_thread, p7_vnf->config, "aerial_p7_start", -1, OAI_PRIORITY_RT);
return 0;
}
......
......@@ -48,6 +48,7 @@
#define CONFIG_STRING_MACRLC_REMOTE_N_PORTD "remote_n_portd"
#define CONFIG_STRING_MACRLC_TRANSPORT_S_PREFERENCE "tr_s_preference"
#define CONFIG_STRING_MACRLC_TRANSPORT_S_SHM_PREFIX "tr_s_shm_prefix"
#define CONFIG_STRING_MACRLC_TRANSPORT_S_POLL_CORE "tr_s_poll_core"
#define CONFIG_STRING_MACRLC_LOCAL_S_ADDRESS "local_s_address"
#define CONFIG_STRING_MACRLC_REMOTE_S_ADDRESS "remote_s_address"
#define CONFIG_STRING_MACRLC_LOCAL_S_PORTC "local_s_portc"
......@@ -125,6 +126,7 @@
{CONFIG_STRING_MACRLC_IDENTITY_PM, HLP_MACRLC_IDENTITY_PM, PARAMFLAG_BOOL, .u8ptr=NULL, .defintval=0, TYPE_UINT8, 0}, \
{CONFIG_STRING_MACRLC_LOCAL_N_ADDRESS_F1U, NULL, 0, .strptr=NULL, .defstrval=NULL, TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_TRANSPORT_S_SHM_PREFIX, NULL, 0, .strptr=NULL, .defstrval="nvipc", TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_TRANSPORT_S_POLL_CORE, NULL, 0, .i8ptr=NULL, .defintval=-1, TYPE_INT8, 0}, \
}
// clang-format off
......@@ -162,6 +164,7 @@
#define MACRLC_IDENTITY_PM_IDX 31
#define MACRLC_LOCAL_N_ADDRESS_F1U_IDX 32
#define MACRLC_TRANSPORT_S_SHM_PREFIX 33
#define MACRLC_TRANSPORT_S_POLL_CORE 34
#define MACRLCPARAMS_CHECK { \
{ .s5 = { NULL } }, \
......
......@@ -1349,8 +1349,8 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.nrmac[j]->eth_params_s.my_portc);
} else if(strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "aerial") == 0){
#ifdef ENABLE_AERIAL
// we are abusing slightly the struture as we are not really using ethernet transport in this case
RC.nrmac[j]->eth_params_s.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_SHM_PREFIX].strptr));
RC.nrmac[j]->nvipc_params_s.nvipc_shm_prefix = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_SHM_PREFIX].strptr));
RC.nrmac[j]->nvipc_params_s.nvipc_poll_core = *(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_POLL_CORE].i8ptr);
printf("Configuring VNF for Aerial connection with prefix %s\n",RC.nrmac[j]->eth_params_s.local_if_name);
aerial_configure_nr_fapi_vnf();
#endif
......
......@@ -760,6 +760,8 @@ typedef struct gNB_MAC_INST_s {
char *f1u_addr;
/// Ethernet parameters for fronthaul interface
eth_params_t eth_params_s;
/// Nvipc parameters for FAPI interface with Aerial
nvipc_params_t nvipc_params_s;
/// Module
module_id_t Mod_id;
/// timing advance group
......
......@@ -334,6 +334,11 @@ typedef struct {
uint8_t if_compress;
} eth_params_t;
typedef struct {
char *nvipc_shm_prefix;
int8_t nvipc_poll_core;
} nvipc_params_t;
typedef struct {
//! Tx buffer for if device, keep one per subframe now to allow multithreading
void *tx[10];
......
......@@ -210,6 +210,7 @@ MACRLCs = (
tr_s_preference = "aerial";
tr_s_shm_prefix = "nvipc";
tr_s_poll_core = 10;
remote_s_address = "127.0.0.1"; // pnf addr [!]
local_s_address = "127.0.0.2"; // vnf addr
local_s_portc = 50001; // vnf p5 port
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment