Commit 6be4cae6 authored by Matthieu Kanj's avatar Matthieu Kanj

removing some included .h files from eNB_scheduler_ulsch_NB_IoT.c +

creation of new file openair2/LAYER2/MAC/vars_NB_IoT.h
parent 50f7cd00
......@@ -328,6 +328,8 @@ typedef struct {
#define DTCH0_NB_IoT 4 // DRB0
/*!\brief DTCH1 DRB1 logical channel */
#define DTCH1_NB_IoT 5 // DRB1
/*!\brief size of buffer status report table */
#define BSR_TABLE_SIZE_NB_IoT 64
// DLSCH LCHAN ID all the same as NB-IoT
/*!\brief DCI PDU filled by MAC for the PHY */
/*
......
......@@ -36,7 +36,7 @@
//#include "SCHED/defs.h"
//#include "SCHED/extern.h"
#include "LAYER2/MAC/defs.h"
//#include "LAYER2/MAC/defs.h"
//#include "LAYER2/MAC/extern.h"
//#include "LAYER2/MAC/proto.h"
......@@ -61,8 +61,8 @@
# include "intertask_interface.h"
#endif
*/
#define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1
//#define ENABLE_MAC_PAYLOAD_DEBUG
//#define DEBUG_eNB_SCHEDULER 1
/*TODO NB_mac_phy_remove_ue*/
......@@ -90,8 +90,23 @@ int UE_PCCID_NB_IoT(module_id_t mod_idP,int ue_idP)
return(eNB_mac_inst_NB_IoT[mod_idP].UE_list.pCC_id[ue_idP]);
}
//------------------------------------------------------------------------------
rnti_t UE_RNTI_NB_IoT(module_id_t mod_idP, int ue_idP)
//------------------------------------------------------------------------------
{
rnti_t rnti = eNB_mac_inst_NB_IoT[mod_idP].UE_list.UE_template[UE_PCCID_NB_IoT(mod_idP,ue_idP)][ue_idP].rnti;
if (rnti>0) {
return (rnti);
}
LOG_D(MAC,"[eNB %d] Couldn't find RNTI for UE %d\n",mod_idP,ue_idP);
//display_backtrace();
return(NOT_A_RNTI);
}
//--------------------------------------------------------------------------------------------------------
int rrc_mac_remove_ue_NB_IoT(
module_id_t mod_idP,
rnti_t rntiP)
......
......@@ -29,42 +29,42 @@
*/
#include "assertions.h"
//#include "assertions.h"
//#include "PHY/defs.h"
#include "PHY/extern.h"
//#include "PHY/extern.h"
#include "PHY/extern_NB_IoT.h"
#include "SCHED/defs.h"
#include "SCHED/extern.h"
//#include "SCHED/defs.h"
//#include "SCHED/extern.h"
//#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/proto.h"
#include "LAYER2/MAC/extern.h"
//#include "LAYER2/MAC/proto.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "OCG.h"
#include "OCG_extern.h"
#include "UTIL/OPT/opt.h" // for trace_pdu() function , description is in probe.c
//#include "OCG.h"
//#include "OCG_extern.h"
#include "RRC/LITE/extern.h"
//#include "RRC/LITE/extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
//NB-IoT
#include "PHY/defs_NB_IoT.h"
#include "LAYER2/MAC/defs_NB_IoT.h"
#include "LAYER2/MAC/proto_NB_IoT.h"
#include "LAYER2/MAC/extern_NB_IoT.h"
#include "RRC/LITE/defs_NB_IoT.h"
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
//#include "pdcp.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
//#if defined(ENABLE_ITTI)
//# include "intertask_interface.h"
//#endif
#include "T.h"
#define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1
//#define DEBUG_eNB_SCHEDULER 1
void rx_sdu_NB_IoT(const module_id_t enb_mod_idP,
......@@ -81,7 +81,7 @@ void rx_sdu_NB_IoT(const module_id_t enb_mod_idP,
unsigned char rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr;
unsigned char rx_lcids[NB_RB_MAX];//for NB-IoT, NB_RB_MAX should be fixed to 5 (2 DRB+ 3SRB)
unsigned short rx_lengths[NB_RB_MAX];
int UE_id = find_UE_id(enb_mod_idP,rntiP);
int UE_id = find_UE_id_NB_IoT(enb_mod_idP,rntiP);
int ii,j;
eNB_MAC_INST_NB_IoT *eNB = &eNB_mac_inst_NB_IoT[enb_mod_idP];
UE_list_NB_IoT_t *UE_list= &eNB->UE_list;
......@@ -91,7 +91,7 @@ void rx_sdu_NB_IoT(const module_id_t enb_mod_idP,
start_meas(&eNB->rx_ulsch_sdu);
/*if there is an error for UE_id> max or UE_id==-1, set rx_lengths to 0*/
if ((UE_id > NUMBER_OF_UE_MAX) || (UE_id == -1) )
if ((UE_id > NUMBER_OF_UE_MAX_NB_IoT) || (UE_id == -1) )
for(ii=0; ii<NB_RB_MAX; ii++) {
rx_lengths[ii] = 0;
}
......@@ -117,7 +117,7 @@ void rx_sdu_NB_IoT(const module_id_t enb_mod_idP,
/*RLF procedure this part just check UE context is NULL or not, if not, means UL in synch*/
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync > 0) {
UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync=0;
mac_eNB_rrc_ul_in_sync_NB_IoT(enb_mod_idP,CC_idP,frameP,subframeP,UE_RNTI(enb_mod_idP,UE_id));
mac_eNB_rrc_ul_in_sync_NB_IoT(enb_mod_idP,CC_idP,frameP,subframeP,UE_RNTI_NB_IoT(enb_mod_idP,UE_id));
}
}
......@@ -151,7 +151,7 @@ void rx_sdu_NB_IoT(const module_id_t enb_mod_idP,
break;
case CRNTI:
UE_id = find_UE_id(enb_mod_idP,(((uint16_t)payload_ptr[0])<<8) + payload_ptr[1]);
UE_id = find_UE_id_NB_IoT(enb_mod_idP,(((uint16_t)payload_ptr[0])<<8) + payload_ptr[1]);
LOG_I(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n",
frameP,subframeP,enb_mod_idP, CC_idP, rx_ces[i], i,num_ce,(((uint16_t)payload_ptr[0])<<8) + payload_ptr[1],UE_id);
if (UE_id!=-1) {
......@@ -187,7 +187,7 @@ void rx_sdu_NB_IoT(const module_id_t enb_mod_idP,
// update buffer info
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid]=BSR_TABLE[UE_list->UE_template[CC_idP][UE_id].bsr_info[lcgid]];
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid]=BSR_TABLE_NB_IoT[UE_list->UE_template[CC_idP][UE_id].bsr_info[lcgid]];
UE_list->UE_template[CC_idP][UE_id].ul_total_buffer= UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid];
......@@ -197,7 +197,7 @@ void rx_sdu_NB_IoT(const module_id_t enb_mod_idP,
if (UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[lcgid] == 0 ) {
UE_list->UE_template[CC_idP][UE_id].ul_buffer_creation_time[lcgid]=frameP;
}
if (mac_eNB_get_rrc_status(enb_mod_idP,UE_RNTI(enb_mod_idP,UE_id)) < RRC_CONNECTED)
if (mac_eNB_get_rrc_status(enb_mod_idP,UE_RNTI_NB_IoT(enb_mod_idP,UE_id)) < RRC_CONNECTED_NB_IoT)
LOG_I(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d : ul_total_buffer = %d (lcg increment %d)\n",
enb_mod_idP, CC_idP, rx_ces[i], UE_list->UE_template[CC_idP][UE_id].ul_total_buffer,
UE_list->UE_template[CC_idP][UE_id].ul_buffer_info[lcgid]);
......
......@@ -53,7 +53,7 @@ extern IF_Module_t *if_inst;
extern eNB_MAC_INST_NB_IoT *eNB_mac_inst_NB_IoT;
#endif
// extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE];
extern const uint32_t BSR_TABLE_NB_IoT[BSR_TABLE_SIZE_NB_IoT];
// //extern uint32_t EBSR_Level[63];
// extern const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE];
// //extern uint32_t Extended_BSR_TABLE[63]; ----currently not used
......
......@@ -73,5 +73,6 @@ int mac_top_init_NB_IoT(void);
int find_UE_id_NB_IoT (module_id_t module_idP, rnti_t rnti) ;
int UE_PCCID_NB_IoT (module_id_t module_idP, int UE_id);
rnti_t UE_RNTI_NB_IoT (module_id_t module_idP, int UE_id);
#endif
/*
* 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.0 (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 vars.h
* \brief mac vars
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \version 1.0
* \email navid.nikaein@eurecom.fr
* @ingroup _mac
*/
#ifndef __MAC_VARS_NB_IOT_H__
#define __MAC_VARS_NB_IOT_H__
#ifdef USER_MODE
//#include "stdio.h"
#endif //USER_MODE
//#include "PHY/defs.h"
//#include "defs.h"
#include "defs_NB_IoT.h"
//#include "PHY_INTERFACE/defs.h"
//#include "COMMON/mac_rrc_primitives.h"
// #ifdef NB_IOT
// //NB-IoT
// eNB_MAC_INST_NB_IoT *eNB_mac_inst_NB_IoT;
// IF_Module_t *if_inst;
// #endif
const uint32_t BSR_TABLE[BSR_TABLE_SIZE]= {0,10,12,14,17,19,22,26,31,36,42,49,57,67,78,91,
105,125,146,171,200,234,274,321,376,440,515,603,706,826,967,1132,
1326,1552,1817,2127,2490,2915,3413,3995,4677,5467,6411,7505,8787,10287,12043,14099,
16507,19325,22624,26487,31009,36304,42502,49759,58255,68201,79846,93479,109439, 128125,150000, 300000
};
#endif
......@@ -1472,7 +1472,7 @@ int mac_eNB_get_rrc_status_NB_IoT(
if (ue_context_p != NULL) {
return(ue_context_p->ue_context.Status);
} else {
return RRC_INACTIVE;
return RRC_INACTIVE_NB_IoT;
}
}
......
......@@ -223,14 +223,14 @@ typedef struct uid_linear_allocator_NB_IoT_s {
//left as they are --> used in LAYER2/epenair2_proc.c and UE side
//typedef enum UE_STATE_NB_e {
// RRC_INACTIVE=0,
// RRC_IDLE,
// RRC_SI_RECEIVED,
// RRC_CONNECTED,
// RRC_RECONFIGURED,
// RRC_HO_EXECUTION //maybe not needed?
//} UE_STATE_NB_t;
typedef enum UE_STATE_NB_IoT_e {
RRC_INACTIVE_NB_IoT=0,
RRC_IDLE_NB_IoT,
RRC_SI_RECEIVED_NB_IoT,
RRC_CONNECTED_NB_IoT,
RRC_RECONFIGURED_NB_IoT,
RRC_HO_EXECUTION_NB_IoT //maybe not needed?
} UE_STATE_NB_IoT_t;
// HO_STATE is not supported by NB-IoT
......
......@@ -28,7 +28,7 @@
* \email: navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr
*/
#include "defs_NB_IoT.h"
//#include "defs_NB_IoT.h"
#include "extern.h"
#include "extern_NB_IoT.h"
#include "LAYER2/MAC/extern.h"
......@@ -43,6 +43,7 @@
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "rrc_eNB_UE_context.h"
#include "proto_NB_IoT.h"
#include "RRC/LITE/defs_NB_IoT.h"
#ifdef LOCALIZATION
#include <sys/time.h>
......@@ -71,9 +72,9 @@ rrc_t310_expiration_NB(
//-----------------------------------------------------------------------------
{
if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State != RRC_CONNECTED) {
LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n");
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_IDLE;
if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State != RRC_CONNECTED_NB_IoT) {
LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE_NB_IoT\n");
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_IDLE_NB_IoT;
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].UE_index = 0xffff;
UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Rx_buffer.payload_size = 0;
UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size = 0;
......@@ -371,9 +372,9 @@ rrc_rx_tx_NB_IoT(
LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", ctxt_pP->module_id, ctxt_pP->frame);
}
if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION) &&
if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION_NB_IoT) &&
(UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId != 0xFF)) {
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE;
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE_NB_IoT;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
return(RRC_HO_STARTED);
}
......
......@@ -2316,18 +2316,18 @@ int rrc_eNB_decode_dcch_NB_IoT(
present == RRCConnectionReconfigurationComplete_NB__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r13) {
/*NN: revise the condition */
//MP: RRC_RECONFIGURED indicate if the default/dedicated bearer has been/not established
//MP: RRC_RECONFIGURED_NB_IoT indicate if the default/dedicated bearer has been/not established
if (ue_context_p->ue_context.Status == RRC_RECONFIGURED){ // a dedicated bearers has been established
if (ue_context_p->ue_context.Status == RRC_RECONFIGURED_NB_IoT){ // a dedicated bearers has been established
dedicated_DRB = 1;
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED_NB_IoT (dedicated DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg_NB->message.choice.c1.choice.rrcConnectionReconfigurationComplete_r13.rrc_TransactionIdentifier);
}else { //a default bearer has been established
dedicated_DRB = 0;
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
ue_context_p->ue_context.Status = RRC_RECONFIGURED_NB_IoT;
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED_NB_IoT (default DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg_NB->message.choice.c1.choice.rrcConnectionReconfigurationComplete_r13.rrc_TransactionIdentifier);
}
rrc_eNB_process_RRCConnectionReconfigurationComplete_NB_IoT(
......@@ -2439,9 +2439,9 @@ int rrc_eNB_decode_dcch_NB_IoT(
&ul_dcch_msg_NB->message.choice.c1.choice.rrcConnectionSetupComplete_r13.criticalExtensions.choice.rrcConnectionSetupComplete_r13);
//set Ue status CONNECTED
ue_context_p->ue_context.Status = RRC_CONNECTED;
ue_context_p->ue_context.Status = RRC_CONNECTED_NB_IoT;
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n",
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED_NB_IoT \n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
#if defined(FLEXRAN_AGENT_SB_IF)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment