Commit 0b0fabaa authored by Cedric Roux's avatar Cedric Roux

- Fix recent issues with ping in pre-ci

- Corrected PDCP layer to manage more than one UE correctly
	* use eNB_id, UE_id as identifiers for connections
	* splitted UE/eNB data
	* Use the real rb_id for index in array (instead of the one used for communication with RLC/IP driver

pre-ci OK, except for the random issue related to Msg3

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4730 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 068807e1
......@@ -23,7 +23,8 @@
#endif
extern unsigned char pdcp_data_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rab_id, u32 muiP, u32 confirmP, sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, u8 is_data_pdu);
extern unsigned char 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, \
sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, u8 mode);
inline NwGtpv1uRcT gtpv1u_eNB_log_request(NwGtpv1uLogMgrHandleT hLogMgr,
......@@ -60,7 +61,8 @@ NwGtpv1uRcT gtpv1u_process_stack_req(
GTPU_DEBUG("Received T-PDU from gtpv1u stack %u with size %d",
pUlpApi->apiInfo.recvMsgInfo.teid, buffer_len);
pdcp_data_req(0, // module_id,
pdcp_data_req(0, // eNB_idx,
0, // UE idx
0, // frame
1, // enb flag
5, // rb id
......
......@@ -24,6 +24,8 @@ typedef struct RrcDcchDataReq_s {
uint32_t sdu_size;
uint8_t *sdu_p;
uint8_t mode;
uint8_t ue_index;
uint8_t eNB_index;
} RrcDcchDataReq;
typedef struct RrcDcchDataInd_s {
......@@ -32,6 +34,7 @@ typedef struct RrcDcchDataInd_s {
uint32_t sdu_size;
uint8_t *sdu_p;
uint8_t ue_index;
uint8_t eNB_index;
} RrcDcchDataInd;
#endif /* PDCP_MESSAGES_TYPES_H_ */
......@@ -52,20 +52,21 @@
# define MAX_RG 2
#endif
# define MAX_MANAGED_RG_PER_MOBILE 2
# define DEFAULT_RAB_ID 3
# define NB_RB_MAX 11
# define NB_RAB_MAX 8 // 4
# define RAB_SHIFT1 9
# define RAB_SHIFT2 3
# define RAB_OFFSET 0x0007
# define RAB_OFFSET1 0x7E00
# define RAB_OFFSET2 0x01F8
# define DIR_OFFSET 0x8000
# define DIR_SHIFT 15
# define CH_OFFSET 0x0004
# define CH_SHIFT 2
#define MAX_MANAGED_RG_PER_MOBILE 2
#define DEFAULT_RAB_ID 3
#define NB_RB_MAX 11
#define NB_RAB_MAX 8
#define RAB_SHIFT1 9
#define RAB_SHIFT2 3
#define RAB_OFFSET 0x0007
#define RAB_OFFSET1 0x7E00
#define RAB_OFFSET2 0x01F8
#define DIR_OFFSET 0x8000
#define DIR_SHIFT 15
#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 )
......
......@@ -69,6 +69,8 @@
# include "intertask_interface.h"
#endif
#include "assertions.h"
#define DEBUG_HEADER_PARSING 1
#define ENABLE_MAC_PAYLOAD_DEBUG
......@@ -209,6 +211,8 @@ u32 ue_get_SR(u8 Mod_id,u32 frame,u8 eNB_id,u16 rnti, u8 subframe) {
int T=0;
// int sfn=0;
DevCheck(Mod_id < NB_UE_INST, Mod_id, NB_UE_INST, 0);
// determin the measurement gap
LOG_D(MAC,"[UE %d][SR %x] Frame %d subframe %d PHY asks for SR (SR_COUNTER/dsr_TransMax %d/%d), SR_pending %d\n",
Mod_id,rnti,frame,subframe,
......@@ -1011,8 +1015,9 @@ void ue_get_sdu(u8 Mod_id,u32 frame,u8 subframe, u8 eNB_index,u8 *ulsch_buffer,u
u8 dcch_header_len_tmp=0, dtch_header_len_tmp=0;
u8 bsr_header_len=0, bsr_ce_len=0, bsr_len=0;
u8 phr_header_len=0, phr_ce_len=0,phr_len=0;
u16 sdu_lengths[8];
u8 sdu_lcids[8],payload_offset=0,num_sdus=0;
u16 sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
u8 sdu_lcids[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
u8 payload_offset=0,num_sdus=0;
u8 ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES];
u16 sdu_length_total=0;
BSR_SHORT bsr_short;
......
......@@ -60,6 +60,8 @@
# include "intertask_interface.h"
#endif
#include "assertions.h"
#define PDCP_DATA_REQ_DEBUG 0
#define PDCP_DATA_IND_DEBUG 0
......@@ -67,10 +69,6 @@
extern int otg_enabled;
#endif
extern 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*);
extern void rrc_lite_data_ind( u8 Mod_id, u32 frame, u8 eNB_flag, u32 Rb_id, u32 sdu_size,u8 *Buffer);
//Added MW - RRC L2 interface
extern void pdcp_rrc_data_ind( u8 Mod_id, u32 frame, u8 eNB_flag, unsigned int Srb_id, unsigned int Sdu_size,u8 *Buffer);
//extern char *packet_gen(int src, int dst, int ctime, int *pkt_size);
extern int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size);
......@@ -86,24 +84,46 @@ extern int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned in
BOOL pdcp_data_req(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb_id, sdu_size_t sdu_buffer_size, \
unsigned char* sdu_buffer, pdcp_t* test_pdcp_entity, list_t* test_list)
#else
BOOL pdcp_data_req(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb_id, u32 muiP, u32 confirmP, \
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,
sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, u8 mode)
#endif
{
//-----------------------------------------------------------------------------
#ifdef PDCP_UNIT_TEST
pdcp_t* pdcp = test_pdcp_entity;
#else
pdcp_t* pdcp = &pdcp_array[module_id][rb_id];
#endif
pdcp_t* pdcp;
u8 i;
u8 pdcp_header_len=0, pdcp_tailer_len=0;
u16 pdcp_pdu_size=0, current_sn;
mem_block_t* pdcp_pdu = NULL;
rlc_op_status_t rlc_status;
module_id_t module_id;
rb_id_t rb_id_rlc = 0;
DevCheck4(eNB_id < NB_eNB_INST, eNB_id, NB_eNB_INST, UE_id, rb_id);
DevCheck4(UE_id < NB_UE_INST, UE_id, NB_UE_INST, eNB_id, rb_id);
DevCheck4(rb_id < NB_RB_MAX, rb_id, NB_RB_MAX, UE_id, eNB_id);
#ifdef PDCP_UNIT_TEST
pdcp = test_pdcp_entity;
#else
if (eNB_flag == 0) {
pdcp = &pdcp_array_ue[UE_id][rb_id];
module_id = NB_eNB_INST + UE_id;
rb_id_rlc = rb_id;
} else {
pdcp = &pdcp_array_eNB[eNB_id][UE_id][rb_id];
module_id = eNB_id;
rb_id_rlc = rb_id + (NB_RB_MAX * UE_id);
}
#endif
if ((pdcp->instanciated_instance == 0) && (mode != PDCP_TM)) {
LOG_W(PDCP, "Instance is not configured, Ignoring SDU...\n");
if ((pdcp->instanciated_instance == 0) && (mode != PDCP_TM)) {
if (eNB_flag == 0) {
LOG_W(PDCP, "[UE %d] Instance is not configured for eNB %d, rb_id %d Ignoring SDU...\n",
UE_id, eNB_id, rb_id);
} else {
LOG_W(PDCP, "[eNB %d] Instance is not configured for UE %d, rb_id %d Ignoring SDU...\n",
eNB_id, UE_id, rb_id);
}
return FALSE;
}
if (sdu_buffer_size == 0) {
......@@ -118,7 +138,7 @@ BOOL pdcp_data_req(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb
LOG_E(PDCP, "Requested SDU size (%d) is bigger than that can be handled by PDCP (%u)!\n",
sdu_buffer_size, MAX_IP_PACKET_SIZE);
// XXX What does following call do?
mac_xface->macphy_exit("");
mac_xface->macphy_exit("PDCP sdu buffer size > MAX_IP_PACKET_SIZE");
}
// PDCP transparent mode for MBMS traffic
......@@ -128,7 +148,7 @@ BOOL pdcp_data_req(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb
pdcp_pdu = get_free_mem_block(sdu_buffer_size);
if (pdcp_pdu != NULL) {
memcpy(&pdcp_pdu->data[0], sdu_buffer, sdu_buffer_size);
rlc_status = rlc_data_req(module_id, frame, eNB_flag, RLC_MBMS_YES, rb_id, muiP, confirmP, sdu_buffer_size, pdcp_pdu);
rlc_status = rlc_data_req(module_id, frame, eNB_flag, RLC_MBMS_YES, rb_id_rlc, muiP, confirmP, sdu_buffer_size, pdcp_pdu);
} else
rlc_status = RLC_OP_STATUS_OUT_OF_RESSOURCES;
} else {
......@@ -229,7 +249,7 @@ BOOL pdcp_data_req(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb
* Ask sublayer to transmit data and check return value
* to see if RLC succeeded
*/
rlc_status = rlc_data_req(module_id, frame, eNB_flag, 0, rb_id, muiP, confirmP, pdcp_pdu_size, pdcp_pdu);
rlc_status = rlc_data_req(module_id, frame, eNB_flag, 0, rb_id_rlc, muiP, confirmP, pdcp_pdu_size, pdcp_pdu);
}
switch (rlc_status) {
case RLC_OP_STATUS_OK:
......@@ -277,26 +297,54 @@ BOOL pdcp_data_req(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb
BOOL pdcp_data_ind(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb_id, sdu_size_t sdu_buffer_size, \
mem_block_t* sdu_buffer, pdcp_t* pdcp_test_entity, list_t* test_list)
#else
BOOL pdcp_data_ind(module_id_t module_id, u32_t frame, u8_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)
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, \
mem_block_t* sdu_buffer, u8 is_data_plane)
#endif
{
//-----------------------------------------------------------------------------
#ifdef PDCP_UNIT_TEST
pdcp_t* pdcp = pdcp_test_entity;
list_t* sdu_list = test_list;
pdcp_t* pdcp;
list_t* sdu_list;
#else
pdcp_t* pdcp = &pdcp_array[module_id][rb_id];
list_t* sdu_list = &pdcp_sdu_list;
pdcp_t* pdcp;
list_t* sdu_list;
#endif
mem_block_t *new_sdu = NULL;
int src_id, dst_id,ctime; // otg param
u8 pdcp_header_len=0, pdcp_tailer_len=0;
u16 sequence_number;
u8 payload_offset=0;
module_id_t module_id;
#ifdef PDCP_UNIT_TEST
pdcp = pdcp_test_entity;
sdu_list = test_list;
LOG_I(PDCP,"Data indication notification for PDCP entity with module "
"ID %d and radio bearer ID %d rlc sdu size %d eNB_flag %d\n", module_id, rb_id, sdu_buffer_size, eNB_flag);
LOG_I(PDCP, "Data indication notification for PDCP entity for module"
"ID %d and radio bearer ID %d rlc sdu size %d eNB_flag %d\n",
module_id, rb_id, sdu_buffer_size, eNB_flag);
#else
DevCheck(UE_id < NB_UE_INST, UE_id, NB_UE_INST, eNB_id);
DevCheck(eNB_id < NB_eNB_INST, eNB_id, NB_eNB_INST, UE_id);
DevCheck(rb_id < NB_RB_MAX, rb_id, NB_eNB_INST, NB_RB_MAX);
if (eNB_flag == 0) {
pdcp = &pdcp_array_ue[UE_id][rb_id];
module_id = NB_eNB_INST + UE_id;
LOG_I(PDCP, "Data indication notification for PDCP entity from UE %u to eNB %u "
"and radio bearer ID %d rlc sdu size %d eNB_flag %d\n",
UE_id, eNB_id, rb_id, sdu_buffer_size, eNB_flag);
} else {
pdcp = &pdcp_array_eNB[UE_id][eNB_id][rb_id];
module_id = eNB_id;
LOG_I(PDCP, "Data indication notification for PDCP entity from eNB %u to UE %u "
"and radio bearer ID %d rlc sdu size %d eNB_flag %d\n",
eNB_id, UE_id, rb_id, sdu_buffer_size, eNB_flag);
}
sdu_list = &pdcp_sdu_list;
#endif
if (sdu_buffer_size == 0) {
LOG_W(PDCP, "SDU buffer size is zero! Ignoring this chunk!\n");
......@@ -364,7 +412,8 @@ BOOL pdcp_data_ind(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb
}
#endif
//rrc_lite_data_ind(module_id, //Modified MW - L2 Interface
pdcp_rrc_data_ind(module_id,
pdcp_rrc_data_ind(eNB_id,
UE_id,
frame,
eNB_flag,
rb_id,
......@@ -387,20 +436,11 @@ BOOL pdcp_data_ind(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb
}
#if defined(USER_MODE) && defined(OAI_EMU)
if (oai_emulation.info.otg_enabled ==1 ){
src_id = 0;
dst_id = (eNB_flag == 1) ? module_id : module_id /*- NB_eNB_INST*/;
src_id = (eNB_flag != 0) ? UE_id + NB_eNB_INST : eNB_id;
dst_id = (eNB_flag == 0) ? UE_id + NB_eNB_INST : eNB_id;
ctime = oai_emulation.info.time_ms; // avg current simulation time in ms : we may get the exact time through OCG?
LOG_D(OTG,"Check received buffer : enb_flag %d mod id %d, rab id %d (src %d, dst %d)\n", eNB_flag, module_id, rb_id, src_id, dst_id);
if (MBMS_flagP == 0) {
src_id = (eNB_flag == 1) ? (rb_id - DTCH) / NB_RB_MAX /*- NB_eNB_INST */ + 1 : ((rb_id - DTCH) / NB_RB_MAX);
}else {
#ifdef Rel10
src_id = (rb_id - MTCH - 3 - maxDRB) / maxSessionPerPMCH /*- NB_eNB_INST */ ;
//dst_id is now = module_id (supoosed to be 1 for UE), take the same as module from rlc_data_ind
// dst_id generated data from OTG is is 1 (session_id)
#endif
}
LOG_D(PDCP, "Check received buffer : enb_flag %d mod id %d, rab id %d (src %d, dst %d)\n",
eNB_flag, module_id, rb_id, src_id, dst_id);
if (otg_rx_pkt(src_id, dst_id,ctime,&sdu_buffer->data[payload_offset],
sdu_buffer_size - payload_offset ) == 0 ) {
......@@ -422,13 +462,17 @@ BOOL pdcp_data_ind(module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rb
* Prepend PDCP indication header which is going to be removed at pdcp_fifo_flush_sdus()
*/
memset(new_sdu->data, 0, sizeof (pdcp_data_ind_header_t));
((pdcp_data_ind_header_t *) new_sdu->data)->rb_id = rb_id;
if (eNB_flag == 0) {
((pdcp_data_ind_header_t *) new_sdu->data)->rb_id = rb_id;
} else {
((pdcp_data_ind_header_t *) new_sdu->data)->rb_id = rb_id + (UE_id * NB_RAB_MAX);
}
((pdcp_data_ind_header_t *) new_sdu->data)->data_size = sdu_buffer_size - payload_offset;
// Here there is no virtualization possible
#ifdef IDROMEL_NEMO
if (eNB_flag == 0)
((pdcp_data_ind_header_t *) new_sdu->data)->inst = rb_id/8;
((pdcp_data_ind_header_t *) new_sdu->data)->inst = rb_id / NB_RAB_MAX;
else
((pdcp_data_ind_header_t *) new_sdu->data)->inst = 0;
#else
......@@ -513,7 +557,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) {
RRC_DCCH_DATA_REQ (msg_p).frame, RRC_DCCH_DATA_REQ (msg_p).enb_flag, RRC_DCCH_DATA_REQ (msg_p).rb_id,
RRC_DCCH_DATA_REQ (msg_p).muip, RRC_DCCH_DATA_REQ (msg_p).confirmp, RRC_DCCH_DATA_REQ (msg_p).mode);
pdcp_data_req (instance, RRC_DCCH_DATA_REQ (msg_p).frame, RRC_DCCH_DATA_REQ (msg_p).enb_flag,
pdcp_data_req (RRC_DCCH_DATA_REQ (msg_p).eNB_index, RRC_DCCH_DATA_REQ (msg_p).ue_index, RRC_DCCH_DATA_REQ (msg_p).frame, RRC_DCCH_DATA_REQ (msg_p).enb_flag,
RRC_DCCH_DATA_REQ (msg_p).rb_id, RRC_DCCH_DATA_REQ (msg_p).muip,
RRC_DCCH_DATA_REQ (msg_p).confirmp, RRC_DCCH_DATA_REQ (msg_p).sdu_size,
RRC_DCCH_DATA_REQ (msg_p).sdu_p, RRC_DCCH_DATA_REQ (msg_p).mode);
......@@ -556,12 +600,12 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) {
pdcp_fifo_read_input_sdus(frame, eNB_flag, UE_index, eNB_index);
// PDCP -> NAS/IP traffic: RX
pdcp_fifo_flush_sdus(frame, eNB_flag);
pdcp_fifo_flush_sdus(frame, eNB_flag, eNB_index, UE_index);
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT);
}
BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, u32_t index,
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,
......@@ -572,8 +616,8 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
#ifdef Rel10
,PMCH_InfoList_r9_t* pmch_InfoList_r9
#endif
){
)
{
long int rb_id = 0;
long int lc_id = 0;
long int srb_id = 0;
......@@ -589,6 +633,8 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
u32 action = ACTION_ADD;
SRB_ToAddMod_t* srb_toaddmod = NULL;
DRB_ToAddMod_t* drb_toaddmod = NULL;
pdcp_t *pdcp;
module_id_t module_id;
#ifdef Rel10
int i,j;
......@@ -596,53 +642,70 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
MBMS_SessionInfo_r9_t *MBMS_SessionInfo= NULL;
#endif
LOG_D(PDCP, "[MOD_id %d]CONFIG REQ ASN1 for %s %d\n",module_id,
(eNB_flag == 1)? "eNB": "UE", index);
if (eNB_flag == 0) {
module_id = NB_eNB_INST + UE_id;
LOG_D(PDCP, "[UE %d] CONFIG REQ ASN1 for eNB %d (Mod_id %u)\n", UE_id, eNB_id, module_id);
} else {
module_id = eNB_id;
LOG_D(PDCP, "[eNB %d] CONFIG REQ ASN1 for UE %d (Mod_id %u)\n", eNB_id, UE_id, module_id);
}
// srb2add_list does not define pdcp config, we use rlc info to setup the pdcp dcch0 and dcch1 channels
if (srb2add_list != NULL) {
for (cnt=0;cnt<srb2add_list->list.count;cnt++) {
srb_id = srb2add_list->list.array[cnt]->srb_Identity;
lc_id = srb_id;
rb_id = (index * NB_RB_MAX) + srb_id;
if (pdcp_array[module_id][rb_id].instanciated_instance == module_id + 1)
action = ACTION_MODIFY;
else
action = ACTION_ADD;
srb_toaddmod = srb2add_list->list.array[cnt];
rlc_type = RLC_MODE_AM;
rb_id = srb_id;
lc_id = srb_id;
if (eNB_flag == 0) {
pdcp = &pdcp_array_ue[UE_id][srb_id];
} else {
pdcp = &pdcp_array_eNB[eNB_id][UE_id][srb_id];
}
if (pdcp->instanciated_instance == 1) {
action = ACTION_MODIFY;
} else {
action = ACTION_ADD;
}
if (srb_toaddmod->rlc_Config) {
switch (srb_toaddmod->rlc_Config->present) {
case SRB_ToAddMod__rlc_Config_PR_NOTHING:
break;
case SRB_ToAddMod__rlc_Config_PR_explicitValue:
switch (srb_toaddmod->rlc_Config->choice.explicitValue.present) {
case RLC_Config_PR_NOTHING:
case SRB_ToAddMod__rlc_Config_PR_NOTHING:
break;
case SRB_ToAddMod__rlc_Config_PR_explicitValue:
switch (srb_toaddmod->rlc_Config->choice.explicitValue.present) {
case RLC_Config_PR_NOTHING:
break;
default:
pdcp_config_req_asn1 (pdcp,
eNB_id,
UE_id,
frame,
eNB_flag, // not really required
rlc_type,
action,
lc_id,
mch_id,
rb_id,
srb_sn,
0, // drb_report
0, // header compression
security_mode,
kRRCenc,
kRRCint,
kUPenc);
break;
}
break;
case SRB_ToAddMod__rlc_Config_PR_defaultValue:
// already the default values
break;
default:
pdcp_config_req_asn1 (module_id,
frame,
eNB_flag, // not really required
index, // ue/enb index : used for log
rlc_type,
action,
lc_id,
mch_id,
rb_id,
srb_sn,
0, // drb_report
0, // header compression
security_mode,
kRRCenc,
kRRCint,
kUPenc);
DevParam(srb_toaddmod->rlc_Config->present, UE_id, eNB_id);
break;
}
break;
case SRB_ToAddMod__rlc_Config_PR_defaultValue:
// already the default values
break;
default:;
}
}
}
......@@ -661,11 +724,21 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
} else {
lc_id = -1;
}
rb_id = (index * NB_RB_MAX) + lc_id;
if (pdcp_array[module_id][rb_id].instanciated_instance == module_id + 1)
rb_id = lc_id;
DevCheck4(rb_id < NB_RB_MAX, rb_id, NB_RB_MAX, UE_id, eNB_id);
if (eNB_flag == 0) {
pdcp = &pdcp_array_ue[UE_id][rb_id];
} else {
pdcp = &pdcp_array_eNB[eNB_id][UE_id][rb_id];
}
if (pdcp->instanciated_instance == 1)
action = ACTION_MODIFY;
else
action = ACTION_ADD;
if (drb_toaddmod->pdcp_Config){
if (drb_toaddmod->pdcp_Config->discardTimer) {
// set the value of the timer
......@@ -712,10 +785,11 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
default:
LOG_W(PDCP,"[MOD_id %d][RB %d] unknown drb_toaddmod->PDCP_Config->headerCompression->present \n",module_id,drb_id);
}
pdcp_config_req_asn1 (module_id,
pdcp_config_req_asn1 (pdcp,
eNB_id,
UE_id,
frame,
eNB_flag, // not really required
index,
rlc_type,
action,
lc_id,
......@@ -735,12 +809,18 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
if (drb2release_list != NULL) {
for (cnt=0;cnt<drb2release_list->list.count;cnt++) {
pdrb_id = drb2release_list->list.array[cnt];
rb_id = (index * NB_RB_MAX) + *pdrb_id;
rb_id = *pdrb_id;
if (eNB_flag == 0) {
pdcp = &pdcp_array_ue[UE_id][rb_id];
} else {
pdcp = &pdcp_array_eNB[eNB_id][UE_id][rb_id];
}
action = ACTION_REMOVE;
pdcp_config_req_asn1 (module_id,
pdcp_config_req_asn1 (pdcp,
eNB_id,
UE_id,
frame,
eNB_flag, // not really required
index,
rlc_type,
action,
lc_id,
......@@ -757,29 +837,32 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
}
#ifdef Rel10
if (pmch_InfoList_r9 != NULL){
for (i=0;i<pmch_InfoList_r9->list.count;i++){
if (pmch_InfoList_r9 != NULL) {
for (i=0;i<pmch_InfoList_r9->list.count;i++) {
mbms_SessionInfoList_r9 = &(pmch_InfoList_r9->list.array[i]->mbms_SessionInfoList_r9);
for (j=0;j<mbms_SessionInfoList_r9->list.count;j++) {
MBMS_SessionInfo = mbms_SessionInfoList_r9->list.array[j];
//lc_id = MBMS_SessionInfo->logicalChannelIdentity_r9; // lcid
lc_id = MBMS_SessionInfo->sessionId_r9->buf[0];
mch_id = MBMS_SessionInfo->tmgi_r9.serviceId_r9.buf[2]; //serviceId is 3-octet string
// can set the mch_id = i
if (eNB_flag)
rb_id = (mch_id * maxSessionPerPMCH ) + lc_id ;
rb_id = (mch_id * maxSessionPerPMCH ) + lc_id;
else
rb_id = (mch_id * maxSessionPerPMCH ) + lc_id + (maxDRB + 3);
if (pdcp_mbms_array[module_id][rb_id].instanciated_instance == module_id + 1)
action = ACTION_MBMS_MODIFY;
else
action = ACTION_MBMS_ADD;
rlc_type = RLC_MODE_UM;
pdcp_config_req_asn1 (module_id,
pdcp_config_req_asn1 (NULL,
eNB_id,
UE_id,
frame,
eNB_flag, // not really required
index,
eNB_flag,
rlc_type,
action,
lc_id,
......@@ -801,202 +884,248 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
}
BOOL pdcp_config_req_asn1 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16 index,
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){
u8 *kUPenc)
{
module_id_t module_id = 0;
switch (action) {
case ACTION_ADD:
pdcp_array[module_id][rb_id].instanciated_instance = module_id + 1;
pdcp_array[module_id][rb_id].is_ue = (eNB_flag == 0) ? 1 : 0;
pdcp_array[module_id][rb_id].lcid = lc_id;
pdcp_array[module_id][rb_id].header_compression_profile=header_compression_profile;
pdcp_array[module_id][rb_id].status_report = rb_report;
if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits)
pdcp_array[module_id][rb_id].seq_num_size = 7;
else if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits)
pdcp_array[module_id][rb_id].seq_num_size=12;
else
pdcp_array[module_id][rb_id].seq_num_size=5;
pdcp_array[module_id][rb_id].rlc_mode = rlc_mode;
pdcp_array[module_id][rb_id].next_pdcp_tx_sn = 0;
pdcp_array[module_id][rb_id].next_pdcp_rx_sn = 0;
pdcp_array[module_id][rb_id].tx_hfn = 0;
pdcp_array[module_id][rb_id].rx_hfn = 0;
pdcp_array[module_id][rb_id].last_submitted_pdcp_rx_sn = 4095;
pdcp_array[module_id][rb_id].first_missing_pdu = -1;
LOG_I(PDCP,"[%s %d] Config request : Action ADD for %s %d: Frame %d LCID %d (rb id %d) configured with SN size %d bits and RLC %s\n",
(eNB_flag) ? "eNB" : "UE", module_id,
(eNB_flag) ? "UE" : "eNB", index,
frame, lc_id, rb_id, pdcp_array[module_id][rb_id].seq_num_size,
(rlc_mode == 1) ? "AM" : (rlc_mode == 2) ? "TM" : "UM");
/* Setup security */
if (security_mode != 0xff) {
pdcp_config_set_security(module_id, frame, eNB_flag, rb_id, lc_id, security_mode, kRRCenc, kRRCint, kUPenc);
}
LOG_D(PDCP, "[MSC_NEW][FRAME %05d][PDCP][MOD %02d][RB %02d]\n", frame, module_id,rb_id);
case ACTION_ADD:
pdcp->instanciated_instance = 1;
pdcp->is_ue = (eNB_flag == 0) ? 1 : 0;
pdcp->lcid = lc_id;
pdcp->header_compression_profile = header_compression_profile;
pdcp->status_report = rb_report;
if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) {
pdcp->seq_num_size = 7;
} else if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits) {
pdcp->seq_num_size=12;
} else {
pdcp->seq_num_size=5;
}
break;
case ACTION_MODIFY:
pdcp_array[module_id][rb_id].header_compression_profile=header_compression_profile;
pdcp_array[module_id][rb_id].status_report = rb_report;
pdcp_array[module_id][rb_id].rlc_mode = rlc_mode;
pdcp->rlc_mode = rlc_mode;
pdcp->next_pdcp_tx_sn = 0;
pdcp->next_pdcp_rx_sn = 0;
pdcp->tx_hfn = 0;
pdcp->rx_hfn = 0;
pdcp->last_submitted_pdcp_rx_sn = 4095;
pdcp->first_missing_pdu = -1;
if (eNB_flag == 0) {
LOG_I(PDCP, "[UE %d] Config request : Action ADD for eNB %d: Frame %d LCID %d (rb id %d) "
"configured with SN size %d bits and RLC %s\n",
UE_id, eNB_id, frame, lc_id, rb_id, pdcp->seq_num_size,
(rlc_mode == 1) ? "AM" : (rlc_mode == 2) ? "TM" : "UM");
} else {
LOG_I(PDCP, "[eNB %d] Config request : Action ADD for UE %d: Frame %d LCID %d (rb id %d) "
"configured with SN size %d bits and RLC %s\n",
eNB_id, UE_id, frame, lc_id, rb_id, pdcp->seq_num_size,
(rlc_mode == 1) ? "AM" : (rlc_mode == 2) ? "TM" : "UM");
}
/* Setup security */
if (security_mode != 0xff) {
pdcp_config_set_security(module_id, frame, eNB_flag, rb_id, lc_id, security_mode, kRRCenc, kRRCint, kUPenc);
}
/* Setup security */
if (security_mode != 0xff) {
pdcp_config_set_security(pdcp, eNB_id, UE_id, frame, eNB_flag, rb_id, lc_id, security_mode, kRRCenc, kRRCint, kUPenc);
}
if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits)
pdcp_array[module_id][rb_id].seq_num_size = 7;
else if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits)
pdcp_array[module_id][rb_id].seq_num_size=12;
else
pdcp_array[module_id][rb_id].seq_num_size=5;
LOG_D(PDCP, "[MSC_NEW][FRAME %05d][PDCP][MOD %02d][RB %02d]\n", frame, (eNB_flag == 0) ? NB_eNB_INST + UE_id : eNB_id, rb_id);
break;
LOG_I(PDCP,"[%s %d] Config request : Action MODIFY for %s %d: Frame %d LCID %d RB id %d configured with SN size %d and RLC %s \n",
(eNB_flag) ? "eNB" : "UE", module_id,
(eNB_flag) ? "UE" : "eNB", index,
frame, lc_id, rb_id, rb_sn,
(rlc_mode == 1) ? "AM" : (rlc_mode == 2) ? "TM" : "UM");
case ACTION_MODIFY:
pdcp->header_compression_profile=header_compression_profile;
pdcp->status_report = rb_report;
pdcp->rlc_mode = rlc_mode;
break;
case ACTION_REMOVE:
pdcp_array[module_id][rb_id].instanciated_instance = 0;
pdcp_array[module_id][rb_id].lcid= 0;
pdcp_array[module_id][rb_id].header_compression_profile=0x0;
pdcp_array[module_id][rb_id].cipheringAlgorithm=0xff;
pdcp_array[module_id][rb_id].integrityProtAlgorithm=0xff;
pdcp_array[module_id][rb_id].status_report = 0;
pdcp_array[module_id][rb_id].rlc_mode = RLC_NONE;
pdcp_array[module_id][rb_id].next_pdcp_tx_sn = 0;
pdcp_array[module_id][rb_id].next_pdcp_rx_sn = 0;
pdcp_array[module_id][rb_id].tx_hfn = 0;
pdcp_array[module_id][rb_id].rx_hfn = 0;
pdcp_array[module_id][rb_id].last_submitted_pdcp_rx_sn = 4095;
pdcp_array[module_id][rb_id].seq_num_size = 0;
pdcp_array[module_id][rb_id].first_missing_pdu = -1;
pdcp_array[module_id][rb_id].security_activated = 0;
LOG_I(PDCP,"[%s %d] Config request : ACTION_REMOVE: Frame %d LCID %d RBID %d configured\n",
(eNB_flag) ? "eNB" : "UE", module_id, frame, lc_id, rb_id);
/* Security keys */
if (pdcp_array[module_id][rb_id].kUPenc != NULL) {
free(pdcp_array[module_id][rb_id].kUPenc);
}
if (pdcp_array[module_id][rb_id].kRRCint != NULL) {
free(pdcp_array[module_id][rb_id].kRRCint);
}
if (pdcp_array[module_id][rb_id].kRRCenc != NULL) {
free(pdcp_array[module_id][rb_id].kRRCenc);
}
/* Setup security */
if (security_mode != 0xff) {
pdcp_config_set_security(pdcp, eNB_id, UE_id, frame, eNB_flag, rb_id, lc_id, security_mode, kRRCenc, kRRCint, kUPenc);
}
if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) {
pdcp->seq_num_size = 7;
} else if (rb_sn == PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits) {
pdcp->seq_num_size = 12;
} else {
pdcp->seq_num_size=5;
}
break;
if (eNB_flag == 0) {
LOG_I(PDCP,"[UE %d] Config request : Action MODIFY for eNB %d: Frame %d LCID %d "
"RB id %d configured with SN size %d and RLC %s \n",
UE_id, eNB_id, frame, lc_id, rb_id, rb_sn,
(rlc_mode == 1) ? "AM" : (rlc_mode == 2) ? "TM" : "UM");
} else {
LOG_I(PDCP,"[eNB %d] Config request : Action MODIFY for UE %d: Frame %d LCID %d "
"RB id %d configured with SN size %d and RLC %s \n",
eNB_id, UE_id, frame, lc_id, rb_id, rb_sn,
(rlc_mode == 1) ? "AM" : (rlc_mode == 2) ? "TM" : "UM");
}
break;
case ACTION_REMOVE:
pdcp->instanciated_instance = 0;
pdcp->lcid = 0;
pdcp->header_compression_profile = 0x0;
pdcp->cipheringAlgorithm = 0xff;
pdcp->integrityProtAlgorithm = 0xff;
pdcp->status_report = 0;
pdcp->rlc_mode = RLC_NONE;
pdcp->next_pdcp_tx_sn = 0;
pdcp->next_pdcp_rx_sn = 0;
pdcp->tx_hfn = 0;
pdcp->rx_hfn = 0;
pdcp->last_submitted_pdcp_rx_sn = 4095;
pdcp->seq_num_size = 0;
pdcp->first_missing_pdu = -1;
pdcp->security_activated = 0;
if (eNB_flag == 0) {
LOG_I(PDCP, "[UE %d] Config request : ACTION_REMOVE for eNB %d: Frame %d LCID %d RBID %d configured\n",
UE_id, eNB_id, frame, lc_id, rb_id);
} else {
LOG_I(PDCP, "[eNB %d] Config request : ACTION_REMOVE for UE %d: Frame %d LCID %d RBID %d configured\n",
eNB_id, UE_id, frame, lc_id, rb_id);
}
/* Security keys */
if (pdcp->kUPenc != NULL) {
free(pdcp->kUPenc);
}
if (pdcp->kRRCint != NULL) {
free(pdcp->kRRCint);
}
if (pdcp->kRRCenc != NULL) {
free(pdcp->kRRCenc);
}
break;
case ACTION_MBMS_ADD:
case ACTION_MBMS_MODIFY:
pdcp_mbms_array[module_id][rb_id].instanciated_instance = module_id + 1 ;
pdcp_mbms_array[module_id][rb_id].service_id = mch_id;
pdcp_mbms_array[module_id][rb_id].session_id = lc_id;
pdcp_mbms_array[module_id][rb_id].rb_id = rb_id;
LOG_I(PDCP,"[%s %d] Config request : ACTION_MBMS_ADD: Frame %d service_id/mch index %d, session_id/lcid %d, rbid %d configured\n",
(eNB_flag == 1) ? "eNB" : "UE", module_id, frame, mch_id, lc_id, rb_id);
break;
if (eNB_flag == 0) {
module_id = UE_id + NB_eNB_INST;
LOG_I(PDCP,"[UE %d] Config request for eNB %d: %s: Frame %d service_id/mch index %d, session_id/lcid %d, rbid %d configured\n",
UE_id, eNB_id, action == ACTION_MBMS_ADD ? "ACTION_MBMS_ADD" : "ACTION_MBMS_MODIFY", frame, mch_id, lc_id, rb_id);
} else {
module_id = eNB_id;
LOG_I(PDCP,"[eNB %d] Config request for UE %d: %s: Frame %d service_id/mch index %d, session_id/lcid %d, rbid %d configured\n",
eNB_id, UE_id, action == ACTION_MBMS_ADD ? "ACTION_MBMS_ADD" : "ACTION_MBMS_MODIFY", frame, mch_id, lc_id, rb_id);
}
pdcp_mbms_array[module_id][rb_id].instanciated_instance = module_id + 1 ;
pdcp_mbms_array[module_id][rb_id].service_id = mch_id;
pdcp_mbms_array[module_id][rb_id].session_id = lc_id;
pdcp_mbms_array[module_id][rb_id].rb_id = rb_id;
break;
case ACTION_SET_SECURITY_MODE:
pdcp_config_set_security(module_id, frame, eNB_flag, rb_id, lc_id, security_mode, kRRCenc, kRRCint, kUPenc);
break;
pdcp_config_set_security(pdcp, eNB_id, UE_id, frame, eNB_flag, rb_id, lc_id, security_mode, kRRCenc, kRRCint, kUPenc);
break;
default:
LOG_W(PDCP,"unknown action %d for the config request\n",action);
break;
DevParam(action, eNB_id, UE_id);
break;
}
return 0;
}
void pdcp_config_set_security(module_id_t module_id, u32 frame, u8 eNB_flag, rb_id_t rb_id,
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)
{
if ((security_mode >= 0) && (security_mode <= 0x77)) {
pdcp_array[module_id][rb_id].cipheringAlgorithm = security_mode & 0x0f;
pdcp_array[module_id][rb_id].integrityProtAlgorithm = (security_mode>>4) & 0xf;
LOG_D(PDCP,"[%s %d][RB %02d] Set security mode : ACTION_SET_SECURITY_MODE: "
"Frame %d cipheringAlgorithm %d integrityProtAlgorithm %d\n",
(eNB_flag) ? "eNB" : "UE", module_id, rb_id, frame,
pdcp_array[module_id][rb_id].cipheringAlgorithm,
pdcp_array[module_id][rb_id].integrityProtAlgorithm);
pdcp_array[module_id][rb_id].kRRCenc = kRRCenc;
pdcp_array[module_id][rb_id].kRRCint = kRRCint;
pdcp_array[module_id][rb_id].kUPenc = kUPenc;
/* Activate security */
pdcp_array[module_id][rb_id].security_activated = 1;
DevAssert(pdcp != NULL);
if ((security_mode >= 0) && (security_mode <= 0x77)) {
pdcp->cipheringAlgorithm = security_mode & 0x0f;
pdcp->integrityProtAlgorithm = (security_mode>>4) & 0xf;
if (eNB_flag == 0) {
LOG_D(PDCP,"[UE %d][RB %02d] Set security mode : ACTION_SET_SECURITY_MODE: "
"Frame %d cipheringAlgorithm %d integrityProtAlgorithm %d\n",
UE_id, rb_id, frame, pdcp->cipheringAlgorithm, pdcp->integrityProtAlgorithm);
} else {
LOG_D(PDCP,"[%s %d] bad security mode %d", security_mode);
LOG_D(PDCP,"[eNB %d][UE %d][RB %02d] Set security mode : ACTION_SET_SECURITY_MODE: "
"Frame %d cipheringAlgorithm %d integrityProtAlgorithm %d\n",
eNB_id, UE_id, rb_id, frame, pdcp->cipheringAlgorithm, pdcp->integrityProtAlgorithm);
}
pdcp->kRRCenc = kRRCenc;
pdcp->kRRCint = kRRCint;
pdcp->kUPenc = kUPenc;
/* Activate security */
pdcp->security_activated = 1;
} else {
LOG_D(PDCP,"[%s %d] bad security mode %d", security_mode);
}
}
void rrc_pdcp_config_req (module_id_t module_id, u32 frame, u8_t eNB_flag, u32 action, rb_id_t rb_id, u8 security_mode){
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)
{
pdcp_t *pdcp;
module_id_t module_id;
if (eNB_flag == 0) {
pdcp = &pdcp_array_ue[UE_id][rb_id];
module_id = NB_eNB_INST + UE_id;
} else {
pdcp = &pdcp_array_eNB[eNB_id][UE_id][rb_id];
module_id = eNB_id;
}
/*
* Initialize sequence number state variables of relevant PDCP entity
*/
switch (action) {
case ACTION_ADD:
pdcp_array[module_id][rb_id].instanciated_instance = module_id + 1;
pdcp_array[module_id][rb_id].next_pdcp_tx_sn = 0;
pdcp_array[module_id][rb_id].next_pdcp_rx_sn = 0;
pdcp_array[module_id][rb_id].tx_hfn = 0;
pdcp_array[module_id][rb_id].rx_hfn = 0;
/* SN of the last PDCP SDU delivered to upper layers */
pdcp_array[module_id][rb_id].last_submitted_pdcp_rx_sn = 4095;
if ( (rb_id % NB_RB_MAX) < DTCH) // SRB
pdcp_array[module_id][rb_id].seq_num_size = 5;
else // DRB
pdcp_array[module_id][rb_id].seq_num_size = 12;
pdcp_array[module_id][rb_id].first_missing_pdu = -1;
LOG_D(PDCP,"[%s %d] Config request : Action ADD: Frame %d radio bearer id %d configured\n",
(eNB_flag) ? "eNB" : "UE", module_id, frame, rb_id);
LOG_D(PDCP, "[MSC_NEW][FRAME %05d][PDCP][MOD %02d][RB %02d]\n", frame, module_id,rb_id);
break;
case ACTION_ADD:
pdcp->instanciated_instance = 1;
pdcp->next_pdcp_tx_sn = 0;
pdcp->next_pdcp_rx_sn = 0;
pdcp->tx_hfn = 0;
pdcp->rx_hfn = 0;
/* SN of the last PDCP SDU delivered to upper layers */
pdcp->last_submitted_pdcp_rx_sn = 4095;
if (rb_id < DTCH) { // SRB
pdcp->seq_num_size = 5;
} else { // DRB
pdcp->seq_num_size = 12;
}
pdcp->first_missing_pdu = -1;
LOG_D(PDCP,"[%s %d] Config request : Action ADD: Frame %d radio bearer id %d configured\n",
(eNB_flag) ? "eNB" : "UE", module_id, frame, rb_id);
LOG_D(PDCP, "[MSC_NEW][FRAME %05d][PDCP][MOD %02d][RB %02d]\n", frame, module_id,rb_id);
break;
case ACTION_MODIFY:
break;
break;
case ACTION_REMOVE:
pdcp_array[module_id][rb_id].instanciated_instance = 0;
pdcp_array[module_id][rb_id].next_pdcp_tx_sn = 0;
pdcp_array[module_id][rb_id].next_pdcp_rx_sn = 0;
pdcp_array[module_id][rb_id].tx_hfn = 0;
pdcp_array[module_id][rb_id].rx_hfn = 0;
pdcp_array[module_id][rb_id].last_submitted_pdcp_rx_sn = 4095;
pdcp_array[module_id][rb_id].seq_num_size = 0;
pdcp_array[module_id][rb_id].first_missing_pdu = -1;
pdcp_array[module_id][rb_id].security_activated = 0;
LOG_D(PDCP,"[%s %d] Config request : ACTION_REMOVE: Frame %d radio bearer id %d configured\n",
(eNB_flag) ? "eNB" : "UE", module_id, frame, rb_id);
break;
pdcp->instanciated_instance = 0;
pdcp->next_pdcp_tx_sn = 0;
pdcp->next_pdcp_rx_sn = 0;
pdcp->tx_hfn = 0;
pdcp->rx_hfn = 0;
pdcp->last_submitted_pdcp_rx_sn = 4095;
pdcp->seq_num_size = 0;
pdcp->first_missing_pdu = -1;
pdcp->security_activated = 0;
LOG_D(PDCP,"[%s %d] Config request : ACTION_REMOVE: Frame %d radio bearer id %d configured\n",
(eNB_flag) ? "eNB" : "UE", module_id, frame, rb_id);
break;
case ACTION_SET_SECURITY_MODE:
if ((security_mode >= 0 ) && (security_mode <=0x77)) {
pdcp_array[module_id][rb_id].cipheringAlgorithm= security_mode & 0x0f;
pdcp_array[module_id][rb_id].integrityProtAlgorithm = (security_mode>>4) & 0xf;
LOG_D(PDCP,"[%s %d] Set security mode : ACTION_SET_SECURITY_MODE: Frame %d cipheringAlgorithm %d integrityProtAlgorithm %d\n",
(eNB_flag) ? "eNB" : "UE", module_id, frame,
pdcp_array[module_id][rb_id].cipheringAlgorithm,
pdcp_array[module_id][rb_id].integrityProtAlgorithm );
}else
LOG_D(PDCP,"[%s %d] bad security mode %d", security_mode);
break;
if ((security_mode >= 0) && (security_mode <= 0x77)) {
pdcp->cipheringAlgorithm= security_mode & 0x0f;
pdcp->integrityProtAlgorithm = (security_mode>>4) & 0xf;
LOG_D(PDCP,"[%s %d]Set security mode : ACTION_SET_SECURITY_MODE: Frame %d cipheringAlgorithm %d integrityProtAlgorithm %d\n",
(eNB_flag) ? "eNB" : "UE", module_id, frame,
pdcp->cipheringAlgorithm,
pdcp->integrityProtAlgorithm );
} else {
LOG_D(PDCP,"[%s %d] bad security mode %d", security_mode);
}
break;
default:
break;
DevParam(action, UE_id, eNB_id);
break;
}
}
// TODO PDCP module initialization code might be removed
......@@ -1050,8 +1179,7 @@ void
}
//-----------------------------------------------------------------------------
void
pdcp_layer_init ()
void pdcp_layer_init(void)
{
//-----------------------------------------------------------------------------
unsigned int i, j, k;
......@@ -1060,12 +1188,10 @@ void
* Initialize SDU list
*/
list_init(&pdcp_sdu_list, NULL);
for (i=0; i < MAX_MODULES; i++) {
for (j=0; j < NB_RB_MAX; j++) {
memset((void*)&pdcp_array[i][j], 0, sizeof(pdcp_t));
}
}
memset(pdcp_array_ue, 0, sizeof(pdcp_array_ue));
memset(pdcp_array_eNB, 0, sizeof(pdcp_array_eNB));
for (i=0; i < MAX_MODULES; i++) { // MAX service
for (j=0; j < 16*29; j++) { // max session
memset((void*)&pdcp_mbms_array[i][j], 0, sizeof(pdcp_mbms_t));
......
......@@ -237,7 +237,8 @@ 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 (module_id_t module_id, u32_t frame, u8_t eNB_flag, rb_id_t rab_id, u32 muiP, u32 confirmP, sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, u8 mode);)
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, \
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*)
* \brief This functions handles data transfer indications coming from RLC
......@@ -253,8 +254,8 @@ public_pdcp(BOOL pdcp_data_req (module_id_t module_id, u32_t frame, u8_t eNB_fla
* \note None
* @ingroup _pdcp
*/
public_pdcp(BOOL pdcp_data_ind (module_id_t module_id, u32_t frame, u8_t eNB_flag, u8_t MBMS_flagP, rb_id_t rab_id, sdu_size_t sdu_buffer_size, \
mem_block_t* sdu_buffer, u8 is_data_plane);)
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,
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)
......@@ -268,8 +269,7 @@ public_pdcp(BOOL pdcp_data_ind (module_id_t module_id, u32_t frame, u8_t eNB_fla
* \note None
* @ingroup _pdcp
*/
public_pdcp(void rrc_pdcp_config_req (module_id_t module_id, u32 frame, u8_t eNB_flag, u32 action, rb_id_t rab_id, u8 security_mode);)
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);)
/*! \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)
* \brief Function for RRC to configure a Radio Bearer.
......@@ -287,7 +287,7 @@ public_pdcp(void rrc_pdcp_config_req (module_id_t module_id, u32 frame, u8_t eNB
* \return A status about the processing, OK or error code.
*/
public_pdcp(
BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag, u32_t index,
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,
......@@ -316,13 +316,13 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_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 (module_id_t module_id, u32 frame, u8_t eNB_flag, u16 index,
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, 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));
/*! \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
......@@ -351,7 +351,7 @@ 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,u8_t);)
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);)
......@@ -404,7 +404,8 @@ typedef struct pdcp_missing_pdu_info_t {
#define PDCP_MAX_SN_12BIT 4095 // 2^12-1
protected_pdcp(signed int pdcp_2_nas_irq;)
protected_pdcp(pdcp_t pdcp_array[MAX_MODULES][MAX_MODULES*NB_RB_MAX];)
protected_pdcp(pdcp_t pdcp_array_ue[NUMBER_OF_UE_MAX][NB_RB_MAX];)
protected_pdcp(pdcp_t pdcp_array_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][NB_RB_MAX];)
public_pdcp(pdcp_mbms_t pdcp_mbms_array[MAX_MODULES][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;)
......
......@@ -69,6 +69,7 @@ extern int otg_enabled;
#include "UTIL/FIFO/pad_list.h"
#include "platform_constants.h"
#include "assertions.h"
#ifdef NAS_NETLINK
#include <sys/socket.h>
......@@ -95,7 +96,7 @@ extern Packet_OTG_List *otg_pdcp_buffer;
pdcp_data_req_header_t pdcp_read_header;
//-----------------------------------------------------------------------------
int pdcp_fifo_flush_sdus (u32_t frame,u8 eNB_flag)
int pdcp_fifo_flush_sdus(u32_t frame, u8 eNB_flag, u8 eNB_id, u8 UE_id)
{
//-----------------------------------------------------------------------------
......@@ -266,12 +267,15 @@ int pdcp_fifo_flush_sdus (u32_t frame,u8 eNB_flag)
* returns zero value if whole bytes that had to be read were not read at all
* returns a negative value if an error was encountered while reading the rt fifo
*/
int
pdcp_fifo_read_input_sdus_remaining_bytes (u32_t frame,u8_t eNB_flag)
int pdcp_fifo_read_input_sdus_remaining_bytes (u32_t frame, u8_t eNB_flag)
{
//-----------------------------------------------------------------------------
sdu_size_t bytes_read = 0;
rb_id_t rab_id = 0;
pdcp_t *pdcp;
u8 UE_id = 0;
u8 eNB_id;
u8 rb_id;
// if remaining bytes to read
if (pdcp_input_sdu_remaining_size_to_read > 0) {
......@@ -300,12 +304,29 @@ int
pdcp_read_header.inst = 0;
#endif
if (eNB_flag == 0) {
UE_id = pdcp_read_header.inst;
rb_id = pdcp_read_header.rb_id % NB_RB_MAX;
eNB_id = 0;
DevCheck4(UE_id < NB_UE_INST, UE_id, NB_UE_INST, pdcp_read_header.rb_id, NB_RB_MAX);
DevCheck4(eNB_id < NB_eNB_INST, eNB_id, NB_eNB_INST, pdcp_read_header.rb_id, NB_RB_MAX);
pdcp = &pdcp_array_ue[UE_id][rb_id];
} else {
UE_id = pdcp_read_header.rb_id / NB_RB_MAX;
rb_id = pdcp_read_header.rb_id % NB_RB_MAX;
eNB_id = pdcp_read_header.inst;
pdcp = &pdcp_array_eNB[eNB_id][UE_id][rb_id];
}
if (pdcp_input_header.rb_id != 0) {
LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id);
if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id%NB_RB_MAX].instanciated_instance) {
pdcp_data_req (pdcp_input_header.inst,
if (pdcp->instanciated_instance) {
pdcp_data_req (eNB_id, UE_id,
frame, eNB_flag,
pdcp_input_header.rb_id,
RLC_MUI_UNDEFINED,
......@@ -316,18 +337,20 @@ int
}
} else if ((pdcp_input_header.traffic_type == OAI_NW_DRV_IPV6_ADDR_TYPE_MULTICAST) || (pdcp_input_header.traffic_type == OAI_NW_DRV_IPV4_ADDR_TYPE_MULTICAST)) {
printf("[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ on MBMS bearer/ %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ on MBMS bearer/ %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id);
if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id%NB_RB_MAX].instanciated_instance) {
pdcp_data_req (pdcp_input_header.inst,
frame, eNB_flag,
pdcp_input_header.rb_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_TM);
if (pdcp->instanciated_instance) {
pdcp_data_req (eNB_id,
UE_id,
frame,
eNB_flag,
pdcp_input_header.rb_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_TM);
}
} else if (eNB_flag) {
......@@ -336,27 +359,29 @@ int
#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES
for (rab_id = DEFAULT_RAB_ID; rab_id < MAX_RB; rab_id = rab_id + NB_RB_MAX) {
LOG_D(PDCP, "Checking if could sent on default rab id %d\n", rab_id);
if (pdcp_array[pdcp_input_header.inst][rab_id%NB_RB_MAX].instanciated_instance == (pdcp_input_header.inst + 1)) {
pdcp_data_req (pdcp_input_header.inst,
frame, eNB_flag,
rab_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_DATA_PDU);
if (pdcp->instanciated_instance == (pdcp_input_header.inst + 1)) {
pdcp_data_req (eNB_id,
UE_id,
frame, eNB_flag,
rab_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_DATA_PDU);
}
}
} else {
LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
pdcp_data_req (pdcp_input_header.inst,
frame, eNB_flag,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_DATA_PDU);
pdcp_data_req (eNB_id,
UE_id,
frame, eNB_flag,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_DATA_PDU);
}
// not necessary
//memset(pdcp_input_sdu_buffer, 0, MAX_IP_PACKET_SIZE);
......@@ -372,206 +397,43 @@ int
//-----------------------------------------------------------------------------
int pdcp_fifo_read_input_sdus (u32_t frame, u8_t eNB_flag, u8_t UE_index, u8_t eNB_index)
{
//-----------------------------------------------------------------------------
//#ifdef NAS_FIFO
// int cont;
// int bytes_read;
//
// // if remaining bytes to read
// if (pdcp_fifo_read_input_sdus_remaining_bytes (frame,eNB_flag) > 0) {
//
// // all bytes that had to be read for a SDU were read
// // if not overflow of list, try to get new sdus from rt fifo
// cont = 1;
//
// while (cont > 0) {
// bytes_read = rtf_get (NAS2PDCP_FIFO,
// &(((u8 *) & pdcp_input_header)[pdcp_input_index_header]),
// sizeof (pdcp_data_req_header_t) - pdcp_input_index_header);
//
// if (bytes_read > 0) {
//#ifdef PDCP_DEBUG
// LOG_D(PDCP, "[PDCP_FIFOS] TTI %d Read %d Bytes of data (header %d) from Nas_mesh\n",
// frame,
// bytes_read,
// sizeof(pdcp_data_req_header_t));
//#endif // PDCP_DEBUG
// pdcp_input_index_header += bytes_read;
//
// if (pdcp_input_index_header == sizeof (pdcp_data_req_header_t)) {
//#ifdef PDCP_DEBUG
// LOG_D(PDCP, "TTI %d IP->RADIO READ HEADER sdu size %d\n",
// frame,
// pdcp_input_header.data_size);
//#endif //PDCP_DEBUG
// pdcp_input_index_header = 0;
// if (pdcp_input_header.data_size < 0) {
// LOG_E(PDCP, "READ_FIFO: DATA_SIZE %d < 0\n",pdcp_input_header.data_size);
//
// mac_xface->macphy_exit("");
// return 0;
// }
// pdcp_input_sdu_remaining_size_to_read = pdcp_input_header.data_size;
// pdcp_input_sdu_size_read = 0;
// // we know the size of the sdu, so read the sdu;
// cont = pdcp_fifo_read_input_sdus_remaining_bytes (frame,eNB_flag);
// } else {
// cont = 0;
// }
// // error while reading rt fifo
// } else {
// cont = 0;
// }
// }
// }
// return bytes_read;
//
//#else //NAS_FIFO
//#ifdef NAS_NETLINK
// int len = 1;
// rb_id_t rab_id = 0;
//
// while (len > 0) {
// if (pdcp_read_state == 0) {
//#ifdef LINUX
// len = recvmsg(nas_sock_fd, &nas_msg, 0);
//#else
// len = -1;
//#endif
//
// if (len < 0) {
// // nothing in pdcp NAS socket
// //LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len);
// } else {
//#ifdef PDCP_DEBUG
//#ifdef LINUX
// LOG_I(PDCP, "[PDCP][NETLINK] Received socket with length %d (nlmsg_len = %d)\n",
// len, nas_nlh->nlmsg_len-sizeof(struct nlmsghdr));
//#else
// LOG_I(PDCP, "[PDCP][NETLINK] nlmsg_len = %d (%d,%d)\n",
// nas_nlh->nlmsg_len, sizeof(pdcp_data_req_header_t),
// sizeof(struct nlmsghdr));
//#endif
//#endif
// }
//
//#ifdef LINUX
// if (nas_nlh->nlmsg_len == sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)) {
// pdcp_read_state = 1; //get
// memcpy((void *)&pdcp_read_header, (void *)NLMSG_DATA(nas_nlh), sizeof(pdcp_data_req_header_t));
// }
//#else
// pdcp_read_state = 1;
//#endif
// }
//
// if (pdcp_read_state == 1) {
//#ifdef LINUX
// len = recvmsg(nas_sock_fd, &nas_msg, 0);
//#else
// len = -1;
//#endif
//
// if (len < 0) {
// // nothing in pdcp NAS socket
// //LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len);
// } else {
// pdcp_read_state = 0;
// // print_active_requests()
//
//#ifdef LINUX
// memcpy(pdcp_read_payload, (unsigned char *)NLMSG_DATA(nas_nlh), nas_nlh->nlmsg_len - sizeof(struct nlmsghdr));
//#endif
//
//#ifdef OAI_EMU
// pdcp_read_header.inst = (pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) ?
// pdcp_read_header.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local :
// pdcp_read_header.inst + oai_emulation.info.first_enb_local;
//#else
// pdcp_read_header.inst = 0;
//#endif
//
// if (pdcp_read_header.rb_id != 0) {
// if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id].instanciated_instance) {
//#ifdef PDCP_DEBUG
// LOG_I(PDCP, "[PDCP][NETLINK][IP->PDCP] TTI %d, INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n",
// frame, pdcp_read_header.inst, len, nas_nlh->nlmsg_len-sizeof(struct nlmsghdr), pdcp_read_header.rb_id);
// LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
// frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id);
//#endif
//
// pdcp_data_req(pdcp_read_header.inst,
// frame,
// eNB_flag,
// pdcp_read_header.rb_id,
// RLC_MUI_UNDEFINED,
// RLC_SDU_CONFIRM_NO,
// pdcp_read_header.data_size,
// pdcp_read_payload,
// PDCP_DATA_PDU);
// } else {
// LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u\n",
// pdcp_read_header.inst, pdcp_read_header.rb_id);
// }
// } else if (eNB_flag) {
// // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs
// LOG_D(PDCP, "Checking if could sent on default rabs\n");
//#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES
// for (rab_id = DEFAULT_RAB_ID; rab_id < MAX_RB; rab_id = rab_id + NB_RB_MAX) {
// LOG_D(PDCP, "Checking if could sent on default rab id %d\n", rab_id);
// if (pdcp_array[pdcp_input_header.inst][rab_id].instanciated_instance == (pdcp_input_header.inst + 1)) {
// pdcp_data_req (pdcp_input_header.inst, frame, eNB_flag, rab_id, RLC_MUI_UNDEFINED,RLC_SDU_CONFIRM_NO,
// pdcp_input_header.data_size,
// pdcp_input_sdu_buffer,
// PDCP_DATA_PDU);
// }
// }
// } else {
// LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
// pdcp_data_req (pdcp_input_header.inst,
// frame, eNB_flag,
// DEFAULT_RAB_ID,
// RLC_MUI_UNDEFINED,
// RLC_SDU_CONFIRM_NO,
// pdcp_input_header.data_size,
// pdcp_input_sdu_buffer,
// PDCP_DATA_PDU);
// }
// }
// }
// } // end of while
//
// return len;
//
//#else // neither NAS_NETLINK nor NAS_FIFO
// return 0;
//#endif // NAS_NETLINK
#ifdef NAS_NETLINK
# if defined(ENABLE_PDCP_NETLINK_FIFO)
rb_id_t rab_id;
pdcp_t *pdcp;
struct pdcp_netlink_element_s *data = NULL;
while (pdcp_netlink_dequeue_element(eNB_flag, UE_index, eNB_index, &data) != 0) {
DevAssert(data != NULL);
if (eNB_flag == 0) {
rab_id = data->pdcp_read_header.rb_id;
pdcp = &pdcp_array_ue[UE_index][rab_id];
} else {
rab_id = data->pdcp_read_header.rb_id % NB_RAB_MAX;
UE_index = data->pdcp_read_header.rb_id / NB_RAB_MAX;
pdcp = &pdcp_array_eNB[eNB_index][UE_index][rab_id];
}
if (data->pdcp_read_header.rb_id != 0) {
if (pdcp_array[data->pdcp_read_header.inst][data->pdcp_read_header.rb_id%NB_RB_MAX].instanciated_instance) {
if (pdcp->instanciated_instance) {
LOG_D(PDCP, "[FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ "
"/ %d Bytes --->][PDCP][MOD %02d][RB %02d]\n",
frame, data->pdcp_read_header.inst, data->pdcp_read_header.data_size,
data->pdcp_read_header.inst, data->pdcp_read_header.rb_id);
pdcp_data_req(data->pdcp_read_header.inst,
pdcp_data_req(eNB_index,
UE_index,
frame,
eNB_flag,
data->pdcp_read_header.rb_id,
rab_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
data->pdcp_read_header.data_size,
data->data,
PDCP_DATA_PDU);
} else {
LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u\n",
data->pdcp_read_header.inst, data->pdcp_read_header.rb_id);
LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u, UE_index %d, eNB_flag %d\n",
data->pdcp_read_header.inst, data->pdcp_read_header.rb_id, UE_index, eNB_flag);
}
} else if (eNB_flag) {
/* rb_id = 0, thus interpreated as broadcast and transported as
......@@ -580,8 +442,9 @@ int pdcp_fifo_read_input_sdus (u32_t frame, u8_t eNB_flag, u8_t UE_index, u8_t e
*/
#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES
for (rab_id = DEFAULT_RAB_ID; rab_id < MAX_RB; rab_id = rab_id + NB_RB_MAX) {
if (pdcp_array[pdcp_input_header.inst][rab_id%NB_RB_MAX].instanciated_instance == (pdcp_input_header.inst + 1)) {
pdcp_data_req(data->pdcp_read_header.inst,
if (pdcp->instanciated_instance) {
pdcp_data_req(eNB_index,
UE_index,
frame,
eNB_flag,
rab_id,
......@@ -594,7 +457,8 @@ int pdcp_fifo_read_input_sdus (u32_t frame, u8_t eNB_flag, u8_t UE_index, u8_t e
}
} else {
LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
pdcp_data_req(data->pdcp_read_header.inst,
pdcp_data_req(eNB_index,
UE_index,
frame, eNB_flag,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
......@@ -748,13 +612,13 @@ void pdcp_fifo_read_input_sdus_from_otg (u32_t frame, u8_t eNB_flag, u8 UE_index
//rb_id = (/*NB_eNB_INST +*/ dst_id -1 ) * MAX_NUM_RB + DTCH;
LOG_D(OTG,"[eNB %d] Frame %d sending packet %d from module %d on rab id %d (src %d, dst %d) pkt size %d for pdcp mode %d\n",
eNB_index, frame, pkt_cnt++, module_id, rb_id, module_id, dst_id, pkt_size, pdcp_mode);
pdcp_data_req(module_id, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,pdcp_mode);
pdcp_data_req(eNB_index, UE_index, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,pdcp_mode);
}
else {
//rb_id= eNB_index * MAX_NUM_RB + DTCH;
LOG_D(OTG,"[UE %d] sending packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n",
UE_index, src_id, rb_id, src_id, dst_id, pkt_size);
pdcp_data_req(src_id, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO,pkt_size, otg_pkt, PDCP_DATA_PDU);
pdcp_data_req(eNB_index, UE_index, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt, PDCP_DATA_PDU);
}
free(otg_pkt);
}
......@@ -774,7 +638,7 @@ void pdcp_fifo_read_input_sdus_from_otg (u32_t frame, u8_t eNB_flag, u8 UE_index
otg_pkt=packet_gen(src_id, dst_id, 0, ctime, &pkt_size);
if (otg_pkt != NULL){
rb_id = dst_id * NB_RB_MAX + DTCH;
pdcp_data_req(src_id, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO,pkt_size, otg_pkt, PDCP_DATA_PDU);
pdcp_data_req(eNB_index, dst_id, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO,pkt_size, otg_pkt, PDCP_DATA_PDU);
LOG_I(OTG,"send packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n", eNB_index, rb_id, src_id, dst_id, pkt_size);
free(otg_pkt);
}
......
......@@ -202,8 +202,8 @@ void *pdcp_netlink_thread_fct(void *arg) {
new_data->pdcp_read_header.data_size);
} else {
LOG_E(PDCP, "[NETLINK] WRONG size %d should be sizeof "
"(pdcp_data_req_header_t) + sizeof(struct nlmsghdr)\n",
nas_nlh_rx->nlmsg_len);
"%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;
......
......@@ -156,7 +156,7 @@ BOOL pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer
int pdcp_netlink_dequeue_element(uint8_t eNB_flag, uint8_t UE_index, uint8_t eNB_index,
struct pdcp_netlink_element_s **data);
void pdcp_config_set_security(module_id_t module_id, u32 frame, u8 eNB_flag, rb_id_t rb_id,
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);
#if defined(ENABLE_SECURITY)
......
......@@ -77,6 +77,16 @@ void rlc_am_send_sdu (rlc_am_entity_t *rlcP,u32_t frame, u8_t eNB_flag)
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
......@@ -85,7 +95,7 @@ void rlc_am_send_sdu (rlc_am_entity_t *rlcP,u32_t frame, u8_t eNB_flag)
rlcP->output_sdu_size_to_write,
rlcP->output_sdu_in_construction);
#else
rlc_data_ind (rlcP->module_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);
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 {
......
......@@ -54,6 +54,16 @@ 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++) {
......@@ -64,7 +74,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, 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->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);
rlcP->output_sdu_in_construction = NULL;
} else {
msg ("[RLC_TM %p][SEND_SDU] ERROR OUTPUT SDU IS NULL\n", rlcP);
......
......@@ -109,6 +109,15 @@ rlc_um_send_sdu (rlc_um_entity_t *rlcP,u32_t frame, u8_t eNB_flag)
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 (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;
#ifdef TEST_RLC_UM
......@@ -120,7 +129,7 @@ rlc_um_send_sdu (rlc_um_entity_t *rlcP,u32_t frame, u8_t eNB_flag)
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);
#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, frame, eNB_flag, rlcP->is_mxch, rlcP->rb_id, rlcP->output_sdu_size_to_write, rlcP->output_sdu_in_construction,rlcP->is_data_plane);
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);
#endif
rlcP->output_sdu_in_construction = NULL;
} else {
......
......@@ -32,7 +32,10 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
#include "mem_block.h"
#include "../MAC/extern.h"
#include "UTIL/LOG/log.h"
extern void pdcp_data_ind (module_id_t module_idP, u32_t frame, u8_t eNB_flag, u8_t MBMS_flag, rb_id_t rab_idP, sdu_size_t data_sizeP, mem_block_t * sduP, u8 is_data_plane);
#include "assertions.h"
extern void pdcp_data_ind (u8 eNB_id, u8 UE_id, u32_t frame, u8_t eNB_flag, u8_t MBMS_flag, rb_id_t rab_idP, sdu_size_t data_sizeP, mem_block_t * sduP, u8 is_data_plane);
//#define DEBUG_RLC_PDCP_INTERFACE
......@@ -54,7 +57,7 @@ void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, uns
for (octet_index = 0; octet_index < sizeP; octet_index++) {
if ((octet_index % 16) == 0){
if (octet_index != 0) {
LOG_T(componentP, " |\n");
LOG_T(componentP, " |\n");
}
LOG_T(componentP, " %04d |", octet_index);
}
......@@ -284,12 +287,23 @@ rlc_op_status_t rlc_data_req (module_id_t module_idP, u32_t frame, u8_t eNB_
rb_id_t mbms_rb_id = 0;
#endif
#ifdef DEBUG_RLC_DATA_REQ
LOG_D(RLC,"rlc_data_req: module_idP %d (%d), rb_idP %d (%d), muip %d, confirmP %d, sud_sizeP %d, sduP %p\n",module_idP,MAX_MODULES,rb_idP,MAX_RAB,muiP,confirmP,sdu_sizeP,sduP);
LOG_D(RLC,"rlc_data_req: module_idP %d (%d), rb_idP %d (%d), muip %d, confirmP %d, sud_sizeP %d, sduP %p\n",
module_idP,MAX_MODULES,rb_idP,MAX_RAB,muiP,confirmP,sdu_sizeP,sduP);
#endif
if ((module_idP >= 0) && (module_idP < MAX_MODULES) && (MBMS_flagP == 0)) {
if ((rb_idP >= 0) && (rb_idP < MAX_RAB)) {
if (sduP != NULL) {
if (sdu_sizeP > 0) {
#ifdef Rel10
DevCheck((module_idP < MAX_MODULES), module_idP, MAX_MODULES, MBMS_flagP);
#else
DevCheck((module_idP < MAX_MODULES) && (MBMS_flagP == 0), module_idP, MAX_MODULES, MBMS_flagP);
#endif
DevCheck(rb_idP < MAX_RAB, rb_idP, MAX_RB, 0);
DevAssert(sduP != NULL);
DevCheck(sdu_sizeP > 0, sdu_sizeP, 0, 0);
#ifndef Rel10
DevCheck(MBMS_flagP == 0, MBMS_flagP, 0, 0);
#endif
if (MBMS_flagP == 0) {
LOG_D(RLC, "[FRAME %05d][RLC][MOD %02d][RB %02d] Display of rlc_data_req:\n",
frame, module_idP, rb_idP);
rlc_util_print_hex_octets(RLC, (unsigned char*)sduP->data, sdu_sizeP);
......@@ -300,8 +314,8 @@ rlc_op_status_t rlc_data_req (module_id_t module_idP, u32_t frame, u8_t eNB_
switch (rlc[module_idP].m_rlc_pointer[rb_idP].rlc_type) {
case RLC_NONE:
free_mem_block(sduP);
LOG_E(RLC, "Received RLC_NONE as rlc_type for module_idP %d, rb_id %d, eNB_flag %d\n", module_idP, rb_idP, eNB_flagP);
return RLC_OP_STATUS_BAD_PARAMETER;
break;
case RLC_AM:
#ifdef DEBUG_RLC_DATA_REQ
......@@ -415,23 +429,9 @@ rlc_op_status_t rlc_data_req (module_id_t module_idP, u32_t frame, u8_t eNB_
return RLC_OP_STATUS_INTERNAL_ERROR;
}
} else {
free_mem_block(sduP);
//handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : SDU size is 0\n", __FILE__, __LINE__);
return RLC_OP_STATUS_BAD_PARAMETER;
}
} else {
free_mem_block(sduP);
//handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : SDU is NULL\n", __FILE__, __LINE__);
return RLC_OP_STATUS_BAD_PARAMETER;
}
} else {
free_mem_block(sduP);
//handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : parameter rb_id out of bounds :%d\n", __FILE__, __LINE__, rb_idP);
return RLC_OP_STATUS_BAD_PARAMETER;
}
#ifdef Rel10
} else if ((module_idP >= 0) && (module_idP < MAX_MODULES) && (MBMS_flagP == 1)) {
} else { /* MBMS_flag != 0 */
if (rb_idP < (maxSessionPerPMCH * maxServiceCount)) {
if (eNB_flagP) {
mbms_rb_id = rb_idP + (maxDRB + 3) * MAX_MOBILES_PER_RG;
......@@ -480,22 +480,41 @@ rlc_op_status_t rlc_data_req (module_id_t module_idP, u32_t frame, u8_t eNB_
} else {
return RLC_OP_STATUS_BAD_PARAMETER;
}
#endif
} else {
}
#else
} else {/* MBMS_flag != 0 */
free_mem_block(sduP);
LOG_E(RLC, "MBMS_flag != 0 while Rel10 is not defined...\n");
//handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : parameter module_id out of bounds :%d\n", __FILE__, __LINE__, module_idP);
return RLC_OP_STATUS_BAD_PARAMETER;
}
#endif
}
//-----------------------------------------------------------------------------
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) {
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 rb_idP, sdu_size_t sdu_sizeP, mem_block_t* sduP, boolean_t is_data_planeP) {
//-----------------------------------------------------------------------------
char *from_str;
char *to_str;
u8_t from_value;
u8_t to_value;
if (eNB_flag == 0) {
from_str = "UE";
to_str = "eNB";
from_value = UE_id;
to_value = eNB_id;
} else {
from_str = "eNB";
to_str = "UE";
from_value = eNB_id;
to_value = UE_id;
}
LOG_D(RLC, "[FRAME %05d][RLC][MOD %02d][RB %02d] Display of rlc_data_ind:\n", frame, module_idP, rb_idP);
rlc_util_print_hex_octets(RLC, (unsigned char*)sduP->data, sdu_sizeP);
//check_mem_area();
// now demux is done at PDCP
// if ((is_data_planeP)) {
// now demux is done at PDCP
// if ((is_data_planeP)) {
#ifdef DEBUG_RLC_PDCP_INTERFACE
msg("[RLC] TTI %d, INST %d : Receiving SDU (%p) of size %d bytes to Rb_id %d\n",
frame, module_idP,
......@@ -505,16 +524,19 @@ void rlc_data_ind (module_id_t module_idP, u32_t frame, u8_t eNB_flag, u8_t
#endif //DEBUG_RLC_PDCP_INTERFACE
switch (rlc[module_idP].m_rlc_pointer[rb_idP].rlc_type) {
case RLC_AM:
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RLC_AM][MOD %02d][RB %02d][--- RLC_DATA_IND/%d Bytes --->][PDCP][MOD %02d][RB %02d]\n",frame, module_idP,rb_idP,sdu_sizeP, module_idP,rb_idP);
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RLC_AM][%s %02d][RB %02d][--- RLC_DATA_IND/%d Bytes --->][PDCP][%s %02d][RB %02d]\n",
frame, from_str, from_value, rb_idP, sdu_sizeP, to_str, to_value, rb_idP);
break;
case RLC_UM:
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RLC_UM][MOD %02d][RB %02d][--- RLC_DATA_IND/%d Bytes --->][PDCP][MOD %02d][RB %02d]\n",frame, module_idP,rb_idP,sdu_sizeP, module_idP,rb_idP);
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RLC_UM][%s %02d][RB %02d][--- RLC_DATA_IND/%d Bytes --->][PDCP][%s %02d][RB %02d]\n",
frame, from_str, from_value, rb_idP, sdu_sizeP, to_str, to_value, rb_idP);
break;
case RLC_TM:
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RLC_TM][MOD %02d][RB %02d][--- RLC_DATA_IND/%d Bytes --->][PDCP][MOD %02d][RB %02d]\n",frame, module_idP,rb_idP,sdu_sizeP, module_idP,rb_idP);
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RLC_TM][%s %02d][RB %02d][--- RLC_DATA_IND/%d Bytes --->][PDCP][%s %02d][RB %02d]\n",
frame, from_str, from_value, rb_idP, sdu_sizeP, to_str, to_value, rb_idP);
break;
}
pdcp_data_ind (module_idP, frame, eNB_flag, MBMS_flagP, rb_idP, sdu_sizeP, sduP, is_data_planeP);
pdcp_data_ind (eNB_id, UE_id, frame, eNB_flag, MBMS_flagP, rb_idP % NB_RB_MAX, sdu_sizeP, sduP, is_data_planeP);
}
//-----------------------------------------------------------------------------
void rlc_data_conf (module_id_t module_idP, u32_t frame, u8_t eNB_flag, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP, boolean_t is_data_planeP) {
......@@ -540,7 +562,7 @@ void rlc_data_conf (module_id_t module_idP, u32_t frame, u8_t eNB_flag, rb_i
}
//-----------------------------------------------------------------------------
int
rlc_module_init ()
rlc_module_init (void)
{
//-----------------------------------------------------------------------------
int i;
......@@ -557,19 +579,19 @@ rlc_module_init ()
}
//-----------------------------------------------------------------------------
void
rlc_module_cleanup ()
rlc_module_cleanup (void)
//-----------------------------------------------------------------------------
{
}
//-----------------------------------------------------------------------------
void
rlc_layer_init ()
rlc_layer_init (void)
{
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
void
rlc_layer_cleanup ()
rlc_layer_cleanup (void)
//-----------------------------------------------------------------------------
{
}
......
......@@ -174,8 +174,10 @@ typedef struct {
#define RLC_MAX_LC ((max_val_DRB_Identity+1)* MAX_MOBILES_PER_RG)
#endif
protected_rlc(void (*rlc_rrc_data_ind) (module_id_t , u32_t, u8_t, rb_id_t , sdu_size_t , u8_t* );)
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.
......@@ -309,8 +311,7 @@ public_rlc_rrc( rlc_op_status_t rrc_rlc_data_req (module_id_t, u32_t, u8_t,
* \param[in] rrc_data_indP Pointer on RRC data indicate function.
* \param[in] rrc_data_confP Pointer on RRC data confirm callback function.
*/
public_rlc_rrc( void rrc_rlc_register_rrc ( void (*rrc_data_indP) (module_id_t , u32_t, u8_t, rb_id_t , sdu_size_t , u8_t*),
void (*rrc_data_conf) (module_id_t , rb_id_t , mui_t, rlc_tx_status_t) );)
public_rlc_rrc(void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t rrc_data_confP);)
//-----------------------------------------------------------------------------
// PUBLIC INTERFACE WITH MAC
......@@ -409,7 +410,7 @@ 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, 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_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);)
/*! \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)
......
......@@ -265,7 +265,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t module_idP, u32_t frameP, u
#ifdef Rel10
if (pmch_info_listP != NULL) {
LOG_I(RRC,"[%s %d] Config RLC instant for MBMS\n", (eNB_flagP) ? "eNB" : "UE", module_idP);
LOG_I(RLC,"[%s %d] Config RLC instance for MBMS\n", (eNB_flagP) ? "eNB" : "UE", (eNB_flagP) ? module_idP : module_idP - NB_eNB_INST);
for (cnt=0;cnt<pmch_info_listP->list.count;cnt++) {
pmch_info_r9 = pmch_info_listP->list.array[cnt];
......@@ -278,6 +278,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t module_idP, u32_t frameP, u
// lc_id = (NUMBER_OF_UE_MAX*NB_RB_MAX) + mbms_session->logicalChannelIdentity_r9;
// test this one and tell Lionel
if (eNB_flagP) {
/* SR: (maxDRB = 11 + 3) * 16 = 224... */
lc_id = mbms_session->logicalChannelIdentity_r9 + (maxDRB + 3) * MAX_MOBILES_PER_RG;
} else {
lc_id = mbms_session->logicalChannelIdentity_r9 + (maxDRB + 3);
......@@ -560,19 +561,19 @@ rlc_op_status_t rrc_rlc_data_req (module_id_t module_idP, u32_t frame, u8_t
//-----------------------------------------------------------------------------
mem_block_t* sdu;
u8_t UE_id = module_idP - NB_eNB_INST;
sdu = get_free_mem_block(sdu_sizeP);
if (sdu != NULL) {
// msg("[RRC_RLC] MEM_ALLOC %p\n",sdu);
memcpy (sdu->data, sduP, sdu_sizeP);
return rlc_data_req(module_idP, frame, eNB_flagP, MBMS_flagP, rb_idP, muiP, confirmP, sdu_sizeP, sdu);
return rlc_data_req(module_idP, frame, eNB_flagP, MBMS_flagP, rb_idP /* + (UE_id * NB_RB_MAX) */, muiP, confirmP, sdu_sizeP, sdu);
} else {
return RLC_OP_STATUS_INTERNAL_ERROR;
}
}
//-----------------------------------------------------------------------------
void rrc_rlc_register_rrc ( void (*rrc_data_indP) (module_id_t module_idP, u32_t frame, u8_t eNB_id, rb_id_t rb_idP, sdu_size_t sdu_sizeP, u8_t* sduP),
void (*rrc_data_confP) (module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP) ) {
void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t rrc_data_confP) {
//-----------------------------------------------------------------------------
rlc_rrc_data_ind = rrc_data_indP;
rlc_rrc_data_conf = rrc_data_confP;
......
......@@ -132,11 +132,11 @@ int rrc_rg_send_to_srb_rlc (int UE_id, int rb_id, char * data_buffer, int data_l
case RRC_SRB0_ID: //CCCH
case RRC_SRB1_ID: //DCCH-UM
//result = rrc_rlc_data_req(Mod_id,protocol_bs->rrc.current_SFN, eNB_flag,(UE_id*NB_RB_MAX)+DCCH,protocol_bs->rrc.next_MUI++,RRC_RLC_CONFIRM_NO,data_length,tx_data);
if (pdcp_data_req(Mod_id,protocol_bs->rrc.current_SFN, eNB_flag,(UE_id*NB_RB_MAX)+DCCH,protocol_bs->rrc.next_MUI++,RRC_RLC_CONFIRM_NO,data_length,tx_data,1))
if (pdcp_data_req(0, Mod_id,protocol_bs->rrc.current_SFN, eNB_flag,(UE_id*NB_RB_MAX)+DCCH,protocol_bs->rrc.next_MUI++,RRC_RLC_CONFIRM_NO,data_length,tx_data,1))
result = 1;
break;
case RRC_SRB2_ID: //DCCH-AM
if (pdcp_data_req(Mod_id,protocol_bs->rrc.current_SFN, eNB_flag,(UE_id*NB_RB_MAX)+DCCH,protocol_bs->rrc.next_MUI++,RRC_RLC_CONFIRM_YES,data_length,tx_data,1))
if (pdcp_data_req(0, Mod_id,protocol_bs->rrc.current_SFN, eNB_flag,(UE_id*NB_RB_MAX)+DCCH,protocol_bs->rrc.next_MUI++,RRC_RLC_CONFIRM_YES,data_length,tx_data,1))
result = 1;
break;
case RRC_SRB3_ID: //DCCH-AM - NAS
......@@ -462,7 +462,7 @@ void rrc_rg_config_LTE_srb1 (unsigned char Mod_id){
msg("[eNB %d] CALLING PDCP + RLC CONFIG SRB1 (rbid %d) for UE %d\n", Mod_id,srb1,UE_index);
/* rrc_pdcp_config_req (Mod_id, protocol_bs->rrc.current_SFN, eNB_flag, ACTION_ADD, srb1);
rrc_rlc_config_req(Mod_id,protocol_bs->rrc.current_SFN,eNB_flag,ACTION_ADD,srb1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);*/
rrc_pdcp_config_asn1_req(Mod_id,protocol_bs->rrc.current_SFN,eNB_flag,UE_index,
rrc_pdcp_config_asn1_req(Mod_id,UE_index,protocol_bs->rrc.current_SFN,eNB_flag,
protocol_bs->rrc.rg_rb_asn1.SRB_configList[UE_index],
(DRB_ToAddModList_t*)NULL,
(DRB_ToReleaseList_t*)NULL
......@@ -538,7 +538,7 @@ void rrc_rg_config_LTE_srb2 (unsigned char Mod_id){
msg("[eNB %d] CALLING PDCP + RLC CONFIG SRB2 (rbid %d) for UE %d\n", Mod_id,srb2,UE_index);
/* rrc_pdcp_config_req (Mod_id, protocol_bs->rrc.current_SFN, eNB_flag, ACTION_ADD, srb2);
rrc_rlc_config_req(Mod_id,protocol_bs->rrc.current_SFN,eNB_flag,ACTION_ADD,srb2,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);*/
rrc_pdcp_config_asn1_req(Mod_id,protocol_bs->rrc.current_SFN,eNB_flag,UE_index,
rrc_pdcp_config_asn1_req(Mod_id,UE_index,protocol_bs->rrc.current_SFN,eNB_flag,
protocol_bs->rrc.rg_rb_asn1.SRB_configList[UE_index],
(DRB_ToAddModList_t*)NULL,
(DRB_ToReleaseList_t*)NULL
......@@ -628,7 +628,7 @@ void rrc_rg_config_LTE_default_drb (unsigned char Mod_id){
// (UE_index * NB_RB_MAX) + (int)*protocol_bs->rrc.rg_rb_asn1.DRB1_config->logicalChannelIdentity,
// RADIO_ACCESS_BEARER,Rlc_info_um);
rrc_pdcp_config_asn1_req(Mod_id,protocol_bs->rrc.current_SFN,eNB_flag,UE_index,
rrc_pdcp_config_asn1_req(Mod_id,UE_index,protocol_bs->rrc.current_SFN,eNB_flag,
(SRB_ToAddModList_t*)NULL,
protocol_bs->rrc.rg_rb_asn1.DRB_configList[UE_index],
(DRB_ToReleaseList_t*)NULL
......
......@@ -482,7 +482,7 @@ void rrc_ue_config_LTE_srb1 (void){
msg ("[RRC-UE-FRONTEND] Parameters : Mod_id %d, eNB_flag %d, UE_index %d, NB_eNB_INST %d \n",Mod_id, eNB_flag, UE_index, NB_eNB_INST);
// rrc_pdcp_config_req (Mod_id+NB_eNB_INST, protocol_ms->rrc.current_SFN, eNB_flag, ACTION_ADD, srb1);
// rrc_rlc_config_req(Mod_id+NB_eNB_INST, protocol_ms->rrc.current_SFN, eNB_flag, ACTION_ADD, srb1, SIGNALLING_RADIO_BEARER, Rlc_info_am_config);
rrc_pdcp_config_asn1_req(Mod_id+NB_eNB_INST,protocol_ms->rrc.current_SFN,eNB_flag,UE_index,
rrc_pdcp_config_asn1_req(Mod_id,UE_index,protocol_ms->rrc.current_SFN,eNB_flag,
protocol_ms->rrc.ue_rb_asn1.SRB_configList[UE_index],
(DRB_ToAddModList_t*)NULL,
(DRB_ToReleaseList_t*)NULL
......@@ -558,7 +558,7 @@ void rrc_ue_config_LTE_srb2 (void){
msg("[UE %d], CONFIG_SRB2 %d corresponding to eNB_index %d\n", Mod_id,srb2,eNB_index);
// rrc_pdcp_config_req (Mod_id+NB_eNB_INST, protocol_ms->rrc.current_SFN, eNB_flag, ACTION_ADD, srb2);
// rrc_rlc_config_req(Mod_id+NB_eNB_INST,protocol_ms->rrc.current_SFN,eNB_flag,ACTION_ADD,srb2,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
rrc_pdcp_config_asn1_req(Mod_id+NB_eNB_INST,protocol_ms->rrc.current_SFN,eNB_flag,UE_index,
rrc_pdcp_config_asn1_req(Mod_id,UE_index,protocol_ms->rrc.current_SFN,eNB_flag,
protocol_ms->rrc.ue_rb_asn1.SRB_configList[UE_index],
(DRB_ToAddModList_t*)NULL,
(DRB_ToReleaseList_t*)NULL
......@@ -633,7 +633,7 @@ void rrc_ue_config_LTE_default_drb (unsigned char Mod_id){
rrc_rlc_config_req(Mod_id+NB_eNB_INST,protocol_ms->rrc.current_SFN,eNB_flag,ACTION_ADD,
(UE_index * NB_RB_MAX) + (int)*protocol_ms->rrc.ue_rb_asn1.DRB1_config->logicalChannelIdentity,
RADIO_ACCESS_BEARER,Rlc_info_um);*/
rrc_pdcp_config_asn1_req(Mod_id+NB_eNB_INST,protocol_ms->rrc.current_SFN,eNB_flag,UE_index,
rrc_pdcp_config_asn1_req(Mod_id,UE_index,protocol_ms->rrc.current_SFN,eNB_flag,
(SRB_ToAddModList_t*)NULL,
protocol_ms->rrc.ue_rb_asn1.DRB_configList[UE_index],
(DRB_ToReleaseList_t*)NULL
......
......@@ -107,35 +107,35 @@ s8 mac_rrc_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu,u16 Sdu_len,u8 eNB
}
/********************************************************************************************************************/
void rlcrrc_data_ind(module_id_t Mod_id, u32 frame, u8 eNB_flag, unsigned int Srb_id, unsigned int Sdu_size,u8 *Buffer){
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){
/********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_rlc_data_ind_rx(Mod_id,Srb_id, Sdu_size, Buffer);
#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(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);
#endif //CELLULAR
}
/********************************************************************************************************************/
u8 pdcp_rrc_data_req(u8 module_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 muiP, u32 confirmP,
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) {
/********************************************************************************************************************/
#ifdef CELLULAR
return pdcp_data_req( module_id, frame, eNB_flag, rb_id, muiP, confirmP, sdu_buffer_size, sdu_buffer, mode);
#else
return rrc_lite_data_req (module_id, frame, eNB_flag, rb_id, muiP, confirmP, sdu_buffer_size, sdu_buffer, mode);
return rrc_lite_data_req (eNB_id, UE_id, frame, eNB_flag, rb_id, muiP, confirmP, sdu_buffer_size, sdu_buffer, mode);
#endif
}
/********************************************************************************************************************/
void pdcp_rrc_data_ind( u8 Mod_id, u32 frame, u8 eNB_flag, unsigned int Srb_id, unsigned int Sdu_size,u8 *Buffer){
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){
/********************************************************************************************************************/
#ifdef CELLULAR
rrc_L2_rlc_data_ind_rx(Mod_id,Srb_id, Sdu_size, Buffer);
#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(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);
#endif //CELLULAR
}
......
......@@ -50,12 +50,12 @@ void mac_lite_sync_ind(u8 Mod_id, u8 status);
void mac_rrc_meas_ind(u8, MAC_MEAS_REQ_ENTRY*);
void rlcrrc_data_ind(module_id_t Mod_id, u32 frame, u8 eNB_flag, unsigned int Rb_id, u32 sdu_size, u8 *Buffer);
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);
u8 pdcp_rrc_data_req(u8 module_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 muiP, u32 confirmP,
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);
void pdcp_rrc_data_ind(u8 Mod_id, u32 frame, u8 eNB_flag, unsigned int Srb_id, unsigned int Sdu_size, u8 *Buffer);
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 mac_out_of_sync_ind(u8 Mod_id, u32 frame, u16 CH_index);
......
......@@ -476,7 +476,7 @@ void mac_lite_sync_ind(u8 Mod_id,u8 Status){
}
//-------------------------------------------------------------------------------------------//
u8 rrc_lite_data_req(u8 Mod_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 muiP, u32 confirmP,
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) {
//-------------------------------------------------------------------------------------------//
#if defined(ENABLE_ITTI)
......@@ -497,26 +497,33 @@ u8 rrc_lite_data_req(u8 Mod_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32
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;
itti_send_msg_to_task (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, Mod_id, message_p);
itti_send_msg_to_task (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, eNB_flag ? eNB_id : NB_eNB_INST + UE_id, 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 (Mod_id, frame, eNB_flag, rb_id, muiP, confirmP, sdu_size, Buffer, mode);
return pdcp_data_req (eNB_id, UE_id, frame, eNB_flag, rb_id, muiP, confirmP, sdu_size, Buffer, mode);
#endif
}
//-------------------------------------------------------------------------------------------//
void rrc_lite_data_ind(module_id_t Mod_id, u32 frame, u8 eNB_flag,u32 Srb_id, u32 sdu_size,u8 *Buffer){
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){
//-------------------------------------------------------------------------------------------//
u8 UE_index=(Srb_id-1)/NB_RB_MAX;
u8 DCCH_index = Srb_id % NB_RB_MAX;
LOG_N(RRC,"[%s %d] Frame %d: received a DCCH %d message on SRB %d with Size %d\n",
(eNB_flag == 1)? "eNB": "UE",
(eNB_flag == 1)? Mod_id : UE_index,
frame, DCCH_index,Srb_id-1,sdu_size);
u8_t Mod_id;
if (eNB_flag == 0) {
Mod_id = UE_id + 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);
} else {
Mod_id = eNB_id;
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);
}
#if defined(ENABLE_ITTI)
{
......@@ -532,16 +539,17 @@ void rrc_lite_data_ind(module_id_t Mod_id, u32 frame, u8 eNB_flag,u32 Srb_id, u3
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_index;
RRC_DCCH_DATA_IND (message_p).ue_index = UE_id;
RRC_DCCH_DATA_IND (message_p).eNB_index = eNB_id;
itti_send_msg_to_task ((eNB_flag == 1) ? TASK_RRC_ENB : TASK_RRC_UE, Mod_id, message_p);
}
#else
if (eNB_flag ==1) {
rrc_eNB_decode_dcch(Mod_id,frame,DCCH_index,UE_index,Buffer,sdu_size);
rrc_eNB_decode_dcch(eNB_id,frame,DCCH_index,UE_id,Buffer,sdu_size);
}
else {
rrc_ue_decode_dcch(Mod_id-NB_eNB_INST,frame,DCCH_index,Buffer,UE_index);
rrc_ue_decode_dcch(UE_id,frame,DCCH_index,Buffer,eNB_id);
}
#endif
}
......
......@@ -514,7 +514,7 @@ s32 rrc_ue_establish_drb(u8 Mod_id,u32 frame,u8 eNB_index,struct DRB_ToAddMod *
\param eNB_index Index of corresponding CH/eNB
\param mobilityControlInfo Pointer to mobilityControlInfo
*/
void rrc_ue_process_mobilityControlInfo(u8 Mod_id,u32 frame, u8 eNB_index,struct MobilityControlInfo *mobilityControlInfo);
void rrc_ue_process_mobilityControlInfo(u8 eNB_index, u8 UE_id, u32 frame, struct MobilityControlInfo *mobilityControlInfo);
/** \brief Process a measConfig Message and configure PHY/MAC
\param Mod_id Instance of UE on which to act
......@@ -594,10 +594,10 @@ s8 mac_rrc_lite_data_ind( u8 Mod_id, u32 frame, unsigned short Srb_id, u8 *Sdu,
void mac_sync_ind( u8 Mod_id, u8 status);
u8 rrc_lite_data_req(u8 Mod_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 muiP, u32 confirmP,
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);
void rrc_lite_data_ind(module_id_t Mod_id, u32 frame, u8 eNB_flag, u32 Rb_id, u32 sdu_size,u8 *Buffer);
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_in_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index);
......
......@@ -283,7 +283,7 @@ void rrc_ue_generate_RRCConnectionSetupComplete(u8 Mod_id, u32 frame, u8 eNB_ind
frame, Mod_id+NB_eNB_INST, size, eNB_index, rrc_mui, Mod_id+NB_eNB_INST, DCCH);
// rrc_rlc_data_req(Mod_id+NB_eNB_INST,frame, 0 ,DCCH,rrc_mui++,0,size,(char*)buffer);
pdcp_rrc_data_req (Mod_id + NB_eNB_INST, frame, 0, DCCH, rrc_mui++, 0, size, buffer, 1);
pdcp_rrc_data_req (eNB_index, Mod_id, frame, 0, DCCH, rrc_mui++, 0, size, buffer, 1);
}
......@@ -299,7 +299,7 @@ void rrc_ue_generate_RRCConnectionReconfigurationComplete(u8 Mod_id, u32 frame,
frame, Mod_id+NB_eNB_INST, size, eNB_index, rrc_mui, Mod_id+NB_eNB_INST, DCCH);
//rrc_rlc_data_req(Mod_id+NB_eNB_INST,frame, 0 ,DCCH,rrc_mui++,0,size,(char*)buffer);
pdcp_rrc_data_req (Mod_id + NB_eNB_INST, frame, 0, DCCH, rrc_mui++, 0, size, buffer, 1);
pdcp_rrc_data_req (eNB_index, Mod_id, frame, 0, DCCH, rrc_mui++, 0, size, buffer, 1);
}
/*------------------------------------------------------------------------------*/
......@@ -485,8 +485,8 @@ s32 rrc_ue_establish_drb(u8 Mod_id,u32 frame,u8 eNB_index,
int oip_ifup=0,ip_addr_offset3=0,ip_addr_offset4=0;
#endif
LOG_I(RRC,"[UE] Frame %d: processing RRCConnectionReconfiguration: reconfiguring DRB %ld/LCID %d\n",
frame,DRB_config->drb_Identity,(int)*DRB_config->logicalChannelIdentity);
LOG_I(RRC,"[UE %d] Frame %d: processing RRCConnectionReconfiguration: reconfiguring DRB %ld/LCID %d\n",
Mod_id, frame, DRB_config->drb_Identity, (int)*DRB_config->logicalChannelIdentity);
/*
rrc_pdcp_config_req (Mod_id+NB_eNB_INST, frame, 0, ACTION_ADD,
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity, UNDEF_SECURITY_MODE);
......@@ -789,7 +789,7 @@ rrc_ue_process_radioResourceConfigDedicated(u8 Mod_id,u32 frame, u8 eNB_index,
#endif
// Refresh SRBs
rrc_pdcp_config_asn1_req(NB_eNB_INST+Mod_id,frame,0,eNB_index,
rrc_pdcp_config_asn1_req(eNB_index,Mod_id,frame,0,
radioResourceConfigDedicated->srb_ToAddModList,
(DRB_ToAddModList_t*)NULL,
(DRB_ToReleaseList_t*)NULL,
......@@ -939,7 +939,7 @@ rrc_ue_process_radioResourceConfigDedicated(u8 Mod_id,u32 frame, u8 eNB_index,
#endif
// Refresh DRBs
rrc_pdcp_config_asn1_req(NB_eNB_INST+Mod_id,frame,0,eNB_index,
rrc_pdcp_config_asn1_req(eNB_index, Mod_id,frame,0,
(SRB_ToAddModList_t*)NULL,
radioResourceConfigDedicated->drb_ToAddModList,
(DRB_ToReleaseList_t*)NULL,
......@@ -1098,7 +1098,7 @@ void rrc_ue_process_securityModeCommand(uint8_t Mod_id,uint32_t frame,SecurityMo
for (i = 0; i < (enc_rval.encoded + 7) / 8; i++)
LOG_T(RRC, "%02x.", buffer[i]);
LOG_T(RRC, "\n");
pdcp_rrc_data_req (Mod_id + NB_eNB_INST, frame, 0, DCCH, rrc_mui++, 0, (enc_rval.encoded + 7) / 8, buffer, 1);
pdcp_rrc_data_req (eNB_index, Mod_id, frame, 0, DCCH, rrc_mui++, 0, (enc_rval.encoded + 7) / 8, buffer, 1);
}
}
......@@ -1160,7 +1160,7 @@ void rrc_ue_process_ueCapabilityEnquiry(uint8_t Mod_id,uint32_t frame,UECapabili
for (i = 0; i < (enc_rval.encoded + 7) / 8; i++)
LOG_T(RRC, "%02x.", buffer[i]);
LOG_T(RRC, "\n");
pdcp_rrc_data_req (Mod_id + NB_eNB_INST, frame, 0, DCCH, rrc_mui++, 0, (enc_rval.encoded + 7) / 8, buffer, 1);
pdcp_rrc_data_req (eNB_index, Mod_id, frame, 0, DCCH, rrc_mui++, 0, (enc_rval.encoded + 7) / 8, buffer, 1);
}
}
}
......@@ -1181,7 +1181,7 @@ void rrc_ue_process_rrcConnectionReconfiguration(u8 Mod_id, u32 frame,
if (rrcConnectionReconfiguration_r8->mobilityControlInfo) {
LOG_I(RRC,"Mobility Control Information is present\n");
rrc_ue_process_mobilityControlInfo(Mod_id,frame, eNB_index, rrcConnectionReconfiguration_r8->mobilityControlInfo);
rrc_ue_process_mobilityControlInfo(Mod_id, eNB_index, frame, rrcConnectionReconfiguration_r8->mobilityControlInfo);
}
if (rrcConnectionReconfiguration_r8->measConfig != NULL) {
......@@ -1207,11 +1207,11 @@ void rrc_ue_process_rrcConnectionReconfiguration(u8 Mod_id, u32 frame,
pdu_buffer = rrcConnectionReconfiguration_r8->dedicatedInfoNASList->list.array[list_count]->buf;
msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_DOWNLINK_DATA_IND);
NAS_DOWNLINK_DATA_IND(msg_p).UEid = Mod_id; // TODO set the UEid to something else ?
NAS_DOWNLINK_DATA_IND(msg_p).UEid = Mod_id - NB_eNB_INST;
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = pdu_length;
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = pdu_buffer;
itti_send_msg_to_task(TASK_NAS_UE, Mod_id + NB_eNB_INST, msg_p);
itti_send_msg_to_task(TASK_NAS_UE, Mod_id, msg_p);
}
free (rrcConnectionReconfiguration_r8->dedicatedInfoNASList);
......@@ -1253,16 +1253,18 @@ void rrc_ue_process_rrcConnectionReconfiguration(u8 Mod_id, u32 frame,
}
/* 36.331, 5.3.5.4 Reception of an RRCConnectionReconfiguration including the mobilityControlInfo by the UE (handover) */
void rrc_ue_process_mobilityControlInfo(u8 Mod_id,u32 frame, u8 eNB_index,struct MobilityControlInfo *mobilityControlInfo) {
void rrc_ue_process_mobilityControlInfo(u8 eNB_index, u8 UE_id, u32 frame, struct MobilityControlInfo *mobilityControlInfo)
{
u8 Mod_id = NB_eNB_INST + UE_id;
/*
DRB_ToReleaseList_t* drb2release_list;
DRB_Identity_t *lcid;
*/
LOG_N(RRC,"Note: This function needs some updates\n");
if(UE_rrc_inst[Mod_id].Info[eNB_index].T310_active == 1)
UE_rrc_inst[Mod_id].Info[eNB_index].T310_active = 0;
UE_rrc_inst[Mod_id].Info[eNB_index].T304_active = 1;
UE_rrc_inst[Mod_id].Info[eNB_index].T304_cnt = T304[mobilityControlInfo->t304];
if(UE_rrc_inst[UE_id].Info[eNB_index].T310_active == 1)
UE_rrc_inst[UE_id].Info[eNB_index].T310_active = 0;
UE_rrc_inst[UE_id].Info[eNB_index].T304_active = 1;
UE_rrc_inst[UE_id].Info[eNB_index].T304_cnt = T304[mobilityControlInfo->t304];
/*
drb2release_list = CALLOC (1, sizeof (*drb2release_list));
......@@ -1274,15 +1276,15 @@ void rrc_ue_process_mobilityControlInfo(u8 Mod_id,u32 frame, u8 eNB_index,stru
*/
//Removing SRB1 and SRB2 and DRB0
LOG_N(RRC,"[UE %d] : Update needed for rrc_pdcp_config_req (deprecated) and rrc_rlc_config_req commands(deprecated)\n",Mod_id);
rrc_pdcp_config_req (Mod_id+NB_eNB_INST, frame, 0, ACTION_REMOVE, Mod_id+DCCH,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(Mod_id+NB_eNB_INST,frame,0,ACTION_REMOVE,Mod_id+DCCH,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
LOG_N(RRC,"[UE %d] : Update needed for rrc_pdcp_config_req (deprecated) and rrc_rlc_config_req commands(deprecated)\n", UE_id);
rrc_pdcp_config_req (eNB_index, UE_id, frame, 0, ACTION_REMOVE, DCCH,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(Mod_id,frame,0,ACTION_REMOVE,Mod_id+DCCH,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
rrc_pdcp_config_req (Mod_id+NB_eNB_INST, frame, 0, ACTION_REMOVE, Mod_id+DCCH1,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(Mod_id+NB_eNB_INST,frame,0,ACTION_REMOVE,Mod_id+DCCH1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
rrc_pdcp_config_req (eNB_index, UE_id, frame, 0, ACTION_REMOVE, DCCH1,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(Mod_id,frame,0,ACTION_REMOVE,Mod_id+DCCH1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
rrc_pdcp_config_req (Mod_id+NB_eNB_INST, frame, 0, ACTION_REMOVE, Mod_id+DTCH,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(Mod_id+NB_eNB_INST,frame,0,ACTION_REMOVE,Mod_id+DTCH,RADIO_ACCESS_BEARER,Rlc_info_um);
rrc_pdcp_config_req (eNB_index, UE_id, frame, 0, ACTION_REMOVE, DTCH,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(Mod_id,frame,0,ACTION_REMOVE,Mod_id+DTCH,RADIO_ACCESS_BEARER,Rlc_info_um);
/*
rrc_pdcp_config_asn1_req(NB_eNB_INST+Mod_id,frame, 0,eNB_index,
NULL, // SRB_ToAddModList
......@@ -2030,11 +2032,9 @@ int decode_SI(u8 Mod_id,u32 frame,u8 eNB_index,u8 si_window) {
NULL,
NULL,
(MBSFN_SubframeConfigList_t *)NULL
#ifdef Rel10
,0,
&UE_rrc_inst[Mod_id].sib13[eNB_index]->mbsfn_AreaInfoList_r9,
(PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
,0,
0
......@@ -2114,7 +2114,7 @@ void ue_meas_filtering(u8 Mod_id,u32 frame,u8 eNB_index){
}
//Below routine implements Measurement Reporting procedure from 36.331 Section 5.5.5
void rrc_ue_generate_MeasurementReport(u8 Mod_id, u32 frame,u8 eNB_index) {
void rrc_ue_generate_MeasurementReport(u8 eNB_id, u8 UE_id, u32 frame) {
u8 buffer[32], size;
u8 i;
......@@ -2127,38 +2127,38 @@ void rrc_ue_generate_MeasurementReport(u8 Mod_id, u32 frame,u8 eNB_index) {
nElem = 100;
nElem1 = 33;
static u32 pframe=0;
target_eNB_offset = UE_rrc_inst[Mod_id].Info[0].handoverTarget; // eNB_offset of target eNB: used to obtain the mod_id of target eNB
target_eNB_offset = UE_rrc_inst[UE_id].Info[0].handoverTarget; // eNB_offset of target eNB: used to obtain the mod_id of target eNB
for (i=0;i<MAX_MEAS_ID;i++) {
if (UE_rrc_inst[Mod_id].measReportList[0][i] != NULL) {
measId = UE_rrc_inst[Mod_id].measReportList[0][i]->measId;
if (UE_rrc_inst[UE_id].measReportList[0][i] != NULL) {
measId = UE_rrc_inst[UE_id].measReportList[0][i]->measId;
// Note: Values in the meas report have to be the mapped values...to implement binary search for LUT
rsrp_filtered = UE_rrc_inst[Mod_id].rsrp_db_filtered[eNB_index];//nid_cell];
rsrp_filtered = UE_rrc_inst[UE_id].rsrp_db_filtered[eNB_id];//nid_cell];
rsrp_s = binary_search_float(RSRP_meas_mapping,nElem, rsrp_filtered); //mapped RSRP of serving cell
rsrq_filtered = UE_rrc_inst[Mod_id].rsrq_db_filtered[eNB_index];//nid_cell]; //RSRQ of serving cell
rsrq_filtered = UE_rrc_inst[UE_id].rsrq_db_filtered[eNB_id];//nid_cell]; //RSRQ of serving cell
rsrq_s = binary_search_float(RSRQ_meas_mapping,nElem1,rsrp_filtered);//mapped RSRQ of serving cell
LOG_D(RRC,"[UE %d] Frame %d: source eNB %d :rsrp_s: %d rsrq_s: %d tmp: %f tmp1: %f \n",
Mod_id,frame,eNB_index, rsrp_s,rsrq_s,rsrp_filtered,rsrq_filtered);
UE_id, frame, eNB_id, rsrp_s,rsrq_s,rsrp_filtered,rsrq_filtered);
rsrp_t = binary_search_float(RSRP_meas_mapping,nElem,UE_rrc_inst[Mod_id].rsrp_db_filtered[target_eNB_offset]); //RSRP of target cell
rsrq_t = binary_search_float(RSRQ_meas_mapping,nElem1,UE_rrc_inst[Mod_id].rsrq_db_filtered[target_eNB_offset]); //RSRQ of target cell
rsrp_t = binary_search_float(RSRP_meas_mapping,nElem,UE_rrc_inst[UE_id].rsrp_db_filtered[target_eNB_offset]); //RSRP of target cell
rsrq_t = binary_search_float(RSRQ_meas_mapping,nElem1,UE_rrc_inst[UE_id].rsrq_db_filtered[target_eNB_offset]); //RSRQ of target cell
// if (measFlag == 1) {
cellId = get_adjacent_cell_id(Mod_id,eNB_index); //PhycellId of serving cell
targetCellId = UE_rrc_inst[Mod_id].HandoverInfoUe.targetCellId ;//get_adjacent_cell_id(Mod_id,target_eNB_offset); //PhycellId of target cell
cellId = get_adjacent_cell_id(UE_id, eNB_id); //PhycellId of serving cell
targetCellId = UE_rrc_inst[UE_id].HandoverInfoUe.targetCellId ;//get_adjacent_cell_id(Mod_id,target_eNB_offset); //PhycellId of target cell
if (pframe!=frame){
pframe=frame;
size = do_MeasurementReport(buffer,measId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t);
LOG_D(RRC,"[UE %d] Frame %d: Sending MeasReport: servingCell(%d) targetCell(%d) rsrp_s(%d) rsrq_s(%d) rsrp_t(%d) rsrq_t(%d) \n",
Mod_id, frame, cellId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t);
LOG_I(RRC,"[UE %d] Frame %d : Generating Measurement Report for eNB %d\n",Mod_id,frame,eNB_index);
LOG_D(RLC,"[MSC_MSG][FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (MeasurementReport to eNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
frame, Mod_id+NB_eNB_INST, size, eNB_index, rrc_mui, Mod_id+NB_eNB_INST, DCCH);
pdcp_data_req(Mod_id+NB_eNB_INST,frame,0,DCCH,rrc_mui++,0,size,buffer,1);
LOG_D(RRC, "[UE %d] Frame %d: Sending MeasReport: servingCell(%d) targetCell(%d) rsrp_s(%d) rsrq_s(%d) rsrp_t(%d) rsrq_t(%d) \n",
UE_id, frame, cellId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t);
LOG_I(RRC, "[UE %d] Frame %d : Generating Measurement Report for eNB %d\n", UE_id, frame, eNB_id);
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_UE][UE %02d][][--- PDCP_DATA_REQ/%d Bytes (MeasurementReport to eNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
frame, UE_id, size, eNB_id, rrc_mui, eNB_id, DCCH);
pdcp_data_req(eNB_id, UE_id, frame, 0, DCCH, rrc_mui++, 0, size, buffer, 1);
//LOG_D(RRC, "[UE %d] Frame %d Sending MeasReport (%d bytes) through DCCH%d to PDCP \n",Mod_id,frame, size, DCCH);
}
// measFlag = 0; //re-setting measFlag so that no more MeasReports are sent in this frame
......@@ -2371,7 +2371,7 @@ void decode_MBSFNAreaConfiguration(u8 Mod_id, u8 eNB_index, u32 frame,u8 mbsfn_s
UE_rrc_inst[Mod_id].Info[eNB_index].MCCHStatus[mbsfn_sync_area] = 1;
// Config Radio Bearer for MBMS user data (similar way to configure for eNB side in init_MBMS function)
rrc_pdcp_config_asn1_req(NB_eNB_INST+Mod_id,frame,0,eNB_index,
rrc_pdcp_config_asn1_req(eNB_index, Mod_id, frame, 0,
NULL, // SRB_ToAddModList
NULL, // DRB_ToAddModList
(DRB_ToReleaseList_t*)NULL,
......@@ -2489,12 +2489,12 @@ void *rrc_ue_task(void *args_p) {
/* PDCP messages */
case RRC_DCCH_DATA_IND:
LOG_I(RRC, "[UE %d] Received %s: frame %d, DCCH %d, UE %d\n", Mod_id, msg_name,
RRC_DCCH_DATA_IND (msg_p).frame, RRC_DCCH_DATA_IND (msg_p).dcch_index, RRC_DCCH_DATA_IND (msg_p).ue_index);
LOG_I(RRC, "[UE %d] Received %s: frame %d, DCCH %d, eNB %d\n", Mod_id, msg_name,
RRC_DCCH_DATA_IND (msg_p).frame, RRC_DCCH_DATA_IND (msg_p).dcch_index, RRC_DCCH_DATA_IND (msg_p).eNB_index);
rrc_ue_decode_dcch (Mod_id, RRC_DCCH_DATA_IND (msg_p).frame,
RRC_DCCH_DATA_IND (msg_p).dcch_index, RRC_DCCH_DATA_IND (msg_p).sdu_p,
RRC_DCCH_DATA_IND (msg_p).ue_index);
RRC_DCCH_DATA_IND (msg_p).eNB_index);
// Message buffer has been processed, free it now.
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND (msg_p).sdu_p);
......
......@@ -303,7 +303,7 @@ void rrc_t310_expiration(u32 frame, u8 Mod_id, u8 eNB_index) {
if (UE_rrc_inst[Mod_id].Srb2[eNB_index].Active == 1) {
msg ("[RRC Inst %d] eNB_index %d, Remove RB %d\n ", Mod_id, eNB_index,
UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id);
rrc_pdcp_config_req (Mod_id + NB_eNB_INST, frame, 0, ACTION_REMOVE,
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,
UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id, SIGNALLING_RADIO_BEARER, Rlc_info_um);
......
......@@ -417,7 +417,7 @@ static void init_MBMS (u8 Mod_id, u32 frame) {
LOG_D(RRC,"[eNB %d] Frame %d : Radio Bearer config request for MBMS\n", Mod_id, frame); //check the lcid
// Configuring PDCP and RLC for MBMS Radio Bearer
rrc_pdcp_config_asn1_req (Mod_id, frame, 1, 0,
rrc_pdcp_config_asn1_req (Mod_id, 0, frame, 1,
NULL, // SRB_ToAddModList
NULL, // DRB_ToAddModList
(DRB_ToReleaseList_t *) NULL,
......@@ -475,7 +475,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, uint8_t *UE_identity)
static uint8_t rrc_eNB_get_next_free_UE_index (uint8_t Mod_id, uint64_t UE_identity)
{
uint8_t i, first_index = UE_INDEX_INVALID, reg = 0;
......@@ -486,14 +486,14 @@ static uint8_t rrc_eNB_get_next_free_UE_index (uint8_t Mod_id, uint8_t *UE_ident
first_index = i; // save first free position
}
if (memcmp (&eNB_rrc_inst[Mod_id].Info.UE_list[i], UE_identity, sizeof(eNB_rrc_inst[0].Info.UE_list[i])) == 0) {
if (eNB_rrc_inst[Mod_id].Info.UE_list[i] == UE_identity) {
// UE_identity already registered
reg = 1;
}
}
if (reg == 0) {
LOG_I(RRC, "[eNB %d] Adding UE %d\n", Mod_id, first_index);
LOG_I(RRC, "[eNB %d] Adding UE %d with identity "PRIu64"\n", Mod_id, first_index, UE_identity);
return (first_index);
}
else {
......@@ -551,10 +551,9 @@ void rrc_eNB_generate_SecurityModeCommand (u8 Mod_id, u32 frame, u16 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,
(UE_index * NB_RB_MAX) + DCCH);
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, frame, 1, (UE_index * NB_RB_MAX) + DCCH,
pdcp_rrc_data_req (Mod_id, UE_index, frame, 1, DCCH,
rrc_eNB_mui++, 0, size, buffer, 1);
}
......@@ -575,10 +574,9 @@ void rrc_eNB_generate_UECapabilityEnquiry (u8 Mod_id, u32 frame, u16 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,
(UE_index * NB_RB_MAX) + DCCH);
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, frame, 1, (UE_index * NB_RB_MAX) + DCCH,
pdcp_rrc_data_req (Mod_id, UE_index, frame, 1, DCCH,
rrc_eNB_mui++, 0, size, buffer, 1);
}
......@@ -1083,10 +1081,9 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32
Mod_id, frame, 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,
(UE_index * NB_RB_MAX) + DCCH);
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, frame, 1, (UE_index * NB_RB_MAX) + DCCH,
pdcp_rrc_data_req (Mod_id, UE_index, frame, 1, DCCH,
rrc_eNB_mui++, 0, size, buffer, 1);
}
......@@ -1186,7 +1183,7 @@ void rrc_eNB_generate_HandoverPreparationInformation (u8 Mod_id, u32 frame, u8 U
if (mod_id_target != 0xFF) {
//UE_id_target = rrc_find_free_ue_index(modid_target);
UE_id_target = rrc_eNB_get_next_free_UE_index(mod_id_target,(u8 *) &eNB_rrc_inst[Mod_id].Info.UE_list[UE_index]); //this should return a new index
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);
......@@ -1243,7 +1240,7 @@ void check_handovers(u8 Mod_id, u32 frame) {
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);
pdcp_data_req(Mod_id,frame, 1,
pdcp_data_req(Mod_id, i, frame, 1,
(i* NB_RB_MAX)+DCCH,
rrc_eNB_mui++,0,
eNB_rrc_inst[Mod_id].handover_info[i]->size,
......@@ -1974,7 +1971,7 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover (u8 Mod_id, u32 fram
// 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_asn1_req (Mod_id, frame, 1, UE_index,
rrc_pdcp_config_asn1_req (Mod_id, UE_index, frame, 1,
eNB_rrc_inst[Mod_id].SRB_configList[UE_index],
(DRB_ToAddModList_t *) NULL,
(DRB_ToReleaseList_t *) NULL,
......@@ -2136,7 +2133,7 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete (u8 Mod_id, u32 frame,
#endif
// Refresh SRBs/DRBs
rrc_pdcp_config_asn1_req (Mod_id, frame, 1, UE_index,
rrc_pdcp_config_asn1_req (Mod_id, UE_index, frame, 1,
SRB_configList,
DRB_configList, (DRB_ToReleaseList_t *) NULL,
eNB_rrc_inst[Mod_id].ciphering_algorithm[UE_index] |
......@@ -2316,10 +2313,14 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete (u8 Mod_id, u32 frame,
void rrc_eNB_generate_RRCConnectionSetup (u8 Mod_id, u32 frame, u16 UE_index) {
LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig;
SRB_ToAddModList_t **SRB_configList = &eNB_rrc_inst[Mod_id].SRB_configList[UE_index];
SRB_ToAddModList_t **SRB_configList;
SRB_ToAddMod_t *SRB1_config;
int cnt;
DevCheck(UE_index < NUMBER_OF_UE_MAX, UE_index, NUMBER_OF_UE_MAX, 0);
SRB_configList = &eNB_rrc_inst[Mod_id].SRB_configList[UE_index];
eNB_rrc_inst[Mod_id].Srb0.Tx_buffer.payload_size =
do_RRCConnectionSetup ((u8 *) eNB_rrc_inst[Mod_id].Srb0.Tx_buffer.Payload,
mac_xface->get_transmission_mode (Mod_id,
......@@ -2612,9 +2613,12 @@ for (i = 0; i < 8; i++)
frame, Mod_id, Mod_id);
rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8;
UE_index = rrc_eNB_get_next_free_UE_index (Mod_id,
(u8 *) rrcConnectionRequest->ue_Identity.
choice.randomValue.buf);
{
uint64_t random_value = 0;
memcpy(((u8*)&random_value) + 3, rrcConnectionRequest->ue_Identity.choice.randomValue.buf, rrcConnectionRequest->ue_Identity.choice.randomValue.size);
UE_index = rrc_eNB_get_next_free_UE_index (Mod_id, random_value);
}
if (UE_index != UE_INDEX_INVALID)
{
......@@ -2678,7 +2682,7 @@ for (i = 0; i < 8; i++)
// rrc_rlc_config_req(Mod_id,frame,1,ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
rrc_pdcp_config_asn1_req (Mod_id, frame, 1, UE_index,
rrc_pdcp_config_asn1_req (Mod_id, UE_index, frame, 1,
eNB_rrc_inst[Mod_id].
SRB_configList[UE_index],
(DRB_ToAddModList_t *) NULL,
......
......@@ -164,125 +164,46 @@ def execute(oai, user, pw, logfile,logdir):
try:
test = '06'
name = 'Compile oai.rel10.make'
conf = 'make Rel10=1'
name = 'Compile oai.rel8.itti.make'
conf = 'make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel8=1'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for Rel10'
diag = 'check the compilation errors for ITTI Rel8'
oai.send('make clean;')
oai.send('make cleanall;')
oai.send('make cleanasn1;')
oai.send('rm -f ./oaisim.rel10;')
oai.send_expect_false('make Rel10=1 -j4' + tee, makerr1, 1500)
oai.send('cp ./oaisim ./oaisim.rel10;')
oai.send('rm -f ./oaisim.rel8.itti;')
oai.send_expect_false('make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel8=1 -j4' + tee, makerr1, 1500)
oai.send('cp ./oaisim ./oaisim.rel8.itti;')
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
#try:
#test = '07'
#name = 'Compile oai.rel8.cellular.eNB.make'
#conf = 'make rrc_cellular=1 eNB_flag=1'
#tee = ' | tee ' + logdir + '/log_' + case + test + '.txt;'
#diag = 'check the compilation errors for eNB/RG RRC Cellular'
#oai.send('make clean;')
#oai.send('make cleanall;')
#oai.send('make cleanasn1;')
#oai.send('rm -f ./oaisim.rel8.cellular.rg;')
#oai.send_expect_false('make rrc_cellular=1 eNB_flag=1 -j4' + tee, makerr1, 1500)
#oai.send('cp ./oaisim ./oaisim.rel8.cellular.rg;')
#except log.err, e:
#log.fail(case, test, name, conf, e.value, diag, logfile)
#log.skip(case, test, name, conf, '', '', logfile)
#else:
#log.ok(case, test, name, conf, '', logfile)
#log.skip(case, test, name, conf, '', '', logfile)
#try:
#test = '08'
#name = 'Compile oai.rel8.cellular.UE.make'
#conf = 'make rrc_cellular=1 UE_flag=1'
#tee = ' | tee ' + logdir + '/log_' + case + test + '.txt;'
#diag = 'check the compilation errors for UE/MT RRC Cellular'
#oai.send('make clean;')
#oai.send('make cleanall;')
#oai.send('make cleanasn1;')
#oai.send('rm -f ./oaisim.rel8.cellular.mt;')
#oai.send_expect_false('make rrc_cellular=1 UE_flag=1 -j4' + tee, makerr1, 1500)
#oai.send('cp ./oaisim ./oaisim.rel8.cellular.mt;')
#except log.err, e:
#log.fail(case, test, name, conf, e.value, diag, logfile)
#log.skip(case, test, name, conf, '', '', logfile)
#else:
#log.ok(case, test, name, conf, '', logfile)
#log.skip(case, test, name, conf, '', '', logfile)
#try:
#test = '09'
#name = 'Compile oai.rel8.cellular.nas.eNB'
#conf = 'make nas_sim_rg_cellular'
#tee = ' | tee ' + logdir + '/log_' + case + test + '.txt;'
#diag = 'check the compilation errors for NAS SIM RRC Cellular (node RG)'
#oai.send('make clean;')
#oai.send('make cleanall;')
#oai.send('make cleanasn1;')
#oai.send('make cleancell')
#oai.send('rm -f ./nas_sim_rg_cellular;')
#oai.send_expect_false('make nas_sim_rg_cellular -j4' + tee, makerr1, 1500)
#except log.err, e:
#log.fail(case, test, name, conf, e.value, diag, logfile)
#log.skip(case, test, name, conf, '', '', logfile)
#else:
#log.ok(case, test, name, conf, '', logfile)
#log.skip(case, test, name, conf, '', '', logfile)
#try:
#test = '10'
#name = 'Compile oai.rel8.cellular.nas.UE'
#conf = 'make nas_sim_mt_cellular'
#tee = ' | tee ' + logdir + '/log_' + case + test + '.txt;'
#diag = 'check the compilation errors for NAS SIM RRC Cellular (node MT)'
#oai.send('make clean;')
#oai.send('make cleanall;')
#oai.send('make cleanasn1;')
#oai.send('make cleancell')
#oai.send('rm -f ./nas_sim_mt_cellular;')
#oai.send_expect_false('make nas_sim_mt_cellular -j4' + tee, makerr1, 1500)
#except log.err, e:
#log.fail(case, test, name, conf, e.value, diag, logfile)
#log.skip(case, test, name, conf, '', '', logfile)
#else:
#log.ok(case, test, name, conf, '', logfile)
#log.skip(case, test, name, conf, '', '', logfile)
try:
test = '11'
name = 'Compile oai.rel8.itti.make'
conf = 'make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel8=1'
test = '07'
name = 'Compile oai.rel10.make'
conf = 'make Rel10=1'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for ITTI Rel8'
diag = 'check the compilation errors for Rel10'
oai.send('make clean;')
oai.send('make cleanall;')
oai.send('make cleanasn1;')
oai.send('rm -f ./oaisim.rel8.itti;')
oai.send_expect_false('make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel8=1 -j4' + tee, makerr1, 1500)
oai.send('cp ./oaisim ./oaisim.rel8.itti;')
oai.send('rm -f ./oaisim.rel10;')
oai.send_expect_false('make Rel10=1 -j4' + tee, makerr1, 1500)
oai.send('cp ./oaisim ./oaisim.rel10;')
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '12'
test = '08'
name = 'Compile oai.rel10.itti.make'
conf = 'make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel10=1'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for ITTI Rel10'
oai.send('make clean;')
oai.send('make cleanall;')
oai.send('make cleanasn1;')
oai.send('rm -f ./oaisim.rel10.itti;')
oai.send_expect_false('make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel10=1 -j4' + tee, makerr1, 1500)
oai.send('cp ./oaisim ./oaisim.rel10.itti;')
......
......@@ -103,29 +103,32 @@ def execute(oai, user, pw, logfile,logdir):
test = '03'
name = 'Run oai.rel8.abs.ping'
diag = 'Data-plane is not working normally, check the OAI protocol stack, OAI driver, and normal operation of the OS'
oai.driver(oai,user,pw)
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-a -A AWGN -l7 -u' + str(i+1) +' -b'+ str(j+1)
for i in range(NUM_eNB) :
for j in range(NUM_UE) :
conf = '-a -A AWGN -l6 -u' + str(i+1) +' -b'+ str(j+1)
trace = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '.txt'
trace_ping = logdir + '/log_' + case + test + '_' + str(i) + str(j) + '_ping.txt'
tee = ' 2>&1 | tee ' + trace
tee_ping = ' 2>&1 | tee ' + trace_ping
tee = ' 2>&1 > ' + trace
if user == 'root' :
oai.send_nowait('./oaisim.rel8.nas ' + conf + tee + ' &')
oai.send('./oaisim.rel8.nas ' + conf + ' &')
else :
oai.send_nowait('echo '+pw+ ' | sudo -S -E ./oaisim.rel8.nas ' + conf + tee + ' &')
time.sleep(2)
oai.send('echo '+pw+ ' | sudo -S -E ./oaisim.rel8.nas ' + conf + tee + ' &')
time.sleep(20)
for k in range(NUM_TRIALS) :
oai.send_expect('ping 10.0.'+str(j+1)+'.'+str(NUM_eNB+i+1) + ' -c ' + str(random.randint(2, 10))+ ' -s ' + str(random.randint(128, 1500)) + tee_ping, ' 0% packet loss', 300)
trace_ping = logdir + '/log_' + case + test + '_' + str(i) + str(j) + str(k) + '_ping.txt'
tee_ping = ' 2>&1 | tee ' + trace_ping
oai.send_expect('ping 10.0.'+str(j+1)+'.'+str(NUM_eNB+i+1) + ' -c ' + str(random.randint(2, 10))+ ' -s ' + str(random.randint(128, 1500)) + tee_ping, ' 0% packet loss', 20)
if user == 'root' :
oai.send('pkill oaisim;')
oai.send('pkill oaisim.rel8.nas;')
oai.send('pkill oaisim.rel8.nas;')
else :
oai.send_nowait('echo '+pw+ ' | sudo -S pkill oaisim ;')
oai.send_nowait('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas;')
oai.send('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas;')
time.sleep(1)
oai.send_nowait('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas;')
oai.send('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas;')
oai.rm_driver(oai,user,pw)
......
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