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

abstraction mode is OK

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5092 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent cdabfe0a
......@@ -154,9 +154,9 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, u8 eNB_id) {
#endif
#ifdef DEBUG_PHY
if ((mac_xface->frame%100==0) || (mac_xface->frame < 10))
msg("[PHY][ADJUST_GAIN] frame %d, clear = %d, rx_power = %d, rx_power_fil = %d, rx_power_fil_dB = %d, coef=%d, ncoef=%d, rx_total_gain_dB = %d (%d,%d,%d)\n",
mac_xface->frame,clear,rx_power,rx_power_fil,rx_power_fil_dB,coef,ncoef,phy_vars_ue->rx_total_gain_dB,
if ((phy_vars_ue->frame%100==0) || (phy_vars_ue->frame < 10))
msg("[PHY][ADJUST_GAIN] frame %d, rx_power = %d, rx_power_fil = %d, rx_power_fil_dB = %d, coef=%d, ncoef=%d, rx_total_gain_dB = %d (%d,%d,%d)\n",
phy_vars_ue->frame,rx_power,rx_power_fil,rx_power_fil_dB,coef,ncoef,phy_vars_ue->rx_total_gain_dB,
TARGET_RX_POWER,MAX_RF_GAIN,MIN_RF_GAIN);
#endif //DEBUG_PHY
......
......@@ -69,11 +69,11 @@
#define MAX_NUM_CHANNEL_BITS (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE
#define MAX_NUM_RE (14*1200)
#define SI_RNTI 0xffff
#define M_RNTI 0xfffd
#define P_RNTI 0xfffe
#define CBA_RNTI 0xfff4
#define C_RNTI 0x1234
#define SI_RNTI (rnti_t)0xffff
#define M_RNTI (rnti_t)0xfffd
#define P_RNTI (rnti_t)0xfffe
#define CBA_RNTI (rnti_t)0xfff4
#define C_RNTI (rnti_t)0x1234
#define PMI_2A_11 0
#define PMI_2A_1m1 1
......@@ -677,9 +677,9 @@ typedef struct {
/// Position of first CCE of the dci
unsigned int nCCE;
/// flag to indicate that this is a RA response
uint8_t ra_flag;
boolean_t ra_flag;
/// rnti
uint16_t rnti;
rnti_t rnti;
/// Format
DCI_format_t format;
/// DCI pdu
......
......@@ -261,7 +261,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
unsigned int success=0;
u8 eNB,UE_id,i,j,number_of_cards=1;
u8 eNB,UE_id,i,j,number_of_cards_l=1;
u32 ulsch_errors=0;
u32 ulsch_round_attempts[4]={0,0,0,0},ulsch_round_errors[4]={0,0,0,0};
u32 harq_pid_ul, harq_pid_dl;
......@@ -277,9 +277,9 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
phy_vars_eNB->total_system_throughput = 0;//phy_vars_eNB->eNB_UE_stats[UE_id].total_transmitted_bits + phy_vars_eNB->total_system_throughput;
// }
for (eNB=0;eNB<number_of_cards;eNB++) {
for (eNB=0;eNB<number_of_cards_l;eNB++) {
len += sprintf(&buffer[len],"[eNB PROC] eNB %d/%d Frame %d: RX Gain %d dB, I0 %d dBm (%d,%d) dB \n",
eNB,number_of_cards,
eNB,number_of_cards_l,
phy_vars_eNB->frame,
phy_vars_eNB->rx_total_gain_eNB_dB,
phy_vars_eNB->PHY_measurements_eNB[eNB].n0_power_tot_dBm,
......
This diff is collapsed.
......@@ -67,47 +67,6 @@
#define CH_OFFSET 0x0004
#define CH_SHIFT 2
#ifdef MESH
//# define MAX_RB_MOBILE NB_RB_MAX * ( MAX_MANAGED_RG_PER_MOBILE + MAX_MOBILES_PER_RG - 1 )
//# define MAX_RAB_MOBILE NB_RAB_MAX * ( MAX_MANAGED_RG_PER_MOBILE + MAX_MOBILES_PER_RG - 1 )
//# define MAX_RB_RG MAX_RB_MOBILE //NB_RB_MAX * MAX_MOBILES_PER_RG
//# define MAX_RAB_RG (NB_RB_MAX+1) * (MAX_MOBILES_PER_RG + 1)
//# define MAX_RAB MAX_RAB_RG
//# define MAX_RB MAX_RB_RG
#else
//# define MAX_RB_MOBILE NB_RB_MAX * MAX_MANAGED_RG_PER_MOBILE
//# define MAX_RAB_MOBILE NB_RAB_MAX * MAX_MANAGED_RG_PER_MOBILE
//# define MAX_RB_RG NB_RB_MAX * MAX_MOBILES_PER_RG
//# define MAX_RAB_RG NB_RB_MAX * MAX_MOBILES_PER_RG
//# ifdef NODE_RG
//# define MAX_RAB MAX_RAB_RG
//# define MAX_RB MAX_RB_RG
//# else
//# // ifdef NODE_MT
//# // define MAX_RAB MAX_RAB_MOBILE
//# // define MAX_RB MAX_RB_MOBILE
//# //else
//# //error NODE_RG or NODE_MT must be defined
//# //endif
//# endif
#endif //MESH
// RLC_MODE
# define RLC_NONE (rlc_mode_t)0
# define RLC_MODE_AM (rlc_mode_t)1
# define RLC_MODE_TM (rlc_mode_t)2
# define RLC_MODE_UM (rlc_mode_t)3
//E_R
# define E_R_RLC_ER_RELEASE 1
# define E_R_RLC_ER_MODIFICATION 2
# define E_R_RLC_ER_RE_ESTABLISHMENT 4
# define E_R_RLC_ER_STOP 8
# define E_R_RLC_ER_CONTINUE 16
# define E_R_RLC_ER_NONE 0
// RLC_AM_SEND_MRW
# define SEND_MRW_OFF 15
# define SEND_MRW_ON 240
......@@ -134,7 +93,8 @@
# endif
# endif
#define UNUSED_PARAM_MBMS_SESSION_ID 0
#define UNUSED_PARAM_MBMS_SERVICE_ID 0
#ifdef USER_MODE
#define printk printf
......
......@@ -32,18 +32,20 @@ typedef unsigned int tb_size_t;
typedef u16_t rb_id_t;
typedef u16_t srb_id_t;
typedef u32_t frame_t;
typedef s32_t sframe_t;
typedef u32_t sub_frame_t;
typedef u8_t module_id_t;
typedef s8_t smodule_id_t;
typedef unsigned int mui_t;
typedef unsigned int confirm_t;
typedef unsigned int rb_type_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 u16_t pdcp_sn_t;
typedef u32_t pdcp_hfn_t;
typedef int traffic_type_t;
typedef u32_t mbms_session_id_t;
typedef u16_t mbms_service_id_t;
......@@ -56,6 +58,25 @@ typedef unsigned short crc16_t;
typedef unsigned int crc32_t;
typedef signed char boolean_t;
#if !defined(TRUE)
#define TRUE (boolean_t)0x01
#endif
#if !defined(FALSE)
#define FALSE (boolean_t)0x00
#endif
typedef enum link_direction_e {
UNKNOWN_DIR = 0,
DIR_UPLINK = 1,
DIR_DOWNLINK = 2
} link_direction_t;
typedef enum rb_type_e {
UNKNOWN_RADIO_BEARER = 0,
SIGNALLING_RADIO_BEARER = 1,
RADIO_ACCESS_BEARER = 2
} rb_type_t;
typedef enum MBMS_flag_e {
MBMS_FLAG_NO = 0,
......
......@@ -29,11 +29,6 @@
# define ACTION_MBMS_ADD 10
# define ACTION_MBMS_MODIFY 11
# define UPLINK 1
# define DOWNLINK 2
# define SIGNALLING_RADIO_BEARER 1
# define RADIO_ACCESS_BEARER 2
# define MOBILE 7
// equipment type
......
......@@ -203,7 +203,6 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
char* enb_ipv4_address_for_S1U = NULL;
char* enb_interface_name_for_S1_MME = NULL;
char* enb_ipv4_address_for_S1_MME = NULL;
char *astring = NULL;
char *address = NULL;
char *cidr = NULL;
......
......@@ -472,7 +472,7 @@ typedef struct{
/// NDI from last UL scheduling
uint8_t oldNDI_UL[8];
/// Flag to indicate UL has been scheduled at least once
int ul_active;
boolean_t ul_active;
// PHY interface info
......@@ -536,7 +536,7 @@ typedef struct{
typedef struct {
/// Flag to indicate this process is active
u8 RA_active;
boolean_t RA_active;
/// Size of DCI for RA-Response (bytes)
u8 RA_dci_size_bytes1;
/// Size of DCI for RA-Response (bits)
......@@ -1129,9 +1129,9 @@ void init_ue_sched_info(void);
void add_ue_ulsch_info (module_id_t module_idP, module_id_t ue_mod_idP, sub_frame_t subframe,UE_ULSCH_STATUS status);
void add_ue_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);
rnti_t find_UE_RNTI (module_id_t module_idP, module_id_t ue_mod_idP);
u8 find_active_UEs (module_id_t module_idP);
u8 is_UE_active (module_id_t module_idP, module_id_t ue_mod_idP );
boolean_t is_UE_active (module_id_t module_idP, module_id_t ue_mod_idP );
u8 find_ulgranted_UEs(module_id_t module_idP);
u8 find_dlgranted_UEs(module_id_t module_idP);
u8 process_ue_cqi (module_id_t module_idP, module_id_t ue_mod_idP);
......@@ -1343,13 +1343,13 @@ BSR_SHORT *get_bsr_short(module_id_t module_idP, u8 bsr_len);
*/
BSR_LONG * get_bsr_long(module_id_t module_idP, u8 bsr_len);
/*! \fn int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid)
/*! \fn boolean_t update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid)
\brief get the rlc stats and update the bsr level for each lcid
\param[in] Mod_id instance of the UE
\param[in] frame Frame index
\param[in] lcid logical channel identifier
*/
int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcgid);
boolean_t update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcgid);
/*! \fn locate (int *table, int size, int value)
\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.
......
This diff is collapsed.
......@@ -54,6 +54,7 @@
#include "defs.h"
#include "extern.h"
#include "assertions.h"
#include "PHY_INTERFACE/extern.h"
#include "PHY_INTERFACE/defs.h"
#include "PHY/defs.h"
......@@ -68,11 +69,6 @@
#include "SCHED/defs.h"
//#ifdef BIGPHYSAREA
//extern void *bigphys_malloc(int);
//#endif
/***********************************************************************/
void dl_phy_sync_success(module_id_t module_idP,
frame_t frameP,
......
......@@ -106,7 +106,7 @@ void store_dlsch_buffer (module_id_t Mod_id,
for(i=0;i< MAX_NUM_LCID; i++){ // loop over all the logical channels
rlc_status = mac_rlc_status_ind(Mod_id,next_ue, frameP,1,RLC_MBMS_NO,i,0 );
rlc_status = mac_rlc_status_ind(Mod_id,next_ue, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,i,0 );
eNB_mac_inst[Mod_id].UE_template[next_ue].dl_buffer_info[i] = rlc_status.bytes_in_buffer; //storing the dlsch buffer for each logical channel
eNB_mac_inst[Mod_id].UE_template[next_ue].dl_pdus_in_buffer[i] = rlc_status.pdus_in_buffer;
eNB_mac_inst[Mod_id].UE_template[next_ue].dl_buffer_head_sdu_creation_time[i] = rlc_status.head_sdu_creation_time ;
......
......@@ -296,7 +296,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_ind
else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DCCH] > 0) {
// 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,
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH,
6);
if (UE_mac_inst[module_idP].crnti_before_ho)
......@@ -306,7 +306,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_ind
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,
sdu_lengths[0] = mac_rlc_data_req(eNB_indexP, module_idP,frameP,ENB_FLAG_NO, MBMS_FLAG_NO,
DCCH,
(char *)&ulsch_buff[0]);
......@@ -355,7 +355,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_ind
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;
frame_diff = (sframe_t)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));
......
......@@ -367,8 +367,8 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eN
mac_rlc_data_ind(eNB_index,
module_idP,
frameP,
0,
RLC_MBMS_NO,
ENB_FLAG_NO,
MBMS_FLAG_NO,
DCCH,
(char *)payload_ptr,
rx_lengths[i],
......@@ -380,8 +380,8 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eN
mac_rlc_data_ind(eNB_index,
module_idP,
frameP,
0,
RLC_MBMS_NO,
ENB_FLAG_NO,
MBMS_FLAG_NO,
DCCH1,
(char *)payload_ptr,
rx_lengths[i],
......@@ -401,8 +401,8 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eN
mac_rlc_data_ind(eNB_index,
module_idP,
frameP,
0,
RLC_MBMS_NO,
ENB_FLAG_NO,
MBMS_FLAG_NO,
DTCH,
(char *)payload_ptr,
rx_lengths[i],
......@@ -517,8 +517,8 @@ void ue_send_mch_sdu(module_id_t module_idP, frame_t frameP, u8 *sdu, u16 sdu_le
0,
module_idP,
frameP,
0,
RLC_MBMS_YES,
ENB_FLAG_NO,
MBMS_FLAG_YES,
MTCH + (maxDRB + 3),
(char *)payload_ptr,
rx_lengths[i],
......@@ -1080,14 +1080,14 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] == LCID_NOT_EMPTY) {
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO,
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH,
(buflen-dcch_header_len-bsr_len-phr_len));
LOG_D(MAC, "[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to "
"send (Transport Block size %d, mac header len %d)\n",
module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dcch_header_len);
sdu_lengths[0] += mac_rlc_data_req(0, module_idP,frameP,0, RLC_MBMS_NO,
sdu_lengths[0] += mac_rlc_data_req(0, module_idP,frameP,ENB_FLAG_NO, MBMS_FLAG_NO,
DCCH,
(char *)&ulsch_buff[sdu_lengths[0]]);
......@@ -1106,7 +1106,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
// DCCH1
if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] == LCID_NOT_EMPTY) {
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO,
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH1,
(buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-sdu_length_total));
......@@ -1114,7 +1114,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
" send (Transport Block size %d, mac header len %d)\n",
module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dcch1_header_len);
sdu_lengths[num_sdus] = mac_rlc_data_req(0, module_idP,frameP,0,RLC_MBMS_NO,
sdu_lengths[num_sdus] = mac_rlc_data_req(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH1,
(char *)&ulsch_buff[sdu_lengths[0]]);
sdu_length_total += sdu_lengths[num_sdus];
......@@ -1140,7 +1140,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
else
dtch_header_len = 2;//sizeof(SCH_SUBHEADER_SHORT);
*/
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO,
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DTCH,
buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total);
......@@ -1148,7 +1148,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dtch_header_len,
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH]);
sdu_lengths[num_sdus] = mac_rlc_data_req(0, module_idP,frameP, 0, RLC_MBMS_NO,
sdu_lengths[num_sdus] = mac_rlc_data_req(0, module_idP,frameP, ENB_FLAG_NO, MBMS_FLAG_NO,
DTCH,
(char *)&ulsch_buff[sdu_length_total]);
......@@ -1586,10 +1586,10 @@ u8 get_bsr_len (module_id_t module_idP, u16 buflen) {
}
int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcg_id){
boolean_t update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcg_id){
mac_rlc_status_resp_t rlc_status;
u8 sr_pending = 0;
boolean_t sr_pending = FALSE;
if ((lcg_id < 0) || (lcg_id > MAX_NUM_LCGID) )
return sr_pending;
// fixme: need a better way to reset
......@@ -1599,11 +1599,11 @@ int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcg_id){
}
// for (lcid =0 ; lcid < MAX_NUM_LCID; lcid++) {
if (UE_mac_inst[module_idP].scheduling_info.LCGID[lcid] == lcg_id) {
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO,
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
lcid,
0);
if (rlc_status.bytes_in_buffer > 0 ) {
sr_pending = 1;
sr_pending = TRUE;
UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY;
UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] += locate (BSR_TABLE,BSR_TABLE_SIZE, rlc_status.bytes_in_buffer);
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer;
......
This diff is collapsed.
This diff is collapsed.
......@@ -40,7 +40,7 @@
#include "pdcp.h"
#include "pdcp_primitives.h"
extern BOOL util_mark_nth_bit_of_octet(u8_t* octet, u8_t index);
extern boolean_t util_mark_nth_bit_of_octet(u8_t* octet, u8_t index);
/*
* Parses data/control field out of buffer of User Plane PDCP Data PDU with
......@@ -129,7 +129,7 @@ u8 pdcp_get_sequence_number_of_pdu_with_SRB_sn(unsigned char* pdu_buffer)
* @param pdu_buffer PDCP PDU buffer
* @return TRUE on success, FALSE otherwise
*/
BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu_buffer, \
boolean_t pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu_buffer, \
pdcp_control_plane_data_pdu_header* pdu)
{
if (pdu_buffer == NULL || pdu == NULL)
......@@ -150,7 +150,7 @@ BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu
* @param pdu_buffer PDCP PDU buffer
* @return TRUE on success, FALSE otherwise
*/
BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_buffer, \
boolean_t pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_buffer, \
pdcp_user_plane_data_pdu_header_with_long_sn* pdu)
{
if (pdu_buffer == NULL || pdu == NULL)
......@@ -182,7 +182,7 @@ BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_b
* @param pdu A status report header
* @return TRUE on success, FALSE otherwise
*/
BOOL pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
boolean_t pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
u8 bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu)
{
if (pdu_buffer == NULL || pdu == NULL)
......
......@@ -9,12 +9,6 @@
#ifndef PDCP_PRIMITIVES_H
#define PDCP_PRIMITIVES_H
#ifndef TRUE
#define TRUE 0x01
#define FALSE 0x00
typedef unsigned char BOOL;
#endif
/*
* 3GPP TS 36.323 V10.1.0 (2011-03)
*/
......@@ -130,7 +124,7 @@ u8 pdcp_get_sequence_number_of_pdu_with_SRB_sn(unsigned char* pdu_buffer);
* @param pdu_buffer PDCP PDU buffer
* @return TRUE on success, FALSE otherwise
*/
BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu_buffer, \
boolean_t pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu_buffer, \
pdcp_control_plane_data_pdu_header* pdu);
/*
* Fills the incoming buffer with the fields of the header for long SN (RLC UM and AM)
......@@ -138,7 +132,7 @@ BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu
* @param pdu_buffer PDCP PDU buffer
* @return TRUE on success, FALSE otherwise
*/
BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_buffer, \
boolean_t pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_buffer, \
pdcp_user_plane_data_pdu_header_with_long_sn* pdu);
/*
......@@ -150,7 +144,7 @@ BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_b
* @param pdu A status report header
* @return TRUE on success, FALSE otherwise
*/
BOOL pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
boolean_t pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
u8 bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu);
int pdcp_netlink_dequeue_element(module_id_t enb_mod_idP, module_id_t ue_mod_idP, eNB_flag_t eNB_flagP,
......
......@@ -40,9 +40,9 @@
/*
* Initializes sequence numbering state
* @param pdcp_entity The PDCP entity to be initialized
* @return BOOL TRUE on success, FALSE otherwise
* @return boolean_t TRUE on success, FALSE otherwise
*/
BOOL pdcp_init_seq_numbers(pdcp_t* pdcp_entity)
boolean_t pdcp_init_seq_numbers(pdcp_t* pdcp_entity)
{
if (pdcp_entity == NULL)
return FALSE;
......@@ -64,7 +64,7 @@ BOOL pdcp_init_seq_numbers(pdcp_t* pdcp_entity)
return TRUE;
}
BOOL pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity)
boolean_t pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity)
{
if (pdcp_entity == NULL)
return FALSE;
......@@ -81,7 +81,7 @@ BOOL pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity)
/**
* Check if SN number is in the range according to SN size
*/
BOOL pdcp_is_seq_num_valid(u16 seq_num, u8 seq_num_size)
boolean_t pdcp_is_seq_num_valid(u16 seq_num, u8 seq_num_size)
{
if (seq_num >= 0 && seq_num <= pdcp_calculate_max_seq_num_for_given_size(seq_num_size))
return TRUE;
......@@ -121,7 +121,7 @@ u16 pdcp_get_next_tx_seq_number(pdcp_t* pdcp_entity)
return pdcp_seq_num;
}
BOOL pdcp_advance_rx_window(pdcp_t* pdcp_entity)
boolean_t pdcp_advance_rx_window(pdcp_t* pdcp_entity)
{
if (pdcp_is_seq_num_size_valid(pdcp_entity) == FALSE)
return FALSE;
......@@ -146,7 +146,7 @@ BOOL pdcp_advance_rx_window(pdcp_t* pdcp_entity)
* @return 1 if SN is okay, 0 otherwise
* XXX Reordering window should also be handled here
*/
BOOL pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity)
boolean_t pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity)
{
LOG_D(PDCP, "Incoming RX Seq # is %04d\n", seq_num);
......@@ -187,7 +187,7 @@ BOOL pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity)
}
}
BOOL pdcp_mark_current_pdu_as_received(u16 seq_num, pdcp_t* pdcp_entity)
boolean_t pdcp_mark_current_pdu_as_received(u16 seq_num, pdcp_t* pdcp_entity)
{
/*
* Incoming sequence number and PDCP entity were already
......
......@@ -43,17 +43,17 @@
* @param pdcp_entity The PDCP entity to be initialized
* @return none
*/
BOOL pdcp_init_seq_numbers(pdcp_t* pdcp_entity);
boolean_t pdcp_init_seq_numbers(pdcp_t* pdcp_entity);
/**
* Checks if incoming PDCP entitiy pointer and relevant sequence number size is valid
* @return TRUE (0x01) if it is valid, FALSE (0x00) otherwise
*/
BOOL pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity);
boolean_t pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity);
/**
* Check if SN number is in the range according to SN size
* @return TRUE if it is valid, FALSE otherwise
*/
BOOL pdcp_is_seq_num_valid(u16 seq_num, u8 seq_num_size);
boolean_t pdcp_is_seq_num_valid(u16 seq_num, u8 seq_num_size);
/**
* Returns the maximum allowed sequence number value for given size of SN field
* @return Max sequence number value
......@@ -66,16 +66,16 @@ u16 pdcp_get_next_tx_seq_number(pdcp_t* pdcp_entity);
/**
* Advances the RX window state of given PDCP entity upon successfull receipt of a SDU
*/
BOOL pdcp_advance_rx_window(pdcp_t* pdcp_entity);
boolean_t pdcp_advance_rx_window(pdcp_t* pdcp_entity);
/**
* Checks if incoming PDU has a sequence number in accordance with the RX window
* @return TRUE if it is valid, FALSE otherwise
*/
BOOL pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity);
boolean_t pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity);
/**
* Updates missing PDU bitmap with incoming sequence number
* @return TRUE if successful, FALSE otherwise
*/
BOOL pdcp_mark_current_pdu_as_received(u16 seq_num, pdcp_t* pdcp_entity);
boolean_t pdcp_mark_current_pdu_as_received(u16 seq_num, pdcp_t* pdcp_entity);
#endif
......@@ -25,18 +25,18 @@
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*******************************************************************************/
*******************************************************************************/
/*! \file pdcp_thread.c
* \brief
* \author F. Kaltenberger
* \date 2013
* \version 0.1
* \company Eurecom
* \email: florian.kaltenberger@eurecom.fr
* \note
* \warning
*/
* \brief
* \author F. Kaltenberger
* \date 2013
* \version 0.1
* \company Eurecom
* \email: florian.kaltenberger@eurecom.fr
* \note
* \warning
*/
#include <pthread.h>
//#include <inttypes.h>
......@@ -48,112 +48,108 @@
#define OPENAIR_THREAD_STACK_SIZE 8192
#define OPENAIR_THREAD_PRIORITY 255
extern int oai_exit;
extern int oai_exit;
extern char UE_flag;
pthread_t pdcp_thread;
pthread_attr_t pdcp_thread_attr;
pthread_t pdcp_thread;
pthread_attr_t pdcp_thread_attr;
pthread_mutex_t pdcp_mutex;
pthread_cond_t pdcp_cond;
int pdcp_instance_cnt;
pthread_cond_t pdcp_cond;
int pdcp_instance_cnt;
static void *pdcp_thread_main(void* param);
static void *pdcp_thread_main(void* param) {
//u8 eNB_flag = *((u8*)param);
u8 eNB_flag = !UE_flag;
LOG_I(PDCP,"This is pdcp_thread eNB_flag = %d\n",eNB_flag);
while (!oai_exit) {
if (pthread_mutex_lock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error locking mutex.\n");
}
else {
while (pdcp_instance_cnt < 0) {
pthread_cond_wait(&pdcp_cond,&pdcp_mutex);
}
if (pthread_mutex_unlock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error unlocking mutex.\n");
}
}
if (oai_exit) break;
if (eNB_flag) {
pdcp_run(PHY_vars_eNB_g[0]->frame, eNB_flag, PHY_vars_eNB_g[0]->Mod_id, 0);
LOG_D(PDCP,"Calling pdcp_run (eNB) for frame %d\n",PHY_vars_eNB_g[0]->frame);
}
else {
pdcp_run(PHY_vars_UE_g[0]->frame, eNB_flag, 0, PHY_vars_UE_g[0]->Mod_id);
LOG_D(PDCP,"Calling pdcp_run (UE) for frame %d\n",PHY_vars_UE_g[0]->frame);
}
if (pthread_mutex_lock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error locking mutex.\n");
}
else {
pdcp_instance_cnt--;
if (pthread_mutex_unlock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error unlocking mutex.\n");
}
}
if (pthread_mutex_lock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error locking mutex.\n");
}
else {
while (pdcp_instance_cnt < 0) {
pthread_cond_wait(&pdcp_cond,&pdcp_mutex);
}
if (pthread_mutex_unlock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error unlocking mutex.\n");
}
}
if (oai_exit) break;
if (eNB_flag) {
pdcp_run(PHY_vars_eNB_g[0]->frame, eNB_flag, PHY_vars_eNB_g[0]->Mod_id, 0);
LOG_D(PDCP,"Calling pdcp_run (eNB) for frame %d\n",PHY_vars_eNB_g[0]->frame);
}
else {
pdcp_run(PHY_vars_UE_g[0]->frame, eNB_flag, 0, PHY_vars_UE_g[0]->Mod_id);
LOG_D(PDCP,"Calling pdcp_run (UE) for frame %d\n",PHY_vars_UE_g[0]->frame);
}
if (pthread_mutex_lock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error locking mutex.\n");
}
else {
pdcp_instance_cnt--;
if (pthread_mutex_unlock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error unlocking mutex.\n");
}
}
}
return(NULL);
}
int init_pdcp_thread(void) {
int error_code;
struct sched_param p;
int error_code;
struct sched_param p;
pthread_attr_init (&pdcp_thread_attr);
pthread_attr_setstacksize(&pdcp_thread_attr,OPENAIR_THREAD_STACK_SIZE);
//attr_dlsch_threads.priority = 1;
pthread_attr_init (&pdcp_thread_attr);
pthread_attr_setstacksize(&pdcp_thread_attr,OPENAIR_THREAD_STACK_SIZE);
//attr_dlsch_threads.priority = 1;
p.sched_priority = OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&pdcp_thread_attr, &p);
p.sched_priority = OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&pdcp_thread_attr, &p);
#ifndef RTAI_ISNT_POSIX
pthread_attr_setschedpolicy (&pdcp_thread_attr, SCHED_FIFO);
pthread_attr_setschedpolicy (&pdcp_thread_attr, SCHED_FIFO);
#endif
pthread_mutex_init(&pdcp_mutex,NULL);
pthread_cond_init(&pdcp_cond,NULL);
pdcp_instance_cnt = -1;
LOG_I(PDCP,"Allocating PDCP thread\n");
error_code = pthread_create(&pdcp_thread,
&pdcp_thread_attr,
pdcp_thread_main,
(void*)NULL);
if (error_code!= 0) {
pthread_mutex_init(&pdcp_mutex,NULL);
pthread_cond_init(&pdcp_cond,NULL);
pdcp_instance_cnt = -1;
LOG_I(PDCP,"Allocating PDCP thread\n");
error_code = pthread_create(&pdcp_thread,
&pdcp_thread_attr,
pdcp_thread_main,
(void*)NULL);
if (error_code!= 0) {
LOG_I(PDCP,"Could not allocate PDCP thread, error %d\n",error_code);
return(error_code);
}
else {
}
else {
LOG_I(PDCP,"Allocate PDCP thread successful\n");
}
return(0);
}
return(0);
}
void cleanup_pdcp_thread(void) {
void *status;
void *status_p = NULL;
LOG_I(PDCP,"Scheduling PDCP thread to exit\n");
pdcp_instance_cnt = 0;
if (pthread_cond_signal(&pdcp_cond) != 0)
LOG_I(PDCP,"ERROR pthread_cond_signal\n");
else
LOG_I(PDCP,"Signalled PDCP thread to exit\n");
pthread_join(pdcp_thread,&status);
pthread_join(pdcp_thread,&status_p);
LOG_I(PDCP,"PDCP thread exited\n");
pthread_cond_destroy(&pdcp_cond);
pthread_mutex_destroy(&pdcp_mutex);
......
......@@ -131,7 +131,7 @@ void util_print_binary_representation(unsigned char* message, u8_t octet)
* @param index Index of bit to be set
* @return TRUE on success, FALSE otherwise
*/
BOOL util_mark_nth_bit_of_octet(u8_t* octet, u8_t index)
boolean_t util_mark_nth_bit_of_octet(u8_t* octet, u8_t index)
{
u8_t mask = 0x80;
......
......@@ -76,6 +76,6 @@ void util_print_binary_representation(unsigned char* message, u8_t octet);
* @param index Index
* @return TRUE on success, FALSE otherwise
*/
BOOL util_mark_nth_bit_of_octet(u8_t* octet, u8_t index);
boolean_t util_mark_nth_bit_of_octet(u8_t* octet, u8_t index);
#endif // PDCP_UTIL_H
......@@ -125,7 +125,7 @@ void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_fla
rlc_pP->output_sdu_size_to_write,
rlc_pP->output_sdu_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);
rlc_data_ind (rlc_pP->enb_module_id, rlc_pP->ue_module_id, frameP, eNB_flagP, MBMS_FLAG_NO, rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write, rlc_pP->output_sdu_in_construction, rlc_pP->is_data_plane);
#endif
rlc_pP->output_sdu_in_construction = NULL;
} else {
......
......@@ -64,7 +64,7 @@ rlc_tm_send_sdu (rlc_tm_entity_t *rlcP, u32_t frame, u8_t eNB_flag, u8_t error_i
memcpy (&rlcP->output_sdu_in_construction->data[rlcP->output_sdu_size_to_write], srcP, length_in_bytes);
rlc_data_ind (rlcP->enb_module_id, rlcP->ue_module_id, frame, eNB_flag, RLC_MBMS_NO, rlcP->rb_id, length_in_bytes, rlcP->output_sdu_in_construction, rlcP->is_data_plane);
rlc_data_ind (rlcP->enb_module_id, rlcP->ue_module_id, frame, eNB_flag, MBMS_FLAG_NO, rlcP->rb_id, length_in_bytes, rlcP->output_sdu_in_construction, rlcP->is_data_plane);
rlcP->output_sdu_in_construction = NULL;
} else {
msg ("[RLC_TM %p][SEND_SDU] ERROR OUTPUT SDU IS NULL\n", rlcP);
......@@ -182,7 +182,6 @@ rlc_tm_mac_data_indication (void *rlcP, u32_t frame, u8_t eNB_flag, struct mac_d
{
//-----------------------------------------------------------------------------
rlc_tm_entity_t *l_rlc = (rlc_tm_entity_t *) rlcP;
mem_block_t *tb;
if (data_indP.data.nb_elements > 0) {
LOG_D(RLC, "[RLC_TM][%s][MOD %02u/%02u][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n",
......
......@@ -51,12 +51,12 @@ void config_req_rlc_um (frame_t frameP,
rb_type_t rb_typeP)
{
//-----------------------------------------------------------------------------
rlc_um_entity_t *rlc = NULL;
rlc_um_entity_t *rlc_p = NULL;
if (eNB_flagP) {
rlc = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.um;
rlc_p = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.um;
} else {
rlc = &rlc_array_ue[ue_module_idP][rb_idP].rlc.um;
rlc_p = &rlc_array_ue[ue_module_idP][rb_idP].rlc.um;
}
LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ timer_reordering=%d sn_field_length=%d is_mXch=%d --->][RLC_UM][MOD %u/%u][RB %u] \n",
frame,
......@@ -70,10 +70,10 @@ void config_req_rlc_um (frame_t frameP,
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,
rlc_um_init(rlc_p);
if (rlc_um_fsm_notify_event (rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) {
rlc_um_set_debug_infos(rlc_p, frame, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP);
rlc_um_configure(rlc_p,
frame,
config_um_pP->timer_reordering,
config_um_pP->sn_field_length,
......@@ -84,25 +84,38 @@ void config_req_rlc_um (frame_t frameP,
//-----------------------------------------------------------------------------
u32_t t_Reordering_tab[T_Reordering_spare1] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200};
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)
void config_req_rlc_um_asn1 (frame_t frameP,
eNB_flag_t eNB_flagP,
MBMS_flag_t mbms_flagP,
module_id_t enb_module_idP,
module_id_t ue_module_idP,
mbms_session_id_t mbms_session_idP,
mbms_service_id_t mbms_service_idP,
UL_UM_RLC_t *ul_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;
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;
rlc_um_entity_t *rlc_p = NULL;
#if defined(rel10)
if (mbms_flagP) {
if (eNB_flagP) {
rlc_p = &rlc_mbms_array_eNB[enb_module_idP][mbms_service_idP][mbms_session_idP].um;
} else {
rlc_p = &rlc_mbms_array_ue[ue_module_idP][mbms_service_idP][mbms_session_idP].um;
}
}
else
#endif
{
if (eNB_flagP) {
rlc_p = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.um;
} else {
rlc_p = &rlc_array_ue[ue_module_idP][rb_idP].rlc.um;
}
}
//-----------------------------------------------------------------------------
......@@ -116,9 +129,9 @@ void config_req_rlc_um_asn1 (frame_t frameP,
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_init(rlc_p);
if (rlc_um_fsm_notify_event (rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) {
rlc_um_set_debug_infos(rlc_p, 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:
......@@ -130,10 +143,10 @@ void config_req_rlc_um_asn1 (frame_t frameP,
default:
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,
(rlc_p->is_enb) ? "eNB" : "UE",
rlc_p->enb_module_id,
rlc_p->ue_module_id,
rlc_p->rb_id,
ul_rlc_pP->sn_FieldLength);
return;
}
......@@ -150,10 +163,10 @@ void config_req_rlc_um_asn1 (frame_t frameP,
default:
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,
(rlc_p->is_enb) ? "eNB" : "UE",
rlc_p->enb_module_id,
rlc_p->ue_module_id,
rlc_p->rb_id,
dl_rlc_pP->sn_FieldLength);
return;
}
......@@ -162,23 +175,23 @@ void config_req_rlc_um_asn1 (frame_t frameP,
} 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,
(rlc_p->is_enb) ? "eNB" : "UE",
rlc_p->enb_module_id,
rlc_p->ue_module_id,
rlc_p->rb_id,
dl_rlc_pP->t_Reordering);
return;
}
}
if (eNB_flagP > 0) {
rlc_um_configure(rlc,
rlc_um_configure(rlc_p,
frame,
t_Reordering,
ul_sn_FieldLength,
dl_sn_FieldLength,
mbms_flagP);
} else {
rlc_um_configure(rlc,
rlc_um_configure(rlc_p,
frame,
t_Reordering,
dl_sn_FieldLength,
......
......@@ -88,19 +88,41 @@ typedef volatile struct {
*/
public_rlc_um_control_primitives( void config_req_rlc_um (frame_t frame, eNB_flag_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_um_info_t * config_umP, rb_id_t rb_idP, rb_type_t rb_typeP);)
/*! \fn void config_req_rlc_um_asn1 (frame_t frame, eNB_flag_t eNB_flagP, u8_t mbms_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, UL_UM_RLC_t* ul_rlcP, DL_UM_RLC_t* dl_rlcP, rb_id_t rb_idP, rb_type_t rb_typeP)
/*! \fn void config_req_rlc_um_asn1 (frame_t frame,
* eNB_flag_t eNB_flagP,
* MBMS_flag_t mbms_flagP,
* module_id_t enb_module_idP,
* module_id_t ue_module_idP,
* mbms_session_id_t mbms_session_idP,
mbms_service_id_t mbms_service_idP,
UL_UM_RLC_t* ul_rlcP,
DL_UM_RLC_t* dl_rlcP,
rb_id_t rb_idP,
rb_type_t rb_typeP)
* \brief Allocate memory for RLC UM instance, reset protocol variables, and set protocol parameters. After this configuration the RLC UM protocol instance will be in RLC_DATA_TRANSFER_READY_STATE state.
* \param[in] frame Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] frameP Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] mbms_flagP Flag to indicate if this RLC is configured for MBMS.
* \param[in] enb_module_idP eNB Virtualized module identifier.
* \param[in] ue_module_idP UE Virtualized module identifier.
* \param[in] mbms_session_idP MBMS session id.
* \param[in] mbms_service_idP MBMS service id.
* \param[in] ul_rlcP Configuration parameters for RLC UM UL instance.
* \param[in] 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 (frame_t frame, eNB_flag_t eNB_flagP, u8_t mbms_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, UL_UM_RLC_t* ul_rlcP, DL_UM_RLC_t* dl_rlcP, rb_id_t rb_idP, rb_type_t rb_typeP);)
public_rlc_um_control_primitives( void config_req_rlc_um_asn1 (frame_t frameP,
eNB_flag_t eNB_flagP,
MBMS_flag_t mbms_flagP,
module_id_t enb_module_idP,
module_id_t ue_module_idP,
mbms_session_id_t mbms_session_idP,
mbms_service_id_t mbms_service_idP,
UL_UM_RLC_t *ul_rlcP,
DL_UM_RLC_t *dl_rlcP,
rb_id_t rb_idP,
rb_type_t rb_typeP);)
/*! \fn void rlc_um_init (rlc_um_entity_t *rlcP)
* \brief Initialize a RLC UM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC UM protocol instance will be in RLC_NULL_STATE state.
......
......@@ -886,7 +886,6 @@ inline signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_
inline signed int rlc_um_in_reordering_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP) {
//-----------------------------------------------------------------------------
rlc_sn_t modulus = (signed int)rlc_pP->vr_uh - rlc_pP->rx_um_window_size;
rlc_sn_t sn = snP;
snP = (snP - modulus) % rlc_pP->rx_sn_modulo;
......
This diff is collapsed.
......@@ -108,13 +108,25 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
#define RLC_OP_STATUS_INTERNAL_ERROR 2
#define RLC_OP_STATUS_OUT_OF_RESSOURCES 3
#define RLC_SDU_CONFIRM_YES 1
#define RLC_SDU_CONFIRM_NO 0
#define RLC_MUI_UNDEFINED 0
#define RLC_MUI_UNDEFINED (mui_t)0
#define RLC_RB_UNALLOCATED (rb_id_t)0
//-----------------------------------------------------------------------------
// PUBLIC RLC CONSTANTS
//-----------------------------------------------------------------------------
typedef enum rlc_confirm_e {
RLC_SDU_CONFIRM_NO = 0,
RLC_SDU_CONFIRM_YES = 1,
} rlc_confirm_t;
typedef enum rlc_mode_e {
RLC_MODE_NONE = 0,
RLC_MODE_AM = 1,
RLC_MODE_UM = 2,
RLC_MODE_TM = 4
} rlc_mode_t;
/*! \struct rlc_info_t
* \brief Structure containing RLC protocol configuration parameters.
......@@ -132,11 +144,11 @@ typedef volatile struct {
* \brief Primitive exchanged between RLC and MAC informing about the buffer occupancy of the RLC protocol instance.
*/
typedef struct {
u32_t bytes_in_buffer; /*!< \brief Bytes buffered in RLC protocol instance. */
u32_t pdus_in_buffer; /*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */
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 */
rlc_buffer_occupancy_t bytes_in_buffer; /*!< \brief Bytes buffered in RLC protocol instance. */
rlc_buffer_occupancy_t pdus_in_buffer; /*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */
frame_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */
sdu_size_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of already segmented sdu */
boolean_t head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmeneted */
} mac_rlc_status_resp_t;
......@@ -164,9 +176,9 @@ typedef struct {
#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 );)
protected_rlc(void (*rlc_rrc_data_conf) (module_id_t , module_id_t , eNB_flag_t, rb_id_t , mui_t, rlc_tx_status_t );)
typedef void (rrc_data_ind_cb_t)(module_id_t eNB_inst, module_id_t UE_inst, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, u8_t* sduP);
typedef void (rrc_data_conf_cb_t)(module_id_t eNB_inst, module_id_t UE_inst, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP);
typedef void (rrc_data_conf_cb_t)(module_id_t eNB_inst, module_id_t UE_inst, eNB_flag_t eNB_flagP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP);
/*! \struct rlc_t
......@@ -182,15 +194,23 @@ typedef struct rlc_t {
}rlc_t;
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_um_entity_t um;
} 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
#if !defined(Rel10)
# if !defined(maxServiceCount)
//unused arrays rlc_mbms_array_ue rlc_mbms_array_eNB
# define maxServiceCount 1
# endif
# if !defined(maxSessionPerPMCH)
//unused arrays rlc_mbms_array_ue rlc_mbms_array_eNB
# define maxSessionPerPMCH 1
# endif
#endif
public_rlc(rlc_mbms_t rlc_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_rlc(rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_rlc(rb_id_t lcid2rbid_ue[NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
public_rlc(rb_id_t lcid2rbid_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
......@@ -227,7 +247,7 @@ private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t,
// PUBLIC INTERFACE WITH RRC
//-----------------------------------------------------------------------------
#ifdef Rel10
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, SRB_ToAddMod_t* srb2addmod, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP, MBMS_SessionInfoList_r9_t *SessionInfo_listP)
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, SRB_ToAddMod_t* srb2addmod, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP, PMCH_InfoList_r9_t *pmch_info_listP)
* \brief Function for RRC to configure a Radio Bearer.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
......@@ -241,7 +261,7 @@ private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t,
*/
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t, module_id_t, frame_t, eNB_flag_t, SRB_ToAddModList_t*, DRB_ToAddModList_t*, DRB_ToReleaseList_t*, PMCH_InfoList_r9_t *pmch_info_listP);)
#else
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, SRB_ToAddModList_t* srb2add_listP, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP, MBMS_SessionInfoList_r9_t *SessionInfo_listP)
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, SRB_ToAddModList_t* srb2add_listP, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP)
* \brief Function for RRC to configure a Radio Bearer.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
......@@ -360,23 +380,6 @@ public_rlc_mac(void mac_rlc_data_ind (module_id_t, module_i
* \return The maximum number of bytes that the RLC instance can send in the next transmission sequence.
*/
public_rlc_mac(mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t, module_id_t, frame_t, eNB_flag_t, MBMS_flag_t, logical_chan_id_t, tb_size_t );)
//-----------------------------------------------------------------------------
// PUBLIC RLC CONSTANTS
//-----------------------------------------------------------------------------
/** RLC null type identifier. */
#define RLC_NONE (rlc_mode_t)0
/** RLC AM type identifier. */
#define RLC_AM (rlc_mode_t)1
/** RLC UM type identifier. */
#define RLC_UM (rlc_mode_t)2
/** RLC TM type identifier. */
#define RLC_TM (rlc_mode_t)4
#define RLC_MBMS_NO 0
#define RLC_MBMS_YES 1
#define RLC_CHANNEL_ID_DUMMY -1
//-----------------------------------------------------------------------------
// RLC methods
//-----------------------------------------------------------------------------
......
This diff is collapsed.
This diff is collapsed.
......@@ -55,7 +55,7 @@
#include "LAYER2/RLC/rlc.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
#include "LAYER2/PDCP/pdcp.h"
#include "LAYER2/PDCP_v10.1.0/pdcp.h"
#include "UTIL/LOG/log.h"
static mapping rrc_status_names[] = {
......
......@@ -69,34 +69,34 @@ typedef struct
// eNB functions
/// Invoke dlsch/ulsch scheduling procedure for new subframe
void (*eNB_dlsch_ulsch_scheduler)(u8 Mod_id, u8 cooperation_flag, u32 frame, u8 subframe);//, int calibration_flag);
void (*eNB_dlsch_ulsch_scheduler)(u8 Mod_id, u8 cooperation_flag, frame_t frameP, u8 subframe);//, int calibration_flag);
/// Fill random access response sdu, passing timing advance
u16 (*fill_rar)(u8 Mod_id,u32 frame,u8 *dlsch_buffer,u16 N_RB_UL, u8 input_buffer_length);
u16 (*fill_rar)(u8 Mod_id,frame_t frameP,u8 *dlsch_buffer,u16 N_RB_UL, u8 input_buffer_length);
/// Terminate the RA procedure upon reception of l3msg on ulsch
void (*terminate_ra_proc)(u8 Mod_id,u32 frame,u16 UE_id, u8 *l3msg, u16 l3msg_len);
void (*terminate_ra_proc)(u8 Mod_id,frame_t frameP,u16 UE_id, u8 *l3msg, u16 l3msg_len);
/// Initiate the RA procedure upon reception (hypothetical) of a valid preamble
void (*initiate_ra_proc)(u8 Mod_id,u32 frame,u16 preamble,s16 timing_offset,u8 sect_id,u8 subframe,u8 f_id);
void (*initiate_ra_proc)(u8 Mod_id,frame_t frameP,u16 preamble,s16 timing_offset,u8 sect_id,u8 subframe,u8 f_id);
/// cancel an ongoing RA procedure
void (*cancel_ra_proc)(u8 Mod_id,u32 frame,u16 preamble);
void (*cancel_ra_proc)(u8 Mod_id,frame_t frameP,u16 preamble);
/// Get DCI for current subframe from MAC
DCI_PDU* (*get_dci_sdu)(u8 Mod_id,u32 frame,u8 subframe);
DCI_PDU* (*get_dci_sdu)(u8 Mod_id,frame_t frameP,u8 subframe);
/// Get DLSCH sdu for particular RNTI and Transport block index
u8* (*get_dlsch_sdu)(u8 Mod_id,u32 frame,u16 rnti,u8 TB_index);
u8* (*get_dlsch_sdu)(u8 Mod_id,frame_t frameP,u16 rnti,u8 TB_index);
/// Send ULSCH sdu to MAC for given rnti
void (*rx_sdu)(u8 Mod_id,u32 frame,u16 rnti, u8 *sdu,u16 sdu_len);
void (*rx_sdu)(u8 Mod_id,frame_t frameP,u16 rnti, u8 *sdu,u16 sdu_len);
/// Indicate failure to synch to external source
void (*mrbch_phy_sync_failure) (u8 Mod_id,u32 frame, u8 free_eNB_index);
void (*mrbch_phy_sync_failure) (u8 Mod_id,frame_t frameP, u8 free_eNB_index);
/// Indicate Scheduling Request from UE
void (*SR_indication)(u8 Mod_id,u32 frame,u16 rnti,u8 subframe);
void (*SR_indication)(u8 Mod_id,frame_t frameP,u16 rnti,u8 subframe);
/// Configure Common PHY parameters from SIB1
void (*phy_config_sib1_eNB)(u8 Mod_id,
......@@ -124,7 +124,7 @@ typedef struct
#ifdef Rel10
/// Get MCH sdu and corresponding MCS for particular MBSFN subframe
MCH_PDU* (*get_mch_sdu)(uint8_t Mod_id,uint32_t frame,uint32_t subframe);
MCH_PDU* (*get_mch_sdu)(uint8_t Mod_id,frame_t frameP,uint32_t subframe);
#endif
// configure the cba rnti at the physical layer
void (*phy_config_cba_rnti)(u8 Mod_id,u8 eNB_flag, u8 index, u16 cba_rnti, u8 cba_group_id, u8 num_active_cba_groups);
......@@ -135,40 +135,40 @@ typedef struct
void (*phy_reset_ue)(u8 Mod_id,u8 eNB_index);
/// Indicate loss of synchronization of PBCH for this eNB to MAC layer
void (*out_of_sync_ind)(u8 Mod_id,u32 frame,u16 eNB_index);
void (*out_of_sync_ind)(u8 Mod_id,frame_t frameP,u16 eNB_index);
/// Send a received SI sdu
void (*ue_decode_si)(u8 Mod_id,u32 frame, u8 CH_index, void *pdu, u16 len);
void (*ue_decode_si)(u8 Mod_id,frame_t frameP, u8 CH_index, void *pdu, u16 len);
/// Send a received DLSCH sdu to MAC
void (*ue_send_sdu)(u8 Mod_id,u32 frame,u8 *sdu,u16 sdu_len,u8 CH_index);
void (*ue_send_sdu)(u8 Mod_id,frame_t frameP,u8 *sdu,u16 sdu_len,u8 CH_index);
#ifdef Rel10
/// Send a received MCH sdu to MAC
void (*ue_send_mch_sdu)(u8 Mod_id,u32 frame,u8 *sdu,u16 sdu_len,u8 eNB_index,u8 sync_area);
void (*ue_send_mch_sdu)(u8 Mod_id,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eNB_index,u8 sync_area);
/// Function to check if UE PHY needs to decode MCH for MAC
/// get the sync area id, and teturn MCS value if need to decode, otherwise -1
int (*ue_query_mch)(uint8_t Mod_id,uint32_t frame,uint32_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active);
int (*ue_query_mch)(uint8_t Mod_id,frame_t frameP,uint32_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active);
#endif
/// Retrieve ULSCH sdu from MAC
void (*ue_get_sdu)(u8 Mod_id,u32 frame,u8 subframe, u8 CH_index,u8 *ulsch_buffer,u16 buflen,u8 *access_mode);
void (*ue_get_sdu)(u8 Mod_id,frame_t frameP,u8 subframe, u8 CH_index,u8 *ulsch_buffer,u16 buflen,u8 *access_mode);
/// Retrieve RRCConnectionReq from MAC
PRACH_RESOURCES_t* (*ue_get_rach)(u8 Mod_id,u32 frame,u8 Msg3_flag,u8 subframe);
PRACH_RESOURCES_t* (*ue_get_rach)(u8 Mod_id,frame_t frameP,u8 Msg3_flag,u8 subframe);
/// Process Random-Access Response
u16 (*ue_process_rar)(u8 Mod_id,u32 frame,u8 *dlsch_buffer,u16 *t_crnti,u8 preamble_index);
u16 (*ue_process_rar)(u8 Mod_id,frame_t frameP,u8 *dlsch_buffer,u16 *t_crnti,u8 preamble_index);
/// Get SR payload (0,1) from UE MAC
u32 (*ue_get_SR)(u8 Mod_id,u32 frame,u8 eNB_id,u16 rnti,u8 subframe);
u32 (*ue_get_SR)(u8 Mod_id,frame_t frameP,u8 eNB_id,u16 rnti,u8 subframe);
/// Indicate synchronization with valid PBCH
void (*dl_phy_sync_success) (u8 Mod_id,u32 frame, u8 CH_index,u8 first_sync);
void (*dl_phy_sync_success) (u8 Mod_id,frame_t frameP, u8 CH_index,u8 first_sync);
/// Only calls the PDCP for now
UE_L2_STATE_t (*ue_scheduler)(u8 Mod_id, u32 frame,u8 subframe, lte_subframe_t direction,u8 eNB_id);
UE_L2_STATE_t (*ue_scheduler)(u8 Mod_id, frame_t frameP,u8 subframe, lte_subframe_t direction,u8 eNB_id);
/// PHY-Config-Dedicated UE
void (*phy_config_dedicated_ue)(u8 Mod_id,u8 CH_index,
......@@ -205,10 +205,10 @@ typedef struct
void (*ra_succeeded)(u8 Mod_id,u8 eNB_index);
/// Function to indicate the transmission of msg1/rach to MAC
void (*Msg1_transmitted)(u8 Mod_id,u32 frame,u8 eNB_id);
void (*Msg1_transmitted)(u8 Mod_id,frame_t frameP,u8 eNB_id);
/// Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer
void (*Msg3_transmitted)(u8 Mod_id,u32 frame,u8 eNB_id);
void (*Msg3_transmitted)(u8 Mod_id,frame_t frameP,u8 eNB_id);
/// Function to pass inter-cell measurement parameters to PHY (cell Ids)
void (*phy_config_meas_ue)(u8 Mod_id,u8 eNB_index,u8 n_adj_cells,u32 *adj_cell_id);
......
......@@ -89,122 +89,72 @@
/********************************************************************************************************************/
s8 mac_rrc_data_req(module_id_t module_idP, frame_t frameP, rb_id_t srb_idP, u8 nb_tbP,u8 *buffer_pP, eNB_flag_t eNB_flagP, u8 eNB_indexP, u8 mbsfn_sync_areaP){
/********************************************************************************************************************/
#ifdef CELLULAR
return(rrc_L2_data_req_rx(module_idP,srb_idP,nb_tbP,buffer_pP,eNB_indexP));
#else
return(mac_rrc_lite_data_req(module_idP,frameP,srb_idP,nb_tbP,buffer_pP,eNB_flagP,eNB_indexP,mbsfn_sync_areaP));
#endif //CELLULAR
}
/********************************************************************************************************************/
s8 mac_rrc_data_ind(module_id_t module_idP, frame_t frameP, rb_id_t srb_idP, u8 *sduP, sdu_size_t sdu_lenP, eNB_flag_t eNB_flagP, u8 eNB_indexP,u8 mbsfn_sync_area){
/********************************************************************************************************************/
#ifdef CELLULAR
return(rrc_L2_mac_data_ind_rx(module_idP, Srb_id, Sdu, Sdu_len, eNB_indexP));
#else
return(mac_rrc_lite_data_ind(module_idP,frameP,srb_idP,sduP,sdu_lenP,eNB_flagP,eNB_indexP,mbsfn_sync_area));
#endif //CELLULAR
}
/********************************************************************************************************************/
void rlcrrc_data_ind(module_id_t enb_instP, module_id_t ue_instP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t srb_idP, sdu_size_t sdu_lenP,u8 *buffer_pP){
/********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_rlc_data_ind_rx(module_idP,Srb_id, sdu_lenP, buffer_pP);
#else // now this is called from PDCP
//rlcrrc_lite_data_ind(module_idP,frameP,eNB_flag,Srb_id,Sdu_size,Buffer);
rrc_lite_data_ind(enb_instP, ue_instP,frameP,eNB_flagP,srb_idP,sdu_lenP,buffer_pP);
#endif //CELLULAR
}
/********************************************************************************************************************/
u8 pdcp_rrc_data_req(module_id_t enb_instP, module_id_t ue_instP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, mui_t muiP, boolean_t confirmP,
sdu_size_t sdu_buffer_sizeP, u8* sdu_buffer_pP, u8 modeP) {
/********************************************************************************************************************/
#ifdef CELLULAR
return pdcp_data_req( module_id, frameP, eNB_flag, rb_id, muiP, confirmP, sdu_buffer_sizeP, sdu_buffer_pP, modeP);
#else
return rrc_lite_data_req (enb_instP, ue_instP, frameP, eNB_flagP, rb_idP, muiP, confirmP, sdu_buffer_sizeP, sdu_buffer_pP, modeP);
#endif
}
/********************************************************************************************************************/
void pdcp_rrc_data_ind(module_id_t enb_instP, module_id_t ue_instP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t srb_idP, sdu_size_t sdu_sizeP,u8 *buffer_pP){
/********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_rlc_data_ind_rx(module_idP,srb_idP, sdu_sizeP, buffer_pP);
#else // now this is called from PDCP
//rlcrrc_lite_data_ind(module_idP,frameP,eNB_flag,Srb_id,Sdu_size,Buffer);
rrc_lite_data_ind(enb_instP, ue_instP,frameP,eNB_flagP,srb_idP,sdu_sizeP,buffer_pP);
#endif //CELLULAR
}
/********************************************************************************************************************/
void mac_rrc_meas_ind(module_id_t module_idP,MAC_MEAS_REQ_ENTRY *Meas_entry_pP){
/********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_mac_meas_ind_rx ();
#else
// mac_rrc_meas_ind(module_idP,Meas_entry_pP);
#endif //CELLULAR
}
/********************************************************************************************************************/
void mac_sync_ind(module_id_t module_idP,u8 Status){
/********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_sync_ind_rx(module_idP);
#else
mac_lite_sync_ind(module_idP,Status);
#endif //CELLULAR
}
/********************************************************************************************************************/
void mac_in_sync_ind(module_id_t module_idP,frame_t frameP, u16 eNB_indexP){
/********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_sync_ind_rx(module_idP);
#else
rrc_lite_in_sync_ind(module_idP,frameP,eNB_indexP);
#endif
}
/********************************************************************************************************************/
void mac_out_of_sync_ind(module_id_t module_idP,frame_t frameP, u16 eNB_indexP){
/********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_out_sync_ind_rx();
#else
rrc_lite_out_of_sync_ind(module_idP,frameP,eNB_indexP);
#endif //CELLULAR
}
/********************************************************************************************************************/
int mac_get_rrc_status(module_id_t module_idP,eNB_flag_t eNB_flagP,u8 indexP) {
/********************************************************************************************************************/
#ifdef CELLULAR
return (rrc_L2_get_rrc_status(module_idP,eNB_flagP,indexP));
#else
return mac_get_rrc_lite_status(module_idP, eNB_flagP, indexP);
#endif //CELLULAR
}
/********************************************************************************************************************/
char openair_rrc_ue_init(module_id_t module_idP, unsigned char eNB_indexP){
/********************************************************************************************************************/
#ifdef CELLULAR
return (rrc_L2_ue_init(module_idP,eNB_indexP));
#else
return openair_rrc_lite_ue_init(module_idP, eNB_indexP);
#endif //CELLULAR
}
/********************************************************************************************************************/
char openair_rrc_eNB_init(module_id_t module_idP){
/********************************************************************************************************************/
#ifdef CELLULAR
return( rrc_L2_eNB_init(module_idP));
#else
return openair_rrc_lite_eNB_init(module_idP);
#endif //CELLULAR
}
......@@ -123,13 +123,13 @@ int rrc_init_global_param(void) {
DTCH_UL_LCHAN_DESC.max_transport_blocks = 20;
DTCH_UL_LCHAN_DESC.Delay_class = 1;
Rlc_info_um.rlc_mode = RLC_UM;
Rlc_info_um.rlc_mode = RLC_MODE_UM;
Rlc_info_um.rlc.rlc_um_info.timer_reordering = 5;
Rlc_info_um.rlc.rlc_um_info.sn_field_length = 10;
Rlc_info_um.rlc.rlc_um_info.is_mXch = 0;
//Rlc_info_um.rlc.rlc_um_info.sdu_discard_mode=16;
Rlc_info_am_config.rlc_mode = RLC_AM;
Rlc_info_am_config.rlc_mode = RLC_MODE_AM;
Rlc_info_am_config.rlc.rlc_am_info.max_retx_threshold = 50;
Rlc_info_am_config.rlc.rlc_am_info.poll_pdu = 8;
Rlc_info_am_config.rlc.rlc_am_info.poll_byte = 1000;
......
......@@ -2486,7 +2486,7 @@ char openair_rrc_lite_eNB_init (module_id_t Mod_id)
}
char openair_rrc_lite_eNB_configuration (u8 Mod_id, RrcConfigurationReq *configuration)
#else
char openair_rrc_lite_eNB_init (u8 Mod_id)
char openair_rrc_lite_eNB_init (module_id_t Mod_id)
#endif
{
/*-----------------------------------------------------------------------------*/
......@@ -2599,11 +2599,9 @@ int rrc_eNB_decode_ccch (module_id_t Mod_id, frame_t frameP, SRB_INFO * Srb_info
{
/*------------------------------------------------------------------------------*/
u16 Idx, UE_index;
asn_dec_rval_t dec_rval;
//UL_CCCH_Message_t ulccchmsg;
UL_CCCH_Message_t *ul_ccch_msg = NULL; //&ulccchmsg;
u16 Idx, UE_index;
asn_dec_rval_t dec_rval;
UL_CCCH_Message_t *ul_ccch_msg = NULL;
RRCConnectionRequest_r8_IEs_t *rrcConnectionRequest;
int i, rval;
......
This diff is collapsed.
......@@ -17,7 +17,7 @@ CPUFLAGS += $(shell if grep --silent ssse3 /proc/cpuinfo ; then echo "-mssse3" ;
CPUFLAGS += $(shell if grep --silent -w sse4 /proc/cpuinfo ; then echo "-msse4" ; else echo ""; fi)
linux = $(shell if [ `uname` = "Linux" ] ; then echo "1" ; else echo "0" ; fi)
CFLAGS += -g -ggdb
CFLAGS += -g -ggdb -Wstrict-prototypes -Wpointer-sign
CFLAGS += -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 $(CPUFLAGS) -I/usr/include/X11 #-Wno-packed-bitfield-compat
# Check if GCC version is greater or equal to 4.4
......
......@@ -1067,7 +1067,6 @@ int main(int argc, char **argv) {
init_omv ();
#endif
//Before this call, NB_UE_INST and NB_eNB_INST are not set correctly
check_and_adjust_params ();
set_seed = oai_emulation.emulation_config.seed.value;
......
......@@ -118,8 +118,10 @@ extern channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
extern channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
extern mapping small_scale_names[];
extern pdcp_mbms_t pdcp_mbms_array[MAX_MODULES][16*29];
//extern int eMBMS_active;
#if defined(Rel10)
extern pdcp_mbms_t pdcp_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];
extern pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];
#endif
extern void help (void);
......@@ -751,7 +753,7 @@ void init_seed(u8 set_seed) {
}
void init_openair1() {
s32 UE_id, eNB_id;
module_id_t UE_id, eNB_id;
#if defined(ENABLE_RAL)
int list_index;
#endif
......@@ -821,16 +823,16 @@ void init_openair1() {
void init_openair2() {
#ifdef OPENAIR2
s32 i;
s32 UE_id;
module_id_t enb_id;
module_id_t UE_id;
l2_init (&PHY_vars_eNB_g[0]->lte_frame_parms,
oai_emulation.info.eMBMS_active_state,
oai_emulation.info.cba_group_active,
oai_emulation.info.handover_active);
for (i = 0; i < NB_eNB_INST; i++)
mac_xface->mrbch_phy_sync_failure (i, 0, i);
for (enb_id = 0; enb_id < NB_eNB_INST; enb_id++)
mac_xface->mrbch_phy_sync_failure (enb_id, 0, enb_id);
if (abstraction_flag == 1) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++)
......@@ -843,7 +845,7 @@ void init_openair2() {
}
void init_ocm() {
s32 UE_id, eNB_id;
module_id_t UE_id, eNB_id;
/* Added for PHY abstraction */
LOG_I(OCM,"Running with frame_type %d, Nid_cell %d, N_RB_DL %d, EP %d, mode %d, target dl_mcs %d, rate adaptation %d, nframes %d, abstraction %d, channel %s\n", oai_emulation.info.frame_type, Nid_cell, oai_emulation.info.N_RB_DL, oai_emulation.info.extended_prefix_flag, oai_emulation.info.transmission_mode,target_dl_mcs,rate_adaptation_flag,oai_emulation.info.n_frames,abstraction_flag,oai_emulation.environment_system_config.fading.small_scale.selected_option);
......@@ -934,7 +936,7 @@ void init_ocm() {
}
void init_otg_pdcp_buffer() {
s32 i;
module_id_t i;
otg_pdcp_buffer = malloc((NB_UE_INST + NB_eNB_INST) * sizeof(Packet_OTG_List));
for (i = 0; i < NB_UE_INST + NB_eNB_INST; i++) {
......@@ -944,7 +946,7 @@ void init_otg_pdcp_buffer() {
}
void update_omg () {
s32 UE_id, eNB_id;
module_id_t UE_id, eNB_id;
int new_omg_model;
if ((frame % omg_period) == 0 ) { // call OMG every 10ms
......@@ -977,7 +979,7 @@ void update_omg_ocm() {
}
void update_ocm() {
s32 UE_id, eNB_id;
module_id_t UE_id, eNB_id;
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++)
enb_data[eNB_id]->tx_power_dBm = PHY_vars_eNB_g[eNB_id]->lte_frame_parms.pdsch_config_common.referenceSignalPower;
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++)
......@@ -1030,7 +1032,7 @@ void update_ocm() {
}
#ifdef OPENAIR2
void update_otg_eNB(module_id_t module_idP, unsigned int ctime) {
void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime) {
#if defined(USER_MODE) && defined(OAI_EMU)
if (oai_emulation.info.otg_enabled ==1 ) {
......@@ -1040,23 +1042,23 @@ void update_otg_eNB(module_id_t module_idP, unsigned int ctime) {
for (dst_id = 0; dst_id < NUMBER_OF_UE_MAX; dst_id++) {
for_times += 1;
// generate traffic if the ue is rrc reconfigured state
if (mac_get_rrc_status(module_idP, 1/*eNB_flag*/, dst_id) > 2 /*RRC_CONNECTED*/ ) {
if (mac_get_rrc_status(enb_module_idP, ENB_FLAG_YES, dst_id) > 2 /*RRC_CONNECTED*/ ) {
for (app_id=0; app_id<MAX_NUM_APPLICATION; app_id++){
otg_pkt = malloc (sizeof(Packet_otg_elt));
if_times += 1;
(otg_pkt->otg_pkt).sdu_buffer = (u8*) packet_gen(module_idP, dst_id + NB_eNB_INST, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
(otg_pkt->otg_pkt).sdu_buffer = (u8*) packet_gen(enb_module_idP, dst_id + NB_eNB_INST, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
if ((otg_pkt->otg_pkt).sdu_buffer != NULL) {
otg_times += 1;
(otg_pkt->otg_pkt).rb_id = dst_id * NB_RB_MAX + DTCH; // app could be binded to a given DRB
(otg_pkt->otg_pkt).module_id = module_idP;
(otg_pkt->otg_pkt).module_id = enb_module_idP;
(otg_pkt->otg_pkt).dst_id = dst_id;
(otg_pkt->otg_pkt).is_ue = 0;
(otg_pkt->otg_pkt).mode = PDCP_DATA_PDU;
//Adding the packet to the OTG-PDCP buffer
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_idP]));
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[enb_module_idP]));
LOG_I(EMU, "[eNB %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d for app id %d \n",
(otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id, app_id);
} else {
......@@ -1064,33 +1066,31 @@ void update_otg_eNB(module_id_t module_idP, unsigned int ctime) {
otg_pkt=NULL;
}
}
//LOG_T(EMU,"[eNB %d] UE mod id %d is not connected\n", module_id, dst_id);
//LOG_I(EMU,"HEAD of otg_pdcp_buffer[%d] is %p\n", module_id, pkt_list_get_head(&(otg_pdcp_buffer[module_id])));
}
}
#ifdef Rel10
int service_id, session_id, rb_id;
mbms_service_id_t service_id;
mbms_session_id_t session_id;
rb_id_t rb_id;
// MBSM multicast traffic
// if (frame >= 50) {// only generate when UE can receive MTCH (need to control this value)
for (service_id = 0; service_id < 2 ; service_id++) { //maxServiceCount
for (session_id = 0; session_id < 2; session_id++) { // maxSessionPerPMCH
// LOG_I(OTG,"DUY:frame %d, pdcp_mbms_array[module_id][rb_id].instanciated_instance is %d\n",frame,pdcp_mbms_array[module_id][service_id*maxSessionPerPMCH + session_id].instanciated_instance);
if (pdcp_mbms_array[module_idP][service_id*maxSessionPerPMCH + session_id].instanciated_instance == module_idP + 1){ // this service/session is configured
if (pdcp_mbms_array_eNB[enb_module_idP][service_id][session_id].instanciated_instance == enb_module_idP + 1){ // this service/session is configured
otg_pkt = malloc (sizeof(Packet_otg_elt));
// LOG_T(OTG,"multicast packet gen for (service/mch %d, session/lcid %d, rb_id %d)\n", service_id, session_id, service_id*maxSessionPerPMCH + session_id);
rb_id = pdcp_mbms_array[module_idP][service_id*maxSessionPerPMCH + session_id].rb_id;
(otg_pkt->otg_pkt).sdu_buffer = (u8*) packet_gen_multicast(module_idP, session_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
rb_id = pdcp_mbms_array_eNB[enb_module_idP][service_id][session_id].rb_id;
(otg_pkt->otg_pkt).sdu_buffer = (u8*) packet_gen_multicast(enb_module_idP, session_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
if ((otg_pkt->otg_pkt).sdu_buffer != NULL) {
(otg_pkt->otg_pkt).rb_id = rb_id;
(otg_pkt->otg_pkt).module_id = module_idP;
(otg_pkt->otg_pkt).module_id = enb_module_idP;
(otg_pkt->otg_pkt).dst_id = session_id;
(otg_pkt->otg_pkt).is_ue = 0;
//Adding the packet to the OTG-PDCP buffer
(otg_pkt->otg_pkt).mode = PDCP_TM;
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_idP]));
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[enb_module_idP]));
LOG_I(EMU, "[eNB %d] ADD packet (%p) multicast to OTG buffer for dst %d on rb_id %d\n",
(otg_pkt->otg_pkt).module_id, otg_pkt, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id);
} else {
......@@ -1132,11 +1132,6 @@ void update_otg_eNB(module_id_t module_idP, unsigned int ctime) {
}
// } // end multicast traffic
#endif
//LOG_I(EMU, "[eNB %d] update OTG nb_elts = %d \n", module_id, otg_pdcp_buffer[module_idP].nb_elements);
//free(otg_pkt);
//otg_pkt = NULL;
}
#else
if (otg_enabled==1) {
......@@ -1159,13 +1154,7 @@ void update_otg_eNB(module_id_t module_idP, unsigned int ctime) {
free(otg_pkt);
otg_pkt=NULL;
}
/*else {
LOG_I(OTG,"nothing generated (src %d, dst %d)\n",src_id, dst_id);
}*/
}
/*else {
LOG_I(OTG,"rrc_status (src %d, dst %d) = %d\n",src_id, dst_id, mac_get_rrc_status(src_id, eNB_flag, dst_id ));
}*/
}
}
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment