rlc.c 41 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
/*******************************************************************************

Eurecom OpenAirInterface 2
Copyright(c) 1999 - 2010 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, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France

*******************************************************************************/

#define RLC_C
#include "rlc.h"
#include "mem_block.h"
#include "../MAC/extern.h"
#include "UTIL/LOG/log.h"
35
#include "UTIL/OCG/OCG_vars.h"
36 37 38

#include "assertions.h"

39
extern void pdcp_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, MBMS_flag_t MBMS_flag, rb_id_t rab_idP, sdu_size_t data_sizeP, mem_block_t * sdu_pP, uint8_t is_data_plane);
40

41
#define DEBUG_RLC_PDCP_INTERFACE
42

43
#define DEBUG_RLC_DATA_REQ 1
44 45 46 47 48 49 50 51 52 53 54 55

//-----------------------------------------------------------------------------
void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, unsigned long sizeP)
//-----------------------------------------------------------------------------
{
  unsigned long octet_index = 0;

  if (dataP == NULL) {
    return;
  }


56 57 58 59 60


  LOG_T(componentP, "+-----+-------------------------------------------------+\n");
  LOG_T(componentP, "|     |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |\n");
  LOG_T(componentP, "+-----+-------------------------------------------------+\n");
61 62 63
  for (octet_index = 0; octet_index < sizeP; octet_index++) {
    if ((octet_index % 16) == 0){
      if (octet_index != 0) {
64
        LOG_T(componentP, " |\n");
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
      }
      LOG_T(componentP, " %04d |", octet_index);
    }
    /*
     * Print every single octet in hexadecimal form
     */
    LOG_T(componentP, " %02x", dataP[octet_index]);
    /*
     * Align newline and pipes according to the octets in groups of 2
     */
  }

  /*
   * Append enough spaces and put final pipe
   */
  unsigned char index;
  for (index = octet_index; index < 16; ++index)
    LOG_T(componentP, "   ");
  LOG_T(componentP, " |\n");
}

