mac_rrc_primitives.h 18.3 KB
Newer Older
1 2 3 4 5
/*
 * 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
Cedric Roux's avatar
Cedric Roux committed
6
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 * 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
 */

22 23 24 25 26 27 28 29 30 31 32
#ifndef __MAC_RRC_PRIMITIVES_H__
#    define __MAC_RRC_PRIMITIVES_H__



#ifndef OPENAIR2_IN
#include "LAYER2/RLC/rlc.h"
#endif
#include "COMMON/platform_types.h"
#include "COMMON/platform_constants.h"

33 34 35 36 37 38 39
#include "LTE_RadioResourceConfigCommonSIB.h"
#include "LTE_RadioResourceConfigDedicated.h"
#include "LTE_MeasGapConfig.h"
#include "LTE_TDD-Config.h"
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
#include "LTE_MBSFN-AreaInfoList-r9.h"
#include "LTE_MBSFN-SubframeConfigList.h"
40 41 42
#endif
//#include "rrm_config_structs.h"
//#include "platform_types.h"
43
/** @defgroup _mac_rrc_primitives_ MAC Layer Primitives for Communications with RRC
44 45
 * @ingroup _openair_mac_layer_specs_
 * @{
46
This subclause describes the primitives for communications between the RRC and MAC sub-layers.
47 48 49 50 51 52 53 54 55


This subclause describes the primitives for communications between the RRC and MAC sub-layers.
The RRC sequence diagrams are shown below.

The primitives responsible for relaying of radio and traffic measurements to the radio resource manager via
RRC signaling are :
-# MAC_MEAS_REQ: enables RRC to request a measurement process in the MAC (one-shot, periodic or event-driven). This configures
a measurement process in the MAC.
56
-# MAC_MEAS_IND: indicates to RRC that a (periodic) measurement request is available.
57 58 59 60 61 62 63 64
-# MAC_MEAS_CONFIRM: enables RRC to acknowledge a MAC-MEAS-Ind.

These associate a set of measurements (described by the MAC_MEAS_t structure) to a particular logical channel.  Each measurement has
an associated period (which can be infinite in the case of a one-shot measurement) and a set of triggers for generating event-driven
instantaneous measurement reports. The latter is typically used to signal events that correspond to degradation or loss of links with respect to
negotiated QoS values.  These consequently trigger reconfiguration of services by the network. The averaging parameters used by the
MAC measurement process is described by the structure MAC_AVG_t. Note that it is the responsibility
of the MAC-layer to relay PHY measurements which are directly available to the scheduling entity in the MAC-layer.
65
RRC does not directly act on the PHY measurement sub-system.
66 67 68 69

The primitives responsible for logical channel MAC configuration by the radio resource manager via RRC signaling are

-# MAC_CONFIG_REQ: enables RRC to configure a new logical channel description at the MAC layer.  The associated QoS
70
descriptor (MAC_LCHAN_DESC contains the parameters defining the logical channel resource scheduling.
71 72 73 74 75
-# MAC_CONFIG_CONFIRM: indicates to RRC that a given logical channel has or has not been configured.

The primitives responsible for indicating data synchronization (or loss of) to RRC are
-# MAC_SYNC : indicates to RRC that a physical link for a newly established logical channel has been used (reception) with
success.  The parameter passed indicates the logical channel id.  This represents the event of successfully decoding a particular logical
76
channel for the first time.  In the event that several logical channels share the same physical resources (e.g. BCCH and CCCH), it
77 78 79
shall only be sent for the logical channel with the lowest id.
-# MAC_OUT_OF_SYNC : UE primitive indicating to RRC that a physical link for a particular Node-B has been lossed.  The parameter
passed indicates the id of the Node-B.  This represents the event of detecting an unacceptable error rate on the CHBCH of the Node-B in question.
80
and can be used in the case of handover between Node-B's.  Note that this message is redundant since an equivalent way of obtaining the same
81 82 83 84
result could be based on an event-driven measurement report.
*/

#        define NB_SIG_CNX_CH 1
85
#        define NB_CNX_CH MAX_MOBILES_PER_ENB
86 87

#        define NB_SIG_CNX_UE 2 //MAX_MANAGED_RG_PER_MOBILE
88
#        define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE
89 90 91 92 93 94 95 96 97 98

#define NUMBER_OF_MEASUREMENT_SUBBANDS 16

#define RRC_RACH_ASS_REQ 0
#define MAC_RACH_BW_REQ 1



