Merge remote-tracking branch 'origin/NR_UE_MAC_UL_improvements' into integration_2024_w12
This commit is contained in:
@@ -1011,6 +1011,8 @@ bool nr_timer_tick(NR_timer_t *timer)
|
||||
bool expired = false;
|
||||
if (timer->active) {
|
||||
timer->counter += timer->step;
|
||||
if (timer->target == UINT_MAX) // infinite target, never expires
|
||||
return false;
|
||||
expired = nr_timer_expired(*timer);
|
||||
if (expired)
|
||||
timer->active = false;
|
||||
@@ -1020,9 +1022,16 @@ bool nr_timer_tick(NR_timer_t *timer)
|
||||
|
||||
bool nr_timer_expired(NR_timer_t timer)
|
||||
{
|
||||
if (timer.target == UINT_MAX) // infinite target, never expires
|
||||
return false;
|
||||
return (timer.counter >= timer.target);
|
||||
}
|
||||
|
||||
uint32_t nr_timer_elapsed_time(NR_timer_t timer)
|
||||
{
|
||||
return timer.counter;
|
||||
}
|
||||
|
||||
void nr_timer_setup(NR_timer_t *timer, const uint32_t target, const uint32_t step)
|
||||
{
|
||||
timer->target = target;
|
||||
|
||||
@@ -158,6 +158,13 @@ bool nr_timer_expired(NR_timer_t timer);
|
||||
* @return Indication if the timer is active or not
|
||||
*/
|
||||
bool is_nr_timer_active(NR_timer_t timer);
|
||||
/**
|
||||
* @brief To return how much time has passed since start of timer
|
||||
* @param timer Timer to be checked
|
||||
* @return Time passed since start of timer
|
||||
*/
|
||||
uint32_t nr_timer_elapsed_time(NR_timer_t timer);
|
||||
|
||||
|
||||
extern const nr_bandentry_t nr_bandtable[];
|
||||
|
||||
|
||||
@@ -63,11 +63,6 @@
|
||||
#define RAR_PAYLOAD_SIZE_MAX 128
|
||||
#define MAX_CSI_REPORTCONFIG 48
|
||||
|
||||
#define NR_BSR_TRIGGER_NONE (0) /* No BSR Trigger */
|
||||
#define NR_BSR_TRIGGER_REGULAR (1) /* For Regular and ReTxBSR Expiry Triggers */
|
||||
#define NR_BSR_TRIGGER_PERIODIC (2) /* For BSR Periodic Timer Expiry Trigger */
|
||||
#define NR_BSR_TRIGGER_PADDING (4) /* For Padding BSR Trigger */
|
||||
|
||||
// For both DL/UL-SCH
|
||||
// Except:
|
||||
// - UL/DL-SCH: fixed-size MAC CE(known by LCID)
|
||||
|
||||
@@ -657,10 +657,70 @@ static int nr_get_ms_bucketsizeduration(long bucketsizeduration)
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t nr_get_pbr(long prioritizedbitrate) // returns Bps
|
||||
{
|
||||
uint32_t pbr = 0;
|
||||
switch (prioritizedbitrate) {
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps0:
|
||||
pbr = 0;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8:
|
||||
pbr = 8;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps16:
|
||||
pbr = 16;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps32:
|
||||
pbr = 32;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps64:
|
||||
pbr = 64;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps128:
|
||||
pbr = 128;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps256:
|
||||
pbr = 256;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps512:
|
||||
pbr = 512;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps1024:
|
||||
pbr = 1024;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps2048:
|
||||
pbr = 2048;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps4096:
|
||||
pbr = 4096;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8192:
|
||||
pbr = 8192;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps16384:
|
||||
pbr = 16384;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps32768:
|
||||
pbr = 32768;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps65536:
|
||||
pbr = 65536;
|
||||
break;
|
||||
case NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity:
|
||||
pbr = UINT_MAX;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(false, "The proritized bit rate value is not one of the enum values\n");
|
||||
}
|
||||
uint32_t pbr_bytes =
|
||||
(prioritizedbitrate < NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity) ? pbr * 1000 : pbr;
|
||||
return pbr_bytes;
|
||||
}
|
||||
|
||||
static uint32_t get_lc_bucket_size(long prioritisedBitRate, long bucketSizeDuration)
|
||||
{
|
||||
int pbr = nr_get_pbr(prioritisedBitRate);
|
||||
// in infinite pbr, the bucket is saturated by pbr
|
||||
uint32_t pbr = nr_get_pbr(prioritisedBitRate);
|
||||
// if infinite pbr, the bucket is saturated by pbr
|
||||
int bsd = 0;
|
||||
if (prioritisedBitRate == NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity)
|
||||
bsd = 1;
|
||||
@@ -675,8 +735,8 @@ static void set_default_logicalchannelconfig(nr_lcordered_info_t *lc_info, NR_SR
|
||||
{
|
||||
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);
|
||||
lc_info->pbr = UINT_MAX;
|
||||
lc_info->bucket_size = UINT_MAX;
|
||||
}
|
||||
|
||||
static void nr_configure_lc_config(NR_UE_MAC_INST_t *mac,
|
||||
@@ -684,19 +744,27 @@ static void nr_configure_lc_config(NR_UE_MAC_INST_t *mac,
|
||||
NR_LogicalChannelConfig_t *mac_lc_config,
|
||||
NR_SRB_Identity_t srb_id)
|
||||
{
|
||||
NR_LC_SCHEDULING_INFO *lc_sched_info = get_scheduling_info_from_lcid(mac, lc_info->lcid);
|
||||
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;
|
||||
// invalid LCGID to signal it is absent in the configuration
|
||||
lc_sched_info->LCGID = NR_INVALID_LCGID;
|
||||
return;
|
||||
}
|
||||
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;
|
||||
lc_info->priority = ul_parm->priority;
|
||||
lc_info->prioritisedBitRate = ul_parm->prioritisedBitRate;
|
||||
// TODO Verify setting to 0 is ok, 331 just says need R (release if NULL)
|
||||
mac->scheduling_info.lc_sched_info[lc_info->lcid - 1].LCGID = ul_parm->logicalChannelGroup ? *ul_parm->logicalChannelGroup : 0;
|
||||
lc_info->sr_DelayTimerApplied = ul_parm->logicalChannelSR_DelayTimerApplied;
|
||||
lc_info->lc_SRMask = ul_parm->logicalChannelSR_Mask;
|
||||
lc_info->pbr = nr_get_pbr(ul_parm->prioritisedBitRate);
|
||||
// if logicalChannelGroup we release LCGID and set it to invalid
|
||||
lc_sched_info->LCGID = ul_parm->logicalChannelGroup ? *ul_parm->logicalChannelGroup : NR_INVALID_LCGID;
|
||||
lc_info->bucket_size = get_lc_bucket_size(ul_parm->prioritisedBitRate, ul_parm->bucketSizeDuration);
|
||||
// setup and start Bj timer for this LC
|
||||
NR_timer_t *bjt = &lc_sched_info->Bj_timer;
|
||||
nr_timer_setup(bjt, UINT_MAX, 1); // this timer never expires in principle, counter incremented by number of slots
|
||||
nr_timer_start(bjt);
|
||||
}
|
||||
|
||||
static void configure_logicalChannelBearer(NR_UE_MAC_INST_t *mac,
|
||||
@@ -1492,6 +1560,137 @@ static void configure_physicalcellgroup(NR_UE_MAC_INST_t *mac,
|
||||
*p_UE_FR1 : *p_NR_FR1);
|
||||
}
|
||||
|
||||
static uint32_t get_sr_DelayTimer(long logicalChannelSR_DelayTimer)
|
||||
{
|
||||
uint32_t timer = 0;
|
||||
switch (logicalChannelSR_DelayTimer) {
|
||||
case NR_BSR_Config__logicalChannelSR_DelayTimer_sf20 :
|
||||
timer = 20;
|
||||
break;
|
||||
case NR_BSR_Config__logicalChannelSR_DelayTimer_sf40 :
|
||||
timer = 40;
|
||||
break;
|
||||
case NR_BSR_Config__logicalChannelSR_DelayTimer_sf64 :
|
||||
timer = 64;
|
||||
break;
|
||||
case NR_BSR_Config__logicalChannelSR_DelayTimer_sf128 :
|
||||
timer = 128;
|
||||
break;
|
||||
case NR_BSR_Config__logicalChannelSR_DelayTimer_sf512 :
|
||||
timer = 512;
|
||||
break;
|
||||
case NR_BSR_Config__logicalChannelSR_DelayTimer_sf1024 :
|
||||
timer = 1024;
|
||||
break;
|
||||
case NR_BSR_Config__logicalChannelSR_DelayTimer_sf2560 :
|
||||
timer = 2560;
|
||||
break;
|
||||
default :
|
||||
AssertFatal(false, "Invalid SR_DelayTimer %ld\n", logicalChannelSR_DelayTimer);
|
||||
}
|
||||
return timer;
|
||||
}
|
||||
|
||||
static uint32_t nr_get_sf_retxBSRTimer(long retxBSR_Timer)
|
||||
{
|
||||
uint32_t timer = 0;
|
||||
switch (retxBSR_Timer) {
|
||||
case NR_BSR_Config__retxBSR_Timer_sf10:
|
||||
timer = 10;
|
||||
break;
|
||||
case NR_BSR_Config__retxBSR_Timer_sf20:
|
||||
timer = 20;
|
||||
break;
|
||||
case NR_BSR_Config__retxBSR_Timer_sf40:
|
||||
timer = 40;
|
||||
break;
|
||||
case NR_BSR_Config__retxBSR_Timer_sf80:
|
||||
timer = 80;
|
||||
break;
|
||||
case NR_BSR_Config__retxBSR_Timer_sf160:
|
||||
timer = 160;
|
||||
break;
|
||||
case NR_BSR_Config__retxBSR_Timer_sf320:
|
||||
timer = 320;
|
||||
break;
|
||||
case NR_BSR_Config__retxBSR_Timer_sf640:
|
||||
timer = 640;
|
||||
break;
|
||||
case NR_BSR_Config__retxBSR_Timer_sf1280:
|
||||
timer = 1280;
|
||||
break;
|
||||
case NR_BSR_Config__retxBSR_Timer_sf2560:
|
||||
timer = 2560;
|
||||
break;
|
||||
case NR_BSR_Config__retxBSR_Timer_sf5120:
|
||||
timer = 5120;
|
||||
break;
|
||||
case NR_BSR_Config__retxBSR_Timer_sf10240:
|
||||
timer = 10240;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(false, "Invalid retxBSR_Timer %ld\n", retxBSR_Timer);
|
||||
}
|
||||
return timer;
|
||||
}
|
||||
|
||||
static uint32_t nr_get_sf_periodicBSRTimer(long periodicBSR)
|
||||
{
|
||||
uint32_t timer = 0;
|
||||
switch (periodicBSR) {
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf1:
|
||||
timer = 1;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf5:
|
||||
timer = 5;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf10:
|
||||
timer = 10;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf16:
|
||||
timer = 16;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf20:
|
||||
timer = 20;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf32:
|
||||
timer = 32;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf40:
|
||||
timer = 40;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf64:
|
||||
timer = 64;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf80:
|
||||
timer = 80;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf128:
|
||||
timer = 128;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf160:
|
||||
timer = 160;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf320:
|
||||
timer = 320;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf640:
|
||||
timer = 640;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf1280:
|
||||
timer = 1280;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_sf2560:
|
||||
timer = 2560;
|
||||
break;
|
||||
case NR_BSR_Config__periodicBSR_Timer_infinity:
|
||||
timer = UINT_MAX;
|
||||
default:
|
||||
AssertFatal(false, "Invalid periodicBSR_Timer %ld\n", periodicBSR);
|
||||
}
|
||||
return timer;
|
||||
}
|
||||
|
||||
static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroupConfig_t *mcg)
|
||||
{
|
||||
NR_UE_SCHEDULING_INFO *si = &mac->scheduling_info;
|
||||
@@ -1525,10 +1724,17 @@ static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroup
|
||||
}
|
||||
}
|
||||
if (mcg->bsr_Config) {
|
||||
si->periodicBSR_Timer = mcg->bsr_Config->periodicBSR_Timer;
|
||||
si->retxBSR_Timer = mcg->bsr_Config->retxBSR_Timer;
|
||||
if (mcg->bsr_Config->logicalChannelSR_DelayTimer)
|
||||
LOG_E(NR_MAC, "Handling of logicalChannelSR_DelayTimer not implemented\n");
|
||||
int subframes_per_slot = nr_slots_per_frame[mac->current_UL_BWP->scs] / 10;
|
||||
uint32_t periodic_sf = nr_get_sf_periodicBSRTimer(mcg->bsr_Config->periodicBSR_Timer);
|
||||
uint32_t target = periodic_sf < UINT_MAX ? periodic_sf * subframes_per_slot : periodic_sf;
|
||||
nr_timer_setup(&si->periodicBSR_Timer, target, 1); // 1 slot update rate
|
||||
nr_timer_start(&si->periodicBSR_Timer);
|
||||
uint32_t retx_sf = nr_get_sf_retxBSRTimer(mcg->bsr_Config->retxBSR_Timer);
|
||||
nr_timer_setup(&si->retxBSR_Timer, retx_sf * subframes_per_slot, 1); // 1 slot update rate
|
||||
if (mcg->bsr_Config->logicalChannelSR_DelayTimer) {
|
||||
uint32_t dt_sf = get_sr_DelayTimer(*mcg->bsr_Config->logicalChannelSR_DelayTimer);
|
||||
nr_timer_setup(&si->sr_DelayTimer, dt_sf * subframes_per_slot, 1); // 1 slot update rate
|
||||
}
|
||||
}
|
||||
if (mcg->tag_Config) {
|
||||
// TODO TAG not handled
|
||||
@@ -1988,9 +2194,6 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id,
|
||||
AssertFatal(cell_group_config, "CellGroupConfig should not be NULL\n");
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
|
||||
if (cell_group_config->mac_CellGroupConfig)
|
||||
configure_maccellgroup(mac, cell_group_config->mac_CellGroupConfig);
|
||||
|
||||
if (cell_group_config->physicalCellGroupConfig)
|
||||
configure_physicalcellgroup(mac, cell_group_config->physicalCellGroupConfig);
|
||||
|
||||
@@ -2008,6 +2211,9 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id,
|
||||
}
|
||||
}
|
||||
|
||||
if (cell_group_config->mac_CellGroupConfig)
|
||||
configure_maccellgroup(mac, cell_group_config->mac_CellGroupConfig);
|
||||
|
||||
configure_logicalChannelBearer(mac,
|
||||
cell_group_config->rlc_BearerToAddModList,
|
||||
cell_group_config->rlc_BearerToReleaseList);
|
||||
|
||||
@@ -68,6 +68,13 @@
|
||||
// NR UE defs
|
||||
// ==========
|
||||
|
||||
#define NR_BSR_TRIGGER_NONE (0) /* No BSR Trigger */
|
||||
#define NR_BSR_TRIGGER_REGULAR (1) /* For Regular and ReTxBSR Expiry Triggers */
|
||||
#define NR_BSR_TRIGGER_PERIODIC (2) /* For BSR Periodic Timer Expiry Trigger */
|
||||
#define NR_BSR_TRIGGER_PADDING (4) /* For Padding BSR Trigger */
|
||||
|
||||
#define NR_INVALID_LCGID (NR_MAX_NUM_LCGID)
|
||||
|
||||
#define MAX_NUM_BWP_UE 5
|
||||
#define NUM_SLOT_FRAME 10
|
||||
|
||||
@@ -185,6 +192,7 @@ typedef struct {
|
||||
long LCGID;
|
||||
// Bj bucket usage per lcid
|
||||
int32_t Bj;
|
||||
NR_timer_t Bj_timer;
|
||||
} NR_LC_SCHEDULING_INFO;
|
||||
|
||||
typedef struct {
|
||||
@@ -200,18 +208,20 @@ typedef struct {
|
||||
NR_LC_SCHEDULING_INFO lc_sched_info[NR_MAX_NUM_LCID];
|
||||
// lcg scheduling info
|
||||
NR_LCG_SCHEDULING_INFO lcg_sched_info[NR_MAX_NUM_LCGID];
|
||||
/// BSR report flag management
|
||||
uint8_t BSR_reporting_active;
|
||||
// LCID triggering BSR
|
||||
NR_LogicalChannelIdentity_t regularBSR_trigger_lcid;
|
||||
/// SR pending as defined in 38.321
|
||||
uint8_t SR_pending;
|
||||
/// SR_COUNTER as defined in 38.321
|
||||
uint16_t SR_COUNTER;
|
||||
/// retxBSR-Timer, default value is sf2560
|
||||
uint16_t retxBSR_Timer;
|
||||
/// retxBSR_SF, number of subframe before triggering a regular BSR
|
||||
uint16_t retxBSR_SF;
|
||||
/// periodicBSR-Timer, default to infinity
|
||||
uint16_t periodicBSR_Timer;
|
||||
/// periodicBSR_SF, number of subframe before triggering a periodic BSR
|
||||
uint16_t periodicBSR_SF;
|
||||
// logicalChannelSR-DelayTimer
|
||||
NR_timer_t sr_DelayTimer;
|
||||
/// retxBSR-Timer
|
||||
NR_timer_t retxBSR_Timer;
|
||||
/// periodicBSR-Timer
|
||||
NR_timer_t periodicBSR_Timer;
|
||||
/// default value is 0: not configured
|
||||
uint16_t sr_ProhibitTimer;
|
||||
/// sr ProhibitTime running
|
||||
@@ -231,10 +241,6 @@ typedef struct {
|
||||
int16_t prohibitPHR_SF;
|
||||
///DL Pathloss Change in db
|
||||
uint16_t PathlossChange_db;
|
||||
/// default value is false
|
||||
uint16_t extendedBSR_Sizes_r10;
|
||||
/// default value is false
|
||||
uint16_t extendedPHR_r10;
|
||||
} NR_UE_SCHEDULING_INFO;
|
||||
|
||||
typedef enum {
|
||||
@@ -441,9 +447,11 @@ typedef struct nr_lcordered_info_s {
|
||||
// logical channels ids ordered as per priority
|
||||
NR_LogicalChannelIdentity_t lcid;
|
||||
long priority;
|
||||
long prioritisedBitRate;
|
||||
uint32_t pbr; // in B/s (UINT_MAX = infinite)
|
||||
// Bucket size per lcid
|
||||
uint32_t bucket_size;
|
||||
bool sr_DelayTimerApplied;
|
||||
bool lc_SRMask;
|
||||
} nr_lcordered_info_t;
|
||||
|
||||
|
||||
@@ -521,9 +529,6 @@ typedef struct NR_UE_MAC_INST_s {
|
||||
nr_phy_config_t phy_config;
|
||||
nr_synch_request_t synch_request;
|
||||
|
||||
/// BSR report flag management
|
||||
uint8_t BSR_reporting_active;
|
||||
|
||||
// order lc info
|
||||
A_SEQUENCE_OF(nr_lcordered_info_t) lc_ordered_list;
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac);
|
||||
|
||||
void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data);
|
||||
void update_mac_timers(NR_UE_MAC_INST_t *mac);
|
||||
NR_LC_SCHEDULING_INFO *get_scheduling_info_from_lcid(NR_UE_MAC_INST_t *mac, NR_LogicalChannelIdentity_t lcid);
|
||||
|
||||
/**\brief apply default configuration values in nr_mac instance
|
||||
\param mac mac instance */
|
||||
@@ -119,46 +120,6 @@ subframe number \param[in] slotP slot number
|
||||
*/
|
||||
int8_t nr_ue_get_SR(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slotP);
|
||||
|
||||
/*! \fn nr_update_bsr
|
||||
\brief get the rlc stats and update the bsr level for each lcid
|
||||
\param[in] mac pointer to UE MAC instance
|
||||
\param[in] frameP Frame index
|
||||
\param[in] slotP number
|
||||
\param[in] gNB_index
|
||||
*/
|
||||
bool nr_update_bsr(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slotP, uint8_t gNB_index);
|
||||
|
||||
/*! \fn nr_locate_BsrIndexByBufferSize (int *table, int size, int value)
|
||||
\brief locate the BSR level in the table as defined in 38.321. This function requires that he values in table to be monotonic, either increasing or decreasing. The returned value is not less than 0, nor greater than n-1, where n is the size of table.
|
||||
\param[in] *table Pointer to BSR table
|
||||
\param[in] size Size of the table
|
||||
\param[in] value Value of the buffer
|
||||
\return the index in the BSR_LEVEL table
|
||||
*/
|
||||
uint8_t nr_locate_BsrIndexByBufferSize(const uint32_t *table, int size,
|
||||
int value);
|
||||
|
||||
/*! \fn int nr_get_pbr(long prioritizedbitrate)
|
||||
\brief get the rate in kbps from the rate configured by the higher layer
|
||||
\param[in] prioritizedbitrate
|
||||
\return the rate in kbps
|
||||
*/
|
||||
uint32_t nr_get_pbr(long prioritizedbitrate);
|
||||
|
||||
/*! \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
|
||||
\param[in] periodicBSR_Timer timer for periodic BSR
|
||||
\return the number of subframe
|
||||
*/
|
||||
int nr_get_sf_periodicBSRTimer(uint8_t bucketSize);
|
||||
|
||||
/*! \fn int nr_get_sf_retxBSRTimer(uint8_t retxBSR_Timer)
|
||||
\brief get the number of subframe form the bucket size duration configured by the higher layer
|
||||
\param[in] retxBSR_Timer timer for regular BSR
|
||||
\return the time in sf
|
||||
*/
|
||||
int nr_get_sf_retxBSRTimer(uint8_t retxBSR_Timer);
|
||||
|
||||
int8_t nr_ue_process_dci(NR_UE_MAC_INST_t *mac,
|
||||
int cc_id,
|
||||
frame_t frame,
|
||||
|
||||
@@ -72,6 +72,9 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac)
|
||||
mac->p_Max_alt = INT_MIN;
|
||||
reset_mac_inst(mac);
|
||||
|
||||
// need to inizialize because might not been setup (optional timer)
|
||||
nr_timer_stop(&mac->scheduling_info.sr_DelayTimer);
|
||||
|
||||
memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements));
|
||||
memset(&mac->ul_time_alignment, 0, sizeof(mac->ul_time_alignment));
|
||||
memset(mac->ssb_list, 0, sizeof(mac->ssb_list));
|
||||
@@ -81,8 +84,13 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac)
|
||||
void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
|
||||
{
|
||||
// default values as defined in 38.331 sec 9.2.2
|
||||
mac->scheduling_info.retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf80;
|
||||
mac->scheduling_info.periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10;
|
||||
|
||||
// sf80 default for retxBSR_Timer sf10 for periodicBSR_Timer
|
||||
int mu = mac->current_UL_BWP ? mac->current_UL_BWP->scs : get_softmodem_params()->numerology;
|
||||
int subframes_per_slot = nr_slots_per_frame[mu] / 10;
|
||||
nr_timer_setup(&mac->scheduling_info.retxBSR_Timer, 80 * subframes_per_slot, 1); // 1 slot update rate
|
||||
nr_timer_setup(&mac->scheduling_info.periodicBSR_Timer, 10 * subframes_per_slot, 1); // 1 slot update rate
|
||||
|
||||
mac->scheduling_info.periodicPHR_Timer = NR_PHR_Config__phr_PeriodicTimer_sf10;
|
||||
mac->scheduling_info.prohibitPHR_Timer = NR_PHR_Config__phr_ProhibitTimer_sf10;
|
||||
}
|
||||
@@ -144,13 +152,20 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
|
||||
// initialize Bj for each logical channel to zero
|
||||
// TODO reset also other status variables of LC, is this ok?
|
||||
for (int i = 0; i < NR_MAX_NUM_LCID; i++) {
|
||||
LOG_D(NR_MAC, "Applying default logical channel config for LCID %d\n", i);
|
||||
nr_mac->scheduling_info.lc_sched_info[i].Bj = 0;
|
||||
nr_mac->scheduling_info.lc_sched_info[i].LCID_buffer_with_data = false;
|
||||
nr_mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0;
|
||||
}
|
||||
|
||||
// TODO stop all running timers
|
||||
for (int i = 0; i < NR_MAX_NUM_LCID; i++) {
|
||||
nr_mac->scheduling_info.lc_sched_info[i].Bj = 0;
|
||||
nr_timer_stop(&nr_mac->scheduling_info.lc_sched_info[i].Bj_timer);
|
||||
}
|
||||
nr_timer_stop(&nr_mac->ra.contention_resolution_timer);
|
||||
nr_timer_stop(&nr_mac->scheduling_info.sr_DelayTimer);
|
||||
nr_timer_stop(&nr_mac->scheduling_info.retxBSR_Timer);
|
||||
|
||||
// consider all timeAlignmentTimers as expired and perform the corresponding actions in clause 5.2
|
||||
// TODO
|
||||
@@ -177,9 +192,7 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
|
||||
nr_mac->scheduling_info.sr_id = -1; // invalid init value
|
||||
|
||||
// cancel any triggered Buffer Status Reporting procedure
|
||||
nr_mac->scheduling_info.periodicBSR_SF = NR_MAC_UE_BSR_TIMER_NOT_RUNNING;
|
||||
nr_mac->scheduling_info.retxBSR_SF = NR_MAC_UE_BSR_TIMER_NOT_RUNNING;
|
||||
nr_mac->BSR_reporting_active = NR_BSR_TRIGGER_NONE;
|
||||
nr_mac->scheduling_info.BSR_reporting_active = NR_BSR_TRIGGER_NONE;
|
||||
|
||||
// cancel any triggered Power Headroom Reporting procedure
|
||||
// TODO PHR not implemented yet
|
||||
|
||||
@@ -2511,8 +2511,7 @@ int8_t nr_ue_get_SR(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slot)
|
||||
// release all pucch resource
|
||||
//mac->physicalConfigDedicated = NULL; // todo
|
||||
//mac->ul_active = 0; // todo
|
||||
mac->BSR_reporting_active =
|
||||
NR_BSR_TRIGGER_NONE;
|
||||
si->BSR_reporting_active = NR_BSR_TRIGGER_NONE;
|
||||
LOG_I(NR_MAC, "[UE %d] Release all SRs \n", mac->ue_id);
|
||||
}
|
||||
si->SR_pending = 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user