Commit 133aa928 authored by Raymond Knopp's avatar Raymond Knopp

temporary version, use of threadPool for two main RX/TX gNB threads switched...

temporary version, use of threadPool for two main RX/TX gNB threads switched to simpler MsgQ and handler thread. TX is called directly from RX thread instead of spawned. with sl_ahead set to TDD period, only TX or RX will execute in a given slot (except in mixed-slot).

MIMO not working well when throughput is pushed.
parent 5067a2de
......@@ -87,6 +87,7 @@
#include <openair1/PHY/NR_TRANSPORT/nr_dlsch.h>
#include <PHY/NR_ESTIMATION/nr_ul_estimation.h>
#define USE_MSGQ 1
//#define USRP_DEBUG 1
// Fix per CC openair rf/if device update
// extern openair0_device openair0;
......@@ -150,8 +151,20 @@ void *L1_rx_thread(void *arg) {
rx_func(info);
delNotifiedFIFO_elt(res);
}
return NULL;
}
void *L1_tx_thread(void *arg) {
PHY_VARS_gNB *gNB = (PHY_VARS_gNB*)arg;
while (oai_exit == 0) {
notifiedFIFO_elt_t *res = pullNotifiedFIFO(&gNB->L1_tx_out);
processingData_L1tx_t *info = (processingData_L1tx_t *)NotifiedFifoData(res);
tx_func(info);
delNotifiedFIFO_elt(res);
}
return NULL;
}
void rx_func(void *param) {
processingData_L1_t *info = (processingData_L1_t *) param;
PHY_VARS_gNB *gNB = info->gNB;
......@@ -280,12 +293,13 @@ void rx_func(void *param) {
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
stop_meas(&gNB->ul_indication_stats);
int tx_slot_type = nr_slot_select(cfg,frame_rx,slot_tx);
int tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx);
if ((tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) && NFAPI_MODE != NFAPI_MODE_PNF) {
notifiedFIFO_elt_t *res;
processingData_L1tx_t *syncMsg;
// Its a FIFO so it maitains the order in which the MAC fills the messages
// so no need for checking for right slot
#ifndef USE_MSGQ
if (get_softmodem_params()->reorder_thread_disable)
res = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
else
......@@ -297,6 +311,12 @@ void rx_func(void *param) {
syncMsg->timestamp_tx = info->timestamp_tx;
res->key = slot_tx;
pushTpool(&gNB->threadPool, res);
#else
syncMsg = gNB->msgDataTx;
syncMsg->gNB = gNB;
syncMsg->timestamp_tx = info->timestamp_tx;
tx_func(syncMsg);
#endif
} else if (get_softmodem_params()->continuous_tx) {
notifiedFIFO_elt_t *res = pullTpool(&gNB->L1_tx_free, &gNB->threadPool);
if (res == NULL)
......@@ -503,6 +523,8 @@ void init_gNB_Tpool(int inst) {
#ifdef USE_MSGQ
threadCreate(&gNB->L1_rx_thread, L1_rx_thread, (void *)gNB, "L1_rx_thread",
gNB->L1_rx_thread_core, OAI_PRIORITY_RT_MAX);
// threadCreate(&gNB->L1_tx_thread, L1_tx_thread, (void *)gNB, "L1_tx_thread",
// gNB->L1_tx_thread_core, OAI_PRIORITY_RT_MAX);
#endif
if (get_softmodem_params()->reorder_thread_disable) {
notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t), 0, &gNB->L1_tx_out, tx_func);
......@@ -510,7 +532,11 @@ void init_gNB_Tpool(int inst) {
memset(msgDataTx, 0, sizeof(processingData_L1tx_t));
init_DLSCH_struct(gNB, msgDataTx);
memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t));
#ifndef USE_MSGQ
pushNotifiedFIFO(&gNB->L1_tx_out, msgL1Tx); // to unblock the process in the beginning
#else
gNB->msgDataTx = msgDataTx;
#endif
} else {
// we create 2 threads for L1 tx processing
for (int i=0; i < 2; i++) {
......
......@@ -768,8 +768,9 @@ typedef struct PHY_VARS_gNB_s {
tpool_t threadPool;
pthread_t L1_rx_thread;
int L1_rx_thread_core;
pthread_t thread_L1_tx;
pthread_t L1_tx_thread;
int L1_tx_thread_core;
struct processingData_L1tx *msgDataTx;
int nbDecode;
int number_of_nr_dlsch_max;
int number_of_nr_ulsch_max;
......
......@@ -36,6 +36,8 @@
#include "PHY/NR_TRANSPORT/nr_dci.h"
#include "nfapi/oai_integration/vendor_ext.h"
#define USE_MSGQ 1
extern int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req);
extern int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req);
extern int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req);
......@@ -163,6 +165,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT) {
notifiedFIFO_elt_t *res;
#ifndef USE_MSGQ
if (gNB->reorder_thread_disable)
res = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
else
......@@ -170,6 +173,9 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
if (res == NULL)
return; // Tpool has been stopped, nothing to process
processingData_L1tx_t *msgTx = (processingData_L1tx_t *)NotifiedFifoData(res);
#else
processingData_L1tx_t *msgTx = gNB->msgDataTx; //newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0, &gNB->L1_tx_out,NULL);
#endif
/* const time_stats_t ts = exec_time_stats_NotifiedFIFO(res);
merge_meas(&gNB->phy_proc_tx, &ts);
*/
......@@ -215,12 +221,15 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
for (int i=0; i<number_ul_dci_pdu; i++)
msgTx->ul_pdcch_pdu[i] = UL_dci_req->ul_dci_pdu_list[i];
#ifndef USE_MSGQ
if (gNB->reorder_thread_disable)
pushNotifiedFIFO(&gNB->L1_tx_out,res);
else
pushNotifiedFIFO(&gNB->L1_tx_filled,res);
#else
//pushNotifiedFIFO(&gNB->L1_tx_out, res);
#endif
}
for (int i = 0; i < number_ul_tti_pdu; i++) {
switch (UL_tti_req->pdus_list[i].pdu_type) {
case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
......
......@@ -98,9 +98,9 @@
#define L1_PUSCH_DTX_THRESHOLD 13
#define L1_SRS_DTX_THRESHOLD 14
#define L1_MAX_LDPC_ITERATIONS 15
#define L1_TX_AMP_BACKOFF_dB 15
#define L1_RX_THREAD_CORE 16
#define L1_TX_THREAD_CORE 17
#define L1_TX_AMP_BACKOFF_dB 16
#define L1_RX_THREAD_CORE 17
#define L1_TX_THREAD_CORE 18
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
#endif
......@@ -765,6 +765,7 @@ void RCconfig_NR_L1(void)
RC.gNB[j]->L1_rx_thread_core = *(L1_ParamList.paramarray[j][L1_RX_THREAD_CORE].iptr);
RC.gNB[j]->L1_tx_thread_core = *(L1_ParamList.paramarray[j][L1_TX_THREAD_CORE].iptr);
LOG_I(PHY,"TX_AMP = %d (-%d dBFS)\n",RC.gNB[j]->TX_AMP,*L1_ParamList.paramarray[j][L1_TX_AMP_BACKOFF_dB].uptr);
LOG_I(PHY,"L1_RX_THREAD_CORE %d (%d)\n",*(L1_ParamList.paramarray[j][L1_RX_THREAD_CORE].iptr),L1_RX_THREAD_CORE);
if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
// sf_ahead = 2; // Need 4 subframe gap between RX and TX
} else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
......
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