Commit b5708a3a authored by Michael Cook's avatar Michael Cook

Checkpoint.

parent 6e721cec
......@@ -23,7 +23,16 @@
#include <pthread.h>
#include "nfapi/oai_integration/vendor_ext.h"
#include "common/utils/LOG/log.h"
static char nfapi_str_mode[][24] = {"MONOLITHIC","PNF","VNF","UE_STUB_PNF","UE_STUB_OFFNET","STANDALONE_PNF","<UNKNOWN NFAPI MODE>"};
static char nfapi_str_mode[][24] = {
"MONOLITHIC",
"PNF",
"VNF",
"UE_STUB_PNF",
"UE_STUB_OFFNET",
"STANDALONE_PNF",
"<UNKNOWN NFAPI MODE>"
};
typedef struct {
nfapi_mode_t nfapi_mode;
......
......@@ -4530,40 +4530,48 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
return 1;
}
static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config) {
static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{
uint8_t proceed = 1;
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t *)msg;
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
if (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
return 0;
while (((uint8_t *)(*ppReadPackedMsg) < end) && proceed) {
while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
{
nfapi_tl_t generic_tl;
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
return 0;
switch (generic_tl.tag) {
case NFAPI_UE_RELEASE_BODY_TAG: {
switch(generic_tl.tag)
{
case NFAPI_UE_RELEASE_BODY_TAG:
{
pNfapiMsg->ue_release_request_body.tl = generic_tl;
if (pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0)
if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0)
return 0;
if (pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI) {
if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI);
return 0;
} else {
uint8_t j;
uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs;
for (j = 0; j < num; ++j) {
if (pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0) {
for(j = 0; j < num; ++j){
if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){
return 0;
}
}
}
} break;
default: {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag);
} break;
}
break;
default:
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag );
}
break;
};
}
......
......@@ -199,9 +199,8 @@ get_prach_resources(module_id_t module_idP,
UE_mac_inst[module_idP].
RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER =
get_Po_NOMINAL_PUSCH(module_idP, CC_id);
} else {
} else { // Msg3 is being retransmitted
LOG_E(MAC, "Didnt set UE Mode Correctly\n");
// Msg3 is being retransmitted
if (UE_mac_inst[module_idP].RA_usedGroupA == 1) {
if (rach_ConfigCommon->preambleInfo.preamblesGroupAConfig) {
UE_mac_inst[module_idP].RA_prach_resources.
......
......@@ -937,7 +937,6 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc,
int memcpy_ul_config_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req)
{
// make same changes as in dl_config_req
nfapi_ul_config_request_t *p = malloc(sizeof(nfapi_ul_config_request_t));
p->sfn_sf = req->sfn_sf;
......@@ -995,7 +994,6 @@ int memcpy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) {
int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc,
nfapi_pnf_p7_config_t* pnf_p7,
nfapi_hi_dci0_request_t* req) {
// make same changes as in dl_config_req
nfapi_hi_dci0_request_t *p = (nfapi_hi_dci0_request_t *)malloc(sizeof(nfapi_hi_dci0_request_t));
//if(req!=0){
......
......@@ -35,6 +35,9 @@ int tx_req_num_elems;
//module_id_t next_Mod_id;
eth_params_t stub_eth_params;
// This function should return all the sched_response config messages which concern a specific UE. Inside this
// function we should somehow make the translation of config message's rnti to Mod_ID.
Sched_Rsp_t get_nfapi_sched_response(uint8_t Mod_id);
......@@ -129,10 +132,10 @@ int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfa
void UE_config_stub_pnf(void);
// This function is used to open an SCTP socket with a standalone PNF module
// open an SCTP socket with a standalone PNF module
void ue_init_standalone_socket(const char *addr, int port);
// This function is used to read from standalone pnf socket call corresponding memcpy functions
// read from standalone pnf socket call corresponding memcpy functions
void *ue_standalone_pnf_task(void *context);
extern queue_t dl_config_req_queue;
......
......@@ -94,6 +94,7 @@ extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind);
extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP);
extern uint16_t sf_ahead;
//extern int tx_req_UE_MAC1();
......@@ -976,6 +977,7 @@ static uint64_t clock_usec() {
}
return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000);
}
/*!
* \brief This is the UE thread for RX subframe n and TX subframe n+4.
* This thread performs the phy_procedures_UE_RX() on every received slot.
......@@ -1043,12 +1045,10 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
end_flag = 1;
for(uint16_t i = 0; i< NB_THREAD_INST; i++) {
if (phy_stub_ticking != NULL) {
if (phy_stub_ticking->num_single_thread[i] == 0) {
if(phy_stub_ticking != NULL && phy_stub_ticking->num_single_thread[i] == 0) {
end_flag = 0;
}
}
}
} while(end_flag == 0);
sync_var=0;
......@@ -1068,7 +1068,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
if (ue_thread_id == 0) {
if (phy_stub_ticking != NULL) {
if (pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) != 0) {
LOG_E(MAC, "[SCHED][UE] error locking mutex for UE RXTX\n");
LOG_E( MAC, "[SCHED][UE] error locking mutex for UE RXTX\n" );
exit_fun("nothing to add");
}
while (phy_stub_ticking->ticking_var < 0) {
......@@ -1269,7 +1269,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
start_meas(&UE->generic_stat);
#endif
if (UE->mac_enabled == 1) {
if (UE->mac_enabled==1) {
ret = ue_scheduler(ue_Mod_id,
proc->frame_rx,
proc->subframe_rx,
......@@ -1324,32 +1324,30 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
// Generate UL_indications which correspond to UL traffic.
if (ul_config_req != NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
if(ul_config_req!=NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id); // Andrew - send over socket to proxy here
} // Andrew - else send a dummy over the socket
}
phy_procedures_UE_SL_RX(UE, proc);
phy_procedures_UE_SL_RX(UE,proc);
} //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++)
}
if (phy_stub_ticking != NULL) {
if(phy_stub_ticking != NULL) {
phy_stub_ticking->num_single_thread[ue_thread_id] = -1;
}
// waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1.
if (ue_thread_id == 0) {
if(ue_thread_id == 0) {
do {
end_flag = 1;
for (uint16_t i = 0; i < NB_THREAD_INST; i++) {
if (phy_stub_ticking != NULL) {
if (phy_stub_ticking->num_single_thread[i] == 0) {
for(uint16_t i = 0; i< NB_THREAD_INST; i++) {
if(phy_stub_ticking != NULL && phy_stub_ticking->num_single_thread[i] == 0) {
end_flag = 0;
}
}
}
} while (end_flag == 0);
} while(end_flag == 0);
if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs > 0) {
if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs>0) {
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
//LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs);
oai_nfapi_crc_indication(&UL_INFO->crc_ind);
......@@ -1357,12 +1355,12 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
}
if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) {
if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus>0) {
//LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
//LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus);
oai_nfapi_rx_ind(&UL_INFO->rx_ind);
for (uint8_t num_pdu = 0; num_pdu < UL_INFO->rx_ind.rx_indication_body.number_of_pdus; num_pdu++) {
for(uint8_t num_pdu = 0; num_pdu < UL_INFO->rx_ind.rx_indication_body.number_of_pdus; num_pdu++) {
free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list[num_pdu].data);
}
......@@ -1375,14 +1373,14 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
}
if (UL_INFO->harq_ind.harq_indication_body.number_of_harqs > 0) {
if(UL_INFO->harq_ind.harq_indication_body.number_of_harqs>0) {
//LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
oai_nfapi_harq_indication(&UL_INFO->harq_ind);
//LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n");
UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
UL_INFO->harq_ind.harq_indication_body.number_of_harqs =0;
}
if (UL_INFO->sr_ind.sr_indication_body.number_of_srs > 0) {
if(UL_INFO->sr_ind.sr_indication_body.number_of_srs>0) {
//LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs);
oai_nfapi_sr_indication(&UL_INFO->sr_ind);
//LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n");
......@@ -1390,13 +1388,13 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
}
// De-allocate memory of nfapi requests copies before next subframe round
if (dl_config_req != NULL) {
if (dl_config_req->vendor_extension != NULL) {
if(dl_config_req!=NULL) {
if(dl_config_req->vendor_extension!=NULL) {
free(dl_config_req->vendor_extension);
dl_config_req->vendor_extension = NULL;
}
if (dl_config_req->dl_config_request_body.dl_config_pdu_list != NULL) {
if(dl_config_req->dl_config_request_body.dl_config_pdu_list!=NULL) {
free(dl_config_req->dl_config_request_body.dl_config_pdu_list);
dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL;
}
......@@ -1405,7 +1403,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
dl_config_req = NULL;
}
if (tx_request_pdu_list != NULL) {
if(tx_request_pdu_list!=NULL) {
for (int i = 0; i < tx_req_num_elems; i++) {
for (int j = 0; j < tx_request_pdu_list[i].num_segments; j++) {
free(tx_request_pdu_list[i].segments[j].segment_data);
......@@ -1417,8 +1415,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
tx_request_pdu_list = NULL;
}
if (ul_config_req != NULL) {
if (ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) {
if(ul_config_req!=NULL) {
if(ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) {
free(ul_config_req->ul_config_request_body.ul_config_pdu_list);
ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL;
}
......@@ -1427,8 +1425,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
ul_config_req = NULL;
}
if (hi_dci0_req != NULL) {
if (hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list != NULL) {
if(hi_dci0_req!=NULL) {
if(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL) {
free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list);
hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL;
}
......@@ -1477,9 +1475,7 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
struct rx_tx_thread_data *rtd = arg;
UE_rxtx_proc_t *proc = rtd->proc;
PHY_VARS_UE *UE = rtd->UE;
phy_stub_ticking->ticking_var = -1;
proc->subframe_rx=proc->sub_frame_start;
// CAREFUL HERE!
wait_sync("UE_phy_stub_thread_rxn_txnp4");
......
......@@ -709,7 +709,6 @@ int main( int argc, char **argv ) {
UE_config_stub_pnf();
}
// end of test
printf("ITTI tasks created\n");
mlockall(MCL_CURRENT | MCL_FUTURE);
rt_sleep_ns(10*100000000ULL);
......@@ -729,8 +728,7 @@ int main( int argc, char **argv ) {
config_sync_var=0;
init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
init_UE_standalone_thread();
}
else {
} else {
init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,get_softmodem_params()->phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0],
frame_parms[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