//-----------------------------------------------------------------------------
87 88 89 90
rlc_op_status_t rlc_stat_req     (
                  module_id_t   enb_mod_idP,
                  module_id_t   ue_mod_idP,
                  frame_t       frameP,
91
                  eNB_flag_t    enb_flagP,
92
                  rb_id_t       rb_idP,
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
                  unsigned int* stat_tx_pdcp_sdu,
                  unsigned int* stat_tx_pdcp_bytes,
                  unsigned int* stat_tx_pdcp_sdu_discarded,
                  unsigned int* stat_tx_pdcp_bytes_discarded,
                  unsigned int* stat_tx_data_pdu,
                  unsigned int* stat_tx_data_bytes,
                  unsigned int* stat_tx_retransmit_pdu_by_status,
                  unsigned int* stat_tx_retransmit_bytes_by_status,
                  unsigned int* stat_tx_retransmit_pdu,
                  unsigned int* stat_tx_retransmit_bytes,
                  unsigned int* stat_tx_control_pdu,
                  unsigned int* stat_tx_control_bytes,
                  unsigned int* stat_rx_pdcp_sdu,
                  unsigned int* stat_rx_pdcp_bytes,
                  unsigned int* stat_rx_data_pdus_duplicate,
                  unsigned int* stat_rx_data_bytes_duplicate,
                  unsigned int* stat_rx_data_pdu,
                  unsigned int* stat_rx_data_bytes,
                  unsigned int* stat_rx_data_pdu_dropped,
                  unsigned int* stat_rx_data_bytes_dropped,
                  unsigned int* stat_rx_data_pdu_out_of_window,
                  unsigned int* stat_rx_data_bytes_out_of_window,
                  unsigned int* stat_rx_control_pdu,
                  unsigned int* stat_rx_control_bytes,
                  unsigned int* stat_timer_reordering_timed_out,
                  unsigned int* stat_timer_poll_retransmit_timed_out,
                  unsigned int* stat_timer_status_prohibit_timed_out) {
//-----------------------------------------------------------------------------
Lionel Gauthier's avatar
Lionel Gauthier committed
121
    rlc_mode_t             rlc_mode = RLC_MODE_NONE;
122
    void                  *rlc_p      = NULL;
123 124

#ifdef OAI_EMU
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
    if (enb_flagP) {
        AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
            "eNB module id is too low (%u/%d)!\n",
            enb_mod_idP,
            oai_emulation.info.first_enb_local);
        AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),
            "eNB module id is too high (%u/%d)!\n",
            enb_mod_idP,
            oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);
        AssertFatal (ue_mod_idP  < NB_UE_INST,
            "UE module id is too high (%u/%d)!\n",
            ue_mod_idP,
            oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
    } else {
        AssertFatal (ue_mod_idP  < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
            "UE module id is too high (%u/%d)!\n",
            ue_mod_idP,
            oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
        AssertFatal (ue_mod_idP  >= oai_emulation.info.first_ue_local,
            "UE module id is too low (%u/%d)!\n",
            ue_mod_idP,
            oai_emulation.info.first_ue_local);
    }
148 149
#endif
    AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
150
    if (enb_flagP) {
151 152
        rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
        switch (rlc_mode) {
Lionel Gauthier's avatar
Lionel Gauthier committed
153
          case RLC_MODE_NONE:
154 155
              AssertFatal (0 , "enB RLC not configured rb id %u  module eNB id %u!\n", rb_idP, enb_mod_idP);
              break;
Lionel Gauthier's avatar
Lionel Gauthier committed
156
          case RLC_MODE_AM:
157
              rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am;
158
              break;
Lionel Gauthier's avatar
Lionel Gauthier committed
159
          case RLC_MODE_UM:
160
              rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um;
161
              break;
Lionel Gauthier's avatar
Lionel Gauthier committed
162
          case RLC_MODE_TM:
163
              rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm;
164 165 166 167 168 169 170
              break;
          default:
              AssertFatal (0 , "enB RLC internal memory error rb id %u module eNB id %u!\n", rb_idP, enb_mod_idP);
        }
    } else {
        rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
        switch (rlc_mode) {
Lionel Gauthier's avatar
Lionel Gauthier committed
171
          case RLC_MODE_NONE:
172 173
              AssertFatal (0 , "UE RLC not configured rb id %u module ue id %u!\n", rb_idP, ue_mod_idP);
              break;
Lionel Gauthier's avatar
Lionel Gauthier committed
174
          case RLC_MODE_AM:
175
              rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am;
176
              break;
Lionel Gauthier's avatar
Lionel Gauthier committed
177
          case RLC_MODE_UM:
178
              rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um;
179
              break;
Lionel Gauthier's avatar
Lionel Gauthier committed
180
          case RLC_MODE_TM:
181
              rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm;
182 183 184 185 186 187
              break;
          default:
              AssertFatal (0 , "UE RLC internal memory error rb id %u module ue id %u!\n", rb_idP, ue_mod_idP);
        }
    }
    switch (rlc_mode) {
Lionel Gauthier's avatar
Lionel Gauthier committed
188
        case RLC_MODE_NONE:
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
            *stat_tx_pdcp_sdu                     = 0;
            *stat_tx_pdcp_bytes                   = 0;
            *stat_tx_pdcp_sdu_discarded           = 0;
            *stat_tx_pdcp_bytes_discarded         = 0;
            *stat_tx_data_pdu                     = 0;
            *stat_tx_data_bytes                   = 0;
            *stat_tx_retransmit_pdu_by_status     = 0;
            *stat_tx_retransmit_bytes_by_status   = 0;
            *stat_tx_retransmit_pdu               = 0;
            *stat_tx_retransmit_bytes             = 0;
            *stat_tx_control_pdu                  = 0;
            *stat_tx_control_bytes                = 0;
            *stat_rx_pdcp_sdu                     = 0;
            *stat_rx_pdcp_bytes                   = 0;
            *stat_rx_data_pdus_duplicate          = 0;
            *stat_rx_data_bytes_duplicate         = 0;
            *stat_rx_data_pdu                     = 0;
            *stat_rx_data_bytes                   = 0;
            *stat_rx_data_pdu_dropped             = 0;
            *stat_rx_data_bytes_dropped           = 0;
            *stat_rx_data_pdu_out_of_window       = 0;
            *stat_rx_data_bytes_out_of_window     = 0;
            *stat_rx_control_pdu                  = 0;
            *stat_rx_control_bytes                = 0;
            *stat_timer_reordering_timed_out      = 0;
            *stat_timer_poll_retransmit_timed_out = 0;
            *stat_timer_status_prohibit_timed_out = 0;
            return RLC_OP_STATUS_BAD_PARAMETER;
            break;

Lionel Gauthier's avatar
Lionel Gauthier committed
219
        case RLC_MODE_AM:
220
            rlc_am_stat_req((rlc_am_entity_t*)rlc_p,
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
                            stat_tx_pdcp_sdu,
                            stat_tx_pdcp_bytes,
                            stat_tx_pdcp_sdu_discarded,
                            stat_tx_pdcp_bytes_discarded,
                            stat_tx_data_pdu,
                            stat_tx_data_bytes,
                            stat_tx_retransmit_pdu_by_status,
                            stat_tx_retransmit_bytes_by_status,
                            stat_tx_retransmit_pdu,
                            stat_tx_retransmit_bytes,
                            stat_tx_control_pdu,
                            stat_tx_control_bytes,
                            stat_rx_pdcp_sdu,
                            stat_rx_pdcp_bytes,
                            stat_rx_data_pdus_duplicate,
                            stat_rx_data_bytes_duplicate,
                            stat_rx_data_pdu,
                            stat_rx_data_bytes,
                            stat_rx_data_pdu_dropped,
                            stat_rx_data_bytes_dropped,
                            stat_rx_data_pdu_out_of_window,
                            stat_rx_data_bytes_out_of_window,
                            stat_rx_control_pdu,
                            stat_rx_control_bytes,
                            stat_timer_reordering_timed_out,
                            stat_timer_poll_retransmit_timed_out,
                            stat_timer_status_prohibit_timed_out);
                            return RLC_OP_STATUS_OK;
           break;

Lionel Gauthier's avatar
Lionel Gauthier committed
251
       case RLC_MODE_UM:
252 253 254 255 256 257 258 259 260 261 262 263
           *stat_tx_retransmit_pdu_by_status     = 0;
           *stat_tx_retransmit_bytes_by_status   = 0;
           *stat_tx_retransmit_pdu               = 0;
           *stat_tx_retransmit_bytes             = 0;
           *stat_tx_control_pdu                  = 0;
           *stat_tx_control_bytes                = 0;
           *stat_rx_data_pdu_dropped             = 0;
           *stat_rx_data_bytes_dropped           = 0;
           *stat_rx_data_pdu_out_of_window       = 0;
           *stat_rx_data_bytes_out_of_window     = 0;
           *stat_timer_poll_retransmit_timed_out = 0;
           *stat_timer_status_prohibit_timed_out = 0;
264
           rlc_um_stat_req ((rlc_um_entity_t*)rlc_p,
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
                              stat_tx_pdcp_sdu,
                              stat_tx_pdcp_bytes,
                              stat_tx_pdcp_sdu_discarded,
                              stat_tx_pdcp_bytes_discarded,
                              stat_tx_data_pdu,
                              stat_tx_data_bytes,
                              stat_rx_pdcp_sdu,
                              stat_rx_pdcp_bytes,
                              stat_rx_data_pdus_duplicate,
                              stat_rx_data_bytes_duplicate,
                              stat_rx_data_pdu,
                              stat_rx_data_bytes,
                              stat_rx_data_pdu_dropped,
                              stat_rx_data_bytes_dropped,
                              stat_rx_data_pdu_out_of_window,
                              stat_rx_data_bytes_out_of_window,
                              stat_timer_reordering_timed_out);
           return RLC_OP_STATUS_OK;
           break;

Lionel Gauthier's avatar
Lionel Gauthier committed
285
       case RLC_MODE_TM:
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
           *stat_tx_pdcp_sdu                     = 0;
           *stat_tx_pdcp_bytes                   = 0;
           *stat_tx_pdcp_sdu_discarded           = 0;
           *stat_tx_pdcp_bytes_discarded         = 0;
           *stat_tx_data_pdu                     = 0;
           *stat_tx_data_bytes                   = 0;
           *stat_tx_retransmit_pdu_by_status     = 0;
           *stat_tx_retransmit_bytes_by_status   = 0;
           *stat_tx_retransmit_pdu               = 0;
           *stat_tx_retransmit_bytes             = 0;
           *stat_tx_control_pdu                  = 0;
           *stat_tx_control_bytes                = 0;
           *stat_rx_pdcp_sdu                     = 0;
           *stat_rx_pdcp_bytes                   = 0;
           *stat_rx_data_pdus_duplicate          = 0;
           *stat_rx_data_bytes_duplicate         = 0;
           *stat_rx_data_pdu                     = 0;
           *stat_rx_data_bytes                   = 0;
           *stat_rx_data_pdu_dropped             = 0;
           *stat_rx_data_bytes_dropped           = 0;
           *stat_rx_data_pdu_out_of_window       = 0;
           *stat_rx_data_bytes_out_of_window     = 0;
           *stat_rx_control_pdu                  = 0;
           *stat_rx_control_bytes                = 0;
           *stat_timer_reordering_timed_out      = 0;
           *stat_timer_poll_retransmit_timed_out = 0;
           *stat_timer_status_prohibit_timed_out = 0;
           return RLC_OP_STATUS_BAD_PARAMETER;
           break;

       default:
           *stat_tx_pdcp_sdu                     = 0;
           *stat_tx_pdcp_bytes                   = 0;
           *stat_tx_pdcp_sdu_discarded           = 0;
           *stat_tx_pdcp_bytes_discarded         = 0;
           *stat_tx_data_pdu                     = 0;
           *stat_tx_data_bytes                   = 0;
           *stat_tx_retransmit_pdu_by_status     = 0;
           *stat_tx_retransmit_bytes_by_status   = 0;
           *stat_tx_retransmit_pdu               = 0;
           *stat_tx_retransmit_bytes             = 0;
           *stat_tx_control_pdu                  = 0;
           *stat_tx_control_bytes                = 0;
           *stat_rx_pdcp_sdu                     = 0;
           *stat_rx_pdcp_bytes                   = 0;
           *stat_rx_data_pdus_duplicate          = 0;
           *stat_rx_data_bytes_duplicate         = 0;
           *stat_rx_data_pdu                     = 0;
           *stat_rx_data_bytes                   = 0;
           *stat_rx_data_pdu_dropped             = 0;
           *stat_rx_data_bytes_dropped           = 0;
           *stat_rx_data_pdu_out_of_window       = 0;
           *stat_rx_data_bytes_out_of_window     = 0;
           *stat_rx_control_pdu                  = 0;
           *stat_rx_control_bytes                = 0;

           *stat_timer_poll_retransmit_timed_out = 0;
           *stat_timer_status_prohibit_timed_out = 0;
           return RLC_OP_STATUS_BAD_PARAMETER;
    }
346 347
}
//-----------------------------------------------------------------------------
348 349 350
rlc_op_status_t rlc_data_req     (module_id_t  enb_mod_idP,
                                  module_id_t  ue_mod_idP,
                                  frame_t      frameP,
351
                                  eNB_flag_t   enb_flagP,
352 353 354 355 356
                                  MBMS_flag_t  MBMS_flagP,
                                  rb_id_t      rb_idP,
                                  mui_t        muiP,
                                  confirm_t    confirmP,
                                  sdu_size_t   sdu_sizeP,
357
                                  mem_block_t *sdu_pP) {
358
//-----------------------------------------------------------------------------
359
  mem_block_t           *new_sdu_p    = NULL;
Lionel Gauthier's avatar
Lionel Gauthier committed
360
  rlc_mode_t             rlc_mode     = RLC_MODE_NONE;
361
  void                  *rlc_p        = NULL;
362
#ifdef Rel10
363
  rb_id_t                mbms_rb_id = 0;
364
  rlc_um_entity_t       *rlc_um_p   = NULL;
365 366
  rlc_mbms_id_t         *mbms_id_p  = NULL;
  logical_chan_id_t      log_ch_id  = 0;
367 368
#endif
#ifdef DEBUG_RLC_DATA_REQ
369
  LOG_D(RLC,"rlc_data_req: %s enb id  %u  ue id %u, rb_id %u (MAX %d), muip %d, confirmP %d, sud_sizeP %d, sdu_pP %p\n",
370
        (enb_flagP) ? "eNB" : "UE",
371 372 373 374 375 376 377 378
        enb_mod_idP,
        ue_mod_idP,
        rb_idP,
        NB_RAB_MAX,
        muiP,
        confirmP,
        sdu_sizeP,
        sdu_pP);
379
#endif
380 381
#ifdef Rel10
#else
382
  AssertFatal(MBMS_flagP == 0, "MBMS_flagP %u", MBMS_flagP);
383
#endif
384
#ifdef OAI_EMU
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
  if (enb_flagP) {
      AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),
          "eNB module id is too low (%u/%d)!\n",
          enb_mod_idP,
          oai_emulation.info.first_enb_local);
      AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),
          "eNB module id is too high (%u/%d)!\n",
          enb_mod_idP,
          oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);
      AssertFatal (ue_mod_idP  < NB_UE_INST,
          "UE module id is too high (%u/%d)!\n",
          ue_mod_idP,
          oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
  } else {
      AssertFatal (ue_mod_idP  < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),
          "UE module id is too high (%u/%d)!\n",
          ue_mod_idP,
          oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);
      AssertFatal (ue_mod_idP  >= oai_emulation.info.first_ue_local,
          "UE module id is too low (%u/%d)!\n",
          ue_mod_idP,
          oai_emulation.info.first_ue_local);
  }
