Commit 338426ed authored by francescomani's avatar francescomani

use NR_timer_t for SR-ProhibitTimer

parent 1cae1879
...@@ -1691,6 +1691,7 @@ static uint32_t nr_get_sf_periodicBSRTimer(long periodicBSR) ...@@ -1691,6 +1691,7 @@ static uint32_t nr_get_sf_periodicBSRTimer(long periodicBSR)
static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroupConfig_t *mcg) static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroupConfig_t *mcg)
{ {
NR_UE_SCHEDULING_INFO *si = &mac->scheduling_info; NR_UE_SCHEDULING_INFO *si = &mac->scheduling_info;
int scs = mac->current_UL_BWP->scs;
if (mcg->drx_Config) if (mcg->drx_Config)
LOG_E(NR_MAC, "DRX not implemented! Configuration not handled!\n"); LOG_E(NR_MAC, "DRX not implemented! Configuration not handled!\n");
if (mcg->schedulingRequestConfig) { if (mcg->schedulingRequestConfig) {
...@@ -1699,8 +1700,7 @@ static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroup ...@@ -1699,8 +1700,7 @@ static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroup
for (int i = 0; i < src->schedulingRequestToReleaseList->list.count; i++) { for (int i = 0; i < src->schedulingRequestToReleaseList->list.count; i++) {
if (*src->schedulingRequestToReleaseList->list.array[i] == si->sr_id) { if (*src->schedulingRequestToReleaseList->list.array[i] == si->sr_id) {
si->SR_COUNTER = 0; si->SR_COUNTER = 0;
si->sr_ProhibitTimer = 0; nr_timer_setup(&si->sr_ProhibitTimer, 0, 1); // default value is 0ms
si->sr_ProhibitTimer_Running = 0;
si->sr_id = -1; // invalid init value si->sr_id = -1; // invalid init value
} }
else else
...@@ -1715,13 +1715,16 @@ static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroup ...@@ -1715,13 +1715,16 @@ static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroup
"Current implementation cannot handle more than 1 SR configuration\n"); "Current implementation cannot handle more than 1 SR configuration\n");
si->sr_id = sr->schedulingRequestId; si->sr_id = sr->schedulingRequestId;
si->sr_TransMax = sr->sr_TransMax; si->sr_TransMax = sr->sr_TransMax;
int target_ms = 0;
if (sr->sr_ProhibitTimer) if (sr->sr_ProhibitTimer)
LOG_E(NR_MAC, "SR prohibit timer not properly implemented\n"); target_ms = 1 << *sr->sr_ProhibitTimer;
// length of slot is (1/2^scs)ms
nr_timer_setup(&si->sr_ProhibitTimer, target_ms << scs, 1); // 1 slot update rate
} }
} }
} }
if (mcg->bsr_Config) { if (mcg->bsr_Config) {
int subframes_per_slot = nr_slots_per_frame[mac->current_UL_BWP->scs] / 10; int subframes_per_slot = nr_slots_per_frame[scs] / 10;
uint32_t periodic_sf = nr_get_sf_periodicBSRTimer(mcg->bsr_Config->periodicBSR_Timer); 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; 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_setup(&si->periodicBSR_Timer, target, 1); // 1 slot update rate
......
...@@ -222,10 +222,8 @@ typedef struct { ...@@ -222,10 +222,8 @@ typedef struct {
NR_timer_t retxBSR_Timer; NR_timer_t retxBSR_Timer;
/// periodicBSR-Timer /// periodicBSR-Timer
NR_timer_t periodicBSR_Timer; NR_timer_t periodicBSR_Timer;
/// default value is 0: not configured /// sr ProhibitTimer
uint16_t sr_ProhibitTimer; NR_timer_t sr_ProhibitTimer;
/// sr ProhibitTime running
uint8_t sr_ProhibitTimer_Running;
// Maximum number of SR transmissions // Maximum number of SR transmissions
uint32_t sr_TransMax; uint32_t sr_TransMax;
int sr_id; int sr_id;
......
...@@ -165,6 +165,7 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) ...@@ -165,6 +165,7 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
} }
nr_timer_stop(&nr_mac->ra.contention_resolution_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.sr_DelayTimer);
nr_timer_stop(&nr_mac->scheduling_info.sr_ProhibitTimer);
nr_timer_stop(&nr_mac->scheduling_info.retxBSR_Timer); nr_timer_stop(&nr_mac->scheduling_info.retxBSR_Timer);
// consider all timeAlignmentTimers as expired and perform the corresponding actions in clause 5.2 // consider all timeAlignmentTimers as expired and perform the corresponding actions in clause 5.2
...@@ -187,8 +188,6 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) ...@@ -187,8 +188,6 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
// cancel any triggered Scheduling Request procedure // cancel any triggered Scheduling Request procedure
nr_mac->scheduling_info.SR_COUNTER = 0; nr_mac->scheduling_info.SR_COUNTER = 0;
nr_mac->scheduling_info.SR_pending = 0; nr_mac->scheduling_info.SR_pending = 0;
nr_mac->scheduling_info.sr_ProhibitTimer = 0;
nr_mac->scheduling_info.sr_ProhibitTimer_Running = 0;
nr_mac->scheduling_info.sr_id = -1; // invalid init value nr_mac->scheduling_info.sr_id = -1; // invalid init value
// cancel any triggered Buffer Status Reporting procedure // cancel any triggered Buffer Status Reporting procedure
......
...@@ -2504,14 +2504,8 @@ int8_t nr_ue_get_SR(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slot) ...@@ -2504,14 +2504,8 @@ int8_t nr_ue_get_SR(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slot)
si->SR_pending); // todo si->SR_pending); // todo
si->SR_COUNTER++; si->SR_COUNTER++;
// start the sr-prohibittimer : rel 9 and above // start the sr-prohibittimer
if (si->sr_ProhibitTimer > 0) { // timer configured nr_timer_start(&si->sr_ProhibitTimer);
si->sr_ProhibitTimer--;
si->sr_ProhibitTimer_Running = 1;
} else {
si->sr_ProhibitTimer_Running = 0;
}
//mac->ul_active =1;
return (1); //instruct phy to signal SR return (1); //instruct phy to signal SR
} else { } else {
// notify RRC to relase PUCCH/SRS // notify RRC to relase PUCCH/SRS
...@@ -2526,6 +2520,7 @@ int8_t nr_ue_get_SR(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slot) ...@@ -2526,6 +2520,7 @@ int8_t nr_ue_get_SR(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t slot)
} }
si->SR_pending = 0; si->SR_pending = 0;
si->SR_COUNTER = 0; si->SR_COUNTER = 0;
nr_timer_stop(&si->sr_ProhibitTimer);
return (0); return (0);
} }
} }
......
...@@ -133,6 +133,7 @@ static void trigger_regular_bsr(NR_UE_MAC_INST_t *mac, NR_LogicalChannelIdentity ...@@ -133,6 +133,7 @@ static void trigger_regular_bsr(NR_UE_MAC_INST_t *mac, NR_LogicalChannelIdentity
void update_mac_timers(NR_UE_MAC_INST_t *mac) void update_mac_timers(NR_UE_MAC_INST_t *mac)
{ {
nr_timer_tick(&mac->ra.contention_resolution_timer); nr_timer_tick(&mac->ra.contention_resolution_timer);
nr_timer_tick(&mac->scheduling_info.sr_ProhibitTimer);
nr_timer_tick(&mac->scheduling_info.sr_DelayTimer); nr_timer_tick(&mac->scheduling_info.sr_DelayTimer);
bool retxBSR_expired = nr_timer_tick(&mac->scheduling_info.retxBSR_Timer); bool retxBSR_expired = nr_timer_tick(&mac->scheduling_info.retxBSR_Timer);
if (retxBSR_expired) { if (retxBSR_expired) {
...@@ -2678,6 +2679,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac, ...@@ -2678,6 +2679,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac,
LOG_D(NR_MAC, "[UE %d][SR] Gave SDU to PHY, clearing any scheduling request\n", mac->ue_id); LOG_D(NR_MAC, "[UE %d][SR] Gave SDU to PHY, clearing any scheduling request\n", mac->ue_id);
sched_info->SR_pending = 0; sched_info->SR_pending = 0;
sched_info->SR_COUNTER = 0; sched_info->SR_COUNTER = 0;
nr_timer_stop(&sched_info->sr_ProhibitTimer);
/* Actions when a BSR is sent */ /* Actions when a BSR is sent */
if (mac_ce_p->bsr_ce_len) { if (mac_ce_p->bsr_ce_len) {
......
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