Commit b95e8b79 authored by fnabet's avatar fnabet

L2 changes for NR UE demo

parent ef2f111a
...@@ -1045,6 +1045,20 @@ typedef struct { ...@@ -1045,6 +1045,20 @@ typedef struct {
frame_t txFrame; frame_t txFrame;
/// TX subframe counter /// TX subframe counter
sub_frame_t txSubframe; sub_frame_t txSubframe;
#ifdef UE_NR_PHY_DEMO
/// NR numerology index [0..5] as specified in 38.211 Section 4 (mu). 0=15khZ SCS, 1=30khZ, 2=60kHz, etc
uint8_t numerology_index;
/// NR number of ttis per subframe deduced from numerology (cf 38.211): 1, 2, 4, 8(not supported),16(not supported),32(not supported)
uint8_t ttis_per_subframe;
/// NR number of slots per tti . Assumption only 2 Slot per TTI is supported (Slot Config 1 in 38.211)
uint8_t slots_per_tti;
/// NR TTI index within subframe_tx [0 .. ttis_per_subframe - 1] to act upon for transmission
nr_tti_t txNRTti;
/// NR TTI index within subframe_rx [0 .. ttis_per_subframe - 1] to act upon for reception
nr_tti_t rxNRTti;
/// TX last absolute subframe
uint32_t txLastAbsSubframe;
#endif
/// C-RNTI of UE /// C-RNTI of UE
uint16_t crnti; uint16_t crnti;
/// C-RNTI of UE before HO /// C-RNTI of UE before HO
......
...@@ -1861,6 +1861,10 @@ ue_scheduler( ...@@ -1861,6 +1861,10 @@ ue_scheduler(
instance_t instance; instance_t instance;
int result; int result;
#endif #endif
#ifdef UE_NR_PHY_DEMO
boolean_t isNewTxSubframe = (UE_mac_inst[module_idP].txLastAbsSubframe != (txFrameP*10 + txSubframeP));
UE_mac_inst[module_idP].txLastAbsSubframe = (txFrameP*10 + txSubframeP);
#endif
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].ue_scheduler); start_meas(&UE_mac_inst[module_idP].ue_scheduler);
#endif #endif
...@@ -1903,12 +1907,22 @@ ue_scheduler( ...@@ -1903,12 +1907,22 @@ ue_scheduler(
//Rrc_xface->Frame_index=Mac_rlc_xface->frameP; //Rrc_xface->Frame_index=Mac_rlc_xface->frameP;
//if (subframe%5 == 0) //if (subframe%5 == 0)
//LG#ifdef EXMIMO //LG#ifdef EXMIMO
#ifdef UE_NR_PHY_DEMO
// call pdcp_run every subframe on TTI0. To check later if OK
if (isNewTxSubframe)
#endif
{
pdcp_run(&ctxt); pdcp_run(&ctxt);
}
//#endif //#endif
UE_mac_inst[module_idP].txFrame = txFrameP; UE_mac_inst[module_idP].txFrame = txFrameP;
UE_mac_inst[module_idP].txSubframe = txSubframeP; UE_mac_inst[module_idP].txSubframe = txSubframeP;
UE_mac_inst[module_idP].rxFrame = rxFrameP; UE_mac_inst[module_idP].rxFrame = rxFrameP;
UE_mac_inst[module_idP].rxSubframe = rxSubframeP; UE_mac_inst[module_idP].rxSubframe = rxSubframeP;
#ifdef UE_NR_PHY_DEMO
UE_mac_inst[module_idP].txNRTti = txNRTtiP;
UE_mac_inst[module_idP].rxNRTti = rxNRTtiP;
#endif
#ifdef CELLULAR #ifdef CELLULAR
rrc_rx_tx(module_idP, txFrameP, 0, eNB_indexP); rrc_rx_tx(module_idP, txFrameP, 0, eNB_indexP);
...@@ -1973,23 +1987,30 @@ ue_scheduler( ...@@ -1973,23 +1987,30 @@ ue_scheduler(
//return(RRC_OK); //return(RRC_OK);
} }
LOG_I(MAC,"Frame %d: Contention resolution timer %d/%ld\n",txFrameP,UE_mac_inst[module_idP].RA_contention_resolution_cnt, #ifdef UE_NR_PHY_DEMO
((1+rach_ConfigCommon->ra_SupervisionInfo.mac_ContentionResolutionTimer)<<3)); // NR: update and check contention resolution only on every new subframe (TTI0). To check later
if (isNewTxSubframe)
UE_mac_inst[module_idP].RA_contention_resolution_cnt++; #endif
{
if (UE_mac_inst[module_idP].RA_contention_resolution_cnt == LOG_I(MAC,"Frame %d: Contention resolution timer %d/%ld\n",txFrameP,UE_mac_inst[module_idP].RA_contention_resolution_cnt,
((1+rach_ConfigCommon->ra_SupervisionInfo.mac_ContentionResolutionTimer)<<3)) { ((1+rach_ConfigCommon->ra_SupervisionInfo.mac_ContentionResolutionTimer)<<3));
UE_mac_inst[module_idP].RA_active = 0;
UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0; UE_mac_inst[module_idP].RA_contention_resolution_cnt++;
// Signal PHY to quit RA procedure
LOG_E(MAC,"Module id %u Contention resolution timer expired, RA failed\n", module_idP); if (UE_mac_inst[module_idP].RA_contention_resolution_cnt ==
mac_xface->ra_failed(module_idP,0,eNB_indexP); ((1+rach_ConfigCommon->ra_SupervisionInfo.mac_ContentionResolutionTimer)<<3)) {
UE_mac_inst[module_idP].RA_active = 0;
UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0;
// Signal PHY to quit RA procedure
LOG_E(MAC,"Module id %u Contention resolution timer expired, RA failed\n", module_idP);
mac_xface->ra_failed(module_idP,0,eNB_indexP);
}
} }
} }
// Get RLC status info and update Bj for all lcids that are active // Get RLC status info and update Bj for all lcids that are active
// NR LCP: not necessary to update as LCP is not used in OAI but should be done once handling several DRB
for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++ ) { for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++ ) {
if (UE_mac_inst[module_idP].logicalChannelConfig[lcid]) { if (UE_mac_inst[module_idP].logicalChannelConfig[lcid]) {
// meausre the Bj // meausre the Bj
...@@ -2024,16 +2045,22 @@ ue_scheduler( ...@@ -2024,16 +2045,22 @@ ue_scheduler(
// First check ReTxBSR Timer because it is always configured // First check ReTxBSR Timer because it is always configured
// Decrement ReTxBSR Timer if it is running and not null // Decrement ReTxBSR Timer if it is running and not null
if ((UE_mac_inst[module_idP].scheduling_info.retxBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING) #ifdef UE_NR_PHY_DEMO
&& (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF != 0)){ // NR: update only on every new subframe (TTI0). To check later
UE_mac_inst[module_idP].scheduling_info.retxBSR_SF --; if (isNewTxSubframe)
} #endif
{
if ((UE_mac_inst[module_idP].scheduling_info.retxBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING)
&& (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF != 0)){
UE_mac_inst[module_idP].scheduling_info.retxBSR_SF --;
}
// Decrement Periodic Timer if it is running and not null // Decrement Periodic Timer if it is running and not null
if ((UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING) if ((UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING)
&& (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF != 0)){ && (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF != 0)){
UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF--; UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF--;
} }
}
//Check whether Regular BSR is triggered //Check whether Regular BSR is triggered
if (update_bsr(module_idP,txFrameP, txSubframeP,eNB_indexP) == TRUE) { if (update_bsr(module_idP,txFrameP, txSubframeP,eNB_indexP) == TRUE) {
...@@ -2077,7 +2104,14 @@ ue_scheduler( ...@@ -2077,7 +2104,14 @@ ue_scheduler(
if (UE_mac_inst[module_idP].PHR_reconfigured == 1) { // upon (re)configuration of the power headroom reporting functionality by upper layers if (UE_mac_inst[module_idP].PHR_reconfigured == 1) { // upon (re)configuration of the power headroom reporting functionality by upper layers
UE_mac_inst[module_idP].PHR_reporting_active = 1; UE_mac_inst[module_idP].PHR_reporting_active = 1;
UE_mac_inst[module_idP].PHR_reconfigured = 0; UE_mac_inst[module_idP].PHR_reconfigured = 0;
} else { }
#ifdef UE_NR_PHY_DEMO
// NR: Only check Power headroom and update PHR timers every subframe. To check
else if (isNewTxSubframe)
#else
else
#endif
{
//LOG_D(MAC,"PHR normal operation %d active %d \n", UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF, UE_mac_inst[module_idP].PHR_reporting_active); //LOG_D(MAC,"PHR normal operation %d active %d \n", UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF, UE_mac_inst[module_idP].PHR_reporting_active);
if ((UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF <= 0) && if ((UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF <= 0) &&
((mac_xface->get_PL(module_idP,0,eNB_indexP) < UE_mac_inst[module_idP].scheduling_info.PathlossChange_db) || ((mac_xface->get_PL(module_idP,0,eNB_indexP) < UE_mac_inst[module_idP].scheduling_info.PathlossChange_db) ||
......
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