/* * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The OpenAirInterface Software Alliance licenses this file to You under * the OAI Public License, Version 1.1 (the "License"); you may not use this file * except in compliance with the License. * You may obtain a copy of the License at * * http://www.openairinterface.org/?page_id=698 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *------------------------------------------------------------------------------- * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ /*! \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 * @ingroup _oai2 * @{ */ #ifndef __RLC_H__ # define __RLC_H__ # include "platform_types.h" # include "COMMON/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 "LTE_asn_constant.h" # include "common/utils/LOG/log.h" # include "mem_block.h" //# include "PHY/defs.h" # include "LTE_RLC-Config.h" # include "LTE_DRB-ToAddMod.h" # include "LTE_DRB-ToAddModList.h" # include "LTE_SRB-ToAddMod.h" # include "LTE_SRB-ToAddModList.h" # include "LTE_DRB-ToReleaseList.h" #include "LTE_PMCH-InfoList-r9.h" typedef uint64_t hash_key_t; #define HASHTABLE_NOT_A_KEY_VALUE ((uint64_t)-1) //----------------------------------------------------------------------------- #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 segmented */ } 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 (LTE_maxSessionPerPMCH * LTE_maxServiceCount) #define RLC_MAX_LC ((max_val_LTE_DRB_Identity+1)* MAX_MOBILES_PER_ENB) void (*rlc_rrc_data_ind)( const protocol_ctxt_t *const ctxtP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, const uint8_t *const sduP) __attribute__ ((aligned(32))); void (*rlc_rrc_data_conf)( const protocol_ctxt_t *const ctxtP, const rb_id_t rb_idP, const mui_t muiP, const rlc_tx_status_t statusP); typedef void (rrc_data_ind_cb_t)( const protocol_ctxt_t *const ctxtP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, const uint8_t *const sduP); typedef void (rrc_data_conf_cb_t)( const protocol_ctxt_t *const ctxtP, 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; //rlc_mbms_t rlc_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h //rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/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