Commit e7921f03 authored by Lionel Gauthier's avatar Lionel Gauthier

Changed default DRB id from 3 to 1

With folowwing implicit rule
drb id = x => correspondind lc id = x+2, eps bearer id = x+4

Changed RLC inner structs, no more statically allocated array, now it is dynamic via malloc and collection of RLC entities are stored in a hashtable.
Changed misc simple types
Started compiling with all warning setted and treated as errors, still working on RLC and around...
Add const qualifier wherever suitable (for example param frame, module id, const pointers, etc)

Thinking about a type of context parameter in procedure calls in L2 data plane (modules id, frame, srb flag, enb flag, etc)...


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5222 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 4b95c852
......@@ -4,7 +4,10 @@
#include <stdint.h>
#include <stddef.h>
typedef size_t hash_size_t;
typedef size_t hash_size_t;
typedef uint64_t hash_key_t;
#define HASHTABLE_QUESTIONABLE_KEY_VALUE ((uint64_t)-1)
typedef enum hashtable_return_code_e {
HASH_TABLE_OK = 0,
......@@ -18,28 +21,28 @@ typedef enum hashtable_return_code_e {
typedef struct hash_node_s {
uint64_t key;
void *data;
struct hash_node_s *next;
hash_key_t key;
void *data;
struct hash_node_s *next;
} hash_node_t;
typedef struct hash_table_s {
hash_size_t size;
hash_size_t num_elements;
struct hash_node_s **nodes;
hash_size_t (*hashfunc)(const uint64_t);
hash_size_t (*hashfunc)(const hash_key_t);
void (*freefunc)(void*);
} hash_table_t;
char* hashtble_rc_code2string(hashtable_rc_t rcP);
void hash_free_int_func(void* memoryP);
hash_table_t *hashtable_create (hash_size_t size, hash_size_t (*hashfunc)(const uint64_t ), void (*freefunc)(void*));
hash_table_t *hashtable_create (hash_size_t size, hash_size_t (*hashfunc)(const hash_key_t ), void (*freefunc)(void*));
hashtable_rc_t hashtable_destroy(hash_table_t *hashtbl);
hashtable_rc_t hashtable_is_key_exists (hash_table_t *hashtbl, const uint64_t key);
hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t *hashtblP, void funct(uint64_t keyP, void* dataP, void* parameterP), void* parameterP);
hashtable_rc_t hashtable_insert (hash_table_t *hashtbl, const uint64_t key, void *data);
hashtable_rc_t hashtable_remove (hash_table_t *hashtbl, const uint64_t key);
hashtable_rc_t hashtable_get (hash_table_t *hashtbl, const uint64_t key, void **dataP);
hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t *hashtblP, void funct(hash_key_t keyP, void* dataP, void* parameterP), void* parameterP);
hashtable_rc_t hashtable_insert (hash_table_t *hashtbl, const hash_key_t key, void *data);
hashtable_rc_t hashtable_remove (hash_table_t *hashtbl, const hash_key_t key);
hashtable_rc_t hashtable_get (hash_table_t *hashtbl, const hash_key_t key, void **dataP);
hashtable_rc_t hashtable_resize (hash_table_t *hashtbl, hash_size_t size);
......
......@@ -109,7 +109,7 @@ struct mac_tx_tb_management {
unsigned char first_bit; // 0 if data starts on byte boundary(b7), 1 if b6, 2 if b5, etc.
// Previously designed for interlayers optimizations, (avoid aligning on byte boundary)
// but not used by L1 !, so extra cost for alignement in MAC.
unsigned short tb_size_in_bits; // L1H does not care of the field first bit any more, so in order to byte
tb_size_t tb_size_in_bits; // L1H does not care of the field first bit any more, so in order to byte
// align the tb we have to know its size
// for reporting tx status to upper layers
......@@ -123,8 +123,8 @@ struct mac_tx_tb_management {
struct mac_rx_tb_management {
unsigned char *data_ptr;
unsigned short tb_size; // in bits
unsigned char valid_checksum;
tb_size_t tb_size; // in bits
boolean_t valid_checksum;
unsigned char first_bit; // 0 if data starts on byte boundary(b7), 1 if b6, 2 if b5, etc
};
......@@ -132,7 +132,7 @@ struct mac_tb_req {
// BE CAREFULL TO KEEP THE SAME MAPPING FOR THE 6 FIELDS BELLOW AS FOR struct mac_tx_tb_management
unsigned char *data_ptr;
unsigned char first_bit;
unsigned short tb_size;
tb_size_t tb_size;
// align the tb we have to know its size
// for reporting tx status to upper layers
......
......@@ -54,7 +54,7 @@
#define MAX_MANAGED_ENB_PER_MOBILE 2
#define DEFAULT_RAB_ID 3
#define DEFAULT_RAB_ID 1
#define NB_RB_MAX (maxDRB + 3) /* was 11, now 14, maxDRB comes from asn1_constants.h, + 3 because of 3 SRB, one invisible id 0, then id 1 and 2 */
#if defined(Rel10)
......
......@@ -26,11 +26,12 @@ typedef signed char boolean_t;
#define FALSE (boolean_t)0x00
#endif
#define BOOL_NOT(b) (b^TRUE)
//-----------------------------------------------------------------------------
// GENERIC ACCESS STRATUM TYPES
//-----------------------------------------------------------------------------
typedef uint16_t sdu_size_t;
typedef int16_t sdu_ssize_t;
typedef int32_t sdu_size_t;
typedef uint32_t frame_t;
typedef int32_t sframe_t;
typedef uint32_t sub_frame_t;
......@@ -74,8 +75,8 @@ typedef unsigned int crc_t;
//-----------------------------------------------------------------------------
// MAC TYPES
//-----------------------------------------------------------------------------
typedef unsigned int tbs_size_t;
typedef unsigned int tb_size_t;
typedef sdu_size_t tbs_size_t;
typedef sdu_size_t tb_size_t;
typedef unsigned int logical_chan_id_t;
typedef unsigned int num_tb_t;
......@@ -87,7 +88,7 @@ typedef unsigned int confirm_t;
typedef unsigned int rlc_tx_status_t;
typedef int16_t rlc_sn_t;
typedef uint16_t rlc_usn_t;
typedef uint32_t rlc_buffer_occupancy_t;
typedef int32_t rlc_buffer_occupancy_t;
typedef signed int rlc_op_status_t;
//-----------------------------------------------------------------------------
......
......@@ -6,10 +6,8 @@ EXTRA_CFLAGS += -DNO_RRM
COMMON_DIR = $(OPENAIR2_TOP)/COMMON
L2_INTERFACE_DIR = $(OPENAIR2_TOP)/RRC/L2_INTERFACE
#RLC_UM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/UM_v6.1.0_LITE
RLC_UM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/UM_v9.3.0
RLC_AM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/AM_v9.3.0
#RLC_TM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/TM
RLC_TM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/TM_v9.3.0
RLC_DIR = $(OPENAIR2_TOP)/LAYER2/RLC
PDCP_DIR = $(OPENAIR2_TOP)/LAYER2/PDCP_v10.1.0
......@@ -47,10 +45,6 @@ SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_status_report.c
SOURCES_L2 += $(RLC_TM_DIR)/rlc_tm.c
SOURCES_L2 += $(RLC_TM_DIR)/rlc_tm_init.c
#SOURCES_L2 += $(RLC_TM_DIR)/rlc_tm_control_primitives.c
#SOURCES_L2 += $(RLC_TM_DIR)/rlc_tm_fsm.c
#SOURCES_L2 += $(RLC_TM_DIR)/rlc_tm_segment.c
#SOURCES_L2 += $(RLC_TM_DIR)/rlc_tm_reassembly.c
SOURCES_L2 += $(RLC_UM_DIR)/rlc_um.c
SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_fsm.c
......@@ -96,7 +90,6 @@ MAC_OBJS += $(MAC_DIR)/config.o
L2_INTERFACE_OBJS = $(L2_INTERFACE_DIR)/openair_rrc_L2_interface.o
L2_OBJS=$(addsuffix .o,$(basename $(SOURCES_L2))) $(PHY_INTERFACE_OBJS) $(MAC_OBJS) $(L2_INTERFACE_OBJS)
#$(OPT_OBJS)
L2_incl = -I$(OPENAIR2_TOP)
L2_incl += -I$(COMMON_DIR)
......
......@@ -317,53 +317,47 @@ pdcp_fifo_read_input_sdus ()
// if remaining bytes to read
if (pdcp_fifo_read_input_sdus_remaining_bytes () > 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,
// 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,
&(((uint8_t *) & pdcp_input_header)[pdcp_input_index_header]),
sizeof (pdcp_data_req_header_t) - pdcp_input_index_header);
if (bytes_read > 0) {
if (bytes_read > 0) {
#ifdef PDCP_DEBUG
msg("[PDCP_FIFOS] TTI %d Read %d Bytes of data (header %d) from Nas_mesh\n",
Mac_rlc_xface->frame,
bytes_read,
sizeof(pdcp_data_req_header_t));
#endif // PDCP_DEBUG
pdcp_input_index_header += bytes_read;
msg("[PDCP_FIFOS] TTI %d Read %d Bytes of data (header %d) from Nas_mesh\n",
Mac_rlc_xface->frame,
bytes_read,
sizeof(pdcp_data_req_header_t));
#endif
pdcp_input_index_header += bytes_read;
if (pdcp_input_index_header == sizeof (pdcp_data_req_header_t)) {
if (pdcp_input_index_header == sizeof (pdcp_data_req_header_t)) {
#ifdef PDCP_DEBUG
msg("[PDCP] TTI %d IP->RADIO READ HEADER sdu size %d\n",
Mac_rlc_xface->frame,
pdcp_input_header.data_size);
#endif //PDCP_DEBUG
pdcp_input_index_header = 0;
if(pdcp_input_header.data_size<0){
msg("[PDCP][FATAL ERROR] 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 ();
} else {
cont = 0;
}
// error while reading rt fifo
} else {
cont = 0;
msg("[PDCP] TTI %d IP->RADIO READ HEADER sdu size %d\n",
Mac_rlc_xface->frame,
pdcp_input_header.data_size);
#endif
pdcp_input_index_header = 0;
if (pdcp_input_header.data_size < 0) {
msg("[PDCP][FATAL ERROR] 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 ();
} else {
cont = 0;
}
// error while reading rt fifo
} else {
cont = 0;
}
}
}
}
return 0;
}
......@@ -381,89 +375,81 @@ pdcp_fifo_read_input_sdus ()
int bytes_read;
int len;
if (pdcp_read_state == 0) {
#ifdef LINUX
len = recvmsg(nas_sock_fd, &nas_msg, 0);
len = recvmsg(nas_sock_fd, &nas_msg, 0);
#else
len = -1;
len = -1;
#endif
if (len<0) {
// printf("[PDCP][NETLINK %d] nothing in pdcp NAS socket\n", nas_sock_fd);
}
else {
if (len<0) {
//printf("[PDCP][NETLINK %d] nothing in pdcp NAS socket\n", nas_sock_fd);
}
else {
#ifdef PDCP_DEBUG
#ifdef LINUX
printf("[PDCP][NETLINK] Received socket with length %d (nlmsg_len = %d)\n",len,nas_nlh->nlmsg_len-sizeof(struct nlmsghdr));
printf("[PDCP][NETLINK] Received socket with length %d (nlmsg_len = %d)\n",len,nas_nlh->nlmsg_len-sizeof(struct nlmsghdr));
#endif PDCP_DEBUG
#ifdef PDCP_DEBUG
printf("[PDCP][NETLINK] nlmsg_len = %d (%d,%d)\n",nas_nlh->nlmsg_len,
sizeof(pdcp_data_req_header_t),
sizeof(struct nlmsghdr));
printf("[PDCP][NETLINK] nlmsg_len = %d (%d,%d)\n",nas_nlh->nlmsg_len,
sizeof(pdcp_data_req_header_t),
sizeof(struct nlmsghdr));
#endif LINUX
#endif PDCP_DEBUG
}
}
#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));
}
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 //LINUX
pdcp_read_state = 1;
pdcp_read_state = 1;
#endif //LINUX
}
if (pdcp_read_state == 1) {
#ifdef LINUX
len = recvmsg(nas_sock_fd, &nas_msg, 0);
len = recvmsg(nas_sock_fd, &nas_msg, 0);
#else
len = -1;
len = -1;
#endif //LINUX
if (len<0) {
// nothing in pdcp NAS socket
}
else {
pdcp_read_state = 0;
// print_active_requests()
if (len<0) {
// nothing in pdcp NAS socket
} 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));
memcpy(pdcp_read_payload,
(unsigned char *)NLMSG_DATA(nas_nlh),
nas_nlh->nlmsg_len - sizeof(struct nlmsghdr));
#endif
#ifdef IDROMEL_NEMO
pdcp_read_header.inst = 0;
pdcp_read_header.inst = 0;
#endif
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;
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;
#ifdef PDCP_DEBUG
printf("[PDCP][NETLINK][IP->PDCP] TTI %d, INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n",
Mac_rlc_xface->frame,
pdcp_read_header.inst,
len,
nas_nlh->nlmsg_len-sizeof(struct nlmsghdr),
pdcp_read_header.rb_id);
printf("[PDCP][NETLINK][IP->PDCP] TTI %d, INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n",
Mac_rlc_xface->frame,
pdcp_read_header.inst,
len,
nas_nlh->nlmsg_len-sizeof(struct nlmsghdr),
pdcp_read_header.rb_id);
#endif PDCP_DEBUG
pdcp_data_req(pdcp_read_header.inst,
pdcp_read_header.rb_id,
pdcp_read_header.data_size,
pdcp_read_payload);
}
pdcp_data_req(pdcp_read_header.inst,
pdcp_read_header.rb_id,
pdcp_read_header.data_size,
pdcp_read_payload);
}
}
}
#endif
......@@ -77,16 +77,17 @@ extern int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned in
* code at targets/TEST/PDCP/test_pdcp.c:test_pdcp_data_req()
*/
boolean_t pdcp_data_req(
module_id_t enb_mod_idP,
module_id_t ue_mod_idP,
frame_t frameP,
eNB_flag_t enb_flagP,
rb_id_t rb_idP,
mui_t muiP,
confirm_t confirmP,
sdu_size_t sdu_buffer_sizeP,
unsigned char *sdu_buffer_pP,
pdcp_transmission_mode_t modeP)
const module_id_t enb_mod_idP,
const module_id_t ue_mod_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_buffer_sizeP,
unsigned char *const sdu_buffer_pP,
const pdcp_transmission_mode_t modeP)
{
//-----------------------------------------------------------------------------
pdcp_t *pdcp_p = NULL;
......@@ -104,13 +105,25 @@ boolean_t pdcp_data_req(
if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) {
AssertError (rb_idP < NB_RB_MBMS_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MBMS_MAX, ue_mod_idP, enb_mod_idP);
} else {
AssertError (rb_idP < NB_RB_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MAX, ue_mod_idP, enb_mod_idP);
if (srb_flagP) {
AssertError (rb_idP < 2, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, 2, ue_mod_idP, enb_mod_idP);
} else {
AssertError (rb_idP < maxDRB, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, maxDRB, ue_mod_idP, enb_mod_idP);
}
}
if (enb_flagP == ENB_FLAG_NO) {
pdcp_p = &pdcp_array_ue[ue_mod_idP][rb_idP];
if (srb_flagP) {
pdcp_p = &pdcp_array_srb_ue[ue_mod_idP][rb_idP-1];
} else {
pdcp_p = &pdcp_array_drb_ue[ue_mod_idP][rb_idP-1];
}
} else {
pdcp_p = &pdcp_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP];
if (srb_flagP) {
pdcp_p = &pdcp_array_srb_eNB[enb_mod_idP][ue_mod_idP][rb_idP-1];
} else {
pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][rb_idP-1];
}
}
if ((pdcp_p->instanciated_instance == FALSE) && (modeP != PDCP_TRANSMISSION_MODE_TRANSPARENT)) {
......@@ -154,7 +167,7 @@ boolean_t pdcp_data_req(
(unsigned char*)&pdcp_pdu_p->data[0],
sdu_buffer_sizeP);
rlc_status = rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p);
rlc_status = rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p);
} else {
rlc_status = RLC_OP_STATUS_OUT_OF_RESSOURCES;
LOG_W(PDCP,"[FRAME %5u][%s][PDCP][MOD %u/%u][RB %u] PDCP_DATA_REQ SDU DROPPED, OUT OF MEMORY \n",
......@@ -174,7 +187,7 @@ boolean_t pdcp_data_req(
}
} else {
// calculate the pdcp header and trailer size
if (rb_idP < DTCH) {
if (srb_flagP) {
pdcp_header_len = PDCP_CONTROL_PLANE_DATA_PDU_SN_SIZE;
pdcp_tailer_len = PDCP_CONTROL_PLANE_DATA_PDU_MAC_I_SIZE;
} else {
......@@ -205,7 +218,7 @@ boolean_t pdcp_data_req(
* Place User Plane PDCP Data PDU header first
*/
if ((rb_idP % NB_RB_MAX) < DTCH) { // this Control plane PDCP Data PDU
if (srb_flagP) { // this Control plane PDCP Data PDU
pdcp_control_plane_data_pdu_header pdu_header;
pdu_header.sn = pdcp_get_next_tx_seq_number(pdcp_p);
current_sn = pdu_header.sn;
......@@ -262,7 +275,7 @@ boolean_t pdcp_data_req(
if ((pdcp->security_activated != 0) &&
((pdcp->cipheringAlgorithm) != 0) &&
((pdcp->integrityProtAlgorithm) != 0)) {
pdcp_apply_security(pdcp, rb_id % NB_RB_MAX,
pdcp_apply_security(pdcp, rb_id % maxDRB,
pdcp_header_len, current_sn, pdcp_pdu->data,
sdu_buffer_size);
}
......@@ -293,7 +306,7 @@ boolean_t pdcp_data_req(
* Ask sublayer to transmit data and check return value
* to see if RLC succeeded
*/
rlc_status = rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
rlc_status = rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
}
switch (rlc_status) {
case RLC_OP_STATUS_OK:
......@@ -343,17 +356,26 @@ boolean_t pdcp_data_req(
}
boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, MBMS_flag_t MBMS_flagP, rb_id_t rb_idP, sdu_size_t sdu_buffer_sizeP, \
mem_block_t* sdu_buffer_pP, boolean_t is_data_planeP)
boolean_t pdcp_data_ind(
const module_id_t enb_mod_idP,
const module_id_t ue_mod_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_idP,
const sdu_size_t sdu_buffer_sizeP,
mem_block_t* const sdu_buffer_pP)
{
//-----------------------------------------------------------------------------
pdcp_t *pdcp_p = NULL;
list_t *sdu_list_p = NULL;
mem_block_t *new_sdu_p = NULL;
uint8_t pdcp_header_len = 0;
uint8_t pdcp_tailer_len = 0;
uint8_t pdcp_header_len = 0;
uint8_t pdcp_tailer_len = 0;
pdcp_sn_t sequence_number = 0;
uint8_t payload_offset = 0;
uint8_t payload_offset = 0;
rb_id_t rb_id = rb_idP;
if (enb_flagP)
start_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind);
......@@ -397,20 +419,35 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t
ue_mod_idP, enb_mod_idP , rb_idP, sdu_buffer_sizeP, enb_flagP, enb_mod_idP);
}
} else {
rb_idP = rb_idP % NB_RB_MAX;
AssertError (rb_idP < NB_RB_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MAX, ue_mod_idP, enb_mod_idP);
rb_id = rb_idP % maxDRB;
AssertError (rb_id < maxDRB, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_id, maxDRB, ue_mod_idP, enb_mod_idP);
if (enb_flagP == ENB_FLAG_NO) {
pdcp_p = &pdcp_array_ue[ue_mod_idP][rb_idP];
if (srb_flagP) {
pdcp_p = &pdcp_array_srb_ue[ue_mod_idP][rb_id-1];
LOG_I(PDCP, "Data indication notification for PDCP entity from eNB %u to UE %u "
"and signalling radio bearer ID %d rlc sdu size %d enb_flagP %d\n",
enb_mod_idP, ue_mod_idP, rb_id, sdu_buffer_sizeP, enb_flagP);
} else {
pdcp_p = &pdcp_array_drb_ue[ue_mod_idP][rb_id-1];
LOG_I(PDCP, "Data indication notification for PDCP entity from eNB %u to UE %u "
"and data radio bearer ID %d rlc sdu size %d enb_flagP %d\n",
enb_mod_idP, ue_mod_idP, rb_id, sdu_buffer_sizeP, enb_flagP);
}
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_flagP %d\n",
enb_mod_idP, ue_mod_idP, rb_idP, sdu_buffer_sizeP, enb_flagP);
} else {
pdcp_p = &pdcp_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP];
if (srb_flagP) {
pdcp_p = &pdcp_array_srb_eNB[enb_mod_idP][ue_mod_idP][rb_id-1];
LOG_I(PDCP, "Data indication notification for PDCP entity from UE %u to eNB %u "
"and signalling radio bearer ID %d rlc sdu size %d enb_flagP %d eNB_id %d\n",
ue_mod_idP, enb_mod_idP , rb_id, sdu_buffer_sizeP, enb_flagP, enb_mod_idP);
} else {
pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][rb_id-1];
LOG_I(PDCP, "Data indication notification for PDCP entity from UE %u to eNB %u "
"and data radio bearer ID %d rlc sdu size %d enb_flagP %d eNB_id %d\n",
ue_mod_idP, enb_mod_idP , rb_id, sdu_buffer_sizeP, enb_flagP, enb_mod_idP);
}
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_flagP %d eNB_id %d\n",
ue_mod_idP, enb_mod_idP , rb_idP, sdu_buffer_sizeP, enb_flagP, enb_mod_idP);
}
}
......@@ -430,7 +467,7 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t
* Check if incoming SDU is long enough to carry a PDU header
*/
if (MBMS_flagP == 0 ) {
if ((rb_idP % NB_RB_MAX) < DTCH) {
if (srb_flagP) {
pdcp_header_len = PDCP_CONTROL_PLANE_DATA_PDU_SN_SIZE;
pdcp_tailer_len = PDCP_CONTROL_PLANE_DATA_PDU_MAC_I_SIZE;
} else {
......@@ -480,7 +517,7 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t
#endif
}
// SRB1/2: control-plane data
if ( (rb_idP % NB_RB_MAX) < DTCH ){
if (srb_flagP){
#if defined(ENABLE_SECURITY)
if (pdcp->security_activated == 1) {
pdcp_validate_security(pdcp, rb_id, pdcp_header_len,
......@@ -493,7 +530,7 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t
ue_mod_idP,
frameP,
enb_flagP,
rb_idP,
rb_id,
sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len,
(uint8_t*)&sdu_buffer_pP->data[pdcp_header_len]);
free_mem_block(sdu_buffer_pP);
......@@ -507,7 +544,7 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t
payload_offset=PDCP_USER_PLANE_DATA_PDU_LONG_SN_HEADER_SIZE;
#if defined(ENABLE_SECURITY)
if (pdcp->security_activated == 1) {
pdcp_validate_security(pdcp_p, rb_idP % NB_RB_MAX, pdcp_header_len,
pdcp_validate_security(pdcp_p, rb_idP % maxDRB, pdcp_header_len,
sequence_number, sdu_buffer->data,
sdu_buffer_size - pdcp_tailer_len);
}
......@@ -519,15 +556,16 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t
if (oai_emulation.info.otg_enabled == 1) {
module_id_t src_id, dst_id;
int ctime;
rlc_util_print_hex_octets(PDCP,
&sdu_buffer_pP->data[payload_offset],
(unsigned char*)&sdu_buffer_pP->data[payload_offset],
sdu_buffer_sizeP - payload_offset);
src_id = (enb_flagP != 0) ? ue_mod_idP : enb_mod_idP;
dst_id = (enb_flagP == ENB_FLAG_NO) ? ue_mod_idP : enb_mod_idP;
ctime = oai_emulation.info.time_ms; // avg current simulation time in ms : we may get the exact time through OCG?
LOG_D(PDCP, "Check received buffer : enb_flag %d rab id %d (src %d, dst %d)\n",
enb_flagP, rb_idP, src_id, dst_id);
enb_flagP, rb_id, src_id, dst_id);
if (otg_rx_pkt(src_id, dst_id,ctime,&sdu_buffer_pP->data[payload_offset],
sdu_buffer_sizeP - payload_offset ) == 0 ) {
......@@ -562,12 +600,12 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t
// Here there is no virtualization possible
// set ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst for IP layer here
if (enb_flagP == ENB_FLAG_NO) {
((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_idP;
((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_id;
#if defined(OAI_EMU)
((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = ue_mod_idP + oai_emulation.info.nb_enb_local - oai_emulation.info.first_ue_local;
#endif
} else {
((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_idP + (ue_mod_idP * NB_RB_MAX);
((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_id + (ue_mod_idP * maxDRB);
#if defined(OAI_EMU)
((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = enb_mod_idP - oai_emulation.info.first_enb_local;
#endif
......@@ -614,7 +652,7 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_idP);
rb_id);
}
#endif
......@@ -627,7 +665,11 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t
}
//-----------------------------------------------------------------------------
void pdcp_run (frame_t frameP, eNB_flag_t enb_flagP, module_id_t ue_mod_idP, module_id_t enb_mod_idP) {
void pdcp_run (
const frame_t frameP,
const eNB_flag_t enb_flagP,
const module_id_t ue_mod_idP,
const module_id_t enb_mod_idP) {
//-----------------------------------------------------------------------------
#if defined(ENABLE_ITTI)
MessageDef *msg_p;
......@@ -658,10 +700,17 @@ void pdcp_run (frame_t frameP, eNB_flag_t enb_flagP, module_id_t ue_mod_idP, mo
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);
result = 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);
result = 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,
SRB_FLAG_YES,
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);
AssertFatal (result == TRUE, "PDCP data request failed!\n");
// Message buffer has been processed, free it now.
......@@ -708,9 +757,9 @@ void pdcp_run (frame_t frameP, eNB_flag_t enb_flagP, module_id_t ue_mod_idP, mo
pdcp_t *pdcp_p = NULL;
// add other rb_ids
if (enb_flagP == ENB_FLAG_NO) {
pdcp_p = &pdcp_array_ue[ue_mod_idP][DTCH];
pdcp_p = &pdcp_array_drb_ue[ue_mod_idP][DTCH-1];
} else {
pdcp_p = &pdcp_array_eNB[enb_mod_idP][ue_mod_idP][DTCH];
pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][DTCH-1];
}
if (pdcp_p->instanciated_instance == TRUE )
......@@ -735,25 +784,25 @@ void pdcp_run (frame_t frameP, eNB_flag_t enb_flagP, module_id_t ue_mod_idP, mo
}
boolean_t rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
module_id_t ue_mod_idP,
frame_t frameP,
eNB_flag_t enb_flagP,
SRB_ToAddModList_t *srb2add_list_pP,
DRB_ToAddModList_t *drb2add_list_pP,
DRB_ToReleaseList_t *drb2release_list_pP,
uint8_t security_modeP,
uint8_t *kRRCenc_pP,
uint8_t *kRRCint_pP,
uint8_t *kUPenc_pP
boolean_t rrc_pdcp_config_asn1_req (
const module_id_t enb_mod_idP,
const module_id_t ue_mod_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
SRB_ToAddModList_t *const srb2add_list_pP,
DRB_ToAddModList_t *const drb2add_list_pP,
DRB_ToReleaseList_t *const drb2release_list_pP,
const uint8_t security_modeP,
uint8_t *const kRRCenc_pP,
uint8_t *const kRRCint_pP,
uint8_t *const kUPenc_pP
#ifdef Rel10
,PMCH_InfoList_r9_t* pmch_InfoList_r9_pP
,PMCH_InfoList_r9_t* const pmch_InfoList_r9_pP
#endif
)
{
long int rb_id = 0;
long int lc_id = 0;
long int srb_id = 0;
DRB_Identity_t srb_id = 0;
long int mch_id = 0;
rlc_mode_t rlc_type = RLC_MODE_NONE;
DRB_Identity_t drb_id = 0;
......@@ -786,15 +835,15 @@ boolean_t rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
srb_id = srb2add_list_pP->list.array[cnt]->srb_Identity;
srb_toaddmod_p = srb2add_list_pP->list.array[cnt];
rlc_type = RLC_MODE_AM;
rb_id = srb_id;
lc_id = srb_id;
lc_id = srb_id + 2;
if (enb_flagP == ENB_FLAG_NO) {
pdcp_p = &pdcp_array_ue[ue_mod_idP][srb_id];
pdcp_p = &pdcp_array_srb_ue[ue_mod_idP][srb_id-1];
} else {
pdcp_p = &pdcp_array_eNB[enb_mod_idP][ue_mod_idP][srb_id];
pdcp_p = &pdcp_array_srb_eNB[enb_mod_idP][ue_mod_idP][srb_id-1];
}
if (pdcp_p->instanciated_instance == TRUE) {
action = CONFIG_ACTION_MODIFY;
} else {
......@@ -815,11 +864,12 @@ boolean_t rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP, // not really required
SRB_FLAG_YES,
rlc_type,
action,
lc_id,
mch_id,
rb_id,
srb_id,
srb_sn,
0, // drb_report
0, // header compression
......@@ -847,21 +897,17 @@ boolean_t rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
drb_toaddmod_p = drb2add_list_pP->list.array[cnt];
drb_id = drb_toaddmod_p->drb_Identity;
drb_id = drb_toaddmod_p->drb_Identity ;// + drb_id_offset;
lc_id = drb_id + 2;
if (drb_toaddmod_p->logicalChannelIdentity != null) {
lc_id = *drb_toaddmod_p->logicalChannelIdentity;
} else {
lc_id = -1;
}
rb_id = lc_id;
DevCheck4(rb_id < NB_RB_MAX, rb_id, NB_RB_MAX, ue_mod_idP, enb_mod_idP);
DevCheck4(drb_id < maxDRB, drb_id, maxDRB, ue_mod_idP, enb_mod_idP);
if (enb_flagP == ENB_FLAG_NO) {
pdcp_p = &pdcp_array_ue[ue_mod_idP][rb_id];
pdcp_p = &pdcp_array_drb_ue[ue_mod_idP][drb_id-1];
} else {
pdcp_p = &pdcp_array_eNB[enb_mod_idP][ue_mod_idP][rb_id];
pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][drb_id-1];
}
if (pdcp_p->instanciated_instance == TRUE)
......@@ -922,11 +968,12 @@ boolean_t rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP, // not really required
SRB_FLAG_NO,
rlc_type,
action,
lc_id,
mch_id,
rb_id,
drb_id,
drb_sn,
drb_report,
header_compression_profile,
......@@ -941,11 +988,12 @@ boolean_t rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
if (drb2release_list_pP != NULL) {
for (cnt=0;cnt<drb2release_list_pP->list.count;cnt++) {
pdrb_id_p = drb2release_list_pP->list.array[cnt];
rb_id = *pdrb_id_p;
drb_id = *pdrb_id_p;
lc_id = drb_id + 2;
if (enb_flagP == ENB_FLAG_NO) {
pdcp_p = &pdcp_array_ue[ue_mod_idP][rb_id];
pdcp_p = &pdcp_array_drb_ue[ue_mod_idP][drb_id-1];
} else {
pdcp_p = &pdcp_array_eNB[enb_mod_idP][ue_mod_idP][rb_id];
pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][drb_id-1];
}
action = CONFIG_ACTION_REMOVE;
pdcp_config_req_asn1 (pdcp_p,
......@@ -953,11 +1001,12 @@ boolean_t rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP, // not really required
SRB_FLAG_NO,
rlc_type,
action,
lc_id,
mch_id,
rb_id,
drb_id,
0,
0,
0,
......@@ -979,32 +1028,33 @@ boolean_t rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP,
// can set the mch_id = i
if (enb_flagP) {
rb_id = (mch_id * maxSessionPerPMCH ) + lc_id + (maxDRB + 3)*MAX_MOBILES_PER_ENB; // 1
if (pdcp_mbms_array_eNB[enb_mod_idP][mch_id][lc_id].instanciated_instance == TRUE)
action = CONFIG_ACTION_MBMS_MODIFY;
else
action = CONFIG_ACTION_MBMS_ADD;
drb_id = (mch_id * maxSessionPerPMCH ) + lc_id + (maxDRB + 3)*MAX_MOBILES_PER_ENB; // 1
if (pdcp_mbms_array_eNB[enb_mod_idP][mch_id][lc_id].instanciated_instance == TRUE) {
action = CONFIG_ACTION_MBMS_MODIFY;
}else {
action = CONFIG_ACTION_MBMS_ADD;
}
} else {
rb_id = (mch_id * maxSessionPerPMCH ) + lc_id + (maxDRB + 3); // 15
if (pdcp_mbms_array_ue[ue_mod_idP][mch_id][lc_id].instanciated_instance == TRUE)
action = CONFIG_ACTION_MBMS_MODIFY;
else
action = CONFIG_ACTION_MBMS_ADD;
drb_id = (mch_id * maxSessionPerPMCH ) + lc_id + (maxDRB + 3); // 15
if (pdcp_mbms_array_ue[ue_mod_idP][mch_id][lc_id].instanciated_instance == TRUE) {
action = CONFIG_ACTION_MBMS_MODIFY;
} else {
action = CONFIG_ACTION_MBMS_ADD;
}
}
pdcp_config_req_asn1 (
NULL, // unused for MBMS
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_NO,
RLC_MODE_NONE,
action,
lc_id,
mch_id,
rb_id,
drb_id,
0, // unused for MBMS
0, // unused for MBMS
0, // unused for MBMS
......@@ -1026,6 +1076,7 @@ boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP,
module_id_t ue_mod_idP,
frame_t frameP,
eNB_flag_t enb_flagP,
srb_flag_t srb_flagP,
rlc_mode_t rlc_modeP,
config_action_t actionP,
uint16_t lc_idP,
......@@ -1045,7 +1096,9 @@ boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP,
DevAssert(pdcp_pP != NULL);
pdcp_pP->instanciated_instance = TRUE;
pdcp_pP->is_ue = (enb_flagP == ENB_FLAG_NO) ? TRUE : FALSE;
pdcp_pP->is_srb = (srb_flagP == SRB_FLAG_YES) ? TRUE : FALSE;
pdcp_pP->lcid = lc_idP;
pdcp_pP->rb_id = rb_idP;
pdcp_pP->header_compression_profile = header_compression_profileP;
pdcp_pP->status_report = rb_reportP;
......@@ -1202,11 +1255,20 @@ void pdcp_config_set_security(pdcp_t *pdcp_pP,
if (enb_flagP == ENB_FLAG_NO) {
LOG_D(PDCP,"[UE %d][RB %02d] Set security mode : CONFIG_ACTION_SET_SECURITY_MODE: "
"Frame %d cipheringAlgorithm %d integrityProtAlgorithm %d\n",
ue_mod_idP, rb_idP, frameP, pdcp_pP->cipheringAlgorithm, pdcp_pP->integrityProtAlgorithm);
ue_mod_idP,
rb_idP,
frameP,
pdcp_pP->cipheringAlgorithm,
pdcp_pP->integrityProtAlgorithm);
} else {
LOG_D(PDCP,"[eNB %d][UE %d][RB %02d] Set security mode : CONFIG_ACTION_SET_SECURITY_MODE: "
"Frame %d cipheringAlgorithm %d integrityProtAlgorithm %d\n",
enb_mod_idP, ue_mod_idP, rb_idP, frameP, pdcp_pP->cipheringAlgorithm, pdcp_pP->integrityProtAlgorithm);
enb_mod_idP,
ue_mod_idP,
rb_idP,
frameP,
pdcp_pP->cipheringAlgorithm,
pdcp_pP->integrityProtAlgorithm);
}
pdcp_pP->kRRCenc = kRRCenc;
pdcp_pP->kRRCint = kRRCint;
......@@ -1219,14 +1281,22 @@ void pdcp_config_set_security(pdcp_t *pdcp_pP,
}
}
void rrc_pdcp_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, uint32_t actionP, rb_id_t rb_idP, uint8_t security_modeP)
void rrc_pdcp_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, srb_flag_t srb_flagP, uint32_t actionP, rb_id_t rb_idP, uint8_t security_modeP)
{
pdcp_t *pdcp_p = NULL;
if (enb_mod_idP == 0) {
pdcp_p = &pdcp_array_ue[ue_mod_idP][rb_idP];
if (enb_flagP == ENB_FLAG_NO) {
if (srb_flagP) {
pdcp_p = &pdcp_array_srb_ue[ue_mod_idP][rb_idP-1];
} else {
pdcp_p = &pdcp_array_drb_ue[ue_mod_idP][rb_idP-1];
}
} else {
pdcp_p = &pdcp_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP];
if (srb_flagP) {
pdcp_p = &pdcp_array_srb_eNB[enb_mod_idP][ue_mod_idP][rb_idP-1];
} else {
pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][rb_idP-1];
}
}
/*
......@@ -1235,6 +1305,13 @@ void rrc_pdcp_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame
switch (actionP) {
case CONFIG_ACTION_ADD:
pdcp_p->instanciated_instance = TRUE;
pdcp_p->is_srb = srb_flagP;
pdcp_p->rb_id = rb_idP;
if (enb_flagP == ENB_FLAG_NO) {
pdcp_p->is_ue = TRUE;
} else {
pdcp_p->is_ue = FALSE;
}
pdcp_p->next_pdcp_tx_sn = 0;
pdcp_p->next_pdcp_rx_sn = 0;
......@@ -1350,8 +1427,11 @@ void pdcp_layer_init(void)
list_init(&pdcp_sdu_list, NULL);
for (instance = 0; instance < NUMBER_OF_UE_MAX; instance++) {
for (rb_id = 0; rb_id < NB_RB_MAX; rb_id++) {
memset(&pdcp_array_ue[instance][rb_id], 0, sizeof(pdcp_t));
for (rb_id = 0; rb_id < maxDRB; rb_id++) {
memset(&pdcp_array_drb_ue[instance][rb_id-1], 0, sizeof(pdcp_t));
}
for (rb_id = 0; rb_id < 2; rb_id++) {
memset(&pdcp_array_srb_ue[instance][rb_id-1], 0, sizeof(pdcp_t));
}
#if defined(Rel10)
for (service_id = 0; service_id < maxServiceCount; service_id++) {
......@@ -1363,8 +1443,11 @@ void pdcp_layer_init(void)
}
for (instance = 0; instance < NUMBER_OF_eNB_MAX; instance++) {
for (instance2 = 0; instance2 < NUMBER_OF_UE_MAX; instance2++) {
for (rb_id = 0; rb_id < NB_RB_MAX; rb_id++) {
memset(&pdcp_array_eNB[instance][instance2][rb_id], 0, sizeof(pdcp_t));
for (rb_id = 0; rb_id < maxDRB; rb_id++) {
memset(&pdcp_array_drb_eNB[instance][instance2][rb_id-1], 0, sizeof(pdcp_t));
}
for (rb_id = 0; rb_id < 2; rb_id++) {
memset(&pdcp_array_srb_eNB[instance][instance2][rb_id-1], 0, sizeof(pdcp_t));
}
}
#if defined(Rel10)
......
......@@ -122,6 +122,7 @@ typedef struct pdcp_t {
* mode can receive data on NETLINK for eNB while eNB_flag = 0 and for UE when eNB_flag = 1
*/
boolean_t is_ue;
boolean_t is_srb;
/* Configured security algorithms */
uint8_t cipheringAlgorithm;
......@@ -143,6 +144,7 @@ typedef struct pdcp_t {
uint8_t seq_num_size;
logical_chan_id_t lcid;
rb_id_t rb_id;
/*
* Sequence number state variables
*
......@@ -188,7 +190,7 @@ typedef struct pdcp_mbms_t {
* under targets/TEST/PDCP/
*/
/*! \fn boolean_t pdcp_data_req(module_id_t, uint32_t, uint8_t, rb_id_t, sdu_size_t, unsigned char*)
/*! \fn boolean_t pdcp_data_req(module_id_t , module_id_t , frame_t , eNB_flag_t , srb_flag_t , rb_id_t , mui_t , confirm_t ,sdu_size_t , unsigned char* , pdcp_transmission_mode_t )
* \brief This functions handles data transfer requests coming either from RRC or from IP
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
......@@ -204,15 +206,26 @@ typedef struct pdcp_mbms_t {
* \note None
* @ingroup _pdcp
*/
public_pdcp(boolean_t pdcp_data_req(module_id_t eNB_id, module_id_t UE_id, frame_t frame, eNB_flag_t eNB_flag, rb_id_t rb_id, mui_t muiP, confirm_t confirmP, \
sdu_size_t sdu_buffer_size, unsigned char* sdu_buffer, pdcp_transmission_mode_t mode));
/*! \fn boolean_t pdcp_data_ind(module_id_t, module_id_t, frame_t, eNB_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t)
public_pdcp(boolean_t pdcp_data_req(
const module_id_t eNB_id,
const module_id_t UE_id,
const frame_t frame,
const eNB_flag_t eNB_flag,
const srb_flag_t srb_flagP,
const rb_id_t rb_id,
const mui_t muiP,
const confirm_t confirmP, \
const sdu_size_t sdu_buffer_size,
unsigned char* const sdu_buffer,
const pdcp_transmission_mode_t mode));
/*! \fn boolean_t pdcp_data_ind(module_id_t, module_id_t, frame_t, eNB_flag_t, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t)
* \brief This functions handles data transfer indications coming from RLC
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frame Frame number
* \param[in] Shows if relevant PDCP entity is part of an eNB or a UE
* \param[in] Shows if rb is SRB
* \param[in] Tells if MBMS traffic
* \param[in] rab_id Radio Bearer ID
* \param[in] sdu_buffer_size Size of incoming SDU in bytes
......@@ -222,8 +235,16 @@ public_pdcp(boolean_t pdcp_data_req(module_id_t eNB_id, module_id_t UE_id, frame
* \note None
* @ingroup _pdcp
*/
public_pdcp(boolean_t pdcp_data_ind(module_id_t eNB_id, module_id_t UE_id, frame_t frame, eNB_flag_t eNB_flag, MBMS_flag_t MBMS_flagP, rb_id_t rb_id, sdu_size_t sdu_buffer_size,
mem_block_t* sdu_buffer, boolean_t is_data_plane));
public_pdcp(boolean_t pdcp_data_ind(
const module_id_t eNB_id,
const module_id_t UE_id,
const frame_t frame,
const eNB_flag_t eNB_flag,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_id,
const sdu_size_t sdu_buffer_size,
mem_block_t* const sdu_buffer));
/*! \fn void rrc_pdcp_config_req(module_id_t , module_id_t ,frame_t,eNB_flag_t,uint32_t,rb_id_t,uint8_t)
* \brief This functions initializes relevant PDCP entity
......@@ -238,13 +259,15 @@ public_pdcp(boolean_t pdcp_data_ind(module_id_t eNB_id, module_id_t UE_id, frame
* \note None
* @ingroup _pdcp
*/
public_pdcp(void rrc_pdcp_config_req (module_id_t enb_idP,
module_id_t ue_idP,
frame_t frameP,
eNB_flag_t eNB_flagP,
uint32_t actionP,
rb_id_t rb_idP,
uint8_t security_modeP);)
public_pdcp(void rrc_pdcp_config_req (
const module_id_t enb_idP,
const module_id_t ue_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const uint32_t actionP,
const rb_id_t rb_idP,
const uint8_t security_modeP);)
/*! \fn bool rrc_pdcp_config_asn1_req (module_id_t module_id, frame_t frame, eNB_flag_t eNB_flag, SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t* drb2add_list, DRB_ToReleaseList_t* drb2release_list)
* \brief Function for RRC to configure a Radio Bearer.
......@@ -263,29 +286,31 @@ public_pdcp(void rrc_pdcp_config_req (module_id_t enb_idP,
* \return A status about the processing, OK or error code.
*/
public_pdcp(
boolean_t rrc_pdcp_config_asn1_req (module_id_t eNB_idP,
module_id_t ue_idP,
frame_t frameP,
eNB_flag_t eNB_flagP,
SRB_ToAddModList_t *srb2add_list,
DRB_ToAddModList_t *drb2add_list,
DRB_ToReleaseList_t *drb2release_list,
uint8_t security_modeP,
uint8_t *kRRCenc,
uint8_t *kRRCint,
uint8_t *kUPenc
boolean_t rrc_pdcp_config_asn1_req (
const module_id_t eNB_idP,
const module_id_t ue_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
SRB_ToAddModList_t *const srb2add_list,
DRB_ToAddModList_t *const drb2add_list,
DRB_ToReleaseList_t *const drb2release_list,
const uint8_t security_modeP,
uint8_t *const kRRCenc,
uint8_t *const kRRCint,
uint8_t *const kUPenc
#ifdef Rel10
,PMCH_InfoList_r9_t *pmch_InfoList_r9
,PMCH_InfoList_r9_t *pmch_InfoList_r9
#endif
));
/*! \fn boolean_t pdcp_config_req_asn1 (module_id_t module_id, frame_t frame, eNB_flag_t eNB_flag, uint32_t action, rb_id_t rb_id, uint8_t rb_sn, uint8_t rb_report, uint16_t header_compression_profile, uint8_t security_mode)
/*! \fn boolean_t pdcp_config_req_asn1 (module_id_t module_id, frame_t frame, eNB_flag_t eNB_flag, srb_flag_t srb_flagP, uint32_t action, rb_id_t rb_id, uint8_t rb_sn, uint8_t rb_report, uint16_t header_compression_profile, uint8_t security_mode)
* \brief Function for RRC to configure a Radio Bearer.
* \param[in] pdcp_pP Pointer on PDCP structure.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frame Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0)
* \param[in] action add, remove, modify a RB
* \param[in] rb_id radio bearer id
* \param[in] rb_sn sequence number for this radio bearer
......@@ -297,23 +322,25 @@ boolean_t rrc_pdcp_config_asn1_req (module_id_t eNB_idP,
* \param[in] kUPenc User-Plane encryption key
* \return A status about the processing, OK or error code.
*/
public_pdcp(boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP,
module_id_t enb_idP,
module_id_t ue_idP,
frame_t frameP,
eNB_flag_t eNB_flagP,
rlc_mode_t rlc_mode,
uint32_t action,
uint16_t lc_id,
uint16_t mch_id,
rb_id_t rb_id,
uint8_t rb_sn,
uint8_t rb_report,
uint16_t header_compression_profile,
uint8_t security_mode,
uint8_t *kRRCenc,
uint8_t *kRRCint,
uint8_t *kUPenc));
public_pdcp(boolean_t pdcp_config_req_asn1 (
pdcp_t *const pdcp_pP,
const module_id_t enb_idP,
const module_id_t ue_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const rlc_mode_t rlc_mode,
const uint32_t action,
const uint16_t lc_id,
const uint16_t mch_id,
const rb_id_t rb_id,
const uint8_t rb_sn,
const uint8_t rb_report,
const uint16_t header_compression_profile,
const uint8_t security_mode,
uint8_t *const kRRCenc,
uint8_t *const kRRCint,
uint8_t *const 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
......@@ -334,7 +361,11 @@ public_pdcp(boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP,
* \note None
* @ingroup _pdcp
*/
public_pdcp(void pdcp_run (frame_t frameP, eNB_flag_t eNB_flagP, module_id_t ue_mod_idP, module_id_t enb_mod_idP);)
public_pdcp(void pdcp_run (
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const module_id_t ue_mod_idP,
const module_id_t enb_mod_idP);)
public_pdcp(int pdcp_module_init (void);)
public_pdcp(void pdcp_module_cleanup (void);)
public_pdcp(void pdcp_layer_init (void);)
......@@ -344,10 +375,24 @@ public_pdcp(int pdcp_netlink_init (void);)
#define PDCP2NAS_FIFO 21
#define NAS2PDCP_FIFO 22
protected_pdcp_fifo(int pdcp_fifo_flush_sdus (frame_t frameP, eNB_flag_t eNB_flagP, module_id_t enb_idP, module_id_t ue_mod_idP);)
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t eNB_flagP);)
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t eNB_flagP, module_id_t ue_mod_idP, module_id_t enb_mod_idP);)
protected_pdcp_fifo(void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t eNB_flagP, module_id_t ue_mod_idP, module_id_t enb_mod_idP);)
protected_pdcp_fifo(int pdcp_fifo_flush_sdus (
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const module_id_t enb_idP,
const module_id_t ue_mod_idP);)
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus_remaining_bytes (
const frame_t frameP,
const eNB_flag_t eNB_flagP);)
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus (
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const module_id_t ue_mod_idP,
const module_id_t enb_mod_idP);)
protected_pdcp_fifo(void pdcp_fifo_read_input_sdus_from_otg (
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const module_id_t ue_mod_idP,
const module_id_t enb_mod_idP);)
//-----------------------------------------------------------------------------
......@@ -396,10 +441,12 @@ typedef struct pdcp_missing_pdu_info_t {
#define PDCP_MAX_SN_12BIT 4095 // 2^12-1
protected_pdcp(signed int pdcp_2_nas_irq;)
public_pdcp(pdcp_stats_t UE_pdcp_stats[NUMBER_OF_UE_MAX];)
public_pdcp(pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_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_stats_t UE_pdcp_stats[NUMBER_OF_UE_MAX];)
public_pdcp(pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX];)
protected_pdcp(pdcp_t pdcp_array_srb_ue[NUMBER_OF_UE_MAX][2];)
protected_pdcp(pdcp_t pdcp_array_drb_ue[NUMBER_OF_UE_MAX][maxDRB];)
protected_pdcp(pdcp_t pdcp_array_srb_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][2];)
protected_pdcp(pdcp_t pdcp_array_drb_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][maxDRB];)
#if defined(Rel10)
public_pdcp(pdcp_mbms_t pdcp_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_pdcp(pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
......
......@@ -132,8 +132,8 @@ int pdcp_fifo_flush_sdus(frame_t frameP, eNB_flag_t enb_flagP, module_id_t enb_m
*/
gtpv1u_new_data_req(
enb_mod_idP, //gtpv1u_data_t *gtpv1u_data_p,
ue_mod_idP,//rb_id/NB_RB_MAX, TO DO UE ID
((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id, //was 0 default RAB ID
ue_mod_idP,//rb_id/maxDRB, TO DO UE ID
((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id + 4,
&(((uint8_t *) sdu_p->data)[sizeof (pdcp_data_ind_header_t)]),
((pdcp_data_ind_header_t *)(sdu_p->data))->data_size);
......@@ -221,7 +221,7 @@ int pdcp_fifo_flush_sdus(frame_t frameP, eNB_flag_t enb_flagP, module_id_t enb_m
LOG_D(PDCP,
"[FRAME %05d][xxx][PDCP][MOD xx/xx][RB %u][--- PDCP_DATA_IND / %d Bytes --->][IP][INSTANCE %u][RB %u]\n",
frameP,
((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id%NB_RB_MAX,
((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id,
((pdcp_data_ind_header_t *)(sdu_p->data))->data_size,
((pdcp_data_ind_header_t *)(sdu_p->data))->inst,
((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id);
......@@ -330,14 +330,14 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl
if (enb_flagP == 0) {
ue_inst = pdcp_read_header_g.inst;
rb_id = pdcp_read_header_g.rb_id % NB_RB_MAX;
rb_id = pdcp_read_header_g.rb_id;
enb_inst = 0;
pdcp_p = &pdcp_array_ue[ue_inst][rb_id];
pdcp_p = &pdcp_array_drb_ue[ue_inst][rb_id-1];
} else {
ue_inst = pdcp_read_header_g.rb_id / NB_RB_MAX;
rb_id = pdcp_read_header_g.rb_id % NB_RB_MAX;
ue_inst = pdcp_read_header_g.rb_id / maxDRB;
rb_id = pdcp_read_header_g.rb_id % maxDRB;
enb_inst = pdcp_read_header_g.inst;
pdcp_p = &pdcp_array_eNB[enb_inst][ue_inst][rb_id];
pdcp_p = &pdcp_array_drb_eNB[enb_inst][ue_inst][rb_id-1];
}
AssertFatal (enb_inst < NB_eNB_INST, "eNB module id is too high (%u/%d)!\n", enb_inst, NB_eNB_INST);
AssertFatal (ue_inst >= NB_eNB_INST,
......@@ -348,7 +348,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl
"UE module id is too high (%u/%d)!\n",
ue_inst,
NB_eNB_INST + NB_UE_INST);
AssertFatal (rab_id < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rab_id, NB_RB_MAX);
AssertFatal (rab_id < maxDRB, "RB id is too high (%u/%d)!\n", rab_id, maxDRB);
if (pdcp_input_header.rb_id != 0) {
LOG_D(PDCP, "[FRAME %5u][%s][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u/%u][RB %u]\n",
......@@ -362,16 +362,18 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl
rb_id);
if (pdcp_p->instanciated_instance) {
result = pdcp_data_req (enb_inst,
ue_inst,
frameP,
enb_flagP,
rb_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_TRANSMISSION_MODE_DATA);
result = pdcp_data_req (
enb_inst,
ue_inst,
frameP,
enb_flagP,
SRB_FLAG_NO,
rb_id % maxDRB,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
pdcp_input_header.data_size,
pdcp_input_sdu_buffer,
PDCP_TRANSMISSION_MODE_DATA);
AssertFatal (result == TRUE, "PDCP data request failed!\n");
}
......@@ -392,6 +394,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl
ue_inst,
frameP,
enb_flagP,
SRB_FLAG_NO,
rb_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
......@@ -406,7 +409,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl
LOG_D(PDCP, "Checking if could sent on default rabs\n");
for (ue_inst = 0; ue_inst < NUMBER_OF_UE_MAX; ue_inst++) {
LOG_D(PDCP, "Checking if could sent on default rab id %d\n", DEFAULT_RAB_ID);
pdcp_p = &pdcp_array_eNB[enb_inst][ue_inst][DEFAULT_RAB_ID];
pdcp_p = &pdcp_array_drb_eNB[enb_inst][ue_inst][DEFAULT_RAB_ID-1];
if (pdcp_p->instanciated_instance) {
LOG_D(PDCP, "[FRAME %5u][%s][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u/%u][RB DEFAULT_RAB_ID %u]\n",
frameP,
......@@ -422,6 +425,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl
ue_inst,
frameP,
enb_flagP,
SRB_FLAG_NO,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
......@@ -447,6 +451,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl
ue_inst,
frameP,
enb_flagP,
SRB_FLAG_NO,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
......@@ -480,12 +485,12 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
while (pdcp_netlink_dequeue_element(enb_mod_idP, ue_mod_idP, enb_flagP, &data) != 0) {
DevAssert(data != NULL);
if (enb_flagP == 0) {
rab_id = data->pdcp_read_header.rb_id % NB_RB_MAX;
pdcp = &pdcp_array_ue[ue_mod_idP][rab_id];
rab_id = data->pdcp_read_header.rb_id % maxDRB;
pdcp = &pdcp_array_drb_ue[ue_mod_idP][rab_id-1];
} else {
rab_id = data->pdcp_read_header.rb_id % NB_RB_MAX;
ue_mod_idP = data->pdcp_read_header.rb_id / NB_RB_MAX;
pdcp = &pdcp_array_eNB[enb_mod_idP][ue_mod_idP][rab_id];
rab_id = data->pdcp_read_header.rb_id % maxDRB;
ue_mod_idP = data->pdcp_read_header.rb_id / maxDRB;
pdcp = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][rab_id-1];
}
if (enb_flagP) {
AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
......@@ -510,7 +515,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
ue_mod_idP,
oai_emulation.info.first_ue_local);
}
AssertFatal (rab_id < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rab_id, NB_RB_MAX);
AssertFatal (rab_id < maxDRB, "RB id is too high (%u/%d)!\n", rab_id, maxDRB);
if (rab_id != 0) {
if (pdcp->instanciated_instance) {
......@@ -547,7 +552,8 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
ue_mod_idP,
frameP,
enb_flagP,
rab_id,
SRB_FLAG_NO,
rab_id % maxDRB,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
data->pdcp_read_header.data_size,
......@@ -564,7 +570,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
*/
LOG_D(PDCP, "eNB Try Forcing send on DEFAULT_RAB_ID first_ue_local %u nb_ue_local %u\n", oai_emulation.info.first_ue_local, oai_emulation.info.nb_ue_local);
for (ue_id = 0; ue_id < NB_UE_INST; ue_id++) {
pdcp = &pdcp_array_eNB[enb_mod_idP][ue_id][DEFAULT_RAB_ID];
pdcp = &pdcp_array_drb_eNB[enb_mod_idP][ue_id][DEFAULT_RAB_ID-1];
if (pdcp->instanciated_instance) {
LOG_D(PDCP, "eNB Try Forcing send on DEFAULT_RAB_ID UE %d\n", ue_id);
pdcp_data_req(
......@@ -572,6 +578,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
ue_id,
frameP,
enb_flagP,
SRB_FLAG_NO,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
......@@ -587,6 +594,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_NO,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
......@@ -642,9 +650,9 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
// overwrite function input parameters, because only one netlink socket for all instances
if (pdcp_read_header_g.inst < oai_emulation.info.nb_enb_local) {
enb_flagP = 1;
ue_mod_idP = pdcp_read_header_g.rb_id / NB_RB_MAX + oai_emulation.info.first_ue_local;
ue_mod_idP = pdcp_read_header_g.rb_id / maxDRB + oai_emulation.info.first_ue_local;
enb_mod_idP = pdcp_read_header_g.inst + oai_emulation.info.first_enb_local;
rab_id = pdcp_read_header_g.rb_id % NB_RB_MAX;
rab_id = pdcp_read_header_g.rb_id % maxDRB;
} else {
enb_flagP = 0;
ue_mod_idP = pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local + oai_emulation.info.first_ue_local;
......@@ -667,7 +675,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
"UE inst is too high (%u/%d)!\n",
ue_mod_idP,
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
AssertFatal (rab_id < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rab_id, NB_RB_MAX);
AssertFatal (rab_id < maxDRB, "RB id is too high (%u/%d)!\n", rab_id, maxDRB);
#ifdef OAI_EMU
/*LGpdcp_read_header.inst = (pdcp_read_header_g.inst >= oai_emulation.info.nb_enb_local) ? \
pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local :
......@@ -678,7 +686,8 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
if (enb_flagP) {
if (rab_id != 0) {
if (pdcp_array_eNB[enb_mod_idP][ue_mod_idP][rab_id].instanciated_instance) {
rab_id = rab_id % maxDRB;
if (pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][rab_id-1].instanciated_instance) {
#ifdef PDCP_DEBUG
LOG_I(PDCP, "[FRAME %5u][eNB][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n",
frameP,
......@@ -697,7 +706,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
ue_mod_idP,
rab_id);
pdcp_data_req(enb_mod_idP,ue_mod_idP,frameP, enb_flagP,
pdcp_data_req(enb_mod_idP,ue_mod_idP,frameP, enb_flagP,SRB_FLAG_NO,
rab_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
......@@ -718,7 +727,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
// is a broadcast packet, we have to send this packet on all default RABS of all connected UEs
#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES
for (ue_mod_idP = 0; ue_mod_idP < NB_UE_INST; ue_mod_idP++) {
if (pdcp_array_eNB[enb_mod_idP][ue_mod_idP][rab_id].instanciated_instance == TRUE) {
if (pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][rab_id-1].instanciated_instance == TRUE) {
LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u/%u][RB DEFAULT_RAB_ID %u]\n",
frameP,
pdcp_read_header_g.inst,
......@@ -732,6 +741,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_NO,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
......@@ -743,7 +753,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
}
} else {
if (rab_id != 0) {
if (pdcp_array_ue[ue_mod_idP][rab_id].instanciated_instance) {
if (pdcp_array_drb_ue[ue_mod_idP][rab_id-1].instanciated_instance) {
#ifdef PDCP_DEBUG
LOG_I(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n",
frameP,
......@@ -767,6 +777,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_NO,
rab_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
......@@ -798,6 +809,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_NO,
DEFAULT_RAB_ID,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
......@@ -824,7 +836,7 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m
module_id_t src_id, module_id; // src for otg
module_id_t dst_id; // dst for otg
rb_id_t rb_id;
int pkt_size=0, pkt_cnt=0;
signed long pkt_size=0, pkt_cnt=0;
uint8_t pdcp_mode, is_ue=0;
Packet_otg_elt_t *otg_pkt_info=NULL;
int result;
......@@ -850,18 +862,18 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m
// generate traffic if the ue is rrc reconfigured state
// if (mac_get_rrc_status(module_id, enb_flagP, dst_id ) > 2 /*RRC_CONNECTED*/) { // not needed: this test is already done in update_otg_enb
otg_pkt = (uint8_t*) (otg_pkt_info->otg_pkt).sdu_buffer;
otg_pkt = (unsigned char*) (otg_pkt_info->otg_pkt).sdu_buffer;
pkt_size = (otg_pkt_info->otg_pkt).sdu_buffer_size;
if (otg_pkt != NULL) {
if (is_ue == 0 ) {
rlc_util_print_hex_octets(PDCP,
(unsigned char*)otg_pkt,
otg_pkt,
pkt_size);
//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_mod_idP, frameP, pkt_cnt++, module_id, rb_id, module_id, dst_id, pkt_size, pdcp_mode);
result = pdcp_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,pdcp_mode);
result = pdcp_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,pdcp_mode);
AssertFatal (result == TRUE, "PDCP data request failed!\n");
}
else {
......@@ -874,6 +886,7 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_NO,
rb_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
......@@ -900,8 +913,8 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m
if (mac_get_rrc_status(enb_mod_idP, enb_flagP, dst_id ) > 2) {
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(enb_mod_idP, dst_id, frameP, enb_flagP, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO,pkt_size, otg_pkt, PDCP_TRANSMISSION_MODE_DATA);
rb_id = dst_id * maxDRB + DTCH;
pdcp_data_req(enb_mod_idP, dst_id, frameP, enb_flagP, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO,pkt_size, otg_pkt, PDCP_TRANSMISSION_MODE_DATA);
LOG_I(OTG,"send packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n", enb_mod_idP, rb_id, src_id, dst_id, pkt_size);
free(otg_pkt);
}
......
......@@ -204,7 +204,7 @@ void *pdcp_netlink_thread_fct(void *arg) {
* NOTE: netlink messages can be assembled to form a multipart message
*/
for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf;
NLMSG_OK(nas_nlh_rx, len);
NLMSG_OK(nas_nlh_rx, (unsigned int)len);
nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, len)) {
/* There is no need to check for nlmsg_type because
......
......@@ -38,7 +38,8 @@ Address : EURECOM,
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
# include "assertions.h"
#include "assertions.h"
#include "hashtable.h"
#include "rlc_am.h"
#include "rlc_am_segment.h"
#include "rlc_am_timer_poll_retransmit.h"
......@@ -107,47 +108,58 @@ void rlc_am_release (rlc_am_entity_t *rlc_pP)
}
//-----------------------------------------------------------------------------
void config_req_rlc_am (frame_t frameP,
eNB_flag_t eNB_flagP,
module_id_t enb_module_idP,
module_id_t ue_module_idP,
rlc_am_info_t *config_am_pP,
rb_id_t rb_idP,
rb_type_t rb_typeP)
void config_req_rlc_am (
module_id_t enb_module_idP,
module_id_t ue_module_idP,
frame_t frameP,
eNB_flag_t eNB_flagP,
srb_flag_t srb_flagP,
rlc_am_info_t *config_am_pP,
rb_id_t rb_idP)
{
//-----------------------------------------------------------------------------
rlc_am_entity_t *rlc = NULL;
LOG_D(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %u/%u][RB %u]\n",
frameP,
( eNB_flagP > 0) ? "eNB":"UE",
enb_module_idP,
ue_module_idP,
config_am_pP->max_retx_threshold,
config_am_pP->poll_pdu,
config_am_pP->poll_byte,
config_am_pP->t_poll_retransmit,
config_am_pP->t_reordering,
config_am_pP->t_status_prohibit,
enb_module_idP,
ue_module_idP,
rb_idP);
if (eNB_flagP) {
rlc = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.am;
rlc_union_t *rlc_union_p = NULL;
rlc_am_entity_t *rlc_p = NULL;
hash_key_t key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP);
hashtable_rc_t h_rc;
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
rlc_p = &rlc_union_p->rlc.am;
LOG_D(RLC,
"[FRAME %5u][%s][RRC][MOD %u/%u][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %u/%u][RB %u]\n",
frameP,
( eNB_flagP > 0) ? "eNB":"UE",
enb_module_idP,
ue_module_idP,
config_am_pP->max_retx_threshold,
config_am_pP->poll_pdu,
config_am_pP->poll_byte,
config_am_pP->t_poll_retransmit,
config_am_pP->t_reordering,
config_am_pP->t_status_prohibit,
enb_module_idP,
ue_module_idP,
rb_idP);
rlc_am_init(rlc_p,frameP);
rlc_am_set_debug_infos(rlc_p, frameP, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, srb_flagP);
rlc_am_configure(rlc_p,frameP,
config_am_pP->max_retx_threshold,
config_am_pP->poll_pdu,
config_am_pP->poll_byte,
config_am_pP->t_poll_retransmit,
config_am_pP->t_reordering,
config_am_pP->t_status_prohibit);
} else {
rlc = &rlc_array_ue[ue_module_idP][rb_idP].rlc.am;
LOG_E(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- CONFIG_REQ --->][RLC_AM][MOD %u/%u][RB %u] RLC NOT FOUND\n",
frameP,
(eNB_flagP) ? "eNB" : "UE",
enb_module_idP,
ue_module_idP,
enb_module_idP,
ue_module_idP,
rb_idP);
}
rlc_am_init(rlc,frameP);
rlc_am_set_debug_infos(rlc, frameP, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP);
rlc_am_configure(rlc,frameP,
config_am_pP->max_retx_threshold,
config_am_pP->poll_pdu,
config_am_pP->poll_byte,
config_am_pP->t_poll_retransmit,
config_am_pP->t_reordering,
config_am_pP->t_status_prohibit);
}
uint32_t pollPDU_tab[PollPDU_pInfinity+1]={4,8,16,32,64,128,256,1024}; // What is PollPDU_pInfinity??? 1024 for now
uint32_t maxRetxThreshold_tab[UL_AM_RLC__maxRetxThreshold_t32+1]={1,2,3,4,6,8,16,32};
......@@ -157,70 +169,83 @@ uint32_t am_t_Reordering_tab[T_Reordering_spare1]={0,5,10,15,20,25,30,35,40,45,5
uint32_t t_StatusProhibit_tab[T_StatusProhibit_spare8]={0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500};
//-----------------------------------------------------------------------------
void config_req_rlc_am_asn1 (frame_t frameP,
eNB_flag_t eNB_flagP,
module_id_t enb_module_idP,
module_id_t ue_module_idP,
struct RLC_Config__am *config_am_pP,
rb_id_t rb_idP,
rb_type_t rb_typeP)
void config_req_rlc_am_asn1 (
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const struct RLC_Config__am * const config_am_pP,
const rb_id_t rb_idP)
{
//-----------------------------------------------------------------------------
rlc_am_entity_t *rlc = NULL;
if (eNB_flagP) {
rlc = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.am;
} else {
rlc = &rlc_array_ue[ue_module_idP][rb_idP].rlc.am;
}
if ((config_am_pP->ul_AM_RLC.maxRetxThreshold <= UL_AM_RLC__maxRetxThreshold_t32) &&
(config_am_pP->ul_AM_RLC.pollPDU<=PollPDU_pInfinity) &&
(config_am_pP->ul_AM_RLC.pollByte<PollByte_spare1) &&
(config_am_pP->ul_AM_RLC.t_PollRetransmit<T_PollRetransmit_spare9) &&
(config_am_pP->dl_AM_RLC.t_Reordering<T_Reordering_spare1) &&
(config_am_pP->dl_AM_RLC.t_StatusProhibit<T_StatusProhibit_spare8) ){
LOG_D(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %u/%u][RB %u]\n",
frameP,
(eNB_flagP) ? "eNB" : "UE",
enb_module_idP,
ue_module_idP,
maxRetxThreshold_tab[config_am_pP->ul_AM_RLC.maxRetxThreshold],
pollPDU_tab[config_am_pP->ul_AM_RLC.pollPDU],
pollByte_tab[config_am_pP->ul_AM_RLC.pollByte],
PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit],
am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering],
t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit],
enb_module_idP,
ue_module_idP,
rb_idP);
rlc_am_init(rlc,frameP);
rlc_am_set_debug_infos(rlc, frameP, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP);
rlc_am_configure(rlc,
frameP,
maxRetxThreshold_tab[config_am_pP->ul_AM_RLC.maxRetxThreshold],
pollPDU_tab[config_am_pP->ul_AM_RLC.pollPDU],
pollByte_tab[config_am_pP->ul_AM_RLC.pollByte],
PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit],
am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering],
t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit]);
} else {
LOG_D(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- ILLEGAL CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %u/%u][RB %u], RLC-AM NOT CONFIGURED\n",
frameP,
(eNB_flagP) ? "eNB" : "UE",
enb_module_idP,
ue_module_idP,
config_am_pP->ul_AM_RLC.maxRetxThreshold,
config_am_pP->ul_AM_RLC.pollPDU,
config_am_pP->ul_AM_RLC.pollByte,
config_am_pP->ul_AM_RLC.t_PollRetransmit,
config_am_pP->dl_AM_RLC.t_Reordering,
config_am_pP->dl_AM_RLC.t_StatusProhibit,
enb_module_idP,
ue_module_idP,
rb_idP);
}
rlc_union_t *rlc_union_p = NULL;
rlc_am_entity_t *rlc_p = NULL;
hash_key_t key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP);
hashtable_rc_t h_rc;
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
rlc_p = &rlc_union_p->rlc.am;
if ((config_am_pP->ul_AM_RLC.maxRetxThreshold <= UL_AM_RLC__maxRetxThreshold_t32) &&
(config_am_pP->ul_AM_RLC.pollPDU<=PollPDU_pInfinity) &&
(config_am_pP->ul_AM_RLC.pollByte<PollByte_spare1) &&
(config_am_pP->ul_AM_RLC.t_PollRetransmit<T_PollRetransmit_spare9) &&
(config_am_pP->dl_AM_RLC.t_Reordering<T_Reordering_spare1) &&
(config_am_pP->dl_AM_RLC.t_StatusProhibit<T_StatusProhibit_spare8) ){
LOG_D(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %u/%u][RB %u]\n",
frameP,
(eNB_flagP) ? "eNB" : "UE",
enb_module_idP,
ue_module_idP,
maxRetxThreshold_tab[config_am_pP->ul_AM_RLC.maxRetxThreshold],
pollPDU_tab[config_am_pP->ul_AM_RLC.pollPDU],
pollByte_tab[config_am_pP->ul_AM_RLC.pollByte],
PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit],
am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering],
t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit],
enb_module_idP,
ue_module_idP,
rb_idP);
rlc_am_init(rlc_p,frameP);
rlc_am_set_debug_infos(rlc_p, frameP, eNB_flagP, srb_flagP, enb_module_idP, ue_module_idP, rb_idP);
rlc_am_configure(rlc_p,
frameP,
maxRetxThreshold_tab[config_am_pP->ul_AM_RLC.maxRetxThreshold],
pollPDU_tab[config_am_pP->ul_AM_RLC.pollPDU],
pollByte_tab[config_am_pP->ul_AM_RLC.pollByte],
PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit],
am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering],
t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit]);
} else {
LOG_D(RLC,
"[FRAME %5u][%s][RRC][MOD %u/%u][][--- ILLEGAL CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %u/%u][RB %u], RLC-AM NOT CONFIGURED\n",
frameP,
(eNB_flagP) ? "eNB" : "UE",
enb_module_idP,
ue_module_idP,
config_am_pP->ul_AM_RLC.maxRetxThreshold,
config_am_pP->ul_AM_RLC.pollPDU,
config_am_pP->ul_AM_RLC.pollByte,
config_am_pP->ul_AM_RLC.t_PollRetransmit,
config_am_pP->dl_AM_RLC.t_Reordering,
config_am_pP->dl_AM_RLC.t_StatusProhibit,
enb_module_idP,
ue_module_idP,
rb_idP);
}
} else {
LOG_E(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- CONFIG_REQ --->][RLC_AM][MOD %u/%u][RB %u] RLC NOT FOUND\n",
frameP,
(eNB_flagP) ? "eNB" : "UE",
enb_module_idP,
ue_module_idP,
enb_module_idP,
ue_module_idP,
rb_idP);
}
}
//-----------------------------------------------------------------------------
......@@ -386,19 +411,23 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP)
return;
} else if ((tx_data_pdu_management->retx_count >= 0) && (rlc_pP->nb_bytes_requested_by_mac >= RLC_AM_MIN_SEGMENT_SIZE_REQUEST)) {
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] SEND SEGMENT OF DATA PDU SN %04d MAC BYTES %d SIZE %d RTX COUNT %d nack_so_start %d nack_so_stop %04X(hex)\n",
frameP,
(rlc_pP->is_enb) ? "eNB" : "UE",
rlc_pP->enb_module_id,
rlc_pP->ue_module_id,
rlc_pP->rb_id,
rlc_pP->first_retrans_pdu_sn,
rlc_pP->nb_bytes_requested_by_mac,
tx_data_pdu_management->header_and_payload_size,
tx_data_pdu_management->retx_count,
tx_data_pdu_management->nack_so_start,
tx_data_pdu_management->nack_so_stop);
mem_block_t* copy = rlc_am_retransmit_get_subsegment(rlc_pP, frameP, rlc_pP->first_retrans_pdu_sn, &rlc_pP->nb_bytes_requested_by_mac);
frameP,
(rlc_pP->is_enb) ? "eNB" : "UE",
rlc_pP->enb_module_id,
rlc_pP->ue_module_id,
rlc_pP->rb_id,
rlc_pP->first_retrans_pdu_sn,
rlc_pP->nb_bytes_requested_by_mac,
tx_data_pdu_management->header_and_payload_size,
tx_data_pdu_management->retx_count,
tx_data_pdu_management->nack_so_start,
tx_data_pdu_management->nack_so_stop);
mem_block_t* copy = rlc_am_retransmit_get_subsegment(
rlc_pP,
frameP,
rlc_pP->first_retrans_pdu_sn,
&rlc_pP->nb_bytes_requested_by_mac);
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] SEND SEGMENT OF DATA PDU SN %04d (NEW SO %05d)\n",
frameP,
(rlc_pP->is_enb) ? "eNB" : "UE",
......@@ -557,9 +586,9 @@ rlc_am_mac_status_indication (void *rlc_pP, frame_t frameP, uint16_t tb_sizeP, s
rlc->nb_bytes_requested_by_mac = tb_sizeP;
status_resp.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(rlc,frameP);
if ((rlc->input_sdus[rlc->current_sdu_index].mem_block != NULL) && (status_resp.buffer_occupancy_in_bytes)) {
//status_resp.buffer_occupancy_in_bytes += ((rlc_am_entity_t *) rlc)->tx_header_min_length_in_bytes;
status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu;
diff_time = frameP - ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_creation_time;
......@@ -571,7 +600,7 @@ rlc_am_mac_status_indication (void *rlc_pP, frame_t frameP, uint16_t tb_sizeP, s
status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size;
if (sdu_size == sdu_remaining_size) {
status_resp.head_sdu_is_segmented = 0;
status_resp.head_sdu_is_segmented = 0;
}
else {
status_resp.head_sdu_is_segmented = 1;
......@@ -579,8 +608,8 @@ rlc_am_mac_status_indication (void *rlc_pP, frame_t frameP, uint16_t tb_sizeP, s
} else {
}
#ifdef TRACE_RLC_AM_TX_STATUS
if (tb_sizeP > 0) {
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_STATUS_INDICATION (DATA) %d bytes -> %d bytes\n",
......@@ -615,7 +644,7 @@ rlc_am_mac_data_request (void *rlc_pP, frame_t frameP)
rlc_am_pdu_info_t pdu_info;
rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p;
mem_block_t *tb_p;
int16_t tb_size_in_bytes;
tb_size_t tb_size_in_bytes;
int num_nack;
char message_string[9000];
size_t message_string_size = 0;
......@@ -775,7 +804,7 @@ rlc_am_mac_data_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP,
rlc_am_pdu_info_t pdu_info;
rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p;
mem_block_t *tb_p;
int16_t tb_size_in_bytes;
sdu_size_t tb_size_in_bytes;
int num_nack;
char message_string[7000];
size_t message_string_size = 0;
......
......@@ -93,35 +93,49 @@ Address : EURECOM,
* \brief Empty function, TO DO.
* \param[in] rlcP RLC AM protocol instance pointer.
*/
public_rlc_am(void rlc_am_release (rlc_am_entity_t *rlcP);)
public_rlc_am(void rlc_am_release (rlc_am_entity_t * const rlcP);)
/** @addtogroup _rlc_am_init_impl_
* @{
*/
/*! \fn void config_req_rlc_am (uint32_t frame, uint8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
/*! \fn void config_req_rlc_am (const frame_t frame, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const module_id_t enb_module_idP, const module_id_t ue_module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP)
* \brief Configure the UL and DL parameters of the RLC AM
* \param[in] frame Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
* \param[in] enb_module_idP eNB Virtualized module identifier.
* \param[in] ue_module_idP UE Virtualized module identifier.
* \param[in] config_amP Configuration parameters for RLC AM instance.
* \param[in] rb_idP Radio bearer identifier.
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
*/
public_rlc_am(void config_req_rlc_am (uint32_t frame, uint8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP);)
public_rlc_am(void config_req_rlc_am (
const frame_t frame,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const rlc_am_info_t * const config_amP,
const rb_id_t rb_idP);)
/*! \fn void config_req_rlc_am_asn1 (uint32_t frame, uint8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
/*! \fn void config_req_rlc_am_asn1 (const frame_t frame, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const module_id_t enb_module_idP, const module_id_t ue_module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP)
* \brief Configure the UL and DL parameters of the RLC AM with the asn1c autogenerated pameters structs
* \param[in] frame Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
* \param[in] enb_module_idP eNB Virtualized module identifier.
* \param[in] ue_module_idP UE Virtualized module identifier.
* \param[in] config_amP Configuration parameters for RLC AM instance.
* \param[in] rb_idP Radio bearer identifier.
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
*/
public_rlc_am(void config_req_rlc_am_asn1 (uint32_t frame, uint8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP);)
public_rlc_am(void config_req_rlc_am_asn1 (
const const frame_t frame,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const struct RLC_Config__am * const config_amP,
const rb_id_t rb_idP);)
/** @} */
......@@ -218,14 +232,14 @@ public_rlc_am(void rlc_am_stat_req (rlc_am_entity_t *rlcP,
*/
private_rlc_am( void rlc_am_get_pdus (void *argP);)
/*! \fn void rlc_am_rx (void *rlcP, uint32_t frame, uint8_t eNB_flag, struct mac_data_ind data_indication)
/*! \fn void rlc_am_rx (void *rlcP, uint32_t frame, const eNB_flag_t eNB_flag, struct mac_data_ind data_indication)
* \brief Process the received PDUs from lower layer.
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0).
* \param[in] data_indication PDUs from MAC.
*/
protected_rlc_am( void rlc_am_rx (void *, uint32_t frame, struct mac_data_ind);)
protected_rlc_am( void rlc_am_rx (void *, const frame_t frame, struct mac_data_ind);)
/*! \fn struct mac_status_resp rlc_am_mac_status_indication (void *rlcP, uint32_t frame,uint16_t tbs_sizeP, struct mac_status_ind tx_statusP)
* \brief Request the maximum number of bytes that can be served by RLC instance to MAC and fix the amount of bytes requested by MAC for next RLC transmission.
......@@ -235,7 +249,7 @@ protected_rlc_am( void rlc_am_rx (void *, uint32_t frame, struct mac_data_in
* \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU.
* \return The maximum number of bytes that can be served by RLC instance to MAC.
*/
public_rlc_am( struct mac_status_resp rlc_am_mac_status_indication (void *rlcP, uint32_t frame, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP);)
public_rlc_am( struct mac_status_resp rlc_am_mac_status_indication (void *rlcP, const frame_t frame, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP);)
/*! \fn struct mac_data_req rlc_am_mac_data_request (void *rlcP, uint32_t frame)
* \brief Gives PDUs to lower layer MAC.
......@@ -243,16 +257,16 @@ public_rlc_am( struct mac_status_resp rlc_am_mac_status_indication (void *rlc
* \param[in] frame Frame index.
* \return A PDU of the previously requested number of bytes, and the updated maximum number of bytes that can be served by RLC instance to MAC for next RLC transmission.
*/
public_rlc_am( struct mac_data_req rlc_am_mac_data_request (void *rlcP, uint32_t frame);)
public_rlc_am( struct mac_data_req rlc_am_mac_data_request (void *rlcP, const frame_t frame);)
/*! \fn void rlc_am_mac_data_indication (void *rlcP, uint32_t frame, uint8_t eNB_flag, struct mac_data_ind data_indP)
/*! \fn void rlc_am_mac_data_indication (void *rlcP, uint32_t frame, const eNB_flag_t eNB_flag, struct mac_data_ind data_indP)
* \brief Receive PDUs from lower layer MAC.
* \param[in] rlcP RLC UM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0).
* \param[in] data_indP PDUs from MAC.
*/
public_rlc_am( void rlc_am_mac_data_indication (void *rlcP, uint32_t frame, uint8_t eNB_flag, struct mac_data_ind data_indP);)
public_rlc_am( void rlc_am_mac_data_indication (void *rlcP, const frame_t frame, const eNB_flag_t eNB_flag, struct mac_data_ind data_indP);)
/*! \fn void rlc_am_data_req (void *rlcP, uint32_t frame, mem_block_t *sduP)
* \brief Interface with higher layers, buffer higher layer SDUS for transmission.
......@@ -260,6 +274,6 @@ public_rlc_am( void rlc_am_mac_data_indication (void *rlcP, uint32_t fram
* \param[in] frame Frame index.
* \param[in] sduP SDU. (A struct rlc_am_data_req is mapped on sduP->data.)
*/
public_rlc_am( void rlc_am_data_req (void *rlcP, uint32_t frame, mem_block_t *sduP);)
public_rlc_am( void rlc_am_data_req (void *rlcP, const frame_t frame, mem_block_t *sduP);)
/** @} */
# endif
......@@ -73,7 +73,6 @@ typedef struct rlc_am_entity_s {
//---------------------------------------------------------------------
// TX BUFFERS
//---------------------------------------------------------------------
mem_block_t* input_sdus_alloc; /*!< \brief Allocated memory for the input SDU buffer (for SDUs coming from upper layers). */
rlc_am_tx_sdu_management_t *input_sdus; /*!< \brief Input SDU buffer (for SDUs coming from upper layers). */
signed int nb_sdu; /*!< \brief Total number of valid rlc_am_tx_sdu_management_t in input_sdus[]. */
signed int nb_sdu_no_segmented; /*!< \brief Total number of SDUs not segmented and partially segmented. */
......@@ -81,7 +80,6 @@ typedef struct rlc_am_entity_s {
signed int current_sdu_index; /*!< \brief Current SDU index in input_sdus array to be segmented. */
mem_block_t* pdu_retrans_buffer_alloc; /*!< \brief Allocated memory for the retransmission buffer. */
rlc_am_tx_data_pdu_management_t *pdu_retrans_buffer; /*!< \brief Retransmission buffer. */
signed int retrans_num_pdus; /*!< \brief Number of PDUs in the retransmission buffer. */
signed int retrans_num_bytes; /*!< \brief Number of bytes in the retransmission buffer. */
......@@ -175,7 +173,7 @@ typedef struct rlc_am_entity_s {
//---------------------------------------------------------------------
// OUTPUTS
//---------------------------------------------------------------------
uint16_t nb_bytes_requested_by_mac; /*!< \brief Number of bytes requested by lower layer for next transmission. */
sdu_size_t nb_bytes_requested_by_mac; /*!< \brief Number of bytes requested by lower layer for next transmission. */
list_t pdus_to_mac_layer; /*!< \brief PDUs buffered for transmission to MAC layer. */
list_t control_pdu_list; /*!< \brief Control PDUs buffered for transmission to MAC layer. */
rlc_sn_t first_retrans_pdu_sn; /*!< \brief Lowest sequence number of PDU to be retransmitted. */
......
......@@ -45,7 +45,10 @@ Address : EURECOM,
#define TRACE_RLC_AM_FREE_SDU
//-----------------------------------------------------------------------------
void rlc_am_free_in_sdu(rlc_am_entity_t *rlcP, frame_t frameP, unsigned int index_in_bufferP)
void rlc_am_free_in_sdu(
rlc_am_entity_t *const rlcP,
const frame_t frameP,
const unsigned int index_in_bufferP)
//-----------------------------------------------------------------------------
{
if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
......@@ -82,7 +85,9 @@ void rlc_am_free_in_sdu(rlc_am_entity_t *rlcP, frame_t frameP, unsigned int inde
}
// called when segmentation is done
//-----------------------------------------------------------------------------
void rlc_am_free_in_sdu_data(rlc_am_entity_t *rlcP, unsigned int index_in_bufferP)
void rlc_am_free_in_sdu_data(
rlc_am_entity_t *const rlcP,
const unsigned int index_in_bufferP)
//-----------------------------------------------------------------------------
{
if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
......@@ -95,7 +100,7 @@ void rlc_am_free_in_sdu_data(rlc_am_entity_t *rlcP, unsigned int index_in_buffer
}
}
//-----------------------------------------------------------------------------
signed int rlc_am_in_sdu_is_empty(rlc_am_entity_t *rlcP)
signed int rlc_am_in_sdu_is_empty(rlc_am_entity_t *const rlcP)
//-----------------------------------------------------------------------------
{
if (rlcP->nb_sdu == 0) {
......@@ -103,117 +108,3 @@ signed int rlc_am_in_sdu_is_empty(rlc_am_entity_t *rlcP)
}
return 0;
}
//uint8_t in_sdu_data_ring_buffer [RLC_AM_SDU_DATA_BUFFER_SIZE];
//rlc_am_in_sdu_control_t in_sdu_control_ring_buffer[RLC_AM_SDU_CONTROL_BUFFER_SIZE];
//signed int in_sdu_data_buffer_index_start;
//signed int in_sdu_data_buffer_index_end;
//signed int in_sdu_data_buffer_index_next;
//signed int in_sdu_control_buffer_index_start;
//signed int in_sdu_control_buffer_index_end;
//signed int in_sdu_control_buffer_index_next;
/*//-----------------------------------------------------------------------------
signed int rlc_am_in_sdu_data_get_available_size(rlc_am_entity_t *rlcP)
//-----------------------------------------------------------------------------
{
signed int index_diff = rlcP->in_sdu_data_buffer_index_next - rlcP->in_sdu_data_buffer_index_start;
if (index_diff > 0) {
return RLC_AM_SDU_DATA_BUFFER_SIZE - index_diff;
} else {
return 0 - index_diff;
}
}
//-----------------------------------------------------------------------------
signed int rlc_am_in_sdu_control_get_available_size(rlc_am_entity_t *rlcP)
//-----------------------------------------------------------------------------
{
signed int index_diff = rlcP->in_sdu_control_buffer_index_next - rlcP->in_sdu_control_buffer_index_start;
if (index_diff > 0) {
return RLC_AM_SDU_CONTROL_BUFFER_SIZE - index_diff;
} else {
return 0 - index_diff;
}
}
//-----------------------------------------------------------------------------
void rlc_am_in_sdu_data_copy_sdu(rlc_am_entity_t *rlcP, char* sourceP, unsigned int sizeP, unsigned int muiP)
//-----------------------------------------------------------------------------
{
signed int index_diff = rlcP->in_sdu_data_buffer_index_next - rlcP->in_sdu_data_buffer_index_start;
if (index_diff > 0) {
signed int available_size_first_write = RLC_AM_SDU_DATA_BUFFER_SIZE - rlcP->in_sdu_data_buffer_index_next;
if (sizeP <= available_size_first_write) {
memcpy(&rlcP->in_sdu_data_ring_buffer[rlcP->in_sdu_data_buffer_index_next],
sourceP,
sizeP);
} else {
memcpy(&rlcP->in_sdu_data_ring_buffer[rlcP->in_sdu_data_buffer_index_next],
sourceP,
available_size_first_write);
memcpy(&rlcP->in_sdu_data_ring_buffer[0],
&sourceP[available_size_first_write],
sizeP - available_size_first_write);
}
} else {
memcpy(&rlcP->in_sdu_data_ring_buffer[rlcP->in_sdu_data_buffer_index_next],
sourceP,
sizeP);
}
rlcP->in_sdu_control_ring_buffer[rlcP->in_sdu_control_buffer_index_next].sdu_data_buffer_index_start = rlcP->in_sdu_data_buffer_index_next;
rlcP->in_sdu_control_ring_buffer[rlcP->in_sdu_control_buffer_index_next].sdu_data_buffer_index_end = (rlcP->in_sdu_data_buffer_index_end + sizeP) % RLC_AM_SDU_DATA_BUFFER_SIZE;
rlcP->in_sdu_control_ring_buffer[rlcP->in_sdu_control_buffer_index_next].sdu_size = sizeP;
rlcP->in_sdu_control_ring_buffer[rlcP->in_sdu_control_buffer_index_next].sdu_mui = muiP;
rlcP->in_sdu_control_ring_buffer[rlcP->in_sdu_control_buffer_index_next].sdu_segmented_size = 0;
rlcP->in_sdu_control_ring_buffer[rlcP->in_sdu_control_buffer_index_next].nb_pdus = 0;
rlcP->in_sdu_control_ring_buffer[rlcP->in_sdu_control_buffer_index_next].nb_pdus_ack = 0;
rlcP->in_sdu_control_ring_buffer[rlcP->in_sdu_control_buffer_index_next].segmented = 0;
rlcP->in_sdu_control_ring_buffer[rlcP->in_sdu_control_buffer_index_next].discarded = 0;
rlcP->in_sdu_data_buffer_index_end = (rlcP->in_sdu_data_buffer_index_end + sizeP) % RLC_AM_SDU_DATA_BUFFER_SIZE;
rlcP->in_sdu_data_buffer_index_next = (rlcP->in_sdu_data_buffer_index_end + 1) % RLC_AM_SDU_DATA_BUFFER_SIZE;
rlcP->in_sdu_control_buffer_index_end = (rlcP->in_sdu_control_buffer_index_end + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
rlcP->in_sdu_control_buffer_index_next = (rlcP->in_sdu_control_buffer_index_end + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
//rlc->stat_tx_pdcp_sdu += 1;
}
//-----------------------------------------------------------------------------
void rlc_am_in_sdu_data_req (rlc_am_entity_t *rlcP, mem_block_t * sduP)
//-----------------------------------------------------------------------------
{
uint32_t mui;
uint16_t data_offset;
uint16_t data_size;
if (rlcP->protocol_state == RLC_NULL_STATE) {
#ifdef DEBUG_RLC_AM_DATA_REQUEST
msg ("[RLC_AM] RLC_AM_DATA_REQ RLC NOT INITIALIZED, DISCARD SDU\n");
#endif
free_mem_block (sduP);
}
signed int size_available_in_data_buffer = rlc_am_in_sdu_data_get_available_size();
signed int size_available_in_control_buffer = rlc_am_in_sdu_control_get_available_size();
if ((size_available_in_control_buffer > 0) && (size_available_in_control_buffer > 0)){
// parameters from SDU
mui = ((struct rlc_am_data_req *) (sduP->data))->mui;
data_offset = ((struct rlc_am_data_req *) (sduP->data))->data_offset;
data_size = ((struct rlc_am_data_req *) (sduP->data))->data_size;
rlc_am_in_sdu_data_copy_sdu(rlcP, &sduP->data[data_offset], data_size, mui);
} else {
#ifdef DEBUG_RLC_AM_DATA_REQUEST
msg ("[RLC_AM][RB %d] RLC_AM_DATA_REQ BUFFER FULL, NB SDU %d current_sdu_index=%d next_sdu_index=%d size_input_sdus_buffer=%d\n",
rlcP->rb_id, size_available_in_control_buffer, rlcP->in_sdu_control_buffer_index_start, rlcP->in_sdu_control_buffer_index_end, size_available_in_data_buffer);
#endif
rlc->stat_tx_pdcp_sdu_discarded += 1;
free_mem_block (sduP);
}
}*/
......@@ -53,10 +53,8 @@ void rlc_am_init(rlc_am_entity_t *rlc_pP, frame_t frameP)
list_init(&rlc_pP->segmentation_pdu_list, "SEGMENTATION PDU LIST");
//LOG_D(RLC,"RLC_AM_SDU_CONTROL_BUFFER_SIZE %d sizeof(rlc_am_tx_sdu_management_t) %d \n", RLC_AM_SDU_CONTROL_BUFFER_SIZE, sizeof(rlc_am_tx_sdu_management_t));
rlc_pP->input_sdus_alloc = get_free_mem_block(RLC_AM_SDU_CONTROL_BUFFER_SIZE*sizeof(rlc_am_tx_sdu_management_t));
rlc_pP->input_sdus = (rlc_am_tx_sdu_management_t*)((rlc_pP->input_sdus_alloc)->data);
rlc_pP->pdu_retrans_buffer_alloc = get_free_mem_block((uint16_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(rlc_am_tx_data_pdu_management_t)));
rlc_pP->pdu_retrans_buffer = (rlc_am_tx_data_pdu_management_t*)((rlc_pP->pdu_retrans_buffer_alloc)->data);
rlc_pP->input_sdus = calloc(1, RLC_AM_SDU_CONTROL_BUFFER_SIZE*sizeof(rlc_am_tx_sdu_management_t));
rlc_pP->pdu_retrans_buffer = calloc(1, (uint16_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(rlc_am_tx_data_pdu_management_t)));
LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] input_sdus[] = %p element size=%d\n", frameP, rlc_pP->input_sdus,sizeof(rlc_am_tx_sdu_management_t));
LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] pdu_retrans_buffer[] = %p element size=%d\n", frameP, rlc_pP->pdu_retrans_buffer,sizeof(rlc_am_tx_data_pdu_management_t));
......@@ -79,11 +77,10 @@ void rlc_am_init(rlc_am_entity_t *rlc_pP, frame_t frameP)
rlc_pP->first_retrans_pdu_sn = -1;
}
//-----------------------------------------------------------------------------
void rlc_am_cleanup(rlc_am_entity_t *rlc_pP, frame_t frameP)
void rlc_am_cleanup(rlc_am_entity_t *rlc_pP)
//-----------------------------------------------------------------------------
{
LOG_I(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][CLEANUP]\n",
frameP,
LOG_I(RLC, "[FRAME ?????][%s][RLC_AM][MOD %u/%u][RB %u][CLEANUP]\n",
(rlc_pP->is_enb) ? "eNB" : "UE",
rlc_pP->enb_module_id,
rlc_pP->ue_module_id,
......@@ -100,26 +97,24 @@ void rlc_am_cleanup(rlc_am_entity_t *rlc_pP, frame_t frameP)
rlc_pP->output_sdu_in_construction = NULL;
}
unsigned int i;
if (rlc_pP->input_sdus_alloc != NULL) {
if (rlc_pP->input_sdus != NULL) {
for (i=0; i < RLC_AM_SDU_CONTROL_BUFFER_SIZE; i++) {
if (rlc_pP->input_sdus[i].mem_block != NULL) {
free_mem_block(rlc_pP->input_sdus[i].mem_block);
rlc_pP->input_sdus[i].mem_block = NULL;
}
}
free_mem_block(rlc_pP->input_sdus_alloc);
rlc_pP->input_sdus_alloc = NULL;
free(rlc_pP->input_sdus);
rlc_pP->input_sdus = NULL;
}
if (rlc_pP->pdu_retrans_buffer_alloc != NULL) {
if (rlc_pP->pdu_retrans_buffer != NULL) {
for (i=0; i < RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE; i++) {
if (rlc_pP->pdu_retrans_buffer[i].mem_block != NULL) {
free_mem_block(rlc_pP->pdu_retrans_buffer[i].mem_block);
rlc_pP->pdu_retrans_buffer[i].mem_block = NULL;
}
}
free_mem_block(rlc_pP->pdu_retrans_buffer_alloc);
rlc_pP->pdu_retrans_buffer_alloc = NULL;
free(rlc_pP->pdu_retrans_buffer);
rlc_pP->pdu_retrans_buffer = NULL;
}
memset(rlc_pP, 0, sizeof(rlc_am_entity_t));
......@@ -161,13 +156,13 @@ void rlc_am_configure(rlc_am_entity_t *rlc_pP,
void rlc_am_set_debug_infos(rlc_am_entity_t *rlc_pP,
frame_t frameP,
eNB_flag_t eNB_flagP,
srb_flag_t srb_flagP,
module_id_t enb_module_idP,
module_id_t ue_module_idP,
rb_id_t rb_idP,
rb_type_t rb_typeP)
rb_id_t rb_idP)
//-----------------------------------------------------------------------------
{
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SET DEBUG INFOS] module_id %d rb_id %d rb_type %d\n",
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SET DEBUG INFOS] module_id %d rb_id %d is SRB %d\n",
frameP,
(rlc_pP->is_enb) ? "eNB" : "UE",
rlc_pP->enb_module_id,
......@@ -176,15 +171,15 @@ void rlc_am_set_debug_infos(rlc_am_entity_t *rlc_pP,
enb_module_idP,
ue_module_idP,
rb_idP,
rb_typeP);
(srb_flagP) ? "TRUE" : "FALSE");
rlc_pP->enb_module_id = enb_module_idP;
rlc_pP->ue_module_id = ue_module_idP;
rlc_pP->rb_id = rb_idP;
if (rb_typeP != SIGNALLING_RADIO_BEARER) {
rlc_pP->is_data_plane = 1;
} else {
if (srb_flagP) {
rlc_pP->is_data_plane = 0;
} else {
rlc_pP->is_data_plane = 1;
}
rlc_pP->is_enb = eNB_flagP;
}
......@@ -88,12 +88,11 @@ typedef volatile struct {
*/
public_rlc_am_init( void rlc_am_init (rlc_am_entity_t* rlc_pP,frame_t frameP);)
/*! \fn void rlc_am_cleanup(rlc_am_entity_t* rlc_pP,frame_t frameP)
/*! \fn void rlc_am_cleanup(rlc_am_entity_t* rlc_pP)
* \brief Free all memory resources allocated and kept by this RLC AM instance.
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] frame Frame index
*/
public_rlc_am_init( void rlc_am_cleanup(rlc_am_entity_t* rlc_pP,frame_t frameP);)
public_rlc_am_init( void rlc_am_cleanup(rlc_am_entity_t* rlc_pP);)
/*! \fn void rlc_am_configure(rlc_am_entity_t *rlc_pP, frame_t frameP, uint16_t max_retx_thresholdP, uint16_t poll_pduP, uint16_t poll_byteP, uint32_t t_poll_retransmitP, uint32_t t_reorderingP, uint32_t t_status_prohibitP)
* \brief Set RLC AM protocol parameters.
......@@ -116,16 +115,16 @@ public_rlc_am_init( void rlc_am_configure(rlc_am_entity_t *rlc_pP,
uint32_t t_reorderingP,
uint32_t t_status_prohibitP);)
/*! \fn void rlc_am_set_debug_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
/*! \fn void rlc_am_set_debug_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, srb_flag_t srb_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP)
* \brief Set informations that will be displayed in traces, helping the debug process.
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] frame Frame index
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
* \param[in] enb_module_idP eNB Virtualization variable, module identifier.
* \param[in] ue_module_idP UE Virtualization variable, module identifier.
* \param[in] rb_idP Radio bearer identifier.
* \param[in] rb_typeP Radio bearer type (Signalling or data).
*/
public_rlc_am_init( void rlc_am_set_debug_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP);)
public_rlc_am_init( void rlc_am_set_debug_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, srb_flag_t srb_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP);)
/** @} */
#endif
......@@ -128,7 +128,16 @@ void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_fla
rlc_pP->output_sdu_size_to_write,
rlc_pP->output_sdu_in_construction);
#else
rlc_data_ind (rlc_pP->enb_module_id, rlc_pP->ue_module_id, frameP, eNB_flagP, MBMS_FLAG_NO, rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write, rlc_pP->output_sdu_in_construction, rlc_pP->is_data_plane);
rlc_data_ind (
rlc_pP->enb_module_id,
rlc_pP->ue_module_id,
frameP,
eNB_flagP,
BOOL_NOT(rlc_pP->is_data_plane),
MBMS_FLAG_NO,
rlc_pP->rb_id,
rlc_pP->output_sdu_size_to_write,
rlc_pP->output_sdu_in_construction);
#endif
rlc_pP->output_sdu_in_construction = NULL;
} else {
......
......@@ -45,7 +45,7 @@ Address : EURECOM,
//#define DEBUG_RLC_AM_DISPLAY_TB_DATA
//#define RLC_AM_GENERATE_ERRORS
//-----------------------------------------------------------------------------
signed int rlc_am_get_data_pdu_infos(frame_t frameP, rlc_am_pdu_sn_10_t* header_pP, int16_t total_sizeP, rlc_am_pdu_info_t* pdu_info_pP)
signed int rlc_am_get_data_pdu_infos(const const frame_t frameP, rlc_am_pdu_sn_10_t* header_pP, int16_t total_sizeP, rlc_am_pdu_info_t* pdu_info_pP)
//-----------------------------------------------------------------------------
{
memset(pdu_info_pP, 0, sizeof (rlc_am_pdu_info_t));
......@@ -124,7 +124,7 @@ signed int rlc_am_get_data_pdu_infos(frame_t frameP, rlc_am_pdu_sn_10_t* header_
}
}
//-----------------------------------------------------------------------------
void rlc_am_display_data_pdu_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_am_pdu_info_t* pdu_info_pP)
void rlc_am_display_data_pdu_infos(rlc_am_entity_t * const rlc_pP, const const frame_t frameP, rlc_am_pdu_info_t* pdu_info_pP)
//-----------------------------------------------------------------------------
{
int num_li;
......@@ -170,7 +170,7 @@ void rlc_am_display_data_pdu_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_
}
// assumed the sn of the tb_p is equal to VR(MS)
//-----------------------------------------------------------------------------
void rlc_am_rx_update_vr_ms(rlc_am_entity_t *rlc_pP, frame_t frameP, mem_block_t* tb_pP)
void rlc_am_rx_update_vr_ms(rlc_am_entity_t * const rlc_pP, const const frame_t frameP, mem_block_t* tb_pP)
//-----------------------------------------------------------------------------
{
//rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
......@@ -211,7 +211,7 @@ void rlc_am_rx_update_vr_ms(rlc_am_entity_t *rlc_pP, frame_t frameP, mem_block_t
}
// assumed the sn of the tb_p is equal to VR(R)
//-----------------------------------------------------------------------------
void rlc_am_rx_update_vr_r(rlc_am_entity_t *rlc_pP,frame_t frameP,mem_block_t* tb_pP)
void rlc_am_rx_update_vr_r(rlc_am_entity_t * const rlc_pP,const const frame_t frameP,mem_block_t* tb_pP)
//-----------------------------------------------------------------------------
{
rlc_am_pdu_info_t* pdu_info_cursor_p = NULL;
......@@ -249,12 +249,12 @@ void rlc_am_rx_update_vr_r(rlc_am_entity_t *rlc_pP,frame_t frameP,mem_block_t* t
}
//-----------------------------------------------------------------------------
void
rlc_am_receive_routing (rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP)
rlc_am_receive_routing (rlc_am_entity_t * const rlc_pP, const const frame_t frameP, const eNB_flag_t eNB_flagP, struct mac_data_ind data_indP)
//-----------------------------------------------------------------------------
{
mem_block_t *tb_p = NULL;
mem_block_t *tb_p = NULL;
uint8_t *first_byte_p = NULL;
int16_t tb_size_in_bytes;
sdu_size_t tb_size_in_bytes;
while ((tb_p = list_remove_head (&data_indP.data))) {
first_byte_p = ((struct mac_tb_ind *) (tb_p->data))->data_ptr;
......@@ -286,7 +286,7 @@ rlc_am_receive_routing (rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_
} // end while
}
//-----------------------------------------------------------------------------
void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t* tb_pP, uint8_t* first_byte_pP, uint16_t tb_size_in_bytesP)
void rlc_am_receive_process_data_pdu (rlc_am_entity_t * const rlc_pP, const const frame_t frameP, const eNB_flag_t eNB_flagP, mem_block_t* tb_pP, uint8_t* first_byte_pP, uint16_t tb_size_in_bytesP)
//-----------------------------------------------------------------------------
{
// 5.1.3.2 Receive operations
......
......@@ -59,7 +59,7 @@ Address : EURECOM,
# define public_rlc_am_receiver(x) extern x
# endif
# endif
/*! \fn signed int rlc_am_get_data_pdu_infos(frame_t frameP, rlc_am_pdu_sn_10_t* headerP, int16_t sizeP, rlc_am_pdu_info_t* pdu_infoP)
/*! \fn signed int rlc_am_get_data_pdu_infos(const frame_t frameP, rlc_am_pdu_sn_10_t* headerP, int16_t sizeP, rlc_am_pdu_info_t* pdu_infoP)
* \brief Extract PDU informations (header fields, data size, etc) from the serialized PDU.
* \param[in] frame Frame index.
* \param[in] headerP RLC AM header PDU pointer.
......@@ -67,44 +67,44 @@ Address : EURECOM,
* \param[in] pdu_infoP Structure containing extracted informations from PDU.
* \return 0 if no error was encountered during the parsing of the PDU, else -1;
*/
protected_rlc_am_receiver( signed int rlc_am_get_data_pdu_infos(frame_t frameP, rlc_am_pdu_sn_10_t* headerP, int16_t sizeP, rlc_am_pdu_info_t* pdu_infoP));
protected_rlc_am_receiver( signed int rlc_am_get_data_pdu_infos(const frame_t frameP, rlc_am_pdu_sn_10_t* headerP, int16_t sizeP, rlc_am_pdu_info_t* pdu_infoP));
/*! \fn void rlc_am_display_data_pdu_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_am_pdu_info_t* pdu_infoP)
/*! \fn void rlc_am_display_data_pdu_infos(rlc_am_entity_t * const rlc_pP, const frame_t frameP, rlc_am_pdu_info_t* pdu_infoP)
* \brief Display RLC AM PDU informations.
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] pdu_infoP Structure containing extracted informations of a PDU.
*/
protected_rlc_am_receiver( void rlc_am_display_data_pdu_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_am_pdu_info_t* pdu_infoP);)
protected_rlc_am_receiver( void rlc_am_display_data_pdu_infos(rlc_am_entity_t * const rlc_pP, const frame_t frameP, rlc_am_pdu_info_t* pdu_infoP);)
/*! \fn void rlc_am_rx_update_vr_ms(rlc_am_entity_t *rlc_pP,mem_block_t* tb_pP)
/*! \fn void rlc_am_rx_update_vr_ms(rlc_am_entity_t * const rlc_pP,mem_block_t* tb_pP)
* \brief Update RLC AM protocol variable VR(MS).
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] tb_pP PDU embedded in a mem_block_t struct.
* \note It is assumed that the sequence number of the transport block is equal to VR(MS)
*/
protected_rlc_am_receiver( void rlc_am_rx_update_vr_ms(rlc_am_entity_t *rlc_pP,frame_t frameP, mem_block_t* tb_pP);)
protected_rlc_am_receiver( void rlc_am_rx_update_vr_ms(rlc_am_entity_t * const rlc_pP,const frame_t frameP, mem_block_t* tb_pP);)
/*! \fn void rlc_am_rx_update_vr_r (rlc_am_entity_t *rlc_pP,frame_t frameP,mem_block_t* tb_pP)
/*! \fn void rlc_am_rx_update_vr_r (rlc_am_entity_t * const rlc_pP,const frame_t frameP,mem_block_t* tb_pP)
* \brief Update RLC AM protocol variable VR(R).
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] tb_pP PDU embedded in a mem_block_t struct.
* \note It is assumed that the sequence number of the transport block is equal to VR(R)
*/
protected_rlc_am_receiver( void rlc_am_rx_update_vr_r (rlc_am_entity_t *rlc_pP,frame_t frameP, mem_block_t* tb_pP);)
protected_rlc_am_receiver( void rlc_am_rx_update_vr_r (rlc_am_entity_t * const rlc_pP,const frame_t frameP, mem_block_t* tb_pP);)
/*! \fn void rlc_am_receive_routing (rlc_am_entity_t *rlc_pP, frame_t frameP, uint8_t eNB_flagP, struct mac_data_ind data_indP)
/*! \fn void rlc_am_receive_routing (rlc_am_entity_t * const rlc_pP, const frame_t frameP, uint8_t eNB_flagP, struct mac_data_ind data_indP)
* \brief Convert transport blocks received from MAC layer into RLC AM PDUs, and dispatch to the right processing block these PDUS upon their type (CONTROL/DATA).
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0).
* \param[in] data_indP Transport blocks received from MAC layer.
*/
protected_rlc_am_receiver( void rlc_am_receive_routing (rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP));
protected_rlc_am_receiver( void rlc_am_receive_routing (rlc_am_entity_t * const rlc_pP, const frame_t frameP, const eNB_flag_t eNB_flagP, struct mac_data_ind data_indP));
/*! \fn void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, uint8_t eNB_flagP, mem_block_t* tb_pP, uint8_t* first_byteP, uint16_t tb_size_in_bytesP)
/*! \fn void rlc_am_receive_process_data_pdu (rlc_am_entity_t * const rlc_pP, const frame_t frameP, uint8_t eNB_flagP, mem_block_t* tb_pP, uint8_t* first_byteP, uint16_t tb_size_in_bytesP)
* \brief Process an incoming data PDU received from MAC layer.
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] frame Frame index.
......@@ -113,6 +113,6 @@ protected_rlc_am_receiver( void rlc_am_receive_routing (rlc_am_entity_t *rlc_pP,
* \param[in] first_byteP Pointer on first byte of the PDU.
* \param[in] tb_size_in_bytesP Transport block size in bytes (same as PDU size in bytes).
*/
private_rlc_am_receiver( void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t* tb_pP, uint8_t* first_byteP, uint16_t tb_size_in_bytesP));
private_rlc_am_receiver( void rlc_am_receive_process_data_pdu (rlc_am_entity_t * const rlc_pP, const frame_t frameP, const eNB_flag_t eNB_flagP, mem_block_t* tb_pP, uint8_t* first_byteP, uint16_t tb_size_in_bytesP));
/** @} */
# endif
......@@ -43,7 +43,12 @@ Address : EURECOM,
//#define TRACE_RLC_AM_NACK
//#define TRACE_RLC_AM_ACK
//-----------------------------------------------------------------------------
void rlc_am_nack_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_endP)
void rlc_am_nack_pdu (
rlc_am_entity_t *const rlc_pP,
const frame_t frameP,
const rlc_sn_t snP,
const sdu_size_t so_startP,
const sdu_size_t so_endP)
//-----------------------------------------------------------------------------
{
// 5.2.1 Retransmission
......@@ -59,11 +64,11 @@ void rlc_am_nack_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP, sdu
// - indicate to upper layers that max retransmission has been reached.
mem_block_t* mb_pP = rlc_pP->pdu_retrans_buffer[snP].mem_block;
mem_block_t* mb_p = rlc_pP->pdu_retrans_buffer[snP].mem_block;
int pdu_sdu_index;
int sdu_index;
if (mb_pP != NULL) {
if (mb_p != NULL) {
rlc_pP->num_nack_sn += 1;
assert(so_startP <= so_endP);
//-----------------------------------------
......@@ -134,18 +139,21 @@ void rlc_am_nack_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP, sdu
}
}
//-----------------------------------------------------------------------------
void rlc_am_ack_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP)
void rlc_am_ack_pdu (
rlc_am_entity_t *const rlc_pP,
const frame_t frameP,
const rlc_sn_t snP)
//-----------------------------------------------------------------------------
{
mem_block_t* mb_pP = rlc_pP->pdu_retrans_buffer[snP].mem_block;
mem_block_t* mb_p = rlc_pP->pdu_retrans_buffer[snP].mem_block;
int pdu_sdu_index;
int sdu_index;
rlc_pP->pdu_retrans_buffer[snP].flags.retransmit = 0;
if ((rlc_pP->pdu_retrans_buffer[snP].flags.ack == 0) && (mb_pP != NULL)) {
if ((rlc_pP->pdu_retrans_buffer[snP].flags.ack == 0) && (mb_p != NULL)) {
//if (mb_pP != NULL) {
free_mem_block(mb_pP);
free_mem_block(mb_p);
rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL;
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][ACK-PDU] ACK PDU SN %05d previous retx_count %d \n",
frameP,
......@@ -170,9 +178,21 @@ void rlc_am_ack_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP)
if ((rlc_pP->input_sdus[sdu_index].nb_pdus_ack == rlc_pP->input_sdus[sdu_index].nb_pdus) &&
(rlc_pP->input_sdus[sdu_index].sdu_remaining_size == 0)) {
#ifdef TEST_RLC_AM
rlc_am_v9_3_0_test_data_conf (rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->input_sdus[sdu_index].mui, RLC_SDU_CONFIRM_YES);
rlc_am_v9_3_0_test_data_conf (
rlc_pP->module_id,
rlc_pP->rb_id,
rlc_pP->input_sdus[sdu_index].mui,
RLC_SDU_CONFIRM_YES);
#else
rlc_data_conf(rlc_pP->enb_module_id, rlc_pP->ue_module_id, frameP, rlc_pP->is_enb, rlc_pP->rb_id, rlc_pP->input_sdus[sdu_index].mui, RLC_SDU_CONFIRM_YES, rlc_pP->is_data_plane);
rlc_data_conf(
rlc_pP->enb_module_id,
rlc_pP->ue_module_id,
frameP,
rlc_pP->is_enb,
rlc_pP->rb_id,
rlc_pP->input_sdus[sdu_index].mui,
RLC_SDU_CONFIRM_YES,
rlc_pP->is_data_plane);
#endif
rlc_am_free_in_sdu(rlc_pP, frameP, sdu_index);
}
......@@ -238,8 +258,8 @@ void rlc_am_ack_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP)
rlc_pP->ue_module_id,
rlc_pP->rb_id,
snP);
if (mb_pP != NULL) {
free_mem_block(mb_pP);
if (mb_p != NULL) {
free_mem_block(mb_p);
rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL;
}
if (rlc_pP->pdu_retrans_buffer[snP].flags.ack > 0) {
......@@ -268,7 +288,10 @@ void rlc_am_ack_pdu (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP)
}
}
//-----------------------------------------------------------------------------
mem_block_t* rlc_am_retransmit_get_copy (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP)
mem_block_t* rlc_am_retransmit_get_copy (
rlc_am_entity_t *const rlc_pP,
const frame_t frameP,
const rlc_sn_t snP)
//-----------------------------------------------------------------------------
{
mem_block_t* mb_original_p = rlc_pP->pdu_retrans_buffer[snP].mem_block;
......@@ -292,7 +315,11 @@ mem_block_t* rlc_am_retransmit_get_copy (rlc_am_entity_t *rlc_pP, frame_t frameP
}
}
//-----------------------------------------------------------------------------
mem_block_t* rlc_am_retransmit_get_subsegment(rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP, sdu_size_t *sizeP)
mem_block_t* rlc_am_retransmit_get_subsegment(
rlc_am_entity_t *const rlc_pP,
const frame_t frameP,
const rlc_sn_t snP,
sdu_size_t * const sizeP /* in-out*/)
//-----------------------------------------------------------------------------
{
......@@ -773,7 +800,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment(rlc_am_entity_t *rlc_pP, frame_t f
&rlc_pP->pdu_retrans_buffer[snP].payload[start_offset],
test_pdu_copy_size);
((struct mac_tb_req*)(mb_sub_segment_p->data))->tb_size = (((uint64_t)fill_payload_p)+ test_pdu_copy_size) - ((uint64_t)(&pdu_sub_segment_p->b1));
((struct mac_tb_req*)(mb_sub_segment_p->data))->tb_size = (tb_size_t)(((uint64_t)fill_payload_p)+ test_pdu_copy_size) - ((uint64_t)(&pdu_sub_segment_p->b1));
// set LSF
if ((test_pdu_copy_size + start_offset) == rlc_pP->pdu_retrans_buffer[snP].payload_size) {
......@@ -852,7 +879,10 @@ mem_block_t* rlc_am_retransmit_get_subsegment(rlc_am_entity_t *rlc_pP, frame_t f
}
}
//-----------------------------------------------------------------------------
void rlc_am_tx_buffer_display (rlc_am_entity_t* rlc_pP, frame_t frameP, char* message_pP)
void rlc_am_tx_buffer_display (
rlc_am_entity_t* const rlc_pP,
const frame_t frameP,
char* const message_pP)
//-----------------------------------------------------------------------------
{
rlc_sn_t sn = rlc_pP->vt_a;
......@@ -904,7 +934,9 @@ void rlc_am_tx_buffer_display (rlc_am_entity_t* rlc_pP, frame_t frameP, char* me
LOG_D(RLC, "\n");
}
//-----------------------------------------------------------------------------
void rlc_am_retransmit_any_pdu(rlc_am_entity_t* rlc_pP,frame_t frameP)
void rlc_am_retransmit_any_pdu(
rlc_am_entity_t* const rlc_pP,
const frame_t frameP)
//-----------------------------------------------------------------------------
{
rlc_sn_t sn = (rlc_pP->vt_s - 1) & RLC_AM_SN_MASK;
......
......@@ -69,7 +69,12 @@ Address : EURECOM,
* \param[in] so_endP Transport blocks received from MAC layer.
* \note It may appear a new hole in the retransmission buffer depending on the segment offset informations. Depending on the state of the retransmission buffer, negative confirmation can be sent to higher layers about the drop by the RLC AM instance of a particular SDU.
*/
protected_rlc_am_retransmit(void rlc_am_nack_pdu (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_endP);)
protected_rlc_am_retransmit(void rlc_am_nack_pdu (
rlc_am_entity_t *const rlcP,
const frame_t frameP,
const rlc_sn_t snP,
const sdu_size_t so_startP,
const sdu_size_t so_endP);)
/*! \fn void rlc_am_ack_pdu (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP)
* \brief The RLC AM PDU which have the sequence number snP is marked ACKed.
......@@ -78,7 +83,10 @@ protected_rlc_am_retransmit(void rlc_am_nack_pdu (rlc_am_entity_t *rlcP,
* \param[in] snP Sequence number of the PDU that is acknowledged.
* \note Depending on the state of the retransmission buffer, positive confirmation can be sent to higher layers about the receiving by the peer RLC AM instance of a particular SDU.
*/
protected_rlc_am_retransmit(void rlc_am_ack_pdu (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP);)
protected_rlc_am_retransmit(void rlc_am_ack_pdu (
rlc_am_entity_t *const rlcP,
const frame_t frameP,
const rlc_sn_t snP);)
/*! \fn mem_block_t* rlc_am_retransmit_get_copy (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP)
* \brief The RLC AM PDU which have the sequence number snP is marked ACKed.
......@@ -87,7 +95,10 @@ protected_rlc_am_retransmit(void rlc_am_ack_pdu (rlc_am_entity_t *rlcP,
* \param[in] snP Sequence number of the PDU to be copied.
* \return A copy of the PDU having sequence number equal to parameter snP.
*/
protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_copy (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP));
protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_copy (
rlc_am_entity_t *const rlcP,
const frame_t frameP,
const rlc_sn_t snP));
/*! \fn mem_block_t* rlc_am_retransmit_get_subsegment (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t *sizeP)
* \brief The RLC AM PDU which have the sequence number snP is marked ACKed.
......@@ -97,14 +108,20 @@ protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_copy (rlc_am_enti
* \param[in,out] sizeP Maximum size allowed for the subsegment, it is updated with the amount of bytes not used (sizeP[out] = sizeP[in] - size of segment).
* \return A copy of a segment of the PDU having sequence number equal to parameter snP.
*/
protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_subsegment (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t *sizeP));
protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_subsegment (
rlc_am_entity_t *const rlcP,
const frame_t frameP,
const rlc_sn_t snP,
sdu_size_t *const sizeP));
/*! \fn void rlc_am_retransmit_any_pdu(rlc_am_entity_t* rlcP,frame_t frameP)
* \brief Retransmit any PDU in order to unblock peer entity, if no suitable PDU is found (depending on requested MAC size) to be retransmitted, then try to retransmit a subsegment of any PDU.
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in] frameP Frame index.
*/
protected_rlc_am_retransmit(void rlc_am_retransmit_any_pdu(rlc_am_entity_t* rlcP,frame_t frameP);)
protected_rlc_am_retransmit(void rlc_am_retransmit_any_pdu(
rlc_am_entity_t* const rlcP,
const frame_t frameP);)
/*! \fn void rlc_am_tx_buffer_display (rlc_am_entity_t* rlcP, frame_t frameP, char* message_pP)
* \brief Display the dump of the retransmission buffer.
......@@ -112,6 +129,9 @@ protected_rlc_am_retransmit(void rlc_am_retransmit_any_pdu(rlc_am_entity_t* rlcP
* \param[in] frameP Frame index.
* \param[in] message_pP Message to be displayed along with the display of the dump of the retransmission buffer.
*/
protected_rlc_am_retransmit(void rlc_am_tx_buffer_display (rlc_am_entity_t* rlcP, frame_t frameP, char* message_pP);)
protected_rlc_am_retransmit(void rlc_am_tx_buffer_display (
rlc_am_entity_t* const rlcP,
const frame_t frameP,
char* const message_pP);)
/** @} */
# endif
......@@ -45,7 +45,11 @@ Address : EURECOM,
#include "UTIL/LOG/log.h"
//-----------------------------------------------------------------------------
void rlc_am_pdu_polling (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_am_pdu_sn_10_t *pdu_pP, int16_t payload_sizeP)
void rlc_am_pdu_polling (
rlc_am_entity_t *const rlc_pP,
const frame_t frameP,
rlc_am_pdu_sn_10_t *const pdu_pP,
const int16_t payload_sizeP)
//-----------------------------------------------------------------------------
{
// 5.2.2 Polling
......@@ -134,14 +138,16 @@ void rlc_am_pdu_polling (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_am_pdu_sn_
}
}
//-----------------------------------------------------------------------------
void rlc_am_segment_10 (rlc_am_entity_t *rlc_pP,frame_t frameP)
void rlc_am_segment_10 (
rlc_am_entity_t *const rlc_pP,
const frame_t frameP)
{
//-----------------------------------------------------------------------------
list_t pdus;
signed int pdu_remaining_size = 0;
signed int test_pdu_remaining_size = 0;
sdu_size_t pdu_remaining_size = 0;
sdu_size_t test_pdu_remaining_size = 0;
int nb_bytes_to_transmit = rlc_pP->nb_bytes_requested_by_mac;
sdu_size_t nb_bytes_to_transmit = rlc_pP->nb_bytes_requested_by_mac;
rlc_am_pdu_sn_10_t *pdu_p = NULL;
struct mac_tb_req *pdu_tb_req_p = NULL;
mem_block_t *pdu_mem_p = NULL;
......@@ -151,21 +157,21 @@ void rlc_am_segment_10 (rlc_am_entity_t *rlc_pP,frame_t frameP)
rlc_am_tx_sdu_management_t *sdu_mngt_p = NULL;
rlc_am_tx_data_pdu_management_t *pdu_mngt_p = NULL;
unsigned int li_length_in_bytes = 0;
unsigned int test_li_length_in_bytes = 0;
unsigned int test_remaining_size_to_substract= 0;
sdu_size_t li_length_in_bytes = 0;
sdu_size_t test_li_length_in_bytes = 0;
sdu_size_t test_remaining_size_to_substract= 0;
unsigned int test_remaining_num_li_to_substract = 0;
unsigned int continue_fill_pdu_with_sdu = 0;
unsigned int num_fill_sdu = 0;
unsigned int test_num_li = 0;
unsigned int fill_num_li = 0;
unsigned int sdu_buffer_index = 0;
unsigned int data_pdu_size = 0;
sdu_size_t data_pdu_size = 0;
unsigned int fi_first_byte_pdu_is_first_byte_sdu = 0;
unsigned int fi_last_byte_pdu_is_last_byte_sdu = 0;
unsigned int fi = 0;
unsigned int max_li_overhead = 0;
signed int max_li_overhead = 0;
LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] rlc_pP->current_sdu_index %d rlc_pP->next_sdu_index %d rlc_pP->input_sdus[rlc_pP->current_sdu_index].mem_block %p sdu_buffer_occupancy %d\n",
frameP,
......
......@@ -38,13 +38,18 @@ Address : EURECOM,
#define TRACE_RLC_AM_HOLE
//-----------------------------------------------------------------------------
void rlc_am_clear_holes (rlc_am_entity_t *rlc_pP, rlc_sn_t snP)
void rlc_am_clear_holes (
rlc_am_entity_t * const rlc_pP,
const rlc_sn_t snP)
//-----------------------------------------------------------------------------
{
rlc_pP->pdu_retrans_buffer[snP].num_holes = 0;
}
//-----------------------------------------------------------------------------
void rlc_am_shift_down_holes (rlc_am_entity_t *rlc_pP, rlc_sn_t snP, int indexP)
void rlc_am_shift_down_holes (
rlc_am_entity_t *const rlc_pP,
const rlc_sn_t snP,
const int indexP)
//-----------------------------------------------------------------------------
{
int i;
......@@ -55,7 +60,10 @@ void rlc_am_shift_down_holes (rlc_am_entity_t *rlc_pP, rlc_sn_t snP, int indexP)
rlc_pP->pdu_retrans_buffer[snP].num_holes = rlc_pP->pdu_retrans_buffer[snP].num_holes - 1;
}
//-----------------------------------------------------------------------------
void rlc_am_shift_up_holes (rlc_am_entity_t *rlc_pP, rlc_sn_t snP, int indexP)
void rlc_am_shift_up_holes (
rlc_am_entity_t *const rlc_pP,
const rlc_sn_t snP,
const int indexP)
//-----------------------------------------------------------------------------
{
// shift include indexP
......@@ -68,7 +76,12 @@ void rlc_am_shift_up_holes (rlc_am_entity_t *rlc_pP, rlc_sn_t snP, int indexP)
assert(rlc_pP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
}
//-----------------------------------------------------------------------------
void rlc_am_remove_hole (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP, uint16_t so_startP, uint16_t so_stopP)
void rlc_am_remove_hole (
rlc_am_entity_t *const rlc_pP,
const frame_t frameP,
const rlc_sn_t snP,
const sdu_size_t so_startP,
const sdu_size_t so_stopP)
//-----------------------------------------------------------------------------
{
int i;
......@@ -174,7 +187,12 @@ void rlc_am_remove_hole (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP,
assert(rlc_pP->pdu_retrans_buffer[snP].nack_so_start < rlc_pP->pdu_retrans_buffer[snP].payload_size);
}
//-----------------------------------------------------------------------------
void rlc_am_get_next_hole (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP, int* so_startP, int* so_stopP)
void rlc_am_get_next_hole (
rlc_am_entity_t *const rlc_pP,
const frame_t frameP,
const rlc_sn_t snP,
sdu_size_t* const so_startP,
sdu_size_t* const so_stopP)
//-----------------------------------------------------------------------------
{
if (rlc_pP->pdu_retrans_buffer[snP].num_holes == 0) {
......@@ -209,7 +227,12 @@ void rlc_am_get_next_hole (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP
}
}
//-----------------------------------------------------------------------------
void rlc_am_add_hole (rlc_am_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_stopP)
void rlc_am_add_hole (
rlc_am_entity_t *const rlc_pP,
const frame_t frameP,
const rlc_sn_t snP,
sdu_size_t so_startP,
sdu_size_t so_stopP)
//-----------------------------------------------------------------------------
{
int i, hole_index;
......
......@@ -66,9 +66,11 @@ Address : EURECOM,
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in] snP Sequence number.
*/
protected_rlc_am_segments_holes(void rlc_am_clear_holes (rlc_am_entity_t *rlcP, rlc_sn_t snP);)
protected_rlc_am_segments_holes(void rlc_am_clear_holes (
rlc_am_entity_t *const rlcP,
const rlc_sn_t snP);)
/*! \fn void rlc_am_remove_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, uint16_t so_startP, uint16_t so_stopP)
/*! \fn void rlc_am_remove_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_stopP)
* \brief Remove for PDU with sequence number "snP" a NACK for byte segment offset [so_startP, so_stopP].
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in[ frame Frame index.
......@@ -76,9 +78,14 @@ protected_rlc_am_segments_holes(void rlc_am_clear_holes (rlc_am_entity_t *rlcP,
* \param[in] so_startP Start of segment offset.
* \param[in] so_stopP End of segment offset.
*/
protected_rlc_am_segments_holes(void rlc_am_remove_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, uint16_t so_startP, uint16_t so_stopP);)
protected_rlc_am_segments_holes(void rlc_am_remove_hole (
rlc_am_entity_t *const rlcP,
const frame_t frameP,
const rlc_sn_t snP,
const sdu_size_t so_startP,
const sdu_size_t so_stopP);)
/*! \fn void rlc_am_get_next_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, int* so_startP, int* so_stopP)
/*! \fn void rlc_am_get_next_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t* so_startP, sdu_size_t* so_stopP)
* \brief Get for PDU with sequence number "snP" the first hole start and stop parameters.
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in[ frame Frame index.
......@@ -86,9 +93,14 @@ protected_rlc_am_segments_holes(void rlc_am_remove_hole (rlc_am_entity_t *rlcP,
* \param[in,out] so_startP Start of segment offset.
* \param[in,out] so_stopP End of segment offset.
*/
protected_rlc_am_segments_holes(void rlc_am_get_next_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, int* so_startP, int* so_stopP);)
protected_rlc_am_segments_holes(void rlc_am_get_next_hole (
rlc_am_entity_t *const rlcP,
const frame_t frameP,
const rlc_sn_t snP,
sdu_size_t* const so_startP,
sdu_size_t* const so_stopP);)
/*! \fn void rlc_am_add_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, uint16_t so_startP, uint16_t so_stopP)
/*! \fn void rlc_am_add_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_stopP)
* \brief Mark for PDU with sequence number "snP" a NACK for byte segment offset [so_startP, so_stopP].
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in[ frame Frame index.
......@@ -96,6 +108,11 @@ protected_rlc_am_segments_holes(void rlc_am_get_next_hole (rlc_am_entity_t *rlcP
* \param[in,out] so_startP Start of segment offset.
* \param[in,out] so_stopP End of segment offset.
*/
protected_rlc_am_segments_holes(void rlc_am_add_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, uint16_t so_startP, uint16_t so_stopP);)
protected_rlc_am_segments_holes(void rlc_am_add_hole (
rlc_am_entity_t *const rlcP,
const frame_t frameP,
const rlc_sn_t snP,
sdu_size_t so_startP,
sdu_size_t so_stopP);)
/** @} */
#endif
......@@ -115,7 +115,7 @@ void rlc_am_write16_bit_field(uint8_t** data_ppP, unsigned int* bit_pos_pP, sign
}
}
//-----------------------------------------------------------------------------
signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* header_pP, sdu_ssize_t *total_size_pP, rlc_am_control_pdu_info_t* pdu_info_pP)
signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* header_pP, sdu_size_t *total_size_pP, rlc_am_control_pdu_info_t* pdu_info_pP)
//-----------------------------------------------------------------------------
{
memset(pdu_info_pP, 0, sizeof (rlc_am_control_pdu_info_t));
......@@ -153,16 +153,16 @@ signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* header_pP, sdu_ssize
if (!pdu_info_pP->nack_list[pdu_info_pP->num_nack - 1].e1) {
nack_to_read = 0;
*total_size_pP = *total_size_pP - (sdu_ssize_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
*total_size_pP = *total_size_pP - (sdu_size_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
return 0;
}
if (pdu_info_pP->num_nack == RLC_AM_MAX_NACK_IN_STATUS_PDU) {
*total_size_pP = *total_size_pP - (sdu_ssize_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
*total_size_pP = *total_size_pP - (sdu_size_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
return -2;
}
}
*total_size_pP = *total_size_pP - (sdu_ssize_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
*total_size_pP = *total_size_pP - (sdu_size_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
} else {
*total_size_pP = *total_size_pP - 2;
}
......@@ -195,11 +195,11 @@ void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_info_pP)
}
}
//-----------------------------------------------------------------------------
void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, mem_block_t* tb_pP, uint8_t** first_byte_ppP, sdu_ssize_t *tb_size_in_bytes_pP)
void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, mem_block_t* tb_pP, uint8_t** first_byte_ppP, sdu_size_t *tb_size_in_bytes_pP)
//-----------------------------------------------------------------------------
{
rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)*first_byte_ppP;
sdu_ssize_t initial_pdu_size = *tb_size_in_bytes_pP;
rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)*first_byte_ppP;
sdu_size_t initial_pdu_size = *tb_size_in_bytes_pP;
if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, tb_size_in_bytes_pP, &g_rlc_am_control_pdu_info) >= 0) {
......
......@@ -93,15 +93,22 @@ protected_rlc_am_status_report(void rlc_am_write8_bit_field(uint8_t** dat
* \param[in] bits_to_writeP Number of bits to write (max 16).
* \param[in] valueP Value to write.
*/
protected_rlc_am_status_report(void rlc_am_write16_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, uint16_t valueP);)
protected_rlc_am_status_report(void rlc_am_write16_bit_field(
uint8_t** dataP,
unsigned int* bit_posP,
signed int bits_to_writeP,
uint16_t valueP);)
/*! \fn signed int rlc_am_get_control_pdu_infos (rlc_am_pdu_sn_10_t* headerP, int16_t total_sizeP, rlc_am_control_pdu_info_t* pdu_infoP)
/*! \fn signed int rlc_am_get_control_pdu_infos (rlc_am_pdu_sn_10_t* headerP, sdu_size_t *total_sizeP, rlc_am_control_pdu_info_t* pdu_infoP)
* \brief Retrieve control PDU informations from a serialized control PDU.
* \param[in] headerP Pointer on the header of the RLC AM PDU.
* \param[in] total_size_pP Pointer on PDU size in bytes.
* \param[in,out] pdu_infoP Struct containing interpreted PDU control informations.
*/
protected_rlc_am_status_report( signed int rlc_am_get_control_pdu_infos (rlc_am_pdu_sn_10_t* headerP, int16_t *total_size_pP, rlc_am_control_pdu_info_t* pdu_infoP);)
protected_rlc_am_status_report( signed int rlc_am_get_control_pdu_infos (
rlc_am_pdu_sn_10_t* headerP,
sdu_size_t *total_size_pP,
rlc_am_control_pdu_info_t* pdu_infoP);)
/*! \fn void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_infoP)
* \brief Dump on LOG output the informations contained in the pdu_infoP structure.
......@@ -117,7 +124,12 @@ protected_rlc_am_status_report( void rlc_am_display_control_pdu_infos(rlc_am_con
* \param[in] first_byte Pointer on first byte of control PDU.
* \param[in] tb_size_in_bytes Pointer on size of serialized control PDU in bytes.
*/
protected_rlc_am_status_report( void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* tbP, uint8_t** first_byte, int16_t *tb_size_in_bytes);)
protected_rlc_am_status_report( void rlc_am_receive_process_control_pdu(
rlc_am_entity_t* rlcP,
frame_t frameP,
mem_block_t* tbP,
uint8_t** first_byte,
sdu_size_t *tb_size_in_bytes);)
/*! \fn int rlc_am_write_status_pdu(frame_t frameP,rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* pdu_infoP)
* \brief Remove all marked holes for PDU with sequence number "snP".
......
......@@ -110,21 +110,21 @@ typedef struct pdu_management_flags {
*/
typedef struct rlc_am_tx_data_pdu_management {
mem_block_t *mem_block; /*!< \brief PDU embedded in a mem_block_t struct */
uint8_t *first_byte; /*!< \brief Pointer on the PDU including header, LIs, data */
uint8_t *payload; /*!< \brief Pointer on the PDU payload */
int16_t sdus_index[RLC_AM_MAX_SDU_IN_PDU]; /*!< \brief Index of SDU(s) having segments in this pdu (index in rlc_am_entity.input_sdus[]) */
frame_t last_nack_time; /*!< \brief Last frame this PDU was negative acknowledged, for not nacking several times in the same frame */
sdu_size_t hole_so_start [RLC_AM_MAX_HOLES_REPORT_PER_PDU]; /*!< \brief Array containing the start segment offsets for marking a hole (negative acknowledged area) in the PDU. */
sdu_size_t hole_so_stop [RLC_AM_MAX_HOLES_REPORT_PER_PDU]; /*!< \brief Array containing the stop segment offsets for marking a hole (negative acknowledged area) in the PDU. */
uint8_t num_holes; /*!< \brief Number of registereg holes in hole_so_start[], hole_so_stop[]. */
sdu_ssize_t header_and_payload_size; /*!< \brief Size of the PDU in bytes, including header and payload. */
sdu_ssize_t payload_size; /*!< \brief Size of the PDU payload in bytes. */
rlc_sn_t sn; /*!< \brief Sequence number of the PDU. */
sdu_ssize_t nack_so_start; /*!< \brief Lowest NACK start segment offset, must be set to 0 if global NACK. */
sdu_ssize_t nack_so_stop; /*!< \brief Highest NACK stop segment offset, must be set to data_size if global NACK */
uint8_t *first_byte; /*!< \brief Pointer on the PDU including header, LIs, data */
uint8_t *payload; /*!< \brief Pointer on the PDU payload */
int16_t sdus_index[RLC_AM_MAX_SDU_IN_PDU]; /*!< \brief Index of SDU(s) having segments in this pdu (index in rlc_am_entity.input_sdus[]) */
frame_t last_nack_time; /*!< \brief Last frame this PDU was negative acknowledged, for not nacking several times in the same frame */
sdu_size_t hole_so_start [RLC_AM_MAX_HOLES_REPORT_PER_PDU]; /*!< \brief Array containing the start segment offsets for marking a hole (negative acknowledged area) in the PDU. */
sdu_size_t hole_so_stop [RLC_AM_MAX_HOLES_REPORT_PER_PDU]; /*!< \brief Array containing the stop segment offsets for marking a hole (negative acknowledged area) in the PDU. */
uint8_t num_holes; /*!< \brief Number of registereg holes in hole_so_start[], hole_so_stop[]. */
sdu_size_t header_and_payload_size; /*!< \brief Size of the PDU in bytes, including header and payload. */
sdu_size_t payload_size; /*!< \brief Size of the PDU payload in bytes. */
rlc_sn_t sn; /*!< \brief Sequence number of the PDU. */
sdu_size_t nack_so_start; /*!< \brief Lowest NACK start segment offset, must be set to 0 if global NACK. */
sdu_size_t nack_so_stop; /*!< \brief Highest NACK stop segment offset, must be set to data_size if global NACK */
int8_t nb_sdus; /*!< \brief Number of sdu having segments in this pdu. */
int8_t retx_count; /*!< \brief Counts the number of retransmissions of an AMD PDU (see subclause 5.2.1). There is one RETX_COUNT counter per PDU that needs to be retransmitted. there is one VT(DAT) for each PDU and it is incremented each time the PDU is transmitted. */
int8_t nb_sdus; /*!< \brief Number of sdu having segments in this pdu. */
int8_t retx_count; /*!< \brief Counts the number of retransmissions of an AMD PDU (see subclause 5.2.1). There is one RETX_COUNT counter per PDU that needs to be retransmitted. there is one VT(DAT) for each PDU and it is incremented each time the PDU is transmitted. */
pdu_management_flags_t flags; /*!< \brief PDU variables related to its retransmission. */
} rlc_am_tx_data_pdu_management_t;
......
......@@ -40,7 +40,9 @@ Address : EURECOM,
#include "LAYER2/MAC/extern.h"
#include "UTIL/LOG/log.h"
//-----------------------------------------------------------------------------
void rlc_am_check_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
void rlc_am_check_timer_poll_retransmit(
rlc_am_entity_t *const rlc_pP,
const frame_t frameP)
//-----------------------------------------------------------------------------
{
// 5.2.2.3 Expiry of t-PollRetransmit
......@@ -82,19 +84,21 @@ void rlc_am_check_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
rlc_pP->ue_module_id,
rlc_pP->rb_id);
#warning TO DO rlc_am_check_timer_poll_retransmit
//#warning TO DO rlc_am_check_timer_poll_retransmit
rlc_pP->t_poll_retransmit.frame_time_out = frameP + rlc_pP->t_poll_retransmit.time_out;
}
}
}
//-----------------------------------------------------------------------------
int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *rlc_pP)
int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *const rlc_pP)
//-----------------------------------------------------------------------------
{
return rlc_pP->t_poll_retransmit.timed_out;
}
//-----------------------------------------------------------------------------
void rlc_am_stop_and_reset_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
void rlc_am_stop_and_reset_timer_poll_retransmit(
rlc_am_entity_t *const rlc_pP,
const frame_t frameP)
//-----------------------------------------------------------------------------
{
LOG_D(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][T_POLL_RETRANSMIT] STOPPED AND RESET\n",
......@@ -109,7 +113,9 @@ void rlc_am_stop_and_reset_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t
rlc_pP->t_poll_retransmit.timed_out = 0;
}
//-----------------------------------------------------------------------------
void rlc_am_start_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
void rlc_am_start_timer_poll_retransmit(
rlc_am_entity_t *const rlc_pP,
const frame_t frameP)
//-----------------------------------------------------------------------------
{
rlc_pP->t_poll_retransmit.running = 1;
......@@ -125,7 +131,9 @@ void rlc_am_start_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
rlc_pP->t_poll_retransmit.frame_time_out);
}
//-----------------------------------------------------------------------------
void rlc_am_init_timer_poll_retransmit(rlc_am_entity_t *rlc_pP, uint32_t time_outP)
void rlc_am_init_timer_poll_retransmit(
rlc_am_entity_t *const rlc_pP,
const uint32_t time_outP)
//-----------------------------------------------------------------------------
{
rlc_pP->t_poll_retransmit.running = 0;
......
......@@ -66,34 +66,42 @@ Address : EURECOM,
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] frame Frame index
*/
protected_rlc_am_timer_poll_retransmit(void rlc_am_check_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP));
protected_rlc_am_timer_poll_retransmit(void rlc_am_check_timer_poll_retransmit(
rlc_am_entity_t *const rlc_pP,
const frame_t frameP));
/*! \fn int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *rlc_pP)
* \brief Boolean function, check if timer Poll-retransmit has timed-out.
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \return 1 if timer Poll-retransmit has timed-out, else 0.
*/
protected_rlc_am_timer_poll_retransmit(int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *rlc_pP);)
protected_rlc_am_timer_poll_retransmit(int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *const rlc_pP);)
/*! \fn void rlc_am_stop_and_reset_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
* \brief Stop and reset the timer Poll-retransmit.
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] frame Frame index
*/
protected_rlc_am_timer_poll_retransmit(void rlc_am_stop_and_reset_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP);)
protected_rlc_am_timer_poll_retransmit(void rlc_am_stop_and_reset_timer_poll_retransmit(
rlc_am_entity_t *const rlc_pP,
const frame_t frameP);)
/*! \fn void rlc_am_start_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP)
* \brief Re-arm (based on RLC AM config parameter) and start timer Poll-retransmit.
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] frame Frame index
*/
protected_rlc_am_timer_poll_retransmit(void rlc_am_start_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP);)
protected_rlc_am_timer_poll_retransmit(void rlc_am_start_timer_poll_retransmit(
rlc_am_entity_t *const rlc_pP,
const frame_t frameP);)
/*! \fn void rlc_am_init_timer_poll_retransmit(rlc_am_entity_t *rlc_pP, uint32_t time_outP)
* \brief Initialize the timer Poll-retransmit with RLC AM time-out config parameter.
* \param[in] rlc_pP RLC AM protocol instance pointer.
* \param[in] time_outP Time-out in frame units.
*/
protected_rlc_am_timer_poll_retransmit(void rlc_am_init_timer_poll_retransmit(rlc_am_entity_t *rlc_pP, uint32_t time_outP);)
protected_rlc_am_timer_poll_retransmit(void rlc_am_init_timer_poll_retransmit(
rlc_am_entity_t *const rlc_pP,
const uint32_t time_outP);)
/** @} */
#endif
......@@ -40,7 +40,9 @@ Address : EURECOM,
#include "LAYER2/MAC/extern.h"
#include "UTIL/LOG/log.h"
//-----------------------------------------------------------------------------
void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP)
void rlc_am_check_timer_status_prohibit(
rlc_am_entity_t * const rlc_pP,
const frame_t frameP)
//-----------------------------------------------------------------------------
{
if (rlc_pP->t_status_prohibit.time_out > 0) {
......@@ -74,7 +76,7 @@ void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP)
rlc_pP->enb_module_id,
rlc_pP->ue_module_id,
rlc_pP->rb_id);
#warning TO DO rlc_am_check_timer_status_prohibit
//#warning TO DO rlc_am_check_timer_status_prohibit
rlc_am_stop_and_reset_timer_status_prohibit(rlc_pP, frameP);
//rlc_pP->t_status_prohibit.frame_time_out = frameP + rlc_pP->t_status_prohibit.time_out;
}
......@@ -82,7 +84,9 @@ void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP)
}
}
//-----------------------------------------------------------------------------
void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP)
void rlc_am_stop_and_reset_timer_status_prohibit(
rlc_am_entity_t *const rlc_pP,
const frame_t frameP)
//-----------------------------------------------------------------------------
{
if (rlc_pP->t_status_prohibit.time_out > 0) {
......@@ -99,7 +103,9 @@ void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t
}
}
//-----------------------------------------------------------------------------
void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP)
void rlc_am_start_timer_status_prohibit(
rlc_am_entity_t *const rlc_pP,
const frame_t frameP)
//-----------------------------------------------------------------------------
{
if (rlc_pP->t_status_prohibit.time_out > 0) {
......@@ -118,7 +124,9 @@ void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP)
}
}
//-----------------------------------------------------------------------------
void rlc_am_init_timer_status_prohibit(rlc_am_entity_t *rlc_pP, uint32_t time_outP)
void rlc_am_init_timer_status_prohibit(
rlc_am_entity_t *const rlc_pP,
const uint32_t time_outP)
//-----------------------------------------------------------------------------
{
rlc_pP->t_status_prohibit.running = 0;
......
......@@ -42,7 +42,13 @@ Address : EURECOM,
#include "LAYER2/MAC/extern.h"
//-----------------------------------------------------------------------------
void
rlc_tm_send_sdu (rlc_tm_entity_t *rlcP, uint32_t frame, uint8_t eNB_flag, uint8_t error_indicationP, uint8_t * srcP, uint16_t length_in_bitsP)
rlc_tm_send_sdu (
rlc_tm_entity_t * const rlc_pP,
const frame_t frameP,
const eNB_flag_t eNB_flag,
const boolean_t error_indicationP,
uint8_t * const srcP,
const sdu_size_t length_in_bitsP)
{
//-----------------------------------------------------------------------------
int length_in_bytes;
......@@ -50,129 +56,146 @@ rlc_tm_send_sdu (rlc_tm_entity_t *rlcP, uint32_t frame, uint8_t eNB_flag, uint8_
int index;
#endif
#ifdef DEBUG_RLC_TM_REASSEMBLY
msg ("[RLC_TM %p][SEND_SDU] %d bits\n", rlcP, length_in_bitsP);
msg ("[RLC_TM %p][SEND_SDU] %d bits\n", rlc_pP, length_in_bitsP);
#endif
length_in_bytes = (length_in_bitsP + 7) >> 3;
if (rlcP->output_sdu_in_construction == NULL) {
rlcP->output_sdu_in_construction = get_free_mem_block (length_in_bytes);
if (rlc_pP->output_sdu_in_construction == NULL) {
rlc_pP->output_sdu_in_construction = get_free_mem_block (length_in_bytes);
}
if ((rlcP->output_sdu_in_construction)) {
if ((rlc_pP->output_sdu_in_construction)) {
#ifdef DEBUG_RLC_TM_DISPLAY_ASCII_DATA
msg ("[RLC_TM %p][SEND_SDU] DATA :", rlcP);
msg ("[RLC_TM %p][SEND_SDU] DATA :", rlc_pP);
for (index = 0; index < length_in_bytes; index++) {
msg ("%c", srcP[index]);
}
msg ("\n");
#endif
memcpy (&rlcP->output_sdu_in_construction->data[rlcP->output_sdu_size_to_write], srcP, length_in_bytes);
memcpy (&rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write], srcP, length_in_bytes);
rlc_data_ind (rlcP->enb_module_id, rlcP->ue_module_id, frame, eNB_flag, MBMS_FLAG_NO, rlcP->rb_id, length_in_bytes, rlcP->output_sdu_in_construction, rlcP->is_data_plane);
rlcP->output_sdu_in_construction = NULL;
rlc_data_ind (
rlc_pP->enb_module_id,
rlc_pP->ue_module_id,
frameP,
eNB_flag,
BOOL_NOT(rlc_pP->is_data_plane),
MBMS_FLAG_NO,
rlc_pP->rb_id,
length_in_bytes,
rlc_pP->output_sdu_in_construction);
rlc_pP->output_sdu_in_construction = NULL;
} else {
msg ("[RLC_TM %p][SEND_SDU] ERROR OUTPUT SDU IS NULL\n", rlcP);
msg ("[RLC_TM %p][SEND_SDU] ERROR OUTPUT SDU IS NULL\n", rlc_pP);
}
}
//-----------------------------------------------------------------------------
void
rlc_tm_no_segment (rlc_tm_entity_t *rlcP)
rlc_tm_no_segment (
rlc_tm_entity_t *const rlc_pP
)
{
//-----------------------------------------------------------------------------
mem_block_t *pdu;
struct rlc_tm_tx_sdu_management *sdu_mngt;
struct rlc_tm_tx_pdu_management *pdu_mngt;
int nb_pdu_to_transmit;
nb_pdu_to_transmit = 1;
pdu = NULL;
mem_block_t *pdu_p = NULL;
struct rlc_tm_tx_sdu_management *sdu_mngt_p = NULL;
struct rlc_tm_tx_pdu_management *pdu_mngt_p = NULL;
int nb_pdu_to_transmit = 1;
// only one SDU per TTI
while ((rlcP->input_sdus[rlcP->current_sdu_index]) && (nb_pdu_to_transmit > 0)) {
while ((rlc_pP->input_sdus[rlc_pP->current_sdu_index]) && (nb_pdu_to_transmit > 0)) {
sdu_mngt = ((struct rlc_tm_tx_sdu_management *) (rlcP->input_sdus[rlcP->current_sdu_index]->data));
//PRINT_RLC_TM_SEGMENT("[RLC_TM %p] SEGMENT GET NEW SDU %p AVAILABLE SIZE %d Bytes\n", rlcP, sdu_mngt, sdu_mngt->sdu_remaining_size);
sdu_mngt_p = ((struct rlc_tm_tx_sdu_management *) (rlc_pP->input_sdus[rlc_pP->current_sdu_index]->data));
//PRINT_RLC_TM_SEGMENT("[RLC_TM %p] SEGMENT GET NEW SDU %p AVAILABLE SIZE %d Bytes\n", rlc_pP, sdu_mngt_p, sdu_mngt_p->sdu_remaining_size);
if (!(pdu = get_free_mem_block (((rlcP->rlc_pdu_size + 7) >> 3) + sizeof (struct rlc_tm_tx_data_pdu_struct) + GUARD_CRC_LIH_SIZE))) {
msg ("[RLC_TM %p][SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n", rlcP);
if (!(pdu_p = get_free_mem_block (((rlc_pP->rlc_pdu_size + 7) >> 3) + sizeof (struct rlc_tm_tx_data_pdu_struct) + GUARD_CRC_LIH_SIZE))) {
msg ("[RLC_TM %p][SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n", rlc_pP);
return;
}
// SHOULD BE OPTIMIZED...SOON
pdu_mngt = (struct rlc_tm_tx_pdu_management *) (pdu->data);
memset (pdu->data, 0, sizeof (struct rlc_tm_tx_pdu_management));
pdu_mngt->first_byte = (uint8_t*)&pdu->data[sizeof (struct rlc_tm_tx_data_pdu_struct)];
memcpy (pdu_mngt->first_byte, sdu_mngt->first_byte, ((rlcP->rlc_pdu_size + 7) >> 3));
((struct mac_tb_req *) (pdu->data))->rlc = NULL;
((struct mac_tb_req *) (pdu->data))->data_ptr = pdu_mngt->first_byte;
((struct mac_tb_req *) (pdu->data))->first_bit = 0;
((struct mac_tb_req *) (pdu->data))->tb_size = rlcP->rlc_pdu_size >> 3;
list_add_tail_eurecom (pdu, &rlcP->pdus_to_mac_layer);
rlcP->buffer_occupancy -= (sdu_mngt->sdu_size >> 3);
free_mem_block (rlcP->input_sdus[rlcP->current_sdu_index]);
rlcP->input_sdus[rlcP->current_sdu_index] = NULL;
rlcP->current_sdu_index = (rlcP->current_sdu_index + 1) % rlcP->size_input_sdus_buffer;
rlcP->nb_sdu -= 1;
pdu_mngt_p = (struct rlc_tm_tx_pdu_management *) (pdu_p->data);
memset (pdu_p->data, 0, sizeof (struct rlc_tm_tx_pdu_management));
pdu_mngt_p->first_byte = (uint8_t*)&pdu_p->data[sizeof (struct rlc_tm_tx_data_pdu_struct)];
memcpy (pdu_mngt_p->first_byte, sdu_mngt_p->first_byte, ((rlc_pP->rlc_pdu_size + 7) >> 3));
((struct mac_tb_req *) (pdu_p->data))->rlc = NULL;
((struct mac_tb_req *) (pdu_p->data))->data_ptr = pdu_mngt_p->first_byte;
((struct mac_tb_req *) (pdu_p->data))->first_bit = 0;
((struct mac_tb_req *) (pdu_p->data))->tb_size = rlc_pP->rlc_pdu_size >> 3;
list_add_tail_eurecom (pdu_p, &rlc_pP->pdus_to_mac_layer);
rlc_pP->buffer_occupancy -= (sdu_mngt_p->sdu_size >> 3);
free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index]);
rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % rlc_pP->size_input_sdus_buffer;
rlc_pP->nb_sdu -= 1;
}
}
//-----------------------------------------------------------------------------
void
rlc_tm_rx (void *argP, uint32_t frame, uint8_t eNB_flag, struct mac_data_ind data_indP)
rlc_tm_rx (
void *const argP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
struct mac_data_ind data_indP)
{
//-----------------------------------------------------------------------------
rlc_tm_entity_t *rlc = (rlc_tm_entity_t *) argP;
mem_block_t *tb;
uint8_t *first_byte;
rlc_tm_entity_t * const rlc_p = (rlc_tm_entity_t *) argP;
mem_block_t *tb_p;
uint8_t *first_byte_p;
rlc->output_sdu_size_to_write = 0; // size of sdu reassemblied
while ((tb = list_remove_head (&data_indP.data))) {
first_byte = ((struct mac_tb_ind *) (tb->data))->data_ptr;
rlc_p->output_sdu_size_to_write = 0; // size of sdu reassemblied
while ((tb_p = list_remove_head (&data_indP.data))) {
first_byte_p = ((struct mac_tb_ind *) (tb_p->data))->data_ptr;
((struct rlc_tm_rx_pdu_management *) (tb->data))->first_byte = first_byte;
((struct rlc_tm_rx_pdu_management *) (tb_p->data))->first_byte = first_byte_p;
rlc_tm_send_sdu (rlc, frame, eNB_flag, (((struct mac_tb_ind *) (tb->data))->error_indication), first_byte, data_indP.tb_size);
free_mem_block (tb);
rlc_tm_send_sdu (rlc_p, frameP, eNB_flagP, (((struct mac_tb_ind *) (tb_p->data))->error_indication), first_byte_p, data_indP.tb_size);
free_mem_block (tb_p);
}
}
//-----------------------------------------------------------------------------
struct mac_status_resp
rlc_tm_mac_status_indication (void *rlcP, uint16_t tb_sizeP, struct mac_status_ind tx_statusP)
rlc_tm_mac_status_indication (
void *const rlc_pP,
const tb_size_t tb_sizeP,
struct mac_status_ind tx_statusP)
{
//-----------------------------------------------------------------------------
struct mac_status_resp status_resp;
((rlc_tm_entity_t *) rlcP)->rlc_pdu_size = tb_sizeP;
((rlc_tm_entity_t *) rlc_pP)->rlc_pdu_size = tb_sizeP;
status_resp.buffer_occupancy_in_bytes = ((rlc_tm_entity_t *) rlcP)->buffer_occupancy;
status_resp.buffer_occupancy_in_pdus = status_resp.buffer_occupancy_in_bytes / ((rlc_tm_entity_t *) rlcP)->rlc_pdu_size;
status_resp.rlc_info.rlc_protocol_state = ((rlc_tm_entity_t *) rlcP)->protocol_state;
status_resp.buffer_occupancy_in_bytes = ((rlc_tm_entity_t *) rlc_pP)->buffer_occupancy;
status_resp.buffer_occupancy_in_pdus = status_resp.buffer_occupancy_in_bytes / ((rlc_tm_entity_t *) rlc_pP)->rlc_pdu_size;
status_resp.rlc_info.rlc_protocol_state = ((rlc_tm_entity_t *) rlc_pP)->protocol_state;
return status_resp;
}
//-----------------------------------------------------------------------------
struct mac_data_req
rlc_tm_mac_data_request (void *rlcP, uint32_t frame)
rlc_tm_mac_data_request (
void * const rlc_pP,
const frame_t frameP)
{
//-----------------------------------------------------------------------------
rlc_tm_entity_t *l_rlc = (rlc_tm_entity_t *) rlcP;
rlc_tm_entity_t *l_rlc_p = (rlc_tm_entity_t *) rlc_pP;
struct mac_data_req data_req;
rlc_tm_no_segment (l_rlc);
rlc_tm_no_segment (l_rlc_p);
list_init (&data_req.data, NULL);
list_add_list (&l_rlc->pdus_to_mac_layer, &data_req.data);
list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data);
data_req.buffer_occupancy_in_bytes = l_rlc->buffer_occupancy;
data_req.buffer_occupancy_in_pdus = data_req.buffer_occupancy_in_bytes / l_rlc->rlc_pdu_size;
data_req.rlc_info.rlc_protocol_state = l_rlc->protocol_state;
data_req.buffer_occupancy_in_bytes = l_rlc_p->buffer_occupancy;
data_req.buffer_occupancy_in_pdus = data_req.buffer_occupancy_in_bytes / l_rlc_p->rlc_pdu_size;
data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state;
if (data_req.data.nb_elements > 0) {
LOG_D(RLC, "[RLC_TM][%s][MOD %02u/%02u][RB %d][FRAME %05d] MAC_DATA_REQUEST %d TBs\n",
(l_rlc->is_enb) ? "eNB" : "UE",
l_rlc->enb_module_id,
l_rlc->ue_module_id,
l_rlc->rb_id,
frame,
(l_rlc_p->is_enb) ? "eNB" : "UE",
l_rlc_p->enb_module_id,
l_rlc_p->ue_module_id,
l_rlc_p->rb_id,
frameP,
data_req.data.nb_elements);
}
......@@ -181,51 +204,57 @@ rlc_tm_mac_data_request (void *rlcP, uint32_t frame)
//-----------------------------------------------------------------------------
void
rlc_tm_mac_data_indication (void *rlcP, uint32_t frame, uint8_t eNB_flag, struct mac_data_ind data_indP)
rlc_tm_mac_data_indication (
void * const rlc_pP,
const frame_t frameP,
const eNB_flag_t eNB_flag,
struct mac_data_ind data_indP)
{
//-----------------------------------------------------------------------------
rlc_tm_entity_t *l_rlc = (rlc_tm_entity_t *) rlcP;
rlc_tm_entity_t *l_rlc_p = (rlc_tm_entity_t *) rlc_pP;
if (data_indP.data.nb_elements > 0) {
LOG_D(RLC, "[RLC_TM][%s][MOD %02u/%02u][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n",
(l_rlc->is_enb) ? "eNB" : "UE",
l_rlc->enb_module_id,
l_rlc->ue_module_id,
l_rlc->rb_id,
frame,
(l_rlc_p->is_enb) ? "eNB" : "UE",
l_rlc_p->enb_module_id,
l_rlc_p->ue_module_id,
l_rlc_p->rb_id,
frameP,
data_indP.data.nb_elements);
}
rlc_tm_rx (rlcP, frame, eNB_flag, data_indP);
rlc_tm_rx (rlc_pP, frameP, eNB_flag, data_indP);
}
//-----------------------------------------------------------------------------
void
rlc_tm_data_req (void *rlcP, mem_block_t *sduP)
rlc_tm_data_req (
void *const rlc_pP,
mem_block_t *const sdu_pP)
{
//-----------------------------------------------------------------------------
rlc_tm_entity_t *rlc = (rlc_tm_entity_t *) rlcP;
rlc_tm_entity_t *rlc_p = (rlc_tm_entity_t *) rlc_pP;
#ifdef DEBUG_RLC_TM_DATA_REQUEST
LOG_D (RLC, "[RLC_TM][%s][MOD %02u/%02u] RLC_TM_DATA_REQ size %d Bytes, BO %ld , NB SDU %d current_sdu_index=%d next_sdu_index=%d\n",
(l_rlc->is_enb) ? "eNB" : "UE",
l_rlc->enb_module_id,
l_rlc->ue_module_id,
((struct rlc_um_data_req *) (sduP->data))->data_size,
rlc->buffer_occupancy,
rlc->nb_sdu,
rlc->current_sdu_index,
rlc->next_sdu_index);
(l_rlc_p->is_enb) ? "eNB" : "UE",
l_rlc_p->enb_module_id,
l_rlc_p->ue_module_id,
((struct rlc_um_data_req *) (sdu_pP->data))->data_size,
rlc_p->buffer_occupancy,
rlc_p->nb_sdu,
rlc_p->current_sdu_index,
rlc_p->next_sdu_index);
#endif
// not in 3GPP specification but the buffer may be full if not correctly configured
if (rlc->input_sdus[rlc->next_sdu_index] == NULL) {
((struct rlc_tm_tx_sdu_management *) (sduP->data))->sdu_size = ((struct rlc_tm_data_req *) (sduP->data))->data_size;
rlc->buffer_occupancy += ((struct rlc_tm_tx_sdu_management *) (sduP->data))->sdu_size >> 3;
rlc->nb_sdu += 1;
((struct rlc_tm_tx_sdu_management *) (sduP->data))->first_byte = (uint8_t*)&sduP->data[sizeof (struct rlc_tm_data_req_alloc)];
rlc->input_sdus[rlc->next_sdu_index] = sduP;
rlc->next_sdu_index = (rlc->next_sdu_index + 1) % rlc->size_input_sdus_buffer;
if (rlc_p->input_sdus[rlc_p->next_sdu_index] == NULL) {
((struct rlc_tm_tx_sdu_management *) (sdu_pP->data))->sdu_size = ((struct rlc_tm_data_req *) (sdu_pP->data))->data_size;
rlc_p->buffer_occupancy += ((struct rlc_tm_tx_sdu_management *) (sdu_pP->data))->sdu_size >> 3;
rlc_p->nb_sdu += 1;
((struct rlc_tm_tx_sdu_management *) (sdu_pP->data))->first_byte = (uint8_t*)&sdu_pP->data[sizeof (struct rlc_tm_data_req_alloc)];
rlc_p->input_sdus[rlc_p->next_sdu_index] = sdu_pP;
rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer;
} else {
free_mem_block (sduP);
free_mem_block (sdu_pP);
}
}
......@@ -69,58 +69,73 @@ Address : EURECOM,
/*! \fn void rlc_tm_send_sdu (rlc_tm_entity_t *rlcP, uint8_t error_indicationP, uint8_t * srcP, uint16_t length_in_bitsP)
/*! \fn void rlc_tm_send_sdu (
* rlc_tm_entity_t * const rlc_pP,
* const frame_t frameP,
* const eNB_flag_t eNB_flag,
* const boolean_t error_indicationP,
* uint8_t * const srcP,
* const sdu_size_t length_in_bitsP)
* \brief Send SDU if any reassemblied to upper layer.
* \param[in] rlcP RLC TM protocol instance pointer.
* \param[in] error_indicationP Error indicated by lower layers for this SDU.
* \param[in] srcP SDU data pointer.
* \param[in] length_in_bitsP Length of SDU in bits.
*/
private_rlc_tm(void rlc_tm_send_sdu (rlc_tm_entity_t *rlcP, uint8_t error_indicationP, uint8_t * srcP, uint16_t length_in_bitsP);)
private_rlc_tm(void rlc_tm_send_sdu (
rlc_tm_entity_t * const rlc_pP,
const frame_t frameP,
const eNB_flag_t eNB_flag,
const boolean_t error_indicationP,
uint8_t * const srcP,
const sdu_size_t length_in_bitsP);)
/*! \fn void rlc_tm_no_segment (rlc_tm_entity_t *rlcP)
* \brief Schedule a SDU to be transmited by lower layers.
* \param[in] rlcP RLC TM protocol instance pointer.
*/
private_rlc_tm(void rlc_tm_no_segment (rlc_tm_entity_t *rlcP);)
private_rlc_tm(void rlc_tm_no_segment (rlc_tm_entity_t *const rlcP);)
/*! \fn void rlc_tm_rx (void *rlcP, frame_t frame, struct mac_data_ind data_indP)
/*! \fn void rlc_tm_rx (void *const rlcP, const frame_t frameP, struct mac_data_ind data_indP)
* \brief Process the received PDUs from lower layer.
* \param[in] rlcP RLC TM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] frameP Frame index.
* \param[in] data_indP PDUs from MAC.
*/
private_rlc_tm( void rlc_tm_rx (void *rlcP, frame_t frame, struct mac_data_ind data_indP);)
private_rlc_tm( void rlc_tm_rx (
void *const rlcP,
const frame_t frameP,
struct mac_data_ind data_indP);)
/*! \fn struct mac_status_resp rlc_tm_mac_status_indication (void *rlcP, frame_t frame, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP)
/*! \fn struct mac_status_resp rlc_tm_mac_status_indication (void *rlcP, const frame_t frameP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP)
* \brief Request the maximum number of bytes that can be served by RLC instance to MAC and fix the amount of bytes requested by MAC for next RLC transmission.
* \param[in] rlcP RLC TM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] frameP Frame index.
* \param[in] tbs_sizeP Number of bytes requested by MAC for next transmission.
* \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU.
* \return The maximum number of bytes that can be served by RLC instance to MAC.
*/
public_rlc_tm( struct mac_status_resp rlc_tm_mac_status_indication (void *rlcP, frame_t frame, uint16_t tb_sizeP, struct mac_status_ind tx_statusP);)
public_rlc_tm( struct mac_status_resp rlc_tm_mac_status_indication (void *rlcP, const frame_t frameP, uint16_t tb_sizeP, struct mac_status_ind tx_statusP);)
/*! \fn struct mac_data_req rlc_tm_mac_data_request (void *rlcP, frame_t frame)
/*! \fn struct mac_data_req rlc_tm_mac_data_request (void *rlcP, const frame_t frameP)
* \brief Gives PDUs to lower layer MAC.
* \param[in] rlcP RLC TM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] frameP Frame index.
* \return A PDU of the previously requested number of bytes, and the updated maximum number of bytes that can be served by RLC instance to MAC for next RLC transmission.
*/
public_rlc_tm( struct mac_data_req rlc_tm_mac_data_request (void *rlcP, frame_t frame);)
public_rlc_tm( struct mac_data_req rlc_tm_mac_data_request (void *rlcP, const frame_t frameP);)
/*! \fn void rlc_tm_mac_data_indication (void *rlcP, frame_t frame, uint8_t eNB_flag, struct mac_data_ind data_indP)
/*! \fn void rlc_tm_mac_data_indication (void *rlcP, const frame_t frameP, uint8_t eNB_flag, struct mac_data_ind data_indP)
* \brief Receive PDUs from lower layer MAC.
* \param[in] rlcP RLC TM protocol instance pointer.
* \param[in] frame Frame Index.
* \param[in] frameP Frame Index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0).
* \param[in] data_indP PDUs from MAC.
*/
public_rlc_tm( void rlc_tm_mac_data_indication (void *rlcP, frame_t frame, uint8_t eNB_flag, struct mac_data_ind data_indP);)
public_rlc_tm( void rlc_tm_mac_data_indication (void *rlcP, const frame_t frameP, uint8_t eNB_flag, struct mac_data_ind data_indP);)
/*! \fn void rlc_tm_data_req (void *rlcP, mem_block_t *sduP)
......
......@@ -35,34 +35,52 @@ Address : EURECOM,
#include "rlc_tm.h"
#include "LAYER2/MAC/extern.h"
//-----------------------------------------------------------------------------
void config_req_rlc_tm ( uint32_t frame, uint8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_tm_info_t * config_tmP, rb_id_t rb_idP, rb_type_t rb_typeP)
void config_req_rlc_tm (
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const rlc_tm_info_t * const config_tmP,
const rb_id_t rb_idP)
{
//-----------------------------------------------------------------------------
rlc_tm_entity_t *rlc = NULL;
LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ (is_uplink_downlink=%d) --->][RLC_TM][MOD %u/%u][RB %u]\n",
frame,
( eNB_flagP > 0) ? "eNB":"UE",
enb_module_idP,
ue_module_idP,
config_tmP->is_uplink_downlink,
enb_module_idP,
ue_module_idP,
rb_idP);
if (eNB_flagP) {
rlc = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.tm;
rlc_union_t *rlc_union_p = NULL;
rlc_tm_entity_t *rlc_p = NULL;
hash_key_t key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP);
hashtable_rc_t h_rc;
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
rlc_p = &rlc_union_p->rlc.tm;
LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ (is_uplink_downlink=%d) --->][RLC_TM][MOD %u/%u][RB %u]\n",
frameP,
( eNB_flagP > 0) ? "eNB":"UE",
enb_module_idP,
ue_module_idP,
config_tmP->is_uplink_downlink,
enb_module_idP,
ue_module_idP,
rb_idP);
rlc_tm_init(rlc_p);
rlc_p->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
rlc_tm_set_debug_infos(rlc_p, frameP, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, srb_flagP);
rlc_tm_configure(rlc_p, config_tmP->is_uplink_downlink);
} else {
rlc = &rlc_array_ue[ue_module_idP][rb_idP].rlc.tm;
LOG_E(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ --->][RLC_TM][MOD %u/%u][RB %u], RLC NOT FOUND\n",
frameP,
( eNB_flagP > 0) ? "eNB":"UE",
enb_module_idP,
ue_module_idP,
enb_module_idP,
ue_module_idP,
rb_idP);
}
rlc_tm_init(rlc);
rlc->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
rlc_tm_set_debug_infos(rlc, frame, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP);
rlc_tm_configure(rlc, config_tmP->is_uplink_downlink);
}
//-----------------------------------------------------------------------------
void rlc_tm_init (rlc_tm_entity_t *rlcP)
void rlc_tm_init (rlc_tm_entity_t * const rlcP)
{
//-----------------------------------------------------------------------------
int saved_allocation = rlcP->allocation;
......@@ -90,7 +108,7 @@ void rlc_tm_init (rlc_tm_entity_t *rlcP)
}
//-----------------------------------------------------------------------------
void rlc_tm_reset_state_variables (struct rlc_tm_entity *rlcP)
void rlc_tm_reset_state_variables (struct rlc_tm_entity * const rlcP)
{
//-----------------------------------------------------------------------------
rlcP->output_sdu_size_to_write = 0;
......@@ -101,7 +119,7 @@ void rlc_tm_reset_state_variables (struct rlc_tm_entity *rlcP)
}
//-----------------------------------------------------------------------------
void
rlc_tm_cleanup (rlc_tm_entity_t *rlcP)
rlc_tm_cleanup (rlc_tm_entity_t * const rlcP)
{
//-----------------------------------------------------------------------------
int index;
......@@ -125,7 +143,9 @@ rlc_tm_cleanup (rlc_tm_entity_t *rlcP)
}
//-----------------------------------------------------------------------------
void rlc_tm_configure(rlc_tm_entity_t *rlcP, uint8_t is_uplink_downlinkP)
void rlc_tm_configure(
rlc_tm_entity_t * const rlcP,
const boolean_t is_uplink_downlinkP)
{
//-----------------------------------------------------------------------------
rlcP->is_uplink_downlink = is_uplink_downlinkP;
......@@ -133,11 +153,18 @@ void rlc_tm_configure(rlc_tm_entity_t *rlcP, uint8_t is_uplink_downlinkP)
}
//-----------------------------------------------------------------------------
void rlc_tm_set_debug_infos(rlc_tm_entity_t *rlcP, uint32_t frame, uint8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
void rlc_tm_set_debug_infos(
rlc_tm_entity_t * const rlcP,
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP)
//-----------------------------------------------------------------------------
{
msg ("[FRAME %05d][%s][RLC_TM][MOD %02u/%02u][RB %u][SET DEBUG INFOS] enb module_id %d ue module_id %d rb_id %d rb_type %d\n",
frame,
msg ("[FRAME %05d][%s][RLC_TM][MOD %02u/%02u][RB %u][SET DEBUG INFOS] enb module_id %d ue module_id %d rb_id %d srb_flag %d\n",
frameP,
(eNB_flagP) ? "eNB" : "UE",
enb_module_idP,
ue_module_idP,
......@@ -145,15 +172,15 @@ void rlc_tm_set_debug_infos(rlc_tm_entity_t *rlcP, uint32_t frame, uint8_t eNB_f
enb_module_idP,
ue_module_idP,
rb_idP,
rb_typeP);
srb_flagP);
rlcP->enb_module_id = enb_module_idP;
rlcP->ue_module_id = ue_module_idP;
rlcP->rb_id = rb_idP;
if (rb_typeP != SIGNALLING_RADIO_BEARER) {
rlcP->is_data_plane = 1;
} else {
if (srb_flagP) {
rlcP->is_data_plane = 0;
} else {
rlcP->is_data_plane = 1;
}
rlcP->is_enb = eNB_flagP;
}
......@@ -68,59 +68,82 @@ Address : EURECOM,
# endif
# endif
typedef volatile struct {
typedef volatile struct rlc_tm_info_s{
uint8_t is_uplink_downlink;
} rlc_tm_info_t;
/*! \fn void config_req_rlc_tm (uint32_t frame, uint8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_tm_info_t * config_tmP, rb_id_t rb_idP, rb_type_t rb_typeP)
/*! \fn void config_req_rlc_tm (void config_req_rlc_tm (
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const rlc_tm_info_t * const config_tmP,
const rb_id_t rb_idP,
const srb_flag_t srb_flagP)
* \brief Allocate memory for RLC TM instance, reset protocol variables, and set protocol parameters.
* \param[in] frame Frame index.
* \param[in] frameP Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0)
* \param[in] enb_module_idP eNB Virtualized module identifier.
* \param[in] ue_module_idP UE Virtualized module identifier.
* \param[in] config_tmP Configuration parameters for RLC TM instance.
* \param[in] rb_idP Radio bearer identifier.
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
*/
public_rlc_tm_init( void config_req_rlc_tm (uint32_t frame, uint8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_tm_info_t * config_tmP, rb_id_t rb_idP, rb_type_t rb_typeP);)
public_rlc_tm_init( void config_req_rlc_tm (
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const rlc_tm_info_t * const config_tmP,
const rb_id_t rb_idP);)
/*! \fn void rlc_tm_init (rlc_tm_entity_t *rlcP)
* \brief Initialize a RLC TM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC TM protocol instance will be in RLC_NULL_STATE state.
* \param[in] rlcP RLC TM protocol instance pointer.
*/
protected_rlc_tm_init(void rlc_tm_init (rlc_tm_entity_t *rlcP);)
protected_rlc_tm_init(void rlc_tm_init (rlc_tm_entity_t * const rlcP);)
/*! \fn void rlc_tm_reset_state_variables (rlc_tm_entity_t *rlcP)
* \brief Reset protocol variables and state variables to initial values.
* \param[in] rlcP RLC TM protocol instance pointer.
*/
protected_rlc_tm_init(void rlc_tm_reset_state_variables (rlc_tm_entity_t *rlcP);)
protected_rlc_tm_init(void rlc_tm_reset_state_variables (rlc_tm_entity_t * const rlcP);)
/*! \fn void rlc_tm_cleanup(rlc_tm_entity_t *rlcP)
* \brief Free all allocated memory (lists and buffers) previously allocated by this RLC TM instance.
* \param[in] rlcP RLC TM protocol instance pointer.
*/
public_rlc_tm_init( void rlc_tm_cleanup(rlc_tm_entity_t *rlcP);)
public_rlc_tm_init( void rlc_tm_cleanup(rlc_tm_entity_t * const rlcP);)
/*! \fn void rlc_tm_configure(rlc_tm_entity_t *rlcP, uint32_t timer_reorderingP, uint32_t is_uplink_downlinkP)
/*! \fn void rlc_tm_configure(rlc_tm_entity_t * const rlcP, const boolean_t is_uplink_downlinkP)
* \brief Configure RLC TM protocol parameters.
* \param[in] rlcP RLC TM protocol instance pointer.
* \param[in] is_uplink_downlinkP Is this instance is TRANSMITTER_ONLY,
RECEIVER_ONLY, or TRANSMITTER_AND_RECEIVER.
*/
protected_rlc_tm_init(void rlc_tm_configure(rlc_tm_entity_t *rlcP, uint8_t is_uplink_downlinkP);)
protected_rlc_tm_init(void rlc_tm_configure(rlc_tm_entity_t * const rlcP, const boolean_t is_uplink_downlinkP);)
/*! \fn void rlc_tm_set_debug_infos(rlc_tm_entity_t *rlcP, uint32_t frame, uint8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
/*! \fn void rlc_tm_set_debug_infos(rlc_tm_entity_t *rlcP, const frame_t frameP, uint8_t eNB_flagP, const module_id_t enb_module_idP, const module_id_t ue_module_idP, const rb_id_t rb_idP, const srb_flag_t srb_flagP)
* \brief Set debug informations for a RLC TM protocol instance, these informations are only for trace purpose.
* \param[in] rlcP RLC TM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] enb_module_idP eNB Virtualized module identifier.
* \param[in] ue_module_idP UE Virtualized module identifier.
* \param[in] frameP Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
* \param[in] rb_idP Radio bearer identifier.
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
*/
protected_rlc_tm_init(void rlc_tm_set_debug_infos(rlc_tm_entity_t *rlcP, uint32_t frame, uint8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP);)
protected_rlc_tm_init(void rlc_tm_set_debug_infos(
rlc_tm_entity_t * const rlcP,
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP);)
/** @} */
# endif
......@@ -31,8 +31,8 @@ Address : EURECOM,
*******************************************************************************/
#define RLC_UM_MODULE
#define RLC_UM_CONTROL_PRIMITIVES_C
//#include "rtos_header.h"
#include "platform_types.h"
#include "assertions.h"
//-----------------------------------------------------------------------------
#include "rlc_um.h"
#include "rlc_primitives.h"
......@@ -45,25 +45,27 @@ Address : EURECOM,
#include "T-Reordering.h"
//-----------------------------------------------------------------------------
void config_req_rlc_um (frame_t frameP,
eNB_flag_t eNB_flagP,
module_id_t enb_module_idP,
module_id_t ue_module_idP,
rlc_um_info_t *config_um_pP,
rb_id_t rb_idP,
rb_type_t rb_typeP)
void config_req_rlc_um (
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const rlc_um_info_t * const config_um_pP,
const rb_id_t rb_idP)
{
//-----------------------------------------------------------------------------
rlc_um_entity_t *rlc_p = NULL;
rlc_union_t *rlc_union_p = NULL;
rlc_um_entity_t *rlc_p = NULL;
hash_key_t key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP);
hashtable_rc_t h_rc;
if (eNB_flagP) {
rlc_p = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.um;
} else {
rlc_p = &rlc_array_ue[ue_module_idP][rb_idP].rlc.um;
}
LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ timer_reordering=%d sn_field_length=%d is_mXch=%d --->][RLC_UM][MOD %u/%u][RB %u] \n",
frameP,
(eNB_flagP) ? "eNB" : "UE",
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
rlc_p = &rlc_union_p->rlc.um;
LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ timer_reordering=%d sn_field_length=%d is_mXch=%d --->][RLC_UM][MOD %u/%u][RB %u] \n",
frameP,
(eNB_flagP) ? "eNB" : "UE",
enb_module_idP,
ue_module_idP,
config_um_pP->timer_reordering,
......@@ -73,64 +75,66 @@ void config_req_rlc_um (frame_t frameP,
ue_module_idP,
rb_idP);
rlc_um_init(rlc_p);
if (rlc_um_fsm_notify_event (rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) {
rlc_um_set_debug_infos(rlc_p, frameP, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP);
rlc_um_configure(rlc_p,
rlc_um_init(rlc_p);
if (rlc_um_fsm_notify_event (rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) {
rlc_um_set_debug_infos(rlc_p, enb_module_idP, ue_module_idP, frameP, eNB_flagP, srb_flagP, rb_idP);
rlc_um_configure(rlc_p,
frameP,
config_um_pP->timer_reordering,
config_um_pP->sn_field_length,
config_um_pP->sn_field_length,
config_um_pP->is_mXch);
}
} else {
LOG_E(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ --->][RLC_UM][MOD %u/%u][RB %u] RLC NOT FOUND\n",
frameP,
config_um_pP->timer_reordering,
config_um_pP->sn_field_length,
config_um_pP->sn_field_length,
config_um_pP->is_mXch);
}
(eNB_flagP) ? "eNB" : "UE",
enb_module_idP,
ue_module_idP,
enb_module_idP,
ue_module_idP,
rb_idP); }
}
//-----------------------------------------------------------------------------
uint32_t t_Reordering_tab[T_Reordering_spare1] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200};
const uint32_t const t_Reordering_tab[T_Reordering_spare1] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200};
void config_req_rlc_um_asn1 (frame_t frameP,
eNB_flag_t eNB_flagP,
MBMS_flag_t mbms_flagP,
module_id_t enb_module_idP,
module_id_t ue_module_idP,
mbms_session_id_t mbms_session_idP,
mbms_service_id_t mbms_service_idP,
UL_UM_RLC_t *ul_rlc_pP,
DL_UM_RLC_t *dl_rlc_pP,
rb_id_t rb_idP,
rb_type_t rb_typeP)
void config_req_rlc_um_asn1 (
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const MBMS_flag_t mbms_flagP,
const mbms_session_id_t mbms_session_idP,
const mbms_service_id_t mbms_service_idP,
const UL_UM_RLC_t * const ul_rlc_pP,
const DL_UM_RLC_t * const dl_rlc_pP,
const rb_id_t rb_idP)
{
uint32_t ul_sn_FieldLength = 0;
uint32_t dl_sn_FieldLength = 0;
uint32_t t_Reordering;
uint32_t ul_sn_FieldLength = 0;
uint32_t dl_sn_FieldLength = 0;
uint32_t t_Reordering = 0;
rlc_union_t *rlc_union_p = NULL;
rlc_um_entity_t *rlc_p = NULL;
hash_key_t key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP);
hashtable_rc_t h_rc;
#if defined(Rel10)
if (mbms_flagP) {
if (eNB_flagP) {
rlc_p = &rlc_mbms_array_eNB[enb_module_idP][mbms_service_idP][mbms_session_idP].um;
LOG_D(RLC,"eNB config_req_rlc_um_asn1 rlc_um_p : %p RB %u service %u session %u",
rlc_p,
rb_idP,
mbms_service_idP,
mbms_session_idP
);
} else {
rlc_p = &rlc_mbms_array_ue[ue_module_idP][mbms_service_idP][mbms_session_idP].um;
LOG_D(RLC,"UE config_req_rlc_um_asn1 rlc_um_p : %p RB %u service %u session %u",
rlc_p,
rb_idP,
mbms_service_idP,
mbms_session_idP
);
}
key = RLC_COLL_KEY_MBMS_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, mbms_service_idP, mbms_session_idP);
}
else
#endif
{
if (eNB_flagP) {
rlc_p = &rlc_array_eNB[enb_module_idP][ue_module_idP][rb_idP].rlc.um;
} else {
rlc_p = &rlc_array_ue[ue_module_idP][rb_idP].rlc.um;
}
key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP);
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u",
enb_module_idP,
ue_module_idP,
eNB_flagP,
rb_idP,
srb_flagP);
rlc_p = &rlc_union_p->rlc.um;
}
//-----------------------------------------------------------------------------
......@@ -146,7 +150,7 @@ void config_req_rlc_um_asn1 (frame_t frameP,
rlc_um_init(rlc_p);
if (rlc_um_fsm_notify_event (rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) {
rlc_um_set_debug_infos(rlc_p, frameP, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, rb_typeP);
rlc_um_set_debug_infos(rlc_p, enb_module_idP, ue_module_idP, frameP, eNB_flagP, srb_flagP, rb_idP);
if (ul_rlc_pP != NULL) {
switch (ul_rlc_pP->sn_FieldLength) {
case SN_FieldLength_size5:
......@@ -220,7 +224,7 @@ void config_req_rlc_um_asn1 (frame_t frameP,
}
//-----------------------------------------------------------------------------
void
rlc_um_init (rlc_um_entity_t *rlc_pP)
rlc_um_init (rlc_um_entity_t * const rlc_pP)
{
//-----------------------------------------------------------------------------
......@@ -253,22 +257,18 @@ rlc_um_init (rlc_um_entity_t *rlc_pP)
// SPARE : not 3GPP
rlc_pP->size_input_sdus_buffer =128;
if ((rlc_pP->input_sdus_alloc == NULL) && (rlc_pP->size_input_sdus_buffer > 0)) {
rlc_pP->input_sdus_alloc = get_free_mem_block (rlc_pP->size_input_sdus_buffer * sizeof (void *));
rlc_pP->input_sdus = (mem_block_t **) (rlc_pP->input_sdus_alloc->data);
memset (rlc_pP->input_sdus, 0, rlc_pP->size_input_sdus_buffer * sizeof (void *));
if ((rlc_pP->input_sdus == NULL) && (rlc_pP->size_input_sdus_buffer > 0)) {
rlc_pP->input_sdus = calloc(1 , rlc_pP->size_input_sdus_buffer * sizeof (void *));
}
if (rlc_pP->dar_buffer_alloc == NULL) {
rlc_pP->dar_buffer_alloc = get_free_mem_block (1024 * sizeof (void *));
rlc_pP->dar_buffer = (mem_block_t **) (rlc_pP->dar_buffer_alloc->data);
memset (rlc_pP->dar_buffer, 0, 1024 * sizeof (void *));
if (rlc_pP->dar_buffer == NULL) {
rlc_pP->dar_buffer = calloc (1, 1024 * sizeof (void *));
}
rlc_pP->first_pdu = 1;
}
//-----------------------------------------------------------------------------
void
rlc_um_reset_state_variables (rlc_um_entity_t *rlc_pP)
rlc_um_reset_state_variables (rlc_um_entity_t * const rlc_pP)
{
//-----------------------------------------------------------------------------
rlc_pP->buffer_occupancy = 0;
......@@ -285,46 +285,47 @@ rlc_um_reset_state_variables (rlc_um_entity_t *rlc_pP)
}
//-----------------------------------------------------------------------------
void
rlc_um_cleanup (rlc_um_entity_t *rlc_pP)
rlc_um_cleanup (rlc_um_entity_t * const rlc_pP)
{
//-----------------------------------------------------------------------------
int index;
// TX SIDE
list_free (&rlc_pP->pdus_to_mac_layer);
if (rlc_pP->input_sdus_alloc) {
if (rlc_pP->input_sdus) {
for (index = 0; index < rlc_pP->size_input_sdus_buffer; index++) {
if (rlc_pP->input_sdus[index]) {
free_mem_block (rlc_pP->input_sdus[index]);
}
}
free_mem_block (rlc_pP->input_sdus_alloc);
rlc_pP->input_sdus_alloc = NULL;
free (rlc_pP->input_sdus);
rlc_pP->input_sdus = NULL;
}
// RX SIDE
list_free (&rlc_pP->pdus_from_mac_layer);
if ((rlc_pP->output_sdu_in_construction)) {
free_mem_block (rlc_pP->output_sdu_in_construction);
}
if (rlc_pP->dar_buffer_alloc) {
if (rlc_pP->dar_buffer) {
for (index = 0; index < 1024; index++) {
if (rlc_pP->dar_buffer[index]) {
free_mem_block (rlc_pP->dar_buffer[index]);
}
}
free_mem_block (rlc_pP->dar_buffer_alloc);
rlc_pP->dar_buffer_alloc = NULL;
free (rlc_pP->dar_buffer);
rlc_pP->dar_buffer = NULL;
}
memset(rlc_pP, 0, sizeof(rlc_um_entity_t));
}
//-----------------------------------------------------------------------------
void rlc_um_configure(rlc_um_entity_t *rlc_pP,
frame_t frameP,
uint32_t timer_reorderingP,
uint32_t rx_sn_field_lengthP,
uint32_t tx_sn_field_lengthP,
uint32_t is_mXchP)
void rlc_um_configure(
rlc_um_entity_t * const rlc_pP,
const frame_t frameP,
const uint32_t timer_reorderingP,
const uint32_t rx_sn_field_lengthP,
const uint32_t tx_sn_field_lengthP,
const uint32_t is_mXchP)
//-----------------------------------------------------------------------------
{
if (rx_sn_field_lengthP == 10) {
......@@ -386,30 +387,31 @@ void rlc_um_configure(rlc_um_entity_t *rlc_pP,
rlc_um_reset_state_variables (rlc_pP);
}
//-----------------------------------------------------------------------------
void rlc_um_set_debug_infos(rlc_um_entity_t *rlc_pP,
frame_t frameP,
eNB_flag_t eNB_flagP,
module_id_t enb_module_idP,
module_id_t ue_module_idP,
rb_id_t rb_idP,
rb_type_t rb_typeP)
void rlc_um_set_debug_infos(
rlc_um_entity_t *rlc_pP,
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP)
//-----------------------------------------------------------------------------
{
LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][SET DEBUG INFOS] enb_module_id %u ue_module_id %u rb_id %d rb_type %d\n",
LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][SET DEBUG INFOS] enb_module_id %u ue_module_id %u rb_id %d srb_flag %d\n",
frameP,
(eNB_flagP) ? "eNB" : "UE",
enb_module_idP,
ue_module_idP,
rb_idP,
rb_typeP);
srb_flagP);
rlc_pP->enb_module_id = enb_module_idP;
rlc_pP->ue_module_id = ue_module_idP;
rlc_pP->rb_id = rb_idP;
if (rb_typeP == RADIO_ACCESS_BEARER) {
rlc_pP->is_data_plane = 1;
} else {
if (srb_flagP) {
rlc_pP->is_data_plane = 0;
} else {
rlc_pP->is_data_plane = 1;
}
rlc_pP->is_enb = eNB_flagP;
}
......@@ -47,10 +47,8 @@ Address : EURECOM,
//-----------------------------------------------------------------------------
# include "rlc_um_entity.h"
# include "mem_block.h"
//# include "rrm_config_structs.h"
# include "rlc_um_structs.h"
# include "rlc_um_constants.h"
//# include "rlc.h"
# include "platform_types.h"
# include "DL-UM-RLC.h"
# include "UL-UM-RLC.h"
......@@ -79,32 +77,48 @@ typedef volatile struct {
} rlc_um_info_t;
/*! \fn void config_req_rlc_um (frame_t frame, eNB_flag_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_um_info_t * config_umP, rb_id_t rb_idP, rb_type_t rb_typeP)
/*! \fn void config_req_rlc_um (
* const module_id_t enb_module_idP,
* const module_id_t ue_module_idP,
* const frame_t frameP,
* const eNB_flag_t eNB_flagP,
* const srb_flag_t srb_flagP,
* const rlc_um_info_t * const config_umP,
* const rb_id_t rb_idP)
* \brief Allocate memory for RLC UM instance, reset protocol variables, and set protocol parameters. After this configuration the RLC UM protocol instance will be in RLC_DATA_TRANSFER_READY_STATE state.
* \param[in] frame Frame index.
* \param[in] frameP Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
* \param[in] enb_module_idP eNB Virtualized module identifier.
* \param[in] ue_module_idP UE Virtualized module identifier.
* \param[in] config_umP Configuration parameters for RLC UM instance.
* \param[in] rb_idP Radio bearer identifier.
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
*/
public_rlc_um_control_primitives( void config_req_rlc_um (frame_t frame, eNB_flag_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_um_info_t * config_umP, rb_id_t rb_idP, rb_type_t rb_typeP);)
public_rlc_um_control_primitives( void config_req_rlc_um (
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const rlc_um_info_t * const config_umP,
const rb_id_t rb_idP);)
/*! \fn void config_req_rlc_um_asn1 (frame_t frame,
* eNB_flag_t eNB_flagP,
* MBMS_flag_t mbms_flagP,
* module_id_t enb_module_idP,
* module_id_t ue_module_idP,
* mbms_session_id_t mbms_session_idP,
mbms_service_id_t mbms_service_idP,
UL_UM_RLC_t* ul_rlcP,
DL_UM_RLC_t* dl_rlcP,
rb_id_t rb_idP,
rb_type_t rb_typeP)
/*! \fn void config_req_rlc_um_asn1 (
* const module_id_t enb_module_idP,
* const module_id_t ue_module_idP,
* const frame_t frameP,
* const eNB_flag_t eNB_flagP,
* const srb_flag_t srb_flagP,
* const MBMS_flag_t mbms_flagP,
* const mbms_session_id_t mbms_session_idP,
* const mbms_service_id_t mbms_service_idP,
* const UL_UM_RLC_t* const ul_rlcP,
* const DL_UM_RLC_t* const dl_rlcP,
* const rb_id_t rb_idP)
* \brief Allocate memory for RLC UM instance, reset protocol variables, and set protocol parameters. After this configuration the RLC UM protocol instance will be in RLC_DATA_TRANSFER_READY_STATE state.
* \param[in] frameP Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] frameP Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
* \param[in] mbms_flagP Flag to indicate if this RLC is configured for MBMS.
* \param[in] enb_module_idP eNB Virtualized module identifier.
* \param[in] ue_module_idP UE Virtualized module identifier.
......@@ -113,59 +127,85 @@ public_rlc_um_control_primitives( void config_req_rlc_um (frame_t frame, eNB_f
* \param[in] ul_rlcP Configuration parameters for RLC UM UL instance.
* \param[in] dl_rlcP Configuration parameters for RLC UM DL instance.
* \param[in] rb_idP Radio bearer identifier.
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
*/
public_rlc_um_control_primitives( void config_req_rlc_um_asn1 (frame_t frameP,
eNB_flag_t eNB_flagP,
MBMS_flag_t mbms_flagP,
module_id_t enb_module_idP,
module_id_t ue_module_idP,
mbms_session_id_t mbms_session_idP,
mbms_service_id_t mbms_service_idP,
UL_UM_RLC_t *ul_rlcP,
DL_UM_RLC_t *dl_rlcP,
rb_id_t rb_idP,
rb_type_t rb_typeP);)
public_rlc_um_control_primitives( void config_req_rlc_um_asn1 (
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const MBMS_flag_t mbms_flagP,
const mbms_session_id_t mbms_session_idP,
const mbms_service_id_t mbms_service_idP,
const UL_UM_RLC_t * const ul_rlcP,
const DL_UM_RLC_t * const dl_rlcP,
const rb_id_t rb_idP);)
/*! \fn void rlc_um_init (rlc_um_entity_t *rlcP)
* \brief Initialize a RLC UM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC UM protocol instance will be in RLC_NULL_STATE state.
* \param[in] rlcP RLC UM protocol instance pointer.
*/
protected_rlc_um_control_primitives(void rlc_um_init (rlc_um_entity_t *rlcP);)
protected_rlc_um_control_primitives(void rlc_um_init (rlc_um_entity_t * const rlcP);)
/*! \fn void rlc_um_reset_state_variables (rlc_um_entity_t *rlcP)
* \brief Reset protocol variables and state variables to initial values.
* \param[in] rlcP RLC UM protocol instance pointer.
*/
protected_rlc_um_control_primitives(void rlc_um_reset_state_variables (rlc_um_entity_t *rlcP);)
protected_rlc_um_control_primitives(void rlc_um_reset_state_variables (rlc_um_entity_t * const rlcP);)
/*! \fn void rlc_um_cleanup(rlc_um_entity_t *rlcP)
* \brief Free all allocated memory (lists and buffers) previously allocated by this RLC UM instance.
* \param[in] rlcP RLC UM protocol instance pointer.
*/
public_rlc_um_control_primitives( void rlc_um_cleanup(rlc_um_entity_t *rlcP);)
public_rlc_um_control_primitives( void rlc_um_cleanup(rlc_um_entity_t * const rlcP);)
/*! \fn void rlc_um_configure(rlc_um_entity_t *rlcP, frame_t frame, uint32_t timer_reorderingP, uint32_t rx_sn_field_lengthP, uint32_t tx_sn_field_lengthP, uint32_t is_mXchP)
/*! \fn void rlc_um_configure(
* rlc_um_entity_t * const rlcP,
* const frame_t frameP,
* const uint32_t timer_reorderingP,
* const uint32_t rx_sn_field_lengthP,
* const uint32_t tx_sn_field_lengthP,
* const uint32_t is_mXchP)
* \brief Configure RLC UM protocol parameters.
* \param[in] rlcP RLC UM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] timer_reorderingP t-Reordering timer initialization value, units in frame.
* \param[in] frameP Frame index.
* \param[in] timer_reorderingP t-Reordering timer initialization value, units in frameP.
* \param[in] rx_sn_field_lengthP Length of the sequence number, 5 or 10 bits in reception.
* \param[in] tx_sn_field_lengthP Length of the sequence number, 5 or 10 bits in transmission.
* \param[in] is_mXchP Is the radio bearer for MCCH, MTCH.
*/
protected_rlc_um_control_primitives(void rlc_um_configure(rlc_um_entity_t *rlcP, frame_t frame, uint32_t timer_reorderingP, uint32_t rx_sn_field_lengthP, uint32_t tx_sn_field_lengthP, uint32_t is_mXchP);)
protected_rlc_um_control_primitives(void rlc_um_configure(
rlc_um_entity_t *const rlcP,
const frame_t frameP,
const uint32_t timer_reorderingP,
const uint32_t rx_sn_field_lengthP,
const uint32_t tx_sn_field_lengthP,
const uint32_t is_mXchP);)
/*! \fn void rlc_um_set_debug_infos(rlc_um_entity_t *rlcP, frame_t frame, uint8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP)
/*! \fn void rlc_um_set_debug_infos(
* rlc_um_entity_t * const rlcP,
* const module_id_t enb_module_idP,
* const module_id_t ue_module_idP,
* const frame_t frameP,
* const eNB_flag_t eNB_flagP,
* const srb_flag_t srb_flagP,
* const rb_id_t rb_idP)
* \brief Set debug informations for a RLC UM protocol instance, these informations are only for trace purpose.
* \param[in] rlcP RLC UM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] frameP Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] enb_module_idP eNB Virtualized module identifier.
* \param[in] ue_module_idP UE Virtualized module identifier.
* \param[in] rb_idP Radio bearer identifier.
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
*/
protected_rlc_um_control_primitives(void rlc_um_set_debug_infos(rlc_um_entity_t *rlcP, frame_t frame, eNB_flag_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP, rb_type_t rb_typeP);)
protected_rlc_um_control_primitives(void rlc_um_set_debug_infos(
rlc_um_entity_t *rlcP,
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP);)
/** @} */
# endif
......@@ -47,7 +47,12 @@ Address : EURECOM,
//#define TRACE_RLC_UM_RX 1
//#define TRACE_DISPLAY_NVIDIA 1
//-----------------------------------------------------------------------------
signed int rlc_um_get_pdu_infos(frame_t frameP,rlc_um_pdu_sn_10_t* header_pP, sdu_ssize_t total_sizeP, rlc_um_pdu_info_t* pdu_info_pP, uint8_t sn_lengthP)
signed int rlc_um_get_pdu_infos(
const frame_t frameP,
rlc_um_pdu_sn_10_t * const header_pP,
const sdu_size_t total_sizeP,
rlc_um_pdu_info_t * const pdu_info_pP,
const uint8_t sn_lengthP)
//-----------------------------------------------------------------------------
{
sdu_size_t sum_li = 0;
......
......@@ -74,7 +74,12 @@ Address : EURECOM,
* \param[in] sn_lengthP Sequence number length in bits in PDU header (5 or 10).
* \return 0 if no error was encountered during the parsing of the PDU, else -1;
*/
protected_rlc_um_dar( signed int rlc_um_get_pdu_infos(frame_t frameP, rlc_um_pdu_sn_10_t* header_pP, int16_t total_sizeP, rlc_um_pdu_info_t* pdu_info_pP, uint8_t sn_lengthP));
protected_rlc_um_dar( signed int rlc_um_get_pdu_infos(
const frame_t frameP,
rlc_um_pdu_sn_10_t * const header_pP,
const sdu_size_t total_sizeP,
rlc_um_pdu_info_t * const pdu_info_pP,
const uint8_t sn_lengthP));
/*! \fn int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_li_pP, unsigned int* li_array_pP, unsigned int *num_li_pP, sdu_size_t *data_size_pP)
* \brief Reset protocol variables and state variables to initial values.
......
......@@ -73,10 +73,10 @@ typedef struct rlc_um_entity_s {
//-----------------------------
// PROTOCOL VARIABLES
//-----------------------------
rlc_usn_t vt_us; /*!< \brief This state variable holds the value of the SN to be assigned for the next newly generated UMD PDU. It is initially set to 0, and is updated whenever the UM RLC entity delivers an UMD PDU with SN = VT(US). */
rlc_usn_t vr_ur; /*!< \brief UM receive state variable. This state variable holds the value of the SN of the earliest UMD PDU that is still considered for reordering. It is initially set to 0. */
rlc_usn_t vr_ux; /*!< \brief UM t-Reordering state variable. This state variable holds the value of the SN following the SN of the UMD PDU which triggered t-Reordering. */
rlc_usn_t vr_uh; /*!< \brief UM highest received state variable. This state variable holds the value of the SN following the SN of the UMD PDU with the highest SN among received UMD PDUs, and it serves as the higher edge of the reordering window. It is initially set to 0. */
rlc_usn_t vt_us; /*!< \brief This state variable holds the value of the SN to be assigned for the next newly generated UMD PDU. It is initially set to 0, and is updated whenever the UM RLC entity delivers an UMD PDU with SN = VT(US). */
rlc_usn_t vr_ur; /*!< \brief UM receive state variable. This state variable holds the value of the SN of the earliest UMD PDU that is still considered for reordering. It is initially set to 0. */
rlc_usn_t vr_ux; /*!< \brief UM t-Reordering state variable. This state variable holds the value of the SN following the SN of the UMD PDU which triggered t-Reordering. */
rlc_usn_t vr_uh; /*!< \brief UM highest received state variable. This state variable holds the value of the SN following the SN of the UMD PDU with the highest SN among received UMD PDUs, and it serves as the higher edge of the reordering window. It is initially set to 0. */
//-----------------------------
// TIMERS
//-----------------------------
......@@ -88,23 +88,22 @@ typedef struct rlc_um_entity_s {
uint8_t rx_sn_length; /*!< \brief Length of sequence number in bits, can be 5 or 10. */
uint8_t tx_header_min_length_in_bytes; /*!< \brief Length of PDU header, can be 1 or 2 bytes. */
uint8_t rx_header_min_length_in_bytes; /*!< \brief Length of PDU header, can be 1 or 2 bytes. */
rlc_sn_t tx_sn_modulo; /*!< \brief Module of the sequence number of PDU, can be RLC_UM_SN_5_BITS_MODULO or RLC_UM_SN_10_BITS_MODULO. */
rlc_sn_t rx_sn_modulo; /*!< \brief Module of the sequence number of PDU, can be RLC_UM_SN_5_BITS_MODULO or RLC_UM_SN_10_BITS_MODULO. */
rlc_sn_t rx_um_window_size;
rlc_sn_t tx_um_window_size;
rlc_sn_t tx_sn_modulo; /*!< \brief Module of the sequence number of PDU, can be RLC_UM_SN_5_BITS_MODULO or RLC_UM_SN_10_BITS_MODULO. */
rlc_sn_t rx_sn_modulo; /*!< \brief Module of the sequence number of PDU, can be RLC_UM_SN_5_BITS_MODULO or RLC_UM_SN_10_BITS_MODULO. */
rlc_sn_t rx_um_window_size;
rlc_sn_t tx_um_window_size;
//-----------------------------
// tranmission
//-----------------------------
// sdu communication;
mem_block_t **input_sdus; /*!< \brief Input SDU buffer (for SDUs coming from upper layers). Should be accessed as an array. */
mem_block_t * input_sdus_alloc; /*!< \brief Allocated memory for the input SDU buffer (for SDUs coming from upper layers). */
mem_block_t **input_sdus; /*!< \brief Input SDU buffer (for SDUs coming from upper layers). Should be accessed as an array. */
uint16_t size_input_sdus_buffer; /*!< \brief Size of the input SDU buffer. */
uint16_t nb_sdu; /*!< \brief Total number of SDUs in input_sdus[] */
uint16_t next_sdu_index; /*!< \brief Next SDU index for a new incomin SDU in input_sdus[]. */
uint16_t current_sdu_index; /*!< \brief Current SDU index in input_sdus array to be segmented. */
rlc_buffer_occupancy_t buffer_occupancy; /*!< \brief Number of bytes contained in input_sdus buffer.*/
uint32_t nb_bytes_requested_by_mac; /*!< \brief Number of bytes requested by lower layer for next transmission. */
list_t pdus_to_mac_layer; /*!< \brief PDUs buffered for transmission to MAC layer. */
list_t pdus_to_mac_layer; /*!< \brief PDUs buffered for transmission to MAC layer. */
//*****************************************************************************
// RECEIVER
//*****************************************************************************
......@@ -112,7 +111,6 @@ typedef struct rlc_um_entity_s {
sdu_size_t output_sdu_size_to_write; /*!< \brief Size of the reassemblied SDU. */
mem_block_t **dar_buffer; /*!< \brief Array of rx PDUs. */
mem_block_t *dar_buffer_alloc; /*!< \brief Allocated memory for the DAR buffer. */
list_t pdus_from_mac_layer; /*!< \brief Not Used. */
logical_chan_id_t channel_id; /*!< \brief Transport channel identifier. */
......
......@@ -171,7 +171,16 @@ rlc_um_send_sdu (rlc_um_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_flagP)
rlc_um_v9_3_0_test_data_ind (rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write, rlc_pP->output_sdu_in_construction);
#else
// msg("[RLC] DATA IND ON MOD_ID %d RB ID %d, size %d\n",rlc_pP->module_id, rlc_pP->rb_id, frameP,rlc_pP->output_sdu_size_to_write);
rlc_data_ind (rlc_pP->enb_module_id, rlc_pP->ue_module_id, frameP, eNB_flagP, rlc_pP->is_mxch, rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write, rlc_pP->output_sdu_in_construction,rlc_pP->is_data_plane);
rlc_data_ind (
rlc_pP->enb_module_id,
rlc_pP->ue_module_id,
frameP,
eNB_flagP,
BOOL_NOT(rlc_pP->is_data_plane),
rlc_pP->is_mxch,
rlc_pP->rb_id,
rlc_pP->output_sdu_size_to_write,
rlc_pP->output_sdu_in_construction);
#endif
rlc_pP->output_sdu_in_construction = NULL;
} else {
......
......@@ -45,14 +45,23 @@ Address : EURECOM,
#include "assertions.h"
extern void pdcp_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, MBMS_flag_t MBMS_flag, rb_id_t rab_idP, sdu_size_t data_sizeP, mem_block_t * sdu_pP, uint8_t is_data_plane);
extern boolean_t pdcp_data_ind(
const module_id_t enb_mod_idP,
const module_id_t ue_mod_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_idP,
const sdu_size_t sdu_buffer_sizeP,
mem_block_t* const sdu_buffer_pP);
#define DEBUG_RLC_PDCP_INTERFACE
#define DEBUG_RLC_DATA_REQ 1
//-----------------------------------------------------------------------------
void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, unsigned long sizeP)
void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, const signed long sizeP)
//-----------------------------------------------------------------------------
{
unsigned long octet_index = 0;
......@@ -94,11 +103,12 @@ void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, uns
//-----------------------------------------------------------------------------
rlc_op_status_t rlc_stat_req (
module_id_t enb_mod_idP,
module_id_t ue_mod_idP,
frame_t frameP,
eNB_flag_t enb_flagP,
rb_id_t rb_idP,
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
unsigned int* stat_tx_pdcp_sdu,
unsigned int* stat_tx_pdcp_bytes,
unsigned int* stat_tx_pdcp_sdu_discarded,
......@@ -127,71 +137,41 @@ rlc_op_status_t rlc_stat_req (
unsigned int* stat_timer_poll_retransmit_timed_out,
unsigned int* stat_timer_status_prohibit_timed_out) {
//-----------------------------------------------------------------------------
rlc_mode_t rlc_mode = RLC_MODE_NONE;
void *rlc_p = NULL;
rlc_mode_t rlc_mode = RLC_MODE_NONE;
rlc_union_t *rlc_union_p = NULL;
hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE;
hashtable_rc_t h_rc;
#ifdef OAI_EMU
if (enb_flagP) {
AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
AssertFatal ((enb_module_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
"eNB module id is too low (%u/%d)!\n",
enb_mod_idP,
enb_module_idP,
oai_emulation.info.first_enb_local);
AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),
AssertFatal ((enb_module_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),
"eNB module id is too high (%u/%d)!\n",
enb_mod_idP,
enb_module_idP,
oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);
AssertFatal (ue_mod_idP < NB_UE_INST,
AssertFatal (ue_module_idP < NB_UE_INST,
"UE module id is too high (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
} else {
AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
AssertFatal (ue_module_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
"UE module id is too high (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local,
AssertFatal (ue_module_idP >= oai_emulation.info.first_ue_local,
"UE module id is too low (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local);
}
#endif
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
if (enb_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
switch (rlc_mode) {
case RLC_MODE_NONE:
AssertFatal (0 , "enB RLC not configured rb id %u module eNB id %u!\n", rb_idP, enb_mod_idP);
break;
case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am;
break;
case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um;
break;
case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm;
break;
default:
AssertFatal (0 , "enB RLC internal memory error rb id %u module eNB id %u!\n", rb_idP, enb_mod_idP);
}
} else {
rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
switch (rlc_mode) {
case RLC_MODE_NONE:
AssertFatal (0 , "UE RLC not configured rb id %u module ue id %u!\n", rb_idP, ue_mod_idP);
break;
case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am;
break;
case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um;
break;
case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm;
break;
default:
AssertFatal (0 , "UE RLC internal memory error rb id %u module ue id %u!\n", rb_idP, ue_mod_idP);
}
key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, enb_flagP, rb_idP, srb_flagP);
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
rlc_mode = rlc_union_p->mode;
}
switch (rlc_mode) {
case RLC_MODE_NONE:
......@@ -226,7 +206,7 @@ rlc_op_status_t rlc_stat_req (
break;
case RLC_MODE_AM:
rlc_am_stat_req((rlc_am_entity_t*)rlc_p,
rlc_am_stat_req(&rlc_union_p->rlc.am,
stat_tx_pdcp_sdu,
stat_tx_pdcp_bytes,
stat_tx_pdcp_sdu_discarded,
......@@ -270,7 +250,7 @@ rlc_op_status_t rlc_stat_req (
*stat_rx_data_bytes_out_of_window = 0;
*stat_timer_poll_retransmit_timed_out = 0;
*stat_timer_status_prohibit_timed_out = 0;
rlc_um_stat_req ((rlc_um_entity_t*)rlc_p,
rlc_um_stat_req (&rlc_union_p->rlc.um,
stat_tx_pdcp_sdu,
stat_tx_pdcp_bytes,
stat_tx_pdcp_sdu_discarded,
......@@ -353,32 +333,35 @@ rlc_op_status_t rlc_stat_req (
return RLC_OP_STATUS_BAD_PARAMETER;
}
}
//-----------------------------------------------------------------------------
rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
module_id_t ue_mod_idP,
frame_t frameP,
eNB_flag_t enb_flagP,
MBMS_flag_t MBMS_flagP,
rb_id_t rb_idP,
mui_t muiP,
rlc_op_status_t rlc_data_req (const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
confirm_t confirmP,
sdu_size_t sdu_sizeP,
mem_block_t *sdu_pP) {
//-----------------------------------------------------------------------------
mem_block_t *new_sdu_p = NULL;
rlc_mode_t rlc_mode = RLC_MODE_NONE;
void *rlc_p = NULL;
rlc_union_t *rlc_union_p = NULL;
hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE;
hashtable_rc_t h_rc;
#ifdef Rel10
rb_id_t mbms_rb_id = 0;
rlc_um_entity_t *rlc_um_p = NULL;
rlc_mbms_id_t *mbms_id_p = NULL;
logical_chan_id_t log_ch_id = 0;
#endif
#ifdef DEBUG_RLC_DATA_REQ
LOG_D(RLC,"rlc_data_req: %s enb id %u ue id %u, rb_id %u (MAX %d), muip %d, confirmP %d, sud_sizeP %d, sdu_pP %p\n",
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
enb_module_idP,
ue_module_idP,
rb_idP,
NB_RAB_MAX,
muiP,
......@@ -392,26 +375,26 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
#endif
#ifdef OAI_EMU
if (enb_flagP) {
AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
AssertFatal ((enb_module_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
"eNB module id is too low (%u/%d)!\n",
enb_mod_idP,
enb_module_idP,
oai_emulation.info.first_enb_local);
AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),
AssertFatal ((enb_module_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),
"eNB module id is too high (%u/%d)!\n",
enb_mod_idP,
enb_module_idP,
oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);
AssertFatal (ue_mod_idP < NB_UE_INST,
AssertFatal (ue_module_idP < NB_UE_INST,
"UE module id is too high (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
} else {
AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
AssertFatal (ue_module_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
"UE module id is too high (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local,
AssertFatal (ue_module_idP >= oai_emulation.info.first_ue_local,
"UE module id is too low (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local);
}
#endif
......@@ -430,75 +413,33 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
#ifdef Rel10
if (MBMS_flagP == TRUE) {
if (enb_flagP) {
log_ch_id = rlc_mbms_enb_get_lcid_by_rb_id(enb_mod_idP,rb_idP);
mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][log_ch_id];
rlc_um_p = &rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um;
LOG_D(RLC,"eNB rlc_um_p : %p RB %u service %u session %u\n",
rlc_um_p,
rb_idP,
mbms_id_p->service_id,
mbms_id_p->session_id
);
log_ch_id = rlc_mbms_enb_get_lcid_by_rb_id(enb_module_idP,rb_idP);
mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_module_idP][log_ch_id];
} else {
log_ch_id = rlc_mbms_ue_get_lcid_by_rb_id(ue_mod_idP,rb_idP);
mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][log_ch_id];
rlc_um_p = &rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um;
LOG_D(RLC,"UE rlc_um_p : %p RB %u service %u session %u\n",
rlc_um_p,
rb_idP,
mbms_id_p->service_id,
mbms_id_p->session_id
);
log_ch_id = rlc_mbms_ue_get_lcid_by_rb_id(ue_module_idP,rb_idP);
mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_module_idP][log_ch_id];
}
key = RLC_COLL_KEY_MBMS_VALUE(enb_module_idP, ue_module_idP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id);
} else
#endif
{
if (enb_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
switch (rlc_mode) {
case RLC_MODE_NONE:
AssertFatal (0 , "enB RLC not configured rb id %u module %u!\n", rb_idP, enb_mod_idP);
break;
case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am;
break;
case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um;
break;
case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm;
break;
default:
AssertFatal (0 , "enB RLC internal memory error rb id %u module %u!\n", rb_idP, enb_mod_idP);
}
} else {
rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
switch (rlc_mode) {
case RLC_MODE_NONE:
AssertFatal (0 , "UE RLC not configured rb id %u module %u!\n", rb_idP, ue_mod_idP);
break;
case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am;
break;
case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um;
break;
case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm;
break;
default:
AssertFatal (0 , "UE RLC internal memory error rb id %u module %u!\n", rb_idP, ue_mod_idP);
}
}
key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, enb_flagP, rb_idP, srb_flagP);
}
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
rlc_mode = rlc_union_p->mode;
} else {
rlc_mode = RLC_MODE_NONE;
AssertFatal (0 , "RLC not configured key %llu\n", key);
}
if (MBMS_flagP == 0) {
LOG_D(RLC, "[FRAME %5u][%s][RLC][INST %u/%u][RB %u] Display of rlc_data_req:\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
enb_module_idP,
ue_module_idP,
rb_idP);
rlc_util_print_hex_octets(RLC, (unsigned char*)sdu_pP->data, sdu_sizeP);
......@@ -510,8 +451,8 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
free_mem_block(sdu_pP);
LOG_E(RLC, "Received RLC_MODE_NONE as rlc_type for %s eNB id %u, ue id %u, rb_id %u\n",
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
enb_module_idP,
ue_module_idP,
rb_idP);
return RLC_OP_STATUS_BAD_PARAMETER;
......@@ -533,31 +474,21 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
free_mem_block(sdu_pP);
LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED);
if (((rlc_am_entity_t*)rlc_p)->is_data_plane) {
LOG_D(RLC, "[FRAME %5u][%s][PDCP][INST %u/%u][RB %u][--- RLC_AM_DATA_REQ/%d Bytes --->][RLC_AM][INST %u/%u][RB %u]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_idP,
sdu_sizeP,
ue_mod_idP,
rb_idP,
rb_idP);
} else {
LOG_D(RLC, "[FRAME %5u][%s][RRC][INST %u/%u][][--- RLC_AM_DATA_REQ/%d Bytes --->][RLC_AM][INST %u/%u][RB %u]\n",
LOG_D(RLC, "[FRAME %5u][%s][%s][INST %u/%u][%s %u][--- RLC_AM_DATA_REQ/%d Bytes --->][RLC_AM][INST %u/%u][%s %u]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
(srb_flagP) ? "RRC" : "PDCP",
enb_module_idP,
ue_module_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
sdu_sizeP,
enb_mod_idP,
ue_mod_idP,
enb_module_idP,
ue_module_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP);
}
LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT);
rlc_am_data_req((rlc_am_entity_t*)rlc_p, frameP, new_sdu_p);
rlc_am_data_req(&rlc_union_p->rlc.am, frameP, new_sdu_p);
return RLC_OP_STATUS_OK;
} else {
return RLC_OP_STATUS_INTERNAL_ERROR;
......@@ -577,31 +508,21 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
free_mem_block(sdu_pP);
LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED);
if (((rlc_am_entity_t*)rlc_p)->is_data_plane) {
LOG_D(RLC, "[FRAME %5u][%s][PDCP][INST %u/%u][RB %u][--- RLC_UM_DATA_REQ/%d Bytes --->][RLC_UM][INST %u/%u][RB %u]\n",
LOG_D(RLC, "[FRAME %5u][%s][%s][INST %u/%u][%s %u][--- RLC_UM_DATA_REQ/%d Bytes --->][RLC_UM][INST %u/%u][%s %u]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
(srb_flagP) ? "RRC" : "PDCP",
enb_module_idP,
ue_module_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
sdu_sizeP,
enb_mod_idP,
ue_mod_idP,
enb_module_idP,
ue_module_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP);
} else {
LOG_D(RLC, "[FRAME %5u][%s][RRC][INST %u/%u][][--- RLC_UM_DATA_REQ/%d Bytes --->][RLC_UM][INST %u/%u][RB %u]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_idP,
sdu_sizeP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
}
LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT);
rlc_um_data_req((rlc_um_entity_t*)rlc_p, frameP, new_sdu_p);
rlc_um_data_req(&rlc_union_p->rlc.um, frameP, new_sdu_p);
//free_mem_block(new_sdu);
return RLC_OP_STATUS_OK;
......@@ -622,31 +543,21 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
((struct rlc_tm_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_tm_data_req_alloc);
free_mem_block(sdu_pP);
LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED);
if (((rlc_tm_entity_t*)rlc_p)->is_data_plane) {
LOG_D(RLC, "[FRAME %5u][%s][PDCP][INST %u/%u][RB %u][--- RLC_TM_DATA_REQ/%d Bytes --->][RLC_TM][INST %u/%u][RB %u]\n",
LOG_D(RLC, "[FRAME %5u][%s][%s][INST %u/%u][%s %u][--- RLC_TM_DATA_REQ/%d Bytes --->][RLC_TM][INST %u/%u][%s %u]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
(srb_flagP) ? "RRC" : "PDCP",
enb_module_idP,
ue_module_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
sdu_sizeP,
enb_mod_idP,
ue_mod_idP,
enb_module_idP,
ue_module_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP);
} else {
LOG_D(RLC, "[FRAME %5u][%s][RRC][INST %u/%u][][--- RLC_TM_DATA_REQ/%d Bytes --->][RLC_TM][INST %u/%u][RB %u]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_idP,
sdu_sizeP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
}
LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT);
rlc_tm_data_req((rlc_tm_entity_t*)rlc_p, new_sdu_p);
rlc_tm_data_req(&rlc_union_p->rlc.tm, new_sdu_p);
return RLC_OP_STATUS_OK;
} else {
//handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : out of memory\n", __FILE__, __LINE__);
......@@ -675,41 +586,19 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
((struct rlc_um_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_um_data_req_alloc);
free_mem_block(sdu_pP);
LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED);
if (rlc_um_p->is_data_plane) {
LOG_D(RLC, "[FRAME %5u][PDCP][INST %u/%u][RB %u][--- RLC_UM_DATA_REQ/%d Bytes (MBMS) --->][RLC_UM][INST %u/%u][RB %u]\n",
LOG_D(RLC, "[FRAME %5u][%s][%s][INST %u/%u][RB %u][--- RLC_UM_DATA_REQ/%d Bytes (MBMS) --->][RLC_UM][INST %u/%u][RB %u]\n",
frameP,
enb_mod_idP,
ue_mod_idP,
(enb_flagP) ? "eNB" : "UE",
(srb_flagP) ? "RRC" : "PDCP",
enb_module_idP,
ue_module_idP,
rb_idP,
sdu_sizeP,
enb_mod_idP,
ue_mod_idP,
enb_module_idP,
ue_module_idP,
rb_idP);
} else {
if (enb_flagP) {
LOG_D(RLC, "[FRAME %5u][RRC_eNB][INST %u/%u][%u][--- RLC_UM_DATA_REQ/%d Bytes (MBMS) --->][RLC_UM][INST %u/%u][RB %u]\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
sdu_sizeP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
} else {
LOG_D(RLC, "[FRAME %5u][RRC_UE][INST %u/%u][%u][--- RLC_UM_DATA_REQ/%d Bytes (MBMS) --->][RLC_UM][INST %u/%u][RB %u]\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
sdu_sizeP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
}
}
LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT);
rlc_um_data_req(rlc_um_p, frameP, new_sdu_p);
rlc_um_data_req(&rlc_union_p->rlc.um, frameP, new_sdu_p);
//free_mem_block(new_sdu);
return RLC_OP_STATUS_OK;
......@@ -734,152 +623,83 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP,
}
//-----------------------------------------------------------------------------
void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, MBMS_flag_t MBMS_flagP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t* sdu_pP, boolean_t is_data_planeP) {
void rlc_data_ind (
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_idP,
const sdu_size_t sdu_sizeP,
mem_block_t *sdu_pP) {
//-----------------------------------------------------------------------------
rlc_mode_t rlc_mode = RLC_MODE_NONE;
#ifdef Rel10
if (MBMS_flagP == TRUE) {
rlc_mode = RLC_MODE_UM;
} else
#endif
{
if (enb_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
} else {
rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
}
}
LOG_D(RLC, "[FRAME %5u][%s][RLC][INST %u/%u][RB %u] Display of rlc_data_ind: size %u\n",
LOG_D(RLC, "[FRAME %5u][%s][RLC][INST %u/%u][%s %u] Display of rlc_data_ind: size %u\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
enb_module_idP,
ue_module_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
sdu_sizeP);
rlc_util_print_hex_octets(RLC, (unsigned char*)sdu_pP->data, sdu_sizeP);
// now demux is done at PDCP
// if ((is_data_planeP)) {
switch (rlc_mode) {
case RLC_MODE_NONE:
break;
case RLC_MODE_AM:
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][INST %u/%u][RB %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_idP,
sdu_sizeP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
break;
case RLC_MODE_UM:
LOG_D(RLC, "[FRAME %5u][%s][RLC_UM][INST %u/%u][RB %u][--- RLC_DATA_IND %s/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_idP,
(MBMS_flagP) ? "(e-MBMS)" : "",
sdu_sizeP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
break;
case RLC_MODE_TM:
LOG_D(RLC, "[FRAME %5u][%s][RLC_TM][INST %u/%u][RB %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_idP,
sdu_sizeP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
break;
}
pdcp_data_ind (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP, is_data_planeP);
LOG_D(RLC, "[FRAME %5u][%s][RLC][INST %u/%u][%s %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][%s %u]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_module_idP,
ue_module_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
sdu_sizeP,
enb_module_idP,
ue_module_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP);
pdcp_data_ind (
enb_module_idP,
ue_module_idP,
frameP,
enb_flagP,
srb_flagP,
MBMS_flagP,
rb_idP,
sdu_sizeP,
sdu_pP);
}
//-----------------------------------------------------------------------------
void rlc_data_conf (module_id_t enb_mod_idP,
module_id_t ue_mod_idP,
frame_t frameP,
eNB_flag_t enb_flagP,
rb_id_t rb_idP,
mui_t muiP,
rlc_tx_status_t statusP,
boolean_t is_data_planeP) {
void rlc_data_conf (const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
const rlc_tx_status_t statusP) {
//-----------------------------------------------------------------------------
rlc_mode_t rlc_mode = RLC_MODE_NONE;
//TO DO (check if we can add MBMS flag in prototype)#ifdef Rel10
// if (MBMS_flagP == TRUE) {
// rlc_mode = RLC_MODE_UM;
// } else
//#endif
#if !defined(Rel10)
{
if (enb_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
} else {
rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
}
}
#endif
if (!(is_data_planeP)) {
if (srb_flagP) {
if (rlc_rrc_data_conf != NULL) {
#if !defined(Rel10)
LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED);
switch (rlc_mode) {
case RLC_MODE_NONE:
break;
case RLC_MODE_AM:
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][INST %u/%u][RB %u][--- RLC_DATA_CONF /MUI %d --->][RRC][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_idP,
muiP,
enb_mod_idP,
ue_mod_idP,
muiP);
break;
case RLC_MODE_UM:
LOG_D(RLC, "[FRAME %5u][%s][RLC_UM][INST %u/%u][RB %u][--- RLC_DATA_CONF /MUI %d --->][RRC][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_idP,
muiP,
enb_mod_idP,
ue_mod_idP,
muiP);
break;
case RLC_MODE_TM:
LOG_D(RLC, "[FRAME %5u][%s][RLC_TM][INST %u/%u][RB %u][--- RLC_DATA_CONF /MUI %d --->][RRC][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_idP,
muiP,
enb_mod_idP,
ue_mod_idP,
muiP);
break;
}
LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][INST %u/%u][%s %u][--- RLC_DATA_CONF /MUI %d --->][%s][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_module_idP,
ue_module_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
muiP,
(srb_flagP) ? "RRC" : "PDCP",
enb_module_idP,
ue_module_idP,
muiP);
LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT);
#endif
rlc_rrc_data_conf (enb_mod_idP , ue_mod_idP, enb_flagP, rb_idP , muiP, statusP);
rlc_rrc_data_conf (enb_module_idP , ue_module_idP, enb_flagP, rb_idP , muiP, statusP);
}
}
}
......@@ -890,28 +710,16 @@ rlc_module_init (void)
//-----------------------------------------------------------------------------
int k;
module_id_t module_id1;
module_id_t module_id2;
rb_id_t rb_id;
#if defined(Rel10)
mbms_session_id_t session_id;
mbms_service_id_t service_id;
#endif
LOG_D(RLC, "MODULE INIT\n");
rlc_rrc_data_ind = NULL;
rlc_rrc_data_conf = NULL;
rlc_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, rb_free_rlc_union);
AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed");
for (module_id1=0; module_id1 < NUMBER_OF_UE_MAX; module_id1++) {
for (k=0; k < RLC_MAX_LC; k++) {
lcid2rbid_ue[module_id1][k] = RLC_RB_UNALLOCATED;
}
#if defined(Rel10)
for (service_id = 0; service_id < maxServiceCount; service_id++) {
for (session_id = 0; session_id < maxSessionPerPMCH; session_id++) {
memset(&rlc_mbms_array_ue[module_id1][service_id][session_id], 0, sizeof(rlc_mbms_t));
}
}
for (k=0; k < RLC_MAX_MBMS_LC; k++) {
rlc_mbms_lcid2service_session_id_ue[module_id1][k].service_id = 0;
rlc_mbms_lcid2service_session_id_ue[module_id1][k].session_id = 0;
......@@ -920,18 +728,10 @@ rlc_module_init (void)
rlc_mbms_rbid2lcid_eNB[module_id1][k] = RLC_LC_UNALLOCATED;
}
#endif
for (rb_id=0; rb_id < NB_RB_MAX; rb_id++) {
memset(&rlc_array_ue[module_id1][rb_id], 0, sizeof(rlc_t));
}
}
for (module_id1=0; module_id1 < NUMBER_OF_eNB_MAX; module_id1++) {
#if defined(Rel10)
for (service_id = 0; service_id < maxServiceCount; service_id++) {
for (session_id = 0; session_id < maxSessionPerPMCH; session_id++) {
memset(&rlc_mbms_array_eNB[module_id1][service_id][session_id], 0, sizeof(rlc_mbms_t));
}
}
for (k=0; k < RLC_MAX_MBMS_LC; k++) {
rlc_mbms_lcid2service_session_id_eNB[module_id1][k].service_id = 0;
rlc_mbms_lcid2service_session_id_eNB[module_id1][k].session_id = 0;
......@@ -940,14 +740,6 @@ rlc_module_init (void)
rlc_mbms_rbid2lcid_ue[module_id1][k] = RLC_LC_UNALLOCATED;
}
#endif
for (module_id2=0; module_id2 < NUMBER_OF_UE_MAX; module_id2++) {
for (rb_id=0; rb_id < NB_RB_MAX; rb_id++) {
memset(&rlc_array_eNB[module_id1][module_id2][rb_id], 0, sizeof(rlc_t));
}
for (k=0; k < RLC_MAX_LC; k++) {
lcid2rbid_eNB[module_id1][module_id2][k] = RLC_RB_UNALLOCATED;
}
}
}
pool_buffer_init();
......@@ -959,6 +751,7 @@ void
rlc_module_cleanup (void)
//-----------------------------------------------------------------------------
{
hashtable_destroy(rlc_coll_p);
}
//-----------------------------------------------------------------------------
void
......
......@@ -47,6 +47,7 @@ Address : EURECOM,
# include "platform_types.h"
# include "platform_constants.h"
# include "hashtable.h"
# include "rlc_am.h"
# include "rlc_um.h"
# include "rlc_tm.h"
......@@ -177,23 +178,52 @@ typedef struct {
#define RLC_MAX_MBMS_LC (maxSessionPerPMCH * maxServiceCount)
#define RLC_MAX_LC ((max_val_DRB_Identity+1)* NUMBER_OF_UE_MAX)
protected_rlc(void (*rlc_rrc_data_ind) (module_id_t, module_id_t, frame_t, eNB_flag_t, rb_id_t , sdu_size_t , uint8_t* );)
protected_rlc(void (*rlc_rrc_data_conf) (module_id_t , module_id_t , eNB_flag_t, rb_id_t , mui_t, rlc_tx_status_t );)
typedef void (rrc_data_ind_cb_t)(module_id_t eNB_inst, module_id_t UE_inst, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, uint8_t* sduP);
typedef void (rrc_data_conf_cb_t)(module_id_t eNB_inst, module_id_t UE_inst, eNB_flag_t eNB_flagP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP);
protected_rlc(void (*rlc_rrc_data_ind)(
const module_id_t eNB_inst,
const module_id_t UE_inst,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const rb_id_t rb_idP,
const sdu_size_t sdu_sizeP,
uint8_t * const sduP);)
protected_rlc(void (*rlc_rrc_data_conf)(
const module_id_t eNB_inst,
const module_id_t UE_inst,
const eNB_flag_t eNB_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
const rlc_tx_status_t statusP);)
typedef void (rrc_data_ind_cb_t)(
const module_id_t eNB_inst,
const module_id_t UE_inst,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const rb_id_t rb_idP,
const sdu_size_t sdu_sizeP,
uint8_t * const sduP);
typedef void (rrc_data_conf_cb_t)(
const module_id_t eNB_inst,
const module_id_t UE_inst,
const eNB_flag_t eNB_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
const rlc_tx_status_t statusP);
/*! \struct rlc_t
* \brief Structure to be instanciated to allocate memory for RLC protocol instances.
*/
typedef struct rlc_t {
typedef struct rlc_union_s {
rlc_mode_t mode;
union {
rlc_am_entity_t am;
rlc_um_entity_t um;
rlc_tm_entity_t tm;
} rlc;
}rlc_t;
}rlc_union_t;
typedef struct rlc_mbms_s {
rb_id_t rb_id;
......@@ -216,8 +246,8 @@ typedef struct rlc_mbms_id_s {
# define maxSessionPerPMCH 1
# endif
#endif
public_rlc(rlc_mbms_t rlc_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_rlc(rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
//public_rlc(rlc_mbms_t rlc_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
//public_rlc(rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[NUMBER_OF_UE_MAX][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[NUMBER_OF_eNB_MAX][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
......@@ -239,17 +269,38 @@ public_rlc(logical_chan_id_t rlc_mbms_rbid2lcid_ue [NUMBER_OF_UE_MAX][NB_RB_M
public_rlc(logical_chan_id_t rlc_mbms_rbid2lcid_eNB[NUMBER_OF_eNB_MAX][NB_RB_MBMS_MAX];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
public_rlc(rb_id_t lcid2rbid_ue [NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
public_rlc(rb_id_t lcid2rbid_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
//public_rlc(rb_id_t lcid2rbid_ue [NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
//public_rlc(rb_id_t lcid2rbid_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
#define RLC_COLL_KEY_VALUE(eNB_iD, uE_iD, iS_eNB, rB_iD, iS_sRB) \
((hash_key_t)eNB_iD | \
(((hash_key_t)(uE_iD)) << 8) | \
(((hash_key_t)(iS_eNB)) << 16) | \
(((hash_key_t)(rB_iD)) << 17) | \
(((hash_key_t)(iS_sRB)) << 25))
// service id max val is maxServiceCount = 16 (asn1_constants.h)
#define RLC_COLL_KEY_MBMS_VALUE(eNB_iD, uE_iD, iS_eNB, sERVICE_ID, sESSION_ID) \
((hash_key_t)eNB_iD | \
(((hash_key_t)(uE_iD)) << 8) | \
(((hash_key_t)(iS_eNB)) << 16) | \
(((hash_key_t)(sERVICE_ID)) << 24) | \
(((hash_key_t)(sESSION_ID)) << 29) | \
(((hash_key_t)(0x0000000000000001)) << 63))
public_rlc(hash_table_t *rlc_coll_p;)
/*! \var rlc_t rlc_array_ue[NUMBER_OF_UE_MAX][NB_RB_MAX]
\brief Global var for RLC layer, allocate memory for RLC UE protocol instances.
*/
public_rlc(rlc_t rlc_array_ue[NUMBER_OF_UE_MAX][NB_RB_MAX];)
//public_rlc(rlc_t rlc_array_ue[NUMBER_OF_UE_MAX][NB_RB_MAX];)
/*! \var rlc_t rlc_array_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][NB_RB_MAX]
\brief Global var for RLC layer, allocate memory for RLC UE protocol instances.
*/
public_rlc(rlc_t rlc_array_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][NB_RB_MAX];)
//public_rlc(rlc_t rlc_array_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][NB_RB_MAX];)
/*! \fn tbs_size_t mac_rlc_serialize_tb (char* bufferP, list_t transport_blocksP)
* \brief Serialize a list of transport blocks coming from RLC in order to be processed by MAC.
......@@ -274,73 +325,121 @@ private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t,
// PUBLIC INTERFACE WITH RRC
//-----------------------------------------------------------------------------
#ifdef Rel10
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, SRB_ToAddMod_t* srb2addmod, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP, PMCH_InfoList_r9_t *pmch_info_listP)
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const SRB_ToAddMod_t* const srb2addmod, const DRB_ToAddModList_t* const drb2add_listP, const DRB_ToReleaseList_t* const drb2release_listP, const PMCH_InfoList_r9_t * const pmch_info_listP)
* \brief Function for RRC to configure a Radio Bearer.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frameP Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] frameP Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] srb2add_listP SRB configuration list to be created.
* \param[in] drb2add_listP DRB configuration list to be created.
* \param[in] drb2release_listP DRB configuration list to be released.
* \param[in] pmch_info_listP eMBMS pmch info list to be created.
* \return A status about the processing, OK or error code.
*/
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t, module_id_t, frame_t, eNB_flag_t, SRB_ToAddModList_t*, DRB_ToAddModList_t*, DRB_ToReleaseList_t*, PMCH_InfoList_r9_t *pmch_info_listP);)
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (
const module_id_t,
const module_id_t,
const frame_t,
const eNB_flag_t,
const SRB_ToAddModList_t* const ,
const DRB_ToAddModList_t* const ,
const DRB_ToReleaseList_t* const ,
const PMCH_InfoList_r9_t * const pmch_info_listP);)
#else
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, SRB_ToAddModList_t* srb2add_listP, DRB_ToAddModList_t* drb2add_listP, DRB_ToReleaseList_t* drb2release_listP)
/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const SRB_ToAddModList_t* const srb2add_listP, const DRB_ToAddModList_t* const drb2add_listP, const DRB_ToReleaseList_t* const drb2release_listP)
* \brief Function for RRC to configure a Radio Bearer.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frameP Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] frameP Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] srb2add_listP SRB configuration list to be created.
* \param[in] drb2add_listP DRB configuration list to be created.
* \param[in] drb2release_listP DRB configuration list to be released.
* \return A status about the processing, OK or error code.
*/
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t, module_id_t, frame_t, eNB_flag_t, SRB_ToAddModList_t*, DRB_ToAddModList_t*, DRB_ToReleaseList_t*);)
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req (
const module_id_t,
const module_id_t,
const frame_t,
const eNB_flag_t,
const SRB_ToAddModList_t* const ,
const DRB_ToAddModList_t* const ,
const DRB_ToReleaseList_t* const );)
#endif
/*! \fn rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP)
/*! \fn void rb_free_rlc_union (void *rlcu_pP)
* \brief Free the rlc memory contained in the RLC embedded in the rlc_union_t
* struct pointed by of the rlcu_pP parameter. Free the rlc_union_t struct also.
* \param[in] rlcu_pP Pointer on the rlc_union_t struct.
*/
public_rlc_rrc(void
rb_free_rlc_union (void *rlcu_pP);)
/*! \fn rlc_op_status_t rrc_rlc_remove_rlc (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP)
* \brief Remove a RLC protocol instance from a radio bearer.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frameP Frame index.
* \param[in] frameP Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0)
* \param[in] MBMS_flag Flag to indicate whether this is an MBMS service (1) or not (0)
* \param[in] rb_idP Radio bearer identifier.
* \return A status about the processing, OK or error code.
*/
private_rlc_rrc(rlc_op_status_t rrc_rlc_remove_rlc (module_id_t , module_id_t , frame_t , eNB_flag_t , rb_id_t );)
private_rlc_rrc(rlc_op_status_t rrc_rlc_remove_rlc (const module_id_t , const module_id_t , const frame_t , const eNB_flag_t , const srb_flag_t, const MBMS_flag_t, const rb_id_t );)
/*! \fn rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, logical_chan_id_t chan_idP, rlc_mode_t rlc_modeP)
/*! \fn rlc_union_t* rrc_rlc_add_rlc (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, logical_chan_id_t chan_idP, rlc_mode_t rlc_modeP)
* \brief Add a RLC protocol instance to a radio bearer.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frameP Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0)
* \param[in] MBMS_flag Flag to indicate whether this is an MBMS service (1) or not (0)
* \param[in] rb_idP Radio bearer identifier.
* \param[in] chan_idP Logical channel identifier.
* \param[in] rlc_modeP Mode of RLC (AM, UM, TM).
* \return A status about the processing, OK or error code.
*/
private_rlc_rrc(rlc_op_status_t rrc_rlc_add_rlc (module_id_t, module_id_t, frame_t, eNB_flag_t, rb_id_t, logical_chan_id_t, rlc_mode_t);)
/*! \fn rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, config_action_t actionP, rb_id_t rb_idP, rb_type_t rb_typeP, rlc_info_t rlc_infoP)
private_rlc_rrc(rlc_union_t* rrc_rlc_add_rlc (const module_id_t, const module_id_t, const frame_t, const eNB_flag_t, const srb_flag_t, const MBMS_flag_t MBMS_flagP, const rb_id_t, logical_chan_id_t, rlc_mode_t);)
/*! \fn rlc_op_status_t rrc_rlc_config_req (
const module_id_t enb_mod_idP,
const module_id_t ue_mod_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
config_action_t actionP,
const rb_id_t rb_idP,
rlc_info_t rlc_infoP)
* \brief Function for RRC to configure a Radio Bearer.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frameP Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] frameP Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0)
* \param[in] MBMS_flag Flag to indicate whether this is an MBMS service (1) or not (0)
* \param[in] actionP Action for this radio bearer (add, modify, remove).
* \param[in] rb_idP Radio bearer identifier.
* \param[in] rb_typeP Type of radio bearer (signalling, data).
* \param[in] rlc_infoP RLC configuration parameters issued from Radio Resource Manager.
* \return A status about the processing, OK or error code.
*/
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_req (module_id_t, module_id_t, frame_t, eNB_flag_t , config_action_t, rb_id_t, rb_type_t, rlc_info_t );)
/*! \fn rlc_op_status_t rrc_rlc_data_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, MBMS_flag_t MBMS_flagP, rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, char* sduP)
public_rlc_rrc( rlc_op_status_t rrc_rlc_config_req (
const module_id_t,
const module_id_t,
const frame_t,
const eNB_flag_t ,
const srb_flag_t,
const MBMS_flag_t,
config_action_t,
const rb_id_t,
rlc_info_t );)
/*! \fn rlc_op_status_t rrc_rlc_data_req (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, char* sduP)
* \brief Function for RRC to send a SDU through a Signalling Radio Bearer.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
......@@ -354,9 +453,9 @@ public_rlc_rrc( rlc_op_status_t rrc_rlc_config_req (module_id_t, module_id_t,
* \param[in] sduP SDU.
* \return A status about the processing, OK or error code.
*/
public_rlc_rrc( rlc_op_status_t rrc_rlc_data_req (module_id_t, module_id_t, frame_t, eNB_flag_t, MBMS_flag_t, rb_id_t, mui_t, confirm_t, sdu_size_t, char *);)
public_rlc_rrc( rlc_op_status_t rrc_rlc_data_req (const module_id_t, const module_id_t, const frame_t, const eNB_flag_t, const MBMS_flag_t, const rb_id_t, mui_t, confirm_t, sdu_size_t, char *);)
/*! \fn void rrc_rlc_register_rrc ( void (*rrc_data_indP) (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, char* sduP), void (*rrc_data_confP) (module_id_t enb_mod_idP, module_id_t ue_mod_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP)
/*! \fn void rrc_rlc_register_rrc ( void (*rrc_data_indP) (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, char* sduP), void (*rrc_data_confP) (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP)
* \brief This function is called by RRC to register its DATA-INDICATE and DATA-CONFIRM handlers to RLC layer.
* \param[in] rrc_data_indP Pointer on RRC data indicate function.
* \param[in] rrc_data_confP Pointer on RRC data confirm callback function.
......@@ -366,7 +465,7 @@ public_rlc_rrc(void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_d
//-----------------------------------------------------------------------------
// PUBLIC INTERFACE WITH MAC
//-----------------------------------------------------------------------------
/*! \fn tbs_size_t mac_rlc_data_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, MBMS_flag_t MBMS_flagP, logical_chan_id_t rb_idP, char* bufferP)
/*! \fn tbs_size_t mac_rlc_data_req (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const MBMS_flag_t MBMS_flagP, logical_chan_id_t rb_idP, char* bufferP)
* \brief Interface with MAC layer, map data request to the RLC corresponding to the radio bearer.
* \param [in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param [in] ue_mod_idP Virtualized ue module identifier.
......@@ -377,9 +476,9 @@ public_rlc_rrc(void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_d
* \param [in,out] bufferP Memory area to fill with the bytes requested by MAC.
* \return A status about the processing, OK or error code.
*/
public_rlc_mac(tbs_size_t mac_rlc_data_req (module_id_t, module_id_t, frame_t, eNB_flag_t, MBMS_flag_t, logical_chan_id_t, char*);)
public_rlc_mac(tbs_size_t mac_rlc_data_req (const module_id_t, const module_id_t, const frame_t, const eNB_flag_t, const MBMS_flag_t, logical_chan_id_t, char*);)
/*! \fn void mac_rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, MBMS_flag_t MBMS_flagP, logical_chan_id_t rb_idP, uint32_t frameP, char* bufferP, tb_size_t tb_sizeP, num_tb_t num_tbP, crc_t *crcs)
/*! \fn void mac_rlc_data_ind (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const MBMS_flag_t MBMS_flagP, logical_chan_id_t rb_idP, uint32_t frameP, char* bufferP, tb_size_t tb_sizeP, num_tb_t num_tbP, crc_t *crcs)
* \brief Interface with MAC layer, deserialize the transport blocks sent by MAC, then map data indication to the RLC instance corresponding to the radio bearer identifier.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
......@@ -393,9 +492,9 @@ public_rlc_mac(tbs_size_t mac_rlc_data_req (module_id_t, module_i
* \param[in] num_tbP Number of transport blocks.
* \param[in] crcs Array of CRC decoding.
*/
public_rlc_mac(void mac_rlc_data_ind (module_id_t, module_id_t, frame_t, eNB_flag_t, MBMS_flag_t, logical_chan_id_t, char*, tb_size_t, num_tb_t, crc_t* );)
public_rlc_mac(void mac_rlc_data_ind (const module_id_t, const module_id_t, const frame_t, const eNB_flag_t, const MBMS_flag_t, logical_chan_id_t, char*, tb_size_t, num_tb_t, crc_t* );)
/*! \fn mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, MBMS_flag_t MBMS_flagP, logical_chan_id_t rb_idP, tb_size_t tb_sizeP)
/*! \fn mac_rlc_status_resp_t mac_rlc_status_ind (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const MBMS_flag_t MBMS_flagP, logical_chan_id_t rb_idP, tb_size_t tb_sizeP)
* \brief Interface with MAC layer, request and set the number of bytes scheduled for transmission by the RLC instance corresponding to the radio bearer identifier.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
......@@ -406,7 +505,7 @@ public_rlc_mac(void mac_rlc_data_ind (module_id_t, module_i
* \param[in] tb_sizeP Size of a transport block set in bytes.
* \return The maximum number of bytes that the RLC instance can send in the next transmission sequence.
*/
public_rlc_mac(mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t, module_id_t, frame_t, eNB_flag_t, MBMS_flag_t, logical_chan_id_t, tb_size_t );)
public_rlc_mac(mac_rlc_status_resp_t mac_rlc_status_ind (const module_id_t, const module_id_t, const frame_t, const eNB_flag_t, const MBMS_flag_t, logical_chan_id_t, tb_size_t );)
//-----------------------------------------------------------------------------
// RLC methods
//-----------------------------------------------------------------------------
......@@ -417,16 +516,20 @@ public_rlc_mac(mac_rlc_status_resp_t mac_rlc_status_ind (module_id_t, module_i
* @param dataP Pointer to data buffer to be displayed
* @param sizeP Number of octets in data buffer
*/
public_rlc(void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, unsigned long sizeP);)
public_rlc(void rlc_util_print_hex_octets(
const comp_name_t componentP,
unsigned char* const dataP,
const signed long sizeP);)
/*! \fn rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, MBMS_flag_t MBMS_flagP, rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sduP)
/*! \fn rlc_op_status_t rlc_data_req (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sduP)
* \brief Interface with higher layers, map request to the RLC corresponding to the radio bearer.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frameP Frame index.
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0)
* \param[in] MBMS_flagP Flag to indicate whether this is the MBMS service (1) or not (0)
* \param[in] rb_idP Radio bearer identifier.
* \param[in] muiP Message Unit identifier.
......@@ -435,43 +538,72 @@ public_rlc(void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char*
* \param[in] sduP SDU.
* \return A status about the processing, OK or error code.
*/
public_rlc(rlc_op_status_t rlc_data_req (module_id_t , module_id_t , frame_t , eNB_flag_t , MBMS_flag_t , rb_id_t , mui_t , confirm_t , sdu_size_t , mem_block_t *);)
/*! \fn void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, MBMS_flag_t MBMS_flagP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t* sduP, boolean_t is_data_planeP) {
public_rlc(rlc_op_status_t rlc_data_req (
const module_id_t ,
const module_id_t ,
const frame_t ,
const eNB_flag_t ,
const srb_flag_t,
const MBMS_flag_t ,
const rb_id_t ,
const mui_t ,
const confirm_t ,
const sdu_size_t ,
mem_block_t * const);)
/*! \fn void rlc_data_ind (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, mem_block_t* sduP) {
* \brief Interface with higher layers, route SDUs coming from RLC protocol instances to upper layer instance.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frameP Frame index
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0)
* \param[in] MBMS_flagP Flag to indicate whether this is the MBMS service (1) or not (0)
* \param[in] rb_idP Radio bearer identifier.
* \param[in] sdu_sizeP Size of SDU in bytes.
* \param[in] sduP SDU.
* \param[in] is_data_planeP Boolean, is data radio bearer or not.
*/
public_rlc(void rlc_data_ind (module_id_t , module_id_t , frame_t , eNB_flag_t , MBMS_flag_t , rb_id_t, sdu_size_t, mem_block_t*, boolean_t);)
/*! \fn void rlc_data_conf (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP, boolean_t is_data_planeP)
public_rlc(void rlc_data_ind(
const module_id_t ,
const module_id_t ,
const frame_t ,
const eNB_flag_t ,
const srb_flag_t,
const MBMS_flag_t ,
const rb_id_t,
const sdu_size_t,
mem_block_t* const);)
/*! \fn void rlc_data_conf (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const mui_t muiP, const rlc_tx_status_t statusP)
* \brief Interface with higher layers, confirm to upper layer the transmission status for a SDU stamped with a MUI, scheduled for transmission.
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frameP Frame index
* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0)
* \param[in] rb_idP Radio bearer identifier.
* \param[in] muiP Message Unit identifier.
* \param[in] statusP Status of the transmission (RLC_SDU_CONFIRM_YES, RLC_SDU_CONFIRM_NO).
* \param[in] is_data_planeP Boolean, is data radio bearer or not.
*/
public_rlc(void rlc_data_conf (module_id_t, module_id_t, frame_t, eNB_flag_t , rb_id_t, mui_t, rlc_tx_status_t, boolean_t );)
public_rlc(void rlc_data_conf(
const module_id_t,
const module_id_t,
const frame_t,
const eNB_flag_t ,
const srb_flag_t,
const rb_id_t,
const mui_t,
const rlc_tx_status_t );)
/*! \fn rlc_op_status_t rlc_stat_req (
module_id_t enb_mod_idP,
module_id_t ue_mod_idP,
frame_t frameP,
eNB_flag_t eNB_flagP,
rb_id_t rb_idP,
const module_id_t enb_mod_idP,
const module_id_t ue_mod_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
unsigned int* stat_tx_pdcp_sdu,
unsigned int* stat_tx_pdcp_bytes,
unsigned int* stat_tx_pdcp_sdu_discarded,
......@@ -504,7 +636,8 @@ public_rlc(void rlc_data_conf (module_id_t, module_id_t, frame_t,
* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in] ue_mod_idP Virtualized ue module identifier.
* \param[in] frameP
* \param[in] eNB_flagP
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
* \param[in] rb_idP .
* \param[out] stat_tx_pdcp_sdu Number of SDUs coming from upper layers.
* \param[out] stat_tx_pdcp_bytes Number of bytes coming from upper layers.
......@@ -536,38 +669,39 @@ public_rlc(void rlc_data_conf (module_id_t, module_id_t, frame_t,
*/
public_rlc(rlc_op_status_t rlc_stat_req (
module_id_t enb_mod_idP,
module_id_t ue_mod_idP,
frame_t frameP,
eNB_flag_t eNB_flagP,
rb_id_t rb_idP,
unsigned int* stat_tx_pdcp_sdu,
unsigned int* stat_tx_pdcp_bytes,
unsigned int* stat_tx_pdcp_sdu_discarded,
unsigned int* stat_tx_pdcp_bytes_discarded,
unsigned int* stat_tx_data_pdu,
unsigned int* stat_tx_data_bytes,
unsigned int* stat_tx_retransmit_pdu_by_status,
unsigned int* stat_tx_retransmit_bytes_by_status,
unsigned int* stat_tx_retransmit_pdu,
unsigned int* stat_tx_retransmit_bytes,
unsigned int* stat_tx_control_pdu,
unsigned int* stat_tx_control_bytes,
unsigned int* stat_rx_pdcp_sdu,
unsigned int* stat_rx_pdcp_bytes,
unsigned int* stat_rx_data_pdus_duplicate,
unsigned int* stat_rx_data_bytes_duplicate,
unsigned int* stat_rx_data_pdu,
unsigned int* stat_rx_data_bytes,
unsigned int* stat_rx_data_pdu_dropped,
unsigned int* stat_rx_data_bytes_dropped,
unsigned int* stat_rx_data_pdu_out_of_window,
unsigned int* stat_rx_data_bytes_out_of_window,
unsigned int* stat_rx_control_pdu,
unsigned int* stat_rx_control_bytes,
unsigned int* stat_timer_reordering_timed_out,
unsigned int* stat_timer_poll_retransmit_timed_out,
unsigned int* stat_timer_status_prohibit_timed_out);)
const module_id_t enb_mod_idP,
const module_id_t ue_mod_idP,
const frame_t frameP,
const eNB_flag_t eNB_flagP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
unsigned int* const stat_tx_pdcp_sdu,
unsigned int* const stat_tx_pdcp_bytes,
unsigned int* const stat_tx_pdcp_sdu_discarded,
unsigned int* const stat_tx_pdcp_bytes_discarded,
unsigned int* const stat_tx_data_pdu,
unsigned int* const stat_tx_data_bytes,
unsigned int* const stat_tx_retransmit_pdu_by_status,
unsigned int* const stat_tx_retransmit_bytes_by_status,
unsigned int* const stat_tx_retransmit_pdu,
unsigned int* const stat_tx_retransmit_bytes,
unsigned int* const stat_tx_control_pdu,
unsigned int* const stat_tx_control_bytes,
unsigned int* const stat_rx_pdcp_sdu,
unsigned int* const stat_rx_pdcp_bytes,
unsigned int* const stat_rx_data_pdus_duplicate,
unsigned int* const stat_rx_data_bytes_duplicate,
unsigned int* const stat_rx_data_pdu,
unsigned int* const stat_rx_data_bytes,
unsigned int* const stat_rx_data_pdu_dropped,
unsigned int* const stat_rx_data_bytes_dropped,
unsigned int* const stat_rx_data_pdu_out_of_window,
unsigned int* const stat_rx_data_bytes_out_of_window,
unsigned int* const stat_rx_control_pdu,
unsigned int* const stat_rx_control_bytes,
unsigned int* const stat_timer_reordering_timed_out,
unsigned int* const stat_timer_poll_retransmit_timed_out,
unsigned int* const stat_timer_status_prohibit_timed_out);)
/*! \fn int rlc_module_init(void)
* \brief RAZ the memory of the RLC layer, initialize the memory pool manager (mem_block_t structures mainly used in RLC module).
......
......@@ -43,6 +43,7 @@ Address : EURECOM,
#include "LAYER2/MAC/extern.h"
#include "UTIL/LOG/log.h"
#include "UTIL/OCG/OCG_vars.h"
#include "hashtable.h"
#include "assertions.h"
#define DEBUG_MAC_INTERFACE 1
......@@ -50,7 +51,7 @@ Address : EURECOM,
//-----------------------------------------------------------------------------
struct mac_data_ind mac_rlc_deserialize_tb (
char *buffer_pP,
tb_size_t tb_sizeP,
const tb_size_t tb_sizeP,
num_tb_t num_tbP,
crc_t *crcs_pP) {
//-----------------------------------------------------------------------------
......@@ -116,23 +117,27 @@ tbs_size_t mac_rlc_serialize_tb (char* buffer_pP, list_t transport_blocksP) {
}
//-----------------------------------------------------------------------------
tbs_size_t mac_rlc_data_req(
module_id_t enb_mod_idP,
module_id_t ue_mod_idP,
frame_t frameP,
eNB_flag_t enb_flagP,
MBMS_flag_t MBMS_flagP,
logical_chan_id_t channel_idP,
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
char *buffer_pP) {
//-----------------------------------------------------------------------------
struct mac_data_req data_request;
rb_id_t rb_id = 0;
rlc_mode_t rlc_mode = RLC_MODE_NONE;
void *rlc_p = NULL;
rlc_mbms_id_t *mbms_id_p = NULL;
rlc_union_t *rlc_union_p = NULL;
hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE;
hashtable_rc_t h_rc;
srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO;
#ifdef DEBUG_MAC_INTERFACE
LOG_D(RLC, "\n[RLC] Inst %s enb id %d ue id %d: MAC_RLC_DATA_REQ channel %d (%d) MAX RB %d, Num_tb %d\n",
(enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, channel_idP, RLC_MAX_LC, NB_RB_MAX);
(enb_flagP) ? "eNB" : "UE", enb_module_idP, ue_module_idP, channel_idP, RLC_MAX_LC, NB_RB_MAX);
#endif // DEBUG_MAC_INTERFACE
if (MBMS_flagP)
......@@ -141,82 +146,54 @@ tbs_size_t mac_rlc_data_req(
AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX);
#if defined(USER_MODE) && defined(OAI_EMU)
if (enb_flagP) {
AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
AssertFatal ((enb_module_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
"eNB module id is too low (%u/%d)!\n",
enb_mod_idP,
enb_module_idP,
oai_emulation.info.first_enb_local);
AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),
AssertFatal ((enb_module_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),
"eNB module id is too high (%u/%d)!\n",
enb_mod_idP,
enb_module_idP,
oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);
AssertFatal (ue_mod_idP < NB_UE_INST,
AssertFatal (ue_module_idP < NB_UE_INST,
"UE module id is too high (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
} else {
AssertFatal (MBMS_flagP == MBMS_FLAG_NO ," MBMS FLAG SHOULD NOT BE SET IN mac_rlc_data_req in UE\n");
AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
AssertFatal (ue_module_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
"UE module id is too high (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local,
AssertFatal (ue_module_idP >= oai_emulation.info.first_ue_local,
"UE module id is too low (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local);
}
#endif
if (enb_flagP) {
if (MBMS_flagP) {
mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][channel_idP];
rb_id = rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].rb_id;
rlc_p = (void*)&rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um;
rlc_mode = RLC_MODE_UM;
AssertFatal (rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um.allocation == TRUE ,
"enB MBMS RLC UM not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
if (MBMS_flagP) {
if (enb_flagP) {
mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_module_idP][channel_idP];
key = RLC_COLL_KEY_MBMS_VALUE(enb_module_idP, ue_module_idP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id);
} else {
rb_id = lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][channel_idP];
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode;
switch (rlc_mode) {
case RLC_MODE_NONE:
//AssertFatal (0 , "enB RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
AssertError (0 , 0, "enB RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
return (tbs_size_t)0;
break;
case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.am;
break;
case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.um;
break;
case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.tm;
break;
default:
AssertFatal (0 , "enB RLC internal memory error rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
}
return (tbs_size_t)0;
}
} else {
rb_id = lcid2rbid_ue[ue_mod_idP][channel_idP];
rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode;
switch (rlc_mode) {
case RLC_MODE_NONE:
AssertFatal (0 , "UE RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP);
return (tbs_size_t)0;
break;
case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.am;
break;
case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.um;
break;
case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.tm;
break;
default:
AssertFatal (0 , "UE RLC internal memory error rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP);
if (channel_idP > 2) {
rb_id = channel_idP - 2;
} else {
rb_id = channel_idP;
}
key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, enb_flagP, rb_id, srb_flag);
}
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
rlc_mode = rlc_union_p->mode;
} else {
rlc_mode = RLC_MODE_NONE;
AssertFatal (0 , "RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_module_idP);
}
switch (rlc_mode) {
......@@ -224,48 +201,51 @@ tbs_size_t mac_rlc_data_req(
break;
case RLC_MODE_AM:
data_request = rlc_am_mac_data_request((rlc_am_entity_t*)rlc_p, frameP);
data_request = rlc_am_mac_data_request(&rlc_union_p->rlc.am, frameP);
return mac_rlc_serialize_tb(buffer_pP, data_request.data);
break;
case RLC_MODE_UM:
data_request = rlc_um_mac_data_request((rlc_um_entity_t*)rlc_p, frameP);
data_request = rlc_um_mac_data_request(&rlc_union_p->rlc.um, frameP);
return mac_rlc_serialize_tb(buffer_pP, data_request.data);
break;
case RLC_MODE_TM:
data_request = rlc_tm_mac_data_request((rlc_tm_entity_t*)rlc_p, frameP);
data_request = rlc_tm_mac_data_request(&rlc_union_p->rlc.tm, frameP);
return mac_rlc_serialize_tb(buffer_pP, data_request.data);
break;
default:;
}
return (tbs_size_t)0;
}
//-----------------------------------------------------------------------------
void mac_rlc_data_ind (
module_id_t enb_mod_idP,
module_id_t ue_mod_idP,
frame_t frameP,
eNB_flag_t enb_flagP,
MBMS_flag_t MBMS_flagP,
logical_chan_id_t channel_idP,
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
char *buffer_pP,
tb_size_t tb_sizeP,
const tb_size_t tb_sizeP,
num_tb_t num_tbP,
crc_t *crcs_pP) {
//-----------------------------------------------------------------------------
rb_id_t rb_id = 0;
rlc_mode_t rlc_mode = RLC_MODE_NONE;
void *rlc_p = NULL;
rlc_mbms_id_t *mbms_id_p = NULL;
rlc_union_t *rlc_union_p = NULL;
hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE;
hashtable_rc_t h_rc;
srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO;
#ifdef DEBUG_MAC_INTERFACE
if (num_tbP) {
LOG_D(RLC, "[Frame %5u][%s][RLC][MOD %u/%u] MAC_RLC_DATA_IND on channel %d (%d), rb max %d, Num_tb %d\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
enb_module_idP,
ue_module_idP,
channel_idP,
RLC_MAX_LC,
NB_RB_MAX,
......@@ -281,81 +261,52 @@ void mac_rlc_data_ind (
channel_idP, NB_RB_MAX);
if (enb_flagP) {
AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
AssertFatal ((enb_module_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
"eNB module id is too low (%u/%d)!\n",
enb_mod_idP,
enb_module_idP,
oai_emulation.info.first_enb_local);
AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),
AssertFatal ((enb_module_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),
"eNB module id is too high (%u/%d)!\n",
enb_mod_idP,
enb_module_idP,
oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);
AssertFatal (ue_mod_idP < NB_UE_INST,
AssertFatal (ue_module_idP < NB_UE_INST,
"UE module id is too high (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
AssertFatal (MBMS_flagP == MBMS_FLAG_NO ," MBMS FLAG SHOULD NOT BE SET IN mac_rlc_data_ind in eNB\n");
} else {
AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
AssertFatal (ue_module_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
"UE module id is too high (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local,
AssertFatal (ue_module_idP >= oai_emulation.info.first_ue_local,
"UE module id is too low (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local);
}
#endif
if (enb_flagP) {
rb_id = lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][channel_idP];
AssertFatal (rb_id < NB_RB_MAX, "enB RB id is too high (%u/%d) lcid %u enb module %u ue module id %u!\n", rb_id, NB_RB_MAX, channel_idP, enb_mod_idP, ue_mod_idP);
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode;
switch (rlc_mode) {
case RLC_MODE_NONE:
//AssertFatal (0 , "enB RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
AssertError (0 , 0, "enB RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
break;
case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.am;
break;
case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.um;
break;
case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.tm;
break;
default:
AssertFatal (0 , "enB RLC internal memory error rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
if (MBMS_flagP) {
if (BOOL_NOT(enb_flagP)) {
mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[enb_module_idP][channel_idP];
key = RLC_COLL_KEY_MBMS_VALUE(enb_module_idP, ue_module_idP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id);
} else {
return;
}
} else {
if (MBMS_flagP) {
mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][channel_idP];
rb_id = rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].rb_id;
rlc_p = (void*)&rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um;
rlc_mode = RLC_MODE_UM;
AssertFatal (rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um.allocation == TRUE ,
"UE MBMS RLC UM not configured rb id %u lcid %u service_id %u session_id %u module %u!\n",
rb_id, channel_idP,mbms_id_p->service_id, mbms_id_p->session_id, ue_mod_idP);
if (channel_idP > 2) {
rb_id = channel_idP - 2;
} else {
rb_id = lcid2rbid_ue[ue_mod_idP][channel_idP];
AssertFatal (rb_id < NB_RB_MAX, "UE RB id is too high (%u/%d) lcid %u enb module %u ue module id %u!\n", rb_id, NB_RB_MAX, channel_idP, enb_mod_idP, ue_mod_idP);
rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode;
switch (rlc_mode) {
case RLC_MODE_NONE:
AssertFatal (0 , "UE RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP);
break;
case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.am;
break;
case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.um;
break;
case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.tm;
break;
default:
AssertFatal (0 , "UE RLC internal memory error rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP);
}
rb_id = channel_idP;
}
key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, enb_flagP, rb_id, srb_flag);
}
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
rlc_mode = rlc_union_p->mode;
} else {
rlc_mode = RLC_MODE_NONE;
AssertFatal (0 , "%s RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP);
}
struct mac_data_ind data_ind = mac_rlc_deserialize_tb(buffer_pP, tb_sizeP, num_tbP, crcs_pP);
switch (rlc_mode) {
......@@ -365,43 +316,46 @@ void mac_rlc_data_ind (
case RLC_MODE_AM:
#ifdef DEBUG_MAC_INTERFACE
LOG_D(RLC, "MAC DATA IND TO RLC_AM MOD_ID %s enb id %u ue id %u \n", (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP);
LOG_D(RLC, "MAC DATA IND TO RLC_AM MOD_ID %s enb id %u ue id %u \n", (enb_flagP) ? "eNB" : "UE", enb_module_idP, ue_module_idP);
#endif
rlc_am_mac_data_indication((rlc_am_entity_t*)rlc_p, frameP, enb_flagP, data_ind);
rlc_am_mac_data_indication(&rlc_union_p->rlc.am, frameP, enb_flagP, data_ind);
break;
case RLC_MODE_UM:
#ifdef DEBUG_MAC_INTERFACE
LOG_D(RLC, "MAC DATA IND TO RLC_UM MOD_ID %s enb id %u ue id %u \n", (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP);
LOG_D(RLC, "MAC DATA IND TO RLC_UM MOD_ID %s enb id %u ue id %u \n", (enb_flagP) ? "eNB" : "UE", enb_module_idP, ue_module_idP);
#endif
rlc_um_mac_data_indication((rlc_um_entity_t*)rlc_p, frameP, enb_flagP, data_ind);
rlc_um_mac_data_indication(&rlc_union_p->rlc.um, frameP, enb_flagP, data_ind);
break;
case RLC_MODE_TM:
#ifdef DEBUG_MAC_INTERFACE
LOG_D(RLC, "MAC DATA IND TO RLC_TM MOD_ID %s enb id %u ue id %u \n", (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP);
LOG_D(RLC, "MAC DATA IND TO RLC_TM MOD_ID %s enb id %u ue id %u \n", (enb_flagP) ? "eNB" : "UE", enb_module_idP, ue_module_idP);
#endif
rlc_tm_mac_data_indication((rlc_tm_entity_t*)rlc_p, frameP, enb_flagP, data_ind);
rlc_tm_mac_data_indication(&rlc_union_p->rlc.tm, frameP, enb_flagP, data_ind);
break;
}
}
//-----------------------------------------------------------------------------
mac_rlc_status_resp_t mac_rlc_status_ind(
module_id_t enb_mod_idP,
module_id_t ue_mod_idP,
frame_t frameP,
eNB_flag_t enb_flagP,
MBMS_flag_t MBMS_flagP,
logical_chan_id_t channel_idP,
tb_size_t tb_sizeP) {
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
const tb_size_t tb_sizeP) {
//-----------------------------------------------------------------------------
mac_rlc_status_resp_t mac_rlc_status_resp;
struct mac_status_ind tx_status;
struct mac_status_resp status_resp;
rb_id_t rb_id = 0;
rlc_mode_t rlc_mode = RLC_MODE_NONE;
void *rlc_p = NULL;
rlc_mbms_id_t *mbms_id_p = NULL;
rb_id_t rb_id = 0;
rlc_mode_t rlc_mode = RLC_MODE_NONE;
rlc_mbms_id_t *mbms_id_p = NULL;
rlc_union_t *rlc_union_p = NULL;
hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE;
hashtable_rc_t h_rc;
srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO;
memset (&mac_rlc_status_resp, 0, sizeof(mac_rlc_status_resp_t));
memset (&tx_status , 0, sizeof(struct mac_status_ind));
......@@ -413,157 +367,99 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
(enb_flagP) ? "eNB" : "UE",
channel_idP,
RLC_MAX_MBMS_LC,
enb_mod_idP,
ue_mod_idP);
enb_module_idP,
ue_module_idP);
else
AssertFatal (channel_idP < NB_RB_MAX,
"%s channel id is too high (%u/%d) enb module id %u ue module id %u!\n",
(enb_flagP) ? "eNB" : "UE",
channel_idP,
NB_RB_MAX,
enb_mod_idP,
ue_mod_idP);
enb_module_idP,
ue_module_idP);
if (enb_flagP) {
AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
AssertFatal ((enb_module_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
"eNB module id is too low (%u/%d)!\n",
enb_mod_idP,
enb_module_idP,
oai_emulation.info.first_enb_local);
AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),
AssertFatal ((enb_module_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),
"eNB module id is too high (%u/%d)!\n",
enb_mod_idP,
enb_module_idP,
oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);
AssertFatal (ue_mod_idP < NB_UE_INST,
AssertFatal (ue_module_idP < NB_UE_INST,
"UE module id is too high (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
} else {
AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
AssertFatal (ue_module_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
"UE module id is too high (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local,
AssertFatal (ue_module_idP >= oai_emulation.info.first_ue_local,
"UE module id is too low (%u/%d)!\n",
ue_mod_idP,
ue_module_idP,
oai_emulation.info.first_ue_local);
}
#endif
if (enb_flagP) {
if (MBMS_flagP) {
mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][channel_idP];
rb_id = rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].rb_id;
rlc_p = (void*)&rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um;
rlc_mode = RLC_MODE_UM;
if (rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um.allocation == FALSE) {
return mac_rlc_status_resp;
}
//AssertFatal (rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um.allocation == TRUE ,
// "enB MBMS RLC UM not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP);
} else {
rb_id = lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][channel_idP];
if (rb_id >= NB_RB_MAX) {
/*LOG_D(RLC, "[FRAME %05d][%s][RLC][MOD %u/%u] MAC STATUS IND TO NOT CONFIGURED BEARER lc id %u \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
channel_idP);*/
return mac_rlc_status_resp;
}
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode;
switch (rlc_mode) {
case RLC_MODE_NONE:
//LOG_E (RLC, "enB RLC not configured rb id %u lcid %u enb id %u ue id %u!\n", rb_id, channel_idP, enb_mod_idP, ue_mod_idP);
return mac_rlc_status_resp;
break;
case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.am;
break;
case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.um;
break;
case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].rlc.tm;
break;
default:
AssertFatal (0 , "enB RLC internal memory error rb id %u lcid %u enb id %u ue id %u!\n", rb_id, channel_idP, enb_mod_idP, ue_mod_idP);
}
}
} else {
if (MBMS_flagP) {
mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][channel_idP];
rb_id = rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].rb_id;
rlc_p = (void*)&rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um;
rlc_mode = RLC_MODE_UM;
AssertFatal (rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um.allocation == TRUE ,
"UE MBMS RLC UM not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP);
} else {
rb_id = lcid2rbid_ue[ue_mod_idP][channel_idP];
if (rb_id >= NB_RB_MAX) {
/*LOG_D(RLC, "[FRAME %05d][%s][RLC][MOD %u/%u] MAC STATUS IND TO NOT CONFIGURED BEARER lc id %u \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
channel_idP);*/
return mac_rlc_status_resp;
}
rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode;
switch (rlc_mode) {
case RLC_MODE_NONE:
AssertFatal (0 , "UE RLC not configured rb id %u lcid %u enb id %u ue id %u!\n", rb_id, channel_idP, enb_mod_idP, ue_mod_idP);
return mac_rlc_status_resp;
break;
case RLC_MODE_AM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.am;
break;
case RLC_MODE_UM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.um;
break;
case RLC_MODE_TM:
rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_id].rlc.tm;
break;
default:
AssertFatal (0 , "UE RLC internal memory error rb id %u lcid %u enb id %u ue id %u!\n", rb_id, channel_idP, enb_mod_idP, ue_mod_idP);
}
}
}
if (MBMS_flagP) {
if (enb_flagP) {
mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_module_idP][channel_idP];
} else {
mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_module_idP][channel_idP];
}
key = RLC_COLL_KEY_MBMS_VALUE(enb_module_idP, ue_module_idP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id);
} else {
if (channel_idP > 2) {
rb_id = channel_idP - 2;
} else {
rb_id = channel_idP;
}
key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, enb_flagP, rb_id, srb_flag);
}
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
rlc_mode = rlc_union_p->mode;
} else {
rlc_mode = RLC_MODE_NONE;
LOG_E(RLC , "RLC not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_module_idP);
}
switch (rlc_mode) {
case RLC_MODE_NONE:
//handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP);
break;
case RLC_MODE_AM:
status_resp = rlc_am_mac_status_indication((rlc_am_entity_t*)rlc_p, frameP, tb_sizeP, tx_status);
mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time;
mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented;
return mac_rlc_status_resp;
break;
case RLC_MODE_UM:
status_resp = rlc_um_mac_status_indication((rlc_um_entity_t*)rlc_p, frameP, enb_flagP, tb_sizeP, tx_status);
mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus;
mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time;
mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented;
return mac_rlc_status_resp;
break;
case RLC_MODE_TM:
status_resp = rlc_tm_mac_status_indication((rlc_tm_entity_t*)rlc_p, frameP, tb_sizeP, tx_status);
mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus;
return mac_rlc_status_resp;
break;
default:;
}
return mac_rlc_status_resp;
switch (rlc_mode) {
case RLC_MODE_NONE:
//handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP);
break;
case RLC_MODE_AM:
status_resp = rlc_am_mac_status_indication(&rlc_union_p->rlc.am, frameP, tb_sizeP, tx_status);
mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time;
mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented;
return mac_rlc_status_resp;
break;
case RLC_MODE_UM:
status_resp = rlc_um_mac_status_indication(&rlc_union_p->rlc.um, frameP, enb_flagP, tb_sizeP, tx_status);
mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus;
mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time;
mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented;
return mac_rlc_status_resp;
break;
case RLC_MODE_TM:
status_resp = rlc_tm_mac_status_indication(&rlc_union_p->rlc.tm, frameP, tb_sizeP, tx_status);
mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus;
return mac_rlc_status_resp;
break;
default:;
}
return mac_rlc_status_resp;
}
......@@ -42,9 +42,15 @@ Address : EURECOM,
//-----------------------------------------------------------------------------
rlc_op_status_t mpls_rlc_data_req (module_id_t enb_module_idP, module_id_t ue_module_idP, uint32_t frame, rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t* sduP) {
rlc_op_status_t mpls_rlc_data_req (
const module_id_t enb_module_idP,
const module_id_t ue_module_idP,
const frame_t frame,
const rb_id_t rb_idP,
const sdu_size_t sdu_sizeP,
mem_block_t* const sduP) {
//-----------------------------------------------------------------------------
// third arg should be set to 1 or 0
return rlc_data_req(enb_module_idP, ue_module_idP, frame, 0, 0,rb_idP, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, sdu_sizeP, sduP);
return rlc_data_req(enb_module_idP, ue_module_idP, frame, ENB_FLAG_NO, SRB_FLAG_NO, MBMS_FLAG_NO, rb_idP, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, sdu_sizeP, sduP);
}
......@@ -59,15 +59,15 @@ Address : EURECOM,
#include "LAYER2/MAC/extern.h"
#include "assertions.h"
//-----------------------------------------------------------------------------
rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP,
module_id_t ue_mod_idP,
frame_t frameP,
eNB_flag_t enb_flagP,
SRB_ToAddModList_t *srb2add_listP,
DRB_ToAddModList_t *drb2add_listP,
DRB_ToReleaseList_t *drb2release_listP
rlc_op_status_t rrc_rlc_config_asn1_req (const module_id_t enb_mod_idP,
const module_id_t ue_mod_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const SRB_ToAddModList_t * const srb2add_listP,
const DRB_ToAddModList_t * const drb2add_listP,
const DRB_ToReleaseList_t * const drb2release_listP
#if defined(Rel10)
,PMCH_InfoList_r9_t* pmch_InfoList_r9_pP
,const PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP
#endif
) {
//-----------------------------------------------------------------------------
......@@ -76,16 +76,20 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP,
DRB_Identity_t drb_id = 0;
DRB_Identity_t* pdrb_id = NULL;
long int cnt = 0;
SRB_ToAddMod_t *srb_toaddmod_p = NULL;
DRB_ToAddMod_t *drb_toaddmod_p = NULL;
rlc_mode_t rlc_mode = RLC_MODE_NONE;
const SRB_ToAddMod_t *srb_toaddmod_p = NULL;
const DRB_ToAddMod_t *drb_toaddmod_p = NULL;
rlc_union_t *rlc_union_p = NULL;
hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE;
hashtable_rc_t h_rc;
#if defined(Rel10)
int i, j;
MBMS_SessionInfoList_r9_t *mbms_SessionInfoList_r9_p = NULL;
MBMS_SessionInfo_r9_t *MBMS_SessionInfo_p = NULL;
mbms_session_id_t mbms_session_id;
mbms_service_id_t mch_id, mbms_service_id;
mbms_service_id_t mbms_service_id;
DL_UM_RLC_t dl_um_rlc;
#endif
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] CONFIG REQ ASN1 \n",
......@@ -122,12 +126,8 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP,
if (srb2add_listP != NULL) {
for (cnt=0;cnt<srb2add_listP->list.count;cnt++) {
rb_id = srb2add_listP->list.array[cnt]->srb_Identity;
lc_id = rb_id + 2;
if (enb_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_id].mode;
} else {
rlc_mode = rlc_array_ue[ue_mod_idP][rb_id].mode;
}
LOG_D(RLC, "Adding SRB %d, rb_id %d\n",srb2add_listP->list.array[cnt]->srb_Identity,rb_id);
srb_toaddmod_p = srb2add_listP->list.array[cnt];
......@@ -140,127 +140,94 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP,
case RLC_Config_PR_NOTHING:
break;
case RLC_Config_PR_am:
if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_id, rb_id, RLC_MODE_AM) == RLC_OP_STATUS_OK) {
config_req_rlc_am_asn1 (
frameP,
enb_flagP,
enb_mod_idP,
ue_mod_idP,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am,
rb_id,
SIGNALLING_RADIO_BEARER);
} else {
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_id);
}
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_AM) != NULL) {
config_req_rlc_am_asn1 (
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_YES,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am,
rb_id);
} else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d AM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_id);
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_id);
}
break;
case RLC_Config_PR_um_Bi_Directional:
if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_id, rb_id, RLC_MODE_UM) == RLC_OP_STATUS_OK) {
config_req_rlc_um_asn1(
frameP,
enb_flagP,
MBMS_FLAG_NO,
enb_mod_idP,
ue_mod_idP,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.ul_UM_RLC,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.dl_UM_RLC,
rb_id,
SIGNALLING_RADIO_BEARER);
} else {
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_id);
}
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) {
config_req_rlc_um_asn1(
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_YES,
MBMS_FLAG_NO,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.ul_UM_RLC,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.dl_UM_RLC,
rb_id);
} else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_id);
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_id);
}
break;
case RLC_Config_PR_um_Uni_Directional_UL:
if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_id, rb_id, RLC_MODE_UM) == RLC_OP_STATUS_OK) {
config_req_rlc_um_asn1(
frameP,
enb_flagP,
MBMS_FLAG_NO,
enb_mod_idP,
ue_mod_idP,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_UL.ul_UM_RLC,
NULL,
rb_id, SIGNALLING_RADIO_BEARER);
} else {
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_id);
}
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) {
config_req_rlc_um_asn1(
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_YES,
MBMS_FLAG_NO,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_UL.ul_UM_RLC,
NULL,
rb_id);
} else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_id);
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_id);
}
break;
case RLC_Config_PR_um_Uni_Directional_DL:
if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_id, rb_id, RLC_MODE_UM) == RLC_OP_STATUS_OK) {
config_req_rlc_um_asn1(
frameP,
enb_flagP,
MBMS_FLAG_NO,
enb_mod_idP,
ue_mod_idP,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
NULL,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_DL.dl_UM_RLC,
rb_id, SIGNALLING_RADIO_BEARER);
} else {
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_id);
}
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) {
config_req_rlc_um_asn1(
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_YES,
MBMS_FLAG_NO,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
NULL,
&srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_DL.dl_UM_RLC,
rb_id);
} else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_id);
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
rb_id);
}
break;
default:
LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] UNKNOWN RLC CONFIG %d \n",
frameP,
......@@ -273,21 +240,21 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP,
break;
case SRB_ToAddMod__rlc_Config_PR_defaultValue:
#warning TO DO SRB_ToAddMod__rlc_Config_PR_defaultValue
if (rlc_mode == RLC_MODE_NONE) {
rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_id, rb_id, RLC_MODE_UM);
config_req_rlc_um_asn1(
frameP,
enb_flagP,
MBMS_FLAG_NO,
enb_mod_idP,
ue_mod_idP,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
NULL, // TO DO DEFAULT CONFIG
NULL, // TO DO DEFAULT CONFIG
rb_id, SIGNALLING_RADIO_BEARER);
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) {
config_req_rlc_um_asn1(
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_YES,
MBMS_FLAG_NO,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
NULL, // TO DO DEFAULT CONFIG
NULL, // TO DO DEFAULT CONFIG
rb_id);
} else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] SRB %d DEFAULT UM ALREADY CONFIGURED, TO DO MODIFY \n",
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
......@@ -304,14 +271,10 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP,
for (cnt=0;cnt<drb2add_listP->list.count;cnt++) {
drb_toaddmod_p = drb2add_listP->list.array[cnt];
drb_id = *drb_toaddmod_p->logicalChannelIdentity;//drb_toaddmod_p->drb_Identity;
lc_id = drb_id;
if (enb_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][drb_id].mode;
} else {
rlc_mode = rlc_array_ue[ue_mod_idP][drb_id].mode;
}
LOG_D(RLC, "Adding DRB %d, rb_id %d\n",*drb_toaddmod_p->logicalChannelIdentity,drb_id);
drb_id = drb_toaddmod_p->drb_Identity;
lc_id = drb_id + 2;
LOG_D(RLC, "Adding DRB %d, lc_id %d\n",drb_id,lc_id);
if (drb_toaddmod_p->rlc_Config) {
......@@ -320,96 +283,63 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP,
case RLC_Config_PR_NOTHING:
break;
case RLC_Config_PR_am:
if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, drb_id, lc_id, RLC_MODE_AM) == RLC_OP_STATUS_OK) {
config_req_rlc_am_asn1 (
frameP,
enb_flagP,
enb_mod_idP,
ue_mod_idP,
&drb_toaddmod_p->rlc_Config->choice.am,
drb_id,
RADIO_ACCESS_BEARER);
}
} else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] DRB %d AM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
drb_id);
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_AM) != NULL) {
config_req_rlc_am_asn1 (
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_NO,
&drb_toaddmod_p->rlc_Config->choice.am,
drb_id);
}
break;
case RLC_Config_PR_um_Bi_Directional:
if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, drb_id, lc_id, RLC_MODE_UM) == RLC_OP_STATUS_OK) {
config_req_rlc_um_asn1(
frameP,
enb_flagP,
MBMS_FLAG_NO,
enb_mod_idP,
ue_mod_idP,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
&drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.ul_UM_RLC,
&drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.dl_UM_RLC,
drb_id, RADIO_ACCESS_BEARER);
}
} else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] DRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
drb_id);
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM) != NULL) {
config_req_rlc_um_asn1(
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_NO,
MBMS_FLAG_NO,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
&drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.ul_UM_RLC,
&drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.dl_UM_RLC,
drb_id);
}
break;
case RLC_Config_PR_um_Uni_Directional_UL:
if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, drb_id, lc_id, RLC_MODE_UM) == RLC_OP_STATUS_OK) {
config_req_rlc_um_asn1(
frameP,
enb_flagP,
MBMS_FLAG_NO,
enb_mod_idP,
ue_mod_idP,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
&drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_UL.ul_UM_RLC,
NULL,
drb_id, RADIO_ACCESS_BEARER);
}
} else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] DRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
drb_id);
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM) != NULL) {
config_req_rlc_um_asn1(
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_NO,
MBMS_FLAG_NO,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
&drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_UL.ul_UM_RLC,
NULL,
drb_id);
}
break;
case RLC_Config_PR_um_Uni_Directional_DL:
if (rlc_mode == RLC_MODE_NONE) {
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, drb_id, lc_id, RLC_MODE_UM) == RLC_OP_STATUS_OK) {
config_req_rlc_um_asn1(
frameP,
enb_flagP,
MBMS_FLAG_NO,
enb_mod_idP,
ue_mod_idP,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
NULL,
&drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_DL.dl_UM_RLC,
drb_id, RADIO_ACCESS_BEARER);
}
} else {
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] DRB %d UM ALREADY CONFIGURED, TO DO MODIFY \n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
drb_id);
if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM) != NULL) {
config_req_rlc_um_asn1(
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_NO,
MBMS_FLAG_NO,
UNUSED_PARAM_MBMS_SESSION_ID,
UNUSED_PARAM_MBMS_SERVICE_ID,
NULL,
&drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_DL.dl_UM_RLC,
drb_id);
}
break;
default:
......@@ -426,7 +356,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP,
if (drb2release_listP != NULL) {
for (cnt=0;cnt<drb2release_listP->list.count;cnt++) {
pdrb_id = drb2release_listP->list.array[cnt];
rrc_rlc_remove_rlc(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, *pdrb_id);
rrc_rlc_remove_rlc(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_NO, MBMS_FLAG_NO, *pdrb_id);
}
}
......@@ -434,31 +364,43 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP,
if (pmch_InfoList_r9_pP != NULL) {
for (i=0;i<pmch_InfoList_r9_pP->list.count;i++) {
#warning TO DO REMOVE MBMS RLC
mbms_SessionInfoList_r9_p = &(pmch_InfoList_r9_pP->list.array[i]->mbms_SessionInfoList_r9);
for (j=0;j<mbms_SessionInfoList_r9_p->list.count;j++) {
MBMS_SessionInfo_p = mbms_SessionInfoList_r9_p->list.array[j];
mbms_session_id = MBMS_SessionInfo_p->sessionId_r9->buf[0];
lc_id = mbms_session_id;
mbms_service_id = MBMS_SessionInfo_p->tmgi_r9.serviceId_r9.buf[2]; //serviceId is 3-octet string
mch_id = mbms_service_id;
// can set the mch_id = i
if (enb_flagP) {
rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id + (maxDRB + 3) * MAX_MOBILES_PER_ENB; // 1
rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lc_id].service_id = mbms_service_id;
rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lc_id].session_id = mbms_session_id;
rlc_mbms_array_eNB[enb_mod_idP][mbms_service_id][mbms_session_id].rb_id = rb_id;
rlc_mbms_array_eNB[enb_mod_idP][mbms_service_id][mbms_session_id].instanciated_instance = TRUE;
rlc_mbms_enb_set_lcid_by_rb_id(enb_mod_idP,rb_id,lc_id);
} else {
rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id + (maxDRB + 3); // 15
rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][lc_id].service_id = mbms_service_id;
rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][lc_id].session_id = mbms_session_id;
rlc_mbms_array_ue[ue_mod_idP][mbms_service_id][mbms_session_id].rb_id = rb_id;
rlc_mbms_array_ue[ue_mod_idP][mbms_service_id][mbms_session_id].instanciated_instance = TRUE;
rlc_mbms_ue_set_lcid_by_rb_id(ue_mod_idP,rb_id,lc_id);
}
key = RLC_COLL_KEY_MBMS_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, mbms_service_id, mbms_session_id);
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) {
rlc_union_p = rrc_rlc_add_rlc (
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_NO,
MBMS_FLAG_YES,
rb_id,
lc_id,
RLC_MODE_UM);
AssertFatal(rlc_union_p != NULL, "ADD MBMS RLC UM FAILED");
}
LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] CONFIG REQ MBMS ASN1 LC ID %u RB ID %u SESSION ID %u SERVICE ID %u\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
......@@ -473,17 +415,17 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP,
dl_um_rlc.t_Reordering = T_Reordering_ms0;
config_req_rlc_um_asn1 (
frameP,
enb_flagP,
MBMS_FLAG_YES,
enb_mod_idP,
ue_mod_idP,
mbms_session_id,
mbms_service_id,
NULL,
&dl_um_rlc,
rb_id,
RADIO_ACCESS_BEARER);
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
SRB_FLAG_NO,
MBMS_FLAG_YES,
mbms_session_id,
mbms_service_id,
NULL,
&dl_um_rlc,
rb_id);
}
}
}
......@@ -498,36 +440,46 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP,
return RLC_OP_STATUS_OK;
}
//-----------------------------------------------------------------------------
rlc_op_status_t
rb_release_rlc_tm (rlc_tm_entity_t *rlcP, module_id_t enb_mod_idP, module_id_t ue_mod_idP)
{
//-----------------------------------------------------------------------------
rlc_tm_cleanup(rlcP);
return RLC_OP_STATUS_OK;
}
//-----------------------------------------------------------------------------
rlc_op_status_t
rb_release_rlc_um (rlc_um_entity_t *rlcP, module_id_t enb_mod_idP, module_id_t ue_mod_idP)
{
//-----------------------------------------------------------------------------
rlc_um_cleanup(rlcP);
return RLC_OP_STATUS_OK;
}
//-----------------------------------------------------------------------------
rlc_op_status_t
rb_release_rlc_am (rlc_am_entity_t *rlcP, frame_t frameP, module_id_t enb_mod_idP, module_id_t ue_mod_idP)
void
rb_free_rlc_union (void *rlcu_pP)
{
//-----------------------------------------------------------------------------
rlc_am_cleanup(rlcP,frameP);
return RLC_OP_STATUS_OK;
rlc_union_t * rlcu_p;
if (rlcu_pP) {
rlcu_p = (rlc_union_t *)(rlcu_pP);
switch (rlcu_p->mode) {
case RLC_MODE_AM:
rlc_am_cleanup(&rlcu_p->rlc.am);
break;
case RLC_MODE_UM:
rlc_um_cleanup(&rlcu_p->rlc.um);
break;
case RLC_MODE_TM:
rlc_tm_cleanup(&rlcu_p->rlc.tm);
break;
default:
break;
}
free(rlcu_p);
}
}
//-----------------------------------------------------------------------------
rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, rb_id_t rb_idP) {
rlc_op_status_t rrc_rlc_remove_rlc (
const module_id_t enb_mod_idP,
const module_id_t ue_mod_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_idP) {
//-----------------------------------------------------------------------------
logical_chan_id_t lcid = 0;
rlc_mode_t rlc_mode = RLC_MODE_NONE;
rlc_op_status_t status;
logical_chan_id_t lcid = 0;
hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE;
hashtable_rc_t h_rc;
#ifdef Rel10
rlc_mbms_id_t *mbms_id_p = NULL;
#endif
#ifdef OAI_EMU
AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
"eNB module id is too low (%u/%d)!\n",
......@@ -554,120 +506,83 @@ rlc_op_status_t rrc_rlc_remove_rlc (module_id_t enb_mod_idP, module_id_t ue_mo
}
#endif
#ifdef Rel10
if (MBMS_flagP == TRUE) {
if (enb_flagP) {
lcid = rlc_mbms_enb_get_lcid_by_rb_id(enb_mod_idP,rb_idP);
mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid];
rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid].service_id = 0;
rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid].session_id = 0;
rlc_mbms_rbid2lcid_ue[enb_mod_idP][rb_idP] = RLC_LC_UNALLOCATED;
} else {
lcid = rlc_mbms_ue_get_lcid_by_rb_id(ue_mod_idP,rb_idP);
mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][lcid];
rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lcid].service_id = 0;
rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lcid].session_id = 0;
rlc_mbms_rbid2lcid_ue[ue_mod_idP][rb_idP] = RLC_LC_UNALLOCATED;
}
key = RLC_COLL_KEY_MBMS_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id);
} else
#endif
{
key = RLC_COLL_KEY_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, rb_idP, srb_flagP);
}
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
if (enb_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
switch (rlc_mode) {
case RLC_MODE_AM:
LOG_D(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] RELEASE RB AM\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
lcid = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am.channel_id;
AssertFatal (lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid] == rb_idP, "Mismatch in RLC AM LC %u/RB %u mapping for RB %u\n", lcid, lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid], rb_idP);
lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid] = RLC_RB_UNALLOCATED;
status = rb_release_rlc_am(&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am, frameP, enb_mod_idP, ue_mod_idP);
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am.allocation = 0;
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_MODE_NONE;
break;
case RLC_MODE_TM:
LOG_D(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] RELEASE RB TM\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
lcid = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm.channel_id;
AssertFatal (lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid] == rb_idP, "Mismatch in RLC TM LC %u/RB %u mapping for RB %u\n", lcid, lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid], rb_idP);
lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid] = RLC_RB_UNALLOCATED;
status = rb_release_rlc_tm(&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm, enb_mod_idP, ue_mod_idP);
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm.allocation = 0;
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_MODE_NONE;
break;
case RLC_MODE_UM:
LOG_D(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] RELEASE RB UM\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
lcid = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um.channel_id;
AssertFatal (lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid] == rb_idP, "Mismatch in RLC UM LC %u/RB %u mapping for RB %u\n", lcid, lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid], rb_idP);
lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][lcid] = RLC_RB_UNALLOCATED;
status = rb_release_rlc_um(&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um, enb_mod_idP, ue_mod_idP);
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um.allocation = 0;
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_MODE_NONE;
break;
default:
LOG_E(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] RELEASE RB mode %d\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
rlc_mode);
return RLC_OP_STATUS_BAD_PARAMETER;
break;
}
h_rc = hashtable_remove(rlc_coll_p, key);
if (h_rc == HASH_TABLE_OK) {
LOG_D(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] RELEASED %s\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
(srb_flagP) ? "SRB" : "DRB");
} else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) {
LOG_W(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] RELEASE : RLC NOT FOUND %s\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
(srb_flagP) ? "SRB" : "DRB");
} else {
rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
switch (rlc_mode) {
case RLC_MODE_AM:
LOG_D(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] RELEASE RB AM\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
lcid = rlc_array_ue[ue_mod_idP][rb_idP].rlc.am.channel_id;
AssertFatal (lcid2rbid_ue[ue_mod_idP][lcid] == rb_idP, "Mismatch in RLC AM LC %u/RB %u mapping for RB %u\n", lcid, lcid2rbid_ue[ue_mod_idP][lcid], rb_idP);
lcid2rbid_ue[ue_mod_idP][lcid] = RLC_RB_UNALLOCATED;
status = rb_release_rlc_am(&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am, frameP, enb_mod_idP, ue_mod_idP);
rlc_array_ue[ue_mod_idP][rb_idP].rlc.am.allocation = 0;
rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_MODE_NONE;
break;
case RLC_MODE_TM:
LOG_D(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] RELEASE RB TM\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
lcid = rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm.channel_id;
AssertFatal (lcid2rbid_ue[ue_mod_idP][lcid] == rb_idP, "Mismatch in RLC TM LC %u/RB %u mapping for RB %u\n", lcid, lcid2rbid_ue[ue_mod_idP][lcid], rb_idP);
lcid2rbid_ue[ue_mod_idP][lcid] = RLC_RB_UNALLOCATED;
status = rb_release_rlc_tm(&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm, enb_mod_idP, ue_mod_idP);
rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm.allocation = 0;
rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_MODE_NONE;
break;
case RLC_MODE_UM:
LOG_D(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] RELEASE RB UM\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP);
lcid = rlc_array_ue[ue_mod_idP][rb_idP].rlc.um.channel_id;
AssertFatal (lcid2rbid_ue[ue_mod_idP][lcid] == rb_idP, "Mismatch in RLC UM LC %u/RB %u mapping for RB %u\n", lcid, lcid2rbid_ue[ue_mod_idP][lcid], rb_idP);
lcid2rbid_ue[ue_mod_idP][lcid] = RLC_RB_UNALLOCATED;
status = rb_release_rlc_um(&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um, enb_mod_idP, ue_mod_idP);
rlc_array_ue[ue_mod_idP][rb_idP].rlc.um.allocation = 0;
rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_MODE_NONE;
break;
default:
LOG_E(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] RELEASE RB mode %d\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
rlc_mode);
return RLC_OP_STATUS_BAD_PARAMETER;
break;
}
}
return status;
LOG_E(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] RELEASE : INTERNAL ERROR %s\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
(srb_flagP) ? "SRB" : "DRB"); }
return RLC_OP_STATUS_OK;
}
//-----------------------------------------------------------------------------
rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, rb_id_t rb_idP, logical_chan_id_t chan_idP, rlc_mode_t rlc_modeP) {
rlc_union_t* rrc_rlc_add_rlc (
const module_id_t enb_mod_idP,
const module_id_t ue_mod_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP,
const rlc_mode_t rlc_modeP) {
//-----------------------------------------------------------------------------
rlc_mode_t rlc_mode = RLC_MODE_NONE;
unsigned int allocation;
hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE;
hashtable_rc_t h_rc;
rlc_union_t *rlc_union_p = NULL;
#ifdef Rel10
rlc_mbms_id_t *mbms_id_p = NULL;
logical_chan_id_t lcid = 0;
#endif
#ifdef OAI_EMU
if (enb_flagP) {
......@@ -697,185 +612,92 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC);
if (enb_flagP) {
rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
if (rlc_mode != RLC_MODE_NONE) {
LOG_E(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB RB IS ALREADY ALLOCATED\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
return RLC_OP_STATUS_BAD_PARAMETER;
}
AssertFatal (lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][chan_idP] == RLC_RB_UNALLOCATED, "Bad LC RB %u mapping in RLC layer, channel id %u already configured!\n", rb_idP, chan_idP);
lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][chan_idP] = rb_idP;
switch (rlc_modeP) {
case RLC_MODE_AM:
allocation = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am.allocation;
if (!(allocation)) {
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am.allocation = 1;
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_MODE_AM;
LOG_I(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB AM\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
} else {
LOG_D(RLC,"[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB AM IS ALREADY ALLOCATED\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
return RLC_OP_STATUS_BAD_PARAMETER;
}
break;
case RLC_MODE_TM:
allocation = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm.allocation;
if (!(allocation)) {
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm.allocation = 1;
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_MODE_TM;
LOG_I(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB TM\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
} else {
LOG_D(RLC,"[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB TM IS ALREADY ALLOCATED\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
return RLC_OP_STATUS_BAD_PARAMETER;
}
break;
case RLC_MODE_UM:
allocation = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um.allocation;
if (!(allocation)) {
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um.allocation = 1;
rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode = RLC_MODE_UM;
LOG_I(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB UM\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
} else {
LOG_D(RLC,"[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB UM IS ALREADY ALLOCATED\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
return RLC_OP_STATUS_BAD_PARAMETER;
}
break;
default:
LOG_E(RLC, "[Frame %05u][eNB][RLC_RRC][INST %u/%u][RB %u] %s BAD PARAMETER RLC MODE %d\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
__FUNCTION__,
rlc_modeP);
return RLC_OP_STATUS_BAD_PARAMETER;
}
} else {
rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
if (rlc_mode != RLC_MODE_NONE) {
LOG_E(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB RB IS ALREADY ALLOCATED\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
return RLC_OP_STATUS_BAD_PARAMETER;
}
AssertFatal (lcid2rbid_ue[ue_mod_idP][chan_idP] == RLC_RB_UNALLOCATED, "Bad LC RB %u mapping in RLC layer, channel id %u already configured!\n", rb_idP, chan_idP);
lcid2rbid_ue[ue_mod_idP][chan_idP] = rb_idP;
switch (rlc_modeP) {
case RLC_MODE_AM:
allocation = rlc_array_ue[ue_mod_idP][rb_idP].rlc.am.allocation;
if (!(allocation)) {
rlc_array_ue[ue_mod_idP][rb_idP].rlc.am.allocation = 1;
rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_MODE_AM;
LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB AM\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
} else {
LOG_D(RLC,"[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB AM IS ALREADY ALLOCATED\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
return RLC_OP_STATUS_BAD_PARAMETER;
}
break;
case RLC_MODE_TM:
allocation = rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm.allocation;
if (!(allocation)) {
rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm.allocation = 1;
rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_MODE_TM;
LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB TM\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
} else {
LOG_D(RLC,"[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB TM IS ALREADY ALLOCATED\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
return RLC_OP_STATUS_BAD_PARAMETER;
}
break;
case RLC_MODE_UM:
allocation = rlc_array_ue[ue_mod_idP][rb_idP].rlc.um.allocation;
if (!(allocation)) {
rlc_array_ue[ue_mod_idP][rb_idP].rlc.um.allocation = 1;
rlc_array_ue[ue_mod_idP][rb_idP].mode = RLC_MODE_UM;
LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB UM\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
} else {
LOG_D(RLC,"[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u][LCH Id %d] ADD RB UM IS ALREADY ALLOCATED\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
chan_idP);
return RLC_OP_STATUS_BAD_PARAMETER;
}
break;
default:
LOG_E(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] %s BAD PARAMETER RLC MODE %d\n",
frameP,
enb_mod_idP,
ue_mod_idP,
rb_idP,
__FUNCTION__,
rlc_modeP);
return RLC_OP_STATUS_BAD_PARAMETER;
}
}
return RLC_OP_STATUS_OK;
#ifdef Rel10
if (MBMS_flagP == TRUE) {
if (enb_flagP) {
lcid = rlc_mbms_enb_get_lcid_by_rb_id(enb_mod_idP,rb_idP);
mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid];
rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid].service_id = 0;
rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid].session_id = 0;
rlc_mbms_rbid2lcid_ue[enb_mod_idP][rb_idP] = RLC_LC_UNALLOCATED;
} else {
lcid = rlc_mbms_ue_get_lcid_by_rb_id(ue_mod_idP,rb_idP);
mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][lcid];
rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lcid].service_id = 0;
rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lcid].session_id = 0;
rlc_mbms_rbid2lcid_ue[ue_mod_idP][rb_idP] = RLC_LC_UNALLOCATED;
}
key = RLC_COLL_KEY_MBMS_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id);
} else
#endif
{
key = RLC_COLL_KEY_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, rb_idP, srb_flagP);
}
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
LOG_W(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] rrc_rlc_add_rlc , already exist %s\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
(srb_flagP) ? "SRB" : "DRB");
AssertFatal(rlc_union_p->mode == rlc_modeP, "Error rrc_rlc_add_rlc , already exist but RLC mode differ");
return rlc_union_p;
} else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) {
rlc_union_p = calloc(1, sizeof(rlc_union_t));
h_rc = hashtable_insert(rlc_coll_p, key, rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
LOG_I(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] rrc_rlc_add_rlc %s\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
(srb_flagP) ? "SRB" : "DRB");
rlc_union_p->mode = rlc_modeP;
return rlc_union_p;
} else {
LOG_E(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] rrc_rlc_add_rlc FAILED %s\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
(srb_flagP) ? "SRB" : "DRB");
free(rlc_union_p);
rlc_union_p = NULL;
return NULL;
}
} else {
LOG_E(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] rrc_rlc_add_rlc , INTERNAL ERROR %s\n",
frameP,
(enb_flagP) ? "eNB" : "UE",
enb_mod_idP,
ue_mod_idP,
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
(srb_flagP) ? "SRB" : "DRB");
}
return NULL;
}
//-----------------------------------------------------------------------------
rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, config_action_t actionP, rb_id_t rb_idP, rb_type_t rb_typeP, rlc_info_t rlc_infoP) {
rlc_op_status_t rrc_rlc_config_req (
const module_id_t enb_mod_idP,
const module_id_t ue_mod_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const srb_flag_t srb_flagP,
const MBMS_flag_t mbms_flagP,
const config_action_t actionP,
const rb_id_t rb_idP,
const rlc_info_t rlc_infoP) {
//-----------------------------------------------------------------------------
rlc_op_status_t status;
......@@ -915,8 +737,8 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo
switch (actionP) {
case CONFIG_ACTION_ADD:
if ((status = rrc_rlc_add_rlc(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_idP, rb_idP, rlc_infoP.rlc_mode)) != RLC_OP_STATUS_OK) {
return status;
if (rrc_rlc_add_rlc(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, srb_flagP, MBMS_FLAG_NO, rb_idP, rb_idP, rlc_infoP.rlc_mode) != NULL) {
return RLC_OP_STATUS_INTERNAL_ERROR;
}
// no break, fall to next case
case CONFIG_ACTION_MODIFY:
......@@ -929,13 +751,13 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo
rb_idP);
config_req_rlc_am(
frameP,
enb_flagP,
enb_mod_idP,
ue_mod_idP,
&rlc_infoP.rlc.rlc_am_info,
rb_idP,
rb_typeP);
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
srb_flagP,
&rlc_infoP.rlc.rlc_am_info,
rb_idP);
break;
case RLC_MODE_UM:
LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] MODIFY RB UM\n",
......@@ -944,13 +766,13 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo
ue_mod_idP,
rb_idP);
config_req_rlc_um(
frameP,
enb_flagP,
enb_mod_idP,
ue_mod_idP,
&rlc_infoP.rlc.rlc_um_info,
rb_idP,
rb_typeP);
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
srb_flagP,
&rlc_infoP.rlc.rlc_um_info,
rb_idP);
break;
case RLC_MODE_TM:
LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] MODIFY RB TM\n",
......@@ -959,13 +781,13 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo
ue_mod_idP,
rb_idP);
config_req_rlc_tm(
frameP,
enb_flagP,
enb_mod_idP,
ue_mod_idP,
&rlc_infoP.rlc.rlc_tm_info,
rb_idP,
rb_typeP);
enb_mod_idP,
ue_mod_idP,
frameP,
enb_flagP,
srb_flagP,
&rlc_infoP.rlc.rlc_tm_info,
rb_idP);
break;
default:
return RLC_OP_STATUS_BAD_PARAMETER;
......@@ -973,7 +795,7 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo
break;
case CONFIG_ACTION_REMOVE:
return rrc_rlc_remove_rlc(enb_mod_idP, ue_mod_idP, rb_idP, frameP, enb_flagP);
return rrc_rlc_remove_rlc(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, srb_flagP, mbms_flagP, rb_idP);
break;
default:
return RLC_OP_STATUS_BAD_PARAMETER;
......@@ -982,14 +804,24 @@ rlc_op_status_t rrc_rlc_config_req (module_id_t enb_mod_idP, module_id_t ue_mo
return RLC_OP_STATUS_OK;
}
//-----------------------------------------------------------------------------
rlc_op_status_t rrc_rlc_data_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, MBMS_flag_t MBMS_flagP, rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, char* sduP) {
rlc_op_status_t rrc_rlc_data_req (
const module_id_t enb_mod_idP,
const module_id_t ue_mod_idP,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_sizeP,
char* sduP) {
//-----------------------------------------------------------------------------
mem_block_t* sdu;
sdu = get_free_mem_block(sdu_sizeP);
if (sdu != NULL) {
memcpy (sdu->data, sduP, sdu_sizeP);
return rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, MBMS_flagP, rb_idP, muiP, confirmP, sdu_sizeP, sdu);
return rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, MBMS_flagP, rb_idP, muiP, confirmP, sdu_sizeP, sdu);
} else {
return RLC_OP_STATUS_INTERNAL_ERROR;
}
......
......@@ -157,7 +157,7 @@
#define OAI_NW_DRV_PROTOCOL_UDP IPPROTO_UDP
#define OAI_NW_DRV_PROTOCOL_ICMP4 IPPROTO_ICMP
#define OAI_NW_DRV_PROTOCOL_ICMP6 IPPROTO_ICMPV6
#warning "OAI_NW_DRV_PROTOCOL_ARP value 200 may collide with new defined values in kernel"
//#warning "OAI_NW_DRV_PROTOCOL_ARP value 200 may collide with new defined values in kernel"
#define OAI_NW_DRV_PROTOCOL_ARP 200
#define OAI_NW_DRV_PORT_DEFAULT __constant_htons(65535)
......
......@@ -588,11 +588,19 @@ struct rb_entity *nas_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t
#ifdef NAS_DEBUG_CLASS
printk("NAS_COMMON_SEARCH_RB - rab_id %d\n", rab_id);
#endif
for (rb=cx->rb; rb!=NULL; rb=rb->next)
{
if (rb->rab_id==rab_id)
return rb;
}
for (rb=cx->rb; rb!=NULL; rb=rb->next) {
#ifdef NAS_DEBUG_CLASS
printk("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS\n");
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.rab_id %u \n", rb->rab_id);
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.sapi %u \n", rb->sapi;
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.qos %u \n", rb->qos;
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.state %u \n", rb->state;
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.retry %u \n", rb->retry;
printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.countimer %u \n\n", rb->countimer;);
#endif
if (rb->rab_id==rab_id)
return rb;
}
return NULL;
}
......
......@@ -248,7 +248,7 @@ void nas_set_msg_rb_establishment_reply(struct nas_msg_rb_establishment_reply *m
struct nas_priv *priv){
//---------------------------------------------------------------------------
// if ((msgreq->rab_id<3)||(msgreq->rab_id>127))
if ((msgreq->rab_id<3)||(msgreq->rab_id>MAX_RABS)) // navid : increase the number
if ((msgreq->rab_id<1)||(msgreq->rab_id>MAX_RABS)) // navid : increase the number
msgrep->status=-NAS_ERROR_NOTCORRECTRABI;
else
{
......@@ -319,8 +319,9 @@ void nas_set_msg_rb_release_reply(struct nas_msg_rb_release_reply *msgrep,
}
//---------------------------------------------------------------------------
int nas_ioCTL_rb_release_request(struct nas_ioctl *gifr,
struct nas_priv *priv){
int nas_ioCTL_rb_release_request(
struct nas_ioctl *gifr,
struct nas_priv *priv){
//---------------------------------------------------------------------------
struct nas_msg_rb_release_request msgreq;
struct nas_msg_rb_release_reply msgrep;
......@@ -342,9 +343,10 @@ int nas_ioCTL_rb_release_request(struct nas_ioctl *gifr,
///////////////////////////////////////////////////////////////////////////////
// Classifier List
//---------------------------------------------------------------------------
void nas_set_msg_class_list_reply(uint8_t *msgrep,
struct nas_msg_class_list_request *msgreq,
struct nas_priv *priv){
void nas_set_msg_class_list_reply(
uint8_t *msgrep,
struct nas_msg_class_list_request *msgreq,
struct nas_priv *priv) {
//---------------------------------------------------------------------------
struct cx_entity *cx;
struct classifier_entity *gc;
......@@ -401,8 +403,9 @@ void nas_set_msg_class_list_reply(uint8_t *msgrep,
}
//---------------------------------------------------------------------------
int nas_ioCTL_class_list_request(struct nas_ioctl *gifr,
struct nas_priv *priv){
int nas_ioCTL_class_list_request(
struct nas_ioctl *gifr,
struct nas_priv *priv){
//---------------------------------------------------------------------------
uint8_t msgrep[NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1];
struct nas_msg_class_list_request msgreq;
......@@ -424,9 +427,10 @@ int nas_ioCTL_class_list_request(struct nas_ioctl *gifr,
///////////////////////////////////////////////////////////////////////////////
// Request the addition of a classifier rule
//---------------------------------------------------------------------------
void nas_set_msg_class_add_reply(struct nas_msg_class_add_reply *msgrep,
struct nas_msg_class_add_request *msgreq,
struct nas_priv *priv){
void nas_set_msg_class_add_reply(
struct nas_msg_class_add_reply *msgrep,
struct nas_msg_class_add_request *msgreq,
struct nas_priv *priv){
//---------------------------------------------------------------------------
struct classifier_entity *gc,*gc2;
unsigned char *saddr,*daddr;
......
......@@ -519,7 +519,7 @@ uint8_t rrc_lite_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame
}
#else
return pdcp_data_req (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_idP, muiP, confirmP, sdu_size, buffer_pP, mode);
return pdcp_data_req (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, rb_idP, muiP, confirmP, sdu_size, buffer_pP, mode);
#endif
}
......
......@@ -319,7 +319,7 @@ void rrc_ue_generate_RRCConnectionRequest(module_id_t ue_mod_idP, frame_t frameP
mui_t rrc_mui=0;
/* NAS Attach request with IMSI */
static const char nas_attach_req_imsi[] =
static const char const nas_attach_req_imsi[] =
{
0x07, 0x41,
/* EPS Mobile identity = IMSI */
......@@ -334,7 +334,7 @@ static const char nas_attach_req_imsi[] =
};
/* NAS Attach request with GUTI */
static const char nas_attach_req_guti[] =
static const char const nas_attach_req_guti[] =
{
0x07, 0x41,
/* EPS Mobile identity = GUTI */
......@@ -354,7 +354,7 @@ void rrc_ue_generate_RRCConnectionSetupComplete(module_id_t ue_mod_idP, frame_t
uint8_t buffer[100];
uint8_t size;
char *nas_msg;
const char * nas_msg;
int nas_msg_length;
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
......@@ -609,12 +609,12 @@ int32_t rrc_ue_establish_drb(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_
LOG_I(OIP,"[UE %d] Config the oai%d to send/receive pkt on DRB %d to/from the protocol stack\n",
ue_mod_idP,
ip_addr_offset3+ue_mod_idP,
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity);
(eNB_index * maxDRB) + DRB_config->drb_Identity);
rb_conf_ipv4(0,//add
ue_mod_idP,//cx align with the UE index
ip_addr_offset3+ue_mod_idP,//inst num_enb+ue_index
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity,//rb
(eNB_index * maxDRB) + DRB_config->drb_Identity,//rb
0,//dscp
ipv4_address(ip_addr_offset3+ue_mod_idP+1,ip_addr_offset4+ue_mod_idP+1),//saddr
ipv4_address(ip_addr_offset3+ue_mod_idP+1,eNB_index+1));//daddr
......@@ -1413,14 +1413,14 @@ void rrc_ue_process_mobilityControlInfo(uint8_t eNB_index, uint8_t UE_id, frame_
//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", UE_id);
rrc_pdcp_config_req (eNB_index, UE_id, frameP, ENB_FLAG_NO, CONFIG_ACTION_REMOVE, DCCH,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(eNB_index, ue_mod_idP,frameP,ENB_FLAG_NO,CONFIG_ACTION_REMOVE,ue_mod_idP+DCCH,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
rrc_pdcp_config_req (eNB_index, UE_id, frameP, ENB_FLAG_NO, SRB_FLAG_YES, CONFIG_ACTION_REMOVE, DCCH,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(eNB_index, ue_mod_idP,frameP,ENB_FLAG_NO, SRB_FLAG_YES, MBMS_FLAG_NO, CONFIG_ACTION_REMOVE,ue_mod_idP+DCCH,Rlc_info_am_config);
rrc_pdcp_config_req (eNB_index, UE_id, frameP, ENB_FLAG_NO, CONFIG_ACTION_REMOVE, DCCH1,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(eNB_index, ue_mod_idP,frameP,ENB_FLAG_NO,CONFIG_ACTION_REMOVE,ue_mod_idP+DCCH1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
rrc_pdcp_config_req (eNB_index, UE_id, frameP, ENB_FLAG_NO, SRB_FLAG_YES, CONFIG_ACTION_REMOVE, DCCH1,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(eNB_index, ue_mod_idP,frameP,ENB_FLAG_NO, SRB_FLAG_YES,CONFIG_ACTION_REMOVE, MBMS_FLAG_NO,ue_mod_idP+DCCH1,Rlc_info_am_config);
rrc_pdcp_config_req (eNB_index, UE_id, frameP, ENB_FLAG_NO, CONFIG_ACTION_REMOVE, DTCH,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(eNB_index, ue_mod_idP,frameP,ENB_FLAG_NO,CONFIG_ACTION_REMOVE,ue_mod_idP+DTCH,RADIO_ACCESS_BEARER,Rlc_info_um);
rrc_pdcp_config_req (eNB_index, UE_id, frameP, ENB_FLAG_NO, SRB_FLAG_NO, CONFIG_ACTION_REMOVE, DTCH,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(eNB_index, ue_mod_idP,frameP,ENB_FLAG_NO, SRB_FLAG_NO,CONFIG_ACTION_REMOVE, MBMS_FLAG_NO,ue_mod_idP+DTCH,Rlc_info_um);
/*
rrc_pdcp_config_asn1_req(NB_eNB_INST+ue_mod_idP,frameP, 0,eNB_index,
NULL, // SRB_ToAddModList
......@@ -2457,7 +2457,7 @@ void rrc_ue_generate_MeasurementReport(module_id_t eNB_id, module_id_t UE_id, fr
LOG_I(RRC, "[UE %d] Frame %d : Generating Measurement Report for eNB %d\n", UE_id, frameP, 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",
frameP, UE_id, size, eNB_id, rrc_mui, eNB_id, DCCH);
result = pdcp_data_req(eNB_id, UE_id, frameP, 0, DCCH, rrc_mui++, 0, size, buffer, PDCP_TRANSMISSION_MODE_DATA);
result = pdcp_data_req(eNB_id, UE_id, frameP, ENB_FLAG_NO, SRB_FLAG_YES, DCCH, rrc_mui++, 0, size, buffer, PDCP_TRANSMISSION_MODE_DATA);
AssertFatal (result == TRUE, "PDCP data request failed!\n");
//LOG_D(RRC, "[UE %d] Frame %d Sending MeasReport (%d bytes) through DCCH%d to PDCP \n",ue_mod_idP,frameP, size, DCCH);
}
......
......@@ -55,7 +55,7 @@ extern UE_MAC_INST *UE_mac_inst;
extern mui_t rrc_eNB_mui;
//configure BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
void openair_rrc_on(module_id_t Mod_id, eNB_flag_t eNB_flag) {
void openair_rrc_on(module_id_t Mod_id, const eNB_flag_t eNB_flag) {
unsigned short i;
if (eNB_flag == 1) {
......@@ -288,7 +288,7 @@ void rrc_top_cleanup(void) {
}
void rrc_t310_expiration(frame_t frameP, uint8_t Mod_id, uint8_t eNB_index) {
void rrc_t310_expiration(const frame_t frameP, uint8_t Mod_id, uint8_t eNB_index) {
if (UE_rrc_inst[Mod_id].Info[eNB_index].State != RRC_CONNECTED) {
LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n");
......@@ -304,10 +304,10 @@ void rrc_t310_expiration(frame_t frameP, uint8_t Mod_id, uint8_t 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 (eNB_index, Mod_id, frameP, 0, CONFIG_ACTION_REMOVE,
rrc_pdcp_config_req (eNB_index, Mod_id, frameP, ENB_FLAG_NO, SRB_FLAG_YES, CONFIG_ACTION_REMOVE,
UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id, 0);
rrc_rlc_config_req (eNB_index, Mod_id, frameP, 0, CONFIG_ACTION_REMOVE,
UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id, SIGNALLING_RADIO_BEARER, Rlc_info_um);
rrc_rlc_config_req (eNB_index, Mod_id, frameP, ENB_FLAG_NO, SRB_FLAG_YES, MBMS_FLAG_NO, CONFIG_ACTION_REMOVE,
UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id, Rlc_info_um);
UE_rrc_inst[Mod_id].Srb2[eNB_index].Active = 0;
UE_rrc_inst[Mod_id].Srb2[eNB_index].Status = IDLE;
UE_rrc_inst[Mod_id].Srb2[eNB_index].Next_check_frame = 0;
......@@ -318,7 +318,7 @@ void rrc_t310_expiration(frame_t frameP, uint8_t Mod_id, uint8_t eNB_index) {
}
}
RRC_status_t rrc_rx_tx(uint8_t Mod_id,frame_t frameP, eNB_flag_t eNB_flagP,uint8_t index){
RRC_status_t rrc_rx_tx(uint8_t Mod_id, const frame_t frameP, const eNB_flag_t eNB_flagP,uint8_t index){
if(eNB_flagP == 0) {
// check timers
......
......@@ -590,48 +590,48 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
struct PhysicalConfigDedicated **physicalConfigDedicated = &rrc_inst->physicalConfigDedicated[ue_mod_idP];
struct SRB_ToAddMod *SRB2_config;
struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config;
struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config;
struct SRB_ToAddMod *SRB2_config = NULL;
struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL;
struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL;
struct LogicalChannelConfig__ul_SpecificParameters
*SRB2_ul_SpecificParameters;
*SRB2_ul_SpecificParameters = NULL;
SRB_ToAddModList_t *SRB_configList = rrc_inst->SRB_configList[ue_mod_idP];
SRB_ToAddModList_t *SRB_configList2;
struct DRB_ToAddMod *DRB_config;
struct RLC_Config *DRB_rlc_config;
struct PDCP_Config *DRB_pdcp_config;
struct PDCP_Config__rlc_AM *PDCP_rlc_AM;
struct PDCP_Config__rlc_UM *PDCP_rlc_UM;
struct LogicalChannelConfig *DRB_lchan_config;
SRB_ToAddModList_t *SRB_configList2 = NULL;
struct DRB_ToAddMod *DRB_config = NULL;
struct RLC_Config *DRB_rlc_config = NULL;
struct PDCP_Config *DRB_pdcp_config = NULL;
struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL;
struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL;
struct LogicalChannelConfig *DRB_lchan_config = NULL;
struct LogicalChannelConfig__ul_SpecificParameters
*DRB_ul_SpecificParameters;
*DRB_ul_SpecificParameters = NULL;
DRB_ToAddModList_t **DRB_configList = &rrc_inst->DRB_configList[ue_mod_idP];
MAC_MainConfig_t *mac_MainConfig;
MeasObjectToAddModList_t *MeasObj_list;
MeasObjectToAddMod_t *MeasObj;
ReportConfigToAddModList_t *ReportConfig_list;
MAC_MainConfig_t *mac_MainConfig = NULL;
MeasObjectToAddModList_t *MeasObj_list = NULL;
MeasObjectToAddMod_t *MeasObj = NULL;
ReportConfigToAddModList_t *ReportConfig_list = NULL;
ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1,
*ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5;
MeasIdToAddModList_t *MeasId_list;
MeasIdToAddModList_t *MeasId_list = NULL;
MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5;
#if Rel10
long *sr_ProhibitTimer_r9;
long *sr_ProhibitTimer_r9 = NULL;
#endif
long *logicalchannelgroup, *logicalchannelgroup_drb;
long *maxHARQ_Tx, *periodicBSR_Timer;
RSRP_Range_t *rsrp = NULL;
struct MeasConfig__speedStatePars *Sparams = NULL;
QuantityConfig_t *quantityConfig = NULL;
CellsToAddMod_t *CellToAdd;
CellsToAddModList_t *CellsToAddModList;
RSRP_Range_t *rsrp = NULL;
struct MeasConfig__speedStatePars *Sparams = NULL;
QuantityConfig_t *quantityConfig = NULL;
CellsToAddMod_t *CellToAdd = NULL;
CellsToAddModList_t *CellsToAddModList = NULL;
struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
DedicatedInfoNAS_t *dedicatedInfoNas;
DedicatedInfoNAS_t *dedicatedInfoNas = NULL;
C_RNTI_t *cba_RNTI = NULL;
C_RNTI_t *cba_RNTI = NULL;
#ifdef CBA
//struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola;
uint8_t *cba_RNTI_buf;
......@@ -1299,9 +1299,9 @@ void check_handovers(
"[eNB %d] Frame %d: handover Command received for new UE_idx %d current eNB %d target eNB: %d \n",
enb_mod_idP, frameP, i, enb_mod_idP, eNB_rrc_inst[enb_mod_idP].handover_info[i]->modid_t);
//rrc_eNB_process_handoverPreparationInformation(enb_mod_idP,frameP,i);
result = pdcp_data_req(enb_mod_idP, i, frameP, 1,
result = pdcp_data_req(enb_mod_idP, i, frameP, ENB_FLAG_YES, SRB_FLAG_YES,
DCCH,
rrc_eNB_mui++, 0,
rrc_eNB_mui++, FALSE,
eNB_rrc_inst[enb_mod_idP].handover_info[i]->size,
eNB_rrc_inst[enb_mod_idP].handover_info[i]->buf, 1);
AssertFatal(result == TRUE, "PDCP data request failed!\n");
......@@ -2239,7 +2239,7 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete(
#endif
// Refresh SRBs/DRBs
rrc_pdcp_config_asn1_req(enb_mod_idP, ue_mod_idP, frameP, 1,
rrc_pdcp_config_asn1_req(enb_mod_idP, ue_mod_idP, frameP, ENB_FLAG_YES,
SRB_configList,
DRB_configList, (DRB_ToReleaseList_t *) NULL,
eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[ue_mod_idP] |
......@@ -2283,9 +2283,10 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete(
// can mean also IPV6 since ether -> ipv6 autoconf
# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO)
LOG_I(OIP, "[eNB %d] trying to bring up the OAI interface oai%d\n", enb_mod_idP, enb_mod_idP);
oip_ifup = nas_config(enb_mod_idP, // interface index
enb_mod_idP + 1, // thrid octet
enb_mod_idP + 1); // fourth octet
oip_ifup = nas_config(
enb_mod_idP, // interface index
enb_mod_idP + 1, // thrid octet
enb_mod_idP + 1); // fourth octet
if (oip_ifup == 0) { // interface is up --> send a config the DRB
# ifdef OAI_EMU
......@@ -2295,15 +2296,16 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete(
dest_ip_offset = 8;
# endif
LOG_I(OIP,
"[eNB %d] Config the oai%d to send/receive pkt on DRB %d to/from the protocol stack\n",
enb_mod_idP, enb_mod_idP,
(ue_mod_idP * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity);
"[eNB %d] Config the oai%d to send/receive pkt on DRB %d to/from the protocol stack\n",
enb_mod_idP, enb_mod_idP,
(ue_mod_idP * maxDRB) + DRB_configList->list.array[i]->drb_Identity);
rb_conf_ipv4(0, //add
ue_mod_idP, //cx
enb_mod_idP, //inst
(ue_mod_idP * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity, 0, //dscp
ipv4_address(enb_mod_idP + 1, enb_mod_idP + 1), //saddr
ipv4_address(enb_mod_idP + 1, dest_ip_offset + ue_mod_idP + 1)); //daddr
ue_mod_idP, //cx
enb_mod_idP, //inst
(ue_mod_idP * maxDRB) + DRB_configList->list.array[i]->drb_Identity,
0, //dscp
ipv4_address(enb_mod_idP + 1, enb_mod_idP + 1), //saddr
ipv4_address(enb_mod_idP + 1, dest_ip_offset + ue_mod_idP + 1)); //daddr
LOG_D(RRC, "[eNB %d] State = Attached (UE %d)\n", enb_mod_idP, ue_mod_idP);
}
......@@ -2319,18 +2321,22 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete(
frameP, enb_mod_idP, ue_mod_idP, enb_mod_idP);
if (DRB_configList->list.array[i]->logicalChannelIdentity)
DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity;
rrc_mac_config_req(enb_mod_idP, ENB_FLAG_YES, ue_mod_idP, 0,
(RadioResourceConfigCommonSIB_t *) NULL,
eNB_rrc_inst[enb_mod_idP].physicalConfigDedicated[ue_mod_idP],
(MeasObjectToAddMod_t **) NULL,
eNB_rrc_inst[enb_mod_idP].mac_MainConfig[ue_mod_idP],
DRB2LCHAN[i],
DRB_configList->list.array[i]->logicalChannelConfig,
eNB_rrc_inst[enb_mod_idP].measGapConfig[ue_mod_idP],
(TDD_Config_t *) NULL,
NULL,
(uint8_t *) NULL,
(uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL
rrc_mac_config_req(
enb_mod_idP,
ENB_FLAG_YES,
ue_mod_idP,
0,
(RadioResourceConfigCommonSIB_t *) NULL,
eNB_rrc_inst[enb_mod_idP].physicalConfigDedicated[ue_mod_idP],
(MeasObjectToAddMod_t **) NULL,
eNB_rrc_inst[enb_mod_idP].mac_MainConfig[ue_mod_idP],
DRB2LCHAN[i],
DRB_configList->list.array[i]->logicalChannelConfig,
eNB_rrc_inst[enb_mod_idP].measGapConfig[ue_mod_idP],
(TDD_Config_t *) NULL,
NULL,
(uint8_t *) NULL,
(uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL
#ifdef Rel10
, 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL
#endif
......@@ -2346,8 +2352,8 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete(
/* rrc_pdcp_config_req (enb_mod_idP, frameP, 1, CONFIG_ACTION_REMOVE,
(ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE);
*/
rrc_rlc_config_req(enb_mod_idP, ue_mod_idP, frameP, 1, CONFIG_ACTION_REMOVE,
DRB2LCHAN[i], RADIO_ACCESS_BEARER, Rlc_info_um);
rrc_rlc_config_req(enb_mod_idP, ue_mod_idP, frameP, ENB_FLAG_YES, SRB_FLAG_NO, MBMS_FLAG_NO, CONFIG_ACTION_REMOVE,
DRB2LCHAN[i], Rlc_info_um);
}
eNB_rrc_inst[enb_mod_idP].DRB_active[ue_mod_idP][i] = 0;
LOG_D(RRC,
......
......@@ -48,7 +48,7 @@ OMG_OBJS += $(OMG_DIR)/job.o
OMG_OBJS += $(OMG_DIR)/static.o
OMG_OBJS += $(OMG_DIR)/rwp.o
OMG_OBJS += $(OMG_DIR)/rwalk.o
OMG_OBJS += $(OMG_DIR)/hashtable.o
OMG_OBJS += $(OMG_DIR)/omg_hashtable.o
OMG_OBJS += $(OMG_DIR)/mobility_parser.o
OMG_OBJS += $(OMG_DIR)/trace.o
OMG_OBJS += $(OMG_DIR)/sumo.o
......
......@@ -3,10 +3,10 @@ CC= gcc
OBJstatic = omg.c common.c static.c
OBJrwp = omg.c common.c job.c rwp.c
OBJrwalk = omg.c common.c job.c rwalk.c
OBJtrace = omg.c common.c job.c trace.c mobility_parser.c hashtable.c
OBJtrace = omg.c common.c job.c trace.c mobility_parser.c omg_hashtable.c
OBJsumo = omg.c common.c sumo.c client_traci_OMG.c socket_traci_OMG.c storage_traci_OMG.c id_manager.c
OBJ = omg.c common.c static.c job.c rwp.c rwalk.c trace.c sumo.c mobility_parser.c hashtable.c client_traci_OMG.c socket_traci_OMG.c storage_traci_OMG.c id_manager.c
OBJ = omg.c common.c static.c job.c rwp.c rwalk.c trace.c sumo.c mobility_parser.c omg_hashtable.c client_traci_OMG.c socket_traci_OMG.c storage_traci_OMG.c id_manager.c
CFLAGS += -DSTANDALONE -DUSER_MODE
......
......@@ -42,12 +42,12 @@
#include <string.h>
#include <stdlib.h>
#include "mobility_parser.h"
#include "hashtable.h"
#include "omg_hashtable.h"
#include "omg.h"
node_info* head_node_info =NULL;
hash_table_t* table=NULL;
omg_hash_table_t* table=NULL;
//need to be removed , used only once (old code)
struct Exnode* gen_list(){
......@@ -186,7 +186,7 @@ void print_list(struct Exnode* head){
head=head->next;
}
Exnode* get_next_position(hash_table_t *table,int node_id){
Exnode* get_next_position(omg_hash_table_t *table,int node_id){
node_info* head_node=head_node_info;
while(head_node->next!=NULL){
......@@ -233,7 +233,7 @@ Exnode* get_next_position(hash_table_t *table,int node_id){
}
void reset_visit_status(hash_table_t *table,float time, int node_id){
void reset_visit_status(omg_hash_table_t *table,float time, int node_id){
node_info* head_node=head_node_info;
while(head_node->next!=NULL){
......@@ -280,7 +280,7 @@ int get_num_nodes(){
}
return count;
}
void sort_veh_movement(hash_table_t *table){
void sort_veh_movement(omg_hash_table_t *table){
node_info* head_node=head_node_info;
while(head_node->next!=NULL){
int *value1 = NULL;
......@@ -401,7 +401,7 @@ int main(){
Exnode* next_loc=NULL;
//mobility_file = (char*) malloc(256);
//mobility_file=strtok("regular.tr");
hash_table_t *table=read_mobility_file();
omg_hash_table_t *table=read_mobility_file();
sort_veh_movement(table);
printf("Number of nodes --> %d \n",get_num_nodes());
next_loc=get_next_position(table,140392);
......
......@@ -41,7 +41,7 @@
#ifndef MOBILITY_PARSER_H_
#define MOBILITY_PARSER_H_
#include "hashtable.h"
#include "omg_hashtable.h"
/**
* @struct Simple struct to hold only few information
......@@ -120,7 +120,7 @@ int get_num_nodes();
* @param ending pointer of the vehicles linked list
*/
void sort_veh_movement(hash_table_t *table);
void sort_veh_movement(omg_hash_table_t *table);
void quicksortlist(Exnode *pLeft, Exnode *pRight);
/**
......@@ -129,9 +129,9 @@ void quicksortlist(Exnode *pLeft, Exnode *pRight);
* @param hashtable from which the node is to be looked
* @param node_id is the nodes whose next location need to be retrieved from the linked list
*/
Exnode* get_next_position(hash_table_t *table,int node_id);
Exnode* get_next_position(omg_hash_table_t *table,int node_id);
void reset_visit_status(hash_table_t *table, float time, int node_id);
void reset_visit_status(omg_hash_table_t *table, float time, int node_id);
void clear_llist();
......
......@@ -27,7 +27,7 @@
*******************************************************************************/
/*! \file hashtable.c
/*! \file omg_hashtable.c
* \brief A 'C' implementation of a hashtable
* \author S. Uppoor
* \date 2011
......@@ -39,7 +39,7 @@
*/
#include "hashtable.h"
#include "omg_hashtable.h"
#include <stdlib.h>
#include <string.h>
......@@ -62,7 +62,7 @@ hash_table_element_t * hash_table_element_new()
* @param table table from which element has to be deleted
* @param element hash table element to be deleted
*/
void hash_table_element_delete(hash_table_t * table, hash_table_element_t * element)
void hash_table_element_delete(omg_hash_table_t * table, hash_table_element_t * element)
{
//INFO("Deleting an hash table element");
if (table->mode == MODE_COPY)
......@@ -81,13 +81,13 @@ void hash_table_element_delete(hash_table_t * table, hash_table_element_t * elem
/**
* Fuction to create a new hash table
* @param mode hash_table_mode which the hash table should follow
* @returns hash_table_t object which references the hash table
* @returns omg_hash_table_t object which references the hash table
* @returns NULL when no memory
*/
hash_table_t * hash_table_new(hash_table_mode_t mode)
omg_hash_table_t * hash_table_new(hash_table_mode_t mode)
{
//INFO("Creating a new hash table");
hash_table_t *table = calloc(1, hash_table_s);
omg_hash_table_t *table = calloc(1, SIZEOF_HASH_TABLE);
if (!table)
{
//INFO("No Memory while allocating hash_table");
......@@ -110,7 +110,7 @@ hash_table_t * hash_table_new(hash_table_mode_t mode)
* Function to delete the hash table
* @param table hash table to be deleted
*/
void hash_table_delete(hash_table_t * table)
void hash_table_delete(omg_hash_table_t * table)
{
//INFO("Deleating a hash table");
size_t i=0;
......@@ -137,7 +137,7 @@ void hash_table_delete(hash_table_t * table)
* @returns 0 on sucess
* @returns -1 when no memory
*/
int hash_table_add(hash_table_t * table, void * key, size_t key_len, void * value, size_t value_len)
int hash_table_add(omg_hash_table_t * table, void * key, size_t key_len, void * value, size_t value_len)
{
if ((table->key_count / table->key_num) >= table->key_ratio)
{
......@@ -252,7 +252,7 @@ int hash_table_add(hash_table_t * table, void * key, size_t key_len, void * valu
* @returns 0 on sucess
* @returns -1 when key is not found
*/
int hash_table_remove(hash_table_t * table, void * key, size_t key_len)
int hash_table_remove(omg_hash_table_t * table, void * key, size_t key_len)
{
//INFO("Deleting a key-value pair from the hash table");
if ((table->key_num/ table->key_count) >= table->key_ratio)
......@@ -309,7 +309,7 @@ int hash_table_remove(hash_table_t * table, void * key, size_t key_len)
* @returns NULL when key is not found in the hash table
* @returns void* pointer to the value in the table
*/
void * hash_table_lookup(hash_table_t * table, void * key, size_t key_len)
void * hash_table_lookup(omg_hash_table_t * table, void * key, size_t key_len)
{
size_t hash = HASH(key, key_len);
//LOG("Looking up a key-value pair for hash -> %d", (int)hash);
......@@ -349,7 +349,7 @@ void * hash_table_lookup(hash_table_t * table, void * key, size_t key_len)
* @returns 0 when key is not found
* @returns 1 when key is found
*/
int hash_table_has_key(hash_table_t * table, void * key, size_t key_len)
int hash_table_has_key(omg_hash_table_t * table, void * key, size_t key_len)
{
size_t hash = HASH(key, key_len);
//LOG("Searching for key with hash -> %d", (int)hash);
......@@ -385,7 +385,7 @@ int hash_table_has_key(hash_table_t * table, void * key, size_t key_len)
* @param keys a void** pointer where keys are filled in (memory allocated internally and must be freed)
* @return total number of keys filled in keys
*/
size_t hash_table_get_keys(hash_table_t * table, void ** keys)
size_t hash_table_get_keys(omg_hash_table_t * table, void ** keys)
{
size_t i = 0;
size_t count = 0;
......@@ -422,7 +422,7 @@ size_t hash_table_get_keys(hash_table_t * table, void ** keys)
* @returns 1 when no memory
* @returns count of elements
*/
size_t hash_table_get_elements(hash_table_t * table, hash_table_element_t *** elements)
size_t hash_table_get_elements(omg_hash_table_t * table, hash_table_element_t *** elements)
{
size_t i = 0;
size_t count = 0;
......@@ -486,7 +486,7 @@ uint16_t hash_table_do_hash(void * key, size_t key_len, uint16_t max_key)
* @returns -2 when no emmory for new store house
* @returns 0 when sucess
*/
int hash_table_resize(hash_table_t *table, size_t len)
int hash_table_resize(omg_hash_table_t *table, size_t len)
{
//LOG("resizing hash table from %d to %d", table->key_num, len);
hash_table_element_t ** elements;
......
......@@ -27,7 +27,7 @@
*******************************************************************************/
/*! \file hashtable.h
/*! \file omg_hashtable.h
* \brief A 'C' implementation of a hashtable
* \author S. Uppoor
* \date 2011
......@@ -95,7 +95,7 @@ typedef enum hash_table_mode{
* @struct hash_table "hashtable.h"
* @brief identifies the hashtable for which operations are to be performed
*/
typedef struct hash_table
typedef struct omg_hash_table_s
{
/**
* the hash table array where all values are stored
......@@ -122,8 +122,8 @@ typedef struct hash_table
*/
size_t key_ratio;
} hash_table_t;
#define hash_table_s sizeof(hash_table_t)
} omg_hash_table_t;
#define SIZEOF_HASH_TABLE sizeof(omg_hash_table_t)
// element operations
......@@ -139,7 +139,7 @@ hash_table_element_t * hash_table_element_new();
* @param table table from which element has to be deleted
* @param element hash table element to be deleted
*/
void hash_table_element_delete(hash_table_t *, hash_table_element_t *);
void hash_table_element_delete(omg_hash_table_t *, hash_table_element_t *);
/**
* Function that returns a hash value for a given key and key_len
......@@ -154,16 +154,16 @@ uint16_t hash_table_do_hash(void * key, size_t key_len, uint16_t max_key);
/**
* Fuction to create a new hash table
* @param mode hash_table_mode which the hash table should follow
* @returns hash_table_t object which references the hash table
* @returns omg_hash_table_t object which references the hash table
* @returns NULL when no memory
*/
hash_table_t * hash_table_new(hash_table_mode_t);
omg_hash_table_t * hash_table_new(hash_table_mode_t);
/**
* Function to delete the hash table
* @param table hash table to be deleted
*/
void hash_table_delete(hash_table_t *);
void hash_table_delete(omg_hash_table_t *);
/**
* macro to add a key - value pair to the hash table
......@@ -186,7 +186,7 @@ void hash_table_delete(hash_table_t *);
* @returns 0 on sucess
* @returns -1 when no memory
*/
int hash_table_add(hash_table_t *, void *, size_t, void *, size_t);
int hash_table_add(omg_hash_table_t *, void *, size_t, void *, size_t);
/**
* macro to remove an hash table element (for a given key) from a given hash table
......@@ -206,7 +206,7 @@ int hash_table_add(hash_table_t *, void *, size_t, void *, size_t);
* @returns 0 on sucess
* @returns -1 when key is not found
*/
int hash_table_remove(hash_table_t *, void *, size_t);
int hash_table_remove(omg_hash_table_t *, void *, size_t);
/**
* macro to lookup a key in a particular table
......@@ -226,7 +226,7 @@ int hash_table_remove(hash_table_t *, void *, size_t);
* @returns NULL when key is not found in the hash table
* @returns void* pointer to the value in the table
*/
void * hash_table_lookup(hash_table_t *, void *, size_t);
void * hash_table_lookup(omg_hash_table_t *, void *, size_t);
/**
* macro to look if the exists in the hash table
......@@ -244,7 +244,7 @@ void * hash_table_lookup(hash_table_t *, void *, size_t);
* @returns 0 when key is not found
* @returns 1 when key is found
*/
int hash_table_has_key(hash_table_t *, void *, size_t);
int hash_table_has_key(omg_hash_table_t *, void *, size_t);
/**
* Function to return all the keys in a given hash table
......@@ -252,7 +252,7 @@ int hash_table_has_key(hash_table_t *, void *, size_t);
* @param keys a void** pointer where keys are filled in (memory allocated internally and must be freed)
* @return total number of keys filled in keys
*/
size_t hash_table_get_keys(hash_table_t *, void **);
size_t hash_table_get_keys(omg_hash_table_t *, void **);
/**
* Function to get all elements (key - value pairs) from the given hash table
......@@ -261,7 +261,7 @@ size_t hash_table_get_keys(hash_table_t *, void **);
* @returns 1 when no memory
* @returns count of elements
*/
size_t hash_table_get_elements(hash_table_t *, hash_table_element_t *** );
size_t hash_table_get_elements(omg_hash_table_t *, hash_table_element_t *** );
/**
* Function to resize the hash table store house
......@@ -271,5 +271,5 @@ size_t hash_table_get_elements(hash_table_t *, hash_table_element_t *** );
* @returns -2 when no emmory for new store house
* @returns 0 when sucess
*/
int hash_table_resize(hash_table_t *, size_t);
int hash_table_resize(omg_hash_table_t *, size_t);
#endif
......@@ -38,6 +38,12 @@ include $(OPENAIR2_DIR)/NAS/Makefile.inc
ifdef USE_MME
COMMON_CFLAGS += -DENABLE_USE_MME
ENABLE_ITTI = 1
ifdef LINK_PDCP_TO_GTPV1U
COMMON_CFLAGS += -DLINK_PDCP_TO_GTPV1U
# COMMON_CFLAGS += -I$(UDP_DIR)
# COMMON_CFLAGS += -I$(GTPV1U_DIR)
# COMMON_CFLAGS += -I$(GTPV1U_DIR)/nw-gtpv1u/shared
endif
endif
ifdef ENABLE_ITTI
......@@ -75,7 +81,7 @@ export UENAS_CFLAGS
$(UE_NAS_OBJ_DIR)/libuenas.a: force_look
@$(MAKE) -C $(UE_NAS_DIR) -f Makefile.UE $(UE_NAS_OBJ_DIR)/libuenas.a OUTDIR=$(UE_NAS_OBJ_DIR)
COMMON_MME_CFLAGS = -I$(SCTP_DIR)
COMMON_MME_CFLAGS = -I$(SCTP_DIR)
COMMON_MME_CFLAGS += -I$(S1AP_DIR)
COMMON_MME_CFLAGS += -I$(UDP_DIR)
COMMON_MME_CFLAGS += -I$(GTPV1U_DIR)
......@@ -93,15 +99,28 @@ UDP_CFLAGS += $(UTIL_incl)
UDP_CFLAGS += -I$(OPENAIR_HOME)/openair2/ENB_APP
export UDP_CFLAGS
GTPV1U_CFLAGS = $(COMMON_CFLAGS) $(COMMON_MME_CFLAGS)
GTPV1U_CFLAGS += -DENB_MODE
GTPV1U_CFLAGS += -I$(TOP_DIR)
GTPV1U_CFLAGS += -I$(GTPV1U_DIR)/nw-gtpv1u/include
GTPV1U_CFLAGS += -I$(GTPV1U_DIR)/nw-gtpv1u/shared
GTPV1U_CFLAGS += -I$(OPENAIR_HOME)/openair2/ENB_APP
GTPV1U_CFLAGS += $(UTIL_incl) -I$(OPENAIRCN_DIR)/UTILS
GTPV1U_CFLAGS = $(COMMON_CFLAGS) $(COMMON_MME_CFLAGS)
GTPV1U_CFLAGS += -DENB_MODE
GTPV1U_CFLAGS += -I$(TOP_DIR)
GTPV1U_CFLAGS += -I$(GTPV1U_DIR)/nw-gtpv1u/include
GTPV1U_CFLAGS += -I$(GTPV1U_DIR)/nw-gtpv1u/shared
GTPV1U_CFLAGS += -I$(OPENAIR_HOME)/openair2/ENB_APP
GTPV1U_CFLAGS += $(UTIL_incl) -I$(OPENAIRCN_DIR)/UTILS
export GTPV1U_CFLAGS
GTPV1U_ENB_CFLAGS = $(COMMON_CFLAGS)
GTPV1U_ENB_CFLAGS += $(OPENAIR_HOME)/openair2/COMMON
GTPV1U_ENB_CFLAGS += -I$(S1AP_DIR)
GTPV1U_ENB_CFLAGS += -I$(UDP_DIR)
GTPV1U_ENB_CFLAGS += -I$(GTPV1U_DIR)
GTPV1U_ENB_CFLAGS += -DENB_MODE
GTPV1U_ENB_CFLAGS += -I$(TOP_DIR)
GTPV1U_ENB_CFLAGS += -I$(GTPV1U_DIR)/nw-gtpv1u/include
GTPV1U_ENB_CFLAGS += -I$(GTPV1U_DIR)/nw-gtpv1u/shared
GTPV1U_ENB_CFLAGS += -I$(OPENAIR_HOME)/openair2/ENB_APP
GTPV1U_ENB_CFLAGS += $(UTIL_incl) -I$(OPENAIRCN_DIR)/UTILS
export GTPV1U_ENB_CFLAGS
$(S1AP_OBJ_DIR)/libs1ap.a: force_look
@$(MAKE) -C $(S1AP_DIR) -f Makefile.eNB $(S1AP_OBJ_DIR)/libs1ap.a OUTDIR=$(S1AP_OBJ_DIR)
$(SCTP_OBJ_DIR)/libsctp.a: force_look
......
......@@ -217,6 +217,7 @@ INCLUDES += $(ENB_APP_incl)
INCLUDES += $(UTIL_incl)
INCLUDES += $(UTILS_incl)
INCLUDES += -I$(ASN1_MSG_INC)
INCLUDES += -I$(COMMON_UTILS_DIR)/collection
SIMULATION_OBJS = $(TOP_DIR)/SIMULATION/TOOLS/gauss.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/random_channel.o
......
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