Commit 97d947dc authored by francescomani's avatar francescomani

review and formatting

parent e42f4518
...@@ -1357,14 +1357,14 @@ static void nr_generate_Msg2(module_id_t module_idP, ...@@ -1357,14 +1357,14 @@ static void nr_generate_Msg2(module_id_t module_idP,
dci_pdu->powerControlOffsetSS = 1; dci_pdu->powerControlOffsetSS = 1;
dci_pdu_rel15_t dci_payload; dci_pdu_rel15_t dci_payload;
dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, AssertFatal(pdsch_pdu_rel15->rbStart >= alloc_start,
pdsch_pdu_rel15->rbStart - alloc_start, "Start of allocated PRBs %d cannot be smaller than allowed allocation start %d\n",
rbStop - alloc_start); pdsch_pdu_rel15->rbStart,
alloc_start);
dci_payload.frequency_domain_assignment.val =
PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart - alloc_start, rbStop - alloc_start);
LOG_D(NR_MAC,"Msg2 rbSize.rbStart.BWPsize %d.%d.%ld\n", LOG_D(NR_MAC, "Msg2 rbSize.rbStart.BWPsize %d.%d.%ld\n", pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, BWPSize);
pdsch_pdu_rel15->rbSize,
pdsch_pdu_rel15->rbStart,
BWPSize);
dci_payload.time_domain_assignment.val = time_domain_assignment; dci_payload.time_domain_assignment.val = time_domain_assignment;
dci_payload.vrb_to_prb_mapping.val = 0; dci_payload.vrb_to_prb_mapping.val = 0;
...@@ -1516,7 +1516,7 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac, ...@@ -1516,7 +1516,7 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac,
pdsch_pdu_rel15->pduBitmap = 0; pdsch_pdu_rel15->pduBitmap = 0;
pdsch_pdu_rel15->rnti = rnti; pdsch_pdu_rel15->rnti = rnti;
pdsch_pdu_rel15->pduIndex = pduindex; pdsch_pdu_rel15->pduIndex = pduindex;
pdsch_pdu_rel15->BWPSize = dl_bwp->BWPSize; pdsch_pdu_rel15->BWPSize = dl_bwp->BWPSize;
pdsch_pdu_rel15->BWPStart = dl_bwp->BWPStart; pdsch_pdu_rel15->BWPStart = dl_bwp->BWPStart;
pdsch_pdu_rel15->SubcarrierSpacing = dl_bwp->scs; pdsch_pdu_rel15->SubcarrierSpacing = dl_bwp->scs;
pdsch_pdu_rel15->CyclicPrefix = 0; pdsch_pdu_rel15->CyclicPrefix = 0;
...@@ -1572,9 +1572,12 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac, ...@@ -1572,9 +1572,12 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac,
int alloc_start = 0; int alloc_start = 0;
int alloc_stop = 0; int alloc_stop = 0;
get_start_stop_allocation(nr_mac, &ra->sc_info, dl_bwp, ss, &alloc_start, &alloc_stop); get_start_stop_allocation(nr_mac, &ra->sc_info, dl_bwp, ss, &alloc_start, &alloc_stop);
dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, AssertFatal(pdsch_pdu_rel15->rbStart >= alloc_start,
pdsch_pdu_rel15->rbStart - alloc_start, "Start of allocated PRBs %d cannot be smaller than allowed allocation start %d\n",
alloc_stop - alloc_start); pdsch_pdu_rel15->rbStart,
alloc_start);
dci_payload.frequency_domain_assignment.val =
PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart - alloc_start, alloc_stop - alloc_start);
dci_payload.format_indicator = 1; dci_payload.format_indicator = 1;
dci_payload.time_domain_assignment.val = time_domain_assignment; dci_payload.time_domain_assignment.val = time_domain_assignment;
...@@ -1756,7 +1759,7 @@ static void nr_generate_Msg4(module_id_t module_idP, ...@@ -1756,7 +1759,7 @@ static void nr_generate_Msg4(module_id_t module_idP,
// increase PRBs until we get to max size or TBS is bigger than MAC PDU size // increase PRBs until we get to max size or TBS is bigger than MAC PDU size
do { do {
if(rbSize < (rbStop - rbStart)) if (rbSize < rbStop - rbStart)
rbSize++; rbSize++;
else else
mcsIndex++; mcsIndex++;
......
...@@ -394,8 +394,8 @@ void get_start_stop_allocation(gNB_MAC_INST *mac, ...@@ -394,8 +394,8 @@ void get_start_stop_allocation(gNB_MAC_INST *mac,
// TS 38.214 Section 5.1.2.2.2 // TS 38.214 Section 5.1.2.2.2
*rbStop = dl_bwp->BWPSize; *rbStop = dl_bwp->BWPSize;
*rbStart = 0; // start wrt BWPstart *rbStart = 0; // start wrt BWPstart
if (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common && if (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common
ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) { && ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) {
if (mac->cset0_bwp_size != 0) { if (mac->cset0_bwp_size != 0) {
*rbStart = mac->cset0_bwp_start; *rbStart = mac->cset0_bwp_start;
*rbStop = *rbStart + mac->cset0_bwp_size; *rbStop = *rbStart + mac->cset0_bwp_size;
...@@ -1164,6 +1164,10 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1164,6 +1164,10 @@ void nr_schedule_ue_spec(module_id_t module_id,
int rbStop = 0; int rbStop = 0;
int rbStart = 0; int rbStart = 0;
get_start_stop_allocation(gNB_mac, &UE->sc_info, current_BWP, sched_ctrl->search_space, &rbStart, &rbStop); get_start_stop_allocation(gNB_mac, &UE->sc_info, current_BWP, sched_ctrl->search_space, &rbStart, &rbStop);
AssertFatal(pdsch_pdu->rbStart >= rbStart,
"Start of allocated PRBs %d cannot be smaller than allowed allocation start %d\n",
pdsch_pdu->rbStart,
rbStart);
dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu->rbSize, dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu->rbSize,
pdsch_pdu->rbStart - rbStart, pdsch_pdu->rbStart - rbStart,
rbStop - rbStart); rbStop - rbStart);
......
...@@ -693,10 +693,10 @@ void config_uldci(const NR_UE_ServingCell_Info_t *sc_info, ...@@ -693,10 +693,10 @@ void config_uldci(const NR_UE_ServingCell_Info_t *sc_info,
// when DCI format 0_0 is used in any common search space // when DCI format 0_0 is used in any common search space
// the size of the initial UL bandwidth part shall be used // the size of the initial UL bandwidth part shall be used
// 38.214 section 6.1.2.2.2 // 38.214 section 6.1.2.2.2
const uint16_t alloc_size = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common && const uint16_t alloc_size = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common
ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) ? && ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
sc_info->initial_ul_BWPSize : ? sc_info->initial_ul_BWPSize
ul_bwp->BWPSize; : ul_bwp->BWPSize;
dci_pdu_rel15->frequency_domain_assignment.val = dci_pdu_rel15->frequency_domain_assignment.val =
PRBalloc_to_locationandbandwidth0(pusch_pdu->rb_size, pusch_pdu->rb_start, alloc_size); PRBalloc_to_locationandbandwidth0(pusch_pdu->rb_size, pusch_pdu->rb_start, alloc_size);
dci_pdu_rel15->time_domain_assignment.val = time_domain_assignment; dci_pdu_rel15->time_domain_assignment.val = time_domain_assignment;
......
...@@ -1502,10 +1502,10 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, ...@@ -1502,10 +1502,10 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
// when DCI format 0_0 is used in any common search space // when DCI format 0_0 is used in any common search space
// the size of the initial UL bandwidth part shall be used // the size of the initial UL bandwidth part shall be used
// 38.214 section 6.1.2.2.2 // 38.214 section 6.1.2.2.2
const uint16_t bwpSize = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common && const uint16_t bwpSize = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common
ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) ? && ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
UE->sc_info.initial_ul_BWPSize : ? UE->sc_info.initial_ul_BWPSize
ul_bwp->BWPSize; : ul_bwp->BWPSize;
const uint8_t nrOfLayers = retInfo->nrOfLayers; const uint8_t nrOfLayers = retInfo->nrOfLayers;
LOG_D(NR_MAC,"retInfo->time_domain_allocation = %d, tda = %d\n", retInfo->time_domain_allocation, tda); LOG_D(NR_MAC,"retInfo->time_domain_allocation = %d, tda = %d\n", retInfo->time_domain_allocation, tda);
LOG_D(NR_MAC,"tbs %d\n",retInfo->tb_size); LOG_D(NR_MAC,"tbs %d\n",retInfo->tb_size);
...@@ -1672,10 +1672,10 @@ static void pf_ul(module_id_t module_id, ...@@ -1672,10 +1672,10 @@ static void pf_ul(module_id_t module_id,
// the size of the initial UL bandwidth part shall be used // the size of the initial UL bandwidth part shall be used
// 38.214 section 6.1.2.2.2 // 38.214 section 6.1.2.2.2
NR_SearchSpace_t *ss = sched_ctrl->search_space; NR_SearchSpace_t *ss = sched_ctrl->search_space;
const uint16_t bwpSize = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common && const uint16_t bwpSize = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common
ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) ? && ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
UE->sc_info.initial_ul_BWPSize : ? UE->sc_info.initial_ul_BWPSize
current_BWP->BWPSize; : current_BWP->BWPSize;
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
const NR_mac_dir_stats_t *stats = &UE->mac_stats.ul; const NR_mac_dir_stats_t *stats = &UE->mac_stats.ul;
...@@ -1743,7 +1743,9 @@ static void pf_ul(module_id_t module_id, ...@@ -1743,7 +1743,9 @@ static void pf_ul(module_id_t module_id,
/* if no data, pre-allocate 5RB */ /* if no data, pre-allocate 5RB */
/* Find a free CCE */ /* Find a free CCE */
int CCEIndex = get_cce_index(nrmac, int CCEIndex = get_cce_index(nrmac,
CC_id, slot, UE->rnti, CC_id,
slot,
UE->rnti,
&sched_ctrl->aggregation_level, &sched_ctrl->aggregation_level,
ss, ss,
sched_ctrl->coreset, sched_ctrl->coreset,
...@@ -1841,7 +1843,9 @@ static void pf_ul(module_id_t module_id, ...@@ -1841,7 +1843,9 @@ static void pf_ul(module_id_t module_id,
NR_UE_sched_ctrl_t *sched_ctrl = &iterator->UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &iterator->UE->UE_sched_ctrl;
NR_SearchSpace_t *ss = sched_ctrl->search_space; NR_SearchSpace_t *ss = sched_ctrl->search_space;
int CCEIndex = get_cce_index(nrmac, int CCEIndex = get_cce_index(nrmac,
CC_id, slot, iterator->UE->rnti, CC_id,
slot,
iterator->UE->rnti,
&sched_ctrl->aggregation_level, &sched_ctrl->aggregation_level,
ss, ss,
sched_ctrl->coreset, sched_ctrl->coreset,
...@@ -1878,10 +1882,10 @@ static void pf_ul(module_id_t module_id, ...@@ -1878,10 +1882,10 @@ static void pf_ul(module_id_t module_id,
// when DCI format 0_0 is used in any common search space // when DCI format 0_0 is used in any common search space
// the size of the initial UL bandwidth part shall be used // the size of the initial UL bandwidth part shall be used
// 38.214 section 6.1.2.2.2 // 38.214 section 6.1.2.2.2
const uint16_t bwpSize = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common && const uint16_t bwpSize = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common
ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) ? && ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
iterator->UE->sc_info.initial_ul_BWPSize : ? iterator->UE->sc_info.initial_ul_BWPSize
current_BWP->BWPSize; : current_BWP->BWPSize;
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
rbStart++; rbStart++;
sched_pusch->rbStart = rbStart; sched_pusch->rbStart = rbStart;
......
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