fix tb idx assignment in scheduler mac sdu alloc

master
Francisco Paisana 5 years ago
parent 2e455908e8
commit 7e840bde86

@ -232,7 +232,7 @@ private:
uint32_t format1_count_prb(const rbgmask_t& bitmask, uint32_t cc_idx); uint32_t format1_count_prb(const rbgmask_t& bitmask, uint32_t cc_idx);
int alloc_rlc_pdu(sched_interface::dl_sched_pdu_t* mac_sdu, int rem_tbs); int alloc_rlc_pdu(sched_interface::dl_sched_pdu_t* mac_sdu, int rem_tbs);
uint32_t allocate_mac_sdus(sched_interface::dl_sched_data_t* data, uint32_t total_tbs); uint32_t allocate_mac_sdus(sched_interface::dl_sched_data_t* data, uint32_t total_tbs, uint32_t tbidx);
static bool bearer_is_ul(ue_bearer_t* lch); static bool bearer_is_ul(ue_bearer_t* lch);
static bool bearer_is_dl(const ue_bearer_t* lch); static bool bearer_is_dl(const ue_bearer_t* lch);

@ -349,9 +349,10 @@ void sched_ue::tpc_dec()
* Allocate space for multiple MAC SDUs (i.e. RLC PDUs) and corresponding MAC SDU subheaders * Allocate space for multiple MAC SDUs (i.e. RLC PDUs) and corresponding MAC SDU subheaders
* @param data struct where the rlc pdu allocations are stored * @param data struct where the rlc pdu allocations are stored
* @param total_tbs available TB size for allocations for a single UE * @param total_tbs available TB size for allocations for a single UE
* @param tbidx index of TB
* @return allocated bytes, which is always equal or lower than total_tbs * @return allocated bytes, which is always equal or lower than total_tbs
*/ */
uint32_t sched_ue::allocate_mac_sdus(sched_interface::dl_sched_data_t* data, uint32_t total_tbs) uint32_t sched_ue::allocate_mac_sdus(sched_interface::dl_sched_data_t* data, uint32_t total_tbs, uint32_t tbidx)
{ {
// TS 36.321 sec 7.1.2 - MAC PDU subheader is 2 bytes if L<=128 and 3 otherwise // TS 36.321 sec 7.1.2 - MAC PDU subheader is 2 bytes if L<=128 and 3 otherwise
auto compute_subheader_size = [](uint32_t sdu_size) { return sdu_size > 128 ? 3 : 2; }; auto compute_subheader_size = [](uint32_t sdu_size) { return sdu_size > 128 ? 3 : 2; };
@ -361,12 +362,12 @@ uint32_t sched_ue::allocate_mac_sdus(sched_interface::dl_sched_data_t* data, uin
// if we do not have enough bytes to fit MAC subheader and RLC header, skip MAC SDU allocation // if we do not have enough bytes to fit MAC subheader and RLC header, skip MAC SDU allocation
while (rem_tbs >= min_mac_sdu_size) { while (rem_tbs >= min_mac_sdu_size) {
uint32_t max_sdu_bytes = rem_tbs - compute_subheader_size(rem_tbs - 2); uint32_t max_sdu_bytes = rem_tbs - compute_subheader_size(rem_tbs - 2);
uint32_t alloc_sdu_bytes = alloc_rlc_pdu(&data->pdu[0][data->nof_pdu_elems[0]], max_sdu_bytes); uint32_t alloc_sdu_bytes = alloc_rlc_pdu(&data->pdu[tbidx][data->nof_pdu_elems[tbidx]], max_sdu_bytes);
if (alloc_sdu_bytes == 0) { if (alloc_sdu_bytes == 0) {
break; break;
} }
rem_tbs -= (alloc_sdu_bytes + compute_subheader_size(alloc_sdu_bytes)); // account for MAC sub-header rem_tbs -= (alloc_sdu_bytes + compute_subheader_size(alloc_sdu_bytes)); // account for MAC sub-header
data->nof_pdu_elems[0]++; data->nof_pdu_elems[tbidx]++;
} }
return total_tbs - rem_tbs; return total_tbs - rem_tbs;
@ -443,7 +444,7 @@ int sched_ue::generate_format1(dl_harq_proc* h,
} }
// Allocate MAC SDU and respective subheaders // Allocate MAC SDU and respective subheaders
allocate_mac_sdus(data, rem_tbs); allocate_mac_sdus(data, rem_tbs, 0);
Debug("SCHED: Alloc format1 new mcs=%d, tbs=%d, nof_prb=%d, req_bytes=%d\n", mcs, tbs, nof_prb, req_bytes); Debug("SCHED: Alloc format1 new mcs=%d, tbs=%d, nof_prb=%d, req_bytes=%d\n", mcs, tbs, nof_prb, req_bytes);
} else { } else {
@ -550,7 +551,7 @@ int sched_ue::generate_format2a_unlocked(dl_harq_proc* h,
h->new_tx(user_mask, tb, tti, mcs, tbs, data->dci.location.ncce); h->new_tx(user_mask, tb, tti, mcs, tbs, data->dci.location.ncce);
allocate_mac_sdus(data, tbs); allocate_mac_sdus(data, tbs, tb);
Debug("SCHED: Alloc format2/2a new mcs=%d, tbs=%d, nof_prb=%d, req_bytes=%d\n", mcs, tbs, nof_prb, req_bytes); Debug("SCHED: Alloc format2/2a new mcs=%d, tbs=%d, nof_prb=%d, req_bytes=%d\n", mcs, tbs, nof_prb, req_bytes);
} }

Loading…
Cancel
Save