Commit 39fddbba authored by francescomani's avatar francescomani Committed by Laurent THOMAS

review and formatting

parent ca0d4a82
......@@ -1358,14 +1358,14 @@ static void nr_generate_Msg2(module_id_t module_idP,
dci_pdu->powerControlOffsetSS = 1;
dci_pdu_rel15_t dci_payload;
dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
pdsch_pdu_rel15->rbStart - alloc_start,
rbStop - alloc_start);
AssertFatal(pdsch_pdu_rel15->rbStart >= alloc_start,
"Start of allocated PRBs %d cannot be smaller than allowed allocation start %d\n",
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",
pdsch_pdu_rel15->rbSize,
pdsch_pdu_rel15->rbStart,
BWPSize);
LOG_D(NR_MAC, "Msg2 rbSize.rbStart.BWPsize %d.%d.%ld\n", pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, BWPSize);
dci_payload.time_domain_assignment.val = time_domain_assignment;
dci_payload.vrb_to_prb_mapping.val = 0;
......@@ -1517,7 +1517,7 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac,
pdsch_pdu_rel15->pduBitmap = 0;
pdsch_pdu_rel15->rnti = rnti;
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->SubcarrierSpacing = dl_bwp->scs;
pdsch_pdu_rel15->CyclicPrefix = 0;
......@@ -1573,9 +1573,12 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac,
int alloc_start = 0;
int alloc_stop = 0;
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,
pdsch_pdu_rel15->rbStart - alloc_start,
alloc_stop - alloc_start);
AssertFatal(pdsch_pdu_rel15->rbStart >= alloc_start,
"Start of allocated PRBs %d cannot be smaller than allowed allocation start %d\n",
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.time_domain_assignment.val = time_domain_assignment;
......@@ -1757,7 +1760,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
do {
if(rbSize < (rbStop - rbStart))
if (rbSize < rbStop - rbStart)
rbSize++;
else
mcsIndex++;
......
......@@ -394,8 +394,8 @@ void get_start_stop_allocation(gNB_MAC_INST *mac,
// TS 38.214 Section 5.1.2.2.2
*rbStop = dl_bwp->BWPSize;
*rbStart = 0; // start wrt BWPstart
if (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common &&
ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) {
if (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common
&& ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) {
if (mac->cset0_bwp_size != 0) {
*rbStart = mac->cset0_bwp_start;
*rbStop = *rbStart + mac->cset0_bwp_size;
......@@ -1164,6 +1164,10 @@ void nr_schedule_ue_spec(module_id_t module_id,
int rbStop = 0;
int rbStart = 0;
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,
pdsch_pdu->rbStart - rbStart,
rbStop - rbStart);
......
......@@ -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
// the size of the initial UL bandwidth part shall be used
// 38.214 section 6.1.2.2.2
const uint16_t alloc_size = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common &&
ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) ?
sc_info->initial_ul_BWPSize :
ul_bwp->BWPSize;
const uint16_t alloc_size = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common
&& ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
? sc_info->initial_ul_BWPSize
: ul_bwp->BWPSize;
dci_pdu_rel15->frequency_domain_assignment.val =
PRBalloc_to_locationandbandwidth0(pusch_pdu->rb_size, pusch_pdu->rb_start, alloc_size);
dci_pdu_rel15->time_domain_assignment.val = time_domain_assignment;
......
......@@ -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
// the size of the initial UL bandwidth part shall be used
// 38.214 section 6.1.2.2.2
const uint16_t bwpSize = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common &&
ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) ?
UE->sc_info.initial_ul_BWPSize :
ul_bwp->BWPSize;
const uint16_t bwpSize = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common
&& ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
? UE->sc_info.initial_ul_BWPSize
: ul_bwp->BWPSize;
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,"tbs %d\n",retInfo->tb_size);
......@@ -1672,10 +1672,10 @@ static void pf_ul(module_id_t module_id,
// the size of the initial UL bandwidth part shall be used
// 38.214 section 6.1.2.2.2
NR_SearchSpace_t *ss = sched_ctrl->search_space;
const uint16_t bwpSize = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common &&
ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) ?
UE->sc_info.initial_ul_BWPSize :
current_BWP->BWPSize;
const uint16_t bwpSize = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common
&& ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
? UE->sc_info.initial_ul_BWPSize
: current_BWP->BWPSize;
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
const NR_mac_dir_stats_t *stats = &UE->mac_stats.ul;
......@@ -1743,7 +1743,9 @@ static void pf_ul(module_id_t module_id,
/* if no data, pre-allocate 5RB */
/* Find a free CCE */
int CCEIndex = get_cce_index(nrmac,
CC_id, slot, UE->rnti,
CC_id,
slot,
UE->rnti,
&sched_ctrl->aggregation_level,
ss,
sched_ctrl->coreset,
......@@ -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_SearchSpace_t *ss = sched_ctrl->search_space;
int CCEIndex = get_cce_index(nrmac,
CC_id, slot, iterator->UE->rnti,
CC_id,
slot,
iterator->UE->rnti,
&sched_ctrl->aggregation_level,
ss,
sched_ctrl->coreset,
......@@ -1874,10 +1878,10 @@ static void pf_ul(module_id_t module_id,
// when DCI format 0_0 is used in any common search space
// the size of the initial UL bandwidth part shall be used
// 38.214 section 6.1.2.2.2
const uint16_t bwpSize = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common &&
ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) ?
iterator->UE->sc_info.initial_ul_BWPSize :
current_BWP->BWPSize;
const uint16_t bwpSize = (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common
&& ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
? iterator->UE->sc_info.initial_ul_BWPSize
: current_BWP->BWPSize;
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
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