Commit 67c7f973 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge remote-tracking branch 'origin/452-cdrx-better-support-cu-du-split' into...

Merge remote-tracking branch 'origin/452-cdrx-better-support-cu-du-split' into develop_integration_2019_w51
parents 7d86b936 cc15b223
......@@ -6,3 +6,6 @@ log/
lte_build_oai/
targets/bin/
cmake_targets/nas_sim_tools/build/
# vscode
.vscode
\ No newline at end of file
......@@ -45,3 +45,6 @@ MESSAGE_DEF(RRC_MAC_MCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacMcchDat
MESSAGE_DEF(RRC_MAC_MCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacMcchDataInd, rrc_mac_mcch_data_ind)
MESSAGE_DEF(RRC_MAC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacPcchDataReq, rrc_mac_pcch_data_req)
/* RRC configures DRX context (MAC timers) of a UE */
MESSAGE_DEF(RRC_MAC_DRX_CONFIG_REQ, MESSAGE_PRIORITY_MED, rrc_mac_drx_config_req_t, rrc_mac_drx_config_req)
\ No newline at end of file
......@@ -29,6 +29,8 @@
#ifndef MAC_MESSAGES_TYPES_H_
#define MAC_MESSAGES_TYPES_H_
#include <LTE_DRX-Config.h>
//-------------------------------------------------------------------------------------------//
// Defines to access message fields.
#define RRC_MAC_IN_SYNC_IND(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_in_sync_ind
......@@ -48,6 +50,8 @@
#define RRC_MAC_MCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_mcch_data_ind
#define RRC_MAC_PCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_pcch_data_req
#define RRC_MAC_DRX_CONFIG_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_drx_config_req
// Some constants from "LAYER2/MAC/defs.h"
#define BCCH_SDU_SIZE (512)
#define BCCH_SDU_MBMS_SIZE (512)
......@@ -145,4 +149,14 @@ typedef struct RrcMacPcchDataReq_s {
uint8_t sdu[PCCH_SDU_SIZE];
uint8_t enb_index;
} RrcMacPcchDataReq;
/* RRC configures DRX context (MAC timers) of a UE */
typedef struct rrc_mac_drx_config_req_s {
/* UE RNTI to configure */
rnti_t rnti;
/* DRX configuration from MacMainConfig to configure UE's local timers */
LTE_DRX_Config_t * drx_Configuration;
} rrc_mac_drx_config_req_t;
#endif /* MAC_MESSAGES_TYPES_H_ */
......@@ -387,7 +387,6 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) {
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
//RRC_CONFIGURATION_REQ (msg_p).rrc_inactivity_timer_thres = RRC_INACTIVITY_THRESH; // set to 0 to deactivate
// In the configuration file it is in seconds. For RRC it has to be in milliseconds
RRC_CONFIGURATION_REQ (msg_p).rrc_inactivity_timer_thres = (*ENBParamList.paramarray[i][ENB_RRC_INACTIVITY_THRES_IDX].uptr) * 1000;
RRC_CONFIGURATION_REQ (msg_p).cell_identity = enb_id;
......
......@@ -47,6 +47,8 @@
#include "common/ran_context.h"
#include "rrc_eNB_UE_context.h"
#include "asn1_msg.h"
#include "intertask_interface.h"
// undefine C_RNTI from
// openair1/PHY/LTE_TRANSPORT/transport_common.h which
......@@ -398,11 +400,32 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
LTE_SRB_ToAddModList_t *SRB_configList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->srb_ToAddModList;
LTE_DRB_ToReleaseList_t *DRB_ReleaseList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->drb_ToReleaseList;
LTE_MAC_MainConfig_t *mac_MainConfig = NULL;
for (i = 0; i< 8; i++){
DRB2LCHAN[i] = 0;
}
if (rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->mac_MainConfig)
if (rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->mac_MainConfig) {
LOG_D(F1AP, "MAC Main Configuration is present\n");
mac_MainConfig = &rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue;
/* CDRX Configuration */
if (mac_MainConfig->drx_Config == NULL) {
LOG_W(F1AP, "drx_Configuration parameter is NULL, cannot configure local UE parameters or CDRX is deactivated\n");
} else {
MessageDef *message_p = NULL;
/* Send DRX configuration to MAC task to configure timers of local UE context */
message_p = itti_alloc_new_message(TASK_DU_F1, RRC_MAC_DRX_CONFIG_REQ);
RRC_MAC_DRX_CONFIG_REQ(message_p).rnti = ctxt.rnti;
RRC_MAC_DRX_CONFIG_REQ(message_p).drx_Configuration = mac_MainConfig->drx_Config;
itti_send_msg_to_task(TASK_MAC_ENB, ctxt.module_id, message_p);
LOG_D(F1AP, "DRX configured in MAC Main Configuration for RRC Connection Reconfiguration\n");
}
/* End of CDRX configuration */
}
LTE_MeasGapConfig_t *measGapConfig = NULL;
struct LTE_PhysicalConfigDedicated* physicalConfigDedicated = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->physicalConfigDedicated;
rrc_rlc_config_asn1_req(
......@@ -602,7 +625,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
}
int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg) {
int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
const f1ap_ul_rrc_message_t *msg) {
const rnti_t rnti = msg->rnti;
F1AP_F1AP_PDU_t pdu;
......@@ -703,6 +727,25 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_messa
break;
case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete:
LOG_I(F1AP, "[MSG] RRC UL rrcConnectionReconfigurationComplete\n");
/* CDRX: activated when RRC Connection Reconfiguration Complete is received */
int UE_id_mac = find_UE_id(instance, rnti);
if (UE_id_mac == -1) {
LOG_E(F1AP, "Can't find UE_id(MAC) of UE rnti %x\n", rnti);
break;
}
UE_sched_ctrl_t *UE_scheduling_control = &(RC.mac[instance]->UE_list.UE_sched_ctrl[UE_id_mac]);
if (UE_scheduling_control->cdrx_waiting_ack == TRUE) {
UE_scheduling_control->cdrx_waiting_ack = FALSE;
UE_scheduling_control->cdrx_configured = TRUE; // Set to TRUE when RRC Connection Reconfiguration Complete is received
LOG_I(F1AP, "CDRX configuration activated after RRC Connection Reconfiguration Complete reception\n");
}
/* End of CDRX processing */
break;
case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete:
......@@ -710,14 +753,16 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_messa
case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete:
LOG_I(F1AP, "[MSG] RRC UL rrcConnectionSetupComplete \n");
if(!ue_context_p){
if(!ue_context_p){
LOG_E(F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", rnti);
}else {
} else {
LOG_I(F1AP, "Processing RRCConnectionSetupComplete UE %x\n", rnti);
ue_context_p->ue_context.Status = RRC_CONNECTED;
}
break;
case LTE_UL_DCCH_MessageType__c1_PR_securityModeComplete:
LOG_I(F1AP, "[MSG] RRC securityModeComplete \n");
break;
......
......@@ -175,7 +175,7 @@ void *F1AP_DU_task(void *arg) {
&received_msg->ittiMsg.sctp_data_ind);
break;
case F1AP_UL_RRC_MESSAGE: // from rrc
case F1AP_UL_RRC_MESSAGE: // to rrc
LOG_I(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n");
DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&F1AP_UL_RRC_MESSAGE(received_msg));
......
......@@ -1115,18 +1115,18 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
//-----------------------------------------------------------------------------
/*
* Configure local DRX timers and thresholds following the drx_configuration input
* Configure local CDRX timers and thresholds following the drx_configuration input
*/
void eNB_Config_Local_DRX(
module_id_t Mod_id,
rnti_t rnti,
LTE_DRX_Config_t *const drx_Configuration
)
void eNB_Config_Local_DRX(instance_t Mod_id,
rrc_mac_drx_config_req_t *rrc_mac_drx_config_req)
//-----------------------------------------------------------------------------
{
UE_list_t *UE_list_mac = NULL;
int UE_id = -1;
UE_sched_ctrl_t *UE_scheduling_control = NULL;
int UE_id = -1;
rnti_t rnti = rrc_mac_drx_config_req->rnti;
LTE_DRX_Config_t *const drx_Configuration = rrc_mac_drx_config_req->drx_Configuration;
UE_list_mac = &(RC.mac[Mod_id]->UE_list);
......@@ -1134,40 +1134,35 @@ void eNB_Config_Local_DRX(
/* Check UE_id */
if (UE_id == -1) {
LOG_E(MAC, "%s:%d:%s: ERROR, UE_id == -1\n",
__FILE__,
__LINE__,
__FUNCTION__);
LOG_E(MAC, "[eNB_Config_Local_DRX] UE_id == -1\n");
return;
}
/* Get struct to modify */
UE_scheduling_control = &(UE_list_mac->UE_sched_ctrl[UE_id]);
UE_scheduling_control->cdrx_configured = FALSE; // will be set to true when no error
/* Check drx_Configuration */
if (drx_Configuration == NULL) {
LOG_I(MAC, "drx_Configuration parameter is NULL, cannot configure local UE parameters\n");
UE_scheduling_control->cdrx_configured = FALSE;
LOG_W(MAC, "[eNB_Config_Local_DRX] drx_Configuration parameter is NULL, cannot configure local UE parameters for CDRX\n");
return;
}
/* Check if drx config present */
if (drx_Configuration->present != LTE_DRX_Config_PR_setup) {
LOG_I(MAC, "No drx_Configuration present, don't configure local UE parameters\n");
UE_scheduling_control->cdrx_configured = FALSE;
LOG_I(MAC, "[eNB_Config_Local_DRX] No drx_Configuration present, don't configure local UE parameters for CDRX\n");
return;
}
/* Modify scheduling control structure according to DRX configuration: doesn't support every configurations! */
UE_scheduling_control->cdrx_configured = FALSE; // will be set to true when ACK is received
UE_scheduling_control->cdrx_waiting_ack = TRUE; // set to true first, waiting for the UE to configure CDRX on its side
/* Modify scheduling control structure according to DRX configuration: doesn't support every configurations! */
UE_scheduling_control->cdrx_configured = FALSE; // will be set to true when receiving RRC Reconfiguration Complete
UE_scheduling_control->cdrx_waiting_ack = TRUE; // waiting for RRC Reconfiguration Complete message
UE_scheduling_control->in_active_time = FALSE;
UE_scheduling_control->dci0_ongoing_timer = 0;
UE_scheduling_control->on_duration_timer = 0;
switch (drx_Configuration->choice.setup.onDurationTimer) {
struct LTE_DRX_Config__setup *choiceSetup = &drx_Configuration->choice.setup;
switch (choiceSetup->onDurationTimer) {
case 0:
UE_scheduling_control->on_duration_timer_thres = 1;
break;
......@@ -1217,12 +1212,12 @@ void eNB_Config_Local_DRX(
UE_scheduling_control->on_duration_timer_thres = 200;
break;
default:
LOG_E(MAC, "Error in local DRX configuration, the on duration timer value specified is unknown\n");
LOG_E(MAC, "[eNB_Config_Local_DRX] Error in local DRX configuration, the on duration timer value specified is unknown\n");
break;
}
UE_scheduling_control->drx_inactivity_timer = 0;
switch (drx_Configuration->choice.setup.drx_InactivityTimer) {
switch (choiceSetup->drx_InactivityTimer) {
case 0:
UE_scheduling_control->drx_inactivity_timer_thres = 1;
break;
......@@ -1293,11 +1288,11 @@ void eNB_Config_Local_DRX(
UE_scheduling_control->drx_inactivity_timer_thres = 0;
break;
default:
LOG_E(MAC, "Error in local DRX configuration, the drx inactivity timer value specified is unknown\n");
LOG_E(MAC, "[eNB_Config_Local_DRX] Error in local DRX configuration, the drx inactivity timer value specified is unknown\n");
break;
}
if (drx_Configuration->choice.setup.shortDRX == NULL) {
if (choiceSetup->shortDRX == NULL) {
UE_scheduling_control->in_short_drx_cycle = FALSE;
UE_scheduling_control->drx_shortCycle_timer_value = 0;
UE_scheduling_control->short_drx_cycle_duration = 0;
......@@ -1305,8 +1300,8 @@ void eNB_Config_Local_DRX(
UE_scheduling_control->drx_shortCycle_timer_thres = -1;
} else {
UE_scheduling_control->in_short_drx_cycle = FALSE;
UE_scheduling_control->drx_shortCycle_timer_value = (uint8_t) drx_Configuration->choice.setup.shortDRX->drxShortCycleTimer;
switch (drx_Configuration->choice.setup.shortDRX->shortDRX_Cycle) {
UE_scheduling_control->drx_shortCycle_timer_value = (uint8_t) choiceSetup->shortDRX->drxShortCycleTimer;
switch (choiceSetup->shortDRX->shortDRX_Cycle) {
case 0:
UE_scheduling_control->short_drx_cycle_duration = 2;
break;
......@@ -1356,7 +1351,7 @@ void eNB_Config_Local_DRX(
UE_scheduling_control->short_drx_cycle_duration = 640;
break;
default:
LOG_E(MAC, "Error in local DRX configuration, the short drx timer value specified is unknown\n");
LOG_E(MAC, "[eNB_Config_Local_DRX] Error in local DRX configuration, the short drx timer value specified is unknown\n");
break;
}
......@@ -1366,78 +1361,78 @@ void eNB_Config_Local_DRX(
UE_scheduling_control->in_long_drx_cycle = FALSE;
UE_scheduling_control->drx_longCycle_timer = 0;
switch (drx_Configuration->choice.setup.longDRX_CycleStartOffset.present) {
switch (choiceSetup->longDRX_CycleStartOffset.present) {
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf10:
UE_scheduling_control->drx_longCycle_timer_thres = 10;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf10;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf10;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf20:
UE_scheduling_control->drx_longCycle_timer_thres = 20;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf20;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf20;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf32:
UE_scheduling_control->drx_longCycle_timer_thres = 32;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf32;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf32;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf40:
UE_scheduling_control->drx_longCycle_timer_thres = 40;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf40;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf40;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf64:
UE_scheduling_control->drx_longCycle_timer_thres = 64;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf64;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf64;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf80:
UE_scheduling_control->drx_longCycle_timer_thres = 80;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf80;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf80;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf128:
UE_scheduling_control->drx_longCycle_timer_thres = 128;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf128;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf128;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf160:
UE_scheduling_control->drx_longCycle_timer_thres = 160;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf160;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf160;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf256:
UE_scheduling_control->drx_longCycle_timer_thres = 256;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf256;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf256;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf320:
UE_scheduling_control->drx_longCycle_timer_thres = 320;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf320;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf320;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf512:
UE_scheduling_control->drx_longCycle_timer_thres = 512;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf512;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf512;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf640:
UE_scheduling_control->drx_longCycle_timer_thres = 640;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf640;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf640;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf1024:
UE_scheduling_control->drx_longCycle_timer_thres = 1024;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf1024;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf1024;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf1280:
UE_scheduling_control->drx_longCycle_timer_thres = 1280;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf1280;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf1280;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf2048:
UE_scheduling_control->drx_longCycle_timer_thres = 2048;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf2048;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf2048;
break;
case LTE_DRX_Config__setup__longDRX_CycleStartOffset_PR_sf2560:
UE_scheduling_control->drx_longCycle_timer_thres = 2560;
UE_scheduling_control->drx_start_offset = (uint16_t) drx_Configuration->choice.setup.longDRX_CycleStartOffset.choice.sf2560;
UE_scheduling_control->drx_start_offset = (uint16_t) choiceSetup->longDRX_CycleStartOffset.choice.sf2560;
break;
default:
LOG_E(MAC, "Invalid long_DRX value in DRX local configuration\n");
LOG_E(MAC, "[eNB_Config_Local_DRX] Invalid long_DRX value in DRX local configuration\n");
break;
}
memset(UE_scheduling_control->drx_retransmission_timer, 0, sizeof(UE_scheduling_control->drx_retransmission_timer));
switch (drx_Configuration->choice.setup.drx_RetransmissionTimer) {
switch (choiceSetup->drx_RetransmissionTimer) {
case 0:
memset(UE_scheduling_control->drx_retransmission_timer_thres, 1, sizeof(UE_scheduling_control->drx_retransmission_timer_thres));
break;
......@@ -1463,7 +1458,7 @@ void eNB_Config_Local_DRX(
memset(UE_scheduling_control->drx_retransmission_timer_thres, 33, sizeof(UE_scheduling_control->drx_retransmission_timer_thres));
break;
default:
LOG_E(MAC, "Error in local DRX configuration, the drx retransmission timer value specified is unknown\n");
LOG_E(MAC, "[eNB_Config_Local_DRX] Error in local DRX configuration, the drx retransmission timer value specified is unknown\n");
break;
}
}
......@@ -31,6 +31,7 @@
#include "LAYER2/MAC/mac.h"
#include "PHY/defs_common.h" // for PRACH_RESOURCES_t and lte_subframe_t
#include "openair2/COMMON/mac_messages_types.h"
/** \addtogroup _mac
* @{
......@@ -1338,9 +1339,13 @@ int ue_ul_slice_membership(module_id_t mod_id, int UE_id, int slice_idx);
/* DRX Configuration */
/* Configure local DRX timers and thresholds in UE context, following the drx_configuration input */
void eNB_Config_Local_DRX(module_id_t Mod_id, rnti_t rnti, LTE_DRX_Config_t *drx_Configuration);
void eNB_Config_Local_DRX(instance_t Mod_id, rrc_mac_drx_config_req_t *rrc_mac_drx_config_req);
/* from here: prototypes to get rid of compilation warnings: doc to be written by function author */
uint8_t ul_subframe2_k_phich(COMMON_channels_t * cc, sub_frame_t ul_subframe);
#endif
/** @}*/
/* MAC ITTI messaging related functions */
/* Main loop of MAC itti message handling */
void *mac_enb_task(void *arg);
\ No newline at end of file
......@@ -34,15 +34,12 @@
#include "mac_proto.h"
#include "mac_extern.h"
#include "assertions.h"
//#include "PHY_INTERFACE/phy_extern.h"
//#include "PHY/defs_eNB.h"
//#include "SCHED/sched_eNB.h"
#include "LAYER2/PDCP_v10.1.0/pdcp.h"
#include "RRC/LTE/rrc_defs.h"
#include "common/utils/LOG/log.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "common/ran_context.h"
#include "intertask_interface.h"
extern RAN_CONTEXT_t RC;
......@@ -223,3 +220,47 @@ int l2_init_eNB(void)
return (1);
}
//-----------------------------------------------------------------------------
/*
* Main loop of MAC itti message handling
*/
void *mac_enb_task(void *arg)
//-----------------------------------------------------------------------------
{
MessageDef *received_msg = NULL;
int result;
itti_mark_task_ready(TASK_MAC_ENB); // void function 10/2019
LOG_I(MAC,"Starting main loop of MAC message task\n");
while (1) {
itti_receive_msg(TASK_MAC_ENB, &received_msg);
switch (ITTI_MSG_ID(received_msg)) {
case RRC_MAC_DRX_CONFIG_REQ:
LOG_I(MAC, "MAC Task Received RRC_MAC_DRX_CONFIG_REQ\n");
/* Set timers and thresholds values in local MAC context of UE */
eNB_Config_Local_DRX(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.rrc_mac_drx_config_req);
break;
case TERMINATE_MESSAGE:
LOG_W(MAC, " *** Exiting MAC thread\n");
itti_exit_task();
break;
default:
LOG_E(MAC, "MAC instance received unhandled message: %d:%s\n",
ITTI_MSG_ID(received_msg),
ITTI_MSG_NAME(received_msg));
break;
} // end switch
result = itti_free(ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
received_msg = NULL;
} // end while
return NULL;
}
\ No newline at end of file
......@@ -312,10 +312,8 @@ mac_rrc_data_ind(
if (ue_context_p->ue_context.Status != RRC_RECONFIGURED) {
LOG_E(RRC,"[eNB %d] Received C-RNTI ,but UE %x status(%d) not RRC_RECONFIGURED\n",module_idP,rntiP,ue_context_p->ue_context.Status);
return (-1);
} else {
rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt,ue_context_p,0);
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
}
}
rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt,ue_context_p,0);
}
}
......
......@@ -621,36 +621,123 @@ uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,
return((enc_rval.encoded+7)/8);
}
#endif
//-----------------------------------------------------------------------------
/*
* Generate the configuration structure for CDRX feature
*/
LTE_DRX_Config_t *do_DrxConfig(uint8_t Mod_id,
int CC_id,
RrcConfigurationReq *configuration,
LTE_UE_EUTRA_Capability_t *UEcap)
LTE_DRX_Config_t *do_DrxConfig(int CC_id,
RrcConfigurationReq *configuration,
LTE_UE_EUTRA_Capability_t *UEcap)
//-----------------------------------------------------------------------------
{
/* Check CC id */
if (CC_id >= MAX_NUM_CCs) {
LOG_E(RRC, "[do_DrxConfig] Invalid CC_id for DRX configuration\n");
return NULL;
}
/* No CDRX configuration */
if (configuration->radioresourceconfig[CC_id].drx_Config_present == LTE_DRX_Config_PR_NOTHING) {
return NULL;
}
/* CDRX not implemented for TDD */
if (configuration->frame_type[CC_id] == 1) {
LOG_E(RRC, "[do_DrxConfig] CDRX not implemented for TDD\n");
return NULL;
}
/* Need UE capabilities */
if (!UEcap) {
LOG_E(RRC,"[do_DrxConfig] No UEcap pointer\n");
return NULL;
}
/* Check the UE capabilities, CDRX not implemented for Coverage Extension */
LTE_UE_EUTRA_Capability_v920_IEs_t *cap_920 = NULL;
LTE_UE_EUTRA_Capability_v940_IEs_t *cap_940 = NULL;
LTE_UE_EUTRA_Capability_v1020_IEs_t *cap_1020 = NULL;
LTE_UE_EUTRA_Capability_v1060_IEs_t *cap_1060 = NULL;
LTE_UE_EUTRA_Capability_v1090_IEs_t *cap_1090 = NULL;
LTE_UE_EUTRA_Capability_v1130_IEs_t *cap_1130 = NULL;
LTE_UE_EUTRA_Capability_v1170_IEs_t *cap_1170 = NULL;
LTE_UE_EUTRA_Capability_v1180_IEs_t *cap_1180 = NULL;
LTE_UE_EUTRA_Capability_v11a0_IEs_t *cap_11a0 = NULL;
LTE_UE_EUTRA_Capability_v1250_IEs_t *cap_1250 = NULL;
LTE_UE_EUTRA_Capability_v1260_IEs_t *cap_1260 = NULL;
LTE_UE_EUTRA_Capability_v1270_IEs_t *cap_1270 = NULL;
LTE_UE_EUTRA_Capability_v1280_IEs_t *cap_1280 = NULL;
LTE_UE_EUTRA_Capability_v1310_IEs_t *cap_1310 = NULL;
LTE_CE_Parameters_r13_t *CE_param = NULL;
long *ce_a_param = NULL;
cap_920 = UEcap->nonCriticalExtension;
if (cap_920) {
cap_940 = cap_920->nonCriticalExtension;
if (cap_940) {
cap_1020 = cap_940->nonCriticalExtension;
if (cap_1020) {
cap_1060 = cap_1020->nonCriticalExtension;
if (cap_1060) {
cap_1090 = cap_1060->nonCriticalExtension;
if (cap_1090) {
cap_1130 = cap_1090->nonCriticalExtension;
if (cap_1130) {
cap_1170 = cap_1130->nonCriticalExtension;
if (cap_1170) {
cap_1180 = cap_1170->nonCriticalExtension;
if (cap_1180) {
cap_11a0 = cap_1180->nonCriticalExtension;
if (cap_11a0) {
cap_1250 = cap_11a0->nonCriticalExtension;
if (cap_1250) {
cap_1260 = cap_1250->nonCriticalExtension;
if (cap_1260) {
cap_1270 = cap_1260->nonCriticalExtension;
if (cap_1270) {
cap_1280 = cap_1270->nonCriticalExtension;
if (cap_1280) {
cap_1310 = cap_1280->nonCriticalExtension;
if (cap_1310) {
CE_param = cap_1310->ce_Parameters_r13;
if (CE_param) {
ce_a_param = CE_param->ce_ModeA_r13;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (ce_a_param) {