Commit 140ac7d4 authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/Aerial_multi_L2' into integration_2024_w29

parents 9aeacd34 612bbaec
......@@ -15,7 +15,7 @@ export CUDA_MPS_PIPE_DIRECTORY=/var
export CUDA_MPS_LOG_DIRECTORY=/var
# Stop existing MPS
echo quit | nvidia-cuda-mps-control
sudo -E echo quit | sudo -E nvidia-cuda-mps-control
# Start MPS
sudo -E nvidia-cuda-mps-control -d
......
......@@ -254,6 +254,16 @@ The gNB logs can be followed with:
```bash
docker logs -f oai-gnb-aerial
```
#### Running with multiple L2s
One L1 instance can support multiple L2 instances. See also the [aerial documentation](https://developer.nvidia.com/docs/gputelecom/aerial-sdk/text/cubb_quickstart/running_cubb-end-to-end.html#run-multiple-l2-instances-with-single-l1-instance) for more details.
In OAI the share memory prefix must be configured in the configuration file.
```bash
tr_s_preference = "aerial";
tr_s_shm_prefix = "nvipc";
```
### Stopping the setup
......
......@@ -201,6 +201,8 @@ sudo ethtool -G enp1s0f0 tx 4096 rx 4096
- Sometimes, the nrUE would keep repeating RA procedure because of Msg3 failure at the gNB. If it happens, add the `-A` option at the nrUE and/or gNB side, e.g., `-A 45`. This modifies the timing advance (in samples). Adjust +/-5 if the issue persists.
- This can be necessary since certain USRPs have larger signal delays than others; it is therefore specific to the used USRP model.
- The x310 and B210 are found to work with the default configuration; N310 and x410 can benefit from setting this timing advance.
- For example if the OAI UE uses the X410 and the gNB based on [Nvidia Aerial and Foxconn](./Aerial_FAPI_Split_Tutorial.md) a timing advance of 90 has been found to work well.
## 6.5 Lower latency on user plane
- To lower latency on the user plane, you can force the UE to be scheduled constantly in uplink: `--MACRLCs.[0].ulsch_max_frame_inactivity 0` .
......@@ -52,6 +52,7 @@ There is some general information in the [OpenAirInterface Gitlab Wiki](https://
- [How to use device-to-device communication (D2D, 4G)](./d2d_emulator_setup.txt)
- [How to run with E2 agent](../openair2/E2AP/README.md)
- [How to run the physical simulators](./physical-simulators.md)
- [How to setup OAI with Nvidia Aerial and Foxconn](./Aerial_FAPI_Split_Tutorial.md)
Legacy unmaintained files:
- [`L2NFAPI_NOS1.md`](./L2NFAPI_NOS1.md), [`L2NFAPI_S1.md`](./L2NFAPI_S1.md):
......
......@@ -79,6 +79,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "nfapi/oai_integration/vendor_ext.h"
#include "gnb_config.h"
#include "openair2/E1AP/e1ap_common.h"
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#ifdef ENABLE_AERIAL
#include "nfapi/oai_integration/aerial/fapi_nvIPC.h"
#endif
......@@ -748,7 +749,8 @@ int main( int argc, char **argv ) {
if (RC.nb_RU > 0)
start_NR_RU();
#ifdef ENABLE_AERIAL
nvIPC_Init();
gNB_MAC_INST *nrmac = RC.nrmac[0];
nvIPC_Init(nrmac->nvipc_params_s);
#endif
if (RC.nb_nr_L1_inst > 0) {
printf("wait RUs\n");
......
......@@ -590,24 +590,12 @@ static int aerial_recv_msg(nv_ipc_t *ipc, nv_ipc_msg_t *recv_msg)
}
bool recv_task_running = false;
int stick_this_thread_to_core(int core_id)
{
int num_cores = sysconf(_SC_NPROCESSORS_ONLN);
if (core_id < 0 || core_id >= num_cores)
return EINVAL;
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(core_id, &cpuset);
pthread_t current_thread = pthread_self();
return pthread_setaffinity_np(current_thread, sizeof(cpu_set_t), &cpuset);
}
void *epoll_recv_task(void *arg)
{
struct epoll_event ev, events[MAX_EVENTS];
stick_this_thread_to_core(10);
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 +637,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,17 +668,20 @@ int load_hard_code_config(nv_ipc_config_t *config, int module_type, nv_ipc_trans
return 0;
}
int nvIPC_Init() {
// Want to use transport SHM, type epoll, module secondary (reads the created shm from cuphycontroller)
int nvIPC_Init(nvipc_params_t nvipc_params_s)
{
// 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: creating 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();
int nvIPC_Init(nvipc_params_t);
#endif // OPENAIRINTERFACE_FAPI_NVIPC_H
#endif
......@@ -43,38 +43,9 @@ extern uint16_t sf_ahead;
extern uint16_t slot_ahead;
static pthread_t vnf_aerial_p7_start_pthread;
void *aerial_vnf_nr_aerial_p7_start_thread(void *ptr)
void *aerial_vnf_nr_p7_config_init(void *ptr)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
pthread_setname_np(pthread_self(), "VNF_P7_AERIAL");
nfapi_vnf_p7_config_t *config = (nfapi_vnf_p7_config_t *)ptr;
aerial_nfapi_nr_vnf_p7_start(config);
return config;
}
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);
......@@ -82,7 +53,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;
......@@ -112,8 +82,7 @@ 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);
return 0;
}
......@@ -223,13 +192,7 @@ int aerial_pnf_nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr
vnf->p7_vnfs[0].config,
vnf->p7_vnfs[0].thread_started);
if (p7_vnf->thread_started == 0) {
pthread_t vnf_p7_thread;
threadCreate(&vnf_p7_thread, &aerial_vnf_nr_p7_thread_start, p7_vnf, "aerial_p7_thread", -1, OAI_PRIORITY_RT);
p7_vnf->thread_started = 1;
} else {
// P7 thread already running.
}
aerial_vnf_nr_p7_config_init(p7_vnf);
// start all the phys in the pnf.
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Sending NFAPI_VNF_PARAM_REQUEST phy_id:%d\n", pnf->phys[0].id);
......@@ -566,13 +529,7 @@ void aerial_configure_nr_fapi_vnf()
vnf->p7_vnfs[0].config,
vnf->p7_vnfs[0].thread_started);
if (p7_vnf->thread_started == 0) {
pthread_t vnf_p7_thread;
threadCreate(&vnf_p7_thread, &aerial_vnf_nr_p7_thread_start, p7_vnf, "aerial_p7_thread", -1, OAI_PRIORITY_RT);
p7_vnf->thread_started = 1;
} else {
// P7 thread already running.
}
aerial_vnf_nr_p7_config_init(p7_vnf);
}
uint8_t aerial_unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
{
......@@ -583,45 +540,6 @@ uint8_t aerial_unpack_nr_config_response(uint8_t **ppReadPackedMsg, uint8_t *end
return unpack_nr_config_response(ppReadPackedMsg, end, msg, config);
}
// monitor the p7 endpoints and the timing loop and
// send indications to mac
int aerial_nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t *config)
{
if (config == 0)
return -1;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
// Create p7 receive udp port
// todo : this needs updating for Ipv6
NFAPI_TRACE(NFAPI_TRACE_INFO, "Initialising VNF P7 port:%u\n", config->port);
struct timespec ref_time;
clock_gettime(CLOCK_MONOTONIC, &ref_time);
uint8_t setup_done = 0;
while (vnf_p7->terminate == 0) {
if (setup_done == 0) {
struct timespec curr_time;
clock_gettime(CLOCK_MONOTONIC, &curr_time);
uint8_t setup_time = curr_time.tv_sec - ref_time.tv_sec;
if (setup_time > 3) {
setup_done = 1;
}
}
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p7 socket\n");
close(vnf_p7->socket);
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() returning\n", __FUNCTION__);
return 0;
}
int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req)
{
nfapi_vnf_p7_config_t *p7_config = aerial_vnf.p7_vnfs[0].config;
......
......@@ -64,7 +64,6 @@ int oai_fapi_send_end_request(int cell_id, uint32_t frame, uint32_t slot);
uint8_t aerial_unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
uint8_t aerial_unpack_nr_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
int aerial_pnf_nr_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx);
int aerial_nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t *config);
int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req);
int oai_fapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req);
......
......@@ -47,6 +47,8 @@
#define CONFIG_STRING_MACRLC_LOCAL_N_PORTD "local_n_portd"
#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"
......@@ -123,6 +125,8 @@
{CONFIG_STRING_MACRLC_MIN_GRANT_MCS, HLP_MACRLC_MIN_GRANT_MCS, 0, .u8ptr=NULL, .defintval=9, TYPE_UINT8, 0}, \
{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
......@@ -159,6 +163,8 @@
#define MACRLC_MIN_GRANT_MCS_IDX 30
#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 } }, \
......@@ -194,6 +200,8 @@
{ .s5 = { NULL } }, \
{ .s2 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s2 = { NULL } }, \
}
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
......
......@@ -1359,7 +1359,10 @@ 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
printf("Configuring VNF for Aerial connection\n");
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
} else { // other midhaul
......
......@@ -559,6 +559,8 @@ typedef enum {
#define CONFIG_STRING_MACRLC_LOCAL_N_PORTD "local_n_portd"
#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"
......
......@@ -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
......
......@@ -80,7 +80,9 @@ void handle_nr_rach(NR_UL_IND_t *UL_info)
LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",
UL_info->frame, UL_info->slot, UL_info->rach_ind.sfn, UL_info->rach_ind.slot);
for (int i = 0; i < UL_info->rach_ind.number_of_pdus; i++) {
AssertFatal(UL_info->rach_ind.pdu_list[i].num_preamble == 1, "More than 1 preamble not supported\n");
if (UL_info->rach_ind.pdu_list[i].num_preamble > 1) {
LOG_E(MAC, "Not more than 1 preamble per RACH PDU supported, ignoring the rest\n");
}
nr_initiate_ra_proc(UL_info->module_id,
UL_info->CC_id,
UL_info->rach_ind.sfn,
......
......@@ -336,6 +336,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];
......
......@@ -207,14 +207,17 @@ gNBs =
MACRLCs = (
{
num_cc = 1;
local_s_if_name = "lo:";
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
remote_s_portc = 50000; // pnf p5 port [!]
local_s_portd = 50011; // vnf p7 port [!]
remote_s_portd = 50010; // pnf p7 port [!]
tr_s_preference = "aerial";
tr_n_preference = "local_RRC";
pusch_FailureThres = 10;
pusch_TargetSNRx10 = 280; # 150;
......
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