diff --git a/srsenb/hdr/stack/mac/scheduler_ue.h b/srsenb/hdr/stack/mac/scheduler_ue.h index 62a97ef21..966918ca5 100644 --- a/srsenb/hdr/stack/mac/scheduler_ue.h +++ b/srsenb/hdr/stack/mac/scheduler_ue.h @@ -224,7 +224,7 @@ private: bool is_sr_triggered(); uint32_t format1_count_prb(const rbgmask_t& bitmask, uint32_t cc_idx); - int alloc_mac_sdu(sched_interface::dl_sched_pdu_t* pdu, 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); static bool bearer_is_ul(ue_bearer_t* lch); diff --git a/srsenb/src/stack/mac/scheduler_ue.cc b/srsenb/src/stack/mac/scheduler_ue.cc index 73d42795f..71a24996c 100644 --- a/srsenb/src/stack/mac/scheduler_ue.cc +++ b/srsenb/src/stack/mac/scheduler_ue.cc @@ -361,8 +361,15 @@ void sched_ue::tpc_dec() * *******************************************************/ +/** + * 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 total_tbs available TB size for allocations for a single UE + * @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) { + // 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; }; constexpr uint32_t min_mac_sdu_size = 5; // accounts for MAC SDU subheader and RLC header uint32_t rem_tbs = total_tbs; @@ -370,7 +377,7 @@ 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 while (rem_tbs >= min_mac_sdu_size) { uint32_t max_sdu_bytes = rem_tbs - compute_subheader_size(rem_tbs - 2); - uint32_t alloc_sdu_bytes = alloc_mac_sdu(&data->pdu[0][data->nof_pdu_elems[0]], max_sdu_bytes); + uint32_t alloc_sdu_bytes = alloc_rlc_pdu(&data->pdu[0][data->nof_pdu_elems[0]], max_sdu_bytes); if (alloc_sdu_bytes == 0) { break; } @@ -1014,7 +1021,7 @@ sched_ue_carrier* sched_ue::get_ue_carrier(uint32_t enb_cc_idx) } /* Allocates first available RLC PDU */ -int sched_ue::alloc_mac_sdu(sched_interface::dl_sched_pdu_t* mac_sdu, int rem_tbs) +int sched_ue::alloc_rlc_pdu(sched_interface::dl_sched_pdu_t* mac_sdu, int rem_tbs) { // TODO: Implement lcid priority (now lowest index is lowest priority) int alloc_bytes = 0;