Commit 81641ea4 authored by francescomani's avatar francescomani

avoid another segfault at detach

parent 08ad45ad
...@@ -1291,32 +1291,29 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info) ...@@ -1291,32 +1291,29 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
nr_trigger_sr(mac); nr_trigger_sr(mac);
// update Bj for all active lcids before LCP procedure // update Bj for all active lcids before LCP procedure
LOG_D(NR_MAC, "====================[Frame %d][Slot %d]Logical Channel Prioritization===========\n", frame_tx, slot_tx); if (mac->current_UL_BWP) {
for (int i = 0; i < mac->lc_ordered_list.count; i++) { LOG_D(NR_MAC, "%4d.%2d Logical Channel Prioritization\n", frame_tx, slot_tx);
nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[i]; for (int i = 0; i < mac->lc_ordered_list.count; i++) {
int lcid = lc_info->lcid; nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[i];
// max amount of data that can be buffered/accumulated in a logical channel buffer int lcid = lc_info->lcid;
uint32_t bucketSize_max = lc_info->bucket_size; // max amount of data that can be buffered/accumulated in a logical channel buffer
uint32_t bucketSize_max = lc_info->bucket_size;
/* // measure Bj increment the value of Bj by product PBR * T
measure Bj NR_LC_SCHEDULING_INFO *sched_info = get_scheduling_info_from_lcid(mac, lcid);
increment the value of Bj by product PBR * T int32_t bj = sched_info->Bj;
*/ if (lc_info->pbr < UINT_MAX) {
NR_LC_SCHEDULING_INFO *sched_info = get_scheduling_info_from_lcid(mac, lcid); uint32_t slots_elapsed = nr_timer_elapsed_time(sched_info->Bj_timer); // slots elapsed since Bj was last incremented
int32_t bj = sched_info->Bj; // it is safe to divide by 1k since pbr in lc_info is computed multiplying by 1000 the RRC value to convert kB/s to B/s
if (lc_info->pbr < UINT_MAX) { uint32_t pbr_ms = lc_info->pbr / 1000;
uint32_t slots_elapsed = nr_timer_elapsed_time(sched_info->Bj_timer); // slots elapsed since Bj was last incremented bj += ((pbr_ms * slots_elapsed) >> mac->current_UL_BWP->scs); // each slot length is 1/scs ms
// it is safe to divide by 1k since pbr in lc_info is computed multiplying by 1000 the RRC value to convert kB/s to B/s }
uint32_t pbr_ms = lc_info->pbr / 1000; else
bj += ((pbr_ms * slots_elapsed) >> mac->current_UL_BWP->scs); // each slot length is 1/scs ms bj = INT_MAX;
// bj > max bucket size, set bj to max bucket size, as in ts38.321 5.4.3.1 Logical Channel Prioritization
sched_info->Bj = min(bj, bucketSize_max);
// reset bj timer
nr_timer_start(&sched_info->Bj_timer);
} }
else
bj = INT_MAX;
// bj > max bucket size, set bj to max bucket size, as in ts38.321 5.4.3.1 Logical Channel Prioritization
sched_info->Bj = min(bj, bucketSize_max);
// reset bj timer
nr_timer_start(&sched_info->Bj_timer);
} }
if(mac->state >= UE_PERFORMING_RA) if(mac->state >= UE_PERFORMING_RA)
......
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