Commit 848d5e0a authored by matzakos's avatar matzakos

Fixed some more issues for running with multiple UEs. Added configuration...

Fixed some more issues for running with multiple UEs. Added configuration option for the number of UEs.
parent 230421bc
......@@ -1479,6 +1479,7 @@ typedef struct {
/// Panos: Phy_stub mode: Boolean variable to distinguish whether a Msg3 or a regular ULSCH data pdu should be generated
/// after the reception of NFAPI_UL_CONFIG_ULSCH_PDU_TYPE.
uint8_t first_ULSCH_Tx;
uint8_t SI_Decoded;
int ra_frame; // This variable keeps the frame in which the RA started for the specific UE. It is used in order
// to make sure that different UEs RA starts within a number of frames difference.
......
......@@ -1214,7 +1214,7 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
#endif
{
// This is normal LTE case
LOG_I(MAC, "Panos-D: generate_Msg4 1 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR UE_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP);
LOG_I(MAC, "Panos-D: generate_Msg4 1 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP);
if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) {
// Get RRCConnectionSetup for Piggyback
......@@ -1553,6 +1553,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
ra->rnti, round, frameP, subframeP);
// DLSCH Config
//DJP - fix this pdu_index = -1
LOG_I(MAC, "Panos:D: check_Msg4_retransmission() before fill_nfapi_dlsch_config() with pdu_index = -1 \n");
fill_nfapi_dlsch_config(mac, dl_req_body, ra->msg4_TBsize,
-1
/* retransmission, no pdu_index */
......
......@@ -833,7 +833,7 @@ schedule_ue_spec(module_id_t module_idP,
eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP;
eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST;
//LOG_I(MAC, "Panos:D: schedule_ue_spec() before fill_nfapi_dlsch_config() with pdu_index = -1 \n");
fill_nfapi_dlsch_config(eNB, dl_req, TBS, -1
/* retransmission, no pdu_index */
, rnti, 0, // type 0 allocation from 7.1.6 in 36.213
......
......@@ -162,10 +162,18 @@ void ue_init_mac(module_id_t module_idP)
pthread_mutex_init(&UE_mac_inst[module_idP].UL_INFO_mutex,NULL);
UE_mac_inst[module_idP].UE_mode[0] = NOT_SYNCHED; //PRACH;
UE_mac_inst[module_idP].first_ULSCH_Tx =0;
UE_mac_inst[module_idP].SI_Decoded = 0;
UE_mac_inst[module_idP].dl_config_req = NULL;
UE_mac_inst[module_idP].ul_config_req = NULL;
UE_mac_inst[module_idP].hi_dci0_req = NULL;
UE_mac_inst[module_idP].tx_req = NULL;
//UE_mac_inst[Mod_id].ra_frame = 0;
next_ra_frame = 0;
next_Mod_id = 0;
tx_request_pdu_list = NULL;
tx_req_num_elems = 0;
}
#ifdef CBA
......
......@@ -715,7 +715,8 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
nfapi_ul_config_harq_information *ulsch_harq_information = &ul_config_pdu->uci_harq_pdu.harq_information;
//LOG_I(MAC, "Panos-D: handle_nfapi_ul_pdu_UE_MAC 7 \n");
fill_uci_harq_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO,ulsch_harq_information, rnti);
if(ulsch_harq_information != NULL)
fill_uci_harq_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO,ulsch_harq_information, rnti);
}
else if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE) {
AssertFatal(1==0,"NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE not handled yet\n");
......@@ -750,7 +751,8 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
fill_sr_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO,rnti);
nfapi_ul_config_harq_information *ulsch_harq_information = &ul_config_pdu->uci_sr_harq_pdu.harq_information;
fill_uci_harq_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO,ulsch_harq_information, rnti);
if (ulsch_harq_information != NULL)
fill_uci_harq_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO,ulsch_harq_information, rnti);
}
/*else if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_SRS_PDU_TYPE) {
......@@ -1093,7 +1095,7 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //,
if(dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index <= tx_req_num_elems -1){
//if(tx_request_pdu_list + dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index!= NULL){
//LOG_E(MAC, "dl_config_req_UE_MAC 2 Received data: sfn/sf:%d PDU[%d] size:%d, TX_PDU index: %d, tx_req_num_elems: %d \n", NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index, tx_req_num_elems);
LOG_E(MAC, "dl_config_req_UE_MAC 2 Received data: sfn/sf:%d PDU[%d] size:%d, TX_PDU index: %d, tx_req_num_elems: %d \n", NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index, tx_req_num_elems);
ue_send_sdu(Mod_id, 0, sfn, sf,
tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data,
......@@ -1103,15 +1105,17 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //,
}
else{
LOG_E(MAC,"dl_config_req_UE_MAC 2: Problem with receiving data: sfn/sf:%d PDU[%d] size:%d, TX_PDU index: %d\n", NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index);
i++;
}
}
else {
LOG_E(MAC,"[UE %d] Frame %d, subframe %d : Cannot extract DLSCH PDU from NFAPI\n",Mod_id, sfn,sf);
LOG_E(MAC,"[UE %d] Frame %d, subframe %d : DLSCH PDU from NFAPI not for this UE \n",Mod_id, sfn,sf);
i++;
}
}
else if (dl_config_pdu_list[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type == 2) {
dl_config_pdu_tmp = &dl_config_pdu_list[i+1];
if(dl_config_pdu_tmp->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE && dl_config_pdu_list[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti == 0xFFFF){
if(dl_config_pdu_tmp->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE && dl_config_pdu_list[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti == 0xFFFF && UE_mac_inst[Mod_id].UE_mode[0] != NOT_SYNCHED){ //&& UE_mac_inst[Mod_id].UE_mode[0] != NOT_SYNCHED
//pdu = Tx_req->tx_request_body.tx_pdu_list[dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data;
/*LOG_E(MAC,"dl_config_req_UE_MAC 3 Received SI: [PDU:%d] NFAPI_DL_CONFIG_DLSCH_PDU_TYPE TX:%d/%d RX:%d/%d transport_blocks:%d pdu_index:%d sdu:%p\n",
......@@ -1126,6 +1130,7 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //,
}
else{
LOG_E(MAC,"dl_config_req_UE_MAC 3: Problem with receiving SI: sfn/sf:%d PDU[%d] size:%d, TX_PDU index: %d\n", NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index);
i++;
}
}
else if(dl_config_pdu_tmp->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE && dl_config_pdu_list[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti == 0xFFFE){
......@@ -1141,6 +1146,7 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //,
}
else{
LOG_E(MAC,"dl_config_req_UE_MAC: Problem with receiving Paging: sfn/sf:%d PDU[%d] size:%d, TX_PDU index: %d\n", NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index);
i++;
}
}
else if(dl_config_pdu_tmp->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) {
......@@ -1164,9 +1170,11 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //,
UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE;
UE_mac_inst[Mod_id].first_ULSCH_Tx = 1; //Expecting an UL_CONFIG_ULSCH_PDU to enable Msg3 Txon (first ULSCH Txon for the UE)
}
i++;
}
else {
LOG_E(MAC,"[UE %d] %d Frame %d, subframe %d : Cannot extract DLSCH PDU from NFAPI\n",Mod_id, sfn, sf);
LOG_E(MAC,"[UE %d] %d Frame %d, subframe %d : Cannot extract DLSCH PDU from NFAPI 2\n",Mod_id, sfn, sf);
i++;
}
}
......@@ -1179,7 +1187,7 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //,
//LOG_E(MAC,"dl_config_req_UE_MAC 4 Received MIB: sfn/sf: %d.%d \n", sfn, sf);
if(UE_mac_inst[Mod_id].UE_mode[0] == NOT_SYNCHED){
dl_phy_sync_success(Mod_id,sfn,0, 1);
LOG_E(MAC,"dl_config_req_UE_MAC 5 Received MIB: UE_mode: %d\n", UE_mac_inst[Mod_id].UE_mode[0]);
LOG_E(MAC,"dl_config_req_UE_MAC 5 Received MIB: UE_mode: %d, sfn/sf: %d.%d\n", UE_mac_inst[Mod_id].UE_mode[0], sfn, sf);
UE_mac_inst[Mod_id].UE_mode[0]=PRACH;
}
else
......
......@@ -22,6 +22,10 @@ UL_IND_t *UL_INFO;
nfapi_tx_request_pdu_t* tx_request_pdu_list;
int tx_req_num_elems;
int next_ra_frame;
module_id_t next_Mod_id;
// Panos: This function should return all the sched_response config messages which concern a specific UE. Inside this
......
......@@ -789,6 +789,7 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* co
char message_string[10000];
size_t message_string_size;
//LOG_I(RRC, "Panos-D: rrc_ue_decode_ccch, Before xer_sprint() \n");
if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *)dl_ccch_msg)) > 0) {
MessageDef *msg_p;
......@@ -1979,6 +1980,7 @@ rrc_ue_process_securityModeCommand(
char message_string[20000];
size_t message_string_size;
//LOG_I(RRC, "Panos-D: rrc_ue_process_securityModeCommand, Before xer_sprint() \n");
if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) {
MessageDef *msg_p;
......@@ -2090,6 +2092,7 @@ rrc_ue_process_ueCapabilityEnquiry(
char message_string[20000];
size_t message_string_size;
//LOG_I(RRC, "Panos-D: rrc_ue_process_ueCapabilityEnquiry, Before xer_sprint() \n");
if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) {
MessageDef *msg_p;
......@@ -2484,6 +2487,7 @@ rrc_ue_decode_dcch(
char message_string[30000];
size_t message_string_size;
//LOG_I(RRC, "Panos-D: rrc_ue_decode_dcch, Before xer_sprint() \n");
if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *)dl_dcch_msg)) > 0) {
msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText));
msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size;
......@@ -3019,6 +3023,7 @@ int decode_BCCH_DLSCH_Message(
char message_string[15000];
size_t message_string_size;
//LOG_I(RRC, "Panos-D: decode_BCCH_DLSCH_Message, Before xer_sprint() \n");
if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) {
MessageDef *msg_p;
......@@ -3067,6 +3072,8 @@ int decode_BCCH_DLSCH_Message(
//LOG_I( RRC, "Panos-D: decode_BCCH_DLSCH_Message1 BEFORE OTHER decode_SI");
//printf("Panos-D: decode_BCCH_DLSCH_Message1 BEFORE OTHER decode_SI");
decode_SI( ctxt_pP, eNB_index );
//if (nfapi_mode == 3)
UE_mac_inst[ctxt_pP->module_id].SI_Decoded = 1;
}
break;
......
......@@ -65,6 +65,7 @@ int create_tasks_ue(uint32_t ue_nb)
# endif
if (ue_nb > 0) {
//LOG_I(RRC, "Panos-D: create_tasks_ue() before initiating rrc_ue_task \n");
if (itti_create_task (TASK_RRC_UE, rrc_ue_task, NULL) < 0) {
LOG_E(RRC, "Create task for RRC UE failed\n");
return -1;
......
......@@ -942,6 +942,10 @@ int main( int argc, char **argv )
uint8_t abstraction_flag=0;
uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
// Default value for the number of UEs. It will hold,
// if not changed from the command line option --num-ues
NB_UE_INST=1;
#if defined (XFORMS)
int ret;
#endif
......@@ -1107,7 +1111,7 @@ int main( int argc, char **argv )
printf("Before CC \n");
NB_UE_INST=2;
//NB_UE_INST=2;
NB_INST=1;
if (UE_flag==1) {
......
......@@ -72,7 +72,8 @@
#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n"
#define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n"
#define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
#define CONFIG_HLP_EMULIFACE "Set the interface name for the multicast transport for emulation mode (e.g. eth0, lo, etc.) \n"
#define CONFIG_HLP_EMULIFACE "Set the interface name for the multicast transport for emulation mode (e.g. eth0, lo, etc.) \n"
//#define CONFIG_HLP_NUMUES "Set the number of UEs for the emulation"
#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n"
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
......@@ -129,7 +130,8 @@
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
{"r" , CONFIG_HLP_PRB, 0, u8ptr:&n_rb_dl, defintval:0, TYPE_UINT8, 0}, \
{"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100} \
{"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \
{"num-ues", NULL, 0, iptr:&(NB_UE_INST), defintval:1, TYPE_INT, 0} \
}
......
......@@ -900,15 +900,17 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
proc->subframe_rx=proc->sub_frame_start;
// Initialize all nfapi structures to NULL
for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) {
/*for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) {
UE_mac_inst[Mod_id].dl_config_req = NULL;
UE_mac_inst[Mod_id].ul_config_req = NULL;
UE_mac_inst[Mod_id].hi_dci0_req = NULL;
UE_mac_inst[Mod_id].ra_frame = 0;
//UE_mac_inst[Mod_id].ra_frame = 0;
next_ra_frame = 0;
next_Mod_id = 0;
tx_request_pdu_list = NULL;
tx_req_num_elems = 0;
UE_mac_inst[Mod_id].tx_req = NULL;
}
}*/
//PANOS: CAREFUL HERE!
wait_sync("UE_phy_stub_single_thread_rxn_txnp4");
......@@ -1102,12 +1104,14 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
(UE->frame_parms.frame_type == FDD) )
if (UE->mode != loop_through_memory){
if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
// We make the start of RA between consecutive UEs differ by 20 frames
//if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
if (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == next_Mod_id && proc->frame_rx >= next_ra_frame) {
//LOG_D(MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 before RACH \n");
// check if we have PRACH opportunity
if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) ) {
if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[Mod_id].SI_Decoded == 1) {
// The one working strangely...
//if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) {
......@@ -1120,6 +1124,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx ,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0);
UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE;
next_Mod_id = Mod_id + 1;
next_ra_frame = (proc->frame_rx + 20)%1000;
}
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
......
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