/*! MAC/PHY Measurement Structure*/
/*! \brief Logical Channel ID structure */
99
typedef struct {
100
  unsigned short    Index __attribute__ ((packed));       //QOS CLASS?          /*!< \brief Index of logical channel*/
101
} LCHAN_ID;
102 103


104
typedef struct {
105 106
  char Rssi;                        /*!< \brief RSSI (dBm) on physical resources corresponding to logical channel*/
  char Sinr[NUMBER_OF_MEASUREMENT_SUBBANDS];                        /*!< \brief Average SINR (dB) on physical resources corresponding to logical channel*/
107
  uint8_t Harq_delay;         /*!< \brief Average number of transmission rounds (times 10) on transport channel associated with
108
              logical channel*/
109
  unsigned short Bler;              /*!< \brief Average block error rate (times 1000) on transport channel associated with logical channel*/
110
  uint8_t Spec_eff;           /*!< \brief Actual Spectral efficiency (bits/symbol times 10) of transport channel associated with logical channel*/
111 112 113 114
  uint8_t Qdepth;
  //uint8_t Tx_rate;
  //uint8_t Rx_rate;
} __attribute__ ((__packed__)) MAC_MEAS_T;
115 116 117 118
#define MAC_MEAS_T_SIZE sizeof(MAC_MEAS_T)

/*!\brief MAC/RLC Measurement Information
 */
119
typedef struct {
120 121
  char Rssi;                        /*!< \brief RSSI (dBm) on physical resources corresponding to logical channel*/
  char Sinr[NUMBER_OF_MEASUREMENT_SUBBANDS];                        /*!< \brief Average SINR (dB) on physical resources corresponding to logical channel*/
122
  uint8_t Harq_delay;         /*!< \brief Average number of transmission rounds (times 10) on transport channel associated with
123
              logical channel*/
124
  unsigned short Bler;              /*!< \brief Average block error rate (times 1000) on transport channel associated with logical channel*/
125 126
  uint8_t Spec_eff;           /*!< \brief Actual Spectral efficiency (bits/symbol times 10) of transport channel associated with logical channel*/
  uint8_t  rlc_sdu_buffer_occ;    /*!< \brief RLC SDU buffer occupancy */
127
  unsigned short rlc_sdu_loss_indicator; /*!< \brief RLC SDU Loss indicator */
128
} __attribute__ ((__packed__)) MAC_RLC_MEAS_T;
129 130 131 132 133 134 135 136 137
#define MAC_RLC_MEAS_T_SIZE sizeof(MAC_RLC_MEAS_T)





/*! MAC/PHY Measurement Averaging Parameters.  These are fixed-point 16-bit representations of the interval [0,1)*/

typedef struct {
138 139 140 141 142 143
  unsigned short Rssi_forgetting_factor;                        /*!< \brief Forgetting factor for RSSI averaging*/
  unsigned short Sinr_forgetting_factor;                        /*!< \brief Forgetting factor for SINR averaging*/
  unsigned short Harq_delay_forgetting_factor;         /*!< \brief Forgetting factor for HARQ delay averaging*/
  unsigned short Bler_forgetting_factor;              /*!< \brief Forgetting factor for block error rate (times 1000) averaging*/
  unsigned short Spec_eff_forgetting_factor;           /*!< \brief Forgetting factor for Spectral efficiency averaging*/
} __attribute__ ((__packed__))  MAC_AVG_T;
144 145 146 147 148 149 150 151

/*!\brief This primitive indicates to RRC that a measurement request is available */

typedef struct {
  LCHAN_ID  Lchan_id;           /*!< \brief Logical Channel ID*/
  unsigned short Process_id;         /*!< \brief Id of MAC measurement process*/
  MAC_MEAS_T Meas;
  char Meas_status;              /*!< \brief Latest set of MAC measurements performed in the current process*/
152
} __attribute__ ((__packed__))  MAC_MEAS_IND;
153 154 155 156 157 158 159 160

#define MAC_MEAS_IND_SIZE sizeof(MAC_MEAS_IND)

/*!\brief This primitive indicates to MAC that a measurement request was received
 */
typedef struct {
  //LCHAN_ID  Lchan_id;           /*!< \brief Logical Channel ID*/
  //unsigned short       Process_id;         /*!< \brief Id of new MAC measurement process*/
161
  char     Meas_status;           /*!< \brief Status (0-positive, 1-negative)*/
162
} __attribute__ ((__packed__))  MAC_MEAS_CONFIRM;
163 164 165 166 167 168 169 170 171 172

/*!\brief This primitive parametrizes a MAC measurement process
 */
