From f6e664af4cf9a42aabb8ac6c760f8131a29d8442 Mon Sep 17 00:00:00 2001 From: Lionel Gauthier <lionel.gauthier@eurecom.fr> Date: Wed, 3 Jul 2013 16:11:31 +0000 Subject: [PATCH] Modified ETHERNET DRIVER: deleted the classifier, classification is done by marking. Changed netlink reading code in pdcp_fifo.c git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4007 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- .../SIMULATION/ETH_TRANSPORT/netlink_init.c | 84 +- openair2/COMMON/platform_constants.h | 21 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 27 +- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 460 ++- .../AM_v9.3.0/rlc_am_timer_status_prohibit.c | 91 +- openair2/LAYER2/RLC/rlc.h | 1 - openair2/LAYER2/RLC/rlc_rrc.c | 8 +- openair2/Makefile | 2 +- openair2/NAS/DRIVER/LITE/Makefile | 74 +- openair2/NAS/DRIVER/LITE/classifier.c | 866 ------ openair2/NAS/DRIVER/LITE/common.c | 722 ++--- openair2/NAS/DRIVER/LITE/device.c | 25 +- openair2/NAS/DRIVER/LITE/ioctl.c | 535 +--- openair2/NAS/DRIVER/LITE/local.h | 57 +- openair2/NAS/DRIVER/LITE/proto_extern.h | 131 +- openair2/NAS/DRIVER/LITE/tool.c | 115 +- openair2/NAS/DRIVER/MESH/Makefile | 2 +- openair2/NAS/DRIVER/MESH/netlink.c | 1 + openair2/RRC/LITE/rrc_eNB.c | 2523 +++++++++-------- openair2/UTIL/LOG/log.c | 40 +- targets/PROJECTS/MEDIEVAL/Makefile | 11 +- targets/SIMU/USER/oaisim_config.c | 10 +- 22 files changed, 2126 insertions(+), 3680 deletions(-) diff --git a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c index afb05f4b8..be4dd2db2 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c @@ -16,12 +16,19 @@ #include <unistd.h> #include <sys/types.h> #include <fcntl.h> -#define MAX_PAYLOAD 4096 /* this sould cover the max mtu size*/ +#include <errno.h> +#include "platform_constants.h" + +char nl_rx_buf[NL_MAX_PAYLOAD]; + struct sockaddr_nl nas_src_addr, nas_dest_addr; -struct nlmsghdr *nas_nlh = NULL; -struct iovec nas_iov; +struct nlmsghdr *nas_nlh_tx = NULL; +struct nlmsghdr *nas_nlh_rx = NULL; +struct iovec nas_iov_tx; +struct iovec nas_iov_rx = {nl_rx_buf, sizeof(nl_rx_buf)}; int nas_sock_fd; -struct msghdr nas_msg; +struct msghdr nas_msg_tx; +struct msghdr nas_msg_rx; #define GRAAL_NETLINK_ID 31 @@ -39,36 +46,57 @@ int netlink_init(void) ret = fcntl(nas_sock_fd,F_SETFL,O_NONBLOCK); printf("[NETLINK] fcntl returns %d\n",ret); - memset(&nas_src_addr, 0, sizeof(nas_src_addr)); - nas_src_addr.nl_family = AF_NETLINK; - nas_src_addr.nl_pid = 1;//getpid(); /* self pid */ - nas_src_addr.nl_groups = 0; /* not in mcast groups */ - ret = bind(nas_sock_fd, (struct sockaddr *)&nas_src_addr, - sizeof(nas_src_addr)); + + nas_sock_fd = socket(PF_NETLINK, SOCK_RAW,GRAAL_NETLINK_ID); + if (nas_sock_fd==-1) { + printf("[NETLINK] Error opening socket %d (%d:%s)\n",nas_sock_fd,errno, strerror(errno)); + exit(1); + } + printf("[NETLINK]Opened socket with fd %d\n",nas_sock_fd); + printf("[NETLINK] bind returns %d\n",ret); + if (ret == -1) { + printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno)); + exit(1); + } - memset(&nas_dest_addr, 0, sizeof(nas_dest_addr)); - nas_dest_addr.nl_family = AF_NETLINK; - nas_dest_addr.nl_pid = 0; /* For Linux Kernel */ - nas_dest_addr.nl_groups = 0; /* unicast */ + memset(&nas_src_addr, 0, sizeof(nas_src_addr)); + nas_src_addr.nl_family = AF_NETLINK; + nas_src_addr.nl_pid = 1;//getpid(); /* self pid */ + nas_src_addr.nl_groups = 0; /* not in mcast groups */ + ret = bind(nas_sock_fd, (struct sockaddr*)&nas_src_addr, sizeof(nas_src_addr)); - nas_nlh=(struct nlmsghdr *)malloc(NLMSG_SPACE(MAX_PAYLOAD)); - /* Fill the netlink message header */ - nas_nlh->nlmsg_len = NLMSG_SPACE(MAX_PAYLOAD); - nas_nlh->nlmsg_pid = 1;//getpid(); /* self pid */ - nas_nlh->nlmsg_flags = 0; - nas_iov.iov_base = (void *)nas_nlh; - nas_iov.iov_len = nas_nlh->nlmsg_len; - memset(&nas_msg,0,sizeof(nas_msg)); - nas_msg.msg_name = (void *)&nas_dest_addr; - nas_msg.msg_namelen = sizeof(nas_dest_addr); - nas_msg.msg_iov = &nas_iov; - nas_msg.msg_iovlen = 1; - /* Read message from kernel */ - memset(nas_nlh, 0, NLMSG_SPACE(MAX_PAYLOAD)); + memset(&nas_dest_addr, 0, sizeof(nas_dest_addr)); + nas_dest_addr.nl_family = AF_NETLINK; + nas_dest_addr.nl_pid = 0; /* For Linux Kernel */ + nas_dest_addr.nl_groups = 0; /* unicast */ + + // TX PART + nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD)); + memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD)); + /* Fill the netlink message header */ + nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD); + nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */ + nas_nlh_tx->nlmsg_flags = 0; + + nas_iov_tx.iov_base = (void *)nas_nlh_tx; + nas_iov_tx.iov_len = nas_nlh_tx->nlmsg_len; + memset(&nas_msg_tx,0,sizeof(nas_msg_tx)); + nas_msg_tx.msg_name = (void *)&nas_dest_addr; + nas_msg_tx.msg_namelen = sizeof(nas_dest_addr); + nas_msg_tx.msg_iov = &nas_iov_tx; + nas_msg_tx.msg_iovlen = 1; + + + // RX PART + memset(&nas_msg_rx,0,sizeof(nas_msg_rx)); + nas_msg_rx.msg_name = (void *)&nas_src_addr; + nas_msg_rx.msg_namelen = sizeof(nas_src_addr); + nas_msg_rx.msg_iov = &nas_iov_rx; + nas_msg_rx.msg_iovlen = 1; return(nas_sock_fd); } diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index 456b97c42..d444719e9 100755 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -12,14 +12,16 @@ #ifndef __PLATFORM_CONSTANTS_H__ # define __PLATFORM_CONSTANTS_H__ +#define NL_MAX_PAYLOAD 4096 /* this should cover the max mtu size*/ + #ifdef USER_MODE -#ifdef LARGE_SCALE +#ifdef LARGE_SCALE # define NB_MODULES_MAX 128 # define NB_NODE_MAX 128 #else # define NB_MODULES_MAX 32 # define NB_NODE_MAX 32 -#endif +#endif #else # define NB_MODULES_MAX 1 # define NB_NODE_MAX 1 @@ -31,22 +33,23 @@ #else # define MAX_IP_PACKET_SIZE 1500 #endif -// overwrite the previous deinitions +// overwrite the previous deinitions # define MAX_MODULES NB_MODULES_MAX -#ifdef LARGE_SCALE +#ifdef LARGE_SCALE # define MAX_MOBILES_PER_RG 128 # define MAX_RG 2 -#else +#else # define MAX_MOBILES_PER_RG 16 # define MAX_RG 2 #endif # define MAX_MANAGED_RG_PER_MOBILE 2 +# define DEFAULT_RAB_ID 3 # define NB_RB_MAX 11 -# define NB_RAB_MAX 8 // 4 +# define NB_RAB_MAX 8 // 4 # define RAB_SHIFT1 9 # define RAB_SHIFT2 3 # define RAB_OFFSET 0x0007 @@ -54,8 +57,8 @@ # define RAB_OFFSET2 0x01F8 # define DIR_OFFSET 0x8000 # define DIR_SHIFT 15 -# define CH_OFFSET 0x0004 -# define CH_SHIFT 2 +# define CH_OFFSET 0x0004 +# define CH_SHIFT 2 #ifdef MESH # define MAX_RB_MOBILE NB_RB_MAX * ( MAX_MANAGED_RG_PER_MOBILE + MAX_MOBILES_PER_RG - 1 ) @@ -111,7 +114,7 @@ # define DELIVERY_OF_ERRONEOUS_SDU_NO_DETECT 2 -// CBA constant +// CBA constant #define NUM_MAX_CBA_GROUP 4 # ifndef __cplusplus diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 77ae06976..49215f9a1 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -72,6 +72,7 @@ #endif //NON_ACCESS_STRATUM //----------------------------------------------------------------------------- #include "COMMON/platform_constants.h" +#include "COMMON/platform_types.h" #include "DRB-ToAddMod.h" #include "DRB-ToAddModList.h" #include "SRB-ToAddMod.h" @@ -97,15 +98,15 @@ public_pdcp(unsigned int Pdcp_stats_rx_rate[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MA typedef struct pdcp_t { BOOL instanciated_instance; u16 header_compression_profile; - + u8 cipheringAlgorithm; u8 integrityProtAlgorithm; - - u8 rlc_mode; + + u8 rlc_mode; u8 status_report; u8 seq_num_size; - u8 lcid; + u8 lcid; /* * Sequence number state variables * @@ -138,12 +139,12 @@ typedef struct pdcp_t { typedef struct pdcp_mbms_t { BOOL instanciated_instance; - - uint16_t service_id; + + uint16_t service_id; uint32_t session_id; // lcid - uint16_t rb_id; - + uint16_t rb_id; + } pdcp_mbms_t; /* * Following symbolic constant alters the behaviour of PDCP @@ -196,11 +197,11 @@ public_pdcp(BOOL pdcp_data_ind (module_id_t module_id, u32_t frame, u8_t eNB_fla * \param[in] frame Frame number * \param[in] Shows if relevant PDCP entity is part of an eNB or a UE * \param[in] rab_id Radio Bearer ID -* \param[in] muiP +* \param[in] muiP * \param[in] confirmP * \param[in] sdu_buffer_size Size of incoming SDU in bytes * \param[in] sdu_buffer Buffer carrying SDU -* \param[in] mode flag to indicate whether the userplane data belong to the control plane or data plane or transparent +* \param[in] mode flag to indicate whether the userplane data belong to the control plane or data plane or transparent * \return TRUE on success, FALSE otherwise * \note None * @ingroup _pdcp @@ -228,14 +229,14 @@ public_pdcp(BOOL pdcp_data_ind (module_id_t module_id, u32_t frame, u8_t eNB_fla /*! \fn void rrc_pdcp_config_req(module_id_t, rb_id_t,u8) * \brief This functions initializes relevant PDCP entity * \param[in] module_id Module ID of relevant PDCP entity -* \param[in] frame frame counter (TTI) +* \param[in] frame frame counter (TTI) * \param[in] eNB_flag flag indicating the node type * \param[in] action flag for action: add, remove , modify * \param[in] rab_id Radio Bearer ID of relevant PDCP entity * \return none * \note None * @ingroup _pdcp -*/ +*/ public_pdcp(void rrc_pdcp_config_req (module_id_t module_id, u32 frame, u8_t eNB_flag, u32 action, rb_id_t rab_id, u8 security_mode);) @@ -322,7 +323,7 @@ typedef struct pdcp_data_ind_header_t { #if 0 /* - * Missing PDU information struct, a copy of this will be enqueued + * Missing PDU information struct, a copy of this will be enqueued * into pdcp.missing_pdus for every missing PDU */ typedef struct pdcp_missing_pdu_info_t { diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index bff2add21..ed5327510 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -28,7 +28,7 @@ *******************************************************************************/ /*! \file pdcp_fifo.c -* \brief pdcp interface with linux IP interface +* \brief pdcp interface with linux IP interface, have a look at http://man7.org/linux/man-pages/man7/netlink.7.html for netlink * \author Lionel GAUTHIER and Navid Nikaein * \date 2009 * \version 0.5 @@ -65,21 +65,27 @@ extern int otg_enabled; #include "UTIL/OCG/OCG_extern.h" #include "UTIL/LOG/log.h" #include "UTIL/FIFO/pad_list.h" +#include "platform_constants.h" + #ifdef NAS_NETLINK #include <sys/socket.h> #include <linux/netlink.h> +extern char nl_rx_buf[NL_MAX_PAYLOAD]; extern struct sockaddr_nl nas_src_addr, nas_dest_addr; -extern struct nlmsghdr *nas_nlh; -extern struct iovec nas_iov; +extern struct nlmsghdr *nas_nlh_tx; +extern struct nlmsghdr *nas_nlh_rx; +extern struct iovec nas_iov_tx; +extern struct iovec nas_iov_rx; extern int nas_sock_fd; -extern struct msghdr nas_msg; +extern struct msghdr nas_msg_tx; +extern struct msghdr nas_msg_rx; #define MAX_PAYLOAD 1600 unsigned char pdcp_read_state = 0; -unsigned char pdcp_read_payload[MAX_PAYLOAD]; +//unsigned char pdcp_read_payload[MAX_PAYLOAD]; #endif extern Packet_OTG_List *otg_pdcp_buffer; @@ -98,11 +104,11 @@ int u8 cont = 1; int ret; int mcs_inst; - + while (sdu && cont) { #if defined(OAI_EMU) - mcs_inst = ((pdcp_data_ind_header_t *)(sdu->data))->inst; + mcs_inst = ((pdcp_data_ind_header_t *)(sdu->data))->inst; // asjust the instance id when passing sdu to IP ((pdcp_data_ind_header_t *)(sdu->data))->inst = (((pdcp_data_ind_header_t *)(sdu->data))->inst >= NB_eNB_INST) ? ((pdcp_data_ind_header_t *)(sdu->data))->inst - NB_eNB_INST +oai_emulation.info.nb_enb_local - oai_emulation.info.first_ue_local :// UE @@ -132,9 +138,9 @@ int #else #ifdef NAS_NETLINK #ifdef LINUX - memcpy(NLMSG_DATA(nas_nlh), &(((u8 *) sdu->data)[sizeof (pdcp_data_ind_header_t) - pdcp_output_header_bytes_to_write]), + memcpy(NLMSG_DATA(nas_nlh_tx), &(((u8 *) sdu->data)[sizeof (pdcp_data_ind_header_t) - pdcp_output_header_bytes_to_write]), pdcp_output_header_bytes_to_write); - nas_nlh->nlmsg_len = pdcp_output_header_bytes_to_write; + nas_nlh_tx->nlmsg_len = pdcp_output_header_bytes_to_write; #endif //LINUX #endif //NAS_NETLINK @@ -159,9 +165,9 @@ int #ifdef NAS_NETLINK #ifdef LINUX - memcpy(NLMSG_DATA(nas_nlh)+sizeof(pdcp_data_ind_header_t), &(sdu->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write); - nas_nlh->nlmsg_len += pdcp_output_sdu_bytes_to_write; - ret = sendmsg(nas_sock_fd,&nas_msg,0); + memcpy(NLMSG_DATA(nas_nlh_tx)+sizeof(pdcp_data_ind_header_t), &(sdu->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write); + nas_nlh_tx->nlmsg_len += pdcp_output_sdu_bytes_to_write; + ret = sendmsg(nas_sock_fd,&nas_msg_tx,0); if (ret<0) { LOG_D(PDCP, "[PDCP_FIFOS] sendmsg returns %d (errno: %d)\n", ret, errno); mac_xface->macphy_exit(""); @@ -260,7 +266,8 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (u32_t frame,u8_t eNB_flag) { //----------------------------------------------------------------------------- - sdu_size_t bytes_read=0; + sdu_size_t bytes_read = 0; + rb_id_t rab_id = 0; // if remaining bytes to read if (pdcp_input_sdu_remaining_size_to_read > 0) { @@ -289,11 +296,12 @@ int pdcp_read_header.inst = 0; #endif - if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id].instanciated_instance) { + if (pdcp_input_header.rb_id != 0) { LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n", frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id); - pdcp_data_req (pdcp_input_header.inst, + if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id].instanciated_instance) { + pdcp_data_req (pdcp_input_header.inst, frame, eNB_flag, pdcp_input_header.rb_id, RLC_MUI_UNDEFINED, @@ -301,6 +309,34 @@ int pdcp_input_header.data_size, pdcp_input_sdu_buffer, PDCP_DATA_PDU); + } + } else if (eNB_flag) { + // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs + LOG_D(PDCP, "Checking if could sent on default rabs\n"); +#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES + for (rab_id = DEFAULT_RAB_ID; rab_id < MAX_RB; rab_id = rab_id + NB_RB_MAX) { + LOG_D(PDCP, "Checking if could sent on default rab id %d\n", rab_id); + if (pdcp_array[pdcp_input_header.inst][rab_id].instanciated_instance == (pdcp_input_header.inst + 1)) { + pdcp_data_req (pdcp_input_header.inst, + frame, eNB_flag, + rab_id, + RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, + pdcp_input_header.data_size, + pdcp_input_sdu_buffer, + PDCP_DATA_PDU); + } + } + } else { + LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n"); + pdcp_data_req (pdcp_input_header.inst, + frame, eNB_flag, + DEFAULT_RAB_ID, + RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, + pdcp_input_header.data_size, + pdcp_input_sdu_buffer, + PDCP_DATA_PDU); } // not necessary //memset(pdcp_input_sdu_buffer, 0, MAX_IP_PACKET_SIZE); @@ -318,154 +354,280 @@ int pdcp_fifo_read_input_sdus (u32_t frame, u8_t eNB_flag) { //----------------------------------------------------------------------------- -#ifdef NAS_FIFO - int cont; - int bytes_read; - - // if remaining bytes to read - if (pdcp_fifo_read_input_sdus_remaining_bytes (frame,eNB_flag) > 0) { - - // all bytes that had to be read for a SDU were read - // if not overflow of list, try to get new sdus from rt fifo - cont = 1; - - while (cont > 0) { - bytes_read = rtf_get (NAS2PDCP_FIFO, - &(((u8 *) & pdcp_input_header)[pdcp_input_index_header]), - sizeof (pdcp_data_req_header_t) - pdcp_input_index_header); - - if (bytes_read > 0) { -#ifdef PDCP_DEBUG - LOG_D(PDCP, "[PDCP_FIFOS] TTI %d Read %d Bytes of data (header %d) from Nas_mesh\n", - frame, - bytes_read, - sizeof(pdcp_data_req_header_t)); -#endif // PDCP_DEBUG - pdcp_input_index_header += bytes_read; - - if (pdcp_input_index_header == sizeof (pdcp_data_req_header_t)) { -#ifdef PDCP_DEBUG - LOG_D(PDCP, "TTI %d IP->RADIO READ HEADER sdu size %d\n", - frame, - pdcp_input_header.data_size); -#endif //PDCP_DEBUG - pdcp_input_index_header = 0; - if (pdcp_input_header.data_size < 0) { - LOG_E(PDCP, "READ_FIFO: DATA_SIZE %d < 0\n",pdcp_input_header.data_size); - - mac_xface->macphy_exit(""); - return 0; - } - pdcp_input_sdu_remaining_size_to_read = pdcp_input_header.data_size; - pdcp_input_sdu_size_read = 0; - // we know the size of the sdu, so read the sdu; - cont = pdcp_fifo_read_input_sdus_remaining_bytes (frame,eNB_flag); - } else { - cont = 0; - } - // error while reading rt fifo - } else { - cont = 0; - } - } - } - return bytes_read; - -#else //NAS_FIFO +//#ifdef NAS_FIFO +// int cont; +// int bytes_read; +// +// // if remaining bytes to read +// if (pdcp_fifo_read_input_sdus_remaining_bytes (frame,eNB_flag) > 0) { +// +// // all bytes that had to be read for a SDU were read +// // if not overflow of list, try to get new sdus from rt fifo +// cont = 1; +// +// while (cont > 0) { +// bytes_read = rtf_get (NAS2PDCP_FIFO, +// &(((u8 *) & pdcp_input_header)[pdcp_input_index_header]), +// sizeof (pdcp_data_req_header_t) - pdcp_input_index_header); +// +// if (bytes_read > 0) { +//#ifdef PDCP_DEBUG +// LOG_D(PDCP, "[PDCP_FIFOS] TTI %d Read %d Bytes of data (header %d) from Nas_mesh\n", +// frame, +// bytes_read, +// sizeof(pdcp_data_req_header_t)); +//#endif // PDCP_DEBUG +// pdcp_input_index_header += bytes_read; +// +// if (pdcp_input_index_header == sizeof (pdcp_data_req_header_t)) { +//#ifdef PDCP_DEBUG +// LOG_D(PDCP, "TTI %d IP->RADIO READ HEADER sdu size %d\n", +// frame, +// pdcp_input_header.data_size); +//#endif //PDCP_DEBUG +// pdcp_input_index_header = 0; +// if (pdcp_input_header.data_size < 0) { +// LOG_E(PDCP, "READ_FIFO: DATA_SIZE %d < 0\n",pdcp_input_header.data_size); +// +// mac_xface->macphy_exit(""); +// return 0; +// } +// pdcp_input_sdu_remaining_size_to_read = pdcp_input_header.data_size; +// pdcp_input_sdu_size_read = 0; +// // we know the size of the sdu, so read the sdu; +// cont = pdcp_fifo_read_input_sdus_remaining_bytes (frame,eNB_flag); +// } else { +// cont = 0; +// } +// // error while reading rt fifo +// } else { +// cont = 0; +// } +// } +// } +// return bytes_read; +// +//#else //NAS_FIFO +//#ifdef NAS_NETLINK +// int len = 1; +// rb_id_t rab_id = 0; +// +// while (len > 0) { +// if (pdcp_read_state == 0) { +//#ifdef LINUX +// len = recvmsg(nas_sock_fd, &nas_msg, 0); +//#else +// len = -1; +//#endif +// +// if (len < 0) { +// // nothing in pdcp NAS socket +// //LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len); +// } else { +//#ifdef PDCP_DEBUG +//#ifdef LINUX +// LOG_I(PDCP, "[PDCP][NETLINK] Received socket with length %d (nlmsg_len = %d)\n", \ +// len, nas_nlh->nlmsg_len-sizeof(struct nlmsghdr)); +//#else +// LOG_I(PDCP, "[PDCP][NETLINK] nlmsg_len = %d (%d,%d)\n", \ +// nas_nlh->nlmsg_len, sizeof(pdcp_data_req_header_t), \ +// sizeof(struct nlmsghdr)); +//#endif +//#endif +// } +// +//#ifdef LINUX +// if (nas_nlh->nlmsg_len == sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)) { +// pdcp_read_state = 1; //get +// memcpy((void *)&pdcp_read_header, (void *)NLMSG_DATA(nas_nlh), sizeof(pdcp_data_req_header_t)); +// } +//#else +// pdcp_read_state = 1; +//#endif +// } +// +// if (pdcp_read_state == 1) { +//#ifdef LINUX +// len = recvmsg(nas_sock_fd, &nas_msg, 0); +//#else +// len = -1; +//#endif +// +// if (len < 0) { +// // nothing in pdcp NAS socket +// //LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len); +// } else { +// pdcp_read_state = 0; +// // print_active_requests() +// +//#ifdef LINUX +// memcpy(pdcp_read_payload, (unsigned char *)NLMSG_DATA(nas_nlh), nas_nlh->nlmsg_len - sizeof(struct nlmsghdr)); +//#endif +// +//#ifdef OAI_EMU +// pdcp_read_header.inst = (pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) ? \ +// pdcp_read_header.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local : +// pdcp_read_header.inst + oai_emulation.info.first_enb_local; +//#else +// pdcp_read_header.inst = 0; +//#endif +// +// if (pdcp_read_header.rb_id != 0) { +// if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id].instanciated_instance) { +//#ifdef PDCP_DEBUG +// LOG_I(PDCP, "[PDCP][NETLINK][IP->PDCP] TTI %d, INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n", \ +// frame, pdcp_read_header.inst, len, nas_nlh->nlmsg_len-sizeof(struct nlmsghdr), pdcp_read_header.rb_id); +// LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n", +// frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id); +//#endif +// +// pdcp_data_req(pdcp_read_header.inst, +// frame, +// eNB_flag, +// pdcp_read_header.rb_id, +// RLC_MUI_UNDEFINED, +// RLC_SDU_CONFIRM_NO, +// pdcp_read_header.data_size, +// pdcp_read_payload, +// PDCP_DATA_PDU); +// } else { +// LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u\n", +// pdcp_read_header.inst, pdcp_read_header.rb_id); +// } +// } else if (eNB_flag) { +// // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs +// LOG_D(PDCP, "Checking if could sent on default rabs\n"); +//#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES +// for (rab_id = DEFAULT_RAB_ID; rab_id < MAX_RB; rab_id = rab_id + NB_RB_MAX) { +// LOG_D(PDCP, "Checking if could sent on default rab id %d\n", rab_id); +// if (pdcp_array[pdcp_input_header.inst][rab_id].instanciated_instance == (pdcp_input_header.inst + 1)) { +// pdcp_data_req (pdcp_input_header.inst, frame, eNB_flag, rab_id, RLC_MUI_UNDEFINED,RLC_SDU_CONFIRM_NO, +// pdcp_input_header.data_size, +// pdcp_input_sdu_buffer, +// PDCP_DATA_PDU); +// } +// } +// } else { +// LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n"); +// pdcp_data_req (pdcp_input_header.inst, +// frame, eNB_flag, +// DEFAULT_RAB_ID, +// RLC_MUI_UNDEFINED, +// RLC_SDU_CONFIRM_NO, +// pdcp_input_header.data_size, +// pdcp_input_sdu_buffer, +// PDCP_DATA_PDU); +// } +// } +// } +// } // end of while +// +// return len; +// +//#else // neither NAS_NETLINK nor NAS_FIFO +// return 0; +//#endif // NAS_NETLINK +//#endif // NAS_FIFO #ifdef NAS_NETLINK - int len = 1; + int len = 1; + rb_id_t rab_id = 0; while (len > 0) { - if (pdcp_read_state == 0) { -#ifdef LINUX - len = recvmsg(nas_sock_fd, &nas_msg, 0); -#else - len = -1; -#endif + len = recvmsg(nas_sock_fd, &nas_msg_rx, 0); - if (len < 0) { - // nothing in pdcp NAS socket - //LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len); - } else { + if (len<=0) { + // nothing in pdcp NAS socket + //LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len); + } else { + for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf; + NLMSG_OK (nas_nlh_rx, len); + nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, len)) { + + if (nas_nlh_rx->nlmsg_type == NLMSG_DONE) { + LOG_I(PDCP, "[PDCP][NETLINK] RX NLMSG_DONE\n"); + //return; + }; + + if (nas_nlh_rx->nlmsg_type == NLMSG_ERROR) { + LOG_I(PDCP, "[PDCP][NETLINK] RX NLMSG_ERROR\n"); + } + if (pdcp_read_state == 0) { + if (nas_nlh_rx->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_rx), sizeof(pdcp_data_req_header_t)); + LOG_I(PDCP, "[PDCP][NETLINK] RX pdcp_data_req_header_t inst %u, rb_id %u data_size %d\n", pdcp_read_header.inst, pdcp_read_header.rb_id, pdcp_read_header.data_size); + } else { + LOG_E(PDCP, "[PDCP][NETLINK] WRONG size %d should be sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)\n", nas_nlh_rx->nlmsg_len); + } + } else { + pdcp_read_state = 0; + // print_active_requests() #ifdef PDCP_DEBUG -#ifdef LINUX - LOG_I(PDCP, "[PDCP][NETLINK] Received socket with length %d (nlmsg_len = %d)\n", \ - len, nas_nlh->nlmsg_len-sizeof(struct nlmsghdr)); -#else - LOG_I(PDCP, "[PDCP][NETLINK] nlmsg_len = %d (%d,%d)\n", \ - nas_nlh->nlmsg_len, sizeof(pdcp_data_req_header_t), \ - sizeof(struct nlmsghdr)); -#endif // 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)); - } -#else - pdcp_read_state = 1; + LOG_I(PDCP, "[PDCP][NETLINK] Something in socket, length %d \n", nas_nlh_rx->nlmsg_len - sizeof(struct nlmsghdr)); #endif - } - - if (pdcp_read_state == 1) { -#ifdef LINUX - len = recvmsg(nas_sock_fd, &nas_msg, 0); -#else - len = -1; -#endif - - if (len < 0) { - // nothing in pdcp NAS socket - //LOG_I(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len); - } else { - pdcp_read_state = 0; - // print_active_requests() - -#ifdef LINUX - memcpy(pdcp_read_payload, (unsigned char *)NLMSG_DATA(nas_nlh), nas_nlh->nlmsg_len - sizeof(struct nlmsghdr)); -#endif - -#ifdef OAI_EMU - pdcp_read_header.inst = (pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) ? \ - pdcp_read_header.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local : - pdcp_read_header.inst + oai_emulation.info.first_enb_local; -#else - pdcp_read_header.inst = 0; -#endif - - if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id].instanciated_instance) { + //memcpy(pdcp_read_payload, (unsigned char *)NLMSG_DATA(nas_nlh_rx), nas_nlh_rx->nlmsg_len - sizeof(struct nlmsghdr)); + + #ifdef OAI_EMU + pdcp_read_header.inst = (pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) ? \ + pdcp_read_header.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local : + pdcp_read_header.inst + oai_emulation.info.first_enb_local; + #else + pdcp_read_header.inst = 0; + #endif + + if (pdcp_read_header.rb_id != 0) { + if (pdcp_array[pdcp_read_header.inst][pdcp_read_header.rb_id].instanciated_instance) { #ifdef PDCP_DEBUG - LOG_I(PDCP, "[PDCP][NETLINK][IP->PDCP] TTI %d, INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n", \ - frame, pdcp_read_header.inst, len, nas_nlh->nlmsg_len-sizeof(struct nlmsghdr), pdcp_read_header.rb_id); - LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n", - frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id); + LOG_I(PDCP, "[PDCP][NETLINK][IP->PDCP] TTI %d, INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n", + frame, pdcp_read_header.inst, len, nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr), pdcp_read_header.rb_id); + LOG_D(PDCP, "[MSC_MSG][FRAME %05d][IP][MOD %02d][][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %02d][RB %02d]\n", + frame, pdcp_read_header.inst, pdcp_read_header.data_size, pdcp_read_header.inst, pdcp_read_header.rb_id); #endif - pdcp_data_req(pdcp_read_header.inst, - frame, - eNB_flag, - pdcp_read_header.rb_id, - RLC_MUI_UNDEFINED, - RLC_SDU_CONFIRM_NO, - pdcp_read_header.data_size, - pdcp_read_payload, - PDCP_DATA_PDU); - } else { - LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u\n", - pdcp_read_header.inst, pdcp_read_header.rb_id); - } - } - } - } // end of while - + pdcp_data_req(pdcp_read_header.inst, + frame, + eNB_flag, + pdcp_read_header.rb_id, + RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, + pdcp_read_header.data_size, + (unsigned char *)NLMSG_DATA(nas_nlh_rx), + PDCP_DATA_PDU); + } else { + LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u\n", + pdcp_read_header.inst, pdcp_read_header.rb_id); + } + } else if (eNB_flag) { + // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs + #warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES + for (rab_id = DEFAULT_RAB_ID; rab_id < MAX_RB; rab_id = rab_id + NB_RB_MAX) { + if (pdcp_array[pdcp_input_header.inst][rab_id].instanciated_instance == (pdcp_input_header.inst + 1)) { + pdcp_data_req (pdcp_read_header.inst, frame, eNB_flag, rab_id, RLC_MUI_UNDEFINED,RLC_SDU_CONFIRM_NO, + pdcp_read_header.data_size, + (unsigned char *)NLMSG_DATA(nas_nlh_rx), + PDCP_DATA_PDU); + } + } + } else { + LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n"); + pdcp_data_req (pdcp_read_header.inst, + frame, eNB_flag, + DEFAULT_RAB_ID, + RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, + pdcp_read_header.data_size, + (unsigned char *)NLMSG_DATA(nas_nlh_rx), + PDCP_DATA_PDU); + } + } + } + } + } return len; #else // neither NAS_NETLINK nor NAS_FIFO return 0; #endif // NAS_NETLINK -#endif // NAS_FIFO } diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c index 037a3530b..69d525082 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c @@ -40,40 +40,43 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame) //----------------------------------------------------------------------------- { - if (rlcP->t_status_prohibit.running) { - if ( - // CASE 1: start time out - // +-----------+------------------+----------+ - // | |******************| | - // +-----------+------------------+----------+ - //FRAME # 0 FRAME MAX - ((rlcP->t_status_prohibit.frame_start < rlcP->t_status_prohibit.frame_time_out) && - ((frame >= rlcP->t_status_prohibit.frame_time_out) || - (frame < rlcP->t_status_prohibit.frame_start))) || - // CASE 2: time out start - // +-----------+------------------+----------+ - // |***********| |**********| - // +-----------+------------------+----------+ - //FRAME # 0 FRAME MAX VALUE - ((rlcP->t_status_prohibit.frame_start > rlcP->t_status_prohibit.frame_time_out) && - (frame < rlcP->t_status_prohibit.frame_start) && (frame >= rlcP->t_status_prohibit.frame_time_out)) - ) { + if (rlcP->t_status_prohibit.time_out > 0) { + if (rlcP->t_status_prohibit.running) { + if ( + // CASE 1: start time out + // +-----------+------------------+----------+ + // | |******************| | + // +-----------+------------------+----------+ + //FRAME # 0 FRAME MAX + ((rlcP->t_status_prohibit.frame_start < rlcP->t_status_prohibit.frame_time_out) && + ((frame >= rlcP->t_status_prohibit.frame_time_out) || + (frame < rlcP->t_status_prohibit.frame_start))) || + // CASE 2: time out start + // +-----------+------------------+----------+ + // |***********| |**********| + // +-----------+------------------+----------+ + //FRAME # 0 FRAME MAX VALUE + ((rlcP->t_status_prohibit.frame_start > rlcP->t_status_prohibit.frame_time_out) && + (frame < rlcP->t_status_prohibit.frame_start) && (frame >= rlcP->t_status_prohibit.frame_time_out)) + ) { - //if ((rlcP->t_status_prohibit.frame_time_out <= frame) && (rlcP->t_status_prohibit.frame_start)) { - rlcP->t_status_prohibit.running = 0; - rlcP->t_status_prohibit.timed_out = 1; - rlcP->stat_timer_status_prohibit_timed_out += 1; + //if ((rlcP->t_status_prohibit.frame_time_out <= frame) && (rlcP->t_status_prohibit.frame_start)) { + rlcP->t_status_prohibit.running = 0; + rlcP->t_status_prohibit.timed_out = 1; + rlcP->stat_timer_status_prohibit_timed_out += 1; - LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] TIME-OUT\n", frame, - rlcP->module_id, rlcP->rb_id); - LOG_D(RLC, "[MSC_MSG][FRAME %05d][RLC_AM][MOD %02d][RB %02d][--- t-StatusProhibit Timed-out --->][RLC_AM][MOD %02d][RB %02d]\n", - frame, - rlcP->module_id, - rlcP->rb_id, - rlcP->module_id, - rlcP->rb_id); + LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] TIME-OUT\n", frame, + rlcP->module_id, rlcP->rb_id); + LOG_D(RLC, "[MSC_MSG][FRAME %05d][RLC_AM][MOD %02d][RB %02d][--- t-StatusProhibit Timed-out --->][RLC_AM][MOD %02d][RB %02d]\n", + frame, + rlcP->module_id, + rlcP->rb_id, + rlcP->module_id, + rlcP->rb_id); #warning TO DO rlc_am_check_timer_status_prohibit - rlcP->t_status_prohibit.frame_time_out = frame + rlcP->t_status_prohibit.time_out; + rlc_am_stop_and_reset_timer_status_prohibit(rlcP, frame); + //rlcP->t_status_prohibit.frame_time_out = frame + rlcP->t_status_prohibit.time_out; + } } } } @@ -81,23 +84,27 @@ void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame) void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame) //----------------------------------------------------------------------------- { - LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] STOPPED AND RESET\n", frame, + if (rlcP->t_status_prohibit.time_out > 0) { + LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] STOPPED AND RESET\n", frame, rlcP->module_id, rlcP->rb_id); - rlcP->t_status_prohibit.running = 0; - rlcP->t_status_prohibit.frame_time_out = 0; - rlcP->t_status_prohibit.frame_start = 0; - rlcP->t_status_prohibit.timed_out = 0; + rlcP->t_status_prohibit.running = 0; + rlcP->t_status_prohibit.frame_time_out = 0; + rlcP->t_status_prohibit.frame_start = 0; + rlcP->t_status_prohibit.timed_out = 0; + } } //----------------------------------------------------------------------------- void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlcP,u32_t frame) //----------------------------------------------------------------------------- { - rlcP->t_status_prohibit.running = 1; - rlcP->t_status_prohibit.frame_time_out = rlcP->t_status_prohibit.time_out + frame; - rlcP->t_status_prohibit.frame_start = frame; - rlcP->t_status_prohibit.timed_out = 0; - LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] STARTED (TIME-OUT = FRAME %05d)\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->t_status_prohibit.frame_time_out); - LOG_D(RLC, "TIME-OUT = FRAME %05d\n", rlcP->t_status_prohibit.frame_time_out); + if (rlcP->t_status_prohibit.time_out > 0) { + rlcP->t_status_prohibit.running = 1; + rlcP->t_status_prohibit.frame_time_out = rlcP->t_status_prohibit.time_out + frame; + rlcP->t_status_prohibit.frame_start = frame; + rlcP->t_status_prohibit.timed_out = 0; + LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d][T-STATUS-PROHIBIT] STARTED (TIME-OUT = FRAME %05d)\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->t_status_prohibit.frame_time_out); + LOG_D(RLC, "TIME-OUT = FRAME %05d\n", rlcP->t_status_prohibit.frame_time_out); + } } //----------------------------------------------------------------------------- void rlc_am_init_timer_status_prohibit(rlc_am_entity_t *rlcP, u32_t time_outP) diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index 08535e4c1..85865e243 100755 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -171,7 +171,6 @@ typedef struct { #define RLC_MAX_LC ((max_val_DRB_Identity+1)* MAX_MOBILES_PER_RG) #endif - protected_rlc(void (*rlc_rrc_data_ind) (module_id_t , u32_t, u8_t, rb_id_t , sdu_size_t , char* );) protected_rlc(void (*rlc_rrc_data_conf) (module_id_t , rb_id_t , mui_t, rlc_tx_status_t );) diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c index 0b636b6ec..e9a4b74ac 100644 --- a/openair2/LAYER2/RLC/rlc_rrc.c +++ b/openair2/LAYER2/RLC/rlc_rrc.c @@ -268,7 +268,13 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t module_idP, u32_t frameP, u mbms_session = pmch_info_r9->mbms_SessionInfoList_r9.list.array[cnt2]; if (mbms_session->logicalChannelIdentity_r9 > 0) { - lc_id = (NUMBER_OF_UE_MAX*NB_RB_MAX) + mbms_session->logicalChannelIdentity_r9; + //lc_id = (NUMBER_OF_UE_MAX*NB_RB_MAX) + mbms_session->logicalChannelIdentity_r9; + + if (eNB_flagP) { + lc_id = mbms_session->logicalChannelIdentity_r9 + (maxDRB + 3) * MAX_MOBILES_PER_RG; + } else { + lc_id = mbms_session->logicalChannelIdentity_r9 + (maxDRB + 3); + } if (mbms_session->sessionId_r9 != NULL) { mbms_session_id = mbms_session->sessionId_r9->buf[0]; diff --git a/openair2/Makefile b/openair2/Makefile index b5a866596..4fe94ad21 100755 --- a/openair2/Makefile +++ b/openair2/Makefile @@ -119,7 +119,7 @@ remove_emul: clean_nasmesh: - (cd NAS/DRIVER/MESH && $(MAKE) V=1 -C /usr/src/linux M=`pwd` clean) + (cd NAS/DRIVER/MESH && $(MAKE) V=1 -C /usr/src/linux M=`pwd` clean) nasmesh_address_fix.ko: (cd NAS/DRIVER/MESH && $(MAKE) -j$(NUM_CORES) $(SET_UM) V=1 ADDRESS_FIX=1 -C /usr/src/linux M=`pwd`) diff --git a/openair2/NAS/DRIVER/LITE/Makefile b/openair2/NAS/DRIVER/LITE/Makefile index 0e66748e1..f9cdb226c 100755 --- a/openair2/NAS/DRIVER/LITE/Makefile +++ b/openair2/NAS/DRIVER/LITE/Makefile @@ -10,62 +10,64 @@ export KERNEL_MAIN_TYPE KERNEL_MAIN_VERSION=$(shell echo `uname -r | cut -d. -f-1`) ifeq ($(IS_LINUX), 1) -SUBVERSION=$(shell echo `grep '^SUBLEVEL =' /usr/src/linux/Makefile | sed -e 's, ,,g' | sed -e 's/SUBLEVEL=//'`) +PATCHLEVEL=$(shell echo `grep '^PATCHLEVEL =' /usr/src/linux/Makefile | sed -e 's, ,,g' | sed -e 's/PATCHLEVEL=//'`) +SUBLEVEL=$(shell echo `grep '^SUBLEVEL =' /usr/src/linux/Makefile | sed -e 's, ,,g' | sed -e 's/SUBLEVEL=//'`) else ifeq ($(IS_KERNEL_OPENAIRINTERFACE), 1) -SUBVERSION=$(shell echo `grep '^SUBLEVEL =' /usr/src/linux-$(KERNEL_NAME)/Makefile | sed -e 's, ,,g' | sed -e 's/SUBLEVEL=//'`) +PATCHLEVEL=$(shell echo `grep '^PATCHLEVEL =' /usr/src/linux-$(KERNEL_NAME)/Makefile | sed -e 's, ,,g' | sed -e 's/PATCHLEVEL=//'`) +SUBLEVEL=$(shell echo `grep '^SUBLEVEL =' /usr/src/linux-$(KERNEL_NAME)/Makefile | sed -e 's, ,,g' | sed -e 's/SUBLEVEL=//'`) else -SUBVERSION=$(shell echo `grep '^SUBLEVEL =' /usr/src/linux-headers-$(KERNEL_NAME)/Makefile | sed -e 's, ,,g' | sed -e 's/SUBLEVEL=//'`) +PATCHLEVEL=$(shell echo `grep '^PATCHLEVEL =' /usr/src/linux-headers-$(KERNEL_NAME)/Makefile | sed -e 's, ,,g' | sed -e 's/PATCHLEVEL=//'`) +SUBLEVEL=$(shell echo `grep '^SUBLEVEL =' /usr/src/linux-headers-$(KERNEL_NAME)/Makefile | sed -e 's, ,,g' | sed -e 's/SUBLEVEL=//'`) endif endif +ifeq ($(KERNEL_MAIN_VERSION),2) + ifeq ($(PATCHLEVEL),6) + IS_KERNEL_GREATER_THAN_2620=$(shell if [ $(SUBLEVEL) -ge 20 ] ; then echo true ; fi) + IS_KERNEL_GREATER_THAN_2622=$(shell if [ $(SUBLEVEL) -ge 22 ] ; then echo true ; fi) + IS_KERNEL_GREATER_THAN_2629=$(shell if [ $(SUBLEVEL) -ge 29 ] ; then echo true ; fi) + IS_KERNEL_GREATER_THAN_2630=$(shell if [ $(SUBLEVEL) -ge 30 ] ; then echo true ; fi) + IS_KERNEL_GREATER_THAN_2632=$(shell if [ $(SUBLEVEL) -ge 32 ] ; then echo true ; fi) + IS_KERNEL_MAIN_VERSION_IS_3 = "false" + IS_KERNEL_GREATER_THAN_32 = "false" + IS_KERNEL_GREATER_THAN_35 = "false" + endif +else + ifeq ($(KERNEL_MAIN_VERSION),3) + IS_KERNEL_GREATER_THAN_2622 = "true" + IS_KERNEL_GREATER_THAN_2629 = "true" + IS_KERNEL_GREATER_THAN_2630 = "true" + IS_KERNEL_GREATER_THAN_2632 = "true" + IS_KERNEL_MAIN_VERSION_IS_3 = "true" + IS_KERNEL_GREATER_THAN_32=$(shell if [ $(PATCHLEVEL) -ge 2 ] ; then echo true ; fi) + IS_KERNEL_GREATER_THAN_35=$(shell if [ $(PATCHLEVEL) -ge 5 ] ; then echo true ; fi) + endif +endif -IS_KERNEL_SUBVERSION_GREATER_THAN_20=$(shell if [ $(SUBVERSION) -ge 20 ] ; then echo true ; fi) KERNEL_ARCH=$(shell echo `uname -m`) -#SET_REGPARM=$(shell if [ $(KERNEL_ARCH) = 'i686' -a $(SUBVERSION) -ge 20 ]; then echo true ; fi) -SET_X64=$(shell if [ $(KERNEL_ARCH) = 'x86_64' -a $(SUBVERSION) -ge 20 ]; then echo true ; fi) - -IS_KERNEL_SUBVERSION_GREATER_THAN_22=$(shell if [ $(SUBVERSION) -ge 22 ] ; then echo true ; fi) -IS_KERNEL_SUBVERSION_GREATER_THAN_29=$(shell if [ $(SUBVERSION) -ge 29 ] ; then echo true ; fi) -IS_KERNEL_SUBVERSION_GREATER_THAN_30=$(shell if [ $(SUBVERSION) -ge 30 ] ; then echo true ; fi) -IS_KERNEL_SUBVERSION_GREATER_THAN_32=$(shell if [ $(SUBVERSION) -ge 32 ] ; then echo true ; fi) - -# Add global rule for V3 kernels -ifeq ($(KERNEL_MAIN_VERSION),3) - IS_KERNEL_SUBVERSION_GREATER_THAN_22 = "true" - IS_KERNEL_SUBVERSION_GREATER_THAN_29 = "true" - IS_KERNEL_SUBVERSION_GREATER_THAN_30 = "true" - IS_KERNEL_SUBVERSION_GREATER_THAN_32 = "true" - IS_KERNEL_MAIN_VERSION_IS_3 = "true" -endif +SET_X64=$(shell if [ $(KERNEL_ARCH) = 'x86_64' ]; then echo true ; fi) -GT2622= $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_22),-DKERNEL_VERSION_GREATER_THAN_2622=1) -GT2629= $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_29),-DKERNEL_VERSION_GREATER_THAN_2629=1) -GT32= $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_32),-DKERNEL_VERSION_GREATER_THAN_32=1) +GT2622= $(if $(IS_KERNEL_GREATER_THAN_2622),-DKERNEL_VERSION_GREATER_THAN_2622=1) +GT2629= $(if $(IS_KERNEL_GREATER_THAN_2629),-DKERNEL_VERSION_GREATER_THAN_2629=1) +GT2632= $(if $(IS_KERNEL_GREATER_THAN_2632),-DKERNEL_VERSION_GREATER_THAN_2632=1) +GT32= $(if $(IS_KERNEL_GREATER_THAN_32),-DKERNEL_VERSION_GREATER_THAN_32=1) +GT35= $(if $(IS_KERNEL_GREATER_THAN_35),-DKERNEL_VERSION_GREATER_THAN_35=1) V3= $(if $(IS_KERNEL_MAIN_VERSION_IS_3),-DKERNEL_MAIN_VERSION_IS_3=1) -#################################################### -# NASMESH compilation flags -#################################################### -#RTAI=1 - -#################################################### -# D E B U G F L A G S -#################################################### - #################################################### # EXTRA COMPILER FLAGS #################################################### -EXTRA_CFLAGS = -fno-common $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_20),-mregparm=3 -fno-stack-protector -mpreferred-stack-boundary=4) $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) $(GT2622) $(GT2629) $(V3) $(GT32) +EXTRA_CFLAGS = -fno-common $(if $(IS_KERNEL_GREATER_THAN_2620),-mregparm=3 -fno-stack-protector -mpreferred-stack-boundary=4) $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) $(GT2622) $(GT2629) $(V3) $(GT32) $(GT35) ifdef ADDRCONF EXTRA_CFLAGS += -DADDRCONF endif ifdef OAI_NW_DRIVER_TYPE_ETHERNET -EXTRA_CFLAGS += -DOAI_NW_DRIVER_TYPE_ETHERNET +EXTRA_CFLAGS += -DOAI_NW_DRIVER_TYPE_ETHERNET endif ifdef OAI_NW_DRIVER_USE_NETLINK @@ -90,7 +92,7 @@ obj-m += oai_nw_drv.o oai_nw_drv-objs += device.o oai_nw_drv-objs += common.o oai_nw_drv-objs += ioctl.o -oai_nw_drv-objs += classifier.o +#oai_nw_drv-objs += classifier.o oai_nw_drv-objs += tool.o ifdef OAI_NW_DRIVER_USE_NETLINK oai_nw_drv-objs += netlink.o @@ -113,6 +115,8 @@ print: @echo linux kernel ge 29: $(IS_KERNEL_SUBVERSION_GREATER_THAN_29) @echo flag gt2629: $(GT2629) @echo linux kernel ge 30: $(IS_KERNEL_SUBVERSION_GREATER_THAN_30) + @echo linux kernel ge 32: $(IS_KERNEL_SUBVERSION_GREATER_THAN_32) + @echo linux kernel ge 35: $(IS_KERNEL_SUBVERSION_GREATER_THAN_35) @echo flag KERNEL_MAIN_VERSION $(KERNEL_MAIN_VERSION) clean: rm -f *.ko diff --git a/openair2/NAS/DRIVER/LITE/classifier.c b/openair2/NAS/DRIVER/LITE/classifier.c index 48132d75e..937f59318 100755 --- a/openair2/NAS/DRIVER/LITE/classifier.c +++ b/openair2/NAS/DRIVER/LITE/classifier.c @@ -220,300 +220,7 @@ void oai_nw_drv_create_mask_ipv4_addr(struct in_addr *masked_addrP, int prefix_l masked_addrP->s_addr = htonl(0xFFFFFFFF << (32 - prefix_len)); return; } -//--------------------------------------------------------------------------- -// Add a new classifier rule (send direction) -struct classifier_entity *oai_nw_drv_class_add_send_classifier(struct cx_entity *cx, u8 dscp, u16 classref){ - //--------------------------------------------------------------------------- - struct classifier_entity *classifier; - - #ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_ADD_SCLASSIFIER: begin for dscp %d, classref %d\n", dscp,classref); - #endif - if (cx==NULL){ - #ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_ADD_SCLASSIFIER - input parameter cx is NULL \n"); - #endif - return NULL; - } - for (classifier=cx->sclassifier[dscp]; classifier!=NULL; classifier=classifier->next){ - if (classifier->classref==classref){ - #ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_ADD_SCLASSIFIER: classifier already exist for dscp %d, classref %d\n",dscp,classref); - #endif - return classifier; - } - } - classifier=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL); - if (classifier==NULL) - return NULL; - classifier->next=cx->sclassifier[dscp]; - classifier->classref=classref; - cx->sclassifier[dscp]=classifier; - ++cx->nsclassifier; - #ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_ADD_SCLASSIFIER: classifier created for dscp %d, classref %d\n",dscp,classref); - #endif - return classifier; -} -//--------------------------------------------------------------------------- -// Add a new classifier rule (receive direction) -struct classifier_entity *oai_nw_drv_class_add_recv_classifier(u8 dscp, - u16 classref, - struct oai_nw_drv_priv *gpriv){ - //--------------------------------------------------------------------------- - struct classifier_entity *classifier; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_ADD_RCLASSIFIER: begin\n"); -#endif - for (classifier=gpriv->rclassifier[dscp]; classifier!=NULL; classifier=classifier->next) - { - if (classifier->classref==classref){ -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_ADD_RCLASSIFIER: classifier already exist for dscp %d, classref %d\n",dscp,classref); -#endif - return classifier; - } - } - classifier=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL); - if (classifier==NULL) - return NULL; - classifier->next=gpriv->rclassifier[dscp]; - classifier->classref=classref; - gpriv->rclassifier[dscp]=classifier; - ++gpriv->nrclassifier; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_ADD_RCLASSIFIER: classifier created for dscp %d, classref %d\n",dscp,classref); -#endif - return classifier; -} - -//--------------------------------------------------------------------------- -// Add a new classifier rule (forwarding) -struct classifier_entity *oai_nw_drv_class_add_fwd_classifier(struct cx_entity *cx, u8 dscp, u16 classref){ - //--------------------------------------------------------------------------- - struct classifier_entity *classifier; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_ADD_FCLASSIFIER: begin for dscp %d, classref %d\n", dscp,classref); -#endif - if (cx==NULL){ -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_ADD_FCLASSIFIER - input parameter cx is NULL \n"); -#endif - return NULL; - } - for (classifier=cx->fclassifier[dscp]; classifier!=NULL; classifier=classifier->next){ - if (classifier->classref==classref){ -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_ADD_SCLASSIFIER: classifier already exist for dscp %d, classref %d\n",dscp,classref); -#endif - return classifier; - } - } - classifier=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL); - if (classifier==NULL) - return NULL; - classifier->next=cx->fclassifier[dscp]; - classifier->classref=classref; - cx->fclassifier[dscp]=classifier; - ++cx->nfclassifier; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_ADD_FCLASSIFIER: classifier created for dscp %d, classref %d\n",dscp,classref); -#endif - return classifier; -} - - -//--------------------------------------------------------------------------- -void oai_nw_drv_class_flush_send_classifier(struct cx_entity *cx){ - //--------------------------------------------------------------------------- - u8 dscpi; - struct classifier_entity *classifier; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_FLUSH_SCLASSIFIER: begin\n"); -#endif - if (cx==NULL){ -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_FLUSH_SCLASSIFIER - input parameter cx is NULL \n"); -#endif - return; - } - // - for (dscpi=0; dscpi<OAI_NW_DRV_DSCP_MAX; ++dscpi) - { - for (classifier=cx->sclassifier[dscpi]; classifier!=NULL; classifier=cx->sclassifier[dscpi]) - { - cx->sclassifier[dscpi]=classifier->next; - kfree(classifier); - } - } - cx->nsclassifier=0; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_FLUSH_SCLASSIFIER: end\n"); -#endif -} -//--------------------------------------------------------------------------- -void oai_nw_drv_class_flush_fwd_classifier(struct cx_entity *cx){ - //--------------------------------------------------------------------------- - u8 dscpi; - struct classifier_entity *classifier; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_FLUSH_FCLASSIFIER: begin\n"); -#endif - if (cx==NULL){ -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_FLUSH_FCLASSIFIER - input parameter cx is NULL \n"); -#endif - return; - } - // - for (dscpi=0; dscpi<OAI_NW_DRV_DSCP_MAX; ++dscpi) - { - for (classifier=cx->fclassifier[dscpi]; classifier!=NULL; classifier=cx->fclassifier[dscpi]) - { - cx->fclassifier[dscpi]=classifier->next; - kfree(classifier); - } - } - cx->nfclassifier=0; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_FLUSH_FCLASSIFIER: end\n"); -#endif -} -//--------------------------------------------------------------------------- -void oai_nw_drv_class_flush_recv_classifier(struct oai_nw_drv_priv *gpriv){ - //--------------------------------------------------------------------------- - u8 dscpi; - struct classifier_entity *classifier; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_FLUSH_RCLASSIFIER: begin\n"); -#endif - for (dscpi=0; dscpi<OAI_NW_DRV_DSCP_MAX; ++dscpi) - { - for (classifier=gpriv->rclassifier[dscpi]; classifier!=NULL; classifier=gpriv->rclassifier[dscpi]) - { - gpriv->rclassifier[dscpi]=classifier->next; - kfree(classifier); - } - } - gpriv->nrclassifier=0; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_FLUSH_RCLASSIFIER: end\n"); -#endif -} - -//--------------------------------------------------------------------------- -// Delete a classifier rule (send direction) -void oai_nw_drv_class_del_send_classifier(struct cx_entity *cx, u8 dscp, u16 classref){ - //--------------------------------------------------------------------------- - struct classifier_entity *pclassifier,*np; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_DEL_SCLASSIFIER: begin\n"); -#endif - if (cx==NULL){ -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_DEL_SCLASSIFIER - input parameter cx is NULL \n"); -#endif - return; - } - // - pclassifier=cx->sclassifier[dscp]; - if (pclassifier==NULL) - return; - if (pclassifier->classref==classref) - { - cx->sclassifier[dscp]=pclassifier->next; - kfree(pclassifier); - --cx->nsclassifier; - return; - } - for (np=pclassifier->next; np!=NULL; pclassifier=np) - { - if (np->classref==classref) - { - pclassifier->next=np->next; - kfree(np); - --cx->nsclassifier; - return; - } - } -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_DEL_SCLASSIFIER: end\n"); -#endif -} - -//--------------------------------------------------------------------------- -// Delete a classifier rule (send direction) -void oai_nw_drv_class_del_fwd_classifier(struct cx_entity *cx, u8 dscp, u16 classref){ - //--------------------------------------------------------------------------- - struct classifier_entity *pclassifier,*np; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_DEL_FCLASSIFIER: begin\n"); -#endif - if (cx==NULL){ -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_DEL_FCLASSIFIER - input parameter cx is NULL \n"); -#endif - return; - } - // - pclassifier=cx->fclassifier[dscp]; - if (pclassifier==NULL) - return; - if (pclassifier->classref==classref) - { - cx->fclassifier[dscp]=pclassifier->next; - kfree(pclassifier); - --cx->nfclassifier; - return; - } - for (np=pclassifier->next; np!=NULL; pclassifier=np) - { - if (np->classref==classref) - { - pclassifier->next=np->next; - kfree(np); - --cx->nfclassifier; - return; - } - } -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_DEL_FCLASSIFIER: end\n"); -#endif -} - -//--------------------------------------------------------------------------- -// Delete a classifier rule (receive direction) -void oai_nw_drv_class_del_recv_classifier(u8 dscp, u16 classref,struct oai_nw_drv_priv *gpriv){ - //--------------------------------------------------------------------------- - struct classifier_entity *pclassifier,*np; -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_DEL_RCLASSIFIER: begin\n"); -#endif - pclassifier=gpriv->rclassifier[dscp]; - if (pclassifier==NULL) - return; - if (pclassifier->classref==classref) - { - gpriv->rclassifier[dscp]=pclassifier->next; - kfree(pclassifier); - --gpriv->nrclassifier; - return; - } - for (np=pclassifier->next; np!=NULL; pclassifier=np) - { - if (np->classref==classref) - { - pclassifier->next=np->next; - kfree(np); - --gpriv->nrclassifier; - return; - } - } -#ifdef OAI_DRV_DEBUG_CLASS - printk("OAI_NW_DRV_CLASS_DEL_RCLASSIFIER: end\n"); -#endif -} //--------------------------------------------------------------------------- // Search the entity with the IPv6 address 'addr' @@ -606,576 +313,3 @@ struct cx_entity *oai_nw_drv_find_cx6(struct sk_buff *skb, return cx; } -//--------------------------------------------------------------------------- -// Search the entity with the IPv4 address 'addr' -struct cx_entity *oai_nw_drv_find_cx4(struct sk_buff *skb, - unsigned char dscp, - struct oai_nw_drv_priv *gpriv, - int inst, - int *paddr_type, - unsigned char *cx_searcher) { - //--------------------------------------------------------------------------- - unsigned char cxi; - u32 daddr; - struct cx_entity *default_ip=NULL; - struct classifier_entity *pclassifier=NULL; - struct in_addr masked_addr; - - // if (inst >0) - // return(gpriv->cx); //dump to clusterhead - - if (skb!=NULL) { - daddr = ((struct iphdr*)(skb_network_header(skb)))->daddr; - if (daddr != INADDR_ANY) { - - if (ipv4_is_multicast(ip_hdr(skb)->daddr)) { - // TO BE CHECKED - *paddr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_MC_SIGNALLING; - #ifdef OAI_DRV_DEBUG_CLASS - printk("SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr)); - printk(" DEST ADDR %d.%d.%d.%d MULTICAST\n",NIPADDR(ip_hdr(skb)->daddr)); - #endif - return NULL; - } else if (ipv4_is_lbcast(ip_hdr(skb)->daddr)) { - // TO BE CHECKED - *paddr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_BROADCAST; - #ifdef OAI_DRV_DEBUG_CLASS - printk("SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr)); - printk(" DEST ADDR %d.%d.%d.%d LOCAL BROADCAST\n",NIPADDR(ip_hdr(skb)->daddr)); - #endif - return NULL; - } else if (IN_CLASSA(htonl(ip_hdr(skb)->daddr)) || - IN_CLASSB(htonl(ip_hdr(skb)->daddr)) || - IN_CLASSC(htonl(ip_hdr(skb)->daddr))) { - - if ( ((ip_hdr(skb)->daddr & 0xFF000000) >> 24) == 0x000000FF) { - *paddr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_BROADCAST; - #ifdef OAI_DRV_DEBUG_CLASS - printk("SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr)); - printk(" DEST ADDR %d.%d.%d.%d BROADCAST\n",NIPADDR(ip_hdr(skb)->daddr)); - #endif - return NULL; - } - *paddr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_UNICAST; - #ifdef OAI_DRV_DEBUG_CLASS - printk("SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr)); - printk(" DEST ADDR %d.%d.%d.%d UNICAST\n",NIPADDR(ip_hdr(skb)->daddr)); - #endif - - for (cxi=*cx_searcher; cxi<OAI_NW_DRV_CX_MAX; ++cxi) { - - (*cx_searcher)++; - pclassifier = gpriv->cx[cxi].sclassifier[dscp]; - - while (pclassifier!=NULL) { - if ((pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_4) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)) { // verify that this is an IPv4 rule - oai_nw_drv_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen); - if (IN_ARE_ADDR_MASKED_EQUAL(&ip_hdr(skb)->daddr, &(pclassifier->daddr.ipv4), &masked_addr)) { - #ifdef OAI_DRV_DEBUG_CLASS - printk("oai_nw_drv_find_cx4: IP MASK MATCHED: found cx %d: %d.%d.%d.%d/%d\n",cxi, NIPADDR(pclassifier->daddr.ipv4), pclassifier->dplen); - #endif //OAI_DRV_DEBUG_CLASS - return &gpriv->cx[cxi]; - //return gpriv->cx+cxi; - } - } - // goto to next classification rule for the connection - pclassifier = pclassifier->next; - } - } - } else { - *paddr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_UNKNOWN; - #ifdef OAI_DRV_DEBUG_CLASS - printk("SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr)); - printk(" DEST ADDR %d.%d.%d.%d TYPE UNKNOWN\n",NIPADDR(ip_hdr(skb)->daddr)); - #endif - } - } - } - #ifdef OAI_DRV_DEBUG_CLASS - printk("oai_nw_drv_find_cx4 NOT FOUND: %d.%d.%d.%d\n",NIPADDR(ip_hdr(skb)->daddr)); - #endif //OAI_DRV_DEBUG_CLASS - return default_ip; -} - -#ifdef MPLS -//--------------------------------------------------------------------------- -// Search the entity with the mpls label and given exp -struct cx_entity *oai_nw_drv_find_cx_mpls(struct sk_buff *skb, - unsigned char exp, - struct oai_nw_drv_priv *gpriv, - int inst, - unsigned char *cx_searcher){ - //--------------------------------------------------------------------------- - unsigned char cxi; - struct cx_entity *default_label = NULL; - struct classifier_entity *pclassifier = NULL; - - // if (inst >0) - //return(gpriv->cx); //dump to clusterhead - - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][CLASS][MPLS] Searching for label %d\n",MPLSCB(skb)->label); - #endif - - for (cxi=*cx_searcher; cxi<OAI_NW_DRV_CX_MAX; ++cxi) { - - (*cx_searcher)++; - pclassifier = gpriv->cx[cxi].sclassifier[exp]; - - while (pclassifier!=NULL) { - if (pclassifier->ip_version == OAI_NW_DRV_MPLS_VERSION_CODE) { // verify that this is an MPLS rule - - #ifdef OAI_DRV_DEBUG_CLASS - printk("cx %d : label %d\n",cxi,pclassifier->daddr.mpls_label); - #endif //OAI_DRV_DEBUG_CLASS - - if (pclassifier->daddr.mpls_label==MPLSCB(skb)->label){ - #ifdef OAI_DRV_DEBUG_CLASS - printk("found cx %d: label %d, RB %d\n",cxi, - MPLSCB(skb)->label, - pclassifier->rab_id); - #endif //OAI_DRV_DEBUG_CLASS - return gpriv->cx+cxi; - } - /* - else if (gpriv->cx[cxi].sclassifier[dscp]->daddr.ipv4==OAI_NW_DRV_DEFAULT_IPV4_ADDR) { - #ifdef OAI_DRV_DEBUG_CLASS - printk("found default_ip rule\n"); - #endif //OAI_DRV_DEBUG_CLASS - default_ip = gpriv->cx+cxi; - } - */ - } - // goto to next classification rule for the connection - pclassifier = pclassifier->next; - } - } - return default_label; -} -#endif - -//--------------------------------------------------------------------------- -// Search the sending function -void oai_nw_drv_class_send(struct sk_buff *skb,int inst){ - //--------------------------------------------------------------------------- - struct classifier_entity *pclassifier = NULL, *sp = NULL; - struct sk_buff *skb_cloned = NULL; - u8 *protocolh = NULL; - u8 version; - u8 protocol, dscp; - u16 classref; - struct cx_entity *cx = NULL; - unsigned int i; - struct net_device *dev = oai_nw_drv_dev[inst]; - struct oai_nw_drv_priv *gpriv = netdev_priv(dev); - unsigned char cx_searcher,no_connection; - int addr_type; - struct in6_addr masked6_addr; - struct in_addr masked_addr; - // RARP vars - struct arphdr *rarp = NULL; - unsigned char *rarp_ptr = NULL; - __be32 sip, tip; - unsigned char *sha = NULL, *tha = NULL; /* s for "source", t for "target" */ - - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] begin - inst %d\n",__FUNCTION__, inst); - #endif - if (skb==NULL){ - #ifdef OAI_DRV_DEBUG_SEND - printk("[NAS][%s] - input parameter skb is NULL \n",__FUNCTION__); - #endif - return; - } - - #ifdef OAI_DRV_DEBUG_SEND - printk("[NAS][%s] Got packet from kernel:\n",__FUNCTION__); - for (i=0;i < skb->len;i++) - printk("%2x ",((unsigned char *)skb->data)[i]); - printk("\n"); - #endif - - // find all connections related to socket - cx_searcher = 0; - no_connection = 1; - - // Address classification - switch (ntohs(skb->protocol)) { - case ETH_P_IPV6: - version = 6; - addr_type = OAI_NW_DRV_IPV6_ADDR_TYPE_UNKNOWN; - protocolh = oai_nw_drv_TOOL_get_protocol6(ipv6_hdr(skb), &protocol); - dscp = oai_nw_drv_TOOL_get_dscp6 (ipv6_hdr(skb)); - cx = oai_nw_drv_find_cx6 (skb, dscp, gpriv, inst, &addr_type, &cx_searcher); - - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] ETH_P_IPV6 skb %p dscp %d gpriv %p inst %d cx_searcher %p \n",__FUNCTION__,skb, dscp, gpriv, inst, &cx_searcher); - #endif - // find in default DSCP a valid classification - if (cx == NULL) { - switch (addr_type) { - case OAI_NW_DRV_IPV6_ADDR_TYPE_MC_SIGNALLING: - for (i=0; i<OAI_NW_DRV_CX_MAX; i++){ - pclassifier=(&gpriv->cx[i])->sclassifier[OAI_NW_DRV_DSCP_DEFAULT]; - while (pclassifier!=NULL) { - if ((pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_6) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)) { - // ok found default classifier for this packet - oai_nw_drv_create_mask_ipv6_addr(&masked6_addr, pclassifier->dplen); - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] IPv6 MULTICAST CX %u TRYING default DSCP classifier IP Version %d, Dest ADDR %X:%X:%X:%X:%X:%X:%X:%X/%u Mask %X:%X:%X:%X:%X:%X:%X:%X/%u \n", - __FUNCTION__, i, pclassifier->ip_version, - NIP6ADDR(&(pclassifier->daddr.ipv6)), pclassifier->dplen, - NIP6ADDR(&masked6_addr), pclassifier->dplen); - #endif - if (IN6_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv6, &ipv6_hdr(skb)->daddr, &masked6_addr)) { - cx = &gpriv->cx[i]; - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] IPv6 MULTICAST CX %u ETH_P_IPV6 FOUND OAI_NW_DRV_DSCP_DEFAULT with IN6_ARE_ADDR_MASKED_EQUAL(%d bits)\n",__FUNCTION__, i, pclassifier->dplen); - #endif - skb_cloned = skb_clone (skb, 0); - if (skb_cloned) { - pclassifier->fct(skb_cloned, cx, pclassifier,inst); - dev_kfree_skb(skb_cloned); - } else { - printk("[NAS][%s] IPv6 MULTICAST CX %u could not send packet, skb_clone() failed)\n",__FUNCTION__, i); - } - break; - } else if(IN6_IS_ADDR_UNSPECIFIED(&pclassifier->daddr.ipv6)) { - cx = &gpriv->cx[i]; - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] IPv6 MULTICAST CX %u ETH_P_IPV6 FOUND OAI_NW_DRV_DSCP_DEFAULT with IN6_IS_ADDR_UNSPECIFIED\n",__FUNCTION__, i); - #endif - skb_cloned = skb_clone (skb, 0); - if (skb_cloned) { - pclassifier->fct(skb_cloned, cx, pclassifier,inst); - dev_kfree_skb(skb_cloned); - } else { - printk("[NAS][%s] IPv6 MULTICAST CX %u could not send packet, skb_clone() failed)\n",__FUNCTION__, i); - } - break; - } - } - pclassifier = pclassifier->next; - } - } - cx = NULL; - break; - - case OAI_NW_DRV_IPV6_ADDR_TYPE_UNICAST: - - for (i=0; i<OAI_NW_DRV_CX_MAX; i++){ - pclassifier=(&gpriv->cx[i])->sclassifier[OAI_NW_DRV_DSCP_DEFAULT]; - while (pclassifier!=NULL) { - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] TRYING default DSCP classifier IP Version %d, Dest ADDR %X:%X:%X:%X:%X:%X:%X:%X/%u\n",__FUNCTION__, pclassifier->ip_version, NIP6ADDR(&(pclassifier->daddr.ipv6)), pclassifier->dplen); - #endif - if ((pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_6) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)) { - // ok found default classifier for this packet - oai_nw_drv_create_mask_ipv6_addr(&masked6_addr, pclassifier->dplen); - if (IN6_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv6, &ipv6_hdr(skb)->daddr, &masked6_addr)) { - // then force dscp - cx = &gpriv->cx[i]; - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] ETH_P_IPV6 FOUND OAI_NW_DRV_DSCP_DEFAULT with IN6_ARE_ADDR_MASKED_EQUAL(%d bits)\n",__FUNCTION__, pclassifier->dplen); - #endif - dscp = OAI_NW_DRV_DSCP_DEFAULT; - i = OAI_NW_DRV_CX_MAX; - break; - } else if(IN6_IS_ADDR_UNSPECIFIED(&pclassifier->daddr.ipv6)) { - cx = &gpriv->cx[i]; - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] ETH_P_IPV6 FOUND OAI_NW_DRV_DSCP_DEFAULT with IN6_IS_ADDR_UNSPECIFIED\n",__FUNCTION__); - #endif - dscp = OAI_NW_DRV_DSCP_DEFAULT; - i = OAI_NW_DRV_CX_MAX; - break; - } else { - printk("[NAS][%s] TRYING default DSCP classifier: NO MATCH\n",__FUNCTION__); - } - } - pclassifier = pclassifier->next; - } - } - break; - - case OAI_NW_DRV_IPV6_ADDR_TYPE_MC_MBMS: - break; - - // should have found a valid classification rule - case OAI_NW_DRV_IPV6_ADDR_TYPE_UNKNOWN: - default: - ; - } - } - break; - - case ETH_P_ARP: - version = 4; - addr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_BROADCAST; - dscp = 0; - cx = NULL; - /* Basic sanity checks can be done without the lock. */ - //rarp = (struct arphdr *)skb_transport_header(skb); - rarp = (struct arphdr *)skb_network_header(skb); - if (rarp) { - if (rarp->ar_hln != dev->addr_len || dev->type != ntohs(rarp->ar_hrd)) { - printk("[NAS][%s] ARP PACKET WRONG ADDR LEN or WRONG ARP HEADER TYPE\n",__FUNCTION__); - break; - } - } else { - printk("[NAS][%s] ARP HEADER POINTER IS NULL\n",__FUNCTION__); - break; - } - - /* If it's not Ethernet, delete it. */ - if (rarp->ar_pro != htons(ETH_P_IP)) { - printk("[NAS][%s] ARP PACKET PROTOCOL IS NOT ETHERNET\n",__FUNCTION__); - break; - } - rarp_ptr = (unsigned char *) (rarp + 1); - sha = rarp_ptr; - rarp_ptr += dev->addr_len; - memcpy(&sip, rarp_ptr, 4); - rarp_ptr += 4; - tha = rarp_ptr; - rarp_ptr += dev->addr_len; - memcpy(&tip, rarp_ptr, 4); - - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] ARP DEST IP transport IP = %d.%d.%d.%d\n",__FUNCTION__, NIPADDR(tip)); - #endif - for (i=0; i<OAI_NW_DRV_CX_MAX; i++){ - pclassifier=(&gpriv->cx[i])->sclassifier[OAI_NW_DRV_DSCP_DEFAULT]; - while (pclassifier!=NULL) { - if ((pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_4) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)) { - // ok found default classifier for this packet - oai_nw_drv_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen); - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] MASK = %d.%d.%d.%d\n",__FUNCTION__, NIPADDR(masked_addr.s_addr)); - #endif - - if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &tip, &masked_addr.s_addr)) { - // then force dscp - cx = &gpriv->cx[i]; - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] ETH_P_ARP FOUND OAI_NW_DRV_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(%d bits)\n",__FUNCTION__, pclassifier->dplen); - #endif - dscp = OAI_NW_DRV_DSCP_DEFAULT; - i = OAI_NW_DRV_CX_MAX; - break; - } else if(INADDR_ANY == pclassifier->daddr.ipv4) { - cx = &gpriv->cx[i]; - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] ETH_P_ARP FOUND OAI_NW_DRV_DSCP_DEFAULT with INADDR_ANY\n",__FUNCTION__); - #endif - dscp = OAI_NW_DRV_DSCP_DEFAULT; - i = OAI_NW_DRV_CX_MAX; - break; - } - } - pclassifier = pclassifier->next; - } - } - - break; - - case ETH_P_IP: - version = 4; - addr_type = OAI_NW_DRV_IPV4_ADDR_TYPE_UNKNOWN; - dscp = oai_nw_drv_TOOL_get_dscp4((struct iphdr *)(skb_network_header(skb))); - cx = oai_nw_drv_find_cx4(skb, dscp, gpriv, inst, &addr_type, &cx_searcher); - protocolh = oai_nw_drv_TOOL_get_protocol4((struct iphdr *)(skb_network_header(skb)), &protocol); - // find in default DSCP a valid classification - if (cx == NULL) { - switch (addr_type) { - case OAI_NW_DRV_IPV4_ADDR_TYPE_MC_SIGNALLING: - case OAI_NW_DRV_IPV4_ADDR_TYPE_BROADCAST: - for (i=0; i<OAI_NW_DRV_CX_MAX; i++){ - pclassifier=(&gpriv->cx[i])->sclassifier[OAI_NW_DRV_DSCP_DEFAULT]; - while (pclassifier!=NULL) { - if ((pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_4) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)) { - // ok found default classifier for this packet - oai_nw_drv_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen); - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] IPv4 MULTICAST CX %u TRYING default DSCP classifier IP Version %d, Dest ADDR %u.%u.%u.%u/%u Mask %u.%u.%u.%u/%u \n", - __FUNCTION__, i, pclassifier->ip_version, - NIPADDR(pclassifier->daddr.ipv4), pclassifier->dplen, - NIPADDR(masked_addr.s_addr), pclassifier->dplen); - #endif - if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &ip_hdr(skb)->daddr, &masked_addr.s_addr)) { - cx = &gpriv->cx[i]; - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s][CX %u] ETH_P_IP FOUND OAI_NW_DRV_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(IP CLASS %d.%d.%d.%d, IP DEST %d.%d.%d.%d, MASK = %d.%d.%d.%d %d bits)\n", - __FUNCTION__, i, NIPADDR(pclassifier->daddr.ipv4), NIPADDR(ip_hdr(skb)->daddr), NIPADDR(masked_addr.s_addr), pclassifier->dplen); - #endif - skb_cloned = skb_clone (skb, 0); - if (skb_cloned) { - pclassifier->fct(skb_cloned, cx, pclassifier,inst); - dev_kfree_skb(skb_cloned); - } else { - printk("[NAS][%s] IPv4 MULTICAST CX %u could not send packet, skb_clone() failed)\n",__FUNCTION__, i); - } - break; - } else if(INADDR_ANY == pclassifier->daddr.ipv4) { - cx = &gpriv->cx[i]; - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s][CX %u] ETH_P_IP FOUND OAI_NW_DRV_DSCP_DEFAULT with INADDR_ANY\n",__FUNCTION__, i); - #endif - skb_cloned = skb_clone (skb, 0); - if (skb_cloned) { - pclassifier->fct(skb_cloned, cx, pclassifier,inst); - dev_kfree_skb(skb_cloned); - } else { - printk("[NAS][%s] IPv6 MULTICAST CX %u could not send packet, skb_clone() failed)\n",__FUNCTION__, i); - } - break; - } - } - pclassifier = pclassifier->next; - } - } - cx = NULL; - break; - case OAI_NW_DRV_IPV4_ADDR_TYPE_UNICAST: - - for (i=0; i<OAI_NW_DRV_CX_MAX; i++){ - //if ((pclassifier=cx->sclassifier[OAI_NW_DRV_DSCP_DEFAULT])!=NULL) { - pclassifier=(&gpriv->cx[i])->sclassifier[OAI_NW_DRV_DSCP_DEFAULT]; - while (pclassifier != NULL) { - if ((pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_4) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)) { - // ok found default classifier for this packet - oai_nw_drv_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen); - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] MASK = %d.%d.%d.%d\n",__FUNCTION__, NIPADDR(masked_addr.s_addr)); - #endif - if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &ip_hdr(skb)->daddr, &masked_addr.s_addr)) { - // then force dscp - cx = &gpriv->cx[i]; - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s][CX %d] ETH_P_IP FOUND OAI_NW_DRV_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(IP CLASS %d.%d.%d.%d, IP DEST %d.%d.%d.%d, MASK = %d.%d.%d.%d %d bits)\n", - __FUNCTION__, i, NIPADDR(pclassifier->daddr.ipv4), NIPADDR(ip_hdr(skb)->daddr), NIPADDR(masked_addr.s_addr), pclassifier->dplen); - #endif - dscp = OAI_NW_DRV_DSCP_DEFAULT; - i = OAI_NW_DRV_CX_MAX; - break; - } else if(INADDR_ANY == pclassifier->daddr.ipv4) { - cx = &gpriv->cx[i]; - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] ETH_P_IP FOUND OAI_NW_DRV_DSCP_DEFAULT with INADDR_ANY\n",__FUNCTION__); - #endif - dscp = OAI_NW_DRV_DSCP_DEFAULT; - i = OAI_NW_DRV_CX_MAX; - break; - } - } - pclassifier = pclassifier->next; - } - } - break; - - // should have found a valid classification rule - case OAI_NW_DRV_IPV4_ADDR_TYPE_UNKNOWN: - default: - ; - } - } - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] ETH_P_IP Got IPv4 packet (%02X), dscp = %d, cx = %p\n",__FUNCTION__,ntohs(skb->protocol),dscp,cx); - #endif - break; - - #ifdef MPLS - case ETH_P_MPLS_UC: - cx=oai_nw_drv_find_cx_mpls(skb,MPLSCB(skb)->exp,gpriv,inst,&cx_searcher); - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] ETH_P_MPLS_UC Got MPLS unicast packet, exp = %d, label = %d, cx = %p\n",__FUNCTION__,MPLSCB(skb)->exp,MPLSCB(skb)->label,cx); - #endif - - dscp = MPLSCB(skb)->exp; - version = OAI_NW_DRV_MPLS_VERSION_CODE; - protocol = version; - break; - #endif - - default: - printk("[NAS][%s] Unknown protocol\n",__FUNCTION__); - version = 0; - return; - } - - - - // If a valid connection for the DSCP/EXP with destination address - // is found scan all protocol-based classification rules - if (cx != NULL) { - classref = 0; - sp = NULL; - - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] DSCP/EXP %d : looking for classifier entry\n",__FUNCTION__,dscp); - #endif - for (pclassifier=cx->sclassifier[dscp]; pclassifier!=NULL; pclassifier=pclassifier->next) { - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] DSCP %d p->classref=%d,p->protocol=%d,p->version=%d\n",__FUNCTION__,dscp,pclassifier->classref,pclassifier->protocol,pclassifier->ip_version); - #endif - // Check if transport protocol/message match - /* - if ((pclassifier->protocol == protocol)) - if ((protocol == OAI_NW_DRV_PROTOCOL_ICMP6) && (version == 6)) - if (pclassifier->protocol_message_type == (pclassifier->protocol_message_type )) { - printk("[GRAAL][CLASSIFIER] Router advertisement\n"); - } - */ - // normal rule checks that network protocol version matches - - if ((pclassifier->ip_version == version) || (pclassifier->ip_version == OAI_NW_DRV_IP_VERSION_ALL)){ - sp=pclassifier; - classref=sp->classref; - break; - } - } - - if (sp!=NULL) { - #ifdef OAI_DRV_DEBUG_CLASS - char sfct[10], sprotocol[10]; - if (sp->fct==oai_nw_drv_common_ip2wireless) - strcpy(sfct, "qos"); - if (sp->fct==oai_nw_drv_CTL_send) - strcpy(sfct, "ctl"); - if (sp->fct==oai_nw_drv_class_del_send_classifier) - strcpy(sfct, "del"); - - switch(protocol) { - case OAI_NW_DRV_PROTOCOL_UDP:strcpy(sprotocol, "udp");printk("udp packet\n");break; - case OAI_NW_DRV_PROTOCOL_TCP:strcpy(sprotocol, "tcp");printk("tcp packet\n");break; - case OAI_NW_DRV_PROTOCOL_ICMP4:strcpy(sprotocol, "icmp4");printk("icmp4 packet\n");break; - case OAI_NW_DRV_PROTOCOL_ICMP6:strcpy(sprotocol, "icmp6");print_TOOL_pk_icmp6((struct icmp6hdr*)protocolh);break; - case OAI_NW_DRV_PROTOCOL_ARP:strcpy(sprotocol, "arp");printk("arp packet\n");break; - #ifdef MPLS - case OAI_NW_DRV_MPLS_VERSION_CODE:strcpy(sprotocol,"mpls");break; - #endif - default:strcpy(sprotocol, "unknown"); - - } - printk("[NAS][%s] (dscp %u, %s) received, (classref %u, fct %s, rab_id %u) classifier rule\n",__FUNCTION__, - dscp, sprotocol, sp->classref, sfct, sp->rab_id); - #endif - - sp->fct(skb, cx, sp,inst); - } // if classifier entry match found - else { - printk("[NAS][%s] no corresponding item in the classifier, so the message is dropped\n",__FUNCTION__); - // oai_nw_drv_COMMON_del_send(skb, cx, NULL,inst); - } - - no_connection = 0; - } // if connection found - //#ifdef OAI_DRV_DEBUG_CLASS - if (no_connection == 1) - printk("[NAS][%s] no corresponding connection, so the message is dropped\n",__FUNCTION__); - //#endif - // } // while loop over connections - #ifdef OAI_DRV_DEBUG_CLASS - printk("[NAS][%s] end\n",__FUNCTION__); - #endif -} diff --git a/openair2/NAS/DRIVER/LITE/common.c b/openair2/NAS/DRIVER/LITE/common.c index 04106bbb9..fa8113f97 100755 --- a/openair2/NAS/DRIVER/LITE/common.c +++ b/openair2/NAS/DRIVER/LITE/common.c @@ -68,12 +68,11 @@ ntohs((addr)->s6_addr16[7]) -//#define OAI_DRV_DEBUG_SEND -//#define OAI_DRV_DEBUG_RECEIVE +//#define OAI_DRV_DEBUG_SEND +//#define OAI_DRV_DEBUG_RECEIVE void oai_nw_drv_common_class_wireless2ip(u16 dlen, void *pdcp_sdu, int inst, - struct classifier_entity *rclass, OaiNwDrvRadioBearerId_t rb_id) { //--------------------------------------------------------------------------- @@ -93,11 +92,7 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, #ifdef OAI_DRV_DEBUG_RECEIVE printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__, rb_id,inst,dlen); #endif - if (rclass == NULL) { - printk("[OAI_IP_DRV][%s] rclass Not found Drop RX packet\n",__FUNCTION__); - ++gpriv->stats.rx_dropped; - return; - } + skb = dev_alloc_skb( dlen + 2 ); if(!skb) { @@ -111,233 +106,188 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, skb->dev = oai_nw_drv_dev[inst]; hard_header_len = oai_nw_drv_dev[inst]->hard_header_len; - #ifdef KERNEL_VERSION_GREATER_THAN_2622 - skb->mac_header = skb->data; - #else - skb->mac.raw = skb->data; - #endif - //printk("[NAC_COMMIN_RECEIVE]: Packet Type %d (%d,%d)",skb->pkt_type,PACKET_HOST,PACKET_BROADCAST); + skb_set_mac_header(skb, 0); + skb_set_network_header(skb, hard_header_len); + skb->mark = rb_id; skb->pkt_type = PACKET_HOST; #ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] Receiving packet of size %d from PDCP \n",__FUNCTION__, skb->len); + printk("[OAI_IP_DRV][%s] Receiving packet @%p of size %d from PDCP \n",__FUNCTION__, skb->data, skb->len); for (i=0;i<skb->len;i++) printk("%2x ",((unsigned char *)(skb->data))[i]); printk("\n"); #endif - #ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] skb->data @ %p\n",__FUNCTION__, skb->data); - printk("[OAI_IP_DRV][%s] skb->mac_header @ %p\n",__FUNCTION__, skb->mac_header); - #endif - if (rclass->ip_version != OAI_NW_DRV_MPLS_VERSION_CODE) { // This is an IP packet - // LG TEST skb->ip_summed = CHECKSUM_NONE; - skb->ip_summed = CHECKSUM_UNNECESSARY; + // LG TEST skb->ip_summed = CHECKSUM_NONE; + skb->ip_summed = CHECKSUM_UNNECESSARY; - ipv = (struct ipversion *)&(skb->data[hard_header_len]); - switch (ipv->version) { + ipv = (struct ipversion *)skb_network_header(skb); - case 6: - #ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] receive IPv6 message\n",__FUNCTION__); - #endif - #ifdef KERNEL_VERSION_GREATER_THAN_2622 - skb->network_header = &skb->data[hard_header_len]; + switch (ipv->version) { + + case 6: + #ifdef OAI_DRV_DEBUG_RECEIVE + printk("[OAI_IP_DRV][%s] receive IPv6 message\n",__FUNCTION__); + #endif + skb_set_network_header(skb, hard_header_len); + //skb->network_header = &skb->data[hard_header_len]; + if (hard_header_len == 0) { + skb->protocol = htons(ETH_P_IPV6); + } else { + #ifdef OAI_NW_DRIVER_TYPE_ETHERNET + skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]); #else - skb->nh.ipv6h = (struct ipv6hdr *)&skb->data[hard_header_len]; #endif - if (hard_header_len == 0) { - skb->protocol = htons(ETH_P_IPV6); - } else { - #ifdef OAI_NW_DRIVER_TYPE_ETHERNET - skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]); - #else - #endif - } - //printk("Writing packet with protocol %x\n",ntohs(skb->protocol)); - break; - - case 4: - #ifdef NAS_ADDRESS_FIX - // Make the third byte of both the source and destination equal to the fourth of the destination - daddr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr; - odaddr = ((struct iphdr *)skb->data)->daddr; - //sn = addr[3]; - saddr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr; - osaddr = ((struct iphdr *)&skb->data[hard_header_len])->saddr; - - if (daddr[0] == saddr[0]) {// same network - daddr[2] = daddr[3]; // set third byte of destination to that of local machine so that local IP stack accepts the packet - saddr[2] = daddr[3]; // set third byte of source to that of local machine so that local IP stack accepts the packet - } else { // get the 3rd byte from device address in net_device structure - ifaddr = (unsigned char *)(&(((struct in_device *)((oai_nw_drv_dev[inst])->ip_ptr))->ifa_list->ifa_local)); - if (saddr[0] == ifaddr[0]) { // source is in same network as local machine - daddr[0] += saddr[3]; // fix address of remote destination to undo change at source - saddr[2] = ifaddr[2]; // set third byte to that of local machine so that local IP stack accepts the packet - } else { // source is remote machine from outside network - saddr[0] -= daddr[3]; // fix address of remote source to be understood by destination - daddr[2] = daddr[3]; // fix 3rd byte of local address to be understood by IP stack of - // destination - } + } + //printk("Writing packet with protocol %x\n",ntohs(skb->protocol)); + break; + + case 4: + #ifdef NAS_ADDRESS_FIX + // Make the third byte of both the source and destination equal to the fourth of the destination + daddr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr; + odaddr = ((struct iphdr *)skb->data)->daddr; + //sn = addr[3]; + saddr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr; + osaddr = ((struct iphdr *)&skb->data[hard_header_len])->saddr; + + if (daddr[0] == saddr[0]) {// same network + daddr[2] = daddr[3]; // set third byte of destination to that of local machine so that local IP stack accepts the packet + saddr[2] = daddr[3]; // set third byte of source to that of local machine so that local IP stack accepts the packet + } else { // get the 3rd byte from device address in net_device structure + ifaddr = (unsigned char *)(&(((struct in_device *)((oai_nw_drv_dev[inst])->ip_ptr))->ifa_list->ifa_local)); + if (saddr[0] == ifaddr[0]) { // source is in same network as local machine + daddr[0] += saddr[3]; // fix address of remote destination to undo change at source + saddr[2] = ifaddr[2]; // set third byte to that of local machine so that local IP stack accepts the packet + } else { // source is remote machine from outside network + saddr[0] -= daddr[3]; // fix address of remote source to be understood by destination + daddr[2] = daddr[3]; // fix 3rd byte of local address to be understood by IP stack of + // destination } - #endif //NAS_ADDRESS_FIX - #ifdef OAI_DRV_DEBUG_RECEIVE - //printk("NAS_TOOL_RECEIVE: receive IPv4 message\n"); - addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr; - if (addr) { + } + #endif //NAS_ADDRESS_FIX + #ifdef OAI_DRV_DEBUG_RECEIVE + //printk("NAS_TOOL_RECEIVE: receive IPv4 message\n"); + addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr; + if (addr) { //addr[2]^=0x01; printk("[OAI_IP_DRV][%s] Source %d.%d.%d.%d\n",__FUNCTION__, addr[0],addr[1],addr[2],addr[3]); - } - addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr; - if (addr){ + } + addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr; + if (addr){ //addr[2]^=0x01; printk("[OAI_IP_DRV][%s] Dest %d.%d.%d.%d\n",__FUNCTION__, addr[0],addr[1],addr[2],addr[3]); - } - printk("[OAI_IP_DRV][%s] protocol %d\n",__FUNCTION__, ((struct iphdr *)&skb->data[hard_header_len])->protocol); - #endif - - #ifdef KERNEL_VERSION_GREATER_THAN_2622 - skb->network_header = &skb->data[hard_header_len]; - network_header = (struct iphdr *)skb_network_header(skb); - protocol = network_header->protocol; - - #else - skb->nh.iph = (struct iphdr *)&skb->data[hard_header_len]; - protocol=skb->nh.iph->protocol; - #endif + } + printk("[OAI_IP_DRV][%s] protocol %d\n",__FUNCTION__, ((struct iphdr *)&skb->data[hard_header_len])->protocol); + #endif - #ifdef OAI_DRV_DEBUG_RECEIVE - switch (protocol) { - case IPPROTO_IP: - printk("[OAI_IP_DRV][%s] Received Raw IPv4 packet\n",__FUNCTION__); - break; - case IPPROTO_IPV6: - printk("[OAI_IP_DRV][%s] Received Raw IPv6 packet\n",__FUNCTION__); - break; - case IPPROTO_ICMP: - printk("[OAI_IP_DRV][%s] Received Raw ICMP packet\n",__FUNCTION__); - break; - case IPPROTO_TCP: - printk("[OAI_IP_DRV][%s] Received TCP packet\n",__FUNCTION__); - break; - case IPPROTO_UDP: - printk("[OAI_IP_DRV][%s] Received UDP packet\n",__FUNCTION__); - break; - default: - break; - } - #endif + skb_set_network_header(skb, hard_header_len); + //skb->network_header = &skb->data[hard_header_len]; + network_header = (struct iphdr *)skb_network_header(skb); + protocol = network_header->protocol; + + #ifdef OAI_DRV_DEBUG_RECEIVE + switch (protocol) { + case IPPROTO_IP: + printk("[OAI_IP_DRV][%s] Received Raw IPv4 packet\n",__FUNCTION__); + break; + case IPPROTO_IPV6: + printk("[OAI_IP_DRV][%s] Received Raw IPv6 packet\n",__FUNCTION__); + break; + case IPPROTO_ICMP: + printk("[OAI_IP_DRV][%s] Received Raw ICMP packet\n",__FUNCTION__); + break; + case IPPROTO_TCP: + printk("[OAI_IP_DRV][%s] Received TCP packet\n",__FUNCTION__); + break; + case IPPROTO_UDP: + printk("[OAI_IP_DRV][%s] Received UDP packet\n",__FUNCTION__); + break; + default: + break; + } + #endif - #ifdef NAS_ADDRESS_FIX - #ifdef KERNEL_VERSION_GREATER_THAN_2622 - network_header->check = 0; - network_header->check = ip_fast_csum((unsigned char *) network_header, network_header->ihl); - //printk("[OAI_IP_DRV][COMMON][RECEIVE] IP Fast Checksum %x \n", network_header->check); - #else - skb->nh.iph->check = 0; - skb->nh.iph->check = ip_fast_csum((unsigned char *)&skb->data[hard_header_len], skb->nh.iph->ihl); - // if (!(skb->nh.iph->frag_off & htons(IP_OFFSET))) { + #ifdef NAS_ADDRESS_FIX + network_header->check = 0; + network_header->check = ip_fast_csum((unsigned char *) network_header, network_header->ihl); + //printk("[OAI_IP_DRV][COMMON][RECEIVE] IP Fast Checksum %x \n", network_header->check); + + switch(protocol) { + case IPPROTO_TCP: + + cksum = (u16*)&(((struct tcphdr*)((network_header + (network_header->ihl<<2))))->check); + check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum)); + //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum)); + //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_TCP, ~(*cksum)); + + *cksum = csum_tcpudp_magic(~osaddr, ~odaddr, 0, 0, ~check); + //*cksum = csum_tcpudp_magic(~osaddr, ~odaddr, dlen, IPPROTO_TCP, ~check); + #ifdef OAI_DRV_DEBUG_RECEIVE + printk("[OAI_IP_DRV][%s] Inst %d TCP packet calculated CS %x, CS = %x (before), SA (%x)%x, DA (%x)%x\n",__FUNCTION__, + inst, + network_header->check, + *cksum, + osaddr, + ((struct iphdr *)skb->data)->saddr, + odaddr, + ((struct iphdr *)skb->data)->daddr); + + printk("[OAI_IP_DRV][%s] Inst %d TCP packet NEW CS %x\n",__FUNCTION__, + inst, + *cksum); #endif + break; - switch(protocol) { - case IPPROTO_TCP: - - #ifdef KERNEL_VERSION_GREATER_THAN_2622 - cksum = (u16*)&(((struct tcphdr*)((network_header + (network_header->ihl<<2))))->check); - check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum)); - //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum)); - //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_TCP, ~(*cksum)); - #else - cksum = (u16*)&(((struct tcphdr*)((skb->data + (skb->nh.iph->ihl<<2))))->check); - check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr,0,0, ~(*cksum)); - //check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr,tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum)); - // check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr, dlen, IPPROTO_TCP, ~(*cksum)); - #endif + case IPPROTO_UDP: + cksum = (u16*)&(((struct udphdr*)((network_header + (network_header->ihl<<2))))->check); + check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum)); + // check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, udp_hdr(skb)->len, IPPROTO_UDP, ~(*cksum)); + //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_UDP, ~(*cksum)); - *cksum = csum_tcpudp_magic(~osaddr, ~odaddr, 0, 0, ~check); - //*cksum = csum_tcpudp_magic(~osaddr, ~odaddr, dlen, IPPROTO_TCP, ~check); - #ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] Inst %d TCP packet calculated CS %x, CS = %x (before), SA (%x)%x, DA (%x)%x\n",__FUNCTION__, - inst, - network_header->check, - *cksum, - osaddr, - ((struct iphdr *)skb->data)->saddr, - odaddr, - ((struct iphdr *)skb->data)->daddr); - - printk("[OAI_IP_DRV][%s] Inst %d TCP packet NEW CS %x\n",__FUNCTION__, - inst, - *cksum); - #endif - break; + *cksum= csum_tcpudp_magic(~osaddr, ~odaddr,0,0, ~check); + //*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,udp_hdr(skb)->len, IPPROTO_UDP, ~check); + //*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,dlen, IPPROTO_UDP, ~check); - case IPPROTO_UDP: - #ifdef KERNEL_VERSION_GREATER_THAN_2622 - cksum = (u16*)&(((struct udphdr*)((network_header + (network_header->ihl<<2))))->check); - check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum)); - // check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, udp_hdr(skb)->len, IPPROTO_UDP, ~(*cksum)); - //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_UDP, ~(*cksum)); - #else - cksum = (u16*)&(((struct udphdr*)((&skb->data[hard_header_len] + (skb->nh.iph->ihl<<2))))->check); - check = csum_tcpudp_magic(((struct iphdr *)&skb->data[hard_header_len])->saddr, ((struct iphdr *)&skb->data[hard_header_len])->daddr, 0,0, ~(*cksum)); - //check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr, udp_hdr(skb)->len, IPPROTO_UDP, ~(*cksum)); - //check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr, dlen, IPPROTO_UDP, ~(*cksum)); - #endif - *cksum= csum_tcpudp_magic(~osaddr, ~odaddr,0,0, ~check); - //*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,udp_hdr(skb)->len, IPPROTO_UDP, ~check); - //*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,dlen, IPPROTO_UDP, ~check); + #ifdef OAI_DRV_DEBUG_RECEIVE + printk("[OAI_IP_DRV][%s] Inst %d UDP packet CS = %x (before), SA (%x)%x, DA (%x)%x\n",__FUNCTION__, + inst,*cksum,osaddr,((struct iphdr *)&skb->data[hard_header_len])->saddr,odaddr,((struct iphdr *)&skb->data[hard_header_len])->daddr); - #ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] Inst %d UDP packet CS = %x (before), SA (%x)%x, DA (%x)%x\n",__FUNCTION__, - inst,*cksum,osaddr,((struct iphdr *)&skb->data[hard_header_len])->saddr,odaddr,((struct iphdr *)&skb->data[hard_header_len])->daddr); - - printk("[OAI_IP_DRV][%s] Inst %d UDP packet NEW CS %x\n",__FUNCTION__,inst,*cksum); - #endif - //if ((check = *cksum) != 0) { - // src, dst, len, proto, sum - // } - break; - - default: - break; - } - //#endif // KERNEL VERSION > 22 - #endif //NAS_ADDRESS_FIX - if (hard_header_len == 0) { - skb->protocol = htons(ETH_P_IP); - } else { - #ifdef OAI_NW_DRIVER_TYPE_ETHERNET - skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]); - #else + printk("[OAI_IP_DRV][%s] Inst %d UDP packet NEW CS %x\n",__FUNCTION__,inst,*cksum); #endif - } - //printk("[OAI_IP_DRV][COMMON] Writing packet with protocol %x\n",ntohs(skb->protocol)); - break; + //if ((check = *cksum) != 0) { + // src, dst, len, proto, sum + // } + break; - default: + default: + break; + } + #endif //NAS_ADDRESS_FIX + if (hard_header_len == 0) { + skb->protocol = htons(ETH_P_IP); + } else { #ifdef OAI_NW_DRIVER_TYPE_ETHERNET - // fill skb->pkt_type, skb->dev - #ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] skb->data @ %p\n",__FUNCTION__, skb->data); - printk("[OAI_IP_DRV][%s] skb->network_header @ %p\n",__FUNCTION__, skb->network_header); - printk("[OAI_IP_DRV][%s] skb->mac_header @ %p\n",__FUNCTION__, skb->mac_header); + skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]); + #else #endif + } + //printk("[OAI_IP_DRV][COMMON] Writing packet with protocol %x\n",ntohs(skb->protocol)); + break; + + default: + // fill skb->pkt_type, skb->dev + skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]); // minus 1(short) instead of 2(bytes) because u16* - p_ether_type = (u16 *)&(skb->mac_header[hard_header_len-2]); + p_ether_type = (u16 *)(skb_network_header(skb)-2); ether_type = ntohs(*p_ether_type); - #ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] Packet is not IPv4 or IPv6 ether_type=%04X\n",__FUNCTION__, ether_type); - printk("[OAI_IP_DRV][%s] skb->data @ %p\n",__FUNCTION__, skb->data); - printk("[OAI_IP_DRV][%s] skb->network_header @ %p\n",__FUNCTION__, skb->network_header); - printk("[OAI_IP_DRV][%s] skb->mac_header @ %p\n",__FUNCTION__, skb->mac_header); - #endif + switch (ether_type) { case ETH_P_ARP: #ifdef OAI_DRV_DEBUG_RECEIVE @@ -345,32 +295,14 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, #endif //skb->pkt_type = PACKET_HOST; skb->protocol = htons(ETH_P_ARP); - #ifdef KERNEL_VERSION_GREATER_THAN_2622 - skb->network_header = &skb->mac_header[hard_header_len]; - #else - skb->nh.iph = (struct iphdr *)&skb->data[hard_header_len]; - #endif break; default: ; } - #else - printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__,rb_id,inst,dlen); - printk("[OAI_IP_DRV][%s] Inst %d: receive unknown message (version=%d)\n",__FUNCTION__,inst,ipv->version); - #endif - } - } else { // This is an MPLS packet - #ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] Received an MPLS packet on RB %d\n",__FUNCTION__,rb_id); - #endif - if (hard_header_len == 0) { - skb->protocol = htons(ETH_P_MPLS_UC); - } else { - #ifdef OAI_NW_DRIVER_TYPE_ETHERNET - skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]); - #endif - } + printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__,rb_id,inst,dlen); + printk("[OAI_IP_DRV][%s] Inst %d: receive unknown message (version=%d)\n",__FUNCTION__,inst,ipv->version); } + ++gpriv->stats.rx_packets; gpriv->stats.rx_bytes += dlen; #ifdef OAI_DRV_DEBUG_RECEIVE @@ -387,7 +319,7 @@ void oai_nw_drv_common_class_wireless2ip(u16 dlen, //--------------------------------------------------------------------------- // Delete the data -void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp,int inst){ +void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst){ //--------------------------------------------------------------------------- struct oai_nw_drv_priv *priv=netdev_priv(oai_nw_drv_dev[inst]); ++priv->stats.tx_dropped; @@ -395,7 +327,7 @@ void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, struct cx_entity *c //--------------------------------------------------------------------------- // Request the transfer of data (QoS SAP) -void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst){ +void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst){ //--------------------------------------------------------------------------- struct pdcp_data_req_header_t pdcph; struct oai_nw_drv_priv *priv=netdev_priv(oai_nw_drv_dev[inst]); @@ -410,96 +342,46 @@ void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, st #ifdef OAI_DRV_DEBUG_SEND printk("[OAI_IP_DRV][%s] inst %d begin \n",__FUNCTION__,inst); #endif - // if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR - // { - // priv->stats.tx_dropped ++; - // printk("NAS_QOS_SEND: No connected, so message are dropped \n"); - // return; - // } + if (skb==NULL){ #ifdef OAI_DRV_DEBUG_SEND printk("[OAI_IP_DRV][%s] input parameter skb is NULL \n",__FUNCTION__); #endif return; } - if (gc==NULL){ -#ifdef OAI_DRV_DEBUG_SEND - printk("[OAI_IP_DRV][%s] input parameter gc is NULL \n",__FUNCTION__); -#endif - priv->stats.tx_dropped ++; - return; - } - if (cx==NULL){ -#ifdef OAI_DRV_DEBUG_SEND - printk("[OAI_IP_DRV][%s] input parameter cx is NULL \n",__FUNCTION__); -#endif - priv->stats.tx_dropped ++; - return; - } - // End debug information - if (gc->rb==NULL) - { - gc->rb=oai_nw_drv_common_search_rb(cx, gc->rab_id); - if (gc->rb==NULL) - { - ++priv->stats.tx_dropped; - printk("[OAI_IP_DRV][%s] No corresponding Radio Bearer, so message are dropped, rab_id=%u \n", __FUNCTION__, gc->rab_id); - return; - } - } -#ifdef OAI_DRV_DEBUG_SEND - printk("[OAI_IP_DRV][%s] #1 :",__FUNCTION__); - printk("lcr %u, rab_id %u, rab_id %u, skb_len %d\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id,skb->len); - oai_nw_drv_print_classifier(gc); -#endif + pdcph.data_size = skb->len; - pdcph.rb_id = (gc->rb)->rab_id; + pdcph.rb_id = skb->mark; pdcph.inst = inst; - -#ifdef OAI_NW_DRIVER_USE_NETLINK bytes_wrote = oai_nw_drv_netlink_send((char *)&pdcph,OAI_NW_DRV_PDCPH_SIZE); #ifdef OAI_DRV_DEBUG_SEND printk("[OAI_IP_DRV][%s] Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n",__FUNCTION__, bytes_wrote,skb->len); #endif -#else - bytes_wrote = rtf_put(IP2PDCP_FIFO, &pdcph, OAI_NW_DRV_PDCPH_SIZE); -#ifdef OAI_DRV_DEBUG_SEND - printk("[OAI_IP_DRV][%s]Wrote %d bytes (header for %d byte skb) to PDCP fifo\n",__FUNCTION__, - bytes_wrote,skb->len); -#endif -#endif //OAI_NW_DRIVER_USE_NETLINK + if (bytes_wrote != OAI_NW_DRV_PDCPH_SIZE) { printk("[OAI_IP_DRV][%s] problem while writing PDCP's header (bytes wrote = %d to fifo %d)\n",__FUNCTION__,bytes_wrote,IP2PDCP_FIFO); - printk("rb_id %d, Wrote %d, Header Size %d \n", pdcph.rb_id , bytes_wrote, OAI_NW_DRV_PDCPH_SIZE); -#ifndef OAI_NW_DRIVER_USE_NETLINK - rtf_reset(IP2PDCP_FIFO); -#endif //OAI_NW_DRIVER_USE_NETLINK + printk("rb_id %u, Wrote %u, Header Size %lu \n", pdcph.rb_id , bytes_wrote, OAI_NW_DRV_PDCPH_SIZE); priv->stats.tx_dropped ++; return; } -#ifdef OAI_NW_DRIVER_USE_NETLINK bytes_wrote += oai_nw_drv_netlink_send((char *)skb->data,skb->len); -#else - bytes_wrote += rtf_put(IP2PDCP_FIFO, skb->data, skb->len); -#endif //OAI_NW_DRIVER_USE_NETLINK + if (bytes_wrote != skb->len+OAI_NW_DRV_PDCPH_SIZE) { - printk("[OAI_IP_DRV][%s] Inst %d, RB_ID %d: problem while writing PDCP's data, bytes_wrote = %d, Data_len %d, PDCPH_SIZE %d\n", + printk("[OAI_IP_DRV][%s] Inst %d, RB_ID %u: problem while writing PDCP's data, bytes_wrote = %u, Data_len %u, PDCPH_SIZE %lu\n", __FUNCTION__, inst, pdcph.rb_id, bytes_wrote, skb->len, OAI_NW_DRV_PDCPH_SIZE); // congestion -#ifndef OAI_NW_DRIVER_USE_NETLINK - rtf_reset(IP2PDCP_FIFO); -#endif //OAI_NW_DRIVER_USE_NETLINK + priv->stats.tx_dropped ++; return; } @@ -518,303 +400,25 @@ void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, st #endif } -#ifndef OAI_NW_DRIVER_USE_NETLINK -//--------------------------------------------------------------------------- -void oai_nw_drv_common_wireless2ip(void){ - //--------------------------------------------------------------------------- - u8 sapi; - struct pdcp_data_ind_header_t pdcph; - unsigned char data_buffer[2048]; - struct classifier_entity *rclass; - struct oai_nw_drv_priv *priv; - int bytes_read; - - // Start debug information -#ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] - begin \n", __FUNCTION__); -#endif - - // End debug information - - bytes_read = rtf_get(PDCP2IP_FIFO,&pdcph, OAI_NW_DRV_PDCPH_SIZE); - - while (bytes_read>0) { - if (bytes_read != OAI_NW_DRV_PDCPH_SIZE) - { - printk("[OAI_IP_DRV][%s] problem while reading PDCP header\n", __FUNCTION__); - return; - } - - priv=netdev_priv(oai_nw_drv_dev[pdcph.inst]); - rclass = oai_nw_drv_common_search_class_for_rb(pdcph.rb_id,priv); - - bytes_read+= rtf_get(PDCP2IP_FIFO, - data_buffer, - pdcph.data_size); - -#ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] - Got header for RB %d, Inst %d \n",__FUNCTION__, - pdcph.rb_id, - pdcph.inst); -#endif - - if (rclass) { -#ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] Found corresponding connection in classifier for RAB\n",__FUNCTION__); -#endif //OAI_DRV_DEBUG_RECEIVE - - oai_nw_drv_common_class_wireless2ip(pdcph.data_size, - (void *)data_buffer, - pdcph.inst, - rclass, - pdcph.rb_id); - } else { - priv->stats.tx_dropped += 1; - } - bytes_read = rtf_get(PDCP2IP_FIFO, &pdcph, OAI_NW_DRV_PDCPH_SIZE); - } -#ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] - end \n",__FUNCTION__); -#endif -} -#else //--------------------------------------------------------------------------- void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh) { //--------------------------------------------------------------------------- struct pdcp_data_ind_header_t *pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh); - struct classifier_entity *rclass; struct oai_nw_drv_priv *priv; priv = netdev_priv(oai_nw_drv_dev[pdcph->inst]); - #ifdef OAI_DRV_DEBUG_RECEIVE printk("[OAI_IP_DRV][%s] QOS receive from PDCP, size %d, rab %d, inst %d\n",__FUNCTION__, pdcph->data_size,pdcph->rb_id,pdcph->inst); #endif //OAI_DRV_DEBUG_RECEIVE - rclass = oai_nw_drv_common_search_class_for_rb(pdcph->rb_id,priv); - - if (rclass) { -#ifdef OAI_DRV_DEBUG_RECEIVE - printk("[OAI_IP_DRV][%s] Found corresponding connection in classifier for RAB\n",__FUNCTION__); -#endif //OAI_DRV_DEBUG_RECEIVE - - oai_nw_drv_common_class_wireless2ip(pdcph->data_size, + oai_nw_drv_common_class_wireless2ip(pdcph->data_size, (unsigned char *)NLMSG_DATA(nlh) + OAI_NW_DRV_PDCPH_SIZE, pdcph->inst, - rclass, pdcph->rb_id); - } else { - priv->stats.tx_dropped += 1; - } } -#endif //OAI_NW_DRIVER_USE_NETLINK -//--------------------------------------------------------------------------- -struct cx_entity *oai_nw_drv_common_search_cx(OaiNwDrvLocalConnectionRef_t lcr,struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- -#ifdef OAI_DRV_DEBUG_CLASS - printk("[OAI_IP_DRV][%s] - lcr %d\n",__FUNCTION__,lcr); -#endif - if (lcr<OAI_NW_DRV_CX_MAX) - return priv->cx+lcr; - else - return NULL; -} -//--------------------------------------------------------------------------- -// Search a Radio Bearer -struct rb_entity *oai_nw_drv_common_search_rb(struct cx_entity *cx, OaiNwDrvRadioBearerId_t rab_id){ - //--------------------------------------------------------------------------- - struct rb_entity *rb; -#ifdef OAI_DRV_DEBUG_CLASS - printk("[OAI_IP_DRV][%s] - rab_id %d\n",__FUNCTION__, rab_id); -#endif - for (rb=cx->rb; rb!=NULL; rb=rb->next) - { - if (rb->rab_id==rab_id) - return rb; - } - return NULL; -} - -// -// Search for a classifier with corresponding radio bearer - -//--------------------------------------------------------------------------- -struct classifier_entity *oai_nw_drv_common_search_class_for_rb(OaiNwDrvRadioBearerId_t rab_id,struct oai_nw_drv_priv *priv) { -//--------------------------------------------------------------------------- - - //struct rb_entity *rb; - int dscp; - struct classifier_entity *rclass; - -#ifdef OAI_DRV_DEBUG_CLASS - printk("[OAI_IP_DRV][%s] - rab_id %d\n",__FUNCTION__, rab_id); -#endif - for (dscp=0;dscp<OAI_NW_DRV_DSCP_MAX;dscp++) { - - // printk("[OAI_IP_DRV][COMMON] priv->rclassifier[%d] = %p\n",dscp,priv->rclassifier[dscp]); - for (rclass=priv->rclassifier[dscp]; rclass!=NULL; rclass=rclass->next) { -#ifdef OAI_DRV_DEBUG_CLASS - printk("[OAI_IP_DRV][%s] - dscp %d, rb %d\n",__FUNCTION__, dscp,rclass->rab_id); -#endif - if (rclass->rab_id==rab_id) - return rclass; - } - } - return NULL; - -} - -//--------------------------------------------------------------------------- -struct rb_entity *oai_nw_drv_common_add_rb(struct oai_nw_drv_priv *gpriv, struct cx_entity *cx, OaiNwDrvRadioBearerId_t rab_id, OaiNwDrvQoSTrafficClass_t qos){ - //-------------------------------------------------------------------------- - struct rb_entity *rb; - //struct classifier_entity *pclassifier; - //struct classifier_entity *rclassifier; - - #ifdef OAI_DRV_DEBUG_CLASS - printk("[OAI_IP_DRV][%s] begin for rab_id %d , qos %d\n",__FUNCTION__, rab_id, qos ); - #endif - if (cx==NULL){ - #ifdef OAI_DRV_DEBUG_CLASS - printk("[OAI_IP_DRV][%s] input parameter cx is NULL \n",__FUNCTION__); - #endif - return NULL; - } - rb=oai_nw_drv_common_search_rb(cx, rab_id); - if (rb==NULL) { - rb=(struct rb_entity *)kmalloc(sizeof(struct rb_entity), GFP_KERNEL); - if (rb!=NULL) { - rb->retry=0; - rb->countimer=OAI_NW_DRV_TIMER_IDLE; - rb->rab_id=rab_id; - //rb->rab_id=rab_id+(32*cx->lcr); - #ifdef OAI_DRV_DEBUG_DC - printk("[OAI_IP_DRV][%s] rab_id=%u, mt_id=%u\n",__FUNCTION__,rb->rab_id, cx->lcr); - #endif - rb->qos=qos; - rb->sapi=OAI_NW_DRV_RAB_INPUT_SAPI; - rb->state=OAI_NW_DRV_IDLE; - rb->next=cx->rb; - cx->rb=rb; - ++cx->num_rb; - } else { - printk("[OAI_IP_DRV][%s] NAS_ADD_CTL_RB: no memory\n",__FUNCTION__); - } - /*if (cx->num_rb == 1) { - // first RAB added, add default classification rule for multicast signalling - pclassifier=oai_nw_drv_class_add_send_classifier(cx, OAI_NW_DRV_DSCP_DEFAULT, 0); - if (pclassifier != NULL) { - pclassifier->rab_id = rab_id; - pclassifier->rb = rb; - oai_nw_drv_TOOL_fct(pclassifier, OAI_NW_DRV_FCT_QOS_SEND); - pclassifier->ip_version = OAI_NW_DRV_IP_VERSION_6; - memset((u8*)&pclassifier->saddr.ipv6,0,16); - memset((u8*)&pclassifier->daddr.ipv6,0,16); - printk("[OAI_IP_DRV][%s] ADD DEFAULT TX CLASSIFIER ON RAB %d OAI_NW_DRV_DSCP_DEFAULT Adding IPv6 %X:%X:%X:%X:%X:%X:%X:%X -> %X:%X:%X:%X:%X:%X:%X:%X \n", - __FUNCTION__, rab_id, NIP6ADDR(&pclassifier->saddr.ipv6), NIP6ADDR(&pclassifier->daddr.ipv6)); - pclassifier->splen = 0; - pclassifier->dplen = 0; - pclassifier->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT; - pclassifier->protocol_message_type = 0; //LG ?? - pclassifier->sport = htons(OAI_NW_DRV_PORT_DEFAULT); - pclassifier->dport = htons(OAI_NW_DRV_PORT_DEFAULT); - } - // first RAB added, add default classification rule for multicast signalling - rclassifier=oai_nw_drv_class_add_recv_classifier(OAI_NW_DRV_DSCP_DEFAULT, 1, gpriv); - if (rclassifier != NULL) { - rclassifier->rab_id = rab_id; - rclassifier->rb = rb; - //oai_nw_drv_TOOL_fct(rclassifier, OAI_NW_DRV_FCT_QOS_SEND); - rclassifier->ip_version = OAI_NW_DRV_IP_VERSION_6; - memset((u8*)&rclassifier->saddr.ipv6,0,16); - memset((u8*)&rclassifier->daddr.ipv6,0,16); - printk("[OAI_IP_DRV][%s] ADD DEFAULT RX CLASSIFIER ON RAB %d OAI_NW_DRV_DSCP_DEFAULT Adding IPv6 %X:%X:%X:%X:%X:%X:%X:%X -> %X:%X:%X:%X:%X:%X:%X:%X \n", - __FUNCTION__, rab_id, NIP6ADDR(&rclassifier->saddr.ipv6), NIP6ADDR(&rclassifier->daddr.ipv6)); - rclassifier->splen = 0; - rclassifier->dplen = 0; - rclassifier->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT; - rclassifier->protocol_message_type = 0; //LG ?? - rclassifier->sport = htons(OAI_NW_DRV_PORT_DEFAULT); - rclassifier->dport = htons(OAI_NW_DRV_PORT_DEFAULT); - } - pclassifier=oai_nw_drv_class_add_send_classifier(cx, OAI_NW_DRV_DSCP_DEFAULT, 2); - if (pclassifier != NULL) { - pclassifier->rab_id = rab_id; - pclassifier->rb = rb; - oai_nw_drv_TOOL_fct(pclassifier, OAI_NW_DRV_FCT_QOS_SEND); - pclassifier->ip_version = OAI_NW_DRV_IP_VERSION_4; - memset((u8*)&pclassifier->saddr.ipv4,0,4); - memset((u8*)&pclassifier->daddr.ipv4,0,4); - printk("[OAI_IP_DRV][%s] ADD DEFAULT TX CLASSIFIER ON RAB %d OAI_NW_DRV_DSCP_DEFAULT Adding IPv4 %d:%d:%d:%d -> %d.%d.%d.%d\n", - __FUNCTION__, rab_id, NIPADDR(pclassifier->saddr.ipv4), NIPADDR(pclassifier->daddr.ipv4)); - pclassifier->splen = 0; - pclassifier->dplen = 0; - pclassifier->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT; - pclassifier->protocol_message_type = 0; //LG ?? - pclassifier->sport = htons(OAI_NW_DRV_PORT_DEFAULT); - pclassifier->dport = htons(OAI_NW_DRV_PORT_DEFAULT); - } - // first RAB added, add default classification rule for multicast signalling - rclassifier=oai_nw_drv_class_add_recv_classifier(OAI_NW_DRV_DSCP_DEFAULT, 3, gpriv); - if (rclassifier != NULL) { - rclassifier->rab_id = rab_id; - rclassifier->rb = rb; - //oai_nw_drv_TOOL_fct(rclassifier, OAI_NW_DRV_FCT_QOS_SEND); - rclassifier->ip_version = OAI_NW_DRV_IP_VERSION_4; - memset((u8*)&rclassifier->saddr.ipv4,0,4); - memset((u8*)&rclassifier->daddr.ipv4,0,4); - printk("[OAI_IP_DRV][%s] ADD DEFAULT RX CLASSIFIER ON RAB %d OAI_NW_DRV_DSCP_DEFAULT Adding IPv4 %d:%d:%d:%d -> %d.%d.%d.%d\n", - __FUNCTION__, rab_id, NIPADDR(rclassifier->saddr.ipv4), NIPADDR(rclassifier->daddr.ipv4)); - rclassifier->splen = 0; - rclassifier->dplen = 0; - rclassifier->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT; - rclassifier->protocol_message_type = 0; //LG ?? - rclassifier->sport = htons(OAI_NW_DRV_PORT_DEFAULT); - rclassifier->dport = htons(OAI_NW_DRV_PORT_DEFAULT); - } - }*/ - } - #ifdef OAI_DRV_DEBUG_CLASS - printk("[OAI_IP_DRV][%s] end \n",__FUNCTION__ ); - #endif - return rb; -} - -//--------------------------------------------------------------------------- -void oai_nw_drv_common_flush_rb(struct cx_entity *cx){ - //--------------------------------------------------------------------------- - struct rb_entity *rb; - struct classifier_entity *gc; - u8 dscp; -#ifdef OAI_DRV_DEBUG_CLASS - printk("[OAI_IP_DRV][%s] begin\n",__FUNCTION__); -#endif - if (cx==NULL){ -#ifdef OAI_DRV_DEBUG_CLASS - printk("[OAI_IP_DRV][%s] input parameter cx is NULL \n",__FUNCTION__); -#endif - return; - } - // End debug information - for (rb=cx->rb; rb!=NULL; rb=cx->rb){ - printk("[OAI_IP_DRV][%s] del rab_id %u\n",__FUNCTION__, rb->rab_id); - cx->rb=rb->next; - kfree(rb); - } - cx->num_rb=0; - cx->rb=NULL; - for(dscp=0; dscp<OAI_NW_DRV_DSCP_MAX; ++dscp) - { - for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next) - gc->rb=NULL; - } -#ifdef OAI_DRV_DEBUG_CLASS - printk("[OAI_IP_DRV][%s] end\n",__FUNCTION__); -#endif -} diff --git a/openair2/NAS/DRIVER/LITE/device.c b/openair2/NAS/DRIVER/LITE/device.c index fe2eee515..d716ca55d 100755 --- a/openair2/NAS/DRIVER/LITE/device.c +++ b/openair2/NAS/DRIVER/LITE/device.c @@ -180,7 +180,6 @@ int oai_nw_drv_stop(struct net_device *dev){ //--------------------------------------------------------------------------- void oai_nw_drv_teardown(struct net_device *dev){ //--------------------------------------------------------------------------- - int cxi; struct oai_nw_drv_priv *priv; int inst; @@ -192,12 +191,12 @@ void oai_nw_drv_teardown(struct net_device *dev){ printk("[OAI_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__); return; } - oai_nw_drv_class_flush_recv_classifier(priv); + /*oai_nw_drv_class_flush_recv_classifier(priv); for (cxi=0;cxi<OAI_NW_DRV_CX_MAX;cxi++) { oai_nw_drv_common_flush_rb(priv->cx+cxi); oai_nw_drv_class_flush_send_classifier(priv->cx+cxi); - } + }*/ printk("[OAI_IP_DRV][%s] End\n", __FUNCTION__); } // check dev else { @@ -248,7 +247,7 @@ int oai_nw_drv_hard_start_xmit(struct sk_buff *skb, struct net_device *dev){ #ifdef OAI_DRV_DEBUG_DEVICE printk("[OAI_IP_DRV][%s] step 1\n", __FUNCTION__); #endif - oai_nw_drv_class_send(skb,inst); + oai_nw_drv_common_ip2wireless(skb,inst); #ifdef OAI_DRV_DEBUG_DEVICE printk("[OAI_IP_DRV][%s] step 2\n", __FUNCTION__); #endif @@ -335,7 +334,7 @@ static const struct net_device_ops nasmesh_netdev_ops = { // Initialisation of the network device void oai_nw_drv_init(struct net_device *dev){ //--------------------------------------------------------------------------- - u8 cxi, dscpi; + u8 cxi; struct oai_nw_drv_priv *priv; int index; @@ -385,7 +384,7 @@ void oai_nw_drv_init(struct net_device *dev){ //341 dev->tx_queue_len = 1000; /* Ethernet wants good queues */ //342 dev->flags = IFF_BROADCAST|IFF_MULTICAST; //343 dev->priv_flags |= IFF_TX_SKB_SHARING; - //344 + //344 //345 memset(dev->broadcast, 0xFF, ETH_ALEN); //346 } ether_setup(dev); @@ -416,10 +415,10 @@ void oai_nw_drv_init(struct net_device *dev){ // priv->timer_establishment=TIMER_ESTABLISHMENT_DEFAULT; // priv->timer_release=TIMER_RELEASE_DEFAULT; - for (dscpi=0; dscpi<OAI_NW_DRV_DSCP_MAX; ++dscpi) { + /*for (dscpi=0; dscpi<OAI_NW_DRV_DSCP_MAX; ++dscpi) { priv->rclassifier[dscpi]=NULL; } - priv->nrclassifier=0; + priv->nrclassifier=0;*/ // for (cxi=0;cxi<OAI_NW_DRV_CX_MAX;cxi++) { #ifdef OAI_DRV_DEBUG_DEVICE @@ -432,7 +431,7 @@ void oai_nw_drv_init(struct net_device *dev){ priv->cx[cxi].countimer = OAI_NW_DRV_TIMER_IDLE; priv->cx[cxi].retry = 0; priv->cx[cxi].lcr = cxi; - priv->cx[cxi].rb = NULL; + /*priv->cx[cxi].rb = NULL; priv->cx[cxi].num_rb = 0; // initialisation of the classifier for (dscpi=0; dscpi<65; ++dscpi) { @@ -442,6 +441,7 @@ void oai_nw_drv_init(struct net_device *dev){ priv->cx[cxi].nsclassifier=0; priv->cx[cxi].nfclassifier=0; + */ // initialisation of the IP address oai_nw_drv_TOOL_eNB_imei2iid(oai_nw_drv_IMEI, (u8 *)priv->cx[cxi].iid6, dev->addr_len); priv->cx[cxi].iid4=0; @@ -628,10 +628,3 @@ MODULE_PARM_DESC(oai_nw_drv_is_clusterhead,"The Clusterhead Indicator"); //MODULE_VERSION(DRV_VERSION); /*#endif*/ -/* -//--------------------------------------------------------------------------- -//module_init(init_nasmesh); -//module_exit(exit_nasmesh); -//--------------------------------------------------------------------------- - -*/ diff --git a/openair2/NAS/DRIVER/LITE/ioctl.c b/openair2/NAS/DRIVER/LITE/ioctl.c index b3397120d..53335dbfd 100755 --- a/openair2/NAS/DRIVER/LITE/ioctl.c +++ b/openair2/NAS/DRIVER/LITE/ioctl.c @@ -77,517 +77,12 @@ int oai_nw_drv_ioCTL_statistic_request(struct oai_nw_drv_ioctl *gifr, return 0; } -/////////////////////////////////////////////////////////////////////////////// -// Connections List -//--------------------------------------------------------------------------- -void oai_nw_drv_set_msg_cx_list_reply(u8 *msgrep, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - struct cx_entity *cx; - OaiNwDrvLocalConnectionRef_t lcr; - struct oai_nw_drv_msg_cx_list_reply *list; - msgrep[0]=OAI_NW_DRV_CX_MAX; - list=(struct oai_nw_drv_msg_cx_list_reply *)(msgrep+1); - for(lcr=0;lcr<OAI_NW_DRV_CX_MAX;++lcr) - { - cx=oai_nw_drv_common_search_cx(lcr,priv); - list[lcr].lcr=lcr; - list[lcr].state=cx->state; - list[lcr].cellid=cx->cellid; - list[lcr].iid4=cx->iid4; - list[lcr].iid6[0]=cx->iid6[0]; - list[lcr].iid6[1]=cx->iid6[1]; - list[lcr].num_rb=cx->num_rb; - list[lcr].nsclassifier=cx->nsclassifier; - printk("NAS_SET_MSG_CX_LIST_REPLY: nsc=%u\n",cx->nsclassifier); - } -} - -//--------------------------------------------------------------------------- -int oai_nw_drv_ioCTL_cx_list_request(struct oai_nw_drv_ioctl *gifr, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - u8 msgrep[OAI_NW_DRV_CX_MAX*sizeof(struct oai_nw_drv_msg_cx_list_reply)+1]; - printk("NAS_IOCTL_CX_LIST: connection list requested\n"); - oai_nw_drv_set_msg_cx_list_reply(msgrep,priv); - if (copy_to_user(gifr->msg, msgrep, OAI_NW_DRV_CX_MAX*sizeof(struct oai_nw_drv_msg_cx_list_reply)+1)) - { - printk("NAS_IOCTL_CX_LIST: copy_to_user failure\n"); - return -EFAULT; - } - printk("NAS_IOCTL_CX_LIST: end\n"); - return 0; -} - - - - -/////////////////////////////////////////////////////////////////////////////// -// Radio Bearer List -//--------------------------------------------------------------------------- -void oai_nw_drv_set_msg_rb_list_reply(u8 *msgrep, - struct oai_nw_drv_msg_rb_list_request *msgreq, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - struct cx_entity *cx; - cx=oai_nw_drv_common_search_cx(msgreq->lcr,priv); - if (cx!=NULL) - { - u8 rbi; - struct rb_entity *rb; - struct oai_nw_drv_msg_rb_list_reply *list; - if (cx->num_rb > OAI_NW_DRV_LIST_RB_MAX) - msgrep[0] = OAI_NW_DRV_LIST_RB_MAX; - else - msgrep[0] = cx->num_rb; - list=(struct oai_nw_drv_msg_rb_list_reply *)(msgrep+1); - for (rb=cx->rb, rbi=0; (rb!=NULL)&&(rbi<msgrep[0]); rb=rb->next, ++rbi) - { - list[rbi].state=rb->state; - list[rbi].rab_id=rb->rab_id; - list[rbi].sapi=rb->sapi; - list[rbi].qos=rb->qos; - } - } - else - msgrep[0]=0; -} - -//--------------------------------------------------------------------------- -int oai_nw_drv_ioCTL_rb_list_request(struct oai_nw_drv_ioctl *gifr, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - u8 msgrep[OAI_NW_DRV_LIST_RB_MAX*sizeof(struct oai_nw_drv_msg_rb_list_reply)+1]; - struct oai_nw_drv_msg_rb_list_request msgreq; - printk("NAS_IOCTL_RB_LIST: Radio Bearer list requested\n"); - if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) - { - printk("NAS_IOCTL_RB_LIST: copy_from_user failure\n"); - return -EFAULT; - } - oai_nw_drv_set_msg_rb_list_reply(msgrep, &msgreq,priv); - if (copy_to_user(gifr->msg, msgrep, OAI_NW_DRV_LIST_RB_MAX*sizeof(struct oai_nw_drv_msg_rb_list_reply)+1)) - { - printk("NAS_IOCTL_RB_LIST: copy_to_user failure\n"); - return -EFAULT; - } - printk("NAS_IOCTL_CX_LIST: end\n"); - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// -// Radio Bearer Establishment -//--------------------------------------------------------------------------- -void oai_nw_drv_set_msg_rb_establishment_reply(struct oai_nw_drv_msg_rb_establishment_reply *msgrep, - struct oai_nw_drv_msg_rb_establishment_request *msgreq, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - if ((msgreq->rab_id<3)||(msgreq->rab_id>OAI_NW_DRV_MAX_RABS)) { // navid : increase the number - msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTRABI; - } else { - struct cx_entity *cx; - cx=oai_nw_drv_common_search_cx(msgreq->lcr,priv); - if (cx==NULL) { - msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTLCR; - } else { - struct rb_entity *rb; - rb=oai_nw_drv_common_add_rb(priv, cx, msgreq->rab_id, msgreq->qos); - if (rb!=NULL){ - //rb->cnxid = msgreq->cnxid; - //msgrep->status=oai_nw_drv_rg_DC_send_rb_establish_request(cx, rb); - } else { - msgrep->status=-OAI_NW_DRV_ERROR_NOMEMORY; - //msgrep->cnxid = msgreq->cnxid; - } - } - } -} - -//--------------------------------------------------------------------------- -int oai_nw_drv_ioCTL_rb_establishment_request(struct oai_nw_drv_ioctl *gifr, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - struct oai_nw_drv_msg_rb_establishment_request msgreq; - struct oai_nw_drv_msg_rb_establishment_reply msgrep; - printk("NAS_IOCTL_RB_ESTABLISHMENT: Radio bearer establishment requested\n"); - if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) { - printk("NAS_IOCTL_RB_ESTABLISHMENT: copy_from_user failure\n"); - return -EFAULT; - } - - oai_nw_drv_set_msg_rb_establishment_reply(&msgrep, &msgreq,priv); - - if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) { - printk("NAS_IOCTL_RB_ESTABLISHMENT: copy_to_user failure\n"); - return -EFAULT; - } - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// -// Radio Bearer Release -//--------------------------------------------------------------------------- -void oai_nw_drv_set_msg_rb_release_reply(struct oai_nw_drv_msg_rb_release_reply *msgrep, - struct oai_nw_drv_msg_rb_release_request *msgreq, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - if (msgreq->lcr<OAI_NW_DRV_CX_MAX) - { - struct rb_entity *rb; - struct cx_entity *cx; - cx=oai_nw_drv_common_search_cx(msgreq->lcr,priv); - rb=oai_nw_drv_common_search_rb(cx, msgreq->rab_id); - if (rb!=NULL) { - //msgrep->status=oai_nw_drv_rg_DC_send_rb_release_request(cx, rb); - } - else - msgrep->status=-OAI_NW_DRV_ERROR_NOTCONNECTED; - // msgrep->cnxid = msgreq->cnxid; - } - else - msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTLCR; -} - -//--------------------------------------------------------------------------- -int oai_nw_drv_ioCTL_rb_release_request(struct oai_nw_drv_ioctl *gifr, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - struct oai_nw_drv_msg_rb_release_request msgreq; - struct oai_nw_drv_msg_rb_release_reply msgrep; - printk("NAS_IOCTL_RB_RELEASE: Radio bearer release requested\n"); - if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) - { - printk("NAS_IOCTL_RB_RELEASE: copy_from_user failure\n"); - return -EFAULT; - } - oai_nw_drv_set_msg_rb_release_reply(&msgrep, &msgreq, priv); - if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) - { - printk("NAS_IOCTL_RB_RELEASE: copy_to_user failure\n"); - return -EFAULT; - } - return 0; -} - - - -/////////////////////////////////////////////////////////////////////////////// -// Classifier List -//--------------------------------------------------------------------------- -void oai_nw_drv_set_msg_class_list_reply(u8 *msgrep, - struct oai_nw_drv_msg_class_list_request *msgreq, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - struct cx_entity *cx; - struct classifier_entity *gc; - struct oai_nw_drv_msg_class_list_reply *list; - u8 cli; - list=(struct oai_nw_drv_msg_class_list_reply *)(msgrep+1); - switch(msgreq->dir) - { - case OAI_NW_DRV_DIRECTION_SEND: - cx=oai_nw_drv_common_search_cx(msgreq->lcr,priv); - if (cx==NULL) { - msgrep[0]=0; - return; - } - gc=cx->sclassifier[msgreq->dscp]; - break; - case OAI_NW_DRV_DIRECTION_RECEIVE: - cx=NULL; - gc=priv->rclassifier[msgreq->dscp]; - break; - default: - cx=NULL; - msgrep[0]=0; - return; - } - for (cli=0; (gc!=NULL)&&(cli<OAI_NW_DRV_LIST_CLASS_MAX); gc=gc->next, ++cli) - { - list[cli].classref=gc->classref; - list[cli].lcr=msgreq->lcr; - list[cli].dir=msgreq->dir; - list[cli].dscp=msgreq->dscp; - list[cli].rab_id=gc->rab_id; - list[cli].version=gc->ip_version; - switch(gc->ip_version) - { - case 4: - list[cli].saddr.ipv4 = gc->saddr.ipv4; - list[cli].daddr.ipv4 = gc->daddr.ipv4; - break; - case 6: - list[cli].saddr.ipv6 = gc->saddr.ipv6; - list[cli].daddr.ipv6 = gc->daddr.ipv6; - break; - } - list[cli].protocol=gc->protocol; - list[cli].sport=ntohs(gc->sport); - list[cli].dport=ntohs(gc->dport); - list[cli].splen=gc->splen; - list[cli].dplen=gc->dplen; - list[cli].fct=oai_nw_drv_TOOL_invfct(gc); - } - msgrep[0]=cli; -} - -//--------------------------------------------------------------------------- -int oai_nw_drv_ioCTL_class_list_request(struct oai_nw_drv_ioctl *gifr, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - struct oai_nw_drv_msg_class_list_request msgreq; - printk("NAS_IOCTL_CLASS_LIST: classifier list requested\n"); - if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) - { - printk("NAS_IOCTL_CLASS_LIST: copy_from_user failure\n"); - return -EFAULT; - } - oai_nw_drv_set_msg_class_list_reply(g_msgrep, &msgreq,priv); - if (copy_to_user(gifr->msg, g_msgrep, OAI_NW_DRV_LIST_CLASS_MAX*sizeof(struct oai_nw_drv_msg_class_list_reply)+1)) - { - printk("NAS_IOCTL_CLASS_LIST: copy_to_user failure\n"); - return -EFAULT; - } - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// -// Request the addition of a classifier rule -//--------------------------------------------------------------------------- -void oai_nw_drv_set_msg_class_add_reply(struct oai_nw_drv_msg_class_add_reply *msgrep, - struct oai_nw_drv_msg_class_add_request *msgreq, - struct oai_nw_drv_priv *priv){ -//--------------------------------------------------------------------------- - struct classifier_entity *gc,*gc2; - unsigned char *saddr,*daddr; - unsigned int *saddr32,*daddr32; - - printk("[OAI_IP_DRV][CLASS] oai_nw_drv_set_msg_class_add_reply\n"); - - - if (msgreq->dscp>OAI_NW_DRV_DSCP_MAX){ - printk("NAS_SET_MSG_CLASS_ADD_REPLY: Incoherent parameter value\n"); - msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTDSCP; - return; - } - - if (msgreq->dir==OAI_NW_DRV_DIRECTION_SEND){ - - struct cx_entity *cx; - cx=oai_nw_drv_common_search_cx(msgreq->lcr,priv); - - if (cx!=NULL){ - printk("NAS_SET_MSG_CLASS_ADD_REPLY: DSCP/EXP %d, Classref %d, RB %u\n", msgreq->dscp, msgreq->classref,msgreq->rab_id ); - gc=oai_nw_drv_class_add_send_classifier(cx, msgreq->dscp, msgreq->classref); - - printk("NAS_SET_MSG_CLASS_ADD_REPLY: %p %p\n" , msgreq, gc); - - if (gc==NULL){ - msgrep->status=-OAI_NW_DRV_ERROR_NOMEMORY; - return; - } - }else{ - msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTLCR; - return; - } - gc->rab_id=msgreq->rab_id; - - gc->rb=oai_nw_drv_common_search_rb(cx, gc->rab_id); - printk("NAS_SET_MSG_CLASS_ADD_REPLY: gc_rb %p %u \n", gc->rb, gc->rab_id); - }else{ - if (msgreq->dir==OAI_NW_DRV_DIRECTION_RECEIVE) { - gc=oai_nw_drv_class_add_recv_classifier(msgreq->dscp, - msgreq->classref, - priv); - if (gc==NULL){ - msgrep->status=-OAI_NW_DRV_ERROR_NOMEMORY; - return; - } - gc->rab_id=msgreq->rab_id; - - } else { - msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTDIR; - return; - } - for (gc2 = priv->rclassifier[msgreq->dscp]; gc2!=NULL ; gc2 = gc2->next) - printk("[OAI_IP_DRV][CLASS] Add Receive Classifier dscp %d: rab_id %d (%p,next %p)\n",msgreq->dscp,gc2->rab_id,gc2,gc2->next); - } - printk("[OAI_IP_DRV][CLASS] Getting addresses ...\n"); - - oai_nw_drv_TOOL_fct(gc, msgreq->fct); - gc->ip_version=msgreq->version; - - switch(gc->ip_version){ - - case 4: - gc->saddr.ipv4=msgreq->saddr.ipv4; - gc->daddr.ipv4=msgreq->daddr.ipv4; - - // #ifdef NAS_CLASS_DEBUG - saddr = (unsigned char *)&gc->saddr.ipv4; - daddr = (unsigned char *)&gc->daddr.ipv4; - - printk("[OAI_IP_DRV][CLASS] Adding IPv4 %d.%d.%d.%d/%d -> %d.%d.%d.%d/%d\n", - saddr[0],saddr[1],saddr[2],saddr[3],msgreq->splen, - daddr[0],daddr[1],daddr[2],daddr[3],msgreq->dplen); - //#endif - gc->splen=msgreq->splen; - gc->dplen=msgreq->dplen; - break; - - case 6: - memcpy(&gc->saddr.ipv6,&msgreq->saddr.ipv6,16); - memcpy(&gc->daddr.ipv6,&msgreq->daddr.ipv6,16); - - saddr32 = (unsigned int *)&gc->saddr.ipv6; - daddr32 = (unsigned int *)&gc->daddr.ipv6; - - printk("[OAI_IP_DRV][CLASS] Adding IPv6 %X:%X:%X:%X:%X:%X:%X:%X/%d -> %X:%X:%X:%X:%X:%X:%X:%X/%d\n", - NIP6ADDR(&gc->saddr.ipv6), msgreq->splen, NIP6ADDR(&gc->daddr.ipv6), msgreq->dplen); - gc->splen=msgreq->splen; - gc->dplen=msgreq->dplen; - break; - - case OAI_NW_DRV_MPLS_VERSION_CODE: - printk("[OAI_IP_DRV][CLASS] Adding MPLS label %d with exp %d\n", - msgreq->daddr.mpls_label,msgreq->dscp); - gc->daddr.mpls_label = msgreq->daddr.mpls_label; - - break; - - case 0: - gc->saddr.ipv6.s6_addr32[0]=0; - gc->daddr.ipv6.s6_addr32[1]=0; - gc->saddr.ipv6.s6_addr32[2]=0; - gc->daddr.ipv6.s6_addr32[3]=0; - gc->splen=0; - gc->dplen=0; - break; - - default: - msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTVERSION; - kfree(gc); - return; - } - gc->protocol=msgreq->protocol; - gc->protocol_message_type=msgreq->protocol_message_type; - gc->sport=htons(msgreq->sport); - gc->dport=htons(msgreq->dport); - msgrep->status=0; -} - -//--------------------------------------------------------------------------- -int oai_nw_drv_ioCTL_class_add_request(struct oai_nw_drv_ioctl *gifr, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - struct oai_nw_drv_msg_class_add_request msgreq; - struct oai_nw_drv_msg_class_add_reply msgrep; - - - printk("NAS_IOCTL_CLASS_ADD: Add classifier components requested\n"); - printk("NAS_IOCTL_CLASS_ADD: size of gifr msg %d\n", sizeof(gifr->msg)); - - - if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))){ - printk("NAS_IOCTL_CLASS_ADD: copy_from_user failure\n"); - return -EFAULT; - } - - oai_nw_drv_set_msg_class_add_reply(&msgrep, &msgreq,priv); - if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))){ - printk("NAS_IOCTL_CLASS_ADD: copy_to_user failure\n"); - return -EFAULT; - } - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// -// Request the deletion of a classifier rule -//--------------------------------------------------------------------------- -void oai_nw_drv_set_msg_class_del_reply(struct oai_nw_drv_msg_class_del_reply *msgrep, - struct oai_nw_drv_msg_class_del_request *msgreq, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - if (msgreq->dscp>OAI_NW_DRV_DSCP_DEFAULT) { - printk("NAS_SET_MSG_CLASS_DEL_REPLY: Incoherent parameter value\n"); - msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTDSCP; - return; - } - - if (msgreq->dir==OAI_NW_DRV_DIRECTION_SEND) { - struct cx_entity *cx; - cx=oai_nw_drv_common_search_cx(msgreq->lcr,priv); - if (cx!=NULL) { - oai_nw_drv_class_del_send_classifier(cx, msgreq->dscp, msgreq->classref); - } else { - msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTLCR; - return; - } - } else { - if (msgreq->dir==OAI_NW_DRV_DIRECTION_RECEIVE) { - oai_nw_drv_class_del_recv_classifier(msgreq->dscp, msgreq->classref,priv); - } else { - msgrep->status=-OAI_NW_DRV_ERROR_NOTCORRECTDIR; - return; - } - } - msgrep->status=0; -} - -//--------------------------------------------------------------------------- -int oai_nw_drv_ioCTL_class_del_request(struct oai_nw_drv_ioctl *gifr, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - struct oai_nw_drv_msg_class_del_request msgreq; - struct oai_nw_drv_msg_class_del_reply msgrep; - printk("NAS_IOCTL_CLASS_DEL: Del classifier components requested\n"); - if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) { - printk("NAS_IOCTL_CLASS_DEL: copy_from_user failure\n"); - return -EFAULT; - } - - oai_nw_drv_set_msg_class_del_reply(&msgrep, &msgreq,priv); - - if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) { - printk("NAS_IOCTL_CLASS_DEL: copy_to_user failure\n"); - return -EFAULT; - } - return 0; -} - /////////////////////////////////////////////////////////////////////////////// // IMEI // Messages for IMEI transfer -//--------------------------------------------------------------------------- -void oai_nw_drv_set_msg_imei_reply(struct oai_nw_drv_msg_l2id_reply *msgrep, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - struct cx_entity *cx; - int lcr=0; // Temp lcr->mt =0 - cx=oai_nw_drv_common_search_cx(lcr,priv); - if (cx!=NULL) - { - msgrep->l2id[0] = cx->iid6[0]; - msgrep->l2id[1] = cx->iid6[1]; - } -} -//--------------------------------------------------------------------------- -int oai_nw_drv_ioCTL_imei_request(struct oai_nw_drv_ioctl *gifr, - struct oai_nw_drv_priv *priv){ - //--------------------------------------------------------------------------- - struct oai_nw_drv_msg_l2id_reply msgrep; - printk("NAS_IOCTL_IMEI: IMEI requested\n"); - oai_nw_drv_set_msg_imei_reply(&msgrep,priv); - if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) - { - printk("NAS_IOCTL_IMEI: copy_to_user failure\n"); - return -EFAULT; - } - return 0; -} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -613,30 +108,8 @@ int oai_nw_drv_CTL_ioctl(struct net_device *dev, case OAI_NW_DRV_MSG_STATISTIC_REQUEST: r=oai_nw_drv_ioCTL_statistic_request(gifr,priv); break; - case OAI_NW_DRV_MSG_CX_LIST_REQUEST: - r=oai_nw_drv_ioCTL_cx_list_request(gifr,priv); - break; - case OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REQUEST: - r=oai_nw_drv_ioCTL_rb_establishment_request(gifr,priv); - break; - case OAI_NW_DRV_MSG_RB_RELEASE_REQUEST: - r= oai_nw_drv_ioCTL_rb_release_request(gifr,priv); - break; - case OAI_NW_DRV_MSG_RB_LIST_REQUEST: - r=oai_nw_drv_ioCTL_rb_list_request(gifr,priv); - break; - case OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: - r=oai_nw_drv_ioCTL_class_add_request(gifr,priv); - break; - case OAI_NW_DRV_MSG_CLASS_LIST_REQUEST: - r=oai_nw_drv_ioCTL_class_list_request(gifr,priv); - break; - case OAI_NW_DRV_MSG_CLASS_DEL_REQUEST: - r=oai_nw_drv_ioCTL_class_del_request(gifr,priv); - break; - case OAI_NW_DRV_MSG_IMEI_REQUEST: - r=oai_nw_drv_ioCTL_imei_request(gifr,priv); - break; + + default: // printk("NAS_IOCTL_RRM: unkwon request type, type=%x\n", gifr->type); r=-EFAULT; @@ -651,9 +124,7 @@ int oai_nw_drv_CTL_ioctl(struct net_device *dev, } //--------------------------------------------------------------------------- -void oai_nw_drv_CTL_send(struct sk_buff *skb, - struct cx_entity *cx, - struct classifier_entity *gc,int inst){ +void oai_nw_drv_CTL_send(struct sk_buff *skb, int inst) { //--------------------------------------------------------------------------- printk("NAS_CTL_SEND - void \n"); } diff --git a/openair2/NAS/DRIVER/LITE/local.h b/openair2/NAS/DRIVER/LITE/local.h index 938c9e013..05c8aaec7 100755 --- a/openair2/NAS/DRIVER/LITE/local.h +++ b/openair2/NAS/DRIVER/LITE/local.h @@ -64,18 +64,6 @@ #include "constant.h" #include "sap.h" -//#include "rrc_nas_primitives.h" - - -struct rb_entity { - OaiNwDrvRadioBearerId_t rab_id; - OaiNwDrvSapId_t sapi; - OaiNwDrvQoSTrafficClass_t qos; - u8 state; - u8 retry; - u32 countimer; - struct rb_entity *next; -}; struct cx_entity { int sap[OAI_NW_DRV_SAPI_CX_MAX]; @@ -84,14 +72,9 @@ struct cx_entity { OaiNwDrvCellID_t cellid; // cell identification u32 countimer; // timeout's counter u8 retry; // number of retransmission - struct classifier_entity *sclassifier[OAI_NW_DRV_DSCP_MAX]; // send classifier; - struct classifier_entity *fclassifier[OAI_NW_DRV_DSCP_MAX]; // forward classifier; - u16 nsclassifier; - u16 nfclassifier; + u32 iid6[2]; // IPv6 interface identification u8 iid4; // IPv4 interface identification - struct rb_entity *rb; - u16 num_rb; // number of radio bearer in linked list int lastRRCprimitive; //measures int req_prov_id [OAI_NW_DRV_MAX_MEASURE_NB]; @@ -101,34 +84,6 @@ struct cx_entity { int provider_id [OAI_NW_DRV_MAX_MEASURE_NB]; }; -struct classifier_entity { - u32 classref; // classifier identity - struct classifier_entity *next; // linked list - u8 ip_version; // IP version 4 or 6 - union{ - struct in6_addr ipv6; - u32 ipv4; - } saddr; // IP source address - u8 splen; // IP source prefix length - union{ - struct in6_addr ipv6; - u32 ipv4; - unsigned int mpls_label; - } daddr; // IP destination address - u8 dplen; // IP destination prefix length - u8 protocol; // high layer protocol type (TCP, UDP,..) - unsigned char protocol_message_type; - u16 sport; // source port - u16 dport; // destination port - struct rb_entity *rb; // pointer to rb_entity for sending function or receiving in case of forwarding rule - struct rb_entity *rb_rx; // pointer to rb_entity for receiving (in case of forwarding rule) - OaiNwDrvRadioBearerId_t rab_id; // RAB identification for sending - OaiNwDrvRadioBearerId_t rab_id_rx; // RAB identification for receiving (in case of forwarding rule) - void (*fct)(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst); -}; - -//#define NAS_RETRY_LIMIT_DEFAULT 5 - struct oai_nw_drv_priv { int irq; int rx_flags; @@ -139,7 +94,7 @@ struct oai_nw_drv_priv { u32 timer_establishment; u32 timer_release; struct cx_entity cx[OAI_NW_DRV_CX_MAX]; - struct classifier_entity *rclassifier[OAI_NW_DRV_DSCP_MAX]; // receive classifier + //struct classifier_entity *rclassifier[OAI_NW_DRV_DSCP_MAX]; // receive classifier u16 nrclassifier; int sap[OAI_NW_DRV_SAPI_MAX]; struct sock *nl_sk; @@ -173,15 +128,9 @@ typedef struct pdcp_data_ind_header_t { extern struct net_device *oai_nw_drv_dev[OAI_NW_DRV_NB_INSTANCES_MAX]; -//extern int bytes_wrote; -//extern int bytes_read; extern u8 OAI_NW_DRV_NULL_IMEI[14]; -//global variables shared with RRC -#ifndef OAI_NW_DRIVER_USE_NETLINK -extern int pdcp_2_oai_nw_drv_irq; -#endif -//extern u8 nas_IMEI[14]; + #endif \ No newline at end of file diff --git a/openair2/NAS/DRIVER/LITE/proto_extern.h b/openair2/NAS/DRIVER/LITE/proto_extern.h index 31f31481d..3a0eb2dd6 100755 --- a/openair2/NAS/DRIVER/LITE/proto_extern.h +++ b/openair2/NAS/DRIVER/LITE/proto_extern.h @@ -74,39 +74,33 @@ int oai_nw_drv_find_inst(struct net_device *dev); // common.c /** -\fn void oai_nw_drv_common_class_wireless2ip(unsigned short dlen, void* pdcp_sdu,int inst,struct classifier_entity *rclass,OaiNwDrvRadioBearerId_t rb_id) +\fn void oai_nw_drv_common_class_wireless2ip(unsigned short dlen, void* pdcp_sdu,int inst,OaiNwDrvRadioBearerId_t rb_id) \brief Receive classified LTE packet, build skbuff struct with it and deliver it to the OS network layer. @param dlen Length of SDU in bytes @param pdcp_sdu Pointer to received SDU @param inst Instance number -@param rclass RX Classifier entity @param rb_id Radio Bearer Id */ void oai_nw_drv_common_class_wireless2ip(unsigned short dlen, void *pdcp_sdu, int inst, - struct classifier_entity *rclass, OaiNwDrvRadioBearerId_t rb_id); /** -\fn void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst) +\fn void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst) \brief Request the transfer of data (QoS SAP) @param skb pointer to socket buffer -@param cx pointer to connection entity for SDU -@param gc pointer to classifier entity for SDU @param inst device instance */ -void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst); +void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst); /** -\fn void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst) +\fn void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst) \brief Drop the IP packet comming from the OS network layer. @param skb pointer to socket buffer -@param cx pointer to connection entity for SDU -@param gc pointer to classifier entity for SDU @param inst device instance */ -void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst); +void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst); #ifndef OAI_NW_DRIVER_USE_NETLINK /** @@ -122,49 +116,6 @@ void oai_nw_drv_common_wireless2ip(void); void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh); #endif //OAI_NW_DRIVER_USE_NETLINK -/** -\fn struct rb_entity *oai_nw_drv_common_add_rb(struct cx_entity *cx, OaiNwDrvRadioBearerId_t rabi, OaiNwDrvQoSTrafficClass_t qos) -\brief Add a radio-bearer descriptor -@param gpriv pointer to driver instance private datas -@param cx pointer to connection entity -@param rabi radio-bearer index -@param qos NAS QOS traffic class - */ -struct rb_entity *oai_nw_drv_common_add_rb(struct oai_nw_drv_priv *gpriv, struct cx_entity *cx, OaiNwDrvRadioBearerId_t rab_id, OaiNwDrvQoSTrafficClass_t qos); - -/** -\fn struct rb_entity *oai_nw_drv_common_search_rb(struct cx_entity *cx, OaiNwDrvRadioBearerId_t rabi) -\brief Search for a radio-bearer entity for a particular connection and radio-bearer index -@param cx pointer to connection entity -@param rabi radio-bearer index -@returns A pointer to the radio-bearer entity - */ -struct rb_entity *oai_nw_drv_common_search_rb(struct cx_entity *cx, OaiNwDrvRadioBearerId_t rabi); - -/** -\fn struct cx_entity *oai_nw_drv_common_search_cx(OaiNwDrvLocalConnectionRef_t lcr,struct oai_nw_drv_priv *gpriv) -\brief Search for a connection entity based on its index and pointer to oai_nw_drv_priv -@param lcr index of local connection -@param gpriv pointer to oai_nw_drv_priv for device -@returns A pointer to the connection entity - */ -struct cx_entity *oai_nw_drv_common_search_cx(OaiNwDrvLocalConnectionRef_t lcr,struct oai_nw_drv_priv *gpriv); - -/** -\fn struct classifier_entity *oai_nw_drv_common_search_class_for_rb(OaiNwDrvRadioBearerId_t rab_id,struct oai_nw_drv_priv *priv) -\brief Search for an RX classifier entity based on a RB id and pointer to oai_nw_drv_priv -@param rab_id Index of RAB for search -@param priv pointer to oai_nw_drv_priv for device -@returns A pointer to the corresponding RX classifier entity - */ -struct classifier_entity *oai_nw_drv_common_search_class_for_rb(OaiNwDrvRadioBearerId_t rab_id,struct oai_nw_drv_priv *priv); - -/** -\fn void oai_nw_drv_common_flush_rb(struct cx_entity *cx) -\brief Clear all RB's for a particular connection -@param cx pointer to connection entity - */ -void oai_nw_drv_common_flush_rb(struct cx_entity *cx); #ifdef OAI_NW_DRIVER_USE_NETLINK /** @@ -186,15 +137,9 @@ void oai_nw_drv_COMMON_QOS_receive(struct nlmsghdr *nlh); #endif //OAI_NW_DRIVER_USE_NETLINK -// int oai_nw_drv_mesh_DC_receive(struct cx_entity *cx,struct oai_nw_drv_priv *gpriv); -// int oai_nw_drv_mesh_GC_receive(struct oai_nw_drv_priv *gpriv); -// int oai_nw_drv_mesh_DC_send_cx_establish_request(struct cx_entity *cx,struct oai_nw_drv_priv *gpriv); -// int oai_nw_drv_mesh_DC_send_cx_release_request(struct cx_entity *cx,struct oai_nw_drv_priv *gpriv); -// void oai_nw_drv_mesh_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,struct oai_nw_drv_priv *gpriv); // iocontrol.c -void oai_nw_drv_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc, int inst); -//int oai_nw_drv_CTL_receive_authentication(struct ipv6hdr *iph, struct cx-entity *cx, unsigned char sapi); +void oai_nw_drv_CTL_send(struct sk_buff *skb, int inst); int oai_nw_drv_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); // classifier.c @@ -205,70 +150,9 @@ int oai_nw_drv_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); void oai_nw_drv_class_send(struct sk_buff *skb, //!< Pointer to socket buffer int inst //!< Instance ID ); -/** - \brief -*/ -struct classifier_entity *oai_nw_drv_class_add_send_classifier(struct cx_entity *cx, unsigned char dscp, unsigned short classref); - -/** - \brief Send a socket received from IP to classifier for a particular instance ID. -*/ -struct classifier_entity *oai_nw_drv_class_add_fwd_classifier(struct cx_entity *cx, - unsigned char dscp, - unsigned short classref - ); - -/** - \brief Send a socket received from IP to classifier for a particular instance ID. -*/ -struct classifier_entity *oai_nw_drv_class_add_recv_classifier(unsigned char dscp, - unsigned short classref, - struct oai_nw_drv_priv* - ); - -/** - \brief -*/ -void oai_nw_drv_class_del_send_classifier(struct cx_entity *cx, - unsigned char dscp, - unsigned short classref - ); - -/** - \brief -*/ -void oai_nw_drv_class_del_fwd_classifier(struct cx_entity *cx, - unsigned char dscp, - unsigned short classref - ); - -/** - \brief -*/ -void oai_nw_drv_class_del_recv_classifier(unsigned char dscp, - unsigned short classref, - struct oai_nw_drv_priv* - ); - -/** - \brief -*/ -void oai_nw_drv_class_flush_send_classifier(struct cx_entity *cx); - -/** - \brief -*/ -void oai_nw_drv_class_flush_fwd_classifier(struct cx_entity *cx); - -/** - \brief -*/ -void oai_nw_drv_class_flush_recv_classifier(struct oai_nw_drv_priv *gpriv); // tool.c -unsigned char oai_nw_drv_TOOL_invfct(struct classifier_entity *gc); -void oai_nw_drv_TOOL_fct(struct classifier_entity *gc, unsigned char fct); void oai_nw_drv_TOOL_imei2iid(unsigned char *imei, unsigned char *iid); void oai_nw_drv_TOOL_eNB_imei2iid(unsigned char *imei, unsigned char *iid, unsigned char len); unsigned char oai_nw_drv_TOOL_get_dscp6(struct ipv6hdr *iph); @@ -285,9 +169,6 @@ void print_TOOL_pk_all(struct sk_buff *skb); void print_TOOL_pk_ipv6(struct ipv6hdr *iph); void print_TOOL_state(unsigned char state); void oai_nw_drv_tool_print_buffer(char * buffer,int length); -void oai_nw_drv_print_rb_entity(struct rb_entity *rb); -void oai_nw_drv_print_classifier(struct classifier_entity *gc); - #ifdef OAI_NW_DRIVER_USE_NETLINK // netlink.c diff --git a/openair2/NAS/DRIVER/LITE/tool.c b/openair2/NAS/DRIVER/LITE/tool.c index b6135aeb0..e3a410c54 100755 --- a/openair2/NAS/DRIVER/LITE/tool.c +++ b/openair2/NAS/DRIVER/LITE/tool.c @@ -42,58 +42,7 @@ //#define OAI_NW_DRV_DEBUG_TOOL 1 -//--------------------------------------------------------------------------- -// -void oai_nw_drv_TOOL_fct(struct classifier_entity *classifier, u8 fct){ -//--------------------------------------------------------------------------- -// Start debug information -#ifdef OAI_NW_DRV_DEBUG_TOOL - printk("OAI_NW_DRV_TOOL_FCT - begin \n"); -#endif - if (classifier==NULL){ -#ifdef OAI_NW_DRV_DEBUG_TOOL - printk("OAI_NW_DRV_TOOL_FCT - input parameter classifier is NULL \n"); -#endif - return; - } -// End debug information - switch(fct){ - case OAI_NW_DRV_FCT_QOS_SEND: - classifier->fct=oai_nw_drv_common_ip2wireless; - break; - case OAI_NW_DRV_FCT_CTL_SEND: - classifier->fct=oai_nw_drv_CTL_send; - break; - case OAI_NW_DRV_FCT_DEL_SEND: - classifier->fct=oai_nw_drv_common_ip2wireless_drop; - break; - default: - classifier->fct=oai_nw_drv_common_ip2wireless_drop; - } -} -//--------------------------------------------------------------------------- -u8 oai_nw_drv_TOOL_invfct(struct classifier_entity *classifier){ -//--------------------------------------------------------------------------- -// Start debug information -#ifdef OAI_NW_DRV_DEBUG_TOOL - printk("OAI_NW_DRV_TOOL_INVFCT - begin \n"); -#endif - if (classifier==NULL){ -#ifdef OAI_NW_DRV_DEBUG_TOOL - printk("OAI_NW_DRV_TOOL_INVFCT - input parameter classifier is NULL \n"); -#endif - return 0; - } -// End debug information - if (classifier->fct==oai_nw_drv_common_ip2wireless) - return OAI_NW_DRV_FCT_QOS_SEND; - if (classifier->fct==oai_nw_drv_CTL_send) - return OAI_NW_DRV_FCT_CTL_SEND; - if (classifier->fct==oai_nw_drv_common_ip2wireless_drop) - return OAI_NW_DRV_FCT_DEL_SEND; - return 0; -} //--------------------------------------------------------------------------- u8 oai_nw_drv_TOOL_get_dscp6(struct ipv6hdr *iph){ @@ -677,31 +626,7 @@ void print_TOOL_pk_all(struct sk_buff *skb){ return (1); }*/ -//--------------------------------------------------------------------------- -void print_TOOL_state(u8 state){ -//--------------------------------------------------------------------------- -// case OAI_NW_DRV_STATE_IDLE:printk(" State OAI_NW_DRV_STATE_IDLE\n");return; -// case OAI_NW_DRV_STATE_CONNECTED:printk(" State OAI_NW_DRV_STATE_CONNECTED\n");return; -// case OAI_NW_DRV_STATE_ESTABLISHMENT_REQUEST:printk(" State OAI_NW_DRV_STATE_ESTABLISHMENT_REQUEST\n");return; -// case OAI_NW_DRV_STATE_ESTABLISHMENT_FAILURE:printk(" State OAI_NW_DRV_STATE_ESTABLISHMENT_FAILURE\n");return; -// case OAI_NW_DRV_STATE_RELEASE_FAILURE:printk(" State OAI_NW_DRV_STATE_RELEASE_FAILURE\n");return; - - switch(state){ - case OAI_NW_DRV_IDLE:printk("OAI_NW_DRV_IDLE\n");return; - case OAI_NW_DRV_CX_FACH:printk("OAI_NW_DRV_CX_FACH\n");return; - case OAI_NW_DRV_CX_DCH:printk("OAI_NW_DRV_CX_DCH\n");return; - case OAI_NW_DRV_CX_RECEIVED:printk("OAI_NW_DRV_CX_RECEIVED\n");return; - case OAI_NW_DRV_CX_CONNECTING:printk("OAI_NW_DRV_CX_CONNECTING\n");return; - case OAI_NW_DRV_CX_RELEASING:printk("OAI_NW_DRV_CX_RELEASING\n");return; - case OAI_NW_DRV_CX_CONNECTING_FAILURE:printk("OAI_NW_DRV_CX_CONNECTING_FAILURE\n");return; - case OAI_NW_DRV_CX_RELEASING_FAILURE:printk("OAI_NW_DRV_CX_RELEASING_FAILURE\n");return; - case OAI_NW_DRV_RB_ESTABLISHING:printk("OAI_NW_DRV_RB_ESTABLISHING\n");return; - case OAI_NW_DRV_RB_RELEASING:printk("OAI_NW_DRV_RB_RELEASING\n");return; - case OAI_NW_DRV_RB_DCH:printk("OAI_NW_DRV_RB_DCH\n");return; - - default: printk(" Unknown state\n"); - } -} + //----------------------------------------------------------------------------- // Print the content of a buffer in hexadecimal @@ -725,42 +650,4 @@ void oai_nw_drv_tool_print_buffer(char * buffer,int length) { printk("-%hx-",buffer[i]); printk(",\t length %d\n", length); } -//----------------------------------------------------------------------------- -void oai_nw_drv_print_rb_entity(struct rb_entity *rb){ -//----------------------------------------------------------------------------- -// Start debug information -#ifdef OAI_NW_DRV_DEBUG_TOOL - printk("OAI_NW_DRV_PRINT_RB_ENTITY - begin \n"); -#endif - if (rb==NULL){ -#ifdef OAI_NW_DRV_DEBUG_TOOL - printk("OAI_NW_DRV_PRINT_RB_ENTITY - input parameter rb is NULL \n"); -#endif - return; - } -// End debug information - printk("\nrb_entity content: rab_id %d, sapi %d, qos %d, \n", rb->rab_id, rb->sapi, rb->qos); - printk("state %d, retry %d, countimer %d\n",rb->state, rb->retry, rb->countimer); -}; - -//----------------------------------------------------------------------------- -void oai_nw_drv_print_classifier(struct classifier_entity *classifier){ -//----------------------------------------------------------------------------- -// Start debug information -#ifdef OAI_NW_DRV_DEBUG_TOOL - printk("OAI_NW_DRV_PRINT_GC_ENTITY - begin \n"); -#endif - if (classifier==NULL){ -#ifdef OAI_NW_DRV_DEBUG_TOOL - printk("OAI_NW_DRV_PRINT_GC_ENTITY - input parameter classifier is NULL \n"); -#endif - return; - } -// End debug information - printk("\nClassifier content: classref %d, version %d, splen %d, dplen %d,\n", classifier->classref, classifier->ip_version, classifier->splen, classifier->dplen); - printk("protocol %d, sport %d, dport %d, rab_id %d\n", classifier->protocol, classifier->sport, classifier->dport, classifier->rab_id); - if (classifier->rb != NULL){ - oai_nw_drv_print_rb_entity(classifier->rb); - } -}; diff --git a/openair2/NAS/DRIVER/MESH/Makefile b/openair2/NAS/DRIVER/MESH/Makefile index d51f8774a..12727146c 100755 --- a/openair2/NAS/DRIVER/MESH/Makefile +++ b/openair2/NAS/DRIVER/MESH/Makefile @@ -37,7 +37,7 @@ ifeq ($(KERNEL_MAIN_VERSION),3) IS_KERNEL_SUBVERSION_GREATER_THAN_29 = "true" IS_KERNEL_SUBVERSION_GREATER_THAN_30 = "true" IS_KERNEL_SUBVERSION_GREATER_THAN_32 = "true" - IS_KERNEL_SUBVERSION_GREATER_THAN_301=$(shell if [ $(SUBVERSION) -ge 1 ] ; then echo true ; fi) + IS_KERNEL_SUBVERSION_GREATER_THAN_301=$(shell if [ $(SUBVERSION) -ge 1 ] ; then echo true ; fi) endif GT2622 = $(if $(IS_KERNEL_SUBVERSION_GREATER_THAN_22),-DKERNEL_VERSION_GREATER_THAN_2622=1) diff --git a/openair2/NAS/DRIVER/MESH/netlink.c b/openair2/NAS/DRIVER/MESH/netlink.c index c66549e19..603c7435b 100644 --- a/openair2/NAS/DRIVER/MESH/netlink.c +++ b/openair2/NAS/DRIVER/MESH/netlink.c @@ -45,6 +45,7 @@ #include "local.h" #include "proto_extern.h" +#include "platform_constants.h" //#define NETLINK_DEBUG 1 diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 0dcc79190..668f0ded4 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -54,18 +54,18 @@ #include "SIMULATION/ETH_TRANSPORT/extern.h" //#ifdef Rel10 -# include "MeasResults.h" +#include "MeasResults.h" //#endif #ifdef USER_MODE -# include "RRC/NAS/nas_config.h" -# include "RRC/NAS/rb_config.h" -# include "OCG.h" -# include "OCG_extern.h" +#include "RRC/NAS/nas_config.h" +#include "RRC/NAS/rb_config.h" +#include "OCG.h" +#include "OCG_extern.h" #endif #if defined(ENABLE_USE_MME) -# include "../../S1AP/s1ap_eNB.h" +#include "../../S1AP/s1ap_eNB.h" #endif //#define XER_PRINT @@ -76,207 +76,274 @@ extern EMULATION_VARS *Emul_vars; extern eNB_MAC_INST *eNB_mac_inst; extern UE_MAC_INST *UE_mac_inst; #ifdef BIGPHYSAREA -extern void *bigphys_malloc(int); +extern void *bigphys_malloc (int); #endif -extern inline unsigned int taus(void); -void init_SI(u8 Mod_id) { +extern inline unsigned int taus (void); +void +init_SI (u8 Mod_id) +{ - u8 SIwindowsize=1; - u16 SIperiod=8; + u8 SIwindowsize = 1; + u16 SIperiod = 8; /* - uint32_t mib=0; - int i; - int N_RB_DL,phich_resource; - - - do_MIB(mac_xface->lte_frame_parms,0x321,&mib); - - for (i=0;i<1024;i+=4) - do_MIB(mac_xface->lte_frame_parms,i,&mib); - - N_RB_DL=6; - while (N_RB_DL != 0) { - phich_resource = 1; - while (phich_resource != 0) { - for (i=0;i<2;i++) { - mac_xface->lte_frame_parms->N_RB_DL = N_RB_DL; - mac_xface->lte_frame_parms->phich_config_common.phich_duration=i; - mac_xface->lte_frame_parms->phich_config_common.phich_resource = phich_resource; - do_MIB(mac_xface->lte_frame_parms,0,&mib); - } - if (phich_resource == 1) - phich_resource = 3; - else if (phich_resource == 3) - phich_resource = 6; - else if (phich_resource == 6) - phich_resource = 12; - else if (phich_resource == 12) - phich_resource = 0; - } - if (N_RB_DL == 6) - N_RB_DL = 15; - else if (N_RB_DL == 15) - N_RB_DL = 25; - else if (N_RB_DL == 25) - N_RB_DL = 50; - else if (N_RB_DL == 50) - N_RB_DL = 75; - else if (N_RB_DL == 75) - N_RB_DL = 100; - else if (N_RB_DL == 100) - N_RB_DL = 0; - } - exit(-1); - */ + uint32_t mib=0; + int i; + int N_RB_DL,phich_resource; + + + do_MIB(mac_xface->lte_frame_parms,0x321,&mib); + + for (i=0;i<1024;i+=4) + do_MIB(mac_xface->lte_frame_parms,i,&mib); + + N_RB_DL=6; + while (N_RB_DL != 0) { + phich_resource = 1; + while (phich_resource != 0) { + for (i=0;i<2;i++) { + mac_xface->lte_frame_parms->N_RB_DL = N_RB_DL; + mac_xface->lte_frame_parms->phich_config_common.phich_duration=i; + mac_xface->lte_frame_parms->phich_config_common.phich_resource = phich_resource; + do_MIB(mac_xface->lte_frame_parms,0,&mib); + } + if (phich_resource == 1) + phich_resource = 3; + else if (phich_resource == 3) + phich_resource = 6; + else if (phich_resource == 6) + phich_resource = 12; + else if (phich_resource == 12) + phich_resource = 0; + } + if (N_RB_DL == 6) + N_RB_DL = 15; + else if (N_RB_DL == 15) + N_RB_DL = 25; + else if (N_RB_DL == 25) + N_RB_DL = 50; + else if (N_RB_DL == 50) + N_RB_DL = 75; + else if (N_RB_DL == 75) + N_RB_DL = 100; + else if (N_RB_DL == 100) + N_RB_DL = 0; + } + exit(-1); + */ eNB_rrc_inst[Mod_id].sizeof_SIB1 = 0; eNB_rrc_inst[Mod_id].sizeof_SIB23 = 0; - eNB_rrc_inst[Mod_id].SIB1 = (u8 *)malloc16(32); + eNB_rrc_inst[Mod_id].SIB1 = (u8 *) malloc16 (32); /* - printf ("before SIB1 init : Nid_cell %d\n", mac_xface->lte_frame_parms->Nid_cell); - printf ("before SIB1 init : frame_type %d,tdd_config %d\n", - mac_xface->lte_frame_parms->frame_type, - mac_xface->lte_frame_parms->tdd_config); - */ + printf ("before SIB1 init : Nid_cell %d\n", mac_xface->lte_frame_parms->Nid_cell); + printf ("before SIB1 init : frame_type %d,tdd_config %d\n", + mac_xface->lte_frame_parms->frame_type, + mac_xface->lte_frame_parms->tdd_config); + */ if (eNB_rrc_inst[Mod_id].SIB1) - eNB_rrc_inst[Mod_id].sizeof_SIB1 = do_SIB1(mac_xface->lte_frame_parms, - (uint8_t *)eNB_rrc_inst[Mod_id].SIB1, - &eNB_rrc_inst[Mod_id].siblock1, - &eNB_rrc_inst[Mod_id].sib1); - else { - LOG_E(RRC,"[eNB] init_SI: FATAL, no memory for SIB1 allocated\n"); - mac_xface->macphy_exit(""); - } + eNB_rrc_inst[Mod_id].sizeof_SIB1 = do_SIB1 (mac_xface->lte_frame_parms, + (uint8_t *) + eNB_rrc_inst[Mod_id].SIB1, + &eNB_rrc_inst[Mod_id]. + siblock1, + &eNB_rrc_inst[Mod_id].sib1); + else + { + LOG_E (RRC, "[eNB] init_SI: FATAL, no memory for SIB1 allocated\n"); + mac_xface->macphy_exit (""); + } /* - printf ("after SIB1 init : Nid_cell %d\n", mac_xface->lte_frame_parms->Nid_cell); - printf ("after SIB1 init : frame_type %d,tdd_config %d\n", - mac_xface->lte_frame_parms->frame_type, - mac_xface->lte_frame_parms->tdd_config); - */ + printf ("after SIB1 init : Nid_cell %d\n", mac_xface->lte_frame_parms->Nid_cell); + printf ("after SIB1 init : frame_type %d,tdd_config %d\n", + mac_xface->lte_frame_parms->frame_type, + mac_xface->lte_frame_parms->tdd_config); + */ if (eNB_rrc_inst[Mod_id].sizeof_SIB1 == 255) - mac_xface->macphy_exit(""); - - eNB_rrc_inst[Mod_id].SIB23 = (u8 *)malloc16(64); - if (eNB_rrc_inst[Mod_id].SIB23) { - - eNB_rrc_inst[Mod_id].sizeof_SIB23 = do_SIB23(Mod_id, - mac_xface->lte_frame_parms, - eNB_rrc_inst[Mod_id].SIB23, - &eNB_rrc_inst[Mod_id].systemInformation, - &eNB_rrc_inst[Mod_id].sib2, - &eNB_rrc_inst[Mod_id].sib3 + mac_xface->macphy_exit (""); + + eNB_rrc_inst[Mod_id].SIB23 = (u8 *) malloc16 (64); + if (eNB_rrc_inst[Mod_id].SIB23) + { + + eNB_rrc_inst[Mod_id].sizeof_SIB23 = do_SIB23 (Mod_id, + mac_xface-> + lte_frame_parms, + eNB_rrc_inst[Mod_id]. + SIB23, + &eNB_rrc_inst[Mod_id]. + systemInformation, + &eNB_rrc_inst[Mod_id]. + sib2, + &eNB_rrc_inst[Mod_id].sib3 #ifdef Rel10 - , - &eNB_rrc_inst[Mod_id].sib13, - eNB_rrc_inst[Mod_id].MBMS_flag + , + &eNB_rrc_inst[Mod_id]. + sib13, + eNB_rrc_inst[Mod_id]. + MBMS_flag #endif - ); - /* - eNB_rrc_inst[Mod_id].sizeof_SIB23 = do_SIB2_AT4(Mod_id, - eNB_rrc_inst[Mod_id].SIB23, - &eNB_rrc_inst[Mod_id].systemInformation, - &eNB_rrc_inst[Mod_id].sib2); - */ - if (eNB_rrc_inst[Mod_id].sizeof_SIB23 == 255) - mac_xface->macphy_exit("eNB_rrc_inst[Mod_id].sizeof_SIB23 == 255"); - - LOG_T(RRC,"[eNB %d] SIB2/3 Contents (partial)\n", Mod_id); - LOG_T(RRC,"[eNB %d] pusch_config_common.n_SB = %ld\n", Mod_id,eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB); - LOG_T(RRC,"[eNB %d] pusch_config_common.hoppingMode = %ld\n", Mod_id, eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode); - LOG_T(RRC,"[eNB %d] pusch_config_common.pusch_HoppingOffset = %ld\n", Mod_id,eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset); - LOG_T(RRC,"[eNB %d] pusch_config_common.enable64QAM = %d\n", Mod_id,(int)eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM); - LOG_T(RRC,"[eNB %d] pusch_config_common.groupHoppingEnabled = %d\n", Mod_id,(int)eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled); - LOG_T(RRC,"[eNB %d] pusch_config_common.groupAssignmentPUSCH = %ld\n", Mod_id,eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH); - LOG_T(RRC,"[eNB %d] pusch_config_common.sequenceHoppingEnabled = %d\n", Mod_id,(int)eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled); - LOG_T(RRC, "[eNB %d] pusch_config_common.cyclicShift = %ld\n",Mod_id, eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift); + ); + /* + eNB_rrc_inst[Mod_id].sizeof_SIB23 = do_SIB2_AT4(Mod_id, + eNB_rrc_inst[Mod_id].SIB23, + &eNB_rrc_inst[Mod_id].systemInformation, + &eNB_rrc_inst[Mod_id].sib2); + */ + if (eNB_rrc_inst[Mod_id].sizeof_SIB23 == 255) + mac_xface->macphy_exit ("eNB_rrc_inst[Mod_id].sizeof_SIB23 == 255"); + + LOG_T (RRC, "[eNB %d] SIB2/3 Contents (partial)\n", Mod_id); + LOG_T (RRC, "[eNB %d] pusch_config_common.n_SB = %ld\n", Mod_id, + eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon. + pusch_ConfigCommon.pusch_ConfigBasic.n_SB); + LOG_T (RRC, "[eNB %d] pusch_config_common.hoppingMode = %ld\n", Mod_id, + eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon. + pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode); + LOG_T (RRC, "[eNB %d] pusch_config_common.pusch_HoppingOffset = %ld\n", + Mod_id, + eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon. + pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset); + LOG_T (RRC, "[eNB %d] pusch_config_common.enable64QAM = %d\n", Mod_id, + (int) eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon. + pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM); + LOG_T (RRC, "[eNB %d] pusch_config_common.groupHoppingEnabled = %d\n", + Mod_id, + (int) eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon. + pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled); + LOG_T (RRC, "[eNB %d] pusch_config_common.groupAssignmentPUSCH = %ld\n", + Mod_id, + eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon. + pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. + groupAssignmentPUSCH); + LOG_T (RRC, + "[eNB %d] pusch_config_common.sequenceHoppingEnabled = %d\n", + Mod_id, + (int) eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon. + pusch_ConfigCommon.ul_ReferenceSignalsPUSCH. + sequenceHoppingEnabled); + LOG_T (RRC, "[eNB %d] pusch_config_common.cyclicShift = %ld\n", Mod_id, + eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon. + pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift); #ifdef Rel10 - if (eNB_rrc_inst[Mod_id].MBMS_flag ==1) { - - // LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", Mod_id, eNB_rrc_inst[Mod_id].sib2->mbsfn_SubframeConfigList->list.count); - LOG_D(RRC, "[eNB %d] mbsfn_Subframe_pattern is = %ld\n", Mod_id, eNB_rrc_inst[Mod_id].sib2->mbsfn_SubframeConfigList->list.array[0]->subframeAllocation.choice.oneFrame.buf[0]); - LOG_D(RRC, "[eNB %d] radioframe_allocation_period = %ld (just index number, not the real value)\n", Mod_id, eNB_rrc_inst[Mod_id].sib2->mbsfn_SubframeConfigList->list.array[0]->radioframeAllocationPeriod);// need to display the real value, using array of char (like in dumping SIB2) - LOG_D(RRC, "[eNB %d] radioframe_allocation_offset = %ld\n", Mod_id, eNB_rrc_inst[Mod_id].sib2->mbsfn_SubframeConfigList->list.array[0]->radioframeAllocationOffset); - // SIB13 - LOG_D(RRC, "[eNB %d] SIB13 contents (partial)\n", Mod_id); - LOG_D(RRC, "[eNB %d] Number of MBSFN Area: %ld\n",Mod_id, eNB_rrc_inst[Mod_id].sib13->mbsfn_AreaInfoList_r9.list.count); - LOG_D(RRC, "[eNB %d] MCCH Info of first MBSFN Area(partial)\n", Mod_id); - LOG_D(RRC, "[eNB %d] MCCH Repetition Period: %d (just index number, not real value)\n", Mod_id, eNB_rrc_inst[Mod_id].sib13->mbsfn_AreaInfoList_r9.list.array[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9); - LOG_D(RRC, "[eNB %d] MCCH Offset: %d\n", Mod_id, eNB_rrc_inst[Mod_id].sib13->mbsfn_AreaInfoList_r9.list.array[0]->mcch_Config_r9.mcch_Offset_r9); - } + if (eNB_rrc_inst[Mod_id].MBMS_flag == 1) + { + + // LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", Mod_id, eNB_rrc_inst[Mod_id].sib2->mbsfn_SubframeConfigList->list.count); + LOG_D (RRC, "[eNB %d] mbsfn_Subframe_pattern is = %ld\n", Mod_id, + eNB_rrc_inst[Mod_id].sib2->mbsfn_SubframeConfigList->list. + array[0]->subframeAllocation.choice.oneFrame.buf[0]); + LOG_D (RRC, "[eNB %d] radioframe_allocation_period = %ld (just index number, not the real value)\n", Mod_id, eNB_rrc_inst[Mod_id].sib2->mbsfn_SubframeConfigList->list.array[0]->radioframeAllocationPeriod); // need to display the real value, using array of char (like in dumping SIB2) + LOG_D (RRC, "[eNB %d] radioframe_allocation_offset = %ld\n", + Mod_id, + eNB_rrc_inst[Mod_id].sib2->mbsfn_SubframeConfigList->list. + array[0]->radioframeAllocationOffset); + // SIB13 + LOG_D (RRC, "[eNB %d] SIB13 contents (partial)\n", Mod_id); + LOG_D (RRC, "[eNB %d] Number of MBSFN Area: %ld\n", Mod_id, + eNB_rrc_inst[Mod_id].sib13->mbsfn_AreaInfoList_r9.list. + count); + LOG_D (RRC, "[eNB %d] MCCH Info of first MBSFN Area(partial)\n", + Mod_id); + LOG_D (RRC, + "[eNB %d] MCCH Repetition Period: %d (just index number, not real value)\n", + Mod_id, + eNB_rrc_inst[Mod_id].sib13->mbsfn_AreaInfoList_r9.list. + array[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9); + LOG_D (RRC, "[eNB %d] MCCH Offset: %d\n", Mod_id, + eNB_rrc_inst[Mod_id].sib13->mbsfn_AreaInfoList_r9.list. + array[0]->mcch_Config_r9.mcch_Offset_r9); + } #endif - LOG_D(RRC, "[MSC_MSG][FRAME unknown][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) --->][MAC_UE][MOD %02d][]\n", - Mod_id, Mod_id); - - rrc_mac_config_req(Mod_id,1,0,0, - (RadioResourceConfigCommonSIB_t *)&eNB_rrc_inst[Mod_id].sib2->radioResourceConfigCommon, - (struct PhysicalConfigDedicated *)NULL, - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - eNB_rrc_inst[Mod_id].sib1->tdd_Config, - &SIwindowsize, - &SIperiod, - eNB_rrc_inst[Mod_id].sib2->freqInfo.ul_CarrierFreq, - eNB_rrc_inst[Mod_id].sib2->freqInfo.ul_Bandwidth, - &eNB_rrc_inst[Mod_id].sib2->freqInfo.additionalSpectrumEmission, - (MBSFN_SubframeConfigList_t *)eNB_rrc_inst[Mod_id].sib2->mbsfn_SubframeConfigList + LOG_D (RRC, + "[MSC_MSG][FRAME unknown][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) --->][MAC_UE][MOD %02d][]\n", + Mod_id, Mod_id); + + rrc_mac_config_req (Mod_id, 1, 0, 0, + (RadioResourceConfigCommonSIB_t *) & + eNB_rrc_inst[Mod_id].sib2-> + radioResourceConfigCommon, + (struct PhysicalConfigDedicated *) NULL, + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, 0, + (struct LogicalChannelConfig *) NULL, + (MeasGapConfig_t *) NULL, + eNB_rrc_inst[Mod_id].sib1->tdd_Config, + &SIwindowsize, &SIperiod, + eNB_rrc_inst[Mod_id].sib2->freqInfo.ul_CarrierFreq, + eNB_rrc_inst[Mod_id].sib2->freqInfo.ul_Bandwidth, + &eNB_rrc_inst[Mod_id].sib2->freqInfo. + additionalSpectrumEmission, + (MBSFN_SubframeConfigList_t *) eNB_rrc_inst[Mod_id]. + sib2->mbsfn_SubframeConfigList #ifdef Rel10 - , - eNB_rrc_inst[Mod_id].MBMS_flag, - (MBSFN_AreaInfoList_r9_t *)&eNB_rrc_inst[Mod_id].sib13->mbsfn_AreaInfoList_r9, - (PMCH_InfoList_r9_t *)NULL + , + eNB_rrc_inst[Mod_id].MBMS_flag, + (MBSFN_AreaInfoList_r9_t *) & eNB_rrc_inst[Mod_id]. + sib13->mbsfn_AreaInfoList_r9, + (PMCH_InfoList_r9_t *) NULL #endif #ifdef CBA - , - 0,//eNB_rrc_inst[Mod_id].num_active_cba_groups, - 0 //eNB_rrc_inst[Mod_id].cba_rnti[0] -#endif - ); - } - else { - LOG_E(RRC,"[eNB] init_SI: FATAL, no memory for SIB2/3 allocated\n"); - mac_xface->macphy_exit(""); - } + , 0, //eNB_rrc_inst[Mod_id].num_active_cba_groups, + 0 //eNB_rrc_inst[Mod_id].cba_rnti[0] +#endif + ); + } + else + { + LOG_E (RRC, "[eNB] init_SI: FATAL, no memory for SIB2/3 allocated\n"); + mac_xface->macphy_exit (""); + } } #ifdef Rel10 -void init_MCCH(u8 Mod_id) { - +void +init_MCCH (u8 Mod_id) +{ + // initialize RRC_eNB_INST MCCH entry eNB_rrc_inst[Mod_id].sizeof_MCCH_MESSAGE = 0; - eNB_rrc_inst[Mod_id].MCCH_MESSAGE = (u8 *)malloc16(32); - if (eNB_rrc_inst[Mod_id].MCCH_MESSAGE) { - eNB_rrc_inst[Mod_id].sizeof_MCCH_MESSAGE = do_MBSFNAreaConfig(mac_xface->lte_frame_parms, - (uint8_t *)eNB_rrc_inst[Mod_id].MCCH_MESSAGE, - &eNB_rrc_inst[Mod_id].mcch, - &eNB_rrc_inst[Mod_id].mcch_message); - - LOG_D(RRC, "[eNB %d] MCCH_MESSAGE contents (partial)\n", Mod_id); - LOG_D(RRC, "[eNB %d] CommonSF_AllocPeriod_r9 %d\n", Mod_id, eNB_rrc_inst[Mod_id].mcch_message->commonSF_AllocPeriod_r9); - LOG_D(RRC, "[eNB %d] CommonSF_Alloc_r9.list.count (number of MBSFN Subframe Pattern) %d\n", Mod_id, eNB_rrc_inst[Mod_id].mcch_message->commonSF_Alloc_r9.list.count); - LOG_D(RRC, "[eNB %d] First MBSFN Subframe Pattern: %02x (in hex)\n", Mod_id, eNB_rrc_inst[Mod_id].mcch_message->commonSF_Alloc_r9.list.array[0]->subframeAllocation.choice.oneFrame.buf[0]); - - - } - else { - LOG_E(RRC, "[eNB] init_MCCH: FATAL, no memory for MCCH MESSAGE allocated\n"); - mac_xface->macphy_exit(""); - } - + eNB_rrc_inst[Mod_id].MCCH_MESSAGE = (u8 *) malloc16 (32); + if (eNB_rrc_inst[Mod_id].MCCH_MESSAGE) + { + eNB_rrc_inst[Mod_id].sizeof_MCCH_MESSAGE = + do_MBSFNAreaConfig (mac_xface->lte_frame_parms, + (uint8_t *) eNB_rrc_inst[Mod_id].MCCH_MESSAGE, + &eNB_rrc_inst[Mod_id].mcch, + &eNB_rrc_inst[Mod_id].mcch_message); + + LOG_D (RRC, "[eNB %d] MCCH_MESSAGE contents (partial)\n", Mod_id); + LOG_D (RRC, "[eNB %d] CommonSF_AllocPeriod_r9 %d\n", Mod_id, + eNB_rrc_inst[Mod_id].mcch_message->commonSF_AllocPeriod_r9); + LOG_D (RRC, + "[eNB %d] CommonSF_Alloc_r9.list.count (number of MBSFN Subframe Pattern) %d\n", + Mod_id, + eNB_rrc_inst[Mod_id].mcch_message->commonSF_Alloc_r9.list.count); + LOG_D (RRC, "[eNB %d] First MBSFN Subframe Pattern: %02x (in hex)\n", + Mod_id, + eNB_rrc_inst[Mod_id].mcch_message->commonSF_Alloc_r9.list. + array[0]->subframeAllocation.choice.oneFrame.buf[0]); + + + } + else + { + LOG_E (RRC, + "[eNB] init_MCCH: FATAL, no memory for MCCH MESSAGE allocated\n"); + mac_xface->macphy_exit (""); + } + if (eNB_rrc_inst[Mod_id].sizeof_MCCH_MESSAGE == 255) - mac_xface->macphy_exit(""); + mac_xface->macphy_exit (""); //Set the eNB_rrc_inst[Mod_id].MCCH_MESS.Active to 1 (allow to transfer MCCH message RRC->MAC in function mac_rrc_data_req) - eNB_rrc_inst[Mod_id].MCCH_MESS.Active =1; + eNB_rrc_inst[Mod_id].MCCH_MESS.Active = 1; // ??Configure MCCH logical channel // call mac_config_req with appropriate structure from ASN.1 description @@ -284,144 +351,154 @@ void init_MCCH(u8 Mod_id) { //LOG_I(RRC, "DUY: lcid before entering rrc_mac_config_req is %02d\n",eNB_rrc_inst[Mod_id].mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9); // LOG_I(RRC, "DUY: serviceID is %d\n",eNB_rrc_inst[Mod_id].mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->tmgi_r9.serviceId_r9.buf[2]); //LOG_I(RRC, "DUY: session ID is %d\n",eNB_rrc_inst[Mod_id].mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->sessionId_r9->buf[0]); - rrc_mac_config_req(Mod_id,1,0,0, - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (u8 *)NULL, - (u16 *)NULL, - NULL, - NULL, - NULL, - (MBSFN_SubframeConfigList_t *)NULL - + rrc_mac_config_req (Mod_id, 1, 0, 0, + (RadioResourceConfigCommonSIB_t *) NULL, + (struct PhysicalConfigDedicated *) NULL, + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, + 0, + (struct LogicalChannelConfig *) NULL, + (MeasGapConfig_t *) NULL, + (TDD_Config_t *) NULL, + (u8 *) NULL, + (u16 *) NULL, + NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL #ifdef Rel10 - , - 0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *) &(eNB_rrc_inst[Mod_id].mcch_message->pmch_InfoList_r9) -#endif + , + 0, + (MBSFN_AreaInfoList_r9_t *) NULL, + (PMCH_InfoList_r9_t *) & (eNB_rrc_inst[Mod_id]. + mcch_message-> + pmch_InfoList_r9) +#endif #ifdef CBA - , - 0, - 0 + , 0, 0 #endif - ); + ); //LOG_I(RRC,"DUY: lcid after rrc_mac_config_req is %02d\n",eNB_rrc_inst[Mod_id].mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9); - + } -void init_MBMS(u8 Mod_id, u32 frame) {// init the configuration for MTCH +void +init_MBMS (u8 Mod_id, u32 frame) +{ // init the configuration for MTCH // int j,i, num_mch; - if (eNB_rrc_inst[Mod_id].MBMS_flag ==1) { - - // LOG_I(RRC,"[eNB %d] Frame %d : Configuring Radio Bearer for MBMS service in MCH[%d]\n", Mod_id, frame,i); //check the lcid - // Configuring PDCP and RLC for MBMS Radio Bearer - - rrc_pdcp_config_asn1_req(Mod_id,frame,1,0, - NULL, // SRB_ToAddModList - NULL, // DRB_ToAddModList - (DRB_ToReleaseList_t*)NULL + if (eNB_rrc_inst[Mod_id].MBMS_flag == 1) + { + + // LOG_I(RRC,"[eNB %d] Frame %d : Configuring Radio Bearer for MBMS service in MCH[%d]\n", Mod_id, frame,i); //check the lcid + // Configuring PDCP and RLC for MBMS Radio Bearer + + rrc_pdcp_config_asn1_req (Mod_id, frame, 1, 0, NULL, // SRB_ToAddModList + NULL, // DRB_ToAddModList + (DRB_ToReleaseList_t *) NULL #ifdef Rel10 - , - &(eNB_rrc_inst[Mod_id].mcch_message->pmch_InfoList_r9) + , + &(eNB_rrc_inst[Mod_id].mcch_message-> + pmch_InfoList_r9) #endif - ); - - rrc_rlc_config_asn1_req(Mod_id, frame, 1, 0, - NULL,// SRB_ToAddModList - NULL,// DRB_ToAddModList - NULL,// DRB_ToReleaseList - &(eNB_rrc_inst[Mod_id].mcch_message->pmch_InfoList_r9)); - - - //rrc_mac_config_req(); - // use the same as of DTCH for the moment,need to check the flag for mXch - - } - + ); + + rrc_rlc_config_asn1_req (Mod_id, frame, 1, 0, NULL, // SRB_ToAddModList + NULL, // DRB_ToAddModList + NULL, // DRB_ToReleaseList + &(eNB_rrc_inst[Mod_id].mcch_message-> + pmch_InfoList_r9)); + + + //rrc_mac_config_req(); + // use the same as of DTCH for the moment,need to check the flag for mXch + + } + } #endif /*------------------------------------------------------------------------------*/ -char openair_rrc_lite_eNB_init(u8 Mod_id){ +char +openair_rrc_lite_eNB_init (u8 Mod_id) +{ /*-----------------------------------------------------------------------------*/ unsigned char j; - LOG_I(RRC,"[eNB %d] Init (UE State = RRC_IDLE)...\n", Mod_id); - LOG_D(RRC, "[MSC_NEW][FRAME 00000][RRC_eNB][MOD %02d][]\n", Mod_id); - LOG_D(RRC, "[MSC_NEW][FRAME 00000][IP][MOD %02d][]\n", Mod_id); + LOG_I (RRC, "[eNB %d] Init (UE State = RRC_IDLE)...\n", Mod_id); + LOG_D (RRC, "[MSC_NEW][FRAME 00000][RRC_eNB][MOD %02d][]\n", Mod_id); + LOG_D (RRC, "[MSC_NEW][FRAME 00000][IP][MOD %02d][]\n", Mod_id); - for (j=0; j<NUMBER_OF_UE_MAX; j++) - eNB_rrc_inst[Mod_id].Info.Status[j] = RRC_IDLE;//CH_READY; + for (j = 0; j < NUMBER_OF_UE_MAX; j++) + eNB_rrc_inst[Mod_id].Info.Status[j] = RRC_IDLE; //CH_READY; #if defined(ENABLE_USE_MME) /* Connect eNB to MME */ - if (oai_emulation.info.mme_enabled > 0) { - if (s1ap_eNB_init(oai_emulation.info.mme_ip_address, Mod_id) < 0) { - mac_xface->macphy_exit(""); - return -1; + if (oai_emulation.info.mme_enabled > 0) + { + if (s1ap_eNB_init (oai_emulation.info.mme_ip_address, Mod_id) < 0) + { + mac_xface->macphy_exit (""); + return -1; + } } - } #endif - eNB_rrc_inst[Mod_id].Info.Nb_ue=0; + eNB_rrc_inst[Mod_id].Info.Nb_ue = 0; - eNB_rrc_inst[Mod_id].Srb0.Active=0; + eNB_rrc_inst[Mod_id].Srb0.Active = 0; - for(j=0;j<(NUMBER_OF_UE_MAX+1);j++){ - eNB_rrc_inst[Mod_id].Srb2[j].Active=0; - } + for (j = 0; j < (NUMBER_OF_UE_MAX + 1); j++) + { + eNB_rrc_inst[Mod_id].Srb2[j].Active = 0; + } /// System Information INIT - LOG_I(RRC,"Checking release \n"); + LOG_I (RRC, "Checking release \n"); #ifdef Rel10 // This has to come from some top-level configuration - printf("Rel10 RRC detected, MBMS flag %d\n",eNB_rrc_inst[Mod_id].MBMS_flag); + printf ("Rel10 RRC detected, MBMS flag %d\n", + eNB_rrc_inst[Mod_id].MBMS_flag); -#else - printf("Rel8 RRC\n"); +#else + printf ("Rel8 RRC\n"); #endif -#ifdef CBA - for(j=0; j<NUM_MAX_CBA_GROUP; j++) +#ifdef CBA + for (j = 0; j < NUM_MAX_CBA_GROUP; j++) eNB_rrc_inst[Mod_id].cba_rnti[j] = CBA_OFFSET + j; - + if (eNB_rrc_inst[Mod_id].num_active_cba_groups > NUM_MAX_CBA_GROUP) eNB_rrc_inst[Mod_id].num_active_cba_groups = NUM_MAX_CBA_GROUP; - - LOG_D(RRC, "[eNB %d] Initialization of 4 cba_RNTI values (%x %x %x %x) num active groups %d\n", - Mod_id, eNB_rrc_inst[Mod_id].cba_rnti[0], eNB_rrc_inst[Mod_id].cba_rnti[1], - eNB_rrc_inst[Mod_id].cba_rnti[2],eNB_rrc_inst[Mod_id].cba_rnti[3], - eNB_rrc_inst[Mod_id].num_active_cba_groups); + + LOG_D (RRC, + "[eNB %d] Initialization of 4 cba_RNTI values (%x %x %x %x) num active groups %d\n", + Mod_id, eNB_rrc_inst[Mod_id].cba_rnti[0], + eNB_rrc_inst[Mod_id].cba_rnti[1], eNB_rrc_inst[Mod_id].cba_rnti[2], + eNB_rrc_inst[Mod_id].cba_rnti[3], + eNB_rrc_inst[Mod_id].num_active_cba_groups); #endif - init_SI(Mod_id); + init_SI (Mod_id); #ifdef Rel10 - if (eNB_rrc_inst[Mod_id].MBMS_flag ==1) { - /// MCCH INIT - init_MCCH(Mod_id); - /// MTCH data bearer init - init_MBMS(Mod_id,0); - } -#endif + if (eNB_rrc_inst[Mod_id].MBMS_flag == 1) + { + /// MCCH INIT + init_MCCH (Mod_id); + /// MTCH data bearer init + init_MBMS (Mod_id, 0); + } +#endif -#ifdef NO_RRM //init ch SRB0, SRB1 & BDTCH - openair_rrc_on(Mod_id,1); +#ifdef NO_RRM //init ch SRB0, SRB1 & BDTCH + openair_rrc_on (Mod_id, 1); #else - eNB_rrc_inst[Mod_id].Last_scan_req=0; - send_msg(&S_rrc,msg_rrc_phy_synch_to_MR_ind(Mod_id,eNB_rrc_inst[Mod_id].Mac_id)); + eNB_rrc_inst[Mod_id].Last_scan_req = 0; + send_msg (&S_rrc, + msg_rrc_phy_synch_to_MR_ind (Mod_id, + eNB_rrc_inst[Mod_id].Mac_id)); #endif return 0; @@ -429,438 +506,569 @@ char openair_rrc_lite_eNB_init(u8 Mod_id){ } -u8 get_next_UE_index(u8 Mod_id,u8 *UE_identity) { +u8 +get_next_UE_index (u8 Mod_id, u8 * UE_identity) +{ - u8 i,first_index = 255,reg=0; + u8 i, first_index = 255, reg = 0; - for (i=0;i<NUMBER_OF_UE_MAX;i++) { + for (i = 0; i < NUMBER_OF_UE_MAX; i++) + { - if ((first_index == 255) && (*(unsigned int*)eNB_rrc_inst[Mod_id].Info.UE_list[i] == 0x00000000)) - first_index = i; // save first free position + if ((first_index == 255) + && (*(unsigned int *) eNB_rrc_inst[Mod_id].Info.UE_list[i] == + 0x00000000)) + first_index = i; // save first free position - if ((eNB_rrc_inst[Mod_id].Info.UE_list[i][0]==UE_identity[0]) && - (eNB_rrc_inst[Mod_id].Info.UE_list[i][1]==UE_identity[1]) && - (eNB_rrc_inst[Mod_id].Info.UE_list[i][2]==UE_identity[2]) && - (eNB_rrc_inst[Mod_id].Info.UE_list[i][3]==UE_identity[3]) && - (eNB_rrc_inst[Mod_id].Info.UE_list[i][4]==UE_identity[4])) // UE_identity already registered - reg=1; + if ((eNB_rrc_inst[Mod_id].Info.UE_list[i][0] == UE_identity[0]) && (eNB_rrc_inst[Mod_id].Info.UE_list[i][1] == UE_identity[1]) && (eNB_rrc_inst[Mod_id].Info.UE_list[i][2] == UE_identity[2]) && (eNB_rrc_inst[Mod_id].Info.UE_list[i][3] == UE_identity[3]) && (eNB_rrc_inst[Mod_id].Info.UE_list[i][4] == UE_identity[4])) // UE_identity already registered + reg = 1; - } + } - if (reg==0) { - LOG_I(RRC,"Adding UE %d\n",first_index); - return(first_index); - } + if (reg == 0) + { + LOG_I (RRC, "Adding UE %d\n", first_index); + return (first_index); + } else - return(255); + return (255); } -void rrc_remove_UE(u8 Mod_id,u8 UE_id) { +void +rrc_remove_UE (u8 Mod_id, u8 UE_id) +{ - LOG_I(RRC,"Removing UE %d\n",UE_id); + LOG_I (RRC, "Removing UE %d\n", UE_id); eNB_rrc_inst[Mod_id].Info.Status[UE_id] = RRC_IDLE; - *(unsigned int*)eNB_rrc_inst[Mod_id].Info.UE_list[UE_id] = 0x00000000; + *(unsigned int *) eNB_rrc_inst[Mod_id].Info.UE_list[UE_id] = 0x00000000; } /*------------------------------------------------------------------------------*/ -int rrc_eNB_decode_dcch(u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index, u8 *Rx_sdu, u8 sdu_size) { +int +rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index, + u8 * Rx_sdu, u8 sdu_size) +{ /*------------------------------------------------------------------------------*/ asn_dec_rval_t dec_rval; //UL_DCCH_Message_t uldcchmsg; - UL_DCCH_Message_t *ul_dcch_msg=NULL;//&uldcchmsg; - UE_EUTRA_Capability_t *UE_EUTRA_Capability=NULL; + UL_DCCH_Message_t *ul_dcch_msg = NULL; //&uldcchmsg; + UE_EUTRA_Capability_t *UE_EUTRA_Capability = NULL; int i; - if (Srb_id != 1) { - LOG_E(RRC,"[eNB %d] Frame %d: Received message on SRB%d, should not have ...\n",Mod_id,frame,Srb_id); - } + if (Srb_id != 1) + { + LOG_E (RRC, + "[eNB %d] Frame %d: Received message on SRB%d, should not have ...\n", + Mod_id, frame, Srb_id); + } //memset(ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); - LOG_D(RRC,"[eNB %d] Frame %d: Decoding UL-DCCH Message\n", - Mod_id,frame); - dec_rval = uper_decode(NULL, - &asn_DEF_UL_DCCH_Message, - (void**)&ul_dcch_msg, - Rx_sdu, - sdu_size, - 0, - 0); - for (i=0;i<sdu_size;i++) - LOG_T(RRC,"%x.",Rx_sdu[i]); - LOG_T(RRC,"\n"); - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) { - LOG_E(RRC,"[UE %d] Frame %d : Failed to decode UL-DCCH (%d bytes)\n",Mod_id,frame,dec_rval.consumed); - return -1; - } + LOG_D (RRC, "[eNB %d] Frame %d: Decoding UL-DCCH Message\n", Mod_id, frame); + dec_rval = uper_decode (NULL, + &asn_DEF_UL_DCCH_Message, + (void **) &ul_dcch_msg, Rx_sdu, sdu_size, 0, 0); + for (i = 0; i < sdu_size; i++) + LOG_T (RRC, "%x.", Rx_sdu[i]); + LOG_T (RRC, "\n"); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) + { + LOG_E (RRC, "[UE %d] Frame %d : Failed to decode UL-DCCH (%d bytes)\n", + Mod_id, frame, dec_rval.consumed); + return -1; + } - if (ul_dcch_msg->message.present == UL_DCCH_MessageType_PR_c1) { - - switch (ul_dcch_msg->message.choice.c1.present) { - - case UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ - break; - case UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000: - break; - case UL_DCCH_MessageType__c1_PR_measurementReport: - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND " - "%d bytes (measurementReport) --->][RRC_eNB][MOD %02d][]\n", - frame, Mod_id, DCCH, sdu_size, Mod_id); - rrc_eNB_process_MeasurementReport(Mod_id,UE_index,&ul_dcch_msg->message.choice.c1.choice.measurementReport.criticalExtensions.choice.c1.choice.measurementReport_r8.measResults); - break; - case UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes " - "(RRCConnectionReconfigurationComplete) --->][RRC_eNB][MOD %02d][]\n", - frame, Mod_id, DCCH, sdu_size, Mod_id); - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.present == RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) { - rrc_eNB_process_RRCConnectionReconfigurationComplete(Mod_id,frame,UE_index,&ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8); - eNB_rrc_inst[Mod_id].Info.Status[UE_index] = RRC_RECONFIGURED; - LOG_I(RRC,"[eNB %d] UE %d State = RRC_RECONFIGURED \n",Mod_id,UE_index); - } - break; - case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes " - "(rrcConnectionReestablishmentComplete) --->][RRC_eNB][MOD %02d][]\n", - frame, Mod_id, DCCH, sdu_size, Mod_id); - break; - case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes " - "(RRCConnectionSetupComplete) --->][RRC_eNB][MOD %02d][]\n", - frame, Mod_id, DCCH, sdu_size, Mod_id); - - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.present == RRCConnectionSetupComplete__criticalExtensions_PR_c1) { - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.present == RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { - rrc_eNB_process_RRCConnectionSetupComplete(Mod_id, frame, UE_index, &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); - eNB_rrc_inst[Mod_id].Info.Status[UE_index] = RRC_CONNECTED; - LOG_I(RRC, "[eNB %d] UE %d State = RRC_CONNECTED \n", Mod_id, UE_index); - LOG_D(RRC, "[MSC_NBOX][FRAME %05d][RRC_eNB][MOD %02d][][Rx RRCConnectionSetupComplete\n" - "Now CONNECTED with UE %d][RRC_eNB][MOD %02d][]\n", - frame, Mod_id, UE_index, Mod_id); - } - } - break; - case UL_DCCH_MessageType__c1_PR_securityModeComplete: - LOG_I(RRC,"[eNB %d] Frame %d received securityModeComplete on UL-DCCH %d from UE %d\n", - Mod_id, frame, DCCH, UE_index ); - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes " - "(securityModeComplete) --->][RRC_eNB][MOD %02d][]\n", - frame, Mod_id, DCCH, sdu_size, Mod_id); + if (ul_dcch_msg->message.present == UL_DCCH_MessageType_PR_c1) + { + + switch (ul_dcch_msg->message.choice.c1.present) + { + + case UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ + break; + case UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000: + break; + case UL_DCCH_MessageType__c1_PR_measurementReport: + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND " + "%d bytes (measurementReport) --->][RRC_eNB][MOD %02d][]\n", + frame, Mod_id, DCCH, sdu_size, Mod_id); + rrc_eNB_process_MeasurementReport (Mod_id, UE_index, + &ul_dcch_msg->message.choice.c1. + choice.measurementReport. + criticalExtensions.choice.c1. + choice.measurementReport_r8. + measResults); + break; + case UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes " + "(RRCConnectionReconfigurationComplete) --->][RRC_eNB][MOD %02d][]\n", + frame, Mod_id, DCCH, sdu_size, Mod_id); + if (ul_dcch_msg->message.choice.c1.choice. + rrcConnectionReconfigurationComplete.criticalExtensions. + present == + RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) + { + rrc_eNB_process_RRCConnectionReconfigurationComplete (Mod_id, + frame, + UE_index, + &ul_dcch_msg-> + message. + choice.c1. + choice. + rrcConnectionReconfigurationComplete. + criticalExtensions. + choice. + rrcConnectionReconfigurationComplete_r8); + eNB_rrc_inst[Mod_id].Info.Status[UE_index] = RRC_RECONFIGURED; + LOG_I (RRC, "[eNB %d] UE %d State = RRC_RECONFIGURED \n", + Mod_id, UE_index); + } + break; + case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes " + "(rrcConnectionReestablishmentComplete) --->][RRC_eNB][MOD %02d][]\n", + frame, Mod_id, DCCH, sdu_size, Mod_id); + break; + case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes " + "(RRCConnectionSetupComplete) --->][RRC_eNB][MOD %02d][]\n", + frame, Mod_id, DCCH, sdu_size, Mod_id); + + if (ul_dcch_msg->message.choice.c1.choice. + rrcConnectionSetupComplete.criticalExtensions.present == + RRCConnectionSetupComplete__criticalExtensions_PR_c1) + { + if (ul_dcch_msg->message.choice.c1.choice. + rrcConnectionSetupComplete.criticalExtensions.choice.c1. + present == + RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) + { + rrc_eNB_process_RRCConnectionSetupComplete (Mod_id, frame, + UE_index, + &ul_dcch_msg-> + message.choice. + c1.choice. + rrcConnectionSetupComplete. + criticalExtensions. + choice.c1. + choice. + rrcConnectionSetupComplete_r8); + eNB_rrc_inst[Mod_id].Info.Status[UE_index] = RRC_CONNECTED; + LOG_I (RRC, "[eNB %d] UE %d State = RRC_CONNECTED \n", + Mod_id, UE_index); + LOG_D (RRC, + "[MSC_NBOX][FRAME %05d][RRC_eNB][MOD %02d][][Rx RRCConnectionSetupComplete\n" + "Now CONNECTED with UE %d][RRC_eNB][MOD %02d][]\n", + frame, Mod_id, UE_index, Mod_id); + } + } + break; + case UL_DCCH_MessageType__c1_PR_securityModeComplete: + LOG_I (RRC, + "[eNB %d] Frame %d received securityModeComplete on UL-DCCH %d from UE %d\n", + Mod_id, frame, DCCH, UE_index); + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes " + "(securityModeComplete) --->][RRC_eNB][MOD %02d][]\n", frame, + Mod_id, DCCH, sdu_size, Mod_id); #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)ul_dcch_msg); + xer_fprint (stdout, &asn_DEF_UL_DCCH_Message, (void *) ul_dcch_msg); #endif - // confirm with PDCP about the security mode for DCCH - //rrc_pdcp_config_req (Mod_id, frame, 1,ACTION_SET_SECURITY_MODE, (UE_index * NB_RB_MAX) + DCCH, 0x77); - // continue the procedure - rrc_eNB_generate_UECapabilityEnquiry(Mod_id,frame,UE_index); - break; - case UL_DCCH_MessageType__c1_PR_securityModeFailure: - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes " - "(securityModeFailure) --->][RRC_eNB][MOD %02d][]\n", - frame, Mod_id, DCCH, sdu_size, Mod_id); + // confirm with PDCP about the security mode for DCCH + //rrc_pdcp_config_req (Mod_id, frame, 1,ACTION_SET_SECURITY_MODE, (UE_index * NB_RB_MAX) + DCCH, 0x77); + // continue the procedure + rrc_eNB_generate_UECapabilityEnquiry (Mod_id, frame, UE_index); + break; + case UL_DCCH_MessageType__c1_PR_securityModeFailure: + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes " + "(securityModeFailure) --->][RRC_eNB][MOD %02d][]\n", frame, + Mod_id, DCCH, sdu_size, Mod_id); #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)ul_dcch_msg); + xer_fprint (stdout, &asn_DEF_UL_DCCH_Message, (void *) ul_dcch_msg); #endif - // cancel the security mode in PDCP - - // followup with the remaining procedure - rrc_eNB_generate_UECapabilityEnquiry(Mod_id,frame,UE_index); - break; - case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: - LOG_I(RRC,"[eNB %d] Frame %d received ueCapabilityInformation on UL-DCCH %d from UE %d\n", - Mod_id, frame, DCCH, UE_index ); - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes " - "(UECapabilityInformation) --->][RRC_eNB][MOD %02d][]\n", - frame, Mod_id, DCCH, sdu_size, Mod_id); + // cancel the security mode in PDCP + + // followup with the remaining procedure + rrc_eNB_generate_UECapabilityEnquiry (Mod_id, frame, UE_index); + break; + case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: + LOG_I (RRC, + "[eNB %d] Frame %d received ueCapabilityInformation on UL-DCCH %d from UE %d\n", + Mod_id, frame, DCCH, UE_index); + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes " + "(UECapabilityInformation) --->][RRC_eNB][MOD %02d][]\n", + frame, Mod_id, DCCH, sdu_size, Mod_id); #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)ul_dcch_msg); + xer_fprint (stdout, &asn_DEF_UL_DCCH_Message, (void *) ul_dcch_msg); #endif - dec_rval = uper_decode(NULL, - &asn_DEF_UE_EUTRA_Capability, - (void**)&UE_EUTRA_Capability, - ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[0]->ueCapabilityRAT_Container.buf, - ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[0]->ueCapabilityRAT_Container.size, - 0, - 0); + dec_rval = uper_decode (NULL, + &asn_DEF_UE_EUTRA_Capability, + (void **) &UE_EUTRA_Capability, + ul_dcch_msg->message.choice.c1.choice. + ueCapabilityInformation.criticalExtensions. + choice.c1.choice.ueCapabilityInformation_r8. + ue_CapabilityRAT_ContainerList.list. + array[0]->ueCapabilityRAT_Container.buf, + ul_dcch_msg->message.choice.c1.choice. + ueCapabilityInformation.criticalExtensions. + choice.c1.choice.ueCapabilityInformation_r8. + ue_CapabilityRAT_ContainerList.list. + array[0]->ueCapabilityRAT_Container.size, 0, + 0); #ifdef XER_PRINT - xer_fprint(stdout,&asn_DEF_UE_EUTRA_Capability,(void*)UE_EUTRA_Capability); + xer_fprint (stdout, &asn_DEF_UE_EUTRA_Capability, + (void *) UE_EUTRA_Capability); #endif - rrc_eNB_generate_defaultRRCConnectionReconfiguration(Mod_id,frame,UE_index, NULL, 0); - break; - case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: - break; - case UL_DCCH_MessageType__c1_PR_ulInformationTransfer: + rrc_eNB_generate_defaultRRCConnectionReconfiguration (Mod_id, frame, + UE_index, + NULL, 0); + break; + case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: + break; + case UL_DCCH_MessageType__c1_PR_ulInformationTransfer: #if defined(ENABLE_USE_MME) - { - if (oai_emulation.info.mme_enabled == 1) { - ULInformationTransfer_t *ulInformationTransfer; - ulInformationTransfer = &ul_dcch_msg->message.choice.c1.choice.ulInformationTransfer; - - if (ulInformationTransfer->criticalExtensions.present == - ULInformationTransfer__criticalExtensions_PR_c1) { - if (ulInformationTransfer->criticalExtensions.choice.c1.present == - ULInformationTransfer__criticalExtensions__c1_PR_ulInformationTransfer_r8) { - - ULInformationTransfer_r8_IEs_t *ulInformationTransferR8; - ulInformationTransferR8 = &ulInformationTransfer->criticalExtensions.choice.c1.choice.ulInformationTransfer_r8; - if (ulInformationTransferR8->dedicatedInfoType.present == ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS) - s1ap_eNB_new_data_request(Mod_id, - UE_index, - ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.buf, - ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.size); - } - } - } - } + { + if (oai_emulation.info.mme_enabled == 1) + { + ULInformationTransfer_t *ulInformationTransfer; + ulInformationTransfer = + &ul_dcch_msg->message.choice.c1.choice. + ulInformationTransfer; + + if (ulInformationTransfer->criticalExtensions.present == + ULInformationTransfer__criticalExtensions_PR_c1) + { + if (ulInformationTransfer->criticalExtensions.choice.c1. + present == + ULInformationTransfer__criticalExtensions__c1_PR_ulInformationTransfer_r8) + { + + ULInformationTransfer_r8_IEs_t + *ulInformationTransferR8; + ulInformationTransferR8 = + &ulInformationTransfer->criticalExtensions.choice. + c1.choice.ulInformationTransfer_r8; + if (ulInformationTransferR8->dedicatedInfoType. + present == + ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS) + s1ap_eNB_new_data_request (Mod_id, UE_index, + ulInformationTransferR8-> + dedicatedInfoType.choice. + dedicatedInfoNAS.buf, + ulInformationTransferR8-> + dedicatedInfoType.choice. + dedicatedInfoNAS.size); + } + } + } + } #endif - break; - case UL_DCCH_MessageType__c1_PR_counterCheckResponse: - break; + break; + case UL_DCCH_MessageType__c1_PR_counterCheckResponse: + break; #ifdef Rel10 - case UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: - break; - case UL_DCCH_MessageType__c1_PR_proximityIndication_r9: - break; - case UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: - break; - case UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: - break; - case UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: - break; + case UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: + break; + case UL_DCCH_MessageType__c1_PR_proximityIndication_r9: + break; + case UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: + break; + case UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: + break; + case UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: + break; #endif - default: - LOG_E(RRC,"[UE %d] Frame %d : Unknown message\n",Mod_id,frame); + default: + LOG_E (RRC, "[UE %d] Frame %d : Unknown message\n", Mod_id, frame); + return -1; + } + return 0; + } + else + { + LOG_E (RRC, "[UE %d] Frame %d : Unknown error\n", Mod_id, frame); return -1; } - return 0; - } - else { - LOG_E(RRC,"[UE %d] Frame %d : Unknown error\n",Mod_id,frame); - return -1; - } } /*------------------------------------------------------------------------------*/ -int rrc_eNB_decode_ccch(u8 Mod_id, u32 frame, SRB_INFO *Srb_info){ +int +rrc_eNB_decode_ccch (u8 Mod_id, u32 frame, SRB_INFO * Srb_info) +{ /*------------------------------------------------------------------------------*/ - u16 Idx,UE_index; + u16 Idx, UE_index; asn_dec_rval_t dec_rval; //UL_CCCH_Message_t ulccchmsg; - UL_CCCH_Message_t *ul_ccch_msg=NULL; //&ulccchmsg; + UL_CCCH_Message_t *ul_ccch_msg = NULL; //&ulccchmsg; RRCConnectionRequest_r8_IEs_t *rrcConnectionRequest; - int i,rval; + int i, rval; //memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t)); - LOG_T(RRC,"[eNB %d] Frame %d: Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n", Mod_id,frame, - ((uint8_t*)Srb_info->Rx_buffer.Payload)[0], - ((uint8_t*)Srb_info->Rx_buffer.Payload)[1], - ((uint8_t*)Srb_info->Rx_buffer.Payload)[2], - ((uint8_t*)Srb_info->Rx_buffer.Payload)[3], - ((uint8_t*)Srb_info->Rx_buffer.Payload)[4], - ((uint8_t*)Srb_info->Rx_buffer.Payload)[5], - (uint8_t*)Srb_info->Rx_buffer.Payload); - dec_rval = uper_decode(NULL, - &asn_DEF_UL_CCCH_Message, - (void**)&ul_ccch_msg, - (uint8_t*)Srb_info->Rx_buffer.Payload, - 100,0,0); - for (i=0;i<8;i++) - LOG_T(RRC,"%x.",((u8*)&ul_ccch_msg)[i]); - if (dec_rval.consumed == 0) { - LOG_E(RRC,"[eNB %d] FATAL Error in receiving CCCH\n", Mod_id); - return -1; //mac_xface->macphy_exit(""); //exit(-1); - } - if (ul_ccch_msg->message.present == UL_CCCH_MessageType_PR_c1) { - - switch (ul_ccch_msg->message.choice.c1.present) { - - case UL_CCCH_MessageType__c1_PR_NOTHING : - LOG_I(RRC,"[eNB %d] Frame %d : Received PR_NOTHING on UL-CCCH-Message\n",Mod_id,frame); - break; - - case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest : - LOG_D(RRC, "[MSC_MSG][FRAME %05d][MAC_eNB][MOD %02d][][--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) -->][RRC_eNB][MOD %02d][]\n", - frame, Mod_id, Mod_id); - LOG_I(RRC,"[eNB %d] Frame %d : RRCConnectionReestablishmentRequest not supported yet\n",Mod_id,frame); - break; - - case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest : - LOG_D(RRC, "[MSC_MSG][FRAME %05d][MAC_eNB][MOD %02d][][--- MAC_DATA_IND (rrcConnectionRequest on SRB0) -->][RRC_eNB][MOD %02d][]\n", - frame, Mod_id, Mod_id); - - rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; - UE_index = get_next_UE_index(Mod_id,(u8 *)rrcConnectionRequest->ue_Identity.choice.randomValue.buf); - - if (UE_index!=255) { - - // memcpy(&Rrc_xface->UE_id[Mod_id][UE_index],(u8 *)rrcConnectionRequest->ue_Identity.choice.randomValue.buf,5); - memcpy(&eNB_rrc_inst[Mod_id].Info.UE_list[UE_index],(u8 *)rrcConnectionRequest->ue_Identity.choice.randomValue.buf,5); - - LOG_I(RRC,"[eNB %d] Frame %d : Accept new connection from UE %d (%x%x%x%x%x)\n",Mod_id,frame,UE_index, - eNB_rrc_inst[Mod_id].Info.UE_list[UE_index][0], - eNB_rrc_inst[Mod_id].Info.UE_list[UE_index][1], - eNB_rrc_inst[Mod_id].Info.UE_list[UE_index][2], - eNB_rrc_inst[Mod_id].Info.UE_list[UE_index][3], - eNB_rrc_inst[Mod_id].Info.UE_list[UE_index][4]); - - //CONFIG SRB2 (DCCHs, ONE per User) //meas && lchan Cfg - //eNB_rrc_inst[Mod_id].Info.Dtch_bd_config[UE_index].Status=NEED_RADIO_CONFIG; - //eNB_rrc_inst[Mod_id].Info.Dtch_bd_config[UE_index].Next_eNBeck_frame=Rrc_xface->Frame_index+1; - eNB_rrc_inst[Mod_id].Info.Nb_ue++; + LOG_T (RRC, "[eNB %d] Frame %d: Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n", + Mod_id, frame, ((uint8_t *) Srb_info->Rx_buffer.Payload)[0], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[1], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[2], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[3], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[4], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[5], + (uint8_t *) Srb_info->Rx_buffer.Payload); + dec_rval = + uper_decode (NULL, &asn_DEF_UL_CCCH_Message, (void **) &ul_ccch_msg, + (uint8_t *) Srb_info->Rx_buffer.Payload, 100, 0, 0); + for (i = 0; i < 8; i++) + LOG_T (RRC, "%x.", ((u8 *) & ul_ccch_msg)[i]); + if (dec_rval.consumed == 0) + { + LOG_E (RRC, "[eNB %d] FATAL Error in receiving CCCH\n", Mod_id); + return -1; //mac_xface->macphy_exit(""); //exit(-1); + } + if (ul_ccch_msg->message.present == UL_CCCH_MessageType_PR_c1) + { + + switch (ul_ccch_msg->message.choice.c1.present) + { + + case UL_CCCH_MessageType__c1_PR_NOTHING: + LOG_I (RRC, + "[eNB %d] Frame %d : Received PR_NOTHING on UL-CCCH-Message\n", + Mod_id, frame); + break; + + case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest: + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][MAC_eNB][MOD %02d][][--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) -->][RRC_eNB][MOD %02d][]\n", + frame, Mod_id, Mod_id); + LOG_I (RRC, + "[eNB %d] Frame %d : RRCConnectionReestablishmentRequest not supported yet\n", + Mod_id, frame); + break; + + case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest: + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][MAC_eNB][MOD %02d][][--- MAC_DATA_IND (rrcConnectionRequest on SRB0) -->][RRC_eNB][MOD %02d][]\n", + frame, Mod_id, Mod_id); + + rrcConnectionRequest = + &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest. + criticalExtensions.choice.rrcConnectionRequest_r8; + UE_index = + get_next_UE_index (Mod_id, + (u8 *) rrcConnectionRequest->ue_Identity. + choice.randomValue.buf); + + if (UE_index != 255) + { + + // memcpy(&Rrc_xface->UE_id[Mod_id][UE_index],(u8 *)rrcConnectionRequest->ue_Identity.choice.randomValue.buf,5); + memcpy (&eNB_rrc_inst[Mod_id].Info.UE_list[UE_index], + (u8 *) rrcConnectionRequest->ue_Identity.choice. + randomValue.buf, 5); + + LOG_I (RRC, + "[eNB %d] Frame %d : Accept new connection from UE %d (%x%x%x%x%x)\n", + Mod_id, frame, UE_index, + eNB_rrc_inst[Mod_id].Info.UE_list[UE_index][0], + eNB_rrc_inst[Mod_id].Info.UE_list[UE_index][1], + eNB_rrc_inst[Mod_id].Info.UE_list[UE_index][2], + eNB_rrc_inst[Mod_id].Info.UE_list[UE_index][3], + eNB_rrc_inst[Mod_id].Info.UE_list[UE_index][4]); + + //CONFIG SRB2 (DCCHs, ONE per User) //meas && lchan Cfg + //eNB_rrc_inst[Mod_id].Info.Dtch_bd_config[UE_index].Status=NEED_RADIO_CONFIG; + //eNB_rrc_inst[Mod_id].Info.Dtch_bd_config[UE_index].Next_eNBeck_frame=Rrc_xface->Frame_index+1; + eNB_rrc_inst[Mod_id].Info.Nb_ue++; #ifndef NO_RRM - send_msg(&S_rrc,msg_rrc_MR_attach_ind(Mod_id,Mac_id)); + send_msg (&S_rrc, msg_rrc_MR_attach_ind (Mod_id, Mac_id)); #else - Idx = (UE_index * NB_RB_MAX) + DCCH; - // SRB1 - eNB_rrc_inst[Mod_id].Srb1[UE_index].Active = 1; - eNB_rrc_inst[Mod_id].Srb1[UE_index].Srb_info.Srb_id = Idx; - memcpy(&eNB_rrc_inst[Mod_id].Srb1[UE_index].Srb_info.Lchan_desc[0],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE); - memcpy(&eNB_rrc_inst[Mod_id].Srb1[UE_index].Srb_info.Lchan_desc[1],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE); - - // SRB2 - eNB_rrc_inst[Mod_id].Srb2[UE_index].Active = 1; - eNB_rrc_inst[Mod_id].Srb2[UE_index].Srb_info.Srb_id = Idx; - memcpy(&eNB_rrc_inst[Mod_id].Srb2[UE_index].Srb_info.Lchan_desc[0],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE); - memcpy(&eNB_rrc_inst[Mod_id].Srb2[UE_index].Srb_info.Lchan_desc[1],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE); - - rrc_eNB_generate_RRCConnectionSetup(Mod_id,frame,UE_index); - //LOG_D(RRC, "[MSC_NBOX][FRAME %05d][RRC_eNB][MOD %02d][][Tx RRCConnectionSetup][RRC_eNB][MOD %02d][]\n", - // frame, Mod_id, Mod_id); - - //LOG_D(RRC,"[eNB %d] RLC AM allocation index@0 is %d\n",Mod_id,rlc[Mod_id].m_rlc_am_array[0].allocation); - //LOG_D(RRC,"[eNB %d] RLC AM allocation index@1 is %d\n",Mod_id,rlc[Mod_id].m_rlc_am_array[1].allocation); - LOG_I(RRC,"[eNB %d] CALLING RLC CONFIG SRB1 (rbid %d) for UE %d\n", - Mod_id,Idx,UE_index); - - // rrc_pdcp_config_req (Mod_id, frame, 1, ACTION_ADD, idx, UNDEF_SECURITY_MODE); - - // rrc_rlc_config_req(Mod_id,frame,1,ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); - - rrc_pdcp_config_asn1_req(Mod_id,frame,1,UE_index, - eNB_rrc_inst[Mod_id].SRB_configList[UE_index], - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL + Idx = (UE_index * NB_RB_MAX) + DCCH; + // SRB1 + eNB_rrc_inst[Mod_id].Srb1[UE_index].Active = 1; + eNB_rrc_inst[Mod_id].Srb1[UE_index].Srb_info.Srb_id = Idx; + memcpy (&eNB_rrc_inst[Mod_id].Srb1[UE_index].Srb_info. + Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + memcpy (&eNB_rrc_inst[Mod_id].Srb1[UE_index].Srb_info. + Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + + // SRB2 + eNB_rrc_inst[Mod_id].Srb2[UE_index].Active = 1; + eNB_rrc_inst[Mod_id].Srb2[UE_index].Srb_info.Srb_id = Idx; + memcpy (&eNB_rrc_inst[Mod_id].Srb2[UE_index].Srb_info. + Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + memcpy (&eNB_rrc_inst[Mod_id].Srb2[UE_index].Srb_info. + Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + + rrc_eNB_generate_RRCConnectionSetup (Mod_id, frame, UE_index); + //LOG_D(RRC, "[MSC_NBOX][FRAME %05d][RRC_eNB][MOD %02d][][Tx RRCConnectionSetup][RRC_eNB][MOD %02d][]\n", + // frame, Mod_id, Mod_id); + + //LOG_D(RRC,"[eNB %d] RLC AM allocation index@0 is %d\n",Mod_id,rlc[Mod_id].m_rlc_am_array[0].allocation); + //LOG_D(RRC,"[eNB %d] RLC AM allocation index@1 is %d\n",Mod_id,rlc[Mod_id].m_rlc_am_array[1].allocation); + LOG_I (RRC, + "[eNB %d] CALLING RLC CONFIG SRB1 (rbid %d) for UE %d\n", + Mod_id, Idx, UE_index); + + // rrc_pdcp_config_req (Mod_id, frame, 1, ACTION_ADD, idx, UNDEF_SECURITY_MODE); + + // rrc_rlc_config_req(Mod_id,frame,1,ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); + + rrc_pdcp_config_asn1_req (Mod_id, frame, 1, UE_index, + eNB_rrc_inst[Mod_id]. + SRB_configList[UE_index], + (DRB_ToAddModList_t *) NULL, + (DRB_ToReleaseList_t *) NULL #ifdef Rel10 - ,(PMCH_InfoList_r9_t *)NULL + , (PMCH_InfoList_r9_t *) NULL #endif - ); - - rrc_rlc_config_asn1_req(Mod_id,frame,1,UE_index, - eNB_rrc_inst[Mod_id].SRB_configList[UE_index], - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL + ); + + rrc_rlc_config_asn1_req (Mod_id, frame, 1, UE_index, + eNB_rrc_inst[Mod_id]. + SRB_configList[UE_index], + (DRB_ToAddModList_t *) NULL, + (DRB_ToReleaseList_t *) NULL #ifdef Rel10 - ,(MBMS_SessionInfoList_r9_t *)NULL + , (MBMS_SessionInfoList_r9_t *) NULL #endif - ); - //LOG_D(RRC,"[eNB %d] RLC AM allocation index@0 is %d\n",Mod_id,rlc[Mod_id].m_rlc_am_array[0].allocation); - //LOG_D(RRC,"[eNB %d] RLC AM allocation index@1 is %d\n",Mod_id,rlc[Mod_id].m_rlc_am_array[1].allocation); - - /* - - LOG_D(RRC,"[eNB %d] CALLING RLC CONFIG SRB2 (rbid %d) for UE %d\n", - Mod_id,Idx+1,UE_index); - Mac_rlc_xface->rrc_rlc_config_req(Mod_id,ACTION_ADD,Idx+1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); - LOG_D(RRC,"[eNB %d] RLC AM allocation index@0 is %d\n",Mod_id,rlc[Mod_id].m_rlc_am_array[0].allocation); - LOG_D(RRC,"[eNB %d] RLC AM allocation index@1 is %d\n",rlc[Mod_id].m_rlc_am_array[1].allocation); - */ + ); + //LOG_D(RRC,"[eNB %d] RLC AM allocation index@0 is %d\n",Mod_id,rlc[Mod_id].m_rlc_am_array[0].allocation); + //LOG_D(RRC,"[eNB %d] RLC AM allocation index@1 is %d\n",Mod_id,rlc[Mod_id].m_rlc_am_array[1].allocation); + + /* + + LOG_D(RRC,"[eNB %d] CALLING RLC CONFIG SRB2 (rbid %d) for UE %d\n", + Mod_id,Idx+1,UE_index); + Mac_rlc_xface->rrc_rlc_config_req(Mod_id,ACTION_ADD,Idx+1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); + LOG_D(RRC,"[eNB %d] RLC AM allocation index@0 is %d\n",Mod_id,rlc[Mod_id].m_rlc_am_array[0].allocation); + LOG_D(RRC,"[eNB %d] RLC AM allocation index@1 is %d\n",rlc[Mod_id].m_rlc_am_array[1].allocation); + */ #endif //NO_RRM - } - else { - LOG_E(RRC,"can't add UE, max user count reached!\n"); - } - break; - - default: - LOG_E(RRC,"[eNB %d] Frame %d : Unknown message\n",Mod_id,frame); + } + else + { + LOG_E (RRC, "can't add UE, max user count reached!\n"); + } + break; + + default: + LOG_E (RRC, "[eNB %d] Frame %d : Unknown message\n", Mod_id, frame); + rval = -1; + } + rval = 0; + } + else + { + LOG_E (RRC, "[eNB %d] Frame %d : Unknown error \n", Mod_id, frame); rval = -1; } - rval = 0; - } - else{ - LOG_E(RRC,"[eNB %d] Frame %d : Unknown error \n",Mod_id,frame); - rval = -1; - } return rval; } -void rrc_eNB_process_RRCConnectionSetupComplete( - u8 Mod_id, - u32 frame, - u8 UE_index,RRCConnectionSetupComplete_r8_IEs_t *rrcConnectionSetupComplete) { +void +rrc_eNB_process_RRCConnectionSetupComplete (u8 Mod_id, + u32 frame, + u8 UE_index, + RRCConnectionSetupComplete_r8_IEs_t + * rrcConnectionSetupComplete) +{ - LOG_I(RRC, "[eNB %d][RAPROC] Frame %d : Logical Channel UL-DCCH, " - "processing RRCConnectionSetupComplete from UE %d\n", - Mod_id, frame, UE_index); + LOG_I (RRC, "[eNB %d][RAPROC] Frame %d : Logical Channel UL-DCCH, " + "processing RRCConnectionSetupComplete from UE %d\n", + Mod_id, frame, UE_index); // Forward message to S1AP layer #if defined(ENABLE_USE_MME) if (oai_emulation.info.mme_enabled == 1) - s1ap_eNB_new_data_request(Mod_id, UE_index, - rrcConnectionSetupComplete->dedicatedInfoNAS.buf, - rrcConnectionSetupComplete->dedicatedInfoNAS.size); + s1ap_eNB_new_data_request (Mod_id, UE_index, + rrcConnectionSetupComplete->dedicatedInfoNAS. + buf, + rrcConnectionSetupComplete->dedicatedInfoNAS. + size); else #endif - rrc_eNB_generate_SecurityModeCommand(Mod_id,frame,UE_index); + rrc_eNB_generate_SecurityModeCommand (Mod_id, frame, UE_index); //rrc_eNB_generate_UECapabilityEnquiry(Mod_id,frame,UE_index); } -mui_t rrc_eNB_mui=0; +mui_t rrc_eNB_mui = 0; -void rrc_eNB_generate_SecurityModeCommand(u8 Mod_id, u32 frame, u16 UE_index) { +void +rrc_eNB_generate_SecurityModeCommand (u8 Mod_id, u32 frame, u16 UE_index) +{ uint8_t buffer[100]; uint8_t size; - size = do_SecurityModeCommand(Mod_id,buffer,UE_index,0); + size = do_SecurityModeCommand (Mod_id, buffer, UE_index, 0); - LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d, UE id %d)\n", - Mod_id,frame, size, UE_index); + LOG_I (RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d, UE id %d)\n", + Mod_id, frame, size, UE_index); - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (securityModeCommand to UE %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", - frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, (UE_index*NB_RB_MAX)+DCCH); + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (securityModeCommand to UE %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", + frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, + (UE_index * NB_RB_MAX) + DCCH); //rrc_rlc_data_req(Mod_id,frame, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); - pdcp_data_req(Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH, rrc_eNB_mui++, 0, size, (char*)buffer, 1); + pdcp_data_req (Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH, + rrc_eNB_mui++, 0, size, (char *) buffer, 1); } -void rrc_eNB_generate_UECapabilityEnquiry(u8 Mod_id, u32 frame, u16 UE_index) { +void +rrc_eNB_generate_UECapabilityEnquiry (u8 Mod_id, u32 frame, u16 UE_index) +{ uint8_t buffer[100]; uint8_t size; - size = do_UECapabilityEnquiry(Mod_id,buffer,UE_index,0); + size = do_UECapabilityEnquiry (Mod_id, buffer, UE_index, 0); - LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate UECapabilityEnquiry (bytes %d, UE id %d)\n", - Mod_id,frame, size, UE_index); + LOG_I (RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate UECapabilityEnquiry (bytes %d, UE id %d)\n", + Mod_id, frame, size, UE_index); - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (UECapabilityEnquiry to UE %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", - frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, (UE_index*NB_RB_MAX)+DCCH); + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (UECapabilityEnquiry to UE %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", + frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, + (UE_index * NB_RB_MAX) + DCCH); //rrc_rlc_data_req(Mod_id,frame, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); - pdcp_data_req(Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH, rrc_eNB_mui++, 0, size, (char*)buffer, 1); + pdcp_data_req (Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH, + rrc_eNB_mui++, 0, size, (char *) buffer, 1); } -void rrc_eNB_generate_defaultRRCConnectionReconfiguration(u8 Mod_id, u32 frame, u16 UE_index, u8 *nas_pdu, u32 nas_length) { +void +rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32 frame, + u16 UE_index, + u8 * nas_pdu, + u32 nas_length) +{ u8 buffer[100]; @@ -870,15 +1078,17 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(u8 Mod_id, u32 frame, // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE eNB_RRC_INST *rrc_inst = &eNB_rrc_inst[Mod_id]; - - struct PhysicalConfigDedicated **physicalConfigDedicated = &rrc_inst->physicalConfigDedicated[UE_index]; + + struct PhysicalConfigDedicated **physicalConfigDedicated = + &rrc_inst->physicalConfigDedicated[UE_index]; struct SRB_ToAddMod *SRB2_config; struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config; struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config; - struct LogicalChannelConfig__ul_SpecificParameters *SRB2_ul_SpecificParameters; - SRB_ToAddModList_t *SRB_configList = rrc_inst->SRB_configList[UE_index]; + struct LogicalChannelConfig__ul_SpecificParameters + *SRB2_ul_SpecificParameters; + SRB_ToAddModList_t *SRB_configList = rrc_inst->SRB_configList[UE_index]; SRB_ToAddModList_t *SRB_configList2; struct DRB_ToAddMod *DRB_config; @@ -886,433 +1096,495 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(u8 Mod_id, u32 frame, struct PDCP_Config *DRB_pdcp_config; struct PDCP_Config__rlc_UM *PDCP_rlc_UM; struct LogicalChannelConfig *DRB_lchan_config; - struct LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters; + struct LogicalChannelConfig__ul_SpecificParameters + *DRB_ul_SpecificParameters; DRB_ToAddModList_t **DRB_configList = &rrc_inst->DRB_configList[UE_index]; MAC_MainConfig_t *mac_MainConfig; MeasObjectToAddModList_t *MeasObj_list; MeasObjectToAddMod_t *MeasObj; ReportConfigToAddModList_t *ReportConfig_list; - ReportConfigToAddMod_t *ReportConfig_per,*ReportConfig_A1,*ReportConfig_A2,*ReportConfig_A3,*ReportConfig_A4,*ReportConfig_A5; + ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, + *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; MeasIdToAddModList_t *MeasId_list; - MeasIdToAddMod_t *MeasId0,*MeasId1,*MeasId2,*MeasId3,*MeasId4,*MeasId5; + MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; #if Rel10 - long * sr_ProhibitTimer_r9; + long *sr_ProhibitTimer_r9; #endif - long *logicalchannelgroup,*logicalchannelgroup_drb; + long *logicalchannelgroup, *logicalchannelgroup_drb; long *maxHARQ_Tx, *periodicBSR_Timer; RSRP_Range_t *rsrp; struct MeasConfig__speedStatePars *Sparams; CellsToAddMod_t *CellToAdd; CellsToAddModList_t *CellsToAddModList; - - 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; - cba_RNTI = CALLOC(1,sizeof(C_RNTI_t)); - cba_RNTI_buf = CALLOC(1, 2*sizeof(uint8_t)); + cba_RNTI = CALLOC (1, sizeof (C_RNTI_t)); + cba_RNTI_buf = CALLOC (1, 2 * sizeof (uint8_t)); cba_RNTI->buf = cba_RNTI_buf; cba_RNTI->size = 2; - cba_RNTI->bits_unused=0; + cba_RNTI->bits_unused = 0; // associate UEs to the CBa groups as a function of their UE id - if (rrc_inst->num_active_cba_groups){ - cba_RNTI->buf[0] = rrc_inst->cba_rnti[UE_index % rrc_inst->num_active_cba_groups]&0xff; - cba_RNTI->buf[1] = 0xff; - LOG_D(RRC,"[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n", - Mod_id, frame, rrc_inst->cba_rnti[UE_index % rrc_inst->num_active_cba_groups], - UE_index%rrc_inst->num_active_cba_groups, UE_index); - } else { - cba_RNTI->buf[0] = 0x0; - cba_RNTI->buf[1] = 0x0; - LOG_D(RRC,"[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", - Mod_id, frame, UE_index); - } - - -#endif + if (rrc_inst->num_active_cba_groups) + { + cba_RNTI->buf[0] = + rrc_inst->cba_rnti[UE_index % rrc_inst->num_active_cba_groups] & 0xff; + cba_RNTI->buf[1] = 0xff; + LOG_D (RRC, + "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n", + Mod_id, frame, + rrc_inst->cba_rnti[UE_index % rrc_inst->num_active_cba_groups], + UE_index % rrc_inst->num_active_cba_groups, UE_index); + } + else + { + cba_RNTI->buf[0] = 0x0; + cba_RNTI->buf[1] = 0x0; + LOG_D (RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", + Mod_id, frame, UE_index); + } + + +#endif // // Configure SRB2 /// SRB2 - SRB2_config = CALLOC(1,sizeof(*SRB2_config)); - SRB_configList2 = CALLOC(1,sizeof(*SRB_configList2)); - memset(SRB_configList2,0,sizeof(*SRB_configList2)); - + SRB2_config = CALLOC (1, sizeof (*SRB2_config)); + SRB_configList2 = CALLOC (1, sizeof (*SRB_configList2)); + memset (SRB_configList2, 0, sizeof (*SRB_configList2)); + SRB2_config->srb_Identity = 2; - SRB2_rlc_config = CALLOC(1,sizeof(*SRB2_rlc_config)); - SRB2_config->rlc_Config = SRB2_rlc_config; + SRB2_rlc_config = CALLOC (1, sizeof (*SRB2_rlc_config)); + SRB2_config->rlc_Config = SRB2_rlc_config; SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB2_rlc_config->choice.explicitValue.present=RLC_Config_PR_am; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms50; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - - SRB2_lchan_config = CALLOC(1,sizeof(*SRB2_lchan_config)); - SRB2_config->logicalChannelConfig = SRB2_lchan_config; - - SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - - - SRB2_ul_SpecificParameters = CALLOC(1,sizeof(*SRB2_ul_SpecificParameters)); - - SRB2_ul_SpecificParameters->priority = 1; - SRB2_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - SRB2_ul_SpecificParameters->bucketSizeDuration = LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = + T_PollRetransmit_ms15; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = + PollPDU_p8; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = + PollByte_kB1000; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = + UL_AM_RLC__maxRetxThreshold_t32; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = + T_Reordering_ms50; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = + T_StatusProhibit_ms10; + + SRB2_lchan_config = CALLOC (1, sizeof (*SRB2_lchan_config)); + SRB2_config->logicalChannelConfig = SRB2_lchan_config; + + SRB2_lchan_config->present = + SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + + + SRB2_ul_SpecificParameters = + CALLOC (1, sizeof (*SRB2_ul_SpecificParameters)); + + SRB2_ul_SpecificParameters->priority = 1; + SRB2_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + SRB2_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; // LCG for CCCH and DCCH is 0 as defined in 36331 - logicalchannelgroup = CALLOC(1,sizeof(long)); - *logicalchannelgroup=0; + logicalchannelgroup = CALLOC (1, sizeof (long)); + *logicalchannelgroup = 0; SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; - ASN_SEQUENCE_ADD(&SRB_configList->list,SRB2_config); - ASN_SEQUENCE_ADD(&SRB_configList2->list,SRB2_config); + SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = + SRB2_ul_SpecificParameters; + ASN_SEQUENCE_ADD (&SRB_configList->list, SRB2_config); + ASN_SEQUENCE_ADD (&SRB_configList2->list, SRB2_config); // Configure DRB - *DRB_configList = CALLOC(1,sizeof(*DRB_configList)); + *DRB_configList = CALLOC (1, sizeof (*DRB_configList)); /// DRB - DRB_config = CALLOC(1,sizeof(*DRB_config)); + DRB_config = CALLOC (1, sizeof (*DRB_config)); //DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 // NN: this is the 1st DRB for this ue, so set it to 1 - DRB_config->drb_Identity = (DRB_Identity_t) 1; // (UE_index+1); //allowed values 1..32 - DRB_config->logicalChannelIdentity = CALLOC(1,sizeof(long)); + DRB_config->drb_Identity = (DRB_Identity_t) 1; // (UE_index+1); //allowed values 1..32 + DRB_config->logicalChannelIdentity = CALLOC (1, sizeof (long)); *(DRB_config->logicalChannelIdentity) = (long) 3; - DRB_rlc_config = CALLOC(1,sizeof(*DRB_rlc_config)); - DRB_config->rlc_Config = DRB_rlc_config; - DRB_rlc_config->present=RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength=SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength=SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering=T_Reordering_ms5; - - DRB_pdcp_config = CALLOC(1,sizeof(*DRB_pdcp_config)); - DRB_config->pdcp_Config = DRB_pdcp_config; - DRB_pdcp_config->discardTimer=NULL; + DRB_rlc_config = CALLOC (1, sizeof (*DRB_rlc_config)); + DRB_config->rlc_Config = DRB_rlc_config; + DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = + SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = + SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = + T_Reordering_ms5; + + DRB_pdcp_config = CALLOC (1, sizeof (*DRB_pdcp_config)); + DRB_config->pdcp_Config = DRB_pdcp_config; + DRB_pdcp_config->discardTimer = NULL; DRB_pdcp_config->rlc_AM = NULL; - PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); - DRB_pdcp_config->rlc_UM =PDCP_rlc_UM; + PDCP_rlc_UM = CALLOC (1, sizeof (*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + DRB_pdcp_config->headerCompression.present = + PDCP_Config__headerCompression_PR_notUsed; - DRB_lchan_config = CALLOC(1,sizeof(*DRB_lchan_config)); - DRB_config->logicalChannelConfig = DRB_lchan_config; - DRB_ul_SpecificParameters = CALLOC(1,sizeof(*DRB_ul_SpecificParameters)); + DRB_lchan_config = CALLOC (1, sizeof (*DRB_lchan_config)); + DRB_config->logicalChannelConfig = DRB_lchan_config; + DRB_ul_SpecificParameters = CALLOC (1, sizeof (*DRB_ul_SpecificParameters)); DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; - DRB_ul_SpecificParameters->priority = 2; // lower priority than srb1, srb2 - DRB_ul_SpecificParameters->prioritisedBitRate=LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - DRB_ul_SpecificParameters->bucketSizeDuration=LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - + DRB_ul_SpecificParameters->priority = 2; // lower priority than srb1, srb2 + DRB_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + DRB_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) - logicalchannelgroup_drb = CALLOC(1,sizeof(long)); - *logicalchannelgroup_drb=1; + logicalchannelgroup_drb = CALLOC (1, sizeof (long)); + *logicalchannelgroup_drb = 1; DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - ASN_SEQUENCE_ADD(&(*DRB_configList)->list,DRB_config); + ASN_SEQUENCE_ADD (&(*DRB_configList)->list, DRB_config); - mac_MainConfig = CALLOC(1,sizeof(*mac_MainConfig)); + mac_MainConfig = CALLOC (1, sizeof (*mac_MainConfig)); eNB_rrc_inst[Mod_id].mac_MainConfig[UE_index] = mac_MainConfig; - mac_MainConfig->ul_SCH_Config = CALLOC(1,sizeof(*mac_MainConfig->ul_SCH_Config)); + mac_MainConfig->ul_SCH_Config = + CALLOC (1, sizeof (*mac_MainConfig->ul_SCH_Config)); - maxHARQ_Tx = CALLOC(1,sizeof(long)); - *maxHARQ_Tx=MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + maxHARQ_Tx = CALLOC (1, sizeof (long)); + *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; - periodicBSR_Timer = CALLOC(1,sizeof(long)); + periodicBSR_Timer = CALLOC (1, sizeof (long)); *periodicBSR_Timer = MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf64; - mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; + mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; - mac_MainConfig->ul_SCH_Config->retxBSR_Timer = MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf320; + mac_MainConfig->ul_SCH_Config->retxBSR_Timer = + MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf320; - mac_MainConfig->ul_SCH_Config->ttiBundling=0; // FALSE + mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE mac_MainConfig->drx_Config = NULL; - mac_MainConfig->phr_Config = CALLOC(1,sizeof(*mac_MainConfig->phr_Config)); + mac_MainConfig->phr_Config = + CALLOC (1, sizeof (*mac_MainConfig->phr_Config)); mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; - mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer= MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer=MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange=MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB #ifdef Rel10 - sr_ProhibitTimer_r9 = CALLOC(1,sizeof(long)); - *sr_ProhibitTimer_r9=0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR - mac_MainConfig->sr_ProhibitTimer_r9=sr_ProhibitTimer_r9; + sr_ProhibitTimer_r9 = CALLOC (1, sizeof (long)); + *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR + mac_MainConfig->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; //sps_RA_ConfigList_rlola = NULL; #endif // Measurement ID list - MeasId_list = CALLOC(1,sizeof(*MeasId_list)); - memset((void *)MeasId_list,0,sizeof(*MeasId_list)); + MeasId_list = CALLOC (1, sizeof (*MeasId_list)); + memset ((void *) MeasId_list, 0, sizeof (*MeasId_list)); - MeasId0 = CALLOC(1,sizeof(*MeasId0)); + MeasId0 = CALLOC (1, sizeof (*MeasId0)); MeasId0->measId = 1; MeasId0->measObjectId = 1; MeasId0->reportConfigId = 1; - ASN_SEQUENCE_ADD(&MeasId_list->list,MeasId0); + ASN_SEQUENCE_ADD (&MeasId_list->list, MeasId0); - MeasId1 = CALLOC(1,sizeof(*MeasId1)); + MeasId1 = CALLOC (1, sizeof (*MeasId1)); MeasId1->measId = 2; MeasId1->measObjectId = 1; MeasId1->reportConfigId = 2; - ASN_SEQUENCE_ADD(&MeasId_list->list,MeasId1); + ASN_SEQUENCE_ADD (&MeasId_list->list, MeasId1); - MeasId2 = CALLOC(1,sizeof(*MeasId2)); + MeasId2 = CALLOC (1, sizeof (*MeasId2)); MeasId2->measId = 3; MeasId2->measObjectId = 1; MeasId2->reportConfigId = 3; - ASN_SEQUENCE_ADD(&MeasId_list->list,MeasId2); + ASN_SEQUENCE_ADD (&MeasId_list->list, MeasId2); - MeasId3 = CALLOC(1,sizeof(*MeasId3)); + MeasId3 = CALLOC (1, sizeof (*MeasId3)); MeasId3->measId = 4; MeasId3->measObjectId = 1; MeasId3->reportConfigId = 4; - ASN_SEQUENCE_ADD(&MeasId_list->list,MeasId3); + ASN_SEQUENCE_ADD (&MeasId_list->list, MeasId3); - MeasId4 = CALLOC(1,sizeof(*MeasId4)); + MeasId4 = CALLOC (1, sizeof (*MeasId4)); MeasId4->measId = 5; MeasId4->measObjectId = 1; MeasId4->reportConfigId = 5; - ASN_SEQUENCE_ADD(&MeasId_list->list,MeasId4); + ASN_SEQUENCE_ADD (&MeasId_list->list, MeasId4); - MeasId5 = CALLOC(1,sizeof(*MeasId5)); + MeasId5 = CALLOC (1, sizeof (*MeasId5)); MeasId5->measId = 6; MeasId5->measObjectId = 1; MeasId5->reportConfigId = 6; - ASN_SEQUENCE_ADD(&MeasId_list->list,MeasId5); + ASN_SEQUENCE_ADD (&MeasId_list->list, MeasId5); // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; // Add one EUTRA Measurement Object - MeasObj_list = CALLOC(1,sizeof(*MeasObj_list)); - memset((void *)MeasObj_list,0,sizeof(*MeasObj_list)); + MeasObj_list = CALLOC (1, sizeof (*MeasObj_list)); + memset ((void *) MeasObj_list, 0, sizeof (*MeasObj_list)); // Configure MeasObject - MeasObj = CALLOC(1,sizeof(*MeasObj)); - memset((void *)MeasObj,0,sizeof(*MeasObj)); - - MeasObj->measObjectId = 1; - MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; - MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; - MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; - MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1,sizeof(uint8_t)); - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; + MeasObj = CALLOC (1, sizeof (*MeasObj)); + memset ((void *) MeasObj, 0, sizeof (*MeasObj)); + + MeasObj->measObjectId = 1; + MeasObj->measObject.present = + MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = + AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = + CALLOC (1, sizeof (uint8_t)); + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; - MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB + MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = (CellsToAddModList_t *)CALLOC(1,sizeof(*CellsToAddModList)); + MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = + (CellsToAddModList_t *) CALLOC (1, sizeof (*CellsToAddModList)); - CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; + CellsToAddModList = + MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; // Add adjacent cell lists (6 per eNB) - for (i=0;i<6;i++) { - CellToAdd = (CellsToAddMod_t *)CALLOC(1,sizeof(*CellToAdd)); - CellToAdd->cellIndex = i+1; - CellToAdd->physCellId = get_adjacent_cell_id(Mod_id,i); - CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - - ASN_SEQUENCE_ADD(&CellsToAddModList->list,CellToAdd); - } + for (i = 0; i < 6; i++) + { + CellToAdd = (CellsToAddMod_t *) CALLOC (1, sizeof (*CellToAdd)); + CellToAdd->cellIndex = i + 1; + CellToAdd->physCellId = get_adjacent_cell_id (Mod_id, i); + CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; + + ASN_SEQUENCE_ADD (&CellsToAddModList->list, CellToAdd); + } - ASN_SEQUENCE_ADD(&MeasObj_list->list,MeasObj); + ASN_SEQUENCE_ADD (&MeasObj_list->list, MeasObj); // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; // Report Configurations for periodical, A1-A5 events - ReportConfig_list = CALLOC(1,sizeof(*ReportConfig_list)); - memset((void *)ReportConfig_list,0,sizeof(*ReportConfig_list)); - - ReportConfig_per = CALLOC(1,sizeof(*ReportConfig_per)); - memset((void *)ReportConfig_per,0,sizeof(*ReportConfig_per)); - - ReportConfig_A1 = CALLOC(1,sizeof(*ReportConfig_A1)); - memset((void *)ReportConfig_A1,0,sizeof(*ReportConfig_A1)); - - ReportConfig_A2 = CALLOC(1,sizeof(*ReportConfig_A2)); - memset((void *)ReportConfig_A2,0,sizeof(*ReportConfig_A2)); - - ReportConfig_A3 = CALLOC(1,sizeof(*ReportConfig_A3)); - memset((void *)ReportConfig_A3,0,sizeof(*ReportConfig_A3)); - - ReportConfig_A4 = CALLOC(1,sizeof(*ReportConfig_A4)); - memset((void *)ReportConfig_A4,0,sizeof(*ReportConfig_A4)); - - ReportConfig_A5 = CALLOC(1,sizeof(*ReportConfig_A5)); - memset((void *)ReportConfig_A5,0,sizeof(*ReportConfig_A5)); - - ReportConfig_per->reportConfigId = 1; - ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_periodical; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list,ReportConfig_per); - - ReportConfig_A1->reportConfigId = 2; - ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1.a1_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list,ReportConfig_A1); + ReportConfig_list = CALLOC (1, sizeof (*ReportConfig_list)); + memset ((void *) ReportConfig_list, 0, sizeof (*ReportConfig_list)); + + ReportConfig_per = CALLOC (1, sizeof (*ReportConfig_per)); + memset ((void *) ReportConfig_per, 0, sizeof (*ReportConfig_per)); + + ReportConfig_A1 = CALLOC (1, sizeof (*ReportConfig_A1)); + memset ((void *) ReportConfig_A1, 0, sizeof (*ReportConfig_A1)); + + ReportConfig_A2 = CALLOC (1, sizeof (*ReportConfig_A2)); + memset ((void *) ReportConfig_A2, 0, sizeof (*ReportConfig_A2)); + + ReportConfig_A3 = CALLOC (1, sizeof (*ReportConfig_A3)); + memset ((void *) ReportConfig_A3, 0, sizeof (*ReportConfig_A3)); + + ReportConfig_A4 = CALLOC (1, sizeof (*ReportConfig_A4)); + memset ((void *) ReportConfig_A4, 0, sizeof (*ReportConfig_A4)); + + ReportConfig_A5 = CALLOC (1, sizeof (*ReportConfig_A5)); + memset ((void *) ReportConfig_A5, 0, sizeof (*ReportConfig_A5)); + + ReportConfig_per->reportConfigId = 1; + ReportConfig_per->reportConfig.present = + ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType. + present = ReportConfigEUTRA__triggerType_PR_periodical; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice. + periodical.purpose = + ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = + ReportConfigEUTRA__reportQuantity_both; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = + ReportInterval_ms120; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = + ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD (&ReportConfig_list->list, ReportConfig_per); + + ReportConfig_A1->reportConfigId = 2; + ReportConfig_A1->reportConfig.present = + ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice. + event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice. + event.eventId.choice.eventA1.a1_Threshold.present = + ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice. + event.eventId.choice.eventA1.a1_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = + ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = + ReportInterval_ms120; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = + ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD (&ReportConfig_list->list, ReportConfig_A1); /* - ReportConfig_A2->reportConfigId = 3; - ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2.a2_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list,ReportConfig_A2); - - ReportConfig_A3->reportConfigId = 4; - ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 10; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.reportOnLeave = 1; - - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list,ReportConfig_A3); - - ReportConfig_A4->reportConfigId = 5; - ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4.a4_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list,ReportConfig_A4); - - ReportConfig_A5->reportConfigId = 6; - ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA5.a5_Threshold1.choice.threshold_RSRP = 10; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA5.a5_Threshold2.choice.threshold_RSRP = 10; - - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list,ReportConfig_A5); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; - */ + ReportConfig_A2->reportConfigId = 3; + ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2.a2_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list,ReportConfig_A2); + + ReportConfig_A3->reportConfigId = 4; + ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 10; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.reportOnLeave = 1; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list,ReportConfig_A3); + + ReportConfig_A4->reportConfigId = 5; + ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4.a4_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list,ReportConfig_A4); + + ReportConfig_A5->reportConfigId = 6; + ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA5.a5_Threshold1.choice.threshold_RSRP = 10; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA5.a5_Threshold2.choice.threshold_RSRP = 10; + + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list,ReportConfig_A5); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; + */ /* - rsrp=CALLOC(1,sizeof(RSRP_Range_t)); - *rsrp=20; - - - Sparams = CALLOC(1,sizeof(*Sparams)); - Sparams->present=MeasConfig__speedStatePars_PR_setup; - Sparams->choice.setup.timeToTrigger_SF.sf_High=SpeedStateScaleFactors__sf_Medium_oDot75; - Sparams->choice.setup.timeToTrigger_SF.sf_Medium=SpeedStateScaleFactors__sf_High_oDot5; - Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh=10; - Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium=5; - Sparams->choice.setup.mobilityStateParameters.t_Evaluation=MobilityStateParameters__t_Evaluation_s60; - Sparams->choice.setup.mobilityStateParameters.t_HystNormal=MobilityStateParameters__t_HystNormal_s120; - - speedStatePars=Sparams; - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->s_Measure=rsrp; - - */ - memset(buffer,0,100); - - size = do_RRCConnectionReconfiguration(Mod_id, - buffer, - UE_index, - 0,//Transaction_id, - SRB_configList2, - *DRB_configList, - NULL, // DRB2_list, - NULL, //*sps_Config, - physicalConfigDedicated[UE_index], - MeasObj_list, - ReportConfig_list, - NULL, //*QuantityConfig, - MeasId_list, - mac_MainConfig, - NULL, - cba_RNTI, - nas_pdu, - nas_length - ); //*measGapConfig); - - LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %d)\n",Mod_id,frame, size, UE_index); - - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", - frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, (UE_index*NB_RB_MAX)+DCCH); + rsrp=CALLOC(1,sizeof(RSRP_Range_t)); + *rsrp=20; + + + Sparams = CALLOC(1,sizeof(*Sparams)); + Sparams->present=MeasConfig__speedStatePars_PR_setup; + Sparams->choice.setup.timeToTrigger_SF.sf_High=SpeedStateScaleFactors__sf_Medium_oDot75; + Sparams->choice.setup.timeToTrigger_SF.sf_Medium=SpeedStateScaleFactors__sf_High_oDot5; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh=10; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium=5; + Sparams->choice.setup.mobilityStateParameters.t_Evaluation=MobilityStateParameters__t_Evaluation_s60; + Sparams->choice.setup.mobilityStateParameters.t_HystNormal=MobilityStateParameters__t_HystNormal_s120; + + speedStatePars=Sparams; + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->s_Measure=rsrp; + + */ + memset (buffer, 0, 100); + + size = do_RRCConnectionReconfiguration (Mod_id, buffer, UE_index, 0, //Transaction_id, + SRB_configList2, *DRB_configList, NULL, // DRB2_list, + NULL, //*sps_Config, + physicalConfigDedicated[UE_index], MeasObj_list, ReportConfig_list, NULL, //*QuantityConfig, + MeasId_list, mac_MainConfig, NULL, cba_RNTI, nas_pdu, nas_length); //*measGapConfig); + + LOG_I (RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %d)\n", + Mod_id, frame, size, UE_index); + + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", + frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, + (UE_index * NB_RB_MAX) + DCCH); //rrc_rlc_data_req(Mod_id,frame, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); - pdcp_data_req(Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH, rrc_eNB_mui++, 0, size, (char*)buffer, 1); + pdcp_data_req (Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH, + rrc_eNB_mui++, 0, size, (char *) buffer, 1); } -void rrc_eNB_process_MeasurementReport(u8 Mod_id,u16 UE_index,MeasResults_t *measResults2) { - - LOG_I(RRC,"Received Measurement Report From UE %d (Measurement Id %d)\n",UE_index,(int)measResults2->measId); - if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count>0) { - LOG_I(RRC,"Physical Cell Id %d\n",(int)measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId); - LOG_I(RRC,"RSRP of Target %d\n",(int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->measResult.rsrpResult)); - LOG_I(RRC,"RSRQ of Target %d\n",(int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->measResult.rsrqResult)); - } +void +rrc_eNB_process_MeasurementReport (u8 Mod_id, u16 UE_index, + MeasResults_t * measResults2) +{ + + LOG_I (RRC, "Received Measurement Report From UE %d (Measurement Id %d)\n", + UE_index, (int) measResults2->measId); + if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list. + count > 0) + { + LOG_I (RRC, "Physical Cell Id %d\n", + (int) measResults2->measResultNeighCells->choice. + measResultListEUTRA.list.array[0]->physCellId); + LOG_I (RRC, "RSRP of Target %d\n", + (int) *(measResults2->measResultNeighCells->choice. + measResultListEUTRA.list.array[0]->measResult. + rsrpResult)); + LOG_I (RRC, "RSRQ of Target %d\n", + (int) *(measResults2->measResultNeighCells->choice. + measResultListEUTRA.list.array[0]->measResult. + rsrqResult)); + } #ifdef Rel10 - LOG_I(RRC,"RSRP of Source %d\n",measResults2->measResultPCell.rsrpResult); - LOG_I(RRC,"RSRQ of Source %d\n",measResults2->measResultPCell.rsrqResult); + LOG_I (RRC, "RSRP of Source %d\n", + measResults2->measResultPCell.rsrpResult); + LOG_I (RRC, "RSRQ of Source %d\n", + measResults2->measResultPCell.rsrqResult); #else - LOG_I(RRC,"RSRP of Source %d\n",measResults2->measResultServCell.rsrpResult); - LOG_I(RRC,"RSRQ of Source %d\n",measResults2->measResultServCell.rsrqResult); + LOG_I (RRC, "RSRP of Source %d\n", + measResults2->measResultServCell.rsrpResult); + LOG_I (RRC, "RSRQ of Source %d\n", + measResults2->measResultServCell.rsrqResult); #endif //Look for IP address of the target eNB @@ -1321,258 +1593,293 @@ void rrc_eNB_process_MeasurementReport(u8 Mod_id,u16 UE_index,MeasResults_t *me //Send Handover Command //x2delay(); - // handover_request_x2(UE_index,Mod_id,measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId); + // handover_request_x2(UE_index,Mod_id,measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId); - // u8 buffer[100]; + // u8 buffer[100]; // int size=rrc_eNB_generate_Handover_Command_TeNB(0,0,buffer); // - // send_check_message((char*)buffer,size); + // send_check_message((char*)buffer,size); //send_handover_command(); } -void rrc_eNB_process_RRCConnectionReconfigurationComplete(u8 Mod_id,u32 frame,u8 UE_index, - RRCConnectionReconfigurationComplete_r8_IEs_t *rrcConnectionReconfigurationComplete){ +void +rrc_eNB_process_RRCConnectionReconfigurationComplete (u8 Mod_id, u32 frame, + u8 UE_index, + RRCConnectionReconfigurationComplete_r8_IEs_t + * + rrcConnectionReconfigurationComplete) +{ int i; #ifdef NAS_NETLINK - int oip_ifup=0; - int dest_ip_offset=0; + int oip_ifup = 0; + int dest_ip_offset = 0; #endif - DRB_ToAddModList_t *DRB_configList = eNB_rrc_inst[Mod_id].DRB_configList[UE_index]; - SRB_ToAddModList_t *SRB_configList = eNB_rrc_inst[Mod_id].SRB_configList[UE_index]; - - // Refresh SRBs/DRBs - rrc_pdcp_config_asn1_req(Mod_id,frame,1,UE_index, - SRB_configList, - DRB_configList, - (DRB_ToReleaseList_t*)NULL + DRB_ToAddModList_t *DRB_configList = + eNB_rrc_inst[Mod_id].DRB_configList[UE_index]; + SRB_ToAddModList_t *SRB_configList = + eNB_rrc_inst[Mod_id].SRB_configList[UE_index]; + + // Refresh SRBs/DRBs + rrc_pdcp_config_asn1_req (Mod_id, frame, 1, UE_index, + SRB_configList, + DRB_configList, (DRB_ToReleaseList_t *) NULL #ifdef Rel10 - ,(PMCH_InfoList_r9_t *)NULL + , (PMCH_InfoList_r9_t *) NULL #endif - ); + ); // Refresh SRBs/DRBs - rrc_rlc_config_asn1_req(Mod_id,frame,1,UE_index, - SRB_configList, - DRB_configList, - (DRB_ToReleaseList_t*)NULL + rrc_rlc_config_asn1_req (Mod_id, frame, 1, UE_index, + SRB_configList, + DRB_configList, (DRB_ToReleaseList_t *) NULL #ifdef Rel10 - ,(MBMS_SessionInfoList_r9_t *)NULL + , (MBMS_SessionInfoList_r9_t *) NULL #endif - ); + ); // Loop through DRBs and establish if necessary - if (DRB_configList != NULL) { - for (i=0;i<DRB_configList->list.count;i++) { // num max DRB (11-3-8) - if (DRB_configList->list.array[i]) { - LOG_I(RRC,"[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE %d, reconfiguring DRB %d/LCID %d\n", - Mod_id,frame, UE_index, - (int)DRB_configList->list.array[i]->drb_Identity, - (UE_index * NB_RB_MAX) + (int)*DRB_configList->list.array[i]->logicalChannelIdentity); - if (eNB_rrc_inst[Mod_id].DRB_active[UE_index][i] == 0) { - /* - rrc_pdcp_config_req (Mod_id, frame, 1, ACTION_ADD, - (UE_index * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity,UNDEF_SECURITY_MODE); - rrc_rlc_config_req(Mod_id,frame,1,ACTION_ADD, - (UE_index * NB_RB_MAX) + (int)*eNB_rrc_inst[Mod_id].DRB_config[UE_index][i]->logicalChannelIdentity, - RADIO_ACCESS_BEARER,Rlc_info_um); - */ - eNB_rrc_inst[Mod_id].DRB_active[UE_index][i] = 1; - - LOG_D(RRC,"[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n", - Mod_id, frame, (int)DRB_configList->list.array[i]->drb_Identity); - + if (DRB_configList != NULL) + { + for (i = 0; i < DRB_configList->list.count; i++) + { // num max DRB (11-3-8) + if (DRB_configList->list.array[i]) + { + LOG_I (RRC, + "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE %d, reconfiguring DRB %d/LCID %d\n", + Mod_id, frame, UE_index, + (int) DRB_configList->list.array[i]->drb_Identity, + (UE_index * NB_RB_MAX) + + (int) *DRB_configList->list.array[i]-> + logicalChannelIdentity); + if (eNB_rrc_inst[Mod_id].DRB_active[UE_index][i] == 0) + { + /* + rrc_pdcp_config_req (Mod_id, frame, 1, ACTION_ADD, + (UE_index * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity,UNDEF_SECURITY_MODE); + rrc_rlc_config_req(Mod_id,frame,1,ACTION_ADD, + (UE_index * NB_RB_MAX) + (int)*eNB_rrc_inst[Mod_id].DRB_config[UE_index][i]->logicalChannelIdentity, + RADIO_ACCESS_BEARER,Rlc_info_um); + */ + eNB_rrc_inst[Mod_id].DRB_active[UE_index][i] = 1; + + LOG_D (RRC, + "[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n", + Mod_id, frame, + (int) DRB_configList->list.array[i]->drb_Identity); + #ifdef NAS_NETLINK - // 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", Mod_id, Mod_id); - oip_ifup = nas_config(Mod_id,// interface index - Mod_id+1, // thrid octet - Mod_id+1);// fourth octet - - if (oip_ifup == 0 ){ // interface is up --> send a config the DRB -# ifdef OAI_EMU - oai_emulation.info.oai_ifup[Mod_id]=1; - dest_ip_offset=NB_eNB_INST; -# else - 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", - Mod_id, - Mod_id, - (UE_index * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity); - rb_conf_ipv4(0,//add - UE_index, //cx - Mod_id,//inst - (UE_index * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity, - 0,//dscp - ipv4_address(Mod_id+1,Mod_id+1),//saddr - ipv4_address(Mod_id+1,dest_ip_offset+UE_index+1));//daddr - - LOG_D(RRC,"[eNB %d] State = Attached (UE %d)\n",Mod_id,UE_index); - } -# else -# ifdef OAI_EMU - oai_emulation.info.oai_ifup[Mod_id]=1; -# endif -# endif + // 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", + Mod_id, Mod_id); + oip_ifup = nas_config (Mod_id, // interface index + Mod_id + 1, // thrid octet + Mod_id + 1); // fourth octet + + if (oip_ifup == 0) + { // interface is up --> send a config the DRB +#ifdef OAI_EMU + oai_emulation.info.oai_ifup[Mod_id] = 1; + dest_ip_offset = NB_eNB_INST; +#else + 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", + Mod_id, Mod_id, + (UE_index * NB_RB_MAX) + + *DRB_configList->list.array[i]-> + logicalChannelIdentity); + rb_conf_ipv4 (0, //add + UE_index, //cx + Mod_id, //inst + (UE_index * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity, 0, //dscp + ipv4_address (Mod_id + 1, Mod_id + 1), //saddr + ipv4_address (Mod_id + 1, dest_ip_offset + UE_index + 1)); //daddr + + LOG_D (RRC, "[eNB %d] State = Attached (UE %d)\n", + Mod_id, UE_index); + } +#else +#ifdef OAI_EMU + oai_emulation.info.oai_ifup[Mod_id] = 1; +#endif #endif - - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (DRB UE %d) --->][MAC_eNB][MOD %02d][]\n", - frame, Mod_id, UE_index, Mod_id); - if (DRB_configList->list.array[i]->logicalChannelIdentity) - DRB2LCHAN[i] = (u8)*DRB_configList->list.array[i]->logicalChannelIdentity; - rrc_mac_config_req(Mod_id,1,UE_index,0, - (RadioResourceConfigCommonSIB_t *)NULL, - eNB_rrc_inst[Mod_id].physicalConfigDedicated[UE_index], - (MeasObjectToAddMod_t **)NULL, - eNB_rrc_inst[Mod_id].mac_MainConfig[UE_index], - DRB2LCHAN[i], - DRB_configList->list.array[i]->logicalChannelConfig, - eNB_rrc_inst[Mod_id].measGapConfig[UE_index], - (TDD_Config_t *)NULL, - (u8 *)NULL, - (u16 *)NULL, - NULL, - NULL, - NULL, - (MBSFN_SubframeConfigList_t *)NULL -#ifdef Rel10 - , - 0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL - #endif -#ifdef CBA - , - eNB_rrc_inst[Mod_id].num_active_cba_groups, - eNB_rrc_inst[Mod_id].cba_rnti[0] -#endif - ); - - } - else { // remove LCHAN from MAC/PHY - - if (eNB_rrc_inst[Mod_id].DRB_active[UE_index][i] ==1) { - // DRB has just been removed so remove RLC + PDCP for DRB - /* rrc_pdcp_config_req (Mod_id, frame, 1, ACTION_REMOVE, - (UE_index * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); - */ - rrc_rlc_config_req(Mod_id,frame,1,ACTION_REMOVE, - (UE_index * NB_RB_MAX) + DRB2LCHAN[i], - RADIO_ACCESS_BEARER,Rlc_info_um); - } - eNB_rrc_inst[Mod_id].DRB_active[UE_index][i] = 0; - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (DRB UE %d) --->][MAC_eNB][MOD %02d][]\n", - frame, Mod_id, UE_index, Mod_id); - - rrc_mac_config_req(Mod_id,1,UE_index,0, - (RadioResourceConfigCommonSIB_t *)NULL, - eNB_rrc_inst[Mod_id].physicalConfigDedicated[UE_index], - (MeasObjectToAddMod_t **)NULL, - eNB_rrc_inst[Mod_id].mac_MainConfig[UE_index], - DRB2LCHAN[i], - (LogicalChannelConfig_t *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (u8 *)NULL, - (u16 *)NULL, - NULL, - NULL, - NULL, - NULL -#ifdef Rel10 - , - 0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (DRB UE %d) --->][MAC_eNB][MOD %02d][]\n", + frame, Mod_id, UE_index, Mod_id); + if (DRB_configList->list.array[i]->logicalChannelIdentity) + DRB2LCHAN[i] = + (u8) * + DRB_configList->list.array[i]->logicalChannelIdentity; + rrc_mac_config_req (Mod_id, 1, UE_index, 0, + (RadioResourceConfigCommonSIB_t *) NULL, + eNB_rrc_inst[Mod_id]. + physicalConfigDedicated[UE_index], + (MeasObjectToAddMod_t **) NULL, + eNB_rrc_inst[Mod_id]. + mac_MainConfig[UE_index], DRB2LCHAN[i], + DRB_configList->list.array[i]-> + logicalChannelConfig, + eNB_rrc_inst[Mod_id]. + measGapConfig[UE_index], + (TDD_Config_t *) NULL, (u8 *) NULL, + (u16 *) NULL, NULL, NULL, NULL, + (MBSFN_SubframeConfigList_t *) NULL +#ifdef Rel10 + , + 0, + (MBSFN_AreaInfoList_r9_t *) NULL, + (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , + eNB_rrc_inst[Mod_id]. + num_active_cba_groups, + eNB_rrc_inst[Mod_id].cba_rnti[0] +#endif + ); + + } + else + { // remove LCHAN from MAC/PHY + + if (eNB_rrc_inst[Mod_id].DRB_active[UE_index][i] == 1) + { + // DRB has just been removed so remove RLC + PDCP for DRB + /* rrc_pdcp_config_req (Mod_id, frame, 1, ACTION_REMOVE, + (UE_index * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); + */ + rrc_rlc_config_req (Mod_id, frame, 1, ACTION_REMOVE, + (UE_index * NB_RB_MAX) + + DRB2LCHAN[i], RADIO_ACCESS_BEARER, + Rlc_info_um); + } + eNB_rrc_inst[Mod_id].DRB_active[UE_index][i] = 0; + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (DRB UE %d) --->][MAC_eNB][MOD %02d][]\n", + frame, Mod_id, UE_index, Mod_id); + + rrc_mac_config_req (Mod_id, 1, UE_index, 0, + (RadioResourceConfigCommonSIB_t *) NULL, + eNB_rrc_inst[Mod_id]. + physicalConfigDedicated[UE_index], + (MeasObjectToAddMod_t **) NULL, + eNB_rrc_inst[Mod_id]. + mac_MainConfig[UE_index], DRB2LCHAN[i], + (LogicalChannelConfig_t *) NULL, + (MeasGapConfig_t *) NULL, + (TDD_Config_t *) NULL, (u8 *) NULL, + (u16 *) NULL, NULL, NULL, NULL, NULL +#ifdef Rel10 + , + 0, + (MBSFN_AreaInfoList_r9_t *) NULL, + (PMCH_InfoList_r9_t *) NULL #endif #ifdef CBA - , - 0, - 0 + , 0, 0 #endif - ); - } - } + ); + } + } + } } - } } -void rrc_eNB_generate_RRCConnectionSetup(u8 Mod_id,u32 frame, u16 UE_index) { +void +rrc_eNB_generate_RRCConnectionSetup (u8 Mod_id, u32 frame, u16 UE_index) +{ - LogicalChannelConfig_t *SRB1_logicalChannelConfig;//,*SRB2_logicalChannelConfig; - SRB_ToAddModList_t **SRB_configList = &eNB_rrc_inst[Mod_id].SRB_configList[UE_index]; + LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; + SRB_ToAddModList_t **SRB_configList = + &eNB_rrc_inst[Mod_id].SRB_configList[UE_index]; SRB_ToAddMod_t *SRB1_config; int cnt; eNB_rrc_inst[Mod_id].Srb0.Tx_buffer.payload_size = - do_RRCConnectionSetup((u8 *)eNB_rrc_inst[Mod_id].Srb0.Tx_buffer.Payload, - mac_xface->get_transmission_mode(Mod_id,find_UE_RNTI(Mod_id,UE_index)), - UE_index,0, - mac_xface->lte_frame_parms, - SRB_configList, - &eNB_rrc_inst[Mod_id].physicalConfigDedicated[UE_index]); + do_RRCConnectionSetup ((u8 *) eNB_rrc_inst[Mod_id].Srb0.Tx_buffer.Payload, + mac_xface->get_transmission_mode (Mod_id, + find_UE_RNTI + (Mod_id, + UE_index)), + UE_index, 0, mac_xface->lte_frame_parms, + SRB_configList, + &eNB_rrc_inst[Mod_id]. + physicalConfigDedicated[UE_index]); // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - if (*SRB_configList != NULL) { - for (cnt=0;cnt<(*SRB_configList)->list.count;cnt++) { - if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) { - - SRB1_config = (*SRB_configList)->list.array[cnt]; - - if (SRB1_config->logicalChannelConfig) { - if (SRB1_config->logicalChannelConfig->present == SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { - SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; - } - else { - SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; - } - } - else { - SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; - } - - LOG_D(RRC, "[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %d) --->][MAC_eNB][MOD %02d][]\n", - frame, Mod_id, UE_index, Mod_id); - rrc_mac_config_req(Mod_id,1,UE_index,0, - (RadioResourceConfigCommonSIB_t *)NULL, - eNB_rrc_inst[Mod_id].physicalConfigDedicated[UE_index], - (MeasObjectToAddMod_t **)NULL, - eNB_rrc_inst[Mod_id].mac_MainConfig[UE_index], - 1, - SRB1_logicalChannelConfig, - eNB_rrc_inst[Mod_id].measGapConfig[UE_index], - (TDD_Config_t *)NULL, - (u8 *)NULL, - (u16 *)NULL, - NULL, - NULL, - NULL, - (MBSFN_SubframeConfigList_t *)NULL -#ifdef Rel10 - , - 0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + if (*SRB_configList != NULL) + { + for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) + { + if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) + { + + SRB1_config = (*SRB_configList)->list.array[cnt]; + + if (SRB1_config->logicalChannelConfig) + { + if (SRB1_config->logicalChannelConfig->present == + SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) + { + SRB1_logicalChannelConfig = + &SRB1_config->logicalChannelConfig->choice. + explicitValue; + } + else + { + SRB1_logicalChannelConfig = + &SRB1_logicalChannelConfig_defaultValue; + } + } + else + { + SRB1_logicalChannelConfig = + &SRB1_logicalChannelConfig_defaultValue; + } + + LOG_D (RRC, + "[MSC_MSG][FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %d) --->][MAC_eNB][MOD %02d][]\n", + frame, Mod_id, UE_index, Mod_id); + rrc_mac_config_req (Mod_id, 1, UE_index, 0, + (RadioResourceConfigCommonSIB_t *) NULL, + eNB_rrc_inst[Mod_id]. + physicalConfigDedicated[UE_index], + (MeasObjectToAddMod_t **) NULL, + eNB_rrc_inst[Mod_id]. + mac_MainConfig[UE_index], 1, + SRB1_logicalChannelConfig, + eNB_rrc_inst[Mod_id]. + measGapConfig[UE_index], + (TDD_Config_t *) NULL, (u8 *) NULL, + (u16 *) NULL, NULL, NULL, NULL, + (MBSFN_SubframeConfigList_t *) NULL +#ifdef Rel10 + , + 0, + (MBSFN_AreaInfoList_r9_t *) NULL, + (PMCH_InfoList_r9_t *) NULL #endif #ifdef CBA - , - 0, - 0 + , 0, 0 #endif - ); - break; - } + ); + break; + } + } } - } - LOG_I(RRC,"[eNB %d][RAPROC] Frame %d : Logical Channel DL-CCCH, Generating RRCConnectionSetup (bytes %d, UE %d)\n", - Mod_id,frame,eNB_rrc_inst[Mod_id].Srb0.Tx_buffer.payload_size, UE_index); + LOG_I (RRC, + "[eNB %d][RAPROC] Frame %d : Logical Channel DL-CCCH, Generating RRCConnectionSetup (bytes %d, UE %d)\n", + Mod_id, frame, eNB_rrc_inst[Mod_id].Srb0.Tx_buffer.payload_size, + UE_index); } @@ -1596,5 +1903,5 @@ void rrc_eNB_generate_RRCConnectionSetup(u8 Mod_id,u32 frame, u16 UE_index) { } */ #ifndef USER_MODE -EXPORT_SYMBOL(Rlc_info_am_config); +EXPORT_SYMBOL (Rlc_info_am_config); #endif diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c index 7447c0338..cbc3f2d8e 100755 --- a/openair2/UTIL/LOG/log.c +++ b/openair2/UTIL/LOG/log.c @@ -96,7 +96,7 @@ int logInit (void) { } g_log->log_component[PHY].name = "PHY"; - g_log->log_component[PHY].level = LOG_INFO; + g_log->log_component[PHY].level = LOG_EMERG; g_log->log_component[PHY].flag = LOG_MED; g_log->log_component[PHY].interval = 1; g_log->log_component[PHY].fd = 0; @@ -104,7 +104,7 @@ int logInit (void) { g_log->log_component[PHY].filelog_name = "/tmp/phy.log"; g_log->log_component[MAC].name = "MAC"; - g_log->log_component[MAC].level = LOG_DEBUG; + g_log->log_component[MAC].level = LOG_EMERG; g_log->log_component[MAC].flag = LOG_MED; g_log->log_component[MAC].interval = 1; g_log->log_component[MAC].fd = 0; @@ -112,7 +112,7 @@ int logInit (void) { g_log->log_component[MAC].filelog_name = "/tmp/mac.log"; g_log->log_component[OPT].name = "OPT"; - g_log->log_component[OPT].level = LOG_INFO; + g_log->log_component[OPT].level = LOG_EMERG; g_log->log_component[OPT].flag = LOG_MED; g_log->log_component[OPT].interval = 1; g_log->log_component[OPT].fd = 0; @@ -144,7 +144,7 @@ int logInit (void) { g_log->log_component[RRC].filelog_name = "/tmp/rrc.log"; g_log->log_component[EMU].name = "EMU"; - g_log->log_component[EMU].level = LOG_INFO; + g_log->log_component[EMU].level = LOG_EMERG; g_log->log_component[EMU].flag = LOG_MED; g_log->log_component[EMU].interval = 1; g_log->log_component[EMU].fd = 0; @@ -152,7 +152,7 @@ int logInit (void) { g_log->log_component[EMU].filelog_name = ""; g_log->log_component[OMG].name = "OMG"; - g_log->log_component[OMG].level = LOG_INFO; + g_log->log_component[OMG].level = LOG_EMERG; g_log->log_component[OMG].flag = LOG_MED; g_log->log_component[OMG].interval = 1; g_log->log_component[OMG].fd = 0; @@ -160,7 +160,7 @@ int logInit (void) { g_log->log_component[OMG].filelog_name = ""; g_log->log_component[OTG].name = "OTG"; - g_log->log_component[OTG].level = LOG_FILE; + g_log->log_component[OTG].level = LOG_EMERG; g_log->log_component[OTG].flag = LOG_MED; g_log->log_component[OTG].interval = 1; g_log->log_component[OTG].fd = 0; @@ -168,7 +168,7 @@ int logInit (void) { g_log->log_component[OTG].filelog_name = "/tmp/otg.log"; g_log->log_component[OTG_LATENCY].name = "OTG_LATENCY"; - g_log->log_component[OTG_LATENCY].level = LOG_FILE; + g_log->log_component[OTG_LATENCY].level = LOG_EMERG; g_log->log_component[OTG_LATENCY].flag = LOG_MED; g_log->log_component[OTG_LATENCY].interval = 1; g_log->log_component[OTG_LATENCY].fd = 0; @@ -176,7 +176,7 @@ int logInit (void) { g_log->log_component[OTG_LATENCY].filelog_name = "/tmp/otg_latency.dat"; g_log->log_component[OTG_LATENCY_BG].name = "OTG_LATENCY_BG"; - g_log->log_component[OTG_LATENCY_BG].level = LOG_FILE; + g_log->log_component[OTG_LATENCY_BG].level = LOG_EMERG; g_log->log_component[OTG_LATENCY_BG].flag = LOG_MED; g_log->log_component[OTG_LATENCY_BG].interval = 1; g_log->log_component[OTG_LATENCY_BG].fd = 0; @@ -185,7 +185,7 @@ int logInit (void) { g_log->log_component[OTG_GP].name = "OTG_GP"; - g_log->log_component[OTG_GP].level = LOG_FILE; + g_log->log_component[OTG_GP].level = LOG_EMERG; g_log->log_component[OTG_GP].flag = LOG_MED; g_log->log_component[OTG_GP].interval = 1; g_log->log_component[OTG_GP].fd = 0; @@ -193,7 +193,7 @@ int logInit (void) { g_log->log_component[OTG_GP].filelog_name = "/tmp/otg_GP.dat"; g_log->log_component[OTG_GP_BG].name = "OTG_GP_BG"; - g_log->log_component[OTG_GP_BG].level = LOG_FILE; + g_log->log_component[OTG_GP_BG].level = LOG_EMERG; g_log->log_component[OTG_GP_BG].flag = LOG_MED; g_log->log_component[OTG_GP_BG].interval = 1; g_log->log_component[OTG_GP_BG].fd = 0; @@ -201,7 +201,7 @@ int logInit (void) { g_log->log_component[OTG_GP_BG].filelog_name = "/tmp/otg_GP_bg.dat"; g_log->log_component[OTG_JITTER].name = "OTG_JITTER"; - g_log->log_component[OTG_JITTER].level = LOG_FILE; + g_log->log_component[OTG_JITTER].level = LOG_EMERG; g_log->log_component[OTG_JITTER].flag = LOG_MED; g_log->log_component[OTG_JITTER].interval = 1; g_log->log_component[OTG_JITTER].fd = 0; @@ -209,7 +209,7 @@ int logInit (void) { g_log->log_component[OTG_JITTER].filelog_name = "/tmp/otg_jitter.dat"; g_log->log_component[OCG].name = "OCG"; - g_log->log_component[OCG].level = LOG_INFO; + g_log->log_component[OCG].level = LOG_EMERG; g_log->log_component[OCG].flag = LOG_MED; g_log->log_component[OCG].interval = 1; g_log->log_component[OCG].fd = 0; @@ -217,7 +217,7 @@ int logInit (void) { g_log->log_component[OCG].filelog_name = ""; g_log->log_component[PERF].name = "PERF"; - g_log->log_component[PERF].level = LOG_INFO; + g_log->log_component[PERF].level = LOG_EMERG; g_log->log_component[PERF].flag = LOG_MED; g_log->log_component[PERF].interval = 1; g_log->log_component[PERF].fd = 0; @@ -225,7 +225,7 @@ int logInit (void) { g_log->log_component[PERF].filelog_name = ""; g_log->log_component[OIP].name = "OIP"; - g_log->log_component[OIP].level = LOG_INFO; + g_log->log_component[OIP].level = LOG_EMERG; g_log->log_component[OIP].flag = LOG_MED; g_log->log_component[OIP].interval = 1; g_log->log_component[OIP].fd = 0; @@ -233,7 +233,7 @@ int logInit (void) { g_log->log_component[OIP].filelog_name = ""; g_log->log_component[CLI].name = "CLI"; - g_log->log_component[CLI].level = LOG_INFO; + g_log->log_component[CLI].level = LOG_EMERG; g_log->log_component[CLI].flag = LOG_MED; g_log->log_component[CLI].interval = 1; g_log->log_component[CLI].fd = 0; @@ -241,7 +241,7 @@ int logInit (void) { g_log->log_component[CLI].filelog_name = ""; g_log->log_component[MSC].name = "MSC"; - g_log->log_component[MSC].level = LOG_TRACE; + g_log->log_component[MSC].level = LOG_EMERG; g_log->log_component[MSC].flag = LOG_MED; g_log->log_component[MSC].interval = 1; g_log->log_component[MSC].fd = 0; @@ -249,7 +249,7 @@ int logInit (void) { g_log->log_component[MSC].filelog_name = "/tmp/msc.log"; g_log->log_component[OCM].name = "OCM"; - g_log->log_component[OCM].level = LOG_TRACE; + g_log->log_component[OCM].level = LOG_EMERG; g_log->log_component[OCM].flag = LOG_MED; g_log->log_component[OCM].interval = 1; g_log->log_component[OCM].fd = 0; @@ -257,7 +257,7 @@ int logInit (void) { g_log->log_component[OCM].filelog_name = "/tmp/ocm.log"; g_log->log_component[S1AP].name = "S1AP"; - g_log->log_component[S1AP].level = LOG_TRACE; + g_log->log_component[S1AP].level = LOG_EMERG; g_log->log_component[S1AP].flag = LOG_MED; g_log->log_component[S1AP].interval = 1; g_log->log_component[S1AP].fd = 0; @@ -265,7 +265,7 @@ int logInit (void) { g_log->log_component[S1AP].filelog_name = "/tmp/s1ap.log"; g_log->log_component[SCTP].name = "SCTP"; - g_log->log_component[SCTP].level = LOG_TRACE; + g_log->log_component[SCTP].level = LOG_EMERG; g_log->log_component[SCTP].flag = LOG_MED; g_log->log_component[SCTP].interval = 1; g_log->log_component[SCTP].fd = 0; @@ -273,7 +273,7 @@ int logInit (void) { g_log->log_component[SCTP].filelog_name = ""; g_log->log_component[HW].name = "HW"; - g_log->log_component[HW].level = LOG_DEBUG; + g_log->log_component[HW].level = LOG_EMERG; g_log->log_component[HW].flag = LOG_MED; g_log->log_component[HW].interval = 1; g_log->log_component[HW].fd = 0; diff --git a/targets/PROJECTS/MEDIEVAL/Makefile b/targets/PROJECTS/MEDIEVAL/Makefile index 50893c378..80ee11a67 100755 --- a/targets/PROJECTS/MEDIEVAL/Makefile +++ b/targets/PROJECTS/MEDIEVAL/Makefile @@ -1,15 +1,16 @@ all: oaisim naslite_netlink_ether -userclean: clean oaisim naslite_netlink_ether +userclean: clean oaisim naslite_netlink_ether -oaisim: - (cd $(OPENAIR_TARGETS)/SIMU/USER && make NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 -j2) +oaisim: + (cd $(OPENAIR_TARGETS)/SIMU/USER && make NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 Rel10=1 -j8) naslite_netlink_ether: (cd $(OPENAIR2_DIR) && make naslite_netlink_ether.ko) (cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE/RB_TOOL/ && make) -clean: - (cd $(OPENAIR_TARGETS)/SIMU/USER && make clean) +clean: (cd $(OPENAIR2_DIR)/NAS/DRIVER/LITE && make clean) + (cd $(OPENAIR_TARGETS)/SIMU/USER && make clean) + (cd $(OPENAIR_TARGETS)/SIMU/USER && make cleanasn1) diff --git a/targets/SIMU/USER/oaisim_config.c b/targets/SIMU/USER/oaisim_config.c index 20dcc84b1..5d6863ec7 100644 --- a/targets/SIMU/USER/oaisim_config.c +++ b/targets/SIMU/USER/oaisim_config.c @@ -416,7 +416,15 @@ int olg_config() { oai_emulation.info.g_log_verbosity, oai_emulation.emulation_config.log_emu.interval); // if perf eval then reset the otg log level - /* + set_comp_log(PHY, LOG_NONE, 0x15,1); + set_comp_log(EMU, LOG_NONE, 0x15,1); + set_comp_log(OCG, LOG_NONE, 0x15,1); + set_comp_log(OCM, LOG_NONE, 0x15,1); + set_comp_log(OTG, LOG_NONE, 0x15,1); + set_comp_log(MAC, LOG_NONE, 0x15,1); + set_comp_log(OMG, LOG_NONE, 0x15,1); + set_comp_log(OPT, LOG_ERR, 0x15,1); +/* set_log(OCG, LOG_DEBUG, 1); set_log(EMU, LOG_INFO, 20); set_log(MAC, LOG_DEBUG, 1); -- GitLab