Now virtualization should be OK.
TO DO :test RF and ethernet emulation. git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5086 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
+19
-18
@@ -144,6 +144,7 @@
|
||||
#include "PHY/TOOLS/time_meas.h"
|
||||
#include "PHY/CODING/defs.h"
|
||||
#include "PHY/TOOLS/defs.h"
|
||||
#include "platform_types.h"
|
||||
|
||||
#ifdef OPENAIR_LTE
|
||||
|
||||
@@ -180,30 +181,30 @@ enum transmission_access_mode{
|
||||
/// Top-level PHY Data Structure for eNB
|
||||
typedef struct {
|
||||
/// Module ID indicator for this instance
|
||||
u8 Mod_id;
|
||||
u8 local_flag;
|
||||
unsigned int rx_total_gain_eNB_dB;
|
||||
u32 frame;
|
||||
LTE_DL_FRAME_PARMS lte_frame_parms;
|
||||
module_id_t Mod_id;
|
||||
u8 local_flag;
|
||||
unsigned int rx_total_gain_eNB_dB;
|
||||
frame_t frame;
|
||||
LTE_DL_FRAME_PARMS lte_frame_parms;
|
||||
PHY_MEASUREMENTS_eNB PHY_measurements_eNB[NUMBER_OF_eNB_SECTORS_MAX]; /// Measurement variables
|
||||
LTE_eNB_COMMON lte_eNB_common_vars;
|
||||
LTE_eNB_SRS lte_eNB_srs_vars[NUMBER_OF_UE_MAX];
|
||||
LTE_eNB_PBCH lte_eNB_pbch;
|
||||
LTE_eNB_PUSCH *lte_eNB_pusch_vars[NUMBER_OF_UE_MAX];
|
||||
LTE_eNB_PRACH lte_eNB_prach_vars;
|
||||
LTE_eNB_DLSCH_t *dlsch_eNB[NUMBER_OF_UE_MAX][2]; // Nusers times two spatial streams
|
||||
LTE_eNB_COMMON lte_eNB_common_vars;
|
||||
LTE_eNB_SRS lte_eNB_srs_vars[NUMBER_OF_UE_MAX];
|
||||
LTE_eNB_PBCH lte_eNB_pbch;
|
||||
LTE_eNB_PUSCH *lte_eNB_pusch_vars[NUMBER_OF_UE_MAX];
|
||||
LTE_eNB_PRACH lte_eNB_prach_vars;
|
||||
LTE_eNB_DLSCH_t *dlsch_eNB[NUMBER_OF_UE_MAX][2]; // Nusers times two spatial streams
|
||||
// old: LTE_eNB_DLSCH_t **dlsch_eNB[2]; // Nusers times two spatial streams
|
||||
LTE_eNB_ULSCH_t *ulsch_eNB[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA
|
||||
LTE_eNB_DLSCH_t *dlsch_eNB_SI,*dlsch_eNB_ra;
|
||||
LTE_eNB_DLSCH_t *dlsch_eNB_MCH;
|
||||
LTE_eNB_UE_stats eNB_UE_stats[NUMBER_OF_UE_MAX];
|
||||
LTE_eNB_UE_stats *eNB_UE_stats_ptr[NUMBER_OF_UE_MAX];
|
||||
LTE_eNB_ULSCH_t *ulsch_eNB[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA
|
||||
LTE_eNB_DLSCH_t *dlsch_eNB_SI,*dlsch_eNB_ra;
|
||||
LTE_eNB_DLSCH_t *dlsch_eNB_MCH;
|
||||
LTE_eNB_UE_stats eNB_UE_stats[NUMBER_OF_UE_MAX];
|
||||
LTE_eNB_UE_stats *eNB_UE_stats_ptr[NUMBER_OF_UE_MAX];
|
||||
|
||||
/// cell-specific reference symbols
|
||||
unsigned int lte_gold_table[20][2][14];
|
||||
unsigned int lte_gold_table[20][2][14];
|
||||
|
||||
/// mbsfn reference symbols
|
||||
unsigned int lte_gold_mbsfn_table[10][3][42];
|
||||
unsigned int lte_gold_mbsfn_table[10][3][42];
|
||||
|
||||
u32 X_u[64][839];
|
||||
|
||||
|
||||
@@ -1010,7 +1010,7 @@ void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
|
||||
|
||||
// Check for SR and do ACK/NACK accordingly
|
||||
if (is_SR_TXOp(phy_vars_ue,eNB_id,next_slot>>1)==1) {
|
||||
LOG_I(PHY,"[UE %d][SR %x] Frame %d subframe %d: got SR_TXOp, Checking for SR for PUSCH from MAC\n",
|
||||
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d: got SR_TXOp, Checking for SR for PUSCH from MAC\n",
|
||||
phy_vars_ue->Mod_id,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,phy_vars_ue->frame,next_slot>>1);
|
||||
#ifdef OPENAIR2
|
||||
SR_payload = mac_xface->ue_get_SR(phy_vars_ue->Mod_id,
|
||||
@@ -1024,7 +1024,7 @@ void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
|
||||
|
||||
if (SR_payload>0) {
|
||||
generate_ul_signal = 1;
|
||||
LOG_I(PHY,"[UE %d][SR %x] Frame %d subframe %d got the SR for PUSCH is %d\n",
|
||||
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d got the SR for PUSCH is %d\n",
|
||||
phy_vars_ue->Mod_id,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,phy_vars_ue->frame,next_slot>>1,SR_payload);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -333,8 +333,8 @@ typedef struct{ //RRC_INTERFACE_FUNCTIONS
|
||||
char (*openair_rrc_eNB_init)(u8 );
|
||||
char (*openair_rrc_UE_init)(u8, u8);
|
||||
RRC_status_t (*rrc_rx_tx)(u8,u32,u8,u8);
|
||||
u8 (*mac_rrc_data_ind)(u8,u32,u16,u8 *,u16,u8 eNB_flag, u8 eNB_index);
|
||||
u8 (*mac_rrc_data_req)(u8,u32,u16,u8,u8 *,u8 eNB_flag, u8 eNB_index);
|
||||
u8 (*mac_rrc_data_ind)(u8,u32,u16,u8 *,u16,eNB_flag_t eNB_flag, u8 eNB_index);
|
||||
u8 (*mac_rrc_data_req)(u8,u32,u16,u8,u8 *,eNB_flag_t eNB_flag, u8 eNB_index);
|
||||
void (*mac_rrc_meas_ind)(u8,MAC_MEAS_REQ_ENTRY*);
|
||||
void (*def_meas_ind)(u8, u8);
|
||||
void (*rrc_data_indP) (module_id_t , rb_id_t , sdu_size_t , char*);
|
||||
@@ -352,12 +352,7 @@ typedef struct{
|
||||
unsigned short (*mac_config_req)(u8,u8,MAC_CONFIG_REQ*);
|
||||
MAC_MEAS_REQ_ENTRY* (*mac_meas_req)(u8 , MAC_MEAS_REQ*);
|
||||
void (*mac_out_of_sync_ind)(u8,u32,unsigned short);
|
||||
//u8 (*mac_rrc_data_ind)(u8,unsigned short,char *,u8);
|
||||
//u8 (*mac_rrc_data_req)( u8, unsigned short, u8,char *);
|
||||
//void (*mac_switch_node_function)(u8);
|
||||
// void (*mac_rlc_exit)(void);
|
||||
//RLC_INTERFACE_FUNCTIONS
|
||||
// void (*pdcp_run)(unsigned int);
|
||||
void (*pdcp_run)(void);
|
||||
void (*pdcp_data_req)(module_id_t, rb_id_t, sdu_size_t, char*);
|
||||
signed int (*rrc_rlc_config_req)(unsigned int, unsigned int, unsigned int, unsigned int, rlc_info_t );
|
||||
@@ -373,21 +368,18 @@ typedef struct{
|
||||
u16 *SIperiod
|
||||
#ifdef Rel10
|
||||
,
|
||||
u8 MBMS_Flag,
|
||||
MBMS_flag_t MBMS_Flag,
|
||||
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList,
|
||||
MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList,
|
||||
struct PMCH_InfoList_r9 *pmch_InfoList
|
||||
#endif
|
||||
);
|
||||
unsigned int (*mac_rlc_data_req)(module_id_t, unsigned int, char*);
|
||||
void (*mac_rlc_data_ind)(module_id_t, chan_id_t, char*, tb_size_t, num_tb_t, crc_t* );
|
||||
mac_rlc_status_resp_t (*mac_rlc_status_ind) (module_id_t, chan_id_t, tb_size_t, num_tb_t);
|
||||
void (*mac_rlc_data_ind)(module_id_t, logical_chan_id_t, char*, tb_size_t, num_tb_t, crc_t* );
|
||||
mac_rlc_status_resp_t (*mac_rlc_status_ind) (module_id_t, logical_chan_id_t, tb_size_t, num_tb_t);
|
||||
signed int (*rrc_rlc_data_req)(module_id_t, rb_id_t, mui_t, confirm_t, sdu_size_t, char *);
|
||||
void (*rrc_rlc_register_rrc) (void (*rrc_data_indP)(module_id_t , rb_id_t , sdu_size_t , char* ),
|
||||
void (*rrc_data_confP) (module_id_t , rb_id_t , mui_t ) ) ;
|
||||
//rlc_op_status_t rrc_rlc_config_req (module_id_t, rb_id_t, rb_type_t, rlc_info_t );
|
||||
//rlc_op_status_t rrc_rlc_data_req (module_id_t, rb_id_t, mui_t, confirm_t, sdu_size_t, mem_block_t*);
|
||||
//void rrc_rlc_register_rrc ( void(*rrc_data_indP) (module_id_t , rb_id_t , sdu_size_t , mem_block_t*),void(*rrc_data_conf) (module_id_t , rb_id_t , mui_t) );
|
||||
void (*mrbch_phy_sync_failure) (u8 Mod_id, u32 frame, u8 Free_ch_index);
|
||||
void (*dl_phy_sync_success) (u8 Mod_id, u32 frame, u8 eNB_index);
|
||||
}MAC_RLC_XFACE;
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
#define MAX_MANAGED_RG_PER_MOBILE 2
|
||||
|
||||
#define DEFAULT_RAB_ID 3
|
||||
#define NB_RB_MAX 11
|
||||
#define NB_RAB_MAX 8
|
||||
#define NB_RB_MAX (maxDRB + 3) /* was 11, now 14, maxDRB comes from asn1_constants.h, + 3 because of 3 SRB, one invisible id 0, then id 1 and 2 */
|
||||
#define NB_RAB_MAX maxDRB /* was 8, now 11 */
|
||||
#define RAB_SHIFT1 9
|
||||
#define RAB_SHIFT2 3
|
||||
#define RAB_OFFSET 0x0007
|
||||
@@ -69,36 +69,36 @@
|
||||
|
||||
#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
|
||||
//# 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
|
||||
//# 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 0
|
||||
# define RLC_MODE_AM 1
|
||||
# define RLC_MODE_TM 2
|
||||
# define RLC_MODE_UM 3
|
||||
# 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
|
||||
|
||||
@@ -25,19 +25,29 @@ typedef signed long int s64_t;
|
||||
|
||||
typedef unsigned int config_action_t;
|
||||
|
||||
typedef unsigned int sdu_size_t;
|
||||
typedef u16_t sdu_size_t;
|
||||
typedef s16_t sdu_ssize_t;
|
||||
typedef unsigned int tbs_size_t;
|
||||
typedef unsigned int tb_size_t;
|
||||
typedef unsigned int rb_id_t;
|
||||
typedef unsigned int module_id_t;
|
||||
typedef u16_t rb_id_t;
|
||||
typedef u16_t srb_id_t;
|
||||
typedef u32_t frame_t;
|
||||
typedef u32_t sub_frame_t;
|
||||
typedef u8_t module_id_t;
|
||||
typedef unsigned int mui_t;
|
||||
typedef unsigned int confirm_t;
|
||||
typedef unsigned int rb_type_t;
|
||||
typedef rb_id_t chan_id_t;
|
||||
typedef unsigned int logical_chan_id_t;
|
||||
typedef unsigned int num_tb_t;
|
||||
typedef unsigned int crc_t;
|
||||
typedef unsigned int rlc_tx_status_t;
|
||||
typedef unsigned int rlc_mode_t;
|
||||
typedef s16_t rlc_sn_t;
|
||||
typedef u16_t rlc_usn_t;
|
||||
typedef int traffic_type_t;
|
||||
typedef u32_t mbms_session_id_t;
|
||||
typedef u16_t mbms_service_id_t;
|
||||
typedef u16_t rnti_t;
|
||||
|
||||
typedef signed int rlc_op_status_t;
|
||||
|
||||
@@ -47,8 +57,17 @@ typedef unsigned int crc32_t;
|
||||
|
||||
typedef signed char boolean_t;
|
||||
|
||||
typedef enum MBMS_flag_e {
|
||||
MBMS_FLAG_NO = 0,
|
||||
MBMS_FLAG_YES = 1,
|
||||
} MBMS_flag_t;
|
||||
|
||||
typedef enum eNB_flag_e {
|
||||
ENB_FLAG_NO = 0,
|
||||
ENB_FLAG_YES = 1,
|
||||
} eNB_flag_t;
|
||||
|
||||
// just for integration
|
||||
extern unsigned int frame;
|
||||
extern frame_t frame;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef OLD_RRC_CELLULAR
|
||||
# ifndef __RRM_CONFIG_STRUCTS_H__
|
||||
# define __RRM_CONFIG_STRUCTS_H__
|
||||
|
||||
@@ -171,4 +171,4 @@ typedef volatile struct {
|
||||
//typedef RG_CONFIG MAIN_RADIO_GATEWAY;
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
+315
-315
@@ -25,16 +25,16 @@
|
||||
Forums : http://forums.eurecom.fsr/openairinterface
|
||||
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
|
||||
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
/*! \file config.c
|
||||
* \brief UE and eNB configuration
|
||||
* \author Raymond Knopp, Navid Nikaein
|
||||
* \date 2013
|
||||
* \version 0.1
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* @ingroup _mac
|
||||
* \brief UE and eNB configuration
|
||||
* \author Raymond Knopp, Navid Nikaein
|
||||
* \date 2013
|
||||
* \version 0.1
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "COMMON/platform_types.h"
|
||||
#include "COMMON/platform_constants.h"
|
||||
@@ -56,197 +56,197 @@
|
||||
#endif
|
||||
|
||||
/* sec 5.9, 36.321: MAC Reset Procedure */
|
||||
void ue_mac_reset(u8 Mod_id,u8 eNB_index) {
|
||||
|
||||
void ue_mac_reset(module_id_t module_idP,u8 eNB_index) {
|
||||
|
||||
//Resetting Bj
|
||||
UE_mac_inst[Mod_id].scheduling_info.Bj[0] = 0;
|
||||
UE_mac_inst[Mod_id].scheduling_info.Bj[1] = 0;
|
||||
UE_mac_inst[Mod_id].scheduling_info.Bj[2] = 0;
|
||||
UE_mac_inst[module_idP].scheduling_info.Bj[0] = 0;
|
||||
UE_mac_inst[module_idP].scheduling_info.Bj[1] = 0;
|
||||
UE_mac_inst[module_idP].scheduling_info.Bj[2] = 0;
|
||||
//Stopping all timers
|
||||
|
||||
|
||||
//timeAlignmentTimer expires
|
||||
|
||||
|
||||
// PHY changes for UE MAC reset
|
||||
mac_xface->phy_reset_ue(Mod_id,eNB_index);
|
||||
|
||||
mac_xface->phy_reset_ue(module_idP,eNB_index);
|
||||
|
||||
// notify RRC to relase PUCCH/SRS
|
||||
// cancel all pending SRs
|
||||
UE_mac_inst[Mod_id].scheduling_info.SR_pending=0;
|
||||
UE_mac_inst[Mod_id].scheduling_info.SR_COUNTER=0;
|
||||
|
||||
UE_mac_inst[module_idP].scheduling_info.SR_pending=0;
|
||||
UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0;
|
||||
|
||||
// stop ongoing RACH procedure
|
||||
|
||||
|
||||
// discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_PreambleIndex = 0; // check!
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
|
||||
ue_init_mac(Mod_id); //This will hopefully do the rest of the MAC reset procedure
|
||||
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = 0; // check!
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
|
||||
ue_init_mac(module_idP); //This will hopefully do the rest of the MAC reset procedure
|
||||
|
||||
}
|
||||
|
||||
int rrc_mac_config_req(u8 Mod_id,u8 eNB_flag,u8 UE_id,u8 eNB_index,
|
||||
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
struct PhysicalConfigDedicated *physicalConfigDedicated,
|
||||
MeasObjectToAddMod_t **measObj,
|
||||
MAC_MainConfig_t *mac_MainConfig,
|
||||
long logicalChannelIdentity,
|
||||
LogicalChannelConfig_t *logicalChannelConfig,
|
||||
MeasGapConfig_t *measGapConfig,
|
||||
TDD_Config_t *tdd_Config,
|
||||
MobilityControlInfo_t *mobilityControlInfo,
|
||||
u8 *SIwindowsize,
|
||||
u16 *SIperiod,
|
||||
ARFCN_ValueEUTRA_t *ul_CarrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
||||
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList
|
||||
int rrc_mac_config_req(module_id_t Mod_id, eNB_flag_t eNB_flagP,u8 UE_id,u8 eNB_index,
|
||||
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
struct PhysicalConfigDedicated *physicalConfigDedicated,
|
||||
MeasObjectToAddMod_t **measObj,
|
||||
MAC_MainConfig_t *mac_MainConfig,
|
||||
long logicalChannelIdentity,
|
||||
LogicalChannelConfig_t *logicalChannelConfig,
|
||||
MeasGapConfig_t *measGapConfig,
|
||||
TDD_Config_t *tdd_Config,
|
||||
MobilityControlInfo_t *mobilityControlInfo,
|
||||
u8 *SIwindowsize,
|
||||
u16 *SIperiod,
|
||||
ARFCN_ValueEUTRA_t *ul_CarrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
||||
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList
|
||||
#ifdef Rel10
|
||||
,u8 MBMS_Flag,
|
||||
MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList,
|
||||
PMCH_InfoList_r9_t *pmch_InfoList
|
||||
,u8 MBMS_Flag,
|
||||
MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList,
|
||||
PMCH_InfoList_r9_t *pmch_InfoList
|
||||
#endif
|
||||
#ifdef CBA
|
||||
,u8 num_active_cba_groups,
|
||||
u16 cba_rnti
|
||||
,u8 num_active_cba_groups,
|
||||
u16 cba_rnti
|
||||
#endif
|
||||
) {
|
||||
) {
|
||||
|
||||
int i;
|
||||
|
||||
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
|
||||
|
||||
if (eNB_flag==0) {
|
||||
LOG_I(MAC,"[CONFIG][UE %d] Configuring MAC/PHY from eNB %d\n",Mod_id,eNB_index);
|
||||
if (tdd_Config != NULL)
|
||||
UE_mac_inst[Mod_id].tdd_Config = tdd_Config;
|
||||
if (eNB_flagP==0) {
|
||||
LOG_I(MAC,"[CONFIG][UE %d] Configuring MAC/PHY from eNB %d\n",Mod_id,eNB_index);
|
||||
if (tdd_Config != NULL)
|
||||
UE_mac_inst[Mod_id].tdd_Config = tdd_Config;
|
||||
}else {
|
||||
if (physicalConfigDedicated == NULL){
|
||||
LOG_I(MAC,"[CONFIG][eNB %d] Configuring MAC/PHY\n",Mod_id);
|
||||
} else{
|
||||
LOG_I(MAC,"[CONFIG][eNB %d] Configuring MAC/PHY for UE %d (%x)\n",Mod_id,UE_id,find_UE_RNTI(Mod_id,UE_id));
|
||||
}
|
||||
if (physicalConfigDedicated == NULL){
|
||||
LOG_I(MAC,"[CONFIG][eNB %d] Configuring MAC/PHY\n",Mod_id);
|
||||
} else{
|
||||
LOG_I(MAC,"[CONFIG][eNB %d] Configuring MAC/PHY for UE %d (%x)\n",Mod_id,UE_id,find_UE_RNTI(Mod_id,UE_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((tdd_Config!=NULL)||(SIwindowsize!=NULL)||(SIperiod!=NULL)){
|
||||
if (eNB_flag==1)
|
||||
mac_xface->phy_config_sib1_eNB(Mod_id,tdd_Config,*SIwindowsize,*SIperiod);
|
||||
else
|
||||
mac_xface->phy_config_sib1_ue(Mod_id,eNB_index,tdd_Config,*SIwindowsize,*SIperiod);
|
||||
if (eNB_flagP==1)
|
||||
mac_xface->phy_config_sib1_eNB(Mod_id,tdd_Config,*SIwindowsize,*SIperiod);
|
||||
else
|
||||
mac_xface->phy_config_sib1_ue(Mod_id,eNB_index,tdd_Config,*SIwindowsize,*SIperiod);
|
||||
}
|
||||
|
||||
if (radioResourceConfigCommon!=NULL) {
|
||||
if (eNB_flag==1) {
|
||||
LOG_I(MAC,"[CONFIG]SIB2/3 Contents (partial)\n");
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.n_SB = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.hoppingMode = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.pusch_HoppingOffset = %ld\n", radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.enable64QAM = %d\n",radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.groupHoppingEnabled = %d\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.groupAssignmentPUSCH = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.sequenceHoppingEnabled = %d\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.cyclicShift = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift);
|
||||
mac_xface->phy_config_sib2_eNB(Mod_id,radioResourceConfigCommon,ul_CarrierFreq,ul_Bandwidth,additionalSpectrumEmission,mbsfn_SubframeConfigList);
|
||||
}
|
||||
else {
|
||||
UE_mac_inst[Mod_id].radioResourceConfigCommon = radioResourceConfigCommon;
|
||||
mac_xface->phy_config_sib2_ue(Mod_id,eNB_index,radioResourceConfigCommon,ul_CarrierFreq,ul_Bandwidth,additionalSpectrumEmission,mbsfn_SubframeConfigList);
|
||||
}
|
||||
if (eNB_flagP==1) {
|
||||
LOG_I(MAC,"[CONFIG]SIB2/3 Contents (partial)\n");
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.n_SB = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.hoppingMode = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.pusch_HoppingOffset = %ld\n", radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.enable64QAM = %d\n",radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.groupHoppingEnabled = %d\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.groupAssignmentPUSCH = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.sequenceHoppingEnabled = %d\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled);
|
||||
LOG_I(MAC,"[CONFIG]pusch_config_common.cyclicShift = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift);
|
||||
mac_xface->phy_config_sib2_eNB(Mod_id,radioResourceConfigCommon,ul_CarrierFreq,ul_Bandwidth,additionalSpectrumEmission,mbsfn_SubframeConfigList);
|
||||
}
|
||||
else {
|
||||
UE_mac_inst[Mod_id].radioResourceConfigCommon = radioResourceConfigCommon;
|
||||
mac_xface->phy_config_sib2_ue(Mod_id,eNB_index,radioResourceConfigCommon,ul_CarrierFreq,ul_Bandwidth,additionalSpectrumEmission,mbsfn_SubframeConfigList);
|
||||
}
|
||||
}
|
||||
// SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup
|
||||
if (logicalChannelConfig!= NULL) {
|
||||
if (eNB_flag==0){
|
||||
LOG_I(MAC,"[CONFIG][UE %d] Applying RRC logicalChannelConfig from eNB%d\n",Mod_id,eNB_index);
|
||||
UE_mac_inst[Mod_id].logicalChannelConfig[logicalChannelIdentity]=logicalChannelConfig;
|
||||
UE_mac_inst[Mod_id].scheduling_info.Bj[logicalChannelIdentity]=0; // initilize the bucket for this lcid
|
||||
if (logicalChannelConfig->ul_SpecificParameters) {
|
||||
UE_mac_inst[Mod_id].scheduling_info.bucket_size[logicalChannelIdentity]=logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate *
|
||||
logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration; // set the max bucket size
|
||||
UE_mac_inst[Mod_id].scheduling_info.LCGID[logicalChannelIdentity]=*logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup;
|
||||
LOG_D(MAC,"[CONFIG][UE %d] LCID %d is attached to the LCGID %d\n",Mod_id,logicalChannelIdentity,*logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup);
|
||||
} else {
|
||||
LOG_E(MAC,"[CONFIG][UE %d] LCID %d NULL ul_SpecificParameters\n",Mod_id,logicalChannelIdentity);
|
||||
mac_xface->macphy_exit("");
|
||||
if (eNB_flagP==0){
|
||||
LOG_I(MAC,"[CONFIG][UE %d] Applying RRC logicalChannelConfig from eNB%d\n",Mod_id,eNB_index);
|
||||
UE_mac_inst[Mod_id].logicalChannelConfig[logicalChannelIdentity]=logicalChannelConfig;
|
||||
UE_mac_inst[Mod_id].scheduling_info.Bj[logicalChannelIdentity]=0; // initilize the bucket for this lcid
|
||||
if (logicalChannelConfig->ul_SpecificParameters) {
|
||||
UE_mac_inst[Mod_id].scheduling_info.bucket_size[logicalChannelIdentity]=logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate *
|
||||
logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration; // set the max bucket size
|
||||
UE_mac_inst[Mod_id].scheduling_info.LCGID[logicalChannelIdentity]=*logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup;
|
||||
LOG_D(MAC,"[CONFIG][UE %d] LCID %d is attached to the LCGID %d\n",Mod_id,logicalChannelIdentity,*logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup);
|
||||
} else {
|
||||
LOG_E(MAC,"[CONFIG][UE %d] LCID %d NULL ul_SpecificParameters\n",Mod_id,logicalChannelIdentity);
|
||||
mac_xface->macphy_exit("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mac_MainConfig != NULL){
|
||||
if (eNB_flag==0){
|
||||
LOG_I(MAC,"[CONFIG][UE%d] Applying RRC macMainConfig from eNB%d\n",Mod_id,eNB_index);
|
||||
UE_mac_inst[Mod_id].macConfig=mac_MainConfig;
|
||||
UE_mac_inst[Mod_id].measGapConfig=measGapConfig;
|
||||
if (mac_MainConfig->ul_SCH_Config) {
|
||||
if (eNB_flagP==0){
|
||||
LOG_I(MAC,"[CONFIG][UE%d] Applying RRC macMainConfig from eNB%d\n",Mod_id,eNB_index);
|
||||
UE_mac_inst[Mod_id].macConfig=mac_MainConfig;
|
||||
UE_mac_inst[Mod_id].measGapConfig=measGapConfig;
|
||||
if (mac_MainConfig->ul_SCH_Config) {
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config->periodicBSR_Timer)
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicBSR_Timer = (u16) *mac_MainConfig->ul_SCH_Config->periodicBSR_Timer;
|
||||
else
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicBSR_Timer = (u16) MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity;
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config->maxHARQ_Tx)
|
||||
UE_mac_inst[Mod_id].scheduling_info.maxHARQ_Tx = (u16) *mac_MainConfig->ul_SCH_Config->maxHARQ_Tx;
|
||||
else
|
||||
UE_mac_inst[Mod_id].scheduling_info.maxHARQ_Tx = (u16) MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
|
||||
if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer)
|
||||
UE_mac_inst[Mod_id].scheduling_info.retxBSR_Timer = (u16) mac_MainConfig->ul_SCH_Config->retxBSR_Timer;
|
||||
else
|
||||
UE_mac_inst[Mod_id].scheduling_info.retxBSR_Timer = (u16)MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560;
|
||||
}
|
||||
if (mac_MainConfig->ul_SCH_Config->periodicBSR_Timer)
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicBSR_Timer = (u16) *mac_MainConfig->ul_SCH_Config->periodicBSR_Timer;
|
||||
else
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicBSR_Timer = (u16) MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity;
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config->maxHARQ_Tx)
|
||||
UE_mac_inst[Mod_id].scheduling_info.maxHARQ_Tx = (u16) *mac_MainConfig->ul_SCH_Config->maxHARQ_Tx;
|
||||
else
|
||||
UE_mac_inst[Mod_id].scheduling_info.maxHARQ_Tx = (u16) MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
|
||||
if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer)
|
||||
UE_mac_inst[Mod_id].scheduling_info.retxBSR_Timer = (u16) mac_MainConfig->ul_SCH_Config->retxBSR_Timer;
|
||||
else
|
||||
UE_mac_inst[Mod_id].scheduling_info.retxBSR_Timer = (u16)MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560;
|
||||
}
|
||||
#ifdef Rel10
|
||||
if (mac_MainConfig->sr_ProhibitTimer_r9)
|
||||
UE_mac_inst[Mod_id].scheduling_info.sr_ProhibitTimer = (u16) *mac_MainConfig->sr_ProhibitTimer_r9;
|
||||
else
|
||||
UE_mac_inst[Mod_id].scheduling_info.sr_ProhibitTimer = (u16) 0;
|
||||
if (mac_MainConfig->sr_ProhibitTimer_r9)
|
||||
UE_mac_inst[Mod_id].scheduling_info.sr_ProhibitTimer = (u16) *mac_MainConfig->sr_ProhibitTimer_r9;
|
||||
else
|
||||
UE_mac_inst[Mod_id].scheduling_info.sr_ProhibitTimer = (u16) 0;
|
||||
#endif
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[Mod_id].scheduling_info.periodicBSR_Timer);
|
||||
UE_mac_inst[Mod_id].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[Mod_id].scheduling_info.retxBSR_Timer);
|
||||
|
||||
UE_mac_inst[Mod_id].scheduling_info.drx_config = mac_MainConfig->drx_Config;
|
||||
UE_mac_inst[Mod_id].scheduling_info.phr_config = mac_MainConfig->phr_Config;
|
||||
if (mac_MainConfig->phr_Config){
|
||||
UE_mac_inst[Mod_id].PHR_state = mac_MainConfig->phr_Config->present;
|
||||
UE_mac_inst[Mod_id].PHR_reconfigured = 1;
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_Timer = mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer;
|
||||
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_Timer = mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer;
|
||||
UE_mac_inst[Mod_id].scheduling_info.PathlossChange = mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange;
|
||||
} else {
|
||||
UE_mac_inst[Mod_id].PHR_reconfigured = 0;
|
||||
UE_mac_inst[Mod_id].PHR_state = MAC_MainConfig__phr_Config_PR_setup;
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
|
||||
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
|
||||
UE_mac_inst[Mod_id].scheduling_info.PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;
|
||||
}
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_id].scheduling_info.periodicPHR_Timer);
|
||||
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_Timer);
|
||||
UE_mac_inst[Mod_id].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[Mod_id].scheduling_info.PathlossChange);
|
||||
LOG_D(MAC,"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n",
|
||||
Mod_id,mac_MainConfig->phr_Config->present,
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_SF,
|
||||
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_SF,
|
||||
UE_mac_inst[Mod_id].scheduling_info.PathlossChange_db);
|
||||
}
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[Mod_id].scheduling_info.periodicBSR_Timer);
|
||||
UE_mac_inst[Mod_id].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[Mod_id].scheduling_info.retxBSR_Timer);
|
||||
|
||||
UE_mac_inst[Mod_id].scheduling_info.drx_config = mac_MainConfig->drx_Config;
|
||||
UE_mac_inst[Mod_id].scheduling_info.phr_config = mac_MainConfig->phr_Config;
|
||||
if (mac_MainConfig->phr_Config){
|
||||
UE_mac_inst[Mod_id].PHR_state = mac_MainConfig->phr_Config->present;
|
||||
UE_mac_inst[Mod_id].PHR_reconfigured = 1;
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_Timer = mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer;
|
||||
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_Timer = mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer;
|
||||
UE_mac_inst[Mod_id].scheduling_info.PathlossChange = mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange;
|
||||
} else {
|
||||
UE_mac_inst[Mod_id].PHR_reconfigured = 0;
|
||||
UE_mac_inst[Mod_id].PHR_state = MAC_MainConfig__phr_Config_PR_setup;
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
|
||||
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
|
||||
UE_mac_inst[Mod_id].scheduling_info.PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;
|
||||
}
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_id].scheduling_info.periodicPHR_Timer);
|
||||
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_Timer);
|
||||
UE_mac_inst[Mod_id].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[Mod_id].scheduling_info.PathlossChange);
|
||||
LOG_D(MAC,"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n",
|
||||
Mod_id,mac_MainConfig->phr_Config->present,
|
||||
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_SF,
|
||||
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_SF,
|
||||
UE_mac_inst[Mod_id].scheduling_info.PathlossChange_db);
|
||||
}
|
||||
}
|
||||
|
||||
if (physicalConfigDedicated != NULL) {
|
||||
if (eNB_flag==1){
|
||||
mac_xface->phy_config_dedicated_eNB(Mod_id,find_UE_RNTI(Mod_id,UE_id),physicalConfigDedicated);
|
||||
}else{
|
||||
mac_xface->phy_config_dedicated_ue(Mod_id,eNB_index,physicalConfigDedicated);
|
||||
UE_mac_inst[Mod_id].physicalConfigDedicated=physicalConfigDedicated; // for SR proc
|
||||
}
|
||||
if (eNB_flagP==1){
|
||||
mac_xface->phy_config_dedicated_eNB(Mod_id,find_UE_RNTI(Mod_id,UE_id),physicalConfigDedicated);
|
||||
}else{
|
||||
mac_xface->phy_config_dedicated_ue(Mod_id,eNB_index,physicalConfigDedicated);
|
||||
UE_mac_inst[Mod_id].physicalConfigDedicated=physicalConfigDedicated; // for SR proc
|
||||
}
|
||||
}
|
||||
|
||||
if (eNB_flag == 0) {
|
||||
if (measObj!= NULL) {
|
||||
if (measObj[0]!= NULL){
|
||||
UE_mac_inst[Mod_id].n_adj_cells = measObj[0]->measObject.choice.measObjectEUTRA.cellsToAddModList->list.count;
|
||||
LOG_I(MAC,"Number of adjacent cells %d\n",UE_mac_inst[Mod_id].n_adj_cells);
|
||||
for (i=0;i<UE_mac_inst[Mod_id].n_adj_cells;i++) {
|
||||
UE_mac_inst[Mod_id].adj_cell_id[i] = measObj[0]->measObject.choice.measObjectEUTRA.cellsToAddModList->list.array[i]->physCellId;
|
||||
LOG_I(MAC,"Cell %d : Nid_cell %d\n",i,UE_mac_inst[Mod_id].adj_cell_id[i]);
|
||||
}
|
||||
mac_xface->phy_config_meas_ue(Mod_id,eNB_index,UE_mac_inst[Mod_id].n_adj_cells,UE_mac_inst[Mod_id].adj_cell_id);
|
||||
}
|
||||
/*
|
||||
if (eNB_flagP == 0) {
|
||||
if (measObj!= NULL) {
|
||||
if (measObj[0]!= NULL){
|
||||
UE_mac_inst[Mod_id].n_adj_cells = measObj[0]->measObject.choice.measObjectEUTRA.cellsToAddModList->list.count;
|
||||
LOG_I(MAC,"Number of adjacent cells %d\n",UE_mac_inst[Mod_id].n_adj_cells);
|
||||
for (i=0;i<UE_mac_inst[Mod_id].n_adj_cells;i++) {
|
||||
UE_mac_inst[Mod_id].adj_cell_id[i] = measObj[0]->measObject.choice.measObjectEUTRA.cellsToAddModList->list.array[i]->physCellId;
|
||||
LOG_I(MAC,"Cell %d : Nid_cell %d\n",i,UE_mac_inst[Mod_id].adj_cell_id[i]);
|
||||
}
|
||||
mac_xface->phy_config_meas_ue(Mod_id,eNB_index,UE_mac_inst[Mod_id].n_adj_cells,UE_mac_inst[Mod_id].adj_cell_id);
|
||||
}
|
||||
/*
|
||||
if (quantityConfig != NULL) {
|
||||
if (quantityConfig[0] != NULL) {
|
||||
UE_mac_inst[Mod_id].quantityConfig = quantityConfig[0];
|
||||
@@ -254,193 +254,193 @@ int rrc_mac_config_req(u8 Mod_id,u8 eNB_flag,u8 UE_id,u8 eNB_index,
|
||||
mac_xface->phy_config_meas_ue
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
if (eNB_flag==0) {
|
||||
if(mobilityControlInfo != NULL) {
|
||||
|
||||
LOG_D(MAC,"[UE%d] MAC Reset procedure triggered by RRC eNB %d \n",Mod_id,eNB_index);
|
||||
ue_mac_reset(Mod_id,eNB_index);
|
||||
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.rach_ConfigCommon) {
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->rach_ConfigCommon,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.rach_ConfigCommon,
|
||||
sizeof(RACH_ConfigCommon_t));
|
||||
}
|
||||
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->prach_Config.prach_ConfigInfo,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo,
|
||||
sizeof(PRACH_ConfigInfo_t));
|
||||
UE_mac_inst[Mod_id].radioResourceConfigCommon->prach_Config.rootSequenceIndex = mobilityControlInfo->radioResourceConfigCommon.prach_Config.rootSequenceIndex;
|
||||
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.pdsch_ConfigCommon) {
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->pdsch_ConfigCommon,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.pdsch_ConfigCommon,
|
||||
sizeof(PDSCH_ConfigCommon_t));
|
||||
}
|
||||
// not a pointer: mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->pusch_ConfigCommon,
|
||||
(void *)&mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon,
|
||||
sizeof(PUSCH_ConfigCommon_t));
|
||||
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.phich_Config) {
|
||||
/* memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->phich_Config,
|
||||
if (eNB_flagP==0) {
|
||||
if(mobilityControlInfo != NULL) {
|
||||
|
||||
LOG_D(MAC,"[UE%d] MAC Reset procedure triggered by RRC eNB %d \n",Mod_id,eNB_index);
|
||||
ue_mac_reset(Mod_id,eNB_index);
|
||||
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.rach_ConfigCommon) {
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->rach_ConfigCommon,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.rach_ConfigCommon,
|
||||
sizeof(RACH_ConfigCommon_t));
|
||||
}
|
||||
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->prach_Config.prach_ConfigInfo,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo,
|
||||
sizeof(PRACH_ConfigInfo_t));
|
||||
UE_mac_inst[Mod_id].radioResourceConfigCommon->prach_Config.rootSequenceIndex = mobilityControlInfo->radioResourceConfigCommon.prach_Config.rootSequenceIndex;
|
||||
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.pdsch_ConfigCommon) {
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->pdsch_ConfigCommon,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.pdsch_ConfigCommon,
|
||||
sizeof(PDSCH_ConfigCommon_t));
|
||||
}
|
||||
// not a pointer: mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->pusch_ConfigCommon,
|
||||
(void *)&mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon,
|
||||
sizeof(PUSCH_ConfigCommon_t));
|
||||
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.phich_Config) {
|
||||
/* memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->phich_Config,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.phich_Config,
|
||||
sizeof(PHICH_Config_t)); */
|
||||
}
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.pucch_ConfigCommon) {
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->pucch_ConfigCommon,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.pucch_ConfigCommon,
|
||||
sizeof(PUCCH_ConfigCommon_t));
|
||||
}
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon) {
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->soundingRS_UL_ConfigCommon,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon,
|
||||
sizeof(SoundingRS_UL_ConfigCommon_t));
|
||||
}
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.uplinkPowerControlCommon) {
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->uplinkPowerControlCommon,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.uplinkPowerControlCommon,
|
||||
sizeof(UplinkPowerControlCommon_t));
|
||||
}
|
||||
//configure antennaInfoCommon somewhere here..
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.p_Max) {
|
||||
//to be configured
|
||||
}
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.tdd_Config) {
|
||||
UE_mac_inst[Mod_id].tdd_Config = mobilityControlInfo->radioResourceConfigCommon.tdd_Config;
|
||||
}
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.ul_CyclicPrefixLength) {
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->ul_CyclicPrefixLength,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.ul_CyclicPrefixLength,
|
||||
sizeof(UL_CyclicPrefixLength_t));
|
||||
}
|
||||
// store the previous rnti in case of failure, and set thenew rnti
|
||||
UE_mac_inst[Mod_id].crnti_before_ho = UE_mac_inst[Mod_id].crnti;
|
||||
UE_mac_inst[Mod_id].crnti = ((mobilityControlInfo->newUE_Identity.buf[0])|(mobilityControlInfo->newUE_Identity.buf[1]<<8));
|
||||
LOG_I(MAC,"[UE %d] Received new identity %x from %d\n", Mod_id, UE_mac_inst[Mod_id].crnti, eNB_index);
|
||||
UE_mac_inst[Mod_id].rach_ConfigDedicated = malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated));
|
||||
if (mobilityControlInfo->rach_ConfigDedicated){
|
||||
memcpy((void*)UE_mac_inst[Mod_id].rach_ConfigDedicated,
|
||||
(void*)mobilityControlInfo->rach_ConfigDedicated,
|
||||
sizeof(*mobilityControlInfo->rach_ConfigDedicated));
|
||||
}
|
||||
mac_xface->phy_config_afterHO_ue(Mod_id,eNB_index,mobilityControlInfo,0);
|
||||
}
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.pucch_ConfigCommon) {
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->pucch_ConfigCommon,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.pucch_ConfigCommon,
|
||||
sizeof(PUCCH_ConfigCommon_t));
|
||||
}
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon) {
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->soundingRS_UL_ConfigCommon,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon,
|
||||
sizeof(SoundingRS_UL_ConfigCommon_t));
|
||||
}
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.uplinkPowerControlCommon) {
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->uplinkPowerControlCommon,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.uplinkPowerControlCommon,
|
||||
sizeof(UplinkPowerControlCommon_t));
|
||||
}
|
||||
//configure antennaInfoCommon somewhere here..
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.p_Max) {
|
||||
//to be configured
|
||||
}
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.tdd_Config) {
|
||||
UE_mac_inst[Mod_id].tdd_Config = mobilityControlInfo->radioResourceConfigCommon.tdd_Config;
|
||||
}
|
||||
if(mobilityControlInfo->radioResourceConfigCommon.ul_CyclicPrefixLength) {
|
||||
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->ul_CyclicPrefixLength,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.ul_CyclicPrefixLength,
|
||||
sizeof(UL_CyclicPrefixLength_t));
|
||||
}
|
||||
// store the previous rnti in case of failure, and set thenew rnti
|
||||
UE_mac_inst[Mod_id].crnti_before_ho = UE_mac_inst[Mod_id].crnti;
|
||||
UE_mac_inst[Mod_id].crnti = ((mobilityControlInfo->newUE_Identity.buf[0])|(mobilityControlInfo->newUE_Identity.buf[1]<<8));
|
||||
LOG_I(MAC,"[UE %d] Received new identity %x from %d\n", Mod_id, UE_mac_inst[Mod_id].crnti, eNB_index);
|
||||
UE_mac_inst[Mod_id].rach_ConfigDedicated = malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated));
|
||||
if (mobilityControlInfo->rach_ConfigDedicated){
|
||||
memcpy((void*)UE_mac_inst[Mod_id].rach_ConfigDedicated,
|
||||
(void*)mobilityControlInfo->rach_ConfigDedicated,
|
||||
sizeof(*mobilityControlInfo->rach_ConfigDedicated));
|
||||
}
|
||||
mac_xface->phy_config_afterHO_ue(Mod_id,eNB_index,mobilityControlInfo,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mbsfn_SubframeConfigList != NULL) {
|
||||
if (eNB_flag == 1) {
|
||||
LOG_I(MAC,"[eNB %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", Mod_id, mbsfn_SubframeConfigList->list.count);
|
||||
eNB_mac_inst[Mod_id].num_sf_allocation_pattern= mbsfn_SubframeConfigList->list.count;
|
||||
for (i=0; i<mbsfn_SubframeConfigList->list.count; i++) {
|
||||
eNB_mac_inst[Mod_id].mbsfn_SubframeConfig[i] = mbsfn_SubframeConfigList->list.array[i];
|
||||
LOG_I(MAC, "[eNB %d][CONFIG] MBSFN_SubframeConfig[%d] pattern is %x\n", Mod_id, i,
|
||||
eNB_mac_inst[Mod_id].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]);
|
||||
}
|
||||
if (eNB_flagP == 1) {
|
||||
LOG_I(MAC,"[eNB %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", Mod_id, mbsfn_SubframeConfigList->list.count);
|
||||
eNB_mac_inst[Mod_id].num_sf_allocation_pattern= mbsfn_SubframeConfigList->list.count;
|
||||
for (i=0; i<mbsfn_SubframeConfigList->list.count; i++) {
|
||||
eNB_mac_inst[Mod_id].mbsfn_SubframeConfig[i] = mbsfn_SubframeConfigList->list.array[i];
|
||||
LOG_I(MAC, "[eNB %d][CONFIG] MBSFN_SubframeConfig[%d] pattern is %x\n", Mod_id, i,
|
||||
eNB_mac_inst[Mod_id].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]);
|
||||
}
|
||||
#ifdef Rel10
|
||||
eNB_mac_inst[Mod_id].MBMS_flag = MBMS_Flag;
|
||||
eNB_mac_inst[Mod_id].MBMS_flag = MBMS_Flag;
|
||||
#endif
|
||||
}
|
||||
else { // UE
|
||||
LOG_I(MAC,"[UE %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", Mod_id, mbsfn_SubframeConfigList->list.count);
|
||||
UE_mac_inst[Mod_id].num_sf_allocation_pattern= mbsfn_SubframeConfigList->list.count;
|
||||
for (i=0; i<mbsfn_SubframeConfigList->list.count; i++) {
|
||||
LOG_I(MAC, "[UE %d] Configuring MBSFN_SubframeConfig %d from received SIB2 \n", Mod_id, i);
|
||||
UE_mac_inst[Mod_id].mbsfn_SubframeConfig[i] = mbsfn_SubframeConfigList->list.array[i];
|
||||
// LOG_I("[UE %d] MBSFN_SubframeConfig[%d] pattern is %ld\n", Mod_id,
|
||||
// UE_mac_inst[Mod_id].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]);
|
||||
}
|
||||
}
|
||||
else { // UE
|
||||
LOG_I(MAC,"[UE %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", Mod_id, mbsfn_SubframeConfigList->list.count);
|
||||
UE_mac_inst[Mod_id].num_sf_allocation_pattern= mbsfn_SubframeConfigList->list.count;
|
||||
for (i=0; i<mbsfn_SubframeConfigList->list.count; i++) {
|
||||
LOG_I(MAC, "[UE %d] Configuring MBSFN_SubframeConfig %d from received SIB2 \n", Mod_id, i);
|
||||
UE_mac_inst[Mod_id].mbsfn_SubframeConfig[i] = mbsfn_SubframeConfigList->list.array[i];
|
||||
// LOG_I("[UE %d] MBSFN_SubframeConfig[%d] pattern is %ld\n", Mod_id,
|
||||
// UE_mac_inst[Mod_id].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Rel10
|
||||
if (mbsfn_AreaInfoList != NULL) {
|
||||
if (eNB_flag == 1) {
|
||||
// One eNB could be part of multiple mbsfn syc area, this could change over time so reset each time
|
||||
LOG_I(MAC,"[eNB %d][CONFIG] Received %d MBSFN Area Info\n", Mod_id, mbsfn_AreaInfoList->list.count);
|
||||
eNB_mac_inst[Mod_id].num_active_mbsfn_area = mbsfn_AreaInfoList->list.count;
|
||||
for (i =0; i< mbsfn_AreaInfoList->list.count; i++) {
|
||||
eNB_mac_inst[Mod_id].mbsfn_AreaInfo[i] = mbsfn_AreaInfoList->list.array[i];
|
||||
LOG_I(MAC,"[eNB %d][CONFIG] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n", Mod_id,i,
|
||||
eNB_mac_inst[Mod_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
|
||||
mac_xface->phy_config_sib13_eNB(Mod_id,i,eNB_mac_inst[Mod_id].mbsfn_AreaInfo[i]->mbsfn_AreaId_r9);
|
||||
if (eNB_flagP == 1) {
|
||||
// One eNB could be part of multiple mbsfn syc area, this could change over time so reset each time
|
||||
LOG_I(MAC,"[eNB %d][CONFIG] Received %d MBSFN Area Info\n", Mod_id, mbsfn_AreaInfoList->list.count);
|
||||
eNB_mac_inst[Mod_id].num_active_mbsfn_area = mbsfn_AreaInfoList->list.count;
|
||||
for (i =0; i< mbsfn_AreaInfoList->list.count; i++) {
|
||||
eNB_mac_inst[Mod_id].mbsfn_AreaInfo[i] = mbsfn_AreaInfoList->list.array[i];
|
||||
LOG_I(MAC,"[eNB %d][CONFIG] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n", Mod_id,i,
|
||||
eNB_mac_inst[Mod_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
|
||||
mac_xface->phy_config_sib13_eNB(Mod_id,i,eNB_mac_inst[Mod_id].mbsfn_AreaInfo[i]->mbsfn_AreaId_r9);
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // UE
|
||||
LOG_I(MAC,"[UE %d][CONFIG] Received %d MBSFN Area Info\n", Mod_id, mbsfn_AreaInfoList->list.count);
|
||||
UE_mac_inst[Mod_id].num_active_mbsfn_area = mbsfn_AreaInfoList->list.count;
|
||||
for (i =0; i< mbsfn_AreaInfoList->list.count; i++) {
|
||||
UE_mac_inst[Mod_id].mbsfn_AreaInfo[i] = mbsfn_AreaInfoList->list.array[i];
|
||||
LOG_I(MAC,"[UE %d] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n",Mod_id, i,
|
||||
UE_mac_inst[Mod_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
|
||||
mac_xface->phy_config_sib13_ue(Mod_id,eNB_index,i,UE_mac_inst[Mod_id].mbsfn_AreaInfo[i]->mbsfn_AreaId_r9);
|
||||
else { // UE
|
||||
LOG_I(MAC,"[UE %d][CONFIG] Received %d MBSFN Area Info\n", Mod_id, mbsfn_AreaInfoList->list.count);
|
||||
UE_mac_inst[Mod_id].num_active_mbsfn_area = mbsfn_AreaInfoList->list.count;
|
||||
for (i =0; i< mbsfn_AreaInfoList->list.count; i++) {
|
||||
UE_mac_inst[Mod_id].mbsfn_AreaInfo[i] = mbsfn_AreaInfoList->list.array[i];
|
||||
LOG_I(MAC,"[UE %d] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n",Mod_id, i,
|
||||
UE_mac_inst[Mod_id].mbsfn_AreaInfo[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9);
|
||||
mac_xface->phy_config_sib13_ue(Mod_id,eNB_index,i,UE_mac_inst[Mod_id].mbsfn_AreaInfo[i]->mbsfn_AreaId_r9);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (pmch_InfoList != NULL) {
|
||||
|
||||
// LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9));
|
||||
// LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9));
|
||||
|
||||
if (eNB_flag == 1) {
|
||||
if (eNB_flagP == 1) {
|
||||
|
||||
LOG_I(MAC, "[CONFIG] Number of PMCH in this MBSFN Area %d\n", pmch_InfoList->list.count);
|
||||
LOG_I(MAC, "[CONFIG] Number of PMCH in this MBSFN Area %d\n", pmch_InfoList->list.count);
|
||||
|
||||
for (i =0; i< pmch_InfoList->list.count; i++) {
|
||||
eNB_mac_inst[Mod_id].pmch_Config[i] = &pmch_InfoList->list.array[i]->pmch_Config_r9;
|
||||
for (i =0; i< pmch_InfoList->list.count; i++) {
|
||||
eNB_mac_inst[Mod_id].pmch_Config[i] = &pmch_InfoList->list.array[i]->pmch_Config_r9;
|
||||
|
||||
LOG_I(MAC, "[CONFIG] PMCH[%d]: This PMCH stop at subframe %ldth\n", i,
|
||||
eNB_mac_inst[Mod_id].pmch_Config[i]->sf_AllocEnd_r9);
|
||||
LOG_I(MAC, "[CONFIG] PMCH[%d]: mch_Scheduling_Period = %ld\n", i,
|
||||
eNB_mac_inst[Mod_id].pmch_Config[i]->mch_SchedulingPeriod_r9);
|
||||
LOG_I(MAC, "[CONFIG] PMCH[%d]: dataMCS = %ld\n", i,
|
||||
eNB_mac_inst[Mod_id].pmch_Config[i]->dataMCS_r9);
|
||||
LOG_I(MAC, "[CONFIG] PMCH[%d]: This PMCH stop at subframe %ldth\n", i,
|
||||
eNB_mac_inst[Mod_id].pmch_Config[i]->sf_AllocEnd_r9);
|
||||
LOG_I(MAC, "[CONFIG] PMCH[%d]: mch_Scheduling_Period = %ld\n", i,
|
||||
eNB_mac_inst[Mod_id].pmch_Config[i]->mch_SchedulingPeriod_r9);
|
||||
LOG_I(MAC, "[CONFIG] PMCH[%d]: dataMCS = %ld\n", i,
|
||||
eNB_mac_inst[Mod_id].pmch_Config[i]->dataMCS_r9);
|
||||
|
||||
// MBMS session info list in each MCH
|
||||
eNB_mac_inst[Mod_id].mbms_SessionList[i] = &pmch_InfoList->list.array[i]->mbms_SessionInfoList_r9;
|
||||
LOG_I(MAC, "PMCH[%d] Number of session (MTCH) is: %d\n",i, eNB_mac_inst[Mod_id].mbms_SessionList[i]->list.count);
|
||||
// MBMS session info list in each MCH
|
||||
eNB_mac_inst[Mod_id].mbms_SessionList[i] = &pmch_InfoList->list.array[i]->mbms_SessionInfoList_r9;
|
||||
LOG_I(MAC, "PMCH[%d] Number of session (MTCH) is: %d\n",i, eNB_mac_inst[Mod_id].mbms_SessionList[i]->list.count);
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // UE
|
||||
LOG_I(MAC, "[UE %d] Configuring PMCH_config from MCCH MESSAGE \n",Mod_id);
|
||||
for (i =0; i< pmch_InfoList->list.count; i++) {
|
||||
UE_mac_inst[Mod_id].pmch_Config[i] = &pmch_InfoList->list.array[i]->pmch_Config_r9;
|
||||
LOG_I(MAC, "[UE %d] PMCH[%d]: MCH_Scheduling_Period = %ld\n", Mod_id, i,
|
||||
UE_mac_inst[Mod_id].pmch_Config[i]->mch_SchedulingPeriod_r9);
|
||||
else { // UE
|
||||
LOG_I(MAC, "[UE %d] Configuring PMCH_config from MCCH MESSAGE \n",Mod_id);
|
||||
for (i =0; i< pmch_InfoList->list.count; i++) {
|
||||
UE_mac_inst[Mod_id].pmch_Config[i] = &pmch_InfoList->list.array[i]->pmch_Config_r9;
|
||||
LOG_I(MAC, "[UE %d] PMCH[%d]: MCH_Scheduling_Period = %ld\n", Mod_id, i,
|
||||
UE_mac_inst[Mod_id].pmch_Config[i]->mch_SchedulingPeriod_r9);
|
||||
}
|
||||
UE_mac_inst[Mod_id].mcch_status = 1;
|
||||
}
|
||||
UE_mac_inst[Mod_id].mcch_status = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
#ifdef CBA
|
||||
if (eNB_flag == 0){
|
||||
if (cba_rnti) {
|
||||
UE_mac_inst[Mod_id].cba_rnti[num_active_cba_groups-1] = cba_rnti;
|
||||
LOG_D(MAC,"[UE %d] configure CBA group %d RNTI %x for eNB %d (total active cba group %d)\n",
|
||||
Mod_id,Mod_id%num_active_cba_groups, cba_rnti,eNB_index,num_active_cba_groups);
|
||||
mac_xface->phy_config_cba_rnti(Mod_id,eNB_flag,eNB_index,cba_rnti,num_active_cba_groups-1, num_active_cba_groups);
|
||||
}
|
||||
if (eNB_flagP == 0){
|
||||
if (cba_rnti) {
|
||||
UE_mac_inst[Mod_id].cba_rnti[num_active_cba_groups-1] = cba_rnti;
|
||||
LOG_D(MAC,"[UE %d] configure CBA group %d RNTI %x for eNB %d (total active cba group %d)\n",
|
||||
Mod_id,Mod_id%num_active_cba_groups, cba_rnti,eNB_index,num_active_cba_groups);
|
||||
mac_xface->phy_config_cba_rnti(Mod_id,eNB_flagP,eNB_index,cba_rnti,num_active_cba_groups-1, num_active_cba_groups);
|
||||
}
|
||||
}else {
|
||||
if (cba_rnti) {
|
||||
LOG_D(MAC,"[eNB %d] configure CBA RNTI for UE %d (total active cba groups %d)\n",
|
||||
Mod_id, UE_id, num_active_cba_groups);
|
||||
eNB_mac_inst[Mod_id].num_active_cba_groups=num_active_cba_groups;
|
||||
for (i=0; i < num_active_cba_groups; i ++){
|
||||
if (eNB_mac_inst[Mod_id].cba_rnti[i] != cba_rnti + i)
|
||||
eNB_mac_inst[Mod_id].cba_rnti[i] = cba_rnti + i;
|
||||
//only configure UE ids up to num_active_cba_groups
|
||||
//we use them as candidates for the transmission of dci format0)
|
||||
if (UE_id%num_active_cba_groups == i){
|
||||
mac_xface->phy_config_cba_rnti(Mod_id,eNB_flag,UE_id,cba_rnti + i,i,num_active_cba_groups );
|
||||
LOG_D(MAC,"[eNB %d] configure CBA groups %d with RNTI %x for UE %d (total active cba groups %d)\n",
|
||||
Mod_id, i, eNB_mac_inst[Mod_id].cba_rnti[i],UE_id, num_active_cba_groups);
|
||||
}
|
||||
if (cba_rnti) {
|
||||
LOG_D(MAC,"[eNB %d] configure CBA RNTI for UE %d (total active cba groups %d)\n",
|
||||
Mod_id, UE_id, num_active_cba_groups);
|
||||
eNB_mac_inst[Mod_id].num_active_cba_groups=num_active_cba_groups;
|
||||
for (i=0; i < num_active_cba_groups; i ++){
|
||||
if (eNB_mac_inst[Mod_id].cba_rnti[i] != cba_rnti + i)
|
||||
eNB_mac_inst[Mod_id].cba_rnti[i] = cba_rnti + i;
|
||||
//only configure UE ids up to num_active_cba_groups
|
||||
//we use them as candidates for the transmission of dci format0)
|
||||
if (UE_id%num_active_cba_groups == i){
|
||||
mac_xface->phy_config_cba_rnti(Mod_id,eNB_flagP,UE_id,cba_rnti + i,i,num_active_cba_groups );
|
||||
LOG_D(MAC,"[eNB %d] configure CBA groups %d with RNTI %x for UE %d (total active cba groups %d)\n",
|
||||
Mod_id, i, eNB_mac_inst[Mod_id].cba_rnti[i],UE_id, num_active_cba_groups);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+153
-149
@@ -333,7 +333,7 @@ typedef enum {
|
||||
// temp struct for sched
|
||||
typedef struct {
|
||||
|
||||
u16 rnti;
|
||||
rnti_t rnti;
|
||||
u16 subframe;
|
||||
u16 serving_num;
|
||||
UE_ULSCH_STATUS status;
|
||||
@@ -341,7 +341,7 @@ typedef struct {
|
||||
// temp struct for sched
|
||||
typedef struct {
|
||||
|
||||
u16 rnti;
|
||||
rnti_t rnti;
|
||||
u16 weight;
|
||||
u16 subframe;
|
||||
u16 serving_num;
|
||||
@@ -383,7 +383,7 @@ typedef struct{
|
||||
typedef struct{
|
||||
|
||||
/// CRNTI of UE
|
||||
uint16_t crnti; ///user id (rnti) of connected UEs
|
||||
rnti_t crnti; ///user id (rnti) of connected UEs
|
||||
// rrc status
|
||||
uint8_t rrc_status;
|
||||
/// harq pid
|
||||
@@ -466,7 +466,7 @@ typedef struct{
|
||||
|
||||
typedef struct{
|
||||
/// C-RNTI of UE
|
||||
u16 rnti;
|
||||
rnti_t rnti;
|
||||
/// NDI from last scheduling
|
||||
uint8_t oldNDI[8];
|
||||
/// NDI from last UL scheduling
|
||||
@@ -566,7 +566,7 @@ typedef struct {
|
||||
/// Flag to indicate that eNB is waiting for ACK that UE has received Msg3.
|
||||
u8 wait_ack_Msg4;
|
||||
/// UE RNTI allocated during RAR
|
||||
u16 rnti;
|
||||
rnti_t rnti;
|
||||
/// RA RNTI allocated from received PRACH
|
||||
u16 RA_rnti;
|
||||
/// Received preamble_index
|
||||
@@ -597,9 +597,9 @@ typedef struct{
|
||||
///
|
||||
u16 Node_id;
|
||||
/// frame counter
|
||||
u32 frame;
|
||||
frame_t frame;
|
||||
/// subframe counter
|
||||
u32 subframe;
|
||||
sub_frame_t subframe;
|
||||
/// Outgoing DCI for PHY generated by eNB scheduler
|
||||
DCI_PDU DCI_pdu;
|
||||
/// Outgoing BCCH pdu for PHY
|
||||
@@ -711,13 +711,13 @@ typedef struct {
|
||||
typedef struct{
|
||||
u16 Node_id;
|
||||
/// frame counter
|
||||
u32 frame;
|
||||
frame_t frame;
|
||||
/// subframe counter
|
||||
u32 subframe;
|
||||
sub_frame_t subframe;
|
||||
/// C-RNTI of UE
|
||||
u16 crnti;
|
||||
/// C-RNTI of UE before HO
|
||||
uint16_t crnti_before_ho; ///user id (rnti) of connected UEs
|
||||
rnti_t crnti_before_ho; ///user id (rnti) of connected UEs
|
||||
/// uplink active flag
|
||||
uint8_t ul_active;
|
||||
/// pointer to RRC PHY configuration
|
||||
@@ -858,33 +858,36 @@ unsigned char generate_dlsch_header(unsigned char *mac_header,
|
||||
@param mbsfn_AreaInfoList pointer to MBSFN Area Info list from SIB13
|
||||
@param pmch_InfoList pointer to PMCH_InfoList from MBSFNAreaConfiguration Message (MCCH Message)
|
||||
*/
|
||||
int rrc_mac_config_req(u8 Mod_id,u8 eNB_flag,u8 UE_id,u8 eNB_index,
|
||||
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
struct PhysicalConfigDedicated *physicalConfigDedicated,
|
||||
MeasObjectToAddMod_t **measObj,
|
||||
MAC_MainConfig_t *mac_MainConfig,
|
||||
long logicalChannelIdentity,
|
||||
LogicalChannelConfig_t *logicalChannelConfig,
|
||||
MeasGapConfig_t *measGapConfig,
|
||||
TDD_Config_t *tdd_Config,
|
||||
MobilityControlInfo_t *mobilityControlInfo,
|
||||
u8 *SIwindowsize,
|
||||
u16 *SIperiod,
|
||||
ARFCN_ValueEUTRA_t *ul_CarrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
||||
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList
|
||||
int rrc_mac_config_req(module_id_t module_idP,
|
||||
eNB_flag_t eNB_flag,
|
||||
u8 UE_id,
|
||||
u8 eNB_index,
|
||||
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
struct PhysicalConfigDedicated *physicalConfigDedicated,
|
||||
MeasObjectToAddMod_t **measObj,
|
||||
MAC_MainConfig_t *mac_MainConfig,
|
||||
long logicalChannelIdentity,
|
||||
LogicalChannelConfig_t *logicalChannelConfig,
|
||||
MeasGapConfig_t *measGapConfig,
|
||||
TDD_Config_t *tdd_Config,
|
||||
MobilityControlInfo_t *mobilityControlInfo,
|
||||
u8 *SIwindowsize,
|
||||
u16 *SIperiod,
|
||||
ARFCN_ValueEUTRA_t *ul_CarrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
||||
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList
|
||||
#ifdef Rel10
|
||||
,
|
||||
u8 MBMS_Flag,
|
||||
MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList,
|
||||
PMCH_InfoList_r9_t *pmch_InfoList
|
||||
,
|
||||
u8 MBMS_Flag,
|
||||
MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList,
|
||||
PMCH_InfoList_r9_t *pmch_InfoList
|
||||
|
||||
#endif
|
||||
#ifdef CBA
|
||||
,
|
||||
u8 num_active_cba_groups,
|
||||
u16 cba_rnti
|
||||
,
|
||||
u8 num_active_cba_groups,
|
||||
u16 cba_rnti
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -897,7 +900,7 @@ for the message.
|
||||
@param nprb Pointer to current PRB count
|
||||
@param nCCE Pointer to current nCCE count
|
||||
*/
|
||||
void schedule_RA(u8 Mod_id,u32 frame,u8 subframe,u8 Msg3_subframe,u8 *nprb,unsigned int *nCCE);
|
||||
void schedule_RA(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,u8 Msg3_subframe,u8 *nprb,unsigned int *nCCE);
|
||||
|
||||
/** \brief First stage of SI Scheduling. Gets a SI SDU from RRC if available and computes the MCS required to transport it as a function of the SDU length. It assumes a length less than or equal to 64 bytes (MCS 6, 3 PRBs).
|
||||
@param Mod_id Instance ID of eNB
|
||||
@@ -907,21 +910,21 @@ void schedule_RA(u8 Mod_id,u32 frame,u8 subframe,u8 Msg3_subframe,u8 *nprb,unsig
|
||||
@param nprb Pointer to current PRB count
|
||||
@param nCCE Pointer to current nCCE count
|
||||
*/
|
||||
void schedule_SI(u8 Mod_id,u32 frame,u8 *nprb,unsigned int *nCCE);
|
||||
void schedule_SI(module_id_t module_idP,frame_t frameP,u8 *nprb,unsigned int *nCCE);
|
||||
|
||||
/** \brief MBMS scheduling: Checking the position for MBSFN subframes. Create MSI, transfer MCCH from RRC to MAC, transfer MTCHs from RLC to MAC. Multiplexing MSI,MCCH&MTCHs. Return 1 if there are MBSFN data being allocated, otherwise return 0;
|
||||
@param Mod_id Instance ID of eNB
|
||||
@param frame Frame index
|
||||
@param subframe Subframe number on which to act
|
||||
*/
|
||||
int schedule_MBMS(unsigned char Mod_id,u32 frame, u8 subframe);
|
||||
int schedule_MBMS(module_id_t module_idP,frame_t frameP, sub_frame_t subframe);
|
||||
|
||||
/** \brief check the mapping between sf allocation and sync area, Currently only supports 1:1 mapping
|
||||
@param Mod_id Instance ID of eNB
|
||||
@param mbsfn_sync_area index of mbsfn sync area
|
||||
@param[out] index of sf pattern
|
||||
*/
|
||||
s8 get_mbsfn_sf_alloction (unsigned char Mod_id, u8 mbsfn_sync_area);
|
||||
s8 get_mbsfn_sf_alloction (module_id_t module_idP, u8 mbsfn_sync_area);
|
||||
|
||||
/** \brief check the mapping between sf allocation and sync area, Currently only supports 1:1 mapping
|
||||
@param Mod_id Instance ID of eNB
|
||||
@@ -929,7 +932,7 @@ s8 get_mbsfn_sf_alloction (unsigned char Mod_id, u8 mbsfn_sync_area);
|
||||
@param eNB_index index of eNB
|
||||
@param[out] index of sf pattern
|
||||
*/
|
||||
s8 ue_get_mbsfn_sf_alloction (unsigned char Mod_id, u8 mbsfn_sync_area, unsigned char eNB_index);
|
||||
s8 ue_get_mbsfn_sf_alloction (module_id_t module_idP, u8 mbsfn_sync_area, unsigned char eNB_index);
|
||||
|
||||
/** \brief top ULSCH Scheduling for TDD (config 1-6).
|
||||
@param Mod_id Instance ID of eNB
|
||||
@@ -938,7 +941,7 @@ s8 ue_get_mbsfn_sf_alloction (unsigned char Mod_id, u8 mbsfn_sync_area, unsigned
|
||||
@param sched_subframe Subframe number where PUSCH is transmitted (for DAI lookup)
|
||||
@param nCCE Pointer to current nCCE count
|
||||
*/
|
||||
void schedule_ulsch(unsigned char Mod_id,u32 frame,unsigned char cooperation_flag,unsigned char subframe,unsigned char sched_subframe,unsigned int *nCCE);
|
||||
void schedule_ulsch(module_id_t module_idP,frame_t frameP,unsigned char cooperation_flag,sub_frame_t subframe,unsigned char sched_subframe,unsigned int *nCCE);
|
||||
|
||||
/** \brief ULSCH Scheduling per RNTI TDD config (config 1-6).
|
||||
@param Mod_id Instance ID of eNB
|
||||
@@ -947,7 +950,7 @@ void schedule_ulsch(unsigned char Mod_id,u32 frame,unsigned char cooperation_fla
|
||||
@param sched_subframe Subframe number where PUSCH is transmitted (for DAI lookup)
|
||||
@param nCCE Pointer to current nCCE count
|
||||
*/
|
||||
void schedule_ulsch_rnti(u8 Mod_id, unsigned char cooperation_flag, u32 frame, unsigned char subframe, unsigned char sched_subframe, u8 granted_UEs, unsigned int *nCCE, unsigned int *nCCE_available, u16 *first_rb);
|
||||
void schedule_ulsch_rnti(module_id_t module_idP, unsigned char cooperation_flag, frame_t frameP, sub_frame_t subframe, unsigned char sched_subframe, u8 granted_UEs, unsigned int *nCCE, unsigned int *nCCE_available, u16 *first_rb);
|
||||
|
||||
/** \brief ULSCH Scheduling for CBA RNTI TDD config (config 1-6).
|
||||
@param Mod_id Instance ID of eNB
|
||||
@@ -956,7 +959,7 @@ void schedule_ulsch_rnti(u8 Mod_id, unsigned char cooperation_flag, u32 frame, u
|
||||
@param sched_subframe Subframe number where PUSCH is transmitted (for DAI lookup)
|
||||
@param nCCE Pointer to current nCCE count
|
||||
*/
|
||||
void schedule_ulsch_cba_rnti(u8 Mod_id, unsigned char cooperation_flag, u32 frame, unsigned char subframe, unsigned char sched_subframe, u8 granted_UEs, unsigned int *nCCE, unsigned int *nCCE_available, u16 *first_rb);
|
||||
void schedule_ulsch_cba_rnti(module_id_t module_idP, unsigned char cooperation_flag, frame_t frameP, sub_frame_t subframe, unsigned char sched_subframe, u8 granted_UEs, unsigned int *nCCE, unsigned int *nCCE_available, u16 *first_rb);
|
||||
|
||||
/** \brief Second stage of DLSCH scheduling, after schedule_SI, schedule_RA and schedule_dlsch have been called. This routine first allocates random frequency assignments for SI and RA SDUs using distributed VRB allocations and adds the corresponding DCI SDU to the DCI buffer for PHY. It then loops over the UE specific DCIs previously allocated and fills in the remaining DCI fields related to frequency allocation. It assumes localized allocation of type 0 (DCI.rah=0). The allocation is done for tranmission modes 1,2,4.
|
||||
@param Mod_id Instance of eNB
|
||||
@@ -966,7 +969,7 @@ void schedule_ulsch_cba_rnti(u8 Mod_id, unsigned char cooperation_flag, u32 fram
|
||||
@param RA_scheduled RA was scheduled in this subframe
|
||||
@param mbsfn_flag Indicates that this subframe is for MCH/MCCH
|
||||
*/
|
||||
void fill_DLSCH_dci(u8 Mod_id,u32 frame,u8 subframe,u32 rballoc,u8 RA_scheduled,int mbsfn_flag);
|
||||
void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,u32 rballoc,u8 RA_scheduled,int mbsfn_flag);
|
||||
|
||||
/** \brief UE specific DLSCH scheduling. Retrieves next ue to be schduled from round-robin scheduler and gets the appropriate harq_pid for the subframe from PHY. If the process is active and requires a retransmission, it schedules the retransmission with the same PRB count and MCS as the first transmission. Otherwise it consults RLC for DCCH/DTCH SDUs (status with maximum number of available PRBS), builds the MAC header (timing advance sent by default) and copies
|
||||
@param Mod_id Instance ID of eNB
|
||||
@@ -976,45 +979,45 @@ void fill_DLSCH_dci(u8 Mod_id,u32 frame,u8 subframe,u32 rballoc,u8 RA_scheduled,
|
||||
@param nCCE_used Number of CCE used by SI/RA
|
||||
@param mbsfn_flag Indicates that MCH/MCCH is in this subframe
|
||||
*/
|
||||
void schedule_ue_spec(u8 Mod_id,u32 frame,u8 subframe,u16 nb_rb_used0,unsigned int *nCCE_used,int mbsfn_flag);
|
||||
void schedule_ue_spec(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,u16 nb_rb_used0,unsigned int *nCCE_used,int mbsfn_flag);
|
||||
|
||||
/** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure.
|
||||
@param Mod_id Module id of UE
|
||||
@returns Po_NOMINAL_PUSCH (PREAMBLE_RECEIVED_TARGET_POWER+DELTA_PREAMBLE
|
||||
*/
|
||||
s8 get_Po_NOMINAL_PUSCH(u8 Mod_id);
|
||||
s8 get_Po_NOMINAL_PUSCH(module_id_t module_idP);
|
||||
|
||||
/** \brief Function to compute DELTA_PREAMBLE from 36.321 (for RA power ramping procedure and Msg3 PUSCH power control policy)
|
||||
@param Mod_id Module id of UE
|
||||
@returns DELTA_PREAMBLE
|
||||
*/
|
||||
s8 get_DELTA_PREAMBLE(u8 Mod_id);
|
||||
s8 get_DELTA_PREAMBLE(module_id_t module_idP);
|
||||
|
||||
/** \brief Function for compute deltaP_rampup from 36.321 (for RA power ramping procedure and Msg3 PUSCH power control policy)
|
||||
@param Mod_id Module id of UE
|
||||
@returns deltaP_rampup
|
||||
*/
|
||||
s8 get_deltaP_rampup(u8 Mod_id);
|
||||
s8 get_deltaP_rampup(module_id_t module_idP);
|
||||
|
||||
//main.c
|
||||
|
||||
void chbch_phy_sync_success(u8 Mod_id,u32 frame,u8 eNB_index);
|
||||
void chbch_phy_sync_success(module_id_t module_idP,frame_t frameP,u8 eNB_index);
|
||||
|
||||
void mrbch_phy_sync_failure(u8 Mod_id, u32 frame,u8 free_eNB_index);
|
||||
void mrbch_phy_sync_failure(module_id_t module_idP, frame_t frameP,u8 free_eNB_index);
|
||||
|
||||
int mac_top_init(int eMBMS_active, u8 cba_group_active, u8 HO_active);
|
||||
|
||||
char layer2_init_UE(u8 Mod_id);
|
||||
char layer2_init_UE(module_id_t module_idP);
|
||||
|
||||
char layer2_init_eNB(u8 Mod_id, u8 Free_ch_index);
|
||||
char layer2_init_eNB(module_id_t module_idP, u8 Free_ch_index);
|
||||
|
||||
void mac_switch_node_function(u8 Mod_id);
|
||||
void mac_switch_node_function(module_id_t module_idP);
|
||||
|
||||
int mac_init_global_param(void);
|
||||
|
||||
void mac_top_cleanup(void);
|
||||
|
||||
void mac_UE_out_of_sync_ind(u8 Mod_id,u32 frame, u16 eNB_index);
|
||||
void mac_UE_out_of_sync_ind(module_id_t module_idP,frame_t frameP, u16 eNB_index);
|
||||
|
||||
|
||||
// eNB functions
|
||||
@@ -1029,13 +1032,13 @@ void mac_UE_out_of_sync_ind(u8 Mod_id,u32 frame, u16 eNB_index);
|
||||
*/
|
||||
|
||||
|
||||
void dlsch_scheduler_pre_processor (unsigned char Mod_id,
|
||||
u32 frame,
|
||||
unsigned char subframe,
|
||||
u8 *dl_pow_off,
|
||||
u16 *pre_nb_available_rbs,
|
||||
int N_RBGS,
|
||||
unsigned char rballoc_sub_UE[NUMBER_OF_UE_MAX][N_RBGS_MAX]);
|
||||
void dlsch_scheduler_pre_processor (module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t subframe,
|
||||
u8 *dl_pow_off,
|
||||
u16 *pre_nb_available_rbs,
|
||||
int N_RBGS,
|
||||
unsigned char rballoc_sub_UE[NUMBER_OF_UE_MAX][N_RBGS_MAX]);
|
||||
|
||||
/* \brief Function to trigger the eNB scheduling procedure. It is called by PHY at the beginning of each subframe, \f$n$\f
|
||||
and generates all DLSCH allocations for subframe \f$n\f$ and ULSCH allocations for subframe \f$n+k$\f. The resultant DCI_PDU is
|
||||
@@ -1046,7 +1049,7 @@ can be scheduled.
|
||||
@param subframe Index of current subframe
|
||||
@param calibration_flag Flag to indicate that eNB scheduler should schedule TDD auto-calibration PUSCH.
|
||||
*/
|
||||
void eNB_dlsch_ulsch_scheduler(u8 Mod_id, u8 cooperation_flag, u32 frame, u8 subframe);//, int calibration_flag);
|
||||
void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, u8 cooperation_flag, frame_t frameP, sub_frame_t subframe);//, int calibration_flag);
|
||||
|
||||
/* \brief Function to retrieve result of scheduling (DCI) in current subframe. Can be called an arbitrary numeber of times after eNB_dlsch_ulsch_scheduler
|
||||
in a given subframe.
|
||||
@@ -1054,14 +1057,14 @@ in a given subframe.
|
||||
@param subframe Index of current subframe
|
||||
@returns Pointer to generated DCI for subframe
|
||||
*/
|
||||
DCI_PDU *get_dci_sdu(u8 Mod_id,u32 frame,u8 subframe);
|
||||
DCI_PDU *get_dci_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe);
|
||||
|
||||
/* \brief Function to indicate a received preamble on PRACH. It initiates the RA procedure.
|
||||
@param Mod_id Instance ID of eNB
|
||||
@param preamble_index index of the received RA request
|
||||
@param timing_offset Offset in samples of the received PRACH w.r.t. eNB timing. This is used to
|
||||
*/
|
||||
void initiate_ra_proc(u8 Mod_id,u32 frame, u16 preamble_index,s16 timing_offset,u8 sect_id,u8 subframe,u8 f_id);
|
||||
void initiate_ra_proc(module_id_t module_idP,frame_t frameP, u16 preamble_index,s16 timing_offset,u8 sect_id,sub_frame_t subframe,u8 f_id);
|
||||
|
||||
/* \brief Function in eNB to fill RAR pdu when requested by PHY. This provides a single RAR SDU for the moment and returns the t-CRNTI.
|
||||
@param Mod_id Instance ID of eNB
|
||||
@@ -1069,39 +1072,40 @@ void initiate_ra_proc(u8 Mod_id,u32 frame, u16 preamble_index,s16 timing_offset,
|
||||
@param N_RB_UL Number of UL resource blocks
|
||||
@returns t_CRNTI
|
||||
*/
|
||||
u16 fill_rar(u8 Mod_id,u32 frame,
|
||||
u8 *dlsch_buffer,
|
||||
u16 N_RB_UL,
|
||||
u8 input_buffer_length);
|
||||
u16 fill_rar(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
u8 *dlsch_buffer,
|
||||
u16 N_RB_UL,
|
||||
u8 input_buffer_length);
|
||||
|
||||
/* \brief This function indicates the end of RA procedure and provides the l3msg received on ULSCH.
|
||||
@param Mod_id Instance ID of eNB
|
||||
@param rnti RNTI of UE transmitting l3msg
|
||||
@param l3msg Pointer to received l3msg
|
||||
*/
|
||||
void terminate_ra_proc(u8 Mod_id,u32 frame,u16 rnti, u8 *l3msg, u16 l3msg_len);
|
||||
void terminate_ra_proc(module_id_t module_idP,frame_t frameP, rnti_t rnti, u8 *l3msg, u16 l3msg_len);
|
||||
|
||||
/* \brief Function to indicate a failed RA response. It removes all temporary variables related to the initial connection of a UE
|
||||
@param Mod_id Instance ID of eNB
|
||||
@param preamble_index index of the received RA request.
|
||||
*/
|
||||
void cancel_ra_proc(u8 Mod_id,u32 frame, u16 preamble_index);
|
||||
void cancel_ra_proc(module_id_t module_idP,frame_t frameP, u16 preamble_index);
|
||||
|
||||
/* \brief Function to indicate a received SDU on ULSCH.
|
||||
@param Mod_id Instance ID of eNB
|
||||
@param rnti RNTI of UE transmitting the SR
|
||||
@param sdu Pointer to received SDU
|
||||
*/
|
||||
void rx_sdu(u8 Mod_id,u32 frame,u16 rnti, u8 *sdu, u16 sdu_len);
|
||||
void rx_sdu(module_id_t module_idP, frame_t frameP, rnti_t rnti, u8 *sdu, u16 sdu_len);
|
||||
|
||||
/* \brief Function to indicate a scheduled schduling request (SR) was received by eNB.
|
||||
@param Mod_id Instance ID of eNB
|
||||
@param rnti RNTI of UE transmitting the SR
|
||||
@param subframe Index of subframe where SR was received
|
||||
*/
|
||||
void SR_indication(u8 Mod_id,u32 frame,u16 rnti, u8 subframe);
|
||||
void SR_indication(module_id_t module_idP,frame_t frameP,rnti_t rnti, sub_frame_t subframe);
|
||||
|
||||
u8 *get_dlsch_sdu(u8 Mod_id,u32 frame,u16 rnti,u8 TBindex);
|
||||
u8 *get_dlsch_sdu(module_id_t module_idP,frame_t frameP,rnti_t rnti,u8 TBindex);
|
||||
|
||||
/* \brief Function to retrieve MCH transport block and MCS used for MCH in this MBSFN subframe. Returns null if no MCH is to be transmitted
|
||||
@param Mod_id Instance ID of eNB
|
||||
@@ -1114,41 +1118,41 @@ MCH_PDU *get_mch_sdu(uint8_t Mod_id,uint32_t frame,uint32_t subframe);
|
||||
|
||||
|
||||
//added for ALU icic purpose
|
||||
u32 Get_Cell_SBMap(u8 Mod_id);
|
||||
void UpdateSBnumber(unsigned char Mod_id);
|
||||
u32 Get_Cell_SBMap(module_id_t module_idP);
|
||||
void UpdateSBnumber(module_id_t module_idP);
|
||||
//end ALU's algo
|
||||
|
||||
|
||||
void ue_mac_reset(u8 Mod_id,u8 eNB_index);
|
||||
void ue_init_mac(u8 Mod_id);
|
||||
void init_ue_sched_info(void);
|
||||
void add_ue_ulsch_info(u8 Mod_id, u8 UE_id, u8 subframe,UE_ULSCH_STATUS status);
|
||||
void add_ue_dlsch_info(u8 Mod_id, u8 UE_id, u8 subframe,UE_DLSCH_STATUS status);
|
||||
s8 find_UE_id(u8 Mod_id,u16 rnti) ;
|
||||
u16 find_UE_RNTI(u8 Mod_id, u8 UE_id);
|
||||
s8 find_active_UEs(u8 Mod_id);
|
||||
u8 is_UE_active(unsigned char Mod_id, unsigned char UE_id );
|
||||
u16 find_ulgranted_UEs(u8 Mod_id);
|
||||
u16 find_dlgranted_UEs(u8 Mod_id);
|
||||
u8 process_ue_cqi (u8 Mod_id, u8 UE_id);
|
||||
void ue_mac_reset (module_id_t module_idP,u8 eNB_index);
|
||||
void ue_init_mac (module_id_t module_idP);
|
||||
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_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) ;
|
||||
u16 find_UE_RNTI (module_id_t module_idP, module_id_t ue_mod_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 );
|
||||
u8 find_ulgranted_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);
|
||||
|
||||
s8 find_active_UEs_with_traffic(unsigned char Mod_id);
|
||||
s8 find_active_UEs_with_traffic(module_id_t module_idP);
|
||||
|
||||
u8 find_num_active_UEs_in_cbagroup(unsigned char Mod_id, unsigned char group_id);
|
||||
u8 UE_is_to_be_scheduled(u8 Mod_id,u8 UE_id);
|
||||
u8 find_num_active_UEs_in_cbagroup(module_id_t module_idP, unsigned char group_id);
|
||||
u8 UE_is_to_be_scheduled(module_id_t module_idP,u8 UE_id);
|
||||
/** \brief Round-robin scheduler for ULSCH traffic.
|
||||
@param Mod_id Instance ID for eNB
|
||||
@param subframe Subframe number on which to act
|
||||
@returns UE index that is to be scheduled if needed/room
|
||||
*/
|
||||
u8 schedule_next_ulue(u8 Mod_id, u8 UE_id,u8 subframe);
|
||||
module_id_t schedule_next_ulue(module_id_t module_idP, module_id_t ue_mod_idP,sub_frame_t subframe);
|
||||
|
||||
/** \brief Round-robin scheduler for DLSCH traffic.
|
||||
@param Mod_id Instance ID for eNB
|
||||
@param subframe Subframe number on which to act
|
||||
@returns UE index that is to be scheduled if needed/room
|
||||
*/
|
||||
u8 schedule_next_dlue(u8 Mod_id, u8 subframe);
|
||||
module_id_t schedule_next_dlue(module_id_t module_idP, sub_frame_t subframe);
|
||||
|
||||
/* \brief Allocates a set of PRBS for a particular UE. This is a simple function for the moment, later it should process frequency-domain CQI information and/or PMI information. Currently it just returns the first PRBS that are available in the subframe based on the number requested.
|
||||
@param UE_id Index of UE on which to act
|
||||
@@ -1156,14 +1160,14 @@ u8 schedule_next_dlue(u8 Mod_id, u8 subframe);
|
||||
@param rballoc Pointer to bit-map of current PRB allocation given to previous users/control channels. This is updated for subsequent calls to the routine.
|
||||
@returns an rballoc bitmap for resource type 0 allocation (DCI).
|
||||
*/
|
||||
u32 allocate_prbs(u8 UE_id,u8 nb_rb, u32 *rballoc);
|
||||
u32 allocate_prbs(module_id_t ue_mod_idP,u8 nb_rb, u32 *rballoc);
|
||||
|
||||
/* \fn u32 req_new_ulsch(u8 Mod_id)
|
||||
/* \fn u32 req_new_ulsch(module_id_t module_idP)
|
||||
\brief check for a new transmission in any drb
|
||||
@param Mod_id Instance id of UE in machine
|
||||
@returns 1 for new transmission, 0 for none
|
||||
*/
|
||||
u32 req_new_ulsch(u8 Mod_id);
|
||||
u32 req_new_ulsch(module_id_t module_idP);
|
||||
|
||||
/* \brief Get SR payload (0,1) from UE MAC
|
||||
@param Mod_id Instance id of UE in machine
|
||||
@@ -1172,17 +1176,17 @@ u32 req_new_ulsch(u8 Mod_id);
|
||||
@param subframe subframe number
|
||||
@returns 0 for no SR, 1 for SR
|
||||
*/
|
||||
u32 ue_get_SR(u8 Mod_id, u32 frame, u8 eNB_id,u16 rnti,u8 subframe);
|
||||
u32 ue_get_SR(module_id_t module_idP, frame_t frameP, u8 eNB_id,rnti_t rnti,sub_frame_t subframe);
|
||||
|
||||
u8 get_ue_weight(u8 Mod_id, u8 UE_id);
|
||||
u8 get_ue_weight(module_id_t module_idP, module_id_t ue_mod_idP);
|
||||
|
||||
// UE functions
|
||||
void mac_out_of_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index);
|
||||
void mac_out_of_sync_ind(module_id_t module_idP, frame_t frameP, u16 CH_index);
|
||||
|
||||
void ue_decode_si(u8 Mod_id, u32 frame, u8 CH_index, void *pdu, u16 len);
|
||||
void ue_decode_si(module_id_t module_idP, frame_t frame, u8 CH_index, void *pdu, u16 len);
|
||||
|
||||
|
||||
void ue_send_sdu(u8 Mod_id, u32 frame, u8 *sdu,u16 sdu_len,u8 CH_index);
|
||||
void ue_send_sdu(module_id_t module_idP, frame_t frame, u8 *sdu,u16 sdu_len,u8 CH_index);
|
||||
|
||||
|
||||
#ifdef Rel10
|
||||
@@ -1194,7 +1198,7 @@ void ue_send_sdu(u8 Mod_id, u32 frame, u8 *sdu,u16 sdu_len,u8 CH_index);
|
||||
@param eNB_index Index of attached eNB
|
||||
@param sync_area the index of MBSFN sync area
|
||||
*/
|
||||
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(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eNB_index,u8 sync_area) ;
|
||||
|
||||
/*\brief Function to check if UE PHY needs to decode MCH for MAC.
|
||||
@param Mod_id Index of protocol instance
|
||||
@@ -1204,7 +1208,7 @@ void ue_send_mch_sdu(u8 Mod_id,u32 frame,u8 *sdu,u16 sdu_len,u8 eNB_index,u8 syn
|
||||
@param[out] sync_area return the sync area
|
||||
@param[out] mcch_active flag indicating whether this MCCH is active in this SF
|
||||
*/
|
||||
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,uint32_t frame,sub_frame_t subframe, uint8_t eNB_index, uint8_t *sync_area, uint8_t *mcch_active);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1215,14 +1219,14 @@ int ue_query_mch(uint8_t Mod_id,uint32_t frame,uint32_t subframe, uint8_t eNB_in
|
||||
@param subframe subframe number
|
||||
@returns 0 for no SR, 1 for SR
|
||||
*/
|
||||
void ue_get_sdu(u8 Mod_id, u32 frame, u8 subframe, u8 eNB_index,u8 *ulsch_buffer,u16 buflen,u8 *access_mode);
|
||||
void ue_get_sdu(module_id_t module_idP, frame_t frameP, sub_frame_t subframe, u8 eNB_index,u8 *ulsch_buffer,u16 buflen,u8 *access_mode);
|
||||
|
||||
/* \brief Function called by PHY to retrieve information to be transmitted using the RA procedure. If the UE is not in PUSCH mode for a particular eNB index, this is assumed to be an Msg3 and MAC attempts to retrieves the CCCH message from RRC. If the UE is in PUSCH mode for a particular eNB index and PUCCH format 0 (Scheduling Request) is not activated, the MAC may use this resource for random-access to transmit a BSR along with the C-RNTI control element (see 5.1.4 from 36.321)
|
||||
@param Mod_id Index of UE instance
|
||||
@param New_Msg3 Flag to indicate this call is for a new Msg3
|
||||
@param subframe Index of subframe for PRACH transmission (0 ... 9)
|
||||
@returns A pointer to a PRACH_RESOURCES_t */
|
||||
PRACH_RESOURCES_t *ue_get_rach(u8 Mod_id,u32 frame,u8 new_Msg3,u8 subframe);
|
||||
PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP,u8 new_Msg3,sub_frame_t subframe);
|
||||
|
||||
/* \brief Function called by PHY to process the received RAR. It checks that the preamble matches what was sent by the eNB and provides the timing advance and t-CRNTI.
|
||||
@param Mod_id Index of UE instance
|
||||
@@ -1232,7 +1236,7 @@ PRACH_RESOURCES_t *ue_get_rach(u8 Mod_id,u32 frame,u8 new_Msg3,u8 subframe);
|
||||
random-access procedure
|
||||
@returns timing advance or 0xffff if preamble doesn't match
|
||||
*/
|
||||
u16 ue_process_rar(u8 Mod_id,u32 frame,u8 *dlsch_buffer,u16 *t_crnti,u8 preamble_index);
|
||||
u16 ue_process_rar(module_id_t module_idP, frame_t frameP,u8 *dlsch_buffer,u16 *t_crnti,u8 preamble_index);
|
||||
|
||||
|
||||
/* \brief Generate header for UL-SCH. This function parses the desired control elements and sdus and generates the header as described
|
||||
@@ -1252,16 +1256,16 @@ in the ULSCH buffer.
|
||||
@returns Number of bytes used for header
|
||||
*/
|
||||
unsigned char generate_ulsch_header(u8 *mac_header,
|
||||
u8 num_sdus,
|
||||
u8 short_padding,
|
||||
u16 *sdu_lengths,
|
||||
u8 *sdu_lcids,
|
||||
POWER_HEADROOM_CMD *power_headroom,
|
||||
u16 *crnti,
|
||||
BSR_SHORT *truncated_bsr,
|
||||
BSR_SHORT *short_bsr,
|
||||
BSR_LONG *long_bsr,
|
||||
unsigned short post_padding);
|
||||
u8 num_sdus,
|
||||
u8 short_padding,
|
||||
u16 *sdu_lengths,
|
||||
u8 *sdu_lcids,
|
||||
POWER_HEADROOM_CMD *power_headroom,
|
||||
u16 *crnti,
|
||||
BSR_SHORT *truncated_bsr,
|
||||
BSR_SHORT *short_bsr,
|
||||
BSR_LONG *long_bsr,
|
||||
unsigned short post_padding);
|
||||
|
||||
/* \brief Parse header for UL-SCH. This function parses the received UL-SCH header as described
|
||||
in 36-321 MAC layer specifications. It returns the number of bytes used for the header to be used as an offset for the payload
|
||||
@@ -1275,30 +1279,30 @@ in the ULSCH buffer.
|
||||
@returns Pointer to payload following header
|
||||
*/
|
||||
u8 *parse_ulsch_header(u8 *mac_header,
|
||||
u8 *num_ce,
|
||||
u8 *num_sdu,
|
||||
u8 *rx_ces,
|
||||
u8 *rx_lcids,
|
||||
u16 *rx_lengths,
|
||||
u16 tx_lenght);
|
||||
u8 *num_ce,
|
||||
u8 *num_sdu,
|
||||
u8 *rx_ces,
|
||||
u8 *rx_lcids,
|
||||
u16 *rx_lengths,
|
||||
u16 tx_lenght);
|
||||
|
||||
|
||||
int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_active, u8 HO_active);
|
||||
int mac_init(void);
|
||||
s8 add_new_ue(u8 Mod_id, u16 rnti);
|
||||
s8 mac_remove_ue(u8 Mod_id, u8 UE_id);
|
||||
s8 add_new_ue(module_id_t module_idP, rnti_t rnti);
|
||||
s8 mac_remove_ue(module_id_t enb_mod_idP, module_id_t ue_mod_idP);
|
||||
|
||||
/*! \fn UE_L2_state_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t direction,u8 eNB_index)
|
||||
/*! \fn UE_L2_state_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t subframe, lte_subframe_t direction,u8 eNB_index)
|
||||
\brief UE scheduler where all the ue background tasks are done. This function performs the following: 1) Trigger PDCP every 5ms 2) Call RRC for link status return to PHY3) Perform SR/BSR procedures for scheduling feedback 4) Perform PHR procedures.
|
||||
\param[in] Mod_id instance of the UE
|
||||
\param[in] subframe the subframe number
|
||||
\param[in] direction subframe direction
|
||||
\param[in] eNB_index instance of eNB
|
||||
\param[in] module_idP instance of the UE
|
||||
\param[in] subframe t the subframe number
|
||||
\param[in] direction subframe direction
|
||||
\param[in] eNB_index instance of eNB
|
||||
@returns L2 state (CONNETION_OK or CONNECTION_LOST or PHY_RESYNCH)
|
||||
*/
|
||||
UE_L2_STATE_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t direction,u8 eNB_index);
|
||||
UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t subframe, lte_subframe_t direction,u8 eNB_index);
|
||||
|
||||
/*! \fn int use_cba_access(u8 Mod_id,u32 frame,u8 subframe, u8 eNB_index);
|
||||
/*! \fn int use_cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 eNB_index);
|
||||
\brief determine whether to use cba resource to transmit or not
|
||||
\param[in] Mod_id instance of the UE
|
||||
\param[in] frame the frame number
|
||||
@@ -1306,46 +1310,46 @@ UE_L2_STATE_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t dire
|
||||
\param[in] eNB_index instance of eNB
|
||||
\param[out] access(1) or postpone (0)
|
||||
*/
|
||||
int use_cba_access(u8 Mod_id,u32 frame,u8 subframe, u8 eNB_index);
|
||||
int use_cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 eNB_index);
|
||||
|
||||
/*! \fn int get_bsr_lcgid (u8 Mod_id);
|
||||
/*! \fn int get_bsr_lcgid (module_id_t module_idP);
|
||||
\brief determine the lcgid for the bsr
|
||||
\param[in] Mod_id instance of the UE
|
||||
\param[out] lcgid
|
||||
*/
|
||||
int get_bsr_lcgid (u8 Mod_id);
|
||||
int get_bsr_lcgid (module_id_t module_idP);
|
||||
|
||||
/*! \fn u8 get_bsr_len (u8 Mod_id, u16 bufflen);
|
||||
/*! \fn u8 get_bsr_len (module_id_t module_idP, u16 bufflen);
|
||||
\brief determine whether the bsr is short or long assuming that the MAC pdu is built
|
||||
\param[in] Mod_id instance of the UE
|
||||
\param[in] bufflen size of phy transport block
|
||||
\param[out] bsr_len size of bsr control element
|
||||
*/
|
||||
u8 get_bsr_len (u8 Mod_id, u16 buflen);
|
||||
u8 get_bsr_len (module_id_t module_idP, u16 buflen);
|
||||
|
||||
/*! \fn BSR_SHORT * get_bsr_short(u8 Mod_id, u8 bsr_len)
|
||||
/*! \fn BSR_SHORT * get_bsr_short(module_id_t module_idP, u8 bsr_len)
|
||||
\brief get short bsr level
|
||||
\param[in] Mod_id instance of the UE
|
||||
\param[in] bsr_len indicator for no, short, or long bsr
|
||||
\param[out] bsr_s pointer to short bsr
|
||||
*/
|
||||
BSR_SHORT *get_bsr_short(u8 Mod_id, u8 bsr_len);
|
||||
BSR_SHORT *get_bsr_short(module_id_t module_idP, u8 bsr_len);
|
||||
|
||||
/*! \fn BSR_LONG * get_bsr_long(u8 Mod_id, u8 bsr_len)
|
||||
/*! \fn BSR_LONG * get_bsr_long(module_id_t module_idP, u8 bsr_len)
|
||||
\brief get long bsr level
|
||||
\param[in] Mod_id instance of the UE
|
||||
\param[in] bsr_len indicator for no, short, or long bsr
|
||||
\param[out] bsr_l pointer to long bsr
|
||||
*/
|
||||
BSR_LONG * get_bsr_long(u8 Mod_id, u8 bsr_len);
|
||||
BSR_LONG * get_bsr_long(module_id_t module_idP, u8 bsr_len);
|
||||
|
||||
/*! \fn int update_bsr(u8 Mod_id, u32 frame, u8 lcid)
|
||||
/*! \fn int 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
|
||||
\param[in] Mod_id instance of the UE
|
||||
\param[in] frame Frame index
|
||||
\param[in] lcid logical channel identifier
|
||||
*/
|
||||
int update_bsr(u8 Mod_id, u32 frame, u8 lcid, u8 lcgid);
|
||||
int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcgid);
|
||||
|
||||
/*! \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.
|
||||
@@ -1399,25 +1403,25 @@ int get_sf_prohibitPHR_Timer(u8 prohibitPHR_Timer);
|
||||
*/
|
||||
int get_db_dl_PathlossChange(u8 dl_PathlossChange);
|
||||
|
||||
/*! \fn u8 get_phr_mapping (u8 Mod_id, u8 eNB_index)
|
||||
/*! \fn u8 get_phr_mapping (module_id_t module_idP, u8 eNB_index)
|
||||
\brief get phr mapping as described in 36.313
|
||||
\param[in] Mod_id index of eNB
|
||||
\return phr mapping
|
||||
*/
|
||||
u8 get_phr_mapping (u8 Mod_id, u8 eNB_index);
|
||||
u8 get_phr_mapping (module_id_t module_idP, u8 eNB_index);
|
||||
|
||||
/*! \fn void update_phr (u8 Mod_id)
|
||||
/*! \fn void update_phr (module_id_t module_idP)
|
||||
\brief update/reset the phr timers
|
||||
\param[in] Mod_id index of eNB
|
||||
\return void
|
||||
*/
|
||||
void update_phr (u8 Mod_id);
|
||||
void update_phr (module_id_t module_idP);
|
||||
|
||||
/*! \brief Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer
|
||||
\param[in] Mod_id Instance index of UE
|
||||
\param[in] eNB_id Index of eNB
|
||||
*/
|
||||
void Msg3_tx(u8 Mod_id,u32 frame,u8 eNB_id);
|
||||
void Msg3_tx(module_id_t module_idP,frame_t frameP,u8 eNB_id);
|
||||
|
||||
|
||||
/*! \brief Function to indicate the transmission of msg1/rach
|
||||
@@ -1425,12 +1429,12 @@ void Msg3_tx(u8 Mod_id,u32 frame,u8 eNB_id);
|
||||
\param[in] eNB_id Index of eNB
|
||||
*/
|
||||
|
||||
void Msg1_tx(u8 Mod_id,u32 frame, u8 eNB_id);
|
||||
void Msg1_tx(module_id_t module_idP,frame_t frameP, u8 eNB_id);
|
||||
|
||||
void dl_phy_sync_success(unsigned char Mod_id,
|
||||
u32 frame,
|
||||
unsigned char eNB_index,
|
||||
u8 first_sync);
|
||||
void dl_phy_sync_success(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
unsigned char eNB_index,
|
||||
u8 first_sync);
|
||||
|
||||
int dump_eNB_l2_stats(char *buffer, int length);
|
||||
|
||||
|
||||
+3550
-3498
File diff suppressed because it is too large
Load Diff
@@ -39,23 +39,23 @@
|
||||
#include "extern.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
|
||||
s8 get_Po_NOMINAL_PUSCH(u8 Mod_id) {
|
||||
s8 get_Po_NOMINAL_PUSCH(module_id_t module_idP) {
|
||||
RACH_ConfigCommon_t *rach_ConfigCommon = NULL;
|
||||
|
||||
if (UE_mac_inst[Mod_id].radioResourceConfigCommon)
|
||||
rach_ConfigCommon = &UE_mac_inst[Mod_id].radioResourceConfigCommon->rach_ConfigCommon;
|
||||
if (UE_mac_inst[module_idP].radioResourceConfigCommon)
|
||||
rach_ConfigCommon = &UE_mac_inst[module_idP].radioResourceConfigCommon->rach_ConfigCommon;
|
||||
else {
|
||||
LOG_E(MAC,"[UE %d] FATAL radioResourceConfigCommon is NULL !!!\n",Mod_id);
|
||||
LOG_E(MAC,"[UE %d] FATAL radioResourceConfigCommon is NULL !!!\n",module_idP);
|
||||
mac_xface->macphy_exit("");
|
||||
}
|
||||
|
||||
return(-120 + (rach_ConfigCommon->powerRampingParameters.preambleInitialReceivedTargetPower<<1) +
|
||||
get_DELTA_PREAMBLE(Mod_id));
|
||||
get_DELTA_PREAMBLE(module_idP));
|
||||
}
|
||||
|
||||
s8 get_deltaP_rampup(u8 Mod_id) {
|
||||
s8 get_deltaP_rampup(module_id_t module_idP) {
|
||||
|
||||
LOG_D(MAC,"[PUSCH]%d dB\n",UE_mac_inst[Mod_id].RA_PREAMBLE_TRANSMISSION_COUNTER<<1);
|
||||
return((s8)(UE_mac_inst[Mod_id].RA_PREAMBLE_TRANSMISSION_COUNTER<<1));
|
||||
LOG_D(MAC,"[PUSCH]%d dB\n",UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER<<1);
|
||||
return((s8)(UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER<<1));
|
||||
|
||||
}
|
||||
|
||||
+158
-162
@@ -25,16 +25,16 @@
|
||||
Forums : http://forums.eurecom.fsr/openairinterface
|
||||
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
|
||||
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
/*! \file main.c
|
||||
* \brief top init of Layer 2
|
||||
* \author Raymond Knopp and Navid Nikaein
|
||||
* \date 2011
|
||||
* \version 0.5
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* @ingroup _mac
|
||||
* \brief top init of Layer 2
|
||||
* \author Raymond Knopp and Navid Nikaein
|
||||
* \date 2011
|
||||
* \version 0.5
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef USER_MODE
|
||||
#include "LAYER2/register.h"
|
||||
@@ -74,98 +74,94 @@
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
void dl_phy_sync_success(unsigned char Mod_id,
|
||||
u32 frame,
|
||||
unsigned char eNB_index,
|
||||
u8 first_sync){ //init as MR
|
||||
/***********************************************************************/
|
||||
LOG_D(MAC,"[UE %d] Frame %d: PHY Sync to eNB_index %d successful \n", Mod_id, frame, eNB_index);
|
||||
void dl_phy_sync_success(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
unsigned char eNB_index,
|
||||
u8 first_sync){ //init as MR
|
||||
/***********************************************************************/
|
||||
LOG_D(MAC,"[UE %d] Frame %d: PHY Sync to eNB_index %d successful \n", module_idP, frameP, eNB_index);
|
||||
if (first_sync==1) {
|
||||
layer2_init_UE(Mod_id);
|
||||
openair_rrc_ue_init(Mod_id,eNB_index);
|
||||
layer2_init_UE(module_idP);
|
||||
openair_rrc_ue_init(module_idP,eNB_index);
|
||||
}
|
||||
else {
|
||||
mac_in_sync_ind(Mod_id,frame,eNB_index);
|
||||
mac_in_sync_ind(module_idP,frameP,eNB_index);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
void mrbch_phy_sync_failure(u8 Mod_id, u32 frame, u8 free_eNB_index){//init as CH
|
||||
void mrbch_phy_sync_failure(module_id_t module_idP, frame_t frameP, u8 free_eNB_index){//init as CH
|
||||
/***********************************************************************/
|
||||
LOG_I(MAC,"[eNB %d] Frame %d: PHY Sync failure \n",Mod_id,frame);
|
||||
layer2_init_eNB(Mod_id, free_eNB_index);
|
||||
openair_rrc_eNB_init(Mod_id);
|
||||
|
||||
|
||||
|
||||
|
||||
LOG_I(MAC,"[eNB %d] Frame %d: PHY Sync failure \n",module_idP,frameP);
|
||||
layer2_init_eNB(module_idP, free_eNB_index);
|
||||
openair_rrc_eNB_init(module_idP);
|
||||
}
|
||||
|
||||
char layer2_init_eNB(unsigned char Mod_id, unsigned char eNB_index){
|
||||
char layer2_init_eNB(module_id_t module_idP, unsigned char eNB_index){
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
char layer2_init_UE(unsigned char Mod_id){
|
||||
|
||||
char layer2_init_UE(module_id_t module_idP){
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
void mac_UE_out_of_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index){
|
||||
/***********************************************************************/
|
||||
void mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP, u16 eNB_index){
|
||||
/***********************************************************************/
|
||||
|
||||
// Mac_rlc_xface->mac_out_of_sync_ind(Mod_id, frame, eNB_index);
|
||||
// Mac_rlc_xface->mac_out_of_sync_ind(Mod_id, frameP, eNB_index);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
int mac_top_init(int eMBMS_active, u8 cba_group_active, u8 HO_active){
|
||||
/***********************************************************************/
|
||||
unsigned char Mod_id,i,j;
|
||||
/***********************************************************************/
|
||||
module_id_t Mod_id,i,j;
|
||||
RA_TEMPLATE *RA_template;
|
||||
UE_TEMPLATE *UE_template;
|
||||
int size_bytes1,size_bytes2,size_bits1,size_bits2;
|
||||
|
||||
LOG_I(MAC,"[MAIN] Init function start:Nb_UE_INST=%d\n",NB_UE_INST);
|
||||
if (NB_UE_INST>0) {
|
||||
UE_mac_inst = (UE_MAC_INST*)malloc16(NB_UE_INST*sizeof(UE_MAC_INST));
|
||||
if (UE_mac_inst == NULL) {
|
||||
LOG_C(MAC,"[MAIN] Can't ALLOCATE %d Bytes for %d UE_MAC_INST with size %d \n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,sizeof(UE_MAC_INST));
|
||||
mac_xface->macphy_exit("[MAC][MAIN] not enough memory for UEs \n");
|
||||
}
|
||||
LOG_D(MAC,"[MAIN] ALLOCATE %d Bytes for %d UE_MAC_INST @ %p\n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,UE_mac_inst);
|
||||
UE_mac_inst = (UE_MAC_INST*)malloc16(NB_UE_INST*sizeof(UE_MAC_INST));
|
||||
if (UE_mac_inst == NULL) {
|
||||
LOG_C(MAC,"[MAIN] Can't ALLOCATE %d Bytes for %d UE_MAC_INST with size %d \n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,sizeof(UE_MAC_INST));
|
||||
mac_xface->macphy_exit("[MAC][MAIN] not enough memory for UEs \n");
|
||||
}
|
||||
LOG_D(MAC,"[MAIN] ALLOCATE %d Bytes for %d UE_MAC_INST @ %p\n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,UE_mac_inst);
|
||||
|
||||
bzero(UE_mac_inst,NB_UE_INST*sizeof(UE_MAC_INST));
|
||||
for(i=0;i<NB_UE_INST; i++)
|
||||
ue_init_mac(i);
|
||||
|
||||
bzero(UE_mac_inst,NB_UE_INST*sizeof(UE_MAC_INST));
|
||||
for(i=0;i<NB_UE_INST; i++)
|
||||
ue_init_mac(i);
|
||||
|
||||
}
|
||||
else
|
||||
UE_mac_inst = NULL;
|
||||
|
||||
|
||||
LOG_I(MAC,"[MAIN] Init function start:Nb_eNB_INST=%d\n",NB_eNB_INST);
|
||||
if (NB_eNB_INST>0) {
|
||||
eNB_mac_inst = (eNB_MAC_INST*)malloc16(NB_eNB_INST*sizeof(eNB_MAC_INST));
|
||||
if (eNB_mac_inst == NULL){
|
||||
LOG_D(MAC,"[MAIN] can't ALLOCATE %d Bytes for %d eNB_MAC_INST with size %d \n",NB_eNB_INST*sizeof(eNB_MAC_INST),NB_eNB_INST,sizeof(eNB_MAC_INST));
|
||||
mac_xface->macphy_exit("[MAC][MAIN] not enough memory for eNB \n");
|
||||
}
|
||||
LOG_D(MAC,"[MAIN] ALLOCATE %d Bytes for %d eNB_MAC_INST @ %p\n",NB_eNB_INST*sizeof(eNB_MAC_INST),NB_eNB_INST,eNB_mac_inst);
|
||||
bzero(eNB_mac_inst,NB_eNB_INST*sizeof(eNB_MAC_INST));
|
||||
eNB_mac_inst = (eNB_MAC_INST*)malloc16(NB_eNB_INST*sizeof(eNB_MAC_INST));
|
||||
if (eNB_mac_inst == NULL){
|
||||
LOG_D(MAC,"[MAIN] can't ALLOCATE %d Bytes for %d eNB_MAC_INST with size %d \n",NB_eNB_INST*sizeof(eNB_MAC_INST),NB_eNB_INST,sizeof(eNB_MAC_INST));
|
||||
mac_xface->macphy_exit("[MAC][MAIN] not enough memory for eNB \n");
|
||||
}
|
||||
LOG_D(MAC,"[MAIN] ALLOCATE %d Bytes for %d eNB_MAC_INST @ %p\n",NB_eNB_INST*sizeof(eNB_MAC_INST),NB_eNB_INST,eNB_mac_inst);
|
||||
bzero(eNB_mac_inst,NB_eNB_INST*sizeof(eNB_MAC_INST));
|
||||
}
|
||||
else
|
||||
eNB_mac_inst = NULL;
|
||||
|
||||
|
||||
for(Mod_id=0;Mod_id<NB_eNB_INST;Mod_id++){
|
||||
|
||||
#ifdef PHY_EMUL
|
||||
Mac_rlc_xface->Is_cluster_head[Mod_id]=2;//0: MR, 1: CH, 2: not CH neither MR
|
||||
Mac_rlc_xface->Is_cluster_head[Mod_id]=2;//0: MR, 1: CH, 2: not CH neither MR
|
||||
#endif
|
||||
/*#ifdef Rel10
|
||||
/*#ifdef Rel10
|
||||
int n;
|
||||
for (n=0;n<4096;n++)
|
||||
eNB_mac_inst[Mod_id].MCH_pdu.payload[n] = taus();
|
||||
@@ -176,18 +172,18 @@ int mac_top_init(int eMBMS_active, u8 cba_group_active, u8 HO_active){
|
||||
|
||||
|
||||
if (Is_rrc_registered == 1){
|
||||
LOG_I(MAC,"[MAIN] calling RRC\n");
|
||||
LOG_I(MAC,"[MAIN] calling RRC\n");
|
||||
#ifndef CELLULAR //nothing to be done yet for cellular
|
||||
openair_rrc_top_init(eMBMS_active, cba_group_active,HO_active);
|
||||
openair_rrc_top_init(eMBMS_active, cba_group_active,HO_active);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
else {
|
||||
LOG_I(MAC,"[MAIN] Running without an RRC\n");
|
||||
}
|
||||
}
|
||||
#ifndef USER_MODE
|
||||
#ifndef PHY_EMUL
|
||||
LOG_I(MAC,"[MAIN] add openair2 proc\n");
|
||||
//// add_openair2_stats();
|
||||
//// add_openair2_stats();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -196,102 +192,102 @@ int mac_top_init(int eMBMS_active, u8 cba_group_active, u8 HO_active){
|
||||
// Set up DCIs for TDD 5MHz Config 1..6
|
||||
|
||||
for (i=0;i<NB_eNB_INST;i++) {
|
||||
LOG_D(MAC,"[MAIN][eNB %d] initializing RA_template\n",i);
|
||||
LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_eNB][MOD %02d][]\n", i);
|
||||
LOG_D(MAC,"[MAIN][eNB %d] initializing RA_template\n",i);
|
||||
LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_eNB][MOD %02d][]\n", i);
|
||||
|
||||
RA_template = (RA_TEMPLATE *)&eNB_mac_inst[i].RA_template[0];
|
||||
for (j=0;j<NB_RA_PROC_MAX;j++) {
|
||||
if (mac_xface->lte_frame_parms->frame_type == TDD) {
|
||||
switch (mac_xface->lte_frame_parms->N_RB_DL) {
|
||||
case 6:
|
||||
size_bytes1 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
|
||||
size_bytes2 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
|
||||
size_bits1 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
|
||||
size_bits2 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
|
||||
break;
|
||||
case 25:
|
||||
size_bytes1 = sizeof(DCI1A_5MHz_TDD_1_6_t);
|
||||
size_bytes2 = sizeof(DCI1A_5MHz_TDD_1_6_t);
|
||||
size_bits1 = sizeof_DCI1A_5MHz_TDD_1_6_t;
|
||||
size_bits2 = sizeof_DCI1A_5MHz_TDD_1_6_t;
|
||||
break;
|
||||
case 50:
|
||||
size_bytes1 = sizeof(DCI1A_10MHz_TDD_1_6_t);
|
||||
size_bytes2 = sizeof(DCI1A_10MHz_TDD_1_6_t);
|
||||
size_bits1 = sizeof_DCI1A_10MHz_TDD_1_6_t;
|
||||
size_bits2 = sizeof_DCI1A_10MHz_TDD_1_6_t;
|
||||
break;
|
||||
case 100:
|
||||
size_bytes1 = sizeof(DCI1A_20MHz_TDD_1_6_t);
|
||||
size_bytes2 = sizeof(DCI1A_20MHz_TDD_1_6_t);
|
||||
size_bits1 = sizeof_DCI1A_20MHz_TDD_1_6_t;
|
||||
size_bits2 = sizeof_DCI1A_20MHz_TDD_1_6_t;
|
||||
break;
|
||||
default:
|
||||
size_bytes1 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
|
||||
size_bytes2 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
|
||||
size_bits1 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
|
||||
size_bits2 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
|
||||
break;
|
||||
}
|
||||
RA_template = (RA_TEMPLATE *)&eNB_mac_inst[i].RA_template[0];
|
||||
for (j=0;j<NB_RA_PROC_MAX;j++) {
|
||||
if (mac_xface->lte_frame_parms->frame_type == TDD) {
|
||||
switch (mac_xface->lte_frame_parms->N_RB_DL) {
|
||||
case 6:
|
||||
size_bytes1 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
|
||||
size_bytes2 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
|
||||
size_bits1 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
|
||||
size_bits2 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
|
||||
break;
|
||||
case 25:
|
||||
size_bytes1 = sizeof(DCI1A_5MHz_TDD_1_6_t);
|
||||
size_bytes2 = sizeof(DCI1A_5MHz_TDD_1_6_t);
|
||||
size_bits1 = sizeof_DCI1A_5MHz_TDD_1_6_t;
|
||||
size_bits2 = sizeof_DCI1A_5MHz_TDD_1_6_t;
|
||||
break;
|
||||
case 50:
|
||||
size_bytes1 = sizeof(DCI1A_10MHz_TDD_1_6_t);
|
||||
size_bytes2 = sizeof(DCI1A_10MHz_TDD_1_6_t);
|
||||
size_bits1 = sizeof_DCI1A_10MHz_TDD_1_6_t;
|
||||
size_bits2 = sizeof_DCI1A_10MHz_TDD_1_6_t;
|
||||
break;
|
||||
case 100:
|
||||
size_bytes1 = sizeof(DCI1A_20MHz_TDD_1_6_t);
|
||||
size_bytes2 = sizeof(DCI1A_20MHz_TDD_1_6_t);
|
||||
size_bits1 = sizeof_DCI1A_20MHz_TDD_1_6_t;
|
||||
size_bits2 = sizeof_DCI1A_20MHz_TDD_1_6_t;
|
||||
break;
|
||||
default:
|
||||
size_bytes1 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
|
||||
size_bytes2 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
|
||||
size_bits1 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
|
||||
size_bits2 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
switch (mac_xface->lte_frame_parms->N_RB_DL) {
|
||||
case 6:
|
||||
size_bytes1 = sizeof(DCI1A_1_5MHz_FDD_t);
|
||||
size_bytes2 = sizeof(DCI1A_1_5MHz_FDD_t);
|
||||
size_bits1 = sizeof_DCI1A_1_5MHz_FDD_t;
|
||||
size_bits2 = sizeof_DCI1A_1_5MHz_FDD_t;
|
||||
break;
|
||||
case 25:
|
||||
size_bytes1 = sizeof(DCI1A_5MHz_FDD_t);
|
||||
size_bytes2 = sizeof(DCI1A_5MHz_FDD_t);
|
||||
size_bits1 = sizeof_DCI1A_5MHz_FDD_t;
|
||||
size_bits2 = sizeof_DCI1A_5MHz_FDD_t;
|
||||
break;
|
||||
case 50:
|
||||
size_bytes1 = sizeof(DCI1A_10MHz_FDD_t);
|
||||
size_bytes2 = sizeof(DCI1A_10MHz_FDD_t);
|
||||
size_bits1 = sizeof_DCI1A_10MHz_FDD_t;
|
||||
size_bits2 = sizeof_DCI1A_10MHz_FDD_t;
|
||||
break;
|
||||
case 100:
|
||||
size_bytes1 = sizeof(DCI1A_20MHz_FDD_t);
|
||||
size_bytes2 = sizeof(DCI1A_20MHz_FDD_t);
|
||||
size_bits1 = sizeof_DCI1A_20MHz_FDD_t;
|
||||
size_bits2 = sizeof_DCI1A_20MHz_FDD_t;
|
||||
break;
|
||||
default:
|
||||
size_bytes1 = sizeof(DCI1A_1_5MHz_FDD_t);
|
||||
size_bytes2 = sizeof(DCI1A_1_5MHz_FDD_t);
|
||||
size_bits1 = sizeof_DCI1A_1_5MHz_FDD_t;
|
||||
size_bits2 = sizeof_DCI1A_1_5MHz_FDD_t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
memcpy((void *)&RA_template[j].RA_alloc_pdu1[0],(void *)&RA_alloc_pdu,size_bytes1);
|
||||
memcpy((void *)&RA_template[j].RA_alloc_pdu2[0],(void *)&DLSCH_alloc_pdu1A,size_bytes2);
|
||||
RA_template[j].RA_dci_size_bytes1 = size_bytes1;
|
||||
RA_template[j].RA_dci_size_bytes2 = size_bytes2;
|
||||
RA_template[j].RA_dci_size_bits1 = size_bits1;
|
||||
RA_template[j].RA_dci_size_bits2 = size_bits2;
|
||||
|
||||
RA_template[j].RA_dci_fmt1 = format1A;
|
||||
RA_template[j].RA_dci_fmt2 = format1A;
|
||||
}
|
||||
else {
|
||||
switch (mac_xface->lte_frame_parms->N_RB_DL) {
|
||||
case 6:
|
||||
size_bytes1 = sizeof(DCI1A_1_5MHz_FDD_t);
|
||||
size_bytes2 = sizeof(DCI1A_1_5MHz_FDD_t);
|
||||
size_bits1 = sizeof_DCI1A_1_5MHz_FDD_t;
|
||||
size_bits2 = sizeof_DCI1A_1_5MHz_FDD_t;
|
||||
break;
|
||||
case 25:
|
||||
size_bytes1 = sizeof(DCI1A_5MHz_FDD_t);
|
||||
size_bytes2 = sizeof(DCI1A_5MHz_FDD_t);
|
||||
size_bits1 = sizeof_DCI1A_5MHz_FDD_t;
|
||||
size_bits2 = sizeof_DCI1A_5MHz_FDD_t;
|
||||
break;
|
||||
case 50:
|
||||
size_bytes1 = sizeof(DCI1A_10MHz_FDD_t);
|
||||
size_bytes2 = sizeof(DCI1A_10MHz_FDD_t);
|
||||
size_bits1 = sizeof_DCI1A_10MHz_FDD_t;
|
||||
size_bits2 = sizeof_DCI1A_10MHz_FDD_t;
|
||||
break;
|
||||
case 100:
|
||||
size_bytes1 = sizeof(DCI1A_20MHz_FDD_t);
|
||||
size_bytes2 = sizeof(DCI1A_20MHz_FDD_t);
|
||||
size_bits1 = sizeof_DCI1A_20MHz_FDD_t;
|
||||
size_bits2 = sizeof_DCI1A_20MHz_FDD_t;
|
||||
break;
|
||||
default:
|
||||
size_bytes1 = sizeof(DCI1A_1_5MHz_FDD_t);
|
||||
size_bytes2 = sizeof(DCI1A_1_5MHz_FDD_t);
|
||||
size_bits1 = sizeof_DCI1A_1_5MHz_FDD_t;
|
||||
size_bits2 = sizeof_DCI1A_1_5MHz_FDD_t;
|
||||
break;
|
||||
}
|
||||
|
||||
memset (&eNB_mac_inst[i].eNB_stats,0,sizeof(eNB_STATS));
|
||||
UE_template = (UE_TEMPLATE *)&eNB_mac_inst[i].UE_template[0];
|
||||
for (j=0;j<NUMBER_OF_UE_MAX;j++) {
|
||||
UE_template[j].rnti=0;
|
||||
// initiallize the eNB to UE statistics
|
||||
memset (&eNB_mac_inst[i].eNB_UE_stats[j],0,sizeof(eNB_UE_STATS));
|
||||
}
|
||||
memcpy((void *)&RA_template[j].RA_alloc_pdu1[0],(void *)&RA_alloc_pdu,size_bytes1);
|
||||
memcpy((void *)&RA_template[j].RA_alloc_pdu2[0],(void *)&DLSCH_alloc_pdu1A,size_bytes2);
|
||||
RA_template[j].RA_dci_size_bytes1 = size_bytes1;
|
||||
RA_template[j].RA_dci_size_bytes2 = size_bytes2;
|
||||
RA_template[j].RA_dci_size_bits1 = size_bits1;
|
||||
RA_template[j].RA_dci_size_bits2 = size_bits2;
|
||||
|
||||
RA_template[j].RA_dci_fmt1 = format1A;
|
||||
RA_template[j].RA_dci_fmt2 = format1A;
|
||||
}
|
||||
|
||||
memset (&eNB_mac_inst[i].eNB_stats,0,sizeof(eNB_STATS));
|
||||
UE_template = (UE_TEMPLATE *)&eNB_mac_inst[i].UE_template[0];
|
||||
for (j=0;j<NUMBER_OF_UE_MAX;j++) {
|
||||
UE_template[j].rnti=0;
|
||||
// initiallize the eNB to UE statistics
|
||||
memset (&eNB_mac_inst[i].eNB_UE_stats[j],0,sizeof(eNB_UE_STATS));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//ICIC init param
|
||||
//ICIC init param
|
||||
#ifdef ICIC
|
||||
u8 SB_size;
|
||||
SB_size=mac_xface->get_SB_size(mac_xface->lte_frame_parms->N_RB_DL);
|
||||
@@ -299,20 +295,20 @@ int mac_top_init(int eMBMS_active, u8 cba_group_active, u8 HO_active){
|
||||
srand (time(NULL));
|
||||
|
||||
for(j=0;j<NB_eNB_INST;j++){
|
||||
eNB_mac_inst[j].sbmap_conf.first_subframe=0;
|
||||
eNB_mac_inst[j].sbmap_conf.periodicity=10;
|
||||
eNB_mac_inst[j].sbmap_conf.sb_size=SB_size;
|
||||
eNB_mac_inst[j].sbmap_conf.nb_active_sb=1;
|
||||
for(i=0;i<NUMBER_OF_SUBBANDS;i++)
|
||||
eNB_mac_inst[j].sbmap_conf.sbmap[i]=1;
|
||||
eNB_mac_inst[j].sbmap_conf.first_subframe=0;
|
||||
eNB_mac_inst[j].sbmap_conf.periodicity=10;
|
||||
eNB_mac_inst[j].sbmap_conf.sb_size=SB_size;
|
||||
eNB_mac_inst[j].sbmap_conf.nb_active_sb=1;
|
||||
for(i=0;i<NUMBER_OF_SUBBANDS;i++)
|
||||
eNB_mac_inst[j].sbmap_conf.sbmap[i]=1;
|
||||
|
||||
eNB_mac_inst[j].sbmap_conf.sbmap[rand()%NUMBER_OF_SUBBANDS]=0;
|
||||
eNB_mac_inst[j].sbmap_conf.sbmap[rand()%NUMBER_OF_SUBBANDS]=0;
|
||||
|
||||
}
|
||||
#endif
|
||||
//end ALU's algo
|
||||
//end ALU's algo
|
||||
|
||||
LOG_I(MAC,"[MAIN][INIT] Init function finished\n");
|
||||
LOG_I(MAC,"[MAIN][INIT] Init function finished\n");
|
||||
|
||||
return(0);
|
||||
|
||||
@@ -336,8 +332,8 @@ int mac_init_global_param(void){
|
||||
bzero(Mac_rlc_xface,sizeof(MAC_RLC_XFACE));
|
||||
|
||||
if(Mac_rlc_xface == NULL){
|
||||
LOG_E(MAC,"[MAIN] FATAL EROOR: Could not allocate memory for Mac_rlc_xface !!!\n");
|
||||
return (-1);
|
||||
LOG_E(MAC,"[MAIN] FATAL EROOR: Could not allocate memory for Mac_rlc_xface !!!\n");
|
||||
return (-1);
|
||||
|
||||
}
|
||||
|
||||
@@ -384,7 +380,7 @@ int mac_init_global_param(void){
|
||||
|
||||
/***********************************************************************/
|
||||
void mac_top_cleanup(void){
|
||||
/***********************************************************************/
|
||||
/***********************************************************************/
|
||||
#ifndef USER_MODE
|
||||
pdcp_module_cleanup ();
|
||||
#endif
|
||||
@@ -499,7 +495,7 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_activ
|
||||
//Mac_rlc_xface->Is_cluster_head[0] = 1;
|
||||
//Mac_rlc_xface->Is_cluster_head[1] = 0;
|
||||
|
||||
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
+514
-500
File diff suppressed because it is too large
Load Diff
+271
-271
@@ -25,18 +25,18 @@
|
||||
Forums : http://forums.eurecom.fsr/openairinterface
|
||||
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
|
||||
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
|
||||
/*! \file openair2/LAYER2/MAC/ra_procedures.c
|
||||
* \brief Routines for UE MAC-layer Random-access procedures (36.321) V8.6 2009-03
|
||||
* \author R. Knopp
|
||||
* \date 2011
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
* \brief Routines for UE MAC-layer Random-access procedures (36.321) V8.6 2009-03
|
||||
* \author R. Knopp
|
||||
* \date 2011
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: knopp@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "extern.h"
|
||||
#include "defs.h"
|
||||
@@ -55,25 +55,25 @@
|
||||
|
||||
extern inline unsigned int taus(void);
|
||||
|
||||
s8 get_DELTA_PREAMBLE(u8 Mod_id) {
|
||||
s8 get_DELTA_PREAMBLE(module_id_t module_idP) {
|
||||
|
||||
u8 prachConfigIndex = UE_mac_inst[Mod_id].radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex;
|
||||
u8 prachConfigIndex = UE_mac_inst[module_idP].radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex;
|
||||
u8 preambleformat;
|
||||
|
||||
if (UE_mac_inst[Mod_id].tdd_Config) { // TDD
|
||||
if (prachConfigIndex < 20)
|
||||
preambleformat = 0;
|
||||
else if (prachConfigIndex < 30)
|
||||
preambleformat = 1;
|
||||
else if (prachConfigIndex < 40)
|
||||
preambleformat = 2;
|
||||
else if (prachConfigIndex < 48)
|
||||
preambleformat = 3;
|
||||
else
|
||||
preambleformat = 4;
|
||||
if (UE_mac_inst[module_idP].tdd_Config) { // TDD
|
||||
if (prachConfigIndex < 20)
|
||||
preambleformat = 0;
|
||||
else if (prachConfigIndex < 30)
|
||||
preambleformat = 1;
|
||||
else if (prachConfigIndex < 40)
|
||||
preambleformat = 2;
|
||||
else if (prachConfigIndex < 48)
|
||||
preambleformat = 3;
|
||||
else
|
||||
preambleformat = 4;
|
||||
}
|
||||
else { // FDD
|
||||
preambleformat = prachConfigIndex>>2;
|
||||
preambleformat = prachConfigIndex>>2;
|
||||
}
|
||||
switch (preambleformat) {
|
||||
case 0:
|
||||
@@ -86,8 +86,8 @@ s8 get_DELTA_PREAMBLE(u8 Mod_id) {
|
||||
return(8);
|
||||
default:
|
||||
LOG_E(MAC,"[UE %d] ue_procedures.c: FATAL, Illegal preambleformat %d, prachConfigIndex %d\n",
|
||||
Mod_id,
|
||||
preambleformat,prachConfigIndex);
|
||||
module_idP,
|
||||
preambleformat,prachConfigIndex);
|
||||
mac_xface->macphy_exit("");
|
||||
return(0);
|
||||
}
|
||||
@@ -95,309 +95,309 @@ s8 get_DELTA_PREAMBLE(u8 Mod_id) {
|
||||
}
|
||||
|
||||
/// This routine implements Section 5.1.2 (Random Access Resource Selection) from 36.321
|
||||
void get_prach_resources(u8 Mod_id,
|
||||
u8 eNB_index,
|
||||
u8 t_id,
|
||||
u8 first_Msg3,
|
||||
RACH_ConfigDedicated_t *rach_ConfigDedicated) {
|
||||
void get_prach_resources(module_id_t module_idP,
|
||||
u8 eNB_index,
|
||||
u8 t_id,
|
||||
u8 first_Msg3,
|
||||
RACH_ConfigDedicated_t *rach_ConfigDedicated) {
|
||||
|
||||
u8 Msg3_size = UE_mac_inst[Mod_id].RA_Msg3_size;
|
||||
PRACH_RESOURCES_t *prach_resources = &UE_mac_inst[Mod_id].RA_prach_resources;
|
||||
u8 Msg3_size = UE_mac_inst[module_idP].RA_Msg3_size;
|
||||
PRACH_RESOURCES_t *prach_resources = &UE_mac_inst[module_idP].RA_prach_resources;
|
||||
RACH_ConfigCommon_t *rach_ConfigCommon = NULL;
|
||||
u8 noGroupB = 0;
|
||||
u8 f_id = 0,num_prach=0;
|
||||
|
||||
if (UE_mac_inst[Mod_id].radioResourceConfigCommon)
|
||||
rach_ConfigCommon = &UE_mac_inst[Mod_id].radioResourceConfigCommon->rach_ConfigCommon;
|
||||
if (UE_mac_inst[module_idP].radioResourceConfigCommon)
|
||||
rach_ConfigCommon = &UE_mac_inst[module_idP].radioResourceConfigCommon->rach_ConfigCommon;
|
||||
else {
|
||||
LOG_E(MAC,"[UE %d] FATAL radioResourceConfigCommon is NULL !!!\n",Mod_id);
|
||||
mac_xface->macphy_exit("");
|
||||
LOG_E(MAC,"[UE %d] FATAL radioResourceConfigCommon is NULL !!!\n",module_idP);
|
||||
mac_xface->macphy_exit("");
|
||||
}
|
||||
|
||||
if (rach_ConfigDedicated) { // This is for network controlled Mobility, later
|
||||
if (rach_ConfigDedicated->ra_PRACH_MaskIndex != 0) {
|
||||
prach_resources->ra_PreambleIndex = rach_ConfigDedicated->ra_PreambleIndex;
|
||||
prach_resources->ra_RACH_MaskIndex = rach_ConfigDedicated->ra_PRACH_MaskIndex;
|
||||
return;
|
||||
}
|
||||
if (rach_ConfigDedicated->ra_PRACH_MaskIndex != 0) {
|
||||
prach_resources->ra_PreambleIndex = rach_ConfigDedicated->ra_PreambleIndex;
|
||||
prach_resources->ra_RACH_MaskIndex = rach_ConfigDedicated->ra_PRACH_MaskIndex;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!rach_ConfigCommon->preambleInfo.preamblesGroupAConfig) {
|
||||
noGroupB = 1;
|
||||
noGroupB = 1;
|
||||
|
||||
}
|
||||
else {
|
||||
if (rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA ==
|
||||
rach_ConfigCommon->preambleInfo.numberOfRA_Preambles)
|
||||
noGroupB = 1;
|
||||
if (rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA ==
|
||||
rach_ConfigCommon->preambleInfo.numberOfRA_Preambles)
|
||||
noGroupB = 1;
|
||||
}
|
||||
|
||||
if (first_Msg3 == 1) {
|
||||
if (noGroupB == 1) {
|
||||
// use Group A procedure
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_PreambleIndex = (taus())&0x3f;
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
UE_mac_inst[Mod_id].RA_usedGroupA = 1;
|
||||
}
|
||||
else if ((Msg3_size < rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->messageSizeGroupA) ||
|
||||
(mac_xface->get_PL(Mod_id,eNB_index) > UE_mac_inst[Mod_id].RA_maxPL)) {
|
||||
// use Group A procedure
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_PreambleIndex = (taus())%rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA;
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
UE_mac_inst[Mod_id].RA_usedGroupA = 1;
|
||||
}
|
||||
else { // use Group B
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_PreambleIndex =
|
||||
rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA +
|
||||
(taus())%(rach_ConfigCommon->preambleInfo.numberOfRA_Preambles -
|
||||
rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA);
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
UE_mac_inst[Mod_id].RA_usedGroupA = 0;
|
||||
}
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER = get_Po_NOMINAL_PUSCH(Mod_id);
|
||||
if (noGroupB == 1) {
|
||||
// use Group A procedure
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = (taus())&0x3f;
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
UE_mac_inst[module_idP].RA_usedGroupA = 1;
|
||||
}
|
||||
else if ((Msg3_size < rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->messageSizeGroupA) ||
|
||||
(mac_xface->get_PL(module_idP,eNB_index) > UE_mac_inst[module_idP].RA_maxPL)) {
|
||||
// use Group A procedure
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = (taus())%rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA;
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
UE_mac_inst[module_idP].RA_usedGroupA = 1;
|
||||
}
|
||||
else { // use Group B
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex =
|
||||
rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA +
|
||||
(taus())%(rach_ConfigCommon->preambleInfo.numberOfRA_Preambles -
|
||||
rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA);
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
UE_mac_inst[module_idP].RA_usedGroupA = 0;
|
||||
}
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER = get_Po_NOMINAL_PUSCH(module_idP);
|
||||
}
|
||||
else { // Msg3 is being retransmitted
|
||||
if (UE_mac_inst[Mod_id].RA_usedGroupA == 1) {
|
||||
if (rach_ConfigCommon->preambleInfo.preamblesGroupAConfig)
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_PreambleIndex = (taus())%rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA;
|
||||
else
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_PreambleIndex = (taus())&0x3f;
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
}
|
||||
else {
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_PreambleIndex =
|
||||
rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA +
|
||||
(taus())%(rach_ConfigCommon->preambleInfo.numberOfRA_Preambles -
|
||||
rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA);
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
}
|
||||
if (UE_mac_inst[module_idP].RA_usedGroupA == 1) {
|
||||
if (rach_ConfigCommon->preambleInfo.preamblesGroupAConfig)
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = (taus())%rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA;
|
||||
else
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = (taus())&0x3f;
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
}
|
||||
else {
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex =
|
||||
rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA +
|
||||
(taus())%(rach_ConfigCommon->preambleInfo.numberOfRA_Preambles -
|
||||
rach_ConfigCommon->preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA);
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
}
|
||||
}
|
||||
// choose random PRACH resource in TDD
|
||||
if (UE_mac_inst[Mod_id].tdd_Config) {
|
||||
num_prach = mac_xface->get_num_prach_tdd(mac_xface->lte_frame_parms);
|
||||
if ((num_prach>0) && (num_prach<6))
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_TDD_map_index = (taus()%num_prach);
|
||||
f_id = mac_xface->get_fid_prach_tdd(mac_xface->lte_frame_parms,
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_TDD_map_index);
|
||||
if (UE_mac_inst[module_idP].tdd_Config) {
|
||||
num_prach = mac_xface->get_num_prach_tdd(mac_xface->lte_frame_parms);
|
||||
if ((num_prach>0) && (num_prach<6))
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_TDD_map_index = (taus()%num_prach);
|
||||
f_id = mac_xface->get_fid_prach_tdd(mac_xface->lte_frame_parms,
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_TDD_map_index);
|
||||
}
|
||||
|
||||
// choose RA-RNTI
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_RNTI = 1 + t_id + 10*f_id;
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_RNTI = 1 + t_id + 10*f_id;
|
||||
}
|
||||
|
||||
void Msg1_tx(u8 Mod_id,u32 frame, u8 eNB_id) {
|
||||
void Msg1_tx(module_id_t module_idP,frame_t frameP, u8 eNB_id) {
|
||||
|
||||
// start contention resolution timer
|
||||
UE_mac_inst[Mod_id].RA_attempt_number++;
|
||||
UE_mac_inst[module_idP].RA_attempt_number++;
|
||||
#if defined(USER_MODE) && defined(OAI_EMU)
|
||||
if (oai_emulation.info.opt_enabled) {
|
||||
trace_pdu(0, NULL, 0, Mod_id, 3, UE_mac_inst[Mod_id].RA_prach_resources.ra_PreambleIndex,
|
||||
UE_mac_inst[Mod_id].subframe, 0, UE_mac_inst[Mod_id].RA_attempt_number);
|
||||
LOG_D(OPT,"[UE %d][RAPROC] TX MSG1 Frame %d trace pdu for rnti %x with size %d\n",
|
||||
Mod_id, frame, 1, UE_mac_inst[Mod_id].RA_Msg3_size);
|
||||
trace_pdu(0, NULL, 0, module_idP, 3, UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex,
|
||||
UE_mac_inst[module_idP].subframe, 0, UE_mac_inst[module_idP].RA_attempt_number);
|
||||
LOG_D(OPT,"[UE %d][RAPROC] TX MSG1 Frame %d trace pdu for rnti %x with size %d\n",
|
||||
module_idP, frameP, 1, UE_mac_inst[module_idP].RA_Msg3_size);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Msg3_tx(u8 Mod_id,u32 frame, u8 eNB_id) {
|
||||
void Msg3_tx(module_id_t module_idP,frame_t frameP, u8 eNB_id) {
|
||||
|
||||
// start contention resolution timer
|
||||
LOG_I(MAC,"[UE %d][RAPROC] Frame %d : Msg3_tx: Setting contention resolution timer\n",Mod_id,frame);
|
||||
UE_mac_inst[Mod_id].RA_contention_resolution_cnt = 0;
|
||||
UE_mac_inst[Mod_id].RA_contention_resolution_timer_active = 1;
|
||||
LOG_I(MAC,"[UE %d][RAPROC] Frame %d : Msg3_tx: Setting contention resolution timer\n",module_idP,frameP);
|
||||
UE_mac_inst[module_idP].RA_contention_resolution_cnt = 0;
|
||||
UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 1;
|
||||
|
||||
#if defined(USER_MODE) && defined(OAI_EMU)
|
||||
if (oai_emulation.info.opt_enabled) { // msg3
|
||||
trace_pdu(0, &UE_mac_inst[Mod_id].CCCH_pdu.payload[0], UE_mac_inst[Mod_id].RA_Msg3_size,
|
||||
Mod_id, 3, UE_mac_inst[Mod_id].crnti, UE_mac_inst[Mod_id].subframe, 0, 0);
|
||||
LOG_D(OPT,"[UE %d][RAPROC] MSG3 Frame %d trace pdu Preamble %d with size %d\n",
|
||||
Mod_id, frame, UE_mac_inst[Mod_id].crnti /*UE_mac_inst[Mod_id].RA_prach_resources.ra_PreambleIndex*/, UE_mac_inst[Mod_id].RA_Msg3_size);
|
||||
trace_pdu(0, &UE_mac_inst[module_idP].CCCH_pdu.payload[0], UE_mac_inst[module_idP].RA_Msg3_size,
|
||||
module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].subframe, 0, 0);
|
||||
LOG_D(OPT,"[UE %d][RAPROC] MSG3 Frame %d trace pdu Preamble %d with size %d\n",
|
||||
module_idP, frameP, UE_mac_inst[module_idP].crnti /*UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex*/, UE_mac_inst[module_idP].RA_Msg3_size);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
PRACH_RESOURCES_t *ue_get_rach(u8 Mod_id,u32 frame, u8 eNB_index,u8 subframe){
|
||||
PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_indexP,sub_frame_t subframeP){
|
||||
|
||||
|
||||
u8 Size=0;
|
||||
UE_MODE_t UE_mode = mac_xface->get_ue_mode(Mod_id,eNB_index);
|
||||
u8 lcid = CCCH;
|
||||
u16 Size16;
|
||||
u8 Size=0;
|
||||
UE_MODE_t UE_mode = mac_xface->get_ue_mode(module_idP,eNB_indexP);
|
||||
u8 lcid = CCCH;
|
||||
u16 Size16;
|
||||
struct RACH_ConfigCommon *rach_ConfigCommon = (struct RACH_ConfigCommon *)NULL;
|
||||
s32 frame_diff=0;
|
||||
mac_rlc_status_resp_t rlc_status;
|
||||
u8 dcch_header_len=0;
|
||||
u16 sdu_lengths[8];
|
||||
u8 ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES];
|
||||
s32 frame_diff=0;
|
||||
mac_rlc_status_resp_t rlc_status;
|
||||
u8 dcch_header_len=0;
|
||||
u16 sdu_lengths[8];
|
||||
u8 ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES];
|
||||
|
||||
if (UE_mode == PRACH) {
|
||||
if (UE_mac_inst[Mod_id].radioResourceConfigCommon)
|
||||
rach_ConfigCommon = &UE_mac_inst[Mod_id].radioResourceConfigCommon->rach_ConfigCommon;
|
||||
else {
|
||||
return(NULL);
|
||||
}
|
||||
if (Is_rrc_registered == 1) {
|
||||
|
||||
if (UE_mac_inst[Mod_id].RA_active == 0) {
|
||||
// check if RRC is ready to initiate the RA procedure
|
||||
Size = mac_rrc_data_req(Mod_id,
|
||||
frame,
|
||||
CCCH,1,
|
||||
&UE_mac_inst[Mod_id].CCCH_pdu.payload[sizeof(SCH_SUBHEADER_SHORT)+1],0,
|
||||
eNB_index,
|
||||
0);
|
||||
Size16 = (u16)Size;
|
||||
|
||||
// LOG_D(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",Mod_id,frame,Size);
|
||||
LOG_D(RRC, "[MSC_MSG][FRAME %05d][RRC_UE][MOD %02d][][--- MAC_DATA_REQ (RRCConnectionRequest eNB %d) --->][MAC_UE][MOD %02d][]\n",
|
||||
frame, Mod_id, eNB_index, Mod_id);
|
||||
LOG_D(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",Mod_id,frame,Size);
|
||||
|
||||
if (Size>0) {
|
||||
|
||||
UE_mac_inst[Mod_id].RA_active = 1;
|
||||
UE_mac_inst[Mod_id].RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
|
||||
UE_mac_inst[Mod_id].RA_Msg3_size = Size+sizeof(SCH_SUBHEADER_SHORT)+sizeof(SCH_SUBHEADER_SHORT);
|
||||
UE_mac_inst[Mod_id].RA_prachMaskIndex = 0;
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.Msg3 = UE_mac_inst[Mod_id].CCCH_pdu.payload;
|
||||
UE_mac_inst[Mod_id].RA_backoff_cnt = 0; // add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
|
||||
if (rach_ConfigCommon) {
|
||||
UE_mac_inst[Mod_id].RA_window_cnt = 2+ rach_ConfigCommon->ra_SupervisionInfo.ra_ResponseWindowSize;
|
||||
if (UE_mac_inst[Mod_id].RA_window_cnt == 9)
|
||||
UE_mac_inst[Mod_id].RA_window_cnt = 10; // Note: 9 subframe window doesn't exist, after 8 is 10!
|
||||
}
|
||||
else {
|
||||
LOG_D(MAC,"[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",Mod_id,frame);
|
||||
mac_xface->macphy_exit("");
|
||||
}
|
||||
UE_mac_inst[Mod_id].RA_tx_frame = frame;
|
||||
UE_mac_inst[Mod_id].RA_tx_subframe = subframe;
|
||||
UE_mac_inst[Mod_id].RA_backoff_frame = frame;
|
||||
UE_mac_inst[Mod_id].RA_backoff_subframe = subframe;
|
||||
// Fill in preamble and PRACH resource
|
||||
get_prach_resources(Mod_id,eNB_index,subframe,1,NULL);
|
||||
|
||||
generate_ulsch_header((u8*)&UE_mac_inst[Mod_id].CCCH_pdu.payload[0], // mac header
|
||||
1, // num sdus
|
||||
0, // short pading
|
||||
&Size16, // sdu length
|
||||
&lcid, // sdu lcid
|
||||
NULL, // power headroom
|
||||
NULL, // crnti
|
||||
NULL, // truncated bsr
|
||||
NULL, // short bsr
|
||||
NULL, // long_bsr
|
||||
1); //post_padding
|
||||
|
||||
return(&UE_mac_inst[Mod_id].RA_prach_resources);
|
||||
}
|
||||
else if (UE_mac_inst[Mod_id].scheduling_info.BSR_bytes[DCCH] > 0) {
|
||||
// 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
|
||||
rlc_status = mac_rlc_status_ind(Mod_id+NB_eNB_INST,frame,0,RLC_MBMS_NO,
|
||||
DCCH,
|
||||
6);
|
||||
if (UE_mac_inst[Mod_id].crnti_before_ho)
|
||||
LOG_D(MAC,"[UE %d] Frame %d : UL-DCCH -> ULSCH, HO RRCConnectionReconfigurationComplete (%x, %x), RRC message has %d bytes to send throug PRACH (mac header len %d)\n",
|
||||
Mod_id,frame, UE_mac_inst[Mod_id].crnti,UE_mac_inst[Mod_id].crnti_before_ho, rlc_status.bytes_in_buffer,dcch_header_len);
|
||||
else
|
||||
LOG_D(MAC,"[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to send through PRACH(mac header len %d)\n",
|
||||
Mod_id,frame, rlc_status.bytes_in_buffer,dcch_header_len);
|
||||
|
||||
sdu_lengths[0] = mac_rlc_data_req(Mod_id+NB_eNB_INST,frame,RLC_MBMS_NO,
|
||||
DCCH,
|
||||
(char *)&ulsch_buff[0]);
|
||||
|
||||
LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",Mod_id,sdu_lengths[0]);
|
||||
update_bsr(Mod_id, frame, DCCH,UE_mac_inst[Mod_id].scheduling_info.LCGID[DCCH]);
|
||||
//header_len +=2;
|
||||
UE_mac_inst[Mod_id].RA_active = 1;
|
||||
UE_mac_inst[Mod_id].RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
|
||||
UE_mac_inst[Mod_id].RA_Msg3_size = Size+dcch_header_len;
|
||||
UE_mac_inst[Mod_id].RA_prachMaskIndex = 0;
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.Msg3 = ulsch_buff;
|
||||
UE_mac_inst[Mod_id].RA_backoff_cnt = 0; // add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
|
||||
if (rach_ConfigCommon) {
|
||||
UE_mac_inst[Mod_id].RA_window_cnt = 2+ rach_ConfigCommon->ra_SupervisionInfo.ra_ResponseWindowSize;
|
||||
if (UE_mac_inst[Mod_id].RA_window_cnt == 9)
|
||||
UE_mac_inst[Mod_id].RA_window_cnt = 10; // Note: 9 subframe window doesn't exist, after 8 is 10!
|
||||
}
|
||||
else {
|
||||
LOG_D(MAC,"[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",Mod_id,frame);
|
||||
mac_xface->macphy_exit("");
|
||||
}
|
||||
UE_mac_inst[Mod_id].RA_tx_frame = frame;
|
||||
UE_mac_inst[Mod_id].RA_tx_subframe = subframe;
|
||||
UE_mac_inst[Mod_id].RA_backoff_frame = frame;
|
||||
UE_mac_inst[Mod_id].RA_backoff_subframe = subframe;
|
||||
// Fill in preamble and PRACH resource
|
||||
get_prach_resources(Mod_id,eNB_index,subframe,1,NULL);
|
||||
generate_ulsch_header((u8*)ulsch_buff, // mac header
|
||||
1, // num sdus
|
||||
0, // short pading
|
||||
&Size16, // sdu length
|
||||
&lcid, // sdu lcid
|
||||
NULL, // power headroom
|
||||
&UE_mac_inst[Mod_id].crnti, // crnti
|
||||
NULL, // truncated bsr
|
||||
NULL, // short bsr
|
||||
NULL, // long_bsr
|
||||
0); //post_padding
|
||||
|
||||
return(&UE_mac_inst[Mod_id].RA_prach_resources);
|
||||
}
|
||||
if (UE_mac_inst[module_idP].radioResourceConfigCommon)
|
||||
rach_ConfigCommon = &UE_mac_inst[module_idP].radioResourceConfigCommon->rach_ConfigCommon;
|
||||
else {
|
||||
return(NULL);
|
||||
}
|
||||
else { // RACH is active
|
||||
LOG_D(MAC,"[MAC][UE %d][RAPROC] frame %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n",Mod_id,
|
||||
frame,subframe,UE_mac_inst[Mod_id].RA_window_cnt,
|
||||
UE_mac_inst[Mod_id].RA_tx_frame,UE_mac_inst[Mod_id].RA_tx_subframe);
|
||||
// compute backoff parameters
|
||||
if (UE_mac_inst[Mod_id].RA_backoff_cnt>0) {
|
||||
frame_diff = (s32)frame - UE_mac_inst[Mod_id].RA_backoff_frame;
|
||||
if (frame_diff < 0)
|
||||
frame_diff = -frame_diff;
|
||||
UE_mac_inst[Mod_id].RA_backoff_cnt -= ((10*frame_diff) + (subframe-UE_mac_inst[Mod_id].RA_backoff_subframe));
|
||||
if (Is_rrc_registered == 1) {
|
||||
|
||||
UE_mac_inst[Mod_id].RA_backoff_frame = frame;
|
||||
UE_mac_inst[Mod_id].RA_backoff_subframe = subframe;
|
||||
}
|
||||
// compute RA window parameters
|
||||
if (UE_mac_inst[Mod_id].RA_window_cnt>0) {
|
||||
frame_diff = (s32)frame - UE_mac_inst[Mod_id].RA_tx_frame;
|
||||
if (frame_diff < 0)
|
||||
frame_diff = -frame_diff;
|
||||
UE_mac_inst[Mod_id].RA_window_cnt -= ((10*frame_diff) + (subframe-UE_mac_inst[Mod_id].RA_tx_subframe));
|
||||
LOG_D(MAC,"[MAC][UE %d][RAPROC] frame %d, subframe %d: RA Active, adjusted window cnt %d\n",Mod_id,
|
||||
frame,subframe,UE_mac_inst[Mod_id].RA_window_cnt);
|
||||
}
|
||||
if ((UE_mac_inst[Mod_id].RA_window_cnt<=0) &&
|
||||
(UE_mac_inst[Mod_id].RA_backoff_cnt<=0)) {
|
||||
if (UE_mac_inst[module_idP].RA_active == 0) {
|
||||
// check if RRC is ready to initiate the RA procedure
|
||||
Size = mac_rrc_data_req(module_idP,
|
||||
frameP,
|
||||
CCCH,1,
|
||||
&UE_mac_inst[module_idP].CCCH_pdu.payload[sizeof(SCH_SUBHEADER_SHORT)+1],0,
|
||||
eNB_indexP,
|
||||
0);
|
||||
Size16 = (u16)Size;
|
||||
|
||||
UE_mac_inst[Mod_id].RA_tx_frame = frame;
|
||||
UE_mac_inst[Mod_id].RA_tx_subframe = subframe;
|
||||
UE_mac_inst[Mod_id].RA_PREAMBLE_TRANSMISSION_COUNTER++;
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER += (rach_ConfigCommon->powerRampingParameters.powerRampingStep<<1); // 2dB increments in ASN.1 definition
|
||||
if (UE_mac_inst[Mod_id].RA_PREAMBLE_TRANSMISSION_COUNTER == rach_ConfigCommon->ra_SupervisionInfo.preambleTransMax) {
|
||||
LOG_D(MAC,"[UE %d] Frame %d: Maximum number of RACH attempts (%d)\n",Mod_id,frame,rach_ConfigCommon->ra_SupervisionInfo.preambleTransMax);
|
||||
// send message to RRC
|
||||
UE_mac_inst[Mod_id].RA_PREAMBLE_TRANSMISSION_COUNTER=1;
|
||||
UE_mac_inst[Mod_id].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER = get_Po_NOMINAL_PUSCH(Mod_id);
|
||||
}
|
||||
UE_mac_inst[Mod_id].RA_window_cnt = 2+ rach_ConfigCommon->ra_SupervisionInfo.ra_ResponseWindowSize;
|
||||
UE_mac_inst[Mod_id].RA_backoff_cnt = 0;
|
||||
// LOG_D(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",module_idP,frameP,Size);
|
||||
LOG_D(RRC, "[MSC_MSG][FRAME %05d][RRC_UE][MOD %02d][][--- MAC_DATA_REQ (RRCConnectionRequest eNB %d) --->][MAC_UE][MOD %02d][]\n",
|
||||
frameP, module_idP, eNB_indexP, module_idP);
|
||||
LOG_D(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",module_idP,frameP,Size);
|
||||
|
||||
// Fill in preamble and PRACH resource
|
||||
get_prach_resources(Mod_id,eNB_index,subframe,0,NULL);
|
||||
return(&UE_mac_inst[Mod_id].RA_prach_resources);
|
||||
}
|
||||
if (Size>0) {
|
||||
|
||||
UE_mac_inst[module_idP].RA_active = 1;
|
||||
UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
|
||||
UE_mac_inst[module_idP].RA_Msg3_size = Size+sizeof(SCH_SUBHEADER_SHORT)+sizeof(SCH_SUBHEADER_SHORT);
|
||||
UE_mac_inst[module_idP].RA_prachMaskIndex = 0;
|
||||
UE_mac_inst[module_idP].RA_prach_resources.Msg3 = UE_mac_inst[module_idP].CCCH_pdu.payload;
|
||||
UE_mac_inst[module_idP].RA_backoff_cnt = 0; // add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
|
||||
if (rach_ConfigCommon) {
|
||||
UE_mac_inst[module_idP].RA_window_cnt = 2+ rach_ConfigCommon->ra_SupervisionInfo.ra_ResponseWindowSize;
|
||||
if (UE_mac_inst[module_idP].RA_window_cnt == 9)
|
||||
UE_mac_inst[module_idP].RA_window_cnt = 10; // Note: 9 subframe window doesn't exist, after 8 is 10!
|
||||
}
|
||||
else {
|
||||
LOG_D(MAC,"[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",module_idP,frameP);
|
||||
mac_xface->macphy_exit("");
|
||||
}
|
||||
UE_mac_inst[module_idP].RA_tx_frame = frameP;
|
||||
UE_mac_inst[module_idP].RA_tx_subframe = subframeP;
|
||||
UE_mac_inst[module_idP].RA_backoff_frame = frameP;
|
||||
UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
|
||||
// Fill in preamble and PRACH resource
|
||||
get_prach_resources(module_idP,eNB_indexP,subframeP,1,NULL);
|
||||
|
||||
generate_ulsch_header((u8*)&UE_mac_inst[module_idP].CCCH_pdu.payload[0], // mac header
|
||||
1, // num sdus
|
||||
0, // short pading
|
||||
&Size16, // sdu length
|
||||
&lcid, // sdu lcid
|
||||
NULL, // power headroom
|
||||
NULL, // crnti
|
||||
NULL, // truncated bsr
|
||||
NULL, // short bsr
|
||||
NULL, // long_bsr
|
||||
1); //post_padding
|
||||
|
||||
return(&UE_mac_inst[module_idP].RA_prach_resources);
|
||||
}
|
||||
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)
|
||||
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,
|
||||
DCCH,
|
||||
6);
|
||||
if (UE_mac_inst[module_idP].crnti_before_ho)
|
||||
LOG_D(MAC,"[UE %d] Frame %d : UL-DCCH -> ULSCH, HO RRCConnectionReconfigurationComplete (%x, %x), RRC message has %d bytes to send throug PRACH (mac header len %d)\n",
|
||||
module_idP,frameP, UE_mac_inst[module_idP].crnti,UE_mac_inst[module_idP].crnti_before_ho, rlc_status.bytes_in_buffer,dcch_header_len);
|
||||
else
|
||||
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);
|
||||
|
||||
sdu_lengths[0] = mac_rlc_data_req(eNB_indexP, module_idP,frameP,0, RLC_MBMS_NO,
|
||||
DCCH,
|
||||
(char *)&ulsch_buff[0]);
|
||||
|
||||
LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",module_idP,sdu_lengths[0]);
|
||||
update_bsr(module_idP, frameP, DCCH,UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]);
|
||||
//header_len +=2;
|
||||
UE_mac_inst[module_idP].RA_active = 1;
|
||||
UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
|
||||
UE_mac_inst[module_idP].RA_Msg3_size = Size+dcch_header_len;
|
||||
UE_mac_inst[module_idP].RA_prachMaskIndex = 0;
|
||||
UE_mac_inst[module_idP].RA_prach_resources.Msg3 = ulsch_buff;
|
||||
UE_mac_inst[module_idP].RA_backoff_cnt = 0; // add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
|
||||
if (rach_ConfigCommon) {
|
||||
UE_mac_inst[module_idP].RA_window_cnt = 2+ rach_ConfigCommon->ra_SupervisionInfo.ra_ResponseWindowSize;
|
||||
if (UE_mac_inst[module_idP].RA_window_cnt == 9)
|
||||
UE_mac_inst[module_idP].RA_window_cnt = 10; // Note: 9 subframe window doesn't exist, after 8 is 10!
|
||||
}
|
||||
else {
|
||||
LOG_D(MAC,"[UE %d] FATAL Frame %d: rach_ConfigCommon is NULL !!!\n",module_idP,frameP);
|
||||
mac_xface->macphy_exit("");
|
||||
}
|
||||
UE_mac_inst[module_idP].RA_tx_frame = frameP;
|
||||
UE_mac_inst[module_idP].RA_tx_subframe = subframeP;
|
||||
UE_mac_inst[module_idP].RA_backoff_frame = frameP;
|
||||
UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
|
||||
// Fill in preamble and PRACH resource
|
||||
get_prach_resources(module_idP,eNB_indexP,subframeP,1,NULL);
|
||||
generate_ulsch_header((u8*)ulsch_buff, // mac header
|
||||
1, // num sdus
|
||||
0, // short pading
|
||||
&Size16, // sdu length
|
||||
&lcid, // sdu lcid
|
||||
NULL, // power headroom
|
||||
&UE_mac_inst[module_idP].crnti, // crnti
|
||||
NULL, // truncated bsr
|
||||
NULL, // short bsr
|
||||
NULL, // long_bsr
|
||||
0); //post_padding
|
||||
|
||||
return(&UE_mac_inst[module_idP].RA_prach_resources);
|
||||
}
|
||||
}
|
||||
else { // RACH is active
|
||||
LOG_D(MAC,"[MAC][UE %d][RAPROC] frameP %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n",module_idP,
|
||||
frameP,subframeP,UE_mac_inst[module_idP].RA_window_cnt,
|
||||
UE_mac_inst[module_idP].RA_tx_frame,UE_mac_inst[module_idP].RA_tx_subframe);
|
||||
// compute backoff parameters
|
||||
if (UE_mac_inst[module_idP].RA_backoff_cnt>0) {
|
||||
frame_diff = (s32)frameP - UE_mac_inst[module_idP].RA_backoff_frame;
|
||||
if (frame_diff < 0)
|
||||
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_frame = frameP;
|
||||
UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
|
||||
}
|
||||
// compute RA window parameters
|
||||
if (UE_mac_inst[module_idP].RA_window_cnt>0) {
|
||||
frame_diff = (frame_t)frameP - UE_mac_inst[module_idP].RA_tx_frame;
|
||||
if (frame_diff < 0)
|
||||
frame_diff = -frame_diff;
|
||||
UE_mac_inst[module_idP].RA_window_cnt -= ((10*frame_diff) + (subframeP-UE_mac_inst[module_idP].RA_tx_subframe));
|
||||
LOG_D(MAC,"[MAC][UE %d][RAPROC] frameP %d, subframe %d: RA Active, adjusted window cnt %d\n",module_idP,
|
||||
frameP,subframeP,UE_mac_inst[module_idP].RA_window_cnt);
|
||||
}
|
||||
if ((UE_mac_inst[module_idP].RA_window_cnt<=0) &&
|
||||
(UE_mac_inst[module_idP].RA_backoff_cnt<=0)) {
|
||||
|
||||
UE_mac_inst[module_idP].RA_tx_frame = frameP;
|
||||
UE_mac_inst[module_idP].RA_tx_subframe = subframeP;
|
||||
UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER++;
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER += (rach_ConfigCommon->powerRampingParameters.powerRampingStep<<1); // 2dB increments in ASN.1 definition
|
||||
if (UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER == rach_ConfigCommon->ra_SupervisionInfo.preambleTransMax) {
|
||||
LOG_D(MAC,"[UE %d] Frame %d: Maximum number of RACH attempts (%d)\n",module_idP,frameP,rach_ConfigCommon->ra_SupervisionInfo.preambleTransMax);
|
||||
// send message to RRC
|
||||
UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER=1;
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PREAMBLE_RECEIVED_TARGET_POWER = get_Po_NOMINAL_PUSCH(module_idP);
|
||||
}
|
||||
UE_mac_inst[module_idP].RA_window_cnt = 2+ rach_ConfigCommon->ra_SupervisionInfo.ra_ResponseWindowSize;
|
||||
UE_mac_inst[module_idP].RA_backoff_cnt = 0;
|
||||
|
||||
// Fill in preamble and PRACH resource
|
||||
get_prach_resources(module_idP,eNB_indexP,subframeP,0,NULL);
|
||||
return(&UE_mac_inst[module_idP].RA_prach_resources);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (UE_mode == PUSCH) {
|
||||
LOG_D(MAC,"[UE %d] FATAL: Should not have checked for RACH in PUSCH yet ...",Mod_id);
|
||||
mac_xface->macphy_exit("");
|
||||
LOG_D(MAC,"[UE %d] FATAL: Should not have checked for RACH in PUSCH yet ...",module_idP);
|
||||
mac_xface->macphy_exit("");
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@@ -25,15 +25,15 @@
|
||||
Forums : http://forums.eurecom.fsr/openairinterface
|
||||
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
|
||||
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
/*! \file rar_tools.c
|
||||
* \brief random access tools
|
||||
* \author Raymond Knopp
|
||||
* \date 2011
|
||||
* \version 0.5
|
||||
* @ingroup _mac
|
||||
* \brief random access tools
|
||||
* \author Raymond Knopp
|
||||
* \date 2011
|
||||
* \version 0.5
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "extern.h"
|
||||
@@ -54,11 +54,11 @@ extern unsigned short RIV2first_rb_LUT25[512];
|
||||
|
||||
extern inline unsigned int taus(void);
|
||||
|
||||
unsigned short fill_rar(u8 Mod_id,
|
||||
u32 frame,
|
||||
u8 *dlsch_buffer,
|
||||
u16 N_RB_UL,
|
||||
u8 input_buffer_length) {
|
||||
unsigned short fill_rar(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
u8 *dlsch_buffer,
|
||||
u16 N_RB_UL,
|
||||
u8 input_buffer_length) {
|
||||
|
||||
RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *)dlsch_buffer;
|
||||
// RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1);
|
||||
@@ -68,34 +68,34 @@ unsigned short fill_rar(u8 Mod_id,
|
||||
uint8_t mcs,TPC,ULdelay,cqireq;
|
||||
|
||||
for (i=0;i<NB_RA_PROC_MAX;i++) {
|
||||
if (eNB_mac_inst[Mod_id].RA_template[i].generate_rar == 1) {
|
||||
ra_idx=i;
|
||||
eNB_mac_inst[Mod_id].RA_template[i].generate_rar = 0;
|
||||
break;
|
||||
}
|
||||
if (eNB_mac_inst[module_idP].RA_template[i].generate_rar == 1) {
|
||||
ra_idx=i;
|
||||
eNB_mac_inst[module_idP].RA_template[i].generate_rar = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// subheader fixed
|
||||
rarh->E = 0; // First and last RAR
|
||||
rarh->T = 1; // 0 for E/T/R/R/BI subheader, 1 for E/T/RAPID subheader
|
||||
rarh->RAPID = eNB_mac_inst[Mod_id].RA_template[ra_idx].preamble_index; // Respond to Preamble 0 only for the moment
|
||||
rarh->RAPID = eNB_mac_inst[module_idP].RA_template[ra_idx].preamble_index; // Respond to Preamble 0 only for the moment
|
||||
/*
|
||||
rar->R = 0;
|
||||
rar->Timing_Advance_Command = eNB_mac_inst[Mod_id].RA_template[ra_idx].timing_offset/4;
|
||||
rar->Timing_Advance_Command = eNB_mac_inst[module_idP].RA_template[ra_idx].timing_offset/4;
|
||||
rar->hopping_flag = 0;
|
||||
rar->rb_alloc = mac_xface->computeRIV(N_RB_UL,12,2); // 2 RB
|
||||
rar->mcs = 2; // mcs 2
|
||||
rar->TPC = 4; // 2 dB power adjustment
|
||||
rar->UL_delay = 0;
|
||||
rar->cqi_req = 1;
|
||||
rar->t_crnti = eNB_mac_inst[Mod_id].RA_template[ra_idx].rnti;
|
||||
*/
|
||||
rar[4] = (uint8_t)(eNB_mac_inst[Mod_id].RA_template[ra_idx].rnti>>8);
|
||||
rar[5] = (uint8_t)(eNB_mac_inst[Mod_id].RA_template[ra_idx].rnti&0xff);
|
||||
eNB_mac_inst[Mod_id].RA_template[ra_idx].timing_offset = 0;
|
||||
//eNB_mac_inst[Mod_id].RA_template[ra_idx].timing_offset /= 16;
|
||||
rar[0] = (uint8_t)(eNB_mac_inst[Mod_id].RA_template[ra_idx].timing_offset>>(2+4)); // 7 MSBs of timing advance + divide by 4
|
||||
rar[1] = (uint8_t)(eNB_mac_inst[Mod_id].RA_template[ra_idx].timing_offset<<(4-2))&0xf0; // 4 LSBs of timing advance + divide by 4
|
||||
rar->t_crnti = eNB_mac_inst[module_idP].RA_template[ra_idx].rnti;
|
||||
*/
|
||||
rar[4] = (uint8_t)(eNB_mac_inst[module_idP].RA_template[ra_idx].rnti>>8);
|
||||
rar[5] = (uint8_t)(eNB_mac_inst[module_idP].RA_template[ra_idx].rnti&0xff);
|
||||
eNB_mac_inst[module_idP].RA_template[ra_idx].timing_offset = 0;
|
||||
//eNB_mac_inst[module_idP].RA_template[ra_idx].timing_offset /= 16;
|
||||
rar[0] = (uint8_t)(eNB_mac_inst[module_idP].RA_template[ra_idx].timing_offset>>(2+4)); // 7 MSBs of timing advance + divide by 4
|
||||
rar[1] = (uint8_t)(eNB_mac_inst[module_idP].RA_template[ra_idx].timing_offset<<(4-2))&0xf0; // 4 LSBs of timing advance + divide by 4
|
||||
rballoc = mac_xface->computeRIV(N_RB_UL,1,1); // first PRB only for UL Grant
|
||||
rar[1] |= (rballoc>>7)&7; // Hopping = 0 (bit 3), 3 MSBs of rballoc
|
||||
rar[2] = ((uint8_t)(rballoc&0xff))<<1; // 7 LSBs of rballoc
|
||||
@@ -106,59 +106,59 @@ unsigned short fill_rar(u8 Mod_id,
|
||||
rar[2] |= ((mcs&0x8)>>3); // mcs 10
|
||||
rar[3] = (((mcs&0x7)<<5)) | ((TPC&7)<<2) | ((ULdelay&1)<<1) | (cqireq&1);
|
||||
|
||||
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Generating RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for ra_idx %d, CRNTI %x,preamble %d/%d,TIMING OFFSET %d\n",Mod_id,frame,
|
||||
*(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
|
||||
ra_idx,
|
||||
eNB_mac_inst[Mod_id].RA_template[ra_idx].rnti,
|
||||
rarh->RAPID,eNB_mac_inst[Mod_id].RA_template[0].preamble_index,
|
||||
eNB_mac_inst[Mod_id].RA_template[ra_idx].timing_offset);
|
||||
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Generating RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for ra_idx %d, CRNTI %x,preamble %d/%d,TIMING OFFSET %d\n",module_idP,frame,
|
||||
*(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
|
||||
ra_idx,
|
||||
eNB_mac_inst[module_idP].RA_template[ra_idx].rnti,
|
||||
rarh->RAPID,eNB_mac_inst[module_idP].RA_template[0].preamble_index,
|
||||
eNB_mac_inst[module_idP].RA_template[ra_idx].timing_offset);
|
||||
|
||||
#if defined(USER_MODE) && defined(OAI_EMU)
|
||||
if (oai_emulation.info.opt_enabled){
|
||||
trace_pdu(1, dlsch_buffer, input_buffer_length, Mod_id, 2, 1,
|
||||
eNB_mac_inst[Mod_id].subframe, 0, 0);
|
||||
LOG_I(OPT,"[eNB %d][RAPROC] RAR Frame %d trace pdu for rnti %x and rapid %d size %d\n",
|
||||
Mod_id, frame, eNB_mac_inst[Mod_id].RA_template[ra_idx].rnti,
|
||||
trace_pdu(1, dlsch_buffer, input_buffer_length, module_idP, 2, 1,
|
||||
eNB_mac_inst[module_idP].subframe, 0, 0);
|
||||
LOG_I(OPT,"[eNB %d][RAPROC] RAR Frame %d trace pdu for rnti %x and rapid %d size %d\n",
|
||||
module_idP, frame, eNB_mac_inst[module_idP].RA_template[ra_idx].rnti,
|
||||
rarh->RAPID, input_buffer_length);
|
||||
}
|
||||
#endif
|
||||
return(eNB_mac_inst[Mod_id].RA_template[ra_idx].rnti);
|
||||
return(eNB_mac_inst[module_idP].RA_template[ra_idx].rnti);
|
||||
}
|
||||
|
||||
uint16_t ue_process_rar(u8 Mod_id, u32 frame, u8 *dlsch_buffer,u16 *t_crnti,u8 preamble_index) {
|
||||
uint16_t ue_process_rar(module_id_t module_idP, frame_t frameP, u8 *dlsch_buffer,rnti_t *t_crnti,u8 preamble_index) {
|
||||
|
||||
RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *)dlsch_buffer;
|
||||
// RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1);
|
||||
uint8_t *rar = (uint8_t *)(dlsch_buffer+1);
|
||||
|
||||
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",Mod_id,frame,
|
||||
*(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
|
||||
rarh->RAPID,preamble_index);
|
||||
#ifdef DEBUG_RAR
|
||||
LOG_D(MAC,"[UE %d][RAPROC] rarh->E %d\n",Mod_id,rarh->E);
|
||||
LOG_D(MAC,"[UE %d][RAPROC] rarh->T %d\n",Mod_id,rarh->T);
|
||||
LOG_D(MAC,"[UE %d][RAPROC] rarh->RAPID %d\n",Mod_id,rarh->RAPID);
|
||||
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->R %d\n",Mod_id,rar->R);
|
||||
LOG_I(MAC,"[UE %d][RAPROC] rar->Timing_Advance_Command %d\n",Mod_id,(((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->hopping_flag %d\n",Mod_id,rar->hopping_flag);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->rb_alloc %d\n",Mod_id,rar->rb_alloc);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->mcs %d\n",Mod_id,rar->mcs);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->TPC %d\n",Mod_id,rar->TPC);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->UL_delay %d\n",Mod_id,rar->UL_delay);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->cqi_req %d\n",Mod_id,rar->cqi_req);
|
||||
LOG_I(MAC,"[UE %d][RAPROC] rar->t_crnti %x\n",Mod_id,(uint16_t)rar[5]+(rar[4]<<8));
|
||||
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",module_idP,frame,
|
||||
*(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
|
||||
rarh->RAPID,preamble_index);
|
||||
#ifdef DEBUG_RAR
|
||||
LOG_D(MAC,"[UE %d][RAPROC] rarh->E %d\n",module_idP,rarh->E);
|
||||
LOG_D(MAC,"[UE %d][RAPROC] rarh->T %d\n",module_idP,rarh->T);
|
||||
LOG_D(MAC,"[UE %d][RAPROC] rarh->RAPID %d\n",module_idP,rarh->RAPID);
|
||||
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->R %d\n",module_idP,rar->R);
|
||||
LOG_I(MAC,"[UE %d][RAPROC] rar->Timing_Advance_Command %d\n",module_idP,(((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->hopping_flag %d\n",module_idP,rar->hopping_flag);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->rb_alloc %d\n",module_idP,rar->rb_alloc);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->mcs %d\n",module_idP,rar->mcs);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->TPC %d\n",module_idP,rar->TPC);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->UL_delay %d\n",module_idP,rar->UL_delay);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->cqi_req %d\n",module_idP,rar->cqi_req);
|
||||
LOG_I(MAC,"[UE %d][RAPROC] rar->t_crnti %x\n",module_idP,(uint16_t)rar[5]+(rar[4]<<8));
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (preamble_index == rarh->RAPID) {
|
||||
*t_crnti = (uint16_t)rar[5]+(rar[4]<<8);//rar->t_crnti;
|
||||
UE_mac_inst[Mod_id].crnti = *t_crnti;//rar->t_crnti;
|
||||
//return(rar->Timing_Advance_Command);
|
||||
return((((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
|
||||
*t_crnti = (uint16_t)rar[5]+(rar[4]<<8);//rar->t_crnti;
|
||||
UE_mac_inst[module_idP].crnti = *t_crnti;//rar->t_crnti;
|
||||
//return(rar->Timing_Advance_Command);
|
||||
return((((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
|
||||
}
|
||||
else {
|
||||
UE_mac_inst[Mod_id].crnti=0;
|
||||
return(0xffff);
|
||||
UE_mac_inst[module_idP].crnti=0;
|
||||
return(0xffff);
|
||||
}
|
||||
}
|
||||
|
||||
+1026
-1024
File diff suppressed because it is too large
Load Diff
@@ -259,9 +259,6 @@ pdcp_fifo_read_input_sdus_remaining_bytes ()
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
sdu_size_t bytes_read=0;
|
||||
// if remaining bytes to read
|
||||
|
||||
|
||||
|
||||
if (pdcp_input_sdu_remaining_size_to_read > 0) {
|
||||
|
||||
|
||||
+827
-811
File diff suppressed because it is too large
Load Diff
@@ -185,43 +185,7 @@ typedef struct pdcp_mbms_t {
|
||||
* XXX And later this should be configured through the Makefile
|
||||
* under targets/TEST/PDCP/
|
||||
*/
|
||||
#undef PDCP_UNIT_TEST
|
||||
|
||||
#ifdef PDCP_UNIT_TEST
|
||||
/*! \fn BOOL pdcp_data_req(module_id_t, u32_t, u8_t, rb_id_t, sdu_size_t, unsigned char*, pdcp_t*, list_t*)
|
||||
* \brief This functions handles data transfer requests coming from test code (see below for actual code)
|
||||
* \param[in] module_id Module ID
|
||||
* \param[in] frame Frame number
|
||||
* \param[in] Shows if relevant PDCP entity is part of an eNB or a UE
|
||||
* \param[in] rab_id Radio Bearer ID
|
||||
* \param[in] sdu_buffer_size Size of incoming SDU in bytes
|
||||
* \param[in] sdu_buffer Buffer carrying SDU
|
||||
* \param[in] test_pdcp_entity PDCP entity used for testing purposes
|
||||
* \param[in] test_list list_t used for testing purposes
|
||||
* \param[out] test_list Newly created PDU is enqueued into the list
|
||||
* \param[out] test_pdcp PDCP sequence numbering state is updated
|
||||
* \return TRUE on success, FALSE otherwise
|
||||
* \note None
|
||||
* @ingroup _pdcp
|
||||
*/
|
||||
public_pdcp(BOOL pdcp_data_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rab_id, sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, pdcp_t* test_pdcp_entity, list_t* test_list);)
|
||||
/*! \fn BOOL pdcp_data_ind(module_id_t, u32_t, u8_t, rb_id_t, sdu_size_t, unsigned char*)
|
||||
* \brief This functions handles data transfer indications coming from test code (see below for actual code)
|
||||
* \param[in] module_id Module ID
|
||||
* \param[in] frame Frame number
|
||||
* \param[in] Shows if relevant PDCP entity is part of an eNB or a UE
|
||||
* \param[in] rab_id Radio Bearer ID
|
||||
* \param[in] sdu_buffer_size Size of incoming SDU in bytes
|
||||
* \param[in] sdu_buffer Buffer carrying SDU
|
||||
* \param[in] test_list Incoming PDU is received/dequeued from this list
|
||||
* \param[in] test_pdcp_entity PDCP entity used for testing purposes
|
||||
* \return TRUE on success, FALSE otherwise
|
||||
* \note None
|
||||
* @ingroup _pdcp
|
||||
*/
|
||||
public_pdcp(BOOL pdcp_data_ind (module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rab_id, sdu_size_t sdu_buffer_size, \
|
||||
mem_block_t* sdu_buffer, pdcp_t* test_pdcp_entity, list_t* test_list);)
|
||||
#else
|
||||
/*! \fn BOOL 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
|
||||
* \param[in] module_id Module ID
|
||||
@@ -237,10 +201,10 @@ public_pdcp(BOOL pdcp_data_ind (module_id_t module_id, u32_t frame, u8_t eNB_fla
|
||||
* \note None
|
||||
* @ingroup _pdcp
|
||||
*/
|
||||
public_pdcp(BOOL pdcp_data_req(u8 eNB_id, u8 UE_id, u32_t frame, u8_t eNB_flag, rb_id_t rb_id, u32 muiP, u32 confirmP, \
|
||||
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, \
|
||||
sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, u8 mode));
|
||||
|
||||
/*! \fn BOOL pdcp_data_ind(module_id_t, u32_t, u8_t, u8_t, rb_id_t, sdu_size_t, unsigned char*)
|
||||
/*! \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*)
|
||||
* \brief This functions handles data transfer indications coming from RLC
|
||||
* \param[in] module_id Module ID
|
||||
* \param[in] frame Frame number
|
||||
@@ -254,9 +218,8 @@ public_pdcp(BOOL pdcp_data_req(u8 eNB_id, u8 UE_id, u32_t frame, u8_t eNB_flag,
|
||||
* \note None
|
||||
* @ingroup _pdcp
|
||||
*/
|
||||
public_pdcp(BOOL pdcp_data_ind(u8 eNB_id, u8 UE_id, u32_t frame, u8_t eNB_flag, u8_t MBMS_flagP, rb_id_t rb_id, sdu_size_t sdu_buffer_size,
|
||||
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,
|
||||
mem_block_t* sdu_buffer, u8 is_data_plane));
|
||||
#endif // PDCP_UNIT_TEST
|
||||
|
||||
/*! \fn void rrc_pdcp_config_req(module_id_t, rb_id_t,u8)
|
||||
* \brief This functions initializes relevant PDCP entity
|
||||
@@ -269,9 +232,15 @@ public_pdcp(BOOL pdcp_data_ind(u8 eNB_id, u8 UE_id, u32_t frame, u8_t eNB_flag,
|
||||
* \note None
|
||||
* @ingroup _pdcp
|
||||
*/
|
||||
public_pdcp(void rrc_pdcp_config_req (u8 eNB_id, u8 UE_id, u32 frame, u8_t eNB_flag, u32 action, rb_id_t rb_id, u8 security_mode);)
|
||||
public_pdcp(void rrc_pdcp_config_req (module_id_t enb_idP,
|
||||
module_id_t ue_idP,
|
||||
frame_t frameP,
|
||||
eNB_flag_t eNB_flagP,
|
||||
u32 actionP,
|
||||
rb_id_t rb_idP,
|
||||
u8 security_modeP);)
|
||||
|
||||
/*! \fn bool rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_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.
|
||||
* \param[in] module_id Virtualized module identifier.
|
||||
* \param[in] frame Frame index.
|
||||
@@ -287,20 +256,23 @@ public_pdcp(void rrc_pdcp_config_req (u8 eNB_id, u8 UE_id, u32 frame, u8_t eNB_f
|
||||
* \return A status about the processing, OK or error code.
|
||||
*/
|
||||
public_pdcp(
|
||||
BOOL rrc_pdcp_config_asn1_req (u8 eNB_id, u8 UE_id, u32_t frame, u8_t eNB_flag,
|
||||
SRB_ToAddModList_t* srb2add_list,
|
||||
DRB_ToAddModList_t* drb2add_list,
|
||||
DRB_ToReleaseList_t* drb2release_list,
|
||||
u8 security_mode,
|
||||
u8 *kRRCenc,
|
||||
u8 *kRRCint,
|
||||
u8 *kUPenc
|
||||
BOOL rrc_pdcp_config_asn1_req (module_id_t eNB_idP,
|
||||
module_id_t ue_idP,
|
||||
frame_t frameP,
|
||||
eNB_flag_t eNB_flagP,
|
||||
SRB_ToAddModList_t *srb2add_list,
|
||||
DRB_ToAddModList_t *drb2add_list,
|
||||
DRB_ToReleaseList_t *drb2release_list,
|
||||
u8 security_modeP,
|
||||
u8 *kRRCenc,
|
||||
u8 *kRRCint,
|
||||
u8 *kUPenc
|
||||
#ifdef Rel10
|
||||
,PMCH_InfoList_r9_t* pmch_InfoList_r9
|
||||
,PMCH_InfoList_r9_t *pmch_InfoList_r9
|
||||
#endif
|
||||
));
|
||||
|
||||
/*! \fn BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u32 action, rb_id_t rb_id, u8 rb_sn, u8 rb_report, u16 header_compression_profile, u8 security_mode)
|
||||
/*! \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)
|
||||
* \brief Function for RRC to configure a Radio Bearer.
|
||||
* \param[in] module_id Virtualized module identifier.
|
||||
* \param[in] frame Frame index.
|
||||
@@ -316,13 +288,23 @@ BOOL rrc_pdcp_config_asn1_req (u8 eNB_id, u8 UE_id, u32_t frame, u8_t eNB_flag,
|
||||
* \param[in] kUPenc User-Plane encryption key
|
||||
* \return A status about the processing, OK or error code.
|
||||
*/
|
||||
public_pdcp(BOOL pdcp_config_req_asn1 (pdcp_t *pdcp, u8 eNB_id, u8 UE_id, u32 frame, u8_t eNB_flag,
|
||||
rlc_mode_t rlc_mode, u32 action, u16 lc_id, u16 mch_id, rb_id_t rb_id,
|
||||
u8 rb_sn, u8 rb_report, u16 header_compression_profile,
|
||||
u8 security_mode,
|
||||
u8 *kRRCenc,
|
||||
u8 *kRRCint,
|
||||
u8 *kUPenc));
|
||||
public_pdcp(BOOL pdcp_config_req_asn1 (pdcp_t *pdcp_pP,
|
||||
module_id_t enb_idP,
|
||||
module_id_t ue_idP,
|
||||
frame_t frameP,
|
||||
eNB_flag_t eNB_flagP,
|
||||
rlc_mode_t rlc_mode,
|
||||
u32 action,
|
||||
u16 lc_id,
|
||||
u16 mch_id,
|
||||
rb_id_t rb_id,
|
||||
u8 rb_sn,
|
||||
u8 rb_report,
|
||||
u16 header_compression_profile,
|
||||
u8 security_mode,
|
||||
u8 *kRRCenc,
|
||||
u8 *kRRCint,
|
||||
u8 *kUPenc));
|
||||
/*! \fn void rrc_pdcp_config_release(module_id_t, rb_id_t)
|
||||
* \brief This functions is unused
|
||||
* \param[in] module_id Module ID of relevant PDCP entity
|
||||
@@ -341,20 +323,20 @@ public_pdcp(BOOL pdcp_config_req_asn1 (pdcp_t *pdcp, u8 eNB_id, u8 UE_id, u32 fr
|
||||
* \note None
|
||||
* @ingroup _pdcp
|
||||
*/
|
||||
public_pdcp(void pdcp_run (u32_t frame, u8_t eNB_flag, u8 UE_index,u8 eNB_index);)
|
||||
public_pdcp(int pdcp_module_init ();)
|
||||
public_pdcp(void pdcp_module_cleanup ();)
|
||||
public_pdcp(void pdcp_layer_init ();)
|
||||
public_pdcp(void pdcp_layer_cleanup ();)
|
||||
public_pdcp(int pdcp_netlink_init(void);)
|
||||
public_pdcp(void pdcp_run (frame_t frameP, eNB_flag_t eNB_flagP, module_id_t ue_mod_idP, module_id_t enb_mod_idP);)
|
||||
public_pdcp(int pdcp_module_init (void);)
|
||||
public_pdcp(void pdcp_module_cleanup (void);)
|
||||
public_pdcp(void pdcp_layer_init (void);)
|
||||
public_pdcp(void pdcp_layer_cleanup (void);)
|
||||
public_pdcp(int pdcp_netlink_init (void);)
|
||||
|
||||
#define PDCP2NAS_FIFO 21
|
||||
#define NAS2PDCP_FIFO 22
|
||||
|
||||
protected_pdcp_fifo(int pdcp_fifo_flush_sdus(u32_t frame, u8 eNB_flag, u8 eNB_id, u8 UE_id);)
|
||||
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus_remaining_bytes (u32_t,u8_t);)
|
||||
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus (u32_t frame, u8_t eNB_flag, u8_t UE_index, u8_t eNB_index);)
|
||||
protected_pdcp_fifo(void pdcp_fifo_read_input_sdus_from_otg (u32_t frame, u8_t eNB_flag, u8 UE_index, u8 eNB_index);)
|
||||
protected_pdcp_fifo(int pdcp_fifo_flush_sdus (frame_t frameP, eNB_flag_t eNB_flagP, module_id_t enb_idP, module_id_t ue_mod_idP);)
|
||||
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t eNB_flagP);)
|
||||
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t eNB_flagP, module_id_t ue_mod_idP, module_id_t enb_mod_idP);)
|
||||
protected_pdcp_fifo(void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t eNB_flagP, module_id_t ue_mod_idP, module_id_t enb_mod_idP);)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -362,20 +344,19 @@ protected_pdcp_fifo(void pdcp_fifo_read_input_sdus_from_otg (u32_t frame, u8_t e
|
||||
* Following two types are utilized between NAS driver and PDCP
|
||||
*/
|
||||
|
||||
typedef int traffic_type_t;
|
||||
|
||||
typedef struct pdcp_data_req_header_s {
|
||||
rb_id_t rb_id;
|
||||
sdu_size_t data_size;
|
||||
int inst;
|
||||
signed int inst;
|
||||
traffic_type_t traffic_type;
|
||||
} pdcp_data_req_header_t;
|
||||
|
||||
typedef struct pdcp_data_ind_header_s {
|
||||
rb_id_t rb_id;
|
||||
sdu_size_t data_size;
|
||||
int inst;
|
||||
int dummy;
|
||||
signed int inst;
|
||||
traffic_type_t dummy_traffic_type;
|
||||
} pdcp_data_ind_header_t;
|
||||
|
||||
struct pdcp_netlink_element_s {
|
||||
@@ -406,7 +387,8 @@ typedef struct pdcp_missing_pdu_info_t {
|
||||
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_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][NB_RB_MAX];)
|
||||
public_pdcp(pdcp_mbms_t pdcp_mbms_array[MAX_MODULES][16*29];) // MAX_SERVICEx MAX_SESSION
|
||||
public_pdcp(pdcp_mbms_t pdcp_mbms_array_ue[NUMBER_OF_UE_MAX][16*29];) // MAX_SERVICEx MAX_SESSION
|
||||
public_pdcp(pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][16*29];) // MAX_SERVICEx MAX_SESSION
|
||||
protected_pdcp(sdu_size_t pdcp_output_sdu_bytes_to_write;)
|
||||
protected_pdcp(sdu_size_t pdcp_output_header_bytes_to_write;)
|
||||
protected_pdcp(list_t pdcp_sdu_list;)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,18 +25,18 @@
|
||||
Forums : http://forums.eurecom.fsr/openairinterface
|
||||
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
|
||||
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
|
||||
/*! \file pdcp_netlink.c
|
||||
* \brief pdcp communication with linux IP interface,
|
||||
* have a look at http://man7.org/linux/man-pages/man7/netlink.7.html for netlink.
|
||||
* Read operation from netlink should be achieved in an asynchronous way to avoid
|
||||
* subframe overload, netlink congestion...
|
||||
* \author Sebastien ROUX
|
||||
* \date 2013
|
||||
* \version 0.1
|
||||
* @ingroup pdcp
|
||||
*/
|
||||
* \brief pdcp communication with linux IP interface,
|
||||
* have a look at http://man7.org/linux/man-pages/man7/netlink.7.html for netlink.
|
||||
* Read operation from netlink should be achieved in an asynchronous way to avoid
|
||||
* subframe overload, netlink congestion...
|
||||
* \author Sebastien ROUX
|
||||
* \date 2013
|
||||
* \version 0.1
|
||||
* @ingroup pdcp
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
@@ -81,163 +81,199 @@ static pthread_t pdcp_netlink_thread;
|
||||
* and the corresponding entity in User-space.
|
||||
* one queue for eNBs (index 0)/one queue for UEs (index 1)
|
||||
*/
|
||||
static struct lfds611_queue_state **pdcp_netlink_queue = NULL;
|
||||
static uint32_t *pdcp_netlink_nb_element = NULL;
|
||||
static struct lfds611_queue_state **pdcp_netlink_queue_enb = NULL;
|
||||
static struct lfds611_queue_state **pdcp_netlink_queue_ue = NULL;
|
||||
static uint32_t *pdcp_netlink_nb_element_enb = NULL;
|
||||
static uint32_t *pdcp_netlink_nb_element_ue = NULL;
|
||||
|
||||
static void *pdcp_netlink_thread_fct(void *arg);
|
||||
|
||||
int pdcp_netlink_init(void) {
|
||||
|
||||
int i, nb_modules;
|
||||
pthread_attr_t attr;
|
||||
struct sched_param sched_param;
|
||||
int i;
|
||||
int nb_inst_enb;
|
||||
int nb_inst_ue;
|
||||
pthread_attr_t attr;
|
||||
struct sched_param sched_param;
|
||||
|
||||
#if defined(USER_MODE) && defined(OAI_EMU)
|
||||
nb_modules = NB_eNB_INST + NB_UE_INST;
|
||||
nb_inst_enb = oai_emulation.info.nb_enb_local;
|
||||
nb_inst_ue = oai_emulation.info.nb_ue_local;
|
||||
#else
|
||||
nb_modules = 1;
|
||||
nb_inst_enb = 1;
|
||||
nb_inst_ue = 1;
|
||||
#endif
|
||||
|
||||
pdcp_netlink_queue = calloc(nb_modules, sizeof(struct lfds611_queue_state*));
|
||||
pdcp_netlink_nb_element = malloc(nb_modules * sizeof(uint32_t));
|
||||
pdcp_netlink_queue_enb = calloc(nb_inst_enb, sizeof(struct lfds611_queue_state*));
|
||||
pdcp_netlink_nb_element_enb = malloc(nb_inst_enb * sizeof(uint32_t));
|
||||
|
||||
LOG_I(PDCP, "Creating %d queues for Netlink -> PDCP communication\n",
|
||||
nb_modules);
|
||||
pdcp_netlink_queue_ue = calloc(nb_inst_ue, sizeof(struct lfds611_queue_state*));
|
||||
pdcp_netlink_nb_element_ue = malloc(nb_inst_ue * sizeof(uint32_t));
|
||||
|
||||
for (i = 0; i < nb_modules; i++) {
|
||||
pdcp_netlink_nb_element[i] = 0;
|
||||
if (lfds611_queue_new(&pdcp_netlink_queue[i], PDCP_QUEUE_NB_ELEMENTS) < 0) {
|
||||
LOG_E(PDCP, "Failed to create new FIFO for Netlink -> PDCP communcation instance %d\n", i);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
LOG_I(PDCP, "Creating %d queues for eNB Netlink -> PDCP communication\n", nb_inst_enb);
|
||||
LOG_I(PDCP, "Creating %d queues for UE Netlink -> PDCP communication\n", nb_inst_ue);
|
||||
|
||||
if (pthread_attr_init(&attr) != 0) {
|
||||
LOG_E(PDCP, "Failed to initialize pthread attribute for Netlink -> PDCP communication (%d:%s)\n",
|
||||
errno, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
for (i = 0; i < nb_inst_enb; i++) {
|
||||
pdcp_netlink_nb_element_enb[i] = 0;
|
||||
if (lfds611_queue_new(&pdcp_netlink_queue_enb[i], PDCP_QUEUE_NB_ELEMENTS) < 0) {
|
||||
LOG_E(PDCP, "Failed to create new FIFO for eNB Netlink -> PDCP communcation instance %d\n", i);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < nb_inst_ue; i++) {
|
||||
pdcp_netlink_nb_element_ue[i] = 0;
|
||||
if (lfds611_queue_new(&pdcp_netlink_queue_ue[i], PDCP_QUEUE_NB_ELEMENTS) < 0) {
|
||||
LOG_E(PDCP, "Failed to create new FIFO for UE Netlink -> PDCP communcation instance %d\n", i);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
sched_param.sched_priority = 10;
|
||||
if (pthread_attr_init(&attr) != 0) {
|
||||
LOG_E(PDCP, "Failed to initialize pthread attribute for Netlink -> PDCP communication (%d:%s)\n",
|
||||
errno, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
pthread_attr_setschedpolicy(&attr, SCHED_RR);
|
||||
pthread_attr_setschedparam(&attr, &sched_param);
|
||||
sched_param.sched_priority = 10;
|
||||
|
||||
/* Create one thread that fetchs packets from the netlink.
|
||||
* When the netlink fifo is full, packets are silently dropped, this behaviour
|
||||
* should be avoided if we want a reliable link.
|
||||
*/
|
||||
if (pthread_create(&pdcp_netlink_thread, &attr, pdcp_netlink_thread_fct, NULL) != 0) {
|
||||
LOG_E(PDCP, "Failed to create new thread for Netlink/PDCP communcation (%d:%s)\n",
|
||||
errno, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
pthread_attr_setschedpolicy(&attr, SCHED_RR);
|
||||
pthread_attr_setschedparam(&attr, &sched_param);
|
||||
|
||||
return 0;
|
||||
/* Create one thread that fetchs packets from the netlink.
|
||||
* When the netlink fifo is full, packets are silently dropped, this behaviour
|
||||
* should be avoided if we want a reliable link.
|
||||
*/
|
||||
if (pthread_create(&pdcp_netlink_thread, &attr, pdcp_netlink_thread_fct, NULL) != 0) {
|
||||
LOG_E(PDCP, "Failed to create new thread for Netlink/PDCP communcation (%d:%s)\n",
|
||||
errno, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pdcp_netlink_dequeue_element(uint8_t eNB_flag, uint8_t UE_index, uint8_t eNB_index,
|
||||
struct pdcp_netlink_element_s **data)
|
||||
int pdcp_netlink_dequeue_element(
|
||||
module_id_t enb_mod_idP,
|
||||
module_id_t ue_mod_idP,
|
||||
eNB_flag_t eNB_flagP,
|
||||
struct pdcp_netlink_element_s **data_ppP)
|
||||
{
|
||||
int ret = 0;
|
||||
module_id_t module_id;
|
||||
int ret = 0;
|
||||
|
||||
#if defined(USER_MODE) && defined(OAI_EMU)
|
||||
module_id = (eNB_flag != 0) ? eNB_index : NB_eNB_INST + UE_index;
|
||||
#else
|
||||
module_id = 0;
|
||||
#endif
|
||||
if (eNB_flagP) {
|
||||
ret = lfds611_queue_dequeue(pdcp_netlink_queue_enb[enb_mod_idP], (void **)data_ppP);
|
||||
if (ret != 0) {
|
||||
LOG_D(PDCP, "De-queueing packet for eNB instance %d\n", enb_mod_idP);
|
||||
}
|
||||
} else {
|
||||
ret = lfds611_queue_dequeue(pdcp_netlink_queue_ue[ue_mod_idP], (void **)data_ppP);
|
||||
if (ret != 0) {
|
||||
LOG_D(PDCP, "De-queueing packet for UE instance %d\n", ue_mod_idP);
|
||||
}
|
||||
}
|
||||
|
||||
ret = lfds611_queue_dequeue(pdcp_netlink_queue[module_id], (void **)data);
|
||||
|
||||
if (ret != 0) {
|
||||
LOG_D(PDCP, "De-queueing packet for module %d\n", module_id);
|
||||
}
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
void *pdcp_netlink_thread_fct(void *arg) {
|
||||
int len;
|
||||
struct pdcp_netlink_element_s *new_data = NULL;
|
||||
uint8_t pdcp_read_state;
|
||||
int len = 0;
|
||||
struct pdcp_netlink_element_s *new_data_p = NULL;
|
||||
uint8_t pdcp_thread_read_state ;
|
||||
eNB_flag_t eNB_flag = 0;
|
||||
|
||||
pdcp_read_state = 0;
|
||||
memset(nl_rx_buf, 0, NL_MAX_PAYLOAD);
|
||||
pdcp_thread_read_state = 0;
|
||||
memset(nl_rx_buf, 0, NL_MAX_PAYLOAD);
|
||||
|
||||
while (1) {
|
||||
while (1) {
|
||||
|
||||
len = recvmsg(nas_sock_fd, &nas_msg_rx, 0);
|
||||
len = recvmsg(nas_sock_fd, &nas_msg_rx, 0);
|
||||
|
||||
if (len == 0) {
|
||||
/* Other peer (kernel) has performed an orderly shutdown
|
||||
*/
|
||||
LOG_E(PDCP, "Kernel module has closed the netlink\n");
|
||||
exit(EXIT_FAILURE);
|
||||
} else if (len < 0) {
|
||||
/* There was an error */
|
||||
LOG_E(PDCP, "An error occured while reading netlink (%d:%s)\n",
|
||||
errno, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
/* Normal read.
|
||||
* NOTE: netlink messages can be assembled to form a multipart message
|
||||
*/
|
||||
for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf;
|
||||
NLMSG_OK(nas_nlh_rx, len);
|
||||
nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, len)) {
|
||||
if (len == 0) {
|
||||
/* Other peer (kernel) has performed an orderly shutdown
|
||||
*/
|
||||
LOG_E(PDCP, "[NETLINK_THREAD] Kernel module has closed the netlink\n");
|
||||
exit(EXIT_FAILURE);
|
||||
} else if (len < 0) {
|
||||
/* There was an error */
|
||||
LOG_E(PDCP, "[NETLINK_THREAD] An error occured while reading netlink (%d:%s)\n",
|
||||
errno, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
/* Normal read.
|
||||
* NOTE: netlink messages can be assembled to form a multipart message
|
||||
*/
|
||||
for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf;
|
||||
NLMSG_OK(nas_nlh_rx, len);
|
||||
nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, len)) {
|
||||
|
||||
/* There is no need to check for nlmsg_type because
|
||||
* the header is not set in our drivers.
|
||||
*/
|
||||
if (pdcp_read_state == 0) {
|
||||
new_data = malloc(sizeof(struct pdcp_netlink_element_s));
|
||||
/* There is no need to check for nlmsg_type because
|
||||
* the header is not set in our drivers.
|
||||
*/
|
||||
if (pdcp_thread_read_state == 0) {
|
||||
new_data_p = malloc(sizeof(struct pdcp_netlink_element_s));
|
||||
|
||||
if (nas_nlh_rx->nlmsg_len == sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)) {
|
||||
pdcp_read_state = 1;
|
||||
memcpy((void *)&new_data->pdcp_read_header, (void *)NLMSG_DATA(nas_nlh_rx), sizeof(pdcp_data_req_header_t));
|
||||
LOG_I(PDCP, "[NETLINK] RX pdcp_data_req_header_t inst %u, "
|
||||
"rb_id %u data_size %d\n",
|
||||
new_data->pdcp_read_header.inst, new_data->pdcp_read_header.rb_id,
|
||||
new_data->pdcp_read_header.data_size);
|
||||
} else {
|
||||
LOG_E(PDCP, "[NETLINK] WRONG size %d should be sizeof "
|
||||
"%d ((pdcp_data_req_header_t) + sizeof(struct nlmsghdr))\n",
|
||||
nas_nlh_rx->nlmsg_len, sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr));
|
||||
}
|
||||
} else {
|
||||
pdcp_read_state = 0;
|
||||
if (nas_nlh_rx->nlmsg_len == sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)) {
|
||||
pdcp_thread_read_state = 1;
|
||||
memcpy((void *)&new_data_p->pdcp_read_header, (void *)NLMSG_DATA(nas_nlh_rx), sizeof(pdcp_data_req_header_t));
|
||||
LOG_I(PDCP, "[NETLINK_THREAD] RX pdcp_data_req_header_t inst %u, "
|
||||
"rb_id %u data_size %d\n",
|
||||
new_data_p->pdcp_read_header.inst,
|
||||
new_data_p->pdcp_read_header.rb_id,
|
||||
new_data_p->pdcp_read_header.data_size);
|
||||
} else {
|
||||
LOG_E(PDCP, "[NETLINK_THREAD] WRONG size %d should be sizeof "
|
||||
"%d ((pdcp_data_req_header_t) + sizeof(struct nlmsghdr))\n",
|
||||
nas_nlh_rx->nlmsg_len,
|
||||
sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr));
|
||||
}
|
||||
} else {
|
||||
pdcp_thread_read_state = 0;
|
||||
|
||||
#ifdef OAI_EMU
|
||||
if (new_data->pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) {
|
||||
new_data->pdcp_read_header.inst = new_data->pdcp_read_header.inst
|
||||
- oai_emulation.info.nb_enb_local + NB_eNB_INST
|
||||
+ oai_emulation.info.first_ue_local;
|
||||
} else {
|
||||
new_data->pdcp_read_header.inst = new_data->pdcp_read_header.inst
|
||||
+ oai_emulation.info.first_enb_local;
|
||||
}
|
||||
if (new_data_p->pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) {
|
||||
new_data_p->pdcp_read_header.inst = new_data_p->pdcp_read_header.inst
|
||||
- oai_emulation.info.nb_enb_local +
|
||||
+ oai_emulation.info.first_ue_local;
|
||||
eNB_flag = 0;
|
||||
} else {
|
||||
new_data_p->pdcp_read_header.inst = new_data_p->pdcp_read_header.inst
|
||||
+ oai_emulation.info.first_enb_local;
|
||||
eNB_flag = 1;
|
||||
}
|
||||
#else
|
||||
new_data->pdcp_read_header.inst = 0;
|
||||
new_data_p->pdcp_read_header.inst = 0;
|
||||
#endif
|
||||
new_data->data = malloc(sizeof(uint8_t) * new_data->pdcp_read_header.data_size);
|
||||
/* Copy the data */
|
||||
memcpy(new_data->data, NLMSG_DATA(nas_nlh_rx), new_data->pdcp_read_header.data_size);
|
||||
new_data_p->data = malloc(sizeof(uint8_t) * new_data_p->pdcp_read_header.data_size);
|
||||
/* Copy the data */
|
||||
memcpy(new_data_p->data, NLMSG_DATA(nas_nlh_rx), new_data_p->pdcp_read_header.data_size);
|
||||
|
||||
if (pdcp_netlink_nb_element[new_data->pdcp_read_header.inst]
|
||||
> PDCP_QUEUE_NB_ELEMENTS) {
|
||||
LOG_E(PDCP, "[Mod %02x] We reached maximum number of elements in pdcp queue (%d)\n",
|
||||
new_data->pdcp_read_header.inst, pdcp_netlink_nb_element);
|
||||
}
|
||||
if (eNB_flag) {
|
||||
if (pdcp_netlink_nb_element_enb[new_data_p->pdcp_read_header.inst]
|
||||
> PDCP_QUEUE_NB_ELEMENTS) {
|
||||
LOG_E(PDCP, "[NETLINK_THREAD][Inst %02x] We reached maximum number of elements in eNB pdcp queue (%d)\n",
|
||||
new_data_p->pdcp_read_header.inst, pdcp_netlink_nb_element_enb);
|
||||
}
|
||||
|
||||
LOG_D(PDCP, "En-queueing packet for module %d\n", new_data->pdcp_read_header.inst);
|
||||
LOG_D(PDCP, "[NETLINK_THREAD] En-queueing packet for eNB instance %d\n", new_data_p->pdcp_read_header.inst);
|
||||
|
||||
/* Enqueue the element in the right queue */
|
||||
// lfds611_queue_enqueue(pdcp_netlink_queue[new_data->pdcp_read_header.inst], new_data);
|
||||
lfds611_queue_guaranteed_enqueue(pdcp_netlink_queue[new_data->pdcp_read_header.inst], new_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
/* Enqueue the element in the right queue */
|
||||
lfds611_queue_guaranteed_enqueue(pdcp_netlink_queue_enb[new_data_p->pdcp_read_header.inst], new_data_p);
|
||||
} else {
|
||||
if (pdcp_netlink_nb_element_ue[new_data_p->pdcp_read_header.inst]
|
||||
> PDCP_QUEUE_NB_ELEMENTS) {
|
||||
LOG_E(PDCP, "[NETLINK_THREAD][Inst %02x] We reached maximum number of elements in UE pdcp queue (%d)\n",
|
||||
new_data_p->pdcp_read_header.inst, pdcp_netlink_nb_element_ue);
|
||||
}
|
||||
|
||||
LOG_D(PDCP, "[NETLINK_THREAD] En-queueing packet for UE instance %d\n", new_data_p->pdcp_read_header.inst);
|
||||
|
||||
/* Enqueue the element in the right queue */
|
||||
lfds611_queue_guaranteed_enqueue(pdcp_netlink_queue_ue[new_data_p->pdcp_read_header.inst], new_data_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -153,11 +153,11 @@ BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_b
|
||||
BOOL pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
|
||||
u8 bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu);
|
||||
|
||||
int pdcp_netlink_dequeue_element(uint8_t eNB_flag, uint8_t UE_index, uint8_t eNB_index,
|
||||
struct pdcp_netlink_element_s **data);
|
||||
int pdcp_netlink_dequeue_element(module_id_t enb_mod_idP, module_id_t ue_mod_idP, eNB_flag_t eNB_flagP,
|
||||
struct pdcp_netlink_element_s **data_ppP);
|
||||
|
||||
void pdcp_config_set_security(pdcp_t *pdcp, u8 eNB_id, u8 UE_id, u32 frame, u8 eNB_flag, rb_id_t rb_id,
|
||||
u16 lc_id, u8 security_mode, u8 *kRRCenc, u8 *kRRCint, u8 *kUPenc);
|
||||
void pdcp_config_set_security(pdcp_t *pdcp_pP, 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,
|
||||
u16 lc_idP, u8 security_modeP, u8 *kRRCenc_pP, u8 *kRRCint_pP, u8 *kUPenc_pP);
|
||||
|
||||
#if defined(ENABLE_SECURITY)
|
||||
int pdcp_apply_security(pdcp_t *pdcp_entity, rb_id_t rb_id,
|
||||
|
||||
@@ -87,12 +87,15 @@ void util_flush_hex_octets(comp_name_t component, unsigned char* data, unsigned
|
||||
LOG_W(component, "Incoming buffer is NULL! Ignoring...\n");
|
||||
return;
|
||||
}
|
||||
printf("[PDCP]");
|
||||
|
||||
unsigned long octet_index = 0;
|
||||
for (octet_index = 0; octet_index < size; ++octet_index) {
|
||||
LOG_T(component, "%02x.", data[octet_index]);
|
||||
//LOG_T(component, "%02x.", data[octet_index]);
|
||||
printf("%02x.", data[octet_index]);
|
||||
}
|
||||
LOG_T(component, " \n");
|
||||
//LOG_T(component, " \n");
|
||||
printf(" \n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -35,6 +35,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#if defined(ENABLE_ITTI)
|
||||
# include "intertask_interface.h"
|
||||
#endif
|
||||
# include "assertions.h"
|
||||
#include "rlc_am.h"
|
||||
#include "rlc_am_segment.h"
|
||||
#include "rlc_am_timer_poll_retransmit.h"
|
||||
@@ -56,7 +57,7 @@ extern rlc_am_control_pdu_info_t g_rlc_am_control_pdu_info;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
u32_t
|
||||
rlc_am_get_buffer_occupancy_in_bytes (rlc_am_entity_t *rlc_pP,u32 frameP)
|
||||
rlc_am_get_buffer_occupancy_in_bytes (rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
u32_t max_li_overhead;
|
||||
@@ -67,7 +68,7 @@ rlc_am_get_buffer_occupancy_in_bytes (rlc_am_entity_t *rlc_pP,u32 frameP)
|
||||
if (rlc_pP->t_status_prohibit.running == 0) {
|
||||
#ifdef TRACE_RLC_AM_BO
|
||||
if (((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3) > 0) {
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BO : CONTROL PDU %d bytes \n", frameP, rlc_pP->module_id, rlc_pP->rb_id, ((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3));
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BO : CONTROL PDU %d bytes \n", frameP, rlc_pP->module_id, rlc_pP->rb_id, ((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3));
|
||||
}
|
||||
#endif
|
||||
return ((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3);
|
||||
@@ -89,9 +90,9 @@ rlc_am_get_buffer_occupancy_in_bytes (rlc_am_entity_t *rlc_pP,u32 frameP)
|
||||
|
||||
#ifdef TRACE_RLC_AM_BO
|
||||
if ((rlc_pP->status_buffer_occupancy + rlc_pP->retransmission_buffer_occupancy + rlc_pP->sdu_buffer_occupancy + max_li_overhead + header_overhead) > 0) {
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BO : STATUS BUFFER %d bytes \n", frameP, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->status_buffer_occupancy);
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BO : RETRANS BUFFER %d bytes \n", frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->retransmission_buffer_occupancy);
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BO : SDU BUFFER %d bytes + li_overhead %d bytes header_overhead %d bytes (nb sdu not segmented %d)\n", frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->sdu_buffer_occupancy, max_li_overhead, header_overhead, rlc_pP->nb_sdu_no_segmented);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BO : STATUS BUFFER %d bytes \n", frameP, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->status_buffer_occupancy);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BO : RETRANS BUFFER %d bytes \n", frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->retransmission_buffer_occupancy);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BO : SDU BUFFER %d bytes + li_overhead %d bytes header_overhead %d bytes (nb sdu not segmented %d)\n", frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->sdu_buffer_occupancy, max_li_overhead, header_overhead, rlc_pP->nb_sdu_no_segmented);
|
||||
}
|
||||
#endif
|
||||
return rlc_pP->status_buffer_occupancy + rlc_pP->retransmission_buffer_occupancy + rlc_pP->sdu_buffer_occupancy + max_li_overhead + header_overhead;
|
||||
@@ -103,31 +104,46 @@ void rlc_am_release (rlc_am_entity_t *rlc_pP)
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void config_req_rlc_am (rlc_am_entity_t *rlc_pP, u32_t frameP, u8_t eNB_flagP, module_id_t module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
void config_req_rlc_am (frame_t frameP,
|
||||
eNB_flag_t eNB_flagP,
|
||||
module_id_t enb_module_idP,
|
||||
module_id_t ue_module_idP,
|
||||
rlc_am_info_t *config_am_pP,
|
||||
rb_id_t rb_idP,
|
||||
rb_type_t rb_typeP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_%s][MOD %02d][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %02d][RB %02d]\n",
|
||||
rlc_am_entity_t *rlc = NULL;
|
||||
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %u/%u][RB %u]\n",
|
||||
frameP,
|
||||
( Mac_rlc_xface->Is_cluster_head[module_idP] == 1) ? "eNB":"UE",
|
||||
module_idP,
|
||||
config_amP->max_retx_threshold,
|
||||
config_amP->poll_pdu,
|
||||
config_amP->poll_byte,
|
||||
config_amP->t_poll_retransmit,
|
||||
config_amP->t_reordering,
|
||||
config_amP->t_status_prohibit,
|
||||
module_idP,
|
||||
( eNB_flagP > 0) ? "eNB":"UE",
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
config_am_pP->max_retx_threshold,
|
||||
config_am_pP->poll_pdu,
|
||||
config_am_pP->poll_byte,
|
||||
config_am_pP->t_poll_retransmit,
|
||||
config_am_pP->t_reordering,
|
||||
config_am_pP->t_status_prohibit,
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
rb_idP);
|
||||
|
||||
rlc_am_init(rlc_pP,frameP);
|
||||
rlc_am_set_debug_infos(rlc_pP, frameP, eNB_flagP, module_idP, rb_idP, rb_typeP);
|
||||
rlc_am_configure(rlc_pP,frameP,
|
||||
config_amP->max_retx_threshold,
|
||||
config_amP->poll_pdu,
|
||||
config_amP->poll_byte,
|
||||
config_amP->t_poll_retransmit,
|
||||
config_amP->t_reordering,
|
||||
config_amP->t_status_prohibit);
|
||||
if (eNB_flagP) {
|
||||
rlc = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.am;
|
||||
} else {
|
||||
rlc = &rlc_array_ue[ue_module_idP][rb_idP].rlc.am;
|
||||
}
|
||||
rlc_am_init(rlc,frameP);
|
||||
rlc_am_set_debug_infos(rlc, frameP, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP);
|
||||
rlc_am_configure(rlc,frameP,
|
||||
config_am_pP->max_retx_threshold,
|
||||
config_am_pP->poll_pdu,
|
||||
config_am_pP->poll_byte,
|
||||
config_am_pP->t_poll_retransmit,
|
||||
config_am_pP->t_reordering,
|
||||
config_am_pP->t_status_prohibit);
|
||||
|
||||
}
|
||||
u32_t pollPDU_tab[PollPDU_pInfinity+1]={4,8,16,32,64,128,256,1024}; // What is PollPDU_pInfinity??? 1024 for now
|
||||
@@ -138,54 +154,70 @@ u32_t am_t_Reordering_tab[T_Reordering_spare1]={0,5,10,15,20,25,30,35,40,45,50,5
|
||||
u32_t t_StatusProhibit_tab[T_StatusProhibit_spare8]={0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void config_req_rlc_am_asn1 (rlc_am_entity_t *rlc_pP, u32_t frameP, u8_t eNB_flagP, module_id_t module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
void config_req_rlc_am_asn1 (frame_t frameP,
|
||||
eNB_flag_t eNB_flagP,
|
||||
module_id_t enb_module_idP,
|
||||
module_id_t ue_module_idP,
|
||||
struct RLC_Config__am *config_am_pP,
|
||||
rb_id_t rb_idP,
|
||||
rb_type_t rb_typeP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
if ( (config_amP->ul_AM_RLC.maxRetxThreshold <= UL_AM_RLC__maxRetxThreshold_t32) &&
|
||||
(config_amP->ul_AM_RLC.pollPDU<=PollPDU_pInfinity) &&
|
||||
(config_amP->ul_AM_RLC.pollByte<PollByte_spare1) &&
|
||||
(config_amP->ul_AM_RLC.t_PollRetransmit<T_PollRetransmit_spare9) &&
|
||||
(config_amP->dl_AM_RLC.t_Reordering<T_Reordering_spare1) &&
|
||||
(config_amP->dl_AM_RLC.t_StatusProhibit<T_StatusProhibit_spare8) ){
|
||||
rlc_am_entity_t *rlc = NULL;
|
||||
|
||||
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_%s][MOD %02d][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %02d][RB %02d]\n",
|
||||
frameP,
|
||||
( Mac_rlc_xface->Is_cluster_head[module_idP] == 1) ? "eNB":"UE",
|
||||
module_idP,
|
||||
maxRetxThreshold_tab[config_amP->ul_AM_RLC.maxRetxThreshold],
|
||||
pollPDU_tab[config_amP->ul_AM_RLC.pollPDU],
|
||||
pollByte_tab[config_amP->ul_AM_RLC.pollByte],
|
||||
PollRetransmit_tab[config_amP->ul_AM_RLC.t_PollRetransmit],
|
||||
am_t_Reordering_tab[config_amP->dl_AM_RLC.t_Reordering],
|
||||
t_StatusProhibit_tab[config_amP->dl_AM_RLC.t_StatusProhibit],
|
||||
module_idP,
|
||||
rb_idP);
|
||||
if (eNB_flagP) {
|
||||
rlc = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.am;
|
||||
} else {
|
||||
rlc = &rlc_array_ue[ue_module_idP][rb_idP].rlc.am;
|
||||
}
|
||||
if ((config_am_pP->ul_AM_RLC.maxRetxThreshold <= UL_AM_RLC__maxRetxThreshold_t32) &&
|
||||
(config_am_pP->ul_AM_RLC.pollPDU<=PollPDU_pInfinity) &&
|
||||
(config_am_pP->ul_AM_RLC.pollByte<PollByte_spare1) &&
|
||||
(config_am_pP->ul_AM_RLC.t_PollRetransmit<T_PollRetransmit_spare9) &&
|
||||
(config_am_pP->dl_AM_RLC.t_Reordering<T_Reordering_spare1) &&
|
||||
(config_am_pP->dl_AM_RLC.t_StatusProhibit<T_StatusProhibit_spare8) ){
|
||||
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %u/%u][RB %u]\n",
|
||||
frameP,
|
||||
(eNB_flagP) ? "eNB" : "UE",
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
maxRetxThreshold_tab[config_am_pP->ul_AM_RLC.maxRetxThreshold],
|
||||
pollPDU_tab[config_am_pP->ul_AM_RLC.pollPDU],
|
||||
pollByte_tab[config_am_pP->ul_AM_RLC.pollByte],
|
||||
PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit],
|
||||
am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering],
|
||||
t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit],
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
rb_idP);
|
||||
|
||||
rlc_am_init(rlc_pP,frameP);
|
||||
rlc_am_set_debug_infos(rlc_pP, frameP, eNB_flagP, module_idP, rb_idP, rb_typeP);
|
||||
rlc_am_configure(rlc_pP,frameP,
|
||||
maxRetxThreshold_tab[config_amP->ul_AM_RLC.maxRetxThreshold],
|
||||
pollPDU_tab[config_amP->ul_AM_RLC.pollPDU],
|
||||
pollByte_tab[config_amP->ul_AM_RLC.pollByte],
|
||||
PollRetransmit_tab[config_amP->ul_AM_RLC.t_PollRetransmit],
|
||||
am_t_Reordering_tab[config_amP->dl_AM_RLC.t_Reordering],
|
||||
t_StatusProhibit_tab[config_amP->dl_AM_RLC.t_StatusProhibit]);
|
||||
|
||||
}
|
||||
else {
|
||||
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_%s][MOD %02d][][--- ILLEGAL CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %02d][RB %02d], RLC-AM NOT CONFIGURED\n",
|
||||
frameP,
|
||||
( Mac_rlc_xface->Is_cluster_head[module_idP] == 1) ? "eNB":"UE",
|
||||
module_idP,
|
||||
config_amP->ul_AM_RLC.maxRetxThreshold,
|
||||
config_amP->ul_AM_RLC.pollPDU,
|
||||
config_amP->ul_AM_RLC.pollByte,
|
||||
config_amP->ul_AM_RLC.t_PollRetransmit,
|
||||
config_amP->dl_AM_RLC.t_Reordering,
|
||||
config_amP->dl_AM_RLC.t_StatusProhibit,
|
||||
module_idP,
|
||||
rb_idP);
|
||||
}
|
||||
rlc_am_init(rlc,frameP);
|
||||
rlc_am_set_debug_infos(rlc, frameP, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP);
|
||||
rlc_am_configure(rlc,
|
||||
frameP,
|
||||
maxRetxThreshold_tab[config_am_pP->ul_AM_RLC.maxRetxThreshold],
|
||||
pollPDU_tab[config_am_pP->ul_AM_RLC.pollPDU],
|
||||
pollByte_tab[config_am_pP->ul_AM_RLC.pollByte],
|
||||
PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit],
|
||||
am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering],
|
||||
t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit]);
|
||||
} else {
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- ILLEGAL CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %u/%u][RB %u], RLC-AM NOT CONFIGURED\n",
|
||||
frameP,
|
||||
(eNB_flagP) ? "eNB" : "UE",
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
config_am_pP->ul_AM_RLC.maxRetxThreshold,
|
||||
config_am_pP->ul_AM_RLC.pollPDU,
|
||||
config_am_pP->ul_AM_RLC.pollByte,
|
||||
config_am_pP->ul_AM_RLC.t_PollRetransmit,
|
||||
config_am_pP->dl_AM_RLC.t_Reordering,
|
||||
config_am_pP->dl_AM_RLC.t_StatusProhibit,
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
rb_idP);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -250,7 +282,7 @@ void rlc_am_stat_req (rlc_am_entity_t *rlc_pP,
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_am_get_pdus (rlc_am_entity_t *rlc_pP,u32_t frameP)
|
||||
rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
int display_flag = 0;
|
||||
@@ -291,7 +323,13 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP,u32_t frameP)
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] DELAYED SENT STATUS PDU BECAUSE T-STATUS-PROHIBIT RUNNING (TIME-OUT FRAME %05d)\n",frameP, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->t_status_prohibit.frame_time_out);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] DELAYED SENT STATUS PDU BECAUSE T-STATUS-PROHIBIT RUNNING (TIME-OUT FRAME %5u)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->t_status_prohibit.frame_time_out);
|
||||
}
|
||||
}
|
||||
/*while ((rlc_pP->nb_bytes_requested_by_mac > 0) && (stay_on_this_list)) {
|
||||
@@ -300,7 +338,7 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP,u32_t frameP)
|
||||
if ( ((rlc_am_tx_control_pdu_management_t*)(pdu->data))->size <= rlc_pP->nb_bytes_requested_by_mac) {
|
||||
pdu = list_remove_head(&rlc_pP->control_pdu_list);
|
||||
#ifdef TRACE_RLC_AM_TX
|
||||
msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] SEND CONTROL PDU\n", ((rlc_am_entity_t *) rlc_pP)->module_id,((rlc_am_entity_t *) rlc_pP)->rb_id, frameP);
|
||||
msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] SEND CONTROL PDU\n", ((rlc_am_entity_t *) rlc_pP)->module_id,((rlc_am_entity_t *) rlc_pP)->rb_id, frameP);
|
||||
#endif
|
||||
list_add_tail_eurecom (pdu, &rlc_pP->pdus_to_mac_layer);
|
||||
rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - ((rlc_am_tx_control_pdu_management_t*)(pdu->data))->size;
|
||||
@@ -323,7 +361,14 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP,u32_t frameP)
|
||||
|
||||
if ((tx_data_pdu_management->header_and_payload_size <= rlc_pP->nb_bytes_requested_by_mac) && (tx_data_pdu_management->retx_count >= 0) && (tx_data_pdu_management->nack_so_start == 0) && (tx_data_pdu_management->nack_so_stop == 0x7FFF)) {
|
||||
mem_block_t* copy = rlc_am_retransmit_get_copy(rlc_pP, frameP,rlc_pP->first_retrans_pdu_sn);
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] RE-SEND DATA PDU SN %04d %d BYTES\n",frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn, tx_data_pdu_management->header_and_payload_size);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RE-SEND DATA PDU SN %04d %d BYTES\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->first_retrans_pdu_sn,
|
||||
tx_data_pdu_management->header_and_payload_size);
|
||||
rlc_pP->stat_tx_data_pdu += 1;
|
||||
rlc_pP->stat_tx_retransmit_pdu += 1;
|
||||
rlc_pP->stat_tx_retransmit_pdu_by_status += 1;
|
||||
@@ -337,7 +382,12 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP,u32_t frameP)
|
||||
tx_data_pdu_management->retx_count += 1;
|
||||
return;
|
||||
} else if ((tx_data_pdu_management->retx_count >= 0) && (rlc_pP->nb_bytes_requested_by_mac >= RLC_AM_MIN_SEGMENT_SIZE_REQUEST)) {
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] SEND SEGMENT OF DATA PDU SN %04d MAC BYTES %d SIZE %d RTX COUNT %d nack_so_start %d nack_so_stop %04X(hex)\n", frameP, rlc_pP->module_id,rlc_pP->rb_id,
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] SEND SEGMENT OF DATA PDU SN %04d MAC BYTES %d SIZE %d RTX COUNT %d nack_so_start %d nack_so_stop %04X(hex)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->first_retrans_pdu_sn,
|
||||
rlc_pP->nb_bytes_requested_by_mac,
|
||||
tx_data_pdu_management->header_and_payload_size,
|
||||
@@ -346,7 +396,15 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP,u32_t frameP)
|
||||
tx_data_pdu_management->nack_so_stop);
|
||||
|
||||
mem_block_t* copy = rlc_am_retransmit_get_subsegment(rlc_pP, frameP, rlc_pP->first_retrans_pdu_sn, &rlc_pP->nb_bytes_requested_by_mac);
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] SEND SEGMENT OF DATA PDU SN %04d (NEW SO %05d)\n", frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn, tx_data_pdu_management->nack_so_start);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] SEND SEGMENT OF DATA PDU SN %04d (NEW SO %05d)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->first_retrans_pdu_sn,
|
||||
tx_data_pdu_management->nack_so_start);
|
||||
|
||||
rlc_pP->stat_tx_data_pdu += 1;
|
||||
rlc_pP->stat_tx_retransmit_pdu += 1;
|
||||
rlc_pP->stat_tx_retransmit_pdu_by_status += 1;
|
||||
@@ -361,7 +419,13 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP,u32_t frameP)
|
||||
while ((rlc_pP->first_retrans_pdu_sn != rlc_pP->vt_s) &&
|
||||
(!(rlc_pP->pdu_retrans_buffer[rlc_pP->first_retrans_pdu_sn].flags.retransmit))) {
|
||||
rlc_pP->first_retrans_pdu_sn = (rlc_pP->first_retrans_pdu_sn+1) & RLC_AM_SN_MASK;
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] UPDATED first_retrans_pdu_sn SN %04d\n", frameP, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] UPDATED first_retrans_pdu_sn SN %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->first_retrans_pdu_sn);
|
||||
};
|
||||
|
||||
display_flag = 1;
|
||||
@@ -369,17 +433,28 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP,u32_t frameP)
|
||||
// no more pdu to be retransmited
|
||||
rlc_pP->first_retrans_pdu_sn = -1;
|
||||
display_flag = 0;
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] CLEAR first_retrans_pdu_sn\n",frameP, rlc_pP->module_id, rlc_pP->rb_id);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] CLEAR first_retrans_pdu_sn\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
}
|
||||
if (display_flag > 0) {
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] UPDATED first_retrans_pdu_sn %04d\n", frameP, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] UPDATED first_retrans_pdu_sn %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->first_retrans_pdu_sn);
|
||||
}
|
||||
return;
|
||||
|
||||
/* ONLY ONE TB PER TTI
|
||||
if ((tx_data_pdu_management->retx_count >= 0) && (rlc_pP->nb_bytes_requested_by_mac < RLC_AM_MIN_SEGMENT_SIZE_REQUEST)) {
|
||||
#ifdef TRACE_RLC_AM_TX
|
||||
msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BREAK LOOP ON RETRANSMISSION BECAUSE ONLY %d BYTES ALLOWED TO TRANSMIT BY MAC\n",frameP, ((rlc_am_entity_t *) rlc_pP)->module_id,((rlc_am_entity_t *) rlc_pP)->rb_id, rlc_pP->nb_bytes_requested_by_mac);
|
||||
msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BREAK LOOP ON RETRANSMISSION BECAUSE ONLY %d BYTES ALLOWED TO TRANSMIT BY MAC\n",frameP, ((rlc_am_entity_t *) rlc_pP)->module_id,((rlc_am_entity_t *) rlc_pP)->rb_id, rlc_pP->nb_bytes_requested_by_mac);
|
||||
#endif
|
||||
break;
|
||||
}*/
|
||||
@@ -398,7 +473,12 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP,u32_t frameP)
|
||||
rlc_am_retransmit_any_pdu(rlc_pP,frameP);
|
||||
return;
|
||||
} else {
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] COULD NOT RETRANSMIT ANY PDU BECAUSE ",frameP, rlc_pP->module_id, rlc_pP->rb_id);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] COULD NOT RETRANSMIT ANY PDU BECAUSE ",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
if (rlc_pP->pdus_to_mac_layer.head != NULL) {
|
||||
LOG_D(RLC, "THERE ARE SOME PDUS READY TO TRANSMIT ");
|
||||
}
|
||||
@@ -413,21 +493,27 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP,u32_t frameP)
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_DATA_REQ UNKNOWN PROTOCOL STATE 0x%02X\n", frameP, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->protocol_state);
|
||||
LOG_E(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_DATA_REQ UNKNOWN PROTOCOL STATE 0x%02X\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->protocol_state);
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_am_rx (void *argP, u32_t frameP, u8_t eNB_flagP, struct mac_data_ind data_indP)
|
||||
rlc_am_rx (void *arg_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
rlc_am_entity_t *rlc = (rlc_am_entity_t *) argP;
|
||||
rlc_am_entity_t *rlc = (rlc_am_entity_t *) arg_pP;
|
||||
|
||||
switch (rlc->protocol_state) {
|
||||
|
||||
case RLC_NULL_STATE:
|
||||
LOG_N(RLC, "[RLC_AM %p] ERROR MAC_DATA_IND IN RLC_NULL_STATE\n", argP);
|
||||
LOG_N(RLC, "[RLC_AM %p] ERROR MAC_DATA_IND IN RLC_NULL_STATE\n", arg_pP);
|
||||
list_free (&data_indP.data);
|
||||
break;
|
||||
|
||||
@@ -442,7 +528,7 @@ rlc_am_rx (void *argP, u32_t frameP, u8_t eNB_flagP, struct mac_data_ind data_in
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
struct mac_status_resp
|
||||
rlc_am_mac_status_indication (void *rlc_pP, u32 frameP, u16 tb_sizeP, struct mac_status_ind tx_statusP)
|
||||
rlc_am_mac_status_indication (void *rlc_pP, frame_t frameP, u16 tb_sizeP, struct mac_status_ind tx_statusP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
struct mac_status_resp status_resp;
|
||||
@@ -471,36 +557,43 @@ rlc_am_mac_status_indication (void *rlc_pP, u32 frameP, u16 tb_sizeP, struct mac
|
||||
|
||||
if ((rlc->input_sdus[rlc->current_sdu_index].mem_block != NULL) && (status_resp.buffer_occupancy_in_bytes)) {
|
||||
|
||||
//status_resp.buffer_occupancy_in_bytes += ((rlc_am_entity_t *) rlc)->tx_header_min_length_in_bytes;
|
||||
status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu;
|
||||
diff_time = frameP - ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_creation_time;
|
||||
|
||||
status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (u32_t) diff_time : (u32_t)(0xffffffff - diff_time + frameP) ;
|
||||
|
||||
sdu_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_size;
|
||||
sdu_remaining_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_remaining_size;
|
||||
|
||||
status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size;
|
||||
if (sdu_size == sdu_remaining_size) {
|
||||
//status_resp.buffer_occupancy_in_bytes += ((rlc_am_entity_t *) rlc)->tx_header_min_length_in_bytes;
|
||||
status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu;
|
||||
diff_time = frameP - ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_creation_time;
|
||||
|
||||
status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (u32_t) diff_time : (u32_t)(0xffffffff - diff_time + frameP) ;
|
||||
|
||||
sdu_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_size;
|
||||
sdu_remaining_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_remaining_size;
|
||||
|
||||
status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size;
|
||||
if (sdu_size == sdu_remaining_size) {
|
||||
status_resp.head_sdu_is_segmented = 0;
|
||||
}
|
||||
else {
|
||||
status_resp.head_sdu_is_segmented = 1;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
status_resp.head_sdu_is_segmented = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
|
||||
#ifdef TRACE_RLC_AM_TX_STATUS
|
||||
if (tb_sizeP > 0) {
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_STATUS_INDICATION (DATA) %d bytes -> %d bytes\n", frameP, rlc->module_id, rlc->rb_id, tb_sizeP, status_resp.buffer_occupancy_in_bytes);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_STATUS_INDICATION (DATA) %d bytes -> %d bytes\n",
|
||||
frameP,
|
||||
(rlc->is_enb) ? "eNB" : "UE",
|
||||
rlc->enb_module_id,
|
||||
rlc->ue_module_id,
|
||||
rlc->rb_id,
|
||||
tb_sizeP,
|
||||
status_resp.buffer_occupancy_in_bytes);
|
||||
/*if ((tx_statusP.tx_status == MAC_TX_STATUS_SUCCESSFUL) && (tx_statusP.no_pdu)) {
|
||||
msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_STATUS_INDICATION TX STATUS SUCCESSFUL %d PDUs\n",rlc->module_id,
|
||||
msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_STATUS_INDICATION TX STATUS SUCCESSFUL %d PDUs\n",rlc->module_id,
|
||||
rlc->rb_id, frameP, tx_statusP.no_pdu);
|
||||
}
|
||||
if ((tx_statusP.tx_status == MAC_TX_STATUS_UNSUCCESSFUL) && (tx_statusP.no_pdu)) {
|
||||
msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_STATUS_INDICATION TX STATUS UNSUCCESSFUL %d PDUs\n",rlc->module_id, rlc->rb_id,
|
||||
msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_STATUS_INDICATION TX STATUS UNSUCCESSFUL %d PDUs\n",rlc->module_id, rlc->rb_id,
|
||||
frameP, tx_statusP.no_pdu);
|
||||
}*/
|
||||
}
|
||||
@@ -509,7 +602,7 @@ frameP, tx_statusP.no_pdu);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
struct mac_data_req
|
||||
rlc_am_mac_data_request (void *rlc_pP,u32 frameP)
|
||||
rlc_am_mac_data_request (void *rlc_pP, frame_t frameP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
struct mac_data_req data_req;
|
||||
@@ -535,7 +628,13 @@ rlc_am_mac_data_request (void *rlc_pP,u32 frameP)
|
||||
list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data);
|
||||
//((rlc_am_entity_t *) rlc_pP)->tx_pdus += data_req.data.nb_elements;
|
||||
if ((nb_bytes_requested_by_mac + data_req.data.nb_elements) > 0) {
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_DATA_REQUEST %05d BYTES REQUESTED -> %d TBs\n", frameP, l_rlc_p->module_id,l_rlc_p->rb_id, nb_bytes_requested_by_mac, data_req.data.nb_elements);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_DATA_REQUEST %05d BYTES REQUESTED -> %d TBs\n",
|
||||
frameP,
|
||||
(l_rlc_p->is_enb) ? "eNB" : "UE",
|
||||
l_rlc_p->enb_module_id,
|
||||
l_rlc_p->ue_module_id,
|
||||
nb_bytes_requested_by_mac,
|
||||
data_req.data.nb_elements);
|
||||
}
|
||||
data_req.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(l_rlc_p,frameP);
|
||||
data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state;
|
||||
@@ -654,7 +753,7 @@ rlc_am_mac_data_request (void *rlc_pP,u32 frameP)
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_am_mac_data_indication (void *rlc_pP, u32_t frameP, u8 eNB_flagP, struct mac_data_ind data_indP)
|
||||
rlc_am_mac_data_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
rlc_am_entity_t *l_rlc_p = (rlc_am_entity_t *) rlc_pP;
|
||||
@@ -789,7 +888,7 @@ rlc_am_mac_data_indication (void *rlc_pP, u32_t frameP, u8 eNB_flagP, struct mac
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_am_data_req (void *rlc_pP, u32_t frameP, mem_block_t * sdu_pP)
|
||||
rlc_am_data_req (void *rlc_pP, frame_t frameP, mem_block_t * sdu_pP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
rlc_am_entity_t *rlc_p = (rlc_am_entity_t *) rlc_pP;
|
||||
@@ -838,12 +937,44 @@ rlc_am_data_req (void *rlc_pP, u32_t frameP, mem_block_t * sdu_pP)
|
||||
rlc_p->input_sdus[rlc_p->next_sdu_index].flags.no_new_sdu_segmented_in_last_pdu = 0;
|
||||
//rlc_p->input_sdus[rlc_p->next_sdu_index].li_index_for_discard = -1;
|
||||
rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
|
||||
LOG_I(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] RLC_AM_DATA_REQ size %d Bytes, NB SDU %d current_sdu_index=%d next_sdu_index=%d conf %d mui %d\n", frameP, rlc_p->module_id, rlc_p->rb_id, data_size, rlc_p->nb_sdu, rlc_p->current_sdu_index, rlc_p->next_sdu_index, conf, mui);
|
||||
LOG_I(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RLC_AM_DATA_REQ size %d Bytes, NB SDU %d current_sdu_index=%d next_sdu_index=%d conf %d mui %d\n",
|
||||
frameP,
|
||||
(rlc_p->is_enb) ? "eNB" : "UE",
|
||||
rlc_p->enb_module_id,
|
||||
rlc_p->ue_module_id,
|
||||
rlc_p->rb_id,
|
||||
data_size,
|
||||
rlc_p->nb_sdu,
|
||||
rlc_p->current_sdu_index,
|
||||
rlc_p->next_sdu_index,
|
||||
conf,
|
||||
mui);
|
||||
} else {
|
||||
LOG_W(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] RLC_AM_DATA_REQ BUFFER FULL, NB SDU %d current_sdu_index=%d next_sdu_index=%d size_input_sdus_buffer=%d\n", frameP, rlc_p->module_id, rlc_p->rb_id, rlc_p->nb_sdu, rlc_p->current_sdu_index, rlc_p->next_sdu_index, RLC_AM_SDU_CONTROL_BUFFER_SIZE);
|
||||
LOG_W(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RLC_AM_DATA_REQ BUFFER FULL, NB SDU %d current_sdu_index=%d next_sdu_index=%d size_input_sdus_buffer=%d\n",
|
||||
frameP,
|
||||
(rlc_p->is_enb) ? "eNB" : "UE",
|
||||
rlc_p->enb_module_id,
|
||||
rlc_p->ue_module_id,
|
||||
rlc_p->rb_id,
|
||||
rlc_p->nb_sdu,
|
||||
rlc_p->current_sdu_index,
|
||||
rlc_p->next_sdu_index,
|
||||
RLC_AM_SDU_CONTROL_BUFFER_SIZE);
|
||||
LOG_W(RLC, " input_sdus[].mem_block=%p next input_sdus[].flags.segmented=%d\n", rlc_p->input_sdus[rlc_p->next_sdu_index].mem_block, rlc_p->input_sdus[rlc_p->next_sdu_index].flags.segmented);
|
||||
rlc_p->stat_tx_pdcp_sdu_discarded += 1;
|
||||
rlc_p->stat_tx_pdcp_bytes_discarded += ((struct rlc_am_data_req *) (sdu_pP->data))->data_size;
|
||||
free_mem_block (sdu_pP);
|
||||
#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD)
|
||||
AssertFatal(0, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RLC_AM_DATA_REQ size %d Bytes, SDU DROPPED, INPUT BUFFER OVERFLOW NB SDU %d current_sdu_index=%d next_sdu_index=%d \n",
|
||||
frameP,
|
||||
(rlc_p->is_enb) ? "eNB" : "UE",
|
||||
rlc_p->enb_module_id,
|
||||
rlc_p->ue_module_id,
|
||||
rlc_p->rb_id,
|
||||
data_size,
|
||||
rlc_p->nb_sdu,
|
||||
rlc_p->current_sdu_index,
|
||||
rlc_p->next_sdu_index);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,29 +96,29 @@ public_rlc_am(void rlc_am_release (rlc_am_entity_t *rlcP);)
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*! \fn void config_req_rlc_am (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
/*! \fn void config_req_rlc_am (u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
* \brief Configure the UL and DL parameters of the RLC AM
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] enb_module_idP eNB Virtualized module identifier.
|
||||
* \param[in] ue_module_idP UE Virtualized module identifier.
|
||||
* \param[in] config_amP Configuration parameters for RLC AM instance.
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
|
||||
*/
|
||||
public_rlc_am(void config_req_rlc_am (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP);)
|
||||
public_rlc_am(void config_req_rlc_am (u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP);)
|
||||
|
||||
/*! \fn void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
/*! \fn void config_req_rlc_am_asn1 (u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
* \brief Configure the UL and DL parameters of the RLC AM with the asn1c autogenerated pameters structs
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] enb_module_idP eNB Virtualized module identifier.
|
||||
* \param[in] ue_module_idP UE Virtualized module identifier.
|
||||
* \param[in] config_amP Configuration parameters for RLC AM instance.
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
|
||||
*/
|
||||
public_rlc_am(void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP);)
|
||||
public_rlc_am(void config_req_rlc_am_asn1 (u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP);)
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -55,19 +55,21 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
* \brief Structure containing a RLC AM instance protocol variables, statistic variables, allocation variables, buffers and other miscellaneous variables.
|
||||
*/
|
||||
typedef struct rlc_am_entity {
|
||||
module_id_t module_id; /*!< \brief Virtualization index for this protocol instance, means handset or eNB index. */
|
||||
u16_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */
|
||||
boolean_t is_data_plane; /*!< \brief To know if the RLC belongs to a data radio bearer or a signalling radio bearer, for statistics and trace purpose. */
|
||||
boolean_t is_enb; /*!< \brief To know if the RLC belongs to a eNB or UE. */
|
||||
module_id_t enb_module_id; /*!< \brief eNB Virtualization index for this protocol instance, meaningful if is_enb is set. */
|
||||
module_id_t ue_module_id; /*!< \brief UE Virtualization index for this protocol instance. */
|
||||
rb_id_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */
|
||||
logical_chan_id_t channel_id; /*!< \brief Transport channel identifier. */
|
||||
boolean_t is_data_plane; /*!< \brief To know if the RLC belongs to a data radio bearer or a signalling radio bearer, for statistics and trace purpose. */
|
||||
boolean_t is_enb; /*!< \brief To know if the RLC belongs to a eNB or UE. */
|
||||
|
||||
signed int sdu_buffer_occupancy; /*!< \brief Number of bytes of unsegmented SDUs. */
|
||||
signed int retransmission_buffer_occupancy; /*!< \brief Number of bytes of PDUs in retransmission buffer waiting for a ACK. */
|
||||
signed int status_buffer_occupancy; /*!< \brief Number of bytes of control PDUs waiting for transmission. */
|
||||
signed int sdu_buffer_occupancy; /*!< \brief Number of bytes of unsegmented SDUs. */
|
||||
signed int retransmission_buffer_occupancy; /*!< \brief Number of bytes of PDUs in retransmission buffer waiting for a ACK. */
|
||||
signed int status_buffer_occupancy; /*!< \brief Number of bytes of control PDUs waiting for transmission. */
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// TX BUFFERS
|
||||
//---------------------------------------------------------------------
|
||||
mem_block_t* input_sdus_alloc; /*!< \brief Allocated memory for the input SDU buffer (for SDUs coming from upper layers). */
|
||||
mem_block_t* input_sdus_alloc; /*!< \brief Allocated memory for the input SDU buffer (for SDUs coming from upper layers). */
|
||||
rlc_am_tx_sdu_management_t *input_sdus; /*!< \brief Input SDU buffer (for SDUs coming from upper layers). */
|
||||
signed int nb_sdu; /*!< \brief Total number of valid rlc_am_tx_sdu_management_t in input_sdus[]. */
|
||||
signed int nb_sdu_no_segmented; /*!< \brief Total number of SDUs not segmented and partially segmented. */
|
||||
@@ -88,7 +90,7 @@ typedef struct rlc_am_entity {
|
||||
//---------------------------------------------------------------------
|
||||
list2_t receiver_buffer; /*!< \brief Receiver buffer implemented with a list. */
|
||||
mem_block_t *output_sdu_in_construction; /*!< \brief Memory area where a complete SDU is reassemblied before being send to upper layers. */
|
||||
s32_t output_sdu_size_to_write; /*!< \brief Size of the reassemblied SDU. */
|
||||
sdu_size_t output_sdu_size_to_write; /*!< \brief Size of the reassemblied SDU. */
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
@@ -98,19 +100,19 @@ typedef struct rlc_am_entity {
|
||||
//-----------------------------
|
||||
// TX STATE VARIABLES
|
||||
//-----------------------------
|
||||
u16_t vt_a; /*!< \brief Acknowledgement state variable. This state variable holds the value of the SN of the next AMD PDU for which a positive acknowledgment is to be received in-sequence, and it serves as the lower edge of the transmitting window. It is initially set to 0, and is updated whenever the AM RLC entity receives a positive acknowledgment for an AMD PDU with SN = VT(A).*/
|
||||
u16_t vt_ms; /*!< \brief Maximum send state variable. This state variable equals VT(A) + AM_Window_Size, and it serves as the higher edge of the transmitting window. */
|
||||
u16_t vt_s; /*!< \brief Send state variable. This state variable holds the value of the SN to be assigned for the next newly generated AMD PDU. It is initially set to 0, and is updated whenever the AM RLC entity delivers an AMD PDU with SN = VT(S).*/
|
||||
u16_t poll_sn; /*!< \brief Poll send state variable. This state variable holds the value of VT(S)-1 upon the most recent transmission of a RLC data PDU with the poll bit set to “1”. It is initially set to 0.*/
|
||||
rlc_usn_t vt_a; /*!< \brief Acknowledgement state variable. This state variable holds the value of the SN of the next AMD PDU for which a positive acknowledgment is to be received in-sequence, and it serves as the lower edge of the transmitting window. It is initially set to 0, and is updated whenever the AM RLC entity receives a positive acknowledgment for an AMD PDU with SN = VT(A).*/
|
||||
rlc_usn_t vt_ms; /*!< \brief Maximum send state variable. This state variable equals VT(A) + AM_Window_Size, and it serves as the higher edge of the transmitting window. */
|
||||
rlc_usn_t vt_s; /*!< \brief Send state variable. This state variable holds the value of the SN to be assigned for the next newly generated AMD PDU. It is initially set to 0, and is updated whenever the AM RLC entity delivers an AMD PDU with SN = VT(S).*/
|
||||
rlc_usn_t poll_sn; /*!< \brief Poll send state variable. This state variable holds the value of VT(S)-1 upon the most recent transmission of a RLC data PDU with the poll bit set to “1”. It is initially set to 0.*/
|
||||
|
||||
//-----------------------------
|
||||
// RX STATE VARIABLES
|
||||
//-----------------------------
|
||||
u16_t vr_r; /*!< \brief Receive state variable. This state variable holds the value of the SN following the last in-sequence completely received AMD PDU, and it serves as the lower edge of the receiving window. It is initially set to 0, and is updated whenever the AM RLC entity receives an AMD PDU with SN = VR(R). */
|
||||
u16_t vr_mr; /*!< \brief Maximum acceptable receive state variable. This state variable equals VR(R) + AM_Window_Size, and it holds the value of the SN of the first AMD PDU that is beyond the receiving window and serves as the higher edge of the receiving window. */
|
||||
u16_t vr_x; /*!< \brief t-Reordering state variable. This state variable holds the value of the SN following the SN of the RLC data PDU which triggered t-Reordering. */
|
||||
u16_t vr_ms; /*!< \brief Maximum STATUS transmit state variable. This state variable holds the highest possible value of the SN which can be indicated by “ACK_SN” when a STATUS PDU needs to be constructed. It is initially set to 0. */
|
||||
u16_t vr_h; /*!< \brief Highest received state variable. This state variable holds the value of the SN following the SN of the RLC data PDU with the highest SN among received RLC data PDUs. It is initially set to 0. */
|
||||
rlc_usn_t vr_r; /*!< \brief Receive state variable. This state variable holds the value of the SN following the last in-sequence completely received AMD PDU, and it serves as the lower edge of the receiving window. It is initially set to 0, and is updated whenever the AM RLC entity receives an AMD PDU with SN = VR(R). */
|
||||
rlc_usn_t vr_mr; /*!< \brief Maximum acceptable receive state variable. This state variable equals VR(R) + AM_Window_Size, and it holds the value of the SN of the first AMD PDU that is beyond the receiving window and serves as the higher edge of the receiving window. */
|
||||
rlc_usn_t vr_x; /*!< \brief t-Reordering state variable. This state variable holds the value of the SN following the SN of the RLC data PDU which triggered t-Reordering. */
|
||||
rlc_usn_t vr_ms; /*!< \brief Maximum STATUS transmit state variable. This state variable holds the highest possible value of the SN which can be indicated by “ACK_SN” when a STATUS PDU needs to be constructed. It is initially set to 0. */
|
||||
rlc_usn_t vr_h; /*!< \brief Highest received state variable. This state variable holds the value of the SN following the SN of the RLC data PDU with the highest SN among received RLC data PDUs. It is initially set to 0. */
|
||||
|
||||
//-----------------------------
|
||||
// TIMERS CONFIGURED BY RRC
|
||||
@@ -183,12 +185,7 @@ typedef struct rlc_am_entity {
|
||||
// note occupancy of other buffers is deducted from nb elements in lists
|
||||
u32_t buffer_occupancy_retransmission_buffer; /*!< \brief Number of PDUs. */
|
||||
|
||||
//**************************************************************
|
||||
// new members
|
||||
//**************************************************************
|
||||
u8_t allocation; /*!< \brief Boolean for rlc_am_entity_t struct allocation. */
|
||||
u8_t location; /*!< \brief EnodeB / UE. */
|
||||
|
||||
} rlc_am_entity_t;
|
||||
/** @} */
|
||||
# endif
|
||||
|
||||
@@ -42,7 +42,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
|
||||
#define TRACE_RLC_AM_FREE_SDU
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_free_in_sdu(rlc_am_entity_t *rlcP, u32_t frame, unsigned int index_in_bufferP)
|
||||
void rlc_am_free_in_sdu(rlc_am_entity_t *rlcP, frame_t frameP, unsigned int index_in_bufferP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
|
||||
@@ -65,7 +65,16 @@ void rlc_am_free_in_sdu(rlc_am_entity_t *rlcP, u32_t frame, unsigned int index_i
|
||||
}
|
||||
}
|
||||
#ifdef TRACE_RLC_AM_FREE_SDU
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][FREE SDU] SDU INDEX %03d current_sdu_index=%d next_sdu_index=%d nb_sdu_no_segmented=%d\n", frame, rlcP->module_id, rlcP->rb_id, index_in_bufferP, rlcP->current_sdu_index, rlcP->next_sdu_index, rlcP->nb_sdu_no_segmented);
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][FREE SDU] SDU INDEX %03d current_sdu_index=%d next_sdu_index=%d nb_sdu_no_segmented=%d\n",
|
||||
frameP,
|
||||
(rlcP->is_enb) ? "eNB" : "UE",
|
||||
rlcP->enb_module_id,
|
||||
rlcP->ue_module_id,
|
||||
rlcP->rb_id,
|
||||
index_in_bufferP,
|
||||
rlcP->current_sdu_index,
|
||||
rlcP->next_sdu_index,
|
||||
rlcP->nb_sdu_no_segmented);
|
||||
#endif
|
||||
}
|
||||
// called when segmentation is done
|
||||
|
||||
@@ -57,14 +57,14 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# define public_rlc_am_in_sdu(x) extern x
|
||||
# endif
|
||||
# endif
|
||||
/*! \fn void rlc_am_free_in_sdu (rlc_am_entity_t *rlcP, u32_t frame, unsigned int index_in_bufferP)
|
||||
/*! \fn void rlc_am_free_in_sdu (rlc_am_entity_t *rlcP, frame_t frameP, unsigned int index_in_bufferP)
|
||||
* \brief Free a higher layer SDU stored in input_sdus[] buffer.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] index_in_bufferP Position index of the SDU.
|
||||
* \note Update also the RLC AM instance variables nb_sdu, current_sdu_index, nb_sdu_no_segmented.
|
||||
*/
|
||||
protected_rlc_am_in_sdu(void rlc_am_free_in_sdu (rlc_am_entity_t *rlcP, u32_t frame, unsigned int index_in_bufferP);)
|
||||
protected_rlc_am_in_sdu(void rlc_am_free_in_sdu (rlc_am_entity_t *rlcP, frame_t frameP, unsigned int index_in_bufferP);)
|
||||
|
||||
|
||||
/*! \fn void rlc_am_free_in_sdu_data (rlc_am_entity_t *rlcP, unsigned int index_in_bufferP)
|
||||
|
||||
@@ -36,119 +36,152 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_init(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
void rlc_am_init(rlc_am_entity_t *rlc_pP, frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
int saved_allocation = rlcP->allocation;
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD XX][RB XX][INIT] STATE VARIABLES, BUFFERS, LISTS\n", frame);
|
||||
memset(rlcP, 0, sizeof(rlc_am_entity_t));
|
||||
rlcP->allocation = saved_allocation;
|
||||
int saved_allocation = rlc_pP->allocation;
|
||||
LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] STATE VARIABLES, BUFFERS, LISTS\n", frameP);
|
||||
memset(rlc_pP, 0, sizeof(rlc_am_entity_t));
|
||||
rlc_pP->allocation = saved_allocation;
|
||||
|
||||
list2_init(&rlcP->receiver_buffer, "RX BUFFER");
|
||||
list_init(&rlcP->pdus_to_mac_layer, "PDUS TO MAC");
|
||||
list_init(&rlcP->control_pdu_list, "CONTROL PDU LIST");
|
||||
list_init(&rlcP->segmentation_pdu_list, "SEGMENTATION PDU LIST");
|
||||
list2_init(&rlc_pP->receiver_buffer, "RX BUFFER");
|
||||
list_init(&rlc_pP->pdus_to_mac_layer, "PDUS TO MAC");
|
||||
list_init(&rlc_pP->control_pdu_list, "CONTROL PDU LIST");
|
||||
list_init(&rlc_pP->segmentation_pdu_list, "SEGMENTATION PDU LIST");
|
||||
//LOG_D(RLC,"RLC_AM_SDU_CONTROL_BUFFER_SIZE %d sizeof(rlc_am_tx_sdu_management_t) %d \n", RLC_AM_SDU_CONTROL_BUFFER_SIZE, sizeof(rlc_am_tx_sdu_management_t));
|
||||
|
||||
rlcP->input_sdus_alloc = get_free_mem_block(RLC_AM_SDU_CONTROL_BUFFER_SIZE*sizeof(rlc_am_tx_sdu_management_t));
|
||||
rlcP->input_sdus = (rlc_am_tx_sdu_management_t*)((rlcP->input_sdus_alloc)->data);
|
||||
rlcP->pdu_retrans_buffer_alloc = get_free_mem_block((u16_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(rlc_am_tx_data_pdu_management_t)));
|
||||
rlcP->pdu_retrans_buffer = (rlc_am_tx_data_pdu_management_t*)((rlcP->pdu_retrans_buffer_alloc)->data);
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD XX][RB XX][INIT] input_sdus[] = %p element size=%d\n", frame, rlcP->input_sdus,sizeof(rlc_am_tx_sdu_management_t));
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD XX][RB XX][INIT] pdu_retrans_buffer[] = %p element size=%d\n", frame, rlcP->pdu_retrans_buffer,sizeof(rlc_am_tx_data_pdu_management_t));
|
||||
rlc_pP->input_sdus_alloc = get_free_mem_block(RLC_AM_SDU_CONTROL_BUFFER_SIZE*sizeof(rlc_am_tx_sdu_management_t));
|
||||
rlc_pP->input_sdus = (rlc_am_tx_sdu_management_t*)((rlc_pP->input_sdus_alloc)->data);
|
||||
rlc_pP->pdu_retrans_buffer_alloc = get_free_mem_block((u16_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(rlc_am_tx_data_pdu_management_t)));
|
||||
rlc_pP->pdu_retrans_buffer = (rlc_am_tx_data_pdu_management_t*)((rlc_pP->pdu_retrans_buffer_alloc)->data);
|
||||
LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] input_sdus[] = %p element size=%d\n", frameP, rlc_pP->input_sdus,sizeof(rlc_am_tx_sdu_management_t));
|
||||
LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] pdu_retrans_buffer[] = %p element size=%d\n", frameP, rlc_pP->pdu_retrans_buffer,sizeof(rlc_am_tx_data_pdu_management_t));
|
||||
|
||||
// TX state variables
|
||||
//rlcP->vt_a = 0;
|
||||
rlcP->vt_ms = rlcP->vt_a + RLC_AM_WINDOW_SIZE;
|
||||
//rlcP->vt_s = 0;
|
||||
//rlcP->poll_sn = 0;
|
||||
//rlc_pP->vt_a = 0;
|
||||
rlc_pP->vt_ms = rlc_pP->vt_a + RLC_AM_WINDOW_SIZE;
|
||||
//rlc_pP->vt_s = 0;
|
||||
//rlc_pP->poll_sn = 0;
|
||||
// TX counters
|
||||
//rlcP->c_pdu_without_poll = 0;
|
||||
//rlcP->c_byte_without_poll = 0;
|
||||
//rlc_pP->c_pdu_without_poll = 0;
|
||||
//rlc_pP->c_byte_without_poll = 0;
|
||||
// RX state variables
|
||||
//rlcP->vr_r = 0;
|
||||
rlcP->vr_mr = rlcP->vr_r + RLC_AM_WINDOW_SIZE;
|
||||
//rlcP->vr_x = 0;
|
||||
//rlcP->vr_ms = 0;
|
||||
//rlcP->vr_h = 0;
|
||||
//rlc_pP->vr_r = 0;
|
||||
rlc_pP->vr_mr = rlc_pP->vr_r + RLC_AM_WINDOW_SIZE;
|
||||
//rlc_pP->vr_x = 0;
|
||||
//rlc_pP->vr_ms = 0;
|
||||
//rlc_pP->vr_h = 0;
|
||||
|
||||
rlcP->last_frame_status_indication = 123456; // any value > 1
|
||||
rlcP->first_retrans_pdu_sn = -1;
|
||||
rlc_pP->last_frame_status_indication = 123456; // any value > 1
|
||||
rlc_pP->first_retrans_pdu_sn = -1;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_cleanup(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
void rlc_am_cleanup(rlc_am_entity_t *rlc_pP, frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
LOG_I(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][CLEANUP]\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
LOG_I(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][CLEANUP]\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
|
||||
list2_free(&rlcP->receiver_buffer);
|
||||
list_free(&rlcP->pdus_to_mac_layer);
|
||||
list_free(&rlcP->control_pdu_list);
|
||||
list_free(&rlcP->segmentation_pdu_list);
|
||||
list2_free(&rlc_pP->receiver_buffer);
|
||||
list_free(&rlc_pP->pdus_to_mac_layer);
|
||||
list_free(&rlc_pP->control_pdu_list);
|
||||
list_free(&rlc_pP->segmentation_pdu_list);
|
||||
|
||||
|
||||
if (rlcP->output_sdu_in_construction != NULL) {
|
||||
free_mem_block(rlcP->output_sdu_in_construction);
|
||||
rlcP->output_sdu_in_construction = NULL;
|
||||
if (rlc_pP->output_sdu_in_construction != NULL) {
|
||||
free_mem_block(rlc_pP->output_sdu_in_construction);
|
||||
rlc_pP->output_sdu_in_construction = NULL;
|
||||
}
|
||||
unsigned int i;
|
||||
if (rlcP->input_sdus_alloc != NULL) {
|
||||
if (rlc_pP->input_sdus_alloc != NULL) {
|
||||
for (i=0; i < RLC_AM_SDU_CONTROL_BUFFER_SIZE; i++) {
|
||||
if (rlcP->input_sdus[i].mem_block != NULL) {
|
||||
free_mem_block(rlcP->input_sdus[i].mem_block);
|
||||
rlcP->input_sdus[i].mem_block = NULL;
|
||||
if (rlc_pP->input_sdus[i].mem_block != NULL) {
|
||||
free_mem_block(rlc_pP->input_sdus[i].mem_block);
|
||||
rlc_pP->input_sdus[i].mem_block = NULL;
|
||||
}
|
||||
}
|
||||
free_mem_block(rlcP->input_sdus_alloc);
|
||||
rlcP->input_sdus_alloc = NULL;
|
||||
rlcP->input_sdus = NULL;
|
||||
free_mem_block(rlc_pP->input_sdus_alloc);
|
||||
rlc_pP->input_sdus_alloc = NULL;
|
||||
rlc_pP->input_sdus = NULL;
|
||||
}
|
||||
if (rlcP->pdu_retrans_buffer_alloc != NULL) {
|
||||
if (rlc_pP->pdu_retrans_buffer_alloc != NULL) {
|
||||
for (i=0; i < RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE; i++) {
|
||||
if (rlcP->pdu_retrans_buffer[i].mem_block != NULL) {
|
||||
free_mem_block(rlcP->pdu_retrans_buffer[i].mem_block);
|
||||
rlcP->pdu_retrans_buffer[i].mem_block = NULL;
|
||||
if (rlc_pP->pdu_retrans_buffer[i].mem_block != NULL) {
|
||||
free_mem_block(rlc_pP->pdu_retrans_buffer[i].mem_block);
|
||||
rlc_pP->pdu_retrans_buffer[i].mem_block = NULL;
|
||||
}
|
||||
}
|
||||
free_mem_block(rlcP->pdu_retrans_buffer_alloc);
|
||||
rlcP->pdu_retrans_buffer_alloc = NULL;
|
||||
rlcP->pdu_retrans_buffer = NULL;
|
||||
free_mem_block(rlc_pP->pdu_retrans_buffer_alloc);
|
||||
rlc_pP->pdu_retrans_buffer_alloc = NULL;
|
||||
rlc_pP->pdu_retrans_buffer = NULL;
|
||||
}
|
||||
memset(rlc_pP, 0, sizeof(rlc_am_entity_t));
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_configure(rlc_am_entity_t *rlcP,
|
||||
u32_t frame,
|
||||
u16_t max_retx_thresholdP,
|
||||
u16_t poll_pduP,
|
||||
u16_t poll_byteP,
|
||||
u32_t t_poll_retransmitP,
|
||||
u32_t t_reorderingP,
|
||||
u32_t t_status_prohibitP)
|
||||
void rlc_am_configure(rlc_am_entity_t *rlc_pP,
|
||||
frame_t frameP,
|
||||
u16_t max_retx_thresholdP,
|
||||
u16_t poll_pduP,
|
||||
u16_t poll_byteP,
|
||||
u32_t t_poll_retransmitP,
|
||||
u32_t t_reorderingP,
|
||||
u32_t t_status_prohibitP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
LOG_I(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][CONFIGURE] max_retx_threshold %d poll_pdu %d poll_byte %d t_poll_retransmit %d t_reordering %d t_status_prohibit %d\n", frame, rlcP->module_id, rlcP->rb_id, max_retx_thresholdP, poll_pduP, poll_byteP, t_poll_retransmitP, t_reorderingP, t_status_prohibitP);
|
||||
LOG_I(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][CONFIGURE] max_retx_threshold %d poll_pdu %d poll_byte %d t_poll_retransmit %d t_reordering %d t_status_prohibit %d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
max_retx_thresholdP,
|
||||
poll_pduP,
|
||||
poll_byteP,
|
||||
t_poll_retransmitP,
|
||||
t_reorderingP,
|
||||
t_status_prohibitP);
|
||||
|
||||
rlcP->max_retx_threshold = max_retx_thresholdP;
|
||||
rlcP->poll_pdu = poll_pduP;
|
||||
rlcP->poll_byte = poll_byteP;
|
||||
rlcP->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
|
||||
rlc_pP->max_retx_threshold = max_retx_thresholdP;
|
||||
rlc_pP->poll_pdu = poll_pduP;
|
||||
rlc_pP->poll_byte = poll_byteP;
|
||||
rlc_pP->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
|
||||
|
||||
rlc_am_init_timer_poll_retransmit(rlcP, t_poll_retransmitP);
|
||||
rlc_am_init_timer_reordering (rlcP, t_reorderingP);
|
||||
rlc_am_init_timer_status_prohibit(rlcP, t_status_prohibitP);
|
||||
rlc_am_init_timer_poll_retransmit(rlc_pP, t_poll_retransmitP);
|
||||
rlc_am_init_timer_reordering (rlc_pP, t_reorderingP);
|
||||
rlc_am_init_timer_status_prohibit(rlc_pP, t_status_prohibitP);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_set_debug_infos(rlc_am_entity_t *rlcP, u32 frame, u8_t eNB_flagP, module_id_t module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
void rlc_am_set_debug_infos(rlc_am_entity_t *rlc_pP,
|
||||
frame_t frameP,
|
||||
eNB_flag_t eNB_flagP,
|
||||
module_id_t enb_module_idP,
|
||||
module_id_t ue_module_idP,
|
||||
rb_id_t rb_idP,
|
||||
rb_type_t rb_typeP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SET DEBUG INFOS] module_id %d rb_id %d rb_type %d\n", frame, module_idP, rb_idP, module_idP, rb_idP, rb_typeP);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SET DEBUG INFOS] module_id %d rb_id %d rb_type %d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rb_idP,
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
rb_idP,
|
||||
rb_typeP);
|
||||
|
||||
rlcP->module_id = module_idP;
|
||||
rlcP->rb_id = rb_idP;
|
||||
rlc_pP->enb_module_id = enb_module_idP;
|
||||
rlc_pP->ue_module_id = ue_module_idP;
|
||||
rlc_pP->rb_id = rb_idP;
|
||||
if (rb_typeP != SIGNALLING_RADIO_BEARER) {
|
||||
rlcP->is_data_plane = 1;
|
||||
rlc_pP->is_data_plane = 1;
|
||||
} else {
|
||||
rlcP->is_data_plane = 0;
|
||||
rlc_pP->is_data_plane = 0;
|
||||
}
|
||||
rlcP->is_enb = eNB_flagP;
|
||||
rlc_pP->is_enb = eNB_flagP;
|
||||
}
|
||||
|
||||
@@ -78,23 +78,23 @@ typedef volatile struct {
|
||||
} rlc_am_info_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/*! \fn void rlc_am_init (rlc_am_entity_t* rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_init (rlc_am_entity_t* rlc_pP,frame_t frameP)
|
||||
* \brief Initialize the RLC AM protocol instance, reset variables, allocate buffers, lists, then, the next step in order have a running RLC AM instance is to configure and set debug informations for this RLC instance.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
*/
|
||||
public_rlc_am_init( void rlc_am_init (rlc_am_entity_t* rlcP,u32_t frame);)
|
||||
public_rlc_am_init( void rlc_am_init (rlc_am_entity_t* rlc_pP,frame_t frameP);)
|
||||
|
||||
/*! \fn void rlc_am_cleanup(rlc_am_entity_t* rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_cleanup(rlc_am_entity_t* rlc_pP,frame_t frameP)
|
||||
* \brief Free all memory resources allocated and kept by this RLC AM instance.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
*/
|
||||
public_rlc_am_init( void rlc_am_cleanup(rlc_am_entity_t* rlcP,u32_t frame);)
|
||||
public_rlc_am_init( void rlc_am_cleanup(rlc_am_entity_t* rlc_pP,frame_t frameP);)
|
||||
|
||||
/*! \fn void rlc_am_configure(rlc_am_entity_t *rlcP, u32_t frame, u16_t max_retx_thresholdP, u16_t poll_pduP, u16_t poll_byteP, u32_t t_poll_retransmitP, u32_t t_reorderingP, u32_t t_status_prohibitP)
|
||||
/*! \fn void rlc_am_configure(rlc_am_entity_t *rlc_pP, frame_t frameP, u16_t max_retx_thresholdP, u16_t poll_pduP, u16_t poll_byteP, u32_t t_poll_retransmitP, u32_t t_reorderingP, u32_t t_status_prohibitP)
|
||||
* \brief Set RLC AM protocol parameters.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
* \param[in] max_retx_thresholdP Limit the number of retransmissions of an
|
||||
AMD PDU.
|
||||
@@ -104,8 +104,8 @@ AMD PDU.
|
||||
* \param[in] t_reorderingP This timer is used by the receiving side of an AM RLC entity in order to detect loss of RLC PDUs at lower layer, value in frames.
|
||||
* \param[in] t_status_prohibitP This timer is used by the receiving side of an AM RLC entity in order to prohibit transmission of a STATUS PDU, value in frames.
|
||||
*/
|
||||
public_rlc_am_init( void rlc_am_configure(rlc_am_entity_t *rlcP,
|
||||
u32_t frame,
|
||||
public_rlc_am_init( void rlc_am_configure(rlc_am_entity_t *rlc_pP,
|
||||
frame_t frameP,
|
||||
u16_t max_retx_thresholdP,
|
||||
u16_t poll_pduP,
|
||||
u16_t poll_byteP,
|
||||
@@ -113,15 +113,16 @@ public_rlc_am_init( void rlc_am_configure(rlc_am_entity_t *rlcP,
|
||||
u32_t t_reorderingP,
|
||||
u32_t t_status_prohibitP);)
|
||||
|
||||
/*! \fn void rlc_am_set_debug_infos(rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
/*! \fn void rlc_am_set_debug_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
* \brief Set informations that will be displayed in traces, helping the debug process.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] module_idP Virtualization variable, module identifier.
|
||||
* \param[in] enb_module_idP eNB Virtualization variable, module identifier.
|
||||
* \param[in] ue_module_idP UE Virtualization variable, module identifier.
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] rb_typeP Radio bearer type (Signalling or data).
|
||||
*/
|
||||
public_rlc_am_init( void rlc_am_set_debug_infos(rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rb_id_t rb_idP, rb_type_t rb_typeP);)
|
||||
public_rlc_am_init( void rlc_am_set_debug_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP);)
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
@@ -25,11 +25,12 @@ Openair Tech : openair_tech@eurecom.fr
|
||||
Forums : http://forums.eurecom.fsr/openairinterface
|
||||
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
|
||||
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
#define RLC_AM_MODULE
|
||||
#define RLC_AM_REASSEMBLY_C
|
||||
#include "platform_types.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "assertions.h"
|
||||
#include "rlc.h"
|
||||
#include "rlc_am.h"
|
||||
#include "list.h"
|
||||
@@ -38,221 +39,301 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
|
||||
//#define TRACE_RLC_AM_RX_DECODE
|
||||
//-----------------------------------------------------------------------------
|
||||
inline void rlc_am_clear_rx_sdu (rlc_am_entity_t *rlcP)
|
||||
inline void rlc_am_clear_rx_sdu (rlc_am_entity_t *rlc_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_reassembly (u8_t * srcP, s32_t lengthP, rlc_am_entity_t *rlcP, u32_t frame)
|
||||
void rlc_am_reassembly (u8_t * src_pP, s32_t lengthP, rlc_am_entity_t *rlc_pP, frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][REASSEMBLY PAYLOAD] reassembly() %d bytes\n", frame, rlcP->module_id, rlcP->rb_id, lengthP);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PAYLOAD] reassembly() %d bytes\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
lengthP);
|
||||
|
||||
if (rlcP->output_sdu_in_construction == NULL) {
|
||||
rlcP->output_sdu_in_construction = get_free_mem_block (RLC_SDU_MAX_SIZE);
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
assert(rlcP->output_sdu_in_construction != NULL);
|
||||
if (rlc_pP->output_sdu_in_construction == NULL) {
|
||||
rlc_pP->output_sdu_in_construction = get_free_mem_block (RLC_SDU_MAX_SIZE);
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
assert(rlc_pP->output_sdu_in_construction != NULL);
|
||||
}
|
||||
if (rlcP->output_sdu_in_construction != NULL) {
|
||||
if (rlc_pP->output_sdu_in_construction != NULL) {
|
||||
|
||||
// check if no overflow in size
|
||||
if ((rlcP->output_sdu_size_to_write + lengthP) <= RLC_SDU_MAX_SIZE) {
|
||||
memcpy (&rlcP->output_sdu_in_construction->data[rlcP->output_sdu_size_to_write], srcP, lengthP);
|
||||
// check if no overflow in size
|
||||
if ((rlc_pP->output_sdu_size_to_write + lengthP) <= RLC_SDU_MAX_SIZE) {
|
||||
memcpy (&rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write], src_pP, lengthP);
|
||||
|
||||
rlcP->output_sdu_size_to_write += lengthP;
|
||||
} else {
|
||||
LOG_E(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][REASSEMBLY PAYLOAD] ERROR SDU SIZE OVERFLOW SDU GARBAGED\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
// erase SDU
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
}
|
||||
rlc_pP->output_sdu_size_to_write += lengthP;
|
||||
} else {
|
||||
LOG_E(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PAYLOAD] ERROR SDU SIZE OVERFLOW SDU GARBAGED\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD)
|
||||
AssertFatal(0, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RLC_AM_DATA_IND, SDU SIZE OVERFLOW SDU GARBAGED\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
#endif
|
||||
// erase SDU
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
}
|
||||
} else {
|
||||
LOG_E(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][REASSEMBLY PAYLOAD] ERROR OUTPUT SDU IS NULL\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
LOG_E(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PAYLOAD] ERROR OUTPUT SDU IS NULL\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD)
|
||||
AssertFatal(0, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RLC_AM_DATA_IND, SDU DROPPED, OUT OF MEMORY\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_send_sdu (rlc_am_entity_t *rlcP,u32_t frame, u8_t eNB_flag)
|
||||
void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_flagP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
if ((rlcP->output_sdu_in_construction)) {
|
||||
LOG_D(RLC, "\n\n\n[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND_SDU] %d bytes sdu %p\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->output_sdu_size_to_write, rlcP->output_sdu_in_construction);
|
||||
if (rlcP->output_sdu_size_to_write > 0) {
|
||||
u8_t eNB_id;
|
||||
u8_t UE_id;
|
||||
if (eNB_flag == 0) {
|
||||
/* FIXME: force send on first eNB */
|
||||
eNB_id = 0;
|
||||
UE_id = rlcP->module_id - NB_eNB_INST;
|
||||
} else {
|
||||
UE_id = rlcP->rb_id / NB_RB_MAX;
|
||||
eNB_id = rlcP->module_id;
|
||||
}
|
||||
rlcP->stat_rx_pdcp_sdu += 1;
|
||||
rlcP->stat_rx_pdcp_bytes += rlcP->output_sdu_size_to_write;
|
||||
#ifdef TEST_RLC_AM
|
||||
rlc_am_v9_3_0_test_data_ind (rlcP->module_id,
|
||||
rlcP->rb_id,
|
||||
rlcP->output_sdu_size_to_write,
|
||||
rlcP->output_sdu_in_construction);
|
||||
#else
|
||||
rlc_data_ind (rlcP->module_id, eNB_id, UE_id, frame, eNB_flag, RLC_MBMS_NO, rlcP->rb_id, rlcP->output_sdu_size_to_write, rlcP->output_sdu_in_construction, rlcP->is_data_plane);
|
||||
#endif
|
||||
rlcP->output_sdu_in_construction = NULL;
|
||||
} else {
|
||||
LOG_E(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND_SDU] ERROR SIZE <= 0 ... DO NOTHING, SET SDU SIZE TO 0\n", frame,rlcP->module_id, rlcP->rb_id);
|
||||
//msg("[RLC_AM][MOD %d] Freeing mem_block ...\n", rlcP->module_id);
|
||||
//free_mem_block (rlcP->output_sdu_in_construction);
|
||||
assert(3==4);
|
||||
}
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
if ((rlc_pP->output_sdu_in_construction)) {
|
||||
LOG_D(RLC, "\n\n\n[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND_SDU] %d bytes sdu %p\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->output_sdu_size_to_write,
|
||||
rlc_pP->output_sdu_in_construction);
|
||||
if (rlc_pP->output_sdu_size_to_write > 0) {
|
||||
rlc_pP->stat_rx_pdcp_sdu += 1;
|
||||
rlc_pP->stat_rx_pdcp_bytes += rlc_pP->output_sdu_size_to_write;
|
||||
#ifdef TEST_RLC_AM
|
||||
rlc_am_v9_3_0_test_data_ind (rlc_pP->module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->output_sdu_size_to_write,
|
||||
rlc_pP->output_sdu_in_construction);
|
||||
#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);
|
||||
#endif
|
||||
rlc_pP->output_sdu_in_construction = NULL;
|
||||
} else {
|
||||
LOG_E(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND_SDU] ERROR SIZE <= 0 ... DO NOTHING, SET SDU SIZE TO 0\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
//msg("[RLC_AM][MOD %d] Freeing mem_block ...\n", rlc_pP->module_id);
|
||||
//free_mem_block (rlc_pP->output_sdu_in_construction);
|
||||
assert(3==4);
|
||||
}
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_reassemble_pdu(rlc_am_entity_t* rlcP, u32_t frame, u8_t eNB_flag, mem_block_t* tbP) {
|
||||
//-----------------------------------------------------------------------------
|
||||
int i,j;
|
||||
void rlc_am_reassemble_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t* tb_pP) {
|
||||
//-----------------------------------------------------------------------------
|
||||
int i,j;
|
||||
|
||||
rlc_am_pdu_info_t* pdu_info = &((rlc_am_rx_pdu_management_t*)(tbP->data))->pdu_info;
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][REASSEMBLY PDU] TRY REASSEMBLY PDU SN=%03d\n", frame, rlcP->module_id, rlcP->rb_id, pdu_info->sn);
|
||||
rlc_am_pdu_info_t* pdu_info = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU SN=%03d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
pdu_info->sn);
|
||||
#ifdef TRACE_RLC_AM_RX_DECODE
|
||||
rlc_am_display_data_pdu_infos(rlcP, frame, pdu_info);
|
||||
rlc_am_display_data_pdu_infos(rlc_pP, frameP, pdu_info);
|
||||
#endif
|
||||
|
||||
if (pdu_info->e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) {
|
||||
switch (pdu_info->fi) {
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=11 (00)\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
// one complete SDU
|
||||
rlc_am_send_sdu(rlcP,frame,eNB_flag); // may be not necessary
|
||||
rlc_am_reassembly (pdu_info->payload, pdu_info->payload_size, rlcP,frame);
|
||||
rlc_am_send_sdu(rlcP,frame,eNB_flag); // may be not necessary
|
||||
//rlcP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=10 (01)\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
// one beginning segment of SDU in PDU
|
||||
rlc_am_send_sdu(rlcP,frame,eNB_flag); // may be not necessary
|
||||
rlc_am_reassembly (pdu_info->payload, pdu_info->payload_size, rlcP,frame);
|
||||
//rlcP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=01 (10)\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
// one last segment of SDU
|
||||
//if (rlcP->reassembly_missing_sn_detected == 0) {
|
||||
rlc_am_reassembly (pdu_info->payload, pdu_info->payload_size, rlcP,frame);
|
||||
rlc_am_send_sdu(rlcP,frame,eNB_flag);
|
||||
//} // else { clear sdu already done
|
||||
//rlcP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=00 (11)\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
//if (rlcP->reassembly_missing_sn_detected == 0) {
|
||||
// one whole segment of SDU in PDU
|
||||
rlc_am_reassembly (pdu_info->payload, pdu_info->payload_size, rlcP,frame);
|
||||
//} else {
|
||||
// rlcP->reassembly_missing_sn_detected = 1; // not necessary but for readability of the code
|
||||
//}
|
||||
if (pdu_info->e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) {
|
||||
switch (pdu_info->fi) {
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=11 (00)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
// one complete SDU
|
||||
rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); // may be not necessary
|
||||
rlc_am_reassembly (pdu_info->payload, pdu_info->payload_size, rlc_pP,frameP);
|
||||
rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); // may be not necessary
|
||||
//rlc_pP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=10 (01)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
// one beginning segment of SDU in PDU
|
||||
rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); // may be not necessary
|
||||
rlc_am_reassembly (pdu_info->payload, pdu_info->payload_size, rlc_pP,frameP);
|
||||
//rlc_pP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=01 (10)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
// one last segment of SDU
|
||||
//if (rlc_pP->reassembly_missing_sn_detected == 0) {
|
||||
rlc_am_reassembly (pdu_info->payload, pdu_info->payload_size, rlc_pP,frameP);
|
||||
rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP);
|
||||
//} // else { clear sdu already done
|
||||
//rlc_pP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=00 (11)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
//if (rlc_pP->reassembly_missing_sn_detected == 0) {
|
||||
// one whole segment of SDU in PDU
|
||||
rlc_am_reassembly (pdu_info->payload, pdu_info->payload_size, rlc_pP,frameP);
|
||||
//} else {
|
||||
// rlc_pP->reassembly_missing_sn_detected = 1; // not necessary but for readability of the code
|
||||
//}
|
||||
|
||||
break;
|
||||
break;
|
||||
#ifdef USER_MODE
|
||||
default:
|
||||
assert(0 != 0);
|
||||
default:
|
||||
assert(0 != 0);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
switch (pdu_info->fi) {
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU FI=11 (00) Li=",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
for (i=0; i < pdu_info->num_li; i++) {
|
||||
LOG_D(RLC, "%d ",pdu_info->li_list[i]);
|
||||
}
|
||||
LOG_D(RLC, "\n");
|
||||
//msg(" remaining size %d\n",size);
|
||||
// N complete SDUs
|
||||
rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP);
|
||||
j = 0;
|
||||
for (i = 0; i < pdu_info->num_li; i++) {
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->li_list[i], rlc_pP,frameP);
|
||||
rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP);
|
||||
j = j + pdu_info->li_list[i];
|
||||
}
|
||||
if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
|
||||
// data is already ok, done by last loop above
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->hidden_size, rlc_pP,frameP);
|
||||
rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP);
|
||||
}
|
||||
//rlc_pP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU FI=10 (01) Li=",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
for (i=0; i < pdu_info->num_li; i++) {
|
||||
LOG_D(RLC, "%d ",pdu_info->li_list[i]);
|
||||
}
|
||||
LOG_D(RLC, "\n");
|
||||
//msg(" remaining size %d\n",size);
|
||||
// N complete SDUs + one segment of SDU in PDU
|
||||
rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP);
|
||||
j = 0;
|
||||
for (i = 0; i < pdu_info->num_li; i++) {
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->li_list[i], rlc_pP,frameP);
|
||||
rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP);
|
||||
j = j + pdu_info->li_list[i];
|
||||
}
|
||||
if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
|
||||
// data is already ok, done by last loop above
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->hidden_size, rlc_pP, frameP);
|
||||
}
|
||||
//rlc_pP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU FI=01 (10) Li=",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
for (i=0; i < pdu_info->num_li; i++) {
|
||||
LOG_D(RLC, "%d ",pdu_info->li_list[i]);
|
||||
}
|
||||
LOG_D(RLC, "\n");
|
||||
//msg(" remaining size %d\n",size);
|
||||
// one last segment of SDU + N complete SDUs in PDU
|
||||
j = 0;
|
||||
for (i = 0; i < pdu_info->num_li; i++) {
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->li_list[i], rlc_pP,frameP);
|
||||
rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP);
|
||||
j = j + pdu_info->li_list[i];
|
||||
}
|
||||
if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
|
||||
// data is already ok, done by last loop above
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->hidden_size, rlc_pP,frameP);
|
||||
rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP);
|
||||
}
|
||||
//rlc_pP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU FI=00 (11) Li=",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
for (i=0; i < pdu_info->num_li; i++) {
|
||||
LOG_D(RLC, "%d ",pdu_info->li_list[i]);
|
||||
}
|
||||
LOG_D(RLC, "\n");
|
||||
//msg(" remaining size %d\n",size);
|
||||
j = 0;
|
||||
for (i = 0; i < pdu_info->num_li; i++) {
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->li_list[i], rlc_pP,frameP);
|
||||
rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP);
|
||||
j = j + pdu_info->li_list[i];
|
||||
}
|
||||
if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
|
||||
// data is already ok, done by last loop above
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->hidden_size, rlc_pP,frameP);
|
||||
} else {
|
||||
#ifdef USER_MODE
|
||||
//assert (5!=5);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
switch (pdu_info->fi) {
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][REASSEMBLY PDU] TRY REASSEMBLY PDU FI=11 (00) Li=", frame, rlcP->module_id, rlcP->rb_id);
|
||||
for (i=0; i < pdu_info->num_li; i++) {
|
||||
LOG_D(RLC, "%d ",pdu_info->li_list[i]);
|
||||
}
|
||||
LOG_D(RLC, "\n");
|
||||
//msg(" remaining size %d\n",size);
|
||||
// N complete SDUs
|
||||
rlc_am_send_sdu(rlcP,frame,eNB_flag);
|
||||
j = 0;
|
||||
for (i = 0; i < pdu_info->num_li; i++) {
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->li_list[i], rlcP,frame);
|
||||
rlc_am_send_sdu(rlcP,frame,eNB_flag);
|
||||
j = j + pdu_info->li_list[i];
|
||||
}
|
||||
if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
|
||||
// data is already ok, done by last loop above
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->hidden_size, rlcP,frame);
|
||||
rlc_am_send_sdu(rlcP,frame,eNB_flag);
|
||||
}
|
||||
//rlcP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][REASSEMBLY PDU] TRY REASSEMBLY PDU FI=10 (01) Li=", frame, rlcP->module_id, rlcP->rb_id);
|
||||
for (i=0; i < pdu_info->num_li; i++) {
|
||||
LOG_D(RLC, "%d ",pdu_info->li_list[i]);
|
||||
}
|
||||
LOG_D(RLC, "\n");
|
||||
//msg(" remaining size %d\n",size);
|
||||
// N complete SDUs + one segment of SDU in PDU
|
||||
rlc_am_send_sdu(rlcP,frame,eNB_flag);
|
||||
j = 0;
|
||||
for (i = 0; i < pdu_info->num_li; i++) {
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->li_list[i], rlcP,frame);
|
||||
rlc_am_send_sdu(rlcP,frame,eNB_flag);
|
||||
j = j + pdu_info->li_list[i];
|
||||
}
|
||||
if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
|
||||
// data is already ok, done by last loop above
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->hidden_size, rlcP, frame);
|
||||
}
|
||||
//rlcP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][REASSEMBLY PDU] TRY REASSEMBLY PDU FI=01 (10) Li=", frame, rlcP->module_id, rlcP->rb_id);
|
||||
for (i=0; i < pdu_info->num_li; i++) {
|
||||
LOG_D(RLC, "%d ",pdu_info->li_list[i]);
|
||||
}
|
||||
LOG_D(RLC, "\n");
|
||||
//msg(" remaining size %d\n",size);
|
||||
// one last segment of SDU + N complete SDUs in PDU
|
||||
j = 0;
|
||||
for (i = 0; i < pdu_info->num_li; i++) {
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->li_list[i], rlcP,frame);
|
||||
rlc_am_send_sdu(rlcP,frame,eNB_flag);
|
||||
j = j + pdu_info->li_list[i];
|
||||
}
|
||||
if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
|
||||
// data is already ok, done by last loop above
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->hidden_size, rlcP,frame);
|
||||
rlc_am_send_sdu(rlcP,frame,eNB_flag);
|
||||
}
|
||||
//rlcP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][REASSEMBLY PDU] TRY REASSEMBLY PDU FI=00 (11) Li=", frame, rlcP->module_id, rlcP->rb_id);
|
||||
for (i=0; i < pdu_info->num_li; i++) {
|
||||
LOG_D(RLC, "%d ",pdu_info->li_list[i]);
|
||||
}
|
||||
LOG_D(RLC, "\n");
|
||||
//msg(" remaining size %d\n",size);
|
||||
j = 0;
|
||||
for (i = 0; i < pdu_info->num_li; i++) {
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->li_list[i], rlcP,frame);
|
||||
rlc_am_send_sdu(rlcP,frame,eNB_flag);
|
||||
j = j + pdu_info->li_list[i];
|
||||
}
|
||||
if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
|
||||
// data is already ok, done by last loop above
|
||||
rlc_am_reassembly (&pdu_info->payload[j], pdu_info->hidden_size, rlcP,frame);
|
||||
} else {
|
||||
//rlc_pP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
#ifdef USER_MODE
|
||||
//assert (5!=5);
|
||||
default:
|
||||
assert(1 != 1);
|
||||
#endif
|
||||
}
|
||||
//rlcP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
#ifdef USER_MODE
|
||||
default:
|
||||
assert(1 != 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
free_mem_block(tbP);
|
||||
}
|
||||
}
|
||||
free_mem_block(tb_pP);
|
||||
}
|
||||
|
||||
@@ -56,36 +56,36 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# define public_rlc_am_reassembly(x) extern x
|
||||
# endif
|
||||
# endif
|
||||
/*! \fn void rlc_am_clear_rx_sdu (rlc_am_entity_t *rlcP)
|
||||
/*! \fn void rlc_am_clear_rx_sdu (rlc_am_entity_t *rlc_pP)
|
||||
* \brief Reset the data cursor index in the output SDU buffer to zero.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
*/
|
||||
private_rlc_am_reassembly( void rlc_am_clear_rx_sdu (rlc_am_entity_t *rlcP);)
|
||||
private_rlc_am_reassembly( void rlc_am_clear_rx_sdu (rlc_am_entity_t *rlc_pP);)
|
||||
|
||||
/*! \fn void rlc_am_reassembly (u8_t * srcP, s32_t lengthP, rlc_am_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_reassembly (u8_t * srcP, s32_t lengthP, rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Concatenate datas at the tail of the output SDU in construction. This SDU in construction will be sent to higher layer.
|
||||
* \param[in] srcP Pointer on data to be reassemblied.
|
||||
* \param[in] lengthP Length of data to be reassemblied.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
*/
|
||||
private_rlc_am_reassembly( void rlc_am_reassembly (u8_t * srcP, s32_t lengthP, rlc_am_entity_t *rlcP,u32_t frame);)
|
||||
private_rlc_am_reassembly( void rlc_am_reassembly (u8_t * srcP, s32_t lengthP, rlc_am_entity_t *rlc_pP,frame_t frameP);)
|
||||
|
||||
/*! \fn void rlc_am_send_sdu (rlc_am_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Send the output SDU in construction to higher layer.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
*/
|
||||
private_rlc_am_reassembly( void rlc_am_send_sdu (rlc_am_entity_t *rlcP,u32_t frame, u8_t eNB_flag);)
|
||||
private_rlc_am_reassembly( void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_flagP);)
|
||||
|
||||
/*! \fn void rlc_am_reassemble_pdu(rlc_am_entity_t* rlcP, u32_t frame, u8_t eNB_flag, mem_block_t* tbP)
|
||||
/*! \fn void rlc_am_reassemble_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, u8_t eNB_flagP, mem_block_t* tb_pP)
|
||||
* \brief Reassembly a RLC AM PDU, depending of the content of this PDU, data will be reassemblied to the current output SDU, the current will be sent to higher layers or not, after or before the reassembly, or no send of SDU will be triggered, depending on FI field in PDU header.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0).
|
||||
* \param[in] tbP RLC AM PDU embedded in a mem_block_t.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0).
|
||||
* \param[in] tb_pP RLC AM PDU embedded in a mem_block_t.
|
||||
*/
|
||||
protected_rlc_am_reassembly( void rlc_am_reassemble_pdu(rlc_am_entity_t* rlcP, u32_t frame, u8_t eNB_flag, mem_block_t* tbP);)
|
||||
protected_rlc_am_reassembly( void rlc_am_reassemble_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t* tb_pP);)
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -42,194 +42,248 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
//#define DEBUG_RLC_AM_DISPLAY_TB_DATA
|
||||
//#define RLC_AM_GENERATE_ERRORS
|
||||
//-----------------------------------------------------------------------------
|
||||
signed int rlc_am_get_data_pdu_infos(u32_t frame, rlc_am_pdu_sn_10_t* headerP, s16_t total_sizeP, rlc_am_pdu_info_t* pdu_infoP)
|
||||
signed int rlc_am_get_data_pdu_infos(frame_t frameP, rlc_am_pdu_sn_10_t* header_pP, s16_t total_sizeP, rlc_am_pdu_info_t* pdu_info_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
memset(pdu_infoP, 0, sizeof (rlc_am_pdu_info_t));
|
||||
memset(pdu_info_pP, 0, sizeof (rlc_am_pdu_info_t));
|
||||
|
||||
s16_t sum_li = 0;
|
||||
pdu_infoP->d_c = headerP->b1 >> 7;
|
||||
pdu_infoP->num_li = 0;
|
||||
pdu_info_pP->d_c = header_pP->b1 >> 7;
|
||||
pdu_info_pP->num_li = 0;
|
||||
|
||||
|
||||
if (pdu_infoP->d_c) {
|
||||
pdu_infoP->rf = (headerP->b1 >> 6) & 0x01;
|
||||
pdu_infoP->p = (headerP->b1 >> 5) & 0x01;
|
||||
pdu_infoP->fi = (headerP->b1 >> 3) & 0x03;
|
||||
pdu_infoP->e = (headerP->b1 >> 2) & 0x01;
|
||||
pdu_infoP->sn = headerP->b2 + (((u16_t)(headerP->b1 & 0x03)) << 8);
|
||||
if (pdu_info_pP->d_c) {
|
||||
pdu_info_pP->rf = (header_pP->b1 >> 6) & 0x01;
|
||||
pdu_info_pP->p = (header_pP->b1 >> 5) & 0x01;
|
||||
pdu_info_pP->fi = (header_pP->b1 >> 3) & 0x03;
|
||||
pdu_info_pP->e = (header_pP->b1 >> 2) & 0x01;
|
||||
pdu_info_pP->sn = header_pP->b2 + (((u16_t)(header_pP->b1 & 0x03)) << 8);
|
||||
|
||||
pdu_infoP->header_size = 2;
|
||||
if (pdu_infoP->rf) {
|
||||
pdu_infoP->lsf = (headerP->data[0] >> 7) & 0x01;
|
||||
pdu_infoP->so = headerP->data[1] + (((u16_t)(headerP->data[0] & 0x7F)) << 8);
|
||||
pdu_infoP->payload = &headerP->data[2];
|
||||
pdu_infoP->header_size += 2;
|
||||
pdu_info_pP->header_size = 2;
|
||||
if (pdu_info_pP->rf) {
|
||||
pdu_info_pP->lsf = (header_pP->data[0] >> 7) & 0x01;
|
||||
pdu_info_pP->so = header_pP->data[1] + (((u16_t)(header_pP->data[0] & 0x7F)) << 8);
|
||||
pdu_info_pP->payload = &header_pP->data[2];
|
||||
pdu_info_pP->header_size += 2;
|
||||
} else {
|
||||
pdu_infoP->payload = &headerP->data[0];
|
||||
pdu_info_pP->payload = &header_pP->data[0];
|
||||
}
|
||||
|
||||
if (pdu_infoP->e) {
|
||||
if (pdu_info_pP->e) {
|
||||
rlc_am_e_li_t *e_li;
|
||||
unsigned int li_length_in_bytes = 1;
|
||||
unsigned int li_to_read = 1;
|
||||
|
||||
if (pdu_infoP->rf) {
|
||||
e_li = (rlc_am_e_li_t*)(&headerP->data[2]);
|
||||
if (pdu_info_pP->rf) {
|
||||
e_li = (rlc_am_e_li_t*)(&header_pP->data[2]);
|
||||
} else {
|
||||
e_li = (rlc_am_e_li_t*)(headerP->data);
|
||||
e_li = (rlc_am_e_li_t*)(header_pP->data);
|
||||
}
|
||||
while (li_to_read) {
|
||||
li_length_in_bytes = li_length_in_bytes ^ 3;
|
||||
if (li_length_in_bytes == 2) {
|
||||
pdu_infoP->li_list[pdu_infoP->num_li] = ((u16_t)(e_li->b1 << 4)) & 0x07F0;
|
||||
pdu_infoP->li_list[pdu_infoP->num_li] |= (((u8_t)(e_li->b2 >> 4)) & 0x000F);
|
||||
pdu_info_pP->li_list[pdu_info_pP->num_li] = ((u16_t)(e_li->b1 << 4)) & 0x07F0;
|
||||
pdu_info_pP->li_list[pdu_info_pP->num_li] |= (((u8_t)(e_li->b2 >> 4)) & 0x000F);
|
||||
li_to_read = e_li->b1 & 0x80;
|
||||
pdu_infoP->header_size += 2;
|
||||
pdu_info_pP->header_size += 2;
|
||||
} else {
|
||||
pdu_infoP->li_list[pdu_infoP->num_li] = ((u16_t)(e_li->b2 << 8)) & 0x0700;
|
||||
pdu_infoP->li_list[pdu_infoP->num_li] |= e_li->b3;
|
||||
pdu_info_pP->li_list[pdu_info_pP->num_li] = ((u16_t)(e_li->b2 << 8)) & 0x0700;
|
||||
pdu_info_pP->li_list[pdu_info_pP->num_li] |= e_li->b3;
|
||||
li_to_read = e_li->b2 & 0x08;
|
||||
e_li++;
|
||||
pdu_infoP->header_size += 1;
|
||||
pdu_info_pP->header_size += 1;
|
||||
}
|
||||
sum_li += pdu_infoP->li_list[pdu_infoP->num_li];
|
||||
pdu_infoP->num_li = pdu_infoP->num_li + 1;
|
||||
if (pdu_infoP->num_li > RLC_AM_MAX_SDU_IN_PDU) {
|
||||
LOG_E(RLC, "[FRAME %05d][RLC_AM][MOD XX][RB XX][GET PDU INFO] SN %04d TOO MANY LIs ", frame, pdu_infoP->sn);
|
||||
sum_li += pdu_info_pP->li_list[pdu_info_pP->num_li];
|
||||
pdu_info_pP->num_li = pdu_info_pP->num_li + 1;
|
||||
if (pdu_info_pP->num_li > RLC_AM_MAX_SDU_IN_PDU) {
|
||||
LOG_E(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][GET PDU INFO] SN %04d TOO MANY LIs ",
|
||||
frameP,
|
||||
pdu_info_pP->sn);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
if (li_length_in_bytes == 2) {
|
||||
pdu_infoP->payload = &e_li->b3;
|
||||
pdu_info_pP->payload = &e_li->b3;
|
||||
} else {
|
||||
pdu_infoP->payload = &e_li->b1;
|
||||
pdu_info_pP->payload = &e_li->b1;
|
||||
}
|
||||
}
|
||||
pdu_infoP->payload_size = total_sizeP - pdu_infoP->header_size;
|
||||
if (pdu_infoP->payload_size > sum_li) {
|
||||
pdu_infoP->hidden_size = pdu_infoP->payload_size - sum_li;
|
||||
pdu_info_pP->payload_size = total_sizeP - pdu_info_pP->header_size;
|
||||
if (pdu_info_pP->payload_size > sum_li) {
|
||||
pdu_info_pP->hidden_size = pdu_info_pP->payload_size - sum_li;
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
LOG_W(RLC, "[FRAME %05d][RLC_AM][MOD XX][RB XX][GET DATA PDU INFO] SN %04d ERROR CONTROL PDU ", frame, pdu_infoP->sn);
|
||||
LOG_W(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][GET DATA PDU INFO] SN %04d ERROR CONTROL PDU ",
|
||||
frameP,
|
||||
pdu_info_pP->sn);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_display_data_pdu_infos(rlc_am_entity_t *rlcP, u32_t frame, rlc_am_pdu_info_t* pdu_infoP)
|
||||
void rlc_am_display_data_pdu_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_am_pdu_info_t* pdu_info_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
int num_li;
|
||||
|
||||
if (pdu_infoP->d_c) {
|
||||
if (pdu_infoP->rf) {
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][DISPLAY DATA PDU] RX DATA PDU SN %04d FI %1d SO %05d LSF %01d POLL %1d ", frame, rlcP->module_id, rlcP->rb_id, pdu_infoP->sn, pdu_infoP->fi, pdu_infoP->so, pdu_infoP->lsf, pdu_infoP->p);
|
||||
if (pdu_info_pP->d_c) {
|
||||
if (pdu_info_pP->rf) {
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][DISPLAY DATA PDU] RX DATA PDU SN %04d FI %1d SO %05d LSF %01d POLL %1d ",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
pdu_info_pP->sn,
|
||||
pdu_info_pP->fi,
|
||||
pdu_info_pP->so,
|
||||
pdu_info_pP->lsf, pdu_info_pP->p);
|
||||
} else {
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][DISPLAY DATA PDU] RX DATA PDU SN %04d FI %1d POLL %1d ", frame, rlcP->module_id, rlcP->rb_id, pdu_infoP->sn, pdu_infoP->fi, pdu_infoP->p);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][DISPLAY DATA PDU] RX DATA PDU SN %04d FI %1d POLL %1d ",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
pdu_info_pP->sn,
|
||||
pdu_info_pP->fi,
|
||||
pdu_info_pP->p);
|
||||
}
|
||||
for (num_li = 0; num_li < pdu_infoP->num_li; num_li++) {
|
||||
LOG_D(RLC, "LI %05d ", pdu_infoP->li_list[num_li]);
|
||||
for (num_li = 0; num_li < pdu_info_pP->num_li; num_li++) {
|
||||
LOG_D(RLC, "LI %05d ", pdu_info_pP->li_list[num_li]);
|
||||
}
|
||||
if (pdu_infoP->hidden_size > 0) {
|
||||
LOG_D(RLC, "hidden size %05d ", pdu_infoP->hidden_size);
|
||||
if (pdu_info_pP->hidden_size > 0) {
|
||||
LOG_D(RLC, "hidden size %05d ", pdu_info_pP->hidden_size);
|
||||
}
|
||||
LOG_D(RLC, "\n");
|
||||
} else {
|
||||
LOG_E(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][DISPLAY DATA PDU] ERROR RX CONTROL PDU\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
LOG_E(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][DISPLAY DATA PDU] ERROR RX CONTROL PDU\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
}
|
||||
}
|
||||
// assumed the sn of the tb is equal to VR(MS)
|
||||
// assumed the sn of the tb_p is equal to VR(MS)
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_rx_update_vr_ms(rlc_am_entity_t *rlcP, u32_t frame, mem_block_t* tbP)
|
||||
void rlc_am_rx_update_vr_ms(rlc_am_entity_t *rlc_pP, frame_t frameP, mem_block_t* tb_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
//rlc_am_pdu_info_t* pdu_info = &((rlc_am_rx_pdu_management_t*)(tbP->data))->pdu_info;
|
||||
rlc_am_pdu_info_t* pdu_info_cursor;
|
||||
mem_block_t* cursor;
|
||||
//rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
|
||||
rlc_am_pdu_info_t* pdu_info_cursor_p = NULL;
|
||||
mem_block_t* cursor_p;
|
||||
|
||||
cursor = tbP;
|
||||
if (cursor) {
|
||||
cursor_p = tb_pP;
|
||||
if (cursor_p) {
|
||||
do {
|
||||
pdu_info_cursor = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
|
||||
if (((rlc_am_rx_pdu_management_t*)(cursor->data))->all_segments_received == 0) {
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
if (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received == 0) {
|
||||
#ifdef TRACE_RLC_AM_RX
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][UPDATE VR(MS)] UPDATED VR(MS) %04d -> %04d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->vr_ms, pdu_info_cursor->sn);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][UPDATE VR(MS)] UPDATED VR(MS) %04d -> %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->vr_ms, pdu_info_cursor_p->sn);
|
||||
#endif
|
||||
rlcP->vr_ms = pdu_info_cursor->sn;
|
||||
rlc_pP->vr_ms = pdu_info_cursor_p->sn;
|
||||
return;
|
||||
}
|
||||
cursor = cursor->next;
|
||||
} while (cursor != NULL);
|
||||
cursor_p = cursor_p->next;
|
||||
} while (cursor_p != NULL);
|
||||
#ifdef TRACE_RLC_AM_RX
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][UPDATE VR(MS)] UPDATED VR(MS) %04d -> %04d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->vr_ms, (pdu_info_cursor->sn + 1) & RLC_AM_SN_MASK);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][UPDATE VR(MS)] UPDATED VR(MS) %04d -> %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->vr_ms,
|
||||
(pdu_info_cursor_p->sn + 1) & RLC_AM_SN_MASK);
|
||||
#endif
|
||||
rlcP->vr_ms = (pdu_info_cursor->sn + 1) & RLC_AM_SN_MASK;
|
||||
rlc_pP->vr_ms = (pdu_info_cursor_p->sn + 1) & RLC_AM_SN_MASK;
|
||||
}
|
||||
}
|
||||
// assumed the sn of the tb is equal to VR(R)
|
||||
// assumed the sn of the tb_p is equal to VR(R)
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_rx_update_vr_r(rlc_am_entity_t *rlcP,u32_t frame,mem_block_t* tbP)
|
||||
void rlc_am_rx_update_vr_r(rlc_am_entity_t *rlc_pP,frame_t frameP,mem_block_t* tb_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
rlc_am_pdu_info_t* pdu_info_cursor;
|
||||
mem_block_t* cursor;
|
||||
cursor = tbP;
|
||||
if (cursor) {
|
||||
rlc_am_pdu_info_t* pdu_info_cursor_p = NULL;
|
||||
mem_block_t* cursor_p;
|
||||
|
||||
cursor_p = tb_pP;
|
||||
if (cursor_p) {
|
||||
do {
|
||||
pdu_info_cursor = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
|
||||
if ((((rlc_am_rx_pdu_management_t*)(cursor->data))->all_segments_received == 0) ||
|
||||
(rlcP->vr_r != pdu_info_cursor->sn)) {
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
if ((((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received == 0) ||
|
||||
(rlc_pP->vr_r != pdu_info_cursor_p->sn)) {
|
||||
return;
|
||||
}
|
||||
#ifdef TRACE_RLC_AM_RX
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][UPDATE VR(R)] UPDATED VR(R) %04d -> %04d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->vr_r, (pdu_info_cursor->sn + 1) & RLC_AM_SN_MASK);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][UPDATE VR(R)] UPDATED VR(R) %04d -> %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->vr_r,
|
||||
(pdu_info_cursor_p->sn + 1) & RLC_AM_SN_MASK);
|
||||
#endif
|
||||
if (((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info.rf == 1) {
|
||||
if (((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info.lsf == 1) {
|
||||
rlcP->vr_r = (rlcP->vr_r + 1) & RLC_AM_SN_MASK;
|
||||
if (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.rf == 1) {
|
||||
if (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.lsf == 1) {
|
||||
rlc_pP->vr_r = (rlc_pP->vr_r + 1) & RLC_AM_SN_MASK;
|
||||
}
|
||||
} else {
|
||||
rlcP->vr_r = (rlcP->vr_r + 1) & RLC_AM_SN_MASK;
|
||||
rlc_pP->vr_r = (rlc_pP->vr_r + 1) & RLC_AM_SN_MASK;
|
||||
}
|
||||
cursor = cursor->next;
|
||||
} while (cursor != NULL);
|
||||
//rlcP->vr_r = (pdu_info_cursor->sn + 1) & RLC_AM_SN_MASK;
|
||||
cursor_p = cursor_p->next;
|
||||
} while (cursor_p != NULL);
|
||||
//rlc_pP->vr_r = (pdu_info_cursor_p->sn + 1) & RLC_AM_SN_MASK;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_am_receive_routing (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP)
|
||||
rlc_am_receive_routing (rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
mem_block_t *tb;
|
||||
u8_t *first_byte;
|
||||
mem_block_t *tb_p = NULL;
|
||||
u8_t *first_byte_p = NULL;
|
||||
s16_t tb_size_in_bytes;
|
||||
|
||||
while ((tb = list_remove_head (&data_indP.data))) {
|
||||
first_byte = ((struct mac_tb_ind *) (tb->data))->data_ptr;
|
||||
tb_size_in_bytes = ((struct mac_tb_ind *) (tb->data))->size;
|
||||
while ((tb_p = list_remove_head (&data_indP.data))) {
|
||||
first_byte_p = ((struct mac_tb_ind *) (tb_p->data))->data_ptr;
|
||||
tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
|
||||
|
||||
if (tb_size_in_bytes > 0) {
|
||||
if ((*first_byte & 0x80) == 0x80) {
|
||||
rlcP->stat_rx_data_bytes += tb_size_in_bytes;
|
||||
rlcP->stat_rx_data_pdu += 1;
|
||||
rlc_am_receive_process_data_pdu (rlcP, frame, eNB_flag, tb, first_byte, tb_size_in_bytes);
|
||||
if ((*first_byte_p & 0x80) == 0x80) {
|
||||
rlc_pP->stat_rx_data_bytes += tb_size_in_bytes;
|
||||
rlc_pP->stat_rx_data_pdu += 1;
|
||||
rlc_am_receive_process_data_pdu (rlc_pP, frameP, eNB_flagP, tb_p, first_byte_p, tb_size_in_bytes);
|
||||
} else {
|
||||
rlcP->stat_rx_control_bytes += tb_size_in_bytes;
|
||||
rlcP->stat_rx_control_pdu += 1;
|
||||
rlc_am_receive_process_control_pdu (rlcP, frame, tb, &first_byte, &tb_size_in_bytes);
|
||||
rlc_pP->stat_rx_control_bytes += tb_size_in_bytes;
|
||||
rlc_pP->stat_rx_control_pdu += 1;
|
||||
rlc_am_receive_process_control_pdu (rlc_pP, frameP, tb_p, &first_byte_p, &tb_size_in_bytes);
|
||||
// Test if remaining bytes not processed (up to know, highest probability is bug in MAC)
|
||||
AssertFatal( tb_size_in_bytes == 0,
|
||||
"Remaining %d bytes following a control PDU",
|
||||
tb_size_in_bytes);
|
||||
}
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][RX ROUTING] VR(R)=%03d VR(MR)=%03d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->vr_r, rlcP->vr_mr);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RX ROUTING] VR(R)=%03d VR(MR)=%03d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->vr_r,
|
||||
rlc_pP->vr_mr);
|
||||
}
|
||||
} // end while
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flag, mem_block_t* tbP, u8_t* first_byteP, u16_t tb_size_in_bytesP)
|
||||
void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t* tb_pP, u8_t* first_byte_pP, u16_t tb_size_in_bytesP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
// 5.1.3.2 Receive operations
|
||||
@@ -258,29 +312,54 @@ void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlcP, u32_t frame, u8_t e
|
||||
// - place the received RLC data PDU in the reception buffer;
|
||||
// - if some byte segments of the AMD PDU contained in the RLC data PDU have been received before:
|
||||
// - discard the duplicate byte segments.
|
||||
rlc_am_pdu_info_t* pdu_info = &((rlc_am_rx_pdu_management_t*)(tbP->data))->pdu_info;
|
||||
rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10 = (rlc_am_pdu_sn_10_t*)first_byteP;
|
||||
rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
|
||||
rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)first_byte_pP;
|
||||
|
||||
if (rlc_am_get_data_pdu_infos(frame,rlc_am_pdu_sn_10, tb_size_in_bytesP, pdu_info) >= 0) {
|
||||
if (rlc_am_get_data_pdu_infos(frameP,rlc_am_pdu_sn_10_p, tb_size_in_bytesP, pdu_info_p) >= 0) {
|
||||
|
||||
((rlc_am_rx_pdu_management_t*)(tbP->data))->all_segments_received = 0;
|
||||
if (rlc_am_in_rx_window(rlcP, pdu_info->sn)) {
|
||||
((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received = 0;
|
||||
if (rlc_am_in_rx_window(rlc_pP, pdu_info_p->sn)) {
|
||||
|
||||
if (pdu_info->p) {
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][PROCESS RX PDU] POLL BIT SET, STATUS REQUESTED:\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
rlcP->status_requested = 1;
|
||||
if (pdu_info_p->p) {
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] POLL BIT SET, STATUS REQUESTED:\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_pP->status_requested = 1;
|
||||
}
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][PROCESS RX PDU] VR(R) %04d VR(H) %04d VR(MR) %04d VR(MS) %04d VR(X) %04d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->vr_r, rlcP->vr_h, rlcP->vr_mr, rlcP->vr_ms, rlcP->vr_x);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] VR(R) %04d VR(H) %04d VR(MR) %04d VR(MS) %04d VR(X) %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->vr_r,
|
||||
rlc_pP->vr_h,
|
||||
rlc_pP->vr_mr,
|
||||
rlc_pP->vr_ms,
|
||||
rlc_pP->vr_x);
|
||||
|
||||
if (rlc_am_rx_list_insert_pdu(rlcP, frame,tbP) < 0) {
|
||||
rlcP->stat_rx_data_pdu_dropped += 1;
|
||||
rlcP->stat_rx_data_bytes_dropped += tb_size_in_bytesP;
|
||||
free_mem_block (tbP);
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][PROCESS RX PDU] PDU DISCARDED, STATUS REQUESTED:\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
rlcP->status_requested = 1;
|
||||
if (rlc_am_rx_list_insert_pdu(rlc_pP, frameP,tb_pP) < 0) {
|
||||
rlc_pP->stat_rx_data_pdu_dropped += 1;
|
||||
rlc_pP->stat_rx_data_bytes_dropped += tb_size_in_bytesP;
|
||||
free_mem_block (tb_pP);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] PDU DISCARDED, STATUS REQUESTED:\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_pP->status_requested = 1;
|
||||
#if defined(RLC_STOP_ON_LOST_PDU)
|
||||
AssertFatal( 0 == 1,
|
||||
"[FRAME %05d][RLC_AM][MOD %d][RB %d] LOST PDU DETECTED\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
"[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] LOST PDU DETECTED\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
#endif
|
||||
} else {
|
||||
// 5.1.3.2.3
|
||||
@@ -316,45 +395,64 @@ void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlcP, u32_t frame, u8_t e
|
||||
|
||||
|
||||
#ifdef TRACE_RLC_AM_RX
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][PROCESS RX PDU] RX LIST AFTER INSERTION:\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
rlc_am_rx_list_display(rlcP, "rlc_am_receive_process_data_pdu AFTER INSERTION ");
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] RX LIST AFTER INSERTION:\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_am_rx_list_display(rlc_pP, "rlc_am_receive_process_data_pdu AFTER INSERTION ");
|
||||
#endif
|
||||
if (rlc_am_sn_gte_vr_h(rlcP, pdu_info->sn) > 0) {
|
||||
rlcP->vr_h = (pdu_info->sn + 1) & RLC_AM_SN_MASK;
|
||||
if (rlc_am_sn_gte_vr_h(rlc_pP, pdu_info_p->sn) > 0) {
|
||||
rlc_pP->vr_h = (pdu_info_p->sn + 1) & RLC_AM_SN_MASK;
|
||||
}
|
||||
rlc_am_rx_check_all_byte_segments(rlcP, frame, tbP);
|
||||
if ((pdu_info->sn == rlcP->vr_ms) && (((rlc_am_rx_pdu_management_t*)(tbP->data))->all_segments_received)) {
|
||||
rlc_am_rx_update_vr_ms(rlcP, frame, tbP);
|
||||
rlc_am_rx_check_all_byte_segments(rlc_pP, frameP, tb_pP);
|
||||
if ((pdu_info_p->sn == rlc_pP->vr_ms) && (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received)) {
|
||||
rlc_am_rx_update_vr_ms(rlc_pP, frameP, tb_pP);
|
||||
}
|
||||
if (pdu_info->sn == rlcP->vr_r) {
|
||||
if (((rlc_am_rx_pdu_management_t*)(tbP->data))->all_segments_received) {
|
||||
rlc_am_rx_update_vr_r(rlcP, frame, tbP);
|
||||
rlcP->vr_mr = (rlcP->vr_r + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
|
||||
if (pdu_info_p->sn == rlc_pP->vr_r) {
|
||||
if (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received) {
|
||||
rlc_am_rx_update_vr_r(rlc_pP, frameP, tb_pP);
|
||||
rlc_pP->vr_mr = (rlc_pP->vr_r + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
|
||||
}
|
||||
rlc_am_rx_list_reassemble_rlc_sdus(rlcP,frame,eNB_flag);
|
||||
rlc_am_rx_list_reassemble_rlc_sdus(rlc_pP,frameP,eNB_flagP);
|
||||
}
|
||||
|
||||
if (rlcP->t_reordering.running) {
|
||||
if ((rlcP->vr_x == rlcP->vr_r) || ((rlc_am_in_rx_window(rlcP, pdu_info->sn) == 0) && (rlcP->vr_x != rlcP->vr_mr))) {
|
||||
rlc_am_stop_and_reset_timer_reordering(rlcP,frame);
|
||||
if (rlc_pP->t_reordering.running) {
|
||||
if ((rlc_pP->vr_x == rlc_pP->vr_r) || ((rlc_am_in_rx_window(rlc_pP, pdu_info_p->sn) == 0) && (rlc_pP->vr_x != rlc_pP->vr_mr))) {
|
||||
rlc_am_stop_and_reset_timer_reordering(rlc_pP,frameP);
|
||||
}
|
||||
}
|
||||
if (!(rlcP->t_reordering.running)) {
|
||||
if (rlcP->vr_h != rlcP->vr_r) { // - if VR (H) > VR(R) translated to - if VR (H) != VR(R)
|
||||
rlc_am_start_timer_reordering(rlcP,frame);
|
||||
rlcP->vr_x = rlcP->vr_h;
|
||||
if (!(rlc_pP->t_reordering.running)) {
|
||||
if (rlc_pP->vr_h != rlc_pP->vr_r) { // - if VR (H) > VR(R) translated to - if VR (H) != VR(R)
|
||||
rlc_am_start_timer_reordering(rlc_pP,frameP);
|
||||
rlc_pP->vr_x = rlc_pP->vr_h;
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][PROCESS RX PDU] VR(R) %04d VR(H) %04d VR(MS) %04d VR(MR) %04d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->vr_r, rlcP->vr_h, rlcP->vr_ms, rlcP->vr_mr);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] VR(R) %04d VR(H) %04d VR(MS) %04d VR(MR) %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->vr_r,
|
||||
rlc_pP->vr_h,
|
||||
rlc_pP->vr_ms,
|
||||
rlc_pP->vr_mr);
|
||||
} else {
|
||||
rlcP->stat_rx_data_pdu_out_of_window += 1;
|
||||
rlcP->stat_rx_data_bytes_out_of_window += tb_size_in_bytesP;
|
||||
free_mem_block (tbP);
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][PROCESS RX PDU] PDU OUT OF RX WINDOW, DISCARDED, STATUS REQUESTED:\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
rlcP->status_requested = 1;
|
||||
rlc_pP->stat_rx_data_pdu_out_of_window += 1;
|
||||
rlc_pP->stat_rx_data_bytes_out_of_window += tb_size_in_bytesP;
|
||||
free_mem_block (tb_pP);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] PDU OUT OF RX WINDOW, DISCARDED, STATUS REQUESTED:\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_pP->status_requested = 1;
|
||||
}
|
||||
} else {
|
||||
free_mem_block (tbP);
|
||||
free_mem_block (tb_pP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# define public_rlc_am_receiver(x) extern x
|
||||
# endif
|
||||
# endif
|
||||
/*! \fn signed int rlc_am_get_data_pdu_infos(u32_t frame, rlc_am_pdu_sn_10_t* headerP, s16_t sizeP, rlc_am_pdu_info_t* pdu_infoP)
|
||||
/*! \fn signed int rlc_am_get_data_pdu_infos(frame_t frameP, rlc_am_pdu_sn_10_t* headerP, s16_t sizeP, rlc_am_pdu_info_t* pdu_infoP)
|
||||
* \brief Extract PDU informations (header fields, data size, etc) from the serialized PDU.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] headerP RLC AM header PDU pointer.
|
||||
@@ -64,52 +64,52 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
* \param[in] pdu_infoP Structure containing extracted informations from PDU.
|
||||
* \return 0 if no error was encountered during the parsing of the PDU, else -1;
|
||||
*/
|
||||
protected_rlc_am_receiver( signed int rlc_am_get_data_pdu_infos(u32_t frame, rlc_am_pdu_sn_10_t* headerP, s16_t sizeP, rlc_am_pdu_info_t* pdu_infoP));
|
||||
protected_rlc_am_receiver( signed int rlc_am_get_data_pdu_infos(frame_t frameP, rlc_am_pdu_sn_10_t* headerP, s16_t sizeP, rlc_am_pdu_info_t* pdu_infoP));
|
||||
|
||||
/*! \fn void rlc_am_display_data_pdu_infos(rlc_am_entity_t *rlcP, u32_t frame, rlc_am_pdu_info_t* pdu_infoP)
|
||||
/*! \fn void rlc_am_display_data_pdu_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_am_pdu_info_t* pdu_infoP)
|
||||
* \brief Display RLC AM PDU informations.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] pdu_infoP Structure containing extracted informations of a PDU.
|
||||
*/
|
||||
protected_rlc_am_receiver( void rlc_am_display_data_pdu_infos(rlc_am_entity_t *rlcP, u32_t frame, rlc_am_pdu_info_t* pdu_infoP);)
|
||||
protected_rlc_am_receiver( void rlc_am_display_data_pdu_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_am_pdu_info_t* pdu_infoP);)
|
||||
|
||||
/*! \fn void rlc_am_rx_update_vr_ms(rlc_am_entity_t *rlcP,mem_block_t* tbP)
|
||||
/*! \fn void rlc_am_rx_update_vr_ms(rlc_am_entity_t *rlc_pP,mem_block_t* tb_pP)
|
||||
* \brief Update RLC AM protocol variable VR(MS).
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] tbP PDU embedded in a mem_block_t struct.
|
||||
* \param[in] tb_pP PDU embedded in a mem_block_t struct.
|
||||
* \note It is assumed that the sequence number of the transport block is equal to VR(MS)
|
||||
*/
|
||||
protected_rlc_am_receiver( void rlc_am_rx_update_vr_ms(rlc_am_entity_t *rlcP,u32_t frame, mem_block_t* tbP);)
|
||||
protected_rlc_am_receiver( void rlc_am_rx_update_vr_ms(rlc_am_entity_t *rlc_pP,frame_t frameP, mem_block_t* tb_pP);)
|
||||
|
||||
/*! \fn void rlc_am_rx_update_vr_r (rlc_am_entity_t *rlcP,u32_t frame,mem_block_t* tbP)
|
||||
/*! \fn void rlc_am_rx_update_vr_r (rlc_am_entity_t *rlc_pP,frame_t frameP,mem_block_t* tb_pP)
|
||||
* \brief Update RLC AM protocol variable VR(R).
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] tbP PDU embedded in a mem_block_t struct.
|
||||
* \param[in] tb_pP PDU embedded in a mem_block_t struct.
|
||||
* \note It is assumed that the sequence number of the transport block is equal to VR(R)
|
||||
*/
|
||||
protected_rlc_am_receiver( void rlc_am_rx_update_vr_r (rlc_am_entity_t *rlcP,u32_t frame, mem_block_t* tbP);)
|
||||
protected_rlc_am_receiver( void rlc_am_rx_update_vr_r (rlc_am_entity_t *rlc_pP,frame_t frameP, mem_block_t* tb_pP);)
|
||||
|
||||
/*! \fn void rlc_am_receive_routing (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP)
|
||||
/*! \fn void rlc_am_receive_routing (rlc_am_entity_t *rlc_pP, frame_t frameP, u8_t eNB_flagP, struct mac_data_ind data_indP)
|
||||
* \brief Convert transport blocks received from MAC layer into RLC AM PDUs, and dispatch to the right processing block these PDUS upon their type (CONTROL/DATA).
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frame 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] data_indP Transport blocks received from MAC layer.
|
||||
*/
|
||||
protected_rlc_am_receiver( void rlc_am_receive_routing (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP));
|
||||
protected_rlc_am_receiver( void rlc_am_receive_routing (rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP));
|
||||
|
||||
/*! \fn void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flag, mem_block_t* tbP, u8_t* first_byteP, u16_t tb_size_in_bytesP)
|
||||
/*! \fn void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, u8_t eNB_flagP, mem_block_t* tb_pP, u8_t* first_byteP, u16_t tb_size_in_bytesP)
|
||||
* \brief Process an incoming data PDU received from MAC layer.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0).
|
||||
* \param[in] tbP PDU embedded in a mem_block_t struct.
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0).
|
||||
* \param[in] tb_pP PDU embedded in a mem_block_t struct.
|
||||
* \param[in] first_byteP Pointer on first byte of the PDU.
|
||||
* \param[in] tb_size_in_bytesP Transport block size in bytes (same as PDU size in bytes).
|
||||
*/
|
||||
private_rlc_am_receiver( void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flag, mem_block_t* tbP, u8_t* first_byteP, u16_t tb_size_in_bytesP));
|
||||
private_rlc_am_receiver( void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t* tb_pP, u8_t* first_byteP, u16_t tb_size_in_bytesP));
|
||||
/** @} */
|
||||
# endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -57,58 +57,58 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# define public_rlc_am_retransmit(x) extern x
|
||||
# endif
|
||||
# endif
|
||||
/*! \fn void rlc_am_nack_pdu (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, u16_t so_startP, u16_t so_endP)
|
||||
/*! \fn void rlc_am_nack_pdu (rlc_am_entity_t *rlcP, frame_t frameP, u16_t snP, sdu_size_t so_startP, sdu_size_t so_endP)
|
||||
* \brief The RLC AM PDU which have the sequence number snP is marked NACKed with segment offset fields.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] snP Sequence number of the PDU that is negative acknowledged.
|
||||
* \param[in] so_startP Start of the segment offset of the PDU that .
|
||||
* \param[in] so_endP Transport blocks received from MAC layer.
|
||||
* \note It may appear a new hole in the retransmission buffer depending on the segment offset informations. Depending on the state of the retransmission buffer, negative confirmation can be sent to higher layers about the drop by the RLC AM instance of a particular SDU.
|
||||
*/
|
||||
protected_rlc_am_retransmit(void rlc_am_nack_pdu (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, u16_t so_startP, u16_t so_endP);)
|
||||
protected_rlc_am_retransmit(void rlc_am_nack_pdu (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_endP);)
|
||||
|
||||
/*! \fn void rlc_am_ack_pdu (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP)
|
||||
/*! \fn void rlc_am_ack_pdu (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP)
|
||||
* \brief The RLC AM PDU which have the sequence number snP is marked ACKed.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] snP Sequence number of the PDU that is acknowledged.
|
||||
* \note Depending on the state of the retransmission buffer, positive confirmation can be sent to higher layers about the receiving by the peer RLC AM instance of a particular SDU.
|
||||
*/
|
||||
protected_rlc_am_retransmit(void rlc_am_ack_pdu (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP);)
|
||||
protected_rlc_am_retransmit(void rlc_am_ack_pdu (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP);)
|
||||
|
||||
/*! \fn mem_block_t* rlc_am_retransmit_get_copy (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP)
|
||||
/*! \fn mem_block_t* rlc_am_retransmit_get_copy (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP)
|
||||
* \brief The RLC AM PDU which have the sequence number snP is marked ACKed.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] snP Sequence number of the PDU to be copied.
|
||||
* \return A copy of the PDU having sequence number equal to parameter snP.
|
||||
*/
|
||||
protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_copy (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP));
|
||||
protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_copy (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP));
|
||||
|
||||
/*! \fn mem_block_t* rlc_am_retransmit_get_subsegment (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, u16_t *sizeP)
|
||||
/*! \fn mem_block_t* rlc_am_retransmit_get_subsegment (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t *sizeP)
|
||||
* \brief The RLC AM PDU which have the sequence number snP is marked ACKed.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
* \param[in] frameP Frame index
|
||||
* \param[in] snP Sequence number of the PDU to be copied.
|
||||
* \param[in,out] sizeP Maximum size allowed for the subsegment, it is updated with the amount of bytes not used (sizeP[out] = sizeP[in] - size of segment).
|
||||
* \return A copy of a segment of the PDU having sequence number equal to parameter snP.
|
||||
*/
|
||||
protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_subsegment (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, u16_t *sizeP));
|
||||
protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_subsegment (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t *sizeP));
|
||||
|
||||
/*! \fn void rlc_am_retransmit_any_pdu(rlc_am_entity_t* rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_retransmit_any_pdu(rlc_am_entity_t* rlcP,frame_t frameP)
|
||||
* \brief Retransmit any PDU in order to unblock peer entity, if no suitable PDU is found (depending on requested MAC size) to be retransmitted, then try to retransmit a subsegment of any PDU.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] frameP Frame index.
|
||||
*/
|
||||
protected_rlc_am_retransmit(void rlc_am_retransmit_any_pdu(rlc_am_entity_t* rlcP,u32_t frame);)
|
||||
protected_rlc_am_retransmit(void rlc_am_retransmit_any_pdu(rlc_am_entity_t* rlcP,frame_t frameP);)
|
||||
|
||||
/*! \fn void rlc_am_tx_buffer_display (rlc_am_entity_t* rlcP, u32_t frame, char* messageP)
|
||||
/*! \fn void rlc_am_tx_buffer_display (rlc_am_entity_t* rlcP, frame_t frameP, char* message_pP)
|
||||
* \brief Display the dump of the retransmission buffer.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] messageP Message to be displayed along with the display of the dump of the retransmission buffer.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] message_pP Message to be displayed along with the display of the dump of the retransmission buffer.
|
||||
*/
|
||||
protected_rlc_am_retransmit(void rlc_am_tx_buffer_display (rlc_am_entity_t* rlcP, u32_t frame, char* messageP);)
|
||||
protected_rlc_am_retransmit(void rlc_am_tx_buffer_display (rlc_am_entity_t* rlcP, frame_t frameP, char* message_pP);)
|
||||
/** @} */
|
||||
# endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -66,38 +66,38 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#include "PHY/defs.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/*! \fn signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlcP u32_t frame, mem_block_t* tbP)
|
||||
/*! \fn signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlcP frame_t frameP, mem_block_t* tbP)
|
||||
* \brief Insert a PDU in the RX buffer (implemented with a list).
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] tbP A PDU embedded in a mem_block_t.
|
||||
* \return Zero if the PDU could be inserted in the RX buffer, a negative value if the PDU could not be inserted.
|
||||
*/
|
||||
protected_rlc_am_rx_list( signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlcP, u32_t frame, mem_block_t* tbP);)
|
||||
protected_rlc_am_rx_list( signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* tbP);)
|
||||
|
||||
/*! \fn void rlc_am_rx_check_all_byte_segments(rlc_am_entity_t* rlcP, u32_t frame, mem_block_t* tbP)
|
||||
/*! \fn void rlc_am_rx_check_all_byte_segments(rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* tbP)
|
||||
* \brief Check if all sub-segments of a PDU are received, if yes then call rlc_am_rx_mark_all_segments_received() procedure.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] tbP A PDU embedded in a mem_block_t.
|
||||
*/
|
||||
protected_rlc_am_rx_list( void rlc_am_rx_check_all_byte_segments(rlc_am_entity_t* rlcP, u32_t frame, mem_block_t* tbP);)
|
||||
protected_rlc_am_rx_list( void rlc_am_rx_check_all_byte_segments(rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* tbP);)
|
||||
|
||||
/*! \fn void rlc_am_rx_mark_all_segments_received (rlc_am_entity_t* rlcP, u32_t frame, mem_block_t* first_segment_tbP)
|
||||
/*! \fn void rlc_am_rx_mark_all_segments_received (rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* first_segment_tbP)
|
||||
* \brief Mark all PDUs having the same sequence number as first_segment_tbP with the information that all segments have been received.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] first_segment_tbP A PDU embedded in a mem_block_t, it is the first PDU in the RX buffer (list) that have its sequence number.
|
||||
*/
|
||||
protected_rlc_am_rx_list( void rlc_am_rx_mark_all_segments_received(rlc_am_entity_t* rlcP, u32_t frame, mem_block_t* first_segment_tbP);)
|
||||
protected_rlc_am_rx_list( void rlc_am_rx_mark_all_segments_received(rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* first_segment_tbP);)
|
||||
|
||||
/*! \fn void rlc_am_rx_list_reassemble_rlc_sdus(rlc_am_entity_t* rlcP,u32_t frame,u8_t eNB_flag)
|
||||
/*! \fn void rlc_am_rx_list_reassemble_rlc_sdus(rlc_am_entity_t* rlcP,frame_t frameP,u8_t eNB_flag)
|
||||
* \brief Reassembly all SDUS that it is possible to reassembly by parsing the RX buffer and looking for PDUs having the flag 'all segments received'.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0).
|
||||
*/
|
||||
protected_rlc_am_rx_list( void rlc_am_rx_list_reassemble_rlc_sdus(rlc_am_entity_t* rlcP,u32_t frame,u8_t eNB_flag);)
|
||||
protected_rlc_am_rx_list( void rlc_am_rx_list_reassemble_rlc_sdus(rlc_am_entity_t* rlcP,frame_t frameP,u8_t eNB_flag);)
|
||||
|
||||
/*! \fn mem_block_t* list2_insert_before_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP)
|
||||
* \brief Insert a PDU embedded in a mem_block_t in a list at a position before a designated element of the list.
|
||||
|
||||
@@ -42,7 +42,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#include "UTIL/LOG/log.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_pdu_polling (rlc_am_entity_t *rlcP, u32_t frame, rlc_am_pdu_sn_10_t *pduP, s16_t payload_sizeP)
|
||||
void rlc_am_pdu_polling (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_am_pdu_sn_10_t *pdu_pP, s16_t payload_sizeP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
// 5.2.2 Polling
|
||||
@@ -72,115 +72,182 @@ void rlc_am_pdu_polling (rlc_am_entity_t *rlcP, u32_t frame, rlc_am_pdu_sn_10_t
|
||||
// - start t-PollRetransmit;
|
||||
// - else:
|
||||
// - restart t-PollRetransmit;
|
||||
rlcP->c_pdu_without_poll += 1;
|
||||
rlcP->c_byte_without_poll += payload_sizeP;
|
||||
rlc_pP->c_pdu_without_poll += 1;
|
||||
rlc_pP->c_byte_without_poll += payload_sizeP;
|
||||
|
||||
if (
|
||||
(rlcP->c_pdu_without_poll >= rlcP->poll_pdu) ||
|
||||
(rlcP->c_byte_without_poll >= rlcP->poll_byte) ||
|
||||
((rlcP->sdu_buffer_occupancy == 0) && (rlcP->retrans_num_bytes_to_retransmit == 0)) ||
|
||||
(rlcP->vt_s == rlcP->vt_ms)
|
||||
(rlc_pP->c_pdu_without_poll >= rlc_pP->poll_pdu) ||
|
||||
(rlc_pP->c_byte_without_poll >= rlc_pP->poll_byte) ||
|
||||
((rlc_pP->sdu_buffer_occupancy == 0) && (rlc_pP->retrans_num_bytes_to_retransmit == 0)) ||
|
||||
(rlc_pP->vt_s == rlc_pP->vt_ms)
|
||||
) {
|
||||
|
||||
if (rlcP->c_pdu_without_poll >= rlcP->poll_pdu) {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][POLL] SET POLL BECAUSE TX NUM PDU THRESHOLD %d HAS BEEN REACHED\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->poll_pdu);
|
||||
if (rlc_pP->c_pdu_without_poll >= rlc_pP->poll_pdu) {
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][POLL] SET POLL BECAUSE TX NUM PDU THRESHOLD %d HAS BEEN REACHED\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->poll_pdu);
|
||||
}
|
||||
if (rlcP->c_pdu_without_poll >= rlcP->poll_pdu) {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][POLL] SET POLL BECAUSE TX NUM BYTES THRESHOLD %d HAS BEEN REACHED\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->poll_byte);
|
||||
if (rlc_pP->c_pdu_without_poll >= rlc_pP->poll_pdu) {
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][POLL] SET POLL BECAUSE TX NUM BYTES THRESHOLD %d HAS BEEN REACHED\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->poll_byte);
|
||||
}
|
||||
if ((rlcP->sdu_buffer_occupancy == 0) && (rlcP->retrans_num_bytes_to_retransmit == 0)) {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][POLL] SET POLL BECAUSE TX BUFFERS ARE EMPTY\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
if ((rlc_pP->sdu_buffer_occupancy == 0) && (rlc_pP->retrans_num_bytes_to_retransmit == 0)) {
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][POLL] SET POLL BECAUSE TX BUFFERS ARE EMPTY\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
}
|
||||
if (rlcP->vt_s == rlcP->vt_ms) {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][POLL] SET POLL BECAUSE OF WINDOW STALLING\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
if (rlc_pP->vt_s == rlc_pP->vt_ms) {
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][POLL] SET POLL BECAUSE OF WINDOW STALLING\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
}
|
||||
pduP->b1 = pduP->b1 | 0x20;
|
||||
rlcP->c_pdu_without_poll = 0;
|
||||
rlcP->c_byte_without_poll = 0;
|
||||
pdu_pP->b1 = pdu_pP->b1 | 0x20;
|
||||
rlc_pP->c_pdu_without_poll = 0;
|
||||
rlc_pP->c_byte_without_poll = 0;
|
||||
|
||||
rlcP->poll_sn = (rlcP->vt_s -1) & RLC_AM_SN_MASK;
|
||||
//optimisation if (!rlcP->t_poll_retransmit.running) {
|
||||
rlc_am_start_timer_poll_retransmit(rlcP,frame);
|
||||
rlc_pP->poll_sn = (rlc_pP->vt_s -1) & RLC_AM_SN_MASK;
|
||||
//optimisation if (!rlc_pP->t_poll_retransmit.running) {
|
||||
rlc_am_start_timer_poll_retransmit(rlc_pP,frameP);
|
||||
//optimisation } else {
|
||||
//optimisation rlcP->t_poll_retransmit.frame_time_out = frame + rlcP->t_poll_retransmit.time_out;
|
||||
//optimisation rlc_pP->t_poll_retransmit.frame_time_out = frameP + rlc_pP->t_poll_retransmit.time_out;
|
||||
//optimisation }
|
||||
} else {
|
||||
pduP->b1 = pduP->b1 & 0xDF;
|
||||
pdu_pP->b1 = pdu_pP->b1 & 0xDF;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_segment_10 (rlc_am_entity_t *rlcP,u32_t frame)
|
||||
void rlc_am_segment_10 (rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
list_t pdus;
|
||||
signed int pdu_remaining_size;
|
||||
signed int test_pdu_remaining_size;
|
||||
signed int pdu_remaining_size = 0;
|
||||
signed int test_pdu_remaining_size = 0;
|
||||
|
||||
int nb_bytes_to_transmit = rlcP->nb_bytes_requested_by_mac;
|
||||
rlc_am_pdu_sn_10_t *pdu;
|
||||
struct mac_tb_req *pdu_tb_req;
|
||||
mem_block_t *pdu_mem;
|
||||
unsigned char *data;
|
||||
unsigned char *data_sdu;
|
||||
rlc_am_e_li_t *e_li;
|
||||
rlc_am_tx_sdu_management_t *sdu_mngt;
|
||||
rlc_am_tx_data_pdu_management_t *pdu_mngt;
|
||||
int nb_bytes_to_transmit = rlc_pP->nb_bytes_requested_by_mac;
|
||||
rlc_am_pdu_sn_10_t *pdu_p = NULL;
|
||||
struct mac_tb_req *pdu_tb_req_p = NULL;
|
||||
mem_block_t *pdu_mem_p = NULL;
|
||||
unsigned char *data = NULL;
|
||||
unsigned char *data_sdu_p = NULL;
|
||||
rlc_am_e_li_t *e_li_p = NULL;
|
||||
rlc_am_tx_sdu_management_t *sdu_mngt_p = NULL;
|
||||
rlc_am_tx_data_pdu_management_t *pdu_mngt_p = NULL;
|
||||
|
||||
unsigned int li_length_in_bytes;
|
||||
unsigned int test_li_length_in_bytes;
|
||||
unsigned int test_remaining_size_to_substract;
|
||||
unsigned int test_remaining_num_li_to_substract;
|
||||
unsigned int continue_fill_pdu_with_sdu;
|
||||
unsigned int num_fill_sdu;
|
||||
unsigned int test_num_li;
|
||||
unsigned int fill_num_li;
|
||||
unsigned int sdu_buffer_index;
|
||||
unsigned int data_pdu_size;
|
||||
unsigned int li_length_in_bytes = 0;
|
||||
unsigned int test_li_length_in_bytes = 0;
|
||||
unsigned int test_remaining_size_to_substract= 0;
|
||||
unsigned int test_remaining_num_li_to_substract = 0;
|
||||
unsigned int continue_fill_pdu_with_sdu = 0;
|
||||
unsigned int num_fill_sdu = 0;
|
||||
unsigned int test_num_li = 0;
|
||||
unsigned int fill_num_li = 0;
|
||||
unsigned int sdu_buffer_index = 0;
|
||||
unsigned int data_pdu_size = 0;
|
||||
|
||||
unsigned int fi_first_byte_pdu_is_first_byte_sdu;
|
||||
unsigned int fi_last_byte_pdu_is_last_byte_sdu;
|
||||
unsigned int fi;
|
||||
unsigned int max_li_overhead;
|
||||
unsigned int fi_first_byte_pdu_is_first_byte_sdu = 0;
|
||||
unsigned int fi_last_byte_pdu_is_last_byte_sdu = 0;
|
||||
unsigned int fi = 0;
|
||||
unsigned int max_li_overhead = 0;
|
||||
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] rlcP->current_sdu_index %d rlcP->next_sdu_index %d rlcP->input_sdus[rlcP->current_sdu_index].mem_block %p sdu_buffer_occupancy %d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->current_sdu_index, rlcP->next_sdu_index, rlcP->input_sdus[rlcP->current_sdu_index].mem_block, rlcP->sdu_buffer_occupancy);
|
||||
if (rlcP->sdu_buffer_occupancy <= 0) {
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] rlc_pP->current_sdu_index %d rlc_pP->next_sdu_index %d rlc_pP->input_sdus[rlc_pP->current_sdu_index].mem_block %p sdu_buffer_occupancy %d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->current_sdu_index,
|
||||
rlc_pP->next_sdu_index,
|
||||
rlc_pP->input_sdus[rlc_pP->current_sdu_index].mem_block,
|
||||
rlc_pP->sdu_buffer_occupancy);
|
||||
if (rlc_pP->sdu_buffer_occupancy <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT]\n", rlcP->module_id, rlcP->rb_id, frame);
|
||||
//msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT]\n", rlc_pP->module_id, rlc_pP->rb_id, frameP);
|
||||
list_init (&pdus, NULL); // param string identifying the list is NULL
|
||||
pdu_mem = NULL;
|
||||
pdu_mem_p = NULL;
|
||||
|
||||
|
||||
while ((rlcP->input_sdus[rlcP->current_sdu_index].mem_block) && (nb_bytes_to_transmit > 0) ) {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] nb_bytes_to_transmit %d BO %d\n", frame, rlcP->module_id, rlcP->rb_id, nb_bytes_to_transmit, rlcP->sdu_buffer_occupancy);
|
||||
// pdu management
|
||||
if (!pdu_mem) {
|
||||
if (rlcP->nb_sdu_no_segmented <= 1) {
|
||||
while ((rlc_pP->input_sdus[rlc_pP->current_sdu_index].mem_block) && (nb_bytes_to_transmit > 0) ) {
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] nb_bytes_to_transmit %d BO %d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
nb_bytes_to_transmit,
|
||||
rlc_pP->sdu_buffer_occupancy);
|
||||
// pdu_p management
|
||||
if (!pdu_mem_p) {
|
||||
if (rlc_pP->nb_sdu_no_segmented <= 1) {
|
||||
max_li_overhead = 0;
|
||||
} else {
|
||||
max_li_overhead = (((rlcP->nb_sdu_no_segmented - 1) * 3) / 2) + ((rlcP->nb_sdu_no_segmented - 1) % 2);
|
||||
max_li_overhead = (((rlc_pP->nb_sdu_no_segmented - 1) * 3) / 2) + ((rlc_pP->nb_sdu_no_segmented - 1) % 2);
|
||||
}
|
||||
LOG_T(RLC, "FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] max_li_overhead %d\n", frame, rlcP->module_id, rlcP->rb_id, max_li_overhead);
|
||||
if (nb_bytes_to_transmit >= (rlcP->sdu_buffer_occupancy + RLC_AM_HEADER_MIN_SIZE + max_li_overhead)) {
|
||||
data_pdu_size = rlcP->sdu_buffer_occupancy + RLC_AM_HEADER_MIN_SIZE + max_li_overhead;
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] alloc PDU size %d bytes to contain not all bytes requested by MAC but all BO of RLC@1\n", frame, rlcP->module_id, rlcP->rb_id, data_pdu_size);
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] max_li_overhead %d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
max_li_overhead);
|
||||
if (nb_bytes_to_transmit >= (rlc_pP->sdu_buffer_occupancy + RLC_AM_HEADER_MIN_SIZE + max_li_overhead)) {
|
||||
data_pdu_size = rlc_pP->sdu_buffer_occupancy + RLC_AM_HEADER_MIN_SIZE + max_li_overhead;
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] alloc PDU size %d bytes to contain not all bytes requested by MAC but all BO of RLC@1\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
data_pdu_size);
|
||||
} else {
|
||||
data_pdu_size = nb_bytes_to_transmit;
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] alloc PDU size %d bytes to contain all bytes requested by MAC@1\n", frame, rlcP->module_id, rlcP->rb_id, data_pdu_size);
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] alloc PDU size %d bytes to contain all bytes requested by MAC@1\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
data_pdu_size);
|
||||
}
|
||||
if (!(pdu_mem = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req)))) {
|
||||
LOG_C(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req)))) {
|
||||
LOG_C(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
return;
|
||||
}
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] get new PDU %d bytes\n", frame, rlcP->module_id, rlcP->rb_id, data_pdu_size);
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] get new PDU %d bytes\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
data_pdu_size);
|
||||
pdu_remaining_size = data_pdu_size - RLC_AM_HEADER_MIN_SIZE;
|
||||
pdu = (rlc_am_pdu_sn_10_t*) (&pdu_mem->data[sizeof(struct mac_tb_req)]);
|
||||
pdu_tb_req = (struct mac_tb_req*) (pdu_mem->data);
|
||||
pdu_mngt = &rlcP->pdu_retrans_buffer[rlcP->vt_s % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE];
|
||||
memset(pdu_mngt, 0, sizeof (rlc_am_tx_data_pdu_management_t));
|
||||
pdu_p = (rlc_am_pdu_sn_10_t*) (&pdu_mem_p->data[sizeof(struct mac_tb_req)]);
|
||||
pdu_tb_req_p = (struct mac_tb_req*) (pdu_mem_p->data);
|
||||
pdu_mngt_p = &rlc_pP->pdu_retrans_buffer[rlc_pP->vt_s % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE];
|
||||
memset(pdu_mngt_p, 0, sizeof (rlc_am_tx_data_pdu_management_t));
|
||||
|
||||
memset (pdu_mem->data, 0, sizeof (rlc_am_pdu_sn_10_t)+sizeof(struct mac_tb_req));
|
||||
memset (pdu_mem_p->data, 0, sizeof (rlc_am_pdu_sn_10_t)+sizeof(struct mac_tb_req));
|
||||
li_length_in_bytes = 1;
|
||||
}
|
||||
//----------------------------------------
|
||||
@@ -189,31 +256,31 @@ void rlc_am_segment_10 (rlc_am_entity_t *rlcP,u32_t frame)
|
||||
continue_fill_pdu_with_sdu = 1;
|
||||
num_fill_sdu = 0;
|
||||
test_num_li = 0;
|
||||
sdu_buffer_index = rlcP->current_sdu_index;
|
||||
sdu_buffer_index = rlc_pP->current_sdu_index;
|
||||
test_pdu_remaining_size = pdu_remaining_size;
|
||||
test_li_length_in_bytes = 1;
|
||||
test_remaining_size_to_substract = 0;
|
||||
test_remaining_num_li_to_substract = 0;
|
||||
|
||||
|
||||
while ((rlcP->input_sdus[sdu_buffer_index].mem_block) && (continue_fill_pdu_with_sdu > 0)) {
|
||||
sdu_mngt = &rlcP->input_sdus[sdu_buffer_index];
|
||||
while ((rlc_pP->input_sdus[sdu_buffer_index].mem_block) && (continue_fill_pdu_with_sdu > 0)) {
|
||||
sdu_mngt_p = &rlc_pP->input_sdus[sdu_buffer_index];
|
||||
|
||||
if (sdu_mngt->sdu_remaining_size > test_pdu_remaining_size) {
|
||||
if (sdu_mngt_p->sdu_remaining_size > test_pdu_remaining_size) {
|
||||
// no LI
|
||||
continue_fill_pdu_with_sdu = 0;
|
||||
num_fill_sdu += 1;
|
||||
test_pdu_remaining_size = 0;
|
||||
test_remaining_size_to_substract = 0;
|
||||
test_remaining_num_li_to_substract = 0;
|
||||
} else if (sdu_mngt->sdu_remaining_size == test_pdu_remaining_size) {
|
||||
} else if (sdu_mngt_p->sdu_remaining_size == test_pdu_remaining_size) {
|
||||
// fi will indicate end of PDU is end of SDU, no need for LI
|
||||
continue_fill_pdu_with_sdu = 0;
|
||||
num_fill_sdu += 1;
|
||||
test_pdu_remaining_size = 0;
|
||||
test_remaining_size_to_substract = 0;
|
||||
test_remaining_num_li_to_substract = 0;
|
||||
} else if ((sdu_mngt->sdu_remaining_size + (test_li_length_in_bytes ^ 3)) == test_pdu_remaining_size ) {
|
||||
} else if ((sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3)) == test_pdu_remaining_size ) {
|
||||
// no LI
|
||||
continue_fill_pdu_with_sdu = 0;
|
||||
num_fill_sdu += 1;
|
||||
@@ -221,8 +288,8 @@ void rlc_am_segment_10 (rlc_am_entity_t *rlcP,u32_t frame)
|
||||
test_remaining_size_to_substract = 0;
|
||||
test_remaining_num_li_to_substract = 0;
|
||||
pdu_remaining_size = pdu_remaining_size - (test_li_length_in_bytes ^ 3);
|
||||
} else if ((sdu_mngt->sdu_remaining_size + (test_li_length_in_bytes ^ 3)) < test_pdu_remaining_size ) {
|
||||
if (pdu_mngt->nb_sdus >= (RLC_AM_MAX_SDU_IN_PDU-1)) {
|
||||
} else if ((sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3)) < test_pdu_remaining_size ) {
|
||||
if (pdu_mngt_p->nb_sdus >= (RLC_AM_MAX_SDU_IN_PDU-1)) {
|
||||
continue_fill_pdu_with_sdu = 0;
|
||||
//num_fill_sdu += 1;
|
||||
test_pdu_remaining_size = 0;
|
||||
@@ -232,13 +299,21 @@ void rlc_am_segment_10 (rlc_am_entity_t *rlcP,u32_t frame)
|
||||
} else {
|
||||
test_num_li += 1;
|
||||
num_fill_sdu += 1;
|
||||
test_pdu_remaining_size = test_pdu_remaining_size - (sdu_mngt->sdu_remaining_size + (test_li_length_in_bytes ^ 3));
|
||||
test_pdu_remaining_size = test_pdu_remaining_size - (sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3));
|
||||
test_remaining_size_to_substract = test_li_length_in_bytes ^ 3;
|
||||
test_remaining_num_li_to_substract = 1;
|
||||
test_li_length_in_bytes = test_li_length_in_bytes ^ 3;
|
||||
}
|
||||
} else {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] sdu_mngt->sdu_remaining_size=%d test_pdu_remaining_size=%d test_li_length_in_bytes=%d\n", frame, rlcP->module_id, rlcP->rb_id, sdu_mngt->sdu_remaining_size, test_pdu_remaining_size, test_li_length_in_bytes ^ 3);
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] sdu_mngt_p->sdu_remaining_size=%d test_pdu_remaining_size=%d test_li_length_in_bytes=%d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
sdu_mngt_p->sdu_remaining_size,
|
||||
test_pdu_remaining_size,
|
||||
test_li_length_in_bytes ^ 3);
|
||||
// reduce the size of the PDU
|
||||
continue_fill_pdu_with_sdu = 0;
|
||||
num_fill_sdu += 1;
|
||||
@@ -247,9 +322,9 @@ void rlc_am_segment_10 (rlc_am_entity_t *rlcP,u32_t frame)
|
||||
test_remaining_num_li_to_substract = 0;
|
||||
pdu_remaining_size = pdu_remaining_size - 1;
|
||||
}
|
||||
pdu_mngt->sdus_index[pdu_mngt->nb_sdus++] = sdu_buffer_index;
|
||||
sdu_mngt->pdus_index[sdu_mngt->nb_pdus++] = rlcP->vt_s % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE;
|
||||
assert(sdu_mngt->nb_pdus < RLC_AM_MAX_SDU_FRAGMENTS);
|
||||
pdu_mngt_p->sdus_index[pdu_mngt_p->nb_sdus++] = sdu_buffer_index;
|
||||
sdu_mngt_p->pdus_index[sdu_mngt_p->nb_pdus++] = rlc_pP->vt_s % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE;
|
||||
assert(sdu_mngt_p->nb_pdus < RLC_AM_MAX_SDU_FRAGMENTS);
|
||||
sdu_buffer_index = (sdu_buffer_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
|
||||
}
|
||||
if (test_remaining_num_li_to_substract > 0) {
|
||||
@@ -258,134 +333,212 @@ void rlc_am_segment_10 (rlc_am_entity_t *rlcP,u32_t frame)
|
||||
pdu_remaining_size = pdu_remaining_size - test_remaining_size_to_substract;
|
||||
}
|
||||
//----------------------------------------
|
||||
// Do the real filling of the pdu
|
||||
// Do the real filling of the pdu_p
|
||||
//----------------------------------------
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] data shift %d Bytes num_li %d\n", frame, rlcP->module_id, rlcP->rb_id, ((test_num_li*3) +1) >> 1, test_num_li);
|
||||
data = ((unsigned char*)(&pdu->data[((test_num_li*3) +1) >> 1]));
|
||||
pdu_mngt->payload = data;
|
||||
e_li = (rlc_am_e_li_t*)(pdu->data);
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u] data shift %d Bytes num_li %d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
((test_num_li*3) +1) >> 1,
|
||||
test_num_li);
|
||||
data = ((unsigned char*)(&pdu_p->data[((test_num_li*3) +1) >> 1]));
|
||||
pdu_mngt_p->payload = data;
|
||||
e_li_p = (rlc_am_e_li_t*)(pdu_p->data);
|
||||
continue_fill_pdu_with_sdu = 1;
|
||||
li_length_in_bytes = 1;
|
||||
fill_num_li = 0;
|
||||
fi_first_byte_pdu_is_first_byte_sdu = 0;
|
||||
fi_last_byte_pdu_is_last_byte_sdu = 0;
|
||||
|
||||
if (rlcP->input_sdus[rlcP->current_sdu_index].sdu_remaining_size ==
|
||||
rlcP->input_sdus[rlcP->current_sdu_index].sdu_size) {
|
||||
if (rlc_pP->input_sdus[rlc_pP->current_sdu_index].sdu_remaining_size ==
|
||||
rlc_pP->input_sdus[rlc_pP->current_sdu_index].sdu_size) {
|
||||
fi_first_byte_pdu_is_first_byte_sdu = 1;
|
||||
}
|
||||
while ((rlcP->input_sdus[rlcP->current_sdu_index].mem_block) && (continue_fill_pdu_with_sdu > 0)) {
|
||||
sdu_mngt = &rlcP->input_sdus[rlcP->current_sdu_index];
|
||||
if (sdu_mngt->sdu_segmented_size == 0) {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] GET NEW SDU %p AVAILABLE SIZE %d Bytes\n", frame, rlcP->module_id, rlcP->rb_id, sdu_mngt, sdu_mngt->sdu_remaining_size);
|
||||
while ((rlc_pP->input_sdus[rlc_pP->current_sdu_index].mem_block) && (continue_fill_pdu_with_sdu > 0)) {
|
||||
sdu_mngt_p = &rlc_pP->input_sdus[rlc_pP->current_sdu_index];
|
||||
if (sdu_mngt_p->sdu_segmented_size == 0) {
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] GET NEW SDU %p AVAILABLE SIZE %d Bytes\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
sdu_mngt_p,
|
||||
sdu_mngt_p->sdu_remaining_size);
|
||||
} else {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] GET AGAIN SDU %p REMAINING AVAILABLE SIZE %d Bytes / %d Bytes LENGTH \n", frame, rlcP->module_id, rlcP->rb_id, sdu_mngt, sdu_mngt->sdu_remaining_size, sdu_mngt->sdu_size);
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] GET AGAIN SDU %p REMAINING AVAILABLE SIZE %d Bytes / %d Bytes LENGTH \n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
sdu_mngt_p,
|
||||
sdu_mngt_p->sdu_remaining_size,
|
||||
sdu_mngt_p->sdu_size);
|
||||
}
|
||||
data_sdu = &sdu_mngt->first_byte[sdu_mngt->sdu_segmented_size];
|
||||
data_sdu_p = &sdu_mngt_p->first_byte[sdu_mngt_p->sdu_segmented_size];
|
||||
|
||||
if (sdu_mngt->sdu_remaining_size > pdu_remaining_size) {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] Filling all remaining PDU with %d bytes\n", frame, rlcP->module_id, rlcP->rb_id, pdu_remaining_size);
|
||||
//msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] pdu_mem %p pdu %p pdu->data %p data %p data_sdu %p pdu_remaining_size %d\n", rlcP->module_id, rlcP->rb_id, frame, pdu_mem, pdu, pdu->data, data, data_sdu,pdu_remaining_size);
|
||||
if (sdu_mngt_p->sdu_remaining_size > pdu_remaining_size) {
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] Filling all remaining PDU with %d bytes\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
pdu_remaining_size);
|
||||
//msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] pdu_mem_p %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n", rlc_pP->module_id, rlc_pP->rb_id, frameP, pdu_mem_p, pdu_p, pdu_p->data, data, data_sdu_p,pdu_remaining_size);
|
||||
|
||||
memcpy(data, data_sdu, pdu_remaining_size);
|
||||
pdu_mngt->payload_size += pdu_remaining_size;
|
||||
sdu_mngt->sdu_remaining_size = sdu_mngt->sdu_remaining_size - pdu_remaining_size;
|
||||
sdu_mngt->sdu_segmented_size = sdu_mngt->sdu_segmented_size + pdu_remaining_size;
|
||||
memcpy(data, data_sdu_p, pdu_remaining_size);
|
||||
pdu_mngt_p->payload_size += pdu_remaining_size;
|
||||
sdu_mngt_p->sdu_remaining_size = sdu_mngt_p->sdu_remaining_size - pdu_remaining_size;
|
||||
sdu_mngt_p->sdu_segmented_size = sdu_mngt_p->sdu_segmented_size + pdu_remaining_size;
|
||||
fi_last_byte_pdu_is_last_byte_sdu = 0;
|
||||
// no LI
|
||||
rlcP->sdu_buffer_occupancy -= pdu_remaining_size;
|
||||
rlc_pP->sdu_buffer_occupancy -= pdu_remaining_size;
|
||||
continue_fill_pdu_with_sdu = 0;
|
||||
pdu_remaining_size = 0;
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] sdu_remaining_size %d bytes sdu_segmented_size %d bytes\n", frame, rlcP->module_id, rlcP->rb_id, sdu_mngt->sdu_remaining_size, sdu_mngt->sdu_segmented_size);
|
||||
} else if (sdu_mngt->sdu_remaining_size == pdu_remaining_size) {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] Exactly Filling remaining PDU with %d remaining bytes of SDU\n", frame, rlcP->module_id, rlcP->rb_id, pdu_remaining_size);
|
||||
memcpy(data, data_sdu, pdu_remaining_size);
|
||||
pdu_mngt->payload_size += pdu_remaining_size;
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] sdu_remaining_size %d bytes sdu_segmented_size %d bytes\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
sdu_mngt_p->sdu_remaining_size,
|
||||
sdu_mngt_p->sdu_segmented_size);
|
||||
} else if (sdu_mngt_p->sdu_remaining_size == pdu_remaining_size) {
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] Exactly Filling remaining PDU with %d remaining bytes of SDU\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
pdu_remaining_size);
|
||||
memcpy(data, data_sdu_p, pdu_remaining_size);
|
||||
pdu_mngt_p->payload_size += pdu_remaining_size;
|
||||
|
||||
// free SDU
|
||||
rlcP->sdu_buffer_occupancy -= sdu_mngt->sdu_remaining_size;
|
||||
rlc_am_free_in_sdu_data(rlcP, rlcP->current_sdu_index);
|
||||
//free_mem_block (rlcP->input_sdus[rlcP->current_sdu_index]);
|
||||
//rlcP->input_sdus[rlcP->current_sdu_index] = NULL;
|
||||
//rlcP->nb_sdu -= 1;
|
||||
rlcP->current_sdu_index = (rlcP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
|
||||
rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
|
||||
rlc_am_free_in_sdu_data(rlc_pP, rlc_pP->current_sdu_index);
|
||||
//free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index]);
|
||||
//rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
|
||||
//rlc_pP->nb_sdu -= 1;
|
||||
rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
|
||||
|
||||
fi_last_byte_pdu_is_last_byte_sdu = 1;
|
||||
// fi will indicate end of PDU is end of SDU, no need for LI
|
||||
continue_fill_pdu_with_sdu = 0;
|
||||
pdu_remaining_size = 0;
|
||||
} else if ((sdu_mngt->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) {
|
||||
} else if ((sdu_mngt_p->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) {
|
||||
if (fill_num_li == (RLC_AM_MAX_SDU_IN_PDU - 1)) {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] [SIZE %d] REACHING RLC_AM_MAX_SDU_IN_PDU LIs -> STOP SEGMENTATION FOR THIS PDU SDU\n", frame, rlcP->module_id, rlcP->rb_id, sdu_mngt->sdu_remaining_size);
|
||||
memcpy(data, data_sdu, sdu_mngt->sdu_remaining_size);
|
||||
pdu_mngt->payload_size += sdu_mngt->sdu_remaining_size;
|
||||
pdu_remaining_size = 0; //Forced to 0 pdu_remaining_size - sdu_mngt->sdu_remaining_size;
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] [SIZE %d] REACHING RLC_AM_MAX_SDU_IN_PDU LIs -> STOP SEGMENTATION FOR THIS PDU SDU\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
sdu_mngt_p->sdu_remaining_size);
|
||||
memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
|
||||
pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size;
|
||||
pdu_remaining_size = 0; //Forced to 0 pdu_remaining_size - sdu_mngt_p->sdu_remaining_size;
|
||||
// free SDU
|
||||
rlcP->sdu_buffer_occupancy -= sdu_mngt->sdu_remaining_size;
|
||||
rlc_am_free_in_sdu_data(rlcP, rlcP->current_sdu_index);
|
||||
//rlcP->input_sdus[rlcP->current_sdu_index] = NULL;
|
||||
//rlcP->nb_sdu -= 1;
|
||||
rlcP->current_sdu_index = (rlcP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
|
||||
rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
|
||||
rlc_am_free_in_sdu_data(rlc_pP, rlc_pP->current_sdu_index);
|
||||
//rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
|
||||
//rlc_pP->nb_sdu -= 1;
|
||||
rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
|
||||
|
||||
// reduce the size of the PDU
|
||||
continue_fill_pdu_with_sdu = 0;
|
||||
fi_last_byte_pdu_is_last_byte_sdu = 1;
|
||||
} else {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] Filling PDU with %d all remaining bytes of SDU\n", frame, rlcP->module_id, rlcP->rb_id, sdu_mngt->sdu_remaining_size);
|
||||
memcpy(data, data_sdu, sdu_mngt->sdu_remaining_size);
|
||||
pdu_mngt->payload_size += sdu_mngt->sdu_remaining_size;
|
||||
data = &data[sdu_mngt->sdu_remaining_size];
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] Filling PDU with %d all remaining bytes of SDU\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
sdu_mngt_p->sdu_remaining_size);
|
||||
memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
|
||||
pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size;
|
||||
data = &data[sdu_mngt_p->sdu_remaining_size];
|
||||
li_length_in_bytes = li_length_in_bytes ^ 3;
|
||||
fill_num_li += 1;
|
||||
if (li_length_in_bytes == 2) {
|
||||
if (fill_num_li == test_num_li) {
|
||||
//e_li->e1 = 0;
|
||||
e_li->b1 = 0;
|
||||
//e_li_p->e1 = 0;
|
||||
e_li_p->b1 = 0;
|
||||
} else {
|
||||
//e_li->e1 = 1;
|
||||
e_li->b1 = 0x80;
|
||||
//e_li_p->e1 = 1;
|
||||
e_li_p->b1 = 0x80;
|
||||
}
|
||||
//e_li->li1 = sdu_mngt->sdu_remaining_size;
|
||||
e_li->b1 = e_li->b1 | (sdu_mngt->sdu_remaining_size >> 4);
|
||||
e_li->b2 = sdu_mngt->sdu_remaining_size << 4;
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] set e_li->b1=0x%02X set e_li->b2=0x%02X fill_num_li=%d test_num_li=%d\n", frame, rlcP->module_id, rlcP->rb_id, e_li->b1, e_li->b2, fill_num_li, test_num_li);
|
||||
//e_li_p->li1 = sdu_mngt_p->sdu_remaining_size;
|
||||
e_li_p->b1 = e_li_p->b1 | (sdu_mngt_p->sdu_remaining_size >> 4);
|
||||
e_li_p->b2 = sdu_mngt_p->sdu_remaining_size << 4;
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] set e_li_p->b1=0x%02X set e_li_p->b2=0x%02X fill_num_li=%d test_num_li=%d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
e_li_p->b1,
|
||||
e_li_p->b2,
|
||||
fill_num_li,
|
||||
test_num_li);
|
||||
} else {
|
||||
if (fill_num_li != test_num_li) {
|
||||
//e_li->e2 = 1;
|
||||
e_li->b2 = e_li->b2 | 0x08;
|
||||
//e_li_p->e2 = 1;
|
||||
e_li_p->b2 = e_li_p->b2 | 0x08;
|
||||
}
|
||||
//e_li->li2 = sdu_mngt->sdu_remaining_size;
|
||||
e_li->b2 = e_li->b2 | (sdu_mngt->sdu_remaining_size >> 8);
|
||||
e_li->b3 = sdu_mngt->sdu_remaining_size & 0xFF;
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] set e_li->b2=0x%02X set e_li->b3=0x%02X fill_num_li=%d test_num_li=%d\n", frame, rlcP->module_id, rlcP->rb_id, e_li->b2, e_li->b3, fill_num_li, test_num_li);
|
||||
e_li++;
|
||||
//e_li_p->li2 = sdu_mngt_p->sdu_remaining_size;
|
||||
e_li_p->b2 = e_li_p->b2 | (sdu_mngt_p->sdu_remaining_size >> 8);
|
||||
e_li_p->b3 = sdu_mngt_p->sdu_remaining_size & 0xFF;
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] set e_li_p->b2=0x%02X set e_li_p->b3=0x%02X fill_num_li=%d test_num_li=%d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
e_li_p->b2,
|
||||
e_li_p->b3,
|
||||
fill_num_li,
|
||||
test_num_li);
|
||||
e_li_p++;
|
||||
}
|
||||
|
||||
pdu_remaining_size = pdu_remaining_size - (sdu_mngt->sdu_remaining_size + li_length_in_bytes);
|
||||
pdu_remaining_size = pdu_remaining_size - (sdu_mngt_p->sdu_remaining_size + li_length_in_bytes);
|
||||
// free SDU
|
||||
rlcP->sdu_buffer_occupancy -= sdu_mngt->sdu_remaining_size;
|
||||
sdu_mngt->sdu_remaining_size = 0;
|
||||
rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
|
||||
sdu_mngt_p->sdu_remaining_size = 0;
|
||||
|
||||
rlc_am_free_in_sdu_data(rlcP, rlcP->current_sdu_index);
|
||||
//free_mem_block (rlcP->input_sdus[rlcP->current_sdu_index]);
|
||||
//rlcP->input_sdus[rlcP->current_sdu_index] = NULL;
|
||||
//rlcP->nb_sdu -= 1;
|
||||
rlcP->current_sdu_index = (rlcP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
|
||||
rlc_am_free_in_sdu_data(rlc_pP, rlc_pP->current_sdu_index);
|
||||
//free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index]);
|
||||
//rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
|
||||
//rlc_pP->nb_sdu -= 1;
|
||||
rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
|
||||
}
|
||||
} else {
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n", frame, rlcP->module_id, rlcP->rb_id, sdu_mngt->sdu_remaining_size, pdu_remaining_size - sdu_mngt->sdu_remaining_size);
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
sdu_mngt_p->sdu_remaining_size,
|
||||
pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
|
||||
#ifdef USER_MODE
|
||||
assert(1!=1);
|
||||
#endif
|
||||
memcpy(data, data_sdu, sdu_mngt->sdu_remaining_size);
|
||||
pdu_mngt->payload_size += sdu_mngt->sdu_remaining_size;
|
||||
pdu_remaining_size = pdu_remaining_size - sdu_mngt->sdu_remaining_size;
|
||||
memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
|
||||
pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size;
|
||||
pdu_remaining_size = pdu_remaining_size - sdu_mngt_p->sdu_remaining_size;
|
||||
// free SDU
|
||||
rlcP->sdu_buffer_occupancy -= sdu_mngt->sdu_remaining_size;
|
||||
rlc_am_free_in_sdu_data(rlcP, rlcP->current_sdu_index);
|
||||
//rlcP->input_sdus[rlcP->current_sdu_index] = NULL;
|
||||
//rlcP->nb_sdu -= 1;
|
||||
rlcP->current_sdu_index = (rlcP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
|
||||
rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
|
||||
rlc_am_free_in_sdu_data(rlc_pP, rlc_pP->current_sdu_index);
|
||||
//rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
|
||||
//rlc_pP->nb_sdu -= 1;
|
||||
rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
|
||||
|
||||
// reduce the size of the PDU
|
||||
continue_fill_pdu_with_sdu = 0;
|
||||
@@ -402,52 +555,54 @@ void rlc_am_segment_10 (rlc_am_entity_t *rlcP,u32_t frame)
|
||||
if (!fi_last_byte_pdu_is_last_byte_sdu) {
|
||||
fi = fi + 1;
|
||||
}
|
||||
pdu->b1 = pdu->b1 | (fi << 3);
|
||||
pdu_p->b1 = pdu_p->b1 | (fi << 3);
|
||||
|
||||
// set fist e bit
|
||||
if (fill_num_li > 0) {
|
||||
pdu->b1 = pdu->b1 | 0x04;
|
||||
pdu_p->b1 = pdu_p->b1 | 0x04;
|
||||
}
|
||||
LOG_T(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEGMENT] SEND PDU SN %04d SIZE %d BYTES PAYLOAD SIZE %d BYTES\n",
|
||||
frame,
|
||||
rlcP->module_id,
|
||||
rlcP->rb_id,
|
||||
rlcP->vt_s,
|
||||
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] SEND PDU SN %04d SIZE %d BYTES PAYLOAD SIZE %d BYTES\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->vt_s,
|
||||
data_pdu_size - pdu_remaining_size,
|
||||
pdu_mngt->payload_size);
|
||||
pdu_mngt_p->payload_size);
|
||||
|
||||
rlcP->stat_tx_data_pdu += 1;
|
||||
rlcP->stat_tx_data_bytes += (data_pdu_size - pdu_remaining_size);
|
||||
rlc_pP->stat_tx_data_pdu += 1;
|
||||
rlc_pP->stat_tx_data_bytes += (data_pdu_size - pdu_remaining_size);
|
||||
|
||||
//pdu->sn = rlcP->vt_s;
|
||||
pdu->b1 = pdu->b1 | 0x80; // DATA/CONTROL field is DATA PDU
|
||||
pdu->b1 = pdu->b1 | (rlcP->vt_s >> 8);
|
||||
pdu->b2 = rlcP->vt_s & 0xFF;
|
||||
rlcP->vt_s = (rlcP->vt_s+1) & RLC_AM_SN_MASK;
|
||||
//pdu_p->sn = rlc_pP->vt_s;
|
||||
pdu_p->b1 = pdu_p->b1 | 0x80; // DATA/CONTROL field is DATA PDU
|
||||
pdu_p->b1 = pdu_p->b1 | (rlc_pP->vt_s >> 8);
|
||||
pdu_p->b2 = rlc_pP->vt_s & 0xFF;
|
||||
rlc_pP->vt_s = (rlc_pP->vt_s+1) & RLC_AM_SN_MASK;
|
||||
|
||||
pdu_tb_req->data_ptr = (unsigned char*)pdu;
|
||||
pdu_tb_req->tb_size = data_pdu_size - pdu_remaining_size;
|
||||
pdu_tb_req_p->data_ptr = (unsigned char*)pdu_p;
|
||||
pdu_tb_req_p->tb_size = data_pdu_size - pdu_remaining_size;
|
||||
|
||||
assert(pdu_tb_req->tb_size < 3000);
|
||||
rlc_am_pdu_polling(rlcP, frame,pdu, pdu_mngt->payload_size);
|
||||
assert(pdu_tb_req_p->tb_size < 3000);
|
||||
rlc_am_pdu_polling(rlc_pP, frameP,pdu_p, pdu_mngt_p->payload_size);
|
||||
|
||||
//list_add_tail_eurecom (pdu_mem, &rlcP->segmentation_pdu_list);
|
||||
pdu_mngt->mem_block = pdu_mem;
|
||||
pdu_mngt->first_byte = (unsigned char*)pdu;
|
||||
pdu_mngt->header_and_payload_size = data_pdu_size - pdu_remaining_size;
|
||||
pdu_mngt->retx_count = -1;
|
||||
//list_add_tail_eurecom (pdu_mem_p, &rlc_pP->segmentation_pdu_list);
|
||||
pdu_mngt_p->mem_block = pdu_mem_p;
|
||||
pdu_mngt_p->first_byte = (unsigned char*)pdu_p;
|
||||
pdu_mngt_p->header_and_payload_size = data_pdu_size - pdu_remaining_size;
|
||||
pdu_mngt_p->retx_count = -1;
|
||||
|
||||
rlcP->retrans_num_pdus += 1;
|
||||
rlcP->retrans_num_bytes += pdu_mngt->header_and_payload_size;
|
||||
rlc_pP->retrans_num_pdus += 1;
|
||||
rlc_pP->retrans_num_bytes += pdu_mngt_p->header_and_payload_size;
|
||||
|
||||
pdu = NULL;
|
||||
pdu_mem = NULL;
|
||||
pdu_p = NULL;
|
||||
pdu_mem_p = NULL;
|
||||
|
||||
//nb_bytes_to_transmit = nb_bytes_to_transmit - data_pdu_size;
|
||||
nb_bytes_to_transmit = 0; // 1 PDU only
|
||||
|
||||
mem_block_t* copy = rlc_am_retransmit_get_copy (rlcP, frame,(rlcP->vt_s-1) & RLC_AM_SN_MASK);
|
||||
list_add_tail_eurecom (copy, &rlcP->segmentation_pdu_list);
|
||||
mem_block_t* copy = rlc_am_retransmit_get_copy (rlc_pP, frameP,(rlc_pP->vt_s-1) & RLC_AM_SN_MASK);
|
||||
list_add_tail_eurecom (copy, &rlc_pP->segmentation_pdu_list);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,20 +58,20 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/*! \fn void rlc_am_pdu_polling (rlc_am_entity_t *rlcP, u32_t frame, rlc_am_pdu_sn_10_t *pduP, s16_t payload_sizeP)
|
||||
/*! \fn void rlc_am_pdu_polling (rlc_am_entity_t *rlcP, frame_t frameP, rlc_am_pdu_sn_10_t *pduP, s16_t payload_sizeP)
|
||||
* \brief Set or not the poll bit in the PDU header depending on RLC AM protocol variables.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in[ frame Frame index.
|
||||
* \param[in] pduP Pointer on the header of the PDU in order to be able to set the poll bit if necessary.
|
||||
* \param[in] payload_sizeP Size of the payload of the PDU.
|
||||
*/
|
||||
protected_rlc_am_segment(void rlc_am_pdu_polling (rlc_am_entity_t *rlcP, u32_t frame, rlc_am_pdu_sn_10_t *pduP, s16_t payload_sizeP);)
|
||||
protected_rlc_am_segment(void rlc_am_pdu_polling (rlc_am_entity_t *rlcP, frame_t frameP, rlc_am_pdu_sn_10_t *pduP, s16_t payload_sizeP);)
|
||||
|
||||
/*! \fn void rlc_am_segment_10 (rlc_am_entity_t *rlcP)
|
||||
* \brief Segment a PDU with 10 bits sequence number, based on segmentation information given by MAC (size to transmit).
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in[ frame Frame index.
|
||||
*/
|
||||
protected_rlc_am_segment(void rlc_am_segment_10 (rlc_am_entity_t *rlcP,u32_t frame);)
|
||||
protected_rlc_am_segment(void rlc_am_segment_10 (rlc_am_entity_t *rlcP,frame_t frameP);)
|
||||
/** @} */
|
||||
# endif
|
||||
|
||||
@@ -36,129 +36,178 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#define TRACE_RLC_AM_HOLE
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_clear_holes (rlc_am_entity_t *rlcP, u16_t snP)
|
||||
void rlc_am_clear_holes (rlc_am_entity_t *rlc_pP, rlc_sn_t snP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
rlcP->pdu_retrans_buffer[snP].num_holes = 0;
|
||||
rlc_pP->pdu_retrans_buffer[snP].num_holes = 0;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_shift_down_holes (rlc_am_entity_t *rlcP, u16_t snP, int indexP)
|
||||
void rlc_am_shift_down_holes (rlc_am_entity_t *rlc_pP, rlc_sn_t snP, int indexP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
int i;
|
||||
for (i=indexP; i < rlcP->pdu_retrans_buffer[snP].num_holes - 1; i++) {
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_start[i] = rlcP->pdu_retrans_buffer[snP].hole_so_start[i+1];
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_stop[i] = rlcP->pdu_retrans_buffer[snP].hole_so_stop[i+1];
|
||||
for (i=indexP; i < rlc_pP->pdu_retrans_buffer[snP].num_holes - 1; i++) {
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i] = rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i+1];
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i] = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i+1];
|
||||
}
|
||||
rlcP->pdu_retrans_buffer[snP].num_holes = rlcP->pdu_retrans_buffer[snP].num_holes - 1;
|
||||
rlc_pP->pdu_retrans_buffer[snP].num_holes = rlc_pP->pdu_retrans_buffer[snP].num_holes - 1;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_shift_up_holes (rlc_am_entity_t *rlcP, u16_t snP, int indexP)
|
||||
void rlc_am_shift_up_holes (rlc_am_entity_t *rlc_pP, rlc_sn_t snP, int indexP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
// shift include indexP
|
||||
int i;
|
||||
for (i=rlcP->pdu_retrans_buffer[snP].num_holes; i > indexP; i--) {
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_start[i] = rlcP->pdu_retrans_buffer[snP].hole_so_start[i-1];
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_stop[i] = rlcP->pdu_retrans_buffer[snP].hole_so_stop[i-1];
|
||||
for (i=rlc_pP->pdu_retrans_buffer[snP].num_holes; i > indexP; i--) {
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i] = rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i-1];
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i] = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i-1];
|
||||
}
|
||||
rlcP->pdu_retrans_buffer[snP].num_holes = rlcP->pdu_retrans_buffer[snP].num_holes + 1;
|
||||
assert(rlcP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
rlc_pP->pdu_retrans_buffer[snP].num_holes = rlc_pP->pdu_retrans_buffer[snP].num_holes + 1;
|
||||
assert(rlc_pP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_remove_hole (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, u16_t so_startP, u16_t so_stopP)
|
||||
void rlc_am_remove_hole (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP, u16_t so_startP, u16_t so_stopP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
int i;
|
||||
#ifdef TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][HOLE] REMOVE HOLE SN %04d so_startP %05d so_stopP %05d rlcP->pdu_retrans_buffer[snP].nack_so_start %05d rlcP->pdu_retrans_buffer[snP].nack_so_stop %05d\n",
|
||||
frame,rlcP->module_id, rlcP->rb_id, snP, so_startP, so_stopP, rlcP->pdu_retrans_buffer[snP].nack_so_start, rlcP->pdu_retrans_buffer[snP].nack_so_stop);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] REMOVE HOLE SN %04d so_startP %05d so_stopP %05d rlc_pP->pdu_retrans_buffer[snP].nack_so_start %05d rlc_pP->pdu_retrans_buffer[snP].nack_so_stop %05d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
snP,
|
||||
so_startP,
|
||||
so_stopP,
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start,
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop);
|
||||
#endif
|
||||
assert(so_startP <= so_stopP);
|
||||
|
||||
if (rlcP->pdu_retrans_buffer[snP].num_holes == 0) {
|
||||
assert(so_startP == rlcP->pdu_retrans_buffer[snP].nack_so_start);
|
||||
assert(so_stopP <= rlcP->pdu_retrans_buffer[snP].nack_so_stop);
|
||||
if (rlc_pP->pdu_retrans_buffer[snP].num_holes == 0) {
|
||||
assert(so_startP == rlc_pP->pdu_retrans_buffer[snP].nack_so_start);
|
||||
assert(so_stopP <= rlc_pP->pdu_retrans_buffer[snP].nack_so_stop);
|
||||
#ifdef TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][HOLE] REMOVE HOLE SN %04d MODIFIED nack_so_start %05d->%05d\n",
|
||||
frame,rlcP->module_id, rlcP->rb_id, snP, rlcP->pdu_retrans_buffer[snP].nack_so_start, so_stopP+1);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] REMOVE HOLE SN %04d MODIFIED nack_so_start %05d->%05d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
snP,
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start,
|
||||
so_stopP+1);
|
||||
#endif
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_start = so_stopP+1;
|
||||
if (rlcP->pdu_retrans_buffer[snP].nack_so_start >= rlcP->pdu_retrans_buffer[snP].nack_so_stop) {
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_start = 0;
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_stop = 0x7FFF;
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = so_stopP+1;
|
||||
if (rlc_pP->pdu_retrans_buffer[snP].nack_so_start >= rlc_pP->pdu_retrans_buffer[snP].nack_so_stop) {
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = 0;
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = 0x7FFF;
|
||||
}
|
||||
} else {
|
||||
// normally should be removed in increasing order...
|
||||
for (i = 0; i < rlcP->pdu_retrans_buffer[snP].num_holes; i++) {
|
||||
if (so_startP <= rlcP->pdu_retrans_buffer[snP].hole_so_start[i]) {
|
||||
if (so_stopP >= rlcP->pdu_retrans_buffer[snP].hole_so_stop[i]) {
|
||||
rlc_am_shift_down_holes(rlcP, snP, i);
|
||||
for (i = 0; i < rlc_pP->pdu_retrans_buffer[snP].num_holes; i++) {
|
||||
if (so_startP <= rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i]) {
|
||||
if (so_stopP >= rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i]) {
|
||||
rlc_am_shift_down_holes(rlc_pP, snP, i);
|
||||
i = i - 1;
|
||||
} else {
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_start[i] = so_stopP;
|
||||
if (rlcP->pdu_retrans_buffer[snP].num_holes == 0) {
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_start = 0;
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_stop = 0x7FFF;
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i] = so_stopP;
|
||||
if (rlc_pP->pdu_retrans_buffer[snP].num_holes == 0) {
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = 0;
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = 0x7FFF;
|
||||
} else {
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_start = rlcP->pdu_retrans_buffer[snP].hole_so_start[0];
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_stop = rlcP->pdu_retrans_buffer[snP].hole_so_stop[rlcP->pdu_retrans_buffer[snP].num_holes - 1];
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = rlc_pP->pdu_retrans_buffer[snP].hole_so_start[0];
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[rlc_pP->pdu_retrans_buffer[snP].num_holes - 1];
|
||||
}
|
||||
#ifdef TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n", frame,rlcP->module_id, rlcP->rb_id, snP, rlcP->pdu_retrans_buffer[snP].nack_so_start, rlcP->pdu_retrans_buffer[snP].nack_so_stop, rlcP->pdu_retrans_buffer[snP].num_holes);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
snP,
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start,
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop,
|
||||
rlc_pP->pdu_retrans_buffer[snP].num_holes);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
} else if (so_startP > rlcP->pdu_retrans_buffer[snP].hole_so_start[i]) {
|
||||
if (so_startP <= rlcP->pdu_retrans_buffer[snP].hole_so_stop[i]) {
|
||||
if (so_stopP < rlcP->pdu_retrans_buffer[snP].hole_so_stop[i]) {
|
||||
} else if (so_startP > rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i]) {
|
||||
if (so_startP <= rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i]) {
|
||||
if (so_stopP < rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i]) {
|
||||
// BAD CASE: 1 HOLE IS SPLITTED IN 2 HOLES
|
||||
rlc_am_shift_up_holes(rlcP, snP, i+1);
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_start[i+1] = so_startP+1;
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_stop[i+1] = rlcP->pdu_retrans_buffer[snP].hole_so_stop[i];
|
||||
rlc_am_shift_up_holes(rlc_pP, snP, i+1);
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i+1] = so_startP+1;
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i+1] = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i];
|
||||
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_stop[i] = so_startP - 1;
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i] = so_startP - 1;
|
||||
} else {
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_stop[i] = so_startP;
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i] = so_startP;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rlcP->pdu_retrans_buffer[snP].num_holes == 0) {
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_start = 0;
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_stop = 0x7FFF;
|
||||
if (rlc_pP->pdu_retrans_buffer[snP].num_holes == 0) {
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = 0;
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = 0x7FFF;
|
||||
} else {
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_start = rlcP->pdu_retrans_buffer[snP].hole_so_start[0];
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_stop = rlcP->pdu_retrans_buffer[snP].hole_so_stop[rlcP->pdu_retrans_buffer[snP].num_holes - 1];
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = rlc_pP->pdu_retrans_buffer[snP].hole_so_start[0];
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[rlc_pP->pdu_retrans_buffer[snP].num_holes - 1];
|
||||
}
|
||||
}
|
||||
#ifdef TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n", frame,rlcP->module_id, rlcP->rb_id, snP, rlcP->pdu_retrans_buffer[snP].nack_so_start, rlcP->pdu_retrans_buffer[snP].nack_so_stop, rlcP->pdu_retrans_buffer[snP].num_holes);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
snP,
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start,
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop,
|
||||
rlc_pP->pdu_retrans_buffer[snP].num_holes);
|
||||
#endif
|
||||
assert(rlcP->pdu_retrans_buffer[snP].nack_so_start < rlcP->pdu_retrans_buffer[snP].payload_size);
|
||||
assert(rlc_pP->pdu_retrans_buffer[snP].nack_so_start < rlc_pP->pdu_retrans_buffer[snP].payload_size);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_get_next_hole (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, int* so_startP, int* so_stopP)
|
||||
void rlc_am_get_next_hole (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP, int* so_startP, int* so_stopP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
if (rlcP->pdu_retrans_buffer[snP].num_holes == 0) {
|
||||
*so_startP = rlcP->pdu_retrans_buffer[snP].nack_so_start;
|
||||
*so_stopP = rlcP->pdu_retrans_buffer[snP].nack_so_stop;
|
||||
if (rlc_pP->pdu_retrans_buffer[snP].num_holes == 0) {
|
||||
*so_startP = rlc_pP->pdu_retrans_buffer[snP].nack_so_start;
|
||||
*so_stopP = rlc_pP->pdu_retrans_buffer[snP].nack_so_stop;
|
||||
#ifdef TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == 0)\n",
|
||||
frame,rlcP->module_id, rlcP->rb_id, snP, *so_startP, *so_stopP);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == 0)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
snP,
|
||||
*so_startP,
|
||||
*so_stopP);
|
||||
#endif
|
||||
} else {
|
||||
*so_startP = rlcP->pdu_retrans_buffer[snP].hole_so_start[0];
|
||||
*so_stopP = rlcP->pdu_retrans_buffer[snP].hole_so_stop[0];
|
||||
*so_startP = rlc_pP->pdu_retrans_buffer[snP].hole_so_start[0];
|
||||
*so_stopP = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[0];
|
||||
#ifdef TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == %d)\n",
|
||||
frame,rlcP->module_id, rlcP->rb_id, snP, *so_startP, *so_stopP, rlcP->pdu_retrans_buffer[snP].num_holes);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == %d)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
snP,
|
||||
*so_startP,
|
||||
*so_stopP,
|
||||
rlc_pP->pdu_retrans_buffer[snP].num_holes);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_add_hole (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, u16_t so_startP, u16_t so_stopP)
|
||||
void rlc_am_add_hole (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_stopP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
int i, hole_index;
|
||||
@@ -169,83 +218,112 @@ void rlc_am_add_hole (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, u16_t so_st
|
||||
|
||||
|
||||
// if global NACK
|
||||
if ((so_startP == 0) && ((so_stopP == 0x7FFF) || (so_stopP == rlcP->pdu_retrans_buffer[snP].payload_size - 1))) {
|
||||
rlcP->pdu_retrans_buffer[snP].num_holes = 0;
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_start = so_startP;
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_stop = so_stopP;
|
||||
if ((so_startP == 0) && ((so_stopP == 0x7FFF) || (so_stopP == rlc_pP->pdu_retrans_buffer[snP].payload_size - 1))) {
|
||||
rlc_pP->pdu_retrans_buffer[snP].num_holes = 0;
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = so_startP;
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = so_stopP;
|
||||
#ifdef TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][HOLE] SN %04d GLOBAL NACK 0->%05d\n",
|
||||
frame,rlcP->module_id, rlcP->rb_id, snP, so_stopP);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] SN %04d GLOBAL NACK 0->%05d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
snP,
|
||||
so_stopP);
|
||||
#endif
|
||||
assert(rlcP->pdu_retrans_buffer[snP].nack_so_start < rlcP->pdu_retrans_buffer[snP].payload_size);
|
||||
assert(rlc_pP->pdu_retrans_buffer[snP].nack_so_start < rlc_pP->pdu_retrans_buffer[snP].payload_size);
|
||||
return;
|
||||
}
|
||||
|
||||
if (so_stopP == 0x7FFF) {
|
||||
so_stopP = rlcP->pdu_retrans_buffer[snP].payload_size - 1;
|
||||
so_stopP = rlc_pP->pdu_retrans_buffer[snP].payload_size - 1;
|
||||
}
|
||||
// first hole
|
||||
if (rlcP->pdu_retrans_buffer[snP].num_holes == 0) {
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_start[0] = so_startP;
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_stop [0] = so_stopP;
|
||||
if (rlc_pP->pdu_retrans_buffer[snP].num_holes == 0) {
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[0] = so_startP;
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop [0] = so_stopP;
|
||||
|
||||
rlcP->pdu_retrans_buffer[snP].num_holes = 1;
|
||||
rlc_pP->pdu_retrans_buffer[snP].num_holes = 1;
|
||||
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_start = so_startP;
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_stop = so_stopP;
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = so_startP;
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = so_stopP;
|
||||
#ifdef TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][HOLE] FIRST HOLE SN %04d GLOBAL NACK %05d->%05d\n",
|
||||
frame,rlcP->module_id, rlcP->rb_id, snP, so_startP, so_stopP);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] FIRST HOLE SN %04d GLOBAL NACK %05d->%05d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
snP,
|
||||
so_startP,
|
||||
so_stopP);
|
||||
#endif
|
||||
assert(rlcP->pdu_retrans_buffer[snP].nack_so_start < rlcP->pdu_retrans_buffer[snP].payload_size);
|
||||
assert(rlc_pP->pdu_retrans_buffer[snP].nack_so_start < rlc_pP->pdu_retrans_buffer[snP].payload_size);
|
||||
return;
|
||||
}
|
||||
|
||||
hole_index = 0;
|
||||
while (hole_index < rlcP->pdu_retrans_buffer[snP].num_holes) {
|
||||
if (so_stopP < rlcP->pdu_retrans_buffer[snP].hole_so_start[hole_index]) {
|
||||
assert(rlcP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
while (hole_index < rlc_pP->pdu_retrans_buffer[snP].num_holes) {
|
||||
if (so_stopP < rlc_pP->pdu_retrans_buffer[snP].hole_so_start[hole_index]) {
|
||||
assert(rlc_pP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
if (hole_index > 0) {
|
||||
assert(so_startP > rlcP->pdu_retrans_buffer[snP].hole_so_stop[hole_index-1]);
|
||||
assert(so_startP > rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[hole_index-1]);
|
||||
}
|
||||
for (i=rlcP->pdu_retrans_buffer[snP].num_holes; i >= hole_index; i--) {
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_start[i] = rlcP->pdu_retrans_buffer[snP].hole_so_start[i-1];
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_stop[i] = rlcP->pdu_retrans_buffer[snP].hole_so_stop[i-1];
|
||||
for (i=rlc_pP->pdu_retrans_buffer[snP].num_holes; i >= hole_index; i--) {
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i] = rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i-1];
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i] = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i-1];
|
||||
}
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_start[hole_index] = so_startP;
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_stop[hole_index] = so_stopP;
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[hole_index] = so_startP;
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[hole_index] = so_stopP;
|
||||
|
||||
// update nack "window" vars nack_so_start, nack_so_stop
|
||||
if (hole_index == 0) {
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_start = so_startP;
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = so_startP;
|
||||
}
|
||||
rlcP->pdu_retrans_buffer[snP].num_holes += 1;
|
||||
rlc_pP->pdu_retrans_buffer[snP].num_holes += 1;
|
||||
#ifdef TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][HOLE] INSERT %d th HOLE SN %04d GLOBAL NACK %05d->%05d\n",
|
||||
frame,rlcP->module_id, rlcP->rb_id, rlcP->pdu_retrans_buffer[snP].num_holes, snP, so_startP, so_stopP);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] INSERT %d th HOLE SN %04d GLOBAL NACK %05d->%05d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->pdu_retrans_buffer[snP].num_holes,
|
||||
snP,
|
||||
so_startP,
|
||||
so_stopP);
|
||||
#endif
|
||||
assert(rlcP->pdu_retrans_buffer[snP].nack_so_start < rlcP->pdu_retrans_buffer[snP].payload_size);
|
||||
assert(rlcP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
assert(rlc_pP->pdu_retrans_buffer[snP].nack_so_start < rlc_pP->pdu_retrans_buffer[snP].payload_size);
|
||||
assert(rlc_pP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
return;
|
||||
}
|
||||
hole_index = hole_index + 1;
|
||||
}
|
||||
|
||||
// if here insert to the "tail"
|
||||
if (so_startP > rlcP->pdu_retrans_buffer[snP].hole_so_stop[hole_index - 1]) {
|
||||
assert(rlcP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_start[hole_index] = so_startP;
|
||||
rlcP->pdu_retrans_buffer[snP].hole_so_stop[hole_index] = so_stopP;
|
||||
rlcP->pdu_retrans_buffer[snP].num_holes += 1;
|
||||
if (so_startP > rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[hole_index - 1]) {
|
||||
assert(rlc_pP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[hole_index] = so_startP;
|
||||
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[hole_index] = so_stopP;
|
||||
rlc_pP->pdu_retrans_buffer[snP].num_holes += 1;
|
||||
// update nack "window" vars nack_so_start, nack_so_stop
|
||||
rlcP->pdu_retrans_buffer[snP].nack_so_stop = so_stopP;
|
||||
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = so_stopP;
|
||||
#ifdef TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][HOLE] INSERT THE %d th LAST HOLE SN %04d GLOBAL NACK %05d->%05d\n",
|
||||
frame,rlcP->module_id, rlcP->rb_id, rlcP->pdu_retrans_buffer[snP].num_holes, snP, so_startP, so_stopP);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] INSERT THE %d th LAST HOLE SN %04d GLOBAL NACK %05d->%05d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->pdu_retrans_buffer[snP].num_holes,
|
||||
snP,
|
||||
so_startP,
|
||||
so_stopP);
|
||||
#endif
|
||||
} else {
|
||||
assert(1==2);
|
||||
}
|
||||
assert(rlcP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
assert(rlcP->pdu_retrans_buffer[snP].nack_so_start < rlcP->pdu_retrans_buffer[snP].payload_size);
|
||||
assert(rlc_pP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
assert(rlc_pP->pdu_retrans_buffer[snP].nack_so_start < rlc_pP->pdu_retrans_buffer[snP].payload_size);
|
||||
}
|
||||
|
||||
@@ -58,14 +58,14 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# define public_rlc_am_segments_holes(x) extern x
|
||||
# endif
|
||||
# endif
|
||||
/*! \fn void rlc_am_clear_holes (rlc_am_entity_t *rlcP, u16_t snP)
|
||||
/*! \fn void rlc_am_clear_holes (rlc_am_entity_t *rlcP, rlc_sn_t snP)
|
||||
* \brief Remove all marked holes for PDU with sequence number "snP".
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] snP Sequence number.
|
||||
*/
|
||||
protected_rlc_am_segments_holes(void rlc_am_clear_holes (rlc_am_entity_t *rlcP, u16_t snP);)
|
||||
protected_rlc_am_segments_holes(void rlc_am_clear_holes (rlc_am_entity_t *rlcP, rlc_sn_t snP);)
|
||||
|
||||
/*! \fn void rlc_am_remove_hole (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, u16_t so_startP, u16_t so_stopP)
|
||||
/*! \fn void rlc_am_remove_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, u16_t so_startP, u16_t so_stopP)
|
||||
* \brief Remove for PDU with sequence number "snP" a NACK for byte segment offset [so_startP, so_stopP].
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in[ frame Frame index.
|
||||
@@ -73,9 +73,9 @@ protected_rlc_am_segments_holes(void rlc_am_clear_holes (rlc_am_entity_t *rlcP,
|
||||
* \param[in] so_startP Start of segment offset.
|
||||
* \param[in] so_stopP End of segment offset.
|
||||
*/
|
||||
protected_rlc_am_segments_holes(void rlc_am_remove_hole (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, u16_t so_startP, u16_t so_stopP);)
|
||||
protected_rlc_am_segments_holes(void rlc_am_remove_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, u16_t so_startP, u16_t so_stopP);)
|
||||
|
||||
/*! \fn void rlc_am_get_next_hole (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, int* so_startP, int* so_stopP)
|
||||
/*! \fn void rlc_am_get_next_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, int* so_startP, int* so_stopP)
|
||||
* \brief Get for PDU with sequence number "snP" the first hole start and stop parameters.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in[ frame Frame index.
|
||||
@@ -83,9 +83,9 @@ protected_rlc_am_segments_holes(void rlc_am_remove_hole (rlc_am_entity_t *rlcP,
|
||||
* \param[in,out] so_startP Start of segment offset.
|
||||
* \param[in,out] so_stopP End of segment offset.
|
||||
*/
|
||||
protected_rlc_am_segments_holes(void rlc_am_get_next_hole (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, int* so_startP, int* so_stopP);)
|
||||
protected_rlc_am_segments_holes(void rlc_am_get_next_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, int* so_startP, int* so_stopP);)
|
||||
|
||||
/*! \fn void rlc_am_add_hole (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, u16_t so_startP, u16_t so_stopP)
|
||||
/*! \fn void rlc_am_add_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, u16_t so_startP, u16_t so_stopP)
|
||||
* \brief Mark for PDU with sequence number "snP" a NACK for byte segment offset [so_startP, so_stopP].
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in[ frame Frame index.
|
||||
@@ -93,6 +93,6 @@ protected_rlc_am_segments_holes(void rlc_am_get_next_hole (rlc_am_entity_t *rlcP
|
||||
* \param[in,out] so_startP Start of segment offset.
|
||||
* \param[in,out] so_stopP End of segment offset.
|
||||
*/
|
||||
protected_rlc_am_segments_holes(void rlc_am_add_hole (rlc_am_entity_t *rlcP, u32_t frame, u16_t snP, u16_t so_startP, u16_t so_stopP);)
|
||||
protected_rlc_am_segments_holes(void rlc_am_add_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, u16_t so_startP, u16_t so_stopP);)
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
@@ -42,124 +42,124 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
|
||||
rlc_am_control_pdu_info_t g_rlc_am_control_pdu_info;
|
||||
//-----------------------------------------------------------------------------
|
||||
u16_t rlc_am_read_bit_field(u8_t** dataP, unsigned int* bit_posP, signed int bits_to_readP) {
|
||||
u16_t rlc_am_read_bit_field(u8_t** data_ppP, unsigned int* bit_pos_pP, signed int bits_to_readP) {
|
||||
//-----------------------------------------------------------------------------
|
||||
u16_t value = 0;
|
||||
unsigned int bits_read;
|
||||
u16_t value = 0;
|
||||
unsigned int bits_read = 0;
|
||||
do {
|
||||
// bits read > bits to read
|
||||
if ((8 - *bit_posP) > bits_to_readP) {
|
||||
bits_read = 8 - *bit_posP;
|
||||
value = (value << bits_to_readP) | ((((u16_t)(**dataP)) & (u16_t)(0x00FF >> *bit_posP)) >> (bits_read -
|
||||
if ((8 - *bit_pos_pP) > bits_to_readP) {
|
||||
bits_read = 8 - *bit_pos_pP;
|
||||
value = (value << bits_to_readP) | ((((u16_t)(**data_ppP)) & (u16_t)(0x00FF >> *bit_pos_pP)) >> (bits_read -
|
||||
bits_to_readP));
|
||||
*bit_posP = *bit_posP + bits_to_readP;
|
||||
*bit_pos_pP = *bit_pos_pP + bits_to_readP;
|
||||
return value;
|
||||
// bits read == bits to read
|
||||
} else if ((8 - *bit_posP) == bits_to_readP) {
|
||||
value = (value << bits_to_readP) | (((u16_t)(**dataP)) & (u16_t)(0x00FF >> *bit_posP));
|
||||
*bit_posP = 0;
|
||||
*dataP = *dataP + 1;
|
||||
} else if ((8 - *bit_pos_pP) == bits_to_readP) {
|
||||
value = (value << bits_to_readP) | (((u16_t)(**data_ppP)) & (u16_t)(0x00FF >> *bit_pos_pP));
|
||||
*bit_pos_pP = 0;
|
||||
*data_ppP = *data_ppP + 1;
|
||||
return value;
|
||||
// bits read < bits to read
|
||||
} else {
|
||||
bits_read = 8 - *bit_posP;
|
||||
value = (value << bits_read) | ((((u16_t)(**dataP)) & (u16_t)(0x00FF >> *bit_posP)));
|
||||
*bit_posP = 0;
|
||||
*dataP = *dataP + 1;
|
||||
bits_read = 8 - *bit_pos_pP;
|
||||
value = (value << bits_read) | ((((u16_t)(**data_ppP)) & (u16_t)(0x00FF >> *bit_pos_pP)));
|
||||
*bit_pos_pP = 0;
|
||||
*data_ppP = *data_ppP + 1;
|
||||
bits_to_readP = bits_to_readP - bits_read;
|
||||
}
|
||||
} while (bits_to_readP > 0);
|
||||
return value;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_write8_bit_field(u8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, u8_t valueP) {
|
||||
void rlc_am_write8_bit_field(u8_t** data_ppP, unsigned int* bit_pos_pP, signed int bits_to_writeP, u8_t valueP) {
|
||||
//-----------------------------------------------------------------------------
|
||||
unsigned int available_bits;
|
||||
|
||||
do {
|
||||
available_bits = 8 - *bit_posP;
|
||||
available_bits = 8 - *bit_pos_pP;
|
||||
// available_bits > bits to write
|
||||
if (available_bits > bits_to_writeP) {
|
||||
**dataP = **dataP | (((valueP & (((u8_t)0xFF) >> (available_bits - bits_to_writeP)))) << (available_bits -
|
||||
**data_ppP = **data_ppP | (((valueP & (((u8_t)0xFF) >> (available_bits - bits_to_writeP)))) << (available_bits -
|
||||
bits_to_writeP));
|
||||
*bit_posP = *bit_posP + bits_to_writeP;
|
||||
*bit_pos_pP = *bit_pos_pP + bits_to_writeP;
|
||||
return;
|
||||
// bits read == bits to read
|
||||
} else if (available_bits == bits_to_writeP) {
|
||||
**dataP = **dataP | (valueP & (((u8_t)0xFF) >> (8 - bits_to_writeP)));
|
||||
*bit_posP = 0;
|
||||
*dataP = *dataP + 1;
|
||||
**data_ppP = **data_ppP | (valueP & (((u8_t)0xFF) >> (8 - bits_to_writeP)));
|
||||
*bit_pos_pP = 0;
|
||||
*data_ppP = *data_ppP + 1;
|
||||
return;
|
||||
// available_bits < bits to write
|
||||
} else {
|
||||
**dataP = **dataP | (valueP >> (bits_to_writeP - available_bits));
|
||||
*bit_posP = 0;
|
||||
*dataP = *dataP + 1;
|
||||
**data_ppP = **data_ppP | (valueP >> (bits_to_writeP - available_bits));
|
||||
*bit_pos_pP = 0;
|
||||
*data_ppP = *data_ppP + 1;
|
||||
bits_to_writeP = bits_to_writeP - available_bits;
|
||||
}
|
||||
} while (bits_to_writeP > 0);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_write16_bit_field(u8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, u16_t valueP) {
|
||||
void rlc_am_write16_bit_field(u8_t** data_ppP, unsigned int* bit_pos_pP, signed int bits_to_writeP, u16_t valueP) {
|
||||
//-----------------------------------------------------------------------------
|
||||
assert(bits_to_writeP <= 16);
|
||||
|
||||
if (bits_to_writeP > 8) {
|
||||
rlc_am_write8_bit_field(dataP,bit_posP, bits_to_writeP - 8, (u8_t)(valueP >> 8));
|
||||
rlc_am_write8_bit_field(dataP,bit_posP, 8, (u8_t)(valueP & 0x00FF));
|
||||
rlc_am_write8_bit_field(data_ppP,bit_pos_pP, bits_to_writeP - 8, (u8_t)(valueP >> 8));
|
||||
rlc_am_write8_bit_field(data_ppP,bit_pos_pP, 8, (u8_t)(valueP & 0x00FF));
|
||||
} else {
|
||||
rlc_am_write8_bit_field(dataP,bit_posP, bits_to_writeP, (u8_t)(valueP & 0x00FF));
|
||||
rlc_am_write8_bit_field(data_ppP,bit_pos_pP, bits_to_writeP, (u8_t)(valueP & 0x00FF));
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* headerP, s16_t *total_size_pP, rlc_am_control_pdu_info_t* pdu_infoP)
|
||||
signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* header_pP, sdu_ssize_t *total_size_pP, rlc_am_control_pdu_info_t* pdu_info_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
memset(pdu_infoP, 0, sizeof (rlc_am_control_pdu_info_t));
|
||||
memset(pdu_info_pP, 0, sizeof (rlc_am_control_pdu_info_t));
|
||||
|
||||
pdu_infoP->d_c = headerP->b1 >> 7;
|
||||
pdu_info_pP->d_c = header_pP->b1 >> 7;
|
||||
|
||||
|
||||
if (!pdu_infoP->d_c) {
|
||||
pdu_infoP->cpt = (headerP->b1 >> 4) & 0x07;
|
||||
if (pdu_infoP->cpt != 0x00) return -3;
|
||||
pdu_infoP->ack_sn = ((headerP->b2 >> 2) & 0x3F) | (((u16_t)(headerP->b1 & 0x0F)) << 6);
|
||||
pdu_infoP->e1 = (headerP->b2 >> 1) & 0x01;
|
||||
if (!pdu_info_pP->d_c) {
|
||||
pdu_info_pP->cpt = (header_pP->b1 >> 4) & 0x07;
|
||||
if (pdu_info_pP->cpt != 0x00) return -3;
|
||||
pdu_info_pP->ack_sn = ((header_pP->b2 >> 2) & 0x3F) | (((u16_t)(header_pP->b1 & 0x0F)) << 6);
|
||||
pdu_info_pP->e1 = (header_pP->b2 >> 1) & 0x01;
|
||||
//*total_size_pP -= 1;
|
||||
|
||||
if (pdu_infoP->e1) {
|
||||
if (pdu_info_pP->e1) {
|
||||
unsigned int nack_to_read = 1;
|
||||
unsigned int bit_pos = 7; // range from 0 (MSB/left) to 7 (LSB/right)
|
||||
u8_t* byte_pos = &headerP->b2;
|
||||
u8_t* byte_pos_p = &header_pP->b2;
|
||||
|
||||
while (nack_to_read) {
|
||||
pdu_infoP->nack_list[pdu_infoP->num_nack].nack_sn = rlc_am_read_bit_field(&byte_pos, &bit_pos, 10);
|
||||
pdu_infoP->nack_list[pdu_infoP->num_nack].e1 = rlc_am_read_bit_field(&byte_pos, &bit_pos, 1);
|
||||
pdu_infoP->nack_list[pdu_infoP->num_nack].e2 = rlc_am_read_bit_field(&byte_pos, &bit_pos, 1);
|
||||
pdu_info_pP->nack_list[pdu_info_pP->num_nack].nack_sn = rlc_am_read_bit_field(&byte_pos_p, &bit_pos, 10);
|
||||
pdu_info_pP->nack_list[pdu_info_pP->num_nack].e1 = rlc_am_read_bit_field(&byte_pos_p, &bit_pos, 1);
|
||||
pdu_info_pP->nack_list[pdu_info_pP->num_nack].e2 = rlc_am_read_bit_field(&byte_pos_p, &bit_pos, 1);
|
||||
// READ SOstart, SOend field
|
||||
if (pdu_infoP->nack_list[pdu_infoP->num_nack].e2) {
|
||||
pdu_infoP->nack_list[pdu_infoP->num_nack].so_start = rlc_am_read_bit_field(&byte_pos, &bit_pos, 15);
|
||||
pdu_infoP->nack_list[pdu_infoP->num_nack].so_end = rlc_am_read_bit_field(&byte_pos, &bit_pos, 15);
|
||||
if (pdu_info_pP->nack_list[pdu_info_pP->num_nack].e2) {
|
||||
pdu_info_pP->nack_list[pdu_info_pP->num_nack].so_start = rlc_am_read_bit_field(&byte_pos_p, &bit_pos, 15);
|
||||
pdu_info_pP->nack_list[pdu_info_pP->num_nack].so_end = rlc_am_read_bit_field(&byte_pos_p, &bit_pos, 15);
|
||||
} else {
|
||||
pdu_infoP->nack_list[pdu_infoP->num_nack].so_start = 0;
|
||||
pdu_info_pP->nack_list[pdu_info_pP->num_nack].so_start = 0;
|
||||
// all 15 bits set to 1 (indicate that the missing portion of the AMD PDU includes all bytes
|
||||
// to the last byte of the AMD PDU)
|
||||
pdu_infoP->nack_list[pdu_infoP->num_nack].so_end = 0x7FFF;
|
||||
pdu_info_pP->nack_list[pdu_info_pP->num_nack].so_end = 0x7FFF;
|
||||
}
|
||||
pdu_infoP->num_nack = pdu_infoP->num_nack + 1;
|
||||
pdu_info_pP->num_nack = pdu_info_pP->num_nack + 1;
|
||||
|
||||
if (!pdu_infoP->nack_list[pdu_infoP->num_nack - 1].e1) {
|
||||
if (!pdu_info_pP->nack_list[pdu_info_pP->num_nack - 1].e1) {
|
||||
nack_to_read = 0;
|
||||
*total_size_pP = *total_size_pP - (s16_t)((uint64_t)byte_pos + (uint64_t)((bit_pos + 7)/8) - (uint64_t)headerP);
|
||||
*total_size_pP = *total_size_pP - (sdu_ssize_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pdu_infoP->num_nack == RLC_AM_MAX_NACK_IN_STATUS_PDU) {
|
||||
*total_size_pP = *total_size_pP - (s16_t)((uint64_t)byte_pos + (uint64_t)((bit_pos + 7)/8) - (uint64_t)headerP);
|
||||
if (pdu_info_pP->num_nack == RLC_AM_MAX_NACK_IN_STATUS_PDU) {
|
||||
*total_size_pP = *total_size_pP - (sdu_ssize_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
*total_size_pP = *total_size_pP - (s16_t)((uint64_t)byte_pos + (uint64_t)((bit_pos + 7)/8) - (uint64_t)headerP);
|
||||
*total_size_pP = *total_size_pP - (sdu_ssize_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
|
||||
} else {
|
||||
*total_size_pP = *total_size_pP - 2;
|
||||
}
|
||||
@@ -169,21 +169,21 @@ signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* headerP, s16_t *tota
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_infoP)
|
||||
void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_info_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
int num_nack;
|
||||
|
||||
if (!pdu_infoP->d_c) {
|
||||
LOG_T(RLC, "CONTROL PDU ACK SN %04d", pdu_infoP->ack_sn);
|
||||
if (!pdu_info_pP->d_c) {
|
||||
LOG_T(RLC, "CONTROL PDU ACK SN %04d", pdu_info_pP->ack_sn);
|
||||
|
||||
for (num_nack = 0; num_nack < pdu_infoP->num_nack; num_nack++) {
|
||||
if (pdu_infoP->nack_list[num_nack].e2) {
|
||||
LOG_T(RLC, "\n\tNACK SN %04d SO START %05d SO END %05d", pdu_infoP->nack_list[num_nack].nack_sn,
|
||||
pdu_infoP->nack_list[num_nack].so_start,
|
||||
pdu_infoP->nack_list[num_nack].so_end);
|
||||
for (num_nack = 0; num_nack < pdu_info_pP->num_nack; num_nack++) {
|
||||
if (pdu_info_pP->nack_list[num_nack].e2) {
|
||||
LOG_T(RLC, "\n\tNACK SN %04d SO START %05d SO END %05d", pdu_info_pP->nack_list[num_nack].nack_sn,
|
||||
pdu_info_pP->nack_list[num_nack].so_start,
|
||||
pdu_info_pP->nack_list[num_nack].so_end);
|
||||
} else {
|
||||
LOG_T(RLC, "\n\tNACK SN %04d", pdu_infoP->nack_list[num_nack].nack_sn);
|
||||
LOG_T(RLC, "\n\tNACK SN %04d", pdu_info_pP->nack_list[num_nack].nack_sn);
|
||||
}
|
||||
}
|
||||
LOG_T(RLC, "\n");
|
||||
@@ -192,23 +192,30 @@ void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_infoP)
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, u32_t frame, mem_block_t* tbP, u8_t** first_byteP, s16_t *tb_size_in_bytes_pP)
|
||||
void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, mem_block_t* tb_pP, u8_t** first_byte_ppP, sdu_ssize_t *tb_size_in_bytes_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
//rlc_am_control_pdu_info_t* pdu_info = ((rlc_am_control_pdu_info_t*)(tbP->data));
|
||||
rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10 = (rlc_am_pdu_sn_10_t*)*first_byteP;
|
||||
s16_t initial_pdu_size = *tb_size_in_bytes_pP;
|
||||
rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)*first_byte_ppP;
|
||||
sdu_ssize_t initial_pdu_size = *tb_size_in_bytes_pP;
|
||||
|
||||
if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10, tb_size_in_bytes_pP, &g_rlc_am_control_pdu_info) >= 0) {
|
||||
if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, tb_size_in_bytes_pP, &g_rlc_am_control_pdu_info) >= 0) {
|
||||
|
||||
rlc_am_tx_buffer_display(rlcP, frame, " TX BUFFER BEFORE PROCESS OF STATUS PDU");
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] RX CONTROL PDU VT(A) %04d VT(S) %04d POLL_SN %04d ACK_SN %04d\n",
|
||||
frame, rlcP->module_id, rlcP->rb_id, rlcP->vt_a, rlcP->vt_s, rlcP->poll_sn, g_rlc_am_control_pdu_info.ack_sn);
|
||||
rlc_am_tx_buffer_display(rlc_pP, frameP, " TX BUFFER BEFORE PROCESS OF STATUS PDU");
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RX CONTROL PDU VT(A) %04d VT(S) %04d POLL_SN %04d ACK_SN %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->vt_a,
|
||||
rlc_pP->vt_s,
|
||||
rlc_pP->poll_sn,
|
||||
g_rlc_am_control_pdu_info.ack_sn);
|
||||
rlc_am_display_control_pdu_infos(&g_rlc_am_control_pdu_info);
|
||||
|
||||
u16_t ack_sn = g_rlc_am_control_pdu_info.ack_sn;
|
||||
u16_t sn_cursor = rlcP->vt_a;
|
||||
u16_t nack_sn;
|
||||
rlc_sn_t ack_sn = g_rlc_am_control_pdu_info.ack_sn;
|
||||
rlc_sn_t sn_cursor = rlc_pP->vt_a;
|
||||
rlc_sn_t nack_sn;
|
||||
unsigned int nack_index;
|
||||
|
||||
// 5.2.1 Retransmission
|
||||
@@ -234,29 +241,29 @@ void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, u32_t frame, mem_
|
||||
assert(ack_sn < RLC_AM_SN_MODULO);
|
||||
assert(g_rlc_am_control_pdu_info.num_nack < RLC_AM_MAX_NACK_IN_STATUS_PDU);
|
||||
|
||||
if (rlc_am_in_tx_window(rlcP, ack_sn) > 0) {
|
||||
rlcP->num_nack_so = 0;
|
||||
rlcP->num_nack_sn = 0;
|
||||
if (rlc_am_in_tx_window(rlc_pP, ack_sn) > 0) {
|
||||
rlc_pP->num_nack_so = 0;
|
||||
rlc_pP->num_nack_sn = 0;
|
||||
|
||||
if (g_rlc_am_control_pdu_info.num_nack == 0) {
|
||||
while (sn_cursor != ack_sn) {
|
||||
if (sn_cursor == rlcP->poll_sn) {
|
||||
rlc_am_stop_and_reset_timer_poll_retransmit(rlcP,frame);
|
||||
if (sn_cursor == rlc_pP->poll_sn) {
|
||||
rlc_am_stop_and_reset_timer_poll_retransmit(rlc_pP,frameP);
|
||||
}
|
||||
rlc_am_ack_pdu(rlcP, frame, sn_cursor);
|
||||
rlc_am_ack_pdu(rlc_pP, frameP, sn_cursor);
|
||||
sn_cursor = (sn_cursor + 1) & RLC_AM_SN_MASK;
|
||||
}
|
||||
} else {
|
||||
nack_index = 0;
|
||||
nack_sn = g_rlc_am_control_pdu_info.nack_list[nack_index].nack_sn;
|
||||
while (sn_cursor != ack_sn) {
|
||||
if (sn_cursor == rlcP->poll_sn) {
|
||||
rlc_am_stop_and_reset_timer_poll_retransmit(rlcP,frame);
|
||||
if (sn_cursor == rlc_pP->poll_sn) {
|
||||
rlc_am_stop_and_reset_timer_poll_retransmit(rlc_pP,frameP);
|
||||
}
|
||||
if (sn_cursor != nack_sn) {
|
||||
rlc_am_ack_pdu(rlcP, frame, sn_cursor);
|
||||
rlc_am_ack_pdu(rlc_pP, frameP, sn_cursor);
|
||||
} else {
|
||||
rlc_am_nack_pdu (rlcP, frame,
|
||||
rlc_am_nack_pdu (rlc_pP, frameP,
|
||||
sn_cursor,
|
||||
g_rlc_am_control_pdu_info.nack_list[nack_index].so_start,
|
||||
g_rlc_am_control_pdu_info.nack_list[nack_index].so_end);
|
||||
@@ -278,53 +285,63 @@ void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, u32_t frame, mem_
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG_N(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] WARNING CONTROL PDU ACK SN OUT OF WINDOW\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
LOG_N(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] WARNING CONTROL PDU ACK SN OUT OF WINDOW\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
}
|
||||
} else {
|
||||
LOG_W(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] ERROR IN DECODING CONTROL PDU\n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
LOG_W(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] ERROR IN DECODING CONTROL PDU\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
}
|
||||
*first_byteP = (u8_t*)((uint64_t)*first_byteP + initial_pdu_size - *tb_size_in_bytes_pP);
|
||||
*first_byte_ppP = (u8_t*)((uint64_t)*first_byte_ppP + initial_pdu_size - *tb_size_in_bytes_pP);
|
||||
|
||||
free_mem_block(tbP);
|
||||
rlc_am_tx_buffer_display(rlcP, frame, NULL);
|
||||
free_mem_block(tb_pP);
|
||||
rlc_am_tx_buffer_display(rlc_pP, frameP, NULL);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
int rlc_am_write_status_pdu(u32_t frame, rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* pdu_infoP)
|
||||
int rlc_am_write_status_pdu(frame_t frameP, rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10_pP, rlc_am_control_pdu_info_t* pdu_info_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
unsigned int bit_pos = 4; // range from 0 (MSB/left) to 7 (LSB/right)
|
||||
u8_t* byte_pos = &rlc_am_pdu_sn_10P->b1;
|
||||
unsigned int index;
|
||||
unsigned int num_bytes;
|
||||
u8_t* byte_pos_p = &rlc_am_pdu_sn_10_pP->b1;
|
||||
unsigned int index = 0;
|
||||
unsigned int num_bytes = 0;
|
||||
|
||||
rlc_am_write16_bit_field(&byte_pos, &bit_pos, 10, pdu_infoP->ack_sn);
|
||||
if (pdu_infoP->num_nack > 0) {
|
||||
rlc_am_write8_bit_field(&byte_pos, &bit_pos, 1, 1);
|
||||
rlc_am_write16_bit_field(&byte_pos_p, &bit_pos, 10, pdu_info_pP->ack_sn);
|
||||
if (pdu_info_pP->num_nack > 0) {
|
||||
rlc_am_write8_bit_field(&byte_pos_p, &bit_pos, 1, 1);
|
||||
} else {
|
||||
rlc_am_write8_bit_field(&byte_pos, &bit_pos, 1, 0);
|
||||
rlc_am_write8_bit_field(&byte_pos_p, &bit_pos, 1, 0);
|
||||
}
|
||||
for (index = 0; index < pdu_infoP->num_nack ; index++) {
|
||||
rlc_am_write16_bit_field(&byte_pos, &bit_pos, 10, pdu_infoP->nack_list[index].nack_sn);
|
||||
rlc_am_write8_bit_field(&byte_pos, &bit_pos, 1, pdu_infoP->nack_list[index].e1);
|
||||
rlc_am_write8_bit_field(&byte_pos, &bit_pos, 1, pdu_infoP->nack_list[index].e2);
|
||||
for (index = 0; index < pdu_info_pP->num_nack ; index++) {
|
||||
rlc_am_write16_bit_field(&byte_pos_p, &bit_pos, 10, pdu_info_pP->nack_list[index].nack_sn);
|
||||
rlc_am_write8_bit_field(&byte_pos_p, &bit_pos, 1, pdu_info_pP->nack_list[index].e1);
|
||||
rlc_am_write8_bit_field(&byte_pos_p, &bit_pos, 1, pdu_info_pP->nack_list[index].e2);
|
||||
// if SO_START SO_END fields
|
||||
if (pdu_infoP->nack_list[index].e2 > 0) {
|
||||
rlc_am_write16_bit_field(&byte_pos, &bit_pos, 15, pdu_infoP->nack_list[index].so_start);
|
||||
rlc_am_write16_bit_field(&byte_pos, &bit_pos, 15, pdu_infoP->nack_list[index].so_end);
|
||||
if (pdu_info_pP->nack_list[index].e2 > 0) {
|
||||
rlc_am_write16_bit_field(&byte_pos_p, &bit_pos, 15, pdu_info_pP->nack_list[index].so_start);
|
||||
rlc_am_write16_bit_field(&byte_pos_p, &bit_pos, 15, pdu_info_pP->nack_list[index].so_end);
|
||||
}
|
||||
}
|
||||
num_bytes = ((unsigned int)byte_pos) - ((unsigned int)(&rlc_am_pdu_sn_10P->b1));
|
||||
num_bytes = ((unsigned int)byte_pos_p) - ((unsigned int)(&rlc_am_pdu_sn_10_pP->b1));
|
||||
if (bit_pos > 0) {
|
||||
num_bytes += 1;
|
||||
}
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD XX][RB XX] WROTE STATUS PDU %d BYTES\n",
|
||||
frame, num_bytes);
|
||||
LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX] WROTE STATUS PDU %d BYTES\n",
|
||||
frameP, num_bytes);
|
||||
#endif
|
||||
return num_bytes;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, u32_t frame)
|
||||
void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
// When STATUS reporting has been triggered, the receiving side of an AM RLC entity shall:
|
||||
@@ -349,49 +366,70 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, u32_t frame)
|
||||
// - set the ACK_SN to the SN of the next not received RLC Data PDU which is not indicated as missing in the
|
||||
// resulting STATUS PDU.
|
||||
|
||||
signed int nb_bits_to_transmit = rlcP->nb_bytes_requested_by_mac << 3;
|
||||
rlc_am_control_pdu_info_t control_pdu_info;
|
||||
rlc_am_pdu_info_t *pdu_info_cursor;
|
||||
u16_t previous_sn_cursor = (rlcP->vr_r - 1) & RLC_AM_SN_MASK;
|
||||
u16_t sn_cursor;
|
||||
mem_block_t *cursor = rlcP->receiver_buffer.head;
|
||||
int all_segments_received;
|
||||
int waited_so = 0;
|
||||
mem_block_t *tb;
|
||||
int pdu_size;
|
||||
signed int nb_bits_to_transmit = rlc_pP->nb_bytes_requested_by_mac << 3;
|
||||
rlc_am_control_pdu_info_t control_pdu_info;
|
||||
rlc_am_pdu_info_t *pdu_info_cursor_p = NULL;
|
||||
rlc_sn_t previous_sn_cursor = (rlc_pP->vr_r - 1) & RLC_AM_SN_MASK;
|
||||
rlc_sn_t sn_cursor = 0;
|
||||
mem_block_t *cursor_p = rlc_pP->receiver_buffer.head;
|
||||
int all_segments_received = 0;
|
||||
int waited_so = 0;
|
||||
mem_block_t *tb_p = NULL;
|
||||
sdu_size_t pdu_size = 0;
|
||||
|
||||
memset(&control_pdu_info, 0, sizeof(rlc_am_control_pdu_info_t));
|
||||
// header size
|
||||
nb_bits_to_transmit = nb_bits_to_transmit - 15;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] nb_bits_to_transmit %d (15 already allocated for header)\n",
|
||||
frame,rlcP->module_id, rlcP->rb_id, nb_bits_to_transmit);
|
||||
rlc_am_rx_list_display(rlcP, " DISPLAY BEFORE CONSTRUCTION OF STATUS REPORT");
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] nb_bits_to_transmit %d (15 already allocated for header)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
nb_bits_to_transmit);
|
||||
rlc_am_rx_list_display(rlc_pP, " DISPLAY BEFORE CONSTRUCTION OF STATUS REPORT");
|
||||
#endif
|
||||
|
||||
if (cursor != NULL) {
|
||||
pdu_info_cursor = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
|
||||
sn_cursor = pdu_info_cursor->sn;
|
||||
if (cursor_p != NULL) {
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
sn_cursor = pdu_info_cursor_p->sn;
|
||||
|
||||
while (rlc_am_in_rx_window(rlcP, sn_cursor) == 0) {
|
||||
cursor = cursor->next;
|
||||
while (rlc_am_in_rx_window(rlc_pP, sn_cursor) == 0) {
|
||||
cursor_p = cursor_p->next;
|
||||
previous_sn_cursor = sn_cursor;
|
||||
|
||||
pdu_info_cursor = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
|
||||
sn_cursor = pdu_info_cursor->sn;
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
sn_cursor = pdu_info_cursor_p->sn;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d FIND VR(R) <= SN sn_cursor %04d -> %04d\n", frame, rlcP->module_id, rlcP->rb_id, __LINE__, previous_sn_cursor, sn_cursor);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d FIND VR(R) <= SN sn_cursor %04d -> %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
previous_sn_cursor,
|
||||
sn_cursor);
|
||||
#endif
|
||||
}
|
||||
|
||||
// 12 bits = size of NACK_SN field + E1, E2 bits
|
||||
// 42 bits = size of NACK_SN field + SO_START, SO_END fields, E1, E2 bits
|
||||
while ((cursor != NULL) && (nb_bits_to_transmit >= 12)){
|
||||
pdu_info_cursor = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
|
||||
all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor->data))->all_segments_received;
|
||||
sn_cursor = pdu_info_cursor->sn;
|
||||
while ((cursor_p != NULL) && (nb_bits_to_transmit >= 12)){
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received;
|
||||
sn_cursor = pdu_info_cursor_p->sn;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d LOOPING sn_cursor %04d previous sn_cursor %04d \n", frame, rlcP->module_id, rlcP->rb_id, __LINE__, sn_cursor, previous_sn_cursor);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d LOOPING sn_cursor %04d previous sn_cursor %04d \n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
sn_cursor,
|
||||
previous_sn_cursor);
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -399,29 +437,50 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, u32_t frame)
|
||||
// -------------------------------------------------------------------------------
|
||||
if (sn_cursor == previous_sn_cursor) {
|
||||
do {
|
||||
cursor = cursor->next;
|
||||
if (cursor != NULL) {
|
||||
pdu_info_cursor = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
|
||||
all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor->data))->all_segments_received;
|
||||
sn_cursor = pdu_info_cursor->sn;
|
||||
cursor_p = cursor_p->next;
|
||||
if (cursor_p != NULL) {
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received;
|
||||
sn_cursor = pdu_info_cursor_p->sn;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d NOW sn_cursor %04d \n", frame, rlcP->module_id, rlcP->rb_id, __LINE__, sn_cursor);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d NOW sn_cursor %04d \n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
sn_cursor);
|
||||
#endif
|
||||
} else {
|
||||
if (all_segments_received) {
|
||||
control_pdu_info.ack_sn = (sn_cursor + 1) & RLC_AM_SN_MASK;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d PREPARE SENDING ACK SN %04d \n", frame, rlcP->module_id, rlcP->rb_id, __LINE__, control_pdu_info.ack_sn);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING ACK SN %04d \n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
control_pdu_info.ack_sn);
|
||||
#endif
|
||||
} else {
|
||||
control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d PREPARE SENDING ACK SN %04d (CASE PREVIOUS SN)\n", frame, rlcP->module_id, rlcP->rb_id, __LINE__, control_pdu_info.ack_sn);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING ACK SN %04d (CASE PREVIOUS SN)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
control_pdu_info.ack_sn);
|
||||
#endif
|
||||
}
|
||||
goto end_push_nack;
|
||||
}
|
||||
} while ((cursor != NULL) && (sn_cursor == previous_sn_cursor));
|
||||
} while ((cursor_p != NULL) && (sn_cursor == previous_sn_cursor));
|
||||
}
|
||||
// -------------------------------------------------------------------------------
|
||||
// simple case, PDU(s) is/are missing
|
||||
@@ -437,14 +496,27 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, u32_t frame)
|
||||
control_pdu_info.num_nack += 1;
|
||||
nb_bits_to_transmit = nb_bits_to_transmit - 12;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d PREPARE SENDING NACK %04d\n",
|
||||
frame, rlcP->module_id, rlcP->rb_id, __LINE__, previous_sn_cursor);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING NACK %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
previous_sn_cursor);
|
||||
#endif
|
||||
} else {
|
||||
control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d NO MORE BITS FOR SENDING NACK %04d -> ABORT AND SET FINAL ACK %04d\n",
|
||||
frame, rlcP->module_id, rlcP->rb_id, __LINE__, previous_sn_cursor, control_pdu_info.ack_sn);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d NO MORE BITS FOR SENDING NACK %04d -> ABORT AND SET FINAL ACK %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
previous_sn_cursor,
|
||||
control_pdu_info.ack_sn);
|
||||
#endif
|
||||
goto end_push_nack;
|
||||
}
|
||||
@@ -455,62 +527,99 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, u32_t frame)
|
||||
if (all_segments_received == 0) {
|
||||
waited_so = 0;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] if (all_segments_received == 0) \n", frame, rlcP->module_id, rlcP->rb_id);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] if (all_segments_received == 0) \n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
#endif
|
||||
do {
|
||||
if (pdu_info_cursor->so > waited_so) {
|
||||
if (pdu_info_cursor_p->so > waited_so) {
|
||||
if (nb_bits_to_transmit >= 42) {
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_cursor;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = waited_so;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = pdu_info_cursor->so - 1;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = pdu_info_cursor_p->so - 1;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
|
||||
control_pdu_info.num_nack += 1;
|
||||
nb_bits_to_transmit = nb_bits_to_transmit - 42;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d (CASE SO %d > WAITED SO %d)\n", frame, rlcP->module_id, rlcP->rb_id, __LINE__, sn_cursor, waited_so, pdu_info_cursor->so - 1, pdu_info_cursor->so, waited_so);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d (CASE SO %d > WAITED SO %d)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
sn_cursor,
|
||||
waited_so,
|
||||
pdu_info_cursor_p->so - 1,
|
||||
pdu_info_cursor_p->so,
|
||||
waited_so);
|
||||
#endif
|
||||
if (pdu_info_cursor->lsf == 1) { // last segment flag
|
||||
if (pdu_info_cursor_p->lsf == 1) { // last segment flag
|
||||
//waited_so = 0x7FF;
|
||||
waited_so = 0x7FFF;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d SN %04d SET WAITED SO 0x7FFF)\n", frame, rlcP->module_id, rlcP->rb_id, __LINE__, sn_cursor);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d SN %04d SET WAITED SO 0x7FFF)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__, sn_cursor);
|
||||
#endif
|
||||
//break;
|
||||
} else {
|
||||
waited_so = pdu_info_cursor->so + pdu_info_cursor->payload_size;
|
||||
waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d SN %04d SET WAITED SO %d @1\n", frame, rlcP->module_id, rlcP->rb_id, __LINE__, sn_cursor, waited_so);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d SN %04d SET WAITED SO %d @1\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
sn_cursor,
|
||||
waited_so);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
control_pdu_info.ack_sn = sn_cursor;
|
||||
goto end_push_nack;
|
||||
}
|
||||
} else { //else { // pdu_info_cursor->so <= waited_so
|
||||
waited_so = pdu_info_cursor->so + pdu_info_cursor->payload_size;
|
||||
if (pdu_info_cursor->lsf == 1) { // last segment flag
|
||||
} else { //else { // pdu_info_cursor_p->so <= waited_so
|
||||
waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size;
|
||||
if (pdu_info_cursor_p->lsf == 1) { // last segment flag
|
||||
//waited_so = 0x7FF;
|
||||
waited_so = 0x7FFF;
|
||||
}
|
||||
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d SN %04d SET WAITED SO %d @2\n", frame, rlcP->module_id, rlcP->rb_id, __LINE__, sn_cursor, waited_so);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d SN %04d SET WAITED SO %d @2\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
sn_cursor, waited_so);
|
||||
#endif
|
||||
}
|
||||
|
||||
cursor = cursor->next;
|
||||
if (cursor != NULL) {
|
||||
pdu_info_cursor = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
|
||||
all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor->data))->all_segments_received;
|
||||
cursor_p = cursor_p->next;
|
||||
if (cursor_p != NULL) {
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received;
|
||||
previous_sn_cursor = sn_cursor;
|
||||
sn_cursor = pdu_info_cursor->sn;
|
||||
sn_cursor = pdu_info_cursor_p->sn;
|
||||
} else {
|
||||
// LG control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
|
||||
control_pdu_info.ack_sn = previous_sn_cursor;
|
||||
goto end_push_nack;
|
||||
}
|
||||
} while ((cursor != NULL) && (sn_cursor == previous_sn_cursor));
|
||||
} while ((cursor_p != NULL) && (sn_cursor == previous_sn_cursor));
|
||||
|
||||
// may be last segment of PDU not received
|
||||
//if ((sn_cursor != previous_sn_cursor) && (waited_so != 0x7FF)) {
|
||||
@@ -525,7 +634,16 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, u32_t frame)
|
||||
control_pdu_info.num_nack += 1;
|
||||
nb_bits_to_transmit = nb_bits_to_transmit - 42;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d\n", frame, rlcP->module_id, rlcP->rb_id, __LINE__, previous_sn_cursor, waited_so, 0x7FFF);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
previous_sn_cursor,
|
||||
waited_so,
|
||||
0x7FFF);
|
||||
#endif
|
||||
} else {
|
||||
control_pdu_info.ack_sn = previous_sn_cursor;
|
||||
@@ -535,16 +653,22 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, u32_t frame)
|
||||
waited_so = 0;
|
||||
} else {
|
||||
waited_so = 0;
|
||||
cursor = cursor->next;
|
||||
cursor_p = cursor_p->next;
|
||||
previous_sn_cursor = sn_cursor;
|
||||
}
|
||||
}
|
||||
control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
|
||||
} else {
|
||||
control_pdu_info.ack_sn = rlcP->vr_r;
|
||||
control_pdu_info.ack_sn = rlc_pP->vr_r;
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d PREPARE SENDING ACK %04d = VR(R)\n",
|
||||
frame, rlcP->module_id, rlcP->rb_id, __LINE__, control_pdu_info.ack_sn);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING ACK %04d = VR(R)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
control_pdu_info.ack_sn);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -552,40 +676,61 @@ end_push_nack:
|
||||
if (control_pdu_info.num_nack > 0) {
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack - 1].e1 = 0;
|
||||
}
|
||||
//msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] nb_bits_to_transmit %d\n",
|
||||
// rlcP->module_id, rlcP->rb_id, frame,nb_bits_to_transmit);
|
||||
//msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] nb_bits_to_transmit %d\n",
|
||||
// rlc_pP->module_id, rlc_pP->rb_id, frameP,nb_bits_to_transmit);
|
||||
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d PREPARE SENDING ACK %04d NUM NACK %d\n",
|
||||
frame, rlcP->module_id, rlcP->rb_id, __LINE__, control_pdu_info.ack_sn, control_pdu_info.num_nack);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING ACK %04d NUM NACK %d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
control_pdu_info.ack_sn,
|
||||
control_pdu_info.num_nack);
|
||||
#endif
|
||||
// encode the control pdu
|
||||
pdu_size = rlcP->nb_bytes_requested_by_mac - ((nb_bits_to_transmit - 7 )>> 3);
|
||||
pdu_size = rlc_pP->nb_bytes_requested_by_mac - ((nb_bits_to_transmit - 7 )>> 3);
|
||||
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] LINE %d forecast pdu_size %d\n",
|
||||
frame, rlcP->module_id, rlcP->rb_id, __LINE__, pdu_size);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d forecast pdu_size %d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
__LINE__,
|
||||
pdu_size);
|
||||
#endif
|
||||
tb = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size);
|
||||
memset(tb->data, 0, sizeof(struct mac_tb_req) + pdu_size);
|
||||
//estimation only ((struct mac_tb_req*)(tb->data))->tb_size = pdu_size;
|
||||
((struct mac_tb_req*)(tb->data))->data_ptr = (u8_t*)&(tb->data[sizeof(struct mac_tb_req)]);
|
||||
tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size);
|
||||
memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size);
|
||||
//estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
|
||||
((struct mac_tb_req*)(tb_p->data))->data_ptr = (u8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]);
|
||||
|
||||
// warning reuse of pdu_size
|
||||
pdu_size = rlc_am_write_status_pdu(frame,(rlc_am_pdu_sn_10_t*)(((struct mac_tb_req*)(tb->data))->data_ptr), &control_pdu_info);
|
||||
((struct mac_tb_req*)(tb->data))->tb_size = pdu_size;
|
||||
//assert((((struct mac_tb_req*)(tb->data))->tb_size) < 3000);
|
||||
pdu_size = rlc_am_write_status_pdu(frameP,(rlc_am_pdu_sn_10_t*)(((struct mac_tb_req*)(tb_p->data))->data_ptr), &control_pdu_info);
|
||||
((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
|
||||
//assert((((struct mac_tb_req*)(tb_p->data))->tb_size) < 3000);
|
||||
|
||||
#ifdef TRACE_STATUS_CREATION
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][SEND-STATUS] SEND STATUS PDU SIZE %d, rlcP->nb_bytes_requested_by_mac %d, nb_bits_to_transmit>>3 %d\n", frame, rlcP->module_id, rlcP->rb_id, pdu_size, rlcP->nb_bytes_requested_by_mac, nb_bits_to_transmit >> 3);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] SEND STATUS PDU SIZE %d, rlc_pP->nb_bytes_requested_by_mac %d, nb_bits_to_transmit>>3 %d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
pdu_size,
|
||||
rlc_pP->nb_bytes_requested_by_mac,
|
||||
nb_bits_to_transmit >> 3);
|
||||
#endif
|
||||
assert(pdu_size == (rlcP->nb_bytes_requested_by_mac - (nb_bits_to_transmit >> 3)));
|
||||
assert(pdu_size == (rlc_pP->nb_bytes_requested_by_mac - (nb_bits_to_transmit >> 3)));
|
||||
|
||||
// remaining bytes to transmit for RLC (retrans pdus and new data pdus)
|
||||
rlcP->nb_bytes_requested_by_mac = rlcP->nb_bytes_requested_by_mac - pdu_size;
|
||||
rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - pdu_size;
|
||||
// put pdu in trans
|
||||
list_add_head(tb, &rlcP->control_pdu_list);
|
||||
rlcP->stat_tx_control_pdu += 1;
|
||||
rlcP->stat_tx_control_bytes += pdu_size;
|
||||
list_add_head(tb_p, &rlc_pP->control_pdu_list);
|
||||
rlc_pP->stat_tx_control_pdu += 1;
|
||||
rlc_pP->stat_tx_control_bytes += pdu_size;
|
||||
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ protected_rlc_am_status_report( signed int rlc_am_get_control_pdu_infos (rlc_am_
|
||||
*/
|
||||
protected_rlc_am_status_report( void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_infoP);)
|
||||
|
||||
/*! \fn void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, u32_t frame, mem_block_t* tbP, u8_t* first_byte, u16_t tb_size_in_bytes)
|
||||
/*! \fn void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* tbP, u8_t* first_byte, u16_t tb_size_in_bytes)
|
||||
* \brief Process the informations contained in the control PDU.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
@@ -114,22 +114,22 @@ protected_rlc_am_status_report( void rlc_am_display_control_pdu_infos(rlc_am_con
|
||||
* \param[in] first_byte Pointer on first byte of control PDU.
|
||||
* \param[in] tb_size_in_bytes Pointer on size of serialized control PDU in bytes.
|
||||
*/
|
||||
protected_rlc_am_status_report( void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, u32_t frame, mem_block_t* tbP, u8_t** first_byte, s16_t *tb_size_in_bytes);)
|
||||
protected_rlc_am_status_report( void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* tbP, u8_t** first_byte, s16_t *tb_size_in_bytes);)
|
||||
|
||||
/*! \fn int rlc_am_write_status_pdu(u32_t frame,rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* pdu_infoP)
|
||||
/*! \fn int rlc_am_write_status_pdu(frame_t frameP,rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* pdu_infoP)
|
||||
* \brief Remove all marked holes for PDU with sequence number "snP".
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] rlc_am_pdu_sn_10P Pointer on the header of the RLC AM control PDU.
|
||||
* \param[in] pdu_infoP Struct containing PDU control informations elements.
|
||||
* \return The number of bytes that have been written.
|
||||
*/
|
||||
protected_rlc_am_status_report(int rlc_am_write_status_pdu(u32_t frame, rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* pdu_infoP);)
|
||||
protected_rlc_am_status_report(int rlc_am_write_status_pdu(frame_t frameP, rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* pdu_infoP);)
|
||||
|
||||
/*! \fn void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, u32_t frame)
|
||||
/*! \fn void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, frame_t frameP)
|
||||
* \brief Send a status PDU based on the receiver buffer content.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
*/
|
||||
protected_rlc_am_status_report(void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, u32_t frame);)
|
||||
protected_rlc_am_status_report(void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, frame_t frameP);)
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
@@ -73,18 +73,14 @@ typedef struct sdu_management_flags {
|
||||
typedef struct rlc_am_tx_sdu_management {
|
||||
mem_block_t *mem_block; /*!< \brief SDU embedded in a mem_block_t. */
|
||||
u8_t *first_byte; /*!< \brief Pointer on SDU payload. */
|
||||
s32_t sdu_creation_time; /*!< \brief Time stamped with mac_xface->frame. */
|
||||
u32_t mui; /*!< \brief Message Unit Identifier, still here for historical reasons (no LTE-PDCP compliant now). */
|
||||
u16_t sdu_remaining_size; /*!< \brief Remaining size in bytes to be filled in a PDU. */
|
||||
u16_t sdu_segmented_size; /*!< \brief Bytes already segmented in a/several PDU(s). */
|
||||
u16_t sdu_size; /*!< \brief SDU size in bytes. */
|
||||
frame_t sdu_creation_time; /*!< \brief Time stamped with mac_xface->frame. */
|
||||
mui_t mui; /*!< \brief Message Unit Identifier, still here for historical reasons (no LTE-PDCP compliant now). */
|
||||
sdu_size_t sdu_remaining_size; /*!< \brief Remaining size in bytes to be filled in a PDU. */
|
||||
sdu_size_t sdu_segmented_size; /*!< \brief Bytes already segmented in a/several PDU(s). */
|
||||
sdu_size_t sdu_size; /*!< \brief SDU size in bytes. */
|
||||
s16_t pdus_index[RLC_AM_MAX_SDU_FRAGMENTS]; /*!< \brief Array containing the sequence numbers of the PDU in which the SDU has been segmented. */
|
||||
u8_t nb_pdus; /*!< \brief Number of referenced PDUs in pdus_index[] array. */
|
||||
//u8_t nb_pdus_internal_use; // count the number of pdus transmitted to lower layers (used in mux procedure)
|
||||
u8_t nb_pdus_ack; /*!< \brief Number of referenced PDUs in pdus_index[] array that have been acknowledged. (used for confirmation and MaxDat discard)*/
|
||||
//u8_t nb_pdus_time; // counter used for timer based discard
|
||||
|
||||
//s8_t li_index_for_discard; // indicates the li index in the last pdu of the sdu, marking the end of the sdu
|
||||
sdu_management_flags_t flags; /*!< \brief bit-field flags related to SDU segmentation and transmission */
|
||||
} rlc_am_tx_sdu_management_t;
|
||||
|
||||
@@ -114,15 +110,15 @@ typedef struct rlc_am_tx_data_pdu_management {
|
||||
u8_t *first_byte; /*!< \brief Pointer on the PDU including header, LIs, data */
|
||||
u8_t *payload; /*!< \brief Pointer on the PDU payload */
|
||||
s16_t sdus_index[RLC_AM_MAX_SDU_IN_PDU]; /*!< \brief Index of SDU(s) having segments in this pdu (index in rlc_am_entity.input_sdus[]) */
|
||||
u32_t last_nack_time; /*!< \brief Last frame this PDU was negative acknowledged, for not nacking several times in the same frame */
|
||||
u16_t hole_so_start [RLC_AM_MAX_HOLES_REPORT_PER_PDU]; /*!< \brief Array containing the start segment offsets for marking a hole (negative acknowledged area) in the PDU. */
|
||||
u16_t hole_so_stop [RLC_AM_MAX_HOLES_REPORT_PER_PDU]; /*!< \brief Array containing the stop segment offsets for marking a hole (negative acknowledged area) in the PDU. */
|
||||
frame_t last_nack_time; /*!< \brief Last frame this PDU was negative acknowledged, for not nacking several times in the same frame */
|
||||
sdu_size_t hole_so_start [RLC_AM_MAX_HOLES_REPORT_PER_PDU]; /*!< \brief Array containing the start segment offsets for marking a hole (negative acknowledged area) in the PDU. */
|
||||
sdu_size_t hole_so_stop [RLC_AM_MAX_HOLES_REPORT_PER_PDU]; /*!< \brief Array containing the stop segment offsets for marking a hole (negative acknowledged area) in the PDU. */
|
||||
u8_t num_holes; /*!< \brief Number of registereg holes in hole_so_start[], hole_so_stop[]. */
|
||||
s16_t header_and_payload_size; /*!< \brief Size of the PDU in bytes, including header and payload. */
|
||||
s16_t payload_size; /*!< \brief Size of the PDU payload in bytes. */
|
||||
s16_t sn; /*!< \brief Sequence number of the PDU. */
|
||||
s16_t nack_so_start; /*!< \brief Lowest NACK start segment offset, must be set to 0 if global NACK. */
|
||||
s16_t nack_so_stop; /*!< \brief Highest NACK stop segment offset, must be set to data_size if global NACK */
|
||||
sdu_ssize_t header_and_payload_size; /*!< \brief Size of the PDU in bytes, including header and payload. */
|
||||
sdu_ssize_t payload_size; /*!< \brief Size of the PDU payload in bytes. */
|
||||
rlc_sn_t sn; /*!< \brief Sequence number of the PDU. */
|
||||
sdu_ssize_t nack_so_start; /*!< \brief Lowest NACK start segment offset, must be set to 0 if global NACK. */
|
||||
sdu_ssize_t nack_so_stop; /*!< \brief Highest NACK stop segment offset, must be set to data_size if global NACK */
|
||||
|
||||
s8_t nb_sdus; /*!< \brief Number of sdu having segments in this pdu. */
|
||||
s8_t retx_count; /*!< \brief Counts the number of retransmissions of an AMD PDU (see subclause 5.2.1). There is one RETX_COUNT counter per PDU that needs to be retransmitted. there is one VT(DAT) for each PDU and it is incremented each time the PDU is transmitted. */
|
||||
@@ -137,12 +133,6 @@ typedef struct rlc_am_tx_data_pdu_management {
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*typedef struct rlc_am_tx_control_pdu_management {
|
||||
mem_block_t *mem_block; //pointer on pdu queued in retransmission_buffer_to_send in order
|
||||
u8_t *first_byte; // pointer on the pdu including header, LIs;
|
||||
u16_t size;
|
||||
} rlc_am_tx_control_pdu_management_t;*/
|
||||
|
||||
/*! \struct nack_sn_t
|
||||
* \brief Structure containing Status PDU information element.
|
||||
*/
|
||||
@@ -227,12 +217,12 @@ typedef struct rlc_am_pdu_info {
|
||||
* \brief Generic structure for implementing a timer.
|
||||
*/
|
||||
typedef struct rlc_am_timer {
|
||||
u32_t frame_time_out;/*!< \brief When set, indicate the frame number the timer will time-out. */
|
||||
u32_t frame_start; /*!< \brief indicate the frame number the timer has been started. */
|
||||
u32_t time_out; /*!< \brief Configured timer duration in frames. */
|
||||
u32_t running:1; /*!< \brief The timer is running. */
|
||||
u32_t timed_out:1; /*!< \brief The timer has timed-out. */
|
||||
u32_t dummy:30; /*!< \brief Bits not used. */
|
||||
frame_t frame_time_out;/*!< \brief When set, indicate the frame number the timer will time-out. */
|
||||
frame_t frame_start; /*!< \brief indicate the frame number the timer has been started. */
|
||||
frame_t time_out; /*!< \brief Configured timer duration in frames. */
|
||||
u32_t running:1; /*!< \brief The timer is running. */
|
||||
u32_t timed_out:1; /*!< \brief The timer has timed-out. */
|
||||
u32_t dummy:30; /*!< \brief Bits not used. */
|
||||
} rlc_am_timer_t ;
|
||||
/** @} */
|
||||
|
||||
@@ -261,29 +251,16 @@ struct rlc_am_tx_data_pdu_allocation {
|
||||
struct rlc_am_tx_data_pdu_management rlc_am_tx_pdu_mngmnt;
|
||||
struct mac_tb_req tb_req;
|
||||
struct mac_tx_tb_management tb_mngt;
|
||||
# ifdef BYPASS_L1
|
||||
struct rlc_am_rx_pdu_management dummy;
|
||||
struct mac_tb_ind dummy2;
|
||||
struct mac_rx_tb_management dummy3;
|
||||
struct rlc_indication dummy4;
|
||||
# endif
|
||||
} dummy;
|
||||
};
|
||||
|
||||
struct rlc_am_tx_control_pdu_allocation {
|
||||
/*struct rlc_am_tx_control_pdu_allocation {
|
||||
union {
|
||||
struct mac_tb_req tb_req;
|
||||
struct mac_tx_tb_management tb_mngt;
|
||||
//struct rlc_am_tx_control_pdu_management rlc_am_tx_pdu_mngmnt;
|
||||
# ifdef BYPASS_L1
|
||||
struct mac_tb_ind dummy2;
|
||||
struct mac_rx_tb_management dummy3;
|
||||
struct rlc_indication dummy4;
|
||||
# endif
|
||||
} dummy;
|
||||
};
|
||||
};*/
|
||||
|
||||
// For test purpose
|
||||
struct rlc_am_data_req_alloc { // alloc enought bytes for sdu mngt also
|
||||
union {
|
||||
struct rlc_am_data_req dummy1;
|
||||
|
||||
@@ -37,7 +37,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_check_timer_poll_retransmit(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
void rlc_am_check_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
// 5.2.2.3 Expiry of t-PollRetransmit
|
||||
@@ -49,77 +49,85 @@ void rlc_am_check_timer_poll_retransmit(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
// - consider any AMD PDU which has not been positively acknowledged for retransmission;
|
||||
// - include a poll in a RLC data PDU as described in section 5.2.2.1.
|
||||
|
||||
if (rlcP->t_poll_retransmit.running) {
|
||||
if (rlc_pP->t_poll_retransmit.running) {
|
||||
if (
|
||||
// CASE 1: start time out
|
||||
// +-----------+------------------+----------+
|
||||
// | |******************| |
|
||||
// +-----------+------------------+----------+
|
||||
//FRAME # 0 FRAME MAX
|
||||
((rlcP->t_poll_retransmit.frame_start < rlcP->t_poll_retransmit.frame_time_out) &&
|
||||
((frame >= rlcP->t_poll_retransmit.frame_time_out) ||
|
||||
(frame < rlcP->t_poll_retransmit.frame_start))) ||
|
||||
((rlc_pP->t_poll_retransmit.frame_start < rlc_pP->t_poll_retransmit.frame_time_out) &&
|
||||
((frameP >= rlc_pP->t_poll_retransmit.frame_time_out) ||
|
||||
(frameP < rlc_pP->t_poll_retransmit.frame_start))) ||
|
||||
// CASE 2: time out start
|
||||
// +-----------+------------------+----------+
|
||||
// |***********| |**********|
|
||||
// +-----------+------------------+----------+
|
||||
//FRAME # 0 FRAME MAX VALUE
|
||||
((rlcP->t_poll_retransmit.frame_start > rlcP->t_poll_retransmit.frame_time_out) &&
|
||||
(frame < rlcP->t_poll_retransmit.frame_start) && (frame >= rlcP->t_poll_retransmit.frame_time_out))
|
||||
((rlc_pP->t_poll_retransmit.frame_start > rlc_pP->t_poll_retransmit.frame_time_out) &&
|
||||
(frameP < rlc_pP->t_poll_retransmit.frame_start) && (frameP >= rlc_pP->t_poll_retransmit.frame_time_out))
|
||||
) {
|
||||
//if (rlcP->t_poll_retransmit.frame_time_out <= frame) {
|
||||
rlcP->t_poll_retransmit.running = 0;
|
||||
rlcP->t_poll_retransmit.timed_out = 1;
|
||||
rlcP->stat_timer_poll_retransmit_timed_out += 1;
|
||||
//if (rlc_pP->t_poll_retransmit.frame_time_out <= frameP) {
|
||||
rlc_pP->t_poll_retransmit.running = 0;
|
||||
rlc_pP->t_poll_retransmit.timed_out = 1;
|
||||
rlc_pP->stat_timer_poll_retransmit_timed_out += 1;
|
||||
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T_POLL_RETRANSMIT] TIME-OUT\n", frame,
|
||||
rlcP->module_id, rlcP->rb_id);
|
||||
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RLC_AM][MOD %02d][RB %02d][--- t-PollRetransmit Timed-out --->][RLC_AM][MOD %02d][RB %02d]\n",
|
||||
frame,
|
||||
rlcP->module_id,
|
||||
rlcP->rb_id,
|
||||
rlcP->module_id,
|
||||
rlcP->rb_id);
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][T_POLL_RETRANSMIT] TIME-OUT\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
|
||||
#warning TO DO rlc_am_check_timer_poll_retransmit
|
||||
rlcP->t_poll_retransmit.frame_time_out = frame + rlcP->t_poll_retransmit.time_out;
|
||||
rlc_pP->t_poll_retransmit.frame_time_out = frameP + rlc_pP->t_poll_retransmit.time_out;
|
||||
}
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *rlcP)
|
||||
int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *rlc_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
return rlcP->t_poll_retransmit.timed_out;
|
||||
return rlc_pP->t_poll_retransmit.timed_out;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_stop_and_reset_timer_poll_retransmit(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
void rlc_am_stop_and_reset_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T_POLL_RETRANSMIT] STOPPED AND RESET\n", frame,
|
||||
rlcP->module_id, rlcP->rb_id);
|
||||
rlcP->t_poll_retransmit.running = 0;
|
||||
rlcP->t_poll_retransmit.frame_time_out = 0;
|
||||
rlcP->t_poll_retransmit.frame_start = 0;
|
||||
rlcP->t_poll_retransmit.timed_out = 0;
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][T_POLL_RETRANSMIT] STOPPED AND RESET\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_pP->t_poll_retransmit.running = 0;
|
||||
rlc_pP->t_poll_retransmit.frame_time_out = 0;
|
||||
rlc_pP->t_poll_retransmit.frame_start = 0;
|
||||
rlc_pP->t_poll_retransmit.timed_out = 0;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_start_timer_poll_retransmit(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
void rlc_am_start_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
rlcP->t_poll_retransmit.running = 1;
|
||||
rlcP->t_poll_retransmit.frame_time_out = frame + rlcP->t_poll_retransmit.time_out;
|
||||
rlcP->t_poll_retransmit.frame_start = frame;
|
||||
rlcP->t_poll_retransmit.timed_out = 0;
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T_POLL_RETRANSMIT] STARTED (TIME-OUT = FRAME %05d)\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->t_poll_retransmit.frame_time_out);
|
||||
rlc_pP->t_poll_retransmit.running = 1;
|
||||
rlc_pP->t_poll_retransmit.frame_time_out = frameP + rlc_pP->t_poll_retransmit.time_out;
|
||||
rlc_pP->t_poll_retransmit.frame_start = frameP;
|
||||
rlc_pP->t_poll_retransmit.timed_out = 0;
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][T_POLL_RETRANSMIT] STARTED (TIME-OUT = FRAME %05d)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->t_poll_retransmit.frame_time_out);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_init_timer_poll_retransmit(rlc_am_entity_t *rlcP, u32_t time_outP)
|
||||
void rlc_am_init_timer_poll_retransmit(rlc_am_entity_t *rlc_pP, u32_t time_outP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
rlcP->t_poll_retransmit.running = 0;
|
||||
rlcP->t_poll_retransmit.frame_time_out = 0;
|
||||
rlcP->t_poll_retransmit.frame_start = 0;
|
||||
rlcP->t_poll_retransmit.time_out = time_outP;
|
||||
rlcP->t_poll_retransmit.timed_out = 0;
|
||||
rlc_pP->t_poll_retransmit.running = 0;
|
||||
rlc_pP->t_poll_retransmit.frame_time_out = 0;
|
||||
rlc_pP->t_poll_retransmit.frame_start = 0;
|
||||
rlc_pP->t_poll_retransmit.time_out = time_outP;
|
||||
rlc_pP->t_poll_retransmit.timed_out = 0;
|
||||
}
|
||||
|
||||
@@ -58,39 +58,39 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/*! \fn void rlc_am_check_timer_poll_retransmit(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_check_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Check if timer Poll-retransmit has timed-out, if so it is stopped and has the status "timed-out".
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
*/
|
||||
protected_rlc_am_timer_poll_retransmit(void rlc_am_check_timer_poll_retransmit(rlc_am_entity_t *rlcP,u32_t frame));
|
||||
protected_rlc_am_timer_poll_retransmit(void rlc_am_check_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP));
|
||||
|
||||
/*! \fn int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *rlcP)
|
||||
/*! \fn int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *rlc_pP)
|
||||
* \brief Boolean function, check if timer Poll-retransmit has timed-out.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \return 1 if timer Poll-retransmit has timed-out, else 0.
|
||||
*/
|
||||
protected_rlc_am_timer_poll_retransmit(int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *rlcP);)
|
||||
protected_rlc_am_timer_poll_retransmit(int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *rlc_pP);)
|
||||
|
||||
/*! \fn void rlc_am_stop_and_reset_timer_poll_retransmit(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_stop_and_reset_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Stop and reset the timer Poll-retransmit.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
*/
|
||||
protected_rlc_am_timer_poll_retransmit(void rlc_am_stop_and_reset_timer_poll_retransmit(rlc_am_entity_t *rlcP,u32_t frame);)
|
||||
protected_rlc_am_timer_poll_retransmit(void rlc_am_stop_and_reset_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP);)
|
||||
|
||||
/*! \fn void rlc_am_start_timer_poll_retransmit(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_start_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Re-arm (based on RLC AM config parameter) and start timer Poll-retransmit.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
*/
|
||||
protected_rlc_am_timer_poll_retransmit(void rlc_am_start_timer_poll_retransmit(rlc_am_entity_t *rlcP,u32_t frame);)
|
||||
protected_rlc_am_timer_poll_retransmit(void rlc_am_start_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP);)
|
||||
|
||||
/*! \fn void rlc_am_init_timer_poll_retransmit(rlc_am_entity_t *rlcP, u32_t time_outP)
|
||||
/*! \fn void rlc_am_init_timer_poll_retransmit(rlc_am_entity_t *rlc_pP, u32_t time_outP)
|
||||
* \brief Initialize the timer Poll-retransmit with RLC AM time-out config parameter.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] time_outP Time-out in frame units.
|
||||
*/
|
||||
protected_rlc_am_timer_poll_retransmit(void rlc_am_init_timer_poll_retransmit(rlc_am_entity_t *rlcP, u32_t time_outP);)
|
||||
protected_rlc_am_timer_poll_retransmit(void rlc_am_init_timer_poll_retransmit(rlc_am_entity_t *rlc_pP, u32_t time_outP);)
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
@@ -37,31 +37,31 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# include "LAYER2/MAC/extern.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_check_timer_reordering(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
void rlc_am_check_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
return ; // for debug
|
||||
|
||||
|
||||
if (rlcP->t_reordering.running) {
|
||||
if (rlc_pP->t_reordering.running) {
|
||||
if (
|
||||
// CASE 1: start time out
|
||||
// +-----------+------------------+----------+
|
||||
// | |******************| |
|
||||
// +-----------+------------------+----------+
|
||||
//FRAME # 0 FRAME MAX
|
||||
((rlcP->t_reordering.frame_start < rlcP->t_reordering.frame_time_out) &&
|
||||
((frame >= rlcP->t_reordering.frame_time_out) ||
|
||||
(frame < rlcP->t_reordering.frame_start))) ||
|
||||
((rlc_pP->t_reordering.frame_start < rlc_pP->t_reordering.frame_time_out) &&
|
||||
((frameP >= rlc_pP->t_reordering.frame_time_out) ||
|
||||
(frameP < rlc_pP->t_reordering.frame_start))) ||
|
||||
// CASE 2: time out start
|
||||
// +-----------+------------------+----------+
|
||||
// |***********| |**********|
|
||||
// +-----------+------------------+----------+
|
||||
//FRAME # 0 FRAME MAX VALUE
|
||||
((rlcP->t_reordering.frame_start > rlcP->t_reordering.frame_time_out) &&
|
||||
(frame < rlcP->t_reordering.frame_start) && (frame >= rlcP->t_reordering.frame_time_out))
|
||||
((rlc_pP->t_reordering.frame_start > rlc_pP->t_reordering.frame_time_out) &&
|
||||
(frameP < rlc_pP->t_reordering.frame_start) && (frameP >= rlc_pP->t_reordering.frame_time_out))
|
||||
) {
|
||||
//if (rlcP->t_reordering.frame_time_out == frame) {
|
||||
//if (rlc_pP->t_reordering.frame_time_out == frameP) {
|
||||
// 5.1.3.2.4 Actions when t-Reordering expires
|
||||
// When t-Reordering expires, the receiving side of an AM RLC entity shall:
|
||||
// - update VR(MS) to the SN of the first AMD PDU with SN >= VR(X) for which not all byte segments have been
|
||||
@@ -71,71 +71,92 @@ void rlc_am_check_timer_reordering(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
// - set VR(X) to VR(H).
|
||||
|
||||
|
||||
rlcP->t_reordering.running = 0;
|
||||
rlcP->t_reordering.timed_out = 1;
|
||||
rlcP->stat_timer_reordering_timed_out += 1;
|
||||
rlc_pP->t_reordering.running = 0;
|
||||
rlc_pP->t_reordering.timed_out = 1;
|
||||
rlc_pP->stat_timer_reordering_timed_out += 1;
|
||||
|
||||
rlc_am_pdu_info_t* pdu_info;
|
||||
mem_block_t* cursor;
|
||||
cursor = rlcP->receiver_buffer.head;
|
||||
cursor = rlc_pP->receiver_buffer.head;
|
||||
|
||||
if (cursor) {
|
||||
do {
|
||||
pdu_info = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
|
||||
|
||||
// NOT VERY SURE ABOUT THAT, THINK ABOUT IT
|
||||
rlcP->vr_ms = (pdu_info->sn + 1) & RLC_AM_SN_MASK;
|
||||
rlc_pP->vr_ms = (pdu_info->sn + 1) & RLC_AM_SN_MASK;
|
||||
|
||||
if (rlc_am_sn_gte_vr_x(rlcP, pdu_info->sn)) {
|
||||
if (rlc_am_sn_gte_vr_x(rlc_pP, pdu_info->sn)) {
|
||||
if (((rlc_am_rx_pdu_management_t*)(cursor->data))->all_segments_received == 0) {
|
||||
rlcP->vr_ms = pdu_info->sn;
|
||||
rlc_pP->vr_ms = pdu_info->sn;
|
||||
break;
|
||||
}
|
||||
}
|
||||
cursor = cursor->next;
|
||||
} while (cursor != NULL);
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-REORDERING] TIME-OUT UPDATED VR(MS) %04d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->vr_ms);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-REORDERING] TIME-OUT UPDATED VR(MS) %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->vr_ms);
|
||||
}
|
||||
|
||||
if (rlc_am_sn_gt_vr_ms(rlcP, rlcP->vr_h)) {
|
||||
rlcP->vr_x = rlcP->vr_h;
|
||||
rlcP->t_reordering.frame_time_out = frame + rlcP->t_reordering.time_out;
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-REORDERING] TIME-OUT, RESTARTED T-REORDERING, UPDATED VR(X) to VR(R) %04d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->vr_x);
|
||||
if (rlc_am_sn_gt_vr_ms(rlc_pP, rlc_pP->vr_h)) {
|
||||
rlc_pP->vr_x = rlc_pP->vr_h;
|
||||
rlc_pP->t_reordering.frame_time_out = frameP + rlc_pP->t_reordering.time_out;
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-REORDERING] TIME-OUT, RESTARTED T-REORDERING, UPDATED VR(X) to VR(R) %04d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->vr_x);
|
||||
}
|
||||
|
||||
rlcP->status_requested = 1;
|
||||
rlc_pP->status_requested = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_stop_and_reset_timer_reordering(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
void rlc_am_stop_and_reset_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-REORDERING] STOPPED AND RESET\n", frame,
|
||||
rlcP->module_id, rlcP->rb_id);
|
||||
rlcP->t_reordering.running = 0;
|
||||
rlcP->t_reordering.frame_time_out = 0;
|
||||
rlcP->t_reordering.frame_start = 0;
|
||||
rlcP->t_reordering.timed_out = 0;
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-REORDERING] STOPPED AND RESET\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_pP->t_reordering.running = 0;
|
||||
rlc_pP->t_reordering.frame_time_out = 0;
|
||||
rlc_pP->t_reordering.frame_start = 0;
|
||||
rlc_pP->t_reordering.timed_out = 0;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_start_timer_reordering(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
void rlc_am_start_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
rlcP->t_reordering.running = 1;
|
||||
rlcP->t_reordering.frame_time_out = frame + rlcP->t_reordering.time_out;
|
||||
rlcP->t_reordering.frame_start = frame;
|
||||
rlcP->t_reordering.timed_out = 0;
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-REORDERING] STARTED (TIME-OUT = FRAME %05d)\n",
|
||||
frame, rlcP->module_id, rlcP->rb_id, rlcP->t_reordering.frame_time_out);
|
||||
rlc_pP->t_reordering.running = 1;
|
||||
rlc_pP->t_reordering.frame_time_out = frameP + rlc_pP->t_reordering.time_out;
|
||||
rlc_pP->t_reordering.frame_start = frameP;
|
||||
rlc_pP->t_reordering.timed_out = 0;
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-REORDERING] STARTED (TIME-OUT = FRAME %5u)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->t_reordering.frame_time_out);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_init_timer_reordering(rlc_am_entity_t *rlcP, u32_t time_outP)
|
||||
void rlc_am_init_timer_reordering(rlc_am_entity_t *rlc_pP, u32_t time_outP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
rlcP->t_reordering.running = 0;
|
||||
rlcP->t_reordering.frame_time_out = 0;
|
||||
rlcP->t_reordering.frame_start = 0;
|
||||
rlcP->t_reordering.time_out = time_outP;
|
||||
rlcP->t_reordering.timed_out = 0;
|
||||
rlc_pP->t_reordering.running = 0;
|
||||
rlc_pP->t_reordering.frame_time_out = 0;
|
||||
rlc_pP->t_reordering.frame_start = 0;
|
||||
rlc_pP->t_reordering.time_out = time_outP;
|
||||
rlc_pP->t_reordering.timed_out = 0;
|
||||
}
|
||||
|
||||
@@ -57,32 +57,32 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/*! \fn void rlc_am_check_timer_reordering(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_check_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Check if timer reordering has timed-out, if so it is stopped and has the status "timed-out".
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frameP Frame index
|
||||
*/
|
||||
protected_rlc_am_timer_reordering(void rlc_am_check_timer_reordering(rlc_am_entity_t *rlcP,u32_t frame));
|
||||
protected_rlc_am_timer_reordering(void rlc_am_check_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP));
|
||||
|
||||
/*! \fn void rlc_am_stop_and_reset_timer_reordering(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_stop_and_reset_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Stop and reset the timer reordering.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
*/
|
||||
protected_rlc_am_timer_reordering(void rlc_am_stop_and_reset_timer_reordering(rlc_am_entity_t *rlcP,u32_t frame);)
|
||||
protected_rlc_am_timer_reordering(void rlc_am_stop_and_reset_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP);)
|
||||
|
||||
/*! \fn void rlc_am_start_timer_reordering(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_start_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Re-arm (based on RLC AM config parameter) and start timer reordering.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
*/
|
||||
protected_rlc_am_timer_reordering(void rlc_am_start_timer_reordering(rlc_am_entity_t *rlcP,u32_t frame);)
|
||||
protected_rlc_am_timer_reordering(void rlc_am_start_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP);)
|
||||
|
||||
/*! \fn void rlc_am_init_timer_reordering(rlc_am_entity_t *rlcP, u32_t time_outP)
|
||||
/*! \fn void rlc_am_init_timer_reordering(rlc_am_entity_t *rlc_pP, u32_t time_outP)
|
||||
* \brief Initialize the timer reordering with RLC AM time-out config parameter.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] time_outP Time-out in frame units.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] time_outP Time-out in frameP units.
|
||||
*/
|
||||
protected_rlc_am_timer_reordering(void rlc_am_init_timer_reordering(rlc_am_entity_t *rlcP, u32_t time_outP);)
|
||||
protected_rlc_am_timer_reordering(void rlc_am_init_timer_reordering(rlc_am_entity_t *rlc_pP, u32_t time_outP);)
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
@@ -37,82 +37,90 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
if (rlcP->t_status_prohibit.time_out > 0) {
|
||||
if (rlcP->t_status_prohibit.running) {
|
||||
if (rlc_pP->t_status_prohibit.time_out > 0) {
|
||||
if (rlc_pP->t_status_prohibit.running) {
|
||||
if (
|
||||
// CASE 1: start time out
|
||||
// +-----------+------------------+----------+
|
||||
// | |******************| |
|
||||
// +-----------+------------------+----------+
|
||||
//FRAME # 0 FRAME MAX
|
||||
((rlcP->t_status_prohibit.frame_start < rlcP->t_status_prohibit.frame_time_out) &&
|
||||
((frame >= rlcP->t_status_prohibit.frame_time_out) ||
|
||||
(frame < rlcP->t_status_prohibit.frame_start))) ||
|
||||
((rlc_pP->t_status_prohibit.frame_start < rlc_pP->t_status_prohibit.frame_time_out) &&
|
||||
((frameP >= rlc_pP->t_status_prohibit.frame_time_out) ||
|
||||
(frameP < rlc_pP->t_status_prohibit.frame_start))) ||
|
||||
// CASE 2: time out start
|
||||
// +-----------+------------------+----------+
|
||||
// |***********| |**********|
|
||||
// +-----------+------------------+----------+
|
||||
//FRAME # 0 FRAME MAX VALUE
|
||||
((rlcP->t_status_prohibit.frame_start > rlcP->t_status_prohibit.frame_time_out) &&
|
||||
(frame < rlcP->t_status_prohibit.frame_start) && (frame >= rlcP->t_status_prohibit.frame_time_out))
|
||||
((rlc_pP->t_status_prohibit.frame_start > rlc_pP->t_status_prohibit.frame_time_out) &&
|
||||
(frameP < rlc_pP->t_status_prohibit.frame_start) && (frameP >= rlc_pP->t_status_prohibit.frame_time_out))
|
||||
) {
|
||||
|
||||
//if ((rlcP->t_status_prohibit.frame_time_out <= frame) && (rlcP->t_status_prohibit.frame_start)) {
|
||||
rlcP->t_status_prohibit.running = 0;
|
||||
rlcP->t_status_prohibit.timed_out = 1;
|
||||
rlcP->stat_timer_status_prohibit_timed_out += 1;
|
||||
//if ((rlc_pP->t_status_prohibit.frame_time_out <= frameP) && (rlc_pP->t_status_prohibit.frame_start)) {
|
||||
rlc_pP->t_status_prohibit.running = 0;
|
||||
rlc_pP->t_status_prohibit.timed_out = 1;
|
||||
rlc_pP->stat_timer_status_prohibit_timed_out += 1;
|
||||
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] TIME-OUT\n", frame,
|
||||
rlcP->module_id, rlcP->rb_id);
|
||||
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RLC_AM][MOD %02d][RB %02d][--- t-StatusProhibit Timed-out --->][RLC_AM][MOD %02d][RB %02d]\n",
|
||||
frame,
|
||||
rlcP->module_id,
|
||||
rlcP->rb_id,
|
||||
rlcP->module_id,
|
||||
rlcP->rb_id);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-STATUS-PROHIBIT] TIME-OUT\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
#warning TO DO rlc_am_check_timer_status_prohibit
|
||||
rlc_am_stop_and_reset_timer_status_prohibit(rlcP, frame);
|
||||
//rlcP->t_status_prohibit.frame_time_out = frame + rlcP->t_status_prohibit.time_out;
|
||||
rlc_am_stop_and_reset_timer_status_prohibit(rlc_pP, frameP);
|
||||
//rlc_pP->t_status_prohibit.frame_time_out = frameP + rlc_pP->t_status_prohibit.time_out;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
if (rlcP->t_status_prohibit.time_out > 0) {
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] STOPPED AND RESET\n", frame,
|
||||
rlcP->module_id, rlcP->rb_id);
|
||||
rlcP->t_status_prohibit.running = 0;
|
||||
rlcP->t_status_prohibit.frame_time_out = 0;
|
||||
rlcP->t_status_prohibit.frame_start = 0;
|
||||
rlcP->t_status_prohibit.timed_out = 0;
|
||||
if (rlc_pP->t_status_prohibit.time_out > 0) {
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-STATUS-PROHIBIT] STOPPED AND RESET\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_pP->t_status_prohibit.running = 0;
|
||||
rlc_pP->t_status_prohibit.frame_time_out = 0;
|
||||
rlc_pP->t_status_prohibit.frame_start = 0;
|
||||
rlc_pP->t_status_prohibit.timed_out = 0;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
if (rlcP->t_status_prohibit.time_out > 0) {
|
||||
rlcP->t_status_prohibit.running = 1;
|
||||
rlcP->t_status_prohibit.frame_time_out = rlcP->t_status_prohibit.time_out + frame;
|
||||
rlcP->t_status_prohibit.frame_start = frame;
|
||||
rlcP->t_status_prohibit.timed_out = 0;
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] STARTED (TIME-OUT = FRAME %05d)\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->t_status_prohibit.frame_time_out);
|
||||
LOG_D(RLC, "TIME-OUT = FRAME %05d\n", rlcP->t_status_prohibit.frame_time_out);
|
||||
if (rlc_pP->t_status_prohibit.time_out > 0) {
|
||||
rlc_pP->t_status_prohibit.running = 1;
|
||||
rlc_pP->t_status_prohibit.frame_time_out = rlc_pP->t_status_prohibit.time_out + frameP;
|
||||
rlc_pP->t_status_prohibit.frame_start = frameP;
|
||||
rlc_pP->t_status_prohibit.timed_out = 0;
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-STATUS-PROHIBIT] STARTED (TIME-OUT = FRAME %5u)\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->t_status_prohibit.frame_time_out);
|
||||
LOG_D(RLC, "TIME-OUT = FRAME %5u\n", rlc_pP->t_status_prohibit.frame_time_out);
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_init_timer_status_prohibit(rlc_am_entity_t *rlcP, u32_t time_outP)
|
||||
void rlc_am_init_timer_status_prohibit(rlc_am_entity_t *rlc_pP, u32_t time_outP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
rlcP->t_status_prohibit.running = 0;
|
||||
rlcP->t_status_prohibit.frame_time_out = 0;
|
||||
rlcP->t_status_prohibit.frame_start = 0;
|
||||
rlcP->t_status_prohibit.time_out = time_outP;
|
||||
rlcP->t_status_prohibit.timed_out = 0;
|
||||
rlc_pP->t_status_prohibit.running = 0;
|
||||
rlc_pP->t_status_prohibit.frame_time_out = 0;
|
||||
rlc_pP->t_status_prohibit.frame_start = 0;
|
||||
rlc_pP->t_status_prohibit.time_out = time_outP;
|
||||
rlc_pP->t_status_prohibit.timed_out = 0;
|
||||
}
|
||||
|
||||
@@ -57,32 +57,32 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/*! \fn void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Check if timer status-prohibit has timed-out, if so it is stopped and has the status "timed-out".
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frameP Frame index
|
||||
*/
|
||||
protected_rlc_am_timer_status_prohibit(void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame));
|
||||
protected_rlc_am_timer_status_prohibit(void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP));
|
||||
|
||||
/*! \fn void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlcP)
|
||||
/*! \fn void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlc_pP)
|
||||
* \brief Stop and reset the timer status-prohibit.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frameP Frame index
|
||||
*/
|
||||
protected_rlc_am_timer_status_prohibit(void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame);)
|
||||
protected_rlc_am_timer_status_prohibit(void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP);)
|
||||
|
||||
/*! \fn void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Re-arm (based on RLC AM config parameter) and start timer status-prohibit.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] frameP Frame index
|
||||
*/
|
||||
protected_rlc_am_timer_status_prohibit(void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame);)
|
||||
protected_rlc_am_timer_status_prohibit(void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP);)
|
||||
|
||||
/*! \fn void rlc_am_init_timer_status_prohibit(rlc_am_entity_t *rlcP, u32_t time_outP)
|
||||
/*! \fn void rlc_am_init_timer_status_prohibit(rlc_am_entity_t *rlc_pP, u32_t time_outP)
|
||||
* \brief Initialize the timer status-prohibit with RLC AM time-out config parameter.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] time_outP Time-out in frame units.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] time_outP Time-out in frameP units.
|
||||
*/
|
||||
protected_rlc_am_timer_status_prohibit(void rlc_am_init_timer_status_prohibit(rlc_am_entity_t *rlcP, u32_t time_outP);)
|
||||
protected_rlc_am_timer_status_prohibit(void rlc_am_init_timer_status_prohibit(rlc_am_entity_t *rlc_pP, u32_t time_outP);)
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
@@ -39,17 +39,17 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#include "rlc_am.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
signed int rlc_am_in_tx_window(rlc_am_entity_t* rlcP, u16_t snP)
|
||||
signed int rlc_am_in_tx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
u16_t shifted_sn;
|
||||
u16_t upper_bound;
|
||||
rlc_usn_t shifted_sn;
|
||||
rlc_usn_t upper_bound;
|
||||
|
||||
if (snP >= RLC_AM_SN_MODULO) {
|
||||
return 0;
|
||||
}
|
||||
shifted_sn = ((u16_t)(snP - rlcP->vt_a)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((u16_t)(rlcP->vt_ms - rlcP->vt_a)) % RLC_AM_SN_MODULO;
|
||||
shifted_sn = ((rlc_usn_t)(snP - rlc_pP->vt_a)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((rlc_usn_t)(rlc_pP->vt_ms - rlc_pP->vt_a)) % RLC_AM_SN_MODULO;
|
||||
if ((shifted_sn >= 0) && (shifted_sn < upper_bound)) {
|
||||
return 1;
|
||||
} else {
|
||||
@@ -57,17 +57,17 @@ signed int rlc_am_in_tx_window(rlc_am_entity_t* rlcP, u16_t snP)
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
signed int rlc_am_in_rx_window(rlc_am_entity_t* rlcP, u16_t snP)
|
||||
signed int rlc_am_in_rx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
u16_t shifted_sn;
|
||||
u16_t upper_bound;
|
||||
rlc_usn_t shifted_sn;
|
||||
rlc_usn_t upper_bound;
|
||||
|
||||
if (snP >= RLC_AM_SN_MODULO) {
|
||||
return 0;
|
||||
}
|
||||
shifted_sn = ((u16_t)(snP - rlcP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((u16_t)(rlcP->vr_mr - rlcP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
shifted_sn = ((rlc_usn_t)(snP - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((rlc_usn_t)(rlc_pP->vr_mr - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
if ((shifted_sn >= 0) && (shifted_sn < upper_bound)) {
|
||||
return 1;
|
||||
} else {
|
||||
@@ -75,17 +75,17 @@ signed int rlc_am_in_rx_window(rlc_am_entity_t* rlcP, u16_t snP)
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
signed int rlc_am_sn_gte_vr_h(rlc_am_entity_t* rlcP, u16_t snP)
|
||||
signed int rlc_am_sn_gte_vr_h(rlc_am_entity_t* rlc_pP, rlc_sn_t snP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
u16_t shifted_sn;
|
||||
u16_t upper_bound;
|
||||
rlc_usn_t shifted_sn;
|
||||
rlc_usn_t upper_bound;
|
||||
|
||||
if (snP >= RLC_AM_SN_MODULO) {
|
||||
return 0;
|
||||
}
|
||||
shifted_sn = ((u16_t)(snP - rlcP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((u16_t)(rlcP->vr_h - rlcP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
shifted_sn = ((rlc_usn_t)(snP - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((rlc_usn_t)(rlc_pP->vr_h - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
if (shifted_sn >= upper_bound) {
|
||||
return 1;
|
||||
} else {
|
||||
@@ -93,17 +93,17 @@ signed int rlc_am_sn_gte_vr_h(rlc_am_entity_t* rlcP, u16_t snP)
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
signed int rlc_am_sn_gte_vr_x(rlc_am_entity_t* rlcP, u16_t snP)
|
||||
signed int rlc_am_sn_gte_vr_x(rlc_am_entity_t* rlc_pP, rlc_sn_t snP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
u16_t shifted_sn;
|
||||
u16_t upper_bound;
|
||||
rlc_usn_t shifted_sn;
|
||||
rlc_usn_t upper_bound;
|
||||
|
||||
if (snP >= RLC_AM_SN_MODULO) {
|
||||
return 0;
|
||||
}
|
||||
shifted_sn = ((u16_t)(snP - rlcP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((u16_t)(rlcP->vr_x - rlcP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
shifted_sn = ((rlc_usn_t)(snP - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((rlc_usn_t)(rlc_pP->vr_x - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
if (shifted_sn >= upper_bound) {
|
||||
return 1;
|
||||
} else {
|
||||
@@ -111,17 +111,17 @@ signed int rlc_am_sn_gte_vr_x(rlc_am_entity_t* rlcP, u16_t snP)
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
signed int rlc_am_sn_gt_vr_ms(rlc_am_entity_t* rlcP, u16_t snP)
|
||||
signed int rlc_am_sn_gt_vr_ms(rlc_am_entity_t* rlc_pP, rlc_sn_t snP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
u16_t shifted_sn;
|
||||
u16_t upper_bound;
|
||||
rlc_usn_t shifted_sn;
|
||||
rlc_usn_t upper_bound;
|
||||
|
||||
if (snP >= RLC_AM_SN_MODULO) {
|
||||
return 0;
|
||||
}
|
||||
shifted_sn = ((u16_t)(snP - rlcP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((u16_t)(rlcP->vr_ms - rlcP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
shifted_sn = ((rlc_usn_t)(snP - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((rlc_usn_t)(rlc_pP->vr_ms - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
if (shifted_sn > upper_bound) {
|
||||
return 1;
|
||||
} else {
|
||||
@@ -129,17 +129,17 @@ signed int rlc_am_sn_gt_vr_ms(rlc_am_entity_t* rlcP, u16_t snP)
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
signed int rlc_am_tx_sn1_gt_sn2(rlc_am_entity_t* rlcP, u16_t sn1P, u16_t sn2P)
|
||||
signed int rlc_am_tx_sn1_gt_sn2(rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t sn2P)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
u16_t shifted_sn;
|
||||
u16_t upper_bound;
|
||||
rlc_usn_t shifted_sn;
|
||||
rlc_usn_t upper_bound;
|
||||
|
||||
if ((sn1P >= RLC_AM_SN_MODULO) || (sn2P >= RLC_AM_SN_MODULO)) {
|
||||
return 0;
|
||||
}
|
||||
shifted_sn = ((u16_t)(sn1P - rlcP->vt_a)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((u16_t)(sn2P - rlcP->vt_a)) % RLC_AM_SN_MODULO;
|
||||
shifted_sn = ((rlc_usn_t)(sn1P - rlc_pP->vt_a)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((rlc_usn_t)(sn2P - rlc_pP->vt_a)) % RLC_AM_SN_MODULO;
|
||||
if (shifted_sn > upper_bound) {
|
||||
return 1;
|
||||
} else {
|
||||
@@ -147,17 +147,17 @@ signed int rlc_am_tx_sn1_gt_sn2(rlc_am_entity_t* rlcP, u16_t sn1P, u16_t sn2P)
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
signed int rlc_am_rx_sn1_gt_sn2(rlc_am_entity_t* rlcP, u16_t sn1P, u16_t sn2P)
|
||||
signed int rlc_am_rx_sn1_gt_sn2(rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t sn2P)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
u16_t shifted_sn;
|
||||
u16_t upper_bound;
|
||||
rlc_usn_t shifted_sn;
|
||||
rlc_usn_t upper_bound;
|
||||
|
||||
if ((sn1P >= RLC_AM_SN_MODULO) || (sn2P >= RLC_AM_SN_MODULO)) {
|
||||
return 0;
|
||||
}
|
||||
shifted_sn = ((u16_t)(sn1P - rlcP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((u16_t)(sn2P - rlcP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
shifted_sn = ((rlc_usn_t)(sn1P - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
upper_bound = ((rlc_usn_t)(sn2P - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
|
||||
if (shifted_sn > upper_bound) {
|
||||
return 1;
|
||||
} else {
|
||||
|
||||
@@ -58,62 +58,62 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/*! \fn signed int rlc_am_in_tx_window(rlc_am_entity_t* rlcP, u16_t snP)
|
||||
/*! \fn signed int rlc_am_in_tx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP)
|
||||
* \brief Boolean function, check if sequence number is VT(A) <= snP < VT(MS).
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] snP Sequence number.
|
||||
* \return 1 if snP in tx window, else 0.
|
||||
*/
|
||||
protected_rlc_am_windows(signed int rlc_am_in_tx_window(rlc_am_entity_t* rlcP, u16_t snP);)
|
||||
protected_rlc_am_windows(signed int rlc_am_in_tx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP);)
|
||||
|
||||
/*! \fn signed int rlc_am_in_rx_window(rlc_am_entity_t* rlcP, u16_t snP)
|
||||
/*! \fn signed int rlc_am_in_rx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP)
|
||||
* \brief Boolean function, check if sequence number is VR(R) <= snP < VR(MR).
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] snP Sequence number.
|
||||
* \return 1 if snP in rx window, else 0.
|
||||
*/
|
||||
protected_rlc_am_windows(signed int rlc_am_in_rx_window(rlc_am_entity_t* rlcP, u16_t snP);)
|
||||
protected_rlc_am_windows(signed int rlc_am_in_rx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP);)
|
||||
|
||||
/*! \fn signed int rlc_am_sn_gte_vr_h (rlc_am_entity_t* rlcP, u16_t snP)
|
||||
/*! \fn signed int rlc_am_sn_gte_vr_h (rlc_am_entity_t* rlc_pP, rlc_sn_t snP)
|
||||
* \brief Boolean function, check if sequence number is greater than or equal VR(R).
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] snP Sequence number.
|
||||
* \return 1 if sequence number is greater than or equal VR(R), else 0.
|
||||
*/
|
||||
protected_rlc_am_windows(signed int rlc_am_sn_gte_vr_h (rlc_am_entity_t* rlcP, u16_t snP);)
|
||||
protected_rlc_am_windows(signed int rlc_am_sn_gte_vr_h (rlc_am_entity_t* rlc_pP, rlc_sn_t snP);)
|
||||
|
||||
/*! \fn signed int rlc_am_sn_gte_vr_x (rlc_am_entity_t* rlcP, u16_t snP)
|
||||
/*! \fn signed int rlc_am_sn_gte_vr_x (rlc_am_entity_t* rlc_pP, rlc_sn_t snP)
|
||||
* \brief Boolean function, check if sequence number is greater than or equal VR(X).
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] snP Sequence number.
|
||||
* \return 1 if sequence number is greater than or equal VR(X), else 0.
|
||||
*/
|
||||
protected_rlc_am_windows(signed int rlc_am_sn_gte_vr_x (rlc_am_entity_t* rlcP, u16_t snP);)
|
||||
protected_rlc_am_windows(signed int rlc_am_sn_gte_vr_x (rlc_am_entity_t* rlc_pP, rlc_sn_t snP);)
|
||||
|
||||
/*! \fn signed int rlc_am_sn_gt_vr_ms (rlc_am_entity_t* rlcP, u16_t snP)
|
||||
/*! \fn signed int rlc_am_sn_gt_vr_ms (rlc_am_entity_t* rlc_pP, rlc_sn_t snP)
|
||||
* \brief Boolean function, check if sequence number is greater than VR(MS).
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] snP Sequence number.
|
||||
* \return 1 if sequence number is greater than VR(MS), else 0.
|
||||
*/
|
||||
protected_rlc_am_windows(signed int rlc_am_sn_gt_vr_ms(rlc_am_entity_t* rlcP, u16_t snP);)
|
||||
protected_rlc_am_windows(signed int rlc_am_sn_gt_vr_ms(rlc_am_entity_t* rlc_pP, rlc_sn_t snP);)
|
||||
|
||||
/*! \fn signed int rlc_am_tx_sn1_gt_sn2 (rlc_am_entity_t* rlcP, u16_t sn1P, u16_t sn2P)
|
||||
/*! \fn signed int rlc_am_tx_sn1_gt_sn2 (rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t sn2P)
|
||||
* \brief Boolean function, in the context of the tx window, check if sn1P is greater than sn2P.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] sn1P Sequence number.
|
||||
* \param[in] sn2P Sequence number.
|
||||
* \return 1 if sn1P is greater than sn2P, else 0.
|
||||
*/
|
||||
protected_rlc_am_windows(signed int rlc_am_tx_sn1_gt_sn2(rlc_am_entity_t* rlcP, u16_t sn1P, u16_t sn2P);)
|
||||
protected_rlc_am_windows(signed int rlc_am_tx_sn1_gt_sn2(rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t sn2P);)
|
||||
|
||||
/*! \fn signed int rlc_am_rx_sn1_gt_sn2(rlc_am_entity_t* rlcP, u16_t sn1P, u16_t sn2P)
|
||||
/*! \fn signed int rlc_am_rx_sn1_gt_sn2(rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t sn2P)
|
||||
* \brief Boolean function, in the context of the rx window, check if sn1P is greater than sn2P.
|
||||
* \param[in] rlcP RLC AM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC AM protocol instance pointer.
|
||||
* \param[in] sn1P Sequence number.
|
||||
* \param[in] sn2P Sequence number.
|
||||
* \return 1 if sn1P is greater than sn2P, else 0.
|
||||
*/
|
||||
protected_rlc_am_windows(signed int rlc_am_rx_sn1_gt_sn2(rlc_am_entity_t* rlcP, u16_t sn1P, u16_t sn2P);)
|
||||
protected_rlc_am_windows(signed int rlc_am_rx_sn1_gt_sn2(rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t sn2P);)
|
||||
/** @} */
|
||||
# endif
|
||||
|
||||
@@ -54,16 +54,6 @@ rlc_tm_send_sdu (rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flag, u8_t error_i
|
||||
rlcP->output_sdu_in_construction = get_free_mem_block (length_in_bytes);
|
||||
}
|
||||
if ((rlcP->output_sdu_in_construction)) {
|
||||
u8_t eNB_id;
|
||||
u8_t UE_id;
|
||||
if (eNB_flag == 0) {
|
||||
/* FIXME: force send on first eNB */
|
||||
eNB_id = 0;
|
||||
UE_id = rlcP->module_id - NB_eNB_INST;
|
||||
} else {
|
||||
UE_id = rlcP->rb_id / NB_RB_MAX;
|
||||
eNB_id = rlcP->module_id;
|
||||
}
|
||||
#ifdef DEBUG_RLC_TM_DISPLAY_ASCII_DATA
|
||||
msg ("[RLC_TM %p][SEND_SDU] DATA :", rlcP);
|
||||
for (index = 0; index < length_in_bytes; index++) {
|
||||
@@ -74,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);
|
||||
|
||||
rlc_data_ind (rlcP->module_id, eNB_id, UE_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, RLC_MBMS_NO, rlcP->rb_id, length_in_bytes, rlcP->output_sdu_in_construction, rlcP->is_data_plane);
|
||||
rlcP->output_sdu_in_construction = NULL;
|
||||
} else {
|
||||
msg ("[RLC_TM %p][SEND_SDU] ERROR OUTPUT SDU IS NULL\n", rlcP);
|
||||
@@ -174,26 +164,13 @@ rlc_tm_mac_data_request (void *rlcP, u32_t frame)
|
||||
data_req.buffer_occupancy_in_pdus = data_req.buffer_occupancy_in_bytes / l_rlc->rlc_pdu_size;
|
||||
data_req.rlc_info.rlc_protocol_state = l_rlc->protocol_state;
|
||||
if (data_req.data.nb_elements > 0) {
|
||||
LOG_D(RLC, "[RLC_TM][MOD %d][RB %d][FRAME %05d] MAC_DATA_REQUEST %d TBs\n", l_rlc->module_id, l_rlc->rb_id, frame, data_req.data.nb_elements);
|
||||
mem_block_t *tb;
|
||||
rlc[l_rlc->module_id].m_mscgen_trace_length = sprintf(rlc[l_rlc->module_id].m_mscgen_trace, "[MSC_MSG][FRAME %05d][RLC_UM][MOD %02d][RB %02d][--- MAC_DATA_REQ/ %d TB(s) ",
|
||||
frame,
|
||||
l_rlc->module_id,
|
||||
l_rlc->rb_id,
|
||||
data_req.data.nb_elements);
|
||||
|
||||
tb = data_req.data.head;
|
||||
while (tb != NULL) {
|
||||
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], "%d Bytes ",
|
||||
((struct mac_tb_req *) (tb->data))->tb_size);
|
||||
tb = tb->next;
|
||||
}
|
||||
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], "BO=%d --->][MAC_%s][MOD %02d][]\n",
|
||||
data_req.buffer_occupancy_in_bytes,
|
||||
(l_rlc->is_enb) ? "eNB":"UE",
|
||||
l_rlc->module_id);
|
||||
rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length] = 0;
|
||||
LOG_D(RLC, "%s", rlc[l_rlc->module_id].m_mscgen_trace);
|
||||
LOG_D(RLC, "[RLC_TM][%s][MOD %02u/%02u][RB %d][FRAME %05d] MAC_DATA_REQUEST %d TBs\n",
|
||||
(l_rlc->is_enb) ? "eNB" : "UE",
|
||||
l_rlc->enb_module_id,
|
||||
l_rlc->ue_module_id,
|
||||
l_rlc->rb_id,
|
||||
frame,
|
||||
data_req.data.nb_elements);
|
||||
}
|
||||
|
||||
return data_req;
|
||||
@@ -208,25 +185,13 @@ rlc_tm_mac_data_indication (void *rlcP, u32_t frame, u8_t eNB_flag, struct mac_d
|
||||
mem_block_t *tb;
|
||||
|
||||
if (data_indP.data.nb_elements > 0) {
|
||||
LOG_D(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n", l_rlc->module_id, l_rlc->rb_id, frame, data_indP.data.nb_elements);
|
||||
rlc[l_rlc->module_id].m_mscgen_trace_length = sprintf(rlc[l_rlc->module_id].m_mscgen_trace, "[MSC_MSG][FRAME %05d][MAC_%s][MOD %02d][][--- MAC_DATA_IND/ %d TB(s) ",
|
||||
LOG_D(RLC, "[RLC_TM][%s][MOD %02u/%02u][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n",
|
||||
(l_rlc->is_enb) ? "eNB" : "UE",
|
||||
l_rlc->enb_module_id,
|
||||
l_rlc->ue_module_id,
|
||||
l_rlc->rb_id,
|
||||
frame,
|
||||
(l_rlc->is_enb) ? "eNB":"UE",
|
||||
l_rlc->module_id,
|
||||
data_indP.data.nb_elements);
|
||||
|
||||
tb = data_indP.data.head;
|
||||
while (tb != NULL) {
|
||||
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], "%d Bytes ",
|
||||
((struct mac_tb_ind *) (tb->data))->size);
|
||||
tb = tb->next;
|
||||
}
|
||||
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], " --->][RLC_TM][MOD %02d][RB %02d]\n",
|
||||
l_rlc->module_id,
|
||||
l_rlc->rb_id);
|
||||
|
||||
rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length] = 0;
|
||||
LOG_D(RLC, "%s", rlc[l_rlc->module_id].m_mscgen_trace);
|
||||
}
|
||||
rlc_tm_rx (rlcP, frame, eNB_flag, data_indP);
|
||||
}
|
||||
@@ -239,7 +204,15 @@ rlc_tm_data_req (void *rlcP, mem_block_t *sduP)
|
||||
rlc_tm_entity_t *rlc = (rlc_tm_entity_t *) rlcP;
|
||||
|
||||
#ifdef DEBUG_RLC_TM_DATA_REQUEST
|
||||
msg ("[RLC_TM %p] RLC_TM_DATA_REQ size %d Bytes, BO %ld , NB SDU %d current_sdu_index=%d next_sdu_index=%d\n", rlc, ((struct rlc_um_data_req *) (sduP->data))->data_size, rlc->buffer_occupancy, rlc->nb_sdu, rlc->current_sdu_index, rlc->next_sdu_index);
|
||||
LOG_D (RLC, "[RLC_TM][%s][MOD %02u/%02u] RLC_TM_DATA_REQ size %d Bytes, BO %ld , NB SDU %d current_sdu_index=%d next_sdu_index=%d\n",
|
||||
(l_rlc->is_enb) ? "eNB" : "UE",
|
||||
l_rlc->enb_module_id,
|
||||
l_rlc->ue_module_id,
|
||||
((struct rlc_um_data_req *) (sduP->data))->data_size,
|
||||
rlc->buffer_occupancy,
|
||||
rlc->nb_sdu,
|
||||
rlc->current_sdu_index,
|
||||
rlc->next_sdu_index);
|
||||
#endif
|
||||
|
||||
// not in 3GPP specification but the buffer may be full if not correctly configured
|
||||
|
||||
@@ -47,13 +47,15 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
* \brief Structure containing a RLC TM instance protocol variables, allocation variables, buffers and other miscellaneous variables.
|
||||
*/
|
||||
typedef struct rlc_tm_entity {
|
||||
module_id_t module_id; /*!< \brief Virtualization index for this protocol instance, means handset or eNB index.*/
|
||||
module_id_t enb_module_id; /*!< \brief eNB Virtualization index for this protocol instance, meaningful if is_enb is set. */
|
||||
module_id_t ue_module_id; /*!< \brief UE Virtualization index for this protocol instance. */
|
||||
u8_t allocation; /*!< \brief Boolean for rlc_tm_entity_t struct allocation. */
|
||||
u8_t protocol_state; /*!< \brief Protocol state, can be RLC_NULL_STATE, RLC_DATA_TRANSFER_READY_STATE, RLC_LOCAL_SUSPEND_STATE. */
|
||||
u8_t is_uplink_downlink; /*!< \brief Is this instance is a transmitter, a receiver or both? */
|
||||
u16_t is_data_plane; /*!< \brief To know if the RLC belongs to a data radio bearer or a signalling radio bearer, for statistics and trace purpose. */
|
||||
boolean_t is_uplink_downlink; /*!< \brief Is this instance is a transmitter, a receiver or both? */
|
||||
boolean_t is_data_plane; /*!< \brief To know if the RLC belongs to a data radio bearer or a signalling radio bearer, for statistics and trace purpose. */
|
||||
// for stats and trace purpose :
|
||||
u16_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */
|
||||
logical_chan_id_t channel_id; /*!< \brief Transport channel identifier. */
|
||||
rb_id_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */
|
||||
boolean_t is_enb; /*!< \brief To know if the RLC belongs to a eNB or UE. */
|
||||
//-----------------------------
|
||||
// tranmission
|
||||
@@ -66,7 +68,7 @@ typedef struct rlc_tm_entity {
|
||||
u16_t next_sdu_index; /*!< \brief Next SDU index for a new incomin SDU in input_sdus[]. */
|
||||
u16_t current_sdu_index; /*!< \brief Current SDU index in input_sdus array to be segmented. */
|
||||
list_t pdus_to_mac_layer; /*!< \brief PDUs buffered for transmission to MAC layer. */
|
||||
u16_t rlc_pdu_size;
|
||||
sdu_size_t rlc_pdu_size;
|
||||
u32_t buffer_occupancy; /*!< \brief Number of bytes contained in input_sdus buffer.*/
|
||||
//-----------------------------
|
||||
// receiver
|
||||
|
||||
@@ -32,13 +32,30 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#include "rlc_tm.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
void config_req_rlc_tm (rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rlc_tm_info_t * config_tmP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
void config_req_rlc_tm ( u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_tm_info_t * config_tmP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
rlc_tm_init(rlcP);
|
||||
rlcP->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
|
||||
rlc_tm_set_debug_infos(rlcP, frame, eNB_flagP, module_idP, rb_idP, rb_typeP);
|
||||
rlc_tm_configure(rlcP, config_tmP->is_uplink_downlink);
|
||||
rlc_tm_entity_t *rlc = NULL;
|
||||
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ (is_uplink_downlink=%d) --->][RLC_TM][MOD %u/%u][RB %u]\n",
|
||||
frame,
|
||||
( eNB_flagP > 0) ? "eNB":"UE",
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
config_tmP->is_uplink_downlink,
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
rb_idP);
|
||||
|
||||
if (eNB_flagP) {
|
||||
rlc = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.tm;
|
||||
} else {
|
||||
rlc = &rlc_array_ue[ue_module_idP][rb_idP].rlc.tm;
|
||||
}
|
||||
rlc_tm_init(rlc);
|
||||
rlc->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
|
||||
rlc_tm_set_debug_infos(rlc, frame, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP);
|
||||
rlc_tm_configure(rlc, config_tmP->is_uplink_downlink);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -101,6 +118,7 @@ rlc_tm_cleanup (rlc_tm_entity_t *rlcP)
|
||||
if ((rlcP->output_sdu_in_construction)) {
|
||||
free_mem_block (rlcP->output_sdu_in_construction);
|
||||
}
|
||||
memset(rlcP, 0, sizeof(rlc_tm_entity_t));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -112,12 +130,22 @@ void rlc_tm_configure(rlc_tm_entity_t *rlcP, u8_t is_uplink_downlinkP)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_tm_set_debug_infos(rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
void rlc_tm_set_debug_infos(rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
msg ("[FRAME %05d][RLC_TM][MOD %02d][RB %02d][SET DEBUG INFOS] module_id %d rb_id %d rb_type %d\n", frame, module_idP, rb_idP, module_idP, rb_idP, rb_typeP);
|
||||
msg ("[FRAME %05d][%s][RLC_TM][MOD %02u/%02u][RB %u][SET DEBUG INFOS] enb module_id %d ue module_id %d rb_id %d rb_type %d\n",
|
||||
frame,
|
||||
(eNB_flagP) ? "eNB" : "UE",
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
rb_idP,
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
rb_idP,
|
||||
rb_typeP);
|
||||
|
||||
rlcP->module_id = module_idP;
|
||||
rlcP->enb_module_id = enb_module_idP;
|
||||
rlcP->ue_module_id = ue_module_idP;
|
||||
rlcP->rb_id = rb_idP;
|
||||
if (rb_typeP != SIGNALLING_RADIO_BEARER) {
|
||||
rlcP->is_data_plane = 1;
|
||||
|
||||
@@ -70,17 +70,17 @@ typedef volatile struct {
|
||||
} rlc_tm_info_t;
|
||||
|
||||
|
||||
/*! \fn void config_req_rlc_tm (rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rlc_tm_info_t * config_tmP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
/*! \fn void config_req_rlc_tm (u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_tm_info_t * config_tmP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
* \brief Allocate memory for RLC TM instance, reset protocol variables, and set protocol parameters.
|
||||
* \param[in] rlcP RLC TM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] enb_module_idP eNB Virtualized module identifier.
|
||||
* \param[in] ue_module_idP UE Virtualized module identifier.
|
||||
* \param[in] config_tmP Configuration parameters for RLC TM instance.
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
|
||||
*/
|
||||
public_rlc_tm_init( void config_req_rlc_tm (rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rlc_tm_info_t * config_tmP, rb_id_t rb_idP, rb_type_t rb_typeP);)
|
||||
public_rlc_tm_init( void config_req_rlc_tm (u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_tm_info_t * config_tmP, rb_id_t rb_idP, rb_type_t rb_typeP);)
|
||||
|
||||
/*! \fn void rlc_tm_init (rlc_tm_entity_t *rlcP)
|
||||
* \brief Initialize a RLC TM 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 TM protocol instance will be in RLC_NULL_STATE state.
|
||||
@@ -108,15 +108,16 @@ RECEIVER_ONLY, or TRANSMITTER_AND_RECEIVER.
|
||||
*/
|
||||
protected_rlc_tm_init(void rlc_tm_configure(rlc_tm_entity_t *rlcP, u8_t is_uplink_downlinkP);)
|
||||
|
||||
/*! \fn void rlc_tm_set_debug_infos(rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
/*! \fn void rlc_tm_set_debug_infos(rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
* \brief Set debug informations for a RLC TM protocol instance, these informations are only for trace purpose.
|
||||
* \param[in] rlcP RLC TM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] enb_module_idP eNB Virtualized module identifier.
|
||||
* \param[in] ue_module_idP UE Virtualized module identifier.
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
|
||||
*/
|
||||
protected_rlc_tm_init(void rlc_tm_set_debug_infos(rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rb_id_t rb_idP, rb_type_t rb_typeP);)
|
||||
protected_rlc_tm_init(void rlc_tm_set_debug_infos(rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP);)
|
||||
/** @} */
|
||||
# endif
|
||||
|
||||
@@ -43,72 +43,75 @@
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------
|
||||
inline void
|
||||
rlc_um_receive_15_process_waited_pdu (struct rlc_um_entity *rlcP, struct rlc_um_rx_pdu_management *pdu_mngt, struct rlc_um_rx_data_pdu_struct *dataP, u16_t tb_sizeP)
|
||||
rlc_um_receive_15_process_waited_pdu (struct rlc_um_entity *rlc_pP,
|
||||
struct rlc_um_rx_pdu_management *pdu_mngt_pP,
|
||||
struct rlc_um_rx_data_pdu_struct *data_pP,
|
||||
sdu_size_t tb_sizeP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
u8_t *data_pdu;
|
||||
int nb_li = 0;
|
||||
int li_index = 0;
|
||||
int remaining_data_size;
|
||||
u16_t li[32];
|
||||
u8_t *data_pdu_p = NULL;
|
||||
sdu_size_t remaining_data_size = 0;
|
||||
int nb_li = 0;
|
||||
int li_index = 0;
|
||||
sdu_size_t li[32];
|
||||
|
||||
if ((dataP->byte1 & RLC_E_MASK) == (u8_t) RLC_E_NEXT_FIELD_IS_DATA) {
|
||||
rlc_um_reassembly ((u8_t *) (&dataP->li_data_7[0]), tb_sizeP - 1, rlcP);
|
||||
if ((data_pP->byte1 & RLC_E_MASK) == (u8_t) RLC_E_NEXT_FIELD_IS_DATA) {
|
||||
rlc_um_reassembly ((u8_t *) (&data_pP->li_data_7[0]), tb_sizeP - 1, rlc_pP, 0);
|
||||
} else {
|
||||
while ((li[nb_li] = ((((u16_t) dataP->li_data_7[nb_li << 1]) << 8) + dataP->li_data_7[(nb_li << 1) + 1])) & RLC_E_NEXT_FIELD_IS_LI_E) {
|
||||
while ((li[nb_li] = ((((u16_t) data_pP->li_data_7[nb_li << 1]) << 8) + data_pP->li_data_7[(nb_li << 1) + 1])) & RLC_E_NEXT_FIELD_IS_LI_E) {
|
||||
li[nb_li] = li[nb_li] & (~(u16_t) RLC_E_NEXT_FIELD_IS_LI_E);
|
||||
nb_li++;
|
||||
}
|
||||
nb_li++; // count the last li
|
||||
|
||||
remaining_data_size = tb_sizeP - 1 - (nb_li << 1);
|
||||
data_pdu = (u8_t *) (&dataP->li_data_7[nb_li << 1]);
|
||||
data_pdu_p = (u8_t *) (&data_pP->li_data_7[nb_li << 1]);
|
||||
|
||||
while (li_index < nb_li) {
|
||||
switch (li[li_index]) {
|
||||
case RLC_LI_LAST_PDU_EXACTLY_FILLED:
|
||||
rlc_um_send_sdu (rlcP);
|
||||
rlc_um_send_sdu (rlc_pP);
|
||||
break;
|
||||
case RLC_LI_LAST_PDU_ONE_BYTE_SHORT:
|
||||
rlcP->output_sdu_size_to_write -= 1;
|
||||
rlc_um_send_sdu (rlcP);
|
||||
rlc_pP->output_sdu_size_to_write -= 1;
|
||||
rlc_um_send_sdu (rlc_pP);
|
||||
break;
|
||||
case RLC_LI_PDU_PIGGY_BACKED_STATUS: // ignore
|
||||
case RLC_LI_PDU_PADDING:
|
||||
remaining_data_size = 0;
|
||||
break;
|
||||
case RLC_LI_1ST_BYTE_SDU_IS_1ST_BYTE_PDU:
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
break;
|
||||
default: // li is length
|
||||
remaining_data_size = remaining_data_size - (li[li_index] >> 1);
|
||||
rlc_um_reassembly (data_pdu, (li[li_index] >> 1), rlcP);
|
||||
data_pdu = (u8_t *) ((u32_t) data_pdu + (li[li_index] >> 1));
|
||||
rlc_um_send_sdu (rlcP);
|
||||
rlc_um_reassembly (data_pdu_p, (li[li_index] >> 1), rlc_pP);
|
||||
data_pdu_p = (u8_t *) ((u64_t) data_pdu_p + (li[li_index] >> 1));
|
||||
rlc_um_send_sdu (rlc_pP);
|
||||
}
|
||||
li_index++;
|
||||
}
|
||||
if ((remaining_data_size)) {
|
||||
rlc_um_reassembly (data_pdu, remaining_data_size, rlcP);
|
||||
rlc_um_reassembly (data_pdu_p, remaining_data_size, rlc_pP);
|
||||
remaining_data_size = 0;
|
||||
}
|
||||
}
|
||||
rlcP->vr_us = (rlcP->vr_us + 1) & 127;
|
||||
rlc_pP->vr_us = (rlc_pP->vr_us + 1) & 127;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline void
|
||||
rlc_um_receive_7_process_waited_pdu (struct rlc_um_entity *rlcP, struct rlc_um_rx_pdu_management *pdu_mngtP, struct rlc_um_rx_data_pdu_struct *dataP, u16_t tb_sizeP)
|
||||
rlc_um_receive_7_process_waited_pdu (struct rlc_um_entity *rlc_pP, struct rlc_um_rx_pdu_management *pdu_mngtP, struct rlc_um_rx_data_pdu_struct *dataP, u16_t tb_sizeP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
u8_t *data_pdu;
|
||||
int remaining_data_size;
|
||||
int nb_li = 0;
|
||||
int li_index = 0;
|
||||
u16_t li[32];
|
||||
u8_t *data_pdu_p = NULL;
|
||||
sdu_size_t remaining_data_size = 0;
|
||||
int nb_li = 0;
|
||||
int li_index = 0;
|
||||
sdu_size_t li[32];
|
||||
|
||||
if ((dataP->byte1 & RLC_E_MASK) == (u8_t) RLC_E_NEXT_FIELD_IS_DATA) {
|
||||
rlc_um_reassembly ((u8_t *) (&dataP->li_data_7[0]), tb_sizeP - 1, rlcP);
|
||||
rlc_um_reassembly ((u8_t *) (&dataP->li_data_7[0]), tb_sizeP - 1, rlc_pP, 0);
|
||||
} else {
|
||||
while ((li[nb_li] = ((u16_t) dataP->li_data_7[nb_li])) & RLC_E_NEXT_FIELD_IS_LI_E) {
|
||||
li[nb_li] = li[nb_li] & (~(u8_t) RLC_E_NEXT_FIELD_IS_LI_E);
|
||||
@@ -117,74 +120,77 @@ rlc_um_receive_7_process_waited_pdu (struct rlc_um_entity *rlcP, struct rlc_um_r
|
||||
nb_li++; // count the last li
|
||||
|
||||
remaining_data_size = tb_sizeP - 1 - nb_li;
|
||||
data_pdu = (u8_t *) (&dataP->li_data_7[nb_li]);
|
||||
data_pdu_p = (u8_t *) (&dataP->li_data_7[nb_li]);
|
||||
|
||||
while (li_index < nb_li) {
|
||||
switch (li[li_index]) {
|
||||
case (u8_t) RLC_LI_LAST_PDU_EXACTLY_FILLED:
|
||||
PRINT_RLC_UM_RX_DECODE_LI ("[RLC_UM %p] RX_7 PDU %p Li RLC_LI_LAST_PDU_EXACTLY_FILLED\n", rlcP, pdu_mngtP);
|
||||
rlc_um_send_sdu (rlcP);
|
||||
PRINT_RLC_UM_RX_DECODE_LI ("[RLC_UM %p] RX_7 PDU %p Li RLC_LI_LAST_PDU_EXACTLY_FILLED\n", rlc_pP, pdu_mngtP);
|
||||
rlc_um_send_sdu (rlc_pP);
|
||||
break;
|
||||
|
||||
case (u8_t) RLC_LI_LAST_PDU_ONE_BYTE_SHORT:
|
||||
PRINT_RLC_UM_RX_DECODE_LI ("[RLC_UM %p] RX_7 PDU %p Li RLC_LI_LAST_PDU_ONE_BYTE_SHORT\n", rlcP, pdu_mngtP);
|
||||
rlcP->output_sdu_size_to_write -= 1;
|
||||
rlc_um_send_sdu (rlcP);
|
||||
PRINT_RLC_UM_RX_DECODE_LI ("[RLC_UM %p] RX_7 PDU %p Li RLC_LI_LAST_PDU_ONE_BYTE_SHORT\n", rlc_pP, pdu_mngtP);
|
||||
rlc_pP->output_sdu_size_to_write -= 1;
|
||||
rlc_um_send_sdu (rlc_pP);
|
||||
break;
|
||||
|
||||
case (u8_t) RLC_LI_PDU_PIGGY_BACKED_STATUS: // ignore
|
||||
case (u8_t) RLC_LI_PDU_PADDING:
|
||||
PRINT_RLC_UM_RX_DECODE_LI ("[RLC_UM %p] RX_7 PDU %p Li RLC_LI_PDU_PADDING\n", rlcP, pdu_mngtP);
|
||||
PRINT_RLC_UM_RX_DECODE_LI ("[RLC_UM %p] RX_7 PDU %p Li RLC_LI_PDU_PADDING\n", rlc_pP, pdu_mngtP);
|
||||
remaining_data_size = 0;
|
||||
break;
|
||||
|
||||
case (u8_t) RLC_LI_1ST_BYTE_SDU_IS_1ST_BYTE_PDU:
|
||||
PRINT_RLC_UM_RX_DECODE_LI ("[RLC_UM %p] RX_7 PDU %p Li RLC_LI_1ST_BYTE_SDU_IS_1ST_BYTE_PDU\n", rlcP, pdu_mngtP);
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
PRINT_RLC_UM_RX_DECODE_LI ("[RLC_UM %p] RX_7 PDU %p Li RLC_LI_1ST_BYTE_SDU_IS_1ST_BYTE_PDU\n", rlc_pP, pdu_mngtP);
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
break;
|
||||
|
||||
default: // li is length
|
||||
PRINT_RLC_UM_RX_DECODE_LI ("[RLC_UM %p] RX_7 PDU %p Li LI_SIZE %d Bytes\n", rlcP, pdu_mngtP, li[li_index] >> 1);
|
||||
PRINT_RLC_UM_RX_DECODE_LI ("[RLC_UM %p] RX_7 PDU %p Li LI_SIZE %d Bytes\n", rlc_pP, pdu_mngtP, li[li_index] >> 1);
|
||||
remaining_data_size = remaining_data_size - (li[li_index] >> 1);
|
||||
rlc_um_reassembly (data_pdu, (li[li_index] >> 1), rlcP);
|
||||
data_pdu = (u8_t *) ((u32_t) data_pdu + (li[li_index] >> 1));
|
||||
rlc_um_send_sdu (rlcP);
|
||||
rlc_um_reassembly (data_pdu_p, (li[li_index] >> 1), rlc_pP);
|
||||
data_pdu_p = (u8_t *) ((u64_t) data_pdu_p + (li[li_index] >> 1));
|
||||
rlc_um_send_sdu (rlc_pP);
|
||||
}
|
||||
li_index++;
|
||||
}
|
||||
if ((remaining_data_size)) {
|
||||
rlc_um_reassembly (data_pdu, remaining_data_size, rlcP);
|
||||
rlc_um_reassembly (data_pdu_p, remaining_data_size, rlc_pP);
|
||||
remaining_data_size = 0;
|
||||
}
|
||||
}
|
||||
rlcP->vr_us = (rlcP->vr_us + 1) & 127;
|
||||
rlc_pP->vr_us = (rlc_pP->vr_us + 1) & 127;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline void
|
||||
rlc_um_receive_15_process_unsynchronized_pdu (struct rlc_um_entity *rlcP, struct rlc_um_rx_pdu_management *pdu_mngt, struct rlc_um_rx_data_pdu_struct *dataP, u16_t tb_sizeP)
|
||||
rlc_um_receive_15_process_unsynchronized_pdu (struct rlc_um_entity *rlc_pP,
|
||||
struct rlc_um_rx_pdu_management *pdu_mngt_pP,
|
||||
struct rlc_um_rx_data_pdu_struct *data_pP,
|
||||
sdu_size_t tb_sizeP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
u8_t *data_pdu;
|
||||
int nb_li = 0;
|
||||
int li_index = 0;
|
||||
int remaining_data_size;
|
||||
u16_t li[32];
|
||||
u8_t start_processing = 0;
|
||||
u8_t *data_pdu_p = NULL;
|
||||
int nb_li = 0;
|
||||
int li_index = 0;
|
||||
sdu_size_t remaining_data_size = 0;
|
||||
sdu_size_t li[32];
|
||||
u8_t start_processing = 0;
|
||||
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
|
||||
if ((dataP->byte1 & RLC_E_MASK) == (u8_t) RLC_E_NEXT_FIELD_IS_DATA) {
|
||||
if ((data_pP->byte1 & RLC_E_MASK) == (u8_t) RLC_E_NEXT_FIELD_IS_DATA) {
|
||||
return;
|
||||
} else {
|
||||
while ((li[nb_li] = ((((u16_t) dataP->li_data_7[nb_li << 1]) << 8) + dataP->li_data_7[(nb_li << 1) + 1])) & RLC_E_NEXT_FIELD_IS_LI_E) {
|
||||
while ((li[nb_li] = ((((u16_t) data_pP->li_data_7[nb_li << 1]) << 8) + data_pP->li_data_7[(nb_li << 1) + 1])) & RLC_E_NEXT_FIELD_IS_LI_E) {
|
||||
li[nb_li] = li[nb_li] & (~(u16_t) RLC_E_NEXT_FIELD_IS_LI_E);
|
||||
nb_li++;
|
||||
}
|
||||
nb_li++; // count the last li
|
||||
|
||||
remaining_data_size = tb_sizeP - 1 - (nb_li << 1);
|
||||
data_pdu = (u8_t *) (&dataP->li_data_7[nb_li << 1]);
|
||||
data_pdu_p = (u8_t *) (&data_pP->li_data_7[nb_li << 1]);
|
||||
|
||||
while (li_index < nb_li) {
|
||||
switch (li[li_index]) {
|
||||
@@ -198,45 +204,48 @@ rlc_um_receive_15_process_unsynchronized_pdu (struct rlc_um_entity *rlcP, struct
|
||||
break;
|
||||
case RLC_LI_1ST_BYTE_SDU_IS_1ST_BYTE_PDU:
|
||||
start_processing = 1;
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
break;
|
||||
default: // li is length
|
||||
remaining_data_size = remaining_data_size - (li[li_index] >> 1);
|
||||
if ((start_processing)) {
|
||||
rlc_um_reassembly (data_pdu, (li[li_index] >> 1), rlcP);
|
||||
rlc_um_send_sdu (rlcP);
|
||||
rlc_um_reassembly (data_pdu_p, (li[li_index] >> 1), rlc_pP, 0);
|
||||
rlc_um_send_sdu (rlc_pP);
|
||||
}
|
||||
start_processing = 1;
|
||||
data_pdu = (u8_t *) ((u32_t) data_pdu + (li[li_index] >> 1));
|
||||
data_pdu_p = (u8_t *) ((u64_t) data_pdu_p + (li[li_index] >> 1));
|
||||
}
|
||||
li_index++;
|
||||
}
|
||||
if ((remaining_data_size)) {
|
||||
rlc_um_reassembly (data_pdu, remaining_data_size, rlcP);
|
||||
rlc_um_reassembly (data_pdu_p, remaining_data_size, rlc_pP);
|
||||
remaining_data_size = 0;
|
||||
}
|
||||
}
|
||||
rlcP->vr_us = (pdu_mngt->sn + 1) & 127;
|
||||
rlc_pP->vr_us = (pdu_mngt_pP->sn + 1) & 127;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline void
|
||||
rlc_um_receive_7_process_unsynchronized_pdu (struct rlc_um_entity *rlcP, struct rlc_um_rx_pdu_management *pdu_mngt, struct rlc_um_rx_data_pdu_struct *dataP, u16_t tb_sizeP)
|
||||
rlc_um_receive_7_process_unsynchronized_pdu (struct rlc_um_entity *rlc_pP,
|
||||
struct rlc_um_rx_pdu_management *pdu_mngt_pP,
|
||||
struct rlc_um_rx_data_pdu_struct *data_pP,
|
||||
sdu_size_t tb_sizeP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
u8_t *data_pdu;
|
||||
int nb_li = 0;
|
||||
int li_index = 0;
|
||||
int remaining_data_size;
|
||||
u16_t li[32];
|
||||
u8_t start_processing = 0;
|
||||
u8_t *data_pdu_p = NULL;
|
||||
int nb_li = 0;
|
||||
int li_index = 0;
|
||||
sdu_size_t remaining_data_size = 0;
|
||||
sdu_size_t li[32];
|
||||
u8_t start_processing = 0;
|
||||
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
|
||||
if ((dataP->byte1 & RLC_E_MASK) == (u8_t) RLC_E_NEXT_FIELD_IS_DATA) {
|
||||
if ((data_pP->byte1 & RLC_E_MASK) == (u8_t) RLC_E_NEXT_FIELD_IS_DATA) {
|
||||
return;
|
||||
} else {
|
||||
while ((li[nb_li] = ((u16_t) dataP->li_data_7[nb_li])) & RLC_E_NEXT_FIELD_IS_LI_E) {
|
||||
while ((li[nb_li] = ((u16_t) data_pP->li_data_7[nb_li])) & RLC_E_NEXT_FIELD_IS_LI_E) {
|
||||
li[nb_li] = li[nb_li] & (~(u8_t) RLC_E_NEXT_FIELD_IS_LI_E);
|
||||
nb_li++;
|
||||
}
|
||||
@@ -244,7 +253,7 @@ rlc_um_receive_7_process_unsynchronized_pdu (struct rlc_um_entity *rlcP, struct
|
||||
|
||||
remaining_data_size = tb_sizeP - 1 - nb_li;
|
||||
|
||||
data_pdu = (u8_t *) (&dataP->li_data_7[nb_li]);
|
||||
data_pdu_p = (u8_t *) (&data_pP->li_data_7[nb_li]);
|
||||
|
||||
while (li_index < nb_li) {
|
||||
switch (li[li_index]) {
|
||||
@@ -258,148 +267,139 @@ rlc_um_receive_7_process_unsynchronized_pdu (struct rlc_um_entity *rlcP, struct
|
||||
break;
|
||||
case (u8_t) RLC_LI_1ST_BYTE_SDU_IS_1ST_BYTE_PDU:
|
||||
start_processing = 1;
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
break;
|
||||
default: // li is length
|
||||
remaining_data_size = remaining_data_size - (li[li_index] >> 1);
|
||||
if ((start_processing)) {
|
||||
rlc_um_reassembly (data_pdu, (li[li_index] >> 1), rlcP);
|
||||
rlc_um_send_sdu (rlcP);
|
||||
rlc_um_reassembly (data_pdu_p, (li[li_index] >> 1), rlc_pP, 0);
|
||||
rlc_um_send_sdu (rlc_pP);
|
||||
}
|
||||
start_processing = 1;
|
||||
data_pdu = (u8_t *) ((u32_t) data_pdu + (li[li_index] >> 1));
|
||||
data_pdu_p = (u8_t *) ((u64_t) data_pdu_p + (li[li_index] >> 1));
|
||||
}
|
||||
li_index++;
|
||||
}
|
||||
if ((remaining_data_size)) {
|
||||
rlc_um_reassembly (data_pdu, remaining_data_size, rlcP);
|
||||
rlc_um_reassembly (data_pdu_p, remaining_data_size, rlc_pP);
|
||||
remaining_data_size = 0;
|
||||
}
|
||||
}
|
||||
rlcP->vr_us = (pdu_mngt->sn + 1) & 127;
|
||||
rlc_pP->vr_us = (pdu_mngt_pP->sn + 1) & 127;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_um_receive_15 (struct rlc_um_entity *rlcP, struct mac_data_ind data_indP)
|
||||
rlc_um_receive_15 (struct rlc_um_entity *rlc_pP, struct mac_data_ind data_indP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
struct rlc_um_rx_data_pdu_struct *data;
|
||||
struct rlc_um_rx_pdu_management *pdu_mngt;
|
||||
struct mem_block *tb;
|
||||
u8_t *first_byte;
|
||||
u8_t tb_size_in_bytes;
|
||||
u8_t first_bit;
|
||||
u8_t bits_to_shift;
|
||||
u8_t bits_to_shift_last_loop;
|
||||
struct rlc_um_rx_data_pdu_struct *data_p = NULL;
|
||||
struct rlc_um_rx_pdu_management *pdu_mngt_p = NULL;
|
||||
struct mem_block *tb_p = NULL;
|
||||
u8_t *first_byte_p = NULL;
|
||||
sdu_size_t tb_size_in_bytes = 0;
|
||||
u8_t first_bit = 0;
|
||||
u8_t bits_to_shift = 0;
|
||||
u8_t bits_to_shift_last_loop = 0;
|
||||
|
||||
while ((tb = remove_up_head (&data_indP.data))) {
|
||||
while ((tb_p = remove_up_head (&data_indP.data))) {
|
||||
|
||||
if (!(((struct mac_tb_ind *) (tb->data))->error_indication)) {
|
||||
if (!(((struct mac_tb_ind *) (tb_p->data))->error_indication)) {
|
||||
|
||||
first_byte = ((struct mac_tb_ind *) (tb->data))->data_ptr;
|
||||
pdu_mngt = (struct rlc_um_rx_pdu_management *) (tb->data);
|
||||
first_byte_p = ((struct mac_tb_ind *) (tb_p->data))->data_ptr;
|
||||
pdu_mngt_p = (struct rlc_um_rx_pdu_management *) (tb_p->data);
|
||||
|
||||
tb_size_in_bytes = data_indP.tb_size;
|
||||
first_bit = ((struct mac_tb_ind *) (tb->data))->first_bit;
|
||||
first_bit = ((struct mac_tb_ind *) (tb_p->data))->first_bit;
|
||||
if (first_bit > 0) {
|
||||
// shift data of transport_block TO CHECK
|
||||
bits_to_shift_last_loop = 0;
|
||||
while ((tb_size_in_bytes)) {
|
||||
bits_to_shift = first_byte[tb_size_in_bytes] >> (8 - first_bit);
|
||||
first_byte[tb_size_in_bytes] = (first_byte[tb_size_in_bytes] << first_bit) | (bits_to_shift_last_loop);
|
||||
bits_to_shift = first_byte_p[tb_size_in_bytes] >> (8 - first_bit);
|
||||
first_byte_p[tb_size_in_bytes] = (first_byte_p[tb_size_in_bytes] << first_bit) | (bits_to_shift_last_loop);
|
||||
tb_size_in_bytes -= 1;
|
||||
bits_to_shift_last_loop = bits_to_shift;
|
||||
}
|
||||
first_byte[0] = (first_byte[0] << first_bit) | (bits_to_shift_last_loop);
|
||||
first_byte_p[0] = (first_byte_p[0] << first_bit) | (bits_to_shift_last_loop);
|
||||
}
|
||||
|
||||
pdu_mngt->first_byte = first_byte;
|
||||
data = (struct rlc_um_rx_data_pdu_struct *) (first_byte);
|
||||
pdu_mngt->sn = data->byte1 >> 1;
|
||||
#ifdef BENCH_QOS_L2
|
||||
fprintf (bench_l2, "[PDU RX] FRAME %d SN %d RLC-UM %p\n", mac_xface->frame, pdu_mngt->sn, rlcP);
|
||||
#endif
|
||||
PRINT_RLC_UM_RX ("[RLC_UM][RB %d] RX PDU SN %02X hex\n", rlcP->rb_id, pdu_mngt->sn);
|
||||
pdu_mngt_p->first_byte = first_byte_p;
|
||||
data_p = (struct rlc_um_rx_data_pdu_struct *) (first_byte_p);
|
||||
pdu_mngt_p->sn = data_p->byte1 >> 1;
|
||||
PRINT_RLC_UM_RX ("[RLC_UM][RB %d] RX PDU SN %02X hex\n", rlc_pP->rb_id, pdu_mngt_p->sn);
|
||||
|
||||
if (pdu_mngt->sn == rlcP->vr_us) {
|
||||
rlc_um_receive_15_process_waited_pdu (rlcP, pdu_mngt, data, data_indP.tb_size);
|
||||
if (pdu_mngt_p->sn == rlc_pP->vr_us) {
|
||||
rlc_um_receive_15_process_waited_pdu (rlc_pP, pdu_mngt_p, data_p, data_indP.tb_size);
|
||||
} else {
|
||||
rlc_um_receive_15_process_unsynchronized_pdu (rlcP, pdu_mngt, data, data_indP.tb_size);
|
||||
rlc_um_receive_15_process_unsynchronized_pdu (rlc_pP, pdu_mngt_p, data_p, data_indP.tb_size);
|
||||
}
|
||||
} else {
|
||||
PRINT_RLC_UM_RX ("[RLC_UM][RB %d] RX PDU WITH ERROR INDICATED BY LOWER LAYERS -> GARBAGE\n", rlcP->rb_id);
|
||||
PRINT_RLC_UM_RX ("[RLC_UM][RB %d] RX PDU WITH ERROR INDICATED BY LOWER LAYERS -> GARBAGE\n", rlc_pP->rb_id);
|
||||
}
|
||||
free_mem_block (tb);
|
||||
free_mem_block (tb_p);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_um_receive_7 (struct rlc_um_entity *rlcP, struct mac_data_ind data_indP)
|
||||
rlc_um_receive_7 (struct rlc_um_entity *rlc_pP, struct mac_data_ind data_indP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
struct rlc_um_rx_data_pdu_struct *data;
|
||||
struct rlc_um_rx_pdu_management *pdu_mngt;
|
||||
struct mem_block *tb;
|
||||
u8_t *first_byte;
|
||||
u8_t tb_size_in_bytes;
|
||||
u8_t first_bit;
|
||||
u8_t bits_to_shift;
|
||||
u8_t bits_to_shift_last_loop;
|
||||
struct rlc_um_rx_data_pdu_struct *data_p = NULL;
|
||||
struct rlc_um_rx_pdu_management *pdu_mngt_p = NULL;
|
||||
struct mem_block *tb_p = NULL;
|
||||
u8_t *first_byte_p = NULL;
|
||||
sdu_size_t tb_size_in_bytes = 0;
|
||||
u8_t first_bit = 0;
|
||||
u8_t bits_to_shift = 0;
|
||||
u8_t bits_to_shift_last_loop = 0;
|
||||
|
||||
while ((tb = remove_up_head (&data_indP.data))) {
|
||||
while ((tb_p = remove_up_head (&data_indP.data))) {
|
||||
|
||||
|
||||
if (!(((struct mac_tb_ind *) (tb->data))->error_indication)) {
|
||||
if (!(((struct mac_tb_ind *) (tb_p->data))->error_indication)) {
|
||||
|
||||
#ifdef DEBUG_RLC_STATS
|
||||
rlcP->rx_pdus += 1;
|
||||
rlc_pP->rx_pdus += 1;
|
||||
#endif
|
||||
first_byte = ((struct mac_tb_ind *) (tb->data))->data_ptr;
|
||||
pdu_mngt = (struct rlc_um_rx_pdu_management *) (tb->data);
|
||||
first_byte_p = ((struct mac_tb_ind *) (tb_p->data))->data_ptr;
|
||||
pdu_mngt_p = (struct rlc_um_rx_pdu_management *) (tb_p->data);
|
||||
|
||||
tb_size_in_bytes = data_indP.tb_size;
|
||||
first_bit = ((struct mac_tb_ind *) (tb->data))->first_bit;
|
||||
first_bit = ((struct mac_tb_ind *) (tb_p->data))->first_bit;
|
||||
if (first_bit > 0) {
|
||||
// shift data of transport_block TO CHECK
|
||||
bits_to_shift_last_loop = 0;
|
||||
while ((tb_size_in_bytes)) {
|
||||
bits_to_shift = first_byte[tb_size_in_bytes] >> (8 - first_bit);
|
||||
first_byte[tb_size_in_bytes] = (first_byte[tb_size_in_bytes] << first_bit) | (bits_to_shift_last_loop);
|
||||
bits_to_shift = first_byte_p[tb_size_in_bytes] >> (8 - first_bit);
|
||||
first_byte_p[tb_size_in_bytes] = (first_byte_p[tb_size_in_bytes] << first_bit) | (bits_to_shift_last_loop);
|
||||
tb_size_in_bytes -= 1;
|
||||
bits_to_shift_last_loop = bits_to_shift;
|
||||
}
|
||||
first_byte[0] = (first_byte[0] << first_bit) | (bits_to_shift_last_loop);
|
||||
first_byte_p[0] = (first_byte_p[0] << first_bit) | (bits_to_shift_last_loop);
|
||||
}
|
||||
|
||||
pdu_mngt->first_byte = first_byte;
|
||||
data = (struct rlc_um_rx_data_pdu_struct *) (first_byte);
|
||||
pdu_mngt->sn = data->byte1 >> 1;
|
||||
PRINT_RLC_UM_RX ("[RLC_UM][RB %d] RX7 PDU SN %d VR(US) %d\n", rlcP->rb_id, pdu_mngt->sn, rlcP->vr_us);
|
||||
#ifdef BENCH_QOS_L2
|
||||
fprintf (bench_l2, "[PDU RX] FRAME %d SN %d RLC-UM %p\n", mac_xface->frame, pdu_mngt->sn, rlcP);
|
||||
#endif
|
||||
pdu_mngt_p->first_byte = first_byte_p;
|
||||
data_p = (struct rlc_um_rx_data_pdu_struct *) (first_byte_p);
|
||||
pdu_mngt_p->sn = data_p->byte1 >> 1;
|
||||
PRINT_RLC_UM_RX ("[RLC_UM][RB %d] RX7 PDU SN %d VR(US) %d\n", rlc_pP->rb_id, pdu_mngt_p->sn, rlc_pP->vr_us);
|
||||
|
||||
if (pdu_mngt->sn == rlcP->vr_us) {
|
||||
rlc_um_receive_7_process_waited_pdu (rlcP, pdu_mngt, data, data_indP.tb_size);
|
||||
if (pdu_mngt_p->sn == rlc_pP->vr_us) {
|
||||
rlc_um_receive_7_process_waited_pdu (rlc_pP, pdu_mngt_p, data_p, data_indP.tb_size);
|
||||
} else {
|
||||
rlc_um_receive_7_process_unsynchronized_pdu (rlcP, pdu_mngt, data, data_indP.tb_size);
|
||||
rlc_um_receive_7_process_unsynchronized_pdu (rlc_pP, pdu_mngt_p, data_p, data_indP.tb_size);
|
||||
}
|
||||
} else {
|
||||
#ifdef DEBUG_RLC_STATS
|
||||
rlcP->rx_pdus_in_error += 1;
|
||||
#endif
|
||||
#ifdef BENCH_QOS_L2
|
||||
fprintf (bench_l2, "[PDU RX ERROR] FRAME %d RLC-UM %p\n", mac_xface->frame, rlcP);
|
||||
rlc_pP->rx_pdus_in_error += 1;
|
||||
#endif
|
||||
#ifdef DEBUG_RLC_UM_RX
|
||||
pdu_mngt = (struct rlc_um_rx_pdu_management *) (tb->data);
|
||||
PRINT_RLC_UM_RX ("[RLC_UM][RB %d] RX7 PDU SN %02X hex??? WITH ERROR INDICATED BY LOWER LAYERS -> GARBAGE\n", rlcP->rb_id, pdu_mngt->sn);
|
||||
pdu_mngt_p = (struct rlc_um_rx_pdu_management *) (tb->data);
|
||||
PRINT_RLC_UM_RX ("[RLC_UM][RB %d] RX7 PDU SN %02X hex??? WITH ERROR INDICATED BY LOWER LAYERS -> GARBAGE\n", rlc_pP->rb_id, pdu_mngt_p->sn);
|
||||
#endif
|
||||
}
|
||||
free_mem_block (tb);
|
||||
free_mem_block (tb_p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@ rlc_um_receive_process_pdu (struct rlc_um_entity *rlcP, struct rlc_um_rx_pdu_man
|
||||
msg ("[RLC_UM_LITE][RB %d] GOOD CRC ON RLC HEADER 1 byte\n", rlcP->rb_id);
|
||||
}
|
||||
}
|
||||
rlc_um_reassembly ((u8_t *) (&dataP->li_data_7[0]), tb_sizeP - 2, rlcP);
|
||||
rlc_um_reassembly ((u8_t *) (&dataP->li_data_7[0]), tb_sizeP - 2, rlcP, 0);
|
||||
} else {
|
||||
rlc_um_reassembly ((u8_t *) (&dataP->li_data_7[0]), tb_sizeP - 1, rlcP);
|
||||
rlc_um_reassembly ((u8_t *) (&dataP->li_data_7[0]), tb_sizeP - 1, rlcP, 0);
|
||||
}
|
||||
}
|
||||
//---------------------------------
|
||||
|
||||
@@ -47,14 +47,14 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
|
||||
#include "rlc_um_very_simple_test.h"
|
||||
|
||||
//#define DEBUG_RLC_UM_TX_STATUS 1
|
||||
#define DEBUG_RLC_UM_TX_STATUS 1
|
||||
#define TRACE_RLC_UM_PDU 1
|
||||
|
||||
#ifdef TRACE_RLC_UM_PDU
|
||||
char message_string[10000];
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_um_stat_req (rlc_um_entity_t *rlcP,
|
||||
void rlc_um_stat_req (rlc_um_entity_t *rlc_pP,
|
||||
unsigned int* stat_tx_pdcp_sdu,
|
||||
unsigned int* stat_tx_pdcp_bytes,
|
||||
unsigned int* stat_tx_pdcp_sdu_discarded,
|
||||
@@ -73,43 +73,43 @@ void rlc_um_stat_req (rlc_um_entity_t *rlcP,
|
||||
unsigned int* stat_rx_data_bytes_out_of_window,
|
||||
unsigned int* stat_timer_reordering_timed_out) {
|
||||
//-----------------------------------------------------------------------------
|
||||
*stat_tx_pdcp_sdu = rlcP->stat_tx_pdcp_sdu;
|
||||
*stat_tx_pdcp_bytes = rlcP->stat_tx_pdcp_bytes;
|
||||
*stat_tx_pdcp_sdu_discarded = rlcP->stat_tx_pdcp_sdu_discarded;
|
||||
*stat_tx_pdcp_bytes_discarded = rlcP->stat_tx_pdcp_bytes_discarded;
|
||||
*stat_tx_data_pdu = rlcP->stat_tx_data_pdu;
|
||||
*stat_tx_data_bytes = rlcP->stat_tx_data_bytes;
|
||||
*stat_rx_pdcp_sdu = rlcP->stat_rx_pdcp_sdu;
|
||||
*stat_rx_pdcp_bytes = rlcP->stat_rx_pdcp_bytes;
|
||||
*stat_rx_data_pdus_duplicate = rlcP->stat_rx_data_pdus_duplicate;
|
||||
*stat_rx_data_bytes_duplicate = rlcP->stat_rx_data_bytes_duplicate;
|
||||
*stat_rx_data_pdu = rlcP->stat_rx_data_pdu;
|
||||
*stat_rx_data_bytes = rlcP->stat_rx_data_bytes;
|
||||
*stat_rx_data_pdu_dropped = rlcP->stat_rx_data_pdu_dropped;
|
||||
*stat_rx_data_bytes_dropped = rlcP->stat_rx_data_bytes_dropped;
|
||||
*stat_rx_data_pdu_out_of_window = rlcP->stat_rx_data_pdu_out_of_window;
|
||||
*stat_rx_data_bytes_out_of_window = rlcP->stat_rx_data_bytes_out_of_window;
|
||||
*stat_timer_reordering_timed_out = rlcP->stat_timer_reordering_timed_out;
|
||||
*stat_tx_pdcp_sdu = rlc_pP->stat_tx_pdcp_sdu;
|
||||
*stat_tx_pdcp_bytes = rlc_pP->stat_tx_pdcp_bytes;
|
||||
*stat_tx_pdcp_sdu_discarded = rlc_pP->stat_tx_pdcp_sdu_discarded;
|
||||
*stat_tx_pdcp_bytes_discarded = rlc_pP->stat_tx_pdcp_bytes_discarded;
|
||||
*stat_tx_data_pdu = rlc_pP->stat_tx_data_pdu;
|
||||
*stat_tx_data_bytes = rlc_pP->stat_tx_data_bytes;
|
||||
*stat_rx_pdcp_sdu = rlc_pP->stat_rx_pdcp_sdu;
|
||||
*stat_rx_pdcp_bytes = rlc_pP->stat_rx_pdcp_bytes;
|
||||
*stat_rx_data_pdus_duplicate = rlc_pP->stat_rx_data_pdus_duplicate;
|
||||
*stat_rx_data_bytes_duplicate = rlc_pP->stat_rx_data_bytes_duplicate;
|
||||
*stat_rx_data_pdu = rlc_pP->stat_rx_data_pdu;
|
||||
*stat_rx_data_bytes = rlc_pP->stat_rx_data_bytes;
|
||||
*stat_rx_data_pdu_dropped = rlc_pP->stat_rx_data_pdu_dropped;
|
||||
*stat_rx_data_bytes_dropped = rlc_pP->stat_rx_data_bytes_dropped;
|
||||
*stat_rx_data_pdu_out_of_window = rlc_pP->stat_rx_data_pdu_out_of_window;
|
||||
*stat_rx_data_bytes_out_of_window = rlc_pP->stat_rx_data_bytes_out_of_window;
|
||||
*stat_timer_reordering_timed_out = rlc_pP->stat_timer_reordering_timed_out;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
u32_t
|
||||
rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlcP)
|
||||
rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlc_pP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
if (rlcP->buffer_occupancy > 0) {
|
||||
return rlcP->buffer_occupancy;
|
||||
if (rlc_pP->buffer_occupancy > 0) {
|
||||
return rlc_pP->buffer_occupancy;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_um_get_pdus (void *argP,u32_t frame)
|
||||
rlc_um_get_pdus (void *argP, frame_t frameP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
rlc_um_entity_t *rlc = (rlc_um_entity_t *) argP;
|
||||
rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) argP;
|
||||
|
||||
switch (rlc->protocol_state) {
|
||||
switch (rlc_p->protocol_state) {
|
||||
|
||||
case RLC_NULL_STATE:
|
||||
// from 3GPP TS 25.322 V9.2.0 p43
|
||||
@@ -139,11 +139,11 @@ rlc_um_get_pdus (void *argP,u32_t frame)
|
||||
// - enters the LOCAL_SUSPEND state.
|
||||
|
||||
// SEND DATA TO MAC
|
||||
if (rlc->tx_sn_length == 10) {
|
||||
rlc_um_segment_10 (rlc,frame);
|
||||
if (rlc_p->tx_sn_length == 10) {
|
||||
rlc_um_segment_10 (rlc_p,frameP);
|
||||
}
|
||||
if (rlc->tx_sn_length == 5) {
|
||||
rlc_um_segment_5 (rlc,frame);
|
||||
if (rlc_p->tx_sn_length == 5) {
|
||||
rlc_um_segment_5 (rlc_p,frameP);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -169,13 +169,19 @@ rlc_um_get_pdus (void *argP,u32_t frame)
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] MAC_DATA_REQ UNKNOWN PROTOCOL STATE %02X hex\n", rlc->module_id, rlc->rb_id, frame, rlc->protocol_state);
|
||||
LOG_E(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_DATA_REQ UNKNOWN PROTOCOL STATE %02X hex\n",
|
||||
frameP,
|
||||
(rlc_p->is_enb) ? "eNB" : "UE",
|
||||
rlc_p->enb_module_id,
|
||||
rlc_p->ue_module_id,
|
||||
rlc_p->rb_id,
|
||||
rlc_p->protocol_state);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_um_rx (void *argP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP)
|
||||
rlc_um_rx (void *argP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
rlc_um_entity_t *l_rlc_p = (rlc_um_entity_t *) argP;
|
||||
@@ -200,19 +206,19 @@ rlc_um_rx (void *argP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP
|
||||
// establishment, the RLC entity:
|
||||
// - is created; and
|
||||
// - enters the DATA_TRANSFER_READY state.
|
||||
LOG_N(RLC, "[RLC_UM][MOD %d] ERROR MAC_DATA_IND IN RLC_NULL_STATE\n", l_rlc_p->module_id);
|
||||
LOG_N(RLC, "[RLC_UM][MOD %02u/%02u] ERROR MAC_DATA_IND IN RLC_NULL_STATE\n", l_rlc_p->enb_module_id, l_rlc_p->ue_module_id);
|
||||
|
||||
/*if (data_indP.data.nb_elements > 0) {
|
||||
LOG_D(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n", l_rlc_p->module_id, l_rlc_p->rb_id, frame, data_indP.data.nb_elements);
|
||||
rlc[l_rlc_p->module_id].m_mscgen_trace_length = sprintf(rlc[l_rlc_p->module_id].m_mscgen_trace, "[MSC_MSG][FRAME %05d][MAC_%s][MOD %02d][][--- MAC_DATA_IND/ %d TB(s) ",
|
||||
frame,
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_DATA_IND %d TBs\n", l_rlc_p->module_id, l_rlc_p->rb_id, frameP, data_indP.data.nb_elements);
|
||||
rlc_p[l_rlc_p->module_id].m_mscgen_trace_length = sprintf(rlc_p[l_rlc_p->module_id].m_mscgen_trace, "[MSC_MSG][FRAME %05d][MAC_%s][MOD %02d][][--- MAC_DATA_IND/ %d TB(s) ",
|
||||
frameP,
|
||||
(l_rlc_p->is_enb) ? "eNB":"UE",
|
||||
l_rlc_p->module_id,
|
||||
data_indP.data.nb_elements);
|
||||
|
||||
tb = data_indP.data.head;
|
||||
while (tb != NULL) {
|
||||
rlc[l_rlc_p->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc_p->module_id].m_mscgen_trace[rlc[l_rlc_p->module_id].m_mscgen_trace_length], " SN %d %c%c%c %d Bytes ",
|
||||
rlc_p[l_rlc_p->module_id].m_mscgen_trace_length += sprintf(&rlc_p[l_rlc_p->module_id].m_mscgen_trace[rlc_p[l_rlc_p->module_id].m_mscgen_trace_length], " SN %d %c%c%c %d Bytes ",
|
||||
(((struct mac_tb_ind *) (tb->data))->data_ptr[1]) + (((u16_t)((((struct mac_tb_ind *) (tb->data))->data_ptr[0]) & 0x03)) << 8),
|
||||
(((struct mac_tb_ind *) (tb->data))->data_ptr[0] & 0x10) ? '}':'{',
|
||||
(((struct mac_tb_ind *) (tb->data))->data_ptr[0] & 0x08) ? '{':'}',
|
||||
@@ -220,12 +226,12 @@ rlc_um_rx (void *argP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP
|
||||
((struct mac_tb_ind *) (tb->data))->size);
|
||||
tb = tb->next;
|
||||
}
|
||||
rlc[l_rlc_p->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc_p->module_id].m_mscgen_trace[rlc[l_rlc_p->module_id].m_mscgen_trace_length], " DROPPED RLC NULL STATE ---X][RLC_UM][MOD %02d][RB %02d]\n",
|
||||
rlc_p[l_rlc_p->module_id].m_mscgen_trace_length += sprintf(&rlc_p[l_rlc_p->module_id].m_mscgen_trace[rlc_p[l_rlc_p->module_id].m_mscgen_trace_length], " DROPPED RLC NULL STATE ---X][RLC_UM][MOD %02d][RB %02d]\n",
|
||||
l_rlc_p->module_id,
|
||||
l_rlc_p->rb_id);
|
||||
|
||||
rlc[l_rlc_p->module_id].m_mscgen_trace[rlc[l_rlc_p->module_id].m_mscgen_trace_length] = 0;
|
||||
LOG_D(RLC, "%s", rlc[l_rlc_p->module_id].m_mscgen_trace);
|
||||
rlc_p[l_rlc_p->module_id].m_mscgen_trace[rlc_p[l_rlc_p->module_id].m_mscgen_trace_length] = 0;
|
||||
LOG_D(RLC, "%s", rlc_p[l_rlc_p->module_id].m_mscgen_trace);
|
||||
}*/
|
||||
list_free (&data_indP.data);
|
||||
break;
|
||||
@@ -250,13 +256,19 @@ rlc_um_rx (void *argP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP
|
||||
|
||||
#ifdef TRACE_RLC_UM_PDU
|
||||
if (data_indP.data.nb_elements > 0) {
|
||||
LOG_D(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n", l_rlc_p->module_id, l_rlc_p->rb_id, frame, data_indP.data.nb_elements);
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_DATA_IND %d TBs\n",
|
||||
frameP,
|
||||
(l_rlc_p->is_enb) ? "eNB" : "UE",
|
||||
l_rlc_p->enb_module_id,
|
||||
l_rlc_p->ue_module_id,
|
||||
l_rlc_p->rb_id,
|
||||
data_indP.data.nb_elements);
|
||||
|
||||
tb_p = data_indP.data.head;
|
||||
while (tb_p != NULL) {
|
||||
tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
|
||||
|
||||
rlc_um_get_pdu_infos(frame,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_ind *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length);
|
||||
rlc_um_get_pdu_infos(frameP,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_ind *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length);
|
||||
message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
|
||||
message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
|
||||
message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
|
||||
@@ -315,7 +327,7 @@ rlc_um_rx (void *argP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP
|
||||
}
|
||||
}
|
||||
#endif
|
||||
rlc_um_receive (l_rlc_p, frame, eNB_flag, data_indP);
|
||||
rlc_um_receive (l_rlc_p, frameP, eNB_flagP, data_indP);
|
||||
break;
|
||||
|
||||
case RLC_LOCAL_SUSPEND_STATE:
|
||||
@@ -335,18 +347,23 @@ rlc_um_rx (void *argP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP
|
||||
// - stays in the LOCAL_SUSPEND state;
|
||||
// - modifies only the protocol parameters and timers as indicated by
|
||||
// upper layers.
|
||||
LOG_N(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] RLC_LOCAL_SUSPEND_STATE\n", l_rlc_p->module_id, l_rlc_p->rb_id, frame);
|
||||
LOG_N(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] RLC_LOCAL_SUSPEND_STATE\n",
|
||||
frameP,
|
||||
(l_rlc_p->is_enb) ? "eNB" : "UE",
|
||||
l_rlc_p->enb_module_id,
|
||||
l_rlc_p->ue_module_id,
|
||||
l_rlc_p->rb_id);
|
||||
/*if (data_indP.data.nb_elements > 0) {
|
||||
LOG_D(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n", l_rlc_p->module_id, l_rlc_p->rb_id, frame, data_indP.data.nb_elements);
|
||||
rlc[l_rlc_p->module_id].m_mscgen_trace_length = sprintf(rlc[l_rlc_p->module_id].m_mscgen_trace, "[MSC_MSG][FRAME %05d][MAC_%s][MOD %02d][][--- MAC_DATA_IND/ %d TB(s) ",
|
||||
frame,
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_DATA_IND %d TBs\n", l_rlc_p->module_id, l_rlc_p->rb_id, frameP, data_indP.data.nb_elements);
|
||||
rlc_p[l_rlc_p->module_id].m_mscgen_trace_length = sprintf(rlc_p[l_rlc_p->module_id].m_mscgen_trace, "[MSC_MSG][FRAME %05d][MAC_%s][MOD %02d][][--- MAC_DATA_IND/ %d TB(s) ",
|
||||
frameP,
|
||||
(l_rlc_p->is_enb) ? "eNB":"UE",
|
||||
l_rlc_p->module_id,
|
||||
data_indP.data.nb_elements);
|
||||
|
||||
tb = data_indP.data.head;
|
||||
while (tb != NULL) {
|
||||
rlc[l_rlc_p->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc_p->module_id].m_mscgen_trace[rlc[l_rlc_p->module_id].m_mscgen_trace_length], " SN %d %c%c%c %d Bytes ",
|
||||
rlc_p[l_rlc_p->module_id].m_mscgen_trace_length += sprintf(&rlc_p[l_rlc_p->module_id].m_mscgen_trace[rlc_p[l_rlc_p->module_id].m_mscgen_trace_length], " SN %d %c%c%c %d Bytes ",
|
||||
(((struct mac_tb_ind *) (tb->data))->data_ptr[1]) + (((u16_t)((((struct mac_tb_ind *) (tb->data))->data_ptr[0]) & 0x03)) << 8),
|
||||
(((struct mac_tb_ind *) (tb->data))->data_ptr[0] & 0x10) ? '}':'{',
|
||||
(((struct mac_tb_ind *) (tb->data))->data_ptr[0] & 0x08) ? '{':'}',
|
||||
@@ -354,57 +371,63 @@ rlc_um_rx (void *argP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP
|
||||
((struct mac_tb_ind *) (tb->data))->size);
|
||||
tb = tb->next;
|
||||
}
|
||||
rlc[l_rlc_p->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc_p->module_id].m_mscgen_trace[rlc[l_rlc_p->module_id].m_mscgen_trace_length], " DROPPED RLC LOCAL SUSPEND STATE ---X][RLC_UM][MOD %02d][RB %02d]\n",
|
||||
rlc_p[l_rlc_p->module_id].m_mscgen_trace_length += sprintf(&rlc_p[l_rlc_p->module_id].m_mscgen_trace[rlc_p[l_rlc_p->module_id].m_mscgen_trace_length], " DROPPED RLC LOCAL SUSPEND STATE ---X][RLC_UM][MOD %02d][RB %02d]\n",
|
||||
l_rlc_p->module_id,
|
||||
l_rlc_p->rb_id);
|
||||
|
||||
rlc[l_rlc_p->module_id].m_mscgen_trace[rlc[l_rlc_p->module_id].m_mscgen_trace_length] = 0;
|
||||
LOG_D(RLC, "%s", rlc[l_rlc_p->module_id].m_mscgen_trace);
|
||||
rlc_p[l_rlc_p->module_id].m_mscgen_trace[rlc_p[l_rlc_p->module_id].m_mscgen_trace_length] = 0;
|
||||
LOG_D(RLC, "%s", rlc_p[l_rlc_p->module_id].m_mscgen_trace);
|
||||
}*/
|
||||
list_free (&data_indP.data);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] TX UNKNOWN PROTOCOL STATE %02X hex\n", l_rlc_p->module_id, l_rlc_p->rb_id, frame, l_rlc_p->protocol_state);
|
||||
LOG_E(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] TX UNKNOWN PROTOCOL STATE %02X hex\n",
|
||||
frameP,
|
||||
(l_rlc_p->is_enb) ? "eNB" : "UE",
|
||||
l_rlc_p->enb_module_id,
|
||||
l_rlc_p->ue_module_id,
|
||||
l_rlc_p->rb_id,
|
||||
l_rlc_p->protocol_state);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
struct mac_status_resp
|
||||
rlc_um_mac_status_indication (void *rlcP, u32_t frame, u8_t eNB_flag, u16_t tbs_sizeP, struct mac_status_ind tx_statusP)
|
||||
rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, u16_t tbs_sizeP, struct mac_status_ind tx_statusP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
struct mac_status_resp status_resp;
|
||||
u16_t sdu_size = 0;
|
||||
u16_t sdu_remaining_size = 0;
|
||||
s32_t diff_time=0;
|
||||
rlc_um_entity_t *rlc = NULL;
|
||||
rlc_um_entity_t *rlc_p = NULL;
|
||||
|
||||
status_resp.buffer_occupancy_in_pdus = 0;
|
||||
status_resp.buffer_occupancy_in_bytes = 0;
|
||||
status_resp.head_sdu_remaining_size_to_send = 0;
|
||||
status_resp.head_sdu_creation_time = 0;
|
||||
status_resp.head_sdu_is_segmented = 0;
|
||||
status_resp.rlc_info.rlc_protocol_state = ((rlc_um_entity_t *) rlcP)->protocol_state;
|
||||
status_resp.rlc_info.rlc_protocol_state = ((rlc_um_entity_t *) rlc_pP)->protocol_state;
|
||||
|
||||
if (rlcP) {
|
||||
rlc = (rlc_um_entity_t *) rlcP;
|
||||
rlc_um_check_timer_dar_time_out(rlc,frame,eNB_flag);
|
||||
if (rlc_pP) {
|
||||
rlc_p = (rlc_um_entity_t *) rlc_pP;
|
||||
rlc_um_check_timer_dar_time_out(rlc_p,frameP,eNB_flagP);
|
||||
|
||||
rlc->nb_bytes_requested_by_mac = tbs_sizeP;
|
||||
rlc_p->nb_bytes_requested_by_mac = tbs_sizeP;
|
||||
|
||||
status_resp.buffer_occupancy_in_bytes = rlc_um_get_buffer_occupancy (rlc);
|
||||
status_resp.buffer_occupancy_in_bytes = rlc_um_get_buffer_occupancy (rlc_p);
|
||||
if (status_resp.buffer_occupancy_in_bytes > 0) {
|
||||
|
||||
status_resp.buffer_occupancy_in_bytes += rlc->tx_header_min_length_in_bytes;
|
||||
status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu;
|
||||
status_resp.buffer_occupancy_in_bytes += rlc_p->tx_header_min_length_in_bytes;
|
||||
status_resp.buffer_occupancy_in_pdus = rlc_p->nb_sdu;
|
||||
|
||||
diff_time = frame - ((struct rlc_um_tx_sdu_management *) (rlc->input_sdus[rlc->current_sdu_index])->data)->sdu_creation_time;
|
||||
status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (u32_t) diff_time : (u32_t)(0xffffffff - diff_time + frame) ;
|
||||
//msg("rlc status for frame %d diff time %d resp %d\n", frame, diff_time,status_resp.head_sdu_creation_time) ;
|
||||
diff_time = frameP - ((struct rlc_um_tx_sdu_management *) (rlc_p->input_sdus[rlc_p->current_sdu_index])->data)->sdu_creation_time;
|
||||
status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (u32_t) diff_time : (u32_t)(0xffffffff - diff_time + frameP) ;
|
||||
//msg("rlc_p status for frameP %d diff time %d resp %d\n", frameP, diff_time,status_resp.head_sdu_creation_time) ;
|
||||
|
||||
sdu_size = ((struct rlc_um_tx_sdu_management *) (rlc->input_sdus[rlc->current_sdu_index])->data)->sdu_size;
|
||||
sdu_remaining_size = ((struct rlc_um_tx_sdu_management *) (rlc->input_sdus[rlc->current_sdu_index])->data)->sdu_remaining_size;
|
||||
sdu_size = ((struct rlc_um_tx_sdu_management *) (rlc_p->input_sdus[rlc_p->current_sdu_index])->data)->sdu_size;
|
||||
sdu_remaining_size = ((struct rlc_um_tx_sdu_management *) (rlc_p->input_sdus[rlc_p->current_sdu_index])->data)->sdu_remaining_size;
|
||||
|
||||
status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size;
|
||||
if (sdu_size == sdu_remaining_size) {
|
||||
@@ -416,17 +439,37 @@ rlc_um_mac_status_indication (void *rlcP, u32_t frame, u8_t eNB_flag, u16_t tbs_
|
||||
|
||||
} else {
|
||||
}
|
||||
//msg("[RLC_UM][MOD %d][RB %d][FRAME %05d] MAC_STATUS_INDICATION BO = %d\n", ((rlc_um_entity_t *) rlcP)->module_id, ((rlc_um_entity_t *) rlcP)->rb_id, status_resp.buffer_occupancy_in_bytes);
|
||||
//msg("[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_STATUS_INDICATION BO = %d\n", ((rlc_um_entity_t *) rlc_pP)->module_id, ((rlc_um_entity_t *) rlc_pP)->rb_id, status_resp.buffer_occupancy_in_bytes);
|
||||
|
||||
status_resp.rlc_info.rlc_protocol_state = ((rlc_um_entity_t *) rlcP)->protocol_state;
|
||||
status_resp.rlc_info.rlc_protocol_state = ((rlc_um_entity_t *) rlc_pP)->protocol_state;
|
||||
#ifdef DEBUG_RLC_UM_TX_STATUS
|
||||
if ((((rlc_um_entity_t *) rlcP)->rb_id > 0) && (status_resp.buffer_occupancy_in_bytes > 0)) {
|
||||
LOG_D(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] MAC_STATUS_INDICATION (DATA) %d bytes -> %d bytes\n", ((rlc_um_entity_t *) rlcP)->module_id, ((rlc_um_entity_t *) rlcP)->rb_id, frame, tbs_sizeP, status_resp.buffer_occupancy_in_bytes);
|
||||
if ((((rlc_um_entity_t *) rlc_pP)->rb_id > 0) && (status_resp.buffer_occupancy_in_bytes > 0)) {
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_STATUS_INDICATION (DATA) %d bytes -> %d bytes\n",
|
||||
frameP,
|
||||
(rlc_p->is_enb) ? "eNB" : "UE",
|
||||
rlc_p->enb_module_id,
|
||||
rlc_p->ue_module_id,
|
||||
rlc_p->rb_id,
|
||||
tbs_sizeP,
|
||||
status_resp.buffer_occupancy_in_bytes);
|
||||
|
||||
if ((tx_statusP.tx_status == MAC_TX_STATUS_SUCCESSFUL) && (tx_statusP.no_pdu)) {
|
||||
LOG_D(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] MAC_STATUS_INDICATION TX STATUS SUCCESSFUL %d PDUs\n",((rlc_um_entity_t *) rlcP)->module_id, ((rlc_um_entity_t *) rlcP)->rb_id, frame, tx_statusP.no_pdu);
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_STATUS_INDICATION TX STATUS SUCCESSFUL %d PDUs\n",
|
||||
frameP,
|
||||
(rlc_p->is_enb) ? "eNB" : "UE",
|
||||
rlc_p->enb_module_id,
|
||||
rlc_p->ue_module_id,
|
||||
rlc_p->rb_id,
|
||||
tx_statusP.no_pdu);
|
||||
}
|
||||
if ((tx_statusP.tx_status == MAC_TX_STATUS_UNSUCCESSFUL) && (tx_statusP.no_pdu)) {
|
||||
LOG_D(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] MAC_STATUS_INDICATION TX STATUS UNSUCCESSFUL %d PDUs\n",((rlc_um_entity_t *) rlcP)->module_id, ((rlc_um_entity_t *) rlcP)->rb_id, frame, tx_statusP.no_pdu);
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_STATUS_INDICATION TX STATUS UNSUCCESSFUL %d PDUs\n",
|
||||
frameP,
|
||||
(rlc_p->is_enb) ? "eNB" : "UE",
|
||||
rlc_p->enb_module_id,
|
||||
rlc_p->ue_module_id,
|
||||
rlc_p->rb_id,
|
||||
tx_statusP.no_pdu);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -438,7 +481,7 @@ rlc_um_mac_status_indication (void *rlcP, u32_t frame, u8_t eNB_flag, u16_t tbs_
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
struct mac_data_req
|
||||
rlc_um_mac_data_request (void *rlcP,u32 frame)
|
||||
rlc_um_mac_data_request (void *rlc_pP,frame_t frameP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
struct mac_data_req data_req;
|
||||
@@ -452,9 +495,9 @@ rlc_um_mac_data_request (void *rlcP,u32 frame)
|
||||
rlc_um_pdu_info_t pdu_info;
|
||||
int octet_index, index;
|
||||
#endif
|
||||
rlc_um_entity_t *l_rlc_p = (rlc_um_entity_t *) rlcP;
|
||||
rlc_um_entity_t *l_rlc_p = (rlc_um_entity_t *) rlc_pP;
|
||||
|
||||
rlc_um_get_pdus (rlcP,frame);
|
||||
rlc_um_get_pdus (rlc_pP,frameP);
|
||||
|
||||
list_init (&data_req.data, NULL);
|
||||
list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data);
|
||||
@@ -466,16 +509,16 @@ rlc_um_mac_data_request (void *rlcP,u32 frame)
|
||||
}
|
||||
data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state;
|
||||
if (data_req.data.nb_elements > 0) {
|
||||
//LOG_I(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] MAC_DATA_REQUEST %d TBs\n", l_rlc_p->module_id, l_rlc_p->rb_id, frame, data_req.data.nb_elements);
|
||||
|
||||
tb_p = data_req.data.head;
|
||||
while (tb_p != NULL) {
|
||||
tb_size_in_bytes = ((struct mac_tb_req *) (tb_p->data))->tb_size;
|
||||
|
||||
LOG_I(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] MAC_DATA_REQUEST TB SIZE %u\n",
|
||||
l_rlc_p->module_id,
|
||||
LOG_I(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_DATA_REQUEST TB SIZE %u\n",
|
||||
frameP,
|
||||
(l_rlc_p->is_enb) ? "eNB" : "UE",
|
||||
l_rlc_p->enb_module_id,
|
||||
l_rlc_p->ue_module_id,
|
||||
l_rlc_p->rb_id,
|
||||
frame,
|
||||
((struct mac_tb_req *) (tb_p->data))->tb_size);
|
||||
l_rlc_p->stat_tx_data_pdu += 1;
|
||||
l_rlc_p->stat_tx_data_bytes += tb_size_in_bytes;
|
||||
@@ -483,7 +526,7 @@ rlc_um_mac_data_request (void *rlcP,u32 frame)
|
||||
AssertFatal( tb_size_in_bytes > 0 , "RLC UM PDU LENGTH %d", tb_size_in_bytes);
|
||||
|
||||
#ifdef TRACE_RLC_UM_PDU
|
||||
rlc_um_get_pdu_infos(frame,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_req *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length);
|
||||
rlc_um_get_pdu_infos(frameP,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_req *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length);
|
||||
message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
|
||||
message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
|
||||
message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
|
||||
@@ -546,34 +589,36 @@ rlc_um_mac_data_request (void *rlcP,u32 frame)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_um_mac_data_indication (void *rlcP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP)
|
||||
rlc_um_mac_data_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
rlc_um_rx (rlcP, frame, eNB_flag, data_indP);
|
||||
rlc_um_check_timer_dar_time_out(rlcP,frame,eNB_flag);
|
||||
rlc_um_rx (rlc_pP, frameP, eNB_flagP, data_indP);
|
||||
rlc_um_check_timer_dar_time_out(rlc_pP,frameP,eNB_flagP);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_um_data_req (void *rlcP, u32_t frame, mem_block_t *sduP)
|
||||
rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
rlc_um_entity_t *rlc = (rlc_um_entity_t *) rlcP;
|
||||
rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) rlc_pP;
|
||||
|
||||
#ifndef USER_MODE
|
||||
unsigned long int rlc_um_time_us;
|
||||
int min, sec, usec;
|
||||
#endif
|
||||
|
||||
LOG_I(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] RLC_UM_DATA_REQ size %d Bytes, BO %d , NB SDU %d current_sdu_index=%d next_sdu_index=%d\n",
|
||||
rlc->module_id,
|
||||
rlc->rb_id,
|
||||
frame,
|
||||
((struct rlc_um_data_req *) (sduP->data))->data_size,
|
||||
rlc->buffer_occupancy,
|
||||
rlc->nb_sdu,
|
||||
rlc->current_sdu_index,
|
||||
rlc->next_sdu_index);
|
||||
LOG_I(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] RLC_UM_DATA_REQ size %d Bytes, BO %d , NB SDU %d current_sdu_index=%d next_sdu_index=%d\n",
|
||||
frameP,
|
||||
(rlc_p->is_enb) ? "eNB" : "UE",
|
||||
rlc_p->enb_module_id,
|
||||
rlc_p->ue_module_id,
|
||||
rlc_p->rb_id,
|
||||
((struct rlc_um_data_req *) (sdu_pP->data))->data_size,
|
||||
rlc_p->buffer_occupancy,
|
||||
rlc_p->nb_sdu,
|
||||
rlc_p->current_sdu_index,
|
||||
rlc_p->next_sdu_index);
|
||||
|
||||
/*#ifndef USER_MODE
|
||||
rlc_um_time_us = (unsigned long int)(rt_get_time_ns ()/(RTIME)1000);
|
||||
@@ -581,30 +626,43 @@ rlc_um_data_req (void *rlcP, u32_t frame, mem_block_t *sduP)
|
||||
min = (sec / 60) % 60;
|
||||
sec = sec % 60;
|
||||
usec = rlc_um_time_us % 1000000;
|
||||
msg ("[RLC_UM_LITE][RB %d] at time %2d:%2d.%6d\n", rlc->rb_id, min, sec , usec);
|
||||
msg ("[RLC_UM_LITE][RB %d] at time %2d:%2d.%6d\n", rlc_p->rb_id, min, sec , usec);
|
||||
#endif*/
|
||||
if (rlc->input_sdus[rlc->next_sdu_index] == NULL) {
|
||||
rlc->input_sdus[rlc->next_sdu_index] = sduP;
|
||||
if (rlc_p->input_sdus[rlc_p->next_sdu_index] == NULL) {
|
||||
rlc_p->input_sdus[rlc_p->next_sdu_index] = sdu_pP;
|
||||
// IMPORTANT : do not change order of affectations
|
||||
((struct rlc_um_tx_sdu_management *) (sduP->data))->sdu_size = ((struct rlc_um_data_req *) (sduP->data))->data_size;
|
||||
rlc->buffer_occupancy += ((struct rlc_um_tx_sdu_management *) (sduP->data))->sdu_size;
|
||||
rlc->nb_sdu += 1;
|
||||
((struct rlc_um_tx_sdu_management *) (sduP->data))->first_byte = (u8_t*)&sduP->data[sizeof (struct rlc_um_data_req_alloc)];
|
||||
((struct rlc_um_tx_sdu_management *) (sduP->data))->sdu_remaining_size = ((struct rlc_um_tx_sdu_management *)
|
||||
(sduP->data))->sdu_size;
|
||||
((struct rlc_um_tx_sdu_management *) (sduP->data))->sdu_segmented_size = 0;
|
||||
((struct rlc_um_tx_sdu_management *) (sduP->data))->sdu_creation_time = frame;
|
||||
rlc->next_sdu_index = (rlc->next_sdu_index + 1) % rlc->size_input_sdus_buffer;
|
||||
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size = ((struct rlc_um_data_req *) (sdu_pP->data))->data_size;
|
||||
rlc_p->buffer_occupancy += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size;
|
||||
rlc_p->nb_sdu += 1;
|
||||
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->first_byte = (u8_t*)&sdu_pP->data[sizeof (struct rlc_um_data_req_alloc)];
|
||||
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_remaining_size = ((struct rlc_um_tx_sdu_management *)
|
||||
(sdu_pP->data))->sdu_size;
|
||||
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_segmented_size = 0;
|
||||
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_creation_time = frameP;
|
||||
rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer;
|
||||
|
||||
rlc->stat_tx_pdcp_sdu += 1;
|
||||
rlc->stat_tx_pdcp_bytes += ((struct rlc_um_tx_sdu_management *) (sduP->data))->sdu_size;
|
||||
rlc_p->stat_tx_pdcp_sdu += 1;
|
||||
rlc_p->stat_tx_pdcp_bytes += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size;
|
||||
|
||||
} else {
|
||||
LOG_W(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] RLC-UM_DATA_REQ input buffer full SDU garbaged\n",rlc->module_id, rlc->rb_id, frame);
|
||||
rlc->stat_tx_pdcp_sdu += 1;
|
||||
rlc->stat_tx_pdcp_bytes += ((struct rlc_um_tx_sdu_management *) (sduP->data))->sdu_size;
|
||||
rlc->stat_tx_pdcp_sdu_discarded += 1;
|
||||
rlc->stat_tx_pdcp_bytes_discarded += ((struct rlc_um_tx_sdu_management *) (sduP->data))->sdu_size;
|
||||
free_mem_block (sduP);
|
||||
LOG_W(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] RLC-UM_DATA_REQ input buffer full SDU garbaged\n",
|
||||
frameP,
|
||||
(rlc_p->is_enb) ? "eNB" : "UE",
|
||||
rlc_p->enb_module_id,
|
||||
rlc_p->ue_module_id,
|
||||
rlc_p->rb_id);
|
||||
rlc_p->stat_tx_pdcp_sdu += 1;
|
||||
rlc_p->stat_tx_pdcp_bytes += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size;
|
||||
rlc_p->stat_tx_pdcp_sdu_discarded += 1;
|
||||
rlc_p->stat_tx_pdcp_bytes_discarded += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size;
|
||||
free_mem_block (sdu_pP);
|
||||
#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD)
|
||||
AssertFatal(0, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RLC_UM_DATA_REQ, SDU DROPPED, INPUT BUFFER OVERFLOW\n",
|
||||
frameP,
|
||||
(rlc_p->is_enb) ? "eNB" : "UE",
|
||||
rlc_p->enb_module_id,
|
||||
rlc_p->ue_module_id,
|
||||
rlc_p->rb_id);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ Openair Tech : openair_tech@eurecom.fr
|
||||
Forums : http://forums.eurecom.fsr/openairinterface
|
||||
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
|
||||
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
#define RLC_UM_MODULE
|
||||
#define RLC_UM_CONTROL_PRIMITIVES_C
|
||||
//#include "rtos_header.h"
|
||||
@@ -42,270 +42,344 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#include "T-Reordering.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void config_req_rlc_um (rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rlc_um_info_t * config_umP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
void config_req_rlc_um (frame_t frameP,
|
||||
eNB_flag_t eNB_flagP,
|
||||
module_id_t enb_module_idP,
|
||||
module_id_t ue_module_idP,
|
||||
rlc_um_info_t *config_um_pP,
|
||||
rb_id_t rb_idP,
|
||||
rb_type_t rb_typeP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_%s][MOD %02d][][--- CONFIG_REQ timer_reordering=%d sn_field_length=%d is_mXch=%d --->][RLC_UM][MOD %02d][RB %02d] \n",
|
||||
frame,
|
||||
( eNB_flagP == 1) ? "eNB":"UE",
|
||||
module_idP,
|
||||
config_umP->timer_reordering,
|
||||
config_umP->sn_field_length,
|
||||
config_umP->is_mXch,
|
||||
module_idP,
|
||||
rb_idP);
|
||||
rlc_um_init(rlcP);
|
||||
if (rlc_um_fsm_notify_event (rlcP, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) {
|
||||
rlc_um_set_debug_infos(rlcP, frame, eNB_flagP, module_idP, rb_idP, rb_typeP);
|
||||
rlc_um_configure(rlcP,
|
||||
frame,
|
||||
config_umP->timer_reordering,
|
||||
config_umP->sn_field_length,
|
||||
config_umP->sn_field_length,
|
||||
config_umP->is_mXch);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
rlc_um_entity_t *rlc = NULL;
|
||||
|
||||
if (eNB_flagP) {
|
||||
rlc = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.um;
|
||||
} else {
|
||||
rlc = &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",
|
||||
frame,
|
||||
(eNB_flagP) ? "eNB" : "UE",
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
config_um_pP->timer_reordering,
|
||||
config_um_pP->sn_field_length,
|
||||
config_um_pP->is_mXch,
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
rb_idP);
|
||||
|
||||
rlc_um_init(rlc);
|
||||
if (rlc_um_fsm_notify_event (rlc, 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_configure(rlc,
|
||||
frame,
|
||||
config_um_pP->timer_reordering,
|
||||
config_um_pP->sn_field_length,
|
||||
config_um_pP->sn_field_length,
|
||||
config_um_pP->is_mXch);
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
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 (rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, u8_t mbms_flagP, module_id_t module_idP, UL_UM_RLC_t* ul_rlcP, DL_UM_RLC_t* dl_rlcP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
void config_req_rlc_um_asn1 (frame_t frameP,
|
||||
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_rlc_pP,
|
||||
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 dl_sn_FieldLength = 0;
|
||||
u32_t t_Reordering;
|
||||
u32_t ul_sn_FieldLength = 0;
|
||||
u32_t dl_sn_FieldLength = 0;
|
||||
u32_t t_Reordering;
|
||||
rlc_um_entity_t *rlc = NULL;
|
||||
|
||||
if (eNB_flagP) {
|
||||
rlc = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.um;
|
||||
} else {
|
||||
rlc = &rlc_array_ue[ue_module_idP][rb_idP].rlc.um;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_%s][MOD %02d][][--- CONFIG_REQ timer_reordering=%dms sn_field_length= --->][RLC_UM][MOD %02d][RB %02d] \n",
|
||||
frame,
|
||||
( eNB_flagP == 1) ? "eNB":"UE",
|
||||
module_idP,
|
||||
(dl_rlcP->t_Reordering<31)?t_Reordering_tab[dl_rlcP->t_Reordering]:-1,
|
||||
// (ul_rlcP->sn_FieldLength<2)?(5*(1+ul_rlcP->sn_FieldLength)):-1,
|
||||
module_idP,
|
||||
rb_idP);
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ timer_reordering=%dms sn_field_length= --->][RLC_UM][MOD %u/%u][RB %u] \n",
|
||||
frame,
|
||||
(eNB_flagP) ? "eNB" : "UE",
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
(dl_rlc_pP->t_Reordering<31)?t_Reordering_tab[dl_rlc_pP->t_Reordering]:-1,
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
rb_idP);
|
||||
|
||||
rlc_um_init(rlcP);
|
||||
if (rlc_um_fsm_notify_event (rlcP, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) {
|
||||
rlc_um_set_debug_infos(rlcP, frame, eNB_flagP, module_idP, rb_idP, rb_typeP);
|
||||
if (ul_rlcP != NULL) {
|
||||
switch (ul_rlcP->sn_FieldLength) {
|
||||
rlc_um_init(rlc);
|
||||
if (rlc_um_fsm_notify_event (rlc, 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);
|
||||
if (ul_rlc_pP != NULL) {
|
||||
switch (ul_rlc_pP->sn_FieldLength) {
|
||||
case SN_FieldLength_size5:
|
||||
ul_sn_FieldLength = 5;
|
||||
break;
|
||||
ul_sn_FieldLength = 5;
|
||||
break;
|
||||
case SN_FieldLength_size10:
|
||||
ul_sn_FieldLength = 10;
|
||||
break;
|
||||
ul_sn_FieldLength = 10;
|
||||
break;
|
||||
default:
|
||||
LOG_E(RLC,"[FRAME %05d][RLC_UM][MOD %02d][RB %02d][CONFIGURE] INVALID Uplink sn_FieldLength %d, RLC NOT CONFIGURED\n",
|
||||
frame, rlcP->module_id, rlcP->rb_id, ul_rlcP->sn_FieldLength);
|
||||
return;
|
||||
LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID Uplink sn_FieldLength %d, RLC NOT CONFIGURED\n",
|
||||
frame,
|
||||
(rlc->is_enb) ? "eNB" : "UE",
|
||||
rlc->enb_module_id,
|
||||
rlc->ue_module_id,
|
||||
rlc->rb_id,
|
||||
ul_rlc_pP->sn_FieldLength);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (dl_rlcP != NULL) {
|
||||
switch (dl_rlcP->sn_FieldLength) {
|
||||
|
||||
if (dl_rlc_pP != NULL) {
|
||||
switch (dl_rlc_pP->sn_FieldLength) {
|
||||
case SN_FieldLength_size5:
|
||||
dl_sn_FieldLength = 5;
|
||||
break;
|
||||
dl_sn_FieldLength = 5;
|
||||
break;
|
||||
case SN_FieldLength_size10:
|
||||
dl_sn_FieldLength = 10;
|
||||
break;
|
||||
dl_sn_FieldLength = 10;
|
||||
break;
|
||||
default:
|
||||
LOG_E(RLC,"[FRAME %05d][RLC_UM][MOD %02d][RB %02d][CONFIGURE] INVALID Downlink sn_FieldLength %d, RLC NOT CONFIGURED\n",
|
||||
frame, rlcP->module_id, rlcP->rb_id, dl_rlcP->sn_FieldLength);
|
||||
return;
|
||||
}
|
||||
if (dl_rlcP->t_Reordering<T_Reordering_spare1) {
|
||||
t_Reordering = t_Reordering_tab[dl_rlcP->t_Reordering];
|
||||
} else {
|
||||
LOG_E(RLC,"[FRAME %05d][RLC_UM][MOD %02d][RB %02d][CONFIGURE] INVALID T_Reordering %d, RLC NOT CONFIGURED\n",
|
||||
frame, rlcP->module_id, rlcP->rb_id, dl_rlcP->t_Reordering);
|
||||
LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID Downlink sn_FieldLength %d, RLC NOT CONFIGURED\n",
|
||||
frame,
|
||||
(rlc->is_enb) ? "eNB" : "UE",
|
||||
rlc->enb_module_id,
|
||||
rlc->ue_module_id,
|
||||
rlc->rb_id,
|
||||
dl_rlc_pP->sn_FieldLength);
|
||||
return;
|
||||
}
|
||||
if (dl_rlc_pP->t_Reordering<T_Reordering_spare1) {
|
||||
t_Reordering = t_Reordering_tab[dl_rlc_pP->t_Reordering];
|
||||
} else {
|
||||
LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID T_Reordering %d, RLC NOT CONFIGURED\n",
|
||||
frame,
|
||||
(rlc->is_enb) ? "eNB" : "UE",
|
||||
rlc->enb_module_id,
|
||||
rlc->ue_module_id,
|
||||
rlc->rb_id,
|
||||
dl_rlc_pP->t_Reordering);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (eNB_flagP > 0) {
|
||||
rlc_um_configure(rlcP,
|
||||
frame,
|
||||
t_Reordering,
|
||||
ul_sn_FieldLength,
|
||||
dl_sn_FieldLength,
|
||||
mbms_flagP);
|
||||
rlc_um_configure(rlc,
|
||||
frame,
|
||||
t_Reordering,
|
||||
ul_sn_FieldLength,
|
||||
dl_sn_FieldLength,
|
||||
mbms_flagP);
|
||||
} else {
|
||||
rlc_um_configure(rlcP,
|
||||
frame,
|
||||
t_Reordering,
|
||||
dl_sn_FieldLength,
|
||||
ul_sn_FieldLength,
|
||||
mbms_flagP);
|
||||
rlc_um_configure(rlc,
|
||||
frame,
|
||||
t_Reordering,
|
||||
dl_sn_FieldLength,
|
||||
ul_sn_FieldLength,
|
||||
mbms_flagP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_um_init (rlc_um_entity_t *rlcP)
|
||||
rlc_um_init (rlc_um_entity_t *rlc_pP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int saved_allocation = rlcP->allocation;
|
||||
memset (rlcP, 0, sizeof (rlc_um_entity_t));
|
||||
rlcP->allocation = saved_allocation;
|
||||
int saved_allocation = rlc_pP->allocation;
|
||||
memset (rlc_pP, 0, sizeof (rlc_um_entity_t));
|
||||
rlc_pP->allocation = saved_allocation;
|
||||
// TX SIDE
|
||||
list_init (&rlcP->pdus_to_mac_layer, NULL);
|
||||
list_init (&rlc_pP->pdus_to_mac_layer, NULL);
|
||||
|
||||
rlcP->protocol_state = RLC_NULL_STATE;
|
||||
//rlcP->nb_sdu = 0;
|
||||
//rlcP->next_sdu_index = 0;
|
||||
//rlcP->current_sdu_index = 0;
|
||||
rlc_pP->protocol_state = RLC_NULL_STATE;
|
||||
//rlc_pP->nb_sdu = 0;
|
||||
//rlc_pP->next_sdu_index = 0;
|
||||
//rlc_pP->current_sdu_index = 0;
|
||||
|
||||
//rlcP->vt_us = 0;
|
||||
//rlc_pP->vt_us = 0;
|
||||
|
||||
// RX SIDE
|
||||
list_init (&rlcP->pdus_from_mac_layer, NULL);
|
||||
//rlcP->vr_ur = 0;
|
||||
//rlcP->vr_ux = 0;
|
||||
//rlcP->vr_uh = 0;
|
||||
//rlcP->output_sdu_size_to_write = 0;
|
||||
//rlcP->output_sdu_in_construction = NULL;
|
||||
list_init (&rlc_pP->pdus_from_mac_layer, NULL);
|
||||
//rlc_pP->vr_ur = 0;
|
||||
//rlc_pP->vr_ux = 0;
|
||||
//rlc_pP->vr_uh = 0;
|
||||
//rlc_pP->output_sdu_size_to_write = 0;
|
||||
//rlc_pP->output_sdu_in_construction = NULL;
|
||||
|
||||
rlcP->rx_sn_length = 10;
|
||||
rlcP->rx_header_min_length_in_bytes = 2;
|
||||
rlcP->tx_sn_length = 10;
|
||||
rlcP->tx_header_min_length_in_bytes = 2;
|
||||
rlc_pP->rx_sn_length = 10;
|
||||
rlc_pP->rx_header_min_length_in_bytes = 2;
|
||||
rlc_pP->tx_sn_length = 10;
|
||||
rlc_pP->tx_header_min_length_in_bytes = 2;
|
||||
|
||||
// SPARE : not 3GPP
|
||||
rlcP->size_input_sdus_buffer =128;
|
||||
rlc_pP->size_input_sdus_buffer =128;
|
||||
|
||||
if ((rlcP->input_sdus_alloc == NULL) && (rlcP->size_input_sdus_buffer > 0)) {
|
||||
rlcP->input_sdus_alloc = get_free_mem_block (rlcP->size_input_sdus_buffer * sizeof (void *));
|
||||
rlcP->input_sdus = (mem_block_t **) (rlcP->input_sdus_alloc->data);
|
||||
memset (rlcP->input_sdus, 0, rlcP->size_input_sdus_buffer * sizeof (void *));
|
||||
if ((rlc_pP->input_sdus_alloc == NULL) && (rlc_pP->size_input_sdus_buffer > 0)) {
|
||||
rlc_pP->input_sdus_alloc = get_free_mem_block (rlc_pP->size_input_sdus_buffer * sizeof (void *));
|
||||
rlc_pP->input_sdus = (mem_block_t **) (rlc_pP->input_sdus_alloc->data);
|
||||
memset (rlc_pP->input_sdus, 0, rlc_pP->size_input_sdus_buffer * sizeof (void *));
|
||||
}
|
||||
if (rlcP->dar_buffer_alloc == NULL) {
|
||||
rlcP->dar_buffer_alloc = get_free_mem_block (1024 * sizeof (void *));
|
||||
rlcP->dar_buffer = (mem_block_t **) (rlcP->dar_buffer_alloc->data);
|
||||
memset (rlcP->dar_buffer, 0, 1024 * sizeof (void *));
|
||||
if (rlc_pP->dar_buffer_alloc == NULL) {
|
||||
rlc_pP->dar_buffer_alloc = get_free_mem_block (1024 * sizeof (void *));
|
||||
rlc_pP->dar_buffer = (mem_block_t **) (rlc_pP->dar_buffer_alloc->data);
|
||||
memset (rlc_pP->dar_buffer, 0, 1024 * sizeof (void *));
|
||||
}
|
||||
|
||||
rlcP->first_pdu = 1;
|
||||
rlc_pP->first_pdu = 1;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_um_reset_state_variables (rlc_um_entity_t *rlcP)
|
||||
rlc_um_reset_state_variables (rlc_um_entity_t *rlc_pP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
rlcP->buffer_occupancy = 0;
|
||||
rlcP->nb_sdu = 0;
|
||||
rlcP->next_sdu_index = 0;
|
||||
rlcP->current_sdu_index = 0;
|
||||
//-----------------------------------------------------------------------------
|
||||
rlc_pP->buffer_occupancy = 0;
|
||||
rlc_pP->nb_sdu = 0;
|
||||
rlc_pP->next_sdu_index = 0;
|
||||
rlc_pP->current_sdu_index = 0;
|
||||
|
||||
// TX SIDE
|
||||
rlcP->vt_us = 0;
|
||||
rlc_pP->vt_us = 0;
|
||||
// RX SIDE
|
||||
rlcP->vr_ur = 0;
|
||||
rlcP->vr_ux = 0;
|
||||
rlcP->vr_uh = 0;
|
||||
rlc_pP->vr_ur = 0;
|
||||
rlc_pP->vr_ux = 0;
|
||||
rlc_pP->vr_uh = 0;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_um_cleanup (rlc_um_entity_t *rlcP)
|
||||
rlc_um_cleanup (rlc_um_entity_t *rlc_pP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
int index;
|
||||
// TX SIDE
|
||||
list_free (&rlcP->pdus_to_mac_layer);
|
||||
list_free (&rlc_pP->pdus_to_mac_layer);
|
||||
|
||||
if (rlcP->input_sdus_alloc) {
|
||||
for (index = 0; index < rlcP->size_input_sdus_buffer; index++) {
|
||||
if (rlcP->input_sdus[index]) {
|
||||
free_mem_block (rlcP->input_sdus[index]);
|
||||
if (rlc_pP->input_sdus_alloc) {
|
||||
for (index = 0; index < rlc_pP->size_input_sdus_buffer; index++) {
|
||||
if (rlc_pP->input_sdus[index]) {
|
||||
free_mem_block (rlc_pP->input_sdus[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
free_mem_block (rlcP->input_sdus_alloc);
|
||||
rlcP->input_sdus_alloc = NULL;
|
||||
free_mem_block (rlc_pP->input_sdus_alloc);
|
||||
rlc_pP->input_sdus_alloc = NULL;
|
||||
}
|
||||
// RX SIDE
|
||||
list_free (&rlcP->pdus_from_mac_layer);
|
||||
if ((rlcP->output_sdu_in_construction)) {
|
||||
free_mem_block (rlcP->output_sdu_in_construction);
|
||||
list_free (&rlc_pP->pdus_from_mac_layer);
|
||||
if ((rlc_pP->output_sdu_in_construction)) {
|
||||
free_mem_block (rlc_pP->output_sdu_in_construction);
|
||||
}
|
||||
if (rlcP->dar_buffer_alloc) {
|
||||
for (index = 0; index < 1024; index++) {
|
||||
if (rlcP->dar_buffer[index]) {
|
||||
free_mem_block (rlcP->dar_buffer[index]);
|
||||
if (rlc_pP->dar_buffer_alloc) {
|
||||
for (index = 0; index < 1024; index++) {
|
||||
if (rlc_pP->dar_buffer[index]) {
|
||||
free_mem_block (rlc_pP->dar_buffer[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
free_mem_block (rlcP->dar_buffer_alloc);
|
||||
rlcP->dar_buffer_alloc = NULL;
|
||||
free_mem_block (rlc_pP->dar_buffer_alloc);
|
||||
rlc_pP->dar_buffer_alloc = NULL;
|
||||
}
|
||||
memset(rlc_pP, 0, sizeof(rlc_um_entity_t));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_um_configure(rlc_um_entity_t *rlcP,
|
||||
u32_t frame,
|
||||
u32_t timer_reorderingP,
|
||||
u32_t rx_sn_field_lengthP,
|
||||
u32_t tx_sn_field_lengthP,
|
||||
u32_t is_mXchP)
|
||||
void rlc_um_configure(rlc_um_entity_t *rlc_pP,
|
||||
frame_t frameP,
|
||||
u32_t timer_reorderingP,
|
||||
u32_t rx_sn_field_lengthP,
|
||||
u32_t tx_sn_field_lengthP,
|
||||
u32_t is_mXchP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
if (rx_sn_field_lengthP == 10) {
|
||||
rlcP->rx_sn_length = 10;
|
||||
rlcP->rx_sn_modulo = RLC_UM_SN_10_BITS_MODULO;
|
||||
rlcP->rx_um_window_size = RLC_UM_WINDOW_SIZE_SN_10_BITS;
|
||||
rlcP->rx_header_min_length_in_bytes = 2;
|
||||
} else if (rx_sn_field_lengthP == 5) {
|
||||
rlcP->rx_sn_length = 5;
|
||||
rlcP->rx_sn_modulo = RLC_UM_SN_5_BITS_MODULO;
|
||||
rlcP->rx_um_window_size = RLC_UM_WINDOW_SIZE_SN_5_BITS;
|
||||
rlcP->rx_header_min_length_in_bytes = 1;
|
||||
} else if (rx_sn_field_lengthP != 0) {
|
||||
LOG_E(RLC, "[FRAME %05d][RLC_UM][MOD %02d][RB %02d][CONFIGURE] INVALID RX SN LENGTH %d BITS NOT IMPLEMENTED YET, RLC NOT CONFIGURED\n", frame, rlcP->module_id, rlcP->rb_id, rx_sn_field_lengthP);
|
||||
return;
|
||||
}
|
||||
if (rx_sn_field_lengthP == 10) {
|
||||
rlc_pP->rx_sn_length = 10;
|
||||
rlc_pP->rx_sn_modulo = RLC_UM_SN_10_BITS_MODULO;
|
||||
rlc_pP->rx_um_window_size = RLC_UM_WINDOW_SIZE_SN_10_BITS;
|
||||
rlc_pP->rx_header_min_length_in_bytes = 2;
|
||||
} else if (rx_sn_field_lengthP == 5) {
|
||||
rlc_pP->rx_sn_length = 5;
|
||||
rlc_pP->rx_sn_modulo = RLC_UM_SN_5_BITS_MODULO;
|
||||
rlc_pP->rx_um_window_size = RLC_UM_WINDOW_SIZE_SN_5_BITS;
|
||||
rlc_pP->rx_header_min_length_in_bytes = 1;
|
||||
} else if (rx_sn_field_lengthP != 0) {
|
||||
LOG_E(RLC, "[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID RX SN LENGTH %d BITS NOT IMPLEMENTED YET, RLC NOT CONFIGURED\n",
|
||||
frame,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rx_sn_field_lengthP);
|
||||
return;
|
||||
}
|
||||
|
||||
if (tx_sn_field_lengthP == 10) {
|
||||
rlcP->tx_sn_length = 10;
|
||||
rlcP->tx_sn_modulo = RLC_UM_SN_10_BITS_MODULO;
|
||||
rlcP->tx_um_window_size = RLC_UM_WINDOW_SIZE_SN_10_BITS;
|
||||
rlcP->tx_header_min_length_in_bytes = 2;
|
||||
} else if (tx_sn_field_lengthP == 5) {
|
||||
rlcP->tx_sn_length = 5;
|
||||
rlcP->tx_sn_modulo = RLC_UM_SN_5_BITS_MODULO;
|
||||
rlcP->tx_um_window_size = RLC_UM_WINDOW_SIZE_SN_5_BITS;
|
||||
rlcP->tx_header_min_length_in_bytes = 1;
|
||||
} else if (tx_sn_field_lengthP != 0) {
|
||||
LOG_E(RLC, "[FRAME %05d][RLC_UM][MOD %02d][RB %02d][CONFIGURE] INVALID RX SN LENGTH %d BITS NOT IMPLEMENTED YET, RLC NOT CONFIGURED\n", frame, rlcP->module_id, rlcP->rb_id, tx_sn_field_lengthP);
|
||||
return;
|
||||
}
|
||||
if (tx_sn_field_lengthP == 10) {
|
||||
rlc_pP->tx_sn_length = 10;
|
||||
rlc_pP->tx_sn_modulo = RLC_UM_SN_10_BITS_MODULO;
|
||||
rlc_pP->tx_um_window_size = RLC_UM_WINDOW_SIZE_SN_10_BITS;
|
||||
rlc_pP->tx_header_min_length_in_bytes = 2;
|
||||
} else if (tx_sn_field_lengthP == 5) {
|
||||
rlc_pP->tx_sn_length = 5;
|
||||
rlc_pP->tx_sn_modulo = RLC_UM_SN_5_BITS_MODULO;
|
||||
rlc_pP->tx_um_window_size = RLC_UM_WINDOW_SIZE_SN_5_BITS;
|
||||
rlc_pP->tx_header_min_length_in_bytes = 1;
|
||||
} else if (tx_sn_field_lengthP != 0) {
|
||||
LOG_E(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02d/%02][RB %u][CONFIGURE] INVALID RX SN LENGTH %d BITS NOT IMPLEMENTED YET, RLC NOT CONFIGURED\n",
|
||||
frame,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
tx_sn_field_lengthP);
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_mXchP > 0) {
|
||||
rlcP->tx_um_window_size = 0;
|
||||
rlcP->rx_um_window_size = 0;
|
||||
}
|
||||
rlcP->is_mxch = is_mXchP;
|
||||
if (is_mXchP > 0) {
|
||||
rlc_pP->tx_um_window_size = 0;
|
||||
rlc_pP->rx_um_window_size = 0;
|
||||
}
|
||||
rlc_pP->is_mxch = is_mXchP;
|
||||
|
||||
rlcP->last_reassemblied_sn = rlcP->rx_sn_modulo - 1;
|
||||
rlcP->last_reassemblied_missing_sn = rlcP->rx_sn_modulo - 1;
|
||||
rlcP->reassembly_missing_sn_detected = 0;
|
||||
// timers
|
||||
rlc_um_init_timer_reordering(rlcP, timer_reorderingP);
|
||||
rlc_pP->last_reassemblied_sn = rlc_pP->rx_sn_modulo - 1;
|
||||
rlc_pP->last_reassemblied_missing_sn = rlc_pP->rx_sn_modulo - 1;
|
||||
rlc_pP->reassembly_missing_sn_detected = 0;
|
||||
// timers
|
||||
rlc_um_init_timer_reordering(rlc_pP, timer_reorderingP);
|
||||
|
||||
rlcP->first_pdu = 1;
|
||||
rlc_pP->first_pdu = 1;
|
||||
|
||||
rlc_um_reset_state_variables (rlcP);
|
||||
rlc_um_reset_state_variables (rlc_pP);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_um_set_debug_infos(rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
void rlc_um_set_debug_infos(rlc_um_entity_t *rlc_pP,
|
||||
frame_t frameP,
|
||||
eNB_flag_t eNB_flagP,
|
||||
module_id_t enb_module_idP,
|
||||
module_id_t ue_module_idP,
|
||||
rb_id_t rb_idP,
|
||||
rb_type_t rb_typeP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
LOG_D(RLC, "[FRAME %05d][RLC_UM][MOD %02d][RB %02d][SET DEBUG INFOS] module_id %d rb_id %d rb_type %d\n", frame, module_idP, rb_idP, module_idP, rb_idP, rb_typeP);
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][SET DEBUG INFOS] enb_module_id %u ue_module_id %u rb_id %d rb_type %d\n",
|
||||
frame,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
eNB_flagP,
|
||||
enb_module_idP,
|
||||
ue_module_idP,
|
||||
rb_idP,
|
||||
rb_typeP);
|
||||
|
||||
rlcP->module_id = module_idP;
|
||||
rlcP->rb_id = rb_idP;
|
||||
if (rb_typeP != SIGNALLING_RADIO_BEARER) {
|
||||
rlcP->is_data_plane = 1;
|
||||
} else {
|
||||
rlcP->is_data_plane = 0;
|
||||
}
|
||||
rlcP->is_enb = eNB_flagP;
|
||||
rlc_pP->enb_module_id = enb_module_idP;
|
||||
rlc_pP->ue_module_id = ue_module_idP;
|
||||
rlc_pP->rb_id = rb_idP;
|
||||
if (rb_typeP != SIGNALLING_RADIO_BEARER) {
|
||||
rlc_pP->is_data_plane = 1;
|
||||
} else {
|
||||
rlc_pP->is_data_plane = 0;
|
||||
}
|
||||
rlc_pP->is_enb = eNB_flagP;
|
||||
}
|
||||
|
||||
@@ -76,31 +76,31 @@ typedef volatile struct {
|
||||
} rlc_um_info_t;
|
||||
|
||||
|
||||
/*! \fn void config_req_rlc_um (rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rlc_um_info_t * config_umP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
/*! \fn 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)
|
||||
* \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] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] enb_module_idP eNB Virtualized module identifier.
|
||||
* \param[in] ue_module_idP UE Virtualized module identifier.
|
||||
* \param[in] config_umP Configuration parameters for RLC UM instance.
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
|
||||
*/
|
||||
public_rlc_um_control_primitives( void config_req_rlc_um (rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t 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 (rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, u8_t mbms_flagP, module_id_t 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, 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)
|
||||
* \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] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] mbms_flagP Flag to indicate if this RLC is configured for MBMS.
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] enb_module_idP eNB Virtualized module identifier.
|
||||
* \param[in] ue_module_idP UE Virtualized module identifier.
|
||||
* \param[in] ul_rlcP Configuration parameters for RLC UM UL instance.
|
||||
* \param[in] dl_rlcP Configuration parameters for RLC UM DL instance.
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
|
||||
*/
|
||||
public_rlc_um_control_primitives( void config_req_rlc_um_asn1 (rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, u8_t mbms_flagP, module_id_t 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 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 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.
|
||||
@@ -120,7 +120,7 @@ protected_rlc_um_control_primitives(void rlc_um_reset_state_variables (rlc_um_en
|
||||
*/
|
||||
public_rlc_um_control_primitives( void rlc_um_cleanup(rlc_um_entity_t *rlcP);)
|
||||
|
||||
/*! \fn void rlc_um_configure(rlc_um_entity_t *rlcP, u32_t frame, u32_t timer_reorderingP, u32_t rx_sn_field_lengthP, u32_t tx_sn_field_lengthP, u32_t is_mXchP)
|
||||
/*! \fn void rlc_um_configure(rlc_um_entity_t *rlcP, frame_t frame, u32_t timer_reorderingP, u32_t rx_sn_field_lengthP, u32_t tx_sn_field_lengthP, u32_t is_mXchP)
|
||||
* \brief Configure RLC UM protocol parameters.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
@@ -129,17 +129,18 @@ public_rlc_um_control_primitives( void rlc_um_cleanup(rlc_um_entity_t *rlcP);)
|
||||
* \param[in] tx_sn_field_lengthP Length of the sequence number, 5 or 10 bits in transmission.
|
||||
* \param[in] is_mXchP Is the radio bearer for MCCH, MTCH.
|
||||
*/
|
||||
protected_rlc_um_control_primitives(void rlc_um_configure(rlc_um_entity_t *rlcP, u32_t frame, u32_t timer_reorderingP, u32_t rx_sn_field_lengthP, u32_t tx_sn_field_lengthP, u32_t is_mXchP);)
|
||||
protected_rlc_um_control_primitives(void rlc_um_configure(rlc_um_entity_t *rlcP, frame_t frame, u32_t timer_reorderingP, u32_t rx_sn_field_lengthP, u32_t tx_sn_field_lengthP, u32_t is_mXchP);)
|
||||
|
||||
/*! \fn void rlc_um_set_debug_infos(rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
/*! \fn void rlc_um_set_debug_infos(rlc_um_entity_t *rlcP, frame_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
|
||||
* \brief Set debug informations for a RLC UM protocol instance, these informations are only for trace purpose.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] enb_module_idP eNB Virtualized module identifier.
|
||||
* \param[in] ue_module_idP UE Virtualized module identifier.
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
|
||||
*/
|
||||
protected_rlc_um_control_primitives(void rlc_um_set_debug_infos(rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rb_id_t rb_idP, rb_type_t rb_typeP);)
|
||||
protected_rlc_um_control_primitives(void rlc_um_set_debug_infos(rlc_um_entity_t *rlcP, frame_t frame, eNB_flag_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP);)
|
||||
/** @} */
|
||||
# endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -62,119 +62,119 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# define public_rlc_um_dar(x) extern x
|
||||
# endif
|
||||
# endif
|
||||
/*! \fn signed int rlc_um_get_pdu_infos(u32_t frame,rlc_um_pdu_sn_10_t* headerP, s16_t total_sizeP, rlc_um_pdu_info_t* pdu_infoP)
|
||||
/*! \fn signed int rlc_um_get_pdu_infos(frame_t frameP,rlc_um_pdu_sn_10_t* header_pP, s16_t total_sizeP, rlc_um_pdu_info_t* pdu_info_pP, u8_t sn_lengthP)
|
||||
* \brief Extract PDU informations (header fields, data size, etc) from the serialized PDU.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] headerP RLC UM header PDU pointer.
|
||||
* \param[in] total_sizeP Size of RLC UM PDU.
|
||||
* \param[in] pdu_infoP Structure containing extracted informations from PDU.
|
||||
* \param[in] sn_lengthP Sequence number length in bits in PDU header (5 or 10).
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] header_pP RLC UM header PDU pointer.
|
||||
* \param[in] total_sizeP Size of RLC UM PDU.
|
||||
* \param[in] pdu_info_pP Structure containing extracted informations from PDU.
|
||||
* \param[in] sn_lengthP Sequence number length in bits in PDU header (5 or 10).
|
||||
* \return 0 if no error was encountered during the parsing of the PDU, else -1;
|
||||
*/
|
||||
protected_rlc_um_dar( signed int rlc_um_get_pdu_infos(u32_t frame, rlc_um_pdu_sn_10_t* headerP, s16_t total_sizeP, rlc_um_pdu_info_t* pdu_infoP, u8_t sn_lengthP));
|
||||
protected_rlc_um_dar( signed int rlc_um_get_pdu_infos(frame_t frameP, rlc_um_pdu_sn_10_t* header_pP, s16_t total_sizeP, rlc_um_pdu_info_t* pdu_info_pP, u8_t sn_lengthP));
|
||||
|
||||
/*! \fn int rlc_um_read_length_indicators(unsigned char**dataP, rlc_um_e_li_t* e_liP, unsigned int* li_arrayP, unsigned int *num_liP, unsigned int *data_sizeP)
|
||||
/*! \fn int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_li_pP, unsigned int* li_array_pP, unsigned int *num_li_pP, sdu_size_t *data_size_pP)
|
||||
* \brief Reset protocol variables and state variables to initial values.
|
||||
* \param[in,out] dataP Pointer on data payload.
|
||||
* \param[in] e_liP Pointer on first LI + e bit in PDU.
|
||||
* \param[in,out] li_arrayP Array containing read LI.
|
||||
* \param[in,out] num_liP Number of LI read.
|
||||
* \param[in,out] data_sizeP Pointer on data size.
|
||||
* \param[in,out] data_ppP Pointer on data payload.
|
||||
* \param[in] e_li_pP Pointer on first LI + e bit in PDU.
|
||||
* \param[in,out] li_array_pP Array containing read LI.
|
||||
* \param[in,out] num_li_pP Pointer on number of LI read.
|
||||
* \param[in,out] data_size_pP Pointer on data size.
|
||||
* \return 0 if no error was encountered during the parsing of the PDU, else -1;
|
||||
*/
|
||||
private_rlc_um_dar( int rlc_um_read_length_indicators(unsigned char**dataP, rlc_um_e_li_t* e_liP, unsigned int* li_arrayP, unsigned int *num_liP, unsigned int *data_sizeP));
|
||||
private_rlc_um_dar( int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_li_pP, unsigned int* li_array_pP, unsigned int *num_li_pP, sdu_size_t *data_size_pP));
|
||||
|
||||
/*! \fn void rlc_um_try_reassembly (rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flag, signed int start_snP, signed int end_snP)
|
||||
/*! \fn void rlc_um_try_reassembly (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, rlc_sn_t start_snP, rlc_sn_t end_snP)
|
||||
* \brief Try reassembly PDUs from DAR buffer, starting at sequence number snP.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0).
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0).
|
||||
* \param[in] start_snP First PDU to be reassemblied if possible.
|
||||
* \param[in] end_snP Last excluded highest sequence number of PDU to be reassemblied.
|
||||
*/
|
||||
private_rlc_um_dar( void rlc_um_try_reassembly (rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flag, signed int start_snP, signed int end_snP));
|
||||
private_rlc_um_dar( void rlc_um_try_reassembly (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, rlc_sn_t start_snP, rlc_sn_t end_snP));
|
||||
|
||||
/*! \fn void rlc_um_check_timer_reordering(rlc_um_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_um_check_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Check if timer reordering has timed-out, if so it is stopped and has the status "timed-out".
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
* \param[in] frameP Frame index
|
||||
*/
|
||||
protected_rlc_um_dar(void rlc_um_check_timer_reordering(rlc_um_entity_t *rlcP,u32_t frame));
|
||||
protected_rlc_um_dar(void rlc_um_check_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP));
|
||||
|
||||
/*! \fn void rlc_um_stop_and_reset_timer_reordering(rlc_um_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_um_stop_and_reset_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Stop and reset the timer reordering.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
*/
|
||||
protected_rlc_um_dar(void rlc_um_stop_and_reset_timer_reordering(rlc_um_entity_t *rlcP,u32_t frame);)
|
||||
protected_rlc_um_dar(void rlc_um_stop_and_reset_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP);)
|
||||
|
||||
/*! \fn void rlc_um_start_timer_reordering(rlc_um_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_um_start_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP)
|
||||
* \brief Re-arm (based on RLC UM config parameter) and start timer reordering.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
*/
|
||||
protected_rlc_um_dar(void rlc_um_start_timer_reordering(rlc_um_entity_t *rlcP,u32_t frame);)
|
||||
protected_rlc_um_dar(void rlc_um_start_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP);)
|
||||
|
||||
/*! \fn void rlc_um_init_timer_reordering(rlc_um_entity_t *rlcP, u32_t time_outP)
|
||||
/*! \fn void rlc_um_init_timer_reordering(rlc_um_entity_t *rlc_pP, u32_t time_outP)
|
||||
* \brief Initialize the timer reordering with RLC UM time-out config parameter.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] time_outP Time-out in frame units.
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
* \param[in] time_outP Time-out in frameP units.
|
||||
*/
|
||||
protected_rlc_um_dar(void rlc_um_init_timer_reordering(rlc_um_entity_t *rlcP, u32_t time_outP);)
|
||||
protected_rlc_um_dar(void rlc_um_init_timer_reordering(rlc_um_entity_t *rlc_pP, u32_t time_outP);)
|
||||
|
||||
/*! \fn void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlcP,u32_t frame,u8_t eNB_flag)
|
||||
/*! \fn void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlc_pP,frame_t frameP,eNB_flag_t eNB_flagP)
|
||||
* \brief Check if t-Reordering expires and take the appropriate actions as described in 3GPP specifications.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB(1) or UE (1)
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] eNB_flagP Flag to indicate eNB(1) or UE (1)
|
||||
*/
|
||||
protected_rlc_um_dar( void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlcP,u32_t frame,u8_t eNB_flag));
|
||||
protected_rlc_um_dar( void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlc_pP,frame_t frameP,eNB_flag_t eNB_flagP));
|
||||
|
||||
/*! \fn mem_block_t *rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t *rlcP, u16_t snP)
|
||||
/*! \fn mem_block_t *rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t *rlc_pP, u16_t snP)
|
||||
* \brief Remove the PDU with sequence number snP from the DAR buffer and return it.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] snP Sequence number.
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
* \param[in] snP Sequence number.
|
||||
* \return The PDU stored in the DAR buffer having sequence number snP, else return NULL.
|
||||
*/
|
||||
private_rlc_um_dar( mem_block_t *rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t *rlcP, u16_t snP));
|
||||
private_rlc_um_dar( mem_block_t *rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t *rlc_pP, u16_t snP));
|
||||
|
||||
/*! \fn mem_block_t *rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t *rlcP, u16_t snP)
|
||||
/*! \fn mem_block_t *rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t *rlc_pP, u16_t snP)
|
||||
* \brief Get the PDU with sequence number snP from the DAR buffer.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] snP Sequence number.
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
* \param[in] snP Sequence number.
|
||||
* \return The PDU stored in the DAR buffer having sequence number snP, else return NULL.
|
||||
*/
|
||||
protected_rlc_um_dar( inline mem_block_t* rlc_um_get_pdu_from_dar_buffer(rlc_um_entity_t *rlcP, u16_t snP));
|
||||
protected_rlc_um_dar( inline mem_block_t* rlc_um_get_pdu_from_dar_buffer(rlc_um_entity_t *rlc_pP, u16_t snP));
|
||||
|
||||
/*! \fn signed int rlc_um_in_window(rlc_um_entity_t *rlcP, u32_t frame, signed int lower_boundP, signed int snP, signed int higher_boundP)
|
||||
/*! \fn signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t lower_boundP, rlc_sn_t snP, rlc_sn_t higher_boundP)
|
||||
* \brief Compute if the sequence number of a PDU is in a window .
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] lower_boundP Lower bound of a window.
|
||||
* \param[in] snP Sequence number of a theorical PDU.
|
||||
* \param[in] higher_boundP Higher bound of a window.
|
||||
* \return -2 if lower_boundP > sn, -1 if higher_boundP < sn, 0 if lower_boundP < sn < higher_boundP, 1 if lower_boundP == sn, 2 if higher_boundP == sn, 3 if higher_boundP == sn == lower_boundP.
|
||||
*/
|
||||
protected_rlc_um_dar(inline signed int rlc_um_in_window(rlc_um_entity_t *rlcP, u32_t frame, signed int lower_boundP, signed int snP, signed int higher_boundP));
|
||||
protected_rlc_um_dar(inline signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t lower_boundP, rlc_sn_t snP, rlc_sn_t higher_boundP));
|
||||
|
||||
/*! \fn signed int rlc_um_in_reordering_window(rlc_um_entity_t *rlcP, u32_t frame, signed int snP)
|
||||
/*! \fn signed int rlc_um_in_reordering_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP)
|
||||
* \brief Compute if the sequence number of a PDU is in a window .
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] snP Sequence number of a theorical PDU.
|
||||
* \return 0 if snP is in reordering window, else -1.
|
||||
*/
|
||||
protected_rlc_um_dar(inline signed int rlc_um_in_reordering_window(rlc_um_entity_t *rlcP, u32_t frame, signed int snP));
|
||||
protected_rlc_um_dar(inline signed int rlc_um_in_reordering_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP));
|
||||
|
||||
/*! \fn void rlc_um_receive_process_dar (rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flag, mem_block_t *pdu_memP,rlc_um_pdu_sn_10_t *pduP, u16_t tb_sizeP)
|
||||
/*! \fn void rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t *pdu_mem_pP,rlc_um_pdu_sn_10_t *pdu_pP, sdu_size_t tb_sizeP)
|
||||
* \brief Apply the DAR process for a PDU: put it in DAR buffer and try to reassembly or discard it.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicated eNB (1) or UE (0).
|
||||
* \param[in] pdu_memP mem_block_t wrapper for a UM PDU .
|
||||
* \param[in] pduP Pointer on the header of the UM PDU.
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] eNB_flagP Flag to indicated eNB (1) or UE (0).
|
||||
* \param[in] pdu_mem_pP mem_block_t wrapper for a UM PDU .
|
||||
* \param[in] pdu_pP Pointer on the header of the UM PDU.
|
||||
* \param[in] tb_sizeP Size of the UM PDU.
|
||||
*/
|
||||
protected_rlc_um_dar(void rlc_um_receive_process_dar (rlc_um_entity_t *rlcP, u32_t frame, u8_t eNB_flag, mem_block_t *pdu_memP,rlc_um_pdu_sn_10_t *pduP, u16_t tb_sizeP));
|
||||
protected_rlc_um_dar(void rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t *pdu_mem_pP,rlc_um_pdu_sn_10_t *pdu_pP, sdu_size_t tb_sizeP));
|
||||
/** @} */
|
||||
# endif
|
||||
|
||||
@@ -59,7 +59,8 @@ typedef struct rlc_um_timer {
|
||||
*/
|
||||
|
||||
typedef struct rlc_um_entity {
|
||||
module_id_t module_id; /*!< \brief Virtualization index for this protocol instance, means handset or eNB index.*/
|
||||
module_id_t enb_module_id; /*!< \brief eNB Virtualization index for this protocol instance, meaningful if is_enb is set. */
|
||||
module_id_t ue_module_id; /*!< \brief UE Virtualization index for this protocol instance. */
|
||||
u8_t allocation; /*!< \brief Boolean for rlc_am_entity_t struct allocation. */
|
||||
u8_t is_uplink_downlink; /*!< \brief Is this instance is a transmitter, a receiver or both? */
|
||||
u8_t protocol_state; /*!< \brief Protocol state, can be RLC_NULL_STATE, RLC_DATA_TRANSFER_READY_STATE, RLC_LOCAL_SUSPEND_STATE. */
|
||||
@@ -114,7 +115,8 @@ typedef struct rlc_um_entity {
|
||||
mem_block_t *dar_buffer_alloc; /*!< \brief Allocated memory for the DAR buffer. */
|
||||
list_t pdus_from_mac_layer; /*!< \brief Not Used. */
|
||||
|
||||
u16_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */
|
||||
logical_chan_id_t channel_id; /*!< \brief Transport channel identifier. */
|
||||
rb_id_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */
|
||||
u16_t last_reassemblied_sn; /*!< \brief Sequence number of the last reassemblied PDU. */
|
||||
u16_t last_reassemblied_missing_sn; /*!< \brief Sequence number of the last found missing PDU. */
|
||||
u16_t reassembly_missing_sn_detected; /*!< \brief Act as a boolean, set if a hole in the sequence numbering of received PDUs has been found. */
|
||||
|
||||
@@ -38,24 +38,33 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
rlc_um_fsm_notify_event (struct rlc_um_entity *rlcP, u8_t eventP)
|
||||
rlc_um_fsm_notify_event (struct rlc_um_entity *rlc_pP, u8_t eventP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
switch (rlcP->protocol_state) {
|
||||
switch (rlc_pP->protocol_state) {
|
||||
//-------------------------------
|
||||
// RLC_NULL_STATE
|
||||
//-------------------------------
|
||||
case RLC_NULL_STATE:
|
||||
switch (eventP) {
|
||||
case RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT:
|
||||
LOG_D(RLC, "[RLC_UM][MOD %d][RB %d] FSM RLC_NULL_STATE -> RLC_DATA_TRANSFER_READY_STATE\n", rlcP->module_id, rlcP->rb_id);
|
||||
rlcP->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
|
||||
LOG_D(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM RLC_NULL_STATE -> RLC_DATA_TRANSFER_READY_STATE\n",
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_pP->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
|
||||
return 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(RLC, "[RLC_UM][MOD %d][RB %d] FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM NULL_STATE\n", rlcP->module_id, rlcP->rb_id, eventP);
|
||||
LOG_E(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM NULL_STATE\n",
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
eventP);
|
||||
mac_xface->macphy_exit("");
|
||||
return 0;
|
||||
}
|
||||
@@ -66,20 +75,33 @@ rlc_um_fsm_notify_event (struct rlc_um_entity *rlcP, u8_t eventP)
|
||||
case RLC_DATA_TRANSFER_READY_STATE:
|
||||
switch (eventP) {
|
||||
case RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_NULL_STATE_EVENT:
|
||||
LOG_D(RLC, "[RLC_UM][MOD %d][RB %d] FSM RLC_DATA_TRANSFER_READY_STATE -> RLC_NULL_STATE\n", rlcP->module_id, rlcP->rb_id);
|
||||
rlcP->protocol_state = RLC_NULL_STATE;
|
||||
LOG_D(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM RLC_DATA_TRANSFER_READY_STATE -> RLC_NULL_STATE\n",
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_pP->protocol_state = RLC_NULL_STATE;
|
||||
return 1;
|
||||
break;
|
||||
|
||||
case RLC_UM_RECEIVE_CRLC_SUSPEND_REQ_EVENT:
|
||||
case RLC_UM_TRANSMIT_CRLC_SUSPEND_CNF_EVENT:
|
||||
LOG_N(RLC, "[RLC_UM][MOD %d][RB %d] FSM RLC_DATA_TRANSFER_READY_STATE -> RLC_LOCAL_SUSPEND_STATE\n", rlcP->module_id, rlcP->rb_id);
|
||||
rlcP->protocol_state = RLC_LOCAL_SUSPEND_STATE;
|
||||
LOG_N(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM RLC_DATA_TRANSFER_READY_STATE -> RLC_LOCAL_SUSPEND_STATE\n",
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_pP->protocol_state = RLC_LOCAL_SUSPEND_STATE;
|
||||
return 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(RLC, "[RLC_UM][MOD %d][RB %d] FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM DATA_TRANSFER_READY_STATE\n", rlcP->module_id, rlcP->rb_id, eventP);
|
||||
LOG_E(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM DATA_TRANSFER_READY_STATE\n",
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
eventP);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@@ -89,25 +111,43 @@ rlc_um_fsm_notify_event (struct rlc_um_entity *rlcP, u8_t eventP)
|
||||
case RLC_LOCAL_SUSPEND_STATE:
|
||||
switch (eventP) {
|
||||
case RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_NULL_STATE_EVENT:
|
||||
LOG_N(RLC, "[RLC_UM][MOD %d][RB %d] FSM RLC_LOCAL_SUSPEND_STATE -> RLC_NULL_STATE\n", rlcP->module_id, rlcP->rb_id);
|
||||
rlcP->protocol_state = RLC_NULL_STATE;
|
||||
LOG_N(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM RLC_LOCAL_SUSPEND_STATE -> RLC_NULL_STATE\n",
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_pP->protocol_state = RLC_NULL_STATE;
|
||||
return 1;
|
||||
break;
|
||||
|
||||
case RLC_UM_RECEIVE_CRLC_RESUME_REQ_EVENT:
|
||||
LOG_N(RLC, "[RLC_UM][MOD %d][RB %d] FSM RLC_LOCAL_SUSPEND_STATE -> RLC_DATA_TRANSFER_READY_STATE\n", rlcP->module_id, rlcP->rb_id);
|
||||
rlcP->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
|
||||
LOG_N(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM RLC_LOCAL_SUSPEND_STATE -> RLC_DATA_TRANSFER_READY_STATE\n",
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_pP->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
|
||||
return 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(RLC, "[RLC_UM][MOD %d][RB %d] FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM RLC_LOCAL_SUSPEND_STATE\n", rlcP->module_id, rlcP->rb_id, eventP);
|
||||
LOG_E(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM RLC_LOCAL_SUSPEND_STATE\n",
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
eventP);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(RLC, "[RLC_UM][MOD %d][RB %d] FSM ERROR UNKNOWN STATE %d\n", rlcP->module_id, rlcP->rb_id, rlcP->protocol_state);
|
||||
LOG_E(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM ERROR UNKNOWN STATE %d\n",
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->protocol_state);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#ifdef USER_MODE
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include "assertions.h"
|
||||
#include "rlc.h"
|
||||
#include "rlc_um.h"
|
||||
#include "rlc_primitives.h"
|
||||
@@ -40,101 +41,144 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
|
||||
//#define DEBUG_RLC_UM_DISPLAY_ASCII_DATA 1
|
||||
//#define TRACE_RLC_UM_DISPLAY_ASCII_DATA 1
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline void
|
||||
rlc_um_clear_rx_sdu (rlc_um_entity_t *rlcP)
|
||||
rlc_um_clear_rx_sdu (rlc_um_entity_t *rlc_pP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_um_reassembly (u8_t * srcP, s32_t lengthP, rlc_um_entity_t *rlcP,u32_t frame)
|
||||
rlc_um_reassembly (u8_t * src_pP, s32_t lengthP, rlc_um_entity_t *rlc_pP, frame_t frameP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
int sdu_max_size;
|
||||
#ifdef DEBUG_RLC_UM_DISPLAY_ASCII_DATA
|
||||
int index;
|
||||
#endif
|
||||
sdu_size_t sdu_max_size;
|
||||
|
||||
LOG_D(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d][REASSEMBLY] reassembly() %d bytes %d bytes already reassemblied\n", rlcP->module_id, rlcP->rb_id, frame, lengthP, rlcP->output_sdu_size_to_write);
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_UM][MOD %u/%u][RB %u][REASSEMBLY] reassembly() %d bytes %d bytes already reassemblied\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
lengthP,
|
||||
rlc_pP->output_sdu_size_to_write);
|
||||
|
||||
if (lengthP <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((rlcP->is_data_plane)) {
|
||||
sdu_max_size = RLC_SDU_MAX_SIZE_DATA_PLANE;
|
||||
if ((rlc_pP->is_data_plane)) {
|
||||
sdu_max_size = RLC_SDU_MAX_SIZE_DATA_PLANE;
|
||||
} else {
|
||||
sdu_max_size = RLC_SDU_MAX_SIZE_CONTROL_PLANE;
|
||||
sdu_max_size = RLC_SDU_MAX_SIZE_CONTROL_PLANE;
|
||||
}
|
||||
|
||||
if (rlcP->output_sdu_in_construction == NULL) {
|
||||
// msg("[RLC_UM_LITE] Getting mem_block ...\n");
|
||||
rlcP->output_sdu_in_construction = get_free_mem_block (sdu_max_size);
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
if (rlc_pP->output_sdu_in_construction == NULL) {
|
||||
// msg("[RLC_UM_LITE] Getting mem_block ...\n");
|
||||
rlc_pP->output_sdu_in_construction = get_free_mem_block (sdu_max_size);
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
}
|
||||
|
||||
if ((rlcP->output_sdu_in_construction)) {
|
||||
|
||||
// check if no overflow in size
|
||||
if ((rlcP->output_sdu_size_to_write + lengthP) <= sdu_max_size) {
|
||||
memcpy (&rlcP->output_sdu_in_construction->data[rlcP->output_sdu_size_to_write], srcP, lengthP);
|
||||
rlcP->output_sdu_size_to_write += lengthP;
|
||||
#ifdef DEBUG_RLC_UM_DISPLAY_ASCII_DATA
|
||||
rlcP->output_sdu_in_construction->data[rlcP->output_sdu_size_to_write] = 0;
|
||||
LOG_T(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d][REASSEMBLY] DATA :", rlcP->module_id, rlcP->rb_id, frame);
|
||||
rlc_util_print_hex_octets(RLC, (unsigned char*)rlcP->output_sdu_in_construction->data, rlcP->output_sdu_size_to_write);
|
||||
if ((rlc_pP->output_sdu_in_construction)) {
|
||||
// check if no overflow in size
|
||||
if ((rlc_pP->output_sdu_size_to_write + lengthP) <= sdu_max_size) {
|
||||
memcpy (&rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write], src_pP, lengthP);
|
||||
rlc_pP->output_sdu_size_to_write += lengthP;
|
||||
#ifdef TRACE_RLC_UM_DISPLAY_ASCII_DATA
|
||||
rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write] = 0;
|
||||
LOG_T(RLC, "[FRAME %5u][%s][RLC_UM][MOD %u/%u][RB %u][REASSEMBLY] DATA :",
|
||||
frameP
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_util_print_hex_octets(RLC, (unsigned char*)rlc_pP->output_sdu_in_construction->data, rlc_pP->output_sdu_size_to_write);
|
||||
#endif
|
||||
} else {
|
||||
LOG_E(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d][REASSEMBLY] [max_sdu size %d] ERROR SDU SIZE OVERFLOW SDU GARBAGED\n", rlcP->module_id, rlcP->rb_id, frame, sdu_max_size);
|
||||
// erase SDU
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
}
|
||||
} else {
|
||||
#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD)
|
||||
AssertFatal(0, "[FRAME %5u][%s][RLC_UM][MOD %u/%u][RB %u] RLC_UM_DATA_IND, SDU TOO BIG, DROPPED\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
#endif
|
||||
LOG_E(RLC, "[FRAME %5u][%s][RLC_UM][MOD %u/%u][RB %u][REASSEMBLY] [max_sdu size %d] ERROR SDU SIZE OVERFLOW SDU GARBAGED\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
sdu_max_size);
|
||||
// erase SDU
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
}
|
||||
} else {
|
||||
LOG_E(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d][REASSEMBLY]ERROR OUTPUT SDU IS NULL\n", rlcP->module_id, rlcP->rb_id, frame);
|
||||
LOG_E(RLC, "[FRAME %5u][%s][RLC_UM][MOD %u/%u][RB %u][REASSEMBLY]ERROR OUTPUT SDU IS NULL\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD)
|
||||
AssertFatal(0, "[FRAME %5u][%s][RLC_UM][MOD %u/%u][RB %u] RLC_UM_DATA_IND, SDU DROPPED, OUT OF MEMORY\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_um_send_sdu (rlc_um_entity_t *rlcP,u32_t frame, u8_t eNB_flag)
|
||||
rlc_um_send_sdu (rlc_um_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_flagP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
if ((rlcP->output_sdu_in_construction)) {
|
||||
LOG_D(RLC, "\n\n\n[RLC_UM][MOD %d][RB %d][FRAME %05d][SEND_SDU] %d bytes sdu %p\n", rlcP->module_id, rlcP->rb_id, frame, rlcP->output_sdu_size_to_write, rlcP->output_sdu_in_construction);
|
||||
if ((rlc_pP->output_sdu_in_construction)) {
|
||||
LOG_D(RLC, "[FRAME %5u][%s][RLC_UM][MOD %u/%u][RB %u] SEND_SDU to upper layers %d bytes sdu %p\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->output_sdu_size_to_write,
|
||||
rlc_pP->output_sdu_in_construction);
|
||||
|
||||
if (rlcP->output_sdu_size_to_write > 0) {
|
||||
u8_t UE_id, eNB_id;
|
||||
if (eNB_flag == 0) {
|
||||
UE_id = rlcP->module_id - NB_eNB_INST;
|
||||
/* FIXME: force send on eNB 0 */
|
||||
eNB_id = 0;
|
||||
} else {
|
||||
UE_id = rlcP->rb_id / NB_RB_MAX;
|
||||
eNB_id = rlcP->module_id;
|
||||
}
|
||||
rlcP->stat_rx_pdcp_sdu += 1;
|
||||
rlcP->stat_rx_pdcp_bytes += rlcP->output_sdu_size_to_write;
|
||||
if (rlc_pP->output_sdu_size_to_write > 0) {
|
||||
rlc_pP->stat_rx_pdcp_sdu += 1;
|
||||
rlc_pP->stat_rx_pdcp_bytes += rlc_pP->output_sdu_size_to_write;
|
||||
#ifdef TEST_RLC_UM
|
||||
#ifdef DEBUG_RLC_UM_DISPLAY_ASCII_DATA
|
||||
rlcP->output_sdu_in_construction->data[rlcP->output_sdu_size_to_write] = 0;
|
||||
LOG_T(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d][SEND_SDU] DATA :", rlcP->module_id, rlcP->rb_id, frame);
|
||||
rlc_util_print_hex_octets(RLC, rlcP->output_sdu_in_construction->data, rlcP->output_sdu_size_to_write);
|
||||
#ifdef TRACE_RLC_UM_DISPLAY_ASCII_DATA
|
||||
rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write] = 0;
|
||||
LOG_T(RLC, "[FRAME %5u][%s][RLC_UM][MOD %u/%u][RB %u][SEND_SDU] DATA :",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
rlc_util_print_hex_octets(RLC, rlc_pP->output_sdu_in_construction->data, rlc_pP->output_sdu_size_to_write);
|
||||
#endif
|
||||
rlc_um_v9_3_0_test_data_ind (rlcP->module_id, rlcP->rb_id, rlcP->output_sdu_size_to_write, rlcP->output_sdu_in_construction);
|
||||
rlc_um_v9_3_0_test_data_ind (rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write, rlc_pP->output_sdu_in_construction);
|
||||
#else
|
||||
// msg("[RLC] DATA IND ON MOD_ID %d RB ID %d, size %d\n",rlcP->module_id, rlcP->rb_id, frame,rlcP->output_sdu_size_to_write);
|
||||
rlc_data_ind (rlcP->module_id, eNB_id, UE_id, frame, eNB_flag, rlcP->is_mxch, rlcP->rb_id, rlcP->output_sdu_size_to_write, rlcP->output_sdu_in_construction,rlcP->is_data_plane);
|
||||
// msg("[RLC] DATA IND ON MOD_ID %d RB ID %d, size %d\n",rlc_pP->module_id, rlc_pP->rb_id, frameP,rlc_pP->output_sdu_size_to_write);
|
||||
rlc_data_ind (rlc_pP->enb_module_id, rlc_pP->ue_module_id, frameP, eNB_flagP, rlc_pP->is_mxch, rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write, rlc_pP->output_sdu_in_construction,rlc_pP->is_data_plane);
|
||||
#endif
|
||||
rlcP->output_sdu_in_construction = NULL;
|
||||
rlc_pP->output_sdu_in_construction = NULL;
|
||||
} else {
|
||||
LOG_E(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d][SEND_SDU] ERROR SIZE <= 0 ... DO NOTHING, SET SDU SIZE TO 0\n",rlcP->module_id, rlcP->rb_id, frame);
|
||||
LOG_E(RLC, "[FRAME %5u][%s][RLC_UM][MOD %u/%u][RB %u][SEND_SDU] ERROR SIZE <= 0 ... DO NOTHING, SET SDU SIZE TO 0\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id);
|
||||
}
|
||||
rlcP->output_sdu_size_to_write = 0;
|
||||
rlc_pP->output_sdu_size_to_write = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,20 +65,21 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
*/
|
||||
protected_rlc_um_reassembly(void rlc_um_clear_rx_sdu (rlc_um_entity_t *rlcP));
|
||||
|
||||
/*! \fn void rlc_um_reassembly (u8_t * srcP, s32_t lengthP, rlc_um_entity_t *rlcP)
|
||||
/*! \fn void rlc_um_reassembly (u8_t * srcP, s32_t lengthP, rlc_um_entity_t *rlcP, frame_t frame)
|
||||
* \brief Reassembly lengthP bytes to the end of the SDU in construction.
|
||||
* \param[in] srcP Pointer on data to be reassemblied.
|
||||
* \param[in] lengthP Length to reassembly.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
*/
|
||||
protected_rlc_um_reassembly(void rlc_um_reassembly (u8_t * srcP, s32_t lengthP, rlc_um_entity_t *rlcP, u32_t frame));
|
||||
protected_rlc_um_reassembly(void rlc_um_reassembly (u8_t * srcP, s32_t lengthP, rlc_um_entity_t *rlcP, frame_t frame));
|
||||
|
||||
/*! \fn void rlc_um_send_sdu (rlc_um_entity_t *rlcP,u32_t frame)
|
||||
/*! \fn void rlc_um_send_sdu (rlc_um_entity_t *rlcP,frame_t frame,eNB_flag_t eNB_flagP)
|
||||
* \brief Send SDU if any reassemblied to upper layer.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] eNB_flagP Boolean to know if rlcP is in eNB (1 or true), or in UE (0 or false).
|
||||
*/
|
||||
protected_rlc_um_reassembly(void rlc_um_send_sdu (rlc_um_entity_t *rlcP,u32_t frame,u8 eNB_flag));
|
||||
protected_rlc_um_reassembly(void rlc_um_send_sdu (rlc_um_entity_t *rlcP,frame_t frameP,eNB_flag_t eNB_flagP));
|
||||
/** @} */
|
||||
# endif
|
||||
|
||||
@@ -43,7 +43,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
#define DEBUG_RLC_UM_RX
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_um_display_rx_window(struct rlc_um_entity *rlcP)
|
||||
void rlc_um_display_rx_window(struct rlc_um_entity *rlc_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
/*
|
||||
@@ -73,21 +73,21 @@ void rlc_um_display_rx_window(struct rlc_um_entity *rlcP)
|
||||
*/
|
||||
unsigned long sn = 0;
|
||||
unsigned long end_sn = 0;
|
||||
char str[4];
|
||||
char time_out_str[11];
|
||||
int str_index;
|
||||
char color[32];
|
||||
char str[4];
|
||||
char time_out_str[11];
|
||||
int str_index;
|
||||
char color[32];
|
||||
|
||||
LOG_T(RLC, "\n");
|
||||
LOG_T(RLC, "+-------------------------------------------------------------------------------------------------------+");
|
||||
LOG_T(RLC, "\n");
|
||||
sprintf(time_out_str, "%010d", rlcP->t_reordering.frame_time_out);
|
||||
sprintf(time_out_str, "%010d", rlc_pP->t_reordering.frame_time_out);
|
||||
time_out_str[10] = 0;
|
||||
LOG_T(RLC, "| RLC UM RB %02d VR(UR)=%03d VR(UX)=%03d VR(UH)=%03d t-Reordering: %s %s %s |",
|
||||
rlcP->rb_id, rlcP->vr_ur, rlcP->vr_ux, rlcP->vr_uh,
|
||||
(rlcP->t_reordering.running)?" ON":"OFF",
|
||||
(rlcP->t_reordering.running)?"Time-out frame:":" ",
|
||||
(rlcP->t_reordering.running)?time_out_str:" ");
|
||||
rlc_pP->rb_id, rlc_pP->vr_ur, rlc_pP->vr_ux, rlc_pP->vr_uh,
|
||||
(rlc_pP->t_reordering.running)?" ON":"OFF",
|
||||
(rlc_pP->t_reordering.running)?"Time-out frameP:":" ",
|
||||
(rlc_pP->t_reordering.running)?time_out_str:" ");
|
||||
LOG_T(RLC, "\n");
|
||||
LOG_T(RLC, "+------+------------------------------------------------------------------------------------------------+");
|
||||
LOG_T(RLC, "\n");
|
||||
@@ -95,7 +95,7 @@ void rlc_um_display_rx_window(struct rlc_um_entity *rlcP)
|
||||
LOG_T(RLC, "\n");
|
||||
LOG_T(RLC, "+------+------------------------------------------------------------------------------------------------+");
|
||||
LOG_T(RLC, "\n");
|
||||
if (rlcP->rx_sn_length == 10) {
|
||||
if (rlc_pP->rx_sn_length == 10) {
|
||||
end_sn = RLC_UM_SN_10_BITS_MODULO;
|
||||
} else {
|
||||
end_sn = RLC_UM_SN_5_BITS_MODULO;
|
||||
@@ -116,20 +116,20 @@ void rlc_um_display_rx_window(struct rlc_um_entity *rlcP)
|
||||
LOG_T(RLC, "%s%s| %04d |", RLC_FG_COLOR_DEFAULT, RLC_NORMAL_VIDEO, sn);
|
||||
}
|
||||
strcpy(color, RLC_FG_COLOR_DEFAULT);
|
||||
if (sn == rlcP->vr_ur) {
|
||||
if (sn == rlc_pP->vr_ur) {
|
||||
str[str_index++] = 'R';
|
||||
strcpy(color, RLC_FG_COLOR_BLUE);
|
||||
}
|
||||
if (sn == rlcP->vr_ux) {
|
||||
if (sn == rlc_pP->vr_ux) {
|
||||
str[str_index++] = 'X';
|
||||
strcpy(color, RLC_FG_COLOR_ORANGE);
|
||||
}
|
||||
if (sn == rlcP->vr_uh) {
|
||||
if (sn == rlc_pP->vr_uh) {
|
||||
str[str_index++] = 'H';
|
||||
strcpy(color, RLC_FG_COLOR_RED);
|
||||
}
|
||||
|
||||
if (rlc_um_get_pdu_from_dar_buffer(rlcP, sn)) {
|
||||
if (rlc_um_get_pdu_from_dar_buffer(rlc_pP, sn)) {
|
||||
// test RLC_REVERSE_VIDEO
|
||||
if (str_index <= 2) str[str_index] = '.';
|
||||
LOG_T(RLC, "%s%s%s", color, RLC_REVERSE_VIDEO, str);
|
||||
@@ -145,26 +145,34 @@ void rlc_um_display_rx_window(struct rlc_um_entity *rlcP)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_um_receive (struct rlc_um_entity *rlcP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP)
|
||||
rlc_um_receive (struct rlc_um_entity *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
mem_block_t *tb;
|
||||
u8_t *first_byte;
|
||||
u16_t tb_size_in_bytes;
|
||||
mem_block_t *tb_p = NULL;
|
||||
u8_t *first_byte_p = NULL;
|
||||
u16_t tb_size_in_bytes = 0;
|
||||
|
||||
while ((tb = list_remove_head (&data_indP.data))) {
|
||||
while ((tb_p = list_remove_head (&data_indP.data))) {
|
||||
|
||||
first_byte = ((struct mac_tb_ind *) (tb->data))->data_ptr;
|
||||
tb_size_in_bytes = ((struct mac_tb_ind *) (tb->data))->size;
|
||||
first_byte_p = ((struct mac_tb_ind *) (tb_p->data))->data_ptr;
|
||||
tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
|
||||
|
||||
rlcP->stat_rx_data_bytes += tb_size_in_bytes;
|
||||
rlcP->stat_rx_data_pdu += 1;
|
||||
rlc_pP->stat_rx_data_bytes += tb_size_in_bytes;
|
||||
rlc_pP->stat_rx_data_pdu += 1;
|
||||
|
||||
if (tb_size_in_bytes > 0) {
|
||||
rlc_um_receive_process_dar (rlcP, frame, eNB_flag, tb, (rlc_um_pdu_sn_10_t *)first_byte, tb_size_in_bytes);
|
||||
LOG_D(RLC, "[RLC_UM][MOD %d][RB %d][FRAME %05d] VR(UR)=%03d VR(UX)=%03d VR(UH)=%03d\n", rlcP->module_id, rlcP->rb_id, frame, rlcP->vr_ur, rlcP->vr_ux, rlcP->vr_uh);
|
||||
rlc_um_display_rx_window(rlcP);
|
||||
}
|
||||
if (tb_size_in_bytes > 0) {
|
||||
rlc_um_receive_process_dar (rlc_pP, frameP, eNB_flagP, tb_p, (rlc_um_pdu_sn_10_t *)first_byte_p, tb_size_in_bytes);
|
||||
LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u] VR(UR)=%03d VR(UX)=%03d VR(UH)=%03d\n",
|
||||
frameP,
|
||||
(rlc_pP->is_enb) ? "eNB" : "UE",
|
||||
rlc_pP->enb_module_id,
|
||||
rlc_pP->ue_module_id,
|
||||
rlc_pP->rb_id,
|
||||
rlc_pP->vr_ur,
|
||||
rlc_pP->vr_ux,
|
||||
rlc_pP->vr_uh);
|
||||
rlc_um_display_rx_window(rlc_pP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,18 +59,19 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
# include "rlc_um_entity.h"
|
||||
# include "mac_primitives.h"
|
||||
|
||||
/*! \fn void rlc_um_display_rx_window(struct rlc_um_entity *rlcP)
|
||||
/*! \fn void rlc_um_display_rx_window(struct rlc_um_entity *rlc_pP)
|
||||
* \brief Display the content of the RX buffer, the output stream is targeted to TTY terminals because of escape sequences.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
*/
|
||||
protected_rlc_um_receiver( void rlc_um_display_rx_window(struct rlc_um_entity *rlcP);)
|
||||
protected_rlc_um_receiver( void rlc_um_display_rx_window(struct rlc_um_entity *rlc_pP);)
|
||||
|
||||
/*! \fn void rlc_um_receive (struct rlc_um_entity *rlcP, u32_t frame, struct mac_data_ind data_indP)
|
||||
/*! \fn void rlc_um_receive (struct rlc_um_entity *rlc_pP, frame_t frameP, struct mac_data_ind data_indP)
|
||||
* \brief Handle the MAC data indication, retreive the transport blocks and send them one by one to the DAR process.
|
||||
* \param[in] rlcP RLC UM protocol instance pointer.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] rlc_pP RLC UM protocol instance pointer.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] eNB_flagP Flag to indicated eNB (1) or UE (0).
|
||||
* \param[in] data_indP Data indication structure containing transport block received from MAC layer.
|
||||
*/
|
||||
protected_rlc_um_receiver( void rlc_um_receive (struct rlc_um_entity *rlcP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP));
|
||||
protected_rlc_um_receiver( void rlc_um_receive (struct rlc_um_entity *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP));
|
||||
/** @} */
|
||||
# endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+632
-354
File diff suppressed because it is too large
Load Diff
+123
-105
@@ -113,6 +113,8 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
|
||||
|
||||
#define RLC_MUI_UNDEFINED 0
|
||||
|
||||
#define RLC_RB_UNALLOCATED (rb_id_t)0
|
||||
|
||||
|
||||
/*! \struct rlc_info_t
|
||||
* \brief Structure containing RLC protocol configuration parameters.
|
||||
@@ -134,7 +136,7 @@ typedef struct {
|
||||
u32_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. */
|
||||
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 */
|
||||
u32_t head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmeneted */
|
||||
u32_t head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmeneted */
|
||||
} mac_rlc_status_resp_t;
|
||||
|
||||
|
||||
@@ -154,58 +156,52 @@ typedef struct {
|
||||
//-----------------------------------------------------------------------------
|
||||
// PRIVATE INTERNALS OF RLC
|
||||
//-----------------------------------------------------------------------------
|
||||
#define RLC_MAX_NUM_INSTANCES_RLC_AM ((maxDRB * MAX_MOBILES_PER_RG)/2)
|
||||
#ifdef Rel10
|
||||
#define RLC_MAX_NUM_INSTANCES_RLC_UM ((maxDRB * MAX_MOBILES_PER_RG)/2 + maxSessionPerPMCH * maxServiceCount)
|
||||
#else
|
||||
#define RLC_MAX_NUM_INSTANCES_RLC_UM ((maxDRB * MAX_MOBILES_PER_RG)/2)
|
||||
#endif
|
||||
#define RLC_MAX_NUM_INSTANCES_RLC_TM (MAX_MOBILES_PER_RG)
|
||||
|
||||
#ifdef Rel10
|
||||
#define RLC_MAX_RB ((maxDRB + 3) * MAX_MOBILES_PER_RG + maxSessionPerPMCH * maxServiceCount)
|
||||
#define RLC_MAX_LC ((max_val_DRB_Identity+1) * NUMBER_OF_UE_MAX + maxSessionPerPMCH * maxServiceCount)
|
||||
#else
|
||||
#define RLC_MAX_RB ((maxDRB + 3)* MAX_MOBILES_PER_RG)
|
||||
#define RLC_MAX_LC ((max_val_DRB_Identity+1)* NUMBER_OF_UE_MAX)
|
||||
#endif
|
||||
|
||||
#ifdef Rel10
|
||||
#define RLC_MAX_LC ((max_val_DRB_Identity+1) * MAX_MOBILES_PER_RG + maxSessionPerPMCH * maxServiceCount)
|
||||
#else
|
||||
#define RLC_MAX_LC ((max_val_DRB_Identity+1)* MAX_MOBILES_PER_RG)
|
||||
#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_conf) (module_id_t , module_id_t , u8_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_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);
|
||||
|
||||
protected_rlc(void (*rlc_rrc_data_ind) (u8_t, u8_t, u32_t, u8_t, rb_id_t , sdu_size_t , u8_t* );)
|
||||
protected_rlc(void (*rlc_rrc_data_conf) (module_id_t , rb_id_t , mui_t, rlc_tx_status_t );)
|
||||
typedef void (rrc_data_ind_cb_t)(u8_t eNB_id, u8_t UE_id, u32_t frame, u8_t eNB_flag, rb_id_t rb_idP, sdu_size_t sdu_sizeP, u8_t* sduP);
|
||||
typedef void (rrc_data_conf_cb_t)(module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP);
|
||||
|
||||
/*! \struct rlc_pointer_t
|
||||
* \brief Structure helping finding the right RLC protocol instance in a rlc_t structure.
|
||||
*/
|
||||
typedef struct rlc_pointer_t {
|
||||
rlc_mode_t rlc_type; /*!< \brief Is RLC protocol instance is AM, UM or TM. */
|
||||
int rlc_index; /*!< \brief Index of RLC protocol instance in rlc_t/m_rlc_Xm_array[]. */
|
||||
} rlc_pointer_t;
|
||||
|
||||
/*! \struct rlc_t
|
||||
* \brief Structure to be instanciated to allocate memory for RLC protocol instances.
|
||||
*/
|
||||
typedef struct rlc_t {
|
||||
//int m_mbms_rlc_pointer[maxSessionPerPMCH][maxServiceCount]; /*!< \brief Link between (service id, session id) and (implicit) RLC UM protocol instance. */
|
||||
signed long int m_lcid2rbid[RLC_MAX_LC]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
|
||||
rlc_pointer_t m_rlc_pointer[RLC_MAX_RB]; /*!< \brief Link between radio bearer ID and RLC protocol instance. */
|
||||
rlc_am_entity_t m_rlc_am_array[RLC_MAX_NUM_INSTANCES_RLC_AM]; /*!< \brief RLC AM protocol instances. */
|
||||
rlc_um_entity_t m_rlc_um_array[RLC_MAX_NUM_INSTANCES_RLC_UM]; /*!< \brief RLC UM protocol instances. */
|
||||
rlc_tm_entity_t m_rlc_tm_array[RLC_MAX_NUM_INSTANCES_RLC_TM]; /*!< \brief RLC TM protocol instances. */
|
||||
char m_mscgen_trace[260];
|
||||
unsigned char m_mscgen_trace_length;
|
||||
rlc_mode_t mode;
|
||||
union {
|
||||
rlc_am_entity_t am;
|
||||
rlc_um_entity_t um;
|
||||
rlc_tm_entity_t tm;
|
||||
} rlc;
|
||||
}rlc_t;
|
||||
|
||||
// RK-LG was protected, public for debug
|
||||
/*! \var rlc_t rlc[MAX_MODULES]
|
||||
\brief Global var for RLC layer, allocate memory for RLC protocol instances.
|
||||
typedef struct rlc_mbms_s {
|
||||
mbms_session_id_t session_id; // lcid
|
||||
mbms_service_id_t service_id;
|
||||
rb_id_t rb_id;
|
||||
module_id_t instanciated_instance;
|
||||
} rlc_mbms_t;
|
||||
|
||||
public_rlc(rlc_mbms_t rlc_mbms_array_ue[NUMBER_OF_UE_MAX][16*29];) // MAX_SERVICEx MAX_SESSION
|
||||
public_rlc(rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][16*29];) // MAX_SERVICEx MAX_SESSION
|
||||
|
||||
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. */
|
||||
/*! \var rlc_t rlc_array_ue[NUMBER_OF_UE_MAX][NB_RB_MAX]
|
||||
\brief Global var for RLC layer, allocate memory for RLC UE protocol instances.
|
||||
*/
|
||||
public_rlc(rlc_t rlc[MAX_MODULES];)
|
||||
public_rlc(rlc_t rlc_array_ue[NUMBER_OF_UE_MAX][NB_RB_MAX];)
|
||||
|
||||
/*! \var rlc_t rlc_array_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][NB_RB_MAX]
|
||||
\brief Global var for RLC layer, allocate memory for RLC UE protocol instances.
|
||||
*/
|
||||
public_rlc(rlc_t rlc_array_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][NB_RB_MAX];)
|
||||
|
||||
/*! \fn tbs_size_t mac_rlc_serialize_tb (char* bufferP, list_t transport_blocksP)
|
||||
* \brief Serialize a list of transport blocks coming from RLC in order to be processed by MAC.
|
||||
@@ -230,11 +226,12 @@ private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t,
|
||||
// PUBLIC INTERFACE WITH RRC
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifdef Rel10
|
||||
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t module_idP, u32_t frame, u8_t eNB_flagP, u8_t UE_index, 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, u8_t UE_index, SRB_ToAddMod_t* srb2addmod, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP, MBMS_SessionInfoList_r9_t *SessionInfo_listP)
|
||||
* \brief Function for RRC to configure a Radio Bearer.
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (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] frameP Frame index.
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] UE_index Index of UE in eNB RRC
|
||||
* \param[in] srb2add_listP SRB configuration list to be created.
|
||||
* \param[in] drb2add_listP DRB configuration list to be created.
|
||||
@@ -242,60 +239,66 @@ private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t,
|
||||
* \param[in] pmch_info_listP eMBMS pmch info list to be created.
|
||||
* \return A status about the processing, OK or error code.
|
||||
*/
|
||||
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t, u32_t, u8_t, u8_t UE_index, 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, u8_t UE_index, SRB_ToAddModList_t*, DRB_ToAddModList_t*, DRB_ToReleaseList_t*, PMCH_InfoList_r9_t *pmch_info_listP);)
|
||||
#else
|
||||
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t module_idP, u32_t frame, u8_t eNB_flagP, u8_t UE_index, 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, MBMS_SessionInfoList_r9_t *SessionInfo_listP)
|
||||
* \brief Function for RRC to configure a Radio Bearer.
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] UE_index Index of UE in eNB RRC
|
||||
* \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] frameP Frame index.
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] srb2add_listP SRB configuration list to be created.
|
||||
* \param[in] drb2add_listP DRB configuration list to be created.
|
||||
* \param[in] drb2release_listP DRB configuration list to be released.
|
||||
* \return A status about the processing, OK or error code.
|
||||
*/
|
||||
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t, u32_t, u8_t, u8_t UE_index, SRB_ToAddModList_t*, DRB_ToAddModList_t*, DRB_ToReleaseList_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*);)
|
||||
#endif
|
||||
|
||||
/*! \fn rlc_op_status_t rrc_rlc_remove_rlc (module_id_t module_idP, u32_t frame, rb_id_t rb_idP)
|
||||
/*! \fn 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)
|
||||
* \brief Remove a RLC protocol instance from a radio bearer.
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] frame Frame index.
|
||||
* \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] frameP Frame index.
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \return A status about the processing, OK or error code.
|
||||
*/
|
||||
private_rlc_rrc(rlc_op_status_t rrc_rlc_remove_rlc (module_id_t, u32_t, rb_id_t);)
|
||||
private_rlc_rrc(rlc_op_status_t rrc_rlc_remove_rlc (module_id_t , module_id_t , frame_t , eNB_flag_t , rb_id_t );)
|
||||
|
||||
/*! \fn rlc_op_status_t rrc_rlc_add_rlc (module_id_t module_idP, u32_t frameP, rb_id_t rb_idP, chan_id_t chan_idP, rlc_mode_t rlc_modeP)
|
||||
/*! \fn 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)
|
||||
* \brief Add a RLC protocol instance to a radio bearer.
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \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] frameP Frame index.
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] chan_idP Logical channel identifier.
|
||||
* \param[in] rlc_modeP Mode of RLC (AM, UM, TM).
|
||||
* \return A status about the processing, OK or error code.
|
||||
*/
|
||||
private_rlc_rrc(rlc_op_status_t rrc_rlc_add_rlc (module_id_t, u32_t, rb_id_t, chan_id_t, rlc_mode_t);)
|
||||
private_rlc_rrc(rlc_op_status_t rrc_rlc_add_rlc (module_id_t, module_id_t, frame_t, eNB_flag_t, rb_id_t, logical_chan_id_t, rlc_mode_t);)
|
||||
|
||||
/*! \fn rlc_op_status_t rrc_rlc_config_req (module_id_t module_idP, u32_t frame, u8_t eNB_flagP, config_action_t actionP, rb_id_t rb_idP, rb_type_t rb_typeP, rlc_info_t rlc_infoP)
|
||||
/*! \fn 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)
|
||||
* \brief Function for RRC to configure a Radio Bearer.
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (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] frameP Frame index.
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] actionP Action for this radio bearer (add, modify, remove).
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] rb_typeP Type of radio bearer (signalling, data).
|
||||
* \param[in] rlc_infoP RLC configuration parameters issued from Radio Resource Manager.
|
||||
* \return A status about the processing, OK or error code.
|
||||
*/
|
||||
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_req (module_id_t, u32_t, u8_t , config_action_t, rb_id_t, rb_type_t, rlc_info_t );)
|
||||
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_req (module_id_t, module_id_t, frame_t, eNB_flag_t , config_action_t, rb_id_t, rb_type_t, rlc_info_t );)
|
||||
|
||||
/*! \fn rlc_op_status_t rrc_rlc_data_req (module_id_t module_idP, u32_t frame, u8_t eNB_flagP, rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, char* sduP)
|
||||
/*! \fn 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)
|
||||
* \brief Function for RRC to send a SDU through a Signalling Radio Bearer.
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] frame Frame index
|
||||
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (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] frameP Frame index
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] MBMS_flag Flag to indicate whether this is an MBMS service (1) or not (0)
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] muiP Message Unit identifier.
|
||||
@@ -304,9 +307,9 @@ public_rlc_rrc( rlc_op_status_t rrc_rlc_config_req (module_id_t, u32_t, u8_t ,
|
||||
* \param[in] sduP SDU.
|
||||
* \return A status about the processing, OK or error code.
|
||||
*/
|
||||
public_rlc_rrc( rlc_op_status_t rrc_rlc_data_req (module_id_t, u32_t, u8_t, u8_t, rb_id_t, mui_t, confirm_t, sdu_size_t, char *);)
|
||||
public_rlc_rrc( rlc_op_status_t rrc_rlc_data_req (module_id_t, module_id_t, frame_t, eNB_flag_t, MBMS_flag_t, rb_id_t, mui_t, confirm_t, sdu_size_t, char *);)
|
||||
|
||||
/*! \fn void rrc_rlc_register_rrc ( void (*rrc_data_indP) (module_id_t module_idP, u32_t frame, u8_t eNB_flag, rb_id_t rb_idP, sdu_size_t sdu_sizeP, char* sduP), void (*rrc_data_confP) (module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP)
|
||||
/*! \fn void rrc_rlc_register_rrc ( void (*rrc_data_indP) (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, sdu_size_t sdu_sizeP, char* sduP), void (*rrc_data_confP) (module_id_t enb_mod_idP, module_id_t ue_mod_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP)
|
||||
* \brief This function is called by RRC to register its DATA-INDICATE and DATA-CONFIRM handlers to RLC layer.
|
||||
* \param[in] rrc_data_indP Pointer on RRC data indicate function.
|
||||
* \param[in] rrc_data_confP Pointer on RRC data confirm callback function.
|
||||
@@ -316,55 +319,59 @@ public_rlc_rrc(void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_d
|
||||
//-----------------------------------------------------------------------------
|
||||
// PUBLIC INTERFACE WITH MAC
|
||||
//-----------------------------------------------------------------------------
|
||||
/*! \fn tbs_size_t mac_rlc_data_req (module_id_t module_idP, u32_t frame, u8_t MBMS_flagP, chan_id_t rb_idP, char* bufferP)
|
||||
/*! \fn tbs_size_t mac_rlc_data_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, MBMS_flag_t MBMS_flagP, logical_chan_id_t rb_idP, char* bufferP)
|
||||
* \brief Interface with MAC layer, map data request to the RLC corresponding to the radio bearer.
|
||||
* \param [in] module_idP Virtualized module identifier.
|
||||
* \param [in] frame Frame index
|
||||
* \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] frameP Frame index
|
||||
* \param [in] eNB_flagP Flag to indicate eNB (1) or UE (0)
|
||||
* \param [in] MBMS_flagP Flag to indicate whether this is the MBMS service (1) or not (0)
|
||||
* \param [in] rb_idP Radio bearer identifier.
|
||||
* \param [in,out] bufferP Memory area to fill with the bytes requested by MAC.
|
||||
* \return A status about the processing, OK or error code.
|
||||
*/
|
||||
public_rlc_mac(tbs_size_t mac_rlc_data_req (module_id_t, u32_t, u8_t, chan_id_t, char*);)
|
||||
public_rlc_mac(tbs_size_t mac_rlc_data_req (module_id_t, module_id_t, frame_t, eNB_flag_t, MBMS_flag_t, logical_chan_id_t, char*);)
|
||||
|
||||
/*! \fn void mac_rlc_data_ind (module_id_t module_idP, u32_t frame, u8_t eNB_flagP, u8_t MBMS_flagP, chan_id_t rb_idP, u32_t frame, char* bufferP, tb_size_t tb_sizeP, num_tb_t num_tbP, crc_t *crcs)
|
||||
/*! \fn void mac_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, logical_chan_id_t rb_idP, u32_t frameP, char* bufferP, tb_size_t tb_sizeP, num_tb_t num_tbP, crc_t *crcs)
|
||||
* \brief Interface with MAC layer, deserialize the transport blocks sent by MAC, then map data indication to the RLC instance corresponding to the radio bearer identifier.
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] frame Frame index
|
||||
* \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] frameP Frame index
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] MBMS_flagP Flag to indicate whether this is the MBMS service (1) or not (0)
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] frameP Frame index.
|
||||
* \param[in] bufferP Memory area containing the transport blocks sent by MAC.
|
||||
* \param[in] tb_sizeP Size of a transport block in bits.
|
||||
* \param[in] num_tbP Number of transport blocks.
|
||||
* \param[in] crcs Array of CRC decoding.
|
||||
*/
|
||||
public_rlc_mac(void mac_rlc_data_ind (module_id_t, u32_t, u8_t, u8_t, chan_id_t, char*, tb_size_t, num_tb_t, crc_t* );)
|
||||
public_rlc_mac(void mac_rlc_data_ind (module_id_t, module_id_t, frame_t, eNB_flag_t, MBMS_flag_t, logical_chan_id_t, char*, tb_size_t, num_tb_t, crc_t* );)
|
||||
|
||||
/*! \fn mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t module_idP, u32_t frame, u8_t eNB_flag, u8_t MBMS_flagP, chan_id_t rb_idP, tb_size_t tb_sizeP)
|
||||
/*! \fn mac_rlc_status_resp_t mac_rlc_status_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, logical_chan_id_t rb_idP, tb_size_t tb_sizeP)
|
||||
* \brief Interface with MAC layer, request and set the number of bytes scheduled for transmission by the RLC instance corresponding to the radio bearer identifier.
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] frame Frame index.
|
||||
* \param[in] eNB_flag Flag to indicate eNB operation (1 true, 0 false)
|
||||
* \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] frameP Frame index.
|
||||
* \param[in] eNB_flagP Flag to indicate eNB operation (1 true, 0 false)
|
||||
* \param[in] MBMS_flagP Flag to indicate whether this is the MBMS service (1) or not (0)
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
* \param[in] tb_sizeP Size of a transport block set in bytes.
|
||||
* \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, u32_t, u8_t, u8_t, 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 0
|
||||
#define RLC_NONE (rlc_mode_t)0
|
||||
/** RLC AM type identifier. */
|
||||
#define RLC_AM 1
|
||||
#define RLC_AM (rlc_mode_t)1
|
||||
/** RLC UM type identifier. */
|
||||
#define RLC_UM 2
|
||||
#define RLC_UM (rlc_mode_t)2
|
||||
/** RLC TM type identifier. */
|
||||
#define RLC_TM 4
|
||||
#define RLC_TM (rlc_mode_t)4
|
||||
|
||||
#define RLC_MBMS_NO 0
|
||||
#define RLC_MBMS_YES 1
|
||||
@@ -384,10 +391,11 @@ public_rlc(void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char*
|
||||
|
||||
|
||||
|
||||
/*! \fn rlc_op_status_t rlc_data_req(module_id_t module_idP, u32_t frame, u8_t eNB_flagP, u8_t MBMS_flagP, rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sduP)
|
||||
/*! \fn rlc_op_status_t 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, mem_block_t *sduP)
|
||||
* \brief Interface with higher layers, map request to the RLC corresponding to the radio bearer.
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] frame Frame index.
|
||||
* \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] frameP Frame index.
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] MBMS_flagP Flag to indicate whether this is the MBMS service (1) or not (0)
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
@@ -397,12 +405,13 @@ public_rlc(void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char*
|
||||
* \param[in] sduP SDU.
|
||||
* \return A status about the processing, OK or error code.
|
||||
*/
|
||||
public_rlc(rlc_op_status_t rlc_data_req (module_id_t, u32_t, u8_t, u8_t,rb_id_t, mui_t, confirm_t, sdu_size_t, mem_block_t*);)
|
||||
public_rlc(rlc_op_status_t rlc_data_req (module_id_t , module_id_t , frame_t , eNB_flag_t , MBMS_flag_t , rb_id_t , mui_t , confirm_t , sdu_size_t , mem_block_t *);)
|
||||
|
||||
/*! \fn void rlc_data_ind (module_id_t module_idP, u32_t frame, u8_t eNB_flag, u8_t MBMS_flagP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t* sduP, boolean_t is_data_planeP)
|
||||
/*! \fn 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* sduP, boolean_t is_data_planeP) {
|
||||
* \brief Interface with higher layers, route SDUs coming from RLC protocol instances to upper layer instance.
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \param[in] frame Frame index
|
||||
* \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] frameP Frame index
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] MBMS_flagP Flag to indicate whether this is the MBMS service (1) or not (0)
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
@@ -410,12 +419,13 @@ public_rlc(rlc_op_status_t rlc_data_req (module_id_t, u32_t, u8_t, u8_t,rb_i
|
||||
* \param[in] sduP SDU.
|
||||
* \param[in] is_data_planeP Boolean, is data radio bearer or not.
|
||||
*/
|
||||
public_rlc(void rlc_data_ind (module_id_t module_idP, u8_t eNB_id, u8_t UE_id, u32_t frame, u8_t eNB_flag, u8_t MBMS_flagP, rb_id_t, sdu_size_t, mem_block_t*, boolean_t);)
|
||||
public_rlc(void rlc_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);)
|
||||
|
||||
|
||||
/*! \fn void rlc_data_conf (module_id_t module_idP, u32_t frameP, u8_t eNB_flagP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP, boolean_t is_data_planeP)
|
||||
/*! \fn void rlc_data_conf (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, rlc_tx_status_t statusP, boolean_t is_data_planeP)
|
||||
* \brief Interface with higher layers, confirm to upper layer the transmission status for a SDU stamped with a MUI, scheduled for transmission.
|
||||
* \param[in] module_idP Virtualized module identifier.
|
||||
* \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] frameP Frame index
|
||||
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
|
||||
* \param[in] rb_idP Radio bearer identifier.
|
||||
@@ -423,12 +433,15 @@ public_rlc(void rlc_data_ind (module_id_t module_idP, u8_t eNB_id
|
||||
* \param[in] statusP Status of the transmission (RLC_SDU_CONFIRM_YES, RLC_SDU_CONFIRM_NO).
|
||||
* \param[in] is_data_planeP Boolean, is data radio bearer or not.
|
||||
*/
|
||||
public_rlc(void rlc_data_conf (module_id_t, u32_t, u8_t , rb_id_t, mui_t, rlc_tx_status_t, boolean_t );)
|
||||
public_rlc(void rlc_data_conf (module_id_t, module_id_t, frame_t, eNB_flag_t , rb_id_t, mui_t, rlc_tx_status_t, boolean_t );)
|
||||
|
||||
|
||||
/*! \fn rlc_op_status_t rlc_stat_req (module_id_t module_idP,
|
||||
u32_t frame,
|
||||
rb_id_t rb_idP,
|
||||
/*! \fn rlc_op_status_t rlc_stat_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,
|
||||
unsigned int* stat_tx_pdcp_sdu,
|
||||
unsigned int* stat_tx_pdcp_bytes,
|
||||
unsigned int* stat_tx_pdcp_sdu_discarded,
|
||||
@@ -458,8 +471,10 @@ public_rlc(void rlc_data_conf (module_id_t, u32_t, u8_t , rb_id_t,
|
||||
unsigned int* stat_timer_status_prohibit_timed_out)
|
||||
|
||||
* \brief Request RLC statistics of a particular radio bearer.
|
||||
* \param[in] module_idP .
|
||||
* \param[in] frame
|
||||
* \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] frameP
|
||||
* \param[in] eNB_flagP
|
||||
* \param[in] rb_idP .
|
||||
* \param[out] stat_tx_pdcp_sdu Number of SDUs coming from upper layers.
|
||||
* \param[out] stat_tx_pdcp_bytes Number of bytes coming from upper layers.
|
||||
@@ -490,9 +505,12 @@ public_rlc(void rlc_data_conf (module_id_t, u32_t, u8_t , rb_id_t,
|
||||
* \param[out] stat_timer_status_prohibit_timed_out Number of times the timer "status_prohibit" has timed-out.
|
||||
*/
|
||||
|
||||
public_rlc(rlc_op_status_t rlc_stat_req (module_id_t module_idP,
|
||||
u32_t frame,
|
||||
rb_id_t rb_idP,
|
||||
public_rlc(rlc_op_status_t rlc_stat_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,
|
||||
unsigned int* stat_tx_pdcp_sdu,
|
||||
unsigned int* stat_tx_pdcp_bytes,
|
||||
unsigned int* stat_tx_pdcp_sdu_discarded,
|
||||
|
||||
+356
-173
@@ -11,16 +11,17 @@
|
||||
#include "rlc.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "UTIL/OCG/OCG_vars.h"
|
||||
#include "assertions.h"
|
||||
|
||||
#define DEBUG_MAC_INTERFACE
|
||||
#define DEBUG_MAC_INTERFACE 1
|
||||
|
||||
// tb_size_t in bytes
|
||||
//-----------------------------------------------------------------------------
|
||||
struct mac_data_ind mac_rlc_deserialize_tb (char* bufferP, tb_size_t tb_sizeP, num_tb_t num_tbP, crc_t *crcsP) {
|
||||
struct mac_data_ind mac_rlc_deserialize_tb (char* buffer_pP, tb_size_t tb_sizeP, num_tb_t num_tbP, crc_t *crcs_pP) {
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
struct mac_data_ind data_ind;
|
||||
mem_block_t* tb;
|
||||
mem_block_t* tb_p;
|
||||
num_tb_t nb_tb_read;
|
||||
tbs_size_t tbs_size;
|
||||
|
||||
@@ -29,25 +30,25 @@ struct mac_data_ind mac_rlc_deserialize_tb (char* bufferP, tb_size_t tb_sizeP, n
|
||||
list_init(&data_ind.data, NULL);
|
||||
|
||||
while (num_tbP > 0) {
|
||||
tb = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_sizeP);
|
||||
if (tb != NULL) {
|
||||
((struct mac_tb_ind *) (tb->data))->first_bit = 0;
|
||||
((struct mac_tb_ind *) (tb->data))->data_ptr = (u8_t*)&tb->data[sizeof (mac_rlc_max_rx_header_size_t)];
|
||||
((struct mac_tb_ind *) (tb->data))->size = tb_sizeP;
|
||||
if (crcsP)
|
||||
((struct mac_tb_ind *) (tb->data))->error_indication = crcsP[nb_tb_read];
|
||||
tb_p = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_sizeP);
|
||||
if (tb_p != NULL) {
|
||||
((struct mac_tb_ind *) (tb_p->data))->first_bit = 0;
|
||||
((struct mac_tb_ind *) (tb_p->data))->data_ptr = (u8_t*)&tb_p->data[sizeof (mac_rlc_max_rx_header_size_t)];
|
||||
((struct mac_tb_ind *) (tb_p->data))->size = tb_sizeP;
|
||||
if (crcs_pP)
|
||||
((struct mac_tb_ind *) (tb_p->data))->error_indication = crcs_pP[nb_tb_read];
|
||||
else
|
||||
((struct mac_tb_ind *) (tb->data))->error_indication = 0;
|
||||
((struct mac_tb_ind *) (tb_p->data))->error_indication = 0;
|
||||
|
||||
memcpy(((struct mac_tb_ind *) (tb->data))->data_ptr, &bufferP[tbs_size], tb_sizeP);
|
||||
memcpy(((struct mac_tb_ind *) (tb_p->data))->data_ptr, &buffer_pP[tbs_size], tb_sizeP);
|
||||
|
||||
#ifdef DEBUG_MAC_INTERFACE
|
||||
LOG_T(RLC, "[MAC-RLC] DUMP RX PDU(%d bytes):\n", tb_sizeP);
|
||||
rlc_util_print_hex_octets(RLC, ((struct mac_tb_ind *) (tb->data))->data_ptr, tb_sizeP);
|
||||
rlc_util_print_hex_octets(RLC, ((struct mac_tb_ind *) (tb_p->data))->data_ptr, tb_sizeP);
|
||||
#endif
|
||||
nb_tb_read = nb_tb_read + 1;
|
||||
tbs_size = tbs_size + tb_sizeP;
|
||||
list_add_tail_eurecom(tb, &data_ind.data);
|
||||
list_add_tail_eurecom(tb_p, &data_ind.data);
|
||||
}
|
||||
num_tbP = num_tbP - 1;
|
||||
}
|
||||
@@ -57,200 +58,382 @@ struct mac_data_ind mac_rlc_deserialize_tb (char* bufferP, tb_size_t tb_sizeP, n
|
||||
return data_ind;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
tbs_size_t mac_rlc_serialize_tb (char* bufferP, list_t transport_blocksP) {
|
||||
tbs_size_t mac_rlc_serialize_tb (char* buffer_pP, list_t transport_blocksP) {
|
||||
//-----------------------------------------------------------------------------
|
||||
mem_block_t* tb;
|
||||
mem_block_t* tb_p;
|
||||
tbs_size_t tbs_size;
|
||||
tbs_size_t tb_size;
|
||||
|
||||
tbs_size = 0;
|
||||
while (transport_blocksP.nb_elements > 0) {
|
||||
tb = list_remove_head (&transport_blocksP);
|
||||
if (tb != NULL) {
|
||||
tb_size = ((struct mac_tb_req *) (tb->data))->tb_size;
|
||||
tb_p = list_remove_head (&transport_blocksP);
|
||||
if (tb_p != NULL) {
|
||||
tb_size = ((struct mac_tb_req *) (tb_p->data))->tb_size;
|
||||
#ifdef DEBUG_MAC_INTERFACE
|
||||
LOG_T(RLC, "[MAC-RLC] DUMP TX PDU(%d bytes):\n", tb_size);
|
||||
rlc_util_print_hex_octets(RLC, ((struct mac_tb_req *) (tb->data))->data_ptr, tb_size);
|
||||
rlc_util_print_hex_octets(RLC, ((struct mac_tb_req *) (tb_p->data))->data_ptr, tb_size);
|
||||
#endif
|
||||
memcpy(&bufferP[tbs_size], &((struct mac_tb_req *) (tb->data))->data_ptr[0], tb_size);
|
||||
memcpy(&buffer_pP[tbs_size], &((struct mac_tb_req *) (tb_p->data))->data_ptr[0], tb_size);
|
||||
tbs_size = tbs_size + tb_size;
|
||||
free_mem_block(tb);
|
||||
free_mem_block(tb_p);
|
||||
}
|
||||
}
|
||||
return tbs_size;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
tbs_size_t mac_rlc_data_req (module_id_t module_idP, u32_t frame, u8_t MBMS_flagP, chan_id_t channel_idP, char* bufferP) {
|
||||
tbs_size_t mac_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,
|
||||
logical_chan_id_t channel_idP,
|
||||
char *buffer_pP) {
|
||||
//-----------------------------------------------------------------------------
|
||||
struct mac_data_req data_request;
|
||||
rb_id_t rb_id;
|
||||
rb_id_t rb_id = 0;
|
||||
rlc_mode_t rlc_mode = RLC_NONE;
|
||||
void *rlc_p = NULL;
|
||||
|
||||
#ifdef DEBUG_MAC_INTERFACE
|
||||
LOG_D(RLC, "\n[RLC] Inst %d(%d): MAC_RLC_DATA_REQ channel %d (%d) MAX RB %d, Num_tb %d\n",
|
||||
module_idP,MAX_MODULES, channel_idP, RLC_MAX_LC, RLC_MAX_RB);
|
||||
|
||||
LOG_D(RLC, "\n[RLC] Inst %s enb id %d ue id %d: MAC_RLC_DATA_REQ channel %d (%d) MAX RB %d, Num_tb %d\n",
|
||||
(eNB_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, channel_idP, RLC_MAX_LC, NB_RB_MAX);
|
||||
|
||||
#endif // DEBUG_MAC_INTERFACE
|
||||
if (MBMS_flagP)
|
||||
AssertFatal (channel_idP < RLC_MAX_LC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_LC);
|
||||
else
|
||||
AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX);
|
||||
|
||||
if ((module_idP >= 0) && (module_idP < MAX_MODULES)) {
|
||||
if ((channel_idP >= 0) && (channel_idP < RLC_MAX_LC)) {
|
||||
rb_id = rlc[module_idP].m_lcid2rbid[channel_idP];
|
||||
if ((rb_id > 0) && (rb_id < RLC_MAX_RB)) {
|
||||
switch (rlc[module_idP].m_rlc_pointer[rb_id].rlc_type) {
|
||||
case RLC_NONE:
|
||||
//handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP);
|
||||
break;
|
||||
AssertFatal (enb_mod_idP >= oai_emulation.info.first_enb_local,
|
||||
"eNB module id is too low (%u/%d)!\n",
|
||||
enb_mod_idP,
|
||||
oai_emulation.info.first_enb_local);
|
||||
AssertFatal (enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local),
|
||||
"eNB module id is too high (%u/%d)!\n",
|
||||
enb_mod_idP,
|
||||
oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);
|
||||
AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local,
|
||||
"UE module id is too low (%u/%d)!\n",
|
||||
ue_mod_idP,
|
||||
oai_emulation.info.first_ue_local);
|
||||
AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
|
||||
"UE module id is too high (%u/%d)!\n",
|
||||
ue_mod_idP,
|
||||
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
|
||||
|
||||
case RLC_AM:
|
||||
data_request = rlc_am_mac_data_request(&rlc[module_idP].m_rlc_am_array[rlc[module_idP].m_rlc_pointer[rb_id].rlc_index], frame);
|
||||
return mac_rlc_serialize_tb(bufferP, data_request.data);
|
||||
break;
|
||||
|
||||
case RLC_UM:
|
||||
data_request = rlc_um_mac_data_request(&rlc[module_idP].m_rlc_um_array[rlc[module_idP].m_rlc_pointer[rb_id].rlc_index], frame);
|
||||
return mac_rlc_serialize_tb(bufferP, data_request.data);
|
||||
break;
|
||||
|
||||
case RLC_TM:
|
||||
data_request = rlc_tm_mac_data_request(&rlc[module_idP].m_rlc_tm_array[rlc[module_idP].m_rlc_pointer[rb_id].rlc_index], frame);
|
||||
return mac_rlc_serialize_tb(bufferP, data_request.data);
|
||||
break;
|
||||
|
||||
default:;
|
||||
//handle_event(ERROR,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no RLC found for this radio bearer %d\n", __FILE__, __LINE__, channel_idP);
|
||||
}
|
||||
} else {
|
||||
LOG_E(RLC, "%s() : radio bearer id out of bounds :%d\n", __FUNCTION__, rb_id);
|
||||
}
|
||||
} else {
|
||||
//handle_event(ERROR,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : parameter rb_id out of bounds :%d\n", __FILE__, __LINE__, channel_idP);
|
||||
LOG_E(RLC, "%s() : parameter channel_id out of bounds :%d\n", __FUNCTION__, channel_idP);
|
||||
return(-1);
|
||||
}
|
||||
} else {
|
||||
LOG_E(RLC, "%s() : parameter module_id out of bounds :%d\n", __FUNCTION__, module_idP);
|
||||
}
|
||||
return (tbs_size_t)0;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void mac_rlc_data_ind (module_id_t module_idP, u32_t frame, u8_t eNB_flag, u8_t MBMS_flagP, chan_id_t channel_idP, char* bufferP, tb_size_t tb_sizeP, num_tb_t num_tbP, crc_t *crcs) {
|
||||
//-----------------------------------------------------------------------------
|
||||
rb_id_t rb_id;
|
||||
#ifdef DEBUG_MAC_INTERFACE
|
||||
if (num_tbP) {
|
||||
LOG_D(RLC, "\n[RLC] Inst %d(%d): MAC_RLC_DATA_IND on channel %d (%d), rb max %d, Num_tb %d\n",
|
||||
module_idP,MAX_MODULES, channel_idP, RLC_MAX_LC, RLC_MAX_RB, num_tbP);
|
||||
}
|
||||
#endif // DEBUG_MAC_INTERFACE
|
||||
|
||||
if ((module_idP >= 0) && (module_idP < MAX_MODULES)) {
|
||||
if ((channel_idP >= 0) && (channel_idP < RLC_MAX_LC)) {
|
||||
rb_id = rlc[module_idP].m_lcid2rbid[channel_idP];
|
||||
if ((rb_id > 0) && (rb_id < RLC_MAX_RB)) {
|
||||
//if (num_tbP > 0) {
|
||||
struct mac_data_ind data_ind = mac_rlc_deserialize_tb(bufferP, tb_sizeP, num_tbP, crcs);
|
||||
|
||||
switch (rlc[module_idP].m_rlc_pointer[rb_id].rlc_type) {
|
||||
case RLC_NONE:
|
||||
//handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, rb_idP);
|
||||
LOG_W(RLC, " FONCTION mac_rlc_data_ind() : no radio bearer configured :%d\n", rb_id);
|
||||
break;
|
||||
|
||||
case RLC_AM:
|
||||
#ifdef DEBUG_MAC_INTERFACE
|
||||
LOG_D(RLC, "MAC DATA IND TO RLC_AM MOD_ID %d RB_INDEX %d (%d) MOD_ID_RLC %d\n", module_idP, rlc[module_idP].m_rlc_pointer[rb_id].rlc_index, rb_id, rlc[module_idP].m_rlc_am_array[rlc[module_idP].m_rlc_pointer[rb_id].rlc_index].module_id);
|
||||
#endif
|
||||
|
||||
rlc_am_mac_data_indication(&rlc[module_idP].m_rlc_am_array[rlc[module_idP].m_rlc_pointer[rb_id].rlc_index], frame, eNB_flag, data_ind);
|
||||
break;
|
||||
|
||||
case RLC_UM:
|
||||
#ifdef DEBUG_MAC_INTERFACE
|
||||
LOG_D(RLC, "MAC DATA IND TO RLC_UM MOD_ID %d RB_INDEX %d MOD_ID_RLC %d\n", module_idP, rlc[module_idP].m_rlc_pointer[rb_id].rlc_index, rlc[module_idP].m_rlc_um_array[rlc[module_idP].m_rlc_pointer[rb_id].rlc_index].module_id);
|
||||
#endif
|
||||
rlc_um_mac_data_indication(&rlc[module_idP].m_rlc_um_array[rlc[module_idP].m_rlc_pointer[rb_id].rlc_index], frame, eNB_flag, data_ind);
|
||||
break;
|
||||
|
||||
case RLC_TM:
|
||||
#ifdef DEBUG_MAC_INTERFACE
|
||||
LOG_D(RLC, "MAC DATA IND TO RLC_TM MOD_ID %d RB_INDEX %d MOD_ID_RLC %d\n", module_idP, rlc[module_idP].m_rlc_pointer[rb_id].rlc_index, rlc[module_idP].m_rlc_tm_array[rlc[module_idP].m_rlc_pointer[rb_id].rlc_index].module_id);
|
||||
#endif
|
||||
rlc_tm_mac_data_indication(&rlc[module_idP].m_rlc_tm_array[rlc[module_idP].m_rlc_pointer[rb_id].rlc_index], frame, eNB_flag, data_ind);
|
||||
break;
|
||||
|
||||
default:
|
||||
//handle_event(ERROR,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no RLC found for this radio bearer %d\n", __FILE__, __LINE__, rb_idP);
|
||||
LOG_W(RLC, "FILE FONCTION mac_rlc_data_ind() LINE : no RLC found for this radio bearer %d\n", rb_id);
|
||||
;
|
||||
|
||||
}
|
||||
} else {
|
||||
LOG_E(RLC, "%s() : radio bearer id out of bounds : rb is %d\n", __FUNCTION__, rb_id);
|
||||
}
|
||||
} else {
|
||||
LOG_E(RLC, "%s() : parameter channel_id out of bounds : channel is %d\n", __FUNCTION__, channel_idP);
|
||||
if (eNB_flagP) {
|
||||
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;
|
||||
switch (rlc_mode) {
|
||||
case RLC_NONE:
|
||||
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;
|
||||
break;
|
||||
case RLC_AM:
|
||||
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.am;
|
||||
break;
|
||||
case RLC_UM:
|
||||
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.um;
|
||||
break;
|
||||
case RLC_TM:
|
||||
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.tm;
|
||||
break;
|
||||
default:
|
||||
AssertFatal (0 , "enB RLC internal memory error rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
|
||||
}
|
||||
} else {
|
||||
LOG_E(RLC, "%s() : parameter module_id out of bounds : module id is %d\n", __FUNCTION__, module_idP);
|
||||
rb_id = lcid2rbid_ue[ue_mod_idP][channel_idP];
|
||||
rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode;
|
||||
switch (rlc_mode) {
|
||||
case RLC_NONE:
|
||||
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;
|
||||
break;
|
||||
case RLC_AM:
|
||||
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.am;
|
||||
break;
|
||||
case RLC_UM:
|
||||
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.um;
|
||||
break;
|
||||
case RLC_TM:
|
||||
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.tm;
|
||||
break;
|
||||
default:
|
||||
AssertFatal (0 , "UE RLC internal memory error rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP);
|
||||
}
|
||||
}
|
||||
|
||||
switch (rlc_mode) {
|
||||
case RLC_NONE:
|
||||
break;
|
||||
|
||||
case RLC_AM:
|
||||
data_request = rlc_am_mac_data_request((rlc_am_entity_t*)rlc_p, frameP);
|
||||
return mac_rlc_serialize_tb(buffer_pP, data_request.data);
|
||||
break;
|
||||
|
||||
case RLC_UM:
|
||||
data_request = rlc_um_mac_data_request((rlc_um_entity_t*)rlc_p, frameP);
|
||||
return mac_rlc_serialize_tb(buffer_pP, data_request.data);
|
||||
break;
|
||||
|
||||
case RLC_TM:
|
||||
data_request = rlc_tm_mac_data_request((rlc_tm_entity_t*)rlc_p, frameP);
|
||||
return mac_rlc_serialize_tb(buffer_pP, data_request.data);
|
||||
break;
|
||||
|
||||
default:;
|
||||
}
|
||||
return (tbs_size_t)0;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void mac_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,
|
||||
logical_chan_id_t channel_idP,
|
||||
char *buffer_pP,
|
||||
tb_size_t tb_sizeP,
|
||||
num_tb_t num_tbP,
|
||||
crc_t *crcs_pP) {
|
||||
//-----------------------------------------------------------------------------
|
||||
rb_id_t rb_id = 0;
|
||||
rlc_mode_t rlc_mode = RLC_NONE;
|
||||
void *rlc_p = NULL;
|
||||
#ifdef DEBUG_MAC_INTERFACE
|
||||
if (num_tbP) {
|
||||
LOG_D(RLC, "[Frame %5u][%s][RLC][MOD %u/%u] MAC_RLC_DATA_IND on channel %d (%d), rb max %d, Num_tb %d\n",
|
||||
frameP,
|
||||
(eNB_flagP) ? "eNB" : "UE",
|
||||
enb_mod_idP,
|
||||
ue_mod_idP,
|
||||
channel_idP,
|
||||
RLC_MAX_LC,
|
||||
NB_RB_MAX,
|
||||
num_tbP);
|
||||
}
|
||||
#endif // DEBUG_MAC_INTERFACE
|
||||
if (MBMS_flagP)
|
||||
AssertFatal (channel_idP < RLC_MAX_LC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_LC);
|
||||
else
|
||||
AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX);
|
||||
|
||||
AssertFatal (enb_mod_idP >= oai_emulation.info.first_enb_local,
|
||||
"eNB module id is too low (%u/%d)!\n",
|
||||
enb_mod_idP,
|
||||
oai_emulation.info.first_enb_local);
|
||||
AssertFatal (enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local),
|
||||
"eNB module id is too high (%u/%d)!\n",
|
||||
enb_mod_idP,
|
||||
oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);
|
||||
AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local,
|
||||
"UE module id is too low (%u/%d)!\n",
|
||||
ue_mod_idP,
|
||||
oai_emulation.info.first_ue_local);
|
||||
AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
|
||||
"UE module id is too high (%u/%d)!\n",
|
||||
ue_mod_idP,
|
||||
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
|
||||
|
||||
if (eNB_flagP) {
|
||||
rb_id = lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][channel_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;
|
||||
switch (rlc_mode) {
|
||||
case RLC_NONE:
|
||||
AssertFatal (0 , "enB RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
|
||||
break;
|
||||
case RLC_AM:
|
||||
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.am;
|
||||
break;
|
||||
case RLC_UM:
|
||||
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.um;
|
||||
break;
|
||||
case RLC_TM:
|
||||
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.tm;
|
||||
break;
|
||||
default:
|
||||
AssertFatal (0 , "enB RLC internal memory error rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
|
||||
}
|
||||
} else {
|
||||
rb_id = lcid2rbid_ue[ue_mod_idP][channel_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;
|
||||
switch (rlc_mode) {
|
||||
case RLC_NONE:
|
||||
AssertFatal (0 , "UE RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP);
|
||||
break;
|
||||
case RLC_AM:
|
||||
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.am;
|
||||
break;
|
||||
case RLC_UM:
|
||||
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.um;
|
||||
break;
|
||||
case RLC_TM:
|
||||
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.tm;
|
||||
break;
|
||||
default:
|
||||
AssertFatal (0 , "UE RLC internal memory error rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP);
|
||||
}
|
||||
}
|
||||
struct mac_data_ind data_ind = mac_rlc_deserialize_tb(buffer_pP, tb_sizeP, num_tbP, crcs_pP);
|
||||
switch (rlc_mode) {
|
||||
case RLC_NONE:
|
||||
//handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP);
|
||||
break;
|
||||
|
||||
case RLC_AM:
|
||||
#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);
|
||||
#endif
|
||||
rlc_am_mac_data_indication((rlc_am_entity_t*)rlc_p, frameP, eNB_flagP, data_ind);
|
||||
break;
|
||||
|
||||
case RLC_UM:
|
||||
#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);
|
||||
#endif
|
||||
rlc_um_mac_data_indication((rlc_um_entity_t*)rlc_p, frameP, eNB_flagP, data_ind);
|
||||
break;
|
||||
|
||||
case RLC_TM:
|
||||
#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);
|
||||
#endif
|
||||
rlc_tm_mac_data_indication((rlc_tm_entity_t*)rlc_p, frameP, eNB_flagP, data_ind);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t module_idP, u32_t frame, u8_t eNB_flag, u8_t MBMS_flagP, chan_id_t channel_idP, tb_size_t tb_sizeP) {
|
||||
mac_rlc_status_resp_t mac_rlc_status_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, logical_chan_id_t channel_idP, tb_size_t tb_sizeP) {
|
||||
//-----------------------------------------------------------------------------
|
||||
rb_id_t rb_id = 0;
|
||||
mac_rlc_status_resp_t mac_rlc_status_resp;
|
||||
struct mac_status_ind tx_status;
|
||||
struct mac_status_resp status_resp;
|
||||
rb_id_t rb_id = 0;
|
||||
rlc_mode_t rlc_mode = RLC_NONE;
|
||||
void *rlc_p = NULL;
|
||||
|
||||
mac_rlc_status_resp.bytes_in_buffer = 0;
|
||||
mac_rlc_status_resp.pdus_in_buffer = 0;
|
||||
memset (&mac_rlc_status_resp, 0, sizeof(mac_rlc_status_resp_t));
|
||||
memset (&tx_status , 0, sizeof(struct mac_status_ind));
|
||||
|
||||
if ((module_idP >= 0) && (module_idP < MAX_MODULES)) {
|
||||
if ((channel_idP >= 0) && (channel_idP < RLC_MAX_LC)) {
|
||||
rb_id = rlc[module_idP].m_lcid2rbid[channel_idP];
|
||||
if ((rb_id > 0) && (rb_id < RLC_MAX_RB)) {
|
||||
struct mac_status_resp status_resp;
|
||||
struct mac_status_ind tx_status;
|
||||
switch (rlc[module_idP].m_rlc_pointer[channel_idP].rlc_type) {
|
||||
case RLC_NONE:
|
||||
//handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP);
|
||||
break;
|
||||
if (MBMS_flagP)
|
||||
AssertFatal (channel_idP < RLC_MAX_LC, "%s channel id is too high (%u/%d) enb module id %u ue module id %u!\n",(eNB_flagP) ? "eNB" : "UE", channel_idP, RLC_MAX_LC, enb_mod_idP, ue_mod_idP);
|
||||
else
|
||||
AssertFatal (channel_idP < NB_RB_MAX, "%s channel id is too high (%u/%d) enb module id %u ue module id %u!\n",(eNB_flagP) ? "eNB" : "UE", channel_idP, NB_RB_MAX, enb_mod_idP, ue_mod_idP);
|
||||
|
||||
case RLC_AM:
|
||||
status_resp = rlc_am_mac_status_indication(&rlc[module_idP].m_rlc_am_array[rlc[module_idP].m_rlc_pointer[channel_idP].rlc_index], frame, tb_sizeP, tx_status);
|
||||
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_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
|
||||
mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented;
|
||||
return mac_rlc_status_resp;
|
||||
break;
|
||||
AssertFatal (enb_mod_idP >= oai_emulation.info.first_enb_local,
|
||||
"eNB module id is too low (%u/%d)!\n",
|
||||
enb_mod_idP,
|
||||
oai_emulation.info.first_enb_local);
|
||||
AssertFatal (enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local),
|
||||
"eNB module id is too high (%u/%d)!\n",
|
||||
enb_mod_idP,
|
||||
oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);
|
||||
AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local,
|
||||
"UE module id is too low (%u/%d)!\n",
|
||||
ue_mod_idP,
|
||||
oai_emulation.info.first_ue_local);
|
||||
AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
|
||||
"UE module id is too high (%u/%d)!\n",
|
||||
ue_mod_idP,
|
||||
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
|
||||
|
||||
case RLC_UM:
|
||||
//msg("[RLC_UM][MOD %d] mac_rlc_status_ind tb_size %d\n", module_idP, tb_sizeP);
|
||||
status_resp = rlc_um_mac_status_indication(&rlc[module_idP].m_rlc_um_array[rlc[module_idP].m_rlc_pointer[channel_idP].rlc_index], frame, eNB_flag, tb_sizeP, tx_status);
|
||||
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.head_sdu_creation_time = status_resp.head_sdu_creation_time;
|
||||
mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
|
||||
mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented;
|
||||
return mac_rlc_status_resp;
|
||||
break;
|
||||
|
||||
case RLC_TM:
|
||||
status_resp = rlc_tm_mac_status_indication(&rlc[module_idP].m_rlc_tm_array[rlc[module_idP].m_rlc_pointer[channel_idP].rlc_index], frame, tb_sizeP, tx_status);
|
||||
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;
|
||||
return mac_rlc_status_resp;
|
||||
break;
|
||||
|
||||
default:;
|
||||
//handle_event(ERROR,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no RLC found for this radio bearer %d\n", __FILE__, __LINE__, channel_idP);
|
||||
|
||||
}
|
||||
} else {
|
||||
// two many traces because MAC probe inactive channels. LOG_E(RLC, "%s(Mod=%d, eNB_flag=%d, mbms flag=%d,channel_id=%d) : radio bearer id out of bounds :%d \n", __FUNCTION__, module_idP, eNB_flag, MBMS_flagP, channel_idP, rb_id);
|
||||
}
|
||||
} else {
|
||||
LOG_E(RLC, "%s() : parameter channel_id out of bounds :%d\n", __FUNCTION__, channel_idP);
|
||||
if (eNB_flagP) {
|
||||
rb_id = lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][channel_idP];
|
||||
if (rb_id >= NB_RB_MAX) {
|
||||
/*LOG_D(RLC, "[FRAME %05d][%s][RLC][MOD %u/%u] MAC STATUS IND TO NOT CONFIGURED BEARER lc id %u \n",
|
||||
frameP,
|
||||
(eNB_flagP) ? "eNB" : "UE",
|
||||
enb_mod_idP,
|
||||
ue_mod_idP,
|
||||
channel_idP);*/
|
||||
return mac_rlc_status_resp;
|
||||
}
|
||||
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode;
|
||||
switch (rlc_mode) {
|
||||
case RLC_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);
|
||||
return mac_rlc_status_resp;
|
||||
break;
|
||||
case RLC_AM:
|
||||
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.am;
|
||||
break;
|
||||
case RLC_UM:
|
||||
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.um;
|
||||
break;
|
||||
case RLC_TM:
|
||||
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.tm;
|
||||
break;
|
||||
default:
|
||||
AssertFatal (0 , "enB RLC internal memory error rb id %u lcid %u enb id %u ue id %u!\n", rb_id, channel_idP, enb_mod_idP, ue_mod_idP);
|
||||
}
|
||||
} else {
|
||||
LOG_E(RLC, "%s() : parameter module_id out of bounds :%d\n", __FUNCTION__, module_idP);
|
||||
rb_id = lcid2rbid_ue[ue_mod_idP][channel_idP];
|
||||
if (rb_id >= NB_RB_MAX) {
|
||||
/*LOG_D(RLC, "[FRAME %05d][%s][RLC][MOD %u/%u] MAC STATUS IND TO NOT CONFIGURED BEARER lc id %u \n",
|
||||
frameP,
|
||||
(eNB_flagP) ? "eNB" : "UE",
|
||||
enb_mod_idP,
|
||||
ue_mod_idP,
|
||||
channel_idP);*/
|
||||
return mac_rlc_status_resp;
|
||||
}
|
||||
rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode;
|
||||
switch (rlc_mode) {
|
||||
case RLC_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);
|
||||
return mac_rlc_status_resp;
|
||||
break;
|
||||
case RLC_AM:
|
||||
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.am;
|
||||
break;
|
||||
case RLC_UM:
|
||||
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.um;
|
||||
break;
|
||||
case RLC_TM:
|
||||
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.tm;
|
||||
break;
|
||||
default:
|
||||
AssertFatal (0 , "UE RLC internal memory error rb id %u lcid %u enb id %u ue id %u!\n", rb_id, channel_idP, enb_mod_idP, ue_mod_idP);
|
||||
}
|
||||
}
|
||||
|
||||
switch (rlc_mode) {
|
||||
case RLC_NONE:
|
||||
//handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP);
|
||||
break;
|
||||
|
||||
case RLC_AM:
|
||||
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.head_sdu_creation_time = status_resp.head_sdu_creation_time;
|
||||
mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
|
||||
mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented;
|
||||
return mac_rlc_status_resp;
|
||||
break;
|
||||
|
||||
case RLC_UM:
|
||||
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.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus;
|
||||
mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time;
|
||||
mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
|
||||
mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented;
|
||||
return mac_rlc_status_resp;
|
||||
break;
|
||||
|
||||
case RLC_TM:
|
||||
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.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus;
|
||||
return mac_rlc_status_resp;
|
||||
break;
|
||||
|
||||
default:;
|
||||
}
|
||||
return mac_rlc_status_resp;
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
rlc_op_status_t mpls_rlc_data_req (module_id_t module_idP, u32_t frame, rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t* sduP) {
|
||||
rlc_op_status_t mpls_rlc_data_req (module_id_t enb_module_idP, module_id_t ue_module_idP, u32_t frame, rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t* sduP) {
|
||||
//-----------------------------------------------------------------------------
|
||||
// third arg should be set to 1 or 0
|
||||
return rlc_data_req(module_idP, frame, 0, 0,rb_idP, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, sdu_sizeP, sduP);
|
||||
return rlc_data_req(enb_module_idP, ue_module_idP, frame, 0, 0,rb_idP, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, sdu_sizeP, sduP);
|
||||
}
|
||||
|
||||
|
||||
+641
-290
File diff suppressed because it is too large
Load Diff
@@ -60,7 +60,7 @@ GT301 = $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_301),-DKERNEL_VERSION_GREATER_
|
||||
# EXTRA COMPILER FLAGS
|
||||
####################################################
|
||||
EXTRA_CFLAGS = -fno-common $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_20),-mregparm=3 -fno-stack-protector -mpreferred-stack-boundary=4) $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) $(GT2622) $(GT2629) $(V3) $(GT32) $(GT301)
|
||||
|
||||
EXTRA_CFLAGS += -I$(OPENAIR2_DIR)
|
||||
ifdef NAS_NETLINK
|
||||
EXTRA_CFLAGS += -DNAS_NETLINK
|
||||
else
|
||||
|
||||
@@ -361,7 +361,7 @@ void nas_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct class
|
||||
|
||||
void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst){
|
||||
//---------------------------------------------------------------------------
|
||||
struct pdcp_data_req_header_t pdcph;
|
||||
struct pdcp_data_req_header_s pdcph;
|
||||
struct nas_priv *priv=netdev_priv(nasdev[inst]);
|
||||
#ifdef LOOPBACK_TEST
|
||||
int i;
|
||||
@@ -479,7 +479,7 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct class
|
||||
void nas_COMMON_QOS_receive(){
|
||||
//---------------------------------------------------------------------------
|
||||
u8 sapi;
|
||||
struct pdcp_data_ind_header_t pdcph;
|
||||
struct pdcp_data_ind_header_s pdcph;
|
||||
unsigned char data_buffer[2048];
|
||||
struct classifier_entity *rclass;
|
||||
struct nas_priv *priv;
|
||||
@@ -540,7 +540,7 @@ void nas_COMMON_QOS_receive(){
|
||||
void nas_COMMON_QOS_receive(struct nlmsghdr *nlh)
|
||||
{
|
||||
|
||||
struct pdcp_data_ind_header_t *pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
|
||||
struct pdcp_data_ind_header_s *pdcph = (struct pdcp_data_ind_header_s *)NLMSG_DATA(nlh);
|
||||
struct classifier_entity *rclass;
|
||||
struct nas_priv *priv;
|
||||
|
||||
|
||||
@@ -92,27 +92,27 @@
|
||||
// Radio Bearers
|
||||
#define NAS_RB_ESTABLISHING 0x24
|
||||
#define NAS_RB_RELEASING 0x28
|
||||
#define NAS_RB_DCH 0x2A
|
||||
#define NAS_RB_DCH 0x2A
|
||||
|
||||
|
||||
#define NAS_TIMER_ESTABLISHMENT_DEFAULT 12
|
||||
#define NAS_TIMER_RELEASE_DEFAULT 2
|
||||
#define NAS_TIMER_IDLE UINT_MAX
|
||||
#define NAS_TIMER_TICK HZ
|
||||
#define NAS_TIMER_RELEASE_DEFAULT 2
|
||||
#define NAS_TIMER_IDLE UINT_MAX
|
||||
#define NAS_TIMER_TICK HZ
|
||||
|
||||
#define NAS_PDCPH_SIZE sizeof(struct pdcp_data_req_header_t)
|
||||
#define NAS_IPV4_SIZE 20
|
||||
#define NAS_IPV6_SIZE 40
|
||||
#define NAS_PDCPH_SIZE sizeof(struct pdcp_data_req_header_s)
|
||||
#define NAS_IPV4_SIZE 20
|
||||
#define NAS_IPV6_SIZE 40
|
||||
|
||||
#define NAS_DIRECTION_SEND 0
|
||||
#define NAS_DIRECTION_RECEIVE 1
|
||||
#define NAS_DIRECTION_FORWARD 2
|
||||
#define NAS_DIRECTION_SEND 0
|
||||
#define NAS_DIRECTION_RECEIVE 1
|
||||
#define NAS_DIRECTION_FORWARD 2
|
||||
|
||||
// function number
|
||||
#define NAS_FCT_DEL_SEND 1
|
||||
#define NAS_FCT_QOS_SEND 2
|
||||
#define NAS_FCT_DC_SEND 3
|
||||
#define NAS_FCT_CTL_SEND 4
|
||||
#define NAS_FCT_DEL_SEND 1
|
||||
#define NAS_FCT_QOS_SEND 2
|
||||
#define NAS_FCT_DC_SEND 3
|
||||
#define NAS_FCT_CTL_SEND 4
|
||||
|
||||
// type of IOCTL command
|
||||
#define NAS_IOCTL_RRM 0x89F0
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
#include "constant.h"
|
||||
#include "sap.h"
|
||||
#include "rrc_nas_primitives.h"
|
||||
#include "COMMON/platform_types.h"
|
||||
|
||||
struct rb_entity
|
||||
{
|
||||
@@ -166,18 +167,18 @@ struct ipversion {
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct pdcp_data_req_header_t {
|
||||
unsigned int rb_id;
|
||||
unsigned int data_size;
|
||||
int inst;
|
||||
int traffic_type;
|
||||
typedef struct pdcp_data_req_header_s {
|
||||
rb_id_t rb_id;
|
||||
sdu_size_t data_size;
|
||||
signed int inst;
|
||||
traffic_type_t traffic_type;
|
||||
} pdcp_data_req_header_t;
|
||||
|
||||
typedef struct pdcp_data_ind_header_t {
|
||||
unsigned int rb_id;
|
||||
unsigned int data_size;
|
||||
int inst;
|
||||
int dummy;
|
||||
typedef struct pdcp_data_ind_header_s {
|
||||
rb_id_t rb_id;
|
||||
sdu_size_t data_size;
|
||||
signed int inst;
|
||||
traffic_type_t dummy_traffic_type;
|
||||
} pdcp_data_ind_header_t;
|
||||
|
||||
extern struct net_device *nasdev[NB_INSTANCES_MAX];
|
||||
|
||||
@@ -87,124 +87,124 @@
|
||||
#include "openair_rrc_L2_interface.h"
|
||||
|
||||
/********************************************************************************************************************/
|
||||
s8 mac_rrc_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb,u8 *Buffer,u8 eNB_flag,u8 eNB_index, u8 mbsfn_sync_area){
|
||||
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(Mod_id,Srb_id,Nb_tb,Buffer,eNB_index));
|
||||
return(rrc_L2_data_req_rx(module_idP,srb_idP,nb_tbP,buffer_pP,eNB_indexP));
|
||||
#else
|
||||
return(mac_rrc_lite_data_req(Mod_id,frame,Srb_id,Nb_tb,Buffer,eNB_flag,eNB_index,mbsfn_sync_area));
|
||||
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(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu,u16 Sdu_len,u8 eNB_flag, u8 eNB_index,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(Mod_id, Srb_id, Sdu, Sdu_len, eNB_index));
|
||||
return(rrc_L2_mac_data_ind_rx(module_idP, Srb_id, Sdu, Sdu_len, eNB_indexP));
|
||||
#else
|
||||
return(mac_rrc_lite_data_ind(Mod_id,frame,Srb_id,Sdu,Sdu_len,eNB_flag,eNB_index,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(u8_t eNB_id, u8_t UE_id, u32 frame, u8 eNB_flag, unsigned int Srb_id, unsigned int Sdu_size,u8 *Buffer){
|
||||
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(Mod_id,Srb_id, Sdu_size, Buffer);
|
||||
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(Mod_id,frame,eNB_flag,Srb_id,Sdu_size,Buffer);
|
||||
rrc_lite_data_ind(eNB_id, UE_id,frame,eNB_flag,Srb_id,Sdu_size,Buffer);
|
||||
//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);
|
||||
#endif //CELLULAR
|
||||
}
|
||||
|
||||
/********************************************************************************************************************/
|
||||
u8 pdcp_rrc_data_req(u8 eNB_id, u8 UE_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 muiP, u32 confirmP,
|
||||
unsigned int sdu_buffer_size, u8* sdu_buffer, u8 mode) {
|
||||
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) {
|
||||
/********************************************************************************************************************/
|
||||
#ifdef CELLULAR
|
||||
return pdcp_data_req( module_id, frame, eNB_flag, rb_id, muiP, confirmP, sdu_buffer_size, sdu_buffer, mode);
|
||||
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_id, UE_id, frame, eNB_flag, rb_id, muiP, confirmP, sdu_buffer_size, sdu_buffer, mode);
|
||||
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(u8_t eNB_id, u8_t UE_id, u32 frame, u8 eNB_flag, unsigned int Srb_id, unsigned int Sdu_size,u8 *Buffer){
|
||||
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(Mod_id,Srb_id, Sdu_size, Buffer);
|
||||
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(Mod_id,frame,eNB_flag,Srb_id,Sdu_size,Buffer);
|
||||
rrc_lite_data_ind(eNB_id, UE_id,frame,eNB_flag,Srb_id,Sdu_size,Buffer);
|
||||
//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);
|
||||
#endif //CELLULAR
|
||||
}
|
||||
|
||||
/********************************************************************************************************************/
|
||||
void mac_rrc_meas_ind(u8 Mod_id,MAC_MEAS_REQ_ENTRY *Meas_entry){
|
||||
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(Mod_id,Meas_entry);
|
||||
// mac_rrc_meas_ind(module_idP,Meas_entry_pP);
|
||||
#endif //CELLULAR
|
||||
}
|
||||
|
||||
/********************************************************************************************************************/
|
||||
void mac_sync_ind(u8 Mod_id,u8 Status){
|
||||
void mac_sync_ind(module_id_t module_idP,u8 Status){
|
||||
/********************************************************************************************************************/
|
||||
#ifdef CELLULAR
|
||||
rrc_L2_sync_ind_rx(Mod_id);
|
||||
rrc_L2_sync_ind_rx(module_idP);
|
||||
#else
|
||||
mac_lite_sync_ind(Mod_id,Status);
|
||||
mac_lite_sync_ind(module_idP,Status);
|
||||
#endif //CELLULAR
|
||||
}
|
||||
|
||||
/********************************************************************************************************************/
|
||||
void mac_in_sync_ind(u8 Mod_id,u32 frame, u16 eNB_index){
|
||||
void mac_in_sync_ind(module_id_t module_idP,frame_t frameP, u16 eNB_indexP){
|
||||
/********************************************************************************************************************/
|
||||
#ifdef CELLULAR
|
||||
rrc_L2_sync_ind_rx(Mod_id);
|
||||
rrc_L2_sync_ind_rx(module_idP);
|
||||
#else
|
||||
rrc_lite_in_sync_ind(Mod_id,frame,eNB_index);
|
||||
rrc_lite_in_sync_ind(module_idP,frameP,eNB_indexP);
|
||||
#endif
|
||||
}
|
||||
|
||||
/********************************************************************************************************************/
|
||||
void mac_out_of_sync_ind(u8 Mod_id,u32 frame, u16 eNB_index){
|
||||
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(Mod_id,frame,eNB_index);
|
||||
rrc_lite_out_of_sync_ind(module_idP,frameP,eNB_indexP);
|
||||
#endif //CELLULAR
|
||||
}
|
||||
|
||||
/********************************************************************************************************************/
|
||||
int mac_get_rrc_status(u8 Mod_id,u8 eNB_flag,u8 index) {
|
||||
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(Mod_id,eNB_flag,index));
|
||||
return (rrc_L2_get_rrc_status(module_idP,eNB_flagP,indexP));
|
||||
#else
|
||||
return mac_get_rrc_lite_status(Mod_id, eNB_flag, index);
|
||||
return mac_get_rrc_lite_status(module_idP, eNB_flagP, indexP);
|
||||
#endif //CELLULAR
|
||||
}
|
||||
|
||||
/********************************************************************************************************************/
|
||||
char openair_rrc_ue_init(u8 Mod_id, unsigned char eNB_index){
|
||||
char openair_rrc_ue_init(module_id_t module_idP, unsigned char eNB_indexP){
|
||||
/********************************************************************************************************************/
|
||||
#ifdef CELLULAR
|
||||
return (rrc_L2_ue_init(Mod_id,eNB_index));
|
||||
return (rrc_L2_ue_init(module_idP,eNB_indexP));
|
||||
#else
|
||||
return openair_rrc_lite_ue_init(Mod_id, eNB_index);
|
||||
return openair_rrc_lite_ue_init(module_idP, eNB_indexP);
|
||||
#endif //CELLULAR
|
||||
}
|
||||
|
||||
/********************************************************************************************************************/
|
||||
char openair_rrc_eNB_init(u8 Mod_id){
|
||||
char openair_rrc_eNB_init(module_id_t module_idP){
|
||||
/********************************************************************************************************************/
|
||||
#ifdef CELLULAR
|
||||
return( rrc_L2_eNB_init(Mod_id));
|
||||
return( rrc_L2_eNB_init(module_idP));
|
||||
#else
|
||||
return openair_rrc_lite_eNB_init(Mod_id);
|
||||
return openair_rrc_lite_eNB_init(module_idP);
|
||||
#endif //CELLULAR
|
||||
}
|
||||
|
||||
@@ -39,32 +39,33 @@
|
||||
#define __OPENAIR_RRC_L2_INTERFACE_H__
|
||||
|
||||
#include "COMMON/mac_rrc_primitives.h"
|
||||
#include "COMMON/platform_types.h"
|
||||
|
||||
s8 mac_rrc_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer, u8 eNB_flag, u8 eNB_index,
|
||||
u8 mbsfn_sync_area);
|
||||
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_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 Sdu_len, u8 eNB_flag, u8 eNB_index,
|
||||
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_index,
|
||||
u8 mbsfn_sync_areaP);
|
||||
|
||||
void mac_lite_sync_ind(u8 Mod_id, u8 status);
|
||||
void mac_lite_sync_ind(module_id_t module_idP, u8 statusP);
|
||||
|
||||
void mac_rrc_meas_ind(u8, MAC_MEAS_REQ_ENTRY*);
|
||||
void mac_rrc_meas_ind(module_id_t, MAC_MEAS_REQ_ENTRY*);
|
||||
|
||||
void rlcrrc_data_ind(u8_t eNB_id, u8_t UE_id, u32 frame, u8 eNB_flag, unsigned int Rb_id, u32 sdu_size, u8 *Buffer);
|
||||
void rlcrrc_data_ind(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, sdu_size_t sdu_sizeP, u8 *buffer_pP);
|
||||
|
||||
u8 pdcp_rrc_data_req(u8 eNB_id, u8 UE_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 muiP, u32 confirmP,
|
||||
unsigned int sdu_buffer_size, u8* sdu_buffer, u8 mode);
|
||||
u8 pdcp_rrc_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, boolean_t confirmP,
|
||||
sdu_size_t sdu_buffer_size, u8* sdu_buffer, u8 mode);
|
||||
|
||||
void pdcp_rrc_data_ind(u8_t eNB_id, u8_t UE_id, u32 frame, u8 eNB_flag, unsigned int Srb_id, unsigned int Sdu_size, u8 *Buffer);
|
||||
void pdcp_rrc_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t srb_idP, sdu_size_t sdu_sizeP, u8 *buffer_pP);
|
||||
|
||||
void mac_out_of_sync_ind(u8 Mod_id, u32 frame, u16 CH_index);
|
||||
void mac_out_of_sync_ind(module_id_t module_idP, frame_t frameP, u16 CH_index);
|
||||
|
||||
char openair_rrc_eNB_init(u8 Mod_id);
|
||||
char openair_rrc_eNB_init(module_id_t module_idP);
|
||||
|
||||
char openair_rrc_ue_init(u8 Mod_id, unsigned char eNB_index);
|
||||
char openair_rrc_ue_init(module_id_t module_idP, unsigned char eNB_indexP);
|
||||
|
||||
int mac_get_rrc_status(u8 Mod_id, u8 eNB_flag, u8 index);
|
||||
int mac_get_rrc_status(module_id_t module_idP, eNB_flag_t eNB_flagP, u8 indexP);
|
||||
|
||||
void mac_in_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index);
|
||||
void mac_in_sync_ind(module_id_t module_idP, frame_t frameP, u16 eNB_indexP);
|
||||
|
||||
#endif
|
||||
|
||||
+124
-124
@@ -60,10 +60,10 @@ extern UE_MAC_INST *UE_mac_inst;
|
||||
//#define RRC_DATA_REQ_DEBUG
|
||||
#define DEBUG_RRC
|
||||
|
||||
u32 mui=0;
|
||||
mui_t mui=0;
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer, u8 eNB_flag, u8 eNB_index,
|
||||
s8 mac_rrc_lite_data_req(module_id_t Mod_idP, frame_t frameP, u16 Srb_id, u8 Nb_tb, u8 *buffer_pP, eNB_flag_t eNB_flagP, u8 eNB_index,
|
||||
u8 mbsfn_sync_area) {
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
SRB_INFO *Srb_info;
|
||||
@@ -71,21 +71,21 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer,
|
||||
|
||||
#ifdef DEBUG_RRC
|
||||
int i;
|
||||
LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_id,Srb_id);
|
||||
LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
|
||||
#endif
|
||||
|
||||
if( eNB_flag == 1){
|
||||
if( eNB_flagP == 1){
|
||||
|
||||
if((Srb_id & RAB_OFFSET) == BCCH){
|
||||
if(eNB_rrc_inst[Mod_id].SI.Active==0) return 0;
|
||||
if(eNB_rrc_inst[Mod_idP].SI.Active==0) return 0;
|
||||
|
||||
// All even frames transmit SIB in SF 5
|
||||
if (eNB_rrc_inst[Mod_id].sizeof_SIB1 == 255) {
|
||||
LOG_E(RRC,"[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_id);
|
||||
if (eNB_rrc_inst[Mod_idP].sizeof_SIB1 == 255) {
|
||||
LOG_E(RRC,"[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP);
|
||||
mac_xface->macphy_exit("");
|
||||
}
|
||||
if ((frame%2) == 0) {
|
||||
memcpy(&Buffer[0],eNB_rrc_inst[Mod_id].SIB1,eNB_rrc_inst[Mod_id].sizeof_SIB1);
|
||||
if ((frameP%2) == 0) {
|
||||
memcpy(&buffer_pP[0],eNB_rrc_inst[Mod_idP].SIB1,eNB_rrc_inst[Mod_idP].sizeof_SIB1);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
@@ -100,7 +100,7 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer,
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frame;
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size;
|
||||
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu));
|
||||
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, eNB_rrc_inst[Mod_id].SIB1, sib1_size);
|
||||
@@ -111,21 +111,21 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer,
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_RRC
|
||||
LOG_D(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_id,frame);
|
||||
for (i=0;i<eNB_rrc_inst[Mod_id].sizeof_SIB1;i++)
|
||||
LOG_T(RRC,"%x.",Buffer[i]);
|
||||
LOG_D(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP);
|
||||
for (i=0;i<eNB_rrc_inst[Mod_idP].sizeof_SIB1;i++)
|
||||
LOG_T(RRC,"%x.",buffer_pP[i]);
|
||||
LOG_T(RRC,"\n");
|
||||
#endif
|
||||
|
||||
return (eNB_rrc_inst[Mod_id].sizeof_SIB1);
|
||||
return (eNB_rrc_inst[Mod_idP].sizeof_SIB1);
|
||||
} // All RFN mod 8 transmit SIB2-3 in SF 5
|
||||
else if ((frame%8) == 1){
|
||||
memcpy(&Buffer[0],eNB_rrc_inst[Mod_id].SIB23,eNB_rrc_inst[Mod_id].sizeof_SIB23);
|
||||
else if ((frameP%8) == 1){
|
||||
memcpy(&buffer_pP[0],eNB_rrc_inst[Mod_idP].SIB23,eNB_rrc_inst[Mod_idP].sizeof_SIB23);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int sib23_size = eNB_rrc_inst[Mod_id].sizeof_SIB23;
|
||||
int sib23_size = eNB_rrc_inst[Mod_idP].sizeof_SIB23;
|
||||
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
|
||||
|
||||
if (sib23_size > sdu_size)
|
||||
@@ -135,23 +135,23 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer,
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frame;
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size;
|
||||
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu));
|
||||
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, eNB_rrc_inst[Mod_id].SIB23, sib23_size);
|
||||
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, eNB_rrc_inst[Mod_idP].SIB23, sib23_size);
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_MAC_ENB, Mod_id, message_p);
|
||||
itti_send_msg_to_task (TASK_MAC_ENB, Mod_idP, message_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_RRC
|
||||
LOG_D(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_id,frame);
|
||||
for (i=0;i<eNB_rrc_inst[Mod_id].sizeof_SIB23;i++)
|
||||
LOG_T(RRC,"%x.",Buffer[i]);
|
||||
LOG_D(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP);
|
||||
for (i=0;i<eNB_rrc_inst[Mod_idP].sizeof_SIB23;i++)
|
||||
LOG_T(RRC,"%x.",buffer_pP[i]);
|
||||
LOG_T(RRC,"\n");
|
||||
#endif
|
||||
return(eNB_rrc_inst[Mod_id].sizeof_SIB23);
|
||||
return(eNB_rrc_inst[Mod_idP].sizeof_SIB23);
|
||||
}
|
||||
else
|
||||
return(0);
|
||||
@@ -159,17 +159,17 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer,
|
||||
|
||||
|
||||
if( (Srb_id & RAB_OFFSET ) == CCCH){
|
||||
LOG_D(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_id,frame, Srb_id);
|
||||
LOG_D(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
|
||||
|
||||
if(eNB_rrc_inst[Mod_id].Srb0.Active==0) {
|
||||
LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_id);
|
||||
if(eNB_rrc_inst[Mod_idP].Srb0.Active==0) {
|
||||
LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP);
|
||||
return -1;
|
||||
}
|
||||
Srb_info=&eNB_rrc_inst[Mod_id].Srb0;
|
||||
Srb_info=&eNB_rrc_inst[Mod_idP].Srb0;
|
||||
|
||||
// check if data is there for MAC
|
||||
if(Srb_info->Tx_buffer.payload_size>0){//Fill buffer
|
||||
LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_id,Srb_info,Srb_info->Tx_buffer.payload_size,Buffer,Srb_info->Tx_buffer.Payload);
|
||||
LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
@@ -183,17 +183,17 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer,
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_CCCH_DATA_REQ);
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frame;
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
|
||||
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu));
|
||||
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_size);
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_MAC_ENB, Mod_id, message_p);
|
||||
itti_send_msg_to_task (TASK_MAC_ENB, Mod_idP, message_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy(Buffer,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size);
|
||||
memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size);
|
||||
Sdu_size = Srb_info->Tx_buffer.payload_size;
|
||||
Srb_info->Tx_buffer.payload_size=0;
|
||||
}
|
||||
@@ -214,7 +214,7 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer,
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int mcch_size = eNB_rrc_inst[Mod_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area];
|
||||
int mcch_size = eNB_rrc_inst[Mod_idP].sizeof_MCCH_MESSAGE[mbsfn_sync_area];
|
||||
int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu);
|
||||
|
||||
if (mcch_size > sdu_size) {
|
||||
@@ -223,29 +223,29 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer,
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_MCCH_DATA_REQ);
|
||||
RRC_MAC_MCCH_DATA_REQ (message_p).frame = frame;
|
||||
RRC_MAC_MCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size;
|
||||
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu));
|
||||
memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, eNB_rrc_inst[Mod_id].MCCH_MESSAGE[mbsfn_sync_area], mcch_size);
|
||||
memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, eNB_rrc_inst[Mod_idP].MCCH_MESSAGE[mbsfn_sync_area], mcch_size);
|
||||
RRC_MAC_MCCH_DATA_REQ (message_p).enb_index = eNB_index;
|
||||
RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area;
|
||||
|
||||
itti_send_msg_to_task (TASK_MAC_ENB, Mod_id, message_p);
|
||||
itti_send_msg_to_task (TASK_MAC_ENB, Mod_idP, message_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy(&Buffer[0],
|
||||
eNB_rrc_inst[Mod_id].MCCH_MESSAGE[mbsfn_sync_area],
|
||||
eNB_rrc_inst[Mod_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
|
||||
memcpy(&buffer_pP[0],
|
||||
eNB_rrc_inst[Mod_idP].MCCH_MESSAGE[mbsfn_sync_area],
|
||||
eNB_rrc_inst[Mod_idP].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
|
||||
|
||||
#ifdef DEBUG_RRC
|
||||
LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_id,frame);
|
||||
for (i=0;i<eNB_rrc_inst[Mod_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area];i++)
|
||||
LOG_T(RRC,"%x.",Buffer[i]);
|
||||
LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_id,frameP);
|
||||
for (i=0;i<eNB_rrc_inst[Mod_idP].sizeof_MCCH_MESSAGE[mbsfn_sync_area];i++)
|
||||
LOG_T(RRC,"%x.",buffer_pP[i]);
|
||||
LOG_T(RRC,"\n");
|
||||
#endif
|
||||
|
||||
return (eNB_rrc_inst[Mod_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
|
||||
return (eNB_rrc_inst[Mod_idP].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
|
||||
// }
|
||||
//else
|
||||
//return(0);
|
||||
@@ -255,10 +255,10 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer,
|
||||
|
||||
else{ //This is an UE
|
||||
#ifdef DEBUG_RRC
|
||||
LOG_D(RRC,"[UE %d] Frame %d Filling CCCH SRB_ID %d\n",Mod_id,frame,Srb_id);
|
||||
LOG_D(RRC,"[UE %d] Frame %d Buffer status %d,\n",Mod_id,frame, UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size);
|
||||
LOG_D(RRC,"[UE %d] Frame %d Filling CCCH SRB_ID %d\n",Mod_idP,frameP,Srb_id);
|
||||
LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
|
||||
#endif
|
||||
if( (UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size > 0) ) {
|
||||
if( (UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size > 0) ) {
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
@@ -272,21 +272,21 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer,
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_RRC_UE, RRC_MAC_CCCH_DATA_REQ);
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frame;
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
|
||||
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu));
|
||||
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.Payload, ccch_size);
|
||||
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload, ccch_size);
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_MAC_UE, Mod_id + NB_eNB_INST, message_p);
|
||||
itti_send_msg_to_task (TASK_MAC_UE, Mod_idP + NB_eNB_INST, message_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy(&Buffer[0],&UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.Payload[0],UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size);
|
||||
u8 Ret_size=UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size;
|
||||
memcpy(&buffer_pP[0],&UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload[0],UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
|
||||
u8 Ret_size=UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
|
||||
// UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size=0;
|
||||
UE_rrc_inst[Mod_id].Info[eNB_index].T300_active = 1;
|
||||
UE_rrc_inst[Mod_id].Info[eNB_index].T300_cnt = 0;
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].T300_active = 1;
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].T300_cnt = 0;
|
||||
// msg("[RRC][UE %d] Sending rach\n",Mod_id);
|
||||
return(Ret_size);
|
||||
}
|
||||
@@ -298,18 +298,18 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size,u8 eNB_flag,u8 eNB_index,u8 mbsfn_sync_area){
|
||||
s8 mac_rrc_lite_data_ind(module_id_t Mod_idP, frame_t frameP, u16 Srb_id, u8 *Sdu, u16 sdu_size,eNB_flag_t eNB_flagP,u8 eNB_index,u8 mbsfn_sync_area){
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
SRB_INFO *Srb_info;
|
||||
/*
|
||||
int si_window;
|
||||
*/
|
||||
|
||||
if(eNB_flag == 0){
|
||||
if(eNB_flagP == 0){
|
||||
|
||||
if(Srb_id == BCCH){
|
||||
|
||||
LOG_T(RRC,"[UE %d] Received SDU for BCCH on SRB %d from eNB %d\n",Mod_id,Srb_id,eNB_index);
|
||||
LOG_T(RRC,"[UE %d] Received SDU for BCCH on SRB %d from eNB %d\n",Mod_idP,Srb_id,eNB_index);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
@@ -323,7 +323,7 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_BCCH_DATA_IND);
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).frame = frame;
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).frame = frameP;
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu));
|
||||
memcpy (RRC_MAC_BCCH_DATA_IND (message_p).sdu, Sdu, sdu_size);
|
||||
@@ -331,14 +331,14 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).rsrq = 30 /* TODO change phy to report rspq */;
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).rsrp = 45 /* TODO change phy to report rspp */;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, Mod_id + NB_eNB_INST, message_p);
|
||||
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p);
|
||||
}
|
||||
#else
|
||||
decode_BCCH_DLSCH_Message(Mod_id,frame,eNB_index,Sdu,sdu_size, 0, 0);
|
||||
decode_BCCH_DLSCH_Message(Mod_idP,frameP,eNB_index,Sdu,sdu_size, 0, 0);
|
||||
/*
|
||||
if ((frame %2) == 0) {
|
||||
if ((frameP %2) == 0) {
|
||||
if (UE_rrc_inst[Mod_id].Info[eNB_index].SIB1Status == 0) {
|
||||
LOG_D(RRC,"[UE %d] Frame %d : Received SIB1 from eNB %d (%d bytes)\n",Mod_id,frame,eNB_index,sdu_size);
|
||||
LOG_D(RRC,"[UE %d] Frame %d : Received SIB1 from eNB %d (%d bytes)\n",Mod_id,frameP,eNB_index,sdu_size);
|
||||
if (UE_rrc_inst[Mod_id].SIB1[eNB_index])
|
||||
memcpy(UE_rrc_inst[Mod_id].SIB1[eNB_index],&Sdu[0],sdu_size);
|
||||
else {
|
||||
@@ -353,11 +353,11 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size
|
||||
else {
|
||||
if ((UE_rrc_inst[Mod_id].Info[eNB_index].SIB1Status == 1) &&
|
||||
(UE_rrc_inst[Mod_id].Info[eNB_index].SIStatus == 0)) {
|
||||
si_window = (frame%UE_rrc_inst[Mod_id].Info[eNB_index].SIperiod)/frame%UE_rrc_inst[Mod_id].Info[eNB_index].SIwindowsize;
|
||||
LOG_D(RRC,"[UE %d] Frame %d : Received SI (%d bytes), in window %d (SIperiod %d, SIwindowsize %d)\n",Mod_id,frame,sdu_size,si_window,UE_rrc_inst[Mod_id].Info[eNB_index].SIperiod,UE_rrc_inst[Mod_id].Info[eNB_index].SIwindowsize);
|
||||
si_window = (frameP%UE_rrc_inst[Mod_id].Info[eNB_index].SIperiod)/frameP%UE_rrc_inst[Mod_id].Info[eNB_index].SIwindowsize;
|
||||
LOG_D(RRC,"[UE %d] Frame %d : Received SI (%d bytes), in window %d (SIperiod %d, SIwindowsize %d)\n",Mod_id,frameP,sdu_size,si_window,UE_rrc_inst[Mod_id].Info[eNB_index].SIperiod,UE_rrc_inst[Mod_id].Info[eNB_index].SIwindowsize);
|
||||
memcpy(UE_rrc_inst[Mod_id].SI[eNB_index],&Sdu[0],sdu_size);
|
||||
if (decode_SI(Mod_id,frame,eNB_index,si_window)==0) {
|
||||
LOG_D(RRC,"[UE %d] Frame %d :Decoded SI successfully\n",Mod_id,frame);
|
||||
if (decode_SI(Mod_id,frameP,eNB_index,si_window)==0) {
|
||||
LOG_D(RRC,"[UE %d] Frame %d :Decoded SI successfully\n",Mod_id,frameP);
|
||||
UE_rrc_inst[Mod_id].Info[eNB_index].SIStatus = 1;
|
||||
}
|
||||
}
|
||||
@@ -380,7 +380,7 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size
|
||||
|
||||
if((Srb_id & RAB_OFFSET) == CCCH){
|
||||
if (sdu_size>0) {
|
||||
LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %d from eNB %d\n",Mod_id,Srb_id & RAB_OFFSET,eNB_index);
|
||||
LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %d from eNB %d\n",Mod_idP,Srb_id & RAB_OFFSET,eNB_index);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
@@ -394,20 +394,20 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_IND);
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).frame = frame;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu));
|
||||
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, Sdu, sdu_size);
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, Mod_id + NB_eNB_INST, message_p);
|
||||
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p);
|
||||
}
|
||||
#else
|
||||
Srb_info = &UE_rrc_inst[Mod_id].Srb0[eNB_index];
|
||||
Srb_info = &UE_rrc_inst[Mod_idP].Srb0[eNB_index];
|
||||
|
||||
memcpy(Srb_info->Rx_buffer.Payload,Sdu,sdu_size);
|
||||
Srb_info->Rx_buffer.payload_size = sdu_size;
|
||||
rrc_ue_decode_ccch(Mod_id, frame, Srb_info, eNB_index);
|
||||
rrc_ue_decode_ccch(Mod_idP, frameP, Srb_info, eNB_index);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -415,7 +415,7 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size
|
||||
#ifdef Rel10
|
||||
if ((Srb_id & RAB_OFFSET) == MCCH) {
|
||||
LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %d from eNB %d\n",
|
||||
Mod_id,frame, mbsfn_sync_area, Srb_id & RAB_OFFSET,eNB_index);
|
||||
Mod_id,frameP, mbsfn_sync_area, Srb_id & RAB_OFFSET,eNB_index);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
@@ -429,17 +429,17 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_MCCH_DATA_IND);
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).frame = frame;
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).frame = frameP;
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu));
|
||||
memcpy (RRC_MAC_MCCH_DATA_IND (message_p).sdu, Sdu, sdu_size);
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).enb_index = eNB_index;
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).mbsfn_sync_area = mbsfn_sync_area;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, Mod_id + NB_eNB_INST, message_p);
|
||||
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p);
|
||||
}
|
||||
#else
|
||||
decode_MCCH_Message(Mod_id, frame, eNB_index, Sdu, sdu_size, mbsfn_sync_area);
|
||||
decode_MCCH_Message(Mod_id, frameP, eNB_index, Sdu, sdu_size, mbsfn_sync_area);
|
||||
#endif
|
||||
}
|
||||
#endif // Rel10
|
||||
@@ -447,8 +447,8 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size
|
||||
}
|
||||
|
||||
else{ // This is an eNB
|
||||
Srb_info = &eNB_rrc_inst[Mod_id].Srb0;
|
||||
LOG_T(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",Mod_id,Srb_info->Srb_id);
|
||||
Srb_info = &eNB_rrc_inst[Mod_idP].Srb0;
|
||||
LOG_T(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",Mod_idP,Srb_info->Srb_id);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
@@ -462,19 +462,19 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND);
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).frame = frame;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu));
|
||||
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, Sdu, sdu_size);
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_ENB, Mod_id, message_p);
|
||||
itti_send_msg_to_task (TASK_RRC_ENB, Mod_idP, message_p);
|
||||
}
|
||||
#else
|
||||
// msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id);
|
||||
if (sdu_size > 0) {
|
||||
memcpy(Srb_info->Rx_buffer.Payload,Sdu,sdu_size);
|
||||
Srb_info->Rx_buffer.payload_size = sdu_size;
|
||||
rrc_eNB_decode_ccch(Mod_id,frame,Srb_info);
|
||||
rrc_eNB_decode_ccch(Mod_idP,frameP,Srb_info);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -485,13 +485,13 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// this function is Not USED anymore
|
||||
void mac_lite_sync_ind(u8 Mod_id,u8 Status){
|
||||
void mac_lite_sync_ind(module_id_t Mod_idP,u8 Status){
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
u8 rrc_lite_data_req(u8 eNB_id, u8 UE_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 muiP, u32 confirmP,
|
||||
unsigned int sdu_size, u8* Buffer, u8 mode) {
|
||||
u8 rrc_lite_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_size, u8* buffer_pP, u8 mode) {
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
@@ -500,10 +500,10 @@ u8 rrc_lite_data_req(u8 eNB_id, u8 UE_id, u32 frame, u8 eNB_flag, unsigned int r
|
||||
u8 *message_buffer;
|
||||
|
||||
message_buffer = itti_malloc (eNB_flag ? TASK_RRC_ENB : TASK_RRC_UE, eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, sdu_size);
|
||||
memcpy (message_buffer, Buffer, sdu_size);
|
||||
memcpy (message_buffer, buffer_pP, sdu_size);
|
||||
|
||||
message_p = itti_alloc_new_message (eNB_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
|
||||
RRC_DCCH_DATA_REQ (message_p).frame = frame;
|
||||
RRC_DCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_DCCH_DATA_REQ (message_p).enb_flag = eNB_flag;
|
||||
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_id;
|
||||
RRC_DCCH_DATA_REQ (message_p).muip = muiP;
|
||||
@@ -511,32 +511,32 @@ u8 rrc_lite_data_req(u8 eNB_id, u8 UE_id, u32 frame, u8 eNB_flag, unsigned int r
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_size;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer;
|
||||
RRC_DCCH_DATA_REQ (message_p).mode = mode;
|
||||
RRC_DCCH_DATA_REQ (message_p).eNB_index = eNB_id;
|
||||
RRC_DCCH_DATA_REQ (message_p).ue_index = UE_id;
|
||||
RRC_DCCH_DATA_REQ (message_p).eNB_index = enb_mod_idP;
|
||||
RRC_DCCH_DATA_REQ (message_p).ue_index = ue_mod_idP;
|
||||
|
||||
itti_send_msg_to_task (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, eNB_flag ? eNB_id : NB_eNB_INST + UE_id, message_p);
|
||||
itti_send_msg_to_task (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, eNB_flag ? enb_mod_idP : NB_eNB_INST + ue_mod_idP, message_p);
|
||||
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
|
||||
|
||||
}
|
||||
#else
|
||||
return pdcp_data_req (eNB_id, UE_id, frame, eNB_flag, rb_id, muiP, confirmP, sdu_size, Buffer, mode);
|
||||
return pdcp_data_req (enb_mod_idP, ue_mod_idP, frameP, eNB_flagP, rb_idP, muiP, confirmP, sdu_size, buffer_pP, mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
void rrc_lite_data_ind(u8_t eNB_id, u8_t UE_id, u32 frame, u8 eNB_flag,u32 Srb_id, u32 sdu_size,u8 *Buffer){
|
||||
void rrc_lite_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP,rb_id_t Srb_id, sdu_size_t sdu_sizeP,u8 *buffer_pP){
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
u8 DCCH_index = Srb_id;
|
||||
u8_t Mod_id;
|
||||
|
||||
if (eNB_flag == 0) {
|
||||
Mod_id = UE_id + NB_eNB_INST;
|
||||
if (eNB_flagP == 0) {
|
||||
Mod_id = ue_mod_idP + NB_eNB_INST;
|
||||
LOG_N(RRC, "[UE %d] Frame %d: received a DCCH %d message on SRB %d with Size %d from eNB %d\n",
|
||||
UE_id, frame, DCCH_index,Srb_id-1,sdu_size, eNB_id);
|
||||
ue_mod_idP, frameP, DCCH_index,Srb_id-1,sdu_sizeP, enb_mod_idP);
|
||||
} else {
|
||||
Mod_id = eNB_id;
|
||||
Mod_id = enb_mod_idP;
|
||||
LOG_N(RRC, "[eNB %d] Frame %d: received a DCCH %d message on SRB %d with Size %d from UE %d\n",
|
||||
eNB_id, frame, DCCH_index,Srb_id-1,sdu_size, UE_id);
|
||||
enb_mod_idP, frameP, DCCH_index,Srb_id-1,sdu_sizeP, ue_mod_idP);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
@@ -546,86 +546,86 @@ void rrc_lite_data_ind(u8_t eNB_id, u8_t UE_id, u32 frame, u8 eNB_flag,u32 Srb_i
|
||||
u8 *message_buffer;
|
||||
|
||||
message_buffer = itti_malloc (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, eNB_flag ? TASK_RRC_ENB : TASK_RRC_UE, sdu_size);
|
||||
memcpy (message_buffer, Buffer, sdu_size);
|
||||
memcpy (message_buffer, buffer_pP, sdu_sizeP);
|
||||
|
||||
message_p = itti_alloc_new_message (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND);
|
||||
RRC_DCCH_DATA_IND (message_p).frame = frame;
|
||||
message_p = itti_alloc_new_message (eNB_flagP ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND);
|
||||
RRC_DCCH_DATA_IND (message_p).frame = frameP;
|
||||
RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index;
|
||||
RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||
RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer;
|
||||
RRC_DCCH_DATA_IND (message_p).ue_index = UE_id;
|
||||
RRC_DCCH_DATA_IND (message_p).eNB_index = eNB_id;
|
||||
RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP;
|
||||
RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer;
|
||||
RRC_DCCH_DATA_IND (message_p).ue_index = ue_mod_idP;
|
||||
RRC_DCCH_DATA_IND (message_p).eNB_index = enb_mod_idP;
|
||||
|
||||
itti_send_msg_to_task (eNB_flag ? TASK_RRC_ENB : TASK_RRC_UE, Mod_id, message_p);
|
||||
}
|
||||
#else
|
||||
if (eNB_flag ==1) {
|
||||
rrc_eNB_decode_dcch(eNB_id,frame,DCCH_index,UE_id,Buffer,sdu_size);
|
||||
if (eNB_flagP ==1) {
|
||||
rrc_eNB_decode_dcch(enb_mod_idP,frameP,DCCH_index,ue_mod_idP,buffer_pP,sdu_sizeP);
|
||||
}
|
||||
else {
|
||||
rrc_ue_decode_dcch(UE_id,frame,DCCH_index,Buffer,eNB_id);
|
||||
rrc_ue_decode_dcch(ue_mod_idP,frameP,DCCH_index,buffer_pP,enb_mod_idP);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
void rrc_lite_in_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index) {
|
||||
void rrc_lite_in_sync_ind(module_id_t Mod_idP, frame_t frameP, u16 eNB_index) {
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_IN_SYNC_IND);
|
||||
RRC_MAC_IN_SYNC_IND (message_p).frame = frame;
|
||||
RRC_MAC_IN_SYNC_IND (message_p).frame = frameP;
|
||||
RRC_MAC_IN_SYNC_IND (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, Mod_id + NB_eNB_INST, message_p);
|
||||
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p);
|
||||
}
|
||||
#else
|
||||
UE_rrc_inst[Mod_id].Info[eNB_index].N310_cnt=0;
|
||||
if (UE_rrc_inst[Mod_id].Info[eNB_index].T310_active==1)
|
||||
UE_rrc_inst[Mod_id].Info[eNB_index].N311_cnt++;
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt=0;
|
||||
if (UE_rrc_inst[Mod_idP].Info[eNB_index].T310_active==1)
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt++;
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
void rrc_lite_out_of_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index){
|
||||
void rrc_lite_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, u16 eNB_index){
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// rlc_info_t rlc_infoP;
|
||||
// rlc_infoP.rlc_mode=RLC_UM;
|
||||
|
||||
LOG_I(RRC,"[UE %d] Frame %d: OUT OF SYNC FROM eNB %d (T310 %d, N310 %d, N311 %d)\n ",
|
||||
Mod_id,frame,eNB_index,
|
||||
UE_rrc_inst[Mod_id].Info[eNB_index].T310_cnt,
|
||||
UE_rrc_inst[Mod_id].Info[eNB_index].N310_cnt,
|
||||
UE_rrc_inst[Mod_id].Info[eNB_index].N311_cnt);
|
||||
Mod_idP,frameP,eNB_index,
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].T310_cnt,
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt,
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_OUT_OF_SYNC_IND);
|
||||
RRC_MAC_OUT_OF_SYNC_IND (message_p).frame = frame;
|
||||
RRC_MAC_OUT_OF_SYNC_IND (message_p).frame = frameP;
|
||||
RRC_MAC_OUT_OF_SYNC_IND (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, Mod_id + NB_eNB_INST, message_p);
|
||||
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p);
|
||||
}
|
||||
#else
|
||||
UE_rrc_inst[Mod_id].Info[eNB_index].N310_cnt++;
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt++;
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
int mac_get_rrc_lite_status(u8 Mod_id,u8 eNB_flag,u8 index){
|
||||
int mac_get_rrc_lite_status(module_id_t Mod_idP,eNB_flag_t eNB_flag,u8 index){
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
if(eNB_flag == 1)
|
||||
return(eNB_rrc_inst[Mod_id].Info.UE[index].Status);
|
||||
return(eNB_rrc_inst[Mod_idP].Info.UE[index].Status);
|
||||
else
|
||||
return(UE_rrc_inst[Mod_id].Info[index].State);
|
||||
return(UE_rrc_inst[Mod_idP].Info[index].State);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
int mac_ue_ccch_success_ind(u8 Mod_id, u8 eNB_index) {
|
||||
int mac_ue_ccch_success_ind(module_id_t Mod_idP, u8 eNB_index) {
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
@@ -634,11 +634,11 @@ int mac_ue_ccch_success_ind(u8 Mod_id, u8 eNB_index) {
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_CNF);
|
||||
RRC_MAC_CCCH_DATA_CNF (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, Mod_id + NB_eNB_INST, message_p);
|
||||
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p);
|
||||
}
|
||||
#else
|
||||
// reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds)
|
||||
UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size=0;
|
||||
UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size=0;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
+79
-71
@@ -234,8 +234,8 @@ union{
|
||||
typedef struct HANDOVER_INFO_s {
|
||||
u8 ho_prepare;
|
||||
u8 ho_complete;
|
||||
u8 modid_s; //Mod_id of serving cell
|
||||
u8 modid_t; //Mod_id of target cell
|
||||
u8 modid_s; //module_idP of serving cell
|
||||
u8 modid_t; //module_idP of target cell
|
||||
u8 ueid_s; //UE index in serving cell
|
||||
u8 ueid_t; //UE index in target cell
|
||||
AS_Config_t as_config; /* these two parameters are taken from 36.331 section 10.2.2: HandoverPreparationInformation-r8-IEs */
|
||||
@@ -444,147 +444,147 @@ typedef struct UE_RRC_INST_s {
|
||||
int rrc_init_global_param(void);
|
||||
int L3_xface_init(void);
|
||||
void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active,u8 HO_enabled);
|
||||
char openair_rrc_lite_eNB_init(u8 Mod_id);
|
||||
char openair_rrc_lite_ue_init(u8 Mod_id,u8 CH_IDX);
|
||||
char openair_rrc_lite_eNB_init(module_id_t module_idP);
|
||||
char openair_rrc_lite_ue_init(module_id_t module_idP,u8 CH_IDX);
|
||||
void rrc_config_buffer(SRB_INFO *srb_info, u8 Lchan_type, u8 Role);
|
||||
void openair_rrc_on(u8 Mod_id,u8 eNB_flag);
|
||||
void openair_rrc_on(module_id_t module_idP, eNB_flag_t eNB_flagP);
|
||||
void rrc_top_cleanup(void);
|
||||
|
||||
/** \brief Function to update timers every subframe. For UE it updates T300,T304 and T310.
|
||||
@param Mod_id Instance of UE/eNB
|
||||
@param module_idP Instance of UE/eNB
|
||||
@param frame Frame index
|
||||
@param eNB_flag Flag to indicate if this instance is and eNB or UE
|
||||
@param index Index of corresponding eNB (for UE)
|
||||
*/
|
||||
RRC_status_t rrc_rx_tx(u8 Mod_id,u32 frame, u8 eNB_flag,u8 index);
|
||||
RRC_status_t rrc_rx_tx(module_id_t module_idP,frame_t frameP, eNB_flag_t eNB_flagP,u8 index);
|
||||
|
||||
// UE RRC Procedures
|
||||
|
||||
/** \brief Decodes DL-CCCH message and invokes appropriate routine to handle the message
|
||||
\param Mod_id Instance ID of UE
|
||||
\param module_idP Instance ID of UE
|
||||
\param Srb_info Pointer to SRB_INFO structure (SRB0)
|
||||
\param eNB_index Index of corresponding eNB/CH*/
|
||||
int rrc_ue_decode_ccch(u8 Mod_id, u32 frame, SRB_INFO *Srb_info,u8 eNB_index);
|
||||
int rrc_ue_decode_ccch(module_id_t module_idP, frame_t frameP, SRB_INFO *Srb_info,u8 eNB_index);
|
||||
|
||||
/** \brief Decodes a DL-DCCH message and invokes appropriate routine to handle the message
|
||||
\param Mod_id Instance ID of UE
|
||||
\param module_idP Instance ID of UE
|
||||
\param frame Frame index
|
||||
\param Srb_id Index of Srb (1,2)
|
||||
\param Buffer Pointer to received SDU
|
||||
\param buffer_pP Pointer to received SDU
|
||||
\param eNB_index Index of corresponding CH/eNB*/
|
||||
void rrc_ue_decode_dcch(u8 Mod_id, u32 frame, u8 Srb_id, u8* Buffer,u8 eNB_index);
|
||||
void rrc_ue_decode_dcch(module_id_t module_idP, frame_t frameP, u8 Srb_id, u8* buffer_pP,u8 eNB_index);
|
||||
|
||||
/** \brief Generate/Encodes RRCConnnectionRequest message at UE
|
||||
\param Mod_id Instance ID of UE
|
||||
\param module_idP Instance ID of UE
|
||||
\param frame Frame index
|
||||
\param Srb_id Index of Srb (1,2)
|
||||
\param eNB_index Index of corresponding eNB/CH*/
|
||||
void rrc_ue_generate_RRCConnectionRequest(u8 Mod_id, u32 frame, u8 eNB_index);
|
||||
void rrc_ue_generate_RRCConnectionRequest(module_id_t module_idP, frame_t frameP, u8 eNB_index);
|
||||
|
||||
/** \brief Generates/Encodes RRCConnnectionSetupComplete message at UE
|
||||
\param Mod_id Instance ID of UE
|
||||
\param module_idP Instance ID of UE
|
||||
\param frame Frame index
|
||||
\param eNB_index Index of corresponding eNB/CH*/
|
||||
void rrc_ue_generate_RRCConnectionSetupComplete(u8 Mod_id,u32 frame,u8 eNB_index, uint8_t Transaction_id);
|
||||
void rrc_ue_generate_RRCConnectionSetupComplete(module_id_t module_idP,frame_t frameP,u8 eNB_index, uint8_t Transaction_id);
|
||||
|
||||
/** \brief process the received rrcConnectionReconfiguration message at UE
|
||||
\param Mod_id Instance ID of UE
|
||||
\param module_idP Instance ID of UE
|
||||
\param frame Frame index
|
||||
\param *rrcConnectionReconfiguration pointer to the sturcture
|
||||
\param eNB_index Index of corresponding eNB/CH*/
|
||||
void rrc_ue_process_rrcConnectionReconfiguration(u8 Mod_id, u32 frame,RRCConnectionReconfiguration_t *rrcConnectionReconfiguration,u8 eNB_index);
|
||||
void rrc_ue_process_rrcConnectionReconfiguration(module_id_t module_idP, frame_t frameP,RRCConnectionReconfiguration_t *rrcConnectionReconfiguration,u8 eNB_index);
|
||||
|
||||
/** \brief Generates/Encodes RRCConnectionReconfigurationComplete message at UE
|
||||
\param Mod_id Instance ID of UE
|
||||
\param module_idP Instance ID of UE
|
||||
\param frame Frame index
|
||||
\param eNB_index Index of corresponding eNB/CH*/
|
||||
void rrc_ue_generate_RRCConnectionReconfigurationComplete(u8 Mod_id, u32 frame, u8 eNB_index, uint8_t Transaction_id);
|
||||
void rrc_ue_generate_RRCConnectionReconfigurationComplete(module_id_t module_idP, frame_t frameP, u8 eNB_index, uint8_t Transaction_id);
|
||||
|
||||
/** \brief Establish SRB1 based on configuration in SRB_ToAddMod structure. Configures RLC/PDCP accordingly
|
||||
\param Mod_id Instance ID of UE
|
||||
\param module_idP Instance ID of UE
|
||||
\param frame Frame index
|
||||
\param eNB_index Index of corresponding eNB/CH
|
||||
\param SRB_config Pointer to SRB_ToAddMod IE from configuration
|
||||
@returns 0 on success*/
|
||||
s32 rrc_ue_establish_srb1(u8 Mod_id,u32 frame,u8 eNB_index,struct SRB_ToAddMod *SRB_config);
|
||||
s32 rrc_ue_establish_srb1(module_id_t module_idP,frame_t frameP,u8 eNB_index,struct SRB_ToAddMod *SRB_config);
|
||||
|
||||
/** \brief Establish SRB2 based on configuration in SRB_ToAddMod structure. Configures RLC/PDCP accordingly
|
||||
\param Mod_id Instance ID of UE
|
||||
\param module_idP Instance ID of UE
|
||||
\param frame Frame index
|
||||
\param eNB_index Index of corresponding eNB/CH
|
||||
\param SRB_config Pointer to SRB_ToAddMod IE from configuration
|
||||
@returns 0 on success*/
|
||||
s32 rrc_ue_establish_srb2(u8 Mod_id,u32 frame, u8 eNB_index,struct SRB_ToAddMod *SRB_config);
|
||||
s32 rrc_ue_establish_srb2(module_id_t module_idP,frame_t frameP, u8 eNB_index,struct SRB_ToAddMod *SRB_config);
|
||||
|
||||
/** \brief Establish a DRB according to DRB_ToAddMod structure
|
||||
\param Mod_id Instance ID of UE
|
||||
\param module_idP Instance ID of UE
|
||||
\param eNB_index Index of corresponding CH/eNB
|
||||
\param DRB_config Pointer to DRB_ToAddMod IE from configuration
|
||||
@returns 0 on success */
|
||||
s32 rrc_ue_establish_drb(u8 Mod_id,u32 frame,u8 eNB_index,struct DRB_ToAddMod *DRB_config);
|
||||
s32 rrc_ue_establish_drb(module_id_t module_idP,frame_t frameP,u8 eNB_index,struct DRB_ToAddMod *DRB_config);
|
||||
|
||||
/** \brief Process MobilityControlInfo Message to proceed with handover and configure PHY/MAC
|
||||
\param Mod_id Instance of UE on which to act
|
||||
\param module_idP Instance of UE on which to act
|
||||
\param frame frame time interval
|
||||
\param eNB_index Index of corresponding CH/eNB
|
||||
\param mobilityControlInfo Pointer to mobilityControlInfo
|
||||
*/
|
||||
void rrc_ue_process_mobilityControlInfo(u8 eNB_index, u8 UE_id, u32 frame, struct MobilityControlInfo *mobilityControlInfo);
|
||||
void rrc_ue_process_mobilityControlInfo(module_id_t enb_module_idP, module_id_t ue_module_idP, frame_t frameP, struct MobilityControlInfo *mobilityControlInfo);
|
||||
|
||||
/** \brief Process a measConfig Message and configure PHY/MAC
|
||||
\param Mod_id Instance of UE on which to act
|
||||
\param module_idP Instance of UE on which to act
|
||||
\param frame frame time interval
|
||||
\param eNB_index Index of corresponding CH/eNB
|
||||
\param measConfig Pointer to MeasConfig IE from configuration*/
|
||||
void rrc_ue_process_measConfig(u8 Mod_id,u32 frame, u8 eNB_index,MeasConfig_t *measConfig);
|
||||
void rrc_ue_process_measConfig(module_id_t module_idP,frame_t frameP, u8 eNB_index,MeasConfig_t *measConfig);
|
||||
|
||||
/** \brief Process a RadioResourceConfigDedicated Message and configure PHY/MAC
|
||||
\param Mod_id Instance of UE on which to act
|
||||
\param module_idP Instance of UE on which to act
|
||||
\param eNB_index Index of corresponding CH/eNB
|
||||
\param radioResourceConfigDedicated Pointer to RadioResourceConfigDedicated IE from configuration*/
|
||||
void rrc_ue_process_radioResourceConfigDedicated(u8 Mod_id,u32 frame, u8 eNB_index,
|
||||
void rrc_ue_process_radioResourceConfigDedicated(module_id_t module_idP,frame_t frameP, u8 eNB_index,
|
||||
RadioResourceConfigDedicated_t *radioResourceConfigDedicated);
|
||||
|
||||
// eNB/CH RRC Procedures
|
||||
|
||||
/**\brief Function to get the next transaction identifier.
|
||||
\param Mod_id Instance ID for CH/eNB
|
||||
\param module_idP Instance ID for CH/eNB
|
||||
\return a transaction identifier*/
|
||||
uint8_t rrc_eNB_get_next_transaction_identifier(uint8_t Mod_id);
|
||||
uint8_t rrc_eNB_get_next_transaction_identifier(module_id_t module_idP);
|
||||
|
||||
/**\brief Entry routine to decode a UL-CCCH-Message. Invokes PER decoder and parses message.
|
||||
\param Mod_id Instance ID for CH/eNB
|
||||
\param module_idP Instance ID for CH/eNB
|
||||
\param frame Frame index
|
||||
\param Srb_info Pointer to SRB0 information structure (buffer, etc.)*/
|
||||
int rrc_eNB_decode_ccch(u8 Mod_id, u32 frame, SRB_INFO *Srb_info);
|
||||
int rrc_eNB_decode_ccch(module_id_t module_idP, frame_t frameP, SRB_INFO *Srb_info);
|
||||
|
||||
/**\brief Entry routine to decode a UL-DCCH-Message. Invokes PER decoder and parses message.
|
||||
\param Mod_id Instance ID for CH/eNB
|
||||
\param module_idP Instance ID for CH/eNB
|
||||
\param frame Frame index
|
||||
\param UE_index Index of UE sending the message
|
||||
\param Rx_sdu Pointer Received Message
|
||||
\param sdu_size Size of incoming SDU*/
|
||||
int rrc_eNB_decode_dcch(u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index, u8 *Rx_sdu, u8 sdu_size);
|
||||
int rrc_eNB_decode_dcch(module_id_t module_idP, frame_t frameP, u8 Srb_id, u8 UE_index, u8 *Rx_sdu, u8 sdu_size);
|
||||
|
||||
/**\brief Generate the RRCConnectionSetup based on information coming from RRM
|
||||
\param Mod_id Instance ID for eNB/CH
|
||||
\param module_idP Instance ID for eNB/CH
|
||||
\param frame Frame index
|
||||
\param UE_index Index of UE receiving the message*/
|
||||
void rrc_eNB_generate_RRCConnectionSetup(u8 Mod_id,u32 frame, u16 UE_index);
|
||||
void rrc_eNB_generate_RRCConnectionSetup(module_id_t module_idP,frame_t frameP, u16 UE_index);
|
||||
|
||||
/**\brief Process the RRCConnectionSetupComplete based on information coming from UE
|
||||
\param Mod_id Instance ID for eNB/CH
|
||||
\param module_idP Instance ID for eNB/CH
|
||||
\param frame Frame index
|
||||
\param UE_index Index of UE transmitting the message
|
||||
\param rrcConnectionSetupComplete Pointer to RRCConnectionSetupComplete message*/
|
||||
void rrc_eNB_process_RRCConnectionSetupComplete(u8 Mod_id, u32 frame, u8 UE_index,
|
||||
void rrc_eNB_process_RRCConnectionSetupComplete(module_id_t module_idP, frame_t frameP, u8 UE_index,
|
||||
RRCConnectionSetupComplete_r8_IEs_t *rrcConnectionSetupComplete);
|
||||
|
||||
/**\brief Process the RRCConnectionReconfigurationComplete based on information coming from UE
|
||||
\param Mod_id Instance ID for eNB/CH
|
||||
\param module_idP Instance ID for eNB/CH
|
||||
\param UE_index Index of UE transmitting the messages
|
||||
\param rrcConnectionReconfigurationComplete Pointer to RRCConnectionReconfigurationComplete message*/
|
||||
void rrc_eNB_process_RRCConnectionReconfigurationComplete(u8 Mod_id,u32 frame,u8 UE_index,RRCConnectionReconfigurationComplete_r8_IEs_t *rrcConnectionReconfigurationComplete);
|
||||
void rrc_eNB_process_RRCConnectionReconfigurationComplete(module_id_t module_idP,frame_t frameP,u8 UE_index,RRCConnectionReconfigurationComplete_r8_IEs_t *rrcConnectionReconfigurationComplete);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
/**\brief RRC eNB task.
|
||||
@@ -597,61 +597,69 @@ void *rrc_ue_task(void *args_p);
|
||||
#endif
|
||||
|
||||
/**\brief Generate/decode the handover RRCConnectionReconfiguration at eNB
|
||||
\param Mod_id Instance ID for eNB/CH
|
||||
\param module_idP Instance ID for eNB/CH
|
||||
\param frame Frame index
|
||||
\param UE_index Index of UE transmitting the messages*/
|
||||
void rrc_eNB_generate_RRCConnectionReconfiguration_handover(u8 Mod_id, u32 frame, u16 UE_index, u8 *nas_pdu, u32 nas_length);
|
||||
void rrc_eNB_generate_RRCConnectionReconfiguration_handover(module_id_t module_idP, frame_t frameP, u16 UE_index, u8 *nas_pdu, u32 nas_length);
|
||||
|
||||
//L2_interface.c
|
||||
s8 mac_rrc_lite_data_req( u8 Mod_id, u32 frame, unsigned short Srb_id, u8 Nb_tb, u8 *Buffer,u8 eNB_flag, u8 eNB_index, u8 mbsfn_sync_area);
|
||||
s8 mac_rrc_lite_data_req( module_id_t module_idP, frame_t frameP, unsigned short Srb_id, u8 Nb_tb, u8 *buffer_pP,eNB_flag_t eNB_flagP, u8 eNB_index, u8 mbsfn_sync_area);
|
||||
|
||||
s8 mac_rrc_lite_data_ind( u8 Mod_id, u32 frame, unsigned short Srb_id, u8 *Sdu, unsigned short Sdu_len,u8 eNB_flag,u8 eNB_index, u8 mbsfn_sync_area);
|
||||
s8 mac_rrc_lite_data_ind( module_id_t module_idP, frame_t frameP, unsigned short Srb_id, u8 *Sdu, unsigned short Sdu_len,eNB_flag_t eNB_flagP,u8 eNB_index, u8 mbsfn_sync_area);
|
||||
|
||||
void mac_sync_ind( u8 Mod_id, u8 status);
|
||||
void mac_sync_ind( module_id_t Mod_instP, u8 status);
|
||||
|
||||
u8 rrc_lite_data_req(u8 eNB_id, u8 UE_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 muiP, u32 confirmP,
|
||||
unsigned int sdu_size, u8* Buffer, u8 mode);
|
||||
u8 rrc_lite_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_sizeP,
|
||||
u8 *Buffer_pP,
|
||||
u8 modeP);
|
||||
|
||||
void rrc_lite_data_ind(u8_t eNB_id, u8_t UE_id, u32 frame, u8 eNB_flag, u32 Rb_id, u32 sdu_size,u8 *Buffer);
|
||||
void rrc_lite_data_ind(module_id_t eNB_id, module_id_t UE_id, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t Rb_id, sdu_size_t sdu_size,u8 *buffer_pP);
|
||||
|
||||
void rrc_lite_in_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index);
|
||||
void rrc_lite_in_sync_ind(module_id_t module_idP, frame_t frameP, u16 eNB_index);
|
||||
|
||||
void rrc_lite_out_of_sync_ind(u8 Mod_id, u32 frame, unsigned short eNB_index);
|
||||
void rrc_lite_out_of_sync_ind(module_id_t module_idP, frame_t frameP, unsigned short eNB_index);
|
||||
|
||||
int decode_MCCH_Message(u8 Mod_id, u32 frame, u8 eNB_index, u8 *Sdu, u8 Sdu_len,u8 mbsfn_sync_area);
|
||||
int decode_MCCH_Message(module_id_t module_idP, frame_t frameP, u8 eNB_index, u8 *Sdu, u8 Sdu_len,u8 mbsfn_sync_area);
|
||||
|
||||
void decode_MBSFNAreaConfiguration(u8 Mod_id, u8 eNB_index, u32 frame,u8 mbsfn_sync_area);
|
||||
void decode_MBSFNAreaConfiguration(module_id_t module_idP, u8 eNB_index, frame_t frameP,u8 mbsfn_sync_area);
|
||||
|
||||
int decode_BCCH_DLSCH_Message(u8 Mod_id,u32 frame,u8 eNB_index,u8 *Sdu,u8 Sdu_len, u8 rsrq, u8 rsrp);
|
||||
int decode_BCCH_DLSCH_Message(module_id_t module_idP,frame_t frameP,u8 eNB_index,u8 *Sdu,u8 Sdu_len, u8 rsrq, u8 rsrp);
|
||||
|
||||
int decode_SIB1(u8 Mod_id,u8 eNB_index, u8 rsrq, u8 rsrp);
|
||||
int decode_SIB1(module_id_t module_idP,u8 eNB_index, u8 rsrq, u8 rsrp);
|
||||
|
||||
int decode_SI(u8 Mod_id,u32 frame,u8 eNB_index,u8 si_window);
|
||||
int decode_SI(module_id_t module_idP,frame_t frameP,u8 eNB_index,u8 si_window);
|
||||
|
||||
void ue_meas_filtering(u8 Mod_id,u32 frame,u8 eNB_index);
|
||||
void ue_meas_filtering(module_id_t module_idP,frame_t frameP,u8 eNB_index);
|
||||
|
||||
void ue_measurement_report_triggering(u8 Mod_id, u32 frame,u8 eNB_index);
|
||||
void ue_measurement_report_triggering(module_id_t module_idP, frame_t frameP,u8 eNB_index);
|
||||
|
||||
int mac_get_rrc_lite_status(u8 Mod_id,u8 eNB_flag,u8 index);
|
||||
int mac_get_rrc_lite_status(module_id_t module_idP,eNB_flag_t eNB_flagP,u8 index);
|
||||
|
||||
void rrc_eNB_generate_UECapabilityEnquiry(u8 Mod_id, u32 frame, u16 UE_index);
|
||||
void rrc_eNB_generate_UECapabilityEnquiry(module_id_t module_idP, frame_t frameP, u16 UE_index);
|
||||
|
||||
void rrc_eNB_generate_SecurityModeCommand(u8 Mod_id, u32 frame, u16 UE_index);
|
||||
void rrc_eNB_generate_SecurityModeCommand(module_id_t module_idP, frame_t frameP, u16 UE_index);
|
||||
|
||||
void rrc_eNB_process_MeasurementReport(u8 Mod_id,u32 frame, u16 UE_index,MeasResults_t *measResults2) ;
|
||||
void rrc_eNB_process_MeasurementReport(u8 module_idP,frame_t frameP, u16 UE_index,MeasResults_t *measResults2) ;
|
||||
|
||||
void rrc_eNB_generate_HandoverPreparationInformation (u8 Mod_id, u32 frame, u8 UE_index, PhysCellId_t targetPhyId) ;
|
||||
void rrc_eNB_generate_HandoverPreparationInformation (u8 module_idP, frame_t frameP, u8 UE_index, PhysCellId_t targetPhyId) ;
|
||||
|
||||
void check_handovers(u8 Mod_id, u32 frame);
|
||||
void check_handovers(u8 module_idP, frame_t frameP);
|
||||
|
||||
u8 check_trigger_meas_event(u8 Mod_id,u32 frame, u8 eNB_index, u8 ue_cnx_index, u8 meas_index,
|
||||
u8 check_trigger_meas_event(u8 module_idP,frame_t frameP, u8 eNB_index, u8 ue_cnx_index, u8 meas_index,
|
||||
Q_OffsetRange_t ofn, Q_OffsetRange_t ocn, Hysteresis_t hys,
|
||||
Q_OffsetRange_t ofs, Q_OffsetRange_t ocs, long a3_offset, TimeToTrigger_t ttt);
|
||||
|
||||
//void rrc_ue_process_ueCapabilityEnquiry(uint8_t Mod_id,uint32_t frame,UECapabilityEnquiry_t *UECapabilityEnquiry,uint8_t eNB_index);
|
||||
//void rrc_ue_process_securityModeCommand(uint8_t Mod_id,uint32_t frame,SecurityModeCommand_t *securityModeCommand,uint8_t eNB_index);
|
||||
//void rrc_ue_process_ueCapabilityEnquiry(uint8_t module_idP,uint32_t frame,UECapabilityEnquiry_t *UECapabilityEnquiry,uint8_t eNB_index);
|
||||
//void rrc_ue_process_securityModeCommand(uint8_t module_idP,uint32_t frame,SecurityModeCommand_t *securityModeCommand,uint8_t eNB_index);
|
||||
|
||||
void rrc_eNB_free_UE_index (u8 Mod_id, u8 UE_id);
|
||||
void rrc_eNB_free_UE_index (module_id_t enb_mod_idP, module_id_t ue_mod_idP);
|
||||
|
||||
long binary_search_int(int elements[], long numElem, int value);
|
||||
|
||||
|
||||
+1658
-1657
File diff suppressed because it is too large
Load Diff
@@ -40,6 +40,7 @@
|
||||
#include "extern.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "COMMON/openair_defs.h"
|
||||
#include "COMMON/platform_types.h"
|
||||
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
#include "LAYER2/RLC/rlc.h"
|
||||
#include "COMMON/mac_rrc_primitives.h"
|
||||
@@ -54,7 +55,7 @@ extern UE_MAC_INST *UE_mac_inst;
|
||||
extern mui_t rrc_eNB_mui;
|
||||
|
||||
//configure BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
|
||||
void openair_rrc_on(u8 Mod_id, u8 eNB_flag) {
|
||||
void openair_rrc_on(module_id_t Mod_id, eNB_flag_t eNB_flag) {
|
||||
unsigned short i;
|
||||
|
||||
if (eNB_flag == 1) {
|
||||
@@ -208,8 +209,8 @@ void rrc_config_buffer(SRB_INFO *Srb_info, u8 Lchan_type, u8 Role) {
|
||||
void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active,u8 HO_active){
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
|
||||
int i;
|
||||
OAI_UECapability_t *UECap;
|
||||
module_id_t module_id;
|
||||
OAI_UECapability_t *UECap = NULL;
|
||||
// uint8_t dummy_buffer[100];
|
||||
|
||||
LOG_D(RRC, "[OPENAIR][INIT] Init function start: NB_UE_INST=%d, NB_eNB_INST=%d\n", NB_UE_INST, NB_eNB_INST);
|
||||
@@ -221,9 +222,9 @@ void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active,u8 HO_active){
|
||||
|
||||
// fill UE capability
|
||||
UECap = fill_ue_capability ();
|
||||
for (i = 0; i < NB_UE_INST; i++) {
|
||||
UE_rrc_inst[i].UECapability = UECap->sdu;
|
||||
UE_rrc_inst[i].UECapability_size = UECap->sdu_size;
|
||||
for (module_id = 0; module_id < NB_UE_INST; module_id++) {
|
||||
UE_rrc_inst[module_id].UECapability = UECap->sdu;
|
||||
UE_rrc_inst[module_id].UECapability_size = UECap->sdu_size;
|
||||
}
|
||||
/*
|
||||
do_UECapabilityEnquiry(0,
|
||||
@@ -232,8 +233,8 @@ void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active,u8 HO_active){
|
||||
0);*/
|
||||
#ifdef Rel10
|
||||
LOG_I(RRC,"[UE] eMBMS active state is %d \n", eMBMS_active);
|
||||
for (i=0;i<NB_UE_INST;i++) {
|
||||
UE_rrc_inst[i].MBMS_flag = (uint8_t)eMBMS_active;
|
||||
for (module_id=0;module_id<NB_UE_INST;module_id++) {
|
||||
UE_rrc_inst[module_id].MBMS_flag = (uint8_t)eMBMS_active;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -244,17 +245,17 @@ void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active,u8 HO_active){
|
||||
eNB_rrc_inst = (eNB_RRC_INST*) malloc16(NB_eNB_INST*sizeof(eNB_RRC_INST));
|
||||
memset (eNB_rrc_inst, 0, NB_eNB_INST * sizeof(eNB_RRC_INST));
|
||||
LOG_I(RRC,"[eNB] handover active state is %d \n", HO_active);
|
||||
for (i=0;i<NB_eNB_INST;i++) {
|
||||
eNB_rrc_inst[i].HO_flag = (uint8_t)HO_active;
|
||||
for (module_id=0;module_id<NB_eNB_INST;module_id++) {
|
||||
eNB_rrc_inst[module_id].HO_flag = (uint8_t)HO_active;
|
||||
}
|
||||
#ifdef Rel10
|
||||
LOG_I(RRC,"[eNB] eMBMS active state is %d \n", eMBMS_active);
|
||||
for (i=0;i<NB_eNB_INST;i++) {
|
||||
eNB_rrc_inst[i].MBMS_flag = (uint8_t)eMBMS_active;
|
||||
for (module_id=0;module_id<NB_eNB_INST;module_id++) {
|
||||
eNB_rrc_inst[module_id].MBMS_flag = (uint8_t)eMBMS_active;
|
||||
}
|
||||
#endif
|
||||
#ifdef CBA
|
||||
for (i=0;i<NB_eNB_INST;i++) {
|
||||
for (module_id=0;module_id<NB_eNB_INST;module_id++) {
|
||||
eNB_rrc_inst[i].num_active_cba_groups = cba_group_active;
|
||||
}
|
||||
#endif
|
||||
@@ -287,7 +288,7 @@ void rrc_top_cleanup(void) {
|
||||
}
|
||||
|
||||
|
||||
void rrc_t310_expiration(u32 frame, u8 Mod_id, u8 eNB_index) {
|
||||
void rrc_t310_expiration(frame_t frameP, u8 Mod_id, u8 eNB_index) {
|
||||
|
||||
if (UE_rrc_inst[Mod_id].Info[eNB_index].State != RRC_CONNECTED) {
|
||||
LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n");
|
||||
@@ -305,7 +306,7 @@ void rrc_t310_expiration(u32 frame, u8 Mod_id, u8 eNB_index) {
|
||||
UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id);
|
||||
rrc_pdcp_config_req (eNB_index, Mod_id, frame, 0, ACTION_REMOVE,
|
||||
UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id, 0);
|
||||
rrc_rlc_config_req (Mod_id + NB_eNB_INST, frame, 0, ACTION_REMOVE,
|
||||
rrc_rlc_config_req (eNB_index, Mod_id, frame, 0, ACTION_REMOVE,
|
||||
UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id, SIGNALLING_RADIO_BEARER, Rlc_info_um);
|
||||
UE_rrc_inst[Mod_id].Srb2[eNB_index].Active = 0;
|
||||
UE_rrc_inst[Mod_id].Srb2[eNB_index].Status = IDLE;
|
||||
@@ -317,9 +318,9 @@ void rrc_t310_expiration(u32 frame, u8 Mod_id, u8 eNB_index) {
|
||||
}
|
||||
}
|
||||
|
||||
RRC_status_t rrc_rx_tx(u8 Mod_id,u32 frame, u8 eNB_flag,u8 index){
|
||||
RRC_status_t rrc_rx_tx(u8 Mod_id,frame_t frameP, eNB_flag_t eNB_flagP,u8 index){
|
||||
|
||||
if(eNB_flag == 0) {
|
||||
if(eNB_flagP == 0) {
|
||||
// check timers
|
||||
|
||||
if (UE_rrc_inst[Mod_id].Info[index].T300_active == 1) {
|
||||
|
||||
+135
-133
@@ -111,7 +111,7 @@ static const uint8_t RRC_TRANSACTION_IDENTIFIER_NUMBER = 4;
|
||||
mui_t rrc_eNB_mui = 0;
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
static void init_SI (u8 Mod_id
|
||||
static void init_SI (module_id_t Mod_id
|
||||
#if defined(ENABLE_ITTI)
|
||||
, RrcConfigurationReq *configuration
|
||||
#endif
|
||||
@@ -344,7 +344,7 @@ static void init_SI (u8 Mod_id
|
||||
|
||||
#ifdef Rel10
|
||||
/*------------------------------------------------------------------------------*/
|
||||
static void init_MCCH (u8 Mod_id) {
|
||||
static void init_MCCH (module_id_t Mod_id) {
|
||||
|
||||
int sync_area=0;
|
||||
// initialize RRC_eNB_INST MCCH entry
|
||||
@@ -425,15 +425,15 @@ static void init_MCCH (u8 Mod_id) {
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
static void init_MBMS (u8 Mod_id, u32 frame) {
|
||||
static void init_MBMS (module_id_t Mod_id, frame_t frameP) {
|
||||
// init the configuration for MTCH
|
||||
|
||||
if (eNB_rrc_inst[Mod_id].MBMS_flag > 0) {
|
||||
|
||||
LOG_D(RRC,"[eNB %d] Frame %d : Radio Bearer config request for MBMS\n", Mod_id, frame); //check the lcid
|
||||
LOG_D(RRC,"[eNB %d] Frame %d : Radio Bearer config request for MBMS\n", Mod_id, frameP); //check the lcid
|
||||
// Configuring PDCP and RLC for MBMS Radio Bearer
|
||||
|
||||
rrc_pdcp_config_asn1_req (Mod_id, 0, frame, 1,
|
||||
rrc_pdcp_config_asn1_req (Mod_id, 0, frameP, 1,
|
||||
NULL, // SRB_ToAddModList
|
||||
NULL, // DRB_ToAddModList
|
||||
(DRB_ToReleaseList_t *) NULL,
|
||||
@@ -447,7 +447,7 @@ static void init_MBMS (u8 Mod_id, u32 frame) {
|
||||
#endif
|
||||
);
|
||||
|
||||
rrc_rlc_config_asn1_req(Mod_id, frame, 1, 0,
|
||||
rrc_rlc_config_asn1_req(Mod_id, 0,frameP, 1,
|
||||
NULL,// SRB_ToAddModList
|
||||
NULL,// DRB_ToAddModList
|
||||
NULL,// DRB_ToReleaseList
|
||||
@@ -459,7 +459,7 @@ static void init_MBMS (u8 Mod_id, u32 frame) {
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
static void rrc_lite_eNB_init_security(u8 Mod_id, u8 UE_index)
|
||||
static void rrc_lite_eNB_init_security(module_id_t Mod_id, u8 UE_index)
|
||||
{
|
||||
#if defined(ENABLE_SECURITY)
|
||||
char ascii_buffer[65];
|
||||
@@ -477,7 +477,7 @@ static void rrc_lite_eNB_init_security(u8 Mod_id, u8 UE_index)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
uint8_t rrc_eNB_get_next_transaction_identifier(uint8_t Mod_id)
|
||||
uint8_t rrc_eNB_get_next_transaction_identifier(module_id_t Mod_id)
|
||||
{
|
||||
static uint8_t rrc_transaction_identifier[NUMBER_OF_eNB_MAX];
|
||||
|
||||
@@ -489,7 +489,7 @@ uint8_t rrc_eNB_get_next_transaction_identifier(uint8_t Mod_id)
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Functions to handle UE index in eNB UE list */
|
||||
|
||||
static uint8_t rrc_eNB_get_next_free_UE_index (uint8_t Mod_id, uint64_t UE_identity)
|
||||
static uint8_t rrc_eNB_get_next_free_UE_index (module_id_t Mod_id, uint64_t UE_identity)
|
||||
{
|
||||
uint8_t i, first_index = UE_INDEX_INVALID, reg = 0;
|
||||
|
||||
@@ -515,24 +515,24 @@ static uint8_t rrc_eNB_get_next_free_UE_index (uint8_t Mod_id, uint64_t UE_ident
|
||||
}
|
||||
}
|
||||
|
||||
void rrc_eNB_free_UE_index (uint8_t Mod_id, uint8_t UE_id)
|
||||
void rrc_eNB_free_UE_index (module_id_t enb_mod_idP, module_id_t ue_mod_idP)
|
||||
{
|
||||
AssertFatal(Mod_id < NB_eNB_INST, "eNB index invalid (%d/%d) for UE %d!", Mod_id, NB_eNB_INST, UE_id);
|
||||
AssertFatal(UE_id < NUMBER_OF_UE_MAX, "UE index invalid (%d/%d) for eNB %d!", UE_id, NUMBER_OF_UE_MAX, Mod_id);
|
||||
AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB inst invalid (%d/%d) for UE %d!", enb_mod_idP, NB_eNB_INST, ue_mod_idP);
|
||||
AssertFatal(ue_mod_idP < NUMBER_OF_UE_MAX, "UE inst invalid (%d/%d) for eNB %d!", ue_mod_idP, NUMBER_OF_UE_MAX, enb_mod_idP);
|
||||
|
||||
LOG_I (RRC, "[eNB %d] Removing UE %d rv 0x%" PRIx64 "\n", Mod_id, UE_id, eNB_rrc_inst[Mod_id].Info.UE_list[UE_id]);
|
||||
eNB_rrc_inst[Mod_id].Info.UE[UE_id].Status = RRC_IDLE;
|
||||
eNB_rrc_inst[Mod_id].Info.UE_list[UE_id] = 0;
|
||||
LOG_I (RRC, "[eNB %d] Removing UE %d rv 0x%" PRIx64 "\n", enb_mod_idP, ue_mod_idP, eNB_rrc_inst[enb_mod_idP].Info.UE_list[ue_mod_idP]);
|
||||
eNB_rrc_inst[enb_mod_idP].Info.UE[ue_mod_idP].Status = RRC_IDLE;
|
||||
eNB_rrc_inst[enb_mod_idP].Info.UE_list[ue_mod_idP] = 0;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
void rrc_eNB_process_RRCConnectionSetupComplete (u8 Mod_id,
|
||||
u32 frame,
|
||||
void rrc_eNB_process_RRCConnectionSetupComplete (module_id_t Mod_id,
|
||||
frame_t frameP,
|
||||
u8 UE_index,
|
||||
RRCConnectionSetupComplete_r8_IEs_t *rrcConnectionSetupComplete)
|
||||
{
|
||||
LOG_I (RRC, "[eNB %d][RAPROC] Frame %d : Logical Channel UL-DCCH, ""processing RRCConnectionSetupComplete from UE %d\n",
|
||||
Mod_id, frame, UE_index);
|
||||
Mod_id, frameP, UE_index);
|
||||
|
||||
#if defined(ENABLE_USE_MME)
|
||||
if (EPC_MODE_ENABLED == 1)
|
||||
@@ -544,13 +544,13 @@ void rrc_eNB_process_RRCConnectionSetupComplete (u8 Mod_id,
|
||||
#endif
|
||||
{
|
||||
// RRC loop back (no S1AP), send SecurityModeCommand to UE
|
||||
rrc_eNB_generate_SecurityModeCommand (Mod_id, frame, UE_index);
|
||||
// rrc_eNB_generate_UECapabilityEnquiry(Mod_id,frame,UE_index);
|
||||
rrc_eNB_generate_SecurityModeCommand (Mod_id, frameP, UE_index);
|
||||
// rrc_eNB_generate_UECapabilityEnquiry(Mod_id,frameP,UE_index);
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
void rrc_eNB_generate_SecurityModeCommand (u8 Mod_id, u32 frame, u16 UE_index)
|
||||
void rrc_eNB_generate_SecurityModeCommand (module_id_t Mod_id, frame_t frameP, u16 UE_index)
|
||||
{
|
||||
uint8_t buffer[100];
|
||||
uint8_t size;
|
||||
@@ -560,20 +560,20 @@ void rrc_eNB_generate_SecurityModeCommand (u8 Mod_id, u32 frame, u16 UE_index)
|
||||
|
||||
LOG_I (RRC,
|
||||
"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d, UE id %d)\n",
|
||||
Mod_id, frame, size, UE_index);
|
||||
Mod_id, frameP, size, UE_index);
|
||||
|
||||
|
||||
LOG_D (RRC,
|
||||
"[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (securityModeCommand to UE %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
|
||||
frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, DCCH);
|
||||
//rrc_rlc_data_req(Mod_id,frame, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer);
|
||||
pdcp_rrc_data_req (Mod_id, UE_index, frame, 1, DCCH,
|
||||
frameP, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, DCCH);
|
||||
//rrc_rlc_data_req(Mod_id,frameP, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer);
|
||||
pdcp_rrc_data_req (Mod_id, UE_index, frameP, 1, DCCH,
|
||||
rrc_eNB_mui++, 0, size, buffer, 1);
|
||||
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
void rrc_eNB_generate_UECapabilityEnquiry (u8 Mod_id, u32 frame, u16 UE_index)
|
||||
void rrc_eNB_generate_UECapabilityEnquiry (module_id_t Mod_id, frame_t frameP, u16 UE_index)
|
||||
{
|
||||
|
||||
uint8_t buffer[100];
|
||||
@@ -583,20 +583,20 @@ void rrc_eNB_generate_UECapabilityEnquiry (u8 Mod_id, u32 frame, u16 UE_index)
|
||||
|
||||
LOG_I (RRC,
|
||||
"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate UECapabilityEnquiry (bytes %d, UE id %d)\n",
|
||||
Mod_id, frame, size, UE_index);
|
||||
Mod_id, frameP, size, UE_index);
|
||||
|
||||
|
||||
LOG_D (RRC,
|
||||
"[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (UECapabilityEnquiry to UE %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
|
||||
frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, DCCH);
|
||||
//rrc_rlc_data_req(Mod_id,frame, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer);
|
||||
pdcp_rrc_data_req (Mod_id, UE_index, frame, 1, DCCH,
|
||||
frameP, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, DCCH);
|
||||
//rrc_rlc_data_req(Mod_id,frameP, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer);
|
||||
pdcp_rrc_data_req (Mod_id, UE_index, frameP, 1, DCCH,
|
||||
rrc_eNB_mui++, 0, size, buffer, 1);
|
||||
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
static void rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32 frame,
|
||||
static void rrc_eNB_generate_defaultRRCConnectionReconfiguration (module_id_t Mod_id, frame_t frameP,
|
||||
u16 UE_index,
|
||||
u8 ho_state)
|
||||
{
|
||||
@@ -671,7 +671,7 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32
|
||||
cba_RNTI->buf[1] = 0xff;
|
||||
LOG_D (RRC,
|
||||
"[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n",
|
||||
Mod_id, frame,
|
||||
Mod_id, frameP,
|
||||
rrc_inst->cba_rnti[UE_index % rrc_inst->num_active_cba_groups],
|
||||
UE_index % rrc_inst->num_active_cba_groups, UE_index);
|
||||
}
|
||||
@@ -680,7 +680,7 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32
|
||||
cba_RNTI->buf[0] = 0x0;
|
||||
cba_RNTI->buf[1] = 0x0;
|
||||
LOG_D (RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n",
|
||||
Mod_id, frame, UE_index);
|
||||
Mod_id, frameP, UE_index);
|
||||
}
|
||||
|
||||
|
||||
@@ -952,7 +952,7 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32
|
||||
ASN_SEQUENCE_ADD (&ReportConfig_list->list, ReportConfig_A1);
|
||||
|
||||
if (ho_state == 1 /*HO_MEASURMENT*/ ){
|
||||
LOG_I(RRC,"[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", Mod_id, frame);
|
||||
LOG_I(RRC,"[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", Mod_id, frameP);
|
||||
ReportConfig_A2->reportConfigId = 3;
|
||||
ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
|
||||
ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_event;
|
||||
@@ -1043,7 +1043,7 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32
|
||||
*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4;
|
||||
*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4;
|
||||
|
||||
LOG_I(RRC,"[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n",Mod_id, frame);
|
||||
LOG_I(RRC,"[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n",Mod_id, frameP);
|
||||
// store the information in an intermediate structure for Hanodver management
|
||||
//rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof());
|
||||
rrc_inst->handover_info[UE_index] = CALLOC(1,sizeof(*(rrc_inst->handover_info[UE_index])));
|
||||
@@ -1126,22 +1126,22 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32
|
||||
#endif
|
||||
|
||||
LOG_I (RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %d)\n",
|
||||
Mod_id, frame, size, UE_index);
|
||||
Mod_id, frameP, size, UE_index);
|
||||
|
||||
LOG_D (RRC,"[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
|
||||
frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, DCCH);
|
||||
//rrc_rlc_data_req(Mod_id,frame, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer);
|
||||
pdcp_rrc_data_req (Mod_id, UE_index, frame, 1, DCCH,
|
||||
LOG_D (RRC,"[MSC_MSG][FRAME %05d][RRC_eNB][MOD %u/%u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %d MUI %d) --->][PDCP][MOD %u/%u][RB %u]\n",
|
||||
frameP, Mod_id, UE_index, size, UE_index, rrc_eNB_mui, Mod_id, UE_index, DCCH);
|
||||
//rrc_rlc_data_req(Mod_id,frameP, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer);
|
||||
pdcp_rrc_data_req (Mod_id, UE_index, frameP, 1, DCCH,
|
||||
rrc_eNB_mui++, 0, size, buffer, 1);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
void rrc_eNB_process_MeasurementReport (u8 Mod_id, u32 frame, u16 UE_index,
|
||||
void rrc_eNB_process_MeasurementReport (module_id_t Mod_id, frame_t frameP, u16 UE_index,
|
||||
MeasResults_t * measResults2)
|
||||
{
|
||||
|
||||
LOG_I (RRC,"[eNB %d] Frame %d: Process Measurement Report From UE %d (Measurement Id %d)\n",
|
||||
Mod_id, frame, UE_index, (int) measResults2->measId);
|
||||
Mod_id, frameP, UE_index, (int) measResults2->measId);
|
||||
if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) {
|
||||
LOG_I (RRC, "Physical Cell Id %d\n",
|
||||
(int) measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId);
|
||||
@@ -1164,11 +1164,11 @@ void rrc_eNB_process_MeasurementReport (u8 Mod_id, u32 frame, u16 UE_index,
|
||||
|
||||
if(eNB_rrc_inst[Mod_id].handover_info[UE_index]->ho_prepare != 0xF0){
|
||||
rrc_eNB_generate_HandoverPreparationInformation(Mod_id,
|
||||
frame,
|
||||
frameP,
|
||||
UE_index,
|
||||
measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId);
|
||||
}else{
|
||||
LOG_D(RRC,"[eNB %d] Frame %d: Ignoring MeasReport from UE %d as Handover is in progress... \n",Mod_id,frame, UE_index);
|
||||
LOG_D(RRC,"[eNB %d] Frame %d: Ignoring MeasReport from UE %d as Handover is in progress... \n",Mod_id,frameP, UE_index);
|
||||
}
|
||||
//Look for IP address of the target eNB
|
||||
//Send Handover Request -> target eNB
|
||||
@@ -1187,7 +1187,7 @@ void rrc_eNB_process_MeasurementReport (u8 Mod_id, u32 frame, u16 UE_index,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
void rrc_eNB_generate_HandoverPreparationInformation (u8 Mod_id, u32 frame, u8 UE_index, PhysCellId_t targetPhyId) {
|
||||
void rrc_eNB_generate_HandoverPreparationInformation (module_id_t Mod_id, frame_t frameP, u8 UE_index, PhysCellId_t targetPhyId) {
|
||||
u8 UE_id_target;
|
||||
u8 mod_id_target = get_adjacent_cell_mod_id(targetPhyId);
|
||||
HANDOVER_INFO *handoverInfo = CALLOC(1,sizeof(*handoverInfo));
|
||||
@@ -1233,7 +1233,7 @@ void rrc_eNB_generate_HandoverPreparationInformation (u8 Mod_id, u32 frame, u8 U
|
||||
UE_id_target = rrc_eNB_get_next_free_UE_index(mod_id_target, eNB_rrc_inst[Mod_id].Info.UE_list[UE_index]); //this should return a new index
|
||||
|
||||
if (UE_id_target!=0xFF) {
|
||||
LOG_N(RRC,"[eNB %d] Frame %d : Emulate sending HandoverPreparationInformation msg from eNB source %d to eNB target %d: source UE_id %d target UE_id %d source_modId: %d target_modId: %d\n",Mod_id,frame,eNB_rrc_inst[Mod_id].physCellId,targetPhyId,UE_index,UE_id_target,Mod_id,mod_id_target);
|
||||
LOG_N(RRC,"[eNB %d] Frame %d : Emulate sending HandoverPreparationInformation msg from eNB source %d to eNB target %d: source UE_id %d target UE_id %d source_modId: %d target_modId: %d\n",Mod_id,frameP,eNB_rrc_inst[Mod_id].physCellId,targetPhyId,UE_index,UE_id_target,Mod_id,mod_id_target);
|
||||
eNB_rrc_inst[mod_id_target].handover_info[UE_id_target] = CALLOC(1,sizeof(*(eNB_rrc_inst[mod_id_target].handover_info[UE_id_target])));
|
||||
memcpy((void *)&eNB_rrc_inst[mod_id_target].handover_info[UE_id_target]->as_context,
|
||||
(void *)&eNB_rrc_inst[Mod_id].handover_info[UE_index]->as_context,
|
||||
@@ -1260,18 +1260,18 @@ void rrc_eNB_generate_HandoverPreparationInformation (u8 Mod_id, u32 frame, u8 U
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
void rrc_eNB_process_handoverPreparationInformation(u8 Mod_id,u32 frame, u16 UE_index) {
|
||||
void rrc_eNB_process_handoverPreparationInformation(module_id_t Mod_id,frame_t frameP, u16 UE_index) {
|
||||
|
||||
LOG_I(RRC,"[eNB %d] Frame %d : Logical Channel UL-DCCH, processing RRCHandoverPreparationInformation, sending RRCConnectionReconfiguration to UE %d \n",Mod_id,frame,UE_index);
|
||||
LOG_I(RRC,"[eNB %d] Frame %d : Logical Channel UL-DCCH, processing RRCHandoverPreparationInformation, sending RRCConnectionReconfiguration to UE %d \n",Mod_id,frameP,UE_index);
|
||||
|
||||
|
||||
//eNB_rrc_inst[Mod_id].Info.UE_list[UE_index]
|
||||
rrc_eNB_generate_RRCConnectionReconfiguration_handover(Mod_id,frame,UE_index,NULL,0);
|
||||
rrc_eNB_generate_RRCConnectionReconfiguration_handover(Mod_id,frameP,UE_index,NULL,0);
|
||||
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
void check_handovers(u8 Mod_id, u32 frame) {
|
||||
void check_handovers(module_id_t Mod_id, frame_t frameP) {
|
||||
u8 i;
|
||||
int result;
|
||||
|
||||
@@ -1279,18 +1279,18 @@ void check_handovers(u8 Mod_id, u32 frame) {
|
||||
if(eNB_rrc_inst[Mod_id].handover_info[i] != NULL) {
|
||||
if(eNB_rrc_inst[Mod_id].handover_info[i]->ho_prepare == 0xFF) {
|
||||
LOG_D(RRC,"[eNB %d] Frame %d: Incoming handover detected for new UE_idx %d (source eNB %d->target eNB %d) \n",
|
||||
Mod_id, frame, i,Mod_id, eNB_rrc_inst[Mod_id].handover_info[i]->modid_t);
|
||||
Mod_id, frameP, i,Mod_id, eNB_rrc_inst[Mod_id].handover_info[i]->modid_t);
|
||||
// source eNB generates rrcconnectionreconfiguration to prepare the HO
|
||||
rrc_eNB_process_handoverPreparationInformation(Mod_id,frame,i);
|
||||
rrc_eNB_process_handoverPreparationInformation(Mod_id,frameP,i);
|
||||
eNB_rrc_inst[Mod_id].handover_info[i]->ho_prepare = 0xF1;
|
||||
}
|
||||
|
||||
if(eNB_rrc_inst[Mod_id].handover_info[i]->ho_complete == 0xF1) {
|
||||
LOG_D(RRC,"[eNB %d] Frame %d: handover Command received for new UE_idx %d current eNB %d target eNB: %d \n",
|
||||
Mod_id, frame, i,Mod_id,eNB_rrc_inst[Mod_id].handover_info[i]->modid_t);
|
||||
//rrc_eNB_process_handoverPreparationInformation(Mod_id,frame,i);
|
||||
result = pdcp_data_req(Mod_id, i, frame, 1,
|
||||
(i* NB_RB_MAX)+DCCH,
|
||||
Mod_id, frameP, i,Mod_id,eNB_rrc_inst[Mod_id].handover_info[i]->modid_t);
|
||||
//rrc_eNB_process_handoverPreparationInformation(Mod_id,frameP,i);
|
||||
result = pdcp_data_req(Mod_id, i, frameP, 1,
|
||||
DCCH,
|
||||
rrc_eNB_mui++,0,
|
||||
eNB_rrc_inst[Mod_id].handover_info[i]->size,
|
||||
eNB_rrc_inst[Mod_id].handover_info[i]->buf,1);
|
||||
@@ -1303,7 +1303,7 @@ void check_handovers(u8 Mod_id, u32 frame) {
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
// 5.3.5.4 RRCConnectionReconfiguration including the mobilityControlInfo to prepare the UE handover
|
||||
void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 frame,u16 UE_index,u8 *nas_pdu,u32 nas_length) {
|
||||
void rrc_eNB_generate_RRCConnectionReconfiguration_handover (module_id_t Mod_id, frame_t frameP,u16 UE_index,u8 *nas_pdu,u32 nas_length) {
|
||||
|
||||
u8 buffer[RRC_BUF_SIZE];
|
||||
u16 size;
|
||||
@@ -1365,13 +1365,13 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 fram
|
||||
struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList;
|
||||
|
||||
|
||||
LOG_D(RRC,"[eNB %d] Frame %d: handover preparation: get the newSourceUEIdentity (C-RNTI): ", Mod_id, frame);
|
||||
LOG_D(RRC,"[eNB %d] Frame %d: handover preparation: get the newSourceUEIdentity (C-RNTI): ", Mod_id, frameP);
|
||||
for (i=0;i<2;i++) {
|
||||
rv[i]=taus()&0xff;
|
||||
LOG_D(RRC," %x.",rv[i]);
|
||||
}
|
||||
|
||||
LOG_D(RRC,"[eNB %d] Frame %d : handover reparation: add target eNB SRB1 and PHYConfigDedicated reconfiguration\n",Mod_id, frame);
|
||||
LOG_D(RRC,"[eNB %d] Frame %d : handover reparation: add target eNB SRB1 and PHYConfigDedicated reconfiguration\n",Mod_id, frameP);
|
||||
// 1st: reconfigure SRB
|
||||
SRB_configList2 = CALLOC(1,sizeof(*SRB_configList));
|
||||
SRB1_config = CALLOC(1,sizeof(*SRB1_config));
|
||||
@@ -1558,7 +1558,7 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 fram
|
||||
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4;
|
||||
|
||||
LOG_D(RRC,"handover_config [MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %d) --->][MAC_eNB][MOD %02d][]\n",
|
||||
frame, Mod_id, UE_index, Mod_id);
|
||||
frameP, Mod_id, UE_index, Mod_id);
|
||||
rrc_mac_config_req (Mod_id, 1, UE_index, 0,
|
||||
(RadioResourceConfigCommonSIB_t *) NULL,
|
||||
eNB_rrc_inst[Mod_id].physicalConfigDedicated[UE_index],
|
||||
@@ -1913,7 +1913,7 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 fram
|
||||
memset((void *)mobilityInfo,0,sizeof(*mobilityInfo));
|
||||
mobilityInfo->targetPhysCellId = (PhysCellId_t) two_tier_hexagonal_cellIds[rrc_inst->handover_info[UE_index]->modid_t];
|
||||
LOG_D(RRC,"[eNB %d] Frame %d: handover preparation: targetPhysCellId: %d mod_id: %d UE_index: %d \n",
|
||||
Mod_id,frame, mobilityInfo->targetPhysCellId,Mod_id,UE_index);
|
||||
Mod_id,frameP, mobilityInfo->targetPhysCellId,Mod_id,UE_index);
|
||||
|
||||
mobilityInfo->additionalSpectrumEmission = CALLOC(1,sizeof(*mobilityInfo->additionalSpectrumEmission));
|
||||
*mobilityInfo->additionalSpectrumEmission = 1; //Check this value!
|
||||
@@ -1999,7 +1999,8 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 fram
|
||||
sizeof(SPS_Config_t));
|
||||
*/
|
||||
LOG_I(RRC,"[eNB %d] Frame %d: adding new UE\n");
|
||||
Idx = (UE_index * NB_RB_MAX) + DCCH;
|
||||
//Idx = (UE_index * NB_RB_MAX) + DCCH;
|
||||
Idx = DCCH;
|
||||
// SRB1
|
||||
eNB_rrc_inst[Mod_id].Srb1[UE_index].Active = 1;
|
||||
eNB_rrc_inst[Mod_id].Srb1[UE_index].Srb_info.Srb_id = Idx;
|
||||
@@ -2018,10 +2019,10 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 fram
|
||||
|
||||
LOG_I (RRC,"[eNB %d] CALLING RLC CONFIG SRB1 (rbid %d) for UE %d\n",Mod_id, Idx, UE_index);
|
||||
|
||||
// rrc_pdcp_config_req (Mod_id, frame, 1, ACTION_ADD, idx, UNDEF_SECURITY_MODE);
|
||||
// rrc_rlc_config_req(Mod_id,frame,1,ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
|
||||
// rrc_pdcp_config_req (Mod_id, frameP, 1, ACTION_ADD, idx, UNDEF_SECURITY_MODE);
|
||||
// rrc_rlc_config_req(Mod_id,frameP,1,ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
|
||||
|
||||
rrc_pdcp_config_asn1_req (Mod_id, UE_index, frame, 1,
|
||||
rrc_pdcp_config_asn1_req (Mod_id, UE_index, frameP, 1,
|
||||
eNB_rrc_inst[Mod_id].SRB_configList[UE_index],
|
||||
(DRB_ToAddModList_t *) NULL,
|
||||
(DRB_ToReleaseList_t *) NULL,
|
||||
@@ -2034,7 +2035,7 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 fram
|
||||
#endif
|
||||
);
|
||||
|
||||
rrc_rlc_config_asn1_req (Mod_id, frame, 1, UE_index,
|
||||
rrc_rlc_config_asn1_req (Mod_id, UE_index,frameP, 1,
|
||||
eNB_rrc_inst[Mod_id].SRB_configList[UE_index],
|
||||
(DRB_ToAddModList_t *) NULL,
|
||||
(DRB_ToReleaseList_t *) NULL
|
||||
@@ -2058,7 +2059,7 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 fram
|
||||
NULL, NULL, dedicatedInfoNASList);
|
||||
|
||||
LOG_I (RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration for handover (bytes %d, UE id %d)\n",
|
||||
Mod_id, frame, size, UE_index);
|
||||
Mod_id, frameP, size, UE_index);
|
||||
// to be updated if needed
|
||||
/*if (eNB_rrc_inst[Mod_id].SRB1_config[UE_index]->logicalChannelConfig) {
|
||||
if (eNB_rrc_inst[Mod_id].SRB1_config[UE_index]->logicalChannelConfig->present == SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) {
|
||||
@@ -2074,11 +2075,11 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 fram
|
||||
*/
|
||||
|
||||
LOG_D (RRC,"[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration_handover to UE %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
|
||||
frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id,
|
||||
(UE_index * NB_RB_MAX) + DCCH);
|
||||
frameP, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id,
|
||||
DCCH);
|
||||
|
||||
//rrc_rlc_data_req(Mod_id,frame, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer);
|
||||
//pdcp_data_req (Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH,rrc_eNB_mui++, 0, size, (char *) buffer, 1);
|
||||
//rrc_rlc_data_req(Mod_id,frameP, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer);
|
||||
//pdcp_data_req (Mod_id, frameP, 1, (UE_index * NB_RB_MAX) + DCCH,rrc_eNB_mui++, 0, size, (char *) buffer, 1);
|
||||
rrc_mac_config_req (Mod_id, 1, UE_index, 0,
|
||||
(RadioResourceConfigCommonSIB_t *) NULL,
|
||||
eNB_rrc_inst[Mod_id].physicalConfigDedicated[UE_index],
|
||||
@@ -2120,19 +2121,19 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 fram
|
||||
eNB_rrc_inst[sourceModId].handover_info[eNB_rrc_inst[Mod_id].handover_info[UE_index]->ueid_s]->ho_complete = 0xF1;
|
||||
//eNB_rrc_inst[Mod_id].handover_info[UE_index]->ho_complete = 0xFF;
|
||||
LOG_D(RRC,"[eNB %d] Frame %d: setting handover complete to 0xF1 for (%d,%d) and to 0xFF for (%d,%d)\n",
|
||||
Mod_id, frame,
|
||||
Mod_id, frameP,
|
||||
sourceModId,eNB_rrc_inst[Mod_id].handover_info[UE_index]->ueid_s,
|
||||
Mod_id, UE_index);
|
||||
}
|
||||
else
|
||||
LOG_W(RRC,"[eNB %d] Frame %d: rrc_eNB_generate_RRCConnectionReconfiguration_handover: Could not find source eNB mod_id.\n",
|
||||
Mod_id, frame);
|
||||
Mod_id, frameP);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
void ue_rrc_process_rrcConnectionReconfiguration(u8 Mod_id,u32 frame,
|
||||
void ue_rrc_process_rrcConnectionReconfiguration(u8 Mod_id,frame_t frameP,
|
||||
RRCConnectionReconfiguration_t *rrcConnectionReconfiguration,
|
||||
u8 CH_index) {
|
||||
|
||||
@@ -2140,7 +2141,7 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 fram
|
||||
if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) {
|
||||
|
||||
if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated) {
|
||||
rrc_ue_process_radioResourceConfigDedicated(Mod_id,frame,CH_index,
|
||||
rrc_ue_process_radioResourceConfigDedicated(Mod_id,frameP,CH_index,
|
||||
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated);
|
||||
|
||||
|
||||
@@ -2152,7 +2153,7 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 fram
|
||||
*/
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
void rrc_eNB_process_RRCConnectionReconfigurationComplete (u8 Mod_id, u32 frame,
|
||||
void rrc_eNB_process_RRCConnectionReconfigurationComplete (module_id_t Mod_id, frame_t frameP,
|
||||
u8 UE_index,
|
||||
RRCConnectionReconfigurationComplete_r8_IEs_t *rrcConnectionReconfigurationComplete)
|
||||
{
|
||||
@@ -2212,7 +2213,7 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete (u8 Mod_id, u32 frame,
|
||||
#endif
|
||||
|
||||
// Refresh SRBs/DRBs
|
||||
rrc_pdcp_config_asn1_req (Mod_id, UE_index, frame, 1,
|
||||
rrc_pdcp_config_asn1_req (Mod_id, UE_index, frameP, 1,
|
||||
SRB_configList,
|
||||
DRB_configList, (DRB_ToReleaseList_t *) NULL,
|
||||
eNB_rrc_inst[Mod_id].ciphering_algorithm[UE_index] |
|
||||
@@ -2225,7 +2226,7 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete (u8 Mod_id, u32 frame,
|
||||
#endif
|
||||
);
|
||||
// Refresh SRBs/DRBs
|
||||
rrc_rlc_config_asn1_req (Mod_id, frame, 1, UE_index,
|
||||
rrc_rlc_config_asn1_req (Mod_id, UE_index, frameP, 1,
|
||||
SRB_configList,
|
||||
DRB_configList, (DRB_ToReleaseList_t *) NULL
|
||||
#ifdef Rel10
|
||||
@@ -2244,7 +2245,7 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete (u8 Mod_id, u32 frame,
|
||||
{
|
||||
LOG_I (RRC,
|
||||
"[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE %d, reconfiguring DRB %d/LCID %d\n",
|
||||
Mod_id, frame, UE_index,
|
||||
Mod_id, frameP, UE_index,
|
||||
(int) DRB_configList->list.array[i]->drb_Identity,
|
||||
(UE_index * NB_RB_MAX) +
|
||||
(int) *DRB_configList->list.array[i]->
|
||||
@@ -2252,9 +2253,9 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete (u8 Mod_id, u32 frame,
|
||||
if (eNB_rrc_inst[Mod_id].DRB_active[UE_index][i] == 0)
|
||||
{
|
||||
/*
|
||||
rrc_pdcp_config_req (Mod_id, frame, 1, ACTION_ADD,
|
||||
rrc_pdcp_config_req (Mod_id, frameP, 1, ACTION_ADD,
|
||||
(UE_index * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity,UNDEF_SECURITY_MODE);
|
||||
rrc_rlc_config_req(Mod_id,frame,1,ACTION_ADD,
|
||||
rrc_rlc_config_req(Mod_id,frameP,1,ACTION_ADD,
|
||||
(UE_index * NB_RB_MAX) + (int)*eNB_rrc_inst[Mod_id].DRB_config[UE_index][i]->logicalChannelIdentity,
|
||||
RADIO_ACCESS_BEARER,Rlc_info_um);
|
||||
*/
|
||||
@@ -2262,7 +2263,7 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete (u8 Mod_id, u32 frame,
|
||||
|
||||
LOG_D (RRC,
|
||||
"[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n",
|
||||
Mod_id, frame,
|
||||
Mod_id, frameP,
|
||||
(int) DRB_configList->list.array[i]->drb_Identity);
|
||||
|
||||
#ifdef NAS_NETLINK
|
||||
@@ -2308,7 +2309,7 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete (u8 Mod_id, u32 frame,
|
||||
|
||||
LOG_D (RRC,
|
||||
"[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (DRB UE %d) --->][MAC_eNB][MOD %02d][]\n",
|
||||
frame, Mod_id, UE_index, Mod_id);
|
||||
frameP, Mod_id, UE_index, Mod_id);
|
||||
if (DRB_configList->list.array[i]->logicalChannelIdentity)
|
||||
DRB2LCHAN[i] =
|
||||
(u8) *
|
||||
@@ -2347,18 +2348,18 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete (u8 Mod_id, u32 frame,
|
||||
if (eNB_rrc_inst[Mod_id].DRB_active[UE_index][i] == 1)
|
||||
{
|
||||
// DRB has just been removed so remove RLC + PDCP for DRB
|
||||
/* rrc_pdcp_config_req (Mod_id, frame, 1, ACTION_REMOVE,
|
||||
/* rrc_pdcp_config_req (Mod_id, frameP, 1, ACTION_REMOVE,
|
||||
(UE_index * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE);
|
||||
*/
|
||||
rrc_rlc_config_req (Mod_id, frame, 1, ACTION_REMOVE,
|
||||
(UE_index * NB_RB_MAX) +
|
||||
DRB2LCHAN[i], RADIO_ACCESS_BEARER,
|
||||
rrc_rlc_config_req (Mod_id, UE_index, frameP, 1, ACTION_REMOVE,
|
||||
DRB2LCHAN[i],
|
||||
RADIO_ACCESS_BEARER,
|
||||
Rlc_info_um);
|
||||
}
|
||||
eNB_rrc_inst[Mod_id].DRB_active[UE_index][i] = 0;
|
||||
LOG_D (RRC,
|
||||
"[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (DRB UE %d) --->][MAC_eNB][MOD %02d][]\n",
|
||||
frame, Mod_id, UE_index, Mod_id);
|
||||
frameP, Mod_id, UE_index, Mod_id);
|
||||
|
||||
rrc_mac_config_req (Mod_id, 1, UE_index, 0,
|
||||
(RadioResourceConfigCommonSIB_t *) NULL,
|
||||
@@ -2389,7 +2390,7 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete (u8 Mod_id, u32 frame,
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
void rrc_eNB_generate_RRCConnectionSetup (u8 Mod_id, u32 frame, u16 UE_index) {
|
||||
void rrc_eNB_generate_RRCConnectionSetup (module_id_t Mod_id, frame_t frameP, u16 UE_index) {
|
||||
|
||||
LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig;
|
||||
SRB_ToAddModList_t **SRB_configList;
|
||||
@@ -2441,7 +2442,7 @@ void rrc_eNB_generate_RRCConnectionSetup (u8 Mod_id, u32 frame, u16 UE_index) {
|
||||
|
||||
LOG_D (RRC,
|
||||
"[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %d) --->][MAC_eNB][MOD %02d][]\n",
|
||||
frame, Mod_id, UE_index, Mod_id);
|
||||
frameP, Mod_id, UE_index, Mod_id);
|
||||
rrc_mac_config_req (Mod_id, 1, UE_index, 0,
|
||||
(RadioResourceConfigCommonSIB_t *) NULL,
|
||||
eNB_rrc_inst[Mod_id].physicalConfigDedicated[UE_index],
|
||||
@@ -2471,14 +2472,14 @@ void rrc_eNB_generate_RRCConnectionSetup (u8 Mod_id, u32 frame, u16 UE_index) {
|
||||
}
|
||||
LOG_I (RRC,
|
||||
"[eNB %d][RAPROC] Frame %d : Logical Channel DL-CCCH, Generating RRCConnectionSetup (bytes %d, UE %d)\n",
|
||||
Mod_id, frame, eNB_rrc_inst[Mod_id].Srb0.Tx_buffer.payload_size,
|
||||
Mod_id, frameP, eNB_rrc_inst[Mod_id].Srb0.Tx_buffer.payload_size,
|
||||
UE_index);
|
||||
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
#if defined(ENABLE_ITTI)
|
||||
char openair_rrc_lite_eNB_init (u8 Mod_id)
|
||||
char openair_rrc_lite_eNB_init (module_id_t Mod_id)
|
||||
{
|
||||
/* Dummy function, initialization will be done through ITTI messaging */
|
||||
return 0;
|
||||
@@ -2594,7 +2595,7 @@ char openair_rrc_lite_eNB_init (u8 Mod_id)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
int rrc_eNB_decode_ccch (u8 Mod_id, u32 frame, SRB_INFO * Srb_info)
|
||||
int rrc_eNB_decode_ccch (module_id_t Mod_id, frame_t frameP, SRB_INFO * Srb_info)
|
||||
{
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -2610,7 +2611,7 @@ int rrc_eNB_decode_ccch (u8 Mod_id, u32 frame, SRB_INFO * Srb_info)
|
||||
//memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t));
|
||||
|
||||
LOG_T (RRC, "[eNB %d] Frame %d: Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n",
|
||||
Mod_id, frame, ((uint8_t *) Srb_info->Rx_buffer.Payload)[0],
|
||||
Mod_id, frameP, ((uint8_t *) Srb_info->Rx_buffer.Payload)[0],
|
||||
((uint8_t *) Srb_info->Rx_buffer.Payload)[1],
|
||||
((uint8_t *) Srb_info->Rx_buffer.Payload)[2],
|
||||
((uint8_t *) Srb_info->Rx_buffer.Payload)[3],
|
||||
@@ -2665,19 +2666,19 @@ for (i = 0; i < 8; i++)
|
||||
|
||||
case UL_CCCH_MessageType__c1_PR_NOTHING:
|
||||
LOG_I (RRC, "[eNB %d] Frame %d : Received PR_NOTHING on UL-CCCH-Message\n",
|
||||
Mod_id, frame);
|
||||
Mod_id, frameP);
|
||||
break;
|
||||
|
||||
case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest:
|
||||
LOG_D (RRC, "[MSC_MSG][FRAME %05d][MAC_eNB][MOD %02d][][--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) -->][RRC_eNB][MOD %02d][]\n",
|
||||
frame, Mod_id, Mod_id);
|
||||
frameP, Mod_id, Mod_id);
|
||||
LOG_I (RRC, "[eNB %d] Frame %d : RRCConnectionReestablishmentRequest not supported yet\n",
|
||||
Mod_id, frame);
|
||||
Mod_id, frameP);
|
||||
break;
|
||||
|
||||
case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest:
|
||||
LOG_D (RRC, "[MSC_MSG][FRAME %05d][MAC_eNB][MOD %02d][][--- MAC_DATA_IND (rrcConnectionRequest on SRB0) -->][RRC_eNB][MOD %02d][]\n",
|
||||
frame, Mod_id, Mod_id);
|
||||
frameP, Mod_id, Mod_id);
|
||||
|
||||
rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8;
|
||||
{
|
||||
@@ -2708,7 +2709,7 @@ for (i = 0; i < 8; i++)
|
||||
(u8 *) rrcConnectionRequest->ue_Identity.choice.randomValue.buf, 5);
|
||||
|
||||
LOG_I (RRC, "[eNB %d] Frame %d : Accept new connection from UE %d (0x%" PRIx64 ")\n",
|
||||
Mod_id, frame, UE_index,
|
||||
Mod_id, frameP, UE_index,
|
||||
eNB_rrc_inst[Mod_id].Info.UE_list[UE_index]);
|
||||
|
||||
//CONFIG SRB2 (DCCHs, ONE per User) //meas && lchan Cfg
|
||||
@@ -2720,7 +2721,8 @@ for (i = 0; i < 8; i++)
|
||||
send_msg (&S_rrc, msg_rrc_MR_attach_ind (Mod_id, Mac_id));
|
||||
#else
|
||||
|
||||
Idx = (UE_index * NB_RB_MAX) + DCCH;
|
||||
//LG COMMENT Idx = (UE_index * NB_RB_MAX) + DCCH;
|
||||
Idx = DCCH;
|
||||
// SRB1
|
||||
eNB_rrc_inst[Mod_id].Srb1[UE_index].Active = 1;
|
||||
eNB_rrc_inst[Mod_id].Srb1[UE_index].Srb_info.Srb_id = Idx;
|
||||
@@ -2737,19 +2739,19 @@ for (i = 0; i < 8; i++)
|
||||
memcpy (&eNB_rrc_inst[Mod_id].Srb2[UE_index].Srb_info.
|
||||
Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
|
||||
|
||||
rrc_eNB_generate_RRCConnectionSetup (Mod_id, frame, UE_index);
|
||||
rrc_eNB_generate_RRCConnectionSetup (Mod_id, frameP, UE_index);
|
||||
//LOG_D(RRC, "[MSC_NBOX][FRAME %05d][RRC_eNB][MOD %02d][][Tx RRCConnectionSetup][RRC_eNB][MOD %02d][]\n",
|
||||
// frame, Mod_id, Mod_id);
|
||||
// frameP, Mod_id, Mod_id);
|
||||
|
||||
//LOG_D(RRC,"[eNB %d] RLC AM allocation index@0 is %d\n",Mod_id,rlc[Mod_id].m_rlc_am_array[0].allocation);
|
||||
//LOG_D(RRC,"[eNB %d] RLC AM allocation index@1 is %d\n",Mod_id,rlc[Mod_id].m_rlc_am_array[1].allocation);
|
||||
LOG_I (RRC,"[eNB %d] CALLING RLC CONFIG SRB1 (rbid %d) for UE %d\n",Mod_id, Idx, UE_index);
|
||||
|
||||
// rrc_pdcp_config_req (Mod_id, frame, 1, ACTION_ADD, idx, UNDEF_SECURITY_MODE);
|
||||
// rrc_pdcp_config_req (Mod_id, frameP, 1, ACTION_ADD, idx, UNDEF_SECURITY_MODE);
|
||||
|
||||
// rrc_rlc_config_req(Mod_id,frame,1,ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
|
||||
// rrc_rlc_config_req(Mod_id,frameP,1,ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
|
||||
|
||||
rrc_pdcp_config_asn1_req (Mod_id, UE_index, frame, 1,
|
||||
rrc_pdcp_config_asn1_req (Mod_id, UE_index, frameP, 1,
|
||||
eNB_rrc_inst[Mod_id].
|
||||
SRB_configList[UE_index],
|
||||
(DRB_ToAddModList_t *) NULL,
|
||||
@@ -2763,7 +2765,7 @@ for (i = 0; i < 8; i++)
|
||||
#endif
|
||||
);
|
||||
|
||||
rrc_rlc_config_asn1_req (Mod_id, frame, 1, UE_index,
|
||||
rrc_rlc_config_asn1_req (Mod_id, UE_index, frameP, 1,
|
||||
eNB_rrc_inst[Mod_id].
|
||||
SRB_configList[UE_index],
|
||||
(DRB_ToAddModList_t *) NULL,
|
||||
@@ -2792,7 +2794,7 @@ for (i = 0; i < 8; i++)
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E (RRC, "[eNB %d] Frame %d : Unknown message\n", Mod_id, frame);
|
||||
LOG_E (RRC, "[eNB %d] Frame %d : Unknown message\n", Mod_id, frameP);
|
||||
rval = -1;
|
||||
break;
|
||||
}
|
||||
@@ -2800,14 +2802,14 @@ for (i = 0; i < 8; i++)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_E (RRC, "[eNB %d] Frame %d : Unknown error \n", Mod_id, frame);
|
||||
LOG_E (RRC, "[eNB %d] Frame %d : Unknown error \n", Mod_id, frameP);
|
||||
rval = -1;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
|
||||
int rrc_eNB_decode_dcch (module_id_t Mod_id, frame_t frameP, u8 Srb_id, u8 UE_index,
|
||||
u8 * Rx_sdu, u8 sdu_size)
|
||||
{
|
||||
/*------------------------------------------------------------------------------*/
|
||||
@@ -2820,12 +2822,12 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
|
||||
if ((Srb_id != 1) && (Srb_id != 2))
|
||||
{
|
||||
LOG_E (RRC, "[eNB %d] Frame %d: Received message on SRB%d, should not have ...\n",
|
||||
Mod_id, frame, Srb_id);
|
||||
Mod_id, frameP, Srb_id);
|
||||
}
|
||||
|
||||
//memset(ul_dcch_msg,0,sizeof(UL_DCCH_Message_t));
|
||||
|
||||
LOG_D (RRC, "[eNB %d] Frame %d: Decoding UL-DCCH Message\n", Mod_id, frame);
|
||||
LOG_D (RRC, "[eNB %d] Frame %d: Decoding UL-DCCH Message\n", Mod_id, frameP);
|
||||
dec_rval = uper_decode (NULL,
|
||||
&asn_DEF_UL_DCCH_Message,
|
||||
(void **) &ul_dcch_msg, Rx_sdu, sdu_size, 0, 0);
|
||||
@@ -2870,7 +2872,7 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
|
||||
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0))
|
||||
{
|
||||
LOG_E (RRC, "[UE %d] Frame %d : Failed to decode UL-DCCH (%d bytes)\n",
|
||||
Mod_id, frame, dec_rval.consumed);
|
||||
Mod_id, frameP, dec_rval.consumed);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2889,8 +2891,8 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
|
||||
LOG_D (RRC,
|
||||
"[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND "
|
||||
"%d bytes (measurementReport) --->][RRC_eNB][MOD %02d][]\n",
|
||||
frame, Mod_id, DCCH, sdu_size, Mod_id);
|
||||
rrc_eNB_process_MeasurementReport (Mod_id, frame, UE_index,
|
||||
frameP, Mod_id, DCCH, sdu_size, Mod_id);
|
||||
rrc_eNB_process_MeasurementReport (Mod_id, frameP, UE_index,
|
||||
&ul_dcch_msg->message.choice.c1.
|
||||
choice.measurementReport.
|
||||
criticalExtensions.choice.c1.
|
||||
@@ -2902,14 +2904,14 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
|
||||
LOG_D (RRC,
|
||||
"[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes "
|
||||
"(RRCConnectionReconfigurationComplete) --->][RRC_eNB][MOD %02d][]\n",
|
||||
frame, Mod_id, DCCH, sdu_size, Mod_id);
|
||||
frameP, Mod_id, DCCH, sdu_size, Mod_id);
|
||||
if (ul_dcch_msg->message.choice.c1.choice.
|
||||
rrcConnectionReconfigurationComplete.criticalExtensions.
|
||||
present ==
|
||||
RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8)
|
||||
{
|
||||
rrc_eNB_process_RRCConnectionReconfigurationComplete (Mod_id,
|
||||
frame,
|
||||
frameP,
|
||||
UE_index,
|
||||
&ul_dcch_msg->
|
||||
message.
|
||||
@@ -2938,14 +2940,14 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
|
||||
LOG_D (RRC,
|
||||
"[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes "
|
||||
"(rrcConnectionReestablishmentComplete) --->][RRC_eNB][MOD %02d][]\n",
|
||||
frame, Mod_id, DCCH, sdu_size, Mod_id);
|
||||
frameP, Mod_id, DCCH, sdu_size, Mod_id);
|
||||
break;
|
||||
|
||||
case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete:
|
||||
LOG_D (RRC,
|
||||
"[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes "
|
||||
"(RRCConnectionSetupComplete) --->][RRC_eNB][MOD %02d][]\n",
|
||||
frame, Mod_id, DCCH, sdu_size, Mod_id);
|
||||
frameP, Mod_id, DCCH, sdu_size, Mod_id);
|
||||
|
||||
if (ul_dcch_msg->message.choice.c1.choice.
|
||||
rrcConnectionSetupComplete.criticalExtensions.present ==
|
||||
@@ -2956,7 +2958,7 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
|
||||
present ==
|
||||
RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8)
|
||||
{
|
||||
rrc_eNB_process_RRCConnectionSetupComplete (Mod_id, frame,
|
||||
rrc_eNB_process_RRCConnectionSetupComplete (Mod_id, frameP,
|
||||
UE_index,
|
||||
&ul_dcch_msg->
|
||||
message.choice.
|
||||
@@ -2972,7 +2974,7 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
|
||||
LOG_D (RRC,
|
||||
"[MSC_NBOX][FRAME %05d][RRC_eNB][MOD %02d][][Rx RRCConnectionSetupComplete\n"
|
||||
"Now CONNECTED with UE %d][RRC_eNB][MOD %02d][]\n",
|
||||
frame, Mod_id, UE_index, Mod_id);
|
||||
frameP, Mod_id, UE_index, Mod_id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2980,24 +2982,24 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
|
||||
case UL_DCCH_MessageType__c1_PR_securityModeComplete:
|
||||
LOG_I (RRC,
|
||||
"[eNB %d] Frame %d received securityModeComplete on UL-DCCH %d from UE %d\n",
|
||||
Mod_id, frame, DCCH, UE_index);
|
||||
Mod_id, frameP, DCCH, UE_index);
|
||||
LOG_D (RRC,
|
||||
"[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes "
|
||||
"(securityModeComplete) --->][RRC_eNB][MOD %02d][]\n", frame,
|
||||
"(securityModeComplete) --->][RRC_eNB][MOD %02d][]\n", frameP,
|
||||
Mod_id, DCCH, sdu_size, Mod_id);
|
||||
#ifdef XER_PRINT
|
||||
xer_fprint (stdout, &asn_DEF_UL_DCCH_Message, (void *) ul_dcch_msg);
|
||||
#endif
|
||||
// confirm with PDCP about the security mode for DCCH
|
||||
//rrc_pdcp_config_req (Mod_id, frame, 1,ACTION_SET_SECURITY_MODE, (UE_index * NB_RB_MAX) + DCCH, 0x77);
|
||||
//rrc_pdcp_config_req (Mod_id, frameP, 1,ACTION_SET_SECURITY_MODE, (UE_index * NB_RB_MAX) + DCCH, 0x77);
|
||||
// continue the procedure
|
||||
rrc_eNB_generate_UECapabilityEnquiry (Mod_id, frame, UE_index);
|
||||
rrc_eNB_generate_UECapabilityEnquiry (Mod_id, frameP, UE_index);
|
||||
break;
|
||||
|
||||
case UL_DCCH_MessageType__c1_PR_securityModeFailure:
|
||||
LOG_D (RRC,
|
||||
"[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes "
|
||||
"(securityModeFailure) --->][RRC_eNB][MOD %02d][]\n", frame,
|
||||
"(securityModeFailure) --->][RRC_eNB][MOD %02d][]\n", frameP,
|
||||
Mod_id, DCCH, sdu_size, Mod_id);
|
||||
#ifdef XER_PRINT
|
||||
xer_fprint (stdout, &asn_DEF_UL_DCCH_Message, (void *) ul_dcch_msg);
|
||||
@@ -3005,17 +3007,17 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
|
||||
// cancel the security mode in PDCP
|
||||
|
||||
// followup with the remaining procedure
|
||||
rrc_eNB_generate_UECapabilityEnquiry (Mod_id, frame, UE_index);
|
||||
rrc_eNB_generate_UECapabilityEnquiry (Mod_id, frameP, UE_index);
|
||||
break;
|
||||
|
||||
case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation:
|
||||
LOG_I (RRC,
|
||||
"[eNB %d] Frame %d received ueCapabilityInformation on UL-DCCH %d from UE %d\n",
|
||||
Mod_id, frame, DCCH, UE_index);
|
||||
Mod_id, frameP, DCCH, UE_index);
|
||||
LOG_D (RRC,
|
||||
"[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes "
|
||||
"(UECapabilityInformation) --->][RRC_eNB][MOD %02d][]\n",
|
||||
frame, Mod_id, DCCH, sdu_size, Mod_id);
|
||||
frameP, Mod_id, DCCH, sdu_size, Mod_id);
|
||||
#ifdef XER_PRINT
|
||||
xer_fprint (stdout, &asn_DEF_UL_DCCH_Message, (void *) ul_dcch_msg);
|
||||
#endif
|
||||
@@ -3045,7 +3047,7 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
|
||||
}
|
||||
#endif
|
||||
|
||||
rrc_eNB_generate_defaultRRCConnectionReconfiguration (Mod_id, frame,
|
||||
rrc_eNB_generate_defaultRRCConnectionReconfiguration (Mod_id, frameP,
|
||||
UE_index,
|
||||
eNB_rrc_inst[Mod_id].HO_flag);
|
||||
break;
|
||||
@@ -3083,14 +3085,14 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
|
||||
#endif
|
||||
|
||||
default:
|
||||
LOG_E (RRC, "[UE %d] Frame %d : Unknown message\n", Mod_id, frame);
|
||||
LOG_E (RRC, "[UE %d] Frame %d : Unknown message\n", Mod_id, frameP);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_E (RRC, "[UE %d] Frame %d : Unknown error\n", Mod_id, frame);
|
||||
LOG_E (RRC, "[UE %d] Frame %d : Unknown error\n", Mod_id, frameP);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -3125,7 +3127,7 @@ void *rrc_enb_task(void *args_p) {
|
||||
|
||||
/* Messages from MAC */
|
||||
case RRC_MAC_CCCH_DATA_IND:
|
||||
LOG_I(RRC, "[eNB %d] Received %s: frame %d,\n", instance, msg_name,
|
||||
LOG_I(RRC, "[eNB %d] Received %s: frameP %d,\n", instance, msg_name,
|
||||
RRC_MAC_CCCH_DATA_IND (msg_p).frame);
|
||||
|
||||
srb_info_p = &eNB_rrc_inst[instance].Srb0;
|
||||
@@ -3138,7 +3140,7 @@ void *rrc_enb_task(void *args_p) {
|
||||
|
||||
/* Messages from PDCP */
|
||||
case RRC_DCCH_DATA_IND:
|
||||
LOG_I(RRC, "[eNB %d][UE %d] Received %s: frame %d, DCCH %d\n", instance, RRC_DCCH_DATA_IND (msg_p).ue_index, msg_name,
|
||||
LOG_I(RRC, "[eNB %d][UE %d] Received %s: frameP %d, DCCH %d\n", instance, RRC_DCCH_DATA_IND (msg_p).ue_index, msg_name,
|
||||
RRC_DCCH_DATA_IND (msg_p).frame, RRC_DCCH_DATA_IND (msg_p).dcch_index);
|
||||
|
||||
rrc_eNB_decode_dcch (instance, RRC_DCCH_DATA_IND (msg_p).frame, RRC_DCCH_DATA_IND (msg_p).dcch_index,
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#define __OCG_H__
|
||||
|
||||
#include "PHY/impl_defs_top.h"
|
||||
#include "platform_types.h"
|
||||
|
||||
#if defined(ENABLE_USE_MME)
|
||||
# include "s1ap_eNB.h"
|
||||
@@ -625,9 +626,9 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
|
||||
typedef struct
|
||||
{
|
||||
unsigned char nb_ue;
|
||||
unsigned char first_ue;
|
||||
module_id_t first_ue;
|
||||
unsigned char nb_enb;
|
||||
unsigned char first_enb;
|
||||
module_id_t first_enb;
|
||||
} master_info_t;
|
||||
|
||||
typedef struct
|
||||
@@ -643,9 +644,9 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
|
||||
unsigned char nb_enb_remote;
|
||||
unsigned char nb_rn_local;
|
||||
unsigned char nb_rn_remote;
|
||||
unsigned char first_enb_local;
|
||||
unsigned char first_rn_local;
|
||||
unsigned char first_ue_local;
|
||||
module_id_t first_enb_local;
|
||||
module_id_t first_rn_local;
|
||||
module_id_t first_ue_local;
|
||||
unsigned short master_id;
|
||||
unsigned char nb_master;
|
||||
unsigned int master_list;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
* Eurecom OpenAirInterface 3
|
||||
* Copyright(c) 2012 Eurecom
|
||||
*
|
||||
* Source eRALlte_main.c
|
||||
* Source lteRALenb_main.c
|
||||
* Version 0.1
|
||||
* Date 06/22/2012
|
||||
* Date 01/17/2014
|
||||
* Product MIH RAL LTE
|
||||
* Subsystem RAL main process running at the network side
|
||||
* Authors Michelle Wetterwald, Lionel Gauthier, Frederic Maurel
|
||||
@@ -20,26 +20,19 @@
|
||||
#define LTE_RAL_ENB_MAIN_C
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <stdio.h>
|
||||
# include <sys/epoll.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/select.h>
|
||||
#include <net/if.h>
|
||||
#include <getopt.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "assertions.h"
|
||||
#include "lteRALenb.h"
|
||||
#include "intertask_interface.h"
|
||||
#include "OCG.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// LTE AS sub-system
|
||||
//#include "nas_ue_ioctl.h"
|
||||
|
||||
#ifdef RAL_REALTIME
|
||||
//LG#include "rrc_nas_primitives.h"
|
||||
//LG#include "nasrg_constant.h"
|
||||
//LG#include "nasrg_iocontrol.h"
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
@@ -47,174 +40,10 @@
|
||||
/****************************************************************************/
|
||||
extern OAI_Emulation oai_emulation;
|
||||
|
||||
//int init_flag = 0;
|
||||
|
||||
/****************************************************************************/
|
||||
/******************* L O C A L D E F I N I T I O N S *******************/
|
||||
/****************************************************************************/
|
||||
|
||||
// static struct ral_lte_priv rl_priv;
|
||||
// //
|
||||
// static void arg_usage(const char* name);
|
||||
// static int parse_opts(int argc, char* argv[]);
|
||||
// static void NAS_Netlink_socket_init(void);
|
||||
// static void get_IPv6_addr(const char* if_name);
|
||||
// static int RAL_initialize(int argc, const char *argv[]);
|
||||
|
||||
//struct ral_lte_priv rl_priv;
|
||||
|
||||
// void arg_usage(const char* name);
|
||||
// int parse_opts(int argc, char* argv[]);
|
||||
// void get_IPv6_addr(const char* if_name);
|
||||
// int RAL_initialize(int argc, const char *argv[]);
|
||||
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
// Next part is used to receive the triggers
|
||||
/****************************************************************************/
|
||||
/*
|
||||
#ifdef MUSER_CONTROL
|
||||
|
||||
#define USER_IP_ADDRESS "127.0.0.1"
|
||||
#define USER_REMOTE_PORT "0"
|
||||
#define NAS_IP_ADDRESS "127.0.0.1"
|
||||
#define NAS_LISTENING_PORT_FOR_USER "22222"
|
||||
|
||||
int g_sockd_user;
|
||||
signed int g_user_congestion = 0;
|
||||
unsigned int g_ratio_modif = 0;
|
||||
//---------------------------------------------------------------------------
|
||||
int lteRALenb_trigger_connect(void){
|
||||
//---------------------------------------------------------------------------
|
||||
struct addrinfo hints;
|
||||
struct addrinfo *result, *rp;
|
||||
int s, on;
|
||||
struct sockaddr_in *addr = NULL;
|
||||
struct sockaddr_in6 *addr6 = NULL;
|
||||
unsigned char buf[sizeof(struct sockaddr_in6)];
|
||||
|
||||
|
||||
memset(&hints, 0, sizeof(struct addrinfo));
|
||||
hints.ai_family = AF_UNSPEC; // Allow IPv4 or IPv6
|
||||
hints.ai_socktype = SOCK_DGRAM; // Datagram socket
|
||||
hints.ai_flags = 0;
|
||||
hints.ai_protocol = 0; // Any protocol
|
||||
|
||||
s = getaddrinfo(g_mih_user_ip_address, g_mih_user_remote_port, &hints, &result);
|
||||
if (s != 0) {
|
||||
LOG_E (RAL_ENB,"getaddrinfo: %s\n", gai_strerror(s));
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (rp = result; rp != NULL; rp = rp->ai_next) {
|
||||
g_sockd_user = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
|
||||
if (g_sockd_user == -1)
|
||||
continue;
|
||||
|
||||
on = 1;
|
||||
setsockopt( g_sockd_user, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
|
||||
|
||||
if(rp->ai_family == AF_INET) {
|
||||
LOG_D (RAL_ENB, "Destination address %s is an ipv4 address\n",g_mih_user_ip_address);
|
||||
addr = (struct sockaddr_in *)(&buf[0]);
|
||||
addr->sin_port = htons(atoi(g_nas_listening_port_for_mih_user));
|
||||
addr->sin_family = AF_INET;
|
||||
s = inet_pton(AF_INET, g_nas_ip_address, &addr->sin_addr);
|
||||
if (s <= 0) {
|
||||
if (s == 0) {
|
||||
LOG_E (RAL_ENB, " IP address should be a IPv4 ADDR - But found not in presentation format : %s\n", g_nas_ip_address);
|
||||
} else {
|
||||
LOG_E (RAL_ENB, " %s - inet_pton( IPv4 ADDR %s): %s\n", __FUNCTION__, g_nas_ip_address, strerror(s));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = bind(g_sockd_user, (const struct sockaddr *)addr, sizeof(struct sockaddr_in));
|
||||
if (s == -1) {
|
||||
LOG_D (RAL_ENB, "IPv4 Address Bind: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
// sockd_mihf is of type SOCK_DGRAM, rp->ai_addr is the address to which datagrams are sent by default
|
||||
if (connect(g_sockd_user, rp->ai_addr, rp->ai_addrlen) != -1) {
|
||||
LOG_D (RAL_ENB, " lteRALeNB is now ready to receive triggers\n");
|
||||
return 0;
|
||||
} else {
|
||||
close(g_sockd_user);
|
||||
}
|
||||
} else if (rp->ai_family == AF_INET6) {
|
||||
LOG_D (RAL_ENB, "Destination address %s is an ipv6 address\n",g_mih_user_ip_address);
|
||||
addr6 = (struct sockaddr_in6 *)(&buf[0]);
|
||||
addr6->sin6_port = htons(atoi(g_nas_listening_port_for_mih_user));
|
||||
addr6->sin6_family = AF_INET6;
|
||||
s = inet_pton(AF_INET, g_nas_ip_address, &addr6->sin6_addr);
|
||||
if (s <= 0) {
|
||||
if (s == 0) {
|
||||
LOG_E (RAL_ENB, "IP address should be a IPv6 ADDR, But found not in presentation format : %s\n", g_nas_ip_address);
|
||||
} else {
|
||||
LOG_E (RAL_ENB, "%s - inet_pton( IPv6 ADDR %s): %s\n", __FUNCTION__, g_nas_ip_address, strerror(s));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = bind(g_sockd_user, (const struct sockaddr *)addr6, sizeof(struct sockaddr_in));
|
||||
if (s == -1) {
|
||||
LOG_D (RAL_ENB, "IPv6 Address Bind: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (connect(g_sockd_user, rp->ai_addr, rp->ai_addrlen) != -1) {
|
||||
LOG_D (RAL_ENB, "lteRALeNB is now ready to receive triggers\n");
|
||||
return 0;
|
||||
} else {
|
||||
close(g_sockd_user);
|
||||
}
|
||||
} else {
|
||||
LOG_E (RAL_ENB, "%s is an unknown address format %d\n",g_mih_user_ip_address,rp->ai_family);
|
||||
}
|
||||
close(g_sockd_user);
|
||||
}
|
||||
|
||||
if (rp == NULL) { // No address succeeded
|
||||
LOG_E (RAL_ENB, "Could not establish socket to MIH-User\n");
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int lteRALenb_trigger_receive(int sock){
|
||||
//---------------------------------------------------------------------------
|
||||
unsigned char str[50];
|
||||
int t, done;
|
||||
t=recv(sock, str, 50, 0);
|
||||
if (t <= 0) {
|
||||
if (t < 0) perror("lteRALenb_trigger_receive : recv");
|
||||
done = 1;
|
||||
}
|
||||
printf("\nmessage from USER, length: %d\n", t);
|
||||
switch (str[0]) {
|
||||
case 0xff:
|
||||
printf("USER ASK FOR STOPPING CONGESTION - not supported yet\n");
|
||||
break;
|
||||
case 0x01:
|
||||
printf("USER ASK FOR TRIGGERING CONGESTION\n");
|
||||
g_enb_ral_obj[instanceP].rlcBufferOccupancy[0] = 95;
|
||||
RAL_NAS_report_congestion(0);
|
||||
break;
|
||||
default:
|
||||
printf("received %hx\n", str[0]);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
*/
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** Name: get_IPv6_addr() **
|
||||
** Description: Gets the IPv6 address of the specified network interface. **
|
||||
@@ -309,6 +138,7 @@ void eRAL_init_default_values(void) {
|
||||
int eRAL_initialize(void){
|
||||
//-----------------------------------------------------------------------------
|
||||
ral_enb_instance_t instance = 0;
|
||||
unsigned int mod_id = 0;
|
||||
char *char_tmp = NULL;
|
||||
|
||||
MIH_C_init();
|
||||
@@ -319,27 +149,29 @@ int eRAL_initialize(void){
|
||||
|
||||
g_enb_ral_fd2instance = hashtable_create (32, NULL, hash_free_int_func);
|
||||
|
||||
for (instance = 0; instance < oai_emulation.info.nb_enb_local; instance++) {
|
||||
for (mod_id = 0; mod_id < oai_emulation.info.nb_enb_local; mod_id++) {
|
||||
char_tmp = calloc(1, strlen(g_conf_enb_ral_listening_port) + 3); // 2 digits + \0 ->99 instances
|
||||
sprintf(char_tmp,"%d", atoi(g_conf_enb_ral_listening_port) + instance);
|
||||
g_enb_ral_obj[instance].ral_listening_port = char_tmp;
|
||||
instance = mod_id;
|
||||
|
||||
sprintf(char_tmp,"%d", atoi(g_conf_enb_ral_listening_port) + mod_id);
|
||||
g_enb_ral_obj[mod_id].ral_listening_port = char_tmp;
|
||||
|
||||
g_enb_ral_obj[instance].ral_ip_address = strdup(g_conf_enb_ral_ip_address);
|
||||
g_enb_ral_obj[instance].ral_link_address = strdup(g_conf_enb_ral_link_address);
|
||||
g_enb_ral_obj[mod_id].ral_ip_address = strdup(g_conf_enb_ral_ip_address);
|
||||
g_enb_ral_obj[mod_id].ral_link_address = strdup(g_conf_enb_ral_link_address);
|
||||
|
||||
char_tmp = calloc(1, strlen(g_conf_enb_mihf_remote_port) + 3); // 2 digits + \0 ->99 instances
|
||||
sprintf(char_tmp, "%d", atoi(g_conf_enb_mihf_remote_port) + instance);
|
||||
g_enb_ral_obj[instance].mihf_remote_port = char_tmp;
|
||||
g_enb_ral_obj[mod_id].mihf_remote_port = char_tmp;
|
||||
|
||||
g_enb_ral_obj[instance].mihf_ip_address = strdup(g_conf_enb_mihf_ip_address);
|
||||
g_enb_ral_obj[mod_id].mihf_ip_address = strdup(g_conf_enb_mihf_ip_address);
|
||||
|
||||
char_tmp = calloc(1, strlen(g_conf_enb_mihf_id) + 3); // 2 digits + \0 ->99 instances
|
||||
sprintf(char_tmp, "%s%02d",g_conf_enb_mihf_id, instance);
|
||||
g_enb_ral_obj[instance].mihf_id = char_tmp;
|
||||
g_enb_ral_obj[mod_id].mihf_id = char_tmp;
|
||||
|
||||
char_tmp = calloc(1, strlen(g_conf_enb_ral_link_id) + 3); // 2 digits + \0 ->99 instances
|
||||
sprintf(char_tmp, "%s%02d",g_conf_enb_ral_link_id, instance);
|
||||
g_enb_ral_obj[instance].link_id = char_tmp;
|
||||
sprintf(char_tmp, "%s%02d",g_conf_enb_ral_link_id, mod_id);
|
||||
g_enb_ral_obj[mod_id].link_id = char_tmp;
|
||||
char_tmp = NULL;
|
||||
|
||||
// excluded MIH_C_LINK_AC_TYPE_NONE
|
||||
@@ -347,7 +179,7 @@ int eRAL_initialize(void){
|
||||
// excluded MIH_C_LINK_AC_TYPE_LINK_LOW_POWER
|
||||
// excluded MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN
|
||||
// excluded MIH_C_LINK_AC_TYPE_LINK_POWER_UP
|
||||
g_enb_ral_obj[instance].mih_supported_link_action_list = (1 << MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR) |
|
||||
g_enb_ral_obj[mod_id].mih_supported_link_action_list = (1 << MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR) |
|
||||
(1 << MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES) |
|
||||
(1 << MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES);
|
||||
// excluded MIH_C_BIT_LINK_DETECTED
|
||||
@@ -355,105 +187,32 @@ int eRAL_initialize(void){
|
||||
// excluded MIH_C_BIT_LINK_HANDOVER_IMMINENT
|
||||
// excluded MIH_C_BIT_LINK_HANDOVER_COMPLETE
|
||||
// excluded MIH_C_BIT_LINK_PDU_TRANSMIT_STATUS
|
||||
g_enb_ral_obj[instance].mih_supported_link_event_list = MIH_C_BIT_LINK_UP | MIH_C_BIT_LINK_DOWN | MIH_C_BIT_LINK_PARAMETERS_REPORT;
|
||||
g_enb_ral_obj[mod_id].mih_supported_link_event_list = MIH_C_BIT_LINK_UP | MIH_C_BIT_LINK_DOWN | MIH_C_BIT_LINK_PARAMETERS_REPORT;
|
||||
// excluded MIH_C_BIT_LINK_GET_PARAMETERS
|
||||
// excluded MIH_C_BIT_LINK_CONFIGURE_THRESHOLDS
|
||||
g_enb_ral_obj[instance].mih_supported_link_command_list = MIH_C_BIT_LINK_EVENT_SUBSCRIBE | MIH_C_BIT_LINK_CONFIGURE_THRESHOLDS |
|
||||
g_enb_ral_obj[mod_id].mih_supported_link_command_list = MIH_C_BIT_LINK_EVENT_SUBSCRIBE | MIH_C_BIT_LINK_CONFIGURE_THRESHOLDS |
|
||||
MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE |
|
||||
MIH_C_BIT_LINK_ACTION;
|
||||
|
||||
g_enb_ral_obj[instance].link_mihcap_flag = MIH_C_BIT_EVENT_SERVICE_SUPPORTED | MIH_C_BIT_COMMAND_SERVICE_SUPPORTED | MIH_C_BIT_INFORMATION_SERVICE_SUPPORTED;
|
||||
g_enb_ral_obj[mod_id].link_mihcap_flag = MIH_C_BIT_EVENT_SERVICE_SUPPORTED | MIH_C_BIT_COMMAND_SERVICE_SUPPORTED | MIH_C_BIT_INFORMATION_SERVICE_SUPPORTED;
|
||||
|
||||
g_enb_ral_obj[instance].net_caps = MIH_C_BIT_NET_CAPS_QOS_CLASS5 | MIH_C_BIT_NET_CAPS_INTERNET_ACCESS | MIH_C_BIT_NET_CAPS_MIH_CAPABILITY;
|
||||
g_enb_ral_obj[mod_id].net_caps = MIH_C_BIT_NET_CAPS_QOS_CLASS5 | MIH_C_BIT_NET_CAPS_INTERNET_ACCESS | MIH_C_BIT_NET_CAPS_MIH_CAPABILITY;
|
||||
|
||||
|
||||
g_enb_ral_obj[instance].transaction_id = (MIH_C_TRANSACTION_ID_T)rand();
|
||||
|
||||
//LOG_N(RAL_ENB, "[MSC_NEW][%s][MIH-F=%s]\n", getTimeStamp4Log(), g_mihf_id);
|
||||
//LOG_N(RAL_ENB, "[MSC_NEW][%s][RAL=%s]\n", getTimeStamp4Log(), g_link_id);
|
||||
//LOG_N(RAL_ENB, "[MSC_NEW][%s][NAS=%s]\n", getTimeStamp4Log(), "nas");
|
||||
g_enb_ral_obj[mod_id].transaction_id = (MIH_C_TRANSACTION_ID_T)rand();
|
||||
|
||||
|
||||
g_enb_ral_obj[instance].ue_htbl = hashtable_create(32, NULL, NULL);
|
||||
g_enb_ral_obj[mod_id].ue_htbl = hashtable_create(32, NULL, NULL);
|
||||
|
||||
LOG_D(RAL_ENB, " Connect to the MIH-F for instance %d...\n", instance);
|
||||
g_enb_ral_obj[instance].mih_sock_desc = -1;
|
||||
if (eRAL_mihf_connect(instance) < 0 ) {
|
||||
LOG_E(RAL_ENB, " %s : Could not connect to MIH-F...\n", __FUNCTION__);
|
||||
// TO DO RETRY LATER
|
||||
//exit(-1);
|
||||
} else {
|
||||
itti_subscribe_event_fd(TASK_RAL_ENB, g_enb_ral_obj[instance].mih_sock_desc);
|
||||
hashtable_insert(g_enb_ral_fd2instance, g_enb_ral_obj[instance].mih_sock_desc, (void*)instance);
|
||||
}
|
||||
LOG_D(RAL_ENB, " Connect to the MIH-F for module id instance %d...\n", mod_id, instance);
|
||||
g_enb_ral_obj[mod_id].mih_sock_desc = -1;
|
||||
AssertFatal(eRAL_mihf_connect(instance) >= 0, " %s : Could not connect to MIH-F...\n", __FUNCTION__);
|
||||
itti_subscribe_event_fd(TASK_RAL_ENB, g_enb_ral_obj[mod_id].mih_sock_desc);
|
||||
hashtable_insert(g_enb_ral_fd2instance, g_enb_ral_obj[mod_id].mih_sock_desc, (void*)instance);
|
||||
|
||||
eRAL_send_link_register_indication(instance, &g_enb_ral_obj[mod_id].transaction_id);
|
||||
g_enb_ral_obj[mod_id].transaction_id += 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*Initialize the NAS driver communication channel
|
||||
*/
|
||||
#ifdef RAL_REALTIME
|
||||
//LG IAL_NAS_ioctl_init();
|
||||
#endif
|
||||
#ifdef RAL_DUMMY
|
||||
//LG NAS_Netlink_socket_init();
|
||||
//LG LOG_D(RAL_ENB, " Waiting for a connection from the NAS Driver ...\n");
|
||||
//LG t = sizeof(nas_socket);
|
||||
//LG if ((g_sockd_nas = accept(netl_s, (struct sockaddr *)&nas_socket, &t)) == -1) {
|
||||
//LG perror("RAL_initialize : g_sockd_nas - accept() failed");
|
||||
//LG exit(1);
|
||||
//LG }
|
||||
#endif
|
||||
LOG_D(RAL_ENB, "NAS Driver Connected.\n\n");
|
||||
|
||||
/* Start listening to user commands for triggers*/
|
||||
#ifdef MUSER_CONTROL
|
||||
//LG lteRALenb_trigger_connect();
|
||||
#endif
|
||||
|
||||
|
||||
/*Get the interface IPv6 address
|
||||
*/
|
||||
#ifdef RAL_DUMMY
|
||||
//LG get_IPv6_addr("eth0");
|
||||
#else
|
||||
#ifdef RAL_REALTIME
|
||||
//LG get_IPv6_addr("oai0");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Get list of MTs
|
||||
//LG LOG_D(RAL_ENB, "Obtaining list of MTs\n\n");
|
||||
#ifdef RAL_REALTIME
|
||||
//init_flag=1;
|
||||
//LG RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_LIST,0,0);
|
||||
//LG RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_LIST,0,0);
|
||||
//init_flag=0;
|
||||
#endif
|
||||
#ifdef RAL_DUMMY
|
||||
//LG eRALlte_NAS_get_MTs_list();
|
||||
#endif
|
||||
// RAL_printInitStatus(0);
|
||||
// g_enb_ral_obj[instanceP].pending_req_flag = 0;
|
||||
// //
|
||||
// g_enb_ral_obj[instanceP].pending_mt_timer = -1;
|
||||
// g_enb_ral_obj[instanceP].pending_mt_flag = 0;
|
||||
// //
|
||||
// LOG_D(RAL_ENB, " List of MTs initialized\n\n");
|
||||
|
||||
// // Initialize measures for demo3
|
||||
// g_enb_ral_obj[instanceP].meas_polling_interval = RAL_DEFAULT_MEAS_POLLING_INTERVAL;
|
||||
// g_enb_ral_obj[instanceP].meas_polling_counter = 1;
|
||||
|
||||
// g_enb_ral_obj[instanceP].congestion_flag = RAL_FALSE;
|
||||
// g_enb_ral_obj[instanceP].measures_triggered_flag = RAL_FALSE;
|
||||
// g_enb_ral_obj[instanceP].congestion_threshold = RAL_DEFAULT_CONGESTION_THRESHOLD;
|
||||
// transaction_id = (MIH_C_TRANSACTION_ID_T)0;
|
||||
|
||||
// eRALlte_send_link_register_indication(&transaction_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -554,83 +313,3 @@ void* eRAL_task(void *args_p) {
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/****************** E X P O R T E D F U N C T I O N S ******************/
|
||||
/****************************************************************************/
|
||||
/*int main(int argc, const char *argv[]){
|
||||
//-----------------------------------------------------------------------------
|
||||
int rc, done;
|
||||
fd_set readfds;
|
||||
struct timeval tv;
|
||||
int time_counter = 1;
|
||||
|
||||
RAL_initialize(argc, argv);
|
||||
|
||||
g_enb_ral_obj[instanceP].pending_mt_timer = 0;
|
||||
|
||||
done = 0;
|
||||
do {
|
||||
// Initialize fd_set and wait for input
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(g_sockd_mihf, &readfds);
|
||||
#ifdef RAL_DUMMY
|
||||
FD_SET(g_sockd_nas, &readfds);
|
||||
#endif
|
||||
#ifdef MUSER_CONTROL
|
||||
FD_SET (g_sockd_user, &readfds);
|
||||
#endif
|
||||
tv.tv_sec = MIH_C_RADIO_POLLING_INTERVAL_SECONDS;
|
||||
tv.tv_usec = MIH_C_RADIO_POLLING_INTERVAL_MICRO_SECONDS;
|
||||
|
||||
rc = select(FD_SETSIZE, &readfds, NULL, NULL, &tv);
|
||||
if (rc < 0) {
|
||||
perror("main : select() failed");
|
||||
done = 1;
|
||||
}
|
||||
// Something is ready for being read
|
||||
else if (rc >= 0){
|
||||
// Read data coming from the MIH Function
|
||||
if (FD_ISSET(g_sockd_mihf, &readfds)) {
|
||||
done = eRALlte_mih_link_process_message();
|
||||
}
|
||||
#ifdef RAL_DUMMY
|
||||
// Read data coming from the NAS driver
|
||||
if (FD_ISSET(g_sockd_nas, &readfds)) {
|
||||
//printf("Received something from NAS\n");
|
||||
done = eRALlte_NAS_process_message();
|
||||
}
|
||||
#endif
|
||||
#ifdef MUSER_CONTROL
|
||||
// Get triggers
|
||||
if (FD_ISSET(g_sockd_user,&readfds)){
|
||||
done = lteRALenb_trigger_receive(g_sockd_user);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Wait until next pending MT's timer expiration
|
||||
if (g_enb_ral_obj[instanceP].pending_mt_timer > 0) {
|
||||
g_enb_ral_obj[instanceP].pending_mt_timer --;
|
||||
eRALlte_process_verify_pending_mt_status();
|
||||
}
|
||||
|
||||
if (time_counter ++ == 11){
|
||||
// check if a new MT appeared or disappeared
|
||||
#ifdef RAL_REALTIME
|
||||
RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_LIST,0,0);
|
||||
#endif
|
||||
time_counter = 1;
|
||||
}
|
||||
//get measures from NAS - timer = 21x100ms -- impair
|
||||
if (g_enb_ral_obj[instanceP].meas_polling_counter ++ == g_enb_ral_obj[instanceP].meas_polling_interval){
|
||||
RAL_NAS_measures_polling();
|
||||
g_enb_ral_obj[instanceP].meas_polling_counter =1;
|
||||
}
|
||||
|
||||
}
|
||||
} while (!done);
|
||||
|
||||
close(g_sockd_mihf);
|
||||
MIH_C_exit();
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Eurecom OpenAirInterface 3
|
||||
* Copyright(c) 2012 Eurecom
|
||||
*
|
||||
* Source eRAL_subscribe.c
|
||||
* Source lteRALenb_subscribe.c
|
||||
*
|
||||
* Version 0.1
|
||||
*
|
||||
@@ -27,18 +27,18 @@
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
** Name: eRAL_subscribe_request() **
|
||||
** Name: eRAL_subscribe_request() **
|
||||
** **
|
||||
** Description: Subscribes the MIH-F to receive specified link event **
|
||||
** indications and sends Link Event Subscribe confirmation **
|
||||
** to the MIH-F. **
|
||||
** indications and sends Link Event Subscribe confirmation **
|
||||
** to the MIH-F. **
|
||||
** **
|
||||
** Inputs: msgP: Pointer to the received MIH message **
|
||||
** Others: None **
|
||||
** Inputs: msgP: Pointer to the received MIH message **
|
||||
** Others: None **
|
||||
** **
|
||||
** Outputs: None **
|
||||
** Return: None **
|
||||
** Others: ralpriv **
|
||||
** Outputs: None **
|
||||
** Return: None **
|
||||
** Others: ralpriv **
|
||||
** **
|
||||
***************************************************************************/
|
||||
void eRAL_subscribe_request(ral_enb_instance_t instanceP, MIH_C_Message_Link_Event_Subscribe_request_t* msgP)
|
||||
@@ -69,18 +69,18 @@ void eRAL_subscribe_request(ral_enb_instance_t instanceP, MIH_C_Message_Link_Eve
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
** Name: eRAL_unsubscribe_request() **
|
||||
** Name: eRAL_unsubscribe_request() **
|
||||
** **
|
||||
** Description: Unsubscribes the MIH-F to receive specified link event **
|
||||
** indications and sends Link Event Unsubscribe confirmation **
|
||||
** to the MIH-F. **
|
||||
** indications and sends Link Event Unsubscribe confirmation **
|
||||
** to the MIH-F. **
|
||||
** **
|
||||
** Inputs: msgP: Pointer to the received MIH message **
|
||||
** Others: None **
|
||||
** Inputs: msgP: Pointer to the received MIH message **
|
||||
** Others: None **
|
||||
** **
|
||||
** Outputs: None **
|
||||
** Return: None **
|
||||
** Others: ralpriv **
|
||||
** Outputs: None **
|
||||
** Return: None **
|
||||
** Others: ralpriv **
|
||||
** **
|
||||
***************************************************************************/
|
||||
void eRAL_unsubscribe_request(ral_enb_instance_t instanceP, MIH_C_Message_Link_Event_Unsubscribe_request_t* msgP)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
** Name: eRAL_configure_thresholds_request() **
|
||||
** Name: eRAL_configure_thresholds_request() **
|
||||
** **
|
||||
** Description: Forwards the Link_Configure_Thresholds.request message **
|
||||
** to the RRC layer. **
|
||||
|
||||
@@ -135,6 +135,9 @@ endif
|
||||
ifeq ($(RLC_STOP_ON_LOST_PDU), 1)
|
||||
CFLAGS += -DRLC_STOP_ON_LOST_PDU
|
||||
endif
|
||||
ifeq ($(STOP_ON_IP_TRAFFIC_OVERLOAD), 1)
|
||||
CFLAGS += -DSTOP_ON_IP_TRAFFIC_OVERLOAD
|
||||
endif
|
||||
|
||||
ifeq ($(ENABLE_RAL), 1)
|
||||
CFLAGS += -DENABLE_RAL
|
||||
|
||||
+576
-568
File diff suppressed because it is too large
Load Diff
@@ -40,7 +40,7 @@ int ulsch_abstraction(double* sinr_dB,u8 TM, u8 mcs,u16 nb_rb, u16 first_rb);
|
||||
|
||||
void calc_path_loss(node_desc_t* node_tx, node_desc_t* node_rx, channel_desc_t *ch_desc, Environment_System_Config env_desc, double **SF);
|
||||
|
||||
void do_OFDM_mod(mod_sym_t **txdataF, s32 **txdata, uint32_t frame, u16 next_slot, LTE_DL_FRAME_PARMS *frame_parms);
|
||||
void do_OFDM_mod(mod_sym_t **txdataF, s32 **txdata, frame_t frame, u16 next_slot, LTE_DL_FRAME_PARMS *frame_parms);
|
||||
|
||||
#ifdef OPENAIR2
|
||||
int omv_write (int pfd, Node_list enb_node_list, Node_list ue_node_list, Data_Flow_Unit omv_data);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,9 +30,9 @@ void update_omg_ocm();
|
||||
|
||||
void update_ocm();
|
||||
|
||||
void update_otg_eNB(int module_id, unsigned int ctime);
|
||||
void update_otg_eNB(module_id_t module_idP, unsigned int ctime);
|
||||
|
||||
void update_otg_UE(int module_id, unsigned int ctime);
|
||||
void update_otg_UE(module_id_t module_idP, unsigned int ctime);
|
||||
|
||||
void exit_fun(const char* s);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user