408
#endif
409 410 411 412 413
  if (MBMS_flagP) {
      AssertFatal (rb_idP < NB_RB_MBMS_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
  } else {
      AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
  }
414
  DevAssert(sdu_pP != NULL);
415 416 417 418 419 420
  DevCheck(sdu_sizeP > 0, sdu_sizeP, 0, 0);

#ifndef Rel10
  DevCheck(MBMS_flagP == 0, MBMS_flagP, 0, 0);
#endif

421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443
#ifdef Rel10
  if (MBMS_flagP == TRUE) {
      if (enb_flagP) {
            log_ch_id = rlc_mbms_enb_get_lcid_by_rb_id(enb_mod_idP,rb_idP);
            mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][log_ch_id];
            rlc_um_p  = &rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um;
            LOG_D(RLC,"eNB rlc_um_p : %p RB %u service %u session %u\n",
                  rlc_um_p,
                  rb_idP,
                  mbms_id_p->service_id,
                  mbms_id_p->session_id
                 );

      } else {
            log_ch_id = rlc_mbms_ue_get_lcid_by_rb_id(ue_mod_idP,rb_idP);
            mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][log_ch_id];
            rlc_um_p  = &rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um;
            LOG_D(RLC,"UE rlc_um_p : %p RB %u service %u session %u\n",
                  rlc_um_p,
                  rb_idP,
                  mbms_id_p->service_id,
                  mbms_id_p->session_id
                 );
444
      }
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
  } else
#endif
  {
      if (enb_flagP) {
          rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
          switch (rlc_mode) {
            case RLC_MODE_NONE:
                AssertFatal (0 , "enB RLC not configured rb id %u module %u!\n", rb_idP, enb_mod_idP);
                break;
            case RLC_MODE_AM:
                rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am;
                break;
            case RLC_MODE_UM:
                rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um;
                break;
            case RLC_MODE_TM:
                rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm;
                break;
            default:
                AssertFatal (0 , "enB RLC internal memory error rb id %u module %u!\n", rb_idP, enb_mod_idP);
          }
      } else {
          rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
          switch (rlc_mode) {
            case RLC_MODE_NONE:
                AssertFatal (0 , "UE RLC not configured rb id %u module %u!\n", rb_idP, ue_mod_idP);
                break;
            case RLC_MODE_AM:
                rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am;
                break;
            case RLC_MODE_UM:
                rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um;
                break;
            case RLC_MODE_TM:
                rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm;
                break;
            default:
                AssertFatal (0 , "UE RLC internal memory error rb id %u module %u!\n", rb_idP, ue_mod_idP);
          }
484 485 486
      }
  }

487
  if (MBMS_flagP == 0) {
488
      LOG_D(RLC, "[FRAME %5u][%s][RLC][INST %u/%u][RB %u] Display of rlc_data_req:\n",
489
          frameP,
490
          (enb_flagP) ? "eNB" : "UE",
491 492 493 494
          enb_mod_idP,
          ue_mod_idP,
          rb_idP);
      rlc_util_print_hex_octets(RLC, (unsigned char*)sdu_pP->data, sdu_sizeP);
495 496

#ifdef DEBUG_RLC_DATA_REQ
497
      LOG_D(RLC,"RLC_TYPE : %d ",rlc_mode);
498
#endif
499
      switch (rlc_mode) {
Lionel Gauthier's avatar
Lionel Gauthier committed
500
          case RLC_MODE_NONE:
501
              free_mem_block(sdu_pP);
Lionel Gauthier's avatar
Lionel Gauthier committed
502
              LOG_E(RLC, "Received RLC_MODE_NONE as rlc_type for %s eNB id  %u, ue id %u, rb_id %u\n",
503
                    (enb_flagP) ? "eNB" : "UE",
504 505 506 507
                    enb_mod_idP,
                    ue_mod_idP,
                    rb_idP);
              return RLC_OP_STATUS_BAD_PARAMETER;
508

Lionel Gauthier's avatar
Lionel Gauthier committed
509
          case RLC_MODE_AM:
510
#ifdef DEBUG_RLC_DATA_REQ
Lionel Gauthier's avatar
Lionel Gauthier committed
511
              msg("RLC_MODE_AM\n");
512
#endif
513
              new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_am_data_req_alloc));
514

515
              if (new_sdu_p != NULL) {
516
                  // PROCESS OF COMPRESSION HERE:
517 518
                  memset (new_sdu_p->data, 0, sizeof (struct rlc_am_data_req_alloc));
                  memcpy (&new_sdu_p->data[sizeof (struct rlc_am_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
519

520 521 522 523
                  ((struct rlc_am_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
                  ((struct rlc_am_data_req *) (new_sdu_p->data))->conf = confirmP;
                  ((struct rlc_am_data_req *) (new_sdu_p->data))->mui  = muiP;
                  ((struct rlc_am_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_am_data_req_alloc);
524 525 526
                  free_mem_block(sdu_pP);
                  LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED);

527
                  if (((rlc_am_entity_t*)rlc_p)->is_data_plane) {
528
                      LOG_D(RLC, "[FRAME %5u][%s][PDCP][INST %u/%u][RB %u][--- RLC_AM_DATA_REQ/%d Bytes --->][RLC_AM][INST %u/%u][RB %u]\n",
529
                          frameP,
530
                          (enb_flagP) ? "eNB" : "UE",
531 532 533 534 535 536 537 538 539
                          enb_mod_idP,
                          ue_mod_idP,
                          rb_idP,
                          sdu_sizeP,
                          ue_mod_idP,
                          rb_idP,
                          rb_idP);
                  } else {
                      LOG_D(RLC, "[FRAME %5u][%s][RRC][INST %u/%u][][--- RLC_AM_DATA_REQ/%d Bytes --->][RLC_AM][INST %u/%u][RB %u]\n",
540
                          frameP,
541
                          (enb_flagP) ? "eNB" : "UE",
542 543 544 545 546 547 548 549 550
                          enb_mod_idP,
                          ue_mod_idP,
                          rb_idP,
                          sdu_sizeP,
                          enb_mod_idP,
                          ue_mod_idP,
                          rb_idP);
                  }
                  LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT);
551
                  rlc_am_data_req((rlc_am_entity_t*)rlc_p, frameP, new_sdu_p);
552 553 554 555 556 557
                  return RLC_OP_STATUS_OK;
              } else {
                  return RLC_OP_STATUS_INTERNAL_ERROR;
              }
              break;

Lionel Gauthier's avatar
Lionel Gauthier committed
558
          case RLC_MODE_UM:
559
            new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc));
560

561
              if (new_sdu_p != NULL) {
562
                  // PROCESS OF COMPRESSION HERE:
563 564
                  memset (new_sdu_p->data, 0, sizeof (struct rlc_um_data_req_alloc));
                  memcpy (&new_sdu_p->data[sizeof (struct rlc_um_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
565

566 567
                  ((struct rlc_um_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
                  ((struct rlc_um_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_um_data_req_alloc);
568 569 570
                  free_mem_block(sdu_pP);

                  LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED);
571
                  if (((rlc_am_entity_t*)rlc_p)->is_data_plane) {
572
                      LOG_D(RLC, "[FRAME %5u][%s][PDCP][INST %u/%u][RB %u][--- RLC_UM_DATA_REQ/%d Bytes --->][RLC_UM][INST %u/%u][RB %u]\n",
573
                          frameP,
574
                          (enb_flagP) ? "eNB" : "UE",
575 576 577 578 579 580 581 582 583
                          enb_mod_idP,
                          ue_mod_idP,
                          rb_idP,
                          sdu_sizeP,
                          enb_mod_idP,
                          ue_mod_idP,
                          rb_idP);
                  } else {
                      LOG_D(RLC, "[FRAME %5u][%s][RRC][INST %u/%u][][--- RLC_UM_DATA_REQ/%d Bytes --->][RLC_UM][INST %u/%u][RB %u]\n",
584
                                     frameP,
585
                                     (enb_flagP) ? "eNB" : "UE",
586 587 588 589 590 591 592 593 594
                                     enb_mod_idP,
                                     ue_mod_idP,
                                     rb_idP,
                                     sdu_sizeP,
                                     enb_mod_idP,
                                     ue_mod_idP,
                                     rb_idP);
                  }
                  LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT);
595
                  rlc_um_data_req((rlc_um_entity_t*)rlc_p, frameP, new_sdu_p);
596

597 598 599 600 601 602 603
                  //free_mem_block(new_sdu);
                  return RLC_OP_STATUS_OK;
              } else {
                  return RLC_OP_STATUS_INTERNAL_ERROR;
              }
              break;

Lionel Gauthier's avatar
Lionel Gauthier committed
604
          case RLC_MODE_TM:
605
            new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_tm_data_req_alloc));
606

607
              if (new_sdu_p != NULL) {
608
                  // PROCESS OF COMPRESSION HERE:
609 610
                  memset (new_sdu_p->data, 0, sizeof (struct rlc_tm_data_req_alloc));
                  memcpy (&new_sdu_p->data[sizeof (struct rlc_tm_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
611

612 613
                  ((struct rlc_tm_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
                  ((struct rlc_tm_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_tm_data_req_alloc);
614 615
                  free_mem_block(sdu_pP);
                  LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED);
616
                  if (((rlc_tm_entity_t*)rlc_p)->is_data_plane) {
617
                      LOG_D(RLC, "[FRAME %5u][%s][PDCP][INST %u/%u][RB %u][--- RLC_TM_DATA_REQ/%d Bytes --->][RLC_TM][INST %u/%u][RB %u]\n",
618
                                 frameP,
619
                                 (enb_flagP) ? "eNB" : "UE",
620 621 622 623 624 625 626 627 628
                                 enb_mod_idP,
                                 ue_mod_idP,
                                 rb_idP,
                                 sdu_sizeP,
                                 enb_mod_idP,
                                 ue_mod_idP,
                                 rb_idP);
                  } else {
                       LOG_D(RLC, "[FRAME %5u][%s][RRC][INST %u/%u][][--- RLC_TM_DATA_REQ/%d Bytes --->][RLC_TM][INST %u/%u][RB %u]\n",
629
                                     frameP,
630
                                     (enb_flagP) ? "eNB" : "UE",
631 632 633 634 635 636 637
                                     enb_mod_idP,
                                     ue_mod_idP,
                                     rb_idP,
                                     sdu_sizeP,
                                     enb_mod_idP,
                                     ue_mod_idP,
                                     rb_idP);
638
                  }
639
                  LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT);
640
                  rlc_tm_data_req((rlc_tm_entity_t*)rlc_p, new_sdu_p);
641 642 643 644 645 646 647 648 649 650 651 652
                  return RLC_OP_STATUS_OK;
              } else {
                  //handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : out of memory\n", __FILE__, __LINE__);
                  return RLC_OP_STATUS_INTERNAL_ERROR;
              }
              break;

          default:
              free_mem_block(sdu_pP);
              return RLC_OP_STATUS_INTERNAL_ERROR;

      }
653

654
#ifdef Rel10
655
  } else { /* MBMS_flag != 0 */
656
	  //  LOG_I(RLC,"DUY rlc_data_req: mbms_rb_id in RLC instant is: %d\n", mbms_rb_id);
657
          if (sdu_pP != NULL) {
658 659
              if (sdu_sizeP > 0) {
                  LOG_I(RLC,"received a packet with size %d for MBMS \n", sdu_sizeP);
660 661
                  new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc));
                  if (new_sdu_p != NULL) {
662
                      // PROCESS OF COMPRESSION HERE:
663 664 665 666
                      memset (new_sdu_p->data, 0, sizeof (struct rlc_um_data_req_alloc));
                      memcpy (&new_sdu_p->data[sizeof (struct rlc_um_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
                      ((struct rlc_um_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
                      ((struct rlc_um_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_um_data_req_alloc);
667
                      free_mem_block(sdu_pP);
668
                      LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED);
669
                      if (rlc_um_p->is_data_plane) {
670
                          LOG_D(RLC, "[FRAME %5u][PDCP][INST %u/%u][RB %u][--- RLC_UM_DATA_REQ/%d Bytes (MBMS) --->][RLC_UM][INST %u/%u][RB %u]\n",
671
                            frameP,
672 673 674 675 676 677
                            enb_mod_idP,
                            ue_mod_idP,
                            rb_idP,
                            sdu_sizeP,
                            enb_mod_idP,
                            ue_mod_idP,
678
                            rb_idP);
679
                      } else {
680
                          if (enb_flagP) {
681
                              LOG_D(RLC, "[FRAME %5u][RRC_eNB][INST %u/%u][%u][--- RLC_UM_DATA_REQ/%d Bytes (MBMS) --->][RLC_UM][INST %u/%u][RB %u]\n",
682
                                 frameP,
683 684 685 686 687 688
                                 enb_mod_idP,
                                 ue_mod_idP,
                                 rb_idP,
                                 sdu_sizeP,
                                 enb_mod_idP,
                                 ue_mod_idP,
689
                                 rb_idP);
690
                          } else {
691
                              LOG_D(RLC, "[FRAME %5u][RRC_UE][INST %u/%u][%u][--- RLC_UM_DATA_REQ/%d Bytes (MBMS) --->][RLC_UM][INST %u/%u][RB %u]\n",
692
                                 frameP,
693 694 695 696 697 698
                                 enb_mod_idP,
                                 ue_mod_idP,
                                 rb_idP,
                                 sdu_sizeP,
                                 enb_mod_idP,
                                 ue_mod_idP,
699
                                 rb_idP);
700 701 702
                          }
                      }
                      LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT);
703
                      rlc_um_data_req(rlc_um_p, frameP, new_sdu_p);
704 705 706 707 708 709 710 711 712 713 714 715

                      //free_mem_block(new_sdu);
                      return RLC_OP_STATUS_OK;
                  } else {
                      return RLC_OP_STATUS_BAD_PARAMETER;
                  }
              } else {
                  return RLC_OP_STATUS_BAD_PARAMETER;
              }
          } else {
              return RLC_OP_STATUS_BAD_PARAMETER;
          }
716 717 718
  }
#else
  } else {/* MBMS_flag != 0 */
719
    free_mem_block(sdu_pP);
720
    LOG_E(RLC, "MBMS_flag != 0 while Rel10 is not defined...\n");
721 722
    //handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : parameter module_id out of bounds :%d\n", __FILE__, __LINE__, module_idP);
    return RLC_OP_STATUS_BAD_PARAMETER;
723
  }
724
#endif
725 726 727
}

//-----------------------------------------------------------------------------
728
void rlc_data_ind     (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, MBMS_flag_t MBMS_flagP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t* sdu_pP, boolean_t is_data_planeP) {
729
//-----------------------------------------------------------------------------
Lionel Gauthier's avatar
Lionel Gauthier committed
730
  rlc_mode_t             rlc_mode   = RLC_MODE_NONE;
731

732 733 734 735 736 737 738 739 740 741 742
#ifdef Rel10
  if (MBMS_flagP == TRUE) {
      rlc_mode = RLC_MODE_UM;
  } else
#endif
  {
      if (enb_flagP) {
          rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
      } else {
          rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
      }
743
  }
744 745

  LOG_D(RLC, "[FRAME %5u][%s][RLC][INST %u/%u][RB %u] Display of rlc_data_ind: size %u\n",
746
        frameP,
747
        (enb_flagP) ? "eNB" : "UE",
748 749 750 751 752 753 754 755 756 757 758
        enb_mod_idP,
        ue_mod_idP,
        rb_idP,
        sdu_sizeP);

  rlc_util_print_hex_octets(RLC, (unsigned char*)sdu_pP->data, sdu_sizeP);
    // now demux is done at PDCP
    //  if ((is_data_planeP)) {


  switch (rlc_mode) {
Lionel Gauthier's avatar
Lionel Gauthier committed
759 760 761
      case RLC_MODE_NONE:
        break;
      case RLC_MODE_AM:
762
          LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][INST %u/%u][RB %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n",
763
                   frameP,
764
                   (enb_flagP) ? "eNB" : "UE",
765 766 767 768 769 770 771 772
                   enb_mod_idP,
                   ue_mod_idP,
                   rb_idP,
                   sdu_sizeP,
                   enb_mod_idP,
                   ue_mod_idP,
                   rb_idP);
          break;
Lionel Gauthier's avatar
Lionel Gauthier committed
773
      case RLC_MODE_UM:
774
          LOG_D(RLC, "[FRAME %5u][%s][RLC_UM][INST %u/%u][RB %u][--- RLC_DATA_IND %s/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n",
775
                   frameP,
776
                   (enb_flagP) ? "eNB" : "UE",
777 778 779
                   enb_mod_idP,
                   ue_mod_idP,
                   rb_idP,
780
                   (MBMS_flagP) ? "(e-MBMS)" : "",
781 782 783 784 785
                   sdu_sizeP,
                   enb_mod_idP,
                   ue_mod_idP,
                   rb_idP);
          break;
Lionel Gauthier's avatar
Lionel Gauthier committed
786
      case RLC_MODE_TM:
787
          LOG_D(RLC, "[FRAME %5u][%s][RLC_TM][INST %u/%u][RB %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n",
788
                 frameP,
789
                 (enb_flagP) ? "eNB" : "UE",
790 791 792 793 794 795 796 797 798
                 enb_mod_idP,
                 ue_mod_idP,
                 rb_idP,
                 sdu_sizeP,
                 enb_mod_idP,
                 ue_mod_idP,
                 rb_idP);
          break;
  }
799
  pdcp_data_ind (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP, is_data_planeP);
800 801
}
//-----------------------------------------------------------------------------
802 803 804
void rlc_data_conf     (module_id_t     enb_mod_idP,
                        module_id_t     ue_mod_idP,
                        frame_t         frameP,
805
                        eNB_flag_t      enb_flagP,
806 807 808 809
                        rb_id_t         rb_idP,
                        mui_t           muiP,
                        rlc_tx_status_t statusP,
                        boolean_t       is_data_planeP) {
810
//-----------------------------------------------------------------------------
Lionel Gauthier's avatar
Lionel Gauthier committed
811
    rlc_mode_t             rlc_mode   = RLC_MODE_NONE;
812

813 814 815 816 817 818 819 820 821 822 823 824 825 826
//TO DO (check if we can add MBMS flag in prototype)#ifdef Rel10
//  if (MBMS_flagP == TRUE) {
//      rlc_mode = RLC_MODE_UM;
//  } else
//#endif
#if !defined(Rel10)
  {
      if (enb_flagP) {
          rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode;
      } else {
          rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode;
      }
  }
#endif
827 828
    if (!(is_data_planeP)) {
        if (rlc_rrc_data_conf != NULL) {
829
#if !defined(Rel10)
830
            LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED);
831
            switch (rlc_mode) {
Lionel Gauthier's avatar
Lionel Gauthier committed
832 833 834
                case RLC_MODE_NONE:
                    break;
                case RLC_MODE_AM:
835
                    LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][INST %u/%u][RB %u][--- RLC_DATA_CONF /MUI %d --->][RRC][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n",
836
                            frameP,
837
                            (enb_flagP) ? "eNB" : "UE",
838 839
                            enb_mod_idP,
                            ue_mod_idP,
840
                            rb_idP,
841 842 843 844
                            muiP,
                            enb_mod_idP,
                            ue_mod_idP,
                            muiP);
845
                    break;
Lionel Gauthier's avatar
Lionel Gauthier committed
846
                case RLC_MODE_UM:
847
                    LOG_D(RLC, "[FRAME %5u][%s][RLC_UM][INST %u/%u][RB %u][--- RLC_DATA_CONF /MUI %d --->][RRC][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n",
848
                            frameP,
849
                            (enb_flagP) ? "eNB" : "UE",
850 851
                            enb_mod_idP,
                            ue_mod_idP,
852
                            rb_idP,
853 854 855 856
                            muiP,
                            enb_mod_idP,
                            ue_mod_idP,
                            muiP);
857
                    break;
Lionel Gauthier's avatar
Lionel Gauthier committed
858
                case RLC_MODE_TM:
859
                    LOG_D(RLC, "[FRAME %5u][%s][RLC_TM][INST %u/%u][RB %u][--- RLC_DATA_CONF /MUI %d --->][RRC][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n",
860
                            frameP,
861
                            (enb_flagP) ? "eNB" : "UE",
862 863
                            enb_mod_idP,
                            ue_mod_idP,
864
                            rb_idP,
865 866 867 868
                            muiP,
                            enb_mod_idP,
                            ue_mod_idP,
                            muiP);
869 870 871
                    break;
            }
            LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT);
872
#endif
873
            rlc_rrc_data_conf (enb_mod_idP , ue_mod_idP, enb_flagP, rb_idP , muiP, statusP);
874 875 876 877 878
        }
    }
}
//-----------------------------------------------------------------------------
int
879
rlc_module_init (void)
880 881
{
//-----------------------------------------------------------------------------
882 883 884 885
   int          k;
   module_id_t  module_id1;
   module_id_t  module_id2;
   rb_id_t      rb_id;
Lionel Gauthier's avatar
Lionel Gauthier committed
886 887 888 889
#if defined(Rel10)
  mbms_session_id_t session_id;
  mbms_service_id_t service_id;
#endif
890

891 892 893
   LOG_D(RLC, "MODULE INIT\n");
   rlc_rrc_data_ind  = NULL;
   rlc_rrc_data_conf = NULL;
894 895 896 897 898 899


   for (module_id1=0; module_id1 < NUMBER_OF_UE_MAX; module_id1++) {
       for (k=0; k < RLC_MAX_LC; k++) {
           lcid2rbid_ue[module_id1][k] = RLC_RB_UNALLOCATED;
       }
Lionel Gauthier's avatar
Lionel Gauthier committed
900 901 902 903 904 905
#if defined(Rel10)
      for (service_id = 0; service_id < maxServiceCount; service_id++) {
          for (session_id = 0; session_id < maxSessionPerPMCH; session_id++) {
              memset(&rlc_mbms_array_ue[module_id1][service_id][session_id], 0, sizeof(rlc_mbms_t));
          }
      }
906 907 908 909
      for (k=0; k < RLC_MAX_MBMS_LC; k++) {
          rlc_mbms_lcid2service_session_id_ue[module_id1][k].service_id = 0;
          rlc_mbms_lcid2service_session_id_ue[module_id1][k].session_id = 0;
      }
910 911 912
      for (k=0; k < NB_RB_MBMS_MAX; k++) {
          rlc_mbms_rbid2lcid_eNB[module_id1][k] = RLC_LC_UNALLOCATED;
      }
Lionel Gauthier's avatar
Lionel Gauthier committed
913
#endif
914 915 916
       for (rb_id=0; rb_id < NB_RB_MAX; rb_id++) {
           memset(&rlc_array_ue[module_id1][rb_id], 0, sizeof(rlc_t));
       }
917
   }
918 919

   for (module_id1=0; module_id1 < NUMBER_OF_eNB_MAX; module_id1++) {
Lionel Gauthier's avatar
Lionel Gauthier committed
920 921 922 923 924 925
#if defined(Rel10)
      for (service_id = 0; service_id < maxServiceCount; service_id++) {
          for (session_id = 0; session_id < maxSessionPerPMCH; session_id++) {
              memset(&rlc_mbms_array_eNB[module_id1][service_id][session_id], 0, sizeof(rlc_mbms_t));
          }
      }
926 927 928 929
      for (k=0; k < RLC_MAX_MBMS_LC; k++) {
          rlc_mbms_lcid2service_session_id_eNB[module_id1][k].service_id = 0;
          rlc_mbms_lcid2service_session_id_eNB[module_id1][k].session_id = 0;
      }
930 931 932
      for (k=0; k < NB_RB_MBMS_MAX; k++) {
          rlc_mbms_rbid2lcid_ue[module_id1][k] = RLC_LC_UNALLOCATED;
      }
Lionel Gauthier's avatar
Lionel Gauthier committed
933
#endif
934 935 936 937 938 939 940 941 942 943
       for (module_id2=0; module_id2 < NUMBER_OF_UE_MAX; module_id2++) {
           for (rb_id=0; rb_id < NB_RB_MAX; rb_id++) {
               memset(&rlc_array_eNB[module_id1][module_id2][rb_id], 0, sizeof(rlc_t));
           }
           for (k=0; k < RLC_MAX_LC; k++) {
               lcid2rbid_eNB[module_id1][module_id2][k] = RLC_RB_UNALLOCATED;
           }
       }
   }

944 945 946 947 948 949
   pool_buffer_init();

   return(0);
}
//-----------------------------------------------------------------------------
void
950
rlc_module_cleanup (void)
951 952 953 954 955
//-----------------------------------------------------------------------------
{
}
//-----------------------------------------------------------------------------
void
956
rlc_layer_init (void)
957 958 959 960 961
{
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
void
962
rlc_layer_cleanup (void)
963 964 965 966
//-----------------------------------------------------------------------------
{
}