Commit ed1714aa authored by Cedric Roux's avatar Cedric Roux

minor: fix spacing

parent 79b7b8ad
......@@ -61,8 +61,8 @@
#define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1
int choose(int n,int k) {
int choose(int n,int k)
{
int res = 1;
int res2 = 1;
int i;
......@@ -77,8 +77,8 @@ int choose(int n,int k) {
}
// Patented algorithm from Yang et al, US Patent 2009, "Channel Quality Indexing and Reverse Indexing"
void reverse_index(int N,int M,int r,int *v) {
void reverse_index(int N,int M,int r,int *v)
{
int BaseValue=0;
int IncreaseValue,ThresholdValue;
int sumV;
......@@ -90,7 +90,6 @@ void reverse_index(int N,int M,int r,int *v) {
sumV=0;
i=M;
while (i>0 && r>0) {
IncreaseValue = choose(N-M+1-sumV-v[i-1]+i-2,i-1);
ThresholdValue = BaseValue+IncreaseValue;
if (r>=ThresholdValue) {
......@@ -103,26 +102,27 @@ void reverse_index(int N,int M,int r,int *v) {
i--;
BaseValue=0;
}
}
}
int to_prb(int dl_Bandwidth) {
int to_prb(int dl_Bandwidth)
{
int prbmap[6] = {6,15,25,50,75,100};
AssertFatal(dl_Bandwidth < 6,"dl_Bandwidth is 0..5\n");
return(prbmap[dl_Bandwidth]);
}
int to_rbg(int dl_Bandwidth) {
int to_rbg(int dl_Bandwidth)
{
int rbgmap[6] = {6,8,13,17,19,25};
AssertFatal(dl_Bandwidth < 6,"dl_Bandwidth is 0..5\n");
return(rbgmap[dl_Bandwidth]);
}
int get_phich_resource_times6(COMMON_channels_t *cc) {
int get_phich_resource_times6(COMMON_channels_t *cc)
{
int phichmap[4] = {1,3,6,12};
AssertFatal(cc!=NULL,"cc is null\n");
AssertFatal(cc->mib!=NULL,"cc->mib is null\n");
......@@ -133,8 +133,8 @@ int get_phich_resource_times6(COMMON_channels_t *cc) {
return(phichmap[cc->mib->message.phich_Config.phich_Resource]);
}
uint16_t mac_computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs) {
uint16_t mac_computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs)
{
uint16_t RIV;
if (Lcrbs<=(1+(N_RB_DL>>1)))
......@@ -145,8 +145,8 @@ uint16_t mac_computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs) {
return(RIV);
}
uint8_t getQm(uint8_t mcs) {
uint8_t getQm(uint8_t mcs)
{
if (mcs<10) return(2);
else if (mcs<17) return(4);
else return (6);
......@@ -159,7 +159,6 @@ void get_Msg3alloc(COMMON_channels_t *cc,
frame_t *frame,
sub_frame_t *subframe)
{
// Fill in other TDD Configuration!!!!
if (cc->tdd_Config==NULL) { // FDD
......@@ -314,9 +313,7 @@ uint8_t subframe2harqpid(COMMON_channels_t *cc,frame_t frame,sub_frame_t subfram
if (cc->tdd_Config == NULL) { // FDD
ret = (((frame<<1)+subframe)&7);
} else {
switch (cc->tdd_Config->subframeAssignment) {
case 1:
if ((subframe==2) ||
(subframe==3) ||
......@@ -376,7 +373,6 @@ uint8_t get_Msg3harqpid(COMMON_channels_t *cc,
frame_t frame,
sub_frame_t current_subframe)
{
uint8_t ul_subframe=0;
uint32_t ul_frame=0;
......@@ -387,7 +383,6 @@ uint8_t get_Msg3harqpid(COMMON_channels_t *cc,
switch (cc->tdd_Config->subframeAssignment) {
case 1:
switch (current_subframe) {
case 9:
case 0:
ul_subframe = 7;
......@@ -404,7 +399,6 @@ uint8_t get_Msg3harqpid(COMMON_channels_t *cc,
case 3:
switch (current_subframe) {
case 0:
case 5:
case 6:
......@@ -428,7 +422,6 @@ uint8_t get_Msg3harqpid(COMMON_channels_t *cc,
case 4:
switch (current_subframe) {
case 0:
case 5:
case 6:
......@@ -456,7 +449,6 @@ uint8_t get_Msg3harqpid(COMMON_channels_t *cc,
}
return(subframe2harqpid(cc,ul_frame,ul_subframe));
}
uint32_t pdcchalloc2ulframe(COMMON_channels_t *ccP,uint32_t frame, uint8_t n)
......@@ -480,11 +472,10 @@ uint32_t pdcchalloc2ulframe(COMMON_channels_t *ccP,uint32_t frame, uint8_t n)
LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, n, ul_frame);
return ul_frame;
}
uint8_t pdcchalloc2ulsubframe(COMMON_channels_t *ccP,uint8_t n) {
uint8_t pdcchalloc2ulsubframe(COMMON_channels_t *ccP,uint8_t n)
{
uint8_t ul_subframe;
if ((ccP->tdd_Config) &&
......@@ -508,13 +499,11 @@ uint8_t pdcchalloc2ulsubframe(COMMON_channels_t *ccP,uint8_t n) {
int is_UL_sf(COMMON_channels_t *ccP,sub_frame_t subframeP)
{
// if FDD return dummy value
if (ccP->tdd_Config == NULL)
return(0);
switch (ccP->tdd_Config->subframeAssignment) {
case 1:
switch (subframeP) {
case 0:
......@@ -565,12 +554,11 @@ int is_UL_sf(COMMON_channels_t *ccP,sub_frame_t subframeP)
AssertFatal(1==0,"subframe %d Unsupported TDD configuration %d\n",
subframeP,(int)ccP->tdd_Config->subframeAssignment);
break;
}
}
uint16_t get_pucch1_absSF(COMMON_channels_t *cc,uint16_t dlsch_absSF) {
uint16_t get_pucch1_absSF(COMMON_channels_t *cc,uint16_t dlsch_absSF)
{
uint16_t sf,f,nextf;
if (cc->tdd_Config==NULL) { //FDD n+4
......@@ -624,8 +612,8 @@ uint16_t get_pucch1_absSF(COMMON_channels_t *cc,uint16_t dlsch_absSF) {
AssertFatal(1==0,"Shouldn't get here\n");
}
void get_srs_pos(COMMON_channels_t *cc,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset) {
void get_srs_pos(COMMON_channels_t *cc,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset)
{
if(cc->tdd_Config) { // TDD
AssertFatal(isrs>=10,"2 ms SRS periodicity not supported");
......@@ -659,10 +647,8 @@ void get_srs_pos(COMMON_channels_t *cc,uint16_t isrs,uint16_t *psrsPeriodicity,u
}
AssertFatal(isrs<=644,"Isrs out of range %d>644\n",isrs);
} // TDD
else { // FDD
if (isrs<2) {
*psrsPeriodicity=2;
*psrsOffset=isrs;
......@@ -696,12 +682,11 @@ void get_srs_pos(COMMON_channels_t *cc,uint16_t isrs,uint16_t *psrsPeriodicity,u
*psrsOffset=isrs-317;
}
AssertFatal(isrs<=636,"Isrs out of range %d>636\n",isrs);
}
}
void get_csi_params(COMMON_channels_t *cc,struct CQI_ReportPeriodic *cqi_ReportPeriodic,uint16_t *Npd,uint16_t *N_OFFSET_CQI,int *H) {
void get_csi_params(COMMON_channels_t *cc,struct CQI_ReportPeriodic *cqi_ReportPeriodic,uint16_t *Npd,uint16_t *N_OFFSET_CQI,int *H)
{
uint16_t cqi_PMI_ConfigIndex = cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex;
uint8_t Jtab[6] = {0,2,2,3,4,4};
......@@ -778,9 +763,8 @@ void get_csi_params(COMMON_channels_t *cc,struct CQI_ReportPeriodic *cqi_ReportP
*H=1;
}
uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,uint8_t tmode,uint8_t ri, CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic) {
uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,uint8_t tmode,uint8_t ri, CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic)
{
int Ntab[6] = {0,4,7,9,10,13};
int N = Ntab[cc->mib->message.dl_Bandwidth];
int Ltab_uesel[6] = {0,6,9,13,15,18};
......@@ -789,7 +773,6 @@ uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,uint8_t tmode,uint8_t ri
AssertFatal(cqi_ReportModeAperiodic != NULL,"cqi_ReportPeriodic is null!\n");
switch (*cqi_ReportModeAperiodic) {
case CQI_ReportModeAperiodic_rm12:
AssertFatal(tmode==4 || tmode==6 || tmode==8 || tmode==9 || tmode==10,"Illegal TM (%d) for CQI_ReportModeAperiodic_rm12\n",tmode);
AssertFatal(cc->p_eNB<=4,"only up to 4 antenna ports supported here\n");
......@@ -852,8 +835,8 @@ uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,uint8_t tmode,uint8_t ri
return(0);
}
uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,int CC_idP,COMMON_channels_t *cc,uint8_t tmode, struct CQI_ReportPeriodic *cqi_ReportPeriodic) {
uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,int CC_idP,COMMON_channels_t *cc,uint8_t tmode, struct CQI_ReportPeriodic *cqi_ReportPeriodic)
{
int no_pmi=0;
// Ltab[6] = {0,log2(15/4/2),log2(25/4/2),log2(50/6/3),log2(75/8/4),log2(100/8/4)};
......@@ -878,8 +861,6 @@ uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,int CC_idP,COMMON_chan
no_pmi=0;
}
if ((cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI) ||
(sched_ctl->feedback_cnt[CC_idP] == 0)) {
// send wideband report every opportunity if wideband reporting mode is selected, else every H opportunities
......@@ -909,8 +890,8 @@ void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t *dl_config_pdu,
uint8_t mcs,
uint8_t ndi,
uint8_t rv,
uint8_t vrb_flag) {
uint8_t vrb_flag)
{
memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu));
......@@ -926,11 +907,10 @@ void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t *dl_config_pdu,
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = ndi;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = rv;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = vrb_flag;
}
void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t frameP, sub_frame_t subframeP,uint8_t cce_idx) {
void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t frameP, sub_frame_t subframeP,uint8_t cce_idx)
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = eNB->common_channels;
UE_list_t *UE_list = &eNB->UE_list;
......@@ -1048,7 +1028,6 @@ void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t
rnti,
ulsch_harq_information);
if (harq_information) fill_nfapi_harq_information(module_idP,CC_idP,
rnti,
(frameP*10)+subframeP,
......@@ -1056,8 +1035,8 @@ void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t
cce_idx);
}
uint8_t get_V_UL_DAI(module_id_t module_idP,int CC_idP,uint16_t rntiP) {
uint8_t get_V_UL_DAI(module_id_t module_idP,int CC_idP,uint16_t rntiP)
{
nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[0];
......@@ -1068,12 +1047,12 @@ uint8_t get_V_UL_DAI(module_id_t module_idP,int CC_idP,uint16_t rntiP) {
}
return(4); // this is rule from Section 7.3 in 36.213
}
void fill_nfapi_ulsch_harq_information(module_id_t module_idP,
int CC_idP,
uint16_t rntiP,
nfapi_ul_config_ulsch_harq_information *harq_information) {
nfapi_ul_config_ulsch_harq_information *harq_information)
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
UE_list_t *UE_list = &eNB->UE_list;
......@@ -1111,7 +1090,6 @@ void fill_nfapi_ulsch_harq_information(module_id_t module_idP,
case 5:
case 6:
case 7:
if (cc->tdd_Config==NULL) // FDD
harq_information->harq_information_rel10.harq_size = 1;
else {
......@@ -1122,7 +1100,6 @@ void fill_nfapi_ulsch_harq_information(module_id_t module_idP,
}
break;
default: // for any other TM we need 2 bits harq
if (cc->tdd_Config==NULL) {
harq_information->harq_information_rel10.harq_size = 2;
}
......@@ -1141,15 +1118,14 @@ void fill_nfapi_harq_information(module_id_t module_idP,
uint16_t rntiP,
uint16_t absSFP,
nfapi_ul_config_harq_information *harq_information,
uint8_t cce_idxP) {
uint8_t cce_idxP)
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
UE_list_t *UE_list = &eNB->UE_list;
int UE_id = find_UE_id(module_idP,rntiP);
AssertFatal(UE_id>=0,"UE_id cannot be found, impossible\n");
AssertFatal(UE_list!=NULL,"UE_list is null\n");
AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated!=NULL,"physicalConfigDedicated for rnti %x is null\n",rntiP);
......@@ -1207,13 +1183,12 @@ void fill_nfapi_harq_information(module_id_t module_idP,
} // get Tmode
}
uint16_t fill_nfapi_uci_acknak(module_id_t module_idP,
int CC_idP,
uint16_t rntiP,
uint16_t absSFP,
uint8_t cce_idxP) {
uint8_t cce_idxP)
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
......@@ -1221,7 +1196,6 @@ uint16_t fill_nfapi_uci_acknak(module_id_t module_idP,
nfapi_ul_config_request_body_t *ul_req = &eNB->UL_req_tmp[CC_idP][ackNAK_absSF%10].ul_config_request_body;
nfapi_ul_config_request_pdu_t *ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
memset((void*)ul_config_pdu,0,sizeof(nfapi_ul_config_request_pdu_t));
ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
ul_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_ul_config_uci_harq_pdu));
......@@ -1265,12 +1239,11 @@ void fill_nfapi_dlsch_config(eNB_MAC_INST *eNB,
uint8_t transmission_mode,
uint8_t num_bf_prb_per_subband,
uint8_t num_bf_vector
) {
)
{
nfapi_dl_config_request_pdu_t *dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length = length;
......@@ -1298,8 +1271,8 @@ void fill_nfapi_dlsch_config(eNB_MAC_INST *eNB,
dl_req->number_pdu++;
}
uint16_t fill_nfapi_tx_req(nfapi_tx_request_body_t *tx_req_body,uint16_t absSF,uint16_t pdu_length, uint16_t *pdu_index, uint8_t *pdu) {
uint16_t fill_nfapi_tx_req(nfapi_tx_request_body_t *tx_req_body,uint16_t absSF,uint16_t pdu_length, uint16_t *pdu_index, uint8_t *pdu)
{
nfapi_tx_request_pdu_t *TX_req = &tx_req_body->tx_pdu_list[tx_req_body->number_of_pdus];
LOG_D(MAC,"Filling TX_req %d for pdu length %d\n",tx_req_body->number_of_pdus,pdu_length);
TX_req->pdu_length = pdu_length;
......@@ -1332,9 +1305,8 @@ void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *ul_con
uint8_t current_tx_nb,
uint8_t n_srs,
uint16_t size
) {
)
{
memset((void*)ul_config_pdu,0,sizeof(nfapi_ul_config_request_pdu_t));
if (cqi_req==0)
ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
......@@ -1399,24 +1371,26 @@ void fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t *ul_con
uint8_t ue_type,
uint16_t total_number_of_repetitions,
uint16_t repetition_number,
uint16_t initial_transmission_sf_io) {
uint16_t initial_transmission_sf_io)
{
// Re13 fields
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.ue_type = ue_type;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions = total_number_of_repetitions;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number = repetition_number;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io = initial_transmission_sf_io;
}
int get_numnarrowbands(long dl_Bandwidth) {
int get_numnarrowbands(long dl_Bandwidth)
{
int nb_tab[6] = {1,2,4,8,12,16};
AssertFatal(dl_Bandwidth<7 || dl_Bandwidth>=0,"dl_Bandwidth not in [0..6]\n");
return(nb_tab[dl_Bandwidth]);
}
int get_numnarrowbandbits(long dl_Bandwidth) {
int get_numnarrowbandbits(long dl_Bandwidth)
{
int nbbits_tab[6] = {0,1,2,3,4,4};
AssertFatal(dl_Bandwidth<7 || dl_Bandwidth>=0,"dl_Bandwidth not in [0..6]\n");
......@@ -1427,11 +1401,10 @@ int get_numnarrowbandbits(long dl_Bandwidth) {
int startSF_fdd_RA_times2[8] = {2,3,4,5,8,10,16,20};
int startSF_tdd_RA[7] = {1,2,4,5,8,10,20};
int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t subframeP,int rmax,MPDCCH_TYPES_t mpdcch_type,int UE_id) {
int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t subframeP,int rmax,MPDCCH_TYPES_t mpdcch_type,int UE_id)
{
struct PRACH_ConfigSIB_v1310 *ext4_prach = eNB->common_channels[CC_id].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
int T;
EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11;
......@@ -1460,7 +1433,6 @@ int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t
case TYPEUESPEC:
epdcch_setconfig_r11= eNB->UE_list.UE_template[CC_id][UE_id].physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0] ;
AssertFatal(epdcch_setconfig_r11 != NULL," epdcch_setconfig_r11 is null for UE specific \n");
AssertFatal(epdcch_setconfig_r11->ext2 != NULL," ext2 doesn't exist in epdcch config ' \n");
......@@ -1477,11 +1449,10 @@ int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t
AssertFatal(T>0,"T is 0!\n");
if (((10*frameP) + subframeP)%T == 0) return(1);
else return(0);
}
int narrowband_to_first_rb(COMMON_channels_t *cc, int nb_index) {
int narrowband_to_first_rb(COMMON_channels_t *cc, int nb_index)
{
switch (cc->mib->message.dl_Bandwidth) {
case 0: // 6 PRBs, N_NB=1, i_0=0
return(0);
......@@ -1540,9 +1511,7 @@ void init_ue_sched_info(void)
unsigned char get_ue_weight(module_id_t module_idP, int CC_idP, int ue_idP)
//------------------------------------------------------------------------------
{
return(eNB_dlsch_info[module_idP][CC_idP][ue_idP].weight);
}
//------------------------------------------------------------------------------
......@@ -1571,8 +1540,6 @@ int find_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP)
RA_TEMPLATE *RA_template = (RA_TEMPLATE *)&RC.mac[mod_idP]->common_channels[CC_idP].RA_template[0];
for (RA_id = 0; RA_id < NB_RA_PROC_MAX; RA_id++) {
LOG_D(MAC,"Checking RA_id %d for %x : RA_active %d, wait_ack_Msg4 %d\n",
RA_id,rntiP,
......@@ -1604,7 +1571,6 @@ int UE_PCCID(module_id_t mod_idP,int ue_idP)
rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP)
//------------------------------------------------------------------------------
{
rnti_t rnti = RC.mac[mod_idP]->UE_list.UE_template[UE_PCCID(mod_idP,ue_idP)][ue_idP].rnti;
if (rnti>0) {
......@@ -1653,7 +1619,6 @@ unsigned char get_aggregation (uint8_t bw_index, uint8_t cqi, uint8_t dci_fmt)
unsigned char aggregation=3;
switch (dci_fmt){
case format0:
aggregation = cqi2fmt0_agg[bw_index][cqi];
break;
......@@ -1790,7 +1755,6 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
eNB_dlsch_info[mod_idP][pCC_id][UE_id].rnti = NOT_A_RNTI;
eNB_dlsch_info[mod_idP][pCC_id][UE_id].status = S_DL_NONE;
// check if this has an RA process active
RA_TEMPLATE *RA_template;
for (i=0;i<NB_RA_PROC_MAX;i++) {
......@@ -1810,8 +1774,6 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
return 0;
}
int prev(UE_list_t *listP, int nodeP, int ul_flag)
{
int j;
......@@ -1842,13 +1804,11 @@ int prev(UE_list_t *listP, int nodeP, int ul_flag)
nodeP, (ul_flag == 0)? "DL" : "UL");
dump_ue_list(listP, ul_flag);
return(-1);
}
void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag)
{
int prev_i,prev_j,next_i,next_j;
LOG_T(MAC,"Swapping UE %d,%d\n",nodeiP,nodejP);
......@@ -1899,7 +1859,6 @@ void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag)
listP->next[nodejP] = next_i;
listP->next[nodeiP] = next_j;
if (nodeiP==listP->head) {
LOG_T(MAC,"changing head to %d\n",nodejP);
listP->head=nodejP;
......@@ -1941,7 +1900,6 @@ void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag)
listP->next_ul[nodejP] = next_i;
listP->next_ul[nodeiP] = next_j;
if (nodeiP==listP->head_ul) {
LOG_T(MAC,"[UL]changing head to %d\n",nodejP);
listP->head_ul=nodejP;
......@@ -1961,13 +1919,6 @@ void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag)
dump_ue_list(listP,ul_flag);
}
/*
#if defined(Rel10) || defined(Rel14)
unsigned char generate_mch_header( unsigned char *mac_header,
......@@ -2084,11 +2035,9 @@ void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag)
// This has to be updated to include BSR information
uint8_t UE_is_to_be_scheduled(module_id_t module_idP,int CC_id,uint8_t UE_id)
{
UE_TEMPLATE *UE_template = &RC.mac[module_idP]->UE_list.UE_template[CC_id][UE_id];
UE_sched_ctrl *UE_sched_ctl = &RC.mac[module_idP]->UE_list.UE_sched_ctrl[UE_id];
// do not schedule UE if UL is not working
if (UE_sched_ctl->ul_failure_timer>0)
return(0);
......@@ -2108,7 +2057,6 @@ uint8_t UE_is_to_be_scheduled(module_id_t module_idP,int CC_id,uint8_t UE_id)
(UE_sched_ctl->ul_scheduled==0)&&
(mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP,UE_id)) < RRC_CONNECTED))) // every Frame when not RRC_CONNECTED
{
LOG_D(MAC,"[eNB %d][PUSCH] UE %d/%x should be scheduled (BSR0 %d,SR %d)\n",module_idP,UE_id,UE_RNTI(module_idP,UE_id),
UE_template->bsr_info[LCGID0],
UE_template->ul_SR);
......@@ -2118,9 +2066,8 @@ uint8_t UE_is_to_be_scheduled(module_id_t module_idP,int CC_id,uint8_t UE_id)
}
}
uint8_t get_tmode(module_id_t module_idP,int CC_idP,int UE_idP) {
uint8_t get_tmode(module_id_t module_idP,int CC_idP,int UE_idP)
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
......@@ -2148,8 +2095,8 @@ uint8_t get_tmode(module_id_t module_idP,int CC_idP,int UE_idP) {
}
}
int8_t get_ULharq(module_id_t module_idP,int CC_idP,uint16_t frameP,uint8_t subframeP) {
int8_t get_ULharq(module_id_t module_idP,int CC_idP,uint16_t frameP,uint8_t subframeP)
{
uint8_t ret = -1;
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
......@@ -2157,9 +2104,7 @@ int8_t get_ULharq(module_id_t module_idP,int CC_idP,uint16_t frameP,uint8_t subf
if (cc->tdd_Config==NULL) { // FDD
ret = (((frameP<<1)+subframeP)&7);
} else {
switch (cc->tdd_Config->subframeAssignment) {
case 1:
if ((subframeP==2) ||
(subframeP==3) ||
......@@ -2221,7 +2166,6 @@ int8_t get_ULharq(module_id_t module_idP,int CC_idP,uint16_t frameP,uint8_t subf
uint16_t getRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs)
{
uint16_t RIV;
if (Lcrbs<=(1+(N_RB_DL>>1)))
......@@ -2234,7 +2178,6 @@ uint16_t getRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs)
uint32_t allocate_prbs(int UE_id,unsigned char nb_rb, int N_RB_DL, uint32_t *rballoc)
{
int i;
uint32_t rballoc_dci=0;
unsigned char nb_rb_alloc=0;
......@@ -2263,7 +2206,6 @@ uint32_t allocate_prbs(int UE_id,unsigned char nb_rb, int N_RB_DL, uint32_t *rba
int get_bw_index(module_id_t module_id, uint8_t CC_id)
{
int bw_index=0;
int N_RB_DL = to_prb(RC.mac[module_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
......@@ -2296,7 +2238,6 @@ int get_bw_index(module_id_t module_id, uint8_t CC_id)
int get_min_rb_unit(module_id_t module_id, uint8_t CC_id)
{
int min_rb_unit=0;
int N_RB_DL = to_prb(RC.mac[module_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
......@@ -2329,7 +2270,6 @@ int get_min_rb_unit(module_id_t module_id, uint8_t CC_id)
uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG, uint8_t *rballoc)
{
int check=0;//check1=0,check2=0;
uint32_t rballoc_dci=0;
//uint8_t number_of_subbands=13;
......@@ -2382,16 +2322,17 @@ uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG, uint8_t *rballoc)
return (rballoc_dci);
}
int get_subbandsize(uint8_t dl_Bandwidth) {
int get_subbandsize(uint8_t dl_Bandwidth)
{
uint8_t ss[6] = {6,4,4,6,8,8};
AssertFatal(dl_Bandwidth<6,"dl_Bandwidth %d is out of bounds\n",dl_Bandwidth);
return(ss[dl_Bandwidth]);
}
int get_nb_subband(int N_RB_DL)
{
int nb_sb=0;
switch (N_RB_DL) {
......@@ -2424,7 +2365,6 @@ int get_nb_subband(int N_RB_DL)
}
return nb_sb;
}
void init_CCE_table(int module_idP,int CC_idP)
......@@ -2440,7 +2380,6 @@ int get_nCCE_offset(int *CCE_table,
const unsigned short rnti,
const unsigned char subframe)
{
int search_space_free,m,nb_candidates = 0,l,i;
unsigned int Yk;
/*
......@@ -2490,7 +2429,6 @@ int get_nCCE_offset(int *CCE_table,
Yk = Yk % (nCCE/L);
switch (L) {
case 1:
case 2:
......@@ -2507,7 +2445,6 @@ int get_nCCE_offset(int *CCE_table,
break;
}
LOG_D(MAC,"rnti %x, Yk = %d, nCCE %d (nCCE/L %d),nb_cand %d\n",rnti,Yk,nCCE,nCCE/L,nb_candidates);
for (m = 0 ; m < nb_candidates ; m++) {
......@@ -2533,8 +2470,8 @@ int get_nCCE_offset(int *CCE_table,
}
}
void dump_CCE_table(int *CCE_table,const int nCCE,const unsigned short rnti,const int subframe,int L) {
void dump_CCE_table(int *CCE_table,const int nCCE,const unsigned short rnti,const int subframe,int L)
{
int nb_candidates = 0,i;
unsigned int Yk;
......@@ -2552,7 +2489,6 @@ void dump_CCE_table(int *CCE_table,const int nCCE,const unsigned short rnti,cons
Yk = Yk % (nCCE/L);
switch (L) {
case 1:
case 2:
......@@ -2569,16 +2505,11 @@ void dump_CCE_table(int *CCE_table,const int nCCE,const unsigned short rnti,cons
break;
}
printf("rnti %x, Yk*L = %d, nCCE %d (nCCE/L %d),nb_cand*L %d\n",rnti,Yk*L,nCCE,nCCE/L,nb_candidates*L);
}
uint16_t getnquad(COMMON_channels_t *cc, uint8_t num_pdcch_symbols,uint8_t mi)
{
uint16_t Nreg=0;
AssertFatal(cc!=NULL,"cc is null\n");
......@@ -2630,8 +2561,8 @@ uint16_t getnCCE(COMMON_channels_t *cc, uint8_t num_pdcch_symbols, uint8_t mi)
return(getnquad(cc,num_pdcch_symbols,mi)/9);
}
uint8_t getmi(COMMON_channels_t *cc,int subframe) {
uint8_t getmi(COMMON_channels_t *cc,int subframe)
{
AssertFatal(cc!=NULL,"cc is null\n");
// for FDD
......@@ -2640,7 +2571,6 @@ uint8_t getmi(COMMON_channels_t *cc,int subframe) {
// for TDD
switch (cc->tdd_Config->subframeAssignment) {
case 0:
if ((subframe==0) || (subframe==5))
return(2);
......@@ -2703,9 +2633,8 @@ uint16_t get_nCCE_max(COMMON_channels_t *cc, int num_pdcch_symbols,int subframe)
int allocate_CCEs(int module_idP,
int CC_idP,
int subframeP,
int test_onlyP) {
int test_onlyP)
{
int *CCE_table = RC.mac[module_idP]->CCE_table[CC_idP];
nfapi_dl_config_request_body_t *DL_req = &RC.mac[module_idP]->DL_req[CC_idP].dl_config_request_body;
nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body;
......@@ -2716,7 +2645,6 @@ int allocate_CCEs(int module_idP,
int i,j,idci;
int nCCE=0;
LOG_D(MAC,"Allocate CCEs subframe %d, test %d : (DL PDU %d, DL DCI %d, UL %d)\n",subframeP,test_onlyP,DL_req->number_pdu,DL_req->number_dci,HI_DCI0_req->number_of_dci);
DL_req->number_pdcch_ofdm_symbols=1;
......@@ -2724,7 +2652,6 @@ try_again:
init_CCE_table(module_idP,CC_idP);
nCCE=0;
for (i=0,idci=0;i<DL_req->number_pdu;i++) {
// allocate DL common DCIs first
if ((dl_config_pdu[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)&&
......@@ -2916,19 +2843,17 @@ try_again:
return 0;
failed:
failed:
return -1;
}
/*
uint8_t get_ul_req_index(module_id_t module_idP, int CC_idP, sub_frame_t subframeP) {
uint8_t get_ul_req_index(module_id_t module_idP, int CC_idP, sub_frame_t subframeP)
{
if (RC.mac[module_idP]->common_channels[CC_idP].tdd_Config == NULL)
return(0);
switch (RC.mac[module_idP]->common_channels[CC_idP].tdd_Config->subframeAssignment) {
case 0:
case 1:
case 2:
......@@ -2959,8 +2884,8 @@ uint8_t get_ul_req_index(module_id_t module_idP, int CC_idP, sub_frame_t subfram
}
*/
nfapi_ul_config_request_pdu_t* has_ul_grant(module_id_t module_idP,int CC_idP,uint16_t absSFP,uint16_t rnti) {
nfapi_ul_config_request_pdu_t* has_ul_grant(module_id_t module_idP,int CC_idP,uint16_t absSFP,uint16_t rnti)
{
nfapi_ul_config_request_body_t *ul_req;
nfapi_ul_config_request_pdu_t *ul_config_pdu;
......@@ -3000,10 +2925,8 @@ nfapi_ul_config_request_pdu_t* has_ul_grant(module_id_t module_idP,int CC_idP,ui
(ul_config_pdu[i].ulsch_uci_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE)&&
(ul_config_pdu[i].ulsch_csi_uci_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]);
}
return(NULL); // no ul grant at all for this UE
}
......@@ -3061,8 +2984,8 @@ boolean_t CCE_allocation_infeasible(int module_idP,
return res;
}
void extract_harq(module_id_t mod_idP,int CC_idP,int UE_id,frame_t frameP,sub_frame_t subframeP,void *harq_indication,int format) {
void extract_harq(module_id_t mod_idP,int CC_idP,int UE_id,frame_t frameP,sub_frame_t subframeP,void *harq_indication,int format)
{
UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
rnti_t rnti = UE_RNTI(mod_idP,UE_id);
......@@ -3111,7 +3034,6 @@ void extract_harq(module_id_t mod_idP,int CC_idP,int UE_id,frame_t frameP,sub_fr
}
}
else {
harq_indication_fdd = (nfapi_harq_indication_fdd_rel13_t *)harq_indication;
num_ack_nak = harq_indication_fdd->number_of_ack_nack;
pdu = &harq_indication_fdd->harq_tb_n[0];
......@@ -3305,8 +3227,9 @@ void extract_harq(module_id_t mod_idP,int CC_idP,int UE_id,frame_t frameP,sub_fr
}
}
}
void extract_pucch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,sub_frame_t subframeP,uint8_t *pdu, uint8_t length) {
void extract_pucch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,sub_frame_t subframeP,uint8_t *pdu, uint8_t length)
{
UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
COMMON_channels_t *cc=&RC.mac[mod_idP]->common_channels[CC_idP];
......@@ -3404,8 +3327,8 @@ void extract_pucch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,
}
}
void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,sub_frame_t subframeP,uint8_t *pdu, uint8_t length) {
void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,sub_frame_t subframeP,uint8_t *pdu, uint8_t length)
{
UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
COMMON_channels_t *cc = &RC.mac[mod_idP]->common_channels[CC_idP];
UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
......@@ -3432,7 +3355,6 @@ void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,
int m;
switch(*cqi_ReportModeAperiodic) {
case CQI_ReportModeAperiodic_rm12:
AssertFatal(0==1, "to be fixed, don't use p but pdu directly\n");
// wideband multiple PMI (TM4/6), Table 5.2.2.6.1-1 (for TM4/6)
......@@ -3596,14 +3518,12 @@ void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,
AssertFatal(1==0,"CQI_ReportModeAperiodic_rm11 to be done\n");
break;
}
}
void cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, rnti_t rntiP,
nfapi_cqi_indication_rel9_t *rel9,uint8_t *pdu,
nfapi_ul_cqi_information_t *ul_cqi_information) {
nfapi_ul_cqi_information_t *ul_cqi_information)
{
int UE_id = find_UE_id(mod_idP, rntiP);
UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
......@@ -3666,7 +3586,6 @@ void SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, sub_frame_t
void UL_failure_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, rnti_t rntiP, sub_frame_t subframeP)
{
int UE_id = find_UE_id(mod_idP, rntiP);
UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
......@@ -3683,9 +3602,8 @@ void UL_failure_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, rnti
}
}
void harq_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, nfapi_harq_indication_pdu_t *harq_pdu) {
void harq_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, nfapi_harq_indication_pdu_t *harq_pdu)
{
rnti_t rnti = harq_pdu->rx_ue_information.rnti;
uint8_t ul_cqi = harq_pdu->ul_cqi_information.ul_cqi;
uint8_t channel = harq_pdu->ul_cqi_information.channel;
......
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