Commit 70920ffd authored by Lionel Gauthier's avatar Lionel Gauthier

abstraction mode is OK

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5092 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent cdabfe0a
...@@ -154,9 +154,9 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, u8 eNB_id) { ...@@ -154,9 +154,9 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, u8 eNB_id) {
#endif #endif
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
if ((mac_xface->frame%100==0) || (mac_xface->frame < 10)) if ((phy_vars_ue->frame%100==0) || (phy_vars_ue->frame < 10))
msg("[PHY][ADJUST_GAIN] frame %d, clear = %d, rx_power = %d, rx_power_fil = %d, rx_power_fil_dB = %d, coef=%d, ncoef=%d, rx_total_gain_dB = %d (%d,%d,%d)\n", msg("[PHY][ADJUST_GAIN] frame %d, rx_power = %d, rx_power_fil = %d, rx_power_fil_dB = %d, coef=%d, ncoef=%d, rx_total_gain_dB = %d (%d,%d,%d)\n",
mac_xface->frame,clear,rx_power,rx_power_fil,rx_power_fil_dB,coef,ncoef,phy_vars_ue->rx_total_gain_dB, phy_vars_ue->frame,rx_power,rx_power_fil,rx_power_fil_dB,coef,ncoef,phy_vars_ue->rx_total_gain_dB,
TARGET_RX_POWER,MAX_RF_GAIN,MIN_RF_GAIN); TARGET_RX_POWER,MAX_RF_GAIN,MIN_RF_GAIN);
#endif //DEBUG_PHY #endif //DEBUG_PHY
......
...@@ -69,11 +69,11 @@ ...@@ -69,11 +69,11 @@
#define MAX_NUM_CHANNEL_BITS (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE #define MAX_NUM_CHANNEL_BITS (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE
#define MAX_NUM_RE (14*1200) #define MAX_NUM_RE (14*1200)
#define SI_RNTI 0xffff #define SI_RNTI (rnti_t)0xffff
#define M_RNTI 0xfffd #define M_RNTI (rnti_t)0xfffd
#define P_RNTI 0xfffe #define P_RNTI (rnti_t)0xfffe
#define CBA_RNTI 0xfff4 #define CBA_RNTI (rnti_t)0xfff4
#define C_RNTI 0x1234 #define C_RNTI (rnti_t)0x1234
#define PMI_2A_11 0 #define PMI_2A_11 0
#define PMI_2A_1m1 1 #define PMI_2A_1m1 1
...@@ -677,9 +677,9 @@ typedef struct { ...@@ -677,9 +677,9 @@ typedef struct {
/// Position of first CCE of the dci /// Position of first CCE of the dci
unsigned int nCCE; unsigned int nCCE;
/// flag to indicate that this is a RA response /// flag to indicate that this is a RA response
uint8_t ra_flag; boolean_t ra_flag;
/// rnti /// rnti
uint16_t rnti; rnti_t rnti;
/// Format /// Format
DCI_format_t format; DCI_format_t format;
/// DCI pdu /// DCI pdu
......
...@@ -261,7 +261,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -261,7 +261,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) { int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
unsigned int success=0; unsigned int success=0;
u8 eNB,UE_id,i,j,number_of_cards=1; u8 eNB,UE_id,i,j,number_of_cards_l=1;
u32 ulsch_errors=0; u32 ulsch_errors=0;
u32 ulsch_round_attempts[4]={0,0,0,0},ulsch_round_errors[4]={0,0,0,0}; u32 ulsch_round_attempts[4]={0,0,0,0},ulsch_round_errors[4]={0,0,0,0};
u32 harq_pid_ul, harq_pid_dl; u32 harq_pid_ul, harq_pid_dl;
...@@ -277,9 +277,9 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) { ...@@ -277,9 +277,9 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
phy_vars_eNB->total_system_throughput = 0;//phy_vars_eNB->eNB_UE_stats[UE_id].total_transmitted_bits + phy_vars_eNB->total_system_throughput; phy_vars_eNB->total_system_throughput = 0;//phy_vars_eNB->eNB_UE_stats[UE_id].total_transmitted_bits + phy_vars_eNB->total_system_throughput;
// } // }
for (eNB=0;eNB<number_of_cards;eNB++) { for (eNB=0;eNB<number_of_cards_l;eNB++) {
len += sprintf(&buffer[len],"[eNB PROC] eNB %d/%d Frame %d: RX Gain %d dB, I0 %d dBm (%d,%d) dB \n", len += sprintf(&buffer[len],"[eNB PROC] eNB %d/%d Frame %d: RX Gain %d dB, I0 %d dBm (%d,%d) dB \n",
eNB,number_of_cards, eNB,number_of_cards_l,
phy_vars_eNB->frame, phy_vars_eNB->frame,
phy_vars_eNB->rx_total_gain_eNB_dB, phy_vars_eNB->rx_total_gain_eNB_dB,
phy_vars_eNB->PHY_measurements_eNB[eNB].n0_power_tot_dBm, phy_vars_eNB->PHY_measurements_eNB[eNB].n0_power_tot_dBm,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -67,47 +67,6 @@ ...@@ -67,47 +67,6 @@
#define CH_OFFSET 0x0004 #define CH_OFFSET 0x0004
#define CH_SHIFT 2 #define CH_SHIFT 2
#ifdef MESH
//# define MAX_RB_MOBILE NB_RB_MAX * ( MAX_MANAGED_RG_PER_MOBILE + MAX_MOBILES_PER_RG - 1 )
//# define MAX_RAB_MOBILE NB_RAB_MAX * ( MAX_MANAGED_RG_PER_MOBILE + MAX_MOBILES_PER_RG - 1 )
//# define MAX_RB_RG MAX_RB_MOBILE //NB_RB_MAX * MAX_MOBILES_PER_RG
//# define MAX_RAB_RG (NB_RB_MAX+1) * (MAX_MOBILES_PER_RG + 1)
//# define MAX_RAB MAX_RAB_RG
//# define MAX_RB MAX_RB_RG
#else
//# define MAX_RB_MOBILE NB_RB_MAX * MAX_MANAGED_RG_PER_MOBILE
//# define MAX_RAB_MOBILE NB_RAB_MAX * MAX_MANAGED_RG_PER_MOBILE
//# define MAX_RB_RG NB_RB_MAX * MAX_MOBILES_PER_RG
//# define MAX_RAB_RG NB_RB_MAX * MAX_MOBILES_PER_RG
//# ifdef NODE_RG
//# define MAX_RAB MAX_RAB_RG
//# define MAX_RB MAX_RB_RG
//# else
//# // ifdef NODE_MT
//# // define MAX_RAB MAX_RAB_MOBILE
//# // define MAX_RB MAX_RB_MOBILE
//# //else
//# //error NODE_RG or NODE_MT must be defined
//# //endif
//# endif
#endif //MESH
// RLC_MODE
# define RLC_NONE (rlc_mode_t)0
# define RLC_MODE_AM (rlc_mode_t)1
# define RLC_MODE_TM (rlc_mode_t)2
# define RLC_MODE_UM (rlc_mode_t)3
//E_R
# define E_R_RLC_ER_RELEASE 1
# define E_R_RLC_ER_MODIFICATION 2
# define E_R_RLC_ER_RE_ESTABLISHMENT 4
# define E_R_RLC_ER_STOP 8
# define E_R_RLC_ER_CONTINUE 16
# define E_R_RLC_ER_NONE 0
// RLC_AM_SEND_MRW // RLC_AM_SEND_MRW
# define SEND_MRW_OFF 15 # define SEND_MRW_OFF 15
# define SEND_MRW_ON 240 # define SEND_MRW_ON 240
...@@ -134,7 +93,8 @@ ...@@ -134,7 +93,8 @@
# endif # endif
# endif # endif
#define UNUSED_PARAM_MBMS_SESSION_ID 0
#define UNUSED_PARAM_MBMS_SERVICE_ID 0
#ifdef USER_MODE #ifdef USER_MODE
#define printk printf #define printk printf
......
...@@ -32,18 +32,20 @@ typedef unsigned int tb_size_t; ...@@ -32,18 +32,20 @@ typedef unsigned int tb_size_t;
typedef u16_t rb_id_t; typedef u16_t rb_id_t;
typedef u16_t srb_id_t; typedef u16_t srb_id_t;
typedef u32_t frame_t; typedef u32_t frame_t;
typedef s32_t sframe_t;
typedef u32_t sub_frame_t; typedef u32_t sub_frame_t;
typedef u8_t module_id_t; typedef u8_t module_id_t;
typedef s8_t smodule_id_t;
typedef unsigned int mui_t; typedef unsigned int mui_t;
typedef unsigned int confirm_t; typedef unsigned int confirm_t;
typedef unsigned int rb_type_t;
typedef unsigned int logical_chan_id_t; typedef unsigned int logical_chan_id_t;
typedef unsigned int num_tb_t; typedef unsigned int num_tb_t;
typedef unsigned int crc_t; typedef unsigned int crc_t;
typedef unsigned int rlc_tx_status_t; typedef unsigned int rlc_tx_status_t;
typedef unsigned int rlc_mode_t;
typedef s16_t rlc_sn_t; typedef s16_t rlc_sn_t;
typedef u16_t rlc_usn_t; typedef u16_t rlc_usn_t;
typedef u16_t pdcp_sn_t;
typedef u32_t pdcp_hfn_t;
typedef int traffic_type_t; typedef int traffic_type_t;
typedef u32_t mbms_session_id_t; typedef u32_t mbms_session_id_t;
typedef u16_t mbms_service_id_t; typedef u16_t mbms_service_id_t;
...@@ -56,6 +58,25 @@ typedef unsigned short crc16_t; ...@@ -56,6 +58,25 @@ typedef unsigned short crc16_t;
typedef unsigned int crc32_t; typedef unsigned int crc32_t;
typedef signed char boolean_t; typedef signed char boolean_t;
#if !defined(TRUE)
#define TRUE (boolean_t)0x01
#endif
#if !defined(FALSE)
#define FALSE (boolean_t)0x00
#endif
typedef enum link_direction_e {
UNKNOWN_DIR = 0,
DIR_UPLINK = 1,
DIR_DOWNLINK = 2
} link_direction_t;
typedef enum rb_type_e {
UNKNOWN_RADIO_BEARER = 0,
SIGNALLING_RADIO_BEARER = 1,
RADIO_ACCESS_BEARER = 2
} rb_type_t;
typedef enum MBMS_flag_e { typedef enum MBMS_flag_e {
MBMS_FLAG_NO = 0, MBMS_FLAG_NO = 0,
......
...@@ -29,11 +29,6 @@ ...@@ -29,11 +29,6 @@
# define ACTION_MBMS_ADD 10 # define ACTION_MBMS_ADD 10
# define ACTION_MBMS_MODIFY 11 # define ACTION_MBMS_MODIFY 11
# define UPLINK 1
# define DOWNLINK 2
# define SIGNALLING_RADIO_BEARER 1
# define RADIO_ACCESS_BEARER 2
# define MOBILE 7 # define MOBILE 7
// equipment type // equipment type
......
...@@ -203,7 +203,6 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) { ...@@ -203,7 +203,6 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
char* enb_ipv4_address_for_S1U = NULL; char* enb_ipv4_address_for_S1U = NULL;
char* enb_interface_name_for_S1_MME = NULL; char* enb_interface_name_for_S1_MME = NULL;
char* enb_ipv4_address_for_S1_MME = NULL; char* enb_ipv4_address_for_S1_MME = NULL;
char *astring = NULL;
char *address = NULL; char *address = NULL;
char *cidr = NULL; char *cidr = NULL;
......
...@@ -472,7 +472,7 @@ typedef struct{ ...@@ -472,7 +472,7 @@ typedef struct{
/// NDI from last UL scheduling /// NDI from last UL scheduling
uint8_t oldNDI_UL[8]; uint8_t oldNDI_UL[8];
/// Flag to indicate UL has been scheduled at least once /// Flag to indicate UL has been scheduled at least once
int ul_active; boolean_t ul_active;
// PHY interface info // PHY interface info
...@@ -536,7 +536,7 @@ typedef struct{ ...@@ -536,7 +536,7 @@ typedef struct{
typedef struct { typedef struct {
/// Flag to indicate this process is active /// Flag to indicate this process is active
u8 RA_active; boolean_t RA_active;
/// Size of DCI for RA-Response (bytes) /// Size of DCI for RA-Response (bytes)
u8 RA_dci_size_bytes1; u8 RA_dci_size_bytes1;
/// Size of DCI for RA-Response (bits) /// Size of DCI for RA-Response (bits)
...@@ -1129,9 +1129,9 @@ void init_ue_sched_info(void); ...@@ -1129,9 +1129,9 @@ void init_ue_sched_info(void);
void add_ue_ulsch_info (module_id_t module_idP, module_id_t ue_mod_idP, sub_frame_t subframe,UE_ULSCH_STATUS status); void add_ue_ulsch_info (module_id_t module_idP, module_id_t ue_mod_idP, sub_frame_t subframe,UE_ULSCH_STATUS status);
void add_ue_dlsch_info (module_id_t module_idP, module_id_t ue_mod_idP, sub_frame_t subframe,UE_DLSCH_STATUS status); void add_ue_dlsch_info (module_id_t module_idP, module_id_t ue_mod_idP, sub_frame_t subframe,UE_DLSCH_STATUS status);
module_id_t find_UE_id (module_id_t module_idP, rnti_t rnti) ; module_id_t find_UE_id (module_id_t module_idP, rnti_t rnti) ;
u16 find_UE_RNTI (module_id_t module_idP, module_id_t ue_mod_idP); rnti_t find_UE_RNTI (module_id_t module_idP, module_id_t ue_mod_idP);
u8 find_active_UEs (module_id_t module_idP); u8 find_active_UEs (module_id_t module_idP);
u8 is_UE_active (module_id_t module_idP, module_id_t ue_mod_idP ); boolean_t is_UE_active (module_id_t module_idP, module_id_t ue_mod_idP );
u8 find_ulgranted_UEs(module_id_t module_idP); u8 find_ulgranted_UEs(module_id_t module_idP);
u8 find_dlgranted_UEs(module_id_t module_idP); u8 find_dlgranted_UEs(module_id_t module_idP);
u8 process_ue_cqi (module_id_t module_idP, module_id_t ue_mod_idP); u8 process_ue_cqi (module_id_t module_idP, module_id_t ue_mod_idP);
...@@ -1343,13 +1343,13 @@ BSR_SHORT *get_bsr_short(module_id_t module_idP, u8 bsr_len); ...@@ -1343,13 +1343,13 @@ BSR_SHORT *get_bsr_short(module_id_t module_idP, u8 bsr_len);
*/ */
BSR_LONG * get_bsr_long(module_id_t module_idP, u8 bsr_len); BSR_LONG * get_bsr_long(module_id_t module_idP, u8 bsr_len);
/*! \fn int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid) /*! \fn boolean_t update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid)
\brief get the rlc stats and update the bsr level for each lcid \brief get the rlc stats and update the bsr level for each lcid
\param[in] Mod_id instance of the UE \param[in] Mod_id instance of the UE
\param[in] frame Frame index \param[in] frame Frame index
\param[in] lcid logical channel identifier \param[in] lcid logical channel identifier
*/ */
int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcgid); boolean_t update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcgid);
/*! \fn locate (int *table, int size, int value) /*! \fn locate (int *table, int size, int value)
\brief locate the BSR level in the table as defined in 36.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. \brief locate the BSR level in the table as defined in 36.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.
......
...@@ -199,8 +199,8 @@ void initiate_ra_proc(module_id_t module_idP, frame_t frameP, u16 preamble_index ...@@ -199,8 +199,8 @@ void initiate_ra_proc(module_id_t module_idP, frame_t frameP, u16 preamble_index
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Initiating RA procedure for preamble index %d\n",module_idP,frameP,preamble_index); LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Initiating RA procedure for preamble index %d\n",module_idP,frameP,preamble_index);
for (i=0;i<NB_RA_PROC_MAX;i++) { for (i=0;i<NB_RA_PROC_MAX;i++) {
if (eNB_mac_inst[module_idP].RA_template[i].RA_active==0) { if (eNB_mac_inst[module_idP].RA_template[i].RA_active==FALSE) {
eNB_mac_inst[module_idP].RA_template[i].RA_active=1; eNB_mac_inst[module_idP].RA_template[i].RA_active=TRUE;
eNB_mac_inst[module_idP].RA_template[i].generate_rar=1; eNB_mac_inst[module_idP].RA_template[i].generate_rar=1;
eNB_mac_inst[module_idP].RA_template[i].generate_Msg4=0; eNB_mac_inst[module_idP].RA_template[i].generate_Msg4=0;
eNB_mac_inst[module_idP].RA_template[i].wait_ack_Msg4=0; eNB_mac_inst[module_idP].RA_template[i].wait_ack_Msg4=0;
...@@ -224,7 +224,7 @@ void cancel_ra_proc(module_id_t module_idP, frame_t frameP, rnti_t rnti) { ...@@ -224,7 +224,7 @@ void cancel_ra_proc(module_id_t module_idP, frame_t frameP, rnti_t rnti) {
for (i=0;i<NB_RA_PROC_MAX;i++) { for (i=0;i<NB_RA_PROC_MAX;i++) {
if (rnti == eNB_mac_inst[module_idP].RA_template[i].rnti) { if (rnti == eNB_mac_inst[module_idP].RA_template[i].rnti) {
eNB_mac_inst[module_idP].RA_template[i].RA_active=0; eNB_mac_inst[module_idP].RA_template[i].RA_active=FALSE;
eNB_mac_inst[module_idP].RA_template[i].generate_rar=0; eNB_mac_inst[module_idP].RA_template[i].generate_rar=0;
eNB_mac_inst[module_idP].RA_template[i].generate_Msg4=0; eNB_mac_inst[module_idP].RA_template[i].generate_Msg4=0;
eNB_mac_inst[module_idP].RA_template[i].wait_ack_Msg4=0; eNB_mac_inst[module_idP].RA_template[i].wait_ack_Msg4=0;
...@@ -251,7 +251,7 @@ void terminate_ra_proc(module_id_t module_idP,frame_t frameP,rnti_t rnti,unsigne ...@@ -251,7 +251,7 @@ void terminate_ra_proc(module_id_t module_idP,frame_t frameP,rnti_t rnti,unsigne
eNB_mac_inst[module_idP].RA_template[i].rnti, rnti, eNB_mac_inst[module_idP].RA_template[i].rnti, rnti,
eNB_mac_inst[module_idP].RA_template[i].RA_active); eNB_mac_inst[module_idP].RA_template[i].RA_active);
if ((eNB_mac_inst[module_idP].RA_template[i].rnti==rnti) && if ((eNB_mac_inst[module_idP].RA_template[i].rnti==rnti) &&
(eNB_mac_inst[module_idP].RA_template[i].RA_active==1)) { (eNB_mac_inst[module_idP].RA_template[i].RA_active==TRUE)) {
payload_ptr = parse_ulsch_header(msg3,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,msg3_len); payload_ptr = parse_ulsch_header(msg3,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,msg3_len);
LOG_D(MAC,"[eNB %d][RAPROC] Frame %d Received CCCH: length %d, offset %d\n", LOG_D(MAC,"[eNB %d][RAPROC] Frame %d Received CCCH: length %d, offset %d\n",
...@@ -307,16 +307,16 @@ module_id_t find_UE_id(module_id_t module_idP, rnti_t rnti) { ...@@ -307,16 +307,16 @@ module_id_t find_UE_id(module_id_t module_idP, rnti_t rnti) {
} }
u16 find_UE_RNTI(module_id_t module_idP, module_id_t ue_mod_idP) { rnti_t find_UE_RNTI(module_id_t module_idP, module_id_t ue_mod_idP) {
return (eNB_mac_inst[module_idP].UE_template[ue_mod_idP].rnti); return (eNB_mac_inst[module_idP].UE_template[ue_mod_idP].rnti);
} }
u8 is_UE_active(module_id_t module_idP, module_id_t ue_mod_idP ){ boolean_t is_UE_active(module_id_t module_idP, module_id_t ue_mod_idP ){
if (eNB_mac_inst[module_idP].UE_template[ue_mod_idP].rnti !=0 ) if (eNB_mac_inst[module_idP].UE_template[ue_mod_idP].rnti !=0 )
return 1; return TRUE;
else else
return 0 ; return FALSE ;
} }
u8 find_active_UEs(module_id_t module_idP){ u8 find_active_UEs(module_id_t module_idP){
...@@ -326,7 +326,7 @@ u8 find_active_UEs(module_id_t module_idP){ ...@@ -326,7 +326,7 @@ u8 find_active_UEs(module_id_t module_idP){
for (ue_mod_id=0;ue_mod_id<NUMBER_OF_UE_MAX;ue_mod_id++) { for (ue_mod_id=0;ue_mod_id<NUMBER_OF_UE_MAX;ue_mod_id++) {
if (((rnti=eNB_mac_inst[module_idP].UE_template[ue_mod_id].rnti) !=0)&&(eNB_mac_inst[module_idP].UE_template[ue_mod_id].ul_active==1)){ if (((rnti=eNB_mac_inst[module_idP].UE_template[ue_mod_id].rnti) !=0)&&(eNB_mac_inst[module_idP].UE_template[ue_mod_id].ul_active==TRUE)){
if (mac_xface->get_eNB_UE_stats(module_idP,rnti) != NULL){ // check at the phy enb_ue state for this rnti if (mac_xface->get_eNB_UE_stats(module_idP,rnti) != NULL){ // check at the phy enb_ue state for this rnti
nb_active_ue++; nb_active_ue++;
...@@ -369,7 +369,7 @@ u8 find_num_active_UEs_in_cbagroup(module_id_t module_idP, unsigned char group_i ...@@ -369,7 +369,7 @@ u8 find_num_active_UEs_in_cbagroup(module_id_t module_idP, unsigned char group_i
for (UE_id=group_id;UE_id<NUMBER_OF_UE_MAX;UE_id+=eNB_mac_inst[module_idP].num_active_cba_groups) { for (UE_id=group_id;UE_id<NUMBER_OF_UE_MAX;UE_id+=eNB_mac_inst[module_idP].num_active_cba_groups) {
if (((rnti=eNB_mac_inst[module_idP].UE_template[UE_id].rnti) !=0) && if (((rnti=eNB_mac_inst[module_idP].UE_template[UE_id].rnti) !=0) &&
(eNB_mac_inst[module_idP].UE_template[UE_id].ul_active==1) && (eNB_mac_inst[module_idP].UE_template[UE_id].ul_active==TRUE) &&
(mac_get_rrc_status(module_idP,1,UE_id) > RRC_CONNECTED)){ (mac_get_rrc_status(module_idP,1,UE_id) > RRC_CONNECTED)){
// && (UE_is_to_be_scheduled(module_idP,UE_id))) // && (UE_is_to_be_scheduled(module_idP,UE_id)))
// check at the phy enb_ue state for this rnti // check at the phy enb_ue state for this rnti
...@@ -383,9 +383,9 @@ u8 find_num_active_UEs_in_cbagroup(module_id_t module_idP, unsigned char group_i ...@@ -383,9 +383,9 @@ u8 find_num_active_UEs_in_cbagroup(module_id_t module_idP, unsigned char group_i
return(nb_ue_in_pusch); return(nb_ue_in_pusch);
} }
#endif #endif
s8 add_new_ue(module_id_t enb_mod_idP, u16 rntiP) { s8 add_new_ue(module_id_t enb_mod_idP, rnti_t rntiP) {
module_id_t ue_mod_id; module_id_t ue_mod_id;
int j; int j;
for (ue_mod_id=0;ue_mod_id<NUMBER_OF_UE_MAX;ue_mod_id++) { for (ue_mod_id=0;ue_mod_id<NUMBER_OF_UE_MAX;ue_mod_id++) {
if (eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].rnti == 0) { if (eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].rnti == 0) {
...@@ -415,7 +415,7 @@ s8 mac_remove_ue(module_id_t enb_mod_idP, module_id_t ue_mod_idP) { ...@@ -415,7 +415,7 @@ s8 mac_remove_ue(module_id_t enb_mod_idP, module_id_t ue_mod_idP) {
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_idP].ul_SR = 0; eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_idP].ul_SR = 0;
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_idP].rnti = 0; eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_idP].rnti = 0;
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_idP].ul_active = 0; eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_idP].ul_active = FALSE;
eNB_ulsch_info[enb_mod_idP][ue_mod_idP].rnti = 0; eNB_ulsch_info[enb_mod_idP][ue_mod_idP].rnti = 0;
eNB_ulsch_info[enb_mod_idP][ue_mod_idP].status = S_UL_NONE; eNB_ulsch_info[enb_mod_idP][ue_mod_idP].status = S_UL_NONE;
eNB_dlsch_info[enb_mod_idP][ue_mod_idP].rnti = 0; eNB_dlsch_info[enb_mod_idP][ue_mod_idP].rnti = 0;
...@@ -511,12 +511,12 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header, ...@@ -511,12 +511,12 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header,
void SR_indication(module_id_t enb_mod_idP, frame_t frameP, rnti_t rntiP, sub_frame_t subframeP) { void SR_indication(module_id_t enb_mod_idP, frame_t frameP, rnti_t rntiP, sub_frame_t subframeP) {
s8 ue_mod_id = find_UE_id(enb_mod_idP, rntiP); smodule_id_t ue_mod_id = find_UE_id(enb_mod_idP, rntiP);
if (ue_mod_id >= 0) { if (ue_mod_id >= 0) {
LOG_D(MAC,"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d \n",enb_mod_idP,rntiP,frameP,subframeP, ue_mod_id); LOG_D(MAC,"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d \n",enb_mod_idP,rntiP,frameP,subframeP, ue_mod_id);
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].ul_SR = 1; eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].ul_SR = 1;
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].ul_active = 1; eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].ul_active = TRUE;
} else { } else {
AssertFatal(0, "find_UE_id(%u,rnti %d) not found", enb_mod_idP, rntiP); AssertFatal(0, "find_UE_id(%u,rnti %d) not found", enb_mod_idP, rntiP);
} }
...@@ -602,7 +602,7 @@ void rx_sdu(module_id_t enb_mod_idP,frame_t frameP,rnti_t rntiP,u8 *sdu, u16 sdu ...@@ -602,7 +602,7 @@ void rx_sdu(module_id_t enb_mod_idP,frame_t frameP,rnti_t rntiP,u8 *sdu, u16 sdu
LOG_D(MAC,"[eNB %d] Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d(%d) \n", LOG_D(MAC,"[eNB %d] Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d(%d) \n",
enb_mod_idP,frameP, rx_lengths[i], ue_mod_id, rx_lcids[i], rx_lcids[i]); enb_mod_idP,frameP, rx_lengths[i], ue_mod_id, rx_lcids[i], rx_lcids[i]);
mac_rlc_data_ind(enb_mod_idP,ue_mod_id, frameP,1,RLC_MBMS_NO, mac_rlc_data_ind(enb_mod_idP,ue_mod_id, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,
rx_lcids[i], rx_lcids[i],
(char *)payload_ptr, (char *)payload_ptr,
rx_lengths[i], rx_lengths[i],
...@@ -628,7 +628,7 @@ void rx_sdu(module_id_t enb_mod_idP,frame_t frameP,rnti_t rntiP,u8 *sdu, u16 sdu ...@@ -628,7 +628,7 @@ void rx_sdu(module_id_t enb_mod_idP,frame_t frameP,rnti_t rntiP,u8 *sdu, u16 sdu
enb_mod_idP,frameP, rx_lengths[i], ue_mod_id,rx_lcids[i],rx_lcids[i]); enb_mod_idP,frameP, rx_lengths[i], ue_mod_id,rx_lcids[i],rx_lcids[i]);
if ((rx_lengths[i] <SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0) ) { // MAX SIZE OF transport block if ((rx_lengths[i] <SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0) ) { // MAX SIZE OF transport block
mac_rlc_data_ind(enb_mod_idP,ue_mod_id, frameP,1,RLC_MBMS_NO, mac_rlc_data_ind(enb_mod_idP,ue_mod_id, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,
DTCH, DTCH,
(char *)payload_ptr, (char *)payload_ptr,
rx_lengths[i], rx_lengths[i],
...@@ -969,6 +969,7 @@ void add_common_dci(DCI_PDU *DCI_pdu, ...@@ -969,6 +969,7 @@ void add_common_dci(DCI_PDU *DCI_pdu,
DCI_pdu->Num_common_dci++; DCI_pdu->Num_common_dci++;
LOG_D(MAC,"add common dci format %d for rnti %d \n",dci_fmt,rnti);
} }
void add_ue_spec_dci(DCI_PDU *DCI_pdu,void *pdu,rnti_t rnti,unsigned char dci_size_bytes,unsigned char aggregation,unsigned char dci_size_bits,unsigned char dci_fmt,u8 ra_flag) { void add_ue_spec_dci(DCI_PDU *DCI_pdu,void *pdu,rnti_t rnti,unsigned char dci_size_bytes,unsigned char aggregation,unsigned char dci_size_bits,unsigned char dci_fmt,u8 ra_flag) {
...@@ -1453,7 +1454,7 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1453,7 +1454,7 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
module_idP,frameP,MTCH,TBS, module_idP,frameP,MTCH,TBS,
TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch); TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch);
rlc_status = mac_rlc_status_ind(module_idP,0,frameP,1,RLC_MBMS_YES,MTCH+ (maxDRB + 3) * MAX_MOBILES_PER_RG, rlc_status = mac_rlc_status_ind(module_idP,0,frameP,ENB_FLAG_YES,MBMS_FLAG_YES,MTCH+ (maxDRB + 3) * MAX_MOBILES_PER_RG,
TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch); TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch);
//printf("frameP %d, subframeP %d, rlc_status.bytes_in_buffer is %d\n",frameP,subframeP, rlc_status.bytes_in_buffer); //printf("frameP %d, subframeP %d, rlc_status.bytes_in_buffer is %d\n",frameP,subframeP, rlc_status.bytes_in_buffer);
...@@ -1461,10 +1462,10 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) ...@@ -1461,10 +1462,10 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
LOG_I(MAC,"[eNB %d][MBMS USER-PLANE], Frame %d, MTCH->MCH, Requesting %d bytes from RLC (header len mtch %d)\n", LOG_I(MAC,"[eNB %d][MBMS USER-PLANE], Frame %d, MTCH->MCH, Requesting %d bytes from RLC (header len mtch %d)\n",
module_idP,frameP,TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch,header_len_mtch); module_idP,frameP,TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch,header_len_mtch);
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0, frameP, 1, RLC_MBMS_YES, sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,
MTCH + (maxDRB + 3) * MAX_MOBILES_PER_RG, MTCH + (maxDRB + 3) * MAX_MOBILES_PER_RG,
(char*)&mch_buffer[sdu_length_total]); (char*)&mch_buffer[sdu_length_total]);
//sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,frameP, RLC_MBMS_NO, MTCH+(MAX_NUM_RB*(NUMBER_OF_UE_MAX+1)), (char*)&mch_buffer[sdu_length_total]); //sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,frameP, MBMS_FLAG_NO, MTCH+(MAX_NUM_RB*(NUMBER_OF_UE_MAX+1)), (char*)&mch_buffer[sdu_length_total]);
LOG_I(MAC,"[eNB %d][MBMS USER-PLANE] Got %d bytes for MTCH %d\n",module_idP,sdu_lengths[num_sdus],MTCH); LOG_I(MAC,"[eNB %d][MBMS USER-PLANE] Got %d bytes for MTCH %d\n",module_idP,sdu_lengths[num_sdus],MTCH);
eNB_mac_inst[module_idP].mtch_active=1; eNB_mac_inst[module_idP].mtch_active=1;
sdu_lcids[num_sdus] = MTCH; sdu_lcids[num_sdus] = MTCH;
...@@ -1597,7 +1598,7 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un ...@@ -1597,7 +1598,7 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un
for (i=0;i<NB_RA_PROC_MAX;i++) { for (i=0;i<NB_RA_PROC_MAX;i++) {
if (RA_template[i].RA_active == 1) { if (RA_template[i].RA_active == TRUE) {
LOG_I(MAC,"[eNB %d][RAPROC] RA %d is active (generate RAR %d, generate_Msg4 %d, wait_ack_Msg4 %d, rnti %x)\n", LOG_I(MAC,"[eNB %d][RAPROC] RA %d is active (generate RAR %d, generate_Msg4 %d, wait_ack_Msg4 %d, rnti %x)\n",
module_idP,i,RA_template[i].generate_rar,RA_template[i].generate_Msg4,RA_template[i].wait_ack_Msg4, RA_template[i].rnti); module_idP,i,RA_template[i].generate_rar,RA_template[i].generate_Msg4,RA_template[i].wait_ack_Msg4, RA_template[i].rnti);
...@@ -1886,7 +1887,7 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un ...@@ -1886,7 +1887,7 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un
RA_template[i].generate_Msg4=0; RA_template[i].generate_Msg4=0;
RA_template[i].generate_Msg4_dci=1; RA_template[i].generate_Msg4_dci=1;
RA_template[i].wait_ack_Msg4=1; RA_template[i].wait_ack_Msg4=1;
RA_template[i].RA_active = 0; RA_template[i].RA_active = FALSE;
lcid=0; lcid=0;
if ((TBsize - rrc_sdu_length - msg4_header) <= 2) { if ((TBsize - rrc_sdu_length - msg4_header) <= 2) {
...@@ -2002,7 +2003,7 @@ void schedule_ulsch(module_id_t module_idP, frame_t frameP,unsigned char coopera ...@@ -2002,7 +2003,7 @@ void schedule_ulsch(module_id_t module_idP, frame_t frameP,unsigned char coopera
// not sure about the break (can there be more than 1 active RA procedure?) // not sure about the break (can there be more than 1 active RA procedure?)
for (i=0;i<NB_RA_PROC_MAX;i++) { for (i=0;i<NB_RA_PROC_MAX;i++) {
if ((eNB_mac_inst[module_idP].RA_template[i].RA_active == 1) && if ((eNB_mac_inst[module_idP].RA_template[i].RA_active == TRUE) &&
(eNB_mac_inst[module_idP].RA_template[i].generate_rar == 0) && (eNB_mac_inst[module_idP].RA_template[i].generate_rar == 0) &&
(eNB_mac_inst[module_idP].RA_template[i].Msg3_subframe == sched_subframe)) { (eNB_mac_inst[module_idP].RA_template[i].Msg3_subframe == sched_subframe)) {
first_rb++; first_rb++;
...@@ -3216,7 +3217,7 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP ...@@ -3216,7 +3217,7 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP
else { else {
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d, subframeP %d : Msg4 acknowledged\n",module_idP,frameP,subframeP); LOG_I(MAC,"[eNB %d][RAPROC] Frame %d, subframeP %d : Msg4 acknowledged\n",module_idP,frameP,subframeP);
eNB_mac_inst[module_idP].RA_template[i].wait_ack_Msg4=0; eNB_mac_inst[module_idP].RA_template[i].wait_ack_Msg4=0;
eNB_mac_inst[module_idP].RA_template[i].RA_active=0; eNB_mac_inst[module_idP].RA_template[i].RA_active=FALSE;
} }
} }
} }
...@@ -3818,8 +3819,8 @@ void schedule_ue_spec(module_id_t module_idP, ...@@ -3818,8 +3819,8 @@ void schedule_ue_spec(module_id_t module_idP,
module_idP, module_idP,
ue_mod_id, ue_mod_id,
frameP, frameP,
1, ENB_FLAG_YES,
RLC_MBMS_NO, MBMS_FLAG_NO,
DCCH, DCCH,
(TBS-ta_len-header_len_dcch)); // transport block set size (TBS-ta_len-header_len_dcch)); // transport block set size
...@@ -3830,8 +3831,8 @@ void schedule_ue_spec(module_id_t module_idP, ...@@ -3830,8 +3831,8 @@ void schedule_ue_spec(module_id_t module_idP,
module_idP, module_idP,
ue_mod_id, ue_mod_id,
frameP, frameP,
1, ENB_FLAG_YES,
RLC_MBMS_NO, MBMS_FLAG_NO,
DCCH, DCCH,
(char *)&dlsch_buffer[sdu_lengths[0]]); (char *)&dlsch_buffer[sdu_lengths[0]]);
...@@ -3858,8 +3859,8 @@ void schedule_ue_spec(module_id_t module_idP, ...@@ -3858,8 +3859,8 @@ void schedule_ue_spec(module_id_t module_idP,
module_idP, module_idP,
ue_mod_id, ue_mod_id,
frameP, frameP,
1, ENB_FLAG_YES,
RLC_MBMS_NO, MBMS_FLAG_NO,
DCCH+1, DCCH+1,
(TBS-ta_len-header_len_dcch-sdu_length_total)); // transport block set size less allocations for timing advance and (TBS-ta_len-header_len_dcch-sdu_length_total)); // transport block set size less allocations for timing advance and
// DCCH SDU // DCCH SDU
...@@ -3871,8 +3872,8 @@ void schedule_ue_spec(module_id_t module_idP, ...@@ -3871,8 +3872,8 @@ void schedule_ue_spec(module_id_t module_idP,
module_idP, module_idP,
ue_mod_id, ue_mod_id,
frameP, frameP,
1, ENB_FLAG_YES,
RLC_MBMS_NO, MBMS_FLAG_NO,
DCCH+1, DCCH+1,
(char *)&dlsch_buffer[sdu_lengths[0]]); (char *)&dlsch_buffer[sdu_lengths[0]]);
...@@ -3897,8 +3898,8 @@ void schedule_ue_spec(module_id_t module_idP, ...@@ -3897,8 +3898,8 @@ void schedule_ue_spec(module_id_t module_idP,
module_idP, module_idP,
ue_mod_id, ue_mod_id,
frameP, frameP,
1, ENB_FLAG_YES,
RLC_MBMS_NO, MBMS_FLAG_NO,
DTCH, DTCH,
TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch);
...@@ -3910,8 +3911,8 @@ void schedule_ue_spec(module_id_t module_idP, ...@@ -3910,8 +3911,8 @@ void schedule_ue_spec(module_id_t module_idP,
module_idP, module_idP,
ue_mod_id, ue_mod_id,
frameP, frameP,
1, ENB_FLAG_YES,
RLC_MBMS_NO, MBMS_FLAG_NO,
DTCH, DTCH,
(char*)&dlsch_buffer[sdu_length_total]); (char*)&dlsch_buffer[sdu_length_total]);
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include "defs.h" #include "defs.h"
#include "extern.h" #include "extern.h"
#include "assertions.h"
#include "PHY_INTERFACE/extern.h" #include "PHY_INTERFACE/extern.h"
#include "PHY_INTERFACE/defs.h" #include "PHY_INTERFACE/defs.h"
#include "PHY/defs.h" #include "PHY/defs.h"
...@@ -68,11 +69,6 @@ ...@@ -68,11 +69,6 @@
#include "SCHED/defs.h" #include "SCHED/defs.h"
//#ifdef BIGPHYSAREA
//extern void *bigphys_malloc(int);
//#endif
/***********************************************************************/ /***********************************************************************/
void dl_phy_sync_success(module_id_t module_idP, void dl_phy_sync_success(module_id_t module_idP,
frame_t frameP, frame_t frameP,
......
...@@ -106,7 +106,7 @@ void store_dlsch_buffer (module_id_t Mod_id, ...@@ -106,7 +106,7 @@ void store_dlsch_buffer (module_id_t Mod_id,
for(i=0;i< MAX_NUM_LCID; i++){ // loop over all the logical channels for(i=0;i< MAX_NUM_LCID; i++){ // loop over all the logical channels
rlc_status = mac_rlc_status_ind(Mod_id,next_ue, frameP,1,RLC_MBMS_NO,i,0 ); rlc_status = mac_rlc_status_ind(Mod_id,next_ue, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,i,0 );
eNB_mac_inst[Mod_id].UE_template[next_ue].dl_buffer_info[i] = rlc_status.bytes_in_buffer; //storing the dlsch buffer for each logical channel eNB_mac_inst[Mod_id].UE_template[next_ue].dl_buffer_info[i] = rlc_status.bytes_in_buffer; //storing the dlsch buffer for each logical channel
eNB_mac_inst[Mod_id].UE_template[next_ue].dl_pdus_in_buffer[i] = rlc_status.pdus_in_buffer; eNB_mac_inst[Mod_id].UE_template[next_ue].dl_pdus_in_buffer[i] = rlc_status.pdus_in_buffer;
eNB_mac_inst[Mod_id].UE_template[next_ue].dl_buffer_head_sdu_creation_time[i] = rlc_status.head_sdu_creation_time ; eNB_mac_inst[Mod_id].UE_template[next_ue].dl_buffer_head_sdu_creation_time[i] = rlc_status.head_sdu_creation_time ;
......
...@@ -296,7 +296,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_ind ...@@ -296,7 +296,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_ind
else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DCCH] > 0) { else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DCCH] > 0) {
// This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example) // This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example)
dcch_header_len = 2 + 2; /// SHORT Subheader + C-RNTI control element dcch_header_len = 2 + 2; /// SHORT Subheader + C-RNTI control element
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO, rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH, DCCH,
6); 6);
if (UE_mac_inst[module_idP].crnti_before_ho) if (UE_mac_inst[module_idP].crnti_before_ho)
...@@ -306,7 +306,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_ind ...@@ -306,7 +306,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_ind
LOG_D(MAC,"[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to send through PRACH(mac header len %d)\n", LOG_D(MAC,"[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to send through PRACH(mac header len %d)\n",
module_idP,frameP, rlc_status.bytes_in_buffer,dcch_header_len); module_idP,frameP, rlc_status.bytes_in_buffer,dcch_header_len);
sdu_lengths[0] = mac_rlc_data_req(eNB_indexP, module_idP,frameP,0, RLC_MBMS_NO, sdu_lengths[0] = mac_rlc_data_req(eNB_indexP, module_idP,frameP,ENB_FLAG_NO, MBMS_FLAG_NO,
DCCH, DCCH,
(char *)&ulsch_buff[0]); (char *)&ulsch_buff[0]);
...@@ -355,7 +355,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_ind ...@@ -355,7 +355,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_ind
UE_mac_inst[module_idP].RA_tx_frame,UE_mac_inst[module_idP].RA_tx_subframe); UE_mac_inst[module_idP].RA_tx_frame,UE_mac_inst[module_idP].RA_tx_subframe);
// compute backoff parameters // compute backoff parameters
if (UE_mac_inst[module_idP].RA_backoff_cnt>0) { if (UE_mac_inst[module_idP].RA_backoff_cnt>0) {
frame_diff = (s32)frameP - UE_mac_inst[module_idP].RA_backoff_frame; frame_diff = (sframe_t)frameP - UE_mac_inst[module_idP].RA_backoff_frame;
if (frame_diff < 0) if (frame_diff < 0)
frame_diff = -frame_diff; frame_diff = -frame_diff;
UE_mac_inst[module_idP].RA_backoff_cnt -= ((10*frame_diff) + (subframeP-UE_mac_inst[module_idP].RA_backoff_subframe)); UE_mac_inst[module_idP].RA_backoff_cnt -= ((10*frame_diff) + (subframeP-UE_mac_inst[module_idP].RA_backoff_subframe));
......
...@@ -367,8 +367,8 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eN ...@@ -367,8 +367,8 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eN
mac_rlc_data_ind(eNB_index, mac_rlc_data_ind(eNB_index,
module_idP, module_idP,
frameP, frameP,
0, ENB_FLAG_NO,
RLC_MBMS_NO, MBMS_FLAG_NO,
DCCH, DCCH,
(char *)payload_ptr, (char *)payload_ptr,
rx_lengths[i], rx_lengths[i],
...@@ -380,8 +380,8 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eN ...@@ -380,8 +380,8 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eN
mac_rlc_data_ind(eNB_index, mac_rlc_data_ind(eNB_index,
module_idP, module_idP,
frameP, frameP,
0, ENB_FLAG_NO,
RLC_MBMS_NO, MBMS_FLAG_NO,
DCCH1, DCCH1,
(char *)payload_ptr, (char *)payload_ptr,
rx_lengths[i], rx_lengths[i],
...@@ -401,8 +401,8 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eN ...@@ -401,8 +401,8 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eN
mac_rlc_data_ind(eNB_index, mac_rlc_data_ind(eNB_index,
module_idP, module_idP,
frameP, frameP,
0, ENB_FLAG_NO,
RLC_MBMS_NO, MBMS_FLAG_NO,
DTCH, DTCH,
(char *)payload_ptr, (char *)payload_ptr,
rx_lengths[i], rx_lengths[i],
...@@ -517,8 +517,8 @@ void ue_send_mch_sdu(module_id_t module_idP, frame_t frameP, u8 *sdu, u16 sdu_le ...@@ -517,8 +517,8 @@ void ue_send_mch_sdu(module_id_t module_idP, frame_t frameP, u8 *sdu, u16 sdu_le
0, 0,
module_idP, module_idP,
frameP, frameP,
0, ENB_FLAG_NO,
RLC_MBMS_YES, MBMS_FLAG_YES,
MTCH + (maxDRB + 3), MTCH + (maxDRB + 3),
(char *)payload_ptr, (char *)payload_ptr,
rx_lengths[i], rx_lengths[i],
...@@ -1080,14 +1080,14 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e ...@@ -1080,14 +1080,14 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] == LCID_NOT_EMPTY) { if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] == LCID_NOT_EMPTY) {
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO, rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH, DCCH,
(buflen-dcch_header_len-bsr_len-phr_len)); (buflen-dcch_header_len-bsr_len-phr_len));
LOG_D(MAC, "[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to " LOG_D(MAC, "[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to "
"send (Transport Block size %d, mac header len %d)\n", "send (Transport Block size %d, mac header len %d)\n",
module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dcch_header_len); module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dcch_header_len);
sdu_lengths[0] += mac_rlc_data_req(0, module_idP,frameP,0, RLC_MBMS_NO, sdu_lengths[0] += mac_rlc_data_req(0, module_idP,frameP,ENB_FLAG_NO, MBMS_FLAG_NO,
DCCH, DCCH,
(char *)&ulsch_buff[sdu_lengths[0]]); (char *)&ulsch_buff[sdu_lengths[0]]);
...@@ -1106,7 +1106,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e ...@@ -1106,7 +1106,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
// DCCH1 // DCCH1
if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] == LCID_NOT_EMPTY) { if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] == LCID_NOT_EMPTY) {
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO, rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH1, DCCH1,
(buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-sdu_length_total)); (buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-sdu_length_total));
...@@ -1114,7 +1114,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e ...@@ -1114,7 +1114,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
" send (Transport Block size %d, mac header len %d)\n", " send (Transport Block size %d, mac header len %d)\n",
module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dcch1_header_len); module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dcch1_header_len);
sdu_lengths[num_sdus] = mac_rlc_data_req(0, module_idP,frameP,0,RLC_MBMS_NO, sdu_lengths[num_sdus] = mac_rlc_data_req(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH1, DCCH1,
(char *)&ulsch_buff[sdu_lengths[0]]); (char *)&ulsch_buff[sdu_lengths[0]]);
sdu_length_total += sdu_lengths[num_sdus]; sdu_length_total += sdu_lengths[num_sdus];
...@@ -1140,7 +1140,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e ...@@ -1140,7 +1140,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
else else
dtch_header_len = 2;//sizeof(SCH_SUBHEADER_SHORT); dtch_header_len = 2;//sizeof(SCH_SUBHEADER_SHORT);
*/ */
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO, rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DTCH, DTCH,
buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total); buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total);
...@@ -1148,7 +1148,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e ...@@ -1148,7 +1148,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dtch_header_len, module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dtch_header_len,
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH]); UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH]);
sdu_lengths[num_sdus] = mac_rlc_data_req(0, module_idP,frameP, 0, RLC_MBMS_NO, sdu_lengths[num_sdus] = mac_rlc_data_req(0, module_idP,frameP, ENB_FLAG_NO, MBMS_FLAG_NO,
DTCH, DTCH,
(char *)&ulsch_buff[sdu_length_total]); (char *)&ulsch_buff[sdu_length_total]);
...@@ -1586,10 +1586,10 @@ u8 get_bsr_len (module_id_t module_idP, u16 buflen) { ...@@ -1586,10 +1586,10 @@ u8 get_bsr_len (module_id_t module_idP, u16 buflen) {
} }
int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcg_id){ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcg_id){
mac_rlc_status_resp_t rlc_status; mac_rlc_status_resp_t rlc_status;
u8 sr_pending = 0; boolean_t sr_pending = FALSE;
if ((lcg_id < 0) || (lcg_id > MAX_NUM_LCGID) ) if ((lcg_id < 0) || (lcg_id > MAX_NUM_LCGID) )
return sr_pending; return sr_pending;
// fixme: need a better way to reset // fixme: need a better way to reset
...@@ -1599,11 +1599,11 @@ int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcg_id){ ...@@ -1599,11 +1599,11 @@ int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcg_id){
} }
// for (lcid =0 ; lcid < MAX_NUM_LCID; lcid++) { // for (lcid =0 ; lcid < MAX_NUM_LCID; lcid++) {
if (UE_mac_inst[module_idP].scheduling_info.LCGID[lcid] == lcg_id) { if (UE_mac_inst[module_idP].scheduling_info.LCGID[lcid] == lcg_id) {
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO, rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
lcid, lcid,
0); 0);
if (rlc_status.bytes_in_buffer > 0 ) { if (rlc_status.bytes_in_buffer > 0 ) {
sr_pending = 1; sr_pending = TRUE;
UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY; UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY;
UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] += locate (BSR_TABLE,BSR_TABLE_SIZE, rlc_status.bytes_in_buffer); UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] += locate (BSR_TABLE,BSR_TABLE_SIZE, rlc_status.bytes_in_buffer);
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer; UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer;
......
...@@ -76,7 +76,7 @@ extern int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned in ...@@ -76,7 +76,7 @@ extern int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned in
* this mem_block_t to be dissected for testing purposes. For further details see test * this mem_block_t to be dissected for testing purposes. For further details see test
* code at targets/TEST/PDCP/test_pdcp.c:test_pdcp_data_req() * code at targets/TEST/PDCP/test_pdcp.c:test_pdcp_data_req()
*/ */
BOOL pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, rb_id_t rb_idP, mui_t muiP, u32 confirmP, boolean_t pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, rb_id_t rb_idP, mui_t muiP, u32 confirmP,
sdu_size_t sdu_buffer_sizeP, unsigned char* sdu_buffer_pP, u8 modeP) sdu_size_t sdu_buffer_sizeP, unsigned char* sdu_buffer_pP, u8 modeP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -131,7 +131,7 @@ BOOL pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t fram ...@@ -131,7 +131,7 @@ BOOL pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t fram
pdcp_pdu_p = get_free_mem_block(sdu_buffer_sizeP); pdcp_pdu_p = get_free_mem_block(sdu_buffer_sizeP);
if (pdcp_pdu_p != NULL) { if (pdcp_pdu_p != NULL) {
memcpy(&pdcp_pdu_p->data[0], sdu_buffer_pP, sdu_buffer_sizeP); memcpy(&pdcp_pdu_p->data[0], sdu_buffer_pP, sdu_buffer_sizeP);
rlc_status = rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, RLC_MBMS_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p); rlc_status = rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p);
} else { } else {
rlc_status = RLC_OP_STATUS_OUT_OF_RESSOURCES; rlc_status = RLC_OP_STATUS_OUT_OF_RESSOURCES;
#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD)
...@@ -291,8 +291,8 @@ BOOL pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t fram ...@@ -291,8 +291,8 @@ BOOL pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t fram
} }
BOOL pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, u8_t MBMS_flagP, rb_id_t rb_idP, sdu_size_t sdu_buffer_sizeP, \ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, MBMS_flag_t MBMS_flagP, rb_id_t rb_idP, sdu_size_t sdu_buffer_sizeP, \
mem_block_t* sdu_buffer_pP, u8 is_data_planeP) mem_block_t* sdu_buffer_pP, boolean_t is_data_planeP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
pdcp_t *pdcp_p = NULL; pdcp_t *pdcp_p = NULL;
...@@ -300,7 +300,7 @@ BOOL pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t fram ...@@ -300,7 +300,7 @@ BOOL pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t fram
mem_block_t *new_sdu_p = NULL; mem_block_t *new_sdu_p = NULL;
u8 pdcp_header_len = 0; u8 pdcp_header_len = 0;
u8 pdcp_tailer_len = 0; u8 pdcp_tailer_len = 0;
u16 sequence_number = 0; pdcp_sn_t sequence_number = 0;
u8 payload_offset = 0; u8 payload_offset = 0;
AssertFatal (enb_mod_idP >= oai_emulation.info.first_enb_local, AssertFatal (enb_mod_idP >= oai_emulation.info.first_enb_local,
...@@ -605,7 +605,7 @@ void pdcp_run (frame_t frameP, eNB_flag_t enb_flagP, module_id_t ue_mod_idP, mo ...@@ -605,7 +605,7 @@ void pdcp_run (frame_t frameP, eNB_flag_t enb_flagP, module_id_t ue_mod_idP, mo
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT);
} }
BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP, boolean_t rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
module_id_t ue_mod_idP, module_id_t ue_mod_idP,
frame_t frameP, frame_t frameP,
eNB_flag_t enb_flagP, eNB_flag_t enb_flagP,
...@@ -625,7 +625,7 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP, ...@@ -625,7 +625,7 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
long int lc_id = 0; long int lc_id = 0;
long int srb_id = 0; long int srb_id = 0;
long int mch_id = 0; long int mch_id = 0;
rlc_mode_t rlc_type = RLC_NONE; rlc_mode_t rlc_type = RLC_MODE_NONE;
DRB_Identity_t drb_id = 0; DRB_Identity_t drb_id = 0;
DRB_Identity_t *pdrb_id_p = NULL; DRB_Identity_t *pdrb_id_p = NULL;
u8 drb_sn = 0; u8 drb_sn = 0;
...@@ -637,7 +637,6 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP, ...@@ -637,7 +637,6 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
SRB_ToAddMod_t *srb_toaddmod_p = NULL; SRB_ToAddMod_t *srb_toaddmod_p = NULL;
DRB_ToAddMod_t *drb_toaddmod_p = NULL; DRB_ToAddMod_t *drb_toaddmod_p = NULL;
pdcp_t *pdcp_p = NULL; pdcp_t *pdcp_p = NULL;
module_id_t module_id = -1;
#ifdef Rel10 #ifdef Rel10
int i,j; int i,j;
...@@ -646,9 +645,9 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP, ...@@ -646,9 +645,9 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
#endif #endif
if (enb_flagP == 0) { if (enb_flagP == 0) {
LOG_D(PDCP, "[UE %d] CONFIG REQ ASN1 for eNB %d\n", ue_mod_idP, enb_mod_idP); LOG_D(PDCP, "[UE %u] CONFIG REQ ASN1 for eNB %u\n", ue_mod_idP, enb_mod_idP);
} else { } else {
LOG_D(PDCP, "[eNB %d] CONFIG REQ ASN1 for UE %d\n", enb_mod_idP, ue_mod_idP); LOG_D(PDCP, "[eNB %u] CONFIG REQ ASN1 for UE %u\n", enb_mod_idP, ue_mod_idP);
} }
// srb2add_list does not define pdcp config, we use rlc info to setup the pdcp dcch0 and dcch1 channels // srb2add_list does not define pdcp config, we use rlc info to setup the pdcp dcch0 and dcch1 channels
...@@ -784,8 +783,8 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP, ...@@ -784,8 +783,8 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
// set the applicable profile // set the applicable profile
break; break;
default: default:
LOG_W(PDCP,"[MOD_id %d][RB %d] unknown drb_toaddmod->PDCP_Config->headerCompression->present \n", LOG_W(PDCP,"[MOD_id %u/%u][RB %u] unknown drb_toaddmod->PDCP_Config->headerCompression->present \n",
module_id, drb_id); enb_mod_idP, ue_mod_idP, drb_id);
break; break;
} }
pdcp_config_req_asn1 (pdcp_p, pdcp_config_req_asn1 (pdcp_p,
...@@ -850,14 +849,14 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP, ...@@ -850,14 +849,14 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
// can set the mch_id = i // can set the mch_id = i
if (enb_flagP) { if (enb_flagP) {
rb_id = (mch_id * maxSessionPerPMCH ) + lc_id; rb_id = (mch_id * maxSessionPerPMCH ) + lc_id; // 1
if (pdcp_mbms_array_eNB[enb_mod_idP][rb_id].instanciated_instance == module_id + 1) if (pdcp_mbms_array_eNB[enb_mod_idP][mch_id][lc_id].instanciated_instance == enb_mod_idP + 1)
action = ACTION_MBMS_MODIFY; action = ACTION_MBMS_MODIFY;
else else
action = ACTION_MBMS_ADD; action = ACTION_MBMS_ADD;
} else { } else {
rb_id = (mch_id * maxSessionPerPMCH ) + lc_id + (maxDRB + 3); rb_id = (mch_id * maxSessionPerPMCH ) + lc_id + (maxDRB + 3); // 15
if (pdcp_mbms_array_ue[ue_mod_idP][rb_id].instanciated_instance == module_id + 1) if (pdcp_mbms_array_ue[ue_mod_idP][mch_id][lc_id].instanciated_instance == ue_mod_idP + 1)
action = ACTION_MBMS_MODIFY; action = ACTION_MBMS_MODIFY;
else else
action = ACTION_MBMS_ADD; action = ACTION_MBMS_ADD;
...@@ -865,24 +864,23 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP, ...@@ -865,24 +864,23 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
rlc_type = RLC_MODE_UM; pdcp_config_req_asn1 (NULL, // unused for MBMS
pdcp_config_req_asn1 (NULL,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
frameP, frameP,
enb_flagP, enb_flagP,
rlc_type, RLC_MODE_NONE,
action, action,
lc_id, lc_id,
mch_id, mch_id,
rb_id, rb_id,
0, // set to deafult 0, // unused for MBMS
0, 0, // unused for MBMS
0, 0, // unused for MBMS
security_modeP, 0, // unused for MBMS
kRRCenc_pP, NULL, // unused for MBMS
kRRCint_pP, NULL, // unused for MBMS
kUPenc_pP); NULL); // unused for MBMS
} }
} }
} }
...@@ -892,49 +890,49 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP, ...@@ -892,49 +890,49 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
} }
BOOL pdcp_config_req_asn1 (pdcp_t *pdcp_pP, boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP,
module_id_t enb_mod_idP, module_id_t enb_mod_idP,
module_id_t ue_mod_idP, module_id_t ue_mod_idP,
frame_t frameP, frame_t frameP,
eNB_flag_t enb_flagP, eNB_flag_t enb_flagP,
rlc_mode_t rlc_modeP, rlc_mode_t rlc_modeP,
u32 actionP, u32 actionP,
u16 lc_idP, u16 lc_idP,
u16 mch_idP, u16 mch_idP,
rb_id_t rb_idP, rb_id_t rb_idP,
u8 rb_snP, u8 rb_snP,
u8 rb_reportP, u8 rb_reportP,
u16 header_compression_profileP, u16 header_compression_profileP,
u8 security_modeP, u8 security_modeP,
u8 *kRRCenc_pP, u8 *kRRCenc_pP,
u8 *kRRCint_pP, u8 *kRRCint_pP,
u8 *kUPenc_pP) u8 *kUPenc_pP)
{ {
switch (actionP) { switch (actionP) {
case ACTION_ADD: case ACTION_ADD:
DevAssert(pdcp_pP != NULL); DevAssert(pdcp_pP != NULL);
pdcp_pP->instanciated_instance = 1; pdcp_pP->instanciated_instance = 1;
pdcp_pP->is_ue = (enb_flagP == 0) ? 1 : 0; pdcp_pP->is_ue = (enb_flagP == 0) ? 1 : 0;
pdcp_pP->lcid = lc_idP; pdcp_pP->lcid = lc_idP;
pdcp_pP->header_compression_profile = header_compression_profileP; pdcp_pP->header_compression_profile = header_compression_profileP;
pdcp_pP->status_report = rb_reportP; pdcp_pP->status_report = rb_reportP;
if (rb_snP == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) { if (rb_snP == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) {
pdcp_pP->seq_num_size = 7; pdcp_pP->seq_num_size = 7;
} else if (rb_snP == PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits) { } else if (rb_snP == PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits) {
pdcp_pP->seq_num_size=12; pdcp_pP->seq_num_size = 12;
} else { } else {
pdcp_pP->seq_num_size=5; pdcp_pP->seq_num_size = 5;
} }
pdcp_pP->rlc_mode = rlc_modeP; pdcp_pP->rlc_mode = rlc_modeP;
pdcp_pP->next_pdcp_tx_sn = 0; pdcp_pP->next_pdcp_tx_sn = 0;
pdcp_pP->next_pdcp_rx_sn = 0; pdcp_pP->next_pdcp_rx_sn = 0;
pdcp_pP->tx_hfn = 0; pdcp_pP->tx_hfn = 0;
pdcp_pP->rx_hfn = 0; pdcp_pP->rx_hfn = 0;
pdcp_pP->last_submitted_pdcp_rx_sn = 4095; pdcp_pP->last_submitted_pdcp_rx_sn = 4095;
pdcp_pP->first_missing_pdu = -1; pdcp_pP->first_missing_pdu = -1;
if (enb_flagP == 0) { if (enb_flagP == 0) {
LOG_I(PDCP, "[UE %d] Config request : Action ADD for eNB %d: Frame %d LCID %d (rb id %d) " LOG_I(PDCP, "[UE %d] Config request : Action ADD for eNB %d: Frame %d LCID %d (rb id %d) "
...@@ -995,7 +993,7 @@ BOOL pdcp_config_req_asn1 (pdcp_t *pdcp_pP, ...@@ -995,7 +993,7 @@ BOOL pdcp_config_req_asn1 (pdcp_t *pdcp_pP,
pdcp_pP->cipheringAlgorithm = 0xff; pdcp_pP->cipheringAlgorithm = 0xff;
pdcp_pP->integrityProtAlgorithm = 0xff; pdcp_pP->integrityProtAlgorithm = 0xff;
pdcp_pP->status_report = 0; pdcp_pP->status_report = 0;
pdcp_pP->rlc_mode = RLC_NONE; pdcp_pP->rlc_mode = RLC_MODE_NONE;
pdcp_pP->next_pdcp_tx_sn = 0; pdcp_pP->next_pdcp_tx_sn = 0;
pdcp_pP->next_pdcp_rx_sn = 0; pdcp_pP->next_pdcp_rx_sn = 0;
pdcp_pP->tx_hfn = 0; pdcp_pP->tx_hfn = 0;
...@@ -1023,6 +1021,7 @@ BOOL pdcp_config_req_asn1 (pdcp_t *pdcp_pP, ...@@ -1023,6 +1021,7 @@ BOOL pdcp_config_req_asn1 (pdcp_t *pdcp_pP,
free(pdcp_pP->kRRCenc); free(pdcp_pP->kRRCenc);
} }
break; break;
#if defined(Rel10)
case ACTION_MBMS_ADD: case ACTION_MBMS_ADD:
case ACTION_MBMS_MODIFY: case ACTION_MBMS_MODIFY:
if (enb_flagP == 0) { if (enb_flagP == 0) {
...@@ -1033,17 +1032,14 @@ BOOL pdcp_config_req_asn1 (pdcp_t *pdcp_pP, ...@@ -1033,17 +1032,14 @@ BOOL pdcp_config_req_asn1 (pdcp_t *pdcp_pP,
enb_mod_idP, ue_mod_idP, actionP == ACTION_MBMS_ADD ? "ACTION_MBMS_ADD" : "ACTION_MBMS_MODIFY", frameP, mch_idP, lc_idP, rb_idP); enb_mod_idP, ue_mod_idP, actionP == ACTION_MBMS_ADD ? "ACTION_MBMS_ADD" : "ACTION_MBMS_MODIFY", frameP, mch_idP, lc_idP, rb_idP);
} }
if (enb_flagP == 1) { if (enb_flagP == 1) {
pdcp_mbms_array_eNB[enb_mod_idP][rb_idP].instanciated_instance = 1 ; pdcp_mbms_array_eNB[enb_mod_idP][mch_idP][lc_idP].instanciated_instance = 1 ;
pdcp_mbms_array_eNB[enb_mod_idP][rb_idP].service_id = mch_idP; pdcp_mbms_array_eNB[enb_mod_idP][mch_idP][lc_idP].rb_id = rb_idP;
pdcp_mbms_array_eNB[enb_mod_idP][rb_idP].session_id = lc_idP;
pdcp_mbms_array_eNB[enb_mod_idP][rb_idP].rb_id = rb_idP;
} else { } else {
pdcp_mbms_array_eNB[ue_mod_idP][rb_idP].instanciated_instance = 1 ; pdcp_mbms_array_eNB[ue_mod_idP][mch_idP][lc_idP].instanciated_instance = 1 ;
pdcp_mbms_array_eNB[ue_mod_idP][rb_idP].service_id = mch_idP; pdcp_mbms_array_eNB[ue_mod_idP][mch_idP][lc_idP].rb_id = rb_idP;
pdcp_mbms_array_eNB[ue_mod_idP][rb_idP].session_id = lc_idP;
pdcp_mbms_array_eNB[ue_mod_idP][rb_idP].rb_id = rb_idP;
} }
break; break;
#endif
case ACTION_SET_SECURITY_MODE: case ACTION_SET_SECURITY_MODE:
pdcp_config_set_security(pdcp_pP, enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_idP, lc_idP, security_modeP, kRRCenc_pP, kRRCint_pP, kUPenc_pP); pdcp_config_set_security(pdcp_pP, enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_idP, lc_idP, security_modeP, kRRCenc_pP, kRRCint_pP, kUPenc_pP);
break; break;
...@@ -1210,9 +1206,13 @@ void pdcp_module_cleanup (void) ...@@ -1210,9 +1206,13 @@ void pdcp_module_cleanup (void)
void pdcp_layer_init(void) void pdcp_layer_init(void)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
module_id_t instance, instance2; module_id_t instance;
rb_id_t rb_id; module_id_t instance2;
int j; rb_id_t rb_id;
#if defined(Rel10)
mbms_session_id_t session_id;
mbms_service_id_t service_id;
#endif
/* /*
* Initialize SDU list * Initialize SDU list
*/ */
...@@ -1222,9 +1222,13 @@ void pdcp_layer_init(void) ...@@ -1222,9 +1222,13 @@ void pdcp_layer_init(void)
for (rb_id = 0; rb_id < NB_RB_MAX; rb_id++) { for (rb_id = 0; rb_id < NB_RB_MAX; rb_id++) {
memset(&pdcp_array_ue[instance][rb_id], 0, sizeof(pdcp_t)); memset(&pdcp_array_ue[instance][rb_id], 0, sizeof(pdcp_t));
} }
for (j = 0; j < 16*29; j++) { #if defined(Rel10)
memset(&pdcp_mbms_array_ue[instance][j], 0, sizeof(pdcp_mbms_t)); for (service_id = 0; service_id < maxServiceCount; service_id++) {
for (session_id = 0; session_id < maxSessionPerPMCH; session_id++) {
memset(&pdcp_mbms_array_ue[instance][service_id][session_id], 0, sizeof(pdcp_mbms_t));
}
} }
#endif
} }
for (instance = 0; instance < NUMBER_OF_eNB_MAX; instance++) { for (instance = 0; instance < NUMBER_OF_eNB_MAX; instance++) {
for (instance2 = 0; instance2 < NUMBER_OF_UE_MAX; instance2++) { for (instance2 = 0; instance2 < NUMBER_OF_UE_MAX; instance2++) {
...@@ -1232,9 +1236,13 @@ void pdcp_layer_init(void) ...@@ -1232,9 +1236,13 @@ void pdcp_layer_init(void)
memset(&pdcp_array_eNB[instance][instance2][rb_id], 0, sizeof(pdcp_t)); memset(&pdcp_array_eNB[instance][instance2][rb_id], 0, sizeof(pdcp_t));
} }
} }
for (j = 0; j < 16*29; j++) { #if defined(Rel10)
memset(&pdcp_mbms_array_eNB[instance][j], 0, sizeof(pdcp_mbms_t)); for (service_id = 0; service_id < maxServiceCount; service_id++) {
for (session_id = 0; session_id < maxSessionPerPMCH; session_id++) {
memset(&pdcp_mbms_array_eNB[instance][service_id][session_id], 0, sizeof(pdcp_mbms_t));
}
} }
#endif
} }
LOG_I(PDCP, "PDCP layer has been initialized\n"); LOG_I(PDCP, "PDCP layer has been initialized\n");
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
*******************************************************************************/ *******************************************************************************/
/*! \file pdcp.c /*! \file pdcp.c
* \brief pdcp interface with RLC * \brief pdcp interface with RLC, RRC
* \author Lionel GAUTHIER and Navid Nikaein * \author Lionel GAUTHIER and Navid Nikaein
* \date 2009-2012 * \date 2009-2012
* \version 1.0 * \version 1.0
...@@ -82,23 +82,16 @@ ...@@ -82,23 +82,16 @@
#include "PMCH-InfoList-r9.h" #include "PMCH-InfoList-r9.h"
#endif #endif
#ifndef FALSE
#define FALSE (0x00)
#endif
#ifndef TRUE
#define TRUE !(FALSE)
#endif
extern pthread_t pdcp_thread; extern pthread_t pdcp_thread;
extern pthread_attr_t pdcp_thread_attr; extern pthread_attr_t pdcp_thread_attr;
extern pthread_mutex_t pdcp_mutex; extern pthread_mutex_t pdcp_mutex;
extern pthread_cond_t pdcp_cond; extern pthread_cond_t pdcp_cond;
extern int pdcp_instance_cnt; extern int pdcp_instance_cnt;
int init_pdcp_thread(void); int init_pdcp_thread(void);
void cleanup_pdcp_thread(void); void cleanup_pdcp_thread(void);
typedef unsigned char BOOL;
public_pdcp(unsigned int Pdcp_stats_tx[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]); public_pdcp(unsigned int Pdcp_stats_tx[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
public_pdcp(unsigned int Pdcp_stats_tx_bytes[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]); public_pdcp(unsigned int Pdcp_stats_tx_bytes[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
...@@ -110,13 +103,13 @@ public_pdcp(unsigned int Pdcp_stats_rx_bytes_last[NB_MODULES_MAX][NB_CNX_CH][NB_ ...@@ -110,13 +103,13 @@ public_pdcp(unsigned int Pdcp_stats_rx_bytes_last[NB_MODULES_MAX][NB_CNX_CH][NB_
public_pdcp(unsigned int Pdcp_stats_rx_rate[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]); public_pdcp(unsigned int Pdcp_stats_rx_rate[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
typedef struct pdcp_t { typedef struct pdcp_t {
BOOL instanciated_instance; boolean_t instanciated_instance;
u16 header_compression_profile; u16 header_compression_profile;
/* SR: added this flag to distinguish UE/eNB instance as pdcp_run for virtual /* SR: added this flag to distinguish UE/eNB instance as pdcp_run for virtual
* mode can receive data on NETLINK for eNB while eNB_flag = 0 and for UE when eNB_flag = 1 * mode can receive data on NETLINK for eNB while eNB_flag = 0 and for UE when eNB_flag = 1
*/ */
u8 is_ue; boolean_t is_ue;
/* Configured security algorithms */ /* Configured security algorithms */
u8 cipheringAlgorithm; u8 cipheringAlgorithm;
...@@ -133,27 +126,27 @@ typedef struct pdcp_t { ...@@ -133,27 +126,27 @@ typedef struct pdcp_t {
u8 security_activated; u8 security_activated;
u8 rlc_mode; rlc_mode_t rlc_mode;
u8 status_report; u8 status_report;
u8 seq_num_size; u8 seq_num_size;
u8 lcid; logical_chan_id_t lcid;
/* /*
* Sequence number state variables * Sequence number state variables
* *
* TX and RX window * TX and RX window
*/ */
u16 next_pdcp_tx_sn; pdcp_sn_t next_pdcp_tx_sn;
u16 next_pdcp_rx_sn; pdcp_sn_t next_pdcp_rx_sn;
/* /*
* TX and RX Hyper Frame Numbers * TX and RX Hyper Frame Numbers
*/ */
u16 tx_hfn; pdcp_hfn_t tx_hfn;
u16 rx_hfn; pdcp_hfn_t rx_hfn;
/* /*
* SN of the last PDCP SDU delivered to upper layers * SN of the last PDCP SDU delivered to upper layers
*/ */
u16 last_submitted_pdcp_rx_sn; pdcp_sn_t last_submitted_pdcp_rx_sn;
/* /*
* Following array is used as a bitmap holding missing sequence * Following array is used as a bitmap holding missing sequence
...@@ -168,15 +161,12 @@ typedef struct pdcp_t { ...@@ -168,15 +161,12 @@ typedef struct pdcp_t {
short int first_missing_pdu; short int first_missing_pdu;
} pdcp_t; } pdcp_t;
#if defined(Rel10)
typedef struct pdcp_mbms_t { typedef struct pdcp_mbms_t {
BOOL instanciated_instance; boolean_t instanciated_instance;
rb_id_t rb_id;
uint16_t service_id;
uint32_t session_id; // lcid
uint16_t rb_id;
} pdcp_mbms_t; } pdcp_mbms_t;
#endif
/* /*
* Following symbolic constant alters the behaviour of PDCP * Following symbolic constant alters the behaviour of PDCP
* and makes it linked to PDCP test code under targets/TEST/PDCP/ * and makes it linked to PDCP test code under targets/TEST/PDCP/
...@@ -186,9 +176,10 @@ typedef struct pdcp_mbms_t { ...@@ -186,9 +176,10 @@ typedef struct pdcp_mbms_t {
* under targets/TEST/PDCP/ * under targets/TEST/PDCP/
*/ */
/*! \fn BOOL pdcp_data_req(module_id_t, u32_t, u8_t, rb_id_t, sdu_size_t, unsigned char*) /*! \fn boolean_t pdcp_data_req(module_id_t, u32_t, u8_t, rb_id_t, sdu_size_t, unsigned char*)
* \brief This functions handles data transfer requests coming either from RRC or from IP * \brief This functions handles data transfer requests coming either from RRC or from IP
* \param[in] module_id Module ID * \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frame Frame number * \param[in] frame Frame number
* \param[in] Shows if relevant PDCP entity is part of an eNB or a UE * \param[in] Shows if relevant PDCP entity is part of an eNB or a UE
* \param[in] rab_id Radio Bearer ID * \param[in] rab_id Radio Bearer ID
...@@ -201,12 +192,13 @@ typedef struct pdcp_mbms_t { ...@@ -201,12 +192,13 @@ typedef struct pdcp_mbms_t {
* \note None * \note None
* @ingroup _pdcp * @ingroup _pdcp
*/ */
public_pdcp(BOOL pdcp_data_req(module_id_t eNB_id, module_id_t UE_id, frame_t frame, eNB_flag_t eNB_flag, rb_id_t rb_id, mui_t muiP, u32 confirmP, \ public_pdcp(boolean_t pdcp_data_req(module_id_t eNB_id, module_id_t UE_id, frame_t frame, eNB_flag_t eNB_flag, rb_id_t rb_id, mui_t muiP, u32 confirmP, \
sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, u8 mode)); sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, u8 mode));
/*! \fn BOOL pdcp_data_ind(module_id_t, module_id_t, u32_t, u8_t, u8_t, rb_id_t, sdu_size_t, unsigned char*) /*! \fn boolean_t pdcp_data_ind(module_id_t, module_id_t, frame_t, eNB_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t)
* \brief This functions handles data transfer indications coming from RLC * \brief This functions handles data transfer indications coming from RLC
* \param[in] module_id Module ID * \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frame Frame number * \param[in] frame Frame number
* \param[in] Shows if relevant PDCP entity is part of an eNB or a UE * \param[in] Shows if relevant PDCP entity is part of an eNB or a UE
* \param[in] Tells if MBMS traffic * \param[in] Tells if MBMS traffic
...@@ -218,16 +210,18 @@ public_pdcp(BOOL pdcp_data_req(module_id_t eNB_id, module_id_t UE_id, frame_t fr ...@@ -218,16 +210,18 @@ public_pdcp(BOOL pdcp_data_req(module_id_t eNB_id, module_id_t UE_id, frame_t fr
* \note None * \note None
* @ingroup _pdcp * @ingroup _pdcp
*/ */
public_pdcp(BOOL pdcp_data_ind(module_id_t eNB_id, module_id_t UE_id, frame_t frame, eNB_flag_t eNB_flag, u8_t MBMS_flagP, rb_id_t rb_id, sdu_size_t sdu_buffer_size, public_pdcp(boolean_t pdcp_data_ind(module_id_t eNB_id, module_id_t UE_id, frame_t frame, eNB_flag_t eNB_flag, MBMS_flag_t MBMS_flagP, rb_id_t rb_id, sdu_size_t sdu_buffer_size,
mem_block_t* sdu_buffer, u8 is_data_plane)); mem_block_t* sdu_buffer, boolean_t is_data_plane));
/*! \fn void rrc_pdcp_config_req(module_id_t, rb_id_t,u8) /*! \fn void rrc_pdcp_config_req(module_id_t , module_id_t ,frame_t,eNB_flag_t,u32,rb_id_t,u8)
* \brief This functions initializes relevant PDCP entity * \brief This functions initializes relevant PDCP entity
* \param[in] module_id Module ID of relevant PDCP entity * \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] frame frame counter (TTI) * \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] eNB_flag flag indicating the node type * \param[in] frameP frame counter (TTI)
* \param[in] action flag for action: add, remove , modify * \param[in] eNB_flagP flag indicating the node type
* \param[in] rab_id Radio Bearer ID of relevant PDCP entity * \param[in] actionP flag for action: add, remove , modify
* \param[in] rb_idP Radio Bearer ID of relevant PDCP entity
* \param[in] security_modeP Radio Bearer ID of relevant PDCP entity
* \return none * \return none
* \note None * \note None
* @ingroup _pdcp * @ingroup _pdcp
...@@ -242,7 +236,8 @@ public_pdcp(void rrc_pdcp_config_req (module_id_t enb_idP, ...@@ -242,7 +236,8 @@ public_pdcp(void rrc_pdcp_config_req (module_id_t enb_idP,
/*! \fn bool rrc_pdcp_config_asn1_req (module_id_t module_id, frame_t frame, eNB_flag_t eNB_flag, SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t* drb2add_list, DRB_ToReleaseList_t* drb2release_list) /*! \fn bool rrc_pdcp_config_asn1_req (module_id_t module_id, frame_t frame, eNB_flag_t eNB_flag, SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t* drb2add_list, DRB_ToReleaseList_t* drb2release_list)
* \brief Function for RRC to configure a Radio Bearer. * \brief Function for RRC to configure a Radio Bearer.
* \param[in] module_id Virtualized module identifier. * \param[in] enb_mod_idP Virtualized enb module identifier.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frame Frame index. * \param[in] frame Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0) * \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] index index of UE or eNB depending on the eNB_flag * \param[in] index index of UE or eNB depending on the eNB_flag
...@@ -256,7 +251,7 @@ public_pdcp(void rrc_pdcp_config_req (module_id_t enb_idP, ...@@ -256,7 +251,7 @@ public_pdcp(void rrc_pdcp_config_req (module_id_t enb_idP,
* \return A status about the processing, OK or error code. * \return A status about the processing, OK or error code.
*/ */
public_pdcp( public_pdcp(
BOOL rrc_pdcp_config_asn1_req (module_id_t eNB_idP, boolean_t rrc_pdcp_config_asn1_req (module_id_t eNB_idP,
module_id_t ue_idP, module_id_t ue_idP,
frame_t frameP, frame_t frameP,
eNB_flag_t eNB_flagP, eNB_flag_t eNB_flagP,
...@@ -272,9 +267,11 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t eNB_idP, ...@@ -272,9 +267,11 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t eNB_idP,
#endif #endif
)); ));
/*! \fn BOOL pdcp_config_req_asn1 (module_id_t module_id, frame_t frame, eNB_flag_t eNB_flag, u32 action, rb_id_t rb_id, u8 rb_sn, u8 rb_report, u16 header_compression_profile, u8 security_mode) /*! \fn boolean_t pdcp_config_req_asn1 (module_id_t module_id, frame_t frame, eNB_flag_t eNB_flag, u32 action, rb_id_t rb_id, u8 rb_sn, u8 rb_report, u16 header_compression_profile, u8 security_mode)
* \brief Function for RRC to configure a Radio Bearer. * \brief Function for RRC to configure a Radio Bearer.
* \param[in] module_id Virtualized module identifier. * \param[in] pdcp_pP Pointer on PDCP structure.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frame Frame index. * \param[in] frame Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0) * \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] action add, remove, modify a RB * \param[in] action add, remove, modify a RB
...@@ -288,7 +285,7 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t eNB_idP, ...@@ -288,7 +285,7 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t eNB_idP,
* \param[in] kUPenc User-Plane encryption key * \param[in] kUPenc User-Plane encryption key
* \return A status about the processing, OK or error code. * \return A status about the processing, OK or error code.
*/ */
public_pdcp(BOOL pdcp_config_req_asn1 (pdcp_t *pdcp_pP, public_pdcp(boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP,
module_id_t enb_idP, module_id_t enb_idP,
module_id_t ue_idP, module_id_t ue_idP,
frame_t frameP, frame_t frameP,
...@@ -315,10 +312,12 @@ public_pdcp(BOOL pdcp_config_req_asn1 (pdcp_t *pdcp_pP, ...@@ -315,10 +312,12 @@ public_pdcp(BOOL pdcp_config_req_asn1 (pdcp_t *pdcp_pP,
*/ */
//public_pdcp(void rrc_pdcp_config_release (module_id_t, rb_id_t);) //public_pdcp(void rrc_pdcp_config_release (module_id_t, rb_id_t);)
/*! \fn void pdcp_run(u32_t, u8_t) /*! \fn void pdcp_run(frame_t, eNB_flag_t, module_id_t,module_id_t)
* \brief Runs PDCP entity to let it handle incoming/outgoing SDUs * \brief Runs PDCP entity to let it handle incoming/outgoing SDUs
* \param[in] frame Frame number * \param[in] frame Frame number
* \param[in] eNB_flag Indicates if this PDCP entity belongs to an eNB or to a UE * \param[in] eNB_flag Indicates if this PDCP entity belongs to an eNB or to a UE
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \return none * \return none
* \note None * \note None
* @ingroup _pdcp * @ingroup _pdcp
...@@ -372,7 +371,7 @@ struct pdcp_netlink_element_s { ...@@ -372,7 +371,7 @@ struct pdcp_netlink_element_s {
* into pdcp.missing_pdus for every missing PDU * into pdcp.missing_pdus for every missing PDU
*/ */
typedef struct pdcp_missing_pdu_info_t { typedef struct pdcp_missing_pdu_info_t {
u16 sequence_number; pdcp_sn_t sequence_number;
} pdcp_missing_pdu_info_t; } pdcp_missing_pdu_info_t;
#endif #endif
...@@ -387,8 +386,10 @@ typedef struct pdcp_missing_pdu_info_t { ...@@ -387,8 +386,10 @@ typedef struct pdcp_missing_pdu_info_t {
protected_pdcp(signed int pdcp_2_nas_irq;) protected_pdcp(signed int pdcp_2_nas_irq;)
protected_pdcp(pdcp_t pdcp_array_ue[NUMBER_OF_UE_MAX][NB_RB_MAX];) protected_pdcp(pdcp_t pdcp_array_ue[NUMBER_OF_UE_MAX][NB_RB_MAX];)
protected_pdcp(pdcp_t pdcp_array_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][NB_RB_MAX];) protected_pdcp(pdcp_t pdcp_array_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][NB_RB_MAX];)
public_pdcp(pdcp_mbms_t pdcp_mbms_array_ue[NUMBER_OF_UE_MAX][16*29];) // MAX_SERVICEx MAX_SESSION #if defined(Rel10)
public_pdcp(pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][16*29];) // MAX_SERVICEx MAX_SESSION public_pdcp(pdcp_mbms_t pdcp_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_pdcp(pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
#endif
protected_pdcp(sdu_size_t pdcp_output_sdu_bytes_to_write;) protected_pdcp(sdu_size_t pdcp_output_sdu_bytes_to_write;)
protected_pdcp(sdu_size_t pdcp_output_header_bytes_to_write;) protected_pdcp(sdu_size_t pdcp_output_header_bytes_to_write;)
protected_pdcp(list_t pdcp_sdu_list;) protected_pdcp(list_t pdcp_sdu_list;)
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include "pdcp.h" #include "pdcp.h"
#include "pdcp_primitives.h" #include "pdcp_primitives.h"
extern BOOL util_mark_nth_bit_of_octet(u8_t* octet, u8_t index); extern boolean_t util_mark_nth_bit_of_octet(u8_t* octet, u8_t index);
/* /*
* Parses data/control field out of buffer of User Plane PDCP Data PDU with * Parses data/control field out of buffer of User Plane PDCP Data PDU with
...@@ -129,7 +129,7 @@ u8 pdcp_get_sequence_number_of_pdu_with_SRB_sn(unsigned char* pdu_buffer) ...@@ -129,7 +129,7 @@ u8 pdcp_get_sequence_number_of_pdu_with_SRB_sn(unsigned char* pdu_buffer)
* @param pdu_buffer PDCP PDU buffer * @param pdu_buffer PDCP PDU buffer
* @return TRUE on success, FALSE otherwise * @return TRUE on success, FALSE otherwise
*/ */
BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu_buffer, \ boolean_t pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu_buffer, \
pdcp_control_plane_data_pdu_header* pdu) pdcp_control_plane_data_pdu_header* pdu)
{ {
if (pdu_buffer == NULL || pdu == NULL) if (pdu_buffer == NULL || pdu == NULL)
...@@ -150,7 +150,7 @@ BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu ...@@ -150,7 +150,7 @@ BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu
* @param pdu_buffer PDCP PDU buffer * @param pdu_buffer PDCP PDU buffer
* @return TRUE on success, FALSE otherwise * @return TRUE on success, FALSE otherwise
*/ */
BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_buffer, \ boolean_t pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_buffer, \
pdcp_user_plane_data_pdu_header_with_long_sn* pdu) pdcp_user_plane_data_pdu_header_with_long_sn* pdu)
{ {
if (pdu_buffer == NULL || pdu == NULL) if (pdu_buffer == NULL || pdu == NULL)
...@@ -182,7 +182,7 @@ BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_b ...@@ -182,7 +182,7 @@ BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_b
* @param pdu A status report header * @param pdu A status report header
* @return TRUE on success, FALSE otherwise * @return TRUE on success, FALSE otherwise
*/ */
BOOL pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \ boolean_t pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
u8 bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu) u8 bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu)
{ {
if (pdu_buffer == NULL || pdu == NULL) if (pdu_buffer == NULL || pdu == NULL)
......
...@@ -9,12 +9,6 @@ ...@@ -9,12 +9,6 @@
#ifndef PDCP_PRIMITIVES_H #ifndef PDCP_PRIMITIVES_H
#define PDCP_PRIMITIVES_H #define PDCP_PRIMITIVES_H
#ifndef TRUE
#define TRUE 0x01
#define FALSE 0x00
typedef unsigned char BOOL;
#endif
/* /*
* 3GPP TS 36.323 V10.1.0 (2011-03) * 3GPP TS 36.323 V10.1.0 (2011-03)
*/ */
...@@ -130,7 +124,7 @@ u8 pdcp_get_sequence_number_of_pdu_with_SRB_sn(unsigned char* pdu_buffer); ...@@ -130,7 +124,7 @@ u8 pdcp_get_sequence_number_of_pdu_with_SRB_sn(unsigned char* pdu_buffer);
* @param pdu_buffer PDCP PDU buffer * @param pdu_buffer PDCP PDU buffer
* @return TRUE on success, FALSE otherwise * @return TRUE on success, FALSE otherwise
*/ */
BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu_buffer, \ boolean_t pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu_buffer, \
pdcp_control_plane_data_pdu_header* pdu); pdcp_control_plane_data_pdu_header* pdu);
/* /*
* Fills the incoming buffer with the fields of the header for long SN (RLC UM and AM) * Fills the incoming buffer with the fields of the header for long SN (RLC UM and AM)
...@@ -138,7 +132,7 @@ BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu ...@@ -138,7 +132,7 @@ BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu
* @param pdu_buffer PDCP PDU buffer * @param pdu_buffer PDCP PDU buffer
* @return TRUE on success, FALSE otherwise * @return TRUE on success, FALSE otherwise
*/ */
BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_buffer, \ boolean_t pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_buffer, \
pdcp_user_plane_data_pdu_header_with_long_sn* pdu); pdcp_user_plane_data_pdu_header_with_long_sn* pdu);
/* /*
...@@ -150,7 +144,7 @@ BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_b ...@@ -150,7 +144,7 @@ BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_b
* @param pdu A status report header * @param pdu A status report header
* @return TRUE on success, FALSE otherwise * @return TRUE on success, FALSE otherwise
*/ */
BOOL pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \ boolean_t pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
u8 bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu); u8 bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu);
int pdcp_netlink_dequeue_element(module_id_t enb_mod_idP, module_id_t ue_mod_idP, eNB_flag_t eNB_flagP, int pdcp_netlink_dequeue_element(module_id_t enb_mod_idP, module_id_t ue_mod_idP, eNB_flag_t eNB_flagP,
......
...@@ -40,9 +40,9 @@ ...@@ -40,9 +40,9 @@
/* /*
* Initializes sequence numbering state * Initializes sequence numbering state
* @param pdcp_entity The PDCP entity to be initialized * @param pdcp_entity The PDCP entity to be initialized
* @return BOOL TRUE on success, FALSE otherwise * @return boolean_t TRUE on success, FALSE otherwise
*/ */
BOOL pdcp_init_seq_numbers(pdcp_t* pdcp_entity) boolean_t pdcp_init_seq_numbers(pdcp_t* pdcp_entity)
{ {
if (pdcp_entity == NULL) if (pdcp_entity == NULL)
return FALSE; return FALSE;
...@@ -64,7 +64,7 @@ BOOL pdcp_init_seq_numbers(pdcp_t* pdcp_entity) ...@@ -64,7 +64,7 @@ BOOL pdcp_init_seq_numbers(pdcp_t* pdcp_entity)
return TRUE; return TRUE;
} }
BOOL pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity) boolean_t pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity)
{ {
if (pdcp_entity == NULL) if (pdcp_entity == NULL)
return FALSE; return FALSE;
...@@ -81,7 +81,7 @@ BOOL pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity) ...@@ -81,7 +81,7 @@ BOOL pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity)
/** /**
* Check if SN number is in the range according to SN size * Check if SN number is in the range according to SN size
*/ */
BOOL pdcp_is_seq_num_valid(u16 seq_num, u8 seq_num_size) boolean_t pdcp_is_seq_num_valid(u16 seq_num, u8 seq_num_size)
{ {
if (seq_num >= 0 && seq_num <= pdcp_calculate_max_seq_num_for_given_size(seq_num_size)) if (seq_num >= 0 && seq_num <= pdcp_calculate_max_seq_num_for_given_size(seq_num_size))
return TRUE; return TRUE;
...@@ -121,7 +121,7 @@ u16 pdcp_get_next_tx_seq_number(pdcp_t* pdcp_entity) ...@@ -121,7 +121,7 @@ u16 pdcp_get_next_tx_seq_number(pdcp_t* pdcp_entity)
return pdcp_seq_num; return pdcp_seq_num;
} }
BOOL pdcp_advance_rx_window(pdcp_t* pdcp_entity) boolean_t pdcp_advance_rx_window(pdcp_t* pdcp_entity)
{ {
if (pdcp_is_seq_num_size_valid(pdcp_entity) == FALSE) if (pdcp_is_seq_num_size_valid(pdcp_entity) == FALSE)
return FALSE; return FALSE;
...@@ -146,7 +146,7 @@ BOOL pdcp_advance_rx_window(pdcp_t* pdcp_entity) ...@@ -146,7 +146,7 @@ BOOL pdcp_advance_rx_window(pdcp_t* pdcp_entity)
* @return 1 if SN is okay, 0 otherwise * @return 1 if SN is okay, 0 otherwise
* XXX Reordering window should also be handled here * XXX Reordering window should also be handled here
*/ */
BOOL pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity) boolean_t pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity)
{ {
LOG_D(PDCP, "Incoming RX Seq # is %04d\n", seq_num); LOG_D(PDCP, "Incoming RX Seq # is %04d\n", seq_num);
...@@ -187,7 +187,7 @@ BOOL pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity) ...@@ -187,7 +187,7 @@ BOOL pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity)
} }
} }
BOOL pdcp_mark_current_pdu_as_received(u16 seq_num, pdcp_t* pdcp_entity) boolean_t pdcp_mark_current_pdu_as_received(u16 seq_num, pdcp_t* pdcp_entity)
{ {
/* /*
* Incoming sequence number and PDCP entity were already * Incoming sequence number and PDCP entity were already
......
...@@ -43,17 +43,17 @@ ...@@ -43,17 +43,17 @@
* @param pdcp_entity The PDCP entity to be initialized * @param pdcp_entity The PDCP entity to be initialized
* @return none * @return none
*/ */
BOOL pdcp_init_seq_numbers(pdcp_t* pdcp_entity); boolean_t pdcp_init_seq_numbers(pdcp_t* pdcp_entity);
/** /**
* Checks if incoming PDCP entitiy pointer and relevant sequence number size is valid * Checks if incoming PDCP entitiy pointer and relevant sequence number size is valid
* @return TRUE (0x01) if it is valid, FALSE (0x00) otherwise * @return TRUE (0x01) if it is valid, FALSE (0x00) otherwise
*/ */
BOOL pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity); boolean_t pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity);
/** /**
* Check if SN number is in the range according to SN size * Check if SN number is in the range according to SN size
* @return TRUE if it is valid, FALSE otherwise * @return TRUE if it is valid, FALSE otherwise
*/ */
BOOL pdcp_is_seq_num_valid(u16 seq_num, u8 seq_num_size); boolean_t pdcp_is_seq_num_valid(u16 seq_num, u8 seq_num_size);
/** /**
* Returns the maximum allowed sequence number value for given size of SN field * Returns the maximum allowed sequence number value for given size of SN field
* @return Max sequence number value * @return Max sequence number value
...@@ -66,16 +66,16 @@ u16 pdcp_get_next_tx_seq_number(pdcp_t* pdcp_entity); ...@@ -66,16 +66,16 @@ u16 pdcp_get_next_tx_seq_number(pdcp_t* pdcp_entity);
/** /**
* Advances the RX window state of given PDCP entity upon successfull receipt of a SDU * Advances the RX window state of given PDCP entity upon successfull receipt of a SDU
*/ */
BOOL pdcp_advance_rx_window(pdcp_t* pdcp_entity); boolean_t pdcp_advance_rx_window(pdcp_t* pdcp_entity);
/** /**
* Checks if incoming PDU has a sequence number in accordance with the RX window * Checks if incoming PDU has a sequence number in accordance with the RX window
* @return TRUE if it is valid, FALSE otherwise * @return TRUE if it is valid, FALSE otherwise
*/ */
BOOL pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity); boolean_t pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity);
/** /**
* Updates missing PDU bitmap with incoming sequence number * Updates missing PDU bitmap with incoming sequence number
* @return TRUE if successful, FALSE otherwise * @return TRUE if successful, FALSE otherwise
*/ */
BOOL pdcp_mark_current_pdu_as_received(u16 seq_num, pdcp_t* pdcp_entity); boolean_t pdcp_mark_current_pdu_as_received(u16 seq_num, pdcp_t* pdcp_entity);
#endif #endif
...@@ -25,18 +25,18 @@ ...@@ -25,18 +25,18 @@
Forums : http://forums.eurecom.fsr/openairinterface Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*******************************************************************************/ *******************************************************************************/
/*! \file pdcp_thread.c /*! \file pdcp_thread.c
* \brief * \brief
* \author F. Kaltenberger * \author F. Kaltenberger
* \date 2013 * \date 2013
* \version 0.1 * \version 0.1
* \company Eurecom * \company Eurecom
* \email: florian.kaltenberger@eurecom.fr * \email: florian.kaltenberger@eurecom.fr
* \note * \note
* \warning * \warning
*/ */
#include <pthread.h> #include <pthread.h>
//#include <inttypes.h> //#include <inttypes.h>
...@@ -48,112 +48,108 @@ ...@@ -48,112 +48,108 @@
#define OPENAIR_THREAD_STACK_SIZE 8192 #define OPENAIR_THREAD_STACK_SIZE 8192
#define OPENAIR_THREAD_PRIORITY 255 #define OPENAIR_THREAD_PRIORITY 255
extern int oai_exit; extern int oai_exit;
extern char UE_flag; extern char UE_flag;
pthread_t pdcp_thread; pthread_t pdcp_thread;
pthread_attr_t pdcp_thread_attr; pthread_attr_t pdcp_thread_attr;
pthread_mutex_t pdcp_mutex; pthread_mutex_t pdcp_mutex;
pthread_cond_t pdcp_cond; pthread_cond_t pdcp_cond;
int pdcp_instance_cnt; int pdcp_instance_cnt;
static void *pdcp_thread_main(void* param); static void *pdcp_thread_main(void* param);
static void *pdcp_thread_main(void* param) { static void *pdcp_thread_main(void* param) {
//u8 eNB_flag = *((u8*)param);
u8 eNB_flag = !UE_flag; u8 eNB_flag = !UE_flag;
LOG_I(PDCP,"This is pdcp_thread eNB_flag = %d\n",eNB_flag); LOG_I(PDCP,"This is pdcp_thread eNB_flag = %d\n",eNB_flag);
while (!oai_exit) { while (!oai_exit) {
if (pthread_mutex_lock(&pdcp_mutex) != 0) { if (pthread_mutex_lock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error locking mutex.\n"); LOG_E(PDCP,"Error locking mutex.\n");
} }
else { else {
while (pdcp_instance_cnt < 0) { while (pdcp_instance_cnt < 0) {
pthread_cond_wait(&pdcp_cond,&pdcp_mutex); pthread_cond_wait(&pdcp_cond,&pdcp_mutex);
} }
if (pthread_mutex_unlock(&pdcp_mutex) != 0) { if (pthread_mutex_unlock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error unlocking mutex.\n"); LOG_E(PDCP,"Error unlocking mutex.\n");
} }
} }
if (oai_exit) break; if (oai_exit) break;
if (eNB_flag) { if (eNB_flag) {
pdcp_run(PHY_vars_eNB_g[0]->frame, eNB_flag, PHY_vars_eNB_g[0]->Mod_id, 0); pdcp_run(PHY_vars_eNB_g[0]->frame, eNB_flag, PHY_vars_eNB_g[0]->Mod_id, 0);
LOG_D(PDCP,"Calling pdcp_run (eNB) for frame %d\n",PHY_vars_eNB_g[0]->frame); LOG_D(PDCP,"Calling pdcp_run (eNB) for frame %d\n",PHY_vars_eNB_g[0]->frame);
} }
else { else {
pdcp_run(PHY_vars_UE_g[0]->frame, eNB_flag, 0, PHY_vars_UE_g[0]->Mod_id); pdcp_run(PHY_vars_UE_g[0]->frame, eNB_flag, 0, PHY_vars_UE_g[0]->Mod_id);
LOG_D(PDCP,"Calling pdcp_run (UE) for frame %d\n",PHY_vars_UE_g[0]->frame); LOG_D(PDCP,"Calling pdcp_run (UE) for frame %d\n",PHY_vars_UE_g[0]->frame);
} }
if (pthread_mutex_lock(&pdcp_mutex) != 0) {
if (pthread_mutex_lock(&pdcp_mutex) != 0) { LOG_E(PDCP,"Error locking mutex.\n");
LOG_E(PDCP,"Error locking mutex.\n"); }
} else {
else { pdcp_instance_cnt--;
pdcp_instance_cnt--; if (pthread_mutex_unlock(&pdcp_mutex) != 0) {
if (pthread_mutex_unlock(&pdcp_mutex) != 0) { LOG_E(PDCP,"Error unlocking mutex.\n");
LOG_E(PDCP,"Error unlocking mutex.\n"); }
} }
}
} }
return(NULL); return(NULL);
} }
int init_pdcp_thread(void) { int init_pdcp_thread(void) {
int error_code; int error_code;
struct sched_param p; struct sched_param p;
pthread_attr_init (&pdcp_thread_attr);
pthread_attr_setstacksize(&pdcp_thread_attr,OPENAIR_THREAD_STACK_SIZE);
//attr_dlsch_threads.priority = 1;
pthread_attr_init (&pdcp_thread_attr); p.sched_priority = OPENAIR_THREAD_PRIORITY;
pthread_attr_setstacksize(&pdcp_thread_attr,OPENAIR_THREAD_STACK_SIZE); pthread_attr_setschedparam (&pdcp_thread_attr, &p);
//attr_dlsch_threads.priority = 1;
p.sched_priority = OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&pdcp_thread_attr, &p);
#ifndef RTAI_ISNT_POSIX #ifndef RTAI_ISNT_POSIX
pthread_attr_setschedpolicy (&pdcp_thread_attr, SCHED_FIFO); pthread_attr_setschedpolicy (&pdcp_thread_attr, SCHED_FIFO);
#endif #endif
pthread_mutex_init(&pdcp_mutex,NULL); pthread_mutex_init(&pdcp_mutex,NULL);
pthread_cond_init(&pdcp_cond,NULL); pthread_cond_init(&pdcp_cond,NULL);
pdcp_instance_cnt = -1; pdcp_instance_cnt = -1;
LOG_I(PDCP,"Allocating PDCP thread\n"); LOG_I(PDCP,"Allocating PDCP thread\n");
error_code = pthread_create(&pdcp_thread, error_code = pthread_create(&pdcp_thread,
&pdcp_thread_attr, &pdcp_thread_attr,
pdcp_thread_main, pdcp_thread_main,
(void*)NULL); (void*)NULL);
if (error_code!= 0) { if (error_code!= 0) {
LOG_I(PDCP,"Could not allocate PDCP thread, error %d\n",error_code); LOG_I(PDCP,"Could not allocate PDCP thread, error %d\n",error_code);
return(error_code); return(error_code);
} }
else { else {
LOG_I(PDCP,"Allocate PDCP thread successful\n"); LOG_I(PDCP,"Allocate PDCP thread successful\n");
} }
return(0);
return(0);
} }
void cleanup_pdcp_thread(void) { void cleanup_pdcp_thread(void) {
void *status; void *status_p = NULL;
LOG_I(PDCP,"Scheduling PDCP thread to exit\n"); LOG_I(PDCP,"Scheduling PDCP thread to exit\n");
pdcp_instance_cnt = 0; pdcp_instance_cnt = 0;
if (pthread_cond_signal(&pdcp_cond) != 0) if (pthread_cond_signal(&pdcp_cond) != 0)
LOG_I(PDCP,"ERROR pthread_cond_signal\n"); LOG_I(PDCP,"ERROR pthread_cond_signal\n");
else else
LOG_I(PDCP,"Signalled PDCP thread to exit\n"); LOG_I(PDCP,"Signalled PDCP thread to exit\n");
pthread_join(pdcp_thread,&status); pthread_join(pdcp_thread,&status_p);
LOG_I(PDCP,"PDCP thread exited\n"); LOG_I(PDCP,"PDCP thread exited\n");
pthread_cond_destroy(&pdcp_cond); pthread_cond_destroy(&pdcp_cond);
pthread_mutex_destroy(&pdcp_mutex); pthread_mutex_destroy(&pdcp_mutex);
......
...@@ -131,7 +131,7 @@ void util_print_binary_representation(unsigned char* message, u8_t octet) ...@@ -131,7 +131,7 @@ void util_print_binary_representation(unsigned char* message, u8_t octet)
* @param index Index of bit to be set * @param index Index of bit to be set
* @return TRUE on success, FALSE otherwise * @return TRUE on success, FALSE otherwise
*/ */
BOOL util_mark_nth_bit_of_octet(u8_t* octet, u8_t index) boolean_t util_mark_nth_bit_of_octet(u8_t* octet, u8_t index)
{ {
u8_t mask = 0x80; u8_t mask = 0x80;
......
...@@ -76,6 +76,6 @@ void util_print_binary_representation(unsigned char* message, u8_t octet); ...@@ -76,6 +76,6 @@ void util_print_binary_representation(unsigned char* message, u8_t octet);
* @param index Index * @param index Index
* @return TRUE on success, FALSE otherwise * @return TRUE on success, FALSE otherwise
*/ */
BOOL util_mark_nth_bit_of_octet(u8_t* octet, u8_t index); boolean_t util_mark_nth_bit_of_octet(u8_t* octet, u8_t index);
#endif // PDCP_UTIL_H #endif // PDCP_UTIL_H
...@@ -125,7 +125,7 @@ void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_fla ...@@ -125,7 +125,7 @@ void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_fla
rlc_pP->output_sdu_size_to_write, rlc_pP->output_sdu_size_to_write,
rlc_pP->output_sdu_in_construction); rlc_pP->output_sdu_in_construction);
#else #else
rlc_data_ind (rlc_pP->enb_module_id, rlc_pP->ue_module_id, frameP, eNB_flagP, RLC_MBMS_NO, rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write, rlc_pP->output_sdu_in_construction, rlc_pP->is_data_plane); rlc_data_ind (rlc_pP->enb_module_id, rlc_pP->ue_module_id, frameP, eNB_flagP, MBMS_FLAG_NO, rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write, rlc_pP->output_sdu_in_construction, rlc_pP->is_data_plane);
#endif #endif
rlc_pP->output_sdu_in_construction = NULL; rlc_pP->output_sdu_in_construction = NULL;
} else { } else {
......
...@@ -64,7 +64,7 @@ rlc_tm_send_sdu (rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flag, u8_t error_i ...@@ -64,7 +64,7 @@ rlc_tm_send_sdu (rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flag, u8_t error_i
memcpy (&rlcP->output_sdu_in_construction->data[rlcP->output_sdu_size_to_write], srcP, length_in_bytes); memcpy (&rlcP->output_sdu_in_construction->data[rlcP->output_sdu_size_to_write], srcP, length_in_bytes);
rlc_data_ind (rlcP->enb_module_id, rlcP->ue_module_id, frame, eNB_flag, RLC_MBMS_NO, rlcP->rb_id, length_in_bytes, rlcP->output_sdu_in_construction, rlcP->is_data_plane); rlc_data_ind (rlcP->enb_module_id, rlcP->ue_module_id, frame, eNB_flag, MBMS_FLAG_NO, rlcP->rb_id, length_in_bytes, rlcP->output_sdu_in_construction, rlcP->is_data_plane);
rlcP->output_sdu_in_construction = NULL; rlcP->output_sdu_in_construction = NULL;
} else { } else {
msg ("[RLC_TM %p][SEND_SDU] ERROR OUTPUT SDU IS NULL\n", rlcP); msg ("[RLC_TM %p][SEND_SDU] ERROR OUTPUT SDU IS NULL\n", rlcP);
...@@ -182,7 +182,6 @@ rlc_tm_mac_data_indication (void *rlcP, u32_t frame, u8_t eNB_flag, struct mac_d ...@@ -182,7 +182,6 @@ rlc_tm_mac_data_indication (void *rlcP, u32_t frame, u8_t eNB_flag, struct mac_d
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_tm_entity_t *l_rlc = (rlc_tm_entity_t *) rlcP; rlc_tm_entity_t *l_rlc = (rlc_tm_entity_t *) rlcP;
mem_block_t *tb;
if (data_indP.data.nb_elements > 0) { if (data_indP.data.nb_elements > 0) {
LOG_D(RLC, "[RLC_TM][%s][MOD %02u/%02u][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n", LOG_D(RLC, "[RLC_TM][%s][MOD %02u/%02u][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n",
......
...@@ -51,12 +51,12 @@ void config_req_rlc_um (frame_t frameP, ...@@ -51,12 +51,12 @@ void config_req_rlc_um (frame_t frameP,
rb_type_t rb_typeP) rb_type_t rb_typeP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_um_entity_t *rlc = NULL; rlc_um_entity_t *rlc_p = NULL;
if (eNB_flagP) { if (eNB_flagP) {
rlc = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.um; rlc_p = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.um;
} else { } else {
rlc = &rlc_array_ue[ue_module_idP][rb_idP].rlc.um; rlc_p = &rlc_array_ue[ue_module_idP][rb_idP].rlc.um;
} }
LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ timer_reordering=%d sn_field_length=%d is_mXch=%d --->][RLC_UM][MOD %u/%u][RB %u] \n", LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ timer_reordering=%d sn_field_length=%d is_mXch=%d --->][RLC_UM][MOD %u/%u][RB %u] \n",
frame, frame,
...@@ -70,10 +70,10 @@ void config_req_rlc_um (frame_t frameP, ...@@ -70,10 +70,10 @@ void config_req_rlc_um (frame_t frameP,
ue_module_idP, ue_module_idP,
rb_idP); rb_idP);
rlc_um_init(rlc); rlc_um_init(rlc_p);
if (rlc_um_fsm_notify_event (rlc, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) { if (rlc_um_fsm_notify_event (rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) {
rlc_um_set_debug_infos(rlc, frame, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP); rlc_um_set_debug_infos(rlc_p, frame, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP);
rlc_um_configure(rlc, rlc_um_configure(rlc_p,
frame, frame,
config_um_pP->timer_reordering, config_um_pP->timer_reordering,
config_um_pP->sn_field_length, config_um_pP->sn_field_length,
...@@ -84,25 +84,38 @@ void config_req_rlc_um (frame_t frameP, ...@@ -84,25 +84,38 @@ void config_req_rlc_um (frame_t frameP,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
u32_t t_Reordering_tab[T_Reordering_spare1] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200}; u32_t t_Reordering_tab[T_Reordering_spare1] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200};
void config_req_rlc_um_asn1 (frame_t frameP, void config_req_rlc_um_asn1 (frame_t frameP,
eNB_flag_t eNB_flagP, eNB_flag_t eNB_flagP,
u8_t mbms_flagP, MBMS_flag_t mbms_flagP,
module_id_t enb_module_idP, module_id_t enb_module_idP,
module_id_t ue_module_idP, module_id_t ue_module_idP,
UL_UM_RLC_t *ul_rlc_pP, mbms_session_id_t mbms_session_idP,
DL_UM_RLC_t *dl_rlc_pP, mbms_service_id_t mbms_service_idP,
rb_id_t rb_idP, UL_UM_RLC_t *ul_rlc_pP,
rb_type_t rb_typeP) DL_UM_RLC_t *dl_rlc_pP,
rb_id_t rb_idP,
rb_type_t rb_typeP)
{ {
u32_t ul_sn_FieldLength = 0; u32_t ul_sn_FieldLength = 0;
u32_t dl_sn_FieldLength = 0; u32_t dl_sn_FieldLength = 0;
u32_t t_Reordering; u32_t t_Reordering;
rlc_um_entity_t *rlc = NULL; rlc_um_entity_t *rlc_p = NULL;
#if defined(rel10)
if (eNB_flagP) { if (mbms_flagP) {
rlc = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.um; if (eNB_flagP) {
} else { rlc_p = &rlc_mbms_array_eNB[enb_module_idP][mbms_service_idP][mbms_session_idP].um;
rlc = &rlc_array_ue[ue_module_idP][rb_idP].rlc.um; } else {
rlc_p = &rlc_mbms_array_ue[ue_module_idP][mbms_service_idP][mbms_session_idP].um;
}
}
else
#endif
{
if (eNB_flagP) {
rlc_p = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.um;
} else {
rlc_p = &rlc_array_ue[ue_module_idP][rb_idP].rlc.um;
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -116,9 +129,9 @@ void config_req_rlc_um_asn1 (frame_t frameP, ...@@ -116,9 +129,9 @@ void config_req_rlc_um_asn1 (frame_t frameP,
ue_module_idP, ue_module_idP,
rb_idP); rb_idP);
rlc_um_init(rlc); rlc_um_init(rlc_p);
if (rlc_um_fsm_notify_event (rlc, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) { if (rlc_um_fsm_notify_event (rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) {
rlc_um_set_debug_infos(rlc, frame, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP); rlc_um_set_debug_infos(rlc_p, frame, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP);
if (ul_rlc_pP != NULL) { if (ul_rlc_pP != NULL) {
switch (ul_rlc_pP->sn_FieldLength) { switch (ul_rlc_pP->sn_FieldLength) {
case SN_FieldLength_size5: case SN_FieldLength_size5:
...@@ -130,10 +143,10 @@ void config_req_rlc_um_asn1 (frame_t frameP, ...@@ -130,10 +143,10 @@ void config_req_rlc_um_asn1 (frame_t frameP,
default: default:
LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID Uplink sn_FieldLength %d, RLC NOT CONFIGURED\n", LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID Uplink sn_FieldLength %d, RLC NOT CONFIGURED\n",
frame, frame,
(rlc->is_enb) ? "eNB" : "UE", (rlc_p->is_enb) ? "eNB" : "UE",
rlc->enb_module_id, rlc_p->enb_module_id,
rlc->ue_module_id, rlc_p->ue_module_id,
rlc->rb_id, rlc_p->rb_id,
ul_rlc_pP->sn_FieldLength); ul_rlc_pP->sn_FieldLength);
return; return;
} }
...@@ -150,10 +163,10 @@ void config_req_rlc_um_asn1 (frame_t frameP, ...@@ -150,10 +163,10 @@ void config_req_rlc_um_asn1 (frame_t frameP,
default: default:
LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID Downlink sn_FieldLength %d, RLC NOT CONFIGURED\n", LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID Downlink sn_FieldLength %d, RLC NOT CONFIGURED\n",
frame, frame,
(rlc->is_enb) ? "eNB" : "UE", (rlc_p->is_enb) ? "eNB" : "UE",
rlc->enb_module_id, rlc_p->enb_module_id,
rlc->ue_module_id, rlc_p->ue_module_id,
rlc->rb_id, rlc_p->rb_id,
dl_rlc_pP->sn_FieldLength); dl_rlc_pP->sn_FieldLength);
return; return;
} }
...@@ -162,23 +175,23 @@ void config_req_rlc_um_asn1 (frame_t frameP, ...@@ -162,23 +175,23 @@ void config_req_rlc_um_asn1 (frame_t frameP,
} else { } else {
LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID T_Reordering %d, RLC NOT CONFIGURED\n", LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID T_Reordering %d, RLC NOT CONFIGURED\n",
frame, frame,
(rlc->is_enb) ? "eNB" : "UE", (rlc_p->is_enb) ? "eNB" : "UE",
rlc->enb_module_id, rlc_p->enb_module_id,
rlc->ue_module_id, rlc_p->ue_module_id,
rlc->rb_id, rlc_p->rb_id,
dl_rlc_pP->t_Reordering); dl_rlc_pP->t_Reordering);
return; return;
} }
} }
if (eNB_flagP > 0) { if (eNB_flagP > 0) {
rlc_um_configure(rlc, rlc_um_configure(rlc_p,
frame, frame,
t_Reordering, t_Reordering,
ul_sn_FieldLength, ul_sn_FieldLength,
dl_sn_FieldLength, dl_sn_FieldLength,
mbms_flagP); mbms_flagP);
} else { } else {
rlc_um_configure(rlc, rlc_um_configure(rlc_p,
frame, frame,
t_Reordering, t_Reordering,
dl_sn_FieldLength, dl_sn_FieldLength,
......
...@@ -88,19 +88,41 @@ typedef volatile struct { ...@@ -88,19 +88,41 @@ typedef volatile struct {
*/ */
public_rlc_um_control_primitives( void config_req_rlc_um (frame_t frame, eNB_flag_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_um_info_t * config_umP, rb_id_t rb_idP, rb_type_t rb_typeP);) public_rlc_um_control_primitives( void config_req_rlc_um (frame_t frame, eNB_flag_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_um_info_t * config_umP, rb_id_t rb_idP, rb_type_t rb_typeP);)
/*! \fn void config_req_rlc_um_asn1 (frame_t frame, eNB_flag_t eNB_flagP, u8_t mbms_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, UL_UM_RLC_t* ul_rlcP, DL_UM_RLC_t* dl_rlcP, rb_id_t rb_idP, rb_type_t rb_typeP) /*! \fn void config_req_rlc_um_asn1 (frame_t frame,
* eNB_flag_t eNB_flagP,
* MBMS_flag_t mbms_flagP,
* module_id_t enb_module_idP,
* module_id_t ue_module_idP,
* mbms_session_id_t mbms_session_idP,
mbms_service_id_t mbms_service_idP,
UL_UM_RLC_t* ul_rlcP,
DL_UM_RLC_t* dl_rlcP,
rb_id_t rb_idP,
rb_type_t rb_typeP)
* \brief Allocate memory for RLC UM instance, reset protocol variables, and set protocol parameters. After this configuration the RLC UM protocol instance will be in RLC_DATA_TRANSFER_READY_STATE state. * \brief Allocate memory for RLC UM instance, reset protocol variables, and set protocol parameters. After this configuration the RLC UM protocol instance will be in RLC_DATA_TRANSFER_READY_STATE state.
* \param[in] frame Frame index. * \param[in] frameP Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0) * \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] mbms_flagP Flag to indicate if this RLC is configured for MBMS. * \param[in] mbms_flagP Flag to indicate if this RLC is configured for MBMS.
* \param[in] enb_module_idP eNB Virtualized module identifier. * \param[in] enb_module_idP eNB Virtualized module identifier.
* \param[in] ue_module_idP UE Virtualized module identifier. * \param[in] ue_module_idP UE Virtualized module identifier.
* \param[in] mbms_session_idP MBMS session id.
* \param[in] mbms_service_idP MBMS service id.
* \param[in] ul_rlcP Configuration parameters for RLC UM UL instance. * \param[in] ul_rlcP Configuration parameters for RLC UM UL instance.
* \param[in] dl_rlcP Configuration parameters for RLC UM DL instance. * \param[in] dl_rlcP Configuration parameters for RLC UM DL instance.
* \param[in] rb_idP Radio bearer identifier. * \param[in] rb_idP Radio bearer identifier.
* \param[in] rb_typeP Radio bearer type (Signalling or Data). * \param[in] rb_typeP Radio bearer type (Signalling or Data).
*/ */
public_rlc_um_control_primitives( void config_req_rlc_um_asn1 (frame_t frame, eNB_flag_t eNB_flagP, u8_t mbms_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, UL_UM_RLC_t* ul_rlcP, DL_UM_RLC_t* dl_rlcP, rb_id_t rb_idP, rb_type_t rb_typeP);) public_rlc_um_control_primitives( void config_req_rlc_um_asn1 (frame_t frameP,
eNB_flag_t eNB_flagP,
MBMS_flag_t mbms_flagP,
module_id_t enb_module_idP,
module_id_t ue_module_idP,
mbms_session_id_t mbms_session_idP,
mbms_service_id_t mbms_service_idP,
UL_UM_RLC_t *ul_rlcP,
DL_UM_RLC_t *dl_rlcP,
rb_id_t rb_idP,
rb_type_t rb_typeP);)
/*! \fn void rlc_um_init (rlc_um_entity_t *rlcP) /*! \fn void rlc_um_init (rlc_um_entity_t *rlcP)
* \brief Initialize a RLC UM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC UM protocol instance will be in RLC_NULL_STATE state. * \brief Initialize a RLC UM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC UM protocol instance will be in RLC_NULL_STATE state.
......
...@@ -886,7 +886,6 @@ inline signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_ ...@@ -886,7 +886,6 @@ inline signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_
inline signed int rlc_um_in_reordering_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP) { inline signed int rlc_um_in_reordering_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_sn_t modulus = (signed int)rlc_pP->vr_uh - rlc_pP->rx_um_window_size; rlc_sn_t modulus = (signed int)rlc_pP->vr_uh - rlc_pP->rx_um_window_size;
rlc_sn_t sn = snP;
snP = (snP - modulus) % rlc_pP->rx_sn_modulo; snP = (snP - modulus) % rlc_pP->rx_sn_modulo;
......
...@@ -115,7 +115,7 @@ rlc_op_status_t rlc_stat_req ( ...@@ -115,7 +115,7 @@ rlc_op_status_t rlc_stat_req (
unsigned int* stat_timer_poll_retransmit_timed_out, unsigned int* stat_timer_poll_retransmit_timed_out,
unsigned int* stat_timer_status_prohibit_timed_out) { unsigned int* stat_timer_status_prohibit_timed_out) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_mode_t rlc_mode = RLC_NONE; rlc_mode_t rlc_mode = RLC_MODE_NONE;
void *rlc_p = NULL; void *rlc_p = NULL;
#ifdef OAI_EMU #ifdef OAI_EMU
...@@ -140,16 +140,16 @@ rlc_op_status_t rlc_stat_req ( ...@@ -140,16 +140,16 @@ rlc_op_status_t rlc_stat_req (
if (eNB_flagP) { if (eNB_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode; rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
AssertFatal (0 , "enB RLC not configured rb id %u module eNB id %u!\n", rb_idP, enb_mod_idP); AssertFatal (0 , "enB RLC not configured rb id %u module eNB id %u!\n", rb_idP, enb_mod_idP);
break; break;
case RLC_AM: case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am;
break; break;
case RLC_UM: case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um;
break; break;
case RLC_TM: case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm;
break; break;
default: default:
...@@ -158,16 +158,16 @@ rlc_op_status_t rlc_stat_req ( ...@@ -158,16 +158,16 @@ rlc_op_status_t rlc_stat_req (
} else { } else {
rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode; rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
AssertFatal (0 , "UE RLC not configured rb id %u module ue id %u!\n", rb_idP, ue_mod_idP); AssertFatal (0 , "UE RLC not configured rb id %u module ue id %u!\n", rb_idP, ue_mod_idP);
break; break;
case RLC_AM: case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am;
break; break;
case RLC_UM: case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um;
break; break;
case RLC_TM: case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm;
break; break;
default: default:
...@@ -175,7 +175,7 @@ rlc_op_status_t rlc_stat_req ( ...@@ -175,7 +175,7 @@ rlc_op_status_t rlc_stat_req (
} }
} }
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
*stat_tx_pdcp_sdu = 0; *stat_tx_pdcp_sdu = 0;
*stat_tx_pdcp_bytes = 0; *stat_tx_pdcp_bytes = 0;
*stat_tx_pdcp_sdu_discarded = 0; *stat_tx_pdcp_sdu_discarded = 0;
...@@ -206,7 +206,7 @@ rlc_op_status_t rlc_stat_req ( ...@@ -206,7 +206,7 @@ rlc_op_status_t rlc_stat_req (
return RLC_OP_STATUS_BAD_PARAMETER; return RLC_OP_STATUS_BAD_PARAMETER;
break; break;
case RLC_AM: case RLC_MODE_AM:
rlc_am_stat_req((rlc_am_entity_t*)rlc_p, rlc_am_stat_req((rlc_am_entity_t*)rlc_p,
stat_tx_pdcp_sdu, stat_tx_pdcp_sdu,
stat_tx_pdcp_bytes, stat_tx_pdcp_bytes,
...@@ -238,7 +238,7 @@ rlc_op_status_t rlc_stat_req ( ...@@ -238,7 +238,7 @@ rlc_op_status_t rlc_stat_req (
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
break; break;
case RLC_UM: case RLC_MODE_UM:
*stat_tx_retransmit_pdu_by_status = 0; *stat_tx_retransmit_pdu_by_status = 0;
*stat_tx_retransmit_bytes_by_status = 0; *stat_tx_retransmit_bytes_by_status = 0;
*stat_tx_retransmit_pdu = 0; *stat_tx_retransmit_pdu = 0;
...@@ -272,7 +272,7 @@ rlc_op_status_t rlc_stat_req ( ...@@ -272,7 +272,7 @@ rlc_op_status_t rlc_stat_req (
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
break; break;
case RLC_TM: case RLC_MODE_TM:
*stat_tx_pdcp_sdu = 0; *stat_tx_pdcp_sdu = 0;
*stat_tx_pdcp_bytes = 0; *stat_tx_pdcp_bytes = 0;
*stat_tx_pdcp_sdu_discarded = 0; *stat_tx_pdcp_sdu_discarded = 0;
...@@ -347,7 +347,7 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, ...@@ -347,7 +347,7 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
mem_block_t *sdu_pP) { mem_block_t *sdu_pP) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
mem_block_t *new_sdu_p = NULL; mem_block_t *new_sdu_p = NULL;
rlc_mode_t rlc_mode = RLC_NONE; rlc_mode_t rlc_mode = RLC_MODE_NONE;
void *rlc_p = NULL; void *rlc_p = NULL;
#ifdef Rel10 #ifdef Rel10
rb_id_t mbms_rb_id = 0; rb_id_t mbms_rb_id = 0;
...@@ -398,16 +398,16 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, ...@@ -398,16 +398,16 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
if (eNB_flagP) { if (eNB_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode; rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
AssertFatal (0 , "enB RLC not configured rb id %u module %u!\n", rb_idP, enb_mod_idP); AssertFatal (0 , "enB RLC not configured rb id %u module %u!\n", rb_idP, enb_mod_idP);
break; break;
case RLC_AM: case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am;
break; break;
case RLC_UM: case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um;
break; break;
case RLC_TM: case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm;
break; break;
default: default:
...@@ -416,16 +416,16 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, ...@@ -416,16 +416,16 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
} else { } else {
rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode; rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
AssertFatal (0 , "UE RLC not configured rb id %u module %u!\n", rb_idP, ue_mod_idP); AssertFatal (0 , "UE RLC not configured rb id %u module %u!\n", rb_idP, ue_mod_idP);
break; break;
case RLC_AM: case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am;
break; break;
case RLC_UM: case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um;
break; break;
case RLC_TM: case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm;
break; break;
default: default:
...@@ -447,18 +447,18 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, ...@@ -447,18 +447,18 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
LOG_D(RLC,"RLC_TYPE : %d ",rlc_mode); LOG_D(RLC,"RLC_TYPE : %d ",rlc_mode);
#endif #endif
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
free_mem_block(sdu_pP); free_mem_block(sdu_pP);
LOG_E(RLC, "Received RLC_NONE as rlc_type for %s eNB id %u, ue id %u, rb_id %u\n", LOG_E(RLC, "Received RLC_MODE_NONE as rlc_type for %s eNB id %u, ue id %u, rb_id %u\n",
(eNB_flagP) ? "eNB" : "UE", (eNB_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
rb_idP); rb_idP);
return RLC_OP_STATUS_BAD_PARAMETER; return RLC_OP_STATUS_BAD_PARAMETER;
case RLC_AM: case RLC_MODE_AM:
#ifdef DEBUG_RLC_DATA_REQ #ifdef DEBUG_RLC_DATA_REQ
msg("RLC_AM\n"); msg("RLC_MODE_AM\n");
#endif #endif
new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_am_data_req_alloc)); new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_am_data_req_alloc));
...@@ -505,7 +505,7 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, ...@@ -505,7 +505,7 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
} }
break; break;
case RLC_UM: case RLC_MODE_UM:
new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc)); new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc));
if (new_sdu_p != NULL) { if (new_sdu_p != NULL) {
...@@ -551,7 +551,7 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, ...@@ -551,7 +551,7 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
} }
break; break;
case RLC_TM: case RLC_MODE_TM:
new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_tm_data_req_alloc)); new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_tm_data_req_alloc));
if (new_sdu_p != NULL) { if (new_sdu_p != NULL) {
...@@ -692,7 +692,7 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, ...@@ -692,7 +692,7 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, MBMS_flag_t MBMS_flagP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t* sdu_pP, boolean_t is_data_planeP) { void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, MBMS_flag_t MBMS_flagP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t* sdu_pP, boolean_t is_data_planeP) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_mode_t rlc_mode = RLC_NONE; rlc_mode_t rlc_mode = RLC_MODE_NONE;
if (eNB_flagP) { if (eNB_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode; rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
...@@ -714,7 +714,9 @@ void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t ...@@ -714,7 +714,9 @@ void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t
switch (rlc_mode) { switch (rlc_mode) {
case RLC_AM: case RLC_MODE_NONE:
break;
case RLC_MODE_AM:
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][INST %u/%u][RB %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n", LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][INST %u/%u][RB %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n",
frame, frame,
(eNB_flagP) ? "eNB" : "UE", (eNB_flagP) ? "eNB" : "UE",
...@@ -726,7 +728,7 @@ void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t ...@@ -726,7 +728,7 @@ void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t
ue_mod_idP, ue_mod_idP,
rb_idP); rb_idP);
break; break;
case RLC_UM: case RLC_MODE_UM:
LOG_D(RLC, "[FRAME %5u][%s][RLC_UM][INST %u/%u][RB %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n", LOG_D(RLC, "[FRAME %5u][%s][RLC_UM][INST %u/%u][RB %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n",
frame, frame,
(eNB_flagP) ? "eNB" : "UE", (eNB_flagP) ? "eNB" : "UE",
...@@ -738,7 +740,7 @@ void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t ...@@ -738,7 +740,7 @@ void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t
ue_mod_idP, ue_mod_idP,
rb_idP); rb_idP);
break; break;
case RLC_TM: case RLC_MODE_TM:
LOG_D(RLC, "[FRAME %5u][%s][RLC_TM][INST %u/%u][RB %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n", LOG_D(RLC, "[FRAME %5u][%s][RLC_TM][INST %u/%u][RB %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n",
frame, frame,
(eNB_flagP) ? "eNB" : "UE", (eNB_flagP) ? "eNB" : "UE",
...@@ -763,7 +765,7 @@ void rlc_data_conf (module_id_t enb_mod_idP, ...@@ -763,7 +765,7 @@ void rlc_data_conf (module_id_t enb_mod_idP,
rlc_tx_status_t statusP, rlc_tx_status_t statusP,
boolean_t is_data_planeP) { boolean_t is_data_planeP) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_mode_t rlc_mode = RLC_NONE; rlc_mode_t rlc_mode = RLC_MODE_NONE;
if (eNB_flagP) { if (eNB_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode; rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
...@@ -774,7 +776,9 @@ void rlc_data_conf (module_id_t enb_mod_idP, ...@@ -774,7 +776,9 @@ void rlc_data_conf (module_id_t enb_mod_idP,
if (rlc_rrc_data_conf != NULL) { if (rlc_rrc_data_conf != NULL) {
LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED); LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED);
switch (rlc_mode) { switch (rlc_mode) {
case RLC_AM: case RLC_MODE_NONE:
break;
case RLC_MODE_AM:
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][INST %u/%u][RB %u][--- RLC_DATA_CONF /MUI %d --->][RRC][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n", LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][INST %u/%u][RB %u][--- RLC_DATA_CONF /MUI %d --->][RRC][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n",
frame, frame,
(eNB_flagP) ? "eNB" : "UE", (eNB_flagP) ? "eNB" : "UE",
...@@ -785,7 +789,7 @@ void rlc_data_conf (module_id_t enb_mod_idP, ...@@ -785,7 +789,7 @@ void rlc_data_conf (module_id_t enb_mod_idP,
ue_mod_idP, ue_mod_idP,
muiP); muiP);
break; break;
case RLC_UM: case RLC_MODE_UM:
LOG_D(RLC, "[FRAME %5u][%s][RLC_UM][INST %u/%u][RB %u][--- RLC_DATA_CONF /MUI %d --->][RRC][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n", LOG_D(RLC, "[FRAME %5u][%s][RLC_UM][INST %u/%u][RB %u][--- RLC_DATA_CONF /MUI %d --->][RRC][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n",
frame, frame,
(eNB_flagP) ? "eNB" : "UE", (eNB_flagP) ? "eNB" : "UE",
...@@ -796,7 +800,7 @@ void rlc_data_conf (module_id_t enb_mod_idP, ...@@ -796,7 +800,7 @@ void rlc_data_conf (module_id_t enb_mod_idP,
ue_mod_idP, ue_mod_idP,
muiP); muiP);
break; break;
case RLC_TM: case RLC_MODE_TM:
LOG_D(RLC, "[FRAME %5u][%s][RLC_TM][INST %u/%u][RB %u][--- RLC_DATA_CONF /MUI %d --->][RRC][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n", LOG_D(RLC, "[FRAME %5u][%s][RLC_TM][INST %u/%u][RB %u][--- RLC_DATA_CONF /MUI %d --->][RRC][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n",
frame, frame,
(eNB_flagP) ? "eNB" : "UE", (eNB_flagP) ? "eNB" : "UE",
...@@ -822,6 +826,10 @@ rlc_module_init (void) ...@@ -822,6 +826,10 @@ rlc_module_init (void)
module_id_t module_id1; module_id_t module_id1;
module_id_t module_id2; module_id_t module_id2;
rb_id_t rb_id; rb_id_t rb_id;
#if defined(Rel10)
mbms_session_id_t session_id;
mbms_service_id_t service_id;
#endif
LOG_D(RLC, "MODULE INIT\n"); LOG_D(RLC, "MODULE INIT\n");
rlc_rrc_data_ind = NULL; rlc_rrc_data_ind = NULL;
...@@ -832,18 +840,26 @@ rlc_module_init (void) ...@@ -832,18 +840,26 @@ rlc_module_init (void)
for (k=0; k < RLC_MAX_LC; k++) { for (k=0; k < RLC_MAX_LC; k++) {
lcid2rbid_ue[module_id1][k] = RLC_RB_UNALLOCATED; lcid2rbid_ue[module_id1][k] = RLC_RB_UNALLOCATED;
} }
for (k=0; k < 16*29; k++) { #if defined(Rel10)
memset(&rlc_mbms_array_ue[module_id1][k], 0, sizeof(rlc_mbms_t)); for (service_id = 0; service_id < maxServiceCount; service_id++) {
} for (session_id = 0; session_id < maxSessionPerPMCH; session_id++) {
memset(&rlc_mbms_array_ue[module_id1][service_id][session_id], 0, sizeof(rlc_mbms_t));
}
}
#endif
for (rb_id=0; rb_id < NB_RB_MAX; rb_id++) { for (rb_id=0; rb_id < NB_RB_MAX; rb_id++) {
memset(&rlc_array_ue[module_id1][rb_id], 0, sizeof(rlc_t)); memset(&rlc_array_ue[module_id1][rb_id], 0, sizeof(rlc_t));
} }
} }
for (module_id1=0; module_id1 < NUMBER_OF_eNB_MAX; module_id1++) { for (module_id1=0; module_id1 < NUMBER_OF_eNB_MAX; module_id1++) {
for (k=0; k < 16*29; k++) { #if defined(Rel10)
memset(&rlc_mbms_array_eNB[module_id1][k], 0, sizeof(rlc_mbms_t)); for (service_id = 0; service_id < maxServiceCount; service_id++) {
} for (session_id = 0; session_id < maxSessionPerPMCH; session_id++) {
memset(&rlc_mbms_array_eNB[module_id1][service_id][session_id], 0, sizeof(rlc_mbms_t));
}
}
#endif
for (module_id2=0; module_id2 < NUMBER_OF_UE_MAX; module_id2++) { for (module_id2=0; module_id2 < NUMBER_OF_UE_MAX; module_id2++) {
for (rb_id=0; rb_id < NB_RB_MAX; rb_id++) { for (rb_id=0; rb_id < NB_RB_MAX; rb_id++) {
memset(&rlc_array_eNB[module_id1][module_id2][rb_id], 0, sizeof(rlc_t)); memset(&rlc_array_eNB[module_id1][module_id2][rb_id], 0, sizeof(rlc_t));
......
...@@ -108,13 +108,25 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis ...@@ -108,13 +108,25 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
#define RLC_OP_STATUS_INTERNAL_ERROR 2 #define RLC_OP_STATUS_INTERNAL_ERROR 2
#define RLC_OP_STATUS_OUT_OF_RESSOURCES 3 #define RLC_OP_STATUS_OUT_OF_RESSOURCES 3
#define RLC_SDU_CONFIRM_YES 1 #define RLC_MUI_UNDEFINED (mui_t)0
#define RLC_SDU_CONFIRM_NO 0
#define RLC_MUI_UNDEFINED 0
#define RLC_RB_UNALLOCATED (rb_id_t)0 #define RLC_RB_UNALLOCATED (rb_id_t)0
//-----------------------------------------------------------------------------
// PUBLIC RLC CONSTANTS
//-----------------------------------------------------------------------------
typedef enum rlc_confirm_e {
RLC_SDU_CONFIRM_NO = 0,
RLC_SDU_CONFIRM_YES = 1,
} rlc_confirm_t;
typedef enum rlc_mode_e {
RLC_MODE_NONE = 0,
RLC_MODE_AM = 1,
RLC_MODE_UM = 2,
RLC_MODE_TM = 4
} rlc_mode_t;
/*! \struct rlc_info_t /*! \struct rlc_info_t
* \brief Structure containing RLC protocol configuration parameters. * \brief Structure containing RLC protocol configuration parameters.
...@@ -132,11 +144,11 @@ typedef volatile struct { ...@@ -132,11 +144,11 @@ typedef volatile struct {
* \brief Primitive exchanged between RLC and MAC informing about the buffer occupancy of the RLC protocol instance. * \brief Primitive exchanged between RLC and MAC informing about the buffer occupancy of the RLC protocol instance.
*/ */
typedef struct { typedef struct {
u32_t bytes_in_buffer; /*!< \brief Bytes buffered in RLC protocol instance. */ rlc_buffer_occupancy_t bytes_in_buffer; /*!< \brief Bytes buffered in RLC protocol instance. */
u32_t pdus_in_buffer; /*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */ rlc_buffer_occupancy_t pdus_in_buffer; /*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */
u32_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */ frame_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */
u32_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of already segmented sdu */ sdu_size_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of already segmented sdu */
u32_t head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmeneted */ boolean_t head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmeneted */
} mac_rlc_status_resp_t; } mac_rlc_status_resp_t;
...@@ -164,9 +176,9 @@ typedef struct { ...@@ -164,9 +176,9 @@ typedef struct {
#endif #endif
protected_rlc(void (*rlc_rrc_data_ind) (module_id_t, module_id_t, frame_t, eNB_flag_t, rb_id_t , sdu_size_t , u8_t* );) protected_rlc(void (*rlc_rrc_data_ind) (module_id_t, module_id_t, frame_t, eNB_flag_t, rb_id_t , sdu_size_t , u8_t* );)
protected_rlc(void (*rlc_rrc_data_conf) (module_id_t , module_id_t , u8_t, rb_id_t , mui_t, rlc_tx_status_t );) protected_rlc(void (*rlc_rrc_data_conf) (module_id_t , module_id_t , eNB_flag_t, rb_id_t , mui_t, rlc_tx_status_t );)
typedef void (rrc_data_ind_cb_t)(module_id_t eNB_inst, module_id_t UE_inst, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, u8_t* sduP); typedef void (rrc_data_ind_cb_t)(module_id_t eNB_inst, module_id_t UE_inst, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, u8_t* sduP);
typedef void (rrc_data_conf_cb_t)(module_id_t eNB_inst, module_id_t UE_inst, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP); typedef void (rrc_data_conf_cb_t)(module_id_t eNB_inst, module_id_t UE_inst, eNB_flag_t eNB_flagP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP);
/*! \struct rlc_t /*! \struct rlc_t
...@@ -182,15 +194,23 @@ typedef struct rlc_t { ...@@ -182,15 +194,23 @@ typedef struct rlc_t {
}rlc_t; }rlc_t;
typedef struct rlc_mbms_s { typedef struct rlc_mbms_s {
mbms_session_id_t session_id; // lcid
mbms_service_id_t service_id;
rb_id_t rb_id; rb_id_t rb_id;
module_id_t instanciated_instance; module_id_t instanciated_instance;
rlc_um_entity_t um; rlc_um_entity_t um;
} rlc_mbms_t; } rlc_mbms_t;
public_rlc(rlc_mbms_t rlc_mbms_array_ue[NUMBER_OF_UE_MAX][16*29];) // MAX_SERVICEx MAX_SESSION #if !defined(Rel10)
public_rlc(rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][16*29];) // MAX_SERVICEx MAX_SESSION # if !defined(maxServiceCount)
//unused arrays rlc_mbms_array_ue rlc_mbms_array_eNB
# define maxServiceCount 1
# endif
# if !defined(maxSessionPerPMCH)
//unused arrays rlc_mbms_array_ue rlc_mbms_array_eNB
# define maxSessionPerPMCH 1
# endif
#endif
public_rlc(rlc_mbms_t rlc_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_rlc(rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_rlc(rb_id_t lcid2rbid_ue[NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ public_rlc(rb_id_t lcid2rbid_ue[NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
public_rlc(rb_id_t lcid2rbid_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ public_rlc(rb_id_t lcid2rbid_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
...@@ -227,7 +247,7 @@ private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t, ...@@ -227,7 +247,7 @@ private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t,
// PUBLIC INTERFACE WITH RRC // PUBLIC INTERFACE WITH RRC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifdef Rel10 #ifdef Rel10
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, SRB_ToAddMod_t* srb2addmod, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP, MBMS_SessionInfoList_r9_t *SessionInfo_listP) /*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, SRB_ToAddMod_t* srb2addmod, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP, PMCH_InfoList_r9_t *pmch_info_listP)
* \brief Function for RRC to configure a Radio Bearer. * \brief Function for RRC to configure a Radio Bearer.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. * \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier. * \param[in] ue_mod_idP Virtualized ue module identifier.
...@@ -241,7 +261,7 @@ private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t, ...@@ -241,7 +261,7 @@ private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t,
*/ */
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t, module_id_t, frame_t, eNB_flag_t, SRB_ToAddModList_t*, DRB_ToAddModList_t*, DRB_ToReleaseList_t*, PMCH_InfoList_r9_t *pmch_info_listP);) public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t, module_id_t, frame_t, eNB_flag_t, SRB_ToAddModList_t*, DRB_ToAddModList_t*, DRB_ToReleaseList_t*, PMCH_InfoList_r9_t *pmch_info_listP);)
#else #else
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, SRB_ToAddModList_t* srb2add_listP, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP, MBMS_SessionInfoList_r9_t *SessionInfo_listP) /*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, SRB_ToAddModList_t* srb2add_listP, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP)
* \brief Function for RRC to configure a Radio Bearer. * \brief Function for RRC to configure a Radio Bearer.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. * \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier. * \param[in] ue_mod_idP Virtualized ue module identifier.
...@@ -360,23 +380,6 @@ public_rlc_mac(void mac_rlc_data_ind (module_id_t, module_i ...@@ -360,23 +380,6 @@ public_rlc_mac(void mac_rlc_data_ind (module_id_t, module_i
* \return The maximum number of bytes that the RLC instance can send in the next transmission sequence. * \return The maximum number of bytes that the RLC instance can send in the next transmission sequence.
*/ */
public_rlc_mac(mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t, module_id_t, frame_t, eNB_flag_t, MBMS_flag_t, logical_chan_id_t, tb_size_t );) public_rlc_mac(mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t, module_id_t, frame_t, eNB_flag_t, MBMS_flag_t, logical_chan_id_t, tb_size_t );)
//-----------------------------------------------------------------------------
// PUBLIC RLC CONSTANTS
//-----------------------------------------------------------------------------
/** RLC null type identifier. */
#define RLC_NONE (rlc_mode_t)0
/** RLC AM type identifier. */
#define RLC_AM (rlc_mode_t)1
/** RLC UM type identifier. */
#define RLC_UM (rlc_mode_t)2
/** RLC TM type identifier. */
#define RLC_TM (rlc_mode_t)4
#define RLC_MBMS_NO 0
#define RLC_MBMS_YES 1
#define RLC_CHANNEL_ID_DUMMY -1
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// RLC methods // RLC methods
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -91,7 +91,7 @@ tbs_size_t mac_rlc_data_req (module_id_t enb_mod_idP, ...@@ -91,7 +91,7 @@ tbs_size_t mac_rlc_data_req (module_id_t enb_mod_idP,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
struct mac_data_req data_request; struct mac_data_req data_request;
rb_id_t rb_id = 0; rb_id_t rb_id = 0;
rlc_mode_t rlc_mode = RLC_NONE; rlc_mode_t rlc_mode = RLC_MODE_NONE;
void *rlc_p = NULL; void *rlc_p = NULL;
#ifdef DEBUG_MAC_INTERFACE #ifdef DEBUG_MAC_INTERFACE
...@@ -126,17 +126,17 @@ tbs_size_t mac_rlc_data_req (module_id_t enb_mod_idP, ...@@ -126,17 +126,17 @@ tbs_size_t mac_rlc_data_req (module_id_t enb_mod_idP,
rb_id = lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][channel_idP]; rb_id = lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][channel_idP];
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode; rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode;
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
AssertFatal (0 , "enB RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP); AssertFatal (0 , "enB RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
return (tbs_size_t)0; return (tbs_size_t)0;
break; break;
case RLC_AM: case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.am; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.am;
break; break;
case RLC_UM: case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.um; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.um;
break; break;
case RLC_TM: case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.tm; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.tm;
break; break;
default: default:
...@@ -146,17 +146,17 @@ tbs_size_t mac_rlc_data_req (module_id_t enb_mod_idP, ...@@ -146,17 +146,17 @@ tbs_size_t mac_rlc_data_req (module_id_t enb_mod_idP,
rb_id = lcid2rbid_ue[ue_mod_idP][channel_idP]; rb_id = lcid2rbid_ue[ue_mod_idP][channel_idP];
rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode; rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode;
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
AssertFatal (0 , "UE RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP); AssertFatal (0 , "UE RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP);
return (tbs_size_t)0; return (tbs_size_t)0;
break; break;
case RLC_AM: case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.am; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.am;
break; break;
case RLC_UM: case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.um; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.um;
break; break;
case RLC_TM: case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.tm; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.tm;
break; break;
default: default:
...@@ -165,20 +165,20 @@ tbs_size_t mac_rlc_data_req (module_id_t enb_mod_idP, ...@@ -165,20 +165,20 @@ tbs_size_t mac_rlc_data_req (module_id_t enb_mod_idP,
} }
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
break; break;
case RLC_AM: case RLC_MODE_AM:
data_request = rlc_am_mac_data_request((rlc_am_entity_t*)rlc_p, frameP); data_request = rlc_am_mac_data_request((rlc_am_entity_t*)rlc_p, frameP);
return mac_rlc_serialize_tb(buffer_pP, data_request.data); return mac_rlc_serialize_tb(buffer_pP, data_request.data);
break; break;
case RLC_UM: case RLC_MODE_UM:
data_request = rlc_um_mac_data_request((rlc_um_entity_t*)rlc_p, frameP); data_request = rlc_um_mac_data_request((rlc_um_entity_t*)rlc_p, frameP);
return mac_rlc_serialize_tb(buffer_pP, data_request.data); return mac_rlc_serialize_tb(buffer_pP, data_request.data);
break; break;
case RLC_TM: case RLC_MODE_TM:
data_request = rlc_tm_mac_data_request((rlc_tm_entity_t*)rlc_p, frameP); data_request = rlc_tm_mac_data_request((rlc_tm_entity_t*)rlc_p, frameP);
return mac_rlc_serialize_tb(buffer_pP, data_request.data); return mac_rlc_serialize_tb(buffer_pP, data_request.data);
break; break;
...@@ -200,7 +200,7 @@ void mac_rlc_data_ind (module_id_t enb_mod_idP, ...@@ -200,7 +200,7 @@ void mac_rlc_data_ind (module_id_t enb_mod_idP,
crc_t *crcs_pP) { crc_t *crcs_pP) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rb_id_t rb_id = 0; rb_id_t rb_id = 0;
rlc_mode_t rlc_mode = RLC_NONE; rlc_mode_t rlc_mode = RLC_MODE_NONE;
void *rlc_p = NULL; void *rlc_p = NULL;
#ifdef DEBUG_MAC_INTERFACE #ifdef DEBUG_MAC_INTERFACE
if (num_tbP) { if (num_tbP) {
...@@ -242,16 +242,16 @@ void mac_rlc_data_ind (module_id_t enb_mod_idP, ...@@ -242,16 +242,16 @@ void mac_rlc_data_ind (module_id_t enb_mod_idP,
AssertFatal (rb_id < NB_RB_MAX, "enB RB id is too high (%u/%d) lcid %u enb module %u ue module id %u!\n", rb_id, NB_RB_MAX, channel_idP, enb_mod_idP, ue_mod_idP); AssertFatal (rb_id < NB_RB_MAX, "enB RB id is too high (%u/%d) lcid %u enb module %u ue module id %u!\n", rb_id, NB_RB_MAX, channel_idP, enb_mod_idP, ue_mod_idP);
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode; rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode;
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
AssertFatal (0 , "enB RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP); AssertFatal (0 , "enB RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
break; break;
case RLC_AM: case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.am; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.am;
break; break;
case RLC_UM: case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.um; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.um;
break; break;
case RLC_TM: case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.tm; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.tm;
break; break;
default: default:
...@@ -262,16 +262,16 @@ void mac_rlc_data_ind (module_id_t enb_mod_idP, ...@@ -262,16 +262,16 @@ void mac_rlc_data_ind (module_id_t enb_mod_idP,
AssertFatal (rb_id < NB_RB_MAX, "UE RB id is too high (%u/%d) lcid %u enb module %u ue module id %u!\n", rb_id, NB_RB_MAX, channel_idP, enb_mod_idP, ue_mod_idP); AssertFatal (rb_id < NB_RB_MAX, "UE RB id is too high (%u/%d) lcid %u enb module %u ue module id %u!\n", rb_id, NB_RB_MAX, channel_idP, enb_mod_idP, ue_mod_idP);
rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode; rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode;
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
AssertFatal (0 , "UE RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP); AssertFatal (0 , "UE RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP);
break; break;
case RLC_AM: case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.am; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.am;
break; break;
case RLC_UM: case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.um; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.um;
break; break;
case RLC_TM: case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.tm; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.tm;
break; break;
default: default:
...@@ -280,25 +280,25 @@ void mac_rlc_data_ind (module_id_t enb_mod_idP, ...@@ -280,25 +280,25 @@ void mac_rlc_data_ind (module_id_t enb_mod_idP,
} }
struct mac_data_ind data_ind = mac_rlc_deserialize_tb(buffer_pP, tb_sizeP, num_tbP, crcs_pP); struct mac_data_ind data_ind = mac_rlc_deserialize_tb(buffer_pP, tb_sizeP, num_tbP, crcs_pP);
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
//handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP); //handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP);
break; break;
case RLC_AM: case RLC_MODE_AM:
#ifdef DEBUG_MAC_INTERFACE #ifdef DEBUG_MAC_INTERFACE
LOG_D(RLC, "MAC DATA IND TO RLC_AM MOD_ID %s enb id %u ue id %u \n", (eNB_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP); LOG_D(RLC, "MAC DATA IND TO RLC_AM MOD_ID %s enb id %u ue id %u \n", (eNB_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP);
#endif #endif
rlc_am_mac_data_indication((rlc_am_entity_t*)rlc_p, frameP, eNB_flagP, data_ind); rlc_am_mac_data_indication((rlc_am_entity_t*)rlc_p, frameP, eNB_flagP, data_ind);
break; break;
case RLC_UM: case RLC_MODE_UM:
#ifdef DEBUG_MAC_INTERFACE #ifdef DEBUG_MAC_INTERFACE
LOG_D(RLC, "MAC DATA IND TO RLC_UM MOD_ID %s enb id %u ue id %u \n", (eNB_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP); LOG_D(RLC, "MAC DATA IND TO RLC_UM MOD_ID %s enb id %u ue id %u \n", (eNB_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP);
#endif #endif
rlc_um_mac_data_indication((rlc_um_entity_t*)rlc_p, frameP, eNB_flagP, data_ind); rlc_um_mac_data_indication((rlc_um_entity_t*)rlc_p, frameP, eNB_flagP, data_ind);
break; break;
case RLC_TM: case RLC_MODE_TM:
#ifdef DEBUG_MAC_INTERFACE #ifdef DEBUG_MAC_INTERFACE
LOG_D(RLC, "MAC DATA IND TO RLC_TM MOD_ID %s enb id %u ue id %u \n", (eNB_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP); LOG_D(RLC, "MAC DATA IND TO RLC_TM MOD_ID %s enb id %u ue id %u \n", (eNB_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP);
#endif #endif
...@@ -313,7 +313,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id ...@@ -313,7 +313,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id
struct mac_status_ind tx_status; struct mac_status_ind tx_status;
struct mac_status_resp status_resp; struct mac_status_resp status_resp;
rb_id_t rb_id = 0; rb_id_t rb_id = 0;
rlc_mode_t rlc_mode = RLC_NONE; rlc_mode_t rlc_mode = RLC_MODE_NONE;
void *rlc_p = NULL; void *rlc_p = NULL;
memset (&mac_rlc_status_resp, 0, sizeof(mac_rlc_status_resp_t)); memset (&mac_rlc_status_resp, 0, sizeof(mac_rlc_status_resp_t));
...@@ -355,17 +355,17 @@ mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id ...@@ -355,17 +355,17 @@ mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id
} }
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode; rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode;
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
//LOG_E (RLC, "enB RLC not configured rb id %u lcid %u enb id %u ue id %u!\n", rb_id, channel_idP, enb_mod_idP, ue_mod_idP); //LOG_E (RLC, "enB RLC not configured rb id %u lcid %u enb id %u ue id %u!\n", rb_id, channel_idP, enb_mod_idP, ue_mod_idP);
return mac_rlc_status_resp; return mac_rlc_status_resp;
break; break;
case RLC_AM: case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.am; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.am;
break; break;
case RLC_UM: case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.um; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.um;
break; break;
case RLC_TM: case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.tm; rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.tm;
break; break;
default: default:
...@@ -384,17 +384,17 @@ mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id ...@@ -384,17 +384,17 @@ mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id
} }
rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode; rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode;
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
AssertFatal (0 , "UE RLC not configured rb id %u lcid %u enb id %u ue id %u!\n", rb_id, channel_idP, enb_mod_idP, ue_mod_idP); AssertFatal (0 , "UE RLC not configured rb id %u lcid %u enb id %u ue id %u!\n", rb_id, channel_idP, enb_mod_idP, ue_mod_idP);
return mac_rlc_status_resp; return mac_rlc_status_resp;
break; break;
case RLC_AM: case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.am; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.am;
break; break;
case RLC_UM: case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.um; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.um;
break; break;
case RLC_TM: case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.tm; rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.tm;
break; break;
default: default:
...@@ -403,11 +403,11 @@ mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id ...@@ -403,11 +403,11 @@ mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id
} }
switch (rlc_mode) { switch (rlc_mode) {
case RLC_NONE: case RLC_MODE_NONE:
//handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP); //handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP);
break; break;
case RLC_AM: case RLC_MODE_AM:
status_resp = rlc_am_mac_status_indication((rlc_am_entity_t*)rlc_p, frameP, tb_sizeP, tx_status); status_resp = rlc_am_mac_status_indication((rlc_am_entity_t*)rlc_p, frameP, tb_sizeP, tx_status);
mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes; mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time; mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time;
...@@ -416,7 +416,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id ...@@ -416,7 +416,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id
return mac_rlc_status_resp; return mac_rlc_status_resp;
break; break;
case RLC_UM: case RLC_MODE_UM:
status_resp = rlc_um_mac_status_indication((rlc_um_entity_t*)rlc_p, frameP, eNB_flagP, tb_sizeP, tx_status); status_resp = rlc_um_mac_status_indication((rlc_um_entity_t*)rlc_p, frameP, eNB_flagP, tb_sizeP, tx_status);
mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes; mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus; mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus;
...@@ -426,7 +426,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id ...@@ -426,7 +426,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id
return mac_rlc_status_resp; return mac_rlc_status_resp;
break; break;
case RLC_TM: case RLC_MODE_TM:
status_resp = rlc_tm_mac_status_indication((rlc_tm_entity_t*)rlc_p, frameP, tb_sizeP, tx_status); status_resp = rlc_tm_mac_status_indication((rlc_tm_entity_t*)rlc_p, frameP, tb_sizeP, tx_status);
mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes; mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus; mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus;
......
...@@ -28,33 +28,38 @@ ...@@ -28,33 +28,38 @@
#include "LAYER2/MAC/extern.h" #include "LAYER2/MAC/extern.h"
#include "assertions.h" #include "assertions.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifdef Rel10 rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP,
rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, SRB_ToAddModList_t* srb2add_listP, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP, PMCH_InfoList_r9_t *pmch_info_listP) { module_id_t ue_mod_idP,
#else frame_t frameP,
rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, SRB_ToAddModList_t* srb2add_listP, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP) { eNB_flag_t enb_flagP,
#endif//----------------------------------------------------------------------------- SRB_ToAddModList_t *srb2add_listP,
rb_id_t rb_id = 0; DRB_ToAddModList_t *drb2add_listP,
logical_chan_id_t lc_id = 0; DRB_ToReleaseList_t *drb2release_listP
DRB_Identity_t drb_id = 0; #if defined(Rel10)
DRB_Identity_t* pdrb_id = NULL; ,PMCH_InfoList_r9_t* pmch_InfoList_r9_pP
long int cnt = 0; #endif
SRB_ToAddMod_t *srb_toaddmod = NULL; ) {
DRB_ToAddMod_t *drb_toaddmod = NULL; //-----------------------------------------------------------------------------
rlc_mode_t rlc_mode = RLC_NONE; rb_id_t rb_id = 0;
#ifdef Rel10 logical_chan_id_t lc_id = 0;
long int cnt2 = 0; DRB_Identity_t drb_id = 0;
// long int mrb_id = 0; DRB_Identity_t* pdrb_id = NULL;
long int mbms_service_id = 0; long int cnt = 0;
// long int mbms_session_id = 0; SRB_ToAddMod_t *srb_toaddmod_p = NULL;
PMCH_Info_r9_t* pmch_info_r9 = NULL; DRB_ToAddMod_t *drb_toaddmod_p = NULL;
MBMS_SessionInfo_r9_t* mbms_session = NULL; rlc_mode_t rlc_mode = RLC_MODE_NONE;
rlc_op_status_t rlc_status = RLC_OP_STATUS_OK; #if defined(Rel10)
DL_UM_RLC_t dl_um_rlc; int i, j;
MBMS_SessionInfoList_r9_t *mbms_SessionInfoList_r9_p = NULL;
MBMS_SessionInfo_r9_t *MBMS_SessionInfo_p = NULL;
mbms_session_id_t mbms_session_id;
mbms_service_id_t mch_id, mbms_service_id;
DL_UM_RLC_t dl_um_rlc;
#endif #endif
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] CONFIG REQ ASN1 \n", LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] CONFIG REQ ASN1 \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP); ue_mod_idP);
...@@ -80,37 +85,37 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue ...@@ -80,37 +85,37 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue
for (cnt=0;cnt<srb2add_listP->list.count;cnt++) { for (cnt=0;cnt<srb2add_listP->list.count;cnt++) {
rb_id = srb2add_listP->list.array[cnt]->srb_Identity; rb_id = srb2add_listP->list.array[cnt]->srb_Identity;
if (eNB_flagP) { if (enb_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode; rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode;
} else { } else {
rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode; rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode;
} }
LOG_D(RLC, "Adding SRB %d, rb_id %d\n",srb2add_listP->list.array[cnt]->srb_Identity,rb_id); LOG_D(RLC, "Adding SRB %d, rb_id %d\n",srb2add_listP->list.array[cnt]->srb_Identity,rb_id);
srb_toaddmod = srb2add_listP->list.array[cnt]; srb_toaddmod_p = srb2add_listP->list.array[cnt];
if (srb_toaddmod->rlc_Config) { if (srb_toaddmod_p->rlc_Config) {
switch (srb_toaddmod->rlc_Config->present) { switch (srb_toaddmod_p->rlc_Config->present) {
case SRB_ToAddMod__rlc_Config_PR_NOTHING: case SRB_ToAddMod__rlc_Config_PR_NOTHING:
break; break;
case SRB_ToAddMod__rlc_Config_PR_explicitValue: case SRB_ToAddMod__rlc_Config_PR_explicitValue:
switch (srb_toaddmod->rlc_Config->choice.explicitValue.present) { switch (srb_toaddmod_p->rlc_Config->choice.explicitValue.present) {
case RLC_Config_PR_NOTHING: case RLC_Config_PR_NOTHING:
break; break;
case RLC_Config_PR_am: case RLC_Config_PR_am:
if (rlc_mode == RLC_NONE) { if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, eNB_flagP, rb_id, rb_id, RLC_AM) == RLC_OP_STATUS_OK) { if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_id, rb_id, RLC_MODE_AM) == RLC_OP_STATUS_OK) {
config_req_rlc_am_asn1 ( config_req_rlc_am_asn1 (
frameP, frameP,
eNB_flagP, enb_flagP,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
&srb_toaddmod->rlc_Config->choice.explicitValue.choice.am, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am,
rb_id, rb_id,
SIGNALLING_RADIO_BEARER); SIGNALLING_RADIO_BEARER);
} else { } else {
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n", LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
rb_id); rb_id);
...@@ -118,29 +123,31 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue ...@@ -118,29 +123,31 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue
} else { } else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d AM ALREADY CONFIGURED, TO DO MODIFY \n", LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d AM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
rb_id); rb_id);
} }
break; break;
case RLC_Config_PR_um_Bi_Directional: case RLC_Config_PR_um_Bi_Directional:
if (rlc_mode == RLC_NONE) { if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, eNB_flagP, rb_id, rb_id, RLC_UM) == RLC_OP_STATUS_OK) { if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_id, rb_id, RLC_MODE_UM) == RLC_OP_STATUS_OK) {
config_req_rlc_um_asn1( config_req_rlc_um_asn1(
frameP, frameP,
eNB_flagP, enb_flagP,
RLC_MBMS_NO, MBMS_FLAG_NO,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
&srb_toaddmod->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.ul_UM_RLC, UNUSED_PARAM_MBMS_SESSION_ID,
&srb_toaddmod->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.dl_UM_RLC, UNUSED_PARAM_MBMS_SERVICE_ID,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.ul_UM_RLC,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.dl_UM_RLC,
rb_id, rb_id,
SIGNALLING_RADIO_BEARER); SIGNALLING_RADIO_BEARER);
} else { } else {
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n", LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
rb_id); rb_id);
...@@ -148,28 +155,30 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue ...@@ -148,28 +155,30 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue
} else { } else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n", LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
rb_id); rb_id);
} }
break; break;
case RLC_Config_PR_um_Uni_Directional_UL: case RLC_Config_PR_um_Uni_Directional_UL:
if (rlc_mode == RLC_NONE) { if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, eNB_flagP, rb_id, rb_id, RLC_UM) == RLC_OP_STATUS_OK) { if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_id, rb_id, RLC_MODE_UM) == RLC_OP_STATUS_OK) {
config_req_rlc_um_asn1( config_req_rlc_um_asn1(
frameP, frameP,
eNB_flagP, enb_flagP,
RLC_MBMS_NO, MBMS_FLAG_NO,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
&srb_toaddmod->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_UL.ul_UM_RLC, UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_UL.ul_UM_RLC,
NULL, NULL,
rb_id, SIGNALLING_RADIO_BEARER); rb_id, SIGNALLING_RADIO_BEARER);
} else { } else {
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n", LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
rb_id); rb_id);
...@@ -177,28 +186,30 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue ...@@ -177,28 +186,30 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue
} else { } else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n", LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
rb_id); rb_id);
} }
break; break;
case RLC_Config_PR_um_Uni_Directional_DL: case RLC_Config_PR_um_Uni_Directional_DL:
if (rlc_mode == RLC_NONE) { if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, eNB_flagP, rb_id, rb_id, RLC_UM) == RLC_OP_STATUS_OK) { if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_id, rb_id, RLC_MODE_UM) == RLC_OP_STATUS_OK) {
config_req_rlc_um_asn1( config_req_rlc_um_asn1(
frameP, frameP,
eNB_flagP, enb_flagP,
RLC_MBMS_NO, MBMS_FLAG_NO,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
NULL, NULL,
&srb_toaddmod->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_DL.dl_UM_RLC, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_DL.dl_UM_RLC,
rb_id, SIGNALLING_RADIO_BEARER); rb_id, SIGNALLING_RADIO_BEARER);
} else { } else {
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n", LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
rb_id); rb_id);
...@@ -206,7 +217,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue ...@@ -206,7 +217,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue
} else { } else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n", LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
rb_id); rb_id);
...@@ -215,30 +226,32 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue ...@@ -215,30 +226,32 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue
default: default:
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] UNKNOWN RLC CONFIG %d \n", LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] UNKNOWN RLC CONFIG %d \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
srb_toaddmod->rlc_Config->choice.explicitValue.present); srb_toaddmod_p->rlc_Config->choice.explicitValue.present);
break; break;
} }
break; break;
case SRB_ToAddMod__rlc_Config_PR_defaultValue: case SRB_ToAddMod__rlc_Config_PR_defaultValue:
#warning TO DO SRB_ToAddMod__rlc_Config_PR_defaultValue #warning TO DO SRB_ToAddMod__rlc_Config_PR_defaultValue
if (rlc_mode == RLC_NONE) { if (rlc_mode == RLC_MODE_NONE) {
rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, eNB_flagP, rb_id, rb_id, RLC_UM); rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_id, rb_id, RLC_MODE_UM);
config_req_rlc_um_asn1( config_req_rlc_um_asn1(
frameP, frameP,
eNB_flagP, enb_flagP,
RLC_MBMS_NO, MBMS_FLAG_NO,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
NULL, // TO DO DEFAULT CONFIG NULL, // TO DO DEFAULT CONFIG
NULL, // TO DO DEFAULT CONFIG NULL, // TO DO DEFAULT CONFIG
rb_id, SIGNALLING_RADIO_BEARER); rb_id, SIGNALLING_RADIO_BEARER);
} else { } else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d DEFAULT UM ALREADY CONFIGURED, TO DO MODIFY \n", LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d DEFAULT UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
rb_id); rb_id);
...@@ -251,114 +264,120 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue ...@@ -251,114 +264,120 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue
} }
if (drb2add_listP != NULL) { if (drb2add_listP != NULL) {
for (cnt=0;cnt<drb2add_listP->list.count;cnt++) { for (cnt=0;cnt<drb2add_listP->list.count;cnt++) {
drb_toaddmod = drb2add_listP->list.array[cnt]; drb_toaddmod_p = drb2add_listP->list.array[cnt];
drb_id = *drb_toaddmod->logicalChannelIdentity;//drb_toaddmod->drb_Identity; drb_id = *drb_toaddmod_p->logicalChannelIdentity;//drb_toaddmod_p->drb_Identity;
lc_id = drb_id; lc_id = drb_id;
if (eNB_flagP) { if (enb_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][drb_id].mode; rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][drb_id].mode;
} else { } else {
rlc_mode = rlc_array_ue[ue_mod_idP][drb_id].mode; rlc_mode = rlc_array_ue[ue_mod_idP][drb_id].mode;
} }
LOG_D(RLC, "Adding DRB %d, rb_id %d\n",*drb_toaddmod->logicalChannelIdentity,drb_id); LOG_D(RLC, "Adding DRB %d, rb_id %d\n",*drb_toaddmod_p->logicalChannelIdentity,drb_id);
if (drb_toaddmod->rlc_Config) { if (drb_toaddmod_p->rlc_Config) {
switch (drb_toaddmod->rlc_Config->present) { switch (drb_toaddmod_p->rlc_Config->present) {
case RLC_Config_PR_NOTHING: case RLC_Config_PR_NOTHING:
break; break;
case RLC_Config_PR_am: case RLC_Config_PR_am:
if (rlc_mode == RLC_NONE) { if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, eNB_flagP, drb_id, lc_id, RLC_AM) == RLC_OP_STATUS_OK) { if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, drb_id, lc_id, RLC_MODE_AM) == RLC_OP_STATUS_OK) {
config_req_rlc_am_asn1 ( config_req_rlc_am_asn1 (
frameP, frameP,
eNB_flagP, enb_flagP,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
&drb_toaddmod->rlc_Config->choice.am, &drb_toaddmod_p->rlc_Config->choice.am,
drb_id, drb_id,
RADIO_ACCESS_BEARER); RADIO_ACCESS_BEARER);
} }
} else { } else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] DRB %d AM ALREADY CONFIGURED, TO DO MODIFY \n", LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] DRB %d AM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
drb_id); drb_id);
} }
break; break;
case RLC_Config_PR_um_Bi_Directional: case RLC_Config_PR_um_Bi_Directional:
if (rlc_mode == RLC_NONE) { if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, eNB_flagP, drb_id, lc_id, RLC_UM) == RLC_OP_STATUS_OK) { if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, drb_id, lc_id, RLC_MODE_UM) == RLC_OP_STATUS_OK) {
config_req_rlc_um_asn1( config_req_rlc_um_asn1(
frameP, frameP,
eNB_flagP, enb_flagP,
RLC_MBMS_NO, MBMS_FLAG_NO,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
&drb_toaddmod->rlc_Config->choice.um_Bi_Directional.ul_UM_RLC, UNUSED_PARAM_MBMS_SESSION_ID,
&drb_toaddmod->rlc_Config->choice.um_Bi_Directional.dl_UM_RLC, UNUSED_PARAM_MBMS_SERVICE_ID,
&drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.ul_UM_RLC,
&drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.dl_UM_RLC,
drb_id, RADIO_ACCESS_BEARER); drb_id, RADIO_ACCESS_BEARER);
} }
} else { } else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] DRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n", LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] DRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
drb_id); drb_id);
} }
break; break;
case RLC_Config_PR_um_Uni_Directional_UL: case RLC_Config_PR_um_Uni_Directional_UL:
if (rlc_mode == RLC_NONE) { if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, eNB_flagP, drb_id, lc_id, RLC_UM) == RLC_OP_STATUS_OK) { if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, drb_id, lc_id, RLC_MODE_UM) == RLC_OP_STATUS_OK) {
config_req_rlc_um_asn1( config_req_rlc_um_asn1(
frameP, frameP,
eNB_flagP, enb_flagP,
RLC_MBMS_NO, MBMS_FLAG_NO,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
&drb_toaddmod->rlc_Config->choice.um_Uni_Directional_UL.ul_UM_RLC, UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
&drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_UL.ul_UM_RLC,
NULL, NULL,
drb_id, RADIO_ACCESS_BEARER); drb_id, RADIO_ACCESS_BEARER);
} }
} else { } else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] DRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n", LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] DRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
drb_id); drb_id);
} }
break; break;
case RLC_Config_PR_um_Uni_Directional_DL: case RLC_Config_PR_um_Uni_Directional_DL:
if (rlc_mode == RLC_NONE) { if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, eNB_flagP, drb_id, lc_id, RLC_UM) == RLC_OP_STATUS_OK) { if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, drb_id, lc_id, RLC_MODE_UM) == RLC_OP_STATUS_OK) {
config_req_rlc_um_asn1( config_req_rlc_um_asn1(
frameP, frameP,
eNB_flagP, enb_flagP,
RLC_MBMS_NO, MBMS_FLAG_NO,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
NULL, NULL,
&drb_toaddmod->rlc_Config->choice.um_Uni_Directional_DL.dl_UM_RLC, &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_DL.dl_UM_RLC,
drb_id, RADIO_ACCESS_BEARER); drb_id, RADIO_ACCESS_BEARER);
} }
} else { } else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] DRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n", LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] DRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
drb_id); drb_id);
} }
break; break;
default: default:
LOG_W(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u][RB %u] unknown drb_toaddmod->rlc_Config->present \n", LOG_W(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u][RB %u] unknown drb_toaddmod_p->rlc_Config->present \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
drb_id); drb_id);
...@@ -369,69 +388,52 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue ...@@ -369,69 +388,52 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue
if (drb2release_listP != NULL) { if (drb2release_listP != NULL) {
for (cnt=0;cnt<drb2release_listP->list.count;cnt++) { for (cnt=0;cnt<drb2release_listP->list.count;cnt++) {
pdrb_id = drb2release_listP->list.array[cnt]; pdrb_id = drb2release_listP->list.array[cnt];
rrc_rlc_remove_rlc(enb_mod_idP, ue_mod_idP, frameP, eNB_flagP, *pdrb_id); rrc_rlc_remove_rlc(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, *pdrb_id);
} }
} }
#ifdef Rel10 #if defined(Rel10)
if (pmch_info_listP != NULL) {
LOG_I(RLC,"[%s %d] Config RLC instance for MBMS\n", (eNB_flagP) ? "eNB" : "UE", (eNB_flagP) ? module_idP : module_idP - NB_eNB_INST);
for (cnt=0;cnt<pmch_info_listP->list.count;cnt++) {
pmch_info_r9 = pmch_info_listP->list.array[cnt];
for (cnt2=0;cnt2<pmch_info_r9->mbms_SessionInfoList_r9.list.count;cnt2++) {
mbms_session = pmch_info_r9->mbms_SessionInfoList_r9.list.array[cnt2];
if (mbms_session->logicalChannelIdentity_r9 > 0) {
// lc_id = (NUMBER_OF_UE_MAX*NB_RB_MAX) + mbms_session->logicalChannelIdentity_r9;
// test this one and tell Lionel
if (eNB_flagP) {
/* SR: (maxDRB = 11 + 3) * 16 = 224... */
lc_id = mbms_session->logicalChannelIdentity_r9 + (maxDRB + 3) * MAX_MOBILES_PER_RG;
} else {
lc_id = mbms_session->logicalChannelIdentity_r9 + (maxDRB + 3);
}
/* if (pmch_InfoList_r9_pP != NULL) {
if (mbms_session->sessionId_r9 != NULL) { for (i=0;i<pmch_InfoList_r9_pP->list.count;i++) {
mbms_session_id = mbms_session->sessionId_r9->buf[0]; mbms_SessionInfoList_r9_p = &(pmch_InfoList_r9_pP->list.array[i]->mbms_SessionInfoList_r9);
} else { for (j=0;j<mbms_SessionInfoList_r9_p->list.count;j++) {
mbms_session_id = mbms_session->logicalChannelIdentity_r9; MBMS_SessionInfo_p = mbms_SessionInfoList_r9_p->list.array[j];
} mbms_session_id = MBMS_SessionInfo_p->sessionId_r9->buf[0];
*/ lc_id = mbms_session_id;
mbms_service_id = mbms_session->tmgi_r9.serviceId_r9.buf[2];// can use the pmch_index, here is the value 'cnt' mbms_service_id = MBMS_SessionInfo_p->tmgi_r9.serviceId_r9.buf[2]; //serviceId is 3-octet string
rb_id = (mbms_service_id * maxSessionPerPMCH) + lc_id; mch_id = mbms_service_id;
if (rlc[module_idP].m_rlc_pointer[rb_id].rlc_type == RLC_NONE) { // can set the mch_id = i
rlc_status = rrc_rlc_add_rlc (module_idP, frameP, rb_id, lc_id, RLC_UM); if (enb_flagP) {
if (rlc_status != RLC_OP_STATUS_OK ) { rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id; // 1
LOG_D(RLC, "[RLC_RRC] COULD NOT ALLOCATE RLC UM INSTANCE\n"); // NO CHECK
continue;//? return rlc_status; /*if (rlc_mbms_array_eNB[enb_mod_idP][mbms_service_id][mbms_session_id].instanciated_instance == enb_mod_idP + 1)
} action = ACTION_MBMS_MODIFY;
} else if (rlc[module_idP].m_rlc_pointer[rb_id].rlc_type != RLC_UM) { else
LOG_E(RLC, "[RLC_RRC] MBMS ERROR IN CONFIG, RLC FOUND ALREADY CONFIGURED FOR MBMS BEARER IS NOT UM\n"); action = ACTION_MBMS_ADD;*/
continue;
}
dl_um_rlc.sn_FieldLength = SN_FieldLength_size5;
dl_um_rlc.t_Reordering = T_Reordering_ms0;
config_req_rlc_um_asn1 (
frameP,
eNB_flagP,
RLC_MBMS_YES,
enb_mod_idP,
ue_mod_idP,
NULL,
&dl_um_rlc,
rb_id,
RADIO_ACCESS_BEARER);
} else { } else {
LOG_D(RLC, "[RLC_RRC] Invalid LogicalChannelIdentity for MTCH --- Value 0 is reserved for MCCH\n"); rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id + (maxDRB + 3); // 15
lc_id = -1; /*if (rlc_mbms_array_ue[ue_mod_idP][mbms_service_id][mbms_session_id].instanciated_instance == ue_mod_idP + 1)
action = ACTION_MBMS_MODIFY;
else
action = ACTION_MBMS_ADD;*/
} }
dl_um_rlc.sn_FieldLength = SN_FieldLength_size5;
dl_um_rlc.t_Reordering = T_Reordering_ms0;
config_req_rlc_um_asn1 (
frameP,
enb_flagP,
MBMS_FLAG_YES,
enb_mod_idP,
ue_mod_idP,
mbms_session_id,
mbms_service_id,
NULL,
&dl_um_rlc,
rb_id,
RADIO_ACCESS_BEARER);
} }
} }
} }
...@@ -439,15 +441,15 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue ...@@ -439,15 +441,15 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] CONFIG REQ ASN1 END \n", LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] CONFIG REQ ASN1 END \n",
frameP, frameP,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
eNB_flagP, enb_flagP,
enb_mod_idP, enb_mod_idP,
ue_mod_idP); ue_mod_idP);
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_op_status_t rlc_op_status_t
rb_release_rlc_tm (struct rlc_tm_entity *rlcP, module_id_t enb_mod_idP, module_id_t ue_mod_idP) rb_release_rlc_tm (rlc_tm_entity_t *rlcP, module_id_t enb_mod_idP, module_id_t ue_mod_idP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_tm_cleanup(rlcP); rlc_tm_cleanup(rlcP);
...@@ -455,7 +457,7 @@ rb_release_rlc_tm (struct rlc_tm_entity *rlcP, module_id_t enb_mod_idP, module_i ...@@ -455,7 +457,7 @@ rb_release_rlc_tm (struct rlc_tm_entity *rlcP, module_id_t enb_mod_idP, module_i
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_op_status_t rlc_op_status_t
rb_release_rlc_um (struct rlc_um_entity *rlcP, module_id_t enb_mod_idP, module_id_t ue_mod_idP) rb_release_rlc_um (rlc_um_entity_t *rlcP, module_id_t enb_mod_idP, module_id_t ue_mod_idP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_um_cleanup(rlcP); rlc_um_cleanup(rlcP);
...@@ -463,17 +465,17 @@ rb_release_rlc_um (struct rlc_um_entity *rlcP, module_id_t enb_mod_idP, module_i ...@@ -463,17 +465,17 @@ rb_release_rlc_um (struct rlc_um_entity *rlcP, module_id_t enb_mod_idP, module_i
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_op_status_t rlc_op_status_t
rb_release_rlc_am (struct rlc_am_entity *rlcP, frame_t frameP, module_id_t enb_mod_idP, module_id_t ue_mod_idP) rb_release_rlc_am (rlc_am_entity_t *rlcP, frame_t frameP, module_id_t enb_mod_idP, module_id_t ue_mod_idP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_am_cleanup(rlcP,frame); rlc_am_cleanup(rlcP,frame);
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP) { rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, rb_id_t rb_idP) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
logical_chan_id_t lcid = 0; logical_chan_id_t lcid = 0;
rlc_mode_t rlc_mode = RLC_NONE; rlc_mode_t rlc_mode = RLC_MODE_NONE;
rlc_op_status_t status; rlc_op_status_t status;
#ifdef OAI_EMU #ifdef OAI_EMU
...@@ -497,10 +499,10 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -497,10 +499,10 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
if (eNB_flagP) { if (enb_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode; rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
switch (rlc_mode) { switch (rlc_mode) {
case RLC_AM: case RLC_MODE_AM:
LOG_D(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] RELEASE RB AM\n", LOG_D(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] RELEASE RB AM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -511,9 +513,9 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -511,9 +513,9 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo
lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid] = RLC_RB_UNALLOCATED; lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid] = RLC_RB_UNALLOCATED;
status = rb_release_rlc_am(&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am, frame, enb_mod_idP, ue_mod_idP); status = rb_release_rlc_am(&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am, frame, enb_mod_idP, ue_mod_idP);
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am.allocation = 0; rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am.allocation = 0;
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_NONE; rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_MODE_NONE;
break; break;
case RLC_TM: case RLC_MODE_TM:
LOG_D(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] RELEASE RB TM\n", LOG_D(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] RELEASE RB TM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -524,9 +526,9 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -524,9 +526,9 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo
lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid] = RLC_RB_UNALLOCATED; lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid] = RLC_RB_UNALLOCATED;
status = rb_release_rlc_tm(&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm, enb_mod_idP, ue_mod_idP); status = rb_release_rlc_tm(&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm, enb_mod_idP, ue_mod_idP);
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm.allocation = 0; rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm.allocation = 0;
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_NONE; rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_MODE_NONE;
break; break;
case RLC_UM: case RLC_MODE_UM:
LOG_D(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] RELEASE RB UM\n", LOG_D(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] RELEASE RB UM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -537,7 +539,7 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -537,7 +539,7 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo
lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid] = RLC_RB_UNALLOCATED; lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid] = RLC_RB_UNALLOCATED;
status = rb_release_rlc_um(&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um, enb_mod_idP, ue_mod_idP); status = rb_release_rlc_um(&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um, enb_mod_idP, ue_mod_idP);
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um.allocation = 0; rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um.allocation = 0;
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_NONE; rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_MODE_NONE;
break; break;
default: default:
LOG_E(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] RELEASE RB mode %d\n", LOG_E(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] RELEASE RB mode %d\n",
...@@ -552,7 +554,7 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -552,7 +554,7 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo
} else { } else {
rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode; rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
switch (rlc_mode) { switch (rlc_mode) {
case RLC_AM: case RLC_MODE_AM:
LOG_D(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] RELEASE RB AM\n", LOG_D(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] RELEASE RB AM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -563,9 +565,9 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -563,9 +565,9 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo
lcid2rbid_ue[ue_mod_idP][lcid] = RLC_RB_UNALLOCATED; lcid2rbid_ue[ue_mod_idP][lcid] = RLC_RB_UNALLOCATED;
status = rb_release_rlc_am(&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am, frame, enb_mod_idP, ue_mod_idP); status = rb_release_rlc_am(&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am, frame, enb_mod_idP, ue_mod_idP);
rlc_array_ue[ue_mod_idP][rb_idP].rlc.am.allocation = 0; rlc_array_ue[ue_mod_idP][rb_idP].rlc.am.allocation = 0;
rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_NONE; rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_MODE_NONE;
break; break;
case RLC_TM: case RLC_MODE_TM:
LOG_D(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] RELEASE RB TM\n", LOG_D(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] RELEASE RB TM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -576,9 +578,9 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -576,9 +578,9 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo
lcid2rbid_ue[ue_mod_idP][lcid] = RLC_RB_UNALLOCATED; lcid2rbid_ue[ue_mod_idP][lcid] = RLC_RB_UNALLOCATED;
status = rb_release_rlc_tm(&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm, enb_mod_idP, ue_mod_idP); status = rb_release_rlc_tm(&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm, enb_mod_idP, ue_mod_idP);
rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm.allocation = 0; rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm.allocation = 0;
rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_NONE; rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_MODE_NONE;
break; break;
case RLC_UM: case RLC_MODE_UM:
LOG_D(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] RELEASE RB UM\n", LOG_D(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] RELEASE RB UM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -589,7 +591,7 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -589,7 +591,7 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo
lcid2rbid_ue[ue_mod_idP][lcid] = RLC_RB_UNALLOCATED; lcid2rbid_ue[ue_mod_idP][lcid] = RLC_RB_UNALLOCATED;
status = rb_release_rlc_um(&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um, enb_mod_idP, ue_mod_idP); status = rb_release_rlc_um(&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um, enb_mod_idP, ue_mod_idP);
rlc_array_ue[ue_mod_idP][rb_idP].rlc.um.allocation = 0; rlc_array_ue[ue_mod_idP][rb_idP].rlc.um.allocation = 0;
rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_NONE; rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_MODE_NONE;
break; break;
default: default:
LOG_E(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] RELEASE RB mode %d\n", LOG_E(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] RELEASE RB mode %d\n",
...@@ -605,9 +607,9 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -605,9 +607,9 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo
return status; return status;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, logical_chan_id_t chan_idP, rlc_mode_t rlc_modeP) { rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, rb_id_t rb_idP, logical_chan_id_t chan_idP, rlc_mode_t rlc_modeP) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_mode_t rlc_mode = RLC_NONE; rlc_mode_t rlc_mode = RLC_MODE_NONE;
unsigned int allocation; unsigned int allocation;
#ifdef OAI_EMU #ifdef OAI_EMU
...@@ -631,9 +633,9 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i ...@@ -631,9 +633,9 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC); AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC);
if (eNB_flagP) { if (enb_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode; rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
if (rlc_mode != RLC_NONE) { if (rlc_mode != RLC_MODE_NONE) {
LOG_E(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB RB IS ALREADY ALLOCATED\n", LOG_E(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB RB IS ALREADY ALLOCATED\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -645,11 +647,11 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i ...@@ -645,11 +647,11 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i
AssertFatal (lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][chan_idP] == RLC_RB_UNALLOCATED, "Bad LC RB %u mapping in RLC layer, channel id %u already configured!\n", rb_idP, chan_idP); AssertFatal (lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][chan_idP] == RLC_RB_UNALLOCATED, "Bad LC RB %u mapping in RLC layer, channel id %u already configured!\n", rb_idP, chan_idP);
lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][chan_idP] = rb_idP; lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][chan_idP] = rb_idP;
switch (rlc_modeP) { switch (rlc_modeP) {
case RLC_AM: case RLC_MODE_AM:
allocation = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am.allocation; allocation = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am.allocation;
if (!(allocation)) { if (!(allocation)) {
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am.allocation = 1; rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am.allocation = 1;
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_AM; rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_MODE_AM;
LOG_I(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB AM\n", LOG_I(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB AM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -666,11 +668,11 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i ...@@ -666,11 +668,11 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i
return RLC_OP_STATUS_BAD_PARAMETER; return RLC_OP_STATUS_BAD_PARAMETER;
} }
break; break;
case RLC_TM: case RLC_MODE_TM:
allocation = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm.allocation; allocation = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm.allocation;
if (!(allocation)) { if (!(allocation)) {
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm.allocation = 1; rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm.allocation = 1;
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_TM; rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_MODE_TM;
LOG_I(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB TM\n", LOG_I(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB TM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -687,11 +689,11 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i ...@@ -687,11 +689,11 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i
return RLC_OP_STATUS_BAD_PARAMETER; return RLC_OP_STATUS_BAD_PARAMETER;
} }
break; break;
case RLC_UM: case RLC_MODE_UM:
allocation = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um.allocation; allocation = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um.allocation;
if (!(allocation)) { if (!(allocation)) {
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um.allocation = 1; rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um.allocation = 1;
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_UM; rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_MODE_UM;
LOG_I(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB UM\n", LOG_I(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB UM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -720,7 +722,7 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i ...@@ -720,7 +722,7 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i
} }
} else { } else {
rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode; rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
if (rlc_mode != RLC_NONE) { if (rlc_mode != RLC_MODE_NONE) {
LOG_E(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB RB IS ALREADY ALLOCATED\n", LOG_E(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB RB IS ALREADY ALLOCATED\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -732,11 +734,11 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i ...@@ -732,11 +734,11 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i
AssertFatal (lcid2rbid_ue[ue_mod_idP][chan_idP] == RLC_RB_UNALLOCATED, "Bad LC RB %u mapping in RLC layer, channel id %u already configured!\n", rb_idP, chan_idP); AssertFatal (lcid2rbid_ue[ue_mod_idP][chan_idP] == RLC_RB_UNALLOCATED, "Bad LC RB %u mapping in RLC layer, channel id %u already configured!\n", rb_idP, chan_idP);
lcid2rbid_ue[ue_mod_idP][chan_idP] = rb_idP; lcid2rbid_ue[ue_mod_idP][chan_idP] = rb_idP;
switch (rlc_modeP) { switch (rlc_modeP) {
case RLC_AM: case RLC_MODE_AM:
allocation = rlc_array_ue[ue_mod_idP][rb_idP].rlc.am.allocation; allocation = rlc_array_ue[ue_mod_idP][rb_idP].rlc.am.allocation;
if (!(allocation)) { if (!(allocation)) {
rlc_array_ue[ue_mod_idP][rb_idP].rlc.am.allocation = 1; rlc_array_ue[ue_mod_idP][rb_idP].rlc.am.allocation = 1;
rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_AM; rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_MODE_AM;
LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB AM\n", LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB AM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -753,11 +755,11 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i ...@@ -753,11 +755,11 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i
return RLC_OP_STATUS_BAD_PARAMETER; return RLC_OP_STATUS_BAD_PARAMETER;
} }
break; break;
case RLC_TM: case RLC_MODE_TM:
allocation = rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm.allocation; allocation = rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm.allocation;
if (!(allocation)) { if (!(allocation)) {
rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm.allocation = 1; rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm.allocation = 1;
rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_TM; rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_MODE_TM;
LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB TM\n", LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB TM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -774,11 +776,11 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i ...@@ -774,11 +776,11 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i
return RLC_OP_STATUS_BAD_PARAMETER; return RLC_OP_STATUS_BAD_PARAMETER;
} }
break; break;
case RLC_UM: case RLC_MODE_UM:
allocation = rlc_array_ue[ue_mod_idP][rb_idP].rlc.um.allocation; allocation = rlc_array_ue[ue_mod_idP][rb_idP].rlc.um.allocation;
if (!(allocation)) { if (!(allocation)) {
rlc_array_ue[ue_mod_idP][rb_idP].rlc.um.allocation = 1; rlc_array_ue[ue_mod_idP][rb_idP].rlc.um.allocation = 1;
rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_UM; rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_MODE_UM;
LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB UM\n", LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB UM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -809,13 +811,13 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i ...@@ -809,13 +811,13 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, config_action_t actionP, rb_id_t rb_idP, rb_type_t rb_typeP, rlc_info_t rlc_infoP) { rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, config_action_t actionP, rb_id_t rb_idP, rb_type_t rb_typeP, rlc_info_t rlc_infoP) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_op_status_t status; rlc_op_status_t status;
LOG_D(RLC, "[FRAME %05u][%s][RLC][MOD %u/%u] CONFIG_REQ for Rab %u\n", LOG_D(RLC, "[FRAME %05u][%s][RLC][MOD %u/%u] CONFIG_REQ for Rab %u\n",
frame, frame,
(eNB_flagP) ? "eNB" : "UE", (enb_flagP) ? "eNB" : "UE",
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
rb_idP); rb_idP);
...@@ -844,12 +846,12 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -844,12 +846,12 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo
switch (actionP) { switch (actionP) {
case ACTION_ADD: case ACTION_ADD:
if ((status = rrc_rlc_add_rlc(enb_mod_idP, ue_mod_idP, frame, eNB_flagP, rb_idP, rb_idP, rlc_infoP.rlc_mode)) != RLC_OP_STATUS_OK) { if ((status = rrc_rlc_add_rlc(enb_mod_idP, ue_mod_idP, frame, enb_flagP, rb_idP, rb_idP, rlc_infoP.rlc_mode)) != RLC_OP_STATUS_OK) {
return status; return status;
} }
case ACTION_MODIFY: case ACTION_MODIFY:
switch (rlc_infoP.rlc_mode) { switch (rlc_infoP.rlc_mode) {
case RLC_AM: case RLC_MODE_AM:
LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] MODIFY RB AM\n", LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] MODIFY RB AM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -858,14 +860,14 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -858,14 +860,14 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo
config_req_rlc_am( config_req_rlc_am(
frame, frame,
eNB_flagP, enb_flagP,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
&rlc_infoP.rlc.rlc_am_info, &rlc_infoP.rlc.rlc_am_info,
rb_idP, rb_idP,
rb_typeP); rb_typeP);
break; break;
case RLC_UM: case RLC_MODE_UM:
LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] MODIFY RB UM\n", LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] MODIFY RB UM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -873,14 +875,14 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -873,14 +875,14 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo
rb_idP); rb_idP);
config_req_rlc_um( config_req_rlc_um(
frame, frame,
eNB_flagP, enb_flagP,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
&rlc_infoP.rlc.rlc_um_info, &rlc_infoP.rlc.rlc_um_info,
rb_idP, rb_idP,
rb_typeP); rb_typeP);
break; break;
case RLC_TM: case RLC_MODE_TM:
LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] MODIFY RB TM\n", LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] MODIFY RB TM\n",
frame, frame,
enb_mod_idP, enb_mod_idP,
...@@ -888,7 +890,7 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -888,7 +890,7 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo
rb_idP); rb_idP);
config_req_rlc_tm( config_req_rlc_tm(
frame, frame,
eNB_flagP, enb_flagP,
enb_mod_idP, enb_mod_idP,
ue_mod_idP, ue_mod_idP,
&rlc_infoP.rlc.rlc_tm_info, &rlc_infoP.rlc.rlc_tm_info,
...@@ -901,7 +903,7 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -901,7 +903,7 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo
break; break;
case ACTION_REMOVE: case ACTION_REMOVE:
return rrc_rlc_remove_rlc(enb_mod_idP, ue_mod_idP, rb_idP, frame, eNB_flagP); return rrc_rlc_remove_rlc(enb_mod_idP, ue_mod_idP, rb_idP, frame, enb_flagP);
break; break;
default: default:
return RLC_OP_STATUS_BAD_PARAMETER; return RLC_OP_STATUS_BAD_PARAMETER;
...@@ -910,14 +912,14 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo ...@@ -910,14 +912,14 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_op_status_t rrc_rlc_data_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, MBMS_flag_t MBMS_flagP, rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, char* sduP) { rlc_op_status_t rrc_rlc_data_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, MBMS_flag_t MBMS_flagP, rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, char* sduP) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
mem_block_t* sdu; mem_block_t* sdu;
sdu = get_free_mem_block(sdu_sizeP); sdu = get_free_mem_block(sdu_sizeP);
if (sdu != NULL) { if (sdu != NULL) {
memcpy (sdu->data, sduP, sdu_sizeP); memcpy (sdu->data, sduP, sdu_sizeP);
return rlc_data_req(enb_mod_idP, ue_mod_idP, frame, eNB_flagP, MBMS_flagP, rb_idP, muiP, confirmP, sdu_sizeP, sdu); return rlc_data_req(enb_mod_idP, ue_mod_idP, frame, enb_flagP, MBMS_flagP, rb_idP, muiP, confirmP, sdu_sizeP, sdu);
} else { } else {
return RLC_OP_STATUS_INTERNAL_ERROR; return RLC_OP_STATUS_INTERNAL_ERROR;
} }
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
#include "LAYER2/RLC/rlc.h" #include "LAYER2/RLC/rlc.h"
#include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h" #include "LAYER2/MAC/extern.h"
#include "LAYER2/PDCP/pdcp.h" #include "LAYER2/PDCP_v10.1.0/pdcp.h"
#include "UTIL/LOG/log.h" #include "UTIL/LOG/log.h"
static mapping rrc_status_names[] = { static mapping rrc_status_names[] = {
......
...@@ -69,34 +69,34 @@ typedef struct ...@@ -69,34 +69,34 @@ typedef struct
// eNB functions // eNB functions
/// Invoke dlsch/ulsch scheduling procedure for new subframe /// Invoke dlsch/ulsch scheduling procedure for new subframe
void (*eNB_dlsch_ulsch_scheduler)(u8 Mod_id, u8 cooperation_flag, u32 frame, u8 subframe);//, int calibration_flag); void (*eNB_dlsch_ulsch_scheduler)(u8 Mod_id, u8 cooperation_flag, frame_t frameP, u8 subframe);//, int calibration_flag);
/// Fill random access response sdu, passing timing advance /// Fill random access response sdu, passing timing advance
u16 (*fill_rar)(u8 Mod_id,u32 frame,u8 *dlsch_buffer,u16 N_RB_UL, u8 input_buffer_length); u16 (*fill_rar)(u8 Mod_id,frame_t frameP,u8 *dlsch_buffer,u16 N_RB_UL, u8 input_buffer_length);
/// Terminate the RA procedure upon reception of l3msg on ulsch /// Terminate the RA procedure upon reception of l3msg on ulsch
void (*terminate_ra_proc)(u8 Mod_id,u32 frame,u16 UE_id, u8 *l3msg, u16 l3msg_len); void (*terminate_ra_proc)(u8 Mod_id,frame_t frameP,u16 UE_id, u8 *l3msg, u16 l3msg_len);
/// Initiate the RA procedure upon reception (hypothetical) of a valid preamble /// Initiate the RA procedure upon reception (hypothetical) of a valid preamble
void (*initiate_ra_proc)(u8 Mod_id,u32 frame,u16 preamble,s16 timing_offset,u8 sect_id,u8 subframe,u8 f_id); void (*initiate_ra_proc)(u8 Mod_id,frame_t frameP,u16 preamble,s16 timing_offset,u8 sect_id,u8 subframe,u8 f_id);
/// cancel an ongoing RA procedure /// cancel an ongoing RA procedure
void (*cancel_ra_proc)(u8 Mod_id,u32 frame,u16 preamble); void (*cancel_ra_proc)(u8 Mod_id,frame_t frameP,u16 preamble);
/// Get DCI for current subframe from MAC /// Get DCI for current subframe from MAC
DCI_PDU* (*get_dci_sdu)(u8 Mod_id,u32 frame,u8 subframe); DCI_PDU* (*get_dci_sdu)(u8 Mod_id,frame_t frameP,u8 subframe);
/// Get DLSCH sdu for particular RNTI and Transport block index /// Get DLSCH sdu for particular RNTI and Transport block index
u8* (*get_dlsch_sdu)(u8 Mod_id,u32 frame,u16 rnti,u8 TB_index); u8* (*get_dlsch_sdu)(u8 Mod_id,frame_t frameP,u16 rnti,u8 TB_index);
/// Send ULSCH sdu to MAC for given rnti /// Send ULSCH sdu to MAC for given rnti
void (*rx_sdu)(u8 Mod_id,u32 frame,u16 rnti, u8 *sdu,u16 sdu_len); void (*rx_sdu)(u8 Mod_id,frame_t frameP,u16 rnti, u8 *sdu,u16 sdu_len);
/// Indicate failure to synch to external source /// Indicate failure to synch to external source
void (*mrbch_phy_sync_failure) (u8 Mod_id,u32 frame, u8 free_eNB_index); void (*mrbch_phy_sync_failure) (u8 Mod_id,frame_t frameP, u8 free_eNB_index);
/// Indicate Scheduling Request from UE /// Indicate Scheduling Request from UE
void (*SR_indication)(u8 Mod_id,u32 frame,u16 rnti,u8 subframe); void (*SR_indication)(u8 Mod_id,frame_t frameP,u16 rnti,u8 subframe);
/// Configure Common PHY parameters from SIB1 /// Configure Common PHY parameters from SIB1
void (*phy_config_sib1_eNB)(u8 Mod_id, void (*phy_config_sib1_eNB)(u8 Mod_id,
...@@ -124,7 +124,7 @@ typedef struct ...@@ -124,7 +124,7 @@ typedef struct
#ifdef Rel10 #ifdef Rel10
/// Get MCH sdu and corresponding MCS for particular MBSFN subframe /// Get MCH sdu and corresponding MCS for particular MBSFN subframe
MCH_PDU* (*get_mch_sdu)(uint8_t Mod_id,uint32_t frame,uint32_t subframe); MCH_PDU* (*get_mch_sdu)(uint8_t Mod_id,frame_t frameP,uint32_t subframe);
#endif #endif
// configure the cba rnti at the physical layer // configure the cba rnti at the physical layer
void (*phy_config_cba_rnti)(u8 Mod_id,u8 eNB_flag, u8 index, u16 cba_rnti, u8 cba_group_id, u8 num_active_cba_groups); void (*phy_config_cba_rnti)(u8 Mod_id,u8 eNB_flag, u8 index, u16 cba_rnti, u8 cba_group_id, u8 num_active_cba_groups);
...@@ -135,40 +135,40 @@ typedef struct ...@@ -135,40 +135,40 @@ typedef struct
void (*phy_reset_ue)(u8 Mod_id,u8 eNB_index); void (*phy_reset_ue)(u8 Mod_id,u8 eNB_index);
/// Indicate loss of synchronization of PBCH for this eNB to MAC layer /// Indicate loss of synchronization of PBCH for this eNB to MAC layer
void (*out_of_sync_ind)(u8 Mod_id,u32 frame,u16 eNB_index); void (*out_of_sync_ind)(u8 Mod_id,frame_t frameP,u16 eNB_index);
/// Send a received SI sdu /// Send a received SI sdu
void (*ue_decode_si)(u8 Mod_id,u32 frame, u8 CH_index, void *pdu, u16 len); void (*ue_decode_si)(u8 Mod_id,frame_t frameP, u8 CH_index, void *pdu, u16 len);
/// Send a received DLSCH sdu to MAC /// Send a received DLSCH sdu to MAC
void (*ue_send_sdu)(u8 Mod_id,u32 frame,u8 *sdu,u16 sdu_len,u8 CH_index); void (*ue_send_sdu)(u8 Mod_id,frame_t frameP,u8 *sdu,u16 sdu_len,u8 CH_index);
#ifdef Rel10 #ifdef Rel10
/// Send a received MCH sdu to MAC /// Send a received MCH sdu to MAC
void (*ue_send_mch_sdu)(u8 Mod_id,u32 frame,u8 *sdu,u16 sdu_len,u8 eNB_index,u8 sync_area); void (*ue_send_mch_sdu)(u8 Mod_id,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eNB_index,u8 sync_area);
/// Function to check if UE PHY needs to decode MCH for MAC /// Function to check if UE PHY needs to decode MCH for MAC
/// get the sync area id, and teturn MCS value if need to decode, otherwise -1 /// get the sync area id, and teturn MCS value if need to decode, otherwise -1
int (*ue_query_mch)(uint8_t Mod_id,uint32_t frame,uint32_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active); int (*ue_query_mch)(uint8_t Mod_id,frame_t frameP,uint32_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active);
#endif #endif
/// Retrieve ULSCH sdu from MAC /// Retrieve ULSCH sdu from MAC
void (*ue_get_sdu)(u8 Mod_id,u32 frame,u8 subframe, u8 CH_index,u8 *ulsch_buffer,u16 buflen,u8 *access_mode); void (*ue_get_sdu)(u8 Mod_id,frame_t frameP,u8 subframe, u8 CH_index,u8 *ulsch_buffer,u16 buflen,u8 *access_mode);
/// Retrieve RRCConnectionReq from MAC /// Retrieve RRCConnectionReq from MAC
PRACH_RESOURCES_t* (*ue_get_rach)(u8 Mod_id,u32 frame,u8 Msg3_flag,u8 subframe); PRACH_RESOURCES_t* (*ue_get_rach)(u8 Mod_id,frame_t frameP,u8 Msg3_flag,u8 subframe);
/// Process Random-Access Response /// Process Random-Access Response
u16 (*ue_process_rar)(u8 Mod_id,u32 frame,u8 *dlsch_buffer,u16 *t_crnti,u8 preamble_index); u16 (*ue_process_rar)(u8 Mod_id,frame_t frameP,u8 *dlsch_buffer,u16 *t_crnti,u8 preamble_index);
/// Get SR payload (0,1) from UE MAC /// Get SR payload (0,1) from UE MAC
u32 (*ue_get_SR)(u8 Mod_id,u32 frame,u8 eNB_id,u16 rnti,u8 subframe); u32 (*ue_get_SR)(u8 Mod_id,frame_t frameP,u8 eNB_id,u16 rnti,u8 subframe);
/// Indicate synchronization with valid PBCH /// Indicate synchronization with valid PBCH
void (*dl_phy_sync_success) (u8 Mod_id,u32 frame, u8 CH_index,u8 first_sync); void (*dl_phy_sync_success) (u8 Mod_id,frame_t frameP, u8 CH_index,u8 first_sync);
/// Only calls the PDCP for now /// Only calls the PDCP for now
UE_L2_STATE_t (*ue_scheduler)(u8 Mod_id, u32 frame,u8 subframe, lte_subframe_t direction,u8 eNB_id); UE_L2_STATE_t (*ue_scheduler)(u8 Mod_id, frame_t frameP,u8 subframe, lte_subframe_t direction,u8 eNB_id);
/// PHY-Config-Dedicated UE /// PHY-Config-Dedicated UE
void (*phy_config_dedicated_ue)(u8 Mod_id,u8 CH_index, void (*phy_config_dedicated_ue)(u8 Mod_id,u8 CH_index,
...@@ -205,10 +205,10 @@ typedef struct ...@@ -205,10 +205,10 @@ typedef struct
void (*ra_succeeded)(u8 Mod_id,u8 eNB_index); void (*ra_succeeded)(u8 Mod_id,u8 eNB_index);
/// Function to indicate the transmission of msg1/rach to MAC /// Function to indicate the transmission of msg1/rach to MAC
void (*Msg1_transmitted)(u8 Mod_id,u32 frame,u8 eNB_id); void (*Msg1_transmitted)(u8 Mod_id,frame_t frameP,u8 eNB_id);
/// Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer /// Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer
void (*Msg3_transmitted)(u8 Mod_id,u32 frame,u8 eNB_id); void (*Msg3_transmitted)(u8 Mod_id,frame_t frameP,u8 eNB_id);
/// Function to pass inter-cell measurement parameters to PHY (cell Ids) /// Function to pass inter-cell measurement parameters to PHY (cell Ids)
void (*phy_config_meas_ue)(u8 Mod_id,u8 eNB_index,u8 n_adj_cells,u32 *adj_cell_id); void (*phy_config_meas_ue)(u8 Mod_id,u8 eNB_index,u8 n_adj_cells,u32 *adj_cell_id);
......
...@@ -89,122 +89,72 @@ ...@@ -89,122 +89,72 @@
/********************************************************************************************************************/ /********************************************************************************************************************/
s8 mac_rrc_data_req(module_id_t module_idP, frame_t frameP, rb_id_t srb_idP, u8 nb_tbP,u8 *buffer_pP, eNB_flag_t eNB_flagP, u8 eNB_indexP, u8 mbsfn_sync_areaP){ s8 mac_rrc_data_req(module_id_t module_idP, frame_t frameP, rb_id_t srb_idP, u8 nb_tbP,u8 *buffer_pP, eNB_flag_t eNB_flagP, u8 eNB_indexP, u8 mbsfn_sync_areaP){
/********************************************************************************************************************/ /********************************************************************************************************************/
#ifdef CELLULAR
return(rrc_L2_data_req_rx(module_idP,srb_idP,nb_tbP,buffer_pP,eNB_indexP));
#else
return(mac_rrc_lite_data_req(module_idP,frameP,srb_idP,nb_tbP,buffer_pP,eNB_flagP,eNB_indexP,mbsfn_sync_areaP)); return(mac_rrc_lite_data_req(module_idP,frameP,srb_idP,nb_tbP,buffer_pP,eNB_flagP,eNB_indexP,mbsfn_sync_areaP));
#endif //CELLULAR
} }
/********************************************************************************************************************/ /********************************************************************************************************************/
s8 mac_rrc_data_ind(module_id_t module_idP, frame_t frameP, rb_id_t srb_idP, u8 *sduP, sdu_size_t sdu_lenP, eNB_flag_t eNB_flagP, u8 eNB_indexP,u8 mbsfn_sync_area){ s8 mac_rrc_data_ind(module_id_t module_idP, frame_t frameP, rb_id_t srb_idP, u8 *sduP, sdu_size_t sdu_lenP, eNB_flag_t eNB_flagP, u8 eNB_indexP,u8 mbsfn_sync_area){
/********************************************************************************************************************/ /********************************************************************************************************************/
#ifdef CELLULAR
return(rrc_L2_mac_data_ind_rx(module_idP, Srb_id, Sdu, Sdu_len, eNB_indexP));
#else
return(mac_rrc_lite_data_ind(module_idP,frameP,srb_idP,sduP,sdu_lenP,eNB_flagP,eNB_indexP,mbsfn_sync_area)); return(mac_rrc_lite_data_ind(module_idP,frameP,srb_idP,sduP,sdu_lenP,eNB_flagP,eNB_indexP,mbsfn_sync_area));
#endif //CELLULAR
} }
/********************************************************************************************************************/ /********************************************************************************************************************/
void rlcrrc_data_ind(module_id_t enb_instP, module_id_t ue_instP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t srb_idP, sdu_size_t sdu_lenP,u8 *buffer_pP){ void rlcrrc_data_ind(module_id_t enb_instP, module_id_t ue_instP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t srb_idP, sdu_size_t sdu_lenP,u8 *buffer_pP){
/********************************************************************************************************************/ /********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_rlc_data_ind_rx(module_idP,Srb_id, sdu_lenP, buffer_pP);
#else // now this is called from PDCP
//rlcrrc_lite_data_ind(module_idP,frameP,eNB_flag,Srb_id,Sdu_size,Buffer);
rrc_lite_data_ind(enb_instP, ue_instP,frameP,eNB_flagP,srb_idP,sdu_lenP,buffer_pP); rrc_lite_data_ind(enb_instP, ue_instP,frameP,eNB_flagP,srb_idP,sdu_lenP,buffer_pP);
#endif //CELLULAR
} }
/********************************************************************************************************************/ /********************************************************************************************************************/
u8 pdcp_rrc_data_req(module_id_t enb_instP, module_id_t ue_instP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, mui_t muiP, boolean_t confirmP, u8 pdcp_rrc_data_req(module_id_t enb_instP, module_id_t ue_instP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, mui_t muiP, boolean_t confirmP,
sdu_size_t sdu_buffer_sizeP, u8* sdu_buffer_pP, u8 modeP) { sdu_size_t sdu_buffer_sizeP, u8* sdu_buffer_pP, u8 modeP) {
/********************************************************************************************************************/ /********************************************************************************************************************/
#ifdef CELLULAR
return pdcp_data_req( module_id, frameP, eNB_flag, rb_id, muiP, confirmP, sdu_buffer_sizeP, sdu_buffer_pP, modeP);
#else
return rrc_lite_data_req (enb_instP, ue_instP, frameP, eNB_flagP, rb_idP, muiP, confirmP, sdu_buffer_sizeP, sdu_buffer_pP, modeP); return rrc_lite_data_req (enb_instP, ue_instP, frameP, eNB_flagP, rb_idP, muiP, confirmP, sdu_buffer_sizeP, sdu_buffer_pP, modeP);
#endif
} }
/********************************************************************************************************************/ /********************************************************************************************************************/
void pdcp_rrc_data_ind(module_id_t enb_instP, module_id_t ue_instP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t srb_idP, sdu_size_t sdu_sizeP,u8 *buffer_pP){ void pdcp_rrc_data_ind(module_id_t enb_instP, module_id_t ue_instP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t srb_idP, sdu_size_t sdu_sizeP,u8 *buffer_pP){
/********************************************************************************************************************/ /********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_rlc_data_ind_rx(module_idP,srb_idP, sdu_sizeP, buffer_pP);
#else // now this is called from PDCP
//rlcrrc_lite_data_ind(module_idP,frameP,eNB_flag,Srb_id,Sdu_size,Buffer);
rrc_lite_data_ind(enb_instP, ue_instP,frameP,eNB_flagP,srb_idP,sdu_sizeP,buffer_pP); rrc_lite_data_ind(enb_instP, ue_instP,frameP,eNB_flagP,srb_idP,sdu_sizeP,buffer_pP);
#endif //CELLULAR
} }
/********************************************************************************************************************/ /********************************************************************************************************************/
void mac_rrc_meas_ind(module_id_t module_idP,MAC_MEAS_REQ_ENTRY *Meas_entry_pP){ void mac_rrc_meas_ind(module_id_t module_idP,MAC_MEAS_REQ_ENTRY *Meas_entry_pP){
/********************************************************************************************************************/ /********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_mac_meas_ind_rx ();
#else
// mac_rrc_meas_ind(module_idP,Meas_entry_pP); // mac_rrc_meas_ind(module_idP,Meas_entry_pP);
#endif //CELLULAR
} }
/********************************************************************************************************************/ /********************************************************************************************************************/
void mac_sync_ind(module_id_t module_idP,u8 Status){ void mac_sync_ind(module_id_t module_idP,u8 Status){
/********************************************************************************************************************/ /********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_sync_ind_rx(module_idP);
#else
mac_lite_sync_ind(module_idP,Status); mac_lite_sync_ind(module_idP,Status);
#endif //CELLULAR
} }
/********************************************************************************************************************/ /********************************************************************************************************************/
void mac_in_sync_ind(module_id_t module_idP,frame_t frameP, u16 eNB_indexP){ void mac_in_sync_ind(module_id_t module_idP,frame_t frameP, u16 eNB_indexP){
/********************************************************************************************************************/ /********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_sync_ind_rx(module_idP);
#else
rrc_lite_in_sync_ind(module_idP,frameP,eNB_indexP); rrc_lite_in_sync_ind(module_idP,frameP,eNB_indexP);
#endif
} }
/********************************************************************************************************************/ /********************************************************************************************************************/
void mac_out_of_sync_ind(module_id_t module_idP,frame_t frameP, u16 eNB_indexP){ void mac_out_of_sync_ind(module_id_t module_idP,frame_t frameP, u16 eNB_indexP){
/********************************************************************************************************************/ /********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_out_sync_ind_rx();
#else
rrc_lite_out_of_sync_ind(module_idP,frameP,eNB_indexP); rrc_lite_out_of_sync_ind(module_idP,frameP,eNB_indexP);
#endif //CELLULAR
} }
/********************************************************************************************************************/ /********************************************************************************************************************/
int mac_get_rrc_status(module_id_t module_idP,eNB_flag_t eNB_flagP,u8 indexP) { int mac_get_rrc_status(module_id_t module_idP,eNB_flag_t eNB_flagP,u8 indexP) {
/********************************************************************************************************************/ /********************************************************************************************************************/
#ifdef CELLULAR
return (rrc_L2_get_rrc_status(module_idP,eNB_flagP,indexP));
#else
return mac_get_rrc_lite_status(module_idP, eNB_flagP, indexP); return mac_get_rrc_lite_status(module_idP, eNB_flagP, indexP);
#endif //CELLULAR
} }
/********************************************************************************************************************/ /********************************************************************************************************************/
char openair_rrc_ue_init(module_id_t module_idP, unsigned char eNB_indexP){ char openair_rrc_ue_init(module_id_t module_idP, unsigned char eNB_indexP){
/********************************************************************************************************************/ /********************************************************************************************************************/
#ifdef CELLULAR
return (rrc_L2_ue_init(module_idP,eNB_indexP));
#else
return openair_rrc_lite_ue_init(module_idP, eNB_indexP); return openair_rrc_lite_ue_init(module_idP, eNB_indexP);
#endif //CELLULAR
} }
/********************************************************************************************************************/ /********************************************************************************************************************/
char openair_rrc_eNB_init(module_id_t module_idP){ char openair_rrc_eNB_init(module_id_t module_idP){
/********************************************************************************************************************/ /********************************************************************************************************************/
#ifdef CELLULAR
return( rrc_L2_eNB_init(module_idP));
#else
return openair_rrc_lite_eNB_init(module_idP); return openair_rrc_lite_eNB_init(module_idP);
#endif //CELLULAR
} }
...@@ -123,13 +123,13 @@ int rrc_init_global_param(void) { ...@@ -123,13 +123,13 @@ int rrc_init_global_param(void) {
DTCH_UL_LCHAN_DESC.max_transport_blocks = 20; DTCH_UL_LCHAN_DESC.max_transport_blocks = 20;
DTCH_UL_LCHAN_DESC.Delay_class = 1; DTCH_UL_LCHAN_DESC.Delay_class = 1;
Rlc_info_um.rlc_mode = RLC_UM; Rlc_info_um.rlc_mode = RLC_MODE_UM;
Rlc_info_um.rlc.rlc_um_info.timer_reordering = 5; Rlc_info_um.rlc.rlc_um_info.timer_reordering = 5;
Rlc_info_um.rlc.rlc_um_info.sn_field_length = 10; Rlc_info_um.rlc.rlc_um_info.sn_field_length = 10;
Rlc_info_um.rlc.rlc_um_info.is_mXch = 0; Rlc_info_um.rlc.rlc_um_info.is_mXch = 0;
//Rlc_info_um.rlc.rlc_um_info.sdu_discard_mode=16; //Rlc_info_um.rlc.rlc_um_info.sdu_discard_mode=16;
Rlc_info_am_config.rlc_mode = RLC_AM; Rlc_info_am_config.rlc_mode = RLC_MODE_AM;
Rlc_info_am_config.rlc.rlc_am_info.max_retx_threshold = 50; Rlc_info_am_config.rlc.rlc_am_info.max_retx_threshold = 50;
Rlc_info_am_config.rlc.rlc_am_info.poll_pdu = 8; Rlc_info_am_config.rlc.rlc_am_info.poll_pdu = 8;
Rlc_info_am_config.rlc.rlc_am_info.poll_byte = 1000; Rlc_info_am_config.rlc.rlc_am_info.poll_byte = 1000;
......
...@@ -2486,7 +2486,7 @@ char openair_rrc_lite_eNB_init (module_id_t Mod_id) ...@@ -2486,7 +2486,7 @@ char openair_rrc_lite_eNB_init (module_id_t Mod_id)
} }
char openair_rrc_lite_eNB_configuration (u8 Mod_id, RrcConfigurationReq *configuration) char openair_rrc_lite_eNB_configuration (u8 Mod_id, RrcConfigurationReq *configuration)
#else #else
char openair_rrc_lite_eNB_init (u8 Mod_id) char openair_rrc_lite_eNB_init (module_id_t Mod_id)
#endif #endif
{ {
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
...@@ -2599,11 +2599,9 @@ int rrc_eNB_decode_ccch (module_id_t Mod_id, frame_t frameP, SRB_INFO * Srb_info ...@@ -2599,11 +2599,9 @@ int rrc_eNB_decode_ccch (module_id_t Mod_id, frame_t frameP, SRB_INFO * Srb_info
{ {
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
u16 Idx, UE_index; u16 Idx, UE_index;
asn_dec_rval_t dec_rval;
asn_dec_rval_t dec_rval; UL_CCCH_Message_t *ul_ccch_msg = NULL;
//UL_CCCH_Message_t ulccchmsg;
UL_CCCH_Message_t *ul_ccch_msg = NULL; //&ulccchmsg;
RRCConnectionRequest_r8_IEs_t *rrcConnectionRequest; RRCConnectionRequest_r8_IEs_t *rrcConnectionRequest;
int i, rval; int i, rval;
......
...@@ -34,429 +34,430 @@ ...@@ -34,429 +34,430 @@
//#define DEBUG_SIM //#define DEBUG_SIM
void Process_Func(int node_id,int port,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im, void Process_Func(int node_id,int port,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms){ node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms){
if(node_id<MAX_eNB) if(node_id<MAX_eNB)
eNB_Inst(node_id,port,r_re0,r_im0,r_re,r_im,s_re,s_im,enb_data,abstraction_flag,frame_parms); eNB_Inst(node_id,port,r_re0,r_im0,r_re,r_im,s_re,s_im,enb_data,abstraction_flag,frame_parms);
else else
UE_Inst(node_id,port,r_re0,r_im0,r_re,r_im,s_re,s_im,ue_data,abstraction_flag,frame_parms); UE_Inst(node_id,port,r_re0,r_im0,r_re,r_im,s_re,s_im,ue_data,abstraction_flag,frame_parms);
} }
void UE_Inst(int node_id,int port,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im, void UE_Inst(int node_id,int port,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,
node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms){ node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms){
int next_slot,last_slot,slot=0,UE_id=0,eNB_id=0; int next_slot,last_slot,slot=0,UE_id=0,eNB_id=0;
lte_subframe_t direction; lte_subframe_t direction;
printf("UE [ %d ] Starts \n",node_id-MAX_eNB); printf("UE [ %d ] Starts \n",node_id-MAX_eNB);
// init_mmap(node_id,frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0); // init_mmap(node_id,frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
init_channel_vars (frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0); init_channel_vars (frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
mmap_ue(node_id,&PHY_vars_UE_g[0]->lte_ue_common_vars.txdata,&PHY_vars_UE_g[0]->lte_ue_common_vars.rxdata,frame_parms); mmap_ue(node_id,&PHY_vars_UE_g[0]->lte_ue_common_vars.txdata,&PHY_vars_UE_g[0]->lte_ue_common_vars.rxdata,frame_parms);
// Interface_init(port,node_id); // Interface_init(port,node_id);
char p_input[FILENAMEMAX]; char p_input[FILENAMEMAX];
int fd_pipe; int fd_pipe;
int fd_channel; int fd_channel;
mkfifo("/tmp/channel", 0666); mkfifo("/tmp/channel", 0666);
fd_channel=open("/tmp/channel",O_RDWR,0); fd_channel=open("/tmp/channel",O_RDWR,0);
sprintf(p_input,"/tmp/pipe_%d",node_id); sprintf(p_input,"/tmp/pipe_%d",node_id);
mkfifo(p_input, 0666); mkfifo(p_input, 0666);
fd_pipe=open(p_input,O_RDWR,0); fd_pipe=open(p_input,O_RDWR,0);
// IntInitAll(); // IntInitAll();
mac_xface->frame=0; mac_xface->frame=0;
while(1){ while(1){
// wait_4slot(&slot,&mac_xface->frame); // wait_4slot(&slot,&mac_xface->frame);
read(fd_pipe,&slot,sizeof(slot)); read(fd_pipe,&slot,sizeof(slot));
last_slot = (slot - 1)%20; last_slot = (slot - 1)%20;
if (last_slot <0) if (last_slot <0)
last_slot+=20; last_slot+=20;
next_slot = (slot + 1)%20; next_slot = (slot + 1)%20;
direction = subframe_select(frame_parms,next_slot>>1); direction = subframe_select(frame_parms,next_slot>>1);
#ifdef DEBUG_SIM #ifdef DEBUG_SIM
printf("\n\n[SIM] EMU PHY procedures UE %d for frame %d, slot %d (subframe %d)\n", printf("\n\n[SIM] EMU PHY procedures UE %d for frame %d, slot %d (subframe %d)\n",
UE_id,mac_xface->frame, slot, (next_slot >> 1)); UE_id,mac_xface->frame, slot, (next_slot >> 1));
#endif #endif
if (PHY_vars_UE_g[UE_id]->UE_mode[0] != NOT_SYNCHED) { if (PHY_vars_UE_g[UE_id]->UE_mode[0] != NOT_SYNCHED) {
if ((mac_xface->frame)>0) { if ((mac_xface->frame)>0) {
phy_procedures_UE_lte ((last_slot),(next_slot), PHY_vars_UE_g[UE_id], 0, abstraction_flag); phy_procedures_UE_lte ((last_slot),(next_slot), PHY_vars_UE_g[UE_id], 0, abstraction_flag);
} }
} }
else { else {
if (((mac_xface->frame)>0) && ((last_slot) == (SLOTS_PER_FRAME-1))) { if (((mac_xface->frame)>0) && ((last_slot) == (SLOTS_PER_FRAME-1))) {
initial_sync(PHY_vars_UE_g[UE_id]); initial_sync(PHY_vars_UE_g[UE_id]);
} }
} }
if( direction == SF_UL || (direction == SF_S && next_slot%2!=0)){ if( direction == SF_UL || (direction == SF_S && next_slot%2!=0)){
do_OFDM_mod(PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdataF,PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdata,next_slot,&PHY_vars_UE_g[UE_id]->lte_frame_parms); do_OFDM_mod(PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdataF,PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdata,next_slot,&PHY_vars_UE_g[UE_id]->lte_frame_parms);
} }
write(fd_channel,&node_id,sizeof(node_id)); write(fd_channel,&node_id,sizeof(node_id));
// send_exec_complete(CHANNEL_PORT); // send_exec_complete(CHANNEL_PORT);
if(slot==19) if(slot==19)
(mac_xface->frame)++; (mac_xface->frame)++;
} }
} }
void eNB_Inst(int node_id,int port,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im, void eNB_Inst(int node_id,int port,double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms){ node_desc_t *enb_data[NUMBER_OF_eNB_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms){
int next_slot,last_slot,slot=0,UE_id=0,eNB_id=0; int next_slot,last_slot,slot=0,UE_id=0,eNB_id=0;
lte_subframe_t direction; lte_subframe_t direction;
printf("eNB [ %d ] Starts \n",node_id); printf("eNB [ %d ] Starts \n",node_id);
// init_mmap(node_id,frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0); // init_mmap(node_id,frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
init_channel_vars (frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0); init_channel_vars (frame_parms, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
mmap_enb(node_id,PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata,PHY_vars_eNB_g[0]->lte_eNB_common_vars.rxdata,frame_parms); mmap_enb(node_id,PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata,PHY_vars_eNB_g[0]->lte_eNB_common_vars.rxdata,frame_parms);
// Interface_init(port,node_id); // Interface_init(port,node_id);
// IntInitAll(); // IntInitAll();
char p_input[FILENAMEMAX]; char p_input[FILENAMEMAX];
int fd_pipe; int fd_pipe;
int fd_channel; int fd_channel;
mkfifo("/tmp/channel", 0666);
fd_channel=open("/tmp/channel",O_RDWR,0); mkfifo("/tmp/channel", 0666);
sprintf(p_input,"/tmp/pipe_%d",node_id); fd_channel=open("/tmp/channel",O_RDWR,0);
mkfifo(p_input, 0666); sprintf(p_input,"/tmp/pipe_%d",node_id);
fd_pipe=open(p_input, O_RDWR,0); mkfifo(p_input, 0666);
mac_xface->frame=0; fd_pipe=open(p_input, O_RDWR,0);
mac_xface->frame=0;
while(1){
// wait_4slot(&slot,&mac_xface->frame); while(1){
read(fd_pipe,&slot,sizeof(slot)); // wait_4slot(&slot,&mac_xface->frame);
read(fd_pipe,&slot,sizeof(slot));
last_slot = (slot - 1)%20;
if (last_slot <0) last_slot = (slot - 1)%20;
last_slot+=20; if (last_slot <0)
next_slot = (slot + 1)%20; last_slot+=20;
direction = subframe_select(frame_parms,next_slot>>1); next_slot = (slot + 1)%20;
#ifdef DEBUG_SIM direction = subframe_select(frame_parms,next_slot>>1);
printf #ifdef DEBUG_SIM
("\n\n [SIM]EMU PHY procedures eNB %d for frame %d, slot %d (subframe %d) (rxdataF_ext %p) Nid_cell %d\n", printf
eNB_id, mac_xface->frame, slot, next_slot >> 1, ("\n\n [SIM]EMU PHY procedures eNB %d for frame %d, slot %d (subframe %d) (rxdataF_ext %p) Nid_cell %d\n",
PHY_vars_eNB_g[0]->lte_eNB_ulsch_vars[0]->rxdataF_ext, PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Nid_cell); eNB_id, mac_xface->frame, slot, next_slot >> 1,
#endif PHY_vars_eNB_g[0]->lte_eNB_ulsch_vars[0]->rxdataF_ext, PHY_vars_eNB_g[eNB_id]->lte_frame_parms.Nid_cell);
phy_procedures_eNB_lte (last_slot, next_slot, PHY_vars_eNB_g[eNB_id], abstraction_flag); #endif
phy_procedures_eNB_lte (last_slot, next_slot, PHY_vars_eNB_g[eNB_id], abstraction_flag);
if( direction == SF_DL || (direction == SF_S && next_slot%2==0)){
do_OFDM_mod(PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdataF[0], if( direction == SF_DL || (direction == SF_S && next_slot%2==0)){
PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdata[0], do_OFDM_mod(PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdataF[0],
next_slot, PHY_vars_eNB_g[eNB_id]->lte_eNB_common_vars.txdata[0],
&PHY_vars_eNB_g[eNB_id]->lte_frame_parms); next_slot,
} &PHY_vars_eNB_g[eNB_id]->lte_frame_parms);
}
write(fd_channel,&node_id,sizeof(node_id));
// send_exec_complete(CHANNEL_PORT); write(fd_channel,&node_id,sizeof(node_id));
if(slot==19) // send_exec_complete(CHANNEL_PORT);
(mac_xface->frame)++; if(slot==19)
} (mac_xface->frame)++;
}
} }
void Channel_Inst(int node_id,int port,double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0, void Channel_Inst(int node_id,int port,double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0,
double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX], double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms){ channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms){
// Interface_init(port,node_id); // Interface_init(port,node_id);
// IntInitAll(); // IntInitAll();
mkfifo("/tmp/channel", 0666); mkfifo("/tmp/channel", 0666);
fd_channel=open("/tmp/channel", O_RDWR ,0); fd_channel=open("/tmp/channel", O_RDWR ,0);
int next_slot,last_slot,slot=0,UE_id=0,eNB_id=0; int next_slot,last_slot,slot=0,UE_id=0,eNB_id=0;
lte_subframe_t direction; lte_subframe_t direction;
char in_buffer[100]; char in_buffer[100];
int ci,ji=0; int ci,ji=0;
for(ci=0;ci<NB_eNB_INST;ci++) for(ci=0;ci<NB_eNB_INST;ci++)
{ {
mmap_enb(ji,tx[ci],rx[ci],frame_parms); mmap_enb(ji,tx[ci],rx[ci],frame_parms);
init_channel_vars (frame_parms, &(s_re[ci]), &(s_im[ci]), &(r_re[ci]), &(r_im[ci]), &(r_re0), &(r_im0)); init_channel_vars (frame_parms, &(s_re[ci]), &(s_im[ci]), &(r_re[ci]), &(r_im[ci]), &(r_re0), &(r_im0));
// init_mmap_channel(ji,frame_parms, &(s_re[ci]), &(s_im[ci]), &(r_re[ci]), &(r_im[ci]), &(r_re0), &(r_im0)); // init_mmap_channel(ji,frame_parms, &(s_re[ci]), &(s_im[ci]), &(r_re[ci]), &(r_im[ci]), &(r_re0), &(r_im0));
sprintf(in_buffer, "/tmp/pipe_%d",ji); sprintf(in_buffer, "/tmp/pipe_%d",ji);
mkfifo(in_buffer, 0666); mkfifo(in_buffer, 0666);
fd_NB[ci]=open(in_buffer, O_RDWR ,0); fd_NB[ci]=open(in_buffer, O_RDWR ,0);
ji++; ji++;
} }
ji=0; ji=0;
for(ci=NB_eNB_INST;ci<(NB_eNB_INST+NB_UE_INST);ci++) for(ci=NB_eNB_INST;ci<(NB_eNB_INST+NB_UE_INST);ci++)
{ {
mmap_enb(MAX_eNB+ji,tx[ci],rx[ci],frame_parms); mmap_enb(MAX_eNB+ji,tx[ci],rx[ci],frame_parms);
init_channel_vars (frame_parms, &(s_re[ci]), &(s_im[ci]), &(r_re[ci]), &(r_im[ci]), &(r_re0), &(r_im0)); init_channel_vars (frame_parms, &(s_re[ci]), &(s_im[ci]), &(r_re[ci]), &(r_im[ci]), &(r_re0), &(r_im0));
// init_mmap_channel(MAX_eNB+ji,frame_parms, &(s_re[ci]), &(s_im[ci]), &(r_re[ci]), &(r_im[ci]), &(r_re0), &(r_im0)); // init_mmap_channel(MAX_eNB+ji,frame_parms, &(s_re[ci]), &(s_im[ci]), &(r_re[ci]), &(r_im[ci]), &(r_re0), &(r_im0));
sprintf(in_buffer, "/tmp/pipe_%d",MAX_eNB+ji); sprintf(in_buffer, "/tmp/pipe_%d",MAX_eNB+ji);
mkfifo(in_buffer, 0666); mkfifo(in_buffer, 0666);
fd_NB[ci]=open(in_buffer, O_RDWR ,0); fd_NB[ci]=open(in_buffer, O_RDWR ,0);
ji++; ji++;
} }
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) { for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) { for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
init_rre(frame_parms,&(r_re0_u[eNB_id][UE_id]),&(r_im0_u[eNB_id][UE_id])); init_rre(frame_parms,&(r_re0_u[eNB_id][UE_id]),&(r_im0_u[eNB_id][UE_id]));
init_rre(frame_parms,&(r_re0_d[UE_id][eNB_id]),&(r_im0_d[UE_id][eNB_id])); init_rre(frame_parms,&(r_re0_d[UE_id][eNB_id]),&(r_im0_d[UE_id][eNB_id]));
} }
} }
for(eNB_id=0;eNB_id<NB_eNB_INST;eNB_id++){ for(eNB_id=0;eNB_id<NB_eNB_INST;eNB_id++){
for(UE_id=0;UE_id<NB_UE_INST;UE_id++){ for(UE_id=0;UE_id<NB_UE_INST;UE_id++){
e2u_t[eNB_id][UE_id]=(ch_thread*)calloc(1,sizeof(ch_thread)); e2u_t[eNB_id][UE_id]=(ch_thread*)calloc(1,sizeof(ch_thread));
} }
} }
for(UE_id=0;UE_id<NB_UE_INST;UE_id++){ for(UE_id=0;UE_id<NB_UE_INST;UE_id++){
for(eNB_id=0;eNB_id<NB_eNB_INST;eNB_id++){ for(eNB_id=0;eNB_id<NB_eNB_INST;eNB_id++){
u2e_t[UE_id][eNB_id]=(ch_thread*)calloc(1,sizeof(ch_thread)); u2e_t[UE_id][eNB_id]=(ch_thread*)calloc(1,sizeof(ch_thread));
} }
} }
pthread_t cthr_u[NB_eNB_INST][NB_UE_INST]; pthread_t cthr_u[NB_eNB_INST][NB_UE_INST];
pthread_t cthr_d[NB_UE_INST][NB_eNB_INST]; pthread_t cthr_d[NB_UE_INST][NB_eNB_INST];
pthread_mutex_init(&downlink_mutex_channel,NULL); pthread_mutex_init(&downlink_mutex_channel,NULL);
pthread_mutex_init(&uplink_mutex_channel,NULL); pthread_mutex_init(&uplink_mutex_channel,NULL);
pthread_mutex_init(&exclusive,NULL); pthread_mutex_init(&exclusive,NULL);
if (pthread_cond_init (&downlink_cond_channel, NULL)) exit(1); if (pthread_cond_init (&downlink_cond_channel, NULL)) exit(1);
if (pthread_cond_init (&uplink_cond_channel, NULL)) exit(1); if (pthread_cond_init (&uplink_cond_channel, NULL)) exit(1);
if (pthread_mutex_lock(&downlink_mutex_channel)) exit(1); if (pthread_mutex_lock(&downlink_mutex_channel)) exit(1);
if (pthread_mutex_lock(&uplink_mutex_channel)) exit(1); if (pthread_mutex_lock(&uplink_mutex_channel)) exit(1);
NUM_THREAD_DOWNLINK=0; NUM_THREAD_DOWNLINK=0;
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){ for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){
for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) { for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) {
u2e_t[UE_id][eNB_id]->thread_id=NUM_THREAD_DOWNLINK; u2e_t[UE_id][eNB_id]->thread_id=NUM_THREAD_DOWNLINK;
u2e_t[UE_id][eNB_id]->eNB_id=eNB_id; u2e_t[UE_id][eNB_id]->eNB_id=eNB_id;
u2e_t[UE_id][eNB_id]->UE_id=UE_id; u2e_t[UE_id][eNB_id]->UE_id=UE_id;
u2e_t[UE_id][eNB_id]->r_re0=r_re0_d[UE_id][eNB_id]; u2e_t[UE_id][eNB_id]->r_re0=r_re0_d[UE_id][eNB_id];
u2e_t[UE_id][eNB_id]->r_im0=r_im0_d[UE_id][eNB_id]; u2e_t[UE_id][eNB_id]->r_im0=r_im0_d[UE_id][eNB_id];
u2e_t[UE_id][eNB_id]->r_re=r_re[NB_eNB_INST+UE_id]; u2e_t[UE_id][eNB_id]->r_re=r_re[NB_eNB_INST+UE_id];
u2e_t[UE_id][eNB_id]->r_im=r_im[NB_eNB_INST+UE_id]; u2e_t[UE_id][eNB_id]->r_im=r_im[NB_eNB_INST+UE_id];
u2e_t[UE_id][eNB_id]->s_im=s_im[eNB_id]; u2e_t[UE_id][eNB_id]->s_im=s_im[eNB_id];
u2e_t[UE_id][eNB_id]->s_re=s_re[eNB_id]; u2e_t[UE_id][eNB_id]->s_re=s_re[eNB_id];
u2e_t[UE_id][eNB_id]->eNB2UE=eNB2UE[eNB_id][UE_id]; u2e_t[UE_id][eNB_id]->eNB2UE=eNB2UE[eNB_id][UE_id];
u2e_t[UE_id][eNB_id]->UE2eNB=UE2eNB[UE_id][eNB_id]; u2e_t[UE_id][eNB_id]->UE2eNB=UE2eNB[UE_id][eNB_id];
u2e_t[UE_id][eNB_id]->enb_data=enb_data[eNB_id]; u2e_t[UE_id][eNB_id]->enb_data=enb_data[eNB_id];
u2e_t[UE_id][eNB_id]->ue_data=ue_data[UE_id]; u2e_t[UE_id][eNB_id]->ue_data=ue_data[UE_id];
u2e_t[UE_id][eNB_id]->next_slot=&next_slot; u2e_t[UE_id][eNB_id]->next_slot=&next_slot;
u2e_t[UE_id][eNB_id]->abstraction_flag=&abstraction_flag; u2e_t[UE_id][eNB_id]->abstraction_flag=&abstraction_flag;
u2e_t[UE_id][eNB_id]->frame_parms=frame_parms; u2e_t[UE_id][eNB_id]->frame_parms=frame_parms;
u2e_t[UE_id][eNB_id]->tx_data[3]=tx[eNB_id][3]; u2e_t[UE_id][eNB_id]->tx_data[3]=tx[eNB_id][3];
u2e_t[UE_id][eNB_id]->rx_data[3]=rx[NB_eNB_INST+UE_id][3]; u2e_t[UE_id][eNB_id]->rx_data[3]=rx[NB_eNB_INST+UE_id][3];
if(pthread_cond_init (&downlink_cond[eNB_id][UE_id], NULL)) exit(1); if(pthread_cond_init (&downlink_cond[eNB_id][UE_id], NULL)) exit(1);
if(pthread_mutex_lock(&downlink_mutex[eNB_id][UE_id])) exit(1); if(pthread_mutex_lock(&downlink_mutex[eNB_id][UE_id])) exit(1);
pthread_create (&cthr_d[UE_id][eNB_id], NULL, do_DL_sig_channel_T,(void*)(u2e_t[UE_id][eNB_id])); pthread_create (&cthr_d[UE_id][eNB_id], NULL, do_DL_sig_channel_T,(void*)(u2e_t[UE_id][eNB_id]));
NUM_THREAD_DOWNLINK++; NUM_THREAD_DOWNLINK++;
} }
} }
NUM_THREAD_UPLINK=0; NUM_THREAD_UPLINK=0;
for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) { for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) {
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){ for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){
e2u_t[eNB_id][UE_id]->thread_id=NUM_THREAD_UPLINK; e2u_t[eNB_id][UE_id]->thread_id=NUM_THREAD_UPLINK;
e2u_t[eNB_id][UE_id]->eNB_id=eNB_id; e2u_t[eNB_id][UE_id]->eNB_id=eNB_id;
e2u_t[eNB_id][UE_id]->UE_id=UE_id; e2u_t[eNB_id][UE_id]->UE_id=UE_id;
e2u_t[eNB_id][UE_id]->r_re=r_re[eNB_id]; e2u_t[eNB_id][UE_id]->r_re=r_re[eNB_id];
e2u_t[eNB_id][UE_id]->r_im=r_im[eNB_id]; e2u_t[eNB_id][UE_id]->r_im=r_im[eNB_id];
e2u_t[eNB_id][UE_id]->r_re0=r_re0_u[eNB_id][UE_id]; e2u_t[eNB_id][UE_id]->r_re0=r_re0_u[eNB_id][UE_id];
e2u_t[eNB_id][UE_id]->r_im0=r_im0_u[eNB_id][UE_id]; e2u_t[eNB_id][UE_id]->r_im0=r_im0_u[eNB_id][UE_id];
e2u_t[eNB_id][UE_id]->s_im=s_im[NB_eNB_INST+UE_id]; e2u_t[eNB_id][UE_id]->s_im=s_im[NB_eNB_INST+UE_id];
e2u_t[eNB_id][UE_id]->s_re=s_re[NB_eNB_INST+UE_id]; e2u_t[eNB_id][UE_id]->s_re=s_re[NB_eNB_INST+UE_id];
e2u_t[eNB_id][UE_id]->eNB2UE=eNB2UE[eNB_id][UE_id]; e2u_t[eNB_id][UE_id]->eNB2UE=eNB2UE[eNB_id][UE_id];
e2u_t[eNB_id][UE_id]->UE2eNB=UE2eNB[UE_id][eNB_id]; e2u_t[eNB_id][UE_id]->UE2eNB=UE2eNB[UE_id][eNB_id];
e2u_t[eNB_id][UE_id]->enb_data=enb_data[eNB_id]; e2u_t[eNB_id][UE_id]->enb_data=enb_data[eNB_id];
e2u_t[eNB_id][UE_id]->ue_data=ue_data[UE_id]; e2u_t[eNB_id][UE_id]->ue_data=ue_data[UE_id];
e2u_t[eNB_id][UE_id]->next_slot=&next_slot; e2u_t[eNB_id][UE_id]->next_slot=&next_slot;
e2u_t[eNB_id][UE_id]->abstraction_flag=&abstraction_flag; e2u_t[eNB_id][UE_id]->abstraction_flag=&abstraction_flag;
e2u_t[eNB_id][UE_id]->frame_parms=frame_parms; e2u_t[eNB_id][UE_id]->frame_parms=frame_parms;
e2u_t[eNB_id][UE_id]->tx_data[3]=tx[NB_eNB_INST+UE_id][3]; e2u_t[eNB_id][UE_id]->tx_data[3]=tx[NB_eNB_INST+UE_id][3];
e2u_t[eNB_id][UE_id]->rx_data[3]=rx[eNB_id][3]; e2u_t[eNB_id][UE_id]->rx_data[3]=rx[eNB_id][3];
if(pthread_cond_init (&uplink_cond[UE_id][eNB_id], NULL)) exit(1); if(pthread_cond_init (&uplink_cond[UE_id][eNB_id], NULL)) exit(1);
if(pthread_mutex_lock(&uplink_mutex[UE_id][eNB_id])) exit(1); if(pthread_mutex_lock(&uplink_mutex[UE_id][eNB_id])) exit(1);
pthread_create (&cthr_u[eNB_id][UE_id], NULL, do_UL_sig_channel_T,(void*)e2u_t[eNB_id][UE_id]); pthread_create (&cthr_u[eNB_id][UE_id], NULL, do_UL_sig_channel_T,(void*)e2u_t[eNB_id][UE_id]);
NUM_THREAD_UPLINK++; NUM_THREAD_UPLINK++;
} }
} }
} }
void Channel_DL(double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0, void Channel_DL(double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0,
double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX], double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,int slot){ channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,int slot){
int count=0; int count=0;
int next_slot,last_slot,UE_id=0,eNB_id=0; int next_slot,last_slot,UE_id=0,eNB_id=0;
lte_subframe_t direction; lte_subframe_t direction;
s32 **txdata,**rxdata; s32 **txdata,**rxdata;
double tx_pwr, rx_pwr; double tx_pwr, rx_pwr;
s32 rx_pwr2; s32 rx_pwr2;
u32 i; u32 i;
u32 slot_offset; u32 slot_offset;
for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) { for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) {
write(fd_NB[eNB_id],&slot,sizeof(slot)); write(fd_NB[eNB_id],&slot,sizeof(slot));
count++; count++;
//send_exec_msg(mac_xface->frame,slot,eNB_PORT+eNB_id); //send_exec_msg(mac_xface->frame,slot,eNB_PORT+eNB_id);
} }
while(count--){ while(count--){
int dummy=1; int dummy=1;
read(fd_channel,&dummy,sizeof(dummy)); read(fd_channel,&dummy,sizeof(dummy));
//wait_4Msg(); //wait_4Msg();
} }
for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) { for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) {
frame_parms = &PHY_vars_eNB_g[eNB_id]->lte_frame_parms; frame_parms = &PHY_vars_eNB_g[eNB_id]->lte_frame_parms;
slot_offset = (nslot)*(frame_parms->samples_per_tti>>1); slot_offset = (nslot)*(frame_parms->samples_per_tti>>1);
txdata =tx[eNB_id][0]; txdata =tx[eNB_id][0];
tx_pwr = dac_fixed_gain(s_re[eNB_id], tx_pwr = dac_fixed_gain(s_re[eNB_id],
s_im[eNB_id], s_im[eNB_id],
txdata, txdata,
slot_offset, slot_offset,
frame_parms->nb_antennas_tx, frame_parms->nb_antennas_tx,
frame_parms->samples_per_tti>>1, frame_parms->samples_per_tti>>1,
14, 14,
40); 40);
printf("[SIM][DL] eNB %d: tx_pwr %f dB for slot %d (subframe %d)\n",eNB_id,10*log10(tx_pwr),nslot,nslot>>1); printf("[SIM][DL] eNB %d: tx_pwr %f dB for slot %d (subframe %d)\n",eNB_id,10*log10(tx_pwr),nslot,nslot>>1);
} }
_COT=0; _COT=0;
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){ for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){
for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) { for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) {
if(pthread_cond_signal(&downlink_cond[eNB_id][UE_id])) exit(1); if(pthread_cond_signal(&downlink_cond[eNB_id][UE_id])) exit(1);
if(pthread_mutex_unlock(&downlink_mutex[eNB_id][UE_id])) exit(1); if(pthread_mutex_unlock(&downlink_mutex[eNB_id][UE_id])) exit(1);
} }
} }
if(pthread_cond_wait(&downlink_cond_channel, &downlink_mutex_channel)) exit(1); if(pthread_cond_wait(&downlink_cond_channel, &downlink_mutex_channel)) exit(1);
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){ for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){
Clean_Param(r_re[NB_eNB_INST+UE_id],r_im[NB_eNB_INST+UE_id],frame_parms); Clean_Param(r_re[NB_eNB_INST+UE_id],r_im[NB_eNB_INST+UE_id],frame_parms);
for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) { for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) {
Channel_Out(SF_DL,eNB_id,UE_id,r_re[NB_eNB_INST+UE_id],r_im[NB_eNB_INST+UE_id],r_re0_d[UE_id][eNB_id],r_im0_d[UE_id][eNB_id],frame_parms); Channel_Out(SF_DL,eNB_id,UE_id,r_re[NB_eNB_INST+UE_id],r_im[NB_eNB_INST+UE_id],r_re0_d[UE_id][eNB_id],r_im0_d[UE_id][eNB_id],frame_parms);
// adc_channel(eNB_id,UE_id,r_re[NB_eNB_INST+UE_id],r_im[NB_eNB_INST+UE_id]); // adc_channel(eNB_id,UE_id,r_re[NB_eNB_INST+UE_id],r_im[NB_eNB_INST+UE_id]);
} }
} }
count=0; count=0;
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++) for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++)
if (mac_xface->frame >= (UE_id * 10)) { if (mac_xface->frame >= (UE_id * 10)) {
write(fd_NB[NB_eNB_INST+UE_id],&slot,sizeof(slot)); write(fd_NB[NB_eNB_INST+UE_id],&slot,sizeof(slot));
//send_exec_msg(mac_xface->frame,slot,UE_PORT+UE_id); //send_exec_msg(mac_xface->frame,slot,UE_PORT+UE_id);
count++; count++;
} }
while(count--){ while(count--){
int dummy=1; int dummy=1;
read(fd_channel,&dummy,sizeof(dummy)); read(fd_channel,&dummy,sizeof(dummy));
//wait_4Msg(); //wait_4Msg();
} }
} }
void Channel_UL(double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0, void Channel_UL(double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0,
double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX], double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,int slot){ channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,int slot){
int count=0; int count=0;
int next_slot,last_slot,UE_id=0,eNB_id=0; int next_slot,last_slot,UE_id=0,eNB_id=0;
lte_subframe_t direction; lte_subframe_t direction;
s32 **txdata,**rxdata; s32 **txdata,**rxdata;
double tx_pwr, rx_pwr; double tx_pwr, rx_pwr;
s32 rx_pwr2; s32 rx_pwr2;
u32 i; u32 i;
u32 slot_offset; u32 slot_offset;
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++) for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++)
if (mac_xface->frame >= (UE_id * 10)) { if (mac_xface->frame >= (UE_id * 10)) {
write(fd_NB[NB_eNB_INST+UE_id],&slot,sizeof(slot)); write(fd_NB[NB_eNB_INST+UE_id],&slot,sizeof(slot));
//send_exec_msg(mac_xface->frame,slot,UE_PORT+UE_id); //send_exec_msg(mac_xface->frame,slot,UE_PORT+UE_id);
count++; count++;
} }
while(count--){ while(count--){
int dummy=1; int dummy=1;
read(fd_channel,&dummy,sizeof(dummy)); read(fd_channel,&dummy,sizeof(dummy));
//wait_4Msg(); //wait_4Msg();
} }
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){ for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){
frame_parms = &PHY_vars_UE_g[UE_id]->lte_frame_parms; frame_parms = &PHY_vars_UE_g[UE_id]->lte_frame_parms;
slot_offset = (nslot)*(frame_parms->samples_per_tti>>1); slot_offset = (nslot)*(frame_parms->samples_per_tti>>1);
txdata =tx[NB_eNB_INST+UE_id][0]; //PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdata; txdata =tx[NB_eNB_INST+UE_id][0]; //PHY_vars_UE_g[UE_id]->lte_ue_common_vars.txdata;
tx_pwr = dac_fixed_gain(s_re[NB_eNB_INST+UE_id], tx_pwr = dac_fixed_gain(s_re[NB_eNB_INST+UE_id],
s_im[NB_eNB_INST+UE_id], s_im[NB_eNB_INST+UE_id],
txdata, txdata,
slot_offset, slot_offset,
frame_parms->nb_antennas_tx, frame_parms->nb_antennas_tx,
frame_parms->samples_per_tti>>1, frame_parms->samples_per_tti>>1,
14, 14,
18); 18);
printf("[SIM][UL] UE %d tx_pwr %f dB for slot %d (subframe %d)\n",UE_id,10*log10(tx_pwr),nslot,nslot>>1); printf("[SIM][UL] UE %d tx_pwr %f dB for slot %d (subframe %d)\n",UE_id,10*log10(tx_pwr),nslot,nslot>>1);
rx_pwr = signal_energy_fp(s_re[NB_eNB_INST+UE_id],s_im[NB_eNB_INST+UE_id],frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0); rx_pwr = signal_energy_fp(s_re[NB_eNB_INST+UE_id],s_im[NB_eNB_INST+UE_id],frame_parms->nb_antennas_rx,frame_parms->samples_per_tti>>1,0);
printf("[SIM][UL] UE %d tx_pwr %f dB for slot %d (subframe %d)\n",UE_id,10*log10(rx_pwr),nslot,nslot>>1); printf("[SIM][UL] UE %d tx_pwr %f dB for slot %d (subframe %d)\n",UE_id,10*log10(rx_pwr),nslot,nslot>>1);
} }
_COT_U=0; _COT_U=0;
for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) { for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) {
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){ for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){
if ( pthread_cond_signal(&uplink_cond[UE_id][eNB_id])) exit(1); if ( pthread_cond_signal(&uplink_cond[UE_id][eNB_id])) exit(1);
if ( pthread_mutex_unlock(&uplink_mutex[UE_id][eNB_id])) exit(1); if ( pthread_mutex_unlock(&uplink_mutex[UE_id][eNB_id])) exit(1);
}} }}
if ( pthread_cond_wait(&uplink_cond_channel, &uplink_mutex_channel)) exit(1); if ( pthread_cond_wait(&uplink_cond_channel, &uplink_mutex_channel)) exit(1);
for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) { for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) {
Clean_Param(r_re[eNB_id],r_im[eNB_id],frame_parms); Clean_Param(r_re[eNB_id],r_im[eNB_id],frame_parms);
for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){ for (UE_id = 0; UE_id < (NB_UE_INST); UE_id++){
Channel_Out(SF_UL,eNB_id,UE_id,r_re[eNB_id],r_im[eNB_id],r_re0_u[eNB_id][UE_id],r_im0_u[eNB_id][UE_id],frame_parms); printf("[SIM][DL] eNB %d: tx_pwr %f dB for slot %d (subframe %d)\n",eNB_id,10*log10(tx_pwr),next_slot,next_slot>>1); Channel_Out(SF_UL,eNB_id,UE_id,r_re[eNB_id],r_im[eNB_id],r_re0_u[eNB_id][UE_id],r_im0_u[eNB_id][UE_id],frame_parms); printf("[SIM][DL] eNB %d: tx_pwr %f dB for slot %d (subframe %d)\n",eNB_id,10*log10(tx_pwr),next_slot,next_slot>>1);
} }
} }
count=0; count=0;
for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) { for (eNB_id=0;eNB_id<(NB_eNB_INST);eNB_id++) {
write(fd_NB[eNB_id],&slot,sizeof(slot)); write(fd_NB[eNB_id],&slot,sizeof(slot));
// send_exec_msg(mac_xface->frame,slot,eNB_PORT+eNB_id); // send_exec_msg(mac_xface->frame,slot,eNB_PORT+eNB_id);
count++; count++;
} }
while(count--){ while(count--){
int dummy=1; int dummy=1;
read(fd_channel,&dummy,sizeof(dummy)); read(fd_channel,&dummy,sizeof(dummy));
// wait_4Msg(); // wait_4Msg();
} }
} }
void Channel_Func(double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0, void Channel_Func(double **s_re[MAX_eNB+MAX_UE],double **s_im[MAX_eNB+MAX_UE],double **r_re[MAX_eNB+MAX_UE],double **r_im[MAX_eNB+MAX_UE],double **r_re0,double **r_im0,
double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX], double **r_re0_d[MAX_UE][MAX_eNB],double **r_im0_d[MAX_UE][MAX_eNB],double **r_re0_u[MAX_eNB][MAX_UE],double **r_im0_u[MAX_eNB][MAX_UE],channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX],
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,int slot){ channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX],node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],u8 abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,int slot){
int last_slot; int last_slot;
lte_subframe_t direction; lte_subframe_t direction;
last_slot = (slot - 1)%20; last_slot = (slot - 1)%20;
if (last_slot <0) if (last_slot <0)
last_slot+=20; last_slot+=20;
nslot = (slot + 1)%20; nslot = (slot + 1)%20;
direction = subframe_select(frame_parms,nslot>>1); direction = subframe_select(frame_parms,nslot>>1);
if( direction == SF_DL || (direction == SF_S && nslot%2==0)){ if( direction == SF_DL || (direction == SF_S && nslot%2==0)){
Channel_DL(s_re,s_im,r_re,r_im,r_re0,r_im0,r_re0_d,r_im0_d,r_re0_u,r_im0_u,eNB2UE,UE2eNB,enb_data,ue_data,abstraction_flag,frame_parms,slot); Channel_DL(s_re,s_im,r_re,r_im,r_re0,r_im0,r_re0_d,r_im0_d,r_re0_u,r_im0_u,eNB2UE,UE2eNB,enb_data,ue_data,abstraction_flag,frame_parms,slot);
} }
else{ else{
Channel_UL(s_re,s_im,r_re,r_im,r_re0,r_im0,r_re0_d,r_im0_d,r_re0_u,r_im0_u,eNB2UE,UE2eNB,enb_data,ue_data,abstraction_flag,frame_parms,slot); Channel_UL(s_re,s_im,r_re,r_im,r_re0,r_im0,r_re0_d,r_im0_d,r_re0_u,r_im0_u,eNB2UE,UE2eNB,enb_data,ue_data,abstraction_flag,frame_parms,slot);
} }
} }
...@@ -17,7 +17,7 @@ CPUFLAGS += $(shell if grep --silent ssse3 /proc/cpuinfo ; then echo "-mssse3" ; ...@@ -17,7 +17,7 @@ CPUFLAGS += $(shell if grep --silent ssse3 /proc/cpuinfo ; then echo "-mssse3" ;
CPUFLAGS += $(shell if grep --silent -w sse4 /proc/cpuinfo ; then echo "-msse4" ; else echo ""; fi) CPUFLAGS += $(shell if grep --silent -w sse4 /proc/cpuinfo ; then echo "-msse4" ; else echo ""; fi)
linux = $(shell if [ `uname` = "Linux" ] ; then echo "1" ; else echo "0" ; fi) linux = $(shell if [ `uname` = "Linux" ] ; then echo "1" ; else echo "0" ; fi)
CFLAGS += -g -ggdb CFLAGS += -g -ggdb -Wstrict-prototypes -Wpointer-sign
CFLAGS += -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 $(CPUFLAGS) -I/usr/include/X11 #-Wno-packed-bitfield-compat CFLAGS += -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 $(CPUFLAGS) -I/usr/include/X11 #-Wno-packed-bitfield-compat
# Check if GCC version is greater or equal to 4.4 # Check if GCC version is greater or equal to 4.4
......
...@@ -1067,7 +1067,6 @@ int main(int argc, char **argv) { ...@@ -1067,7 +1067,6 @@ int main(int argc, char **argv) {
init_omv (); init_omv ();
#endif #endif
//Before this call, NB_UE_INST and NB_eNB_INST are not set correctly //Before this call, NB_UE_INST and NB_eNB_INST are not set correctly
check_and_adjust_params (); check_and_adjust_params ();
set_seed = oai_emulation.emulation_config.seed.value; set_seed = oai_emulation.emulation_config.seed.value;
......
...@@ -118,8 +118,10 @@ extern channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX]; ...@@ -118,8 +118,10 @@ extern channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
extern channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX]; extern channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
extern mapping small_scale_names[]; extern mapping small_scale_names[];
extern pdcp_mbms_t pdcp_mbms_array[MAX_MODULES][16*29]; #if defined(Rel10)
//extern int eMBMS_active; extern pdcp_mbms_t pdcp_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];
extern pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];
#endif
extern void help (void); extern void help (void);
...@@ -751,7 +753,7 @@ void init_seed(u8 set_seed) { ...@@ -751,7 +753,7 @@ void init_seed(u8 set_seed) {
} }
void init_openair1() { void init_openair1() {
s32 UE_id, eNB_id; module_id_t UE_id, eNB_id;
#if defined(ENABLE_RAL) #if defined(ENABLE_RAL)
int list_index; int list_index;
#endif #endif
...@@ -821,16 +823,16 @@ void init_openair1() { ...@@ -821,16 +823,16 @@ void init_openair1() {
void init_openair2() { void init_openair2() {
#ifdef OPENAIR2 #ifdef OPENAIR2
s32 i; module_id_t enb_id;
s32 UE_id; module_id_t UE_id;
l2_init (&PHY_vars_eNB_g[0]->lte_frame_parms, l2_init (&PHY_vars_eNB_g[0]->lte_frame_parms,
oai_emulation.info.eMBMS_active_state, oai_emulation.info.eMBMS_active_state,
oai_emulation.info.cba_group_active, oai_emulation.info.cba_group_active,
oai_emulation.info.handover_active); oai_emulation.info.handover_active);
for (i = 0; i < NB_eNB_INST; i++) for (enb_id = 0; enb_id < NB_eNB_INST; enb_id++)
mac_xface->mrbch_phy_sync_failure (i, 0, i); mac_xface->mrbch_phy_sync_failure (enb_id, 0, enb_id);
if (abstraction_flag == 1) { if (abstraction_flag == 1) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) for (UE_id = 0; UE_id < NB_UE_INST; UE_id++)
...@@ -843,7 +845,7 @@ void init_openair2() { ...@@ -843,7 +845,7 @@ void init_openair2() {
} }
void init_ocm() { void init_ocm() {
s32 UE_id, eNB_id; module_id_t UE_id, eNB_id;
/* Added for PHY abstraction */ /* Added for PHY abstraction */
LOG_I(OCM,"Running with frame_type %d, Nid_cell %d, N_RB_DL %d, EP %d, mode %d, target dl_mcs %d, rate adaptation %d, nframes %d, abstraction %d, channel %s\n", oai_emulation.info.frame_type, Nid_cell, oai_emulation.info.N_RB_DL, oai_emulation.info.extended_prefix_flag, oai_emulation.info.transmission_mode,target_dl_mcs,rate_adaptation_flag,oai_emulation.info.n_frames,abstraction_flag,oai_emulation.environment_system_config.fading.small_scale.selected_option); LOG_I(OCM,"Running with frame_type %d, Nid_cell %d, N_RB_DL %d, EP %d, mode %d, target dl_mcs %d, rate adaptation %d, nframes %d, abstraction %d, channel %s\n", oai_emulation.info.frame_type, Nid_cell, oai_emulation.info.N_RB_DL, oai_emulation.info.extended_prefix_flag, oai_emulation.info.transmission_mode,target_dl_mcs,rate_adaptation_flag,oai_emulation.info.n_frames,abstraction_flag,oai_emulation.environment_system_config.fading.small_scale.selected_option);
...@@ -934,7 +936,7 @@ void init_ocm() { ...@@ -934,7 +936,7 @@ void init_ocm() {
} }
void init_otg_pdcp_buffer() { void init_otg_pdcp_buffer() {
s32 i; module_id_t i;
otg_pdcp_buffer = malloc((NB_UE_INST + NB_eNB_INST) * sizeof(Packet_OTG_List)); otg_pdcp_buffer = malloc((NB_UE_INST + NB_eNB_INST) * sizeof(Packet_OTG_List));
for (i = 0; i < NB_UE_INST + NB_eNB_INST; i++) { for (i = 0; i < NB_UE_INST + NB_eNB_INST; i++) {
...@@ -944,7 +946,7 @@ void init_otg_pdcp_buffer() { ...@@ -944,7 +946,7 @@ void init_otg_pdcp_buffer() {
} }
void update_omg () { void update_omg () {
s32 UE_id, eNB_id; module_id_t UE_id, eNB_id;
int new_omg_model; int new_omg_model;
if ((frame % omg_period) == 0 ) { // call OMG every 10ms if ((frame % omg_period) == 0 ) { // call OMG every 10ms
...@@ -977,7 +979,7 @@ void update_omg_ocm() { ...@@ -977,7 +979,7 @@ void update_omg_ocm() {
} }
void update_ocm() { void update_ocm() {
s32 UE_id, eNB_id; module_id_t UE_id, eNB_id;
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++)
enb_data[eNB_id]->tx_power_dBm = PHY_vars_eNB_g[eNB_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower; enb_data[eNB_id]->tx_power_dBm = PHY_vars_eNB_g[eNB_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower;
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) for (UE_id = 0; UE_id < NB_UE_INST; UE_id++)
...@@ -1030,7 +1032,7 @@ void update_ocm() { ...@@ -1030,7 +1032,7 @@ void update_ocm() {
} }
#ifdef OPENAIR2 #ifdef OPENAIR2
void update_otg_eNB(module_id_t module_idP, unsigned int ctime) { void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime) {
#if defined(USER_MODE) && defined(OAI_EMU) #if defined(USER_MODE) && defined(OAI_EMU)
if (oai_emulation.info.otg_enabled ==1 ) { if (oai_emulation.info.otg_enabled ==1 ) {
...@@ -1040,23 +1042,23 @@ void update_otg_eNB(module_id_t module_idP, unsigned int ctime) { ...@@ -1040,23 +1042,23 @@ void update_otg_eNB(module_id_t module_idP, unsigned int ctime) {
for (dst_id = 0; dst_id < NUMBER_OF_UE_MAX; dst_id++) { for (dst_id = 0; dst_id < NUMBER_OF_UE_MAX; dst_id++) {
for_times += 1; for_times += 1;
// generate traffic if the ue is rrc reconfigured state // generate traffic if the ue is rrc reconfigured state
if (mac_get_rrc_status(module_idP, 1/*eNB_flag*/, dst_id) > 2 /*RRC_CONNECTED*/ ) { if (mac_get_rrc_status(enb_module_idP, ENB_FLAG_YES, dst_id) > 2 /*RRC_CONNECTED*/ ) {
for (app_id=0; app_id<MAX_NUM_APPLICATION; app_id++){ for (app_id=0; app_id<MAX_NUM_APPLICATION; app_id++){
otg_pkt = malloc (sizeof(Packet_otg_elt)); otg_pkt = malloc (sizeof(Packet_otg_elt));
if_times += 1; if_times += 1;
(otg_pkt->otg_pkt).sdu_buffer = (u8*) packet_gen(module_idP, dst_id + NB_eNB_INST, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size)); (otg_pkt->otg_pkt).sdu_buffer = (u8*) packet_gen(enb_module_idP, dst_id + NB_eNB_INST, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
if ((otg_pkt->otg_pkt).sdu_buffer != NULL) { if ((otg_pkt->otg_pkt).sdu_buffer != NULL) {
otg_times += 1; otg_times += 1;
(otg_pkt->otg_pkt).rb_id = dst_id * NB_RB_MAX + DTCH; // app could be binded to a given DRB (otg_pkt->otg_pkt).rb_id = dst_id * NB_RB_MAX + DTCH; // app could be binded to a given DRB
(otg_pkt->otg_pkt).module_id = module_idP; (otg_pkt->otg_pkt).module_id = enb_module_idP;
(otg_pkt->otg_pkt).dst_id = dst_id; (otg_pkt->otg_pkt).dst_id = dst_id;
(otg_pkt->otg_pkt).is_ue = 0; (otg_pkt->otg_pkt).is_ue = 0;
(otg_pkt->otg_pkt).mode = PDCP_DATA_PDU; (otg_pkt->otg_pkt).mode = PDCP_DATA_PDU;
//Adding the packet to the OTG-PDCP buffer //Adding the packet to the OTG-PDCP buffer
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_idP])); pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[enb_module_idP]));
LOG_I(EMU, "[eNB %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d for app id %d \n", LOG_I(EMU, "[eNB %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d for app id %d \n",
(otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id, app_id); (otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id, app_id);
} else { } else {
...@@ -1064,33 +1066,31 @@ void update_otg_eNB(module_id_t module_idP, unsigned int ctime) { ...@@ -1064,33 +1066,31 @@ void update_otg_eNB(module_id_t module_idP, unsigned int ctime) {
otg_pkt=NULL; otg_pkt=NULL;
} }
} }
//LOG_T(EMU,"[eNB %d] UE mod id %d is not connected\n", module_id, dst_id);
//LOG_I(EMU,"HEAD of otg_pdcp_buffer[%d] is %p\n", module_id, pkt_list_get_head(&(otg_pdcp_buffer[module_id])));
} }
} }
#ifdef Rel10 #ifdef Rel10
int service_id, session_id, rb_id; mbms_service_id_t service_id;
mbms_session_id_t session_id;
rb_id_t rb_id;
// MBSM multicast traffic // MBSM multicast traffic
// if (frame >= 50) {// only generate when UE can receive MTCH (need to control this value) // if (frame >= 50) {// only generate when UE can receive MTCH (need to control this value)
for (service_id = 0; service_id < 2 ; service_id++) { //maxServiceCount for (service_id = 0; service_id < 2 ; service_id++) { //maxServiceCount
for (session_id = 0; session_id < 2; session_id++) { // maxSessionPerPMCH for (session_id = 0; session_id < 2; session_id++) { // maxSessionPerPMCH
// LOG_I(OTG,"DUY:frame %d, pdcp_mbms_array[module_id][rb_id].instanciated_instance is %d\n",frame,pdcp_mbms_array[module_id][service_id*maxSessionPerPMCH + session_id].instanciated_instance); if (pdcp_mbms_array_eNB[enb_module_idP][service_id][session_id].instanciated_instance == enb_module_idP + 1){ // this service/session is configured
if (pdcp_mbms_array[module_idP][service_id*maxSessionPerPMCH + session_id].instanciated_instance == module_idP + 1){ // this service/session is configured
otg_pkt = malloc (sizeof(Packet_otg_elt)); otg_pkt = malloc (sizeof(Packet_otg_elt));
// LOG_T(OTG,"multicast packet gen for (service/mch %d, session/lcid %d, rb_id %d)\n", service_id, session_id, service_id*maxSessionPerPMCH + session_id); // LOG_T(OTG,"multicast packet gen for (service/mch %d, session/lcid %d, rb_id %d)\n", service_id, session_id, service_id*maxSessionPerPMCH + session_id);
rb_id = pdcp_mbms_array[module_idP][service_id*maxSessionPerPMCH + session_id].rb_id; rb_id = pdcp_mbms_array_eNB[enb_module_idP][service_id][session_id].rb_id;
(otg_pkt->otg_pkt).sdu_buffer = (u8*) packet_gen_multicast(module_idP, session_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size)); (otg_pkt->otg_pkt).sdu_buffer = (u8*) packet_gen_multicast(enb_module_idP, session_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
if ((otg_pkt->otg_pkt).sdu_buffer != NULL) { if ((otg_pkt->otg_pkt).sdu_buffer != NULL) {
(otg_pkt->otg_pkt).rb_id = rb_id; (otg_pkt->otg_pkt).rb_id = rb_id;
(otg_pkt->otg_pkt).module_id = module_idP; (otg_pkt->otg_pkt).module_id = enb_module_idP;
(otg_pkt->otg_pkt).dst_id = session_id; (otg_pkt->otg_pkt).dst_id = session_id;
(otg_pkt->otg_pkt).is_ue = 0; (otg_pkt->otg_pkt).is_ue = 0;
//Adding the packet to the OTG-PDCP buffer //Adding the packet to the OTG-PDCP buffer
(otg_pkt->otg_pkt).mode = PDCP_TM; (otg_pkt->otg_pkt).mode = PDCP_TM;
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_idP])); pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[enb_module_idP]));
LOG_I(EMU, "[eNB %d] ADD packet (%p) multicast to OTG buffer for dst %d on rb_id %d\n", LOG_I(EMU, "[eNB %d] ADD packet (%p) multicast to OTG buffer for dst %d on rb_id %d\n",
(otg_pkt->otg_pkt).module_id, otg_pkt, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id); (otg_pkt->otg_pkt).module_id, otg_pkt, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id);
} else { } else {
...@@ -1132,11 +1132,6 @@ void update_otg_eNB(module_id_t module_idP, unsigned int ctime) { ...@@ -1132,11 +1132,6 @@ void update_otg_eNB(module_id_t module_idP, unsigned int ctime) {
} }
// } // end multicast traffic // } // end multicast traffic
#endif #endif
//LOG_I(EMU, "[eNB %d] update OTG nb_elts = %d \n", module_id, otg_pdcp_buffer[module_idP].nb_elements);
//free(otg_pkt);
//otg_pkt = NULL;
} }
#else #else
if (otg_enabled==1) { if (otg_enabled==1) {
...@@ -1159,13 +1154,7 @@ void update_otg_eNB(module_id_t module_idP, unsigned int ctime) { ...@@ -1159,13 +1154,7 @@ void update_otg_eNB(module_id_t module_idP, unsigned int ctime) {
free(otg_pkt); free(otg_pkt);
otg_pkt=NULL; otg_pkt=NULL;
} }
/*else {
LOG_I(OTG,"nothing generated (src %d, dst %d)\n",src_id, dst_id);
}*/
} }
/*else {
LOG_I(OTG,"rrc_status (src %d, dst %d) = %d\n",src_id, dst_id, mac_get_rrc_status(src_id, eNB_flag, dst_id ));
}*/
} }
} }
#endif #endif
......
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