typedef struct {
  MAC_MEAS_T Meas_trigger;      /*!< \brief Thresholds to trigger event driven measurement reports*/
  MAC_AVG_T Mac_avg;            /*!< \brief Set of forgetting factors for the averaging of the MAC measurement process*/
  unsigned int bo_forgetting_factor; /*!< \brief Forgetting factor for RLC buffer occupancy averaging*/
  unsigned int sdu_loss_trigger; /*!< \brief Trigger for RLC SDU losses*/
  unsigned short Rep_amount;    /*!< \brief Number of Measurements for this process, 0 means infinite*/
  unsigned short Rep_interval;  /*!< \brief Reporting interval between successive measurement reports in this process*/
173
} __attribute__ ((__packed__))  MAC_RLC_MEAS_DESC;
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188



/*!\brief This primitive indicates to MAC that a (periodic) measurement request is requested for a particular logical channel
 */
typedef struct {
  LCHAN_ID Lchan_id;            /*!< \brief Logical Channel ID*/
  unsigned short  UE_eNB_index;
  unsigned short Process_id;         /*!< \brief Id of new MAC measurement process*/
  //  MAC_MEAS_DESC Meas_desc;/*!< \brief Measurement descriptor associated with Logical channel*/
  MAC_MEAS_T Meas_trigger;      /*!< \brief Thresholds to trigger event driven measurement reports*/
  MAC_AVG_T Mac_avg;            /*!< \brief Set of forgetting factors for the averaging of the MAC measurement process*/
  unsigned short Rep_amount;    /*!< \brief Number of Measurements for this process, 0 means infinite*/
  unsigned short Rep_interval;  /*!< \brief Reporting interval between successive measurement reports in this process*/
  MAC_MEAS_T Mac_meas;      /*!< \brief Measure structure to be filled by the MAC  */
189
} __attribute__ ((__packed__))  MAC_MEAS_REQ;
190 191
#define MAC_MEAS_REQ_SIZE sizeof(MAC_MEAS_REQ)

192
typedef struct MEAS_REQ_TABLE_ENTRY {
193 194 195
  MAC_MEAS_REQ Mac_meas_req;
  unsigned int Last_report_frame;
  unsigned int Next_check_frame;
196 197 198 199
  uint8_t Status;
  uint8_t Meas_req_status;
  uint8_t Rx_activity;
  //uint8_t Meas_Direction;//???
200 201
  struct MEAS_REQ_TABLE_ENTRY *Next_entry;
  struct MEAS_REQ_TABLE_ENTRY *Prev_entry;
202
} __attribute__ ((__packed__)) MAC_MEAS_REQ_ENTRY;
203 204 205 206


/*!\brief This primitive parametrizes an RLC measurement process
 */
207
typedef struct {
208 209
  unsigned int bo_forgetting_factor; /*!< \brief Forgetting factor for buffer occupancy averaging*/
  unsigned int sdu_loss_trigger; /*!< \brief Trigger for RLC sdu losses*/
210
} __attribute__ ((__packed__))  RLC_MEAS_DESC;
211 212 213 214 215 216 217 218 219 220

//#define NUM_MEAS_REQ_MAX 100 //from rrm






/*! \brief MAC Logical Channel Descriptor
 */
221

222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239

/*!\brief This primitive indicates to RRC that a particular logical channel has been established and that successful transmission has
been received.  The parameter passed is the logical channel id.
 */
typedef struct MAC_SYNC {
  LCHAN_ID Lchan_id;       /*!< \brief Logical Channel ID*/
} MAC_SYNC;

/*!\brief This primitive indicates to RRC (UE) that a particular Node-B has been lossed and passes CHBCH logical channel
node_id as parameter
 */
typedef struct MAC_OUT_OF_SYNC {
  unsigned short  Node_id;       /*!< \brief Logical Channel ID*/
} MAC_OUT_OF_SYNC;


/*!\brief This primitive enables RRC to configure a new logical channel description at the MAC layer.
 */
240
typedef struct {
241 242
  LCHAN_ID   Lchan_id;              /*!< \brief Logical Channel ID*/
  //   unsigned short UE_eNB_index; //ID of CH who configued the LC (Need this to identify LC in the UE side)
243
  uint8_t Lchan_type; // DCCH_LCHAN, DTCH_LCHAN
244 245 246 247 248
  LCHAN_DESC  Lchan_desc[2];  /*!< \brief Logical Channel QoS Descriptor (MAC component) */
  uint8_t L3_info_type;
  uint8_t L3_info[16];
  unsigned short UE_eNB_index;
} __attribute__ ((__packed__))  MAC_CONFIG_REQ;
249 250 251 252 253 254 255
#define MAC_CONFIG_REQ_SIZE sizeof(MAC_CONFIG_REQ)


/*!\brief This primitive indicates to RRC that a given logical channel has or has not been configured.
*/
typedef struct {
  LCHAN_ID Lchan_id;        /*!< \brief Logical Channel ID*/
256
  uint8_t    Config_status;   /*!< \brief Configuration status (0-positive, 1-negative)*/
257
} __attribute__ ((__packed__))  MAC_CONFIG_CONFIRM;
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273

/**@}*/


/*
** @addtogroup _mac_impl_ MAC Layer (MAC) Reference Implementation
 *@{
 */

//#include "LAYER2/MAC/defs.h"



typedef struct {
  char Sinr_meas[NB_CNX_CH+1][NUMBER_OF_MEASUREMENT_SUBBANDS];
  char Wideband_sinr;
274
  uint8_t Forg_fact;
275
  unsigned short Rep_interval;
276
  uint8_t Status;
277
  unsigned int Last_report_frame;
278
  unsigned int Next_check_frame;
279
  uint8_t Active;
280
} __attribute__ ((__packed__)) DEFAULT_UE_MEAS;
281 282 283 284
#define DEFAULT_UE_MEAS_SIZE sizeof(DEFAULT_UE_MEAS)

typedef struct {  //From RRC
  unsigned short UE_index;
285
  uint8_t Forg_fact;
286
  unsigned short Rep_interval;;
287
} __attribute__ ((__packed__)) DEFAULT_MEAS_REQ;
288 289 290 291 292
#define DEFAULT_MEAS_REQ_SIZE sizeof(DEFAULT_MEAS_REQ)

typedef struct {  //To RRC
  unsigned short UE_index __attribute__ ((packed));
  char Sinr_meas[NB_CNX_CH+1];
293
  uint8_t Rb_active[NB_RAB_MAX];
294
} __attribute__ ((__packed__)) DEFAULT_MEAS_IND;
295 296 297 298 299 300 301
#define DEFAULT_MEAS_IND_SIZE sizeof(DEFAULT_MEAS_IND)


typedef struct {
  char Sinr_meas[NB_CNX_CH+1][NUMBER_OF_MEASUREMENT_SUBBANDS];
  char Wideband_sinr;
  unsigned int cqi;
302
  uint8_t Forg_fact;
303 304
  unsigned short Rep_interval;
  unsigned int Last_report_frame;
305
  unsigned int Next_check_frame;
306 307
  uint8_t Status; //IDLE,NEED_rADIO_CONFIG, RADIO_CONFIG_TX, RADIO_CONFIG_ok
  uint8_t Active;
308
} __attribute__ ((__packed__)) DEFAULT_CH_MEAS;
309 310 311 312 313 314
#define DEFAULT_eNB_MEAS_SIZE sizeof(DEFAULT_eNB_MEAS)



#ifndef OPENAIR2_IN

315
typedef struct {  //RRC_INTERFACE_FUNCTIONS
316 317
  unsigned int Frame_index;
  unsigned short UE_index[NB_MODULES_MAX][NB_SIG_CNX_UE];
318
  uint8_t  eNB_id[NB_MODULES_MAX][NB_CNX_UE];
319
  //  L2_ID UE_id[NB_MODULES_MAX][NB_CNX_CH];
320
  uint8_t UE_id[NB_MODULES_MAX][NB_CNX_CH][5];
321
  void (*openair_rrc_top_init)(void);
322 323 324 325 326 327 328
  char (*openair_rrc_eNB_init)(uint8_t );
  char (*openair_rrc_UE_init)(uint8_t, uint8_t);
  RRC_status_t (*rrc_rx_tx)(uint8_t,uint32_t,uint8_t,uint8_t);
  uint8_t (*mac_rrc_data_ind)(uint8_t,uint32_t,uint16_t,uint8_t *,uint16_t,eNB_flag_t eNB_flag, uint8_t eNB_index);
  uint8_t (*mac_rrc_data_req)(uint8_t,uint32_t,uint16_t,uint8_t,uint8_t *,eNB_flag_t eNB_flag, uint8_t eNB_index);
  void (*mac_rrc_meas_ind)(uint8_t,MAC_MEAS_REQ_ENTRY*);
  void  (*def_meas_ind)(uint8_t, uint8_t);
329 330
  void (*rrc_data_indP)  (module_id_t , rb_id_t , sdu_size_t , char*);
  void (*fn_rrc)  (void);
331
  uint8_t (*get_rrc_status)(uint8_t Mod_id,uint8_t eNB_flag,uint8_t eNB_index);
332
  double (*rrc_get_estimated_ue_distance) (module_id_t Mod_id, uint8_t UE_id, uint8_t CC_id, uint8_t loc_type);
333
} RRC_XFACE;
334 335


336
typedef struct {
337 338 339 340 341
  //MAC_INTERFACE_FUNCTIONS
  unsigned int frame;
  unsigned short Node_id[NB_MODULES_MAX];
  char Is_cluster_head[NB_MODULES_MAX];
  void (*macphy_exit)(const char *);          /*  Pointer function that stops the low-level scheduler due an exit condition */
342 343 344
  unsigned short (*mac_config_req)(uint8_t,uint8_t,MAC_CONFIG_REQ*);
  MAC_MEAS_REQ_ENTRY* (*mac_meas_req)(uint8_t ,  MAC_MEAS_REQ*);
  void (*mac_out_of_sync_ind)(uint8_t,uint32_t,unsigned short);
345 346
  //RLC_INTERFACE_FUNCTIONS
  void (*pdcp_run)(void);
347
  void (*pdcp_data_req)(module_id_t, rb_id_t, sdu_size_t, char*);
348
  signed int (*rrc_rlc_config_req)(unsigned int, unsigned int, unsigned int, unsigned int, rlc_info_t );
349
  int (*rrc_mac_config_req)(uint8_t Mod_id,uint8_t eNB_flag,uint8_t UE_id,uint8_t eNB_index,
350 351 352
                            LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
                            struct LTE_PhysicalConfigDedicated *physicalConfigDedicated,
                            LTE_MAC_MainConfig_t *mac_MainConfig,
353
                            long logicalChannelIdentity,
354 355 356
                            LTE_LogicalChannelConfig_t *logicalChannelConfig,
                            LTE_MeasGapConfig_t *measGapConfig,
                            LTE_TDD_Config_t *tdd_Config,
357 358
                            uint8_t *SIwindowsize,
                            uint16_t *SIperiod
359
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
360 361
                            ,
                            MBMS_flag_t MBMS_Flag,
362 363 364
                            struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList,
                            LTE_MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList,
                            struct LTE_PMCH_InfoList_r9 *pmch_InfoList
365
#endif
366
                           );
367
  unsigned int (*mac_rlc_data_req)(module_id_t, unsigned int, const unsigned int,char*
368
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
369 370 371 372
                                  ,uint32_t
                                  ,uint32_t
#endif
                                   );
gauthier's avatar
gauthier committed
373
  void (*mac_rlc_data_ind)(module_id_t, logical_chan_id_t, char*, tb_size_t, num_tb_t, crc_t* );
374
  mac_rlc_status_resp_t (*mac_rlc_status_ind)     (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, sub_frame_t subframeP, eNB_flag_t eNB_flagP, MBMS_flag_t MBMS_flagP,
375
      logical_chan_id_t channel_idP, tb_size_t tb_sizeP
376
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
377 378 379 380
      ,uint32_t sourceL2Id
      ,uint32_t destinationL2Id
#endif
      );
381 382
  signed int (*rrc_rlc_data_req)(module_id_t, rb_id_t, mui_t, confirm_t, sdu_size_t, char *);
  void (*rrc_rlc_register_rrc) (void (*rrc_data_indP)(module_id_t , rb_id_t , sdu_size_t , char* ),
383
                                void  (*rrc_data_confP) (module_id_t , rb_id_t , mui_t ) ) ;
384 385
  void (*mrbch_phy_sync_failure) (uint8_t Mod_id, frame_t frame, uint8_t Free_ch_index);
  void (*dl_phy_sync_success) (uint8_t Mod_id, frame_t frame, uint8_t eNB_index);
386
} MAC_RLC_XFACE;
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401


#endif



#define IDLE 0
#define NEED_RADIO_CONFIG 3
#define RADIO_CONFIG_TX 2
#define RADIO_CONFIG_OK 1

#define MEAS_CONFIGURED 4
#define MEAS_OK 5
#define MEAS_TRIGGER 6
#define RRC_MEAS_REPORT_REQ 7
402
#define MEAS_REPORT 8
403 404 405 406 407 408 409 410 411 412

#define RAB_MEAS_IND 0
#define DEF_MEAS_IND 1

#define ADD_LC 0
#define REMOVE_LC 1

#endif