diff --git a/openair1/PHY/CODING/crc_byte.c b/openair1/PHY/CODING/crc_byte.c index f2f7e4e5c7d213e53c3fab1c392fc042c37d3715..06a43fdb79242eed9636c489c00d6ef9c55758d3 100644 --- a/openair1/PHY/CODING/crc_byte.c +++ b/openair1/PHY/CODING/crc_byte.c @@ -32,21 +32,6 @@ #include "PHY/types.h" -// For initialization && verification purposes, bit by bit implementation with any polynomial -// The first bit is in the MSB of each byte - -// Reference 38.212 V15.1.1 Section 5.1 (36-212 v8.6.0 , pp 8-9) -// The highest degree is set by default -/** 1000 0110 0100 1100 1111 1011 D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1 */ -static const uint32_t poly24a = 0x864cfb00; -/** 1000 0000 0000 0000 0110 0011 D^24 + D^23 + D^6 + D^5 + D + 1 */ -static const uint32_t poly24b = 0x80006300; -/** 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1 */ -static const uint32_t poly16 = 0x10210000; -/** 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1 */ -static const uint32_t poly12 = 0x80F00000; -/** 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1 */ -static const uint32_t poly8 = 0x9B000000; // The following arrays are generated with the function 'crcTableInit' /** Encoding table for CRC 24A */ @@ -96,6 +81,24 @@ uint32_t crcbit (uint8_t * inputptr, int32_t octetlen, uint32_t poly) // CRC table initialization /* + RK: Note that this should be brought back and use crcTableInit instead of static declaration + Commented out to remove warning + // For initialization && verification purposes, bit by bit implementation with any polynomial + // The first bit is in the MSB of each byte + + // Reference 38.212 V15.1.1 Section 5.1 (36-212 v8.6.0 , pp 8-9) +// The highest degree is set by default +// 1000 0110 0100 1100 1111 1011 D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1 +static const uint32_t poly24a = 0x864cfb00; +// 1000 0000 0000 0000 0110 0011 D^24 + D^23 + D^6 + D^5 + D + 1 +static const uint32_t poly24b = 0x80006300; +// 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1 +static const uint32_t poly16 = 0x10210000; +// 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1 +static const uint32_t poly12 = 0x80F00000; +// 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1 +static const uint32_t poly8 = 0x9B000000; + void crcTableInit (void) { uint8_t c = 0; diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index f47e9621b93b2b715e93eea2ad6344b6f3303429..0140e63746e7d8d6475adf38da586837093d5765 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -73,7 +73,7 @@ void handle_nfapi_mpdcch_pdu(PHY_VARS_eNB *eNB, LTE_eNB_MPDCCH *mpdcch_vars = &eNB->mpdcch_vars[idx]; nfapi_dl_config_mpdcch_pdu *pdu = &dl_config_pdu->mpdcch_pdu; - LOG_I(PHY,"Frame %d, Subframe %d: MDCI processing\n",proc->frame_tx,proc->subframe_tx); + LOG_D(PHY,"Frame %d, Subframe %d: MDCI processing\n",proc->frame_tx,proc->subframe_tx); // copy dci configuration into eNB structure fill_mdci_and_dlsch(eNB,proc,&mpdcch_vars->mdci_alloc[mpdcch_vars->num_dci],pdu); @@ -101,7 +101,7 @@ void handle_nfapi_hi_dci0_mpdcch_dci_pdu(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, int idx = proc->subframe_tx&1; LTE_eNB_MPDCCH *pdcch_vars = &eNB->mpdcch_vars[idx]; // copy dci configuration in to eNB structure - fill_mpdcch_dci0(eNB,proc,&pdcch_vars->mdci_alloc[pdcch_vars->num_dci], &hi_dci0_config_pdu->dci_pdu); + fill_mpdcch_dci0(eNB,proc,&pdcch_vars->mdci_alloc[pdcch_vars->num_dci], &hi_dci0_config_pdu->mpdcch_dci_pdu); } @@ -180,24 +180,24 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro dlsch1 = eNB->dlsch[UE_id][1]; #if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) - if ((rel13->pdsch_payload_type < 2) && (rel13->ue_type>0)) dlsch0->harq_ids[frame%2][subframe] = 0; + if ((rel13->pdsch_payload_type < 2) && (rel13->ue_type>0)) dlsch0->harq_ids[proc->frame_tx%2][proc->subframe_tx] = 0; #endif - harq_pid = dlsch0->harq_ids[frame%2][subframe]; + harq_pid = dlsch0->harq_ids[proc->frame_tx%2][proc->subframe_tx]; AssertFatal((harq_pid>=0) && (harq_pid<8),"harq_pid %d not in 0...7 frame:%d subframe:%d subframe(TX):%d rnti:%x UE_id:%d dlsch0[harq_ids:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d]\n", harq_pid, frame,subframe, proc->subframe_tx,rel8->rnti,UE_id, - dlsch0->harq_ids[frame%2][0], - dlsch0->harq_ids[frame%2][1], - dlsch0->harq_ids[frame%2][2], - dlsch0->harq_ids[frame%2][3], - dlsch0->harq_ids[frame%2][4], - dlsch0->harq_ids[frame%2][5], - dlsch0->harq_ids[frame%2][6], - dlsch0->harq_ids[frame%2][7], - dlsch0->harq_ids[frame%2][8], - dlsch0->harq_ids[frame%2][9] + dlsch0->harq_ids[proc->frame_tx%2][0], + dlsch0->harq_ids[proc->frame_tx%2][1], + dlsch0->harq_ids[proc->frame_tx%2][2], + dlsch0->harq_ids[proc->frame_tx%2][3], + dlsch0->harq_ids[proc->frame_tx%2][4], + dlsch0->harq_ids[proc->frame_tx%2][5], + dlsch0->harq_ids[proc->frame_tx%2][6], + dlsch0->harq_ids[proc->frame_tx%2][7], + dlsch0->harq_ids[proc->frame_tx%2][8], + dlsch0->harq_ids[proc->frame_tx%2][9] ); dlsch0_harq = dlsch0->harq_processes[harq_pid]; dlsch1_harq = dlsch1->harq_processes[harq_pid]; @@ -223,7 +223,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro computeRhoB_eNB(rel8->pa,eNB->frame_parms.pdsch_config_common.p_b,eNB->frame_parms.nb_antenna_ports_eNB,dlsch1,dlsch1_harq->dl_power_off); } - dlsch0_harq->pdsch_start = eNB->pdcch_vars[subframe & 1].num_pdcch_symbols; + dlsch0_harq->pdsch_start = eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols; if (dlsch0_harq->round==0) { //get pointer to SDU if this a new SDU if(sdu == NULL) { @@ -265,7 +265,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro dlsch0_harq = dlsch0->harq_processes[0]; dlsch0_harq->pdu = sdu; - if (proc->frame_tx < 200) LOG_D(PHY,"NFAPI: frame %d, subframe %d: Programming SI-BR (%d) => %d\n",proc->frame_tx,proc->subframe_tx,rel13->pdsch_payload_type,UE_id); + if (proc->frame_tx < 200) LOG_D(PHY,"NFAPI: frame %d, subframe %d (TX %d.%d): Programming SI-BR (%d) => %d\n",frame,subframe,proc->frame_tx,proc->subframe_tx,rel13->pdsch_payload_type,UE_id); dlsch0->rnti = 0xFFFF; dlsch0->Kmimo = 1; @@ -274,7 +274,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro dlsch0->i0 = rel13->initial_transmission_sf_io; dlsch0_harq->pdsch_start = rel10->pdsch_start; - dlsch0->harq_ids[frame%2][proc->subframe_tx] = 0; + dlsch0->harq_ids[proc->frame_tx%2][proc->subframe_rx] = 0; dlsch0_harq->frame = proc->frame_tx; dlsch0_harq->subframe = proc->subframe_tx; diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 68e9e52eb8b3fca6fdfad61720dbf3349ec3b2b4..3252bb6b92f6a629a1c965db5b31c7f793e33b44 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -892,11 +892,15 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP, } } // mib != NULL + // SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup if (logicalChannelConfig != NULL) { // check for eMTC specific things UE_id = find_UE_id(Mod_idP, rntiP); - AssertFatal(UE_id>=0,"Configuration received for unknown UE (%x), shouldn't happen\n",rntiP); + if (UE_id<0) { + LOG_E(MAC,"Configuration received for unknown UE (%x), shouldn't happen\n",rntiP); + return(-1); + } if (logicalChannelConfig) { UE_list->UE_template[CC_idP][UE_id].lcgidmap[logicalChannelIdentity] = *logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup; UE_list->UE_template[CC_idP][UE_id].lcgidpriority[logicalChannelIdentity] = logicalChannelConfig->ul_SpecificParameters->priority; @@ -905,7 +909,10 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP, if (physicalConfigDedicated != NULL) { UE_id = find_UE_id(Mod_idP, rntiP); - AssertFatal(UE_id>=0,"Configuration received for unknown UE (%x), shouldn't happen\n",rntiP); + if (UE_id<0) { + LOG_E(MAC,"Configuration received for unknown UE (%x), shouldn't happen\n",rntiP); + return(-1); + } UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated = physicalConfigDedicated; LOG_I(MAC,"Added physicalConfigDedicated %p for %d.%d\n",physicalConfigDedicated,CC_idP,UE_id); } @@ -914,7 +921,10 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP, #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) if (sCellToAddMod_r10 != NULL) { - UE_id = find_UE_id(Mod_idP, rntiP); + if (UE_id<0) { + LOG_E(MAC,"Configuration received for unknown UE (%x), shouldn't happen\n",rntiP); + return(-1); + } AssertFatal(UE_id>=0,"Configuration received for unknown UE (%x), shouldn't happen\n",rntiP); config_dedicated_scell(Mod_idP, rntiP, sCellToAddMod_r10); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index bd8e835174d6e84ac4a835d233b9f6f50717e80b..4ebe7313e8764d2658382b6a7445c938a6c6b5f5 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -443,6 +443,7 @@ clear_nfapi_information(eNB_MAC_INST * eNB, int CC_idP, DL_req[CC_idP].dl_config_request_body.number_pdu = 0; DL_req[CC_idP].dl_config_request_body.number_pdsch_rnti = 0; DL_req[CC_idP].dl_config_request_body.transmission_power_pcfich = 6000; + DL_req[CC_idP].sfn_sf = subframeP + (frameP<<4); HI_DCI0_req->hi_dci0_request_body.sfnsf = subframeP + (frameP<<4); HI_DCI0_req->hi_dci0_request_body.number_of_dci = 0; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c index 96ca1c29271e7f873d963d28e97d30849fa6abfe..339d4102aa48416bfe4b498c3219c55c4f3c7f0a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c @@ -408,7 +408,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, vrb_map[first_rb+4] = 1; vrb_map[first_rb+5] = 1; - //if ((frameP&1023) < 200) + if ((frameP&1023) < 200) LOG_D(MAC,"[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n", module_idP,frameP,subframeP,CC_id,(int)si_Narrowband_r13-1,rvidx, sf_mod_period,(int)si_WindowLength_BR_r13,(int)si_RepetitionPattern_r13, diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 9a99701897759c06a4c25d25656005f8866e296a..c4a6a59e2b482dd66fdc8e11ddd4a1752cdeb07f 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -105,8 +105,6 @@ rx_sdu(const module_id_t enb_mod_idP, int lcgid_updated[4] = {0, 0, 0, 0}; UE_list_t *UE_list = &mac->UE_list; int crnti_rx = 0; - RA_t *ra = - (RA_t *) & RC.mac[enb_mod_idP]->common_channels[CC_idP].ra[0]; int first_rb = 0; rrc_eNB_ue_context_t *ue_contextP = NULL; start_meas(&mac->rx_ulsch_sdu); @@ -218,8 +216,11 @@ rx_sdu(const module_id_t enb_mod_idP, return; } } else if ((RA_id = find_RA_id(enb_mod_idP, CC_idP, current_rnti)) != -1) { // Check if this is an RA process for the rnti + + RA_t *ra = (RA_t *) & mac->common_channels[CC_idP].ra[RA_id]; + #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - if (UE_list->UE_template[CC_idP][UE_id].rach_resource_type > 0) harq_pid=0; + if (ra->rach_resource_type > 0) harq_pid=0; #endif AssertFatal(mac->common_channels[CC_idP]. radioResourceConfigCommon->rach_ConfigCommon. @@ -230,7 +231,7 @@ rx_sdu(const module_id_t enb_mod_idP, maxHARQ_Msg3Tx); LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d [RAPROC Msg3] Received ULSCH sdu round %d from PHY (rnti %x, RA_id %d) ul_cqi %d\n", - enb_mod_idP, harq_pid, CC_idP, ra[RA_id].msg3_round, + enb_mod_idP, harq_pid, CC_idP, ra->msg3_round, current_rnti, RA_id, ul_cqi); first_rb = ra->msg3_first_rb; @@ -238,21 +239,21 @@ rx_sdu(const module_id_t enb_mod_idP, LOG_D(MAC, "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n", enb_mod_idP, CC_idP, RA_id, - ra[RA_id].msg3_round, + ra->msg3_round, (int) mac->common_channels[CC_idP]. radioResourceConfigCommon->rach_ConfigCommon. maxHARQ_Msg3Tx); - if (ra[RA_id].msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) { + if (ra->msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) { cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); } else { first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid]; - ra[RA_id].msg3_round++; + ra->msg3_round++; // prepare handling of retransmission get_Msg3allocret(&mac->common_channels[CC_idP], - ra[RA_id].Msg3_subframe, ra[RA_id].Msg3_frame, - &ra[RA_id].Msg3_frame, &ra[RA_id].Msg3_subframe); - add_msg3(enb_mod_idP, CC_idP, &ra[RA_id], frameP, subframeP); + ra->Msg3_subframe, ra->Msg3_frame, + &ra->Msg3_frame, &ra->Msg3_subframe); + add_msg3(enb_mod_idP, CC_idP, ra, frameP, subframeP); } /* TODO: program NACK for PHICH? */ @@ -337,7 +338,7 @@ rx_sdu(const module_id_t enb_mod_idP, * the UE state in the eNB is wrong. */ for (ii = 0; ii < NB_RA_PROC_MAX; ii++) { - ra = &mac->common_channels[CC_idP].ra[ii]; + RA_t *ra = &mac->common_channels[CC_idP].ra[ii]; if ((ra->rnti == current_rnti) && (ra->state != IDLE)) { mac_rrc_data_ind(enb_mod_idP,