Commit 26e3f32b authored by Melissa Elkadi's avatar Melissa Elkadi

Fixed fill_ul_mutex

Mutexes were not being initialized. In multiple
places they were not being unlocked. In fill rach
it was not being locked or unlocked.
parent bc524ea1
......@@ -479,6 +479,7 @@ char *log_getthreadname(char *threadname,
}
#if LOG_MINIMAL
#include <sys/syscall.h>
void logMinimal(int comp, int level, const char *format, ...)
{
struct timespec ts;
......@@ -486,9 +487,10 @@ void logMinimal(int comp, int level, const char *format, ...)
abort();
char buf[MAX_LOG_TOTAL];
int n = snprintf(buf, sizeof(buf), "%lu.%06lu [%s] %c ",
int n = snprintf(buf, sizeof(buf), "%lu.%06lu %08lx [%s] %c ",
ts.tv_sec,
ts.tv_nsec / 1000,
syscall(__NR_gettid),
g_log->log_component[comp].name,
level);
if (n < 0 || n >= sizeof(buf))
......
......@@ -41,9 +41,9 @@
#include "common/utils/LOG/log.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "PHY_INTERFACE/phy_stub_UE.h"
#include "common/ran_context.h"
extern void openair_rrc_top_init_ue( int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, uint8_t HO_active);
void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char eNB_index, uint8_t first_sync) { //init as MR
......@@ -89,6 +89,16 @@ mac_top_init_ue(int eMBMS_active, char *uecap_xer,
UE_mac_inst = NULL;
}
// mutex below are used for multiple UE's L2 FAPI simulation.
if (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
pthread_mutex_init(&fill_ul_mutex.rx_mutex,NULL);
pthread_mutex_init(&fill_ul_mutex.crc_mutex,NULL);
pthread_mutex_init(&fill_ul_mutex.sr_mutex,NULL);
pthread_mutex_init(&fill_ul_mutex.harq_mutex,NULL);
pthread_mutex_init(&fill_ul_mutex.cqi_mutex,NULL);
pthread_mutex_init(&fill_ul_mutex.rach_mutex,NULL);
}
LOG_I(MAC, "[MAIN] calling RRC\n");
openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active,
HO_active);
......
......@@ -47,6 +47,8 @@ queue_t dl_config_req_tx_req_queue;
queue_t ul_config_req_queue;
queue_t hi_dci0_req_queue;
FILL_UL_INFO_MUTEX_t fill_ul_mutex;
int current_sfn_sf;
sem_t sfn_semaphore;
......@@ -114,6 +116,8 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,
UL_INFO->rx_ind.rx_indication_body.number_of_pdus++;
UL_INFO->rx_ind.sfn_sf = frame << 4 | subframe;
pthread_mutex_unlock(&fill_ul_mutex.rx_mutex);
}
void fill_sr_indication_UE_MAC(int Mod_id,
......@@ -152,6 +156,8 @@ void fill_sr_indication_UE_MAC(int Mod_id,
// UL_INFO->rx_ind.rx_indication_body.number_of_pdus++;
sr_ind_body->number_of_srs++;
pthread_mutex_unlock(&fill_ul_mutex.sr_mutex);
}
void fill_crc_indication_UE_MAC(int Mod_id,
......@@ -188,6 +194,8 @@ void fill_crc_indication_UE_MAC(int Mod_id,
__FUNCTION__,
pdu->rx_ue_information.rnti,
UL_INFO->crc_ind.crc_indication_body.number_of_crcs);
pthread_mutex_unlock(&fill_ul_mutex.crc_mutex);
}
void fill_rach_indication_UE_MAC(int Mod_id,
......@@ -196,6 +204,8 @@ void fill_rach_indication_UE_MAC(int Mod_id,
UL_IND_t *UL_INFO,
uint8_t ra_PreambleIndex,
uint16_t ra_RNTI) {
pthread_mutex_lock(&fill_ul_mutex.rach_mutex);
UL_INFO->rach_ind.rach_indication_body.number_of_preambles = 1;
UL_INFO->rach_ind.header.message_id = NFAPI_RACH_INDICATION;
......@@ -245,6 +255,8 @@ void fill_rach_indication_UE_MAC(int Mod_id,
}
free(UL_INFO->rach_ind.rach_indication_body.preamble_list);
pthread_mutex_unlock(&fill_ul_mutex.rach_mutex);
}
void fill_ulsch_cqi_indication_UE_MAC(int Mod_id,
......@@ -333,6 +345,8 @@ void fill_ulsch_harq_indication_UE_MAC(
}
UL_INFO->harq_ind.harq_indication_body.number_of_harqs++;
pthread_mutex_unlock(&fill_ul_mutex.harq_mutex);
}
void fill_uci_harq_indication_UE_MAC(int Mod_id,
......@@ -425,6 +439,8 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
LOG_D(PHY,
"Incremented eNB->UL_INFO.harq_ind.number_of_harqs:%d\n",
UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
pthread_mutex_unlock(&fill_ul_mutex.harq_mutex);
}
void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
......
......@@ -22,7 +22,7 @@
#include "queue.h"
// this mutex is used to set multiple UE's UL value in L2 FAPI simulator.
FILL_UL_INFO_MUTEX_t fill_ul_mutex;
extern FILL_UL_INFO_MUTEX_t fill_ul_mutex;
//below 2 difinitions move to phy_stub_UE.c to add initialization when difinition.
extern UL_IND_t *UL_INFO;
// New
......
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