Commit f3c61b12 authored by francescomani's avatar francescomani

remove pointer to logicalChannelConfig in LC ordered info and store actual values in the list

parent c093e4ed
...@@ -42,32 +42,6 @@ ...@@ -42,32 +42,6 @@
#include "SCHED_NR/phy_frame_config_nr.h" #include "SCHED_NR/phy_frame_config_nr.h"
#include "oai_asn1.h" #include "oai_asn1.h"
const long logicalChannelGroup0_NR = 0;
typedef struct NR_LogicalChannelConfig__ul_SpecificParameters LcConfig_UlParamas_t;
const LcConfig_UlParamas_t NR_LCSRB1 = {
.priority = 1,
.prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity,
.logicalChannelGroup = (long *)&logicalChannelGroup0_NR};
const LcConfig_UlParamas_t NR_LCSRB2 = {
.priority = 3,
.prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity,
.logicalChannelGroup = (long *)&logicalChannelGroup0_NR};
const LcConfig_UlParamas_t NR_LCSRB3 = {
.priority = 1,
.prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity,
.logicalChannelGroup = (long *)&logicalChannelGroup0_NR};
// these are the default values for SRB configurations(SRB1 and SRB2) as mentioned in 36.331 pg 258-259
const NR_LogicalChannelConfig_t NR_SRB1_logicalChannelConfig_defaultValue = {.ul_SpecificParameters =
(LcConfig_UlParamas_t *)&NR_LCSRB1};
const NR_LogicalChannelConfig_t NR_SRB2_logicalChannelConfig_defaultValue = {.ul_SpecificParameters =
(LcConfig_UlParamas_t *)&NR_LCSRB2};
const NR_LogicalChannelConfig_t NR_SRB3_logicalChannelConfig_defaultValue = {.ul_SpecificParameters =
(LcConfig_UlParamas_t *)&NR_LCSRB3};
void set_tdd_config_nr_ue(fapi_nr_tdd_table_t *tdd_table, void set_tdd_config_nr_ue(fapi_nr_tdd_table_t *tdd_table,
int mu, int mu,
NR_TDD_UL_DL_Pattern_t *pattern) NR_TDD_UL_DL_Pattern_t *pattern)
...@@ -650,14 +624,11 @@ static void configure_ss_coreset(NR_BWP_PDCCH_t *pdcch, NR_PDCCH_Config_t *pdcch ...@@ -650,14 +624,11 @@ static void configure_ss_coreset(NR_BWP_PDCCH_t *pdcch, NR_PDCCH_Config_t *pdcch
static int lcid_cmp(const void *a, const void *b) static int lcid_cmp(const void *a, const void *b)
{ {
long pa, pb; long priority_a = (*((nr_lcordered_info_t**)a))->priority;
memcpy(&pa, &((nr_lcordered_info_t*)a)->logicalChannelConfig->ul_SpecificParameters->priority, sizeof(pa)); AssertFatal(priority_a > 0 && priority_a < 17, "Invalid priority value %ld\n", priority_a);
memcpy(&pb, &((nr_lcordered_info_t*)b)->logicalChannelConfig->ul_SpecificParameters->priority, sizeof(pb)); long priority_b = (*((nr_lcordered_info_t**)b))->priority;
if (pa < pb) AssertFatal(priority_b > 0 && priority_b < 17, "Invalid priority value %ld\n", priority_b);
return -1; return priority_a - priority_b;
else if (pa > pb)
return 1;
return 0;
} }
static int nr_get_ms_bucketsizeduration(long bucketsizeduration) static int nr_get_ms_bucketsizeduration(long bucketsizeduration)
...@@ -686,28 +657,46 @@ static int nr_get_ms_bucketsizeduration(long bucketsizeduration) ...@@ -686,28 +657,46 @@ static int nr_get_ms_bucketsizeduration(long bucketsizeduration)
} }
} }
void nr_configure_sched_info(NR_UE_MAC_INST_t *mac, long channel_identity, NR_LogicalChannelConfig_t *lc_config) static uint32_t get_lc_bucket_size(long prioritisedBitRate, long bucketSizeDuration)
{ {
LOG_D(NR_MAC, "Applying RRC Logical Channel Config to lcid %li\n", channel_identity); int pbr = nr_get_pbr(prioritisedBitRate);
// in infinite pbr, the bucket is saturated by pbr
int bsd = 0;
if (prioritisedBitRate == NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity)
bsd = 1;
else
bsd = nr_get_ms_bucketsizeduration(bucketSizeDuration);
// initialize the variable Bj for every LCID return pbr * bsd;
mac->scheduling_info.lc_sched_info[channel_identity - 1].Bj = 0; }
// store the bucket size // default configuration as per 38.331 section 9.2.1
int pbr = nr_get_pbr(lc_config->ul_SpecificParameters->prioritisedBitRate); static void set_default_logicalchannelconfig(nr_lcordered_info_t *lc_info, NR_SRB_Identity_t srb_id)
int bsd = nr_get_ms_bucketsizeduration(lc_config->ul_SpecificParameters->bucketSizeDuration); {
lc_info->lcid = srb_id;
lc_info->priority = srb_id == 2 ? 3 : 1;
lc_info->prioritisedBitRate = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
lc_info->bucket_size = get_lc_bucket_size(lc_info->prioritisedBitRate, 0);
}
// in infinite pbr, the bucket is saturated by pbr static void nr_configure_lc_config(NR_UE_MAC_INST_t *mac,
if (lc_config->ul_SpecificParameters->prioritisedBitRate nr_lcordered_info_t *lc_info,
== NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity) { NR_LogicalChannelConfig_t *mac_lc_config,
bsd = 1; NR_SRB_Identity_t srb_id)
{
if (srb_id > 0 && !mac_lc_config->ul_SpecificParameters) {
// release configuration and reset to default
set_default_logicalchannelconfig(lc_info, srb_id);
mac->scheduling_info.lc_sched_info[lc_info->lcid - 1].LCGID = 0;
return;
} }
mac->scheduling_info.lc_sched_info[channel_identity - 1].bucket_size = pbr * bsd; AssertFatal(mac_lc_config->ul_SpecificParameters, "UL parameters shouldn't be NULL for DRBs\n");
struct NR_LogicalChannelConfig__ul_SpecificParameters *ul_parm = mac_lc_config->ul_SpecificParameters;
if (lc_config->ul_SpecificParameters->logicalChannelGroup != NULL) lc_info->priority = ul_parm->priority;
mac->scheduling_info.lc_sched_info[channel_identity - 1].LCGID = *lc_config->ul_SpecificParameters->logicalChannelGroup; lc_info->prioritisedBitRate = ul_parm->prioritisedBitRate;
else // TODO Verify setting to 0 is ok, 331 just says need R (release if NULL)
mac->scheduling_info.lc_sched_info[channel_identity - 1].LCGID = 0; mac->scheduling_info.lc_sched_info[lc_info->lcid - 1].LCGID = ul_parm->logicalChannelGroup ? *ul_parm->logicalChannelGroup : 0;
lc_info->bucket_size = get_lc_bucket_size(ul_parm->prioritisedBitRate, ul_parm->bucketSizeDuration);
} }
static void configure_logicalChannelBearer(module_id_t module_id, static void configure_logicalChannelBearer(module_id_t module_id,
...@@ -726,7 +715,6 @@ static void configure_logicalChannelBearer(module_id_t module_id, ...@@ -726,7 +715,6 @@ static void configure_logicalChannelBearer(module_id_t module_id,
} }
if (j < mac->lc_ordered_list.count) { if (j < mac->lc_ordered_list.count) {
nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[j]; nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[j];
free(lc_info->logicalChannelConfig);
asn_sequence_del(&mac->lc_ordered_list, j, 0); asn_sequence_del(&mac->lc_ordered_list, j, 0);
free(lc_info); free(lc_info);
} }
...@@ -748,10 +736,10 @@ static void configure_logicalChannelBearer(module_id_t module_id, ...@@ -748,10 +736,10 @@ static void configure_logicalChannelBearer(module_id_t module_id,
if (j < mac->lc_ordered_list.count) { if (j < mac->lc_ordered_list.count) {
LOG_D(NR_MAC, "Logical channel %d is already established, Reconfiguring now\n", lc_identity); LOG_D(NR_MAC, "Logical channel %d is already established, Reconfiguring now\n", lc_identity);
if (mac_lc_config != NULL) { if (mac_lc_config != NULL) {
nr_configure_sched_info(mac, lc_identity, mac_lc_config); NR_SRB_Identity_t srb_id = 0;
UPDATE_MAC_IE(mac->lc_ordered_list.array[j]->logicalChannelConfig, if (rlc_bearer->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity)
rlc_bearer->mac_LogicalChannelConfig, srb_id = rlc_bearer->servedRadioBearer->choice.srb_Identity;
NR_LogicalChannelConfig_t); nr_configure_lc_config(mac, mac->lc_ordered_list.array[j], mac_lc_config, srb_id);
} }
} }
else { else {
...@@ -762,29 +750,14 @@ static void configure_logicalChannelBearer(module_id_t module_id, ...@@ -762,29 +750,14 @@ static void configure_logicalChannelBearer(module_id_t module_id,
AssertFatal(rlc_bearer->servedRadioBearer, "servedRadioBearer should be present for LCID establishment\n"); AssertFatal(rlc_bearer->servedRadioBearer, "servedRadioBearer should be present for LCID establishment\n");
if (rlc_bearer->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity) { /* SRB */ if (rlc_bearer->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity) { /* SRB */
NR_SRB_Identity_t srb_id = rlc_bearer->servedRadioBearer->choice.srb_Identity; NR_SRB_Identity_t srb_id = rlc_bearer->servedRadioBearer->choice.srb_Identity;
if (mac_lc_config != NULL) { if (mac_lc_config != NULL)
UPDATE_MAC_IE(lc_info->logicalChannelConfig, rlc_bearer->mac_LogicalChannelConfig, NR_LogicalChannelConfig_t); nr_configure_lc_config(mac, lc_info, mac_lc_config, srb_id);
} else { else
LOG_D(NR_RRC, "Applying the default logicalChannelConfig for SRB\n"); set_default_logicalchannelconfig(lc_info, srb_id);
switch (srb_id) {
case 1 :
lc_info->logicalChannelConfig = (NR_LogicalChannelConfig_t *)&NR_SRB1_logicalChannelConfig_defaultValue;
break;
case 2 :
lc_info->logicalChannelConfig = (NR_LogicalChannelConfig_t *)&NR_SRB2_logicalChannelConfig_defaultValue;
break;
case 3 :
lc_info->logicalChannelConfig = (NR_LogicalChannelConfig_t *)&NR_SRB3_logicalChannelConfig_defaultValue;
break;
default :
AssertFatal(false, "The logical id %d is not a valid SRB id %li\n", lc_identity, srb_id);
}
}
} else { /* DRB */ } else { /* DRB */
AssertFatal(mac_lc_config, "When establishing a DRB, LogicalChannelConfig should be mandatorily present\n"); AssertFatal(mac_lc_config, "When establishing a DRB, LogicalChannelConfig should be mandatorily present\n");
UPDATE_MAC_IE(lc_info->logicalChannelConfig, rlc_bearer->mac_LogicalChannelConfig, NR_LogicalChannelConfig_t); nr_configure_lc_config(mac, lc_info, mac_lc_config, 0);
} }
nr_configure_sched_info(mac, lc_identity, lc_info->logicalChannelConfig);
ASN_SEQUENCE_ADD(&mac->lc_ordered_list, lc_info); ASN_SEQUENCE_ADD(&mac->lc_ordered_list, lc_info);
} }
} }
......
...@@ -181,12 +181,10 @@ typedef struct { ...@@ -181,12 +181,10 @@ typedef struct {
int32_t LCID_buffer_remain; int32_t LCID_buffer_remain;
// buffer status for each lcid // buffer status for each lcid
uint8_t LCID_status; uint8_t LCID_status;
// Bj bucket usage per lcid // logical channel group id of this LCID
long LCGID;
// Bj bucket usage per lcid
int32_t Bj; int32_t Bj;
// Bucket size per lcid
int32_t bucket_size;
// logical channel group id for each LCID
uint8_t LCGID;
} NR_LC_SCHEDULING_INFO; } NR_LC_SCHEDULING_INFO;
typedef struct { typedef struct {
...@@ -435,8 +433,10 @@ typedef struct ssb_list_info { ...@@ -435,8 +433,10 @@ typedef struct ssb_list_info {
typedef struct nr_lcordered_info_s { typedef struct nr_lcordered_info_s {
// logical channels ids ordered as per priority // logical channels ids ordered as per priority
NR_LogicalChannelIdentity_t lcid; NR_LogicalChannelIdentity_t lcid;
// logical channel configurations reordered as per priority long priority;
NR_LogicalChannelConfig_t *logicalChannelConfig; long prioritisedBitRate;
// Bucket size per lcid
uint32_t bucket_size;
} nr_lcordered_info_t; } nr_lcordered_info_t;
typedef struct { typedef struct {
......
...@@ -239,12 +239,12 @@ bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t ...@@ -239,12 +239,12 @@ bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t
uint8_t nr_locate_BsrIndexByBufferSize(const uint32_t *table, int size, uint8_t nr_locate_BsrIndexByBufferSize(const uint32_t *table, int size,
int value); int value);
/*! \fn int nr_get_pbr(uint8_t prioritizedbitrate) /*! \fn int nr_get_pbr(long prioritizedbitrate)
\brief get the rate in kbps from the rate configured by the higher layer \brief get the rate in kbps from the rate configured by the higher layer
\param[in] prioritizedbitrate \param[in] prioritizedbitrate
\return the rate in kbps \return the rate in kbps
*/ */
uint32_t nr_get_pbr(uint8_t prioritizedbitrate); uint32_t nr_get_pbr(long prioritizedbitrate);
/*! \fn int nr_get_sf_periodicBSRTimer(uint8_t periodicBSR_Timer) /*! \fn int nr_get_sf_periodicBSRTimer(uint8_t periodicBSR_Timer)
\brief get the number of subframe from the periodic BSR timer configured by the higher layers \brief get the number of subframe from the periodic BSR timer configured by the higher layers
......
...@@ -99,11 +99,9 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) ...@@ -99,11 +99,9 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
for (int i = 0; i < NR_MAX_NUM_LCID; i++) { for (int i = 0; i < NR_MAX_NUM_LCID; i++) {
LOG_D(NR_MAC, "Applying default logical channel config for LCGID %d\n", i); LOG_D(NR_MAC, "Applying default logical channel config for LCGID %d\n", i);
mac->scheduling_info.lc_sched_info[i].Bj = -1;
mac->scheduling_info.lc_sched_info[i].bucket_size = -1;
mac->scheduling_info.lc_sched_info[i].LCGID = 0; // defaults to 0 irrespective of SRB or DRB
mac->scheduling_info.lc_sched_info[i].LCID_status = LCID_EMPTY; mac->scheduling_info.lc_sched_info[i].LCID_status = LCID_EMPTY;
mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0; mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0;
mac->scheduling_info.lc_sched_info[i].Bj = 0;
} }
} }
...@@ -146,7 +144,8 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) ...@@ -146,7 +144,8 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
nr_ue_mac_default_configs(nr_mac); nr_ue_mac_default_configs(nr_mac);
// initialize Bj for each logical channel to zero // initialize Bj for each logical channel to zero
// Done in default config but to -1 (is that correct?) for (int i = 0; i < NR_MAX_NUM_LCID; i++)
nr_mac->scheduling_info.lc_sched_info[i].Bj = 0;
// stop all running timers // stop all running timers
// TODO // TODO
...@@ -223,7 +222,6 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac) ...@@ -223,7 +222,6 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac)
for (int i = 0; i < mac->lc_ordered_list.count; i++) { for (int i = 0; i < mac->lc_ordered_list.count; i++) {
nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[i]; nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[i];
free(lc_info->logicalChannelConfig);
asn_sequence_del(&mac->lc_ordered_list, i, 0); asn_sequence_del(&mac->lc_ordered_list, i, 0);
free(lc_info); free(lc_info);
} }
......
...@@ -1110,11 +1110,10 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info) ...@@ -1110,11 +1110,10 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info)
// 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); LOG_D(NR_MAC, "====================[Frame %d][Slot %d]Logical Channel Prioritization===========\n", frame_tx, slot_tx);
for (int i = 0; i < mac->lc_ordered_list.count; i++) { for (int i = 0; i < mac->lc_ordered_list.count; i++) {
int lcid = mac->lc_ordered_list.array[i]->lcid; nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[i];
NR_LogicalChannelConfig_t *lcconfig = mac->lc_ordered_list.array[i]->logicalChannelConfig; int lcid = lc_info->lcid;
NR_LC_SCHEDULING_INFO *sched_lc = &mac->scheduling_info.lc_sched_info[lcid - 1];
// max amount of data that can be buffered/accumulated in a logical channel buffer // max amount of data that can be buffered/accumulated in a logical channel buffer
int32_t bucketSize_max = sched_lc->bucket_size; int32_t bucketSize_max = lc_info->bucket_size;
AssertFatal(bucketSize_max >= 0, "negative bucketSize_max %d, will never schedule UE: lcid %d\n",bucketSize_max, lcid); AssertFatal(bucketSize_max >= 0, "negative bucketSize_max %d, will never schedule UE: lcid %d\n",bucketSize_max, lcid);
/* /*
...@@ -1122,15 +1121,13 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info) ...@@ -1122,15 +1121,13 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info)
increment the value of Bj by product PBR * T increment the value of Bj by product PBR * T
*/ */
int T = 1; // time elapsed since Bj was last incremented int T = 1; // time elapsed since Bj was last incremented
int32_t bj = sched_lc->Bj; int32_t bj = mac->scheduling_info.lc_sched_info[lcid - 1].Bj;
bj += nr_get_pbr(lcconfig->ul_SpecificParameters->prioritisedBitRate) * T; bj += nr_get_pbr(lc_info->prioritisedBitRate) * T;
if (lcconfig->ul_SpecificParameters->prioritisedBitRate if (lc_info->prioritisedBitRate == NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity)
== NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity) { bj = nr_get_pbr(lc_info->prioritisedBitRate);
bj = nr_get_pbr(lcconfig->ul_SpecificParameters->prioritisedBitRate);
}
// bj > max bucket size, set bj to max bucket size, as in ts38.321 5.4.3.1 Logical Channel Prioritization // bj > max bucket size, set bj to max bucket size, as in ts38.321 5.4.3.1 Logical Channel Prioritization
sched_lc->Bj = min(bj, bucketSize_max); mac->scheduling_info.lc_sched_info[lcid - 1].Bj = min(bj, bucketSize_max);
} }
// Call BSR procedure as described in Section 5.4.5 in 38.321 // Call BSR procedure as described in Section 5.4.5 in 38.321
...@@ -1266,7 +1263,7 @@ bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t ...@@ -1266,7 +1263,7 @@ bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t
{ {
bsr_regular_triggered = true; bsr_regular_triggered = true;
LOG_D(NR_MAC, LOG_D(NR_MAC,
"[UE %d] PDCCH Tick : MAC BSR Triggered LCID%d LCGID%d data become available at frame %d slot %d\n", "[UE %d] PDCCH Tick : MAC BSR Triggered LCID %d LCGID %ld data become available at frame %d slot %d\n",
module_idP, module_idP,
lcid, lcid,
mac->scheduling_info.lc_sched_info[lcid - 1].LCGID, mac->scheduling_info.lc_sched_info[lcid - 1].LCGID,
...@@ -2914,8 +2911,7 @@ uint32_t get_count_lcids_same_priority(uint8_t start, uint8_t total_active_lcids ...@@ -2914,8 +2911,7 @@ uint32_t get_count_lcids_same_priority(uint8_t start, uint8_t total_active_lcids
uint8_t same_priority_count = 0; uint8_t same_priority_count = 0;
uint8_t curr_lcid = lcid_ordered_array[start].lcid; uint8_t curr_lcid = lcid_ordered_array[start].lcid;
for (uint8_t index = start; index < total_active_lcids; index++) { for (uint8_t index = start; index < total_active_lcids; index++) {
if (lcid_ordered_array[start].logicalChannelConfig->ul_SpecificParameters->priority == if (lcid_ordered_array[start].priority == lcid_ordered_array[index].priority) {
lcid_ordered_array[index].logicalChannelConfig->ul_SpecificParameters->priority) {
same_priority_count++; same_priority_count++;
} }
} }
...@@ -2933,15 +2929,15 @@ long get_num_bytes_to_reqlc(NR_UE_MAC_INST_t *mac, ...@@ -2933,15 +2929,15 @@ long get_num_bytes_to_reqlc(NR_UE_MAC_INST_t *mac,
long *target) long *target)
{ {
/* Calculates the number of bytes the logical channel should request from the correcponding RLC buffer*/ /* Calculates the number of bytes the logical channel should request from the correcponding RLC buffer*/
NR_LogicalChannelConfig_t *lc_config = NULL; long found_pbr = -1;
for (int i = 0; i < mac->lc_ordered_list.count; i++) { for (int i = 0; i < mac->lc_ordered_list.count; i++) {
if (mac->lc_ordered_list.array[i]->lcid == lc_num) { if (mac->lc_ordered_list.array[i]->lcid == lc_num) {
lc_config = mac->lc_ordered_list.array[i]->logicalChannelConfig; found_pbr = mac->lc_ordered_list.array[i]->prioritisedBitRate;
break; break;
} }
} }
AssertFatal(lc_config, "Couldn't find LC config for ID %d\n", lc_num); AssertFatal(found_pbr >= 0, "Couldn't find LC config for ID %d\n", lc_num);
long pbr = nr_get_pbr(lc_config->ul_SpecificParameters->prioritisedBitRate); uint32_t pbr = nr_get_pbr(found_pbr);
int32_t lcid_remain_buffer = mac->scheduling_info.lc_sched_info[lc_num - 1].LCID_buffer_remain; int32_t lcid_remain_buffer = mac->scheduling_info.lc_sched_info[lc_num - 1].LCID_buffer_remain;
*target = (same_priority_count > 1) ? min(buflen_remain_ep, pbr) : pbr; *target = (same_priority_count > 1) ? min(buflen_remain_ep, pbr) : pbr;
...@@ -2987,10 +2983,8 @@ static void select_logical_channels(NR_UE_MAC_INST_t *mac, int *num_active_lcids ...@@ -2987,10 +2983,8 @@ static void select_logical_channels(NR_UE_MAC_INST_t *mac, int *num_active_lcids
// selection of logical channels with Bj > 0 // selection of logical channels with Bj > 0
for (int i = 0; i < mac->lc_ordered_list.count; i++) { for (int i = 0; i < mac->lc_ordered_list.count; i++) {
int lcid = mac->lc_ordered_list.array[i]->lcid; int lcid = mac->lc_ordered_list.array[i]->lcid;
NR_LogicalChannelConfig_t *logicalChannelConfig = mac->lc_ordered_list.array[i]->logicalChannelConfig;
if (mac->scheduling_info.lc_sched_info[lcid - 1].Bj > 0) { if (mac->scheduling_info.lc_sched_info[lcid - 1].Bj > 0) {
active_lcids[*num_active_lcids].lcid = lcid; active_lcids[*num_active_lcids] = *mac->lc_ordered_list.array[i];
active_lcids[*num_active_lcids].logicalChannelConfig = logicalChannelConfig;
(*num_active_lcids)++; (*num_active_lcids)++;
LOG_D(NR_MAC, "The available lcid is %d with total active channels count = %d\n", lcid, *num_active_lcids); LOG_D(NR_MAC, "The available lcid is %d with total active channels count = %d\n", lcid, *num_active_lcids);
} }
...@@ -3064,7 +3058,7 @@ static bool fill_mac_sdu(module_id_t module_idP, ...@@ -3064,7 +3058,7 @@ static bool fill_mac_sdu(module_id_t module_idP,
// currently the Bj is drecremented by size of MAC SDus everytime it is served to logical channel, so by this approach there // currently the Bj is drecremented by size of MAC SDus everytime it is served to logical channel, so by this approach there
// will be more chance for lower priority logical channels to be served in the next TTI // will be more chance for lower priority logical channels to be served in the next TTI
// second approach can also be followed where Bj is decremented only in the first round but not in the subsequent rounds // second approach can also be followed where Bj is decremented only in the first round but not in the subsequent rounds
sched_info->lc_sched_info[lcid - 1].Bj -= sdu_length; sched_info->lc_sched_info[lcid - 1].Bj -= sdu_length; // TODO avoid Bj to go below 0
LOG_D(NR_MAC, LOG_D(NR_MAC,
"decrement Bj of the lcid %d by size of sdu length = %d and new Bj for lcid %d is %d\n", "decrement Bj of the lcid %d by size of sdu length = %d and new Bj for lcid %d is %d\n",
lcid, lcid,
...@@ -3118,7 +3112,7 @@ static bool fill_mac_sdu(module_id_t module_idP, ...@@ -3118,7 +3112,7 @@ static bool fill_mac_sdu(module_id_t module_idP,
lc_info->LCID_buffer_remain -= sdu_length; lc_info->LCID_buffer_remain -= sdu_length;
(lcg_info + lc_info->LCGID)->BSR_bytes -= sdu_length; (lcg_info + lc_info->LCGID)->BSR_bytes -= sdu_length;
LOG_D(NR_MAC, LOG_D(NR_MAC,
"[UE %d] Update BSR [%d.%d] BSR_bytes for LCG%d = %d\n", "[UE %d] Update BSR [%d.%d] BSR_bytes for LCG %ld = %d\n",
module_idP, module_idP,
frameP, frameP,
subframe, subframe,
...@@ -3365,7 +3359,7 @@ void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIG ...@@ -3365,7 +3359,7 @@ void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIG
ul_time_alignment->ta_apply = false; ul_time_alignment->ta_apply = false;
} }
uint32_t nr_get_pbr(uint8_t prioritizedbitrate) uint32_t nr_get_pbr(long prioritizedbitrate)
{ {
int32_t pbr = -1; int32_t pbr = -1;
switch (prioritizedbitrate) { switch (prioritizedbitrate) {
......
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