Fix Resource Allocation Type 1 Defect

master
Xavier Arteaga 7 years ago
parent 9f7d4718ba
commit 1ba18f1ddc

@ -314,9 +314,10 @@ int srslte_ra_dl_dci_to_grant_prb_allocation(srslte_ra_dl_dci_t *dci, srslte_ra_
break; break;
case SRSLTE_RA_ALLOC_TYPE1: case SRSLTE_RA_ALLOC_TYPE1:
n_rb_type1 = srslte_ra_type1_N_rb(nof_prb); n_rb_type1 = srslte_ra_type1_N_rb(nof_prb);
if (dci->type1_alloc.rbg_subset < (nof_prb / P) % P) { uint32_t temp = ((nof_prb - 1) / P) % P;
if (dci->type1_alloc.rbg_subset < temp) {
n_rb_rbg_subset = ((nof_prb - 1) / (P * P)) * P + P; n_rb_rbg_subset = ((nof_prb - 1) / (P * P)) * P + P;
} else if (dci->type1_alloc.rbg_subset == ((nof_prb / P) % P)) { } else if (dci->type1_alloc.rbg_subset == temp) {
n_rb_rbg_subset = ((nof_prb - 1) / (P * P)) * P + ((nof_prb - 1) % P) + 1; n_rb_rbg_subset = ((nof_prb - 1) / (P * P)) * P + ((nof_prb - 1) % P) + 1;
} else { } else {
n_rb_rbg_subset = ((nof_prb - 1) / (P * P)) * P; n_rb_rbg_subset = ((nof_prb - 1) / (P * P)) * P;
@ -325,10 +326,9 @@ int srslte_ra_dl_dci_to_grant_prb_allocation(srslte_ra_dl_dci_t *dci, srslte_ra_
bitmask = dci->type1_alloc.vrb_bitmask; bitmask = dci->type1_alloc.vrb_bitmask;
for (i = 0; i < n_rb_type1; i++) { for (i = 0; i < n_rb_type1; i++) {
if (bitmask & (1 << (n_rb_type1 - i - 1))) { if (bitmask & (1 << (n_rb_type1 - i - 1))) {
if ((((i + shift) / P) uint32_t idx = (((i + shift) / P) * P * P + dci->type1_alloc.rbg_subset * P + (i + shift) % P);
* P * P + dci->type1_alloc.rbg_subset * P + (i + shift) % P) < nof_prb) { if (idx < nof_prb) {
grant->prb_idx[0][((i + shift) / P) grant->prb_idx[0][idx] = true;
* P * P + dci->type1_alloc.rbg_subset * P + (i + shift) % P] = true;
grant->nof_prb++; grant->nof_prb++;
} else { } else {
return SRSLTE_ERROR; return SRSLTE_ERROR;

Loading…
Cancel
Save