/******************************************************************************* Eurecom OpenAirInterface 2 Copyright(c) 1999 - 2014 Eurecom This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. The full GNU General Public License is included in this distribution in the file called "COPYING". Contact Information Openair Admin: openair_admin@eurecom.fr Openair Tech : openair_tech@eurecom.fr Forums : http://forums.eurecom.fsr/openairinterface Address : EURECOM, Campus SophiaTech, 450 Route des Chappes, CS 50193 06904 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ /*! \file rlc.h * \brief This file, and only this file must be included by external code that interact with RLC layer. * \author GAUTHIER Lionel * \date 2010-2011 * \version * \note * \bug * \warning */ /** @defgroup _rlc_impl_ RLC Layer Reference Implementation * @ingroup _ref_implementation_ * @{ */ #ifndef __RLC_H__ # define __RLC_H__ # include "platform_types.h" # include "platform_constants.h" # include "hashtable.h" # include "rlc_am.h" # include "rlc_um.h" # include "rlc_tm.h" # include "rlc_am_structs.h" # include "rlc_tm_structs.h" # include "rlc_um_structs.h" # include "asn1_constants.h" # include "UTIL/LOG/log.h" # include "mem_block.h" # include "PHY/defs.h" # include "RLC-Config.h" # include "DRB-ToAddMod.h" # include "DRB-ToAddModList.h" # include "SRB-ToAddMod.h" # include "SRB-ToAddModList.h" #ifdef Rel10 #include "PMCH-InfoList-r9.h" #endif //----------------------------------------------------------------------------- # ifdef RLC_MAC_C # define private_rlc_mac(x) x # define public_rlc_mac(x) x # else # define private_rlc_mac(x) # define public_rlc_mac(x) extern x # endif # ifdef RLC_MPLS_C # define private_rlc_mpls(x) x # define public_rlc_mpls(x) x # else # define private_rlc_mpls(x) # define public_rlc_mpls(x) extern x # endif # ifdef RLC_RRC_C # define private_rlc_rrc(x) x # define public_rlc_rrc(x) x # else # define private_rlc_rrc(x) # define public_rlc_rrc(x) extern x # endif # ifdef RLC_C # define private_rlc(x) x # define protected_rlc(x) x # define public_rlc(x) x # else # define private_rlc(x) # if defined(RLC_MAC_C) || defined(RLC_MPLS_C) || defined(RLC_RRC_C) || defined(RLC_AM_C) || defined(RLC_TM_C) || defined(RLC_UM_C) || defined (PDCP_C) # define protected_rlc(x) extern x # else # define protected_rlc(x) # endif # define public_rlc(x) extern x # endif //----------------------------------------------------------------------------- #define RLC_OP_STATUS_OK 1 #define RLC_OP_STATUS_BAD_PARAMETER 22 #define RLC_OP_STATUS_INTERNAL_ERROR 2 #define RLC_OP_STATUS_OUT_OF_RESSOURCES 3 #define RLC_MUI_UNDEFINED (mui_t)0 #define RLC_RB_UNALLOCATED (rb_id_t)0 #define RLC_LC_UNALLOCATED (logical_chan_id_t)0 //----------------------------------------------------------------------------- // PUBLIC RLC CONSTANTS //----------------------------------------------------------------------------- typedef enum rlc_confirm_e { RLC_SDU_CONFIRM_NO = 0, RLC_SDU_CONFIRM_YES = 1, } rlc_confirm_t; typedef enum rlc_mode_e { RLC_MODE_NONE = 0, RLC_MODE_AM = 1, RLC_MODE_UM = 2, RLC_MODE_TM = 4 } rlc_mode_t; /*! \struct rlc_info_t * \brief Structure containing RLC protocol configuration parameters. */ typedef volatile struct { rlc_mode_t rlc_mode; union { rlc_am_info_t rlc_am_info; /*!< \sa rlc_am.h. */ rlc_tm_info_t rlc_tm_info; /*!< \sa rlc_tm.h. */ rlc_um_info_t rlc_um_info; /*!< \sa rlc_um.h. */ }rlc; } rlc_info_t; /*! \struct mac_rlc_status_resp_t * \brief Primitive exchanged between RLC and MAC informing about the buffer occupancy of the RLC protocol instance. */ typedef struct { rlc_buffer_occupancy_t bytes_in_buffer; /*!< \brief Bytes buffered in RLC protocol instance. */ rlc_buffer_occupancy_t pdus_in_buffer; /*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */ frame_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */ sdu_size_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of already segmented sdu */ boolean_t head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmeneted */ } mac_rlc_status_resp_t; /*! \struct mac_rlc_max_rx_header_size_t * \brief Usefull only for debug scenario where we connect 2 RLC protocol instances without the help of the MAC . */ typedef struct { union { struct rlc_am_rx_pdu_management dummy1; struct rlc_tm_rx_pdu_management dummy2; //struct rlc_um_rx_pdu_management dummy3; struct mac_tb_ind dummy4; struct mac_rx_tb_management dummy5; } dummy; } mac_rlc_max_rx_header_size_t; //----------------------------------------------------------------------------- // PRIVATE INTERNALS OF RLC //----------------------------------------------------------------------------- #define RLC_MAX_MBMS_LC (maxSessionPerPMCH * maxServiceCount) #define RLC_MAX_LC ((max_val_DRB_Identity+1)* NUMBER_OF_UE_MAX) protected_rlc(void (*rlc_rrc_data_ind)( const module_id_t eNB_inst, const module_id_t UE_inst, const frame_t frameP, const eNB_flag_t eNB_flagP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, uint8_t * const sduP);) protected_rlc(void (*rlc_rrc_data_conf)( const module_id_t eNB_inst, const module_id_t UE_inst, const eNB_flag_t eNB_flagP, const rb_id_t rb_idP, const mui_t muiP, const rlc_tx_status_t statusP);) typedef void (rrc_data_ind_cb_t)( const module_id_t eNB_inst, const module_id_t UE_inst, const frame_t frameP, const eNB_flag_t eNB_flagP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, uint8_t * const sduP); typedef void (rrc_data_conf_cb_t)( const module_id_t eNB_inst, const module_id_t UE_inst, const eNB_flag_t eNB_flagP, const rb_id_t rb_idP, const mui_t muiP, const rlc_tx_status_t statusP); /*! \struct rlc_t * \brief Structure to be instanciated to allocate memory for RLC protocol instances. */ typedef struct rlc_union_s { rlc_mode_t mode; union { rlc_am_entity_t am; rlc_um_entity_t um; rlc_tm_entity_t tm; } rlc; }rlc_union_t; typedef struct rlc_mbms_s { rb_id_t rb_id; module_id_t instanciated_instance; rlc_um_entity_t um; } rlc_mbms_t; typedef struct rlc_mbms_id_s { mbms_service_id_t service_id; mbms_session_id_t session_id; } rlc_mbms_id_t; #if !defined(Rel10) # if !defined(maxServiceCount) //unused arrays rlc_mbms_array_ue rlc_mbms_array_eNB # define maxServiceCount 1 # endif # if !defined(maxSessionPerPMCH) //unused arrays rlc_mbms_array_ue rlc_mbms_array_eNB # define maxSessionPerPMCH 1 # endif #endif //public_rlc(rlc_mbms_t rlc_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h //public_rlc(rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[NUMBER_OF_UE_MAX][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[NUMBER_OF_eNB_MAX][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h #define rlc_mbms_enb_get_lcid_by_rb_id(Enb_mOD,rB_iD) rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD] ; #define rlc_mbms_enb_set_lcid_by_rb_id(Enb_mOD,rB_iD,lOG_cH_iD) do { \ rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD] = lOG_cH_iD; \ } while (0); #define rlc_mbms_ue_get_lcid_by_rb_id(uE_mOD,rB_iD) rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD] #define rlc_mbms_ue_set_lcid_by_rb_id(uE_mOD,rB_iD,lOG_cH_iD) do { \ AssertFatal(rB_iD