Commit d2e6b9f5 authored by ChiehChun's avatar ChiehChun

Fix indentation, space and warning

parent 40a0ace5
...@@ -465,6 +465,7 @@ uint8_t getN_PRB_DMRS(NR_BWP_Downlink_t *bwp, int numDmrsCdmGrpsNoData) { ...@@ -465,6 +465,7 @@ uint8_t getN_PRB_DMRS(NR_BWP_Downlink_t *bwp, int numDmrsCdmGrpsNoData) {
return numDmrsCdmGrpsNoData * 4; return numDmrsCdmGrpsNoData * 4;
} }
} }
void nr_store_dlsch_buffer(module_id_t module_id, void nr_store_dlsch_buffer(module_id_t module_id,
frame_t frame, frame_t frame,
sub_frame_t slot) { sub_frame_t slot) {
...@@ -496,6 +497,7 @@ void nr_store_dlsch_buffer(module_id_t module_id, ...@@ -496,6 +497,7 @@ void nr_store_dlsch_buffer(module_id_t module_id,
sched_ctrl->rlc_status[lcid].bytes_in_buffer); sched_ctrl->rlc_status[lcid].bytes_in_buffer);
} }
} }
void find_free_CCE(module_id_t module_id, void find_free_CCE(module_id_t module_id,
sub_frame_t slot, sub_frame_t slot,
NR_UE_info_t *UE_info, NR_UE_info_t *UE_info,
...@@ -519,11 +521,12 @@ void find_free_CCE(module_id_t module_id, ...@@ -519,11 +521,12 @@ void find_free_CCE(module_id_t module_id,
m, m,
nr_of_candidates); nr_of_candidates);
if (sched_ctrl->cce_index < 0) { if (sched_ctrl->cce_index < 0) {
LOG_E(MAC, "%s(): could not find CCE for UE %d\n", __func__, UE_id); LOG_E(MAC, "%s(): could not find CCE for UE %d\n", __func__, UE_id);
return; return;
} }
UE_info->num_pdcch_cand[UE_id][cid]++; UE_info->num_pdcch_cand[UE_id][cid]++;
} }
void allocate_retransmission(module_id_t module_id, void allocate_retransmission(module_id_t module_id,
uint8_t *rballoc_mask, uint8_t *rballoc_mask,
int *n_rb_sched, int *n_rb_sched,
...@@ -541,20 +544,20 @@ void allocate_retransmission(module_id_t module_id, ...@@ -541,20 +544,20 @@ void allocate_retransmission(module_id_t module_id,
/* ensure that there is a free place for RB allocation */ /* ensure that there is a free place for RB allocation */
int rbSize = 0; int rbSize = 0;
while (rbSize < retInfo->rbSize) { while (rbSize < retInfo->rbSize) {
rbStart += rbSize; /* last iteration rbSize was not enough, skip it */ rbStart += rbSize; /* last iteration rbSize was not enough, skip it */
rbSize = 0; rbSize = 0;
while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++;
if (rbStart >= bwpSize) { if (rbStart >= bwpSize) {
LOG_E(MAC, LOG_E(MAC,
"cannot allocate retransmission for UE %d/RNTI %04x: no resources\n", "cannot allocate retransmission for UE %d/RNTI %04x: no resources\n",
UE_id, UE_id,
rnti); rnti);
return; return;
} }
while (rbStart + rbSize < bwpSize while (rbStart + rbSize < bwpSize
&& rballoc_mask[rbStart + rbSize] && rballoc_mask[rbStart + rbSize]
&& rbSize < retInfo->rbSize) && rbSize < retInfo->rbSize)
rbSize++; rbSize++;
} }
sched_ctrl->rbSize = retInfo->rbSize; sched_ctrl->rbSize = retInfo->rbSize;
sched_ctrl->rbStart = rbStart; sched_ctrl->rbStart = rbStart;
...@@ -568,12 +571,13 @@ void allocate_retransmission(module_id_t module_id, ...@@ -568,12 +571,13 @@ void allocate_retransmission(module_id_t module_id,
*n_rb_sched -= sched_ctrl->rbSize; *n_rb_sched -= sched_ctrl->rbSize;
int n_rb_ret = sched_ctrl->rbSize; int n_rb_ret = sched_ctrl->rbSize;
for (int i = sched_ctrl->rbStart; n_rb_ret > 0; i++) { for (int i = sched_ctrl->rbStart; n_rb_ret > 0; i++) {
if (!rballoc_mask[i]) if (!rballoc_mask[i])
continue; continue;
rballoc_mask[i] = 0; rballoc_mask[i] = 0;
n_rb_ret --; n_rb_ret--;
} }
} }
void pf_dl(module_id_t module_id, void pf_dl(module_id_t module_id,
frame_t frame, frame_t frame,
sub_frame_t slot, sub_frame_t slot,
...@@ -583,59 +587,22 @@ void pf_dl(module_id_t module_id, ...@@ -583,59 +587,22 @@ void pf_dl(module_id_t module_id,
uint8_t *rballoc_mask, uint8_t *rballoc_mask,
int max_num_ue) { int max_num_ue) {
const int UE_id = 0; const int UE_id = 0;
/* Loop UE_info->list to check retransmission */
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) {
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
const int current_harq_pid = sched_ctrl->current_harq_pid; const int current_harq_pid = sched_ctrl->current_harq_pid;
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid]; NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid];
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
/* Loop UE_info->list to check retransmission */
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) {
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
const uint16_t rnti = UE_info->rnti[UE_id];
/* Calculate Throughput */
/* retransmission */
if (harq->round != 0) {
/* Find a free CCE */
find_free_CCE(module_id,slot,UE_info,UE_id);
/* Find PUCCH occasion */
nr_acknack_scheduling(module_id,
UE_id,
frame,
slot,
num_slots_per_tdd,
&sched_ctrl->pucch_sched_idx,
&sched_ctrl->pucch_occ_idx);
AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n"); /* Calculate Throughput */
/* Allocate retransmission */
allocate_retransmission(module_id,rballoc_mask,&n_rb_sched,UE_info,UE_id);
} else {
/* Check DL buffer */
/* Calculate coeff */
/* Create UE_sched list for transmission*/
}
}
/* Loop UE_sched to find max coeff and allocate transmission */ /* retransmission */
//while(n_rb_sched > 0 && UE_sched.head >= 0){ if (harq->round != 0) {
if (harq->round == 0) { // temp
/* Find max coeff from UE_sched*/
/* Find a free CCE */ /* Find a free CCE */
find_free_CCE(module_id,slot,UE_info,UE_id); find_free_CCE(module_id, slot, UE_info, UE_id);
/* Find PUCCH occasion */ /* Find PUCCH occasion */
nr_acknack_scheduling(module_id, nr_acknack_scheduling(module_id,
...@@ -648,49 +615,87 @@ void pf_dl(module_id_t module_id, ...@@ -648,49 +615,87 @@ void pf_dl(module_id_t module_id,
AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n"); AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n");
/* Allocate transmission */ /* Allocate retransmission */
// Time-domain allocation allocate_retransmission(module_id, rballoc_mask, &n_rb_sched, UE_info, UE_id);
sched_ctrl->time_domain_allocation = 2;
} else {
// modulation scheme /* Check DL buffer */
sched_ctrl->mcsTableIdx = 0;
sched_ctrl->mcs = 9; /* Calculate coeff */
sched_ctrl->numDmrsCdmGrpsNoData = 1;
/* Create UE_sched list for transmission*/
// Freq-demain allocation
while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++;
uint8_t N_PRB_DMRS =
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp,
sched_ctrl->time_domain_allocation);
int rbSize = 0;
uint32_t TBS = 0;
do {
rbSize++;
TBS = nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
rbSize,
nrOfSymbols,
N_PRB_DMRS, // FIXME // This should be multiplied by the
// number of dmrs symbols
0 /* N_PRB_oh, 0 for initialBWP */,
0 /* tb_scaling */,
1 /* nrOfLayers */)
>> 3;
} while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize] && TBS < sched_ctrl->num_total_bytes);
sched_ctrl->rbSize = rbSize;
sched_ctrl->rbStart = rbStart;
n_rb_sched -= sched_ctrl->rbSize;
/* mark the corresponding RBs as used */
for (int rb = 0; rb < sched_ctrl->rbSize; rb++) {
//vrb_map[rb + sched_ctrl->rbStart] = 1;
rballoc_mask[rb + sched_ctrl->rbStart] = 0;
}
} }
}
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
const int current_harq_pid = sched_ctrl->current_harq_pid;
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
/* Loop UE_sched to find max coeff and allocate transmission */
//while(n_rb_sched > 0 && UE_sched.head >= 0){
if (harq->round == 0) { // temp
/* Find max coeff from UE_sched*/
/* Find a free CCE */
find_free_CCE(module_id, slot, UE_info, UE_id);
/* Find PUCCH occasion */
nr_acknack_scheduling(module_id,
UE_id,
frame,
slot,
num_slots_per_tdd,
&sched_ctrl->pucch_sched_idx,
&sched_ctrl->pucch_occ_idx);
AssertFatal(sched_ctrl->pucch_sched_idx >= 0, "no uplink slot for PUCCH found!\n");
/* Allocate transmission */
// Time-domain allocation
sched_ctrl->time_domain_allocation = 2;
// modulation scheme
sched_ctrl->mcsTableIdx = 0;
sched_ctrl->mcs = 9;
sched_ctrl->numDmrsCdmGrpsNoData = 1;
// Freq-demain allocation
while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++;
uint8_t N_PRB_DMRS =
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp,
sched_ctrl->time_domain_allocation);
int rbSize = 0;
uint32_t TBS = 0;
do {
rbSize++;
TBS = nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
rbSize,
nrOfSymbols,
N_PRB_DMRS, // FIXME // This should be multiplied by the
// number of dmrs symbols
0 /* N_PRB_oh, 0 for initialBWP */,
0 /* tb_scaling */,
1 /* nrOfLayers */)
>> 3;
} while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize] && TBS < sched_ctrl->num_total_bytes);
sched_ctrl->rbSize = rbSize;
sched_ctrl->rbStart = rbStart;
n_rb_sched -= sched_ctrl->rbSize;
/* mark the corresponding RBs as used */
for (int rb = 0; rb < sched_ctrl->rbSize; rb++) {
//vrb_map[rb + sched_ctrl->rbStart] = 1;
rballoc_mask[rb + sched_ctrl->rbStart] = 0;
}
}
} }
void nr_simple_dlsch_preprocessor(module_id_t module_id, void nr_simple_dlsch_preprocessor(module_id_t module_id,
...@@ -727,10 +732,10 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id, ...@@ -727,10 +732,10 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
/* Retrieve amount of data to send for this UE */ /* Retrieve amount of data to send for this UE */
nr_store_dlsch_buffer(module_id,frame,slot); nr_store_dlsch_buffer(module_id, frame, slot);
/* pf algo */ /* pf algo */
pf_dl(module_id,frame,slot,num_slots_per_tdd, pf_dl(module_id, frame, slot, num_slots_per_tdd,
UE_info, UE_info,
n_rb_sched, n_rb_sched,
rballoc_mask, rballoc_mask,
......
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