Merge remote-tracking branch 'origin/develop' into ru_rau_enhancement
This commit is contained in:
@@ -40,3 +40,5 @@ MESSAGE_DEF(RRC_MAC_CCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacCcchDat
|
||||
|
||||
MESSAGE_DEF(RRC_MAC_MCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacMcchDataReq, rrc_mac_mcch_data_req)
|
||||
MESSAGE_DEF(RRC_MAC_MCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacMcchDataInd, rrc_mac_mcch_data_ind)
|
||||
|
||||
MESSAGE_DEF(RRC_MAC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacPcchDataReq, rrc_mac_pcch_data_req)
|
||||
|
||||
@@ -43,11 +43,13 @@
|
||||
|
||||
#define RRC_MAC_MCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_mcch_data_req
|
||||
#define RRC_MAC_MCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_mcch_data_ind
|
||||
#define RRC_MAC_PCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_pcch_data_req
|
||||
|
||||
// Some constants from "LAYER2/MAC/defs.h"
|
||||
#define BCCH_SDU_SIZE (512)
|
||||
#define CCCH_SDU_SIZE (512)
|
||||
#define MCCH_SDU_SIZE (512)
|
||||
#define PCCH_SDU_SIZE (512)
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// Messages between RRC and MAC layers
|
||||
@@ -114,4 +116,10 @@ typedef struct RrcMacMcchDataInd_s {
|
||||
uint8_t mbsfn_sync_area;
|
||||
} RrcMacMcchDataInd;
|
||||
|
||||
typedef struct RrcMacPcchDataReq_s {
|
||||
uint32_t frame;
|
||||
uint32_t sdu_size;
|
||||
uint8_t sdu[PCCH_SDU_SIZE];
|
||||
uint8_t enb_index;
|
||||
} RrcMacPcchDataReq;
|
||||
#endif /* MAC_MESSAGES_TYPES_H_ */
|
||||
|
||||
@@ -244,9 +244,7 @@ typedef struct {
|
||||
LCHAN_DESC Lchan_desc[2]; /*!< \brief Logical Channel QoS Descriptor (MAC component) */
|
||||
uint8_t L3_info_type;
|
||||
uint8_t L3_info[16];
|
||||
//#ifndef CELLULAR
|
||||
unsigned short UE_eNB_index;
|
||||
//#endif
|
||||
} __attribute__ ((__packed__)) MAC_CONFIG_REQ;
|
||||
#define MAC_CONFIG_REQ_SIZE sizeof(MAC_CONFIG_REQ)
|
||||
|
||||
@@ -314,18 +312,12 @@ typedef struct {
|
||||
|
||||
#ifndef OPENAIR2_IN
|
||||
|
||||
#ifndef CELLULAR
|
||||
//#include "L3_rrc_defs.h"
|
||||
#endif
|
||||
|
||||
typedef struct { //RRC_INTERFACE_FUNCTIONS
|
||||
unsigned int Frame_index;
|
||||
unsigned short UE_index[NB_MODULES_MAX][NB_SIG_CNX_UE];
|
||||
uint8_t eNB_id[NB_MODULES_MAX][NB_CNX_UE];
|
||||
#ifndef CELLULAR
|
||||
// L2_ID UE_id[NB_MODULES_MAX][NB_CNX_CH];
|
||||
uint8_t UE_id[NB_MODULES_MAX][NB_CNX_CH][5];
|
||||
#endif
|
||||
void (*openair_rrc_top_init)(void);
|
||||
char (*openair_rrc_eNB_init)(uint8_t );
|
||||
char (*openair_rrc_UE_init)(uint8_t, uint8_t);
|
||||
|
||||
@@ -22,12 +22,6 @@
|
||||
#ifndef __openair_DEFS_H__
|
||||
#define __openair_DEFS_H__
|
||||
|
||||
#ifndef USER_MODE
|
||||
#include <linux/kernel.h>
|
||||
#endif //USER_MODE
|
||||
|
||||
|
||||
#ifdef USER_MODE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if !defined (msg)
|
||||
@@ -49,44 +43,7 @@
|
||||
#define PAGE_MASK 0xfffff000
|
||||
#define virt_to_phys(x) (x)
|
||||
|
||||
#else // USER_MODE
|
||||
#include <rtai.h>
|
||||
#define msg rt_printk
|
||||
|
||||
#ifdef BIGPHYSAREA
|
||||
|
||||
#define bigmalloc(x) (bigphys_malloc(x))
|
||||
#define bigmalloc16(x) (bigphys_malloc(x))
|
||||
|
||||
#define malloc16(x) (bigphys_malloc(x))
|
||||
#define free16(y,x)
|
||||
|
||||
#define bigfree(y,x)
|
||||
|
||||
#else // BIGPHYSAREA
|
||||
|
||||
#define bigmalloc(x) (dma_alloc_coherent(pdev[0],(x),&dummy_dma_ptr,0))
|
||||
#define bigmalloc16(x) (dma_alloc_coherent(pdev[0],(x),&dummy_dma_ptr,0))
|
||||
#define bigfree(y,x) (dma_free_coherent(pdev[0],(x),(void *)(y),dummy_dma_ptr))
|
||||
#define malloc16(x) (kmalloc(x,GFP_KERNEL))
|
||||
#define free16(y,x) (kfree(y))
|
||||
|
||||
#endif // BIGPHYSAREA
|
||||
|
||||
|
||||
#ifdef CBMIMO1
|
||||
#define openair_get_mbox() (*(unsigned int *)mbox)
|
||||
#else //CBMIMO1
|
||||
#define openair_get_mbox() (*(unsigned int *)PHY_vars->mbox>>1)
|
||||
#endif //CBMIMO1
|
||||
|
||||
|
||||
#endif // USERMODE
|
||||
|
||||
// #define bzero(s,n) (memset((s),0,(n)))
|
||||
|
||||
#define cmax(a,b) ((a>b) ? (a) : (b))
|
||||
#define cmin(a,b) ((a<b) ? (a) : (b))
|
||||
#endif // /*__openair_DEFS_H__ */
|
||||
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __openair_TYPES_H__
|
||||
#define __openair_TYPES_H__
|
||||
|
||||
//#ifdef USER_MODE
|
||||
//#include <stdint.h>
|
||||
//typedef int8_t s8; /* 8 bit signed integer */
|
||||
//typedef int16_t s16; /* 16 bit signed integer */
|
||||
//typedef int32_t s32; /* 32 bit signed integer */
|
||||
//typedef int64_t s64; /* 64 bit signed integer */
|
||||
|
||||
//typedef uint8_t u8; /* 8 bit unsigned integer */
|
||||
//typedef uint16_t u16; /* 16 bit unsigned integer */
|
||||
//typedef uint32_t u32; /* 32 bit unsigned integer */
|
||||
//typedef uint64_t u64; /* 64 bit unsigned integer */
|
||||
//#else
|
||||
//#include <linux/types.h>
|
||||
//#endif
|
||||
#endif /*__openair_TYPES_H__ */
|
||||
@@ -30,3 +30,4 @@
|
||||
// Messages between RRC and PDCP layers
|
||||
MESSAGE_DEF(RRC_DCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcDcchDataReq, rrc_dcch_data_req)
|
||||
MESSAGE_DEF(RRC_DCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcDcchDataInd, rrc_dcch_data_ind)
|
||||
MESSAGE_DEF(RRC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcPcchDataReq, rrc_pcch_data_req)
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
// Defines to access message fields.
|
||||
#define RRC_DCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_dcch_data_req
|
||||
#define RRC_DCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.rrc_dcch_data_ind
|
||||
#define RRC_PCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_pcch_data_req
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// Messages between RRC and PDCP layers
|
||||
@@ -60,4 +61,13 @@ typedef struct RrcDcchDataInd_s {
|
||||
uint8_t eNB_index; // LG: needed in UE
|
||||
} RrcDcchDataInd;
|
||||
|
||||
typedef struct RrcPcchDataReq_s {
|
||||
uint32_t sdu_size;
|
||||
uint8_t *sdu_p;
|
||||
uint8_t mode;
|
||||
uint16_t rnti;
|
||||
uint8_t ue_index;
|
||||
uint8_t CC_id;
|
||||
} RrcPcchDataReq;
|
||||
|
||||
#endif /* PDCP_MESSAGES_TYPES_H_ */
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#define NL_MAX_PAYLOAD 9000 /* this should cover the max mtu size*/
|
||||
#endif
|
||||
|
||||
#ifdef USER_MODE
|
||||
#ifdef LARGE_SCALE
|
||||
# define NB_MODULES_MAX 128
|
||||
# define NB_NODE_MAX 128
|
||||
@@ -51,11 +50,6 @@
|
||||
# define NB_MODULES_MAX 32
|
||||
# define NB_NODE_MAX 32
|
||||
#endif
|
||||
#else
|
||||
# define NB_MODULES_MAX 1
|
||||
# define NB_NODE_MAX 1
|
||||
#endif //PHY_EMUL
|
||||
|
||||
|
||||
#ifdef JUMBO_FRAME
|
||||
# define MAX_IP_PACKET_SIZE 10000 // 9000
|
||||
@@ -132,9 +126,7 @@
|
||||
#define UNUSED_PARAM_MBMS_SESSION_ID 0
|
||||
#define UNUSED_PARAM_MBMS_SERVICE_ID 0
|
||||
|
||||
#ifdef USER_MODE
|
||||
#define printk printf
|
||||
#endif
|
||||
|
||||
#define UNUSED_VARIABLE(vARIABLE) (void)(vARIABLE)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifndef __PLATFORM_TYPES_H__
|
||||
# define __PLATFORM_TYPES_H__
|
||||
|
||||
#ifdef USER_MODE
|
||||
#if !defined(NAS_NETLINK)
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
@@ -69,6 +69,7 @@ typedef uint32_t frame_t;
|
||||
typedef int32_t sframe_t;
|
||||
typedef uint32_t sub_frame_t;
|
||||
typedef uint8_t module_id_t;
|
||||
typedef uint8_t slice_id_t;
|
||||
typedef uint8_t eNB_index_t;
|
||||
typedef uint16_t ue_id_t;
|
||||
typedef int16_t smodule_id_t;
|
||||
@@ -99,6 +100,15 @@ typedef enum rb_type_e {
|
||||
RADIO_ACCESS_BEARER = 2
|
||||
} rb_type_t;
|
||||
|
||||
typedef enum {
|
||||
CR_ROUND = 0,
|
||||
CR_SRB12 = 1,
|
||||
CR_HOL = 2,
|
||||
CR_LC = 3,
|
||||
CR_CQI = 4,
|
||||
CR_NUM = 5
|
||||
} sorting_criterion_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// PHY TYPES
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -271,29 +281,5 @@ typedef struct protocol_ctxt_s {
|
||||
(CTXT_Pp)->module_id, \
|
||||
(CTXT_Pp)->rnti
|
||||
|
||||
#ifdef OAI_EMU
|
||||
#define CHECK_CTXT_ARGS(CTXT_Pp) \
|
||||
if ((CTXT_Pp)->enb_flag) {\
|
||||
AssertFatal (((CTXT_Pp)->module_id >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),\
|
||||
"eNB module id is too low (%u/%d/%d)!\n",\
|
||||
(CTXT_Pp)->module_id,\
|
||||
oai_emulation.info.first_enb_local,\
|
||||
oai_emulation.info.nb_enb_local);\
|
||||
AssertFatal (((CTXT_Pp)->module_id < (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",\
|
||||
(CTXT_Pp)->module_id,\
|
||||
oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);\
|
||||
} else {\
|
||||
AssertFatal ((CTXT_Pp)->module_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),\
|
||||
"UE module id is too high (%u/%d)!\n",\
|
||||
(CTXT_Pp)->module_id,\
|
||||
oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);\
|
||||
AssertFatal ((CTXT_Pp)->module_id >= oai_emulation.info.first_ue_local,\
|
||||
"UE module id is too low (%u/%d)!\n",\
|
||||
(CTXT_Pp)->module_id,\
|
||||
oai_emulation.info.first_ue_local);\
|
||||
}
|
||||
#else
|
||||
#define CHECK_CTXT_ARGS(CTXT_Pp)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -20,45 +20,13 @@
|
||||
*/
|
||||
|
||||
#ifndef _RTOS_HEADER_H_
|
||||
# define _RTOS_HEADER_H_
|
||||
# if defined(RTAI) && !defined(USER_MODE)
|
||||
// CONVERSION BETWEEN POSIX PTHREAD AND RTAI FUNCTIONS
|
||||
/*
|
||||
# define pthread_mutex_init pthread_mutex_init_rt
|
||||
# define pthread_mutexattr_init pthread_mutexattr_init_rt
|
||||
# define pthread_mutex_lock pthread_mutex_lock_rt
|
||||
# define pthread_mutex_unlock pthread_mutex_unlock_rt
|
||||
# define pthread_mutex_destroy pthread_mutex_destroy_rt
|
||||
# define pthread_cond_init pthread_cond_init_rt
|
||||
# define pthread_cond_wait pthread_cond_wait_rt
|
||||
# define pthread_cond_signal pthread_cond_signal_rt
|
||||
# define pthread_cond_destroy pthread_cond_destroy_rt
|
||||
# define pthread_attr_init pthread_attr_init_rt
|
||||
# define pthread_attr_setschedparam pthread_attr_setschedparam_rt
|
||||
# define pthread_create pthread_create_rt
|
||||
# define pthread_cancel pthread_cancel_rt
|
||||
# define pthread_delete_np pthread_cancel_rt
|
||||
# define pthread_attr_setstacksize pthread_attr_setstacksize_rt
|
||||
# define pthread_self rt_whoami
|
||||
*/
|
||||
# include <asm/rtai.h>
|
||||
# include <rtai.h>
|
||||
# include <rtai_posix.h>
|
||||
# include <rtai_fifos.h>
|
||||
# include <rtai_sched.h>
|
||||
# ifdef CONFIG_PROC_FS
|
||||
# include <rtai_proc_fs.h>
|
||||
# endif
|
||||
# else
|
||||
# ifdef USER_MODE
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <math.h>
|
||||
# include <pthread.h>
|
||||
# include <assert.h>
|
||||
# define rtf_get read
|
||||
# define rtf_put write
|
||||
# endif
|
||||
# endif
|
||||
#define _RTOS_HEADER_H_
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <pthread.h>
|
||||
#include <assert.h>
|
||||
#define rtf_get read
|
||||
#define rtf_put write
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,11 @@ MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG, MESSAGE_PRIORITY_MED, IttiMsgT
|
||||
MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_log)
|
||||
MESSAGE_DEF(S1AP_E_RAB_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_setup_request_log)
|
||||
MESSAGE_DEF(S1AP_E_RAB_SETUP_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_setup_response_log)
|
||||
MESSAGE_DEF(S1AP_E_RAB_MODIFY_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_modify_request_log)
|
||||
MESSAGE_DEF(S1AP_E_RAB_MODIFY_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_modify_response_log)
|
||||
MESSAGE_DEF(S1AP_PAGING_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_paging_log)
|
||||
MESSAGE_DEF(S1AP_E_RAB_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_release_request_log)
|
||||
MESSAGE_DEF(S1AP_E_RAB_RELEASE_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_release_response_log)
|
||||
|
||||
/* eNB application layer -> S1AP messages */
|
||||
MESSAGE_DEF(S1AP_REGISTER_ENB_REQ , MESSAGE_PRIORITY_MED, s1ap_register_enb_req_t , s1ap_register_enb_req)
|
||||
@@ -54,6 +59,8 @@ MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_RESP , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_
|
||||
MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_FAIL , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_fail_t , s1ap_ue_ctxt_modification_fail)
|
||||
MESSAGE_DEF(S1AP_E_RAB_SETUP_RESP , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_resp_t , s1ap_e_rab_setup_resp)
|
||||
MESSAGE_DEF(S1AP_E_RAB_SETUP_REQUEST_FAIL , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_req_fail_t , s1ap_e_rab_setup_request_fail)
|
||||
MESSAGE_DEF(S1AP_E_RAB_MODIFY_RESP , MESSAGE_PRIORITY_MED, s1ap_e_rab_modify_resp_t , s1ap_e_rab_modify_resp)
|
||||
MESSAGE_DEF(S1AP_E_RAB_RELEASE_RESPONSE , MESSAGE_PRIORITY_MED, s1ap_e_rab_release_resp_t , s1ap_e_rab_release_resp)
|
||||
|
||||
/* S1AP -> RRC messages */
|
||||
MESSAGE_DEF(S1AP_DOWNLINK_NAS , MESSAGE_PRIORITY_MED, s1ap_downlink_nas_t , s1ap_downlink_nas )
|
||||
@@ -61,6 +68,8 @@ MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, s1ap_initial_
|
||||
MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_REQ , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_req_t , s1ap_ue_ctxt_modification_req)
|
||||
MESSAGE_DEF(S1AP_PAGING_IND , MESSAGE_PRIORITY_MED, s1ap_paging_ind_t , s1ap_paging_ind )
|
||||
MESSAGE_DEF(S1AP_E_RAB_SETUP_REQ , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_req_t , s1ap_e_rab_setup_req )
|
||||
MESSAGE_DEF(S1AP_E_RAB_MODIFY_REQ , MESSAGE_PRIORITY_MED, s1ap_e_rab_modify_req_t , s1ap_e_rab_modify_req )
|
||||
MESSAGE_DEF(S1AP_E_RAB_RELEASE_COMMAND , MESSAGE_PRIORITY_MED, s1ap_e_rab_release_command_t , s1ap_e_rab_release_command)
|
||||
MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMMAND, MESSAGE_PRIORITY_MED, s1ap_ue_release_command_t , s1ap_ue_release_command)
|
||||
|
||||
/* S1AP <-> RRC messages (can be initiated either by MME or eNB) */
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#define S1AP_UE_CTXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_ctxt_modification_fail
|
||||
#define S1AP_E_RAB_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_setup_resp
|
||||
#define S1AP_E_RAB_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_setup_req_fail
|
||||
#define S1AP_E_RAB_MODIFY_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_modify_resp
|
||||
|
||||
#define S1AP_DOWNLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.s1ap_downlink_nas
|
||||
#define S1AP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_initial_context_setup_req
|
||||
@@ -48,9 +49,12 @@
|
||||
#define S1AP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_command
|
||||
#define S1AP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_complete
|
||||
#define S1AP_E_RAB_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_setup_req
|
||||
#define S1AP_PAGIND_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_paging_ind
|
||||
#define S1AP_E_RAB_MODIFY_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_modify_req
|
||||
#define S1AP_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_paging_ind
|
||||
|
||||
#define S1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_req
|
||||
#define S1AP_E_RAB_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_release_command
|
||||
#define S1AP_E_RAB_RELEASE_RESPONSE(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_release_resp
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
/* Maximum number of e-rabs to be setup/deleted in a single message.
|
||||
@@ -175,6 +179,11 @@ typedef struct s1ap_gummei_s {
|
||||
uint16_t mme_group_id;
|
||||
} s1ap_gummei_t;
|
||||
|
||||
typedef struct s1ap_imsi_s {
|
||||
uint8_t buffer[S1AP_IMSI_LENGTH];
|
||||
uint8_t length;
|
||||
} s1ap_imsi_t;
|
||||
|
||||
typedef struct s_tmsi_s {
|
||||
uint8_t mme_code;
|
||||
uint32_t m_tmsi;
|
||||
@@ -189,7 +198,7 @@ typedef enum ue_paging_identity_presenceMask_e {
|
||||
typedef struct ue_paging_identity_s {
|
||||
ue_paging_identity_presenceMask_t presenceMask;
|
||||
union {
|
||||
char imsi[S1AP_IMSI_LENGTH];
|
||||
s1ap_imsi_t imsi;
|
||||
s_tmsi_t s_tmsi;
|
||||
} choice;
|
||||
} ue_paging_identity_t;
|
||||
@@ -260,11 +269,29 @@ typedef struct e_rab_setup_s {
|
||||
uint32_t gtp_teid;
|
||||
} e_rab_setup_t;
|
||||
|
||||
typedef struct e_rab_modify_s {
|
||||
/* Unique e_rab_id for the UE. */
|
||||
uint8_t e_rab_id;
|
||||
} e_rab_modify_t;
|
||||
|
||||
typedef enum S1ap_Cause_e {
|
||||
S1AP_CAUSE_NOTHING, /* No components present */
|
||||
S1AP_CAUSE_RADIO_NETWORK,
|
||||
S1AP_CAUSE_TRANSPORT,
|
||||
S1AP_CAUSE_NAS,
|
||||
S1AP_CAUSE_PROTOCOL,
|
||||
S1AP_CAUSE_MISC,
|
||||
/* Extensions may appear below */
|
||||
|
||||
} s1ap_Cause_t;
|
||||
|
||||
typedef struct e_rab_failed_s {
|
||||
/* Unique e_rab_id for the UE. */
|
||||
uint8_t e_rab_id;
|
||||
/* Cause of the failure */
|
||||
// cause_t cause;
|
||||
s1ap_Cause_t cause;
|
||||
uint8_t cause_value;
|
||||
} e_rab_failed_t;
|
||||
|
||||
typedef enum s1ap_ue_ctxt_modification_present_s {
|
||||
@@ -460,6 +487,12 @@ typedef struct s1ap_initial_context_setup_req_s {
|
||||
e_rab_t e_rab_param[S1AP_MAX_E_RAB];
|
||||
} s1ap_initial_context_setup_req_t;
|
||||
|
||||
typedef struct tai_plmn_identity_s {
|
||||
uint16_t mcc;
|
||||
uint16_t mnc;
|
||||
uint8_t mnc_digit_length;
|
||||
} plmn_identity_t;
|
||||
|
||||
typedef struct s1ap_paging_ind_s {
|
||||
/* UE identity index value.
|
||||
* Specified in 3GPP TS 36.304
|
||||
@@ -472,6 +505,15 @@ typedef struct s1ap_paging_ind_s {
|
||||
/* Indicates origin of paging */
|
||||
cn_domain_t cn_domain;
|
||||
|
||||
/* PLMN_identity in TAI of Paging*/
|
||||
plmn_identity_t plmn_identity[256];
|
||||
|
||||
/* TAC in TAIList of Paging*/
|
||||
int16_t tac[256];
|
||||
|
||||
/* size of TAIList*/
|
||||
int16_t tai_size;
|
||||
|
||||
/* Optional fields */
|
||||
paging_drx_t paging_drx;
|
||||
|
||||
@@ -520,16 +562,6 @@ typedef struct s1ap_ue_release_command_s {
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
typedef enum S1ap_Cause_e {
|
||||
S1AP_CAUSE_NOTHING, /* No components present */
|
||||
S1AP_CAUSE_RADIO_NETWORK,
|
||||
S1AP_CAUSE_TRANSPORT,
|
||||
S1AP_CAUSE_NAS,
|
||||
S1AP_CAUSE_PROTOCOL,
|
||||
S1AP_CAUSE_MISC,
|
||||
/* Extensions may appear below */
|
||||
|
||||
} s1ap_Cause_t;
|
||||
// S1AP <-- RRC messages
|
||||
typedef struct s1ap_ue_release_req_s {
|
||||
unsigned eNB_ue_s1ap_id:24;
|
||||
@@ -537,4 +569,78 @@ typedef struct s1ap_ue_release_req_s {
|
||||
long cause_value;
|
||||
} s1ap_ue_release_req_t, s1ap_ue_release_resp_t;
|
||||
|
||||
typedef struct s1ap_e_rab_modify_req_s {
|
||||
/* UE id for initial connection to S1AP */
|
||||
uint16_t ue_initial_id;
|
||||
|
||||
/* MME UE id */
|
||||
uint16_t mme_ue_s1ap_id;
|
||||
|
||||
/* eNB ue s1ap id as initialized by S1AP layer */
|
||||
unsigned eNB_ue_s1ap_id:24;
|
||||
|
||||
/* Number of e_rab to be modify in the list */
|
||||
uint8_t nb_e_rabs_tomodify;
|
||||
|
||||
/* E RAB modify request */
|
||||
e_rab_t e_rab_modify_params[S1AP_MAX_E_RAB];
|
||||
} s1ap_e_rab_modify_req_t;
|
||||
|
||||
typedef struct s1ap_e_rab_modify_resp_s {
|
||||
unsigned eNB_ue_s1ap_id:24;
|
||||
|
||||
/* Number of e_rab modify-ed in the list */
|
||||
uint8_t nb_of_e_rabs;
|
||||
/* list of e_rab modify-ed by RRC layers */
|
||||
e_rab_modify_t e_rabs[S1AP_MAX_E_RAB];
|
||||
|
||||
/* Number of e_rab failed to be modify in list */
|
||||
uint8_t nb_of_e_rabs_failed;
|
||||
/* list of e_rabs that failed to be modify */
|
||||
e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB];
|
||||
} s1ap_e_rab_modify_resp_t;
|
||||
|
||||
typedef struct e_rab_release_s {
|
||||
/* Unique e_rab_id for the UE. */
|
||||
uint8_t e_rab_id;
|
||||
} e_rab_release_t;
|
||||
|
||||
typedef struct s1ap_e_rab_release_command_s {
|
||||
/* MME UE id */
|
||||
uint16_t mme_ue_s1ap_id;
|
||||
|
||||
/* eNB ue s1ap id as initialized by S1AP layer */
|
||||
unsigned eNB_ue_s1ap_id:24;
|
||||
|
||||
/* The NAS PDU should be forwarded by the RRC layer to the NAS layer */
|
||||
nas_pdu_t nas_pdu;
|
||||
|
||||
/* Number of e_rab to be released in the list */
|
||||
uint8_t nb_e_rabs_torelease;
|
||||
|
||||
/* E RAB release command */
|
||||
e_rab_release_t e_rab_release_params[S1AP_MAX_E_RAB];
|
||||
|
||||
} s1ap_e_rab_release_command_t;
|
||||
|
||||
typedef struct s1ap_e_rab_release_resp_s {
|
||||
/* MME UE id */
|
||||
uint16_t mme_ue_s1ap_id;
|
||||
|
||||
/* eNB ue s1ap id as initialized by S1AP layer */
|
||||
unsigned eNB_ue_s1ap_id:24;
|
||||
|
||||
/* Number of e_rab released in the list */
|
||||
uint8_t nb_of_e_rabs_released;
|
||||
|
||||
/* list of e_rabs released */
|
||||
e_rab_release_t e_rab_release[S1AP_MAX_E_RAB];
|
||||
|
||||
/* Number of e_rab failed to be released in list */
|
||||
uint8_t nb_of_e_rabs_failed;
|
||||
/* list of e_rabs that failed to be released */
|
||||
e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB];
|
||||
|
||||
} s1ap_e_rab_release_resp_t;
|
||||
|
||||
#endif /* S1AP_MESSAGES_TYPES_H_ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -37,50 +37,10 @@
|
||||
#include "flexran_agent_common.h"
|
||||
#include "flexran_agent_extern.h"
|
||||
|
||||
/* These types will be used to give
|
||||
instructions for the type of stats reports
|
||||
we need to create */
|
||||
typedef struct {
|
||||
uint16_t ue_rnti;
|
||||
uint32_t ue_report_flags; /* Indicates the report elements
|
||||
required for this UE id. See
|
||||
FlexRAN specification 1.2.4.2 */
|
||||
} ue_report_type_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t cc_id;
|
||||
uint32_t cc_report_flags; /* Indicates the report elements
|
||||
required for this CC index. See
|
||||
FlexRAN specification 1.2.4.3 */
|
||||
} cc_report_type_t;
|
||||
|
||||
typedef struct {
|
||||
int nr_ue;
|
||||
ue_report_type_t *ue_report_type;
|
||||
int nr_cc;
|
||||
cc_report_type_t *cc_report_type;
|
||||
} report_config_t;
|
||||
|
||||
typedef struct stats_request_config_s{
|
||||
uint8_t report_type;
|
||||
uint8_t report_frequency;
|
||||
uint16_t period; /*In number of subframes*/
|
||||
report_config_t *config;
|
||||
} stats_request_config_t;
|
||||
|
||||
/* Initialization function for the agent structures etc */
|
||||
void flexran_agent_init_mac_agent(mid_t mod_id);
|
||||
|
||||
int flexran_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
|
||||
|
||||
/* Statistics request protocol message constructor and destructor */
|
||||
int flexran_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg);
|
||||
int flexran_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg);
|
||||
|
||||
/* Statistics reply protocol message constructor and destructor */
|
||||
int flexran_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg);
|
||||
int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg);
|
||||
|
||||
/* Scheduling request information protocol message constructor and estructor */
|
||||
int flexran_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
|
||||
int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg);
|
||||
@@ -89,10 +49,18 @@ int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg);
|
||||
int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
|
||||
int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg);
|
||||
|
||||
/* Statistics reply protocol message constructor and destructor */
|
||||
int flexran_agent_mac_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report);
|
||||
int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg);
|
||||
|
||||
/* DL MAC scheduling decision protocol message constructor (empty command) and destructor */
|
||||
int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg);
|
||||
int flexran_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg);
|
||||
|
||||
/* UL MAC scheduling decision protocol message constructor (empty command) and destructor */
|
||||
int flexran_agent_mac_create_empty_ul_config(mid_t mod_id, Protocol__FlexranMessage **msg);
|
||||
int flexran_agent_mac_destroy_ul_config(Protocol__FlexranMessage *msg);
|
||||
|
||||
int flexran_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
|
||||
|
||||
|
||||
|
||||
@@ -48,26 +48,20 @@ typedef struct {
|
||||
|
||||
/// Send to the controller all the mac stat updates that occured during this subframe
|
||||
/// based on the stats request configuration
|
||||
void (*flexran_agent_send_update_mac_stats)(mid_t mod_id);
|
||||
// void (*flexran_agent_send_update_mac_stats)(mid_t mod_id);
|
||||
|
||||
/// Provide to the scheduler a pending dl_mac_config message
|
||||
void (*flexran_agent_get_pending_dl_mac_config)(mid_t mod_id,
|
||||
Protocol__FlexranMessage **msg);
|
||||
|
||||
/// Run the UE DL scheduler and fill the Protocol__FlexranMessage. Assumes that
|
||||
/// dl_info is already initialized as flex_dl_mac_config and fills the
|
||||
/// flex_dl_data part of it
|
||||
void (*flexran_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe,
|
||||
int *mbsfn_flag, Protocol__FlexranMessage **dl_info);
|
||||
|
||||
|
||||
/// Notify the controller for a state change of a particular UE, by sending the proper
|
||||
/// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER)
|
||||
int (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti,
|
||||
uint8_t state_change);
|
||||
// int (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti,
|
||||
// uint8_t state_change);
|
||||
|
||||
|
||||
void *dl_scheduler_loaded_lib;
|
||||
void *ul_scheduler_loaded_lib;
|
||||
/*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/
|
||||
|
||||
} AGENT_MAC_xface;
|
||||
|
||||
@@ -101,7 +101,7 @@ Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol
|
||||
if (n_cell_report > 0 || n_ue_report > 0) {
|
||||
/*Create header*/
|
||||
int xid = old_report->header->xid;
|
||||
Protocol__FlexHeader *header;
|
||||
Protocol__FlexHeader *header = NULL;
|
||||
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) {
|
||||
goto error;
|
||||
}
|
||||
@@ -180,10 +180,12 @@ Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport *
|
||||
}
|
||||
}
|
||||
|
||||
if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) {
|
||||
copy->has_phr = original->has_phr;
|
||||
copy->phr = original->phr;
|
||||
}
|
||||
|
||||
|
||||
if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR) {
|
||||
copy->has_phr = original->has_phr;
|
||||
copy->phr = original->phr;
|
||||
}
|
||||
|
||||
if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) {
|
||||
copy->n_rlc_report = original->n_rlc_report;
|
||||
@@ -605,7 +607,10 @@ int parse_mac_config(mid_t mod_id, yaml_parser_t *parser) {
|
||||
} else if (strcmp((char *) event.data.scalar.value, "ul_scheduler") == 0) {
|
||||
// Call the proper handler
|
||||
LOG_D(ENB_APP, "This is for the ul_scheduler subsystem\n");
|
||||
goto error;
|
||||
if (parse_ul_scheduler_config(mod_id, parser) == -1) {
|
||||
LOG_D(ENB_APP, "An error occured\n");
|
||||
goto error;
|
||||
}
|
||||
// TODO
|
||||
} else if (strcmp((char *) event.data.scalar.value, "ra_scheduler") == 0) {
|
||||
// Call the proper handler
|
||||
@@ -698,6 +703,56 @@ int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int parse_ul_scheduler_config(mid_t mod_id, yaml_parser_t *parser) {
|
||||
|
||||
yaml_event_t event;
|
||||
|
||||
int done = 0;
|
||||
int mapping_started = 0;
|
||||
|
||||
while (!done) {
|
||||
|
||||
if (!yaml_parser_parse(parser, &event))
|
||||
goto error;
|
||||
|
||||
switch (event.type) {
|
||||
// We are expecting a mapping (behavior and parameters)
|
||||
case YAML_MAPPING_START_EVENT:
|
||||
LOG_D(ENB_APP, "The mapping of the subsystem started\n");
|
||||
mapping_started = 1;
|
||||
break;
|
||||
case YAML_MAPPING_END_EVENT:
|
||||
LOG_D(ENB_APP, "The mapping of the subsystem ended\n");
|
||||
mapping_started = 0;
|
||||
break;
|
||||
case YAML_SCALAR_EVENT:
|
||||
if (!mapping_started) {
|
||||
goto error;
|
||||
}
|
||||
// Check what key needs to be set
|
||||
if (strcmp((char *) event.data.scalar.value, "parameters") == 0) {
|
||||
LOG_D(ENB_APP, "Now it is time to set the parameters for this subsystem\n");
|
||||
if (parse_ul_scheduler_parameters(mod_id, parser) == -1) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
}
|
||||
|
||||
done = (event.type == YAML_MAPPING_END_EVENT);
|
||||
yaml_event_delete(&event);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
yaml_event_delete(&event);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) {
|
||||
yaml_event_t event;
|
||||
|
||||
@@ -753,13 +808,68 @@ int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int parse_ul_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) {
|
||||
yaml_event_t event;
|
||||
|
||||
void *param;
|
||||
|
||||
int done = 0;
|
||||
int mapping_started = 0;
|
||||
|
||||
while (!done) {
|
||||
|
||||
if (!yaml_parser_parse(parser, &event))
|
||||
goto error;
|
||||
|
||||
switch (event.type) {
|
||||
// We are expecting a mapping of parameters
|
||||
case YAML_MAPPING_START_EVENT:
|
||||
LOG_D(ENB_APP, "The mapping of the parameters started\n");
|
||||
mapping_started = 1;
|
||||
break;
|
||||
case YAML_MAPPING_END_EVENT:
|
||||
LOG_D(ENB_APP, "The mapping of the parameters ended\n");
|
||||
mapping_started = 0;
|
||||
break;
|
||||
case YAML_SCALAR_EVENT:
|
||||
if (!mapping_started) {
|
||||
goto error;
|
||||
}
|
||||
// Check what key needs to be set
|
||||
if (mac_agent_registered[mod_id]) {
|
||||
LOG_D(ENB_APP, "Setting parameter %s\n", event.data.scalar.value);
|
||||
param = dlsym(agent_mac_xface[mod_id]->ul_scheduler_loaded_lib,
|
||||
(char *) event.data.scalar.value);
|
||||
if (param == NULL) {
|
||||
goto error;
|
||||
}
|
||||
apply_parameter_modification(param, parser);
|
||||
} else {
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
}
|
||||
|
||||
done = (event.type == YAML_MAPPING_END_EVENT);
|
||||
yaml_event_delete(&event);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
yaml_event_delete(&event);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int load_dl_scheduler_function(mid_t mod_id, const char *function_name) {
|
||||
void *lib;
|
||||
|
||||
char lib_name[120];
|
||||
char target[512];
|
||||
snprintf(lib_name, sizeof(lib_name), "/%s.so", function_name);
|
||||
strcpy(target, local_cache);
|
||||
strcpy(target, RC.flexran[mod_id]->cache_name);
|
||||
strcat(target, lib_name);
|
||||
|
||||
LOG_I(FLEXRAN_AGENT, "Opening pushed code: %s\n", target);
|
||||
@@ -773,7 +883,6 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) {
|
||||
void *loaded_scheduler = dlsym(lib, function_name);
|
||||
if (loaded_scheduler) {
|
||||
if (mac_agent_registered[mod_id]) {
|
||||
agent_mac_xface[mod_id]->flexran_agent_schedule_ue_spec = loaded_scheduler;
|
||||
if (agent_mac_xface[mod_id]->dl_scheduler_loaded_lib != NULL) {
|
||||
dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib);
|
||||
}
|
||||
|
||||
@@ -101,6 +101,10 @@ int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser);
|
||||
|
||||
int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser);
|
||||
|
||||
int parse_ul_scheduler_config(mid_t mod_id, yaml_parser_t *parser);
|
||||
|
||||
int parse_ul_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser);
|
||||
|
||||
int load_dl_scheduler_function(mid_t mod_id, const char *function_name);
|
||||
|
||||
#endif /*FLEXRAN_AGENT_MAC_INTERNAL_H_*/
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* 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 flexran_agent_pdcp.c
|
||||
* \brief FlexRAN agent Control Module PDCP
|
||||
* \author Navid Nikaein and shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#include "flexran_agent_pdcp.h"
|
||||
|
||||
|
||||
/*Trigger boolean for PDCP measurement*/
|
||||
bool triggered_pdcp = false;
|
||||
/*Flags showing if a pdcp agent has already been registered*/
|
||||
unsigned int pdcp_agent_registered[NUM_MAX_ENB];
|
||||
|
||||
/*Array containing the Agent-PDCP interfaces*/
|
||||
AGENT_PDCP_xface *agent_pdcp_xface[NUM_MAX_ENB];
|
||||
|
||||
// NUMBER_OF_UE_MAX
|
||||
|
||||
void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id,
|
||||
const mid_t ue_id,
|
||||
Protocol__FlexPdcpStats *pdcp_aggr_stats){
|
||||
|
||||
int lcid=0;
|
||||
/* only calculate the DRBs */
|
||||
//LOG_I(FLEXRAN_AGENT, "enb %d ue %d \n", mod_id, ue_id);
|
||||
|
||||
for (lcid=NUM_MAX_SRB ; lcid < NUM_MAX_SRB + NUM_MAX_DRB; lcid++){
|
||||
|
||||
pdcp_aggr_stats->pkt_tx += flexran_get_pdcp_tx(mod_id,ue_id,lcid);
|
||||
pdcp_aggr_stats->pkt_tx_bytes += flexran_get_pdcp_tx_bytes(mod_id,ue_id,lcid);
|
||||
pdcp_aggr_stats->pkt_tx_w += flexran_get_pdcp_tx_w(mod_id,ue_id,lcid);
|
||||
pdcp_aggr_stats->pkt_tx_bytes_w += flexran_get_pdcp_tx_bytes_w(mod_id,ue_id,lcid);
|
||||
pdcp_aggr_stats->pkt_tx_aiat += flexran_get_pdcp_tx_aiat(mod_id,ue_id,lcid);
|
||||
pdcp_aggr_stats->pkt_tx_aiat_w += flexran_get_pdcp_tx_aiat_w(mod_id,ue_id,lcid);
|
||||
|
||||
|
||||
pdcp_aggr_stats->pkt_rx += flexran_get_pdcp_rx(mod_id,ue_id,lcid);
|
||||
pdcp_aggr_stats->pkt_rx_bytes += flexran_get_pdcp_rx_bytes(mod_id,ue_id,lcid);
|
||||
pdcp_aggr_stats->pkt_rx_w += flexran_get_pdcp_rx_w(mod_id,ue_id,lcid);
|
||||
pdcp_aggr_stats->pkt_rx_bytes_w += flexran_get_pdcp_rx_bytes_w(mod_id,ue_id,lcid);
|
||||
pdcp_aggr_stats->pkt_rx_aiat += flexran_get_pdcp_rx_aiat(mod_id,ue_id,lcid);
|
||||
pdcp_aggr_stats->pkt_rx_aiat_w += flexran_get_pdcp_rx_aiat_w(mod_id,ue_id,lcid);
|
||||
pdcp_aggr_stats->pkt_rx_oo += flexran_get_pdcp_rx_oo(mod_id,ue_id,lcid);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int flexran_agent_pdcp_stats_reply(mid_t mod_id,
|
||||
const report_config_t *report_config,
|
||||
Protocol__FlexUeStatsReport **ue_report,
|
||||
Protocol__FlexCellStatsReport **cell_report) {
|
||||
|
||||
|
||||
// Protocol__FlexHeader *header;
|
||||
int i;
|
||||
// int cc_id = 0;
|
||||
|
||||
|
||||
/* Allocate memory for list of UE reports */
|
||||
if (report_config->nr_ue > 0) {
|
||||
|
||||
for (i = 0; i < report_config->nr_ue; i++) {
|
||||
|
||||
/* Check flag for creation of buffer status report */
|
||||
if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PDCP_STATS) {
|
||||
|
||||
Protocol__FlexPdcpStats *pdcp_aggr_stats;
|
||||
pdcp_aggr_stats = malloc(sizeof(Protocol__FlexPdcpStats));
|
||||
if (pdcp_aggr_stats == NULL)
|
||||
goto error;
|
||||
protocol__flex_pdcp_stats__init(pdcp_aggr_stats);
|
||||
|
||||
flexran_agent_pdcp_aggregate_stats(mod_id, i, pdcp_aggr_stats);
|
||||
|
||||
pdcp_aggr_stats->has_pkt_tx=1;
|
||||
pdcp_aggr_stats->has_pkt_tx_bytes =1;
|
||||
pdcp_aggr_stats->has_pkt_tx_w=1;
|
||||
pdcp_aggr_stats->has_pkt_tx_bytes_w =1;
|
||||
pdcp_aggr_stats->has_pkt_tx_aiat =1;
|
||||
pdcp_aggr_stats->has_pkt_tx_aiat_w =1;
|
||||
|
||||
pdcp_aggr_stats->pkt_tx_sn = flexran_get_pdcp_tx_sn(mod_id, i, DEFAULT_DRB);
|
||||
pdcp_aggr_stats->has_pkt_tx_sn =1;
|
||||
|
||||
pdcp_aggr_stats->has_pkt_rx =1;
|
||||
pdcp_aggr_stats->has_pkt_rx_bytes =1;
|
||||
pdcp_aggr_stats->has_pkt_rx_w =1;
|
||||
pdcp_aggr_stats->has_pkt_rx_bytes_w =1;
|
||||
pdcp_aggr_stats->has_pkt_rx_aiat =1;
|
||||
pdcp_aggr_stats->has_pkt_rx_aiat_w =1;
|
||||
pdcp_aggr_stats->has_pkt_rx_oo =1;
|
||||
|
||||
pdcp_aggr_stats->pkt_rx_sn = flexran_get_pdcp_rx_sn(mod_id, i, DEFAULT_DRB);
|
||||
pdcp_aggr_stats->has_pkt_rx_sn =1;
|
||||
|
||||
pdcp_aggr_stats->sfn = flexran_get_pdcp_sfn(mod_id);
|
||||
pdcp_aggr_stats->has_sfn =1;
|
||||
|
||||
ue_report[i]->pdcp_stats = pdcp_aggr_stats;
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG_D(FLEXRAN_AGENT, "no UE\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
LOG_W(FLEXRAN_AGENT, "Can't allocate PDCP stats\n");
|
||||
|
||||
/* if (cell_report != NULL)
|
||||
free(cell_report);
|
||||
if (ue_report != NULL)
|
||||
free(ue_report);
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int flexran_agent_register_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface *xface) {
|
||||
if (pdcp_agent_registered[mod_id]) {
|
||||
LOG_E(PDCP, "PDCP agent for eNB %d is already registered\n", mod_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//xface->flexran_pdcp_stats_measurement = NULL;
|
||||
|
||||
pdcp_agent_registered[mod_id] = 1;
|
||||
agent_pdcp_xface[mod_id] = xface;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int flexran_agent_unregister_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface *xface) {
|
||||
|
||||
//xface->agent_ctxt = NULL;
|
||||
//xface->flexran_pdcp_stats_measurement = NULL;
|
||||
|
||||
|
||||
pdcp_agent_registered[mod_id] = 0;
|
||||
agent_pdcp_xface[mod_id] = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 flexran_agent_pdcp.h
|
||||
* \brief FlexRAN agent Control Module PDCP header
|
||||
* \author shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#ifndef FLEXRAN_AGENT_PDCP_H_
|
||||
#define FLEXRAN_AGENT_PDCP_H_
|
||||
|
||||
#include "header.pb-c.h"
|
||||
#include "flexran.pb-c.h"
|
||||
#include "stats_messages.pb-c.h"
|
||||
#include "stats_common.pb-c.h"
|
||||
|
||||
|
||||
#include "flexran_agent_common.h"
|
||||
#include "flexran_agent_defs.h"
|
||||
#include "flexran_agent_pdcp_defs.h"
|
||||
#include "flexran_agent_ran_api.h"
|
||||
|
||||
/**********************************
|
||||
* FlexRAN agent - technology PDCP API
|
||||
**********************************/
|
||||
|
||||
/* Send to the controller all the pdcp stat updates that occured during this subframe*/
|
||||
int flexran_agent_pdcp_stats_reply(mid_t mod_id,
|
||||
const report_config_t *report_config,
|
||||
Protocol__FlexUeStatsReport **ue_report,
|
||||
Protocol__FlexCellStatsReport **cell_report);
|
||||
|
||||
/* Get the stats from RAN API and aggregate them per USER*/
|
||||
void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id,
|
||||
const mid_t ue_id,
|
||||
Protocol__FlexPdcpStats *pdcp_aggr_stats);
|
||||
|
||||
/*Register technology specific interface callbacks*/
|
||||
int flexran_agent_register_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface *xface);
|
||||
|
||||
/*Unregister technology specific callbacks*/
|
||||
int flexran_agent_unregister_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface*xface);
|
||||
|
||||
#endif
|
||||
+37
-18
@@ -3,7 +3,7 @@
|
||||
* 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
|
||||
* 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
|
||||
*
|
||||
@@ -17,28 +17,47 @@
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
*/
|
||||
#ifndef __FLEXRAN_AGENT_PDCP_PRIMITIVES_H__
|
||||
#define __FLEXRAN_AGENT_PDCP_PRIMITIVES_H__
|
||||
|
||||
/*! \file rtai_mem.h
|
||||
* \brief a wrapper for Unified RTAI real-time memory management.
|
||||
* \author Florian Kaltenberger
|
||||
* \date 2011-04-06
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: florian.kaltenberger@eurecom.fr
|
||||
* \note
|
||||
* \bug
|
||||
* \warning
|
||||
*/
|
||||
#include "flexran_agent_defs.h"
|
||||
#include "flexran.pb-c.h"
|
||||
#include "header.pb-c.h"
|
||||
|
||||
/*PDCP aggregated Packet stats */
|
||||
/*
|
||||
void* rt_alloc_wrapper(int size);
|
||||
typedef struct pdcp_aggr_stats_s {
|
||||
int32_t rnti;
|
||||
|
||||
int rt_free_wrapper(void* ptr);
|
||||
int32_t pkt_tx;
|
||||
int32_t pkt_tx_bytes;
|
||||
int32_t pkt_tx_sn;
|
||||
int32_t pkt_tx_rate_s;
|
||||
int32_t pkt_tx_throughput_s;
|
||||
int32_t pkt_tx_aiat;
|
||||
int32_t pkt_tx_aiat_s;
|
||||
|
||||
void* rt_realloc_wrapper(void* oldptr, int size);
|
||||
int32_t pkt_rx;
|
||||
int32_t pkt_rx_bytes;
|
||||
int32_t pkt_rx_sn;
|
||||
int32_t pkt_rx_rate_s;
|
||||
int32_t pkt_rx_goodput_s;
|
||||
int32_t pkt_rx_aiat;
|
||||
int32_t pkt_rx_aiat_s;
|
||||
int32_t pkt_rx_oo;
|
||||
|
||||
|
||||
} pdcp_aggr_stats_t;
|
||||
*/
|
||||
|
||||
void* rt_realloc(void* oldptr, int size);
|
||||
/* FLEXRAN AGENT-PDCP Interface */
|
||||
typedef struct {
|
||||
|
||||
|
||||
// PDCP statistics
|
||||
void (*flexran_pdcp_stats_measurement)(mid_t mod_id, uint16_t rnti, uint16_t seq_num, uint32_t size);
|
||||
|
||||
} AGENT_PDCP_xface;
|
||||
|
||||
void* rt_calloc(int nmemb, int size);
|
||||
#endif
|
||||
@@ -0,0 +1,673 @@
|
||||
/*
|
||||
* 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 flexran_agent_mac.c
|
||||
* \brief FlexRAN agent Control Module RRC
|
||||
* \author shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#include "flexran_agent_rrc.h"
|
||||
|
||||
|
||||
#include "liblfds700.h"
|
||||
|
||||
#include "log.h"
|
||||
|
||||
/*Trigger boolean for RRC measurement*/
|
||||
bool triggered_rrc = false;
|
||||
|
||||
/*Flags showing if an rrc agent has already been registered*/
|
||||
unsigned int rrc_agent_registered[NUM_MAX_ENB];
|
||||
|
||||
/*Array containing the Agent-RRC interfaces*/
|
||||
AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB];
|
||||
|
||||
|
||||
void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) {
|
||||
int size;
|
||||
Protocol__FlexranMessage *msg = NULL;
|
||||
Protocol__FlexHeader *header = NULL;
|
||||
void *data;
|
||||
int priority = 0;
|
||||
err_code_t err_code;
|
||||
|
||||
int xid = 0;
|
||||
|
||||
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0)
|
||||
goto error;
|
||||
|
||||
Protocol__FlexUeStateChange *ue_state_change_msg;
|
||||
ue_state_change_msg = malloc(sizeof(Protocol__FlexUeStateChange));
|
||||
if(ue_state_change_msg == NULL) {
|
||||
goto error;
|
||||
}
|
||||
protocol__flex_ue_state_change__init(ue_state_change_msg);
|
||||
ue_state_change_msg->has_type = 1;
|
||||
ue_state_change_msg->type = state_change;
|
||||
|
||||
Protocol__FlexUeConfig *config;
|
||||
config = malloc(sizeof(Protocol__FlexUeConfig));
|
||||
if (config == NULL) {
|
||||
goto error;
|
||||
}
|
||||
protocol__flex_ue_config__init(config);
|
||||
if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED) {
|
||||
// Simply set the rnti of the UE
|
||||
config->has_rnti = 1;
|
||||
config->rnti = rnti;
|
||||
} else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED
|
||||
|| state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED) {
|
||||
int i = find_UE_id(mod_id, rnti);
|
||||
config->has_rnti = 1;
|
||||
config->rnti = rnti;
|
||||
if(flexran_get_time_alignment_timer(mod_id,i) != -1) {
|
||||
config->time_alignment_timer = flexran_get_time_alignment_timer(mod_id,i);
|
||||
config->has_time_alignment_timer = 1;
|
||||
}
|
||||
if(flexran_get_meas_gap_config(mod_id,i) != -1){
|
||||
config->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id,i);
|
||||
config->has_meas_gap_config_pattern = 1;
|
||||
}
|
||||
if(config->has_meas_gap_config_pattern == 1 &&
|
||||
config->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) {
|
||||
config->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id,i);
|
||||
config->has_meas_gap_config_sf_offset = 1;
|
||||
}
|
||||
//TODO: Set the SPS configuration (Optional)
|
||||
//Not supported for now, so we do not set it
|
||||
|
||||
//TODO: Set the SR configuration (Optional)
|
||||
//We do not set it for now
|
||||
|
||||
//TODO: Set the CQI configuration (Optional)
|
||||
//We do not set it for now
|
||||
|
||||
if(flexran_get_ue_transmission_mode(mod_id,i) != -1) {
|
||||
config->transmission_mode = flexran_get_ue_transmission_mode(mod_id,i);
|
||||
config->has_transmission_mode = 1;
|
||||
}
|
||||
|
||||
config->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i);
|
||||
config->has_ue_aggregated_max_bitrate_ul = 1;
|
||||
|
||||
config->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i);
|
||||
config->has_ue_aggregated_max_bitrate_dl = 1;
|
||||
|
||||
//TODO: Set the UE capabilities
|
||||
Protocol__FlexUeCapabilities *c_capabilities;
|
||||
c_capabilities = malloc(sizeof(Protocol__FlexUeCapabilities));
|
||||
protocol__flex_ue_capabilities__init(c_capabilities);
|
||||
//TODO: Set half duplex (FDD operation)
|
||||
c_capabilities->has_half_duplex = 0;
|
||||
c_capabilities->half_duplex = 1;//flexran_get_half_duplex(i);
|
||||
//TODO: Set intra-frame hopping flag
|
||||
c_capabilities->has_intra_sf_hopping = 0;
|
||||
c_capabilities->intra_sf_hopping = 1;//flexran_get_intra_sf_hopping(i);
|
||||
//TODO: Set support for type 2 hopping with n_sb > 1
|
||||
c_capabilities->has_type2_sb_1 = 0;
|
||||
c_capabilities->type2_sb_1 = 1;//flexran_get_type2_sb_1(i);
|
||||
//TODO: Set ue category
|
||||
c_capabilities->has_ue_category = 0;
|
||||
c_capabilities->ue_category = 1;//flexran_get_ue_category(i);
|
||||
//TODO: Set UE support for resource allocation type 1
|
||||
c_capabilities->has_res_alloc_type1 = 0;
|
||||
c_capabilities->res_alloc_type1 = 1;//flexran_get_res_alloc_type1(i);
|
||||
//Set the capabilites to the message
|
||||
config->capabilities = c_capabilities;
|
||||
|
||||
if(flexran_get_ue_transmission_antenna(mod_id,i) != -1) {
|
||||
config->has_ue_transmission_antenna = 1;
|
||||
config->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id,i);
|
||||
}
|
||||
|
||||
if(flexran_get_tti_bundling(mod_id,i) != -1) {
|
||||
config->has_tti_bundling = 1;
|
||||
config->tti_bundling = flexran_get_tti_bundling(mod_id,i);
|
||||
}
|
||||
|
||||
if(flexran_get_maxHARQ_TX(mod_id,i) != -1){
|
||||
config->has_max_harq_tx = 1;
|
||||
config->max_harq_tx = flexran_get_maxHARQ_TX(mod_id,i);
|
||||
}
|
||||
|
||||
if(flexran_get_beta_offset_ack_index(mod_id,i) != -1) {
|
||||
config->has_beta_offset_ack_index = 1;
|
||||
config->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id,i);
|
||||
}
|
||||
|
||||
if(flexran_get_beta_offset_ri_index(mod_id,i) != -1) {
|
||||
config->has_beta_offset_ri_index = 1;
|
||||
config->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id,i);
|
||||
}
|
||||
|
||||
if(flexran_get_beta_offset_cqi_index(mod_id,i) != -1) {
|
||||
config->has_beta_offset_cqi_index = 1;
|
||||
config->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id,i);
|
||||
}
|
||||
|
||||
/* assume primary carrier */
|
||||
if(flexran_get_ack_nack_simultaneous_trans(mod_id,i,0) != -1) {
|
||||
config->has_ack_nack_simultaneous_trans = 1;
|
||||
config->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,i,0);
|
||||
}
|
||||
|
||||
if(flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -1) {
|
||||
config->has_simultaneous_ack_nack_cqi = 1;
|
||||
config->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id,i);
|
||||
}
|
||||
|
||||
if(flexran_get_aperiodic_cqi_rep_mode(mod_id,i) != -1) {
|
||||
config->has_aperiodic_cqi_rep_mode = 1;
|
||||
int mode = flexran_get_aperiodic_cqi_rep_mode(mod_id,i);
|
||||
if (mode > 4) {
|
||||
config->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE;
|
||||
} else {
|
||||
config->aperiodic_cqi_rep_mode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
if(flexran_get_tdd_ack_nack_feedback_mode(mod_id, i) != -1) {
|
||||
config->has_tdd_ack_nack_feedback = 1;
|
||||
config->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id,i);
|
||||
}
|
||||
|
||||
if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) {
|
||||
config->has_ack_nack_repetition_factor = 1;
|
||||
config->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id,i);
|
||||
}
|
||||
|
||||
if(flexran_get_extended_bsr_size(mod_id, i) != -1) {
|
||||
config->has_extended_bsr_size = 1;
|
||||
config->extended_bsr_size = flexran_get_extended_bsr_size(mod_id,i);
|
||||
}
|
||||
|
||||
config->has_pcell_carrier_index = 1;
|
||||
config->pcell_carrier_index = UE_PCCID(mod_id, i);
|
||||
//TODO: Set carrier aggregation support (boolean)
|
||||
config->has_ca_support = 0;
|
||||
config->ca_support = 0;
|
||||
if(config->has_ca_support){
|
||||
//TODO: Set cross carrier scheduling support (boolean)
|
||||
config->has_cross_carrier_sched_support = 1;
|
||||
config->cross_carrier_sched_support = 0;
|
||||
//TODO: Set secondary cells configuration
|
||||
// We do not set it for now. No carrier aggregation support
|
||||
|
||||
//TODO: Set deactivation timer for secondary cell
|
||||
config->has_scell_deactivation_timer = 0;
|
||||
config->scell_deactivation_timer = 0;
|
||||
}
|
||||
} else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_MOVED) {
|
||||
// TODO: Not supported for now. Leave blank
|
||||
}
|
||||
|
||||
ue_state_change_msg->config = config;
|
||||
msg = malloc(sizeof(Protocol__FlexranMessage));
|
||||
if (msg == NULL) {
|
||||
goto error;
|
||||
}
|
||||
protocol__flexran_message__init(msg);
|
||||
msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG;
|
||||
msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE;
|
||||
msg->ue_state_change_msg = ue_state_change_msg;
|
||||
|
||||
data = flexran_agent_pack_message(msg, &size);
|
||||
/*Send sr info using the MAC channel of the eNB*/
|
||||
if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) {
|
||||
err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
|
||||
goto error;
|
||||
}
|
||||
|
||||
LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
|
||||
return;
|
||||
error:
|
||||
LOG_E(FLEXRAN_AGENT, "Could not send UE state message becasue of %d \n",err_code);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) {
|
||||
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG)
|
||||
goto error;
|
||||
free(msg->ue_state_change_msg->header);
|
||||
//TODO: Free the contents of the UE config structure
|
||||
free(msg->ue_state_change_msg);
|
||||
free(msg);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* this is called by RRC as a part of rrc xface . The controller previously requested this*/
|
||||
void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t* measResults) {
|
||||
|
||||
int i;
|
||||
// int priority = 0; // Warning Preventing
|
||||
// void *data;
|
||||
// int size;
|
||||
// err_code_t err_code = -100;
|
||||
triggered_rrc = true;
|
||||
int num;
|
||||
|
||||
num = flexran_get_num_ues (mod_id);
|
||||
|
||||
meas_stats = malloc(sizeof(rrc_meas_stats) * num);
|
||||
|
||||
for (i = 0; i < num; i++){
|
||||
meas_stats[i].rnti = flexran_get_ue_crnti(mod_id, i);
|
||||
meas_stats[i].meas_id = flexran_get_rrc_pcell_measid(mod_id,i);
|
||||
meas_stats[i].rsrp = flexran_get_rrc_pcell_rsrp(mod_id,i) - 140;
|
||||
// measResults->measResultPCell.rsrpResult - 140;
|
||||
meas_stats[i].rsrq = flexran_get_rrc_pcell_rsrq(mod_id,i)/2 - 20;
|
||||
// (measResults->measResultPCell.rsrqResult)/2 - 20;
|
||||
|
||||
}
|
||||
// repl->neigh_meas = NULL;
|
||||
|
||||
// if (meas->measResultNeighCells != NULL) {
|
||||
// /*
|
||||
// * Neighboring cells measurements performed by UE.
|
||||
// */
|
||||
// NeighCellsMeasurements *neigh_meas;
|
||||
// neigh_meas = malloc(sizeof(NeighCellsMeasurements));
|
||||
// if (neigh_meas == NULL)
|
||||
// goto error;
|
||||
// neigh_cells_measurements__init(neigh_meas);
|
||||
|
||||
// /* EUTRAN RRC Measurements. */
|
||||
// if (meas->measResultNeighCells->present ==
|
||||
// MeasResults__measResultNeighCells_PR_measResultListEUTRA) {
|
||||
|
||||
// MeasResultListEUTRA_t meas_list = meas->measResultNeighCells->
|
||||
// choice.measResultListEUTRA;
|
||||
// /* Set the number of EUTRAN measurements present in report. */
|
||||
// neigh_meas->n_eutra_meas = meas_list.list.count;
|
||||
// if (neigh_meas->n_eutra_meas > 0) {
|
||||
// /* Initialize EUTRAN measurements. */
|
||||
// EUTRAMeasurements **eutra_meas;
|
||||
// eutra_meas = malloc(sizeof(EUTRAMeasurements *) *
|
||||
// neigh_meas->n_eutra_meas);
|
||||
// for (i = 0; i < neigh_meas->n_eutra_meas; i++) {
|
||||
// eutra_meas[i] = malloc(sizeof(EUTRAMeasurements));
|
||||
// eutra_measurements__init(eutra_meas[i]);
|
||||
// /* Fill in the physical cell identifier. */
|
||||
// eutra_meas[i]->has_phys_cell_id = 1;
|
||||
// eutra_meas[i]->phys_cell_id = meas_list.list.array[i]->
|
||||
// physCellId;
|
||||
// // log_i(agent,"PCI of Target %d", eutra_meas[i]->phys_cell_id);
|
||||
// /* Check for Reference signal measurements. */
|
||||
// if (&(meas_list.list.array[i]->measResult)) {
|
||||
// /* Initialize Ref. signal measurements. */
|
||||
// EUTRARefSignalMeas *meas_result;
|
||||
// meas_result = malloc(sizeof(EUTRARefSignalMeas));
|
||||
// eutra_ref_signal_meas__init(meas_result);
|
||||
|
||||
// if (meas_list.list.array[i]->measResult.rsrpResult) {
|
||||
// meas_result->has_rsrp = 1;
|
||||
// meas_result->rsrp = RSRP_meas_mapping[*(meas_list.
|
||||
// list.array[i]->measResult.rsrpResult)];
|
||||
// // log_i(agent,"RSRP of Target %d", meas_result->rsrp);
|
||||
// }
|
||||
|
||||
// if (meas_list.list.array[i]->measResult.rsrqResult) {
|
||||
// meas_result->has_rsrq = 1;
|
||||
// meas_result->rsrq = RSRQ_meas_mapping[*(meas_list.
|
||||
// list.array[i]->measResult.rsrqResult)];
|
||||
// // log_i(agent,"RSRQ of Target %d", meas_result->rsrq);
|
||||
// }
|
||||
// eutra_meas[i]->meas_result = meas_result;
|
||||
// }
|
||||
// /* Check for CGI measurements. */
|
||||
// if (meas_list.list.array[i]->cgi_Info) {
|
||||
// /* Initialize CGI measurements. */
|
||||
// EUTRACgiMeasurements *cgi_meas;
|
||||
// cgi_meas = malloc(sizeof(EUTRACgiMeasurements));
|
||||
// eutra_cgi_measurements__init(cgi_meas);
|
||||
|
||||
// /* EUTRA Cell Global Identity (CGI). */
|
||||
// CellGlobalIdEUTRA *cgi;
|
||||
// cgi = malloc(sizeof(CellGlobalIdEUTRA));
|
||||
// cell_global_id__eutra__init(cgi);
|
||||
|
||||
// cgi->has_cell_id = 1;
|
||||
// CellIdentity_t cId = meas_list.list.array[i]->
|
||||
// cgi_Info->cellGlobalId.cellIdentity;
|
||||
// cgi->cell_id = (cId.buf[0] << 20) + (cId.buf[1] << 12) +
|
||||
// (cId.buf[2] << 4) + (cId.buf[3] >> 4);
|
||||
|
||||
// /* Public land mobile network identifier of neighbor
|
||||
// * cell.
|
||||
// */
|
||||
// PlmnIdentity *plmn_id;
|
||||
// plmn_id = malloc(sizeof(PlmnIdentity));
|
||||
// plmn_identity__init(plmn_id);
|
||||
|
||||
// MNC_t mnc = meas_list.list.array[i]->
|
||||
// cgi_Info->cellGlobalId.plmn_Identity.mnc;
|
||||
|
||||
// plmn_id->has_mnc = 1;
|
||||
// plmn_id->mnc = 0;
|
||||
// for (m = 0; m < mnc.list.count; m++) {
|
||||
// plmn_id->mnc += *mnc.list.array[m] *
|
||||
// ((uint32_t) pow(10, mnc.list.count - m - 1));
|
||||
// }
|
||||
|
||||
// MCC_t *mcc = meas_list.list.array[i]->
|
||||
// cgi_Info->cellGlobalId.plmn_Identity.mcc;
|
||||
|
||||
// plmn_id->has_mcc = 1;
|
||||
// plmn_id->mcc = 0;
|
||||
// for (m = 0; m < mcc->list.count; m++) {
|
||||
// plmn_id->mcc += *mcc->list.array[m] *
|
||||
// ((uint32_t) pow(10, mcc->list.count - m - 1));
|
||||
// }
|
||||
|
||||
// TrackingAreaCode_t tac = meas_list.list.array[i]->
|
||||
// cgi_Info->trackingAreaCode;
|
||||
|
||||
// cgi_meas->has_tracking_area_code = 1;
|
||||
// cgi_meas->tracking_area_code = (tac.buf[0] << 8) +
|
||||
// (tac.buf[1]);
|
||||
|
||||
// PLMN_IdentityList2_t *plmn_l = meas_list.list.array[i]->
|
||||
// cgi_Info->plmn_IdentityList;
|
||||
|
||||
// cgi_meas->n_plmn_id = plmn_l->list.count;
|
||||
// /* Set the PLMN ID list in CGI measurements. */
|
||||
// PlmnIdentity **plmn_id_l;
|
||||
// plmn_id_l = malloc(sizeof(PlmnIdentity *) *
|
||||
// cgi_meas->n_plmn_id);
|
||||
|
||||
// MNC_t mnc2;
|
||||
// MCC_t *mcc2;
|
||||
// for (m = 0; m < cgi_meas->n_plmn_id; m++) {
|
||||
// plmn_id_l[m] = malloc(sizeof(PlmnIdentity));
|
||||
// plmn_identity__init(plmn_id_l[m]);
|
||||
|
||||
// mnc2 = plmn_l->list.array[m]->mnc;
|
||||
// plmn_id_l[m]->has_mnc = 1;
|
||||
// plmn_id_l[m]->mnc = 0;
|
||||
// for (k = 0; k < mnc2.list.count; k++) {
|
||||
// plmn_id_l[m]->mnc += *mnc2.list.array[k] *
|
||||
// ((uint32_t) pow(10, mnc2.list.count - k - 1));
|
||||
// }
|
||||
|
||||
// mcc2 = plmn_l->list.array[m]->mcc;
|
||||
// plmn_id_l[m]->has_mcc = 1;
|
||||
// plmn_id_l[m]->mcc = 0;
|
||||
// for (k = 0; k < mcc2->list.count; k++) {
|
||||
// plmn_id_l[m]->mcc += *mcc2->list.array[k] *
|
||||
// ((uint32_t) pow(10, mcc2->list.count - k - 1));
|
||||
// }
|
||||
// }
|
||||
// cgi_meas->plmn_id = plmn_id_l;
|
||||
// eutra_meas[i]->cgi_meas = cgi_meas;
|
||||
// }
|
||||
// }
|
||||
// neigh_meas->eutra_meas = eutra_meas;
|
||||
// }
|
||||
// }
|
||||
// repl->neigh_meas = neigh_meas;
|
||||
// }
|
||||
/* Attach the RRC measurement reply message to RRC measurements message. */
|
||||
// mrrc_meas->repl = repl;
|
||||
/* Attach RRC measurement message to triggered event message. */
|
||||
// te->mrrc_meas = mrrc_meas;
|
||||
// te->has_action = 0;
|
||||
/* Attach the triggered event message to main message. */
|
||||
// reply->te = te;
|
||||
|
||||
/* Send the report to controller. */
|
||||
// if (flexran_agent_msg_send(b_id, reply) < 0) {
|
||||
// goto error;
|
||||
// }
|
||||
|
||||
/* Free the measurement report received from UE. */
|
||||
// ASN_STRUCT_FREE(asn_DEF_MeasResults, p->meas);
|
||||
/* Free the params. */
|
||||
// free(p);
|
||||
|
||||
|
||||
// stats_reply_msg->cell_report = cell_report;
|
||||
|
||||
// stats_reply_msg->ue_report = ue_report;
|
||||
|
||||
// msg = malloc(sizeof(Protocol__FlexranMessage));
|
||||
// if(msg == NULL)
|
||||
// goto error;
|
||||
// protocol__flexran_message__init(msg);
|
||||
// msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG;
|
||||
// msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME;
|
||||
// msg->stats_reply_msg = stats_reply_msg;
|
||||
|
||||
// data = flexran_agent_pack_message(msg, &size);
|
||||
|
||||
|
||||
// if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) {
|
||||
|
||||
// err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
|
||||
// goto error;
|
||||
// }
|
||||
|
||||
// LOG_I(FLEXRAN_AGENT,"RRC Trigger is done \n");
|
||||
|
||||
return;
|
||||
|
||||
// error:
|
||||
|
||||
// LOG_E(FLEXRAN_AGENT, "Could not send UE state message becasue of %d \n",err_code);
|
||||
/* Free the measurement report received from UE. */
|
||||
// ASN_STRUCT_FREE(asn_DEF_MeasResults, p->meas);
|
||||
/* Free the params. */
|
||||
// free(p);
|
||||
// return -1;
|
||||
}
|
||||
|
||||
|
||||
int flexran_agent_rrc_stats_reply(mid_t mod_id,
|
||||
const report_config_t *report_config,
|
||||
Protocol__FlexUeStatsReport **ue_report,
|
||||
Protocol__FlexCellStatsReport **cell_report) {
|
||||
|
||||
|
||||
// Protocol__FlexHeader *header;
|
||||
int i,j;
|
||||
|
||||
/* Allocate memory for list of UE reports */
|
||||
if (report_config->nr_ue > 0) {
|
||||
|
||||
for (i = 0; i < report_config->nr_ue; i++) {
|
||||
|
||||
/* Check flag for creation of buffer status report */
|
||||
if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RRC_MEASUREMENTS) {
|
||||
|
||||
/*Source Cell*/
|
||||
Protocol__FlexRrcMeasurements *rrc_measurements;
|
||||
rrc_measurements = malloc(sizeof(Protocol__FlexRrcMeasurements));
|
||||
if (rrc_measurements == NULL)
|
||||
goto error;
|
||||
protocol__flex_rrc_measurements__init(rrc_measurements);
|
||||
|
||||
rrc_measurements->measid = flexran_get_rrc_pcell_measid(mod_id,i);
|
||||
rrc_measurements->has_measid = 1;
|
||||
|
||||
rrc_measurements->pcell_rsrp = flexran_get_rrc_pcell_rsrp(mod_id,i);
|
||||
rrc_measurements->has_pcell_rsrp = 1;
|
||||
|
||||
rrc_measurements->pcell_rsrq = flexran_get_rrc_pcell_rsrq(mod_id,i);
|
||||
rrc_measurements->has_pcell_rsrq = 1 ;
|
||||
|
||||
|
||||
/* Target Cell, Neghibouring*/
|
||||
Protocol__FlexNeighCellsMeasurements *neigh_meas;
|
||||
neigh_meas = malloc(sizeof(Protocol__FlexNeighCellsMeasurements));
|
||||
if (neigh_meas == NULL)
|
||||
goto error;
|
||||
protocol__flex_neigh_cells_measurements__init(neigh_meas);
|
||||
|
||||
|
||||
neigh_meas->n_eutra_meas = flexran_get_rrc_num_ncell(mod_id, i);
|
||||
|
||||
Protocol__FlexEutraMeasurements **eutra_meas = NULL;
|
||||
|
||||
if (neigh_meas->n_eutra_meas > 0){
|
||||
|
||||
eutra_meas = malloc(sizeof(Protocol__FlexEutraMeasurements) * neigh_meas->n_eutra_meas);
|
||||
if (eutra_meas == NULL)
|
||||
goto error;
|
||||
|
||||
for (j = 0; j < neigh_meas->n_eutra_meas; j++ ){
|
||||
|
||||
eutra_meas[j] = malloc(sizeof(Protocol__FlexEutraMeasurements));
|
||||
if (eutra_meas[j] == NULL)
|
||||
goto error;
|
||||
|
||||
protocol__flex_eutra_measurements__init(eutra_meas[j]);
|
||||
|
||||
eutra_meas[j]->phys_cell_id = flexran_get_rrc_neigh_phy_cell_id(mod_id, i, j);
|
||||
eutra_meas[j]->has_phys_cell_id = 1;
|
||||
|
||||
|
||||
/*TODO: Extend for CGI and PLMNID*/
|
||||
|
||||
Protocol__FlexEutraRefSignalMeas *meas_result;
|
||||
meas_result = malloc(sizeof(Protocol__FlexEutraRefSignalMeas));
|
||||
|
||||
protocol__flex_eutra_ref_signal_meas__init(meas_result);
|
||||
|
||||
meas_result->rsrp = flexran_get_rrc_neigh_rsrp(mod_id, i, eutra_meas[j]->phys_cell_id);
|
||||
meas_result->has_rsrp = 1;
|
||||
|
||||
meas_result->rsrq = flexran_get_rrc_neigh_rsrq(mod_id, i, eutra_meas[j]->phys_cell_id);
|
||||
meas_result->has_rsrq = 1;
|
||||
|
||||
eutra_meas[j]->meas_result = meas_result;
|
||||
|
||||
}
|
||||
|
||||
neigh_meas->eutra_meas = eutra_meas;
|
||||
|
||||
rrc_measurements->neigh_meas = neigh_meas;
|
||||
|
||||
}
|
||||
|
||||
ue_report[i]->rrc_measurements = rrc_measurements;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* To be considered for RRC signaling of cell*/
|
||||
// if (report_config->nr_cc > 0) {
|
||||
|
||||
|
||||
// // Fill in the Cell reports
|
||||
// for (i = 0; i < report_config->nr_cc; i++) {
|
||||
|
||||
|
||||
// /* Check flag for creation of noise and interference report */
|
||||
// if(report_config->cc_report_type[i].cc_report_flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) {
|
||||
// // TODO: Fill in the actual noise and interference report for this cell
|
||||
// Protocol__FlexNoiseInterferenceReport *ni_report;
|
||||
// ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport));
|
||||
// if(ni_report == NULL)
|
||||
// goto error;
|
||||
// protocol__flex_noise_interference_report__init(ni_report);
|
||||
// // Current frame and subframe number
|
||||
// ni_report->sfn_sf = flexran_get_sfn_sf(enb_id);
|
||||
// ni_report->has_sfn_sf = 1;
|
||||
// //TODO:Received interference power in dbm
|
||||
// ni_report->rip = 0;
|
||||
// ni_report->has_rip = 1;
|
||||
// //TODO:Thermal noise power in dbm
|
||||
// ni_report->tnp = 0;
|
||||
// ni_report->has_tnp = 1;
|
||||
|
||||
// ni_report->p0_nominal_pucch = flexran_get_p0_nominal_pucch(enb_id, 0);
|
||||
// ni_report->has_p0_nominal_pucch = 1;
|
||||
// cell_report[i]->noise_inter_report = ni_report;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
|
||||
for (i = 0; i < report_config->nr_ue; i++){
|
||||
|
||||
if (ue_report[i]->rrc_measurements->neigh_meas != NULL){
|
||||
for (j = 0; j < flexran_get_rrc_num_ncell(mod_id, i); j++){
|
||||
|
||||
free(ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]);
|
||||
}
|
||||
free(ue_report[i]->rrc_measurements->neigh_meas);
|
||||
}
|
||||
}
|
||||
|
||||
if (cell_report != NULL)
|
||||
free(cell_report);
|
||||
if (ue_report != NULL)
|
||||
free(ue_report);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int flexran_agent_register_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface) {
|
||||
if (rrc_agent_registered[mod_id]) {
|
||||
LOG_E(RRC, "RRC agent for eNB %d is already registered\n", mod_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// xface->flexran_agent_send_update_rrc_stats = flexran_agent_send_update_rrc_stats;
|
||||
|
||||
xface->flexran_agent_notify_ue_state_change = flexran_agent_ue_state_change;
|
||||
xface->flexran_trigger_rrc_measurements = flexran_trigger_rrc_measurements;
|
||||
|
||||
rrc_agent_registered[mod_id] = 1;
|
||||
agent_rrc_xface[mod_id] = xface;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int flexran_agent_unregister_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface) {
|
||||
|
||||
//xface->agent_ctxt = NULL;
|
||||
// xface->flexran_agent_send_update_rrc_stats = NULL;
|
||||
|
||||
xface->flexran_agent_notify_ue_state_change = NULL;
|
||||
xface->flexran_trigger_rrc_measurements = NULL;
|
||||
rrc_agent_registered[mod_id] = 0;
|
||||
agent_rrc_xface[mod_id] = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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 flexran_agent_rrc.h
|
||||
* \brief FlexRAN agent Control Module RRC header
|
||||
* \author shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#ifndef FLEXRAN_AGENT_RRC_H_
|
||||
#define FLEXRAN_AGENT_RRC_H_
|
||||
|
||||
#include "header.pb-c.h"
|
||||
#include "flexran.pb-c.h"
|
||||
#include "stats_messages.pb-c.h"
|
||||
#include "stats_common.pb-c.h"
|
||||
|
||||
|
||||
#include "flexran_agent_common.h"
|
||||
#include "flexran_agent_rrc_defs.h"
|
||||
|
||||
|
||||
/* Initialization function for the agent structures etc */
|
||||
void flexran_agent_init_rrc_agent(mid_t mod_id);
|
||||
|
||||
/* UE state change message constructor and destructor */
|
||||
void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change);
|
||||
int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg);
|
||||
|
||||
|
||||
/**********************************
|
||||
* FlexRAN agent - technology RRC API
|
||||
**********************************/
|
||||
|
||||
/* Send to the controller all the rrc stat updates that occured during this subframe*/
|
||||
// void flexran_agent_send_update_rrc_stats(mid_t mod_id);
|
||||
|
||||
/* this is called by RRC as a part of rrc xface . The controller previously requested this*/
|
||||
void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t *);
|
||||
|
||||
/* Statistics reply protocol message constructor and destructor */
|
||||
int flexran_agent_rrc_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report);
|
||||
int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexranMessage *msg);
|
||||
|
||||
/*Register technology specific interface callbacks*/
|
||||
int flexran_agent_register_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface);
|
||||
|
||||
/*Unregister technology specific callbacks*/
|
||||
int flexran_agent_unregister_rrc_xface(mid_t mod_id, AGENT_RRC_xface*xface);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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 flexran_agent_rrc_defs.h
|
||||
* \brief FlexRAN agent - RRC interface primitives
|
||||
* \author shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
* \mail
|
||||
*/
|
||||
|
||||
#ifndef __FLEXRAN_AGENT_RRC_PRIMITIVES_H__
|
||||
#define __FLEXRAN_AGENT_RRC_PRIMITIVES_H__
|
||||
|
||||
#include "flexran_agent_defs.h"
|
||||
#include "flexran.pb-c.h"
|
||||
#include "header.pb-c.h"
|
||||
#include "MeasResults.h"
|
||||
|
||||
#define RINGBUFFER_SIZE 100
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t rnti;
|
||||
int32_t meas_id;
|
||||
int32_t rsrp;
|
||||
int32_t rsrq;
|
||||
|
||||
/*To Be Extended*/
|
||||
}rrc_meas_stats;
|
||||
|
||||
/* RRC CMI statistics */
|
||||
rrc_meas_stats * meas_stats;
|
||||
|
||||
|
||||
/* FLEXRAN AGENT-RRC Interface */
|
||||
typedef struct {
|
||||
|
||||
|
||||
/// Notify the controller for a state change of a particular UE, by sending the proper
|
||||
/// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER)
|
||||
void (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti,
|
||||
uint8_t state_change);
|
||||
|
||||
void (*flexran_trigger_rrc_measurements)(mid_t mod_id, MeasResults_t* measResults);
|
||||
|
||||
} AGENT_RRC_xface;
|
||||
|
||||
#endif
|
||||
@@ -38,6 +38,11 @@ message flex_cell_config {
|
||||
optional uint32 srs_mac_up_pts = 32; // Boolean value. See TS 36.211, section 5.5.3.2. TDD only
|
||||
optional uint32 enable_64QAM = 33; // One of the FLEQ_* enum values
|
||||
optional uint32 carrier_index = 34; // Carrier component index
|
||||
optional uint32 dl_freq = 35; // operating downlink frequency
|
||||
optional uint32 ul_freq = 36; // operating uplink frequency
|
||||
optional uint32 eutra_band= 37; // operating band
|
||||
optional int32 dl_pdsch_power = 38; // operating downlink power
|
||||
optional int32 ul_pusch_power = 39; // operating uplink power
|
||||
}
|
||||
|
||||
message flex_ue_config {
|
||||
@@ -76,6 +81,7 @@ message flex_ue_config {
|
||||
optional uint32 pcell_carrier_index = 27; // Index of primary cell
|
||||
repeated flex_scell_config scell_config = 28; // Secondary cells configuration
|
||||
optional uint32 scell_deactivation_timer = 29;// Deactivation timer for secondary cell
|
||||
optional uint64 imsi = 30;
|
||||
}
|
||||
|
||||
message flex_lc_ue_config {
|
||||
|
||||
@@ -3,4 +3,4 @@ package protocol;
|
||||
|
||||
enum flex_control_delegation_type {
|
||||
FLCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,12 @@ message flex_dl_data {
|
||||
optional uint32 act_deact_ce = 6; //Hex content of MAC CE for Activation/Deactivation in CA
|
||||
}
|
||||
|
||||
|
||||
message flex_ul_data {
|
||||
optional uint32 rnti = 1;
|
||||
optional flex_ul_dci ul_dci = 2;
|
||||
}
|
||||
|
||||
//
|
||||
// Body of the RAR scheduler configuration
|
||||
//
|
||||
@@ -56,4 +62,4 @@ message flex_pdcch_ofdm_sym_count {
|
||||
enum flex_broadcast_type {
|
||||
FLBT_BCCH = 0;
|
||||
FLBT_PCCH = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import "config_messages.proto";
|
||||
import "controller_commands.proto";
|
||||
import "control_delegation.proto";
|
||||
|
||||
|
||||
message flexran_message {
|
||||
optional flexran_direction msg_dir = 100;
|
||||
oneof msg {
|
||||
@@ -28,6 +29,8 @@ message flexran_message {
|
||||
flex_ue_state_change ue_state_change_msg = 15;
|
||||
flex_control_delegation control_delegation_msg = 16;
|
||||
flex_agent_reconfiguration agent_reconfiguration_msg = 17;
|
||||
flex_rrc_triggering rrc_triggering = 18;
|
||||
flex_ul_mac_config ul_mac_config_msg = 19;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +133,7 @@ message flex_enb_config_reply {
|
||||
optional flex_header header = 1;
|
||||
optional uint32 eNB_id = 2; // Unique id to distinguish the eNB
|
||||
repeated flex_cell_config cell_config = 3;
|
||||
optional uint32 device_spec = 4;
|
||||
}
|
||||
|
||||
message flex_ue_config_request {
|
||||
@@ -163,6 +167,18 @@ message flex_dl_mac_config {
|
||||
repeated flex_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC
|
||||
}
|
||||
|
||||
message flex_ul_mac_config {
|
||||
optional flex_header header = 1;
|
||||
optional uint32 sfn_sf = 2;
|
||||
repeated flex_ul_data ul_ue_data = 3;
|
||||
}
|
||||
|
||||
message flex_rrc_triggering {
|
||||
|
||||
optional flex_header header = 1;
|
||||
optional string rrc_trigger = 2;
|
||||
}
|
||||
|
||||
//
|
||||
// UE state change message
|
||||
//
|
||||
@@ -190,7 +206,7 @@ message flex_control_delegation {
|
||||
|
||||
message flex_agent_reconfiguration {
|
||||
optional flex_header header = 1;
|
||||
optional string policy = 2; // The policy changes using YAML syntax in string format
|
||||
optional string policy = 2; // The policy changes using YAML syntax in string format
|
||||
}
|
||||
|
||||
// Extensions of the echo request and reply
|
||||
|
||||
@@ -40,5 +40,7 @@ enum flex_type {
|
||||
// Control delegation messages
|
||||
FLPT_DELEGATE_CONTROL = 15;
|
||||
FLPT_RECONFIGURE_AGENT = 16;
|
||||
FLPT_RRC_TRIGGERING = 17;
|
||||
FLPT_UL_MAC_CONFIG = 18;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,39 @@ message flex_dl_dci {
|
||||
optional uint32 cif = 27; // CIF for cross-carrier scheduling
|
||||
}
|
||||
|
||||
message flex_ul_dci {
|
||||
optional uint32 rnti = 1;
|
||||
optional uint32 rb_start = 2; // The start RB allocated to the UE
|
||||
optional uint32 rb_len = 3; // The number of RBs allocated to the UE
|
||||
optional uint32 mcs = 4; // Modulation and coding scheme
|
||||
optional uint32 cyclic_shift2 = 5; // match DCI format 0/4 PDU
|
||||
optional uint32 freq_hop_flag = 6; // 0 no hopping, 1 hoppping
|
||||
optional uint32 freq_hop_map = 7; // Frequency hopping bits (0..4)
|
||||
optional uint32 ndi = 8; // New data indicator
|
||||
optional uint32 rv = 9; // Redundancy version
|
||||
optional uint32 harq_pid = 10; // The harq process id
|
||||
optional uint32 ultx_mode = 11; // A FLULM_* value
|
||||
optional uint32 tbs_size = 12; // The size of each TBS
|
||||
optional uint32 n_srs = 13; // Overlap indication with srs
|
||||
optional uint32 res_alloc = 14; // Type of resource allocation
|
||||
optional uint32 size = 15; // Size of the ULSCH PDU in bytes for UL Grant.
|
||||
|
||||
optional uint32 dai = 16; // TDD only
|
||||
|
||||
// optional uint32 tb_swap = 17; // Boolean. TB to codeword swap flag
|
||||
|
||||
// optional uint32 pdcch_order = 19;
|
||||
// optional uint32 preamble_index = 20; // Only valid if pdcch_order = 1
|
||||
// optional uint32 prach_mask_index = 21; // Only valid if pdcch_order = 1
|
||||
|
||||
// optional uint32 tbs_idx = 23; // The TBS index for Format 1A
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Messages related to the creation of RLC PDUs
|
||||
//
|
||||
@@ -74,4 +107,4 @@ enum flex_vrb_format {
|
||||
enum flex_ngap_val {
|
||||
FLNGV_1 = 0;
|
||||
FLNGV_2 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,3 +182,90 @@ message flex_noise_interference_report {
|
||||
optional int32 p0_nominal_pucch = 4;
|
||||
}
|
||||
|
||||
//
|
||||
// RRC Measurements Primitives
|
||||
//
|
||||
|
||||
|
||||
message flex_rrc_measurements {
|
||||
// Measurement identifier.
|
||||
optional int32 measid = 1;
|
||||
// Primary Cell Reference Signal Received Power (RSRP).
|
||||
optional int32 pcell_rsrp = 2;
|
||||
// Primary Cell Reference Signal Received Quality (RSRQ).
|
||||
optional int32 pcell_rsrq = 3;
|
||||
// Neighboring cells measurements performed by UE.
|
||||
optional flex_neigh_cells_measurements neigh_meas = 4;
|
||||
}
|
||||
|
||||
message flex_neigh_cells_measurements {
|
||||
// Neighboring EUTRA cells measurements.
|
||||
repeated flex_eutra_measurements eutra_meas = 1;
|
||||
}
|
||||
|
||||
message flex_eutra_measurements {
|
||||
// Physical Cell identifier.
|
||||
optional int32 phys_cell_id = 1;
|
||||
// EUTRA Cell Global Identity (CGI) measurement.
|
||||
optional flex_eutra_cgi_measurements cgi_meas = 2;
|
||||
// EUTRA nearby cell reference signal measurement.
|
||||
optional flex_eutra_ref_signal_meas meas_result = 3;
|
||||
}
|
||||
|
||||
message flex_eutra_cgi_measurements {
|
||||
// EUTRA Cell Global Identity (CGI).
|
||||
optional flex_cell_global_eutra_id cgi = 1;
|
||||
// Tracking area code of the neighbor cell.
|
||||
optional uint32 tracking_area_code = 2;
|
||||
// Public land mobile network identifiers of neighbor cell.
|
||||
repeated flex_plmn_identity plmn_id = 3;
|
||||
}
|
||||
|
||||
message flex_cell_global_eutra_id {
|
||||
// Public land mobile network identifier of neighbor cell.
|
||||
optional flex_plmn_identity plmn_id = 1;
|
||||
// Cell identifier of neighbor cell.
|
||||
optional uint32 cell_id = 2;
|
||||
}
|
||||
|
||||
message flex_plmn_identity {
|
||||
// Mobile Network Code (MNC).
|
||||
repeated uint32 mnc = 1;
|
||||
// Mobile Country Code (MCC).
|
||||
repeated uint32 mcc = 2;
|
||||
// tracking area code
|
||||
repeated uint32 tac = 3;
|
||||
}
|
||||
|
||||
message flex_eutra_ref_signal_meas {
|
||||
// Neighboring Cell RSRP
|
||||
optional int32 rsrp = 1;
|
||||
// Neighboring Cell RSRQ
|
||||
optional int32 rsrq = 2;
|
||||
}
|
||||
|
||||
//
|
||||
// PDCP Statistics
|
||||
//
|
||||
|
||||
message flex_pdcp_stats {
|
||||
|
||||
optional uint32 pkt_tx = 1;
|
||||
optional uint32 pkt_tx_bytes = 2;
|
||||
optional uint32 pkt_tx_sn = 3;
|
||||
optional uint32 pkt_tx_w = 4;
|
||||
optional uint32 pkt_tx_bytes_w = 5;
|
||||
optional uint32 pkt_tx_aiat = 7;
|
||||
optional uint32 pkt_tx_aiat_w = 8;
|
||||
|
||||
optional uint32 pkt_rx = 9;
|
||||
optional uint32 pkt_rx_bytes = 10;
|
||||
optional uint32 pkt_rx_sn = 11;
|
||||
optional uint32 pkt_rx_w = 12;
|
||||
optional uint32 pkt_rx_bytes_w = 13;
|
||||
optional uint32 pkt_rx_aiat = 14;
|
||||
optional uint32 pkt_rx_aiat_w = 15;
|
||||
optional uint32 pkt_rx_oo = 16;
|
||||
|
||||
optional uint64 sfn=17;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ message flex_ue_stats_report {
|
||||
optional flex_dl_cqi_report dl_cqi_report = 7;
|
||||
optional flex_paging_buffer_report pbr = 8;
|
||||
optional flex_ul_cqi_report ul_cqi_report = 9;
|
||||
optional flex_rrc_measurements rrc_measurements = 10;
|
||||
optional flex_pdcp_stats pdcp_stats = 11;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -77,11 +79,15 @@ enum flex_cell_stats_type {
|
||||
// Flags for UE-related statistics
|
||||
enum flex_ue_stats_type {
|
||||
FLUST_BSR = 1;
|
||||
FLUST_PRH = 2;
|
||||
FLUST_PHR = 2;
|
||||
FLUST_RLC_BS = 4;
|
||||
FLUST_MAC_CE_BS = 8;
|
||||
FLUST_DL_CQI = 16;
|
||||
FLUST_PBS = 32;
|
||||
FLUST_UL_CQI = 64;
|
||||
|
||||
FLUST_PDCP_STATS = 1024;
|
||||
FLUST_RRC_MEASUREMENTS = 65536;
|
||||
// To be extended with more types of stats
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ message flex_ul_info {
|
||||
repeated uint32 ul_reception = 2;
|
||||
optional uint32 reception_status = 3;
|
||||
optional uint32 tpc = 4;
|
||||
optional uint32 serv_cell_index = 5;
|
||||
optional uint32 serv_cell_index = 5;
|
||||
optional uint32 rssi = 6;
|
||||
}
|
||||
|
||||
|
||||
+9
-180
@@ -36,10 +36,6 @@
|
||||
#include "common/ran_context.h"
|
||||
|
||||
#include "log.h"
|
||||
#if defined(OAI_EMU)
|
||||
# include "OCG.h"
|
||||
# include "OCG_extern.h"
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
# include "intertask_interface.h"
|
||||
@@ -50,10 +46,6 @@
|
||||
# include "gtpv1u_eNB_task.h"
|
||||
# endif
|
||||
|
||||
#if defined(FLEXRAN_AGENT_SB_IF)
|
||||
# include "flexran_agent.h"
|
||||
#endif
|
||||
|
||||
extern unsigned char NB_eNB_INST;
|
||||
#endif
|
||||
|
||||
@@ -102,102 +94,6 @@ static void configure_rrc(uint32_t enb_id)
|
||||
if (RC.rrc[enb_id]) {
|
||||
RCconfig_RRC(msg_p,enb_id, RC.rrc[enb_id]);
|
||||
|
||||
/*
|
||||
RRC_CONFIGURATION_REQ (msg_p).cell_identity = enb_properties->properties[enb_id]->eNB_id;
|
||||
RRC_CONFIGURATION_REQ (msg_p).tac = enb_properties->properties[enb_id]->tac;
|
||||
RRC_CONFIGURATION_REQ (msg_p).mcc = enb_properties->properties[enb_id]->mcc;
|
||||
RRC_CONFIGURATION_REQ (msg_p).mnc = enb_properties->properties[enb_id]->mnc;
|
||||
RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length = enb_properties->properties[enb_id]->mnc_digit_length;
|
||||
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
RRC_CONFIGURATION_REQ (msg_p).frame_type[CC_id] = enb_properties->properties[enb_id]->frame_type[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).tdd_config[CC_id] = enb_properties->properties[enb_id]->tdd_config[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[CC_id] = enb_properties->properties[enb_id]->tdd_config_s[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).eutra_band[CC_id] = enb_properties->properties[enb_id]->eutra_band[CC_id];
|
||||
|
||||
// RACH-Config
|
||||
RRC_CONFIGURATION_REQ (msg_p).rach_numberOfRA_Preambles[CC_id] = enb_properties->properties[enb_id]->rach_numberOfRA_Preambles[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).rach_preamblesGroupAConfig[CC_id] = enb_properties->properties[enb_id]->rach_preamblesGroupAConfig[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).rach_sizeOfRA_PreamblesGroupA[CC_id] = enb_properties->properties[enb_id]->rach_sizeOfRA_PreamblesGroupA[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[CC_id] = enb_properties->properties[enb_id]->rach_messageSizeGroupA[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[CC_id] = enb_properties->properties[enb_id]->rach_messagePowerOffsetGroupB[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).rach_powerRampingStep[CC_id] = enb_properties->properties[enb_id]->rach_powerRampingStep[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).rach_preambleInitialReceivedTargetPower[CC_id] = enb_properties->properties[enb_id]->rach_preambleInitialReceivedTargetPower[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[CC_id] = enb_properties->properties[enb_id]->rach_preambleTransMax[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).rach_raResponseWindowSize[CC_id] = enb_properties->properties[enb_id]->rach_raResponseWindowSize[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).rach_macContentionResolutionTimer[CC_id] = enb_properties->properties[enb_id]->rach_macContentionResolutionTimer[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).rach_maxHARQ_Msg3Tx[CC_id] = enb_properties->properties[enb_id]->rach_maxHARQ_Msg3Tx[CC_id];
|
||||
|
||||
// BCCH-Config
|
||||
RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[CC_id] = enb_properties->properties[enb_id]->bcch_modificationPeriodCoeff[CC_id];
|
||||
|
||||
// PCCH-Config
|
||||
RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[CC_id] = enb_properties->properties[enb_id]->pcch_defaultPagingCycle[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pcch_nB[CC_id] = enb_properties->properties[enb_id]->pcch_nB[CC_id];
|
||||
|
||||
// PRACH-Config
|
||||
RRC_CONFIGURATION_REQ (msg_p).prach_root[CC_id] = enb_properties->properties[enb_id]->prach_root[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).prach_config_index[CC_id] = enb_properties->properties[enb_id]->prach_config_index[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).prach_high_speed[CC_id] = enb_properties->properties[enb_id]->prach_high_speed[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).prach_zero_correlation[CC_id] = enb_properties->properties[enb_id]->prach_zero_correlation[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).prach_freq_offset[CC_id] = enb_properties->properties[enb_id]->prach_freq_offset[CC_id];
|
||||
|
||||
// PDSCH-Config
|
||||
RRC_CONFIGURATION_REQ (msg_p).pdsch_referenceSignalPower[CC_id] = enb_properties->properties[enb_id]->pdsch_referenceSignalPower[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pdsch_p_b[CC_id] = enb_properties->properties[enb_id]->pdsch_p_b[CC_id];
|
||||
|
||||
// PUSCH-Config
|
||||
RRC_CONFIGURATION_REQ (msg_p).pusch_n_SB[CC_id] = enb_properties->properties[enb_id]->pusch_n_SB[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingMode[CC_id] = enb_properties->properties[enb_id]->pusch_hoppingMode[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingOffset[CC_id] = enb_properties->properties[enb_id]->pusch_hoppingOffset[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pusch_enable64QAM[CC_id] = enb_properties->properties[enb_id]->pusch_enable64QAM[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pusch_groupHoppingEnabled[CC_id] = enb_properties->properties[enb_id]->pusch_groupHoppingEnabled[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pusch_groupAssignment[CC_id] = enb_properties->properties[enb_id]->pusch_groupAssignment[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pusch_sequenceHoppingEnabled[CC_id] = enb_properties->properties[enb_id]->pusch_sequenceHoppingEnabled[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pusch_nDMRS1[CC_id] = enb_properties->properties[enb_id]->pusch_nDMRS1[CC_id];
|
||||
|
||||
// PUCCH-Config
|
||||
|
||||
RRC_CONFIGURATION_REQ (msg_p).pucch_delta_shift[CC_id] = enb_properties->properties[enb_id]->pucch_delta_shift[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pucch_nRB_CQI[CC_id] = enb_properties->properties[enb_id]->pucch_nRB_CQI[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pucch_nCS_AN[CC_id] = enb_properties->properties[enb_id]->pucch_nCS_AN[CC_id];
|
||||
#if !defined(Rel10) && !defined(Rel14)
|
||||
RRC_CONFIGURATION_REQ (msg_p).pucch_n1_AN[CC_id] = enb_properties->properties[enb_id]->pucch_n1_AN[CC_id];
|
||||
#endif
|
||||
|
||||
// SRS Config
|
||||
RRC_CONFIGURATION_REQ (msg_p).srs_enable[CC_id] = enb_properties->properties[enb_id]->srs_enable[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).srs_BandwidthConfig[CC_id] = enb_properties->properties[enb_id]->srs_BandwidthConfig[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).srs_SubframeConfig[CC_id] = enb_properties->properties[enb_id]->srs_SubframeConfig[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).srs_ackNackST[CC_id] = enb_properties->properties[enb_id]->srs_ackNackST[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).srs_MaxUpPts[CC_id] = enb_properties->properties[enb_id]->srs_MaxUpPts[CC_id];
|
||||
|
||||
// uplinkPowerControlCommon
|
||||
|
||||
RRC_CONFIGURATION_REQ (msg_p).pusch_p0_Nominal[CC_id] = enb_properties->properties[enb_id]->pusch_p0_Nominal[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pucch_p0_Nominal[CC_id] = enb_properties->properties[enb_id]->pucch_p0_Nominal[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[CC_id] = enb_properties->properties[enb_id]->pusch_alpha[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[CC_id] = enb_properties->properties[enb_id]->pucch_deltaF_Format1[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[CC_id] = enb_properties->properties[enb_id]->pucch_deltaF_Format1b[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[CC_id] = enb_properties->properties[enb_id]->pucch_deltaF_Format2[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[CC_id] = enb_properties->properties[enb_id]->pucch_deltaF_Format2a[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[CC_id] = enb_properties->properties[enb_id]->pucch_deltaF_Format2b[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).msg3_delta_Preamble[CC_id] = enb_properties->properties[enb_id]->msg3_delta_Preamble[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).ul_CyclicPrefixLength[CC_id] = enb_properties->properties[enb_id]->ul_CyclicPrefixLength[CC_id];
|
||||
|
||||
// UE Timers and Constants
|
||||
|
||||
RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_t300[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_t301[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_t310[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_n310[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_t311[CC_id];
|
||||
RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_n311[CC_id];
|
||||
|
||||
RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[CC_id] = enb_properties->properties[enb_id]->ue_TransmissionMode[CC_id];
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
LOG_I(ENB_APP,"Sending configuration message to RRC task\n");
|
||||
itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
|
||||
@@ -215,9 +111,6 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//,
|
||||
uint32_t register_enb_pending = 0;
|
||||
|
||||
for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
|
||||
# if defined(OAI_EMU)
|
||||
if (oai_emulation.info.cli_start_enb[enb_id] == 1)
|
||||
# endif
|
||||
{
|
||||
s1ap_register_enb_req_t *s1ap_register_eNB;
|
||||
|
||||
@@ -231,44 +124,6 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//,
|
||||
s1ap_register_eNB = &S1AP_REGISTER_ENB_REQ(msg_p);
|
||||
LOG_I(ENB_APP,"default drx %d\n",s1ap_register_eNB->default_drx);
|
||||
|
||||
/*
|
||||
|
||||
s1ap_register_eNB->eNB_id = enb_properties->properties[enb_id]->eNB_id;
|
||||
s1ap_register_eNB->cell_type = enb_properties->properties[enb_id]->cell_type;
|
||||
s1ap_register_eNB->eNB_name = enb_properties->properties[enb_id]->eNB_name;
|
||||
s1ap_register_eNB->tac = enb_properties->properties[enb_id]->tac;
|
||||
s1ap_register_eNB->mcc = enb_properties->properties[enb_id]->mcc;
|
||||
s1ap_register_eNB->mnc = enb_properties->properties[enb_id]->mnc;
|
||||
s1ap_register_eNB->mnc_digit_length = enb_properties->properties[enb_id]->mnc_digit_length;
|
||||
s1ap_register_eNB->default_drx = enb_properties->properties[enb_id]->pcch_defaultPagingCycle[0];
|
||||
|
||||
s1ap_register_eNB->nb_mme = enb_properties->properties[enb_id]->nb_mme;
|
||||
|
||||
AssertFatal (s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS, "Too many MME for eNB %d (%d/%d)!", enb_id, s1ap_register_eNB->nb_mme,
|
||||
S1AP_MAX_NB_MME_IP_ADDRESS);
|
||||
|
||||
for (mme_id = 0; mme_id < s1ap_register_eNB->nb_mme; mme_id++) {
|
||||
s1ap_register_eNB->mme_ip_address[mme_id].ipv4 = enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv4;
|
||||
s1ap_register_eNB->mme_ip_address[mme_id].ipv6 = enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv6;
|
||||
strncpy (s1ap_register_eNB->mme_ip_address[mme_id].ipv4_address,
|
||||
enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv4_address,
|
||||
sizeof(s1ap_register_eNB->mme_ip_address[0].ipv4_address));
|
||||
strncpy (s1ap_register_eNB->mme_ip_address[mme_id].ipv6_address,
|
||||
enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv6_address,
|
||||
sizeof(s1ap_register_eNB->mme_ip_address[0].ipv6_address));
|
||||
}
|
||||
|
||||
s1ap_register_eNB->sctp_in_streams = enb_properties->properties[enb_id]->sctp_in_streams;
|
||||
s1ap_register_eNB->sctp_out_streams = enb_properties->properties[enb_id]->sctp_out_streams;
|
||||
|
||||
|
||||
s1ap_register_eNB->enb_ip_address.ipv6 = 0;
|
||||
s1ap_register_eNB->enb_ip_address.ipv4 = 1;
|
||||
addr.s_addr = enb_properties->properties[enb_id]->enb_ipv4_address_for_S1_MME;
|
||||
str = inet_ntoa(addr);
|
||||
strcpy(s1ap_register_eNB->enb_ip_address.ipv4_address, str);
|
||||
|
||||
*/
|
||||
LOG_I(ENB_APP,"[eNB %d] eNB_app_register for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id));
|
||||
|
||||
itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
|
||||
@@ -295,8 +150,8 @@ void *eNB_app_task(void *args_p)
|
||||
long enb_register_retry_timer_id;
|
||||
# endif
|
||||
uint32_t enb_id;
|
||||
MessageDef *msg_p = NULL;
|
||||
const char *msg_name = NULL;
|
||||
MessageDef *msg_p = NULL;
|
||||
const char *msg_name = NULL;
|
||||
instance_t instance;
|
||||
int result;
|
||||
/* for no gcc warnings */
|
||||
@@ -304,25 +159,16 @@ void *eNB_app_task(void *args_p)
|
||||
|
||||
itti_mark_task_ready (TASK_ENB_APP);
|
||||
|
||||
LOG_I(PHY, "%s() Task ready initialise structures\n", __FUNCTION__);
|
||||
|
||||
RCconfig_L1();
|
||||
|
||||
RCconfig_macrlc();
|
||||
|
||||
LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst);
|
||||
|
||||
if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n");
|
||||
|
||||
# if defined(ENABLE_ITTI)
|
||||
# if defined(OAI_EMU)
|
||||
enb_nb = oai_emulation.info.nb_enb_local;
|
||||
enb_id_start = oai_emulation.info.first_enb_local;
|
||||
enb_id_end = oai_emulation.info.first_enb_local + enb_nb;
|
||||
|
||||
AssertFatal (enb_id_end <= NUMBER_OF_eNB_MAX,
|
||||
"Last eNB index is greater or equal to maximum eNB index (%d/%d)!",
|
||||
enb_id_end, NUMBER_OF_eNB_MAX);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
||||
AssertFatal (enb_nb <= RC.nb_inst,
|
||||
"Number of eNB is greater than eNB defined in configuration file (%d/%d)!",
|
||||
enb_nb, RC.nb_inst);
|
||||
@@ -330,22 +176,14 @@ void *eNB_app_task(void *args_p)
|
||||
LOG_I(ENB_APP,"Allocating eNB_RRC_INST for %d instances\n",RC.nb_inst);
|
||||
|
||||
RC.rrc = (eNB_RRC_INST **)malloc(RC.nb_inst*sizeof(eNB_RRC_INST *));
|
||||
LOG_I(PHY, "%s() RC.nb_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_inst, RC.rrc);
|
||||
|
||||
for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
|
||||
RC.rrc[enb_id] = (eNB_RRC_INST*)malloc(sizeof(eNB_RRC_INST));
|
||||
LOG_I(PHY, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, enb_id, RC.rrc[enb_id], enb_id+1, enb_id_end);
|
||||
memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST));
|
||||
configure_rrc(enb_id);
|
||||
}
|
||||
|
||||
#if defined (FLEXRAN_AGENT_SB_IF)
|
||||
|
||||
for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
|
||||
printf("\n start enb agent %d\n", enb_id);
|
||||
flexran_agent_start(enb_id, enb_properties_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
# if defined(ENABLE_USE_MME)
|
||||
/* Try to register each eNB */
|
||||
@@ -366,6 +204,7 @@ void *eNB_app_task(void *args_p)
|
||||
|
||||
switch (ITTI_MSG_ID(msg_p)) {
|
||||
case TERMINATE_MESSAGE:
|
||||
LOG_W(ENB_APP, " *** Exiting ENB_APP thread\n");
|
||||
itti_exit_task ();
|
||||
break;
|
||||
|
||||
@@ -396,16 +235,6 @@ void *eNB_app_task(void *args_p)
|
||||
msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE);
|
||||
itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p);
|
||||
|
||||
# if defined(OAI_EMU)
|
||||
|
||||
/* Also inform all NAS UE tasks */
|
||||
for (instance = NB_eNB_INST + oai_emulation.info.first_ue_local;
|
||||
instance < (NB_eNB_INST + oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); instance ++) {
|
||||
msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE);
|
||||
itti_send_msg_to_task (TASK_NAS_UE, instance, msg_init_p);
|
||||
}
|
||||
|
||||
# endif
|
||||
} else {
|
||||
uint32_t not_associated = enb_nb - registered_enb;
|
||||
|
||||
|
||||
@@ -30,8 +30,12 @@
|
||||
#ifndef ENB_APP_H_
|
||||
#define ENB_APP_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
void *eNB_app_task(void *args_p);
|
||||
|
||||
/* needed for flexran: start PHY and RRC when restarting */
|
||||
void enb_app_start_phy_rrc(uint32_t enb_id_start, uint32_t enb_id_end);
|
||||
|
||||
#endif /* ENB_APP_H_ */
|
||||
|
||||
+102
-160
@@ -50,15 +50,16 @@
|
||||
#include "sctp_default_values.h"
|
||||
#include "SystemInformationBlockType2.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "LAYER2/MAC/proto.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
|
||||
#include "nfapi_vnf.h"
|
||||
#include "nfapi_pnf.h"
|
||||
|
||||
#include "enb_paramdef.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
|
||||
|
||||
int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc);
|
||||
int RCconfig_S1(MessageDef *msg_p, uint32_t i);
|
||||
|
||||
extern uint16_t sf_ahead;
|
||||
|
||||
static int enb_check_band_frequencies(char* lib_config_file_name_pP,
|
||||
int ind,
|
||||
@@ -101,190 +102,83 @@ static int enb_check_band_frequencies(char* lib_config_file_name_pP,
|
||||
return errors;
|
||||
}
|
||||
|
||||
void RCconfig_flexran()
|
||||
{
|
||||
int i;
|
||||
|
||||
paramdef_t flexranParams[] = FLEXRANPARAMS_DESC;
|
||||
config_get(flexranParams, sizeof(flexranParams)/sizeof(paramdef_t), CONFIG_STRING_NETWORK_CONTROLLER_CONFIG);
|
||||
|
||||
if (!RC.flexran) {
|
||||
RC.flexran = calloc(RC.nb_L1_inst, sizeof(flexran_agent_info_t*));
|
||||
AssertFatal(RC.flexran != NULL,
|
||||
"can't ALLOCATE %zu Bytes for %d flexran agent info with size %zu\n",
|
||||
RC.nb_L1_inst * sizeof(flexran_agent_info_t*),
|
||||
RC.nb_L1_inst, sizeof(flexran_agent_info_t*));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* --------------------------------------------------------*/
|
||||
/* from here function to use configuration module */
|
||||
void RCconfig_RU(void) {
|
||||
|
||||
int j = 0;
|
||||
int i = 0;
|
||||
|
||||
|
||||
paramdef_t RUParams[] = RUPARAMS_DESC;
|
||||
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
|
||||
|
||||
|
||||
config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);
|
||||
|
||||
|
||||
if ( RUParamList.numelt > 0) {
|
||||
|
||||
|
||||
RC.ru = (RU_t**)malloc(RC.nb_RU*sizeof(RU_t*));
|
||||
|
||||
|
||||
|
||||
|
||||
RC.ru_mask=(1<<NB_RU) - 1;
|
||||
printf("Set RU mask to %lx\n",RC.ru_mask);
|
||||
|
||||
for (j = 0; j < RC.nb_RU; j++) {
|
||||
|
||||
RC.ru[j] = (RU_t*)malloc(sizeof(RU_t));
|
||||
memset((void*)RC.ru[j],0,sizeof(RU_t));
|
||||
RC.ru[j]->idx = j;
|
||||
|
||||
RC.ru[j]->if_timing = synch_to_ext_device;
|
||||
if (RC.nb_L1_inst >0)
|
||||
RC.ru[j]->num_eNB = RUParamList.paramarray[j][RU_ENB_LIST_IDX].numelt;
|
||||
else
|
||||
RC.ru[j]->num_eNB = 0;
|
||||
for (i=0;i<RC.ru[j]->num_eNB;i++) RC.ru[j]->eNB_list[i] = RC.eNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]][0];
|
||||
|
||||
if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) {
|
||||
RC.ru[j]->is_slave = 1;
|
||||
}else {
|
||||
RC.ru[j]->is_slave = 0;
|
||||
}
|
||||
|
||||
if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
|
||||
if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
|
||||
RC.ru[j]->if_south = LOCAL_RF;
|
||||
RC.ru[j]->function = eNodeB_3GPP;
|
||||
printf("Setting function for RU %d to eNodeB_3GPP\n",j);
|
||||
}
|
||||
else {
|
||||
RC.ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));
|
||||
RC.ru[j]->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr));
|
||||
RC.ru[j]->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
|
||||
RC.ru[j]->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
|
||||
RC.ru[j]->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
|
||||
RC.ru[j]->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
|
||||
RC.ru[j]->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
|
||||
|
||||
|
||||
if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
|
||||
RC.ru[j]->if_south = LOCAL_RF;
|
||||
RC.ru[j]->function = NGFI_RRU_IF5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE;
|
||||
printf("Setting function for RU %d to NGFI_RRU_IF5 (udp)\n",j);
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
|
||||
RC.ru[j]->if_south = LOCAL_RF;
|
||||
RC.ru[j]->function = NGFI_RRU_IF5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_RAW_MODE;
|
||||
printf("Setting function for RU %d to NGFI_RRU_IF5 (raw)\n",j);
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
|
||||
RC.ru[j]->if_south = LOCAL_RF;
|
||||
RC.ru[j]->function = NGFI_RRU_IF4p5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE;
|
||||
printf("Setting function for RU %d to NGFI_RRU_IF4p5 (udp)\n",j);
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
|
||||
RC.ru[j]->if_south = LOCAL_RF;
|
||||
RC.ru[j]->function = NGFI_RRU_IF4p5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
|
||||
printf("Setting function for RU %d to NGFI_RRU_IF4p5 (raw)\n",j);
|
||||
}
|
||||
}
|
||||
RC.ru[j]->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);;
|
||||
RC.ru[j]->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr);
|
||||
RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt;
|
||||
for (i=0;i<RC.ru[j]->num_bands;i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i];
|
||||
} //strcmp(local_rf, "yes") == 0
|
||||
else {
|
||||
printf("RU %d: Transport %s\n",j,*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr));
|
||||
|
||||
RC.ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));
|
||||
RC.ru[j]->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr));
|
||||
RC.ru[j]->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
|
||||
RC.ru[j]->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
|
||||
RC.ru[j]->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
|
||||
RC.ru[j]->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
|
||||
RC.ru[j]->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
|
||||
if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
|
||||
RC.ru[j]->if_south = REMOTE_IF5;
|
||||
RC.ru[j]->function = NGFI_RAU_IF5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE;
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
|
||||
RC.ru[j]->if_south = REMOTE_IF5;
|
||||
RC.ru[j]->function = NGFI_RAU_IF5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_RAW_MODE;
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
|
||||
RC.ru[j]->if_south = REMOTE_IF4p5;
|
||||
RC.ru[j]->function = NGFI_RAU_IF4p5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE;
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
|
||||
RC.ru[j]->if_south = REMOTE_IF4p5;
|
||||
RC.ru[j]->function = NGFI_RAU_IF4p5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if5_mobipass") == 0) {
|
||||
RC.ru[j]->if_south = REMOTE_IF5;
|
||||
RC.ru[j]->function = NGFI_RAU_IF5;
|
||||
RC.ru[j]->if_timing = synch_to_other;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF5_MOBIPASS;
|
||||
}
|
||||
RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
|
||||
RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
|
||||
} /* strcmp(local_rf, "yes") != 0 */
|
||||
|
||||
RC.ru[j]->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr);
|
||||
RC.ru[j]->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr);
|
||||
|
||||
}// j=0..num_rus
|
||||
} else {
|
||||
RC.nb_RU = 0;
|
||||
} // setting != NULL
|
||||
|
||||
return;
|
||||
|
||||
/* For all agent instance, fill in the same controller configuration. */
|
||||
for (i = 0; i < RC.nb_L1_inst; i++) {
|
||||
RC.flexran[i] = calloc(1, sizeof(flexran_agent_info_t));
|
||||
AssertFatal(RC.flexran[i] != NULL,
|
||||
"can't ALLOCATE %zu Bytes for flexran agent info (iteration %d/%d)\n",
|
||||
sizeof(flexran_agent_info_t), i + 1, RC.nb_L1_inst);
|
||||
/* if config says "yes", enable Agent, in all other cases it's like "no" */
|
||||
RC.flexran[i]->enabled = strcmp(*(flexranParams[FLEXRAN_ENABLED].strptr), "yes") == 0;
|
||||
RC.flexran[i]->interface_name = strdup(*(flexranParams[FLEXRAN_INTERFACE_NAME_IDX].strptr));
|
||||
//inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN);
|
||||
RC.flexran[i]->remote_ipv4_addr = strdup(*(flexranParams[FLEXRAN_IPV4_ADDRESS_IDX].strptr));
|
||||
RC.flexran[i]->remote_port = *(flexranParams[FLEXRAN_PORT_IDX].uptr);
|
||||
RC.flexran[i]->cache_name = strdup(*(flexranParams[FLEXRAN_CACHE_IDX].strptr));
|
||||
RC.flexran[i]->node_ctrl_state = strcmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0 ? ENB_WAIT : ENB_NORMAL_OPERATION;
|
||||
RC.flexran[i]->enb_id = i;
|
||||
}
|
||||
}
|
||||
|
||||
void RCconfig_L1() {
|
||||
void RCconfig_L1(void) {
|
||||
int i,j;
|
||||
paramdef_t L1_Params[] = L1PARAMS_DESC;
|
||||
paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST,NULL,0};
|
||||
|
||||
|
||||
config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL);
|
||||
if (RC.eNB == NULL) {
|
||||
RC.eNB = (PHY_VARS_eNB ***)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB**));
|
||||
LOG_I(PHY,"RC.eNB = %p\n",RC.eNB);
|
||||
memset(RC.eNB,0,(1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB**));
|
||||
RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int));
|
||||
}
|
||||
|
||||
config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL);
|
||||
if (L1_ParamList.numelt > 0) {
|
||||
|
||||
if (RC.eNB == NULL) {
|
||||
RC.eNB = (PHY_VARS_eNB ***)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
|
||||
LOG_I(PHY,"RC.eNB = %p\n",RC.eNB);
|
||||
memset(RC.eNB,0,(1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
|
||||
RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int));
|
||||
}
|
||||
|
||||
for (j = 0; j < RC.nb_L1_inst; j++) {
|
||||
RC.nb_L1_CC[j] = *(L1_ParamList.paramarray[j][L1_CC_IDX].uptr);
|
||||
|
||||
|
||||
if (RC.eNB[j] == NULL) {
|
||||
RC.eNB[j] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB**));
|
||||
RC.eNB[j] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB*));
|
||||
LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]);
|
||||
memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB***));
|
||||
memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB*));
|
||||
}
|
||||
|
||||
|
||||
for (i=0;i<RC.nb_L1_CC[j];i++) {
|
||||
if (RC.eNB[j][i] == NULL) {
|
||||
RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
|
||||
memset((void*)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB));
|
||||
LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]);
|
||||
RC.eNB[j][i]->Mod_id = j;
|
||||
RC.eNB[j][i]->CC_id = i;
|
||||
}
|
||||
if (RC.eNB[j][i] == NULL) {
|
||||
RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
|
||||
memset((void*)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB));
|
||||
LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]);
|
||||
RC.eNB[j][i]->Mod_id = j;
|
||||
RC.eNB[j][i]->CC_id = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
|
||||
|
||||
sf_ahead = 4; // Need 4 subframe gap between RX and TX
|
||||
}
|
||||
else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
|
||||
RC.eNB[j][0]->eth_params_n.local_if_name = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
|
||||
RC.eNB[j][0]->eth_params_n.local_if_name = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
|
||||
RC.eNB[j][0]->eth_params_n.my_addr = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr));
|
||||
RC.eNB[j][0]->eth_params_n.remote_addr = strdup(*(L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr));
|
||||
RC.eNB[j][0]->eth_params_n.my_portc = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr);
|
||||
@@ -292,6 +186,24 @@ void RCconfig_L1() {
|
||||
RC.eNB[j][0]->eth_params_n.my_portd = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr);
|
||||
RC.eNB[j][0]->eth_params_n.remote_portd = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr);
|
||||
RC.eNB[j][0]->eth_params_n.transp_preference = ETH_UDP_MODE;
|
||||
|
||||
sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
|
||||
|
||||
RC.nb_macrlc_inst = 1; // This is used by mac_top_init_eNB()
|
||||
|
||||
// This is used by init_eNB_afterRU()
|
||||
RC.nb_CC = (int *)malloc((1+RC.nb_inst)*sizeof(int));
|
||||
RC.nb_CC[0]=1;
|
||||
|
||||
RC.nb_inst =1; // DJP - feptx_prec uses num_eNB but phy_init_RU uses nb_inst
|
||||
|
||||
LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_inst=1 this is because phy_init_RU() uses that to index and not RC.num_eNB - why the 2 similar variables?\n", __FUNCTION__);
|
||||
LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_CC[0]=%d for init_eNB_afterRU()\n", __FUNCTION__, RC.nb_CC[0]);
|
||||
LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_macrlc_inst:%d because used by mac_top_init_eNB()\n", __FUNCTION__, RC.nb_macrlc_inst);
|
||||
|
||||
mac_top_init_eNB();
|
||||
|
||||
configure_nfapi_pnf(RC.eNB[j][0]->eth_params_n.remote_addr, RC.eNB[j][0]->eth_params_n.remote_portc, RC.eNB[j][0]->eth_params_n.my_addr, RC.eNB[j][0]->eth_params_n.my_portd, RC.eNB[j][0]->eth_params_n .remote_portd);
|
||||
}
|
||||
|
||||
else { // other midhaul
|
||||
@@ -301,6 +213,30 @@ void RCconfig_L1() {
|
||||
l1_north_init_eNB();
|
||||
} else {
|
||||
LOG_I(PHY,"No " CONFIG_STRING_L1_LIST " configuration found");
|
||||
|
||||
// DJP need to create some structures for VNF
|
||||
|
||||
j = 0;
|
||||
|
||||
RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int)); // DJP - 1 lot then???
|
||||
|
||||
RC.nb_L1_CC[j]=1; // DJP - hmmm
|
||||
|
||||
if (RC.eNB[j] == NULL) {
|
||||
RC.eNB[j] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB**));
|
||||
LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]);
|
||||
memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB***));
|
||||
}
|
||||
|
||||
for (i=0;i<RC.nb_L1_CC[j];i++) {
|
||||
if (RC.eNB[j][i] == NULL) {
|
||||
RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
|
||||
memset((void*)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB));
|
||||
LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]);
|
||||
RC.eNB[j][i]->Mod_id = j;
|
||||
RC.eNB[j][i]->CC_id = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,6 +284,12 @@ void RCconfig_macrlc() {
|
||||
RC.mac[j]->eth_params_s.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTD_IDX].iptr);
|
||||
RC.mac[j]->eth_params_s.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
|
||||
RC.mac[j]->eth_params_s.transp_preference = ETH_UDP_MODE;
|
||||
|
||||
sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
|
||||
|
||||
printf("**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
|
||||
configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc);
|
||||
printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
|
||||
} else { // other midhaul
|
||||
AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
|
||||
}
|
||||
@@ -430,7 +372,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
|
||||
int32_t rach_powerRampingStep = 0;
|
||||
int32_t rach_preambleInitialReceivedTargetPower = 0;
|
||||
int32_t rach_preambleTransMax = 0;
|
||||
int32_t rach_raResponseWindowSize = 0;
|
||||
int32_t rach_raResponseWindowSize = 10;
|
||||
int32_t rach_macContentionResolutionTimer = 0;
|
||||
int32_t rach_maxHARQ_Msg3Tx = 0;
|
||||
int32_t pcch_defaultPagingCycle = 0;
|
||||
|
||||
@@ -94,6 +94,7 @@ typedef struct ru_config_s {
|
||||
} ru_config_t;
|
||||
|
||||
extern void RCconfig_RU(void);
|
||||
extern void RCconfig_flexran(void);
|
||||
extern void RCconfig_L1(void);
|
||||
extern void RCconfig_macrlc(void);
|
||||
extern int RCconfig_gtpu(void );
|
||||
|
||||
@@ -613,18 +613,29 @@ static int DEFENBS[] = {0};
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG "NETWORK_CONTROLLER"
|
||||
#define CONFIG_STRING_NETWORK_CONTROLLER_CONFIG "NETWORK_CONTROLLER"
|
||||
|
||||
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME "FLEXRAN_AGENT_INTERFACE_NAME"
|
||||
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS "FLEXRAN_AGENT_IPV4_ADDRESS"
|
||||
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT "FLEXRAN_AGENT_PORT"
|
||||
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE "FLEXRAN_AGENT_CACHE"
|
||||
#define CONFIG_STRING_FLEXRAN_ENABLED "FLEXRAN_ENABLED"
|
||||
#define CONFIG_STRING_FLEXRAN_INTERFACE_NAME "FLEXRAN_INTERFACE_NAME"
|
||||
#define CONFIG_STRING_FLEXRAN_IPV4_ADDRESS "FLEXRAN_IPV4_ADDRESS"
|
||||
#define CONFIG_STRING_FLEXRAN_PORT "FLEXRAN_PORT"
|
||||
#define CONFIG_STRING_FLEXRAN_CACHE "FLEXRAN_CACHE"
|
||||
#define CONFIG_STRING_FLEXRAN_AWAIT_RECONF "FLEXRAN_AWAIT_RECONF"
|
||||
|
||||
#define FLEXRAN_ENABLED 0
|
||||
#define FLEXRAN_INTERFACE_NAME_IDX 1
|
||||
#define FLEXRAN_IPV4_ADDRESS_IDX 2
|
||||
#define FLEXRAN_PORT_IDX 3
|
||||
#define FLEXRAN_CACHE_IDX 4
|
||||
#define FLEXRAN_AWAIT_RECONF_IDX 5
|
||||
|
||||
#define FLEXRANPARAMS_DESC { \
|
||||
{ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME, NULL, 0, uptr:NULL, defstrval:ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE, TYPE_STRING, 0}, \
|
||||
{ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS, NULL, 0, uptr:NULL, defstrval:ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE, TYPE_STRING, 0}, \
|
||||
{ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT, NULL, 0, uptr:NULL, defstrval:ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE, TYPE_STRING, 0}, \
|
||||
{ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE, NULL, 0, uptr:NULL, defstrval:ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE, TYPE_STRING, 0} \
|
||||
{CONFIG_STRING_FLEXRAN_ENABLED, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \
|
||||
{CONFIG_STRING_FLEXRAN_INTERFACE_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \
|
||||
{CONFIG_STRING_FLEXRAN_IPV4_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
|
||||
{CONFIG_STRING_FLEXRAN_PORT, NULL, 0, uptr:NULL, defintval:2210, TYPE_UINT, 0}, \
|
||||
{CONFIG_STRING_FLEXRAN_CACHE, NULL, 0, strptr:NULL, defstrval:"/mnt/oai_agent_cache", TYPE_STRING, 0}, \
|
||||
{CONFIG_STRING_FLEXRAN_AWAIT_RECONF, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0} \
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -21,35 +21,15 @@
|
||||
|
||||
/*! \file flexran_agent.h
|
||||
* \brief top level flexran agent receive thread and itti task
|
||||
* \author Xenofon Foukas and Navid Nikaein
|
||||
* \date 2016
|
||||
* \author Xenofon Foukas and Navid Nikaein and shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#include "flexran_agent_common.h"
|
||||
#include "log.h"
|
||||
#include "flexran_agent.h"
|
||||
#include "flexran_agent_mac_defs.h"
|
||||
#include "flexran_agent_mac.h"
|
||||
#include "flexran_agent_mac_internal.h"
|
||||
|
||||
#include "flexran_agent_extern.h"
|
||||
|
||||
#include "assertions.h"
|
||||
|
||||
#include "flexran_agent_net_comm.h"
|
||||
#include "flexran_agent_async.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
//#define TEST_TIMER
|
||||
|
||||
flexran_agent_instance_t flexran_agent[NUM_MAX_ENB];
|
||||
|
||||
char in_ip[40];
|
||||
static uint16_t in_port;
|
||||
char local_cache[40];
|
||||
|
||||
void *send_thread(void *args);
|
||||
void *receive_thread(void *args);
|
||||
pthread_t new_thread(void *(*f)(void *), void *b);
|
||||
@@ -63,7 +43,7 @@ int agent_task_created = 0;
|
||||
*/
|
||||
void *flexran_agent_task(void *args){
|
||||
|
||||
//flexran_agent_instance_t *d = (flexran_agent_instance_t *) args;
|
||||
//flexran_agent_info_t *d = (flexran_agent_info_t *) args;
|
||||
Protocol__FlexranMessage *msg;
|
||||
void *data;
|
||||
int size;
|
||||
@@ -85,6 +65,7 @@ void *flexran_agent_task(void *args){
|
||||
|
||||
switch (ITTI_MSG_ID(msg_p)) {
|
||||
case TERMINATE_MESSAGE:
|
||||
LOG_W(FLEXRAN_AGENT, " *** Exiting FLEXRAN thread\n");
|
||||
itti_exit_task ();
|
||||
break;
|
||||
|
||||
@@ -123,7 +104,7 @@ void *flexran_agent_task(void *args){
|
||||
|
||||
void *receive_thread(void *args) {
|
||||
|
||||
flexran_agent_instance_t *d = args;
|
||||
flexran_agent_info_t *d = args;
|
||||
void *data;
|
||||
int size;
|
||||
int priority;
|
||||
@@ -197,38 +178,25 @@ pthread_t new_thread(void *(*f)(void *), void *b) {
|
||||
}
|
||||
|
||||
int channel_container_init = 0;
|
||||
int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){
|
||||
|
||||
int flexran_agent_start(mid_t mod_id)
|
||||
{
|
||||
flexran_agent_info_t *flexran = RC.flexran[mod_id];
|
||||
int channel_id;
|
||||
|
||||
flexran_set_enb_vars(mod_id, RAN_LTE_OAI);
|
||||
flexran_agent[mod_id].enb_id = mod_id;
|
||||
|
||||
/*
|
||||
* check the configuration
|
||||
*/
|
||||
if (enb_properties->properties[mod_id]->flexran_agent_cache != NULL) {
|
||||
strncpy(local_cache, enb_properties->properties[mod_id]->flexran_agent_cache, sizeof(local_cache));
|
||||
local_cache[sizeof(local_cache) - 1] = 0;
|
||||
} else {
|
||||
strcpy(local_cache, DEFAULT_FLEXRAN_AGENT_CACHE);
|
||||
char *in_ip = flexran->remote_ipv4_addr;
|
||||
uint16_t in_port = flexran->remote_port;
|
||||
|
||||
/* if this agent is disabled, return and don't do anything */
|
||||
if (!flexran->enabled) {
|
||||
LOG_I(FLEXRAN_AGENT, "FlexRAN Agent for eNB %d is DISABLED\n", mod_id);
|
||||
return 100;
|
||||
}
|
||||
|
||||
if (enb_properties->properties[mod_id]->flexran_agent_ipv4_address != 0) {
|
||||
inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN);
|
||||
} else {
|
||||
strcpy(in_ip, DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS );
|
||||
}
|
||||
|
||||
if (enb_properties->properties[mod_id]->flexran_agent_port != 0 ) {
|
||||
in_port = enb_properties->properties[mod_id]->flexran_agent_port;
|
||||
} else {
|
||||
in_port = DEFAULT_FLEXRAN_AGENT_PORT ;
|
||||
}
|
||||
LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n",
|
||||
flexran_agent[mod_id].enb_id,
|
||||
in_ip,
|
||||
in_port);
|
||||
flexran->enb_id = mod_id;
|
||||
/* assume for the moment the monolithic case, i.e. agent can provide
|
||||
* information for all layers */
|
||||
flexran->capability_mask = FLEXRAN_CAP_LOL1 | FLEXRAN_CAP_HIL1
|
||||
| FLEXRAN_CAP_LOL2 | FLEXRAN_CAP_HIL2
|
||||
| FLEXRAN_CAP_PDCP | FLEXRAN_CAP_RRC;
|
||||
|
||||
/*
|
||||
* Initialize the channel container
|
||||
@@ -264,10 +232,10 @@ int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properti
|
||||
*flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAC);
|
||||
*/
|
||||
|
||||
/*Initialize the continuous MAC stats update mechanism*/
|
||||
flexran_agent_init_cont_mac_stats_update(mod_id);
|
||||
/*Initialize the continuous stats update mechanism*/
|
||||
flexran_agent_init_cont_stats_update(mod_id);
|
||||
|
||||
new_thread(receive_thread, &flexran_agent[mod_id]);
|
||||
new_thread(receive_thread, flexran);
|
||||
|
||||
/*Initialize and register the mac xface. Must be modified later
|
||||
*for more flexibility in agent management */
|
||||
@@ -275,6 +243,12 @@ int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properti
|
||||
AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface));
|
||||
flexran_agent_register_mac_xface(mod_id, mac_agent_xface);
|
||||
|
||||
AGENT_RRC_xface *rrc_agent_xface = (AGENT_RRC_xface *) malloc(sizeof(AGENT_RRC_xface));
|
||||
flexran_agent_register_rrc_xface(mod_id, rrc_agent_xface);
|
||||
|
||||
AGENT_PDCP_xface *pdcp_agent_xface = (AGENT_PDCP_xface *) malloc(sizeof(AGENT_PDCP_xface));
|
||||
flexran_agent_register_pdcp_xface(mod_id, pdcp_agent_xface);
|
||||
|
||||
/*
|
||||
* initilize a timer
|
||||
*/
|
||||
@@ -290,14 +264,34 @@ int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properti
|
||||
* start the enb agent task for tx and interaction with the underlying network function
|
||||
*/
|
||||
if (!agent_task_created) {
|
||||
if (itti_create_task (TASK_FLEXRAN_AGENT, flexran_agent_task, (void *) &flexran_agent[mod_id]) < 0) {
|
||||
if (itti_create_task (TASK_FLEXRAN_AGENT, flexran_agent_task, flexran) < 0) {
|
||||
LOG_E(FLEXRAN_AGENT, "Create task for FlexRAN Agent failed\n");
|
||||
return -1;
|
||||
}
|
||||
agent_task_created = 1;
|
||||
}
|
||||
|
||||
LOG_I(FLEXRAN_AGENT,"client ends\n");
|
||||
|
||||
pthread_mutex_init(&flexran->mutex_node_ctrl, NULL);
|
||||
pthread_cond_init(&flexran->cond_node_ctrl, NULL);
|
||||
|
||||
if (flexran->node_ctrl_state == ENB_WAIT) {
|
||||
/* wait three seconds before showing message and waiting "for real".
|
||||
* This way, the message is (hopefully...) the last one and the user knows
|
||||
* what is happening. If the controller sends a reconfiguration message in
|
||||
* the meantime, the softmodem will never wait */
|
||||
sleep(3);
|
||||
LOG_I(ENB_APP, " * eNB %d: Waiting for FlexRAN RTController command *\n", mod_id);
|
||||
pthread_mutex_lock(&flexran->mutex_node_ctrl);
|
||||
while (ENB_NORMAL_OPERATION != flexran->node_ctrl_state)
|
||||
pthread_cond_wait(&flexran->cond_node_ctrl, &flexran->mutex_node_ctrl);
|
||||
pthread_mutex_unlock(&flexran->mutex_node_ctrl);
|
||||
|
||||
/* reconfigure RRC again, the agent might have changed the configuration */
|
||||
MessageDef *msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ);
|
||||
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[mod_id]->configuration;
|
||||
itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg_p);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
|
||||
@@ -22,20 +22,28 @@
|
||||
/*! \file flexran_agent.h
|
||||
* \brief top level flexran agent
|
||||
* \author Navid Nikaein and Xenofon Foukas
|
||||
* \date 2016
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#ifndef FLEXRAN_AGENT_H_
|
||||
#define FLEXRAN_AGENT_H_
|
||||
|
||||
#include "enb_config.h" // for enb properties
|
||||
#include "flexran_agent_common.h"
|
||||
#include "flexran_agent_async.h"
|
||||
#include "flexran_agent_extern.h"
|
||||
#include "flexran_agent_timer.h"
|
||||
#include "flexran_agent_defs.h"
|
||||
#include "flexran_agent_net_comm.h"
|
||||
#include "flexran_agent_ran_api.h"
|
||||
#include "flexran_agent_mac.h"
|
||||
#include "flexran_agent_rrc.h"
|
||||
#include "flexran_agent_pdcp.h"
|
||||
#include "log.h"
|
||||
#include "assertions.h"
|
||||
|
||||
|
||||
/* Initiation and termination of the eNodeB agent */
|
||||
int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties);
|
||||
int flexran_agent_stop(mid_t mod_id);
|
||||
/* Initiation of the eNodeB agent */
|
||||
int flexran_agent_start(mid_t mod_id);
|
||||
|
||||
/*
|
||||
* enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller
|
||||
|
||||
@@ -68,12 +68,12 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c
|
||||
|
||||
error:
|
||||
LOG_I(FLEXRAN_AGENT,"there was an error\n");
|
||||
return 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int flexran_agent_async_msg_send(void *data, int size, int priority, void *channel_info) {
|
||||
flexran_agent_async_channel_t *channel;
|
||||
channel = (flexran_agent_channel_t *)channel_info;
|
||||
channel = (flexran_agent_async_channel_t *)channel_info;
|
||||
|
||||
return message_put(channel->send_queue, data, size, priority);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -21,8 +21,8 @@
|
||||
|
||||
/*! \file flexran_agent_common.h
|
||||
* \brief common message primitves and utilities
|
||||
* \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein
|
||||
* \date 2016
|
||||
* \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein and shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
#include "flexran.pb-c.h"
|
||||
#include "stats_messages.pb-c.h"
|
||||
#include "stats_common.pb-c.h"
|
||||
|
||||
#include "flexran_agent_ran_api.h"
|
||||
#include "flexran_agent_net_comm.h"
|
||||
#include "flexran_agent_defs.h"
|
||||
#include "enb_config.h"
|
||||
|
||||
@@ -60,6 +61,19 @@ typedef int (*flexran_agent_message_destruction_callback)(
|
||||
Protocol__FlexranMessage *msg
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
|
||||
uint8_t is_initialized;
|
||||
volatile uint8_t cont_update;
|
||||
xid_t xid;
|
||||
Protocol__FlexranMessage *stats_req;
|
||||
Protocol__FlexranMessage *prev_stats_reply;
|
||||
|
||||
pthread_mutex_t *mutex;
|
||||
} stats_updates_context_t;
|
||||
|
||||
stats_updates_context_t stats_context[NUM_MAX_ENB];
|
||||
|
||||
/**********************************
|
||||
* FlexRAN protocol messages helper
|
||||
* functions and generic handlers
|
||||
@@ -116,10 +130,6 @@ int flexran_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg);
|
||||
/* TODO: Need to define and implement destructor */
|
||||
int flexran_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg);
|
||||
|
||||
/* UE state change message constructor and destructor */
|
||||
int flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change);
|
||||
int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg);
|
||||
|
||||
/* Control delegation message constructor and destructor */
|
||||
int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
|
||||
int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg);
|
||||
@@ -128,6 +138,11 @@ int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg);
|
||||
int flexran_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
|
||||
int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg);
|
||||
|
||||
/* rrc triggering measurement message constructor and destructor */
|
||||
int flexran_agent_rrc_measurement(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
|
||||
int flexran_agent_destroy_rrc_measurement(Protocol__FlexranMessage *msg);
|
||||
|
||||
|
||||
/* FlexRAN protocol message dispatcher function */
|
||||
Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id,
|
||||
uint8_t *data,
|
||||
@@ -136,367 +151,21 @@ Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id,
|
||||
/* Function to be used to send a message to a dispatcher once the appropriate event is triggered. */
|
||||
Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args);
|
||||
|
||||
/*Top level Statistics hanlder*/
|
||||
int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
|
||||
|
||||
/* Function to be used to handle reply message . */
|
||||
int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg);
|
||||
|
||||
/* Top level Statistics request protocol message constructor and destructor */
|
||||
int flexran_agent_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg);
|
||||
int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg);
|
||||
|
||||
/****************************
|
||||
* get generic info from RAN
|
||||
****************************/
|
||||
err_code_t flexran_agent_init_cont_stats_update(mid_t mod_id);
|
||||
|
||||
void flexran_set_enb_vars(mid_t mod_id, ran_name_t ran);
|
||||
|
||||
int flexran_get_current_time_ms (mid_t mod_id, int subframe_flag);
|
||||
|
||||
/*Return the current frame number
|
||||
*Could be using implementation specific numbering of frames
|
||||
*/
|
||||
unsigned int flexran_get_current_frame(mid_t mod_id);
|
||||
|
||||
/*Return the current SFN (0-1023)*/
|
||||
unsigned int flexran_get_current_system_frame_num(mid_t mod_id);
|
||||
|
||||
unsigned int flexran_get_current_subframe(mid_t mod_id);
|
||||
|
||||
/*Return the frame and subframe number in compact 16-bit format.
|
||||
Bits 0-3 subframe, rest for frame. Required by FlexRAN protocol*/
|
||||
uint16_t flexran_get_sfn_sf (mid_t mod_id);
|
||||
|
||||
/* Return a future frame and subframe number that is ahead_of_time
|
||||
subframes later in compact 16-bit format. Bits 0-3 subframe,
|
||||
rest for frame */
|
||||
uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time);
|
||||
|
||||
/* Return the number of attached UEs */
|
||||
int flexran_get_num_ues(mid_t mod_id);
|
||||
|
||||
/* Get the rnti of a UE with id ue_id */
|
||||
int flexran_get_ue_crnti (mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get the RLC buffer status report of a ue for a designated
|
||||
logical channel id */
|
||||
int flexran_get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid);
|
||||
|
||||
/* Get power headroom of UE with id ue_id */
|
||||
int flexran_get_ue_phr (mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get the UE wideband CQI */
|
||||
int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get the transmission queue size for a UE with a channel_id logical channel id */
|
||||
int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
|
||||
|
||||
/* Get the head of line delay for a UE with a channel_id logical channel id */
|
||||
int flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
|
||||
|
||||
/* Check the status of the timing advance for a UE */
|
||||
short flexran_get_TA(mid_t mod_id, mid_t ue_id, int CC_id);
|
||||
|
||||
/* Update the timing advance status (find out whether a timing advance command is required) */
|
||||
void flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id);
|
||||
|
||||
/* Return timing advance MAC control element for a designated cell and UE */
|
||||
int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id);
|
||||
|
||||
/* Get the number of active component carriers for a specific UE */
|
||||
int flexran_get_active_CC(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get the rank indicator for a designated cell and UE */
|
||||
int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id);
|
||||
|
||||
/* See TS 36.213, section 10.1 */
|
||||
int flexran_get_n1pucch_an(mid_t mod_id, int CC_id);
|
||||
|
||||
/* See TS 36.211, section 5.4 */
|
||||
int flexran_get_nRB_CQI(mid_t mod_id, int CC_id);
|
||||
|
||||
/* See TS 36.211, section 5.4 */
|
||||
int flexran_get_deltaPUCCH_Shift(mid_t mod_id, int CC_id);
|
||||
|
||||
/* See TS 36.211, section 5.7.1 */
|
||||
int flexran_get_prach_ConfigIndex(mid_t mod_id, int CC_id);
|
||||
|
||||
/* See TS 36.211, section 5.7.1 */
|
||||
int flexran_get_prach_FreqOffset(mid_t mod_id, int CC_id);
|
||||
|
||||
/* See TS 36.321 */
|
||||
int flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Get the length of the UL cyclic prefix */
|
||||
int flexran_get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Get the length of the DL cyclic prefix */
|
||||
int flexran_get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Get the physical cell id of a cell */
|
||||
int flexran_get_cell_id(mid_t mod_id, int CC_id);
|
||||
|
||||
/* See TS 36.211, section 5.5.3.2 */
|
||||
int flexran_get_srs_BandwidthConfig(mid_t mod_id, int CC_id);
|
||||
|
||||
/* See TS 36.211, table 5.5.3.3-1 and 2 */
|
||||
int flexran_get_srs_SubframeConfig(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Boolean value. See TS 36.211,
|
||||
section 5.5.3.2. TDD only */
|
||||
int flexran_get_srs_MaxUpPts(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Get number of DL resource blocks */
|
||||
int flexran_get_N_RB_DL(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Get number of UL resource blocks */
|
||||
int flexran_get_N_RB_UL(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Get number of resource block groups */
|
||||
int flexran_get_N_RBG(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Get DL/UL subframe assignment. TDD only */
|
||||
int flexran_get_subframe_assignment(mid_t mod_id, int CC_id);
|
||||
|
||||
/* TDD only. See TS 36.211, table 4.2.1 */
|
||||
int flexran_get_special_subframe_assignment(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Get the duration of the random access response window in subframes */
|
||||
int flexran_get_ra_ResponseWindowSize(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Get timer used for random access */
|
||||
int flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Get type of duplex mode (FDD/TDD) */
|
||||
int flexran_get_duplex_mode(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Get the SI window length */
|
||||
long flexran_get_si_window_length(mid_t mod_id, int CC_id);
|
||||
|
||||
/* Get the number of PDCCH symbols configured for the cell */
|
||||
int flexran_get_num_pdcch_symb(mid_t mod_id, int CC_id);
|
||||
|
||||
/* See TS 36.213, sec 5.1.1.1 */
|
||||
int flexran_get_tpc(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get the first available HARQ process for a specific cell and UE during
|
||||
a designated frame and subframe. Returns 0 for success. The id and the
|
||||
status of the HARQ process are stored in id and status respectively */
|
||||
int flexran_get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id,
|
||||
const int frame, const uint8_t subframe, unsigned char *id, unsigned char *round);
|
||||
|
||||
/* Uplink power control management*/
|
||||
int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id);
|
||||
|
||||
int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id);
|
||||
|
||||
int flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, int CC_id);
|
||||
|
||||
int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, int CC_id);
|
||||
|
||||
|
||||
/*
|
||||
* ************************************
|
||||
* Get Messages for UE Configuration Reply
|
||||
* ************************************
|
||||
*/
|
||||
|
||||
/* Get timer in subframes. Controls the synchronization
|
||||
status of the UE, not the actual timing
|
||||
advance procedure. See TS 36.321 */
|
||||
int flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get measurement gap configuration. See TS 36.133 */
|
||||
int flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get measurement gap configuration offset if applicable */
|
||||
int flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* DL aggregated bit-rate of non-gbr bearer
|
||||
per UE. See TS 36.413 */
|
||||
int flexran_get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* UL aggregated bit-rate of non-gbr bearer
|
||||
per UE. See TS 36.413 */
|
||||
int flexran_get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Only half-duplex support. FDD
|
||||
operation. Boolean value */
|
||||
int flexran_get_half_duplex(mid_t ue_id);
|
||||
|
||||
/* Support of intra-subframe hopping.
|
||||
Boolean value */
|
||||
int flexran_get_intra_sf_hopping(mid_t ue_id);
|
||||
|
||||
/* UE support for type 2 hopping with
|
||||
n_sb>1 */
|
||||
int flexran_get_type2_sb_1(mid_t ue_id);
|
||||
|
||||
/* Get the UE category */
|
||||
int flexran_get_ue_category(mid_t ue_id);
|
||||
|
||||
/* UE support for resource allocation
|
||||
type 1 */
|
||||
int flexran_get_res_alloc_type1(mid_t ue_id);
|
||||
|
||||
/* Get UE transmission mode */
|
||||
int flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Boolean value. See TS 36.321 */
|
||||
int flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* The max HARQ retransmission for UL.
|
||||
See TS 36.321 */
|
||||
int flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* See TS 36.213 */
|
||||
int flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* See TS 36.213 */
|
||||
int flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* See TS 36.213 */
|
||||
int flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Boolean. See TS36.213, Section 10.1 */
|
||||
int flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Boolean. See TS 36.213, Section 8.2 */
|
||||
int flexran_get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id);
|
||||
|
||||
/* Get aperiodic CQI report mode */
|
||||
int flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id);
|
||||
|
||||
/* Get ACK/NACK feedback mode. TDD only */
|
||||
int flexran_get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* See TS36.213, section 10.1 */
|
||||
int flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Boolean. Extended buffer status report size */
|
||||
int flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get number of UE transmission antennas */
|
||||
int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get logical channel group of a channel with id lc_id */
|
||||
int flexran_get_lcg(mid_t ue_id, mid_t lc_id);
|
||||
|
||||
/* Get direction of logical channel with id lc_id */
|
||||
int flexran_get_direction(mid_t ue_id, mid_t lc_id);
|
||||
|
||||
/*******************
|
||||
* timer primitves
|
||||
*******************/
|
||||
|
||||
#define TIMER_NULL -1
|
||||
#define TIMER_TYPE_INVALIDE -2
|
||||
#define TIMER_SETUP_FAILED -3
|
||||
#define TIMER_REMOVED_FAILED -4
|
||||
#define TIMER_ELEMENT_NOT_FOUND -5
|
||||
|
||||
|
||||
/* Type of the callback executed when the timer expired */
|
||||
typedef Protocol__FlexranMessage *(*flexran_agent_timer_callback_t)(void*);
|
||||
|
||||
typedef enum {
|
||||
/* oneshot timer: */
|
||||
FLEXRAN_AGENT_TIMER_TYPE_ONESHOT = 0x0,
|
||||
|
||||
/* periodic timer */
|
||||
FLEXRAN_AGENT_TIMER_TYPE_PERIODIC = 0x1,
|
||||
|
||||
/* Inactive state: initial state for any timer. */
|
||||
FLEXRAN_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2,
|
||||
|
||||
/* Max number of states available */
|
||||
FLEXRAN_AGENT_TIMER_TYPE_MAX,
|
||||
} flexran_agent_timer_type_t;
|
||||
|
||||
typedef enum {
|
||||
/* Inactive state: initial state for any timer. */
|
||||
FLEXRAN_AGENT_TIMER_STATE_INACTIVE = 0x0,
|
||||
|
||||
/* Inactive state: initial state for any timer. */
|
||||
FLEXRAN_AGENT_TIMER_STATE_ACTIVE = 0x1,
|
||||
|
||||
/* Inactive state: initial state for any timer. */
|
||||
FLEXRAN_AGENT_TIMER_STATE_STOPPED = 0x2,
|
||||
|
||||
/* Max number of states available */
|
||||
FLEXRAN_AGENT_TIMER_STATE_MAX,
|
||||
} flexran_agent_timer_state_t;
|
||||
|
||||
typedef struct flexran_agent_timer_args_s{
|
||||
mid_t mod_id;
|
||||
Protocol__FlexranMessage *msg;
|
||||
} flexran_agent_timer_args_t;
|
||||
|
||||
|
||||
|
||||
typedef struct flexran_agent_timer_element_s{
|
||||
RB_ENTRY(flexran_agent_timer_element_s) entry;
|
||||
|
||||
agent_id_t agent_id;
|
||||
instance_t instance;
|
||||
|
||||
flexran_agent_timer_type_t type;
|
||||
flexran_agent_timer_state_t state;
|
||||
|
||||
uint32_t interval_sec;
|
||||
uint32_t interval_usec;
|
||||
|
||||
long timer_id; /* Timer id returned by the timer API*/
|
||||
xid_t xid; /*The id of the task as received by the controller
|
||||
message*/
|
||||
|
||||
flexran_agent_timer_callback_t cb;
|
||||
flexran_agent_timer_args_t *timer_args;
|
||||
|
||||
} flexran_agent_timer_element_t;
|
||||
|
||||
typedef struct flexran_agent_timer_instance_s{
|
||||
RB_HEAD(flexran_agent_map, flexran_agent_timer_element_s) flexran_agent_head;
|
||||
}flexran_agent_timer_instance_t;
|
||||
|
||||
|
||||
err_code_t flexran_agent_init_timer(void);
|
||||
|
||||
/* Create a timer for some agent related event with id xid. Will store the id
|
||||
of the generated timer in timer_id */
|
||||
err_code_t flexran_agent_create_timer(uint32_t interval_sec,
|
||||
uint32_t interval_usec,
|
||||
agent_id_t agent_id,
|
||||
instance_t instance,
|
||||
uint32_t timer_type,
|
||||
xid_t xid,
|
||||
flexran_agent_timer_callback_t cb,
|
||||
void* timer_args,
|
||||
long *timer_id);
|
||||
|
||||
/* Destroy all existing timers */
|
||||
err_code_t flexran_agent_destroy_timers(void);
|
||||
|
||||
/* Destroy the timer with the given timer_id */
|
||||
err_code_t flexran_agent_destroy_timer(long timer_id);
|
||||
|
||||
/* Destroy the timer for task with id xid */
|
||||
err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid);
|
||||
|
||||
/* Stop a timer */
|
||||
err_code_t flexran_agent_stop_timer(long timer_id);
|
||||
|
||||
/* Restart the given timer */
|
||||
err_code_t flexran_agent_restart_timer(long *timer_id);
|
||||
|
||||
/* Find the timer with the given timer_id */
|
||||
struct flexran_agent_timer_element_s * get_timer_entry(long timer_id);
|
||||
|
||||
/* Obtain the protocol message stored in the given expired timer */
|
||||
Protocol__FlexranMessage * flexran_agent_process_timeout(long timer_id, void* timer_args);
|
||||
|
||||
/* Comparator function comparing two timers. Decides the ordering of the timers */
|
||||
int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b);
|
||||
|
||||
/*Specify a delay in nanoseconds to timespec and sleep until then*/
|
||||
void flexran_agent_sleep_until(struct timespec *ts, int delay);
|
||||
|
||||
/* RB_PROTOTYPE is for .h files */
|
||||
RB_PROTOTYPE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer);
|
||||
void flexran_agent_send_update_stats(mid_t mod_id);
|
||||
|
||||
err_code_t flexran_agent_enable_cont_stats_update(mid_t mod_id, xid_t xid, stats_request_config_t *stats_req) ;
|
||||
err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
/*! \file flexran_agent_common_internal.c
|
||||
* \brief internal functions for common message primitves and utilities
|
||||
* \author Xenofon Foukas
|
||||
* \date 2016
|
||||
* \author Xenofon Foukas and N. Nikaein
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
@@ -32,6 +32,57 @@
|
||||
#include "flexran_agent_common_internal.h"
|
||||
#include "flexran_agent_mac_internal.h"
|
||||
|
||||
/* needed to soft-restart the lte-softmodem */
|
||||
#include "targets/RT/USER/lte-softmodem.h"
|
||||
|
||||
void handle_reconfiguration(mid_t mod_id)
|
||||
{
|
||||
struct timespec start, end;
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
flexran_agent_info_t *flexran = RC.flexran[mod_id];
|
||||
|
||||
if (ENB_WAIT == flexran->node_ctrl_state) {
|
||||
/* this is already waiting, just release */
|
||||
pthread_mutex_lock(&flexran->mutex_node_ctrl);
|
||||
flexran->node_ctrl_state = ENB_NORMAL_OPERATION;
|
||||
pthread_mutex_unlock(&flexran->mutex_node_ctrl);
|
||||
pthread_cond_signal(&flexran->cond_node_ctrl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stop_L1L2(mod_id) < 0) {
|
||||
LOG_E(ENB_APP, "can not stop lte-softmodem, aborting restart\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* node_ctrl_state should have value ENB_MAKE_WAIT only if this method is not
|
||||
* executed by the FlexRAN thread */
|
||||
if (ENB_MAKE_WAIT == flexran->node_ctrl_state) {
|
||||
LOG_I(ENB_APP, " * eNB %d: Waiting for FlexRAN RTController command *\n", mod_id);
|
||||
pthread_mutex_lock(&flexran->mutex_node_ctrl);
|
||||
flexran->node_ctrl_state = ENB_WAIT;
|
||||
while (ENB_NORMAL_OPERATION != flexran->node_ctrl_state)
|
||||
pthread_cond_wait(&flexran->cond_node_ctrl, &flexran->mutex_node_ctrl);
|
||||
pthread_mutex_unlock(&flexran->mutex_node_ctrl);
|
||||
}
|
||||
|
||||
if (restart_L1L2(mod_id) < 0) {
|
||||
LOG_F(ENB_APP, "can not restart, killing lte-softmodem\n");
|
||||
itti_terminate_tasks(TASK_PHY_ENB);
|
||||
return;
|
||||
}
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||
end.tv_sec -= start.tv_sec;
|
||||
if (end.tv_nsec >= start.tv_nsec) {
|
||||
end.tv_nsec -= start.tv_nsec;
|
||||
} else {
|
||||
end.tv_sec -= 1;
|
||||
end.tv_nsec = end.tv_nsec - start.tv_nsec + 1000000000;
|
||||
}
|
||||
LOG_I(ENB_APP, "lte-softmodem restart succeeded in %ld.%ld s\n", end.tv_sec, end.tv_nsec / 1000000);
|
||||
}
|
||||
|
||||
int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) {
|
||||
|
||||
yaml_parser_t parser;
|
||||
@@ -64,7 +115,17 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
|
||||
break;
|
||||
case YAML_SCALAR_EVENT:
|
||||
// Check the system name and call the proper handler
|
||||
if (strcmp((char *) event.data.scalar.value, "mac") == 0) {
|
||||
// Check the system name and call the proper handler
|
||||
if (strcmp((char *) event.data.scalar.value, "enb") == 0) {
|
||||
LOG_I(ENB_APP, "This is intended for the enb system\n");
|
||||
// Call the enb handler
|
||||
if (parse_enb_id(mod_id, &parser) == -1) {
|
||||
LOG_E(ENB_APP, "cannot parse data for eNB\n");
|
||||
goto error;
|
||||
} else { // succeful parse and setting
|
||||
handle_reconfiguration(mod_id);
|
||||
}
|
||||
} else if (strcmp((char *) event.data.scalar.value, "mac") == 0) {
|
||||
LOG_D(ENB_APP, "This is intended for the mac system\n");
|
||||
// Call the mac handler
|
||||
if (parse_mac_config(mod_id, &parser) == -1) {
|
||||
@@ -90,8 +151,8 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
|
||||
// TODO : Just skip it for now
|
||||
if (skip_system_section(&parser) == -1) {
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
@@ -115,6 +176,145 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
|
||||
|
||||
}
|
||||
|
||||
int parse_enb_id(mid_t mod_id, yaml_parser_t *parser) {
|
||||
yaml_event_t event;
|
||||
|
||||
char *endptr;
|
||||
// int is_array;
|
||||
|
||||
int done = 0;
|
||||
int mapping_started = 0;
|
||||
|
||||
while (!done) {
|
||||
|
||||
if (!yaml_parser_parse(parser, &event))
|
||||
goto error;
|
||||
|
||||
switch (event.type) {
|
||||
// We are expecting a mapping of parameters
|
||||
case YAML_SEQUENCE_START_EVENT:
|
||||
// is_array = 1;
|
||||
break;
|
||||
case YAML_MAPPING_START_EVENT:
|
||||
LOG_D(ENB_APP, "The mapping of the parameters started\n");
|
||||
mapping_started = 1;
|
||||
break;
|
||||
case YAML_MAPPING_END_EVENT:
|
||||
LOG_D(ENB_APP, "The mapping of the parameters ended\n");
|
||||
mapping_started = 0;
|
||||
break;
|
||||
case YAML_SCALAR_EVENT:
|
||||
if (!mapping_started) {
|
||||
goto error;
|
||||
}
|
||||
// Check what key needs to be set
|
||||
// use eNB egistered
|
||||
if (mac_agent_registered[mod_id]) {
|
||||
LOG_I(ENB_APP, "Setting parameter for eNB %s\n", event.data.scalar.value);
|
||||
if (strcmp((char *) event.data.scalar.tag, YAML_INT_TAG) == 0) { // if int
|
||||
if ((strtol((char *) event.data.scalar.value, &endptr, 10))== mod_id ) { // enb_id == mod_id: right enb instance to be configured
|
||||
if (parse_enb_config_parameters(mod_id, parser) == -1) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else{
|
||||
goto error; // not the expected type
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
}
|
||||
|
||||
done = (event.type == YAML_MAPPING_END_EVENT);
|
||||
yaml_event_delete(&event);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
yaml_event_delete(&event);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int parse_enb_config_parameters(mid_t mod_id, yaml_parser_t *parser) {
|
||||
yaml_event_t event;
|
||||
|
||||
char *endptr;
|
||||
|
||||
int done = 0;
|
||||
int mapping_started = 0;
|
||||
|
||||
while (!done) {
|
||||
|
||||
if (!yaml_parser_parse(parser, &event))
|
||||
goto error;
|
||||
|
||||
switch (event.type) {
|
||||
// We are expecting a mapping of parameters
|
||||
case YAML_MAPPING_START_EVENT:
|
||||
LOG_D(ENB_APP, "The mapping of the parameters started\n");
|
||||
mapping_started = 1;
|
||||
break;
|
||||
case YAML_MAPPING_END_EVENT:
|
||||
LOG_D(ENB_APP, "The mapping of the parameters ended\n");
|
||||
mapping_started = 0;
|
||||
break;
|
||||
case YAML_SCALAR_EVENT:
|
||||
if (!mapping_started) {
|
||||
goto error;
|
||||
}
|
||||
// Check what key needs to be set
|
||||
if (strcmp((char *) event.data.scalar.value, "dl_freq") == 0) {
|
||||
if (!yaml_parser_parse(parser, &event))
|
||||
goto error;
|
||||
flexran_agent_set_operating_dl_freq(mod_id,
|
||||
0,
|
||||
strtol((char *) event.data.scalar.value, &endptr, 10));
|
||||
LOG_I(ENB_APP, "Setting dl_freq to %s\n", event.data.scalar.value);
|
||||
} else if (strcmp((char *) event.data.scalar.value, "ul_freq_offset") == 0) {
|
||||
if (!yaml_parser_parse(parser, &event))
|
||||
goto error;
|
||||
flexran_agent_set_operating_ul_freq(mod_id,
|
||||
0,
|
||||
strtol((char *) event.data.scalar.value, &endptr, 10));
|
||||
LOG_I(ENB_APP, "Setting ul_freq_offset to %s\n", event.data.scalar.value);
|
||||
} else if (strcmp((char *) event.data.scalar.value, "bandwidth") == 0) {
|
||||
if (!yaml_parser_parse(parser, &event))
|
||||
goto error;
|
||||
flexran_agent_set_operating_bandwidth(mod_id,
|
||||
0,
|
||||
strtol((char *) event.data.scalar.value, &endptr, 10));
|
||||
LOG_I(ENB_APP, "Setting bandwidth to %s\n", event.data.scalar.value);
|
||||
} else if (strcmp((char *) event.data.scalar.value, "frame_type") == 0) {
|
||||
if (!yaml_parser_parse(parser, &event))
|
||||
goto error;
|
||||
flexran_agent_set_operating_frame_type (mod_id,
|
||||
0,
|
||||
strtol((char *) event.data.scalar.value, &endptr, 10));
|
||||
LOG_I(ENB_APP, "Setting frame_type to %s\n", event.data.scalar.value);
|
||||
}else { // not supported tag
|
||||
LOG_E(FLEXRAN_AGENT, "Unsupported tag %s\n", event.data.scalar.value);
|
||||
goto error;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
}
|
||||
|
||||
done = (event.type == YAML_MAPPING_END_EVENT);
|
||||
yaml_event_delete(&event);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
yaml_event_delete(&event);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int skip_system_section(yaml_parser_t *parser) {
|
||||
yaml_event_t event;
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
/*! \file flexran_agent_common_internal.h
|
||||
* \brief internal agent functions for common message primitves and utilities
|
||||
* \author Xenofon Foukas
|
||||
* \date 2016
|
||||
* \author Xenofon Foukas and N. Nikaein
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
@@ -37,6 +37,10 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
|
||||
|
||||
int apply_parameter_modification(void *parameter, yaml_parser_t *parser);
|
||||
|
||||
int parse_enb_id(mid_t mod_id, yaml_parser_t *parser);
|
||||
int parse_enb_config_parameters(mid_t mod_id, yaml_parser_t *parser) ;
|
||||
|
||||
|
||||
// This can be used when parsing for a specific system that is not yet implmeneted
|
||||
// in order to skip its configuration, without affecting the rest
|
||||
int skip_system_section(yaml_parser_t *parser);
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
/*! \file flexran_agent_defs.h
|
||||
* \brief FlexRAN agent common definitions
|
||||
* \author Navid Nikaein and Xenofon Foukas
|
||||
* \date 2016
|
||||
* \author Navid Nikaein and Xenofon Foukas and shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
#ifndef FLEXRAN_AGENT_DEFS_H_
|
||||
@@ -32,11 +32,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "link_manager.h"
|
||||
|
||||
#define NUM_MAX_ENB 2
|
||||
#define NUM_MAX_DRB 8
|
||||
#define NUM_MAX_SRB 3
|
||||
#define NUM_MAX_UE 2048
|
||||
#define DEFAULT_DRB 3
|
||||
#define DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS "127.0.0.1"
|
||||
#define DEFAULT_FLEXRAN_AGENT_PORT 2210
|
||||
#define DEFAULT_FLEXRAN_AGENT_CACHE "/mnt/oai_agent_cache"
|
||||
@@ -102,10 +107,66 @@ typedef uint8_t lcid_t;
|
||||
typedef int32_t err_code_t;
|
||||
|
||||
|
||||
/*---------Timer Enums --------- */
|
||||
|
||||
typedef enum {
|
||||
/* oneshot timer: */
|
||||
FLEXRAN_AGENT_TIMER_TYPE_ONESHOT = 0,
|
||||
|
||||
/* periodic timer */
|
||||
FLEXRAN_AGENT_TIMER_TYPE_PERIODIC = 1,
|
||||
|
||||
/* Inactive state: initial state for any timer. */
|
||||
FLEXRAN_AGENT_TIMER_TYPE_EVENT_DRIVEN = 2,
|
||||
|
||||
/* Max number of states available */
|
||||
FLEXRAN_AGENT_TIMER_TYPE_MAX,
|
||||
} flexran_agent_timer_type_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
/* Inactive state: initial state for any timer. */
|
||||
FLEXRAN_AGENT_TIMER_STATE_INACTIVE = 0x0,
|
||||
|
||||
/* Inactive state: initial state for any timer. */
|
||||
FLEXRAN_AGENT_TIMER_STATE_ACTIVE = 0x1,
|
||||
|
||||
/* Inactive state: initial state for any timer. */
|
||||
FLEXRAN_AGENT_TIMER_STATE_STOPPED = 0x2,
|
||||
|
||||
/* Max number of states available */
|
||||
FLEXRAN_AGENT_TIMER_STATE_MAX,
|
||||
} flexran_agent_timer_state_t;
|
||||
|
||||
#define FLEXRAN_CAP_LOL1 0x1
|
||||
#define FLEXRAN_CAP_HIL1 0x2
|
||||
#define FLEXRAN_CAP_LOL2 0x4 // is: MAC
|
||||
#define FLEXRAN_CAP_HIL2 0x8 // is: RLC
|
||||
#define FLEXRAN_CAP_PDCP 0x16
|
||||
#define FLEXRAN_CAP_RRC 0x32
|
||||
|
||||
typedef enum {
|
||||
ENB_NORMAL_OPERATION = 0x0,
|
||||
ENB_WAIT = 0x1,
|
||||
ENB_MAKE_WAIT = 0x2,
|
||||
} flexran_enb_state_t;
|
||||
|
||||
typedef struct {
|
||||
/* general info */
|
||||
|
||||
int enabled;
|
||||
char *interface_name;
|
||||
char *remote_ipv4_addr;
|
||||
uint16_t remote_port;
|
||||
char *cache_name;
|
||||
|
||||
int enb_id;
|
||||
uint8_t capability_mask;
|
||||
|
||||
/* lock for waiting before starting or soft-restart */
|
||||
pthread_cond_t cond_node_ctrl;
|
||||
pthread_mutex_t mutex_node_ctrl;
|
||||
flexran_enb_state_t node_ctrl_state;
|
||||
|
||||
/* stats */
|
||||
|
||||
uint32_t total_rx_msg;
|
||||
@@ -116,10 +177,51 @@ typedef struct {
|
||||
|
||||
} flexran_agent_info_t;
|
||||
|
||||
|
||||
/*
|
||||
rrc triggering
|
||||
*/
|
||||
|
||||
|
||||
typedef struct {
|
||||
mid_t enb_id;
|
||||
flexran_agent_info_t agent_info;
|
||||
|
||||
} flexran_agent_instance_t;
|
||||
char * trigger_policy;
|
||||
uint32_t report_interval;
|
||||
uint32_t report_amount;
|
||||
|
||||
} agent_reconf_rrc;
|
||||
|
||||
|
||||
/* These structs will be used to give
|
||||
instructions for the type of stats reports
|
||||
we need to create */
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint16_t ue_rnti;
|
||||
uint32_t ue_report_flags; /* Indicates the report elements
|
||||
required for this UE id. See
|
||||
FlexRAN specification 1.2.4.2 */
|
||||
} ue_report_type_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t cc_id;
|
||||
uint32_t cc_report_flags; /* Indicates the report elements
|
||||
required for this CC index. See
|
||||
FlexRAN specification 1.2.4.3 */
|
||||
} cc_report_type_t;
|
||||
|
||||
typedef struct {
|
||||
int nr_ue;
|
||||
ue_report_type_t *ue_report_type;
|
||||
int nr_cc;
|
||||
cc_report_type_t *cc_report_type;
|
||||
} report_config_t;
|
||||
|
||||
typedef struct stats_request_config_s{
|
||||
uint8_t report_type;
|
||||
uint8_t report_frequency;
|
||||
uint16_t period; /*In number of subframes*/
|
||||
report_config_t *config;
|
||||
} stats_request_config_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
*/
|
||||
|
||||
/*! \file ENB_APP/extern.h
|
||||
* \brief FlexRAN agent - mac interface primitives
|
||||
* \author Xenofon Foukas
|
||||
* \date 2016
|
||||
* \brief FlexRAN agent - Extern VSF xfaces
|
||||
* \author Xenofon Foukas and shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
* \mail x.foukas@sms.ed.ac.uk
|
||||
*/
|
||||
@@ -32,12 +32,8 @@
|
||||
|
||||
#include "flexran_agent_defs.h"
|
||||
#include "flexran_agent_mac_defs.h"
|
||||
|
||||
|
||||
//extern msg_context_t shared_ctxt[NUM_MAX_ENB][FLEXRAN_AGENT_MAX];
|
||||
|
||||
/* full path of the local cache for storing VSFs */
|
||||
extern char local_cache[40];
|
||||
#include "flexran_agent_rrc_defs.h"
|
||||
#include "flexran_agent_pdcp_defs.h"
|
||||
|
||||
/* Control module interface for the communication of the MAC Control Module with the agent */
|
||||
extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
|
||||
@@ -45,8 +41,20 @@ extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
|
||||
/* Flag indicating whether the VSFs for the MAC control module have been registered */
|
||||
extern unsigned int mac_agent_registered[NUM_MAX_ENB];
|
||||
|
||||
/* Control module interface for the communication of the RRC Control Module with the agent */
|
||||
extern AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB];
|
||||
|
||||
/* Flag indicating whether the VSFs for the RRC control module have been registered */
|
||||
extern unsigned int rrc_agent_registered[NUM_MAX_ENB];
|
||||
|
||||
/* Control module interface for the communication of the RRC Control Module with the agent */
|
||||
extern AGENT_PDCP_xface *agent_pdcp_xface[NUM_MAX_ENB];
|
||||
|
||||
/* Flag indicating whether the VSFs for the RRC control module have been registered */
|
||||
extern unsigned int pdcp_agent_registered[NUM_MAX_ENB];
|
||||
|
||||
/* Requried to know which UEs had a harq updated over some subframe */
|
||||
extern int harq_pid_updated[NUMBER_OF_UE_MAX][8];
|
||||
extern int harq_pid_round[NUMBER_OF_UE_MAX][8];
|
||||
extern int harq_pid_updated[NUM_MAX_UE][8];
|
||||
extern int harq_pid_round[NUM_MAX_UE][8];
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,14 +21,18 @@
|
||||
|
||||
/*! \file flexran_agent_handler.c
|
||||
* \brief FlexRAN agent tx and rx message handler
|
||||
* \author Xenofon Foukas and Navid Nikaein
|
||||
* \date 2016
|
||||
* \author Xenofon Foukas and Navid Nikaein and shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
|
||||
#include "flexran_agent_defs.h"
|
||||
#include "flexran_agent_common.h"
|
||||
#include "flexran_agent_mac.h"
|
||||
#include "flexran_agent_rrc.h"
|
||||
#include "flexran_agent_pdcp.h"
|
||||
#include "flexran_agent_timer.h"
|
||||
#include "flexran_agent_ran_api.h"
|
||||
#include "log.h"
|
||||
|
||||
#include "assertions.h"
|
||||
@@ -37,7 +41,7 @@ flexran_agent_message_decoded_callback agent_messages_callback[][3] = {
|
||||
{flexran_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/
|
||||
{flexran_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/
|
||||
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply
|
||||
{flexran_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/
|
||||
{flexran_agent_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/
|
||||
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG*/
|
||||
{0, 0, 0}, /*PROTOCOK__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/
|
||||
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/
|
||||
@@ -51,13 +55,14 @@ flexran_agent_message_decoded_callback agent_messages_callback[][3] = {
|
||||
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/
|
||||
{flexran_agent_control_delegation, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/
|
||||
{flexran_agent_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/
|
||||
{flexran_agent_rrc_measurement, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_RRC_TRIGGERING_MSG*/
|
||||
};
|
||||
|
||||
flexran_agent_message_destruction_callback message_destruction_callback[] = {
|
||||
flexran_agent_destroy_hello,
|
||||
flexran_agent_destroy_echo_request,
|
||||
flexran_agent_destroy_echo_reply,
|
||||
flexran_agent_mac_destroy_stats_request,
|
||||
flexran_agent_destroy_stats_request,
|
||||
flexran_agent_mac_destroy_stats_reply,
|
||||
flexran_agent_mac_destroy_sf_trigger,
|
||||
flexran_agent_mac_destroy_sr_info,
|
||||
@@ -93,7 +98,6 @@ Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id,
|
||||
err_code= PROTOCOL__FLEXRAN_ERR__MSG_DECODING;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3 * sizeof(flexran_agent_message_decoded_callback))) ||
|
||||
(decoded_message->msg_dir > PROTOCOL__FLEXRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){
|
||||
err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_HANDLED;
|
||||
@@ -139,7 +143,7 @@ void * flexran_agent_pack_message(Protocol__FlexranMessage *msg,
|
||||
|
||||
DevAssert(buffer !=NULL);
|
||||
|
||||
LOG_D(FLEXRAN_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size);
|
||||
LOG_D(FLEXRAN_AGENT,"Serilized the eNB-UE stats reply (size %d)\n", *size);
|
||||
|
||||
return buffer;
|
||||
|
||||
@@ -187,3 +191,587 @@ Protocol__FlexranMessage* flexran_agent_process_timeout(long timer_id, void* tim
|
||||
err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) {
|
||||
return ((*message_destruction_callback[msg->msg_case-1])(msg));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Top Level Statistics Report
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg){
|
||||
|
||||
// TODO: Must deal with sanitization of input
|
||||
// TODO: Must check if RNTIs and cell ids of the request actually exist
|
||||
// TODO: Must resolve conflicts among stats requests
|
||||
|
||||
int i;
|
||||
err_code_t err_code;
|
||||
xid_t xid;
|
||||
uint32_t usec_interval, sec_interval;
|
||||
|
||||
//TODO: We do not deal with multiple CCs at the moment and eNB id is 0
|
||||
int enb_id = mod_id;
|
||||
|
||||
//eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id];
|
||||
//UE_list_t *eNB_UE_list= &eNB->UE_list;
|
||||
|
||||
report_config_t report_config;
|
||||
|
||||
uint32_t ue_flags = 0;
|
||||
uint32_t c_flags = 0;
|
||||
|
||||
Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
|
||||
|
||||
Protocol__FlexStatsRequest *stats_req = input->stats_request_msg;
|
||||
xid = (stats_req->header)->xid;
|
||||
|
||||
// Check the type of request that is made
|
||||
switch(stats_req->body_case) {
|
||||
case PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ;
|
||||
Protocol__FlexCompleteStatsRequest *comp_req = stats_req->complete_stats_request;
|
||||
if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_OFF) {
|
||||
/*Disable both periodic and continuous updates*/
|
||||
// flexran_agent_disable_cont_stats_update(mod_id);
|
||||
flexran_agent_destroy_timer_by_task_id(xid);
|
||||
*msg = NULL;
|
||||
return 0;
|
||||
} else { //One-off, periodical or continuous reporting
|
||||
//Set the proper flags
|
||||
ue_flags = comp_req->ue_report_flags;
|
||||
c_flags = comp_req->cell_report_flags;
|
||||
//Create a list of all eNB RNTIs and cells
|
||||
|
||||
//Set the number of UEs and create list with their RNTIs stats configs
|
||||
report_config.nr_ue = flexran_get_num_ues(mod_id); //eNB_UE_list->num_UEs
|
||||
report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
|
||||
if (report_config.ue_report_type == NULL) {
|
||||
// TODO: Add appropriate error code
|
||||
err_code = -100;
|
||||
goto error;
|
||||
}
|
||||
for (i = 0; i < report_config.nr_ue; i++) {
|
||||
report_config.ue_report_type[i].ue_rnti = flexran_get_ue_crnti(enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].crnti;
|
||||
report_config.ue_report_type[i].ue_report_flags = ue_flags;
|
||||
}
|
||||
//Set the number of CCs and create a list with the cell stats configs
|
||||
report_config.nr_cc = MAX_NUM_CCs;
|
||||
report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc);
|
||||
if (report_config.cc_report_type == NULL) {
|
||||
// TODO: Add appropriate error code
|
||||
err_code = -100;
|
||||
goto error;
|
||||
}
|
||||
for (i = 0; i < report_config.nr_cc; i++) {
|
||||
//TODO: Must fill in the proper cell ids
|
||||
report_config.cc_report_type[i].cc_id = i;
|
||||
report_config.cc_report_type[i].cc_report_flags = c_flags;
|
||||
}
|
||||
/* Check if request was periodical */
|
||||
if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_PERIODICAL) {
|
||||
/* Create a one off flexran message as an argument for the periodical task */
|
||||
Protocol__FlexranMessage *timer_msg;
|
||||
stats_request_config_t request_config;
|
||||
request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS;
|
||||
request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE;
|
||||
request_config.period = 0;
|
||||
/* Need to make sure that the ue flags are saved (Bug) */
|
||||
if (report_config.nr_ue == 0) {
|
||||
report_config.nr_ue = 1;
|
||||
report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t));
|
||||
if (report_config.ue_report_type == NULL) {
|
||||
// TODO: Add appropriate error code
|
||||
err_code = -100;
|
||||
goto error;
|
||||
}
|
||||
report_config.ue_report_type[0].ue_rnti = 0; // Dummy value
|
||||
report_config.ue_report_type[0].ue_report_flags = ue_flags;
|
||||
}
|
||||
request_config.config = &report_config;
|
||||
flexran_agent_stats_request(enb_id, xid, &request_config, &timer_msg);
|
||||
/* Create a timer */
|
||||
long timer_id = 0;
|
||||
flexran_agent_timer_args_t *timer_args;
|
||||
timer_args = malloc(sizeof(flexran_agent_timer_args_t));
|
||||
memset (timer_args, 0, sizeof(flexran_agent_timer_args_t));
|
||||
timer_args->mod_id = enb_id;
|
||||
timer_args->msg = timer_msg;
|
||||
/*Convert subframes to usec time*/
|
||||
usec_interval = 1000*comp_req->sf;
|
||||
sec_interval = 0;
|
||||
/*add seconds if required*/
|
||||
if (usec_interval >= 1000*1000) {
|
||||
sec_interval = usec_interval/(1000*1000);
|
||||
usec_interval = usec_interval%(1000*1000);
|
||||
}
|
||||
flexran_agent_create_timer(sec_interval, usec_interval, FLEXRAN_AGENT_DEFAULT, enb_id, FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid, flexran_agent_handle_timed_task,(void*) timer_args, &timer_id);
|
||||
} else if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_CONTINUOUS) {
|
||||
/*If request was for continuous updates, disable the previous configuration and
|
||||
set up a new one*/
|
||||
flexran_agent_disable_cont_stats_update(mod_id);
|
||||
stats_request_config_t request_config;
|
||||
request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS;
|
||||
request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE;
|
||||
request_config.period = 0;
|
||||
/* Need to make sure that the ue flags are saved (Bug) */
|
||||
if (report_config.nr_ue == 0) {
|
||||
report_config.nr_ue = 1;
|
||||
report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t));
|
||||
if (report_config.ue_report_type == NULL) {
|
||||
// TODO: Add appropriate error code
|
||||
err_code = -100;
|
||||
goto error;
|
||||
}
|
||||
report_config.ue_report_type[0].ue_rnti = 0; // Dummy value
|
||||
report_config.ue_report_type[0].ue_report_flags = ue_flags;
|
||||
}
|
||||
request_config.config = &report_config;
|
||||
flexran_agent_enable_cont_stats_update(enb_id, xid, &request_config);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST:;
|
||||
Protocol__FlexCellStatsRequest *cell_req = stats_req->cell_stats_request;
|
||||
// UE report config will be blank
|
||||
report_config.nr_ue = 0;
|
||||
report_config.ue_report_type = NULL;
|
||||
report_config.nr_cc = cell_req->n_cell;
|
||||
report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc);
|
||||
if (report_config.cc_report_type == NULL) {
|
||||
// TODO: Add appropriate error code
|
||||
err_code = -100;
|
||||
goto error;
|
||||
}
|
||||
for (i = 0; i < report_config.nr_cc; i++) {
|
||||
//TODO: Must fill in the proper cell ids
|
||||
report_config.cc_report_type[i].cc_id = cell_req->cell[i];
|
||||
report_config.cc_report_type[i].cc_report_flags = cell_req->flags;
|
||||
}
|
||||
break;
|
||||
case PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST:;
|
||||
Protocol__FlexUeStatsRequest *ue_req = stats_req->ue_stats_request;
|
||||
// Cell report config will be blank
|
||||
report_config.nr_cc = 0;
|
||||
report_config.cc_report_type = NULL;
|
||||
report_config.nr_ue = ue_req->n_rnti;
|
||||
report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
|
||||
if (report_config.ue_report_type == NULL) {
|
||||
// TODO: Add appropriate error code
|
||||
err_code = -100;
|
||||
goto error;
|
||||
}
|
||||
for (i = 0; i < report_config.nr_ue; i++) {
|
||||
report_config.ue_report_type[i].ue_rnti = ue_req->rnti[i];
|
||||
report_config.ue_report_type[i].ue_report_flags = ue_req->flags;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//TODO: Add appropriate error code
|
||||
err_code = -100;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (flexran_agent_stats_reply(enb_id, xid, &report_config, msg )){
|
||||
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
|
||||
goto error;
|
||||
}
|
||||
|
||||
free(report_config.ue_report_type);
|
||||
free(report_config.cc_report_type);
|
||||
|
||||
return 0;
|
||||
|
||||
error :
|
||||
LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code);
|
||||
return err_code;
|
||||
}
|
||||
|
||||
/*
|
||||
Top level reply
|
||||
*/
|
||||
|
||||
int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg){
|
||||
|
||||
Protocol__FlexHeader *header = NULL;
|
||||
err_code_t err_code;
|
||||
int i;
|
||||
|
||||
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0)
|
||||
goto error;
|
||||
|
||||
|
||||
Protocol__FlexStatsReply *stats_reply_msg;
|
||||
|
||||
stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply));
|
||||
|
||||
if (stats_reply_msg == NULL)
|
||||
goto error;
|
||||
|
||||
protocol__flex_stats_reply__init(stats_reply_msg);
|
||||
stats_reply_msg->header = header;
|
||||
|
||||
stats_reply_msg->n_ue_report = report_config->nr_ue;
|
||||
stats_reply_msg->n_cell_report = report_config->nr_cc;
|
||||
|
||||
// UE report
|
||||
|
||||
Protocol__FlexUeStatsReport **ue_report;
|
||||
|
||||
|
||||
ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *) * report_config->nr_ue);
|
||||
if (ue_report == NULL)
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < report_config->nr_ue; i++) {
|
||||
|
||||
ue_report[i] = malloc(sizeof(Protocol__FlexUeStatsReport));
|
||||
protocol__flex_ue_stats_report__init(ue_report[i]);
|
||||
ue_report[i]->rnti = report_config->ue_report_type[i].ue_rnti;
|
||||
ue_report[i]->has_rnti = 1;
|
||||
ue_report[i]->flags = report_config->ue_report_type[i].ue_report_flags;
|
||||
ue_report[i]->has_flags = 1;
|
||||
|
||||
}
|
||||
|
||||
// cell rpoert
|
||||
|
||||
Protocol__FlexCellStatsReport **cell_report;
|
||||
|
||||
|
||||
cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *) * report_config->nr_cc);
|
||||
if (cell_report == NULL)
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < report_config->nr_cc; i++) {
|
||||
|
||||
cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport));
|
||||
if(cell_report[i] == NULL)
|
||||
goto error;
|
||||
|
||||
protocol__flex_cell_stats_report__init(cell_report[i]);
|
||||
cell_report[i]->carrier_index = report_config->cc_report_type[i].cc_id;
|
||||
cell_report[i]->has_carrier_index = 1;
|
||||
cell_report[i]->flags = report_config->cc_report_type[i].cc_report_flags;
|
||||
cell_report[i]->has_flags = 1;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
MAC reply split
|
||||
*/
|
||||
|
||||
|
||||
if (flexran_agent_mac_stats_reply(enb_id, report_config, ue_report, cell_report) < 0 ) {
|
||||
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
RRC reply split
|
||||
*/
|
||||
|
||||
if (flexran_agent_rrc_stats_reply(enb_id, report_config, ue_report, cell_report) < 0 ) {
|
||||
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
PDCP reply split
|
||||
*/
|
||||
|
||||
if (flexran_agent_pdcp_stats_reply(enb_id, report_config, ue_report, cell_report) < 0 ) {
|
||||
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
stats_reply_msg->cell_report = cell_report;
|
||||
stats_reply_msg->ue_report = ue_report;
|
||||
|
||||
*msg = malloc(sizeof(Protocol__FlexranMessage));
|
||||
if(*msg == NULL)
|
||||
goto error;
|
||||
protocol__flexran_message__init(*msg);
|
||||
(*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG;
|
||||
(*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME;
|
||||
(*msg)->stats_reply_msg = stats_reply_msg;
|
||||
|
||||
return 0;
|
||||
|
||||
error :
|
||||
LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code);
|
||||
return err_code;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Top Level Request
|
||||
*/
|
||||
|
||||
int flexran_agent_stats_request(mid_t mod_id,
|
||||
xid_t xid,
|
||||
const stats_request_config_t *report_config,
|
||||
Protocol__FlexranMessage **msg) {
|
||||
Protocol__FlexHeader *header = NULL;
|
||||
int i;
|
||||
|
||||
Protocol__FlexStatsRequest *stats_request_msg;
|
||||
stats_request_msg = malloc(sizeof(Protocol__FlexStatsRequest));
|
||||
if(stats_request_msg == NULL)
|
||||
goto error;
|
||||
protocol__flex_stats_request__init(stats_request_msg);
|
||||
|
||||
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0)
|
||||
goto error;
|
||||
|
||||
stats_request_msg->header = header;
|
||||
|
||||
stats_request_msg->type = report_config->report_type;
|
||||
stats_request_msg->has_type = 1;
|
||||
|
||||
switch (report_config->report_type) {
|
||||
case PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS:
|
||||
stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST;
|
||||
Protocol__FlexCompleteStatsRequest *complete_stats;
|
||||
complete_stats = malloc(sizeof(Protocol__FlexCompleteStatsRequest));
|
||||
if(complete_stats == NULL)
|
||||
goto error;
|
||||
protocol__flex_complete_stats_request__init(complete_stats);
|
||||
complete_stats->report_frequency = report_config->report_frequency;
|
||||
complete_stats->has_report_frequency = 1;
|
||||
complete_stats->sf = report_config->period;
|
||||
complete_stats->has_sf = 1;
|
||||
complete_stats->has_cell_report_flags = 1;
|
||||
complete_stats->has_ue_report_flags = 1;
|
||||
if (report_config->config->nr_cc > 0) {
|
||||
complete_stats->cell_report_flags = report_config->config->cc_report_type[0].cc_report_flags;
|
||||
}
|
||||
if (report_config->config->nr_ue > 0) {
|
||||
complete_stats->ue_report_flags = report_config->config->ue_report_type[0].ue_report_flags;
|
||||
}
|
||||
stats_request_msg->complete_stats_request = complete_stats;
|
||||
break;
|
||||
case PROTOCOL__FLEX_STATS_TYPE__FLST_CELL_STATS:
|
||||
stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST;
|
||||
Protocol__FlexCellStatsRequest *cell_stats;
|
||||
cell_stats = malloc(sizeof(Protocol__FlexCellStatsRequest));
|
||||
if(cell_stats == NULL)
|
||||
goto error;
|
||||
protocol__flex_cell_stats_request__init(cell_stats);
|
||||
cell_stats->n_cell = report_config->config->nr_cc;
|
||||
cell_stats->has_flags = 1;
|
||||
if (cell_stats->n_cell > 0) {
|
||||
uint32_t *cells;
|
||||
cells = (uint32_t *) malloc(sizeof(uint32_t)*cell_stats->n_cell);
|
||||
for (i = 0; i < cell_stats->n_cell; i++) {
|
||||
cells[i] = report_config->config->cc_report_type[i].cc_id;
|
||||
}
|
||||
cell_stats->cell = cells;
|
||||
cell_stats->flags = report_config->config->cc_report_type[i].cc_report_flags;
|
||||
}
|
||||
stats_request_msg->cell_stats_request = cell_stats;
|
||||
break;
|
||||
case PROTOCOL__FLEX_STATS_TYPE__FLST_UE_STATS:
|
||||
stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST;
|
||||
Protocol__FlexUeStatsRequest *ue_stats;
|
||||
ue_stats = malloc(sizeof(Protocol__FlexUeStatsRequest));
|
||||
if(ue_stats == NULL)
|
||||
goto error;
|
||||
protocol__flex_ue_stats_request__init(ue_stats);
|
||||
ue_stats->n_rnti = report_config->config->nr_ue;
|
||||
ue_stats->has_flags = 1;
|
||||
if (ue_stats->n_rnti > 0) {
|
||||
uint32_t *ues;
|
||||
ues = (uint32_t *) malloc(sizeof(uint32_t)*ue_stats->n_rnti);
|
||||
for (i = 0; i < ue_stats->n_rnti; i++) {
|
||||
ues[i] = report_config->config->ue_report_type[i].ue_rnti;
|
||||
}
|
||||
ue_stats->rnti = ues;
|
||||
ue_stats->flags = report_config->config->ue_report_type[i].ue_report_flags;
|
||||
}
|
||||
stats_request_msg->ue_stats_request = ue_stats;
|
||||
break;
|
||||
default:
|
||||
goto error;
|
||||
}
|
||||
*msg = malloc(sizeof(Protocol__FlexranMessage));
|
||||
if(*msg == NULL)
|
||||
goto error;
|
||||
protocol__flexran_message__init(*msg);
|
||||
(*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG;
|
||||
(*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE;
|
||||
(*msg)->stats_request_msg = stats_request_msg;
|
||||
return 0;
|
||||
|
||||
error:
|
||||
// TODO: Need to make proper error handling
|
||||
if (header != NULL)
|
||||
free(header);
|
||||
if (stats_request_msg != NULL)
|
||||
free(stats_request_msg);
|
||||
if(*msg != NULL)
|
||||
free(*msg);
|
||||
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg) {
|
||||
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG)
|
||||
goto error;
|
||||
free(msg->stats_request_msg->header);
|
||||
if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST) {
|
||||
free(msg->stats_request_msg->cell_stats_request->cell);
|
||||
}
|
||||
if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST) {
|
||||
free(msg->stats_request_msg->ue_stats_request->rnti);
|
||||
}
|
||||
free(msg->stats_request_msg);
|
||||
free(msg);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
Top Level Update
|
||||
*/
|
||||
|
||||
void flexran_agent_send_update_stats(mid_t mod_id) {
|
||||
|
||||
Protocol__FlexranMessage *current_report = NULL;
|
||||
void *data;
|
||||
int size;
|
||||
err_code_t err_code;
|
||||
int priority = 0;
|
||||
|
||||
if (pthread_mutex_lock(stats_context[mod_id].mutex)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (stats_context[mod_id].cont_update == 1) {
|
||||
|
||||
/*Create a fresh report with the required flags*/
|
||||
err_code = flexran_agent_handle_stats(mod_id, (void *) stats_context[mod_id].stats_req, ¤t_report);
|
||||
if (err_code < 0) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
/* /\*TODO:Check if a previous reports exists and if yes, generate a report */
|
||||
/* *that is the diff between the old and the new report, */
|
||||
/* *respecting the thresholds. Otherwise send the new report*\/ */
|
||||
/* if (stats_context[mod_id].prev_stats_reply != NULL) { */
|
||||
|
||||
/* msg = flexran_agent_generate_diff_mac_stats_report(current_report, stats_context[mod_id].prev_stats_reply); */
|
||||
|
||||
/* /\*Destroy the old stats*\/ */
|
||||
/* flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply); */
|
||||
/* } */
|
||||
/* /\*Use the current report for future comparissons*\/ */
|
||||
/* stats_context[mod_id].prev_stats_reply = current_report; */
|
||||
|
||||
|
||||
if (pthread_mutex_unlock(stats_context[mod_id].mutex)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (current_report != NULL){
|
||||
data=flexran_agent_pack_message(current_report, &size);
|
||||
/*Send any stats updates using the MAC channel of the eNB*/
|
||||
if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) {
|
||||
err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
|
||||
goto error;
|
||||
}
|
||||
|
||||
LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
|
||||
return;
|
||||
}
|
||||
error:
|
||||
LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n");
|
||||
}
|
||||
|
||||
err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id) {
|
||||
/*Disable the continuous updates for the MAC*/
|
||||
if (pthread_mutex_lock(stats_context[mod_id].mutex)) {
|
||||
goto error;
|
||||
}
|
||||
stats_context[mod_id].cont_update = 0;
|
||||
stats_context[mod_id].xid = 0;
|
||||
if (stats_context[mod_id].stats_req != NULL) {
|
||||
flexran_agent_destroy_flexran_message(stats_context[mod_id].stats_req);
|
||||
}
|
||||
if (stats_context[mod_id].prev_stats_reply != NULL) {
|
||||
flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply);
|
||||
}
|
||||
if (pthread_mutex_unlock(stats_context[mod_id].mutex)) {
|
||||
goto error;
|
||||
}
|
||||
return 0;
|
||||
|
||||
error:
|
||||
LOG_E(FLEXRAN_AGENT, "stats_context for eNB %d is not initialized\n", mod_id);
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
err_code_t flexran_agent_enable_cont_stats_update(mid_t mod_id,
|
||||
xid_t xid, stats_request_config_t *stats_req) {
|
||||
|
||||
if (pthread_mutex_lock(stats_context[mod_id].mutex)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
Protocol__FlexranMessage *req_msg;
|
||||
|
||||
flexran_agent_stats_request(mod_id, xid, stats_req, &req_msg);
|
||||
stats_context[mod_id].stats_req = req_msg;
|
||||
stats_context[mod_id].prev_stats_reply = NULL;
|
||||
|
||||
stats_context[mod_id].cont_update = 1;
|
||||
stats_context[mod_id].xid = xid;
|
||||
|
||||
if (pthread_mutex_unlock(stats_context[mod_id].mutex)) {
|
||||
goto error;
|
||||
}
|
||||
return 0;
|
||||
|
||||
error:
|
||||
LOG_E(FLEXRAN_AGENT, "stats_context for eNB %d is not initialized\n", mod_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
err_code_t flexran_agent_init_cont_stats_update(mid_t mod_id) {
|
||||
|
||||
|
||||
/*Initially the continuous update is set to false*/
|
||||
stats_context[mod_id].cont_update = 0;
|
||||
stats_context[mod_id].is_initialized = 1;
|
||||
stats_context[mod_id].stats_req = NULL;
|
||||
stats_context[mod_id].prev_stats_reply = NULL;
|
||||
stats_context[mod_id].mutex = calloc(1, sizeof(pthread_mutex_t));
|
||||
if (stats_context[mod_id].mutex == NULL)
|
||||
goto error;
|
||||
if (pthread_mutex_init(stats_context[mod_id].mutex, NULL))
|
||||
goto error;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
err_code_t flexran_agent_destroy_cont_stats_update(mid_t mod_id) {
|
||||
|
||||
stats_context[mod_id].cont_update = 0;
|
||||
stats_context[mod_id].is_initialized = 0;
|
||||
flexran_agent_destroy_flexran_message(stats_context[mod_id].stats_req);
|
||||
flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply);
|
||||
free(stats_context[mod_id].mutex);
|
||||
|
||||
// mac_agent_registered[mod_id] = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ int flexran_agent_create_channel(void *channel_info,
|
||||
/*element should be a real pointer*/
|
||||
RB_INSERT(flexran_agent_channel_map, &channel_instance.flexran_agent_head, channel);
|
||||
|
||||
LOG_I(FLEXRAN_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id);
|
||||
LOG_I(FLEXRAN_AGENT,"Created a new channel with id %d \n", channel->channel_id);
|
||||
|
||||
return channel_id;
|
||||
}
|
||||
@@ -141,9 +141,9 @@ int flexran_agent_destroy_channel(int channel_id) {
|
||||
for (i = 0; i < NUM_MAX_ENB; i++) {
|
||||
for (j = 0; j < FLEXRAN_AGENT_MAX; j++) {
|
||||
if (agent_channel[i][j] != NULL) {
|
||||
if (agent_channel[i][j]->channel_id == e->channel_id) {
|
||||
agent_channel[i][j] == NULL;
|
||||
}
|
||||
if (agent_channel[i][j]->channel_id == e->channel_id) {
|
||||
free(agent_channel[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,9 @@ err_code_t flexran_agent_init_channel_container(void) {
|
||||
|
||||
for (i = 0; i < NUM_MAX_ENB; i++) {
|
||||
for (j = 0; j < FLEXRAN_AGENT_MAX; j++) {
|
||||
agent_channel[i][j] == NULL;
|
||||
agent_channel[i][j] = malloc(sizeof(flexran_agent_channel_t));
|
||||
if (!agent_channel[i][j])
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,432 @@
|
||||
/*
|
||||
* 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 flexran_agent_ran_api.h
|
||||
* \brief FlexRAN RAN API abstraction header
|
||||
* \author N. Nikaein, X. Foukas and S. SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "flexran_agent_common.h"
|
||||
#include "flexran_agent_common_internal.h"
|
||||
#include "flexran_agent_extern.h"
|
||||
#include "flexran_agent_defs.h"
|
||||
|
||||
|
||||
#include "enb_config.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "LAYER2/RLC/rlc.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "pdcp.h"
|
||||
#include "RRC/LITE/extern.h"
|
||||
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
#include "RRC/LITE/rrc_eNB_UE_context.h"
|
||||
#include "PHY/extern.h"
|
||||
#include "log.h"
|
||||
|
||||
/****************************
|
||||
* get generic info from RAN
|
||||
****************************/
|
||||
|
||||
uint32_t flexran_get_current_time_ms(mid_t mod_id, int subframe_flag);
|
||||
|
||||
/*Return the current frame number
|
||||
*Could be using implementation specific numbering of frames
|
||||
*/
|
||||
frame_t flexran_get_current_frame(mid_t mod_id);
|
||||
|
||||
/*Return the current SFN (0-1023)*/
|
||||
frame_t flexran_get_current_system_frame_num(mid_t mod_id);
|
||||
|
||||
sub_frame_t flexran_get_current_subframe(mid_t mod_id);
|
||||
|
||||
/*Return the frame and subframe number in compact 16-bit format.
|
||||
Bits 0-3 subframe, rest for frame. Required by FlexRAN protocol*/
|
||||
uint16_t flexran_get_sfn_sf(mid_t mod_id);
|
||||
|
||||
/* Return a future frame and subframe number that is ahead_of_time
|
||||
subframes later in compact 16-bit format. Bits 0-3 subframe,
|
||||
rest for frame */
|
||||
uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time);
|
||||
|
||||
/* Return the number of attached UEs */
|
||||
int flexran_get_num_ues(mid_t mod_id);
|
||||
|
||||
/* Get the rnti of a UE with id ue_id */
|
||||
rnti_t flexran_get_ue_crnti(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get the RLC buffer status report in bytes of a ue for a designated
|
||||
* logical channel id */
|
||||
int flexran_get_ue_bsr_ul_buffer_info(mid_t mod_id, mid_t ue_id, lcid_t lcid);
|
||||
|
||||
/* Get power headroom of UE with id ue_id */
|
||||
int8_t flexran_get_ue_phr(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get the UE wideband CQI */
|
||||
uint8_t flexran_get_ue_wcqi(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get the transmission queue size for a UE with a channel_id logical channel id */
|
||||
rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
|
||||
|
||||
/*Get number of pdus in RLC buffer*/
|
||||
rlc_buffer_occupancy_t flexran_get_num_pdus_buffer(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
|
||||
|
||||
/* Get the head of line delay for a UE with a channel_id logical channel id */
|
||||
frame_t flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
|
||||
|
||||
/* Check the status of the timing advance for a UE */
|
||||
int32_t flexran_get_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
|
||||
|
||||
/* Update the timing advance status(find out whether a timing advance command is required) */
|
||||
/* currently broken
|
||||
void flexran_update_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id); */
|
||||
|
||||
/* Return timing advance MAC control element for a designated cell and UE */
|
||||
/* this function is broken */
|
||||
int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
|
||||
|
||||
/* Get the number of active component carriers for a specific UE */
|
||||
int flexran_get_active_CC(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get the rank indicator for a designated cell and UE */
|
||||
uint8_t flexran_get_current_RI(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
|
||||
|
||||
/* See TS 36.213, section 10.1 */
|
||||
uint16_t flexran_get_n1pucch_an(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* See TS 36.211, section 5.4 */
|
||||
uint8_t flexran_get_nRB_CQI(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* See TS 36.211, section 5.4 */
|
||||
uint8_t flexran_get_deltaPUCCH_Shift(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* See TS 36.211, section 5.7.1 */
|
||||
uint8_t flexran_get_prach_ConfigIndex(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* See TS 36.211, section 5.7.1 */
|
||||
uint8_t flexran_get_prach_FreqOffset(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* See TS 36.321 */
|
||||
uint8_t flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get the length of the UL cyclic prefix */
|
||||
lte_prefix_type_t flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get the length of the DL cyclic prefix */
|
||||
lte_prefix_type_t flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get the physical cell id of a cell */
|
||||
uint16_t flexran_get_cell_id(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* See TS 36.211, section 5.5.3.2 */
|
||||
uint8_t flexran_get_srs_BandwidthConfig(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* See TS 36.211, table 5.5.3.3-1 and 2 */
|
||||
uint8_t flexran_get_srs_SubframeConfig(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Boolean value. See TS 36.211,
|
||||
section 5.5.3.2. TDD only */
|
||||
uint8_t flexran_get_srs_MaxUpPts(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get number of DL resource blocks */
|
||||
uint8_t flexran_get_N_RB_DL(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get number of UL resource blocks */
|
||||
uint8_t flexran_get_N_RB_UL(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get number of resource block groups */
|
||||
uint8_t flexran_get_N_RBG(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get DL/UL subframe assignment. TDD only */
|
||||
uint8_t flexran_get_subframe_assignment(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* TDD only. See TS 36.211, table 4.2.1 */
|
||||
uint8_t flexran_get_special_subframe_assignment(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get the duration of the random access response window in subframes */
|
||||
long flexran_get_ra_ResponseWindowSize(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get timer used for random access */
|
||||
long flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get type of duplex mode(FDD/TDD) */
|
||||
Protocol__FlexDuplexMode flexran_get_duplex_mode(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get the SI window length */
|
||||
long flexran_get_si_window_length(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get length of SystemInformationBlock1 */
|
||||
uint8_t flexran_get_sib1_length(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* Get the number of PDCCH symbols configured for the cell */
|
||||
uint8_t flexran_get_num_pdcch_symb(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
uint8_t flexran_get_antenna_ports(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/* See TS 36.213, sec 5.1.1.1 */
|
||||
int flexran_get_tpc(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
|
||||
|
||||
uint8_t flexran_get_ue_wpmi(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
|
||||
|
||||
/* Get the first available HARQ process for a specific cell and UE during
|
||||
a designated frame and subframe. Returns 0 for success. The id and the
|
||||
status of the HARQ process are stored in id and status respectively */
|
||||
/* currently broken
|
||||
int flexran_get_harq(mid_t mod_id, uint8_t cc_id, mid_t ue_id, frame_t frame,
|
||||
sub_frame_t subframe, unsigned char *id, unsigned char *round,
|
||||
uint8_t harq_flag); */
|
||||
|
||||
/* Uplink power control management*/
|
||||
int32_t flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
|
||||
|
||||
int8_t flexran_get_p0_nominal_pucch(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
int32_t flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
|
||||
|
||||
int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
|
||||
|
||||
uint8_t flexran_get_threequarter_fs(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
PUSCH_HOPPING_t flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
uint8_t flexran_get_hopping_offset(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
uint8_t flexran_get_n_SB(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
int flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
uint8_t flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
PHICH_DURATION_t flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/*
|
||||
* ************************************
|
||||
* Get Messages for UE Configuration Reply
|
||||
* ************************************
|
||||
*/
|
||||
|
||||
/* Get timer in subframes. Controls the synchronization
|
||||
status of the UE, not the actual timing
|
||||
advance procedure. See TS 36.321 */
|
||||
TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get measurement gap configuration. See TS 36.133 */
|
||||
Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get measurement gap configuration offset if applicable */
|
||||
long flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* DL aggregated bit-rate of non-gbr bearer
|
||||
per UE. See TS 36.413 */
|
||||
uint64_t flexran_get_ue_aggregated_max_bitrate_dl(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* UL aggregated bit-rate of non-gbr bearer
|
||||
per UE. See TS 36.413 */
|
||||
uint64_t flexran_get_ue_aggregated_max_bitrate_ul(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Only half-duplex support. FDD operation. Boolean value */
|
||||
int flexran_get_half_duplex(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Support of intra-subframe hopping. Boolean value */
|
||||
int flexran_get_intra_sf_hopping(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* UE support for type 2 hopping with n_sb>1 */
|
||||
int flexran_get_type2_sb_1(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get the UE category */
|
||||
long flexran_get_ue_category(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* UE support for resource allocation type 1 */
|
||||
int flexran_get_res_alloc_type1(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get UE transmission mode */
|
||||
long flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Boolean value. See TS 36.321 */
|
||||
BOOLEAN_t flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* The max HARQ retransmission for UL.
|
||||
See TS 36.321 */
|
||||
long flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* See TS 36.213 */
|
||||
long flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* See TS 36.213 */
|
||||
long flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* See TS 36.213 */
|
||||
long flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Boolean. See TS36.213, Section 10.1 */
|
||||
BOOLEAN_t flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Boolean. See TS 36.213, Section 8.2 */
|
||||
BOOLEAN_t flexran_get_ack_nack_simultaneous_trans(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
|
||||
|
||||
/* Get aperiodic CQI report mode */
|
||||
CQI_ReportModeAperiodic_t flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id);
|
||||
|
||||
/* Get ACK/NACK feedback mode. TDD only */
|
||||
long flexran_get_tdd_ack_nack_feedback_mode(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* See TS36.213, section 10.1 */
|
||||
long flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Boolean. Extended buffer status report size */
|
||||
long flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get number of UE transmission antennas */
|
||||
int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get the IMSI of UE */
|
||||
uint64_t flexran_get_ue_imsi(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get logical channel group of a channel with id lc_id */
|
||||
long flexran_get_lcg(mid_t mod_id, mid_t ue_id, mid_t lc_id);
|
||||
|
||||
/* Get direction of logical channel with id lc_id */
|
||||
int flexran_get_direction(mid_t ue_id, mid_t lc_id);
|
||||
|
||||
/*Get downlink frequency*/
|
||||
uint32_t flexran_agent_get_operating_dl_freq(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/*Get uplink frequency*/
|
||||
uint32_t flexran_agent_get_operating_ul_freq(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/*Get eutra band*/
|
||||
uint8_t flexran_agent_get_operating_eutra_band(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/*Get downlink ref signal power*/
|
||||
int8_t flexran_agent_get_operating_pdsch_refpower(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/*Get uplink power*/
|
||||
long flexran_agent_get_operating_pusch_p0(mid_t mod_id, uint8_t cc_id);
|
||||
|
||||
/*set the dl freq */
|
||||
void flexran_agent_set_operating_dl_freq(mid_t mod_id, uint8_t cc_id, uint32_t dl_freq_mhz);
|
||||
|
||||
/* set the ul freq */
|
||||
void flexran_agent_set_operating_ul_freq(mid_t mod_id, uint8_t cc_id, int32_t ul_freq_mhz_offset);
|
||||
|
||||
/*set the the band */
|
||||
void flexran_agent_set_operating_eutra_band(mid_t mod_id, uint8_t cc_id, uint8_t eutra_band);
|
||||
|
||||
/* set the bandwidth (in RB) */
|
||||
void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t N_RB);
|
||||
|
||||
/*set frame type*/
|
||||
void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, lte_frame_type_t frame_type);
|
||||
|
||||
/*RRC status flexRAN*/
|
||||
uint8_t flexran_get_rrc_status(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
|
||||
/***************************** PDCP ***********************/
|
||||
|
||||
/*PDCP superframe numberflexRAN*/
|
||||
uint32_t flexran_get_pdcp_sfn(const mid_t mod_id);
|
||||
|
||||
/*PDCP pdcp tx stats window*/
|
||||
void flexran_set_pdcp_tx_stat_window(const mid_t mod_id, const mid_t ue_id, uint16_t obs_window);
|
||||
|
||||
/*PDCP pdcp rx stats window*/
|
||||
void flexran_set_pdcp_rx_stat_window(const mid_t mod_id, const mid_t ue_id, uint16_t obs_window);
|
||||
|
||||
/*PDCP num tx pdu status flexRAN*/
|
||||
uint32_t flexran_get_pdcp_tx(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP num tx bytes status flexRAN*/
|
||||
uint32_t flexran_get_pdcp_tx_bytes(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP number of transmit packet / second status flexRAN*/
|
||||
uint32_t flexran_get_pdcp_tx_w(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP pdcp tx bytes in a given window flexRAN*/
|
||||
uint32_t flexran_get_pdcp_tx_bytes_w(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP tx sequence number flexRAN*/
|
||||
uint32_t flexran_get_pdcp_tx_sn(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP tx aggregated packet arrival flexRAN*/
|
||||
uint32_t flexran_get_pdcp_tx_aiat(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP tx aggregated packet arrival per second flexRAN*/
|
||||
uint32_t flexran_get_pdcp_tx_aiat_w(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
|
||||
/*PDCP num rx pdu status flexRAN*/
|
||||
uint32_t flexran_get_pdcp_rx(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP num rx bytes status flexRAN*/
|
||||
uint32_t flexran_get_pdcp_rx_bytes(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP number of received packet / second flexRAN*/
|
||||
uint32_t flexran_get_pdcp_rx_w(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP gootput (bit/s) status flexRAN*/
|
||||
uint32_t flexran_get_pdcp_rx_bytes_w(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP rx sequence number flexRAN*/
|
||||
uint32_t flexran_get_pdcp_rx_sn(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP rx aggregated packet arrival flexRAN*/
|
||||
uint32_t flexran_get_pdcp_rx_aiat(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP rx aggregated packet arrival per second flexRAN*/
|
||||
uint32_t flexran_get_pdcp_rx_aiat_w(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*PDCP num of received outoforder pdu status flexRAN*/
|
||||
uint32_t flexran_get_pdcp_rx_oo(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
|
||||
|
||||
/*********************RRC**********************/
|
||||
/*Get primary cell measuremeant id flexRAN*/
|
||||
MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/*Get primary cell RSRP measurement flexRAN*/
|
||||
float flexran_get_rrc_pcell_rsrp(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/*Get primary cell RSRQ measurement flexRAN*/
|
||||
float flexran_get_rrc_pcell_rsrq(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/* Get RRC neighbouring measurement */
|
||||
int flexran_get_rrc_num_ncell(mid_t mod_id, mid_t ue_id);
|
||||
|
||||
/*Get physical cell id*/
|
||||
PhysCellId_t flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, mid_t ue_id, int cell_id);
|
||||
|
||||
/*Get RSRP of neighbouring Cell*/
|
||||
float flexran_get_rrc_neigh_rsrp(mid_t mod_id, mid_t ue_id, int cell_id);
|
||||
|
||||
/*Get RSRQ of neighbouring Cell*/
|
||||
float flexran_get_rrc_neigh_rsrq(mid_t mod_id, mid_t ue_id, int cell_id);
|
||||
|
||||
/*Get MCC PLMN identity neighbouring Cell*/
|
||||
/* currently not implemented
|
||||
int flexran_get_rrc_neigh_plmn_mcc(mid_t mod_id, mid_t ue_id, int cell_id); */
|
||||
|
||||
/*Get MNC PLMN identity neighbouring Cell*/
|
||||
/* currently not implemented
|
||||
int flexran_get_rrc_neigh_plmn_mnc(mid_t mod_id, mid_t ue_id, int cell_id); */
|
||||
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* 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 flexran_agent_timer.c
|
||||
* \brief FlexRAN Timer
|
||||
* \author shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
/*
|
||||
* timer primitives
|
||||
*/
|
||||
|
||||
#include "flexran_agent_timer.h"
|
||||
|
||||
//struct flexran_agent_map agent_map;
|
||||
flexran_agent_timer_instance_t timer_instance;
|
||||
int agent_timer_init = 0;
|
||||
err_code_t flexran_agent_init_timer(void){
|
||||
|
||||
LOG_I(FLEXRAN_AGENT, "init RB tree\n");
|
||||
if (!agent_timer_init) {
|
||||
RB_INIT(&timer_instance.flexran_agent_head);
|
||||
agent_timer_init = 1;
|
||||
}
|
||||
|
||||
return PROTOCOL__FLEXRAN_ERR__NO_ERR;
|
||||
}
|
||||
|
||||
RB_GENERATE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer);
|
||||
|
||||
/* The timer_id might not be the best choice for the comparison */
|
||||
int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b){
|
||||
|
||||
if (a->timer_id < b->timer_id) return -1;
|
||||
if (a->timer_id > b->timer_id) return 1;
|
||||
|
||||
// equal timers
|
||||
return 0;
|
||||
}
|
||||
|
||||
err_code_t flexran_agent_create_timer(uint32_t interval_sec,
|
||||
uint32_t interval_usec,
|
||||
agent_id_t agent_id,
|
||||
instance_t instance,
|
||||
uint32_t timer_type,
|
||||
xid_t xid,
|
||||
flexran_agent_timer_callback_t cb,
|
||||
void* timer_args,
|
||||
long *timer_id){
|
||||
|
||||
struct flexran_agent_timer_element_s *e = calloc(1, sizeof(*e));
|
||||
DevAssert(e != NULL);
|
||||
|
||||
//uint32_t timer_id;
|
||||
int ret=-1;
|
||||
|
||||
if ((interval_sec == 0) && (interval_usec == 0 ))
|
||||
return TIMER_NULL;
|
||||
|
||||
if (timer_type >= FLEXRAN_AGENT_TIMER_TYPE_MAX)
|
||||
return TIMER_TYPE_INVALIDE;
|
||||
|
||||
if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_ONESHOT){
|
||||
ret = timer_setup(interval_sec,
|
||||
interval_usec,
|
||||
TASK_FLEXRAN_AGENT,
|
||||
instance,
|
||||
TIMER_ONE_SHOT,
|
||||
timer_args,
|
||||
timer_id);
|
||||
|
||||
e->type = TIMER_ONE_SHOT;
|
||||
}
|
||||
else if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_PERIODIC ){
|
||||
ret = timer_setup(interval_sec,
|
||||
interval_usec,
|
||||
TASK_FLEXRAN_AGENT,
|
||||
instance,
|
||||
TIMER_PERIODIC,
|
||||
timer_args,
|
||||
timer_id);
|
||||
|
||||
e->type = TIMER_PERIODIC;
|
||||
}
|
||||
|
||||
if (ret < 0 ) {
|
||||
return TIMER_SETUP_FAILED;
|
||||
}
|
||||
|
||||
e->agent_id = agent_id;
|
||||
e->instance = instance;
|
||||
e->state = FLEXRAN_AGENT_TIMER_STATE_ACTIVE;
|
||||
e->timer_id = *timer_id;
|
||||
e->xid = xid;
|
||||
e->timer_args = timer_args;
|
||||
e->cb = cb;
|
||||
/*element should be a real pointer*/
|
||||
RB_INSERT(flexran_agent_map, &timer_instance.flexran_agent_head, e);
|
||||
|
||||
LOG_I(FLEXRAN_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n",
|
||||
e->timer_id, e->agent_id, e->instance);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
err_code_t flexran_agent_destroy_timer(long timer_id){
|
||||
|
||||
struct flexran_agent_timer_element_s *e = get_timer_entry(timer_id);
|
||||
|
||||
if (e != NULL ) {
|
||||
RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
|
||||
flexran_agent_destroy_flexran_message(e->timer_args->msg);
|
||||
free(e);
|
||||
}
|
||||
|
||||
if (timer_remove(timer_id) < 0 )
|
||||
goto error;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
LOG_E(FLEXRAN_AGENT, "timer can't be removed\n");
|
||||
return TIMER_REMOVED_FAILED ;
|
||||
}
|
||||
|
||||
err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid) {
|
||||
struct flexran_agent_timer_element_s *e = NULL;
|
||||
long timer_id;
|
||||
RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) {
|
||||
if (e->xid == xid) {
|
||||
timer_id = e->timer_id;
|
||||
RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
|
||||
flexran_agent_destroy_flexran_message(e->timer_args->msg);
|
||||
free(e);
|
||||
if (timer_remove(timer_id) < 0 ) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
error:
|
||||
LOG_E(FLEXRAN_AGENT, "timer can't be removed\n");
|
||||
return TIMER_REMOVED_FAILED ;
|
||||
}
|
||||
|
||||
err_code_t flexran_agent_destroy_timers(void){
|
||||
|
||||
struct flexran_agent_timer_element_s *e = NULL;
|
||||
|
||||
RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) {
|
||||
RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
|
||||
timer_remove(e->timer_id);
|
||||
flexran_agent_destroy_flexran_message(e->timer_args->msg);
|
||||
free(e);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
void flexran_agent_sleep_until(struct timespec *ts, int delay) {
|
||||
ts->tv_nsec += delay;
|
||||
if(ts->tv_nsec >= 1000*1000*1000){
|
||||
ts->tv_nsec -= 1000*1000*1000;
|
||||
ts->tv_sec++;
|
||||
}
|
||||
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, ts, NULL);
|
||||
}
|
||||
|
||||
|
||||
err_code_t flexran_agent_stop_timer(long timer_id){
|
||||
|
||||
struct flexran_agent_timer_element_s *e=NULL;
|
||||
struct flexran_agent_timer_element_s search;
|
||||
memset(&search, 0, sizeof(struct flexran_agent_timer_element_s));
|
||||
search.timer_id = timer_id;
|
||||
|
||||
e = RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search);
|
||||
|
||||
if (e != NULL ) {
|
||||
e->state = FLEXRAN_AGENT_TIMER_STATE_STOPPED;
|
||||
}
|
||||
|
||||
timer_remove(timer_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct flexran_agent_timer_element_s * get_timer_entry(long timer_id) {
|
||||
|
||||
struct flexran_agent_timer_element_s search;
|
||||
memset(&search, 0, sizeof(struct flexran_agent_timer_element_s));
|
||||
search.timer_id = timer_id;
|
||||
|
||||
return RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search);
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* 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 flexran_agent_timer.h
|
||||
* \brief FlexRAN Timer header
|
||||
* \author shahab SHARIAT BAGHERI
|
||||
* \date 2017
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "flexran_agent_common.h"
|
||||
#include "flexran_agent_common_internal.h"
|
||||
#include "flexran_agent_extern.h"
|
||||
#include "flexran_agent_defs.h"
|
||||
|
||||
|
||||
# include "tree.h"
|
||||
# include "intertask_interface.h"
|
||||
# include "timer.h"
|
||||
|
||||
|
||||
|
||||
/*******************
|
||||
* timer primitves
|
||||
*******************/
|
||||
|
||||
#define TIMER_NULL -1
|
||||
#define TIMER_TYPE_INVALIDE -2
|
||||
#define TIMER_SETUP_FAILED -3
|
||||
#define TIMER_REMOVED_FAILED -4
|
||||
#define TIMER_ELEMENT_NOT_FOUND -5
|
||||
|
||||
|
||||
/* Type of the callback executed when the timer expired */
|
||||
typedef Protocol__FlexranMessage *(*flexran_agent_timer_callback_t)(void*);
|
||||
|
||||
|
||||
typedef struct flexran_agent_timer_args_s{
|
||||
mid_t mod_id;
|
||||
Protocol__FlexranMessage *msg;
|
||||
} flexran_agent_timer_args_t;
|
||||
|
||||
|
||||
typedef struct flexran_agent_timer_element_s{
|
||||
RB_ENTRY(flexran_agent_timer_element_s) entry;
|
||||
|
||||
agent_id_t agent_id;
|
||||
instance_t instance;
|
||||
|
||||
flexran_agent_timer_type_t type;
|
||||
flexran_agent_timer_state_t state;
|
||||
|
||||
uint32_t interval_sec;
|
||||
uint32_t interval_usec;
|
||||
|
||||
long timer_id; /* Timer id returned by the timer API*/
|
||||
xid_t xid; /*The id of the task as received by the controller
|
||||
message*/
|
||||
|
||||
flexran_agent_timer_callback_t cb;
|
||||
flexran_agent_timer_args_t *timer_args;
|
||||
|
||||
} flexran_agent_timer_element_t;
|
||||
|
||||
typedef struct flexran_agent_timer_instance_s{
|
||||
RB_HEAD(flexran_agent_map, flexran_agent_timer_element_s) flexran_agent_head;
|
||||
}flexran_agent_timer_instance_t;
|
||||
|
||||
|
||||
err_code_t flexran_agent_init_timer(void);
|
||||
|
||||
/* Create a timer for some agent related event with id xid. Will store the id
|
||||
of the generated timer in timer_id */
|
||||
err_code_t flexran_agent_create_timer(uint32_t interval_sec,
|
||||
uint32_t interval_usec,
|
||||
agent_id_t agent_id,
|
||||
instance_t instance,
|
||||
uint32_t timer_type,
|
||||
xid_t xid,
|
||||
flexran_agent_timer_callback_t cb,
|
||||
void* timer_args,
|
||||
long *timer_id);
|
||||
|
||||
/* Destroy all existing timers */
|
||||
err_code_t flexran_agent_destroy_timers(void);
|
||||
|
||||
/* Destroy the timer with the given timer_id */
|
||||
err_code_t flexran_agent_destroy_timer(long timer_id);
|
||||
|
||||
/* Destroy the timer for task with id xid */
|
||||
err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid);
|
||||
|
||||
/* Stop a timer */
|
||||
err_code_t flexran_agent_stop_timer(long timer_id);
|
||||
|
||||
/* Restart the given timer */
|
||||
err_code_t flexran_agent_restart_timer(long *timer_id);
|
||||
|
||||
/* Find the timer with the given timer_id */
|
||||
struct flexran_agent_timer_element_s * get_timer_entry(long timer_id);
|
||||
|
||||
/* Obtain the protocol message stored in the given expired timer */
|
||||
Protocol__FlexranMessage * flexran_agent_process_timeout(long timer_id, void* timer_args);
|
||||
|
||||
/* Comparator function comparing two timers. Decides the ordering of the timers */
|
||||
int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b);
|
||||
|
||||
/*Specify a delay in nanoseconds to timespec and sleep until then*/
|
||||
void flexran_agent_sleep_until(struct timespec *ts, int delay);
|
||||
|
||||
/* RB_PROTOTYPE is for .h files */
|
||||
RB_PROTOTYPE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer);
|
||||
+496
-763
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,584 @@
|
||||
|
||||
/*
|
||||
* 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 config.c
|
||||
* \brief UE and eNB configuration performed by RRC or as a consequence of RRC procedures
|
||||
* \author Navid Nikaein and Raymond Knopp
|
||||
* \date 2010 - 2014
|
||||
* \version 0.1
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
#include "COMMON/platform_types.h"
|
||||
#include "COMMON/platform_constants.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "SystemInformationBlockType2.h"
|
||||
//#include "RadioResourceConfigCommonSIB.h"
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#ifdef Rel14
|
||||
#include "PRACH-ConfigSIB-v1310.h"
|
||||
#endif
|
||||
#include "MeasGapConfig.h"
|
||||
#include "MeasObjectToAddModList.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "MAC-MainConfig.h"
|
||||
#include "defs.h"
|
||||
#include "proto.h"
|
||||
#include "extern.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#include "common/ran_context.h"
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
#include "MBSFN-AreaInfoList-r9.h"
|
||||
#include "MBSFN-AreaInfo-r9.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "PMCH-InfoList-r9.h"
|
||||
#endif
|
||||
|
||||
extern void mac_init_cell_params(int Mod_idP,int CC_idP);
|
||||
extern void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
|
||||
|
||||
|
||||
/* sec 5.9, 36.321: MAC Reset Procedure */
|
||||
void ue_mac_reset(module_id_t module_idP, uint8_t eNB_index)
|
||||
{
|
||||
|
||||
//Resetting Bj
|
||||
UE_mac_inst[module_idP].scheduling_info.Bj[0] = 0;
|
||||
UE_mac_inst[module_idP].scheduling_info.Bj[1] = 0;
|
||||
UE_mac_inst[module_idP].scheduling_info.Bj[2] = 0;
|
||||
|
||||
//Stopping all timers
|
||||
|
||||
//timeAlignmentTimer expires
|
||||
|
||||
// PHY changes for UE MAC reset
|
||||
phy_reset_ue(module_idP, 0, eNB_index);
|
||||
|
||||
// notify RRC to relase PUCCH/SRS
|
||||
// cancel all pending SRs
|
||||
UE_mac_inst[module_idP].scheduling_info.SR_pending = 0;
|
||||
UE_mac_inst[module_idP].scheduling_info.SR_COUNTER = 0;
|
||||
|
||||
//Set BSR Trigger Bmp and remove timer flags
|
||||
UE_mac_inst[module_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
|
||||
|
||||
// stop ongoing RACH procedure
|
||||
|
||||
// discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = 0; // check!
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
|
||||
|
||||
ue_init_mac(module_idP); //This will hopefully do the rest of the MAC reset procedure
|
||||
|
||||
}
|
||||
|
||||
int32_t **rxdata;
|
||||
int32_t **txdata;
|
||||
|
||||
|
||||
int
|
||||
rrc_mac_config_req_ue(module_id_t Mod_idP,
|
||||
int CC_idP,
|
||||
uint8_t eNB_index,
|
||||
RadioResourceConfigCommonSIB_t *
|
||||
radioResourceConfigCommon,
|
||||
struct PhysicalConfigDedicated
|
||||
*physicalConfigDedicated,
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
SCellToAddMod_r10_t * sCellToAddMod_r10,
|
||||
//struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
|
||||
#endif
|
||||
MeasObjectToAddMod_t ** measObj,
|
||||
MAC_MainConfig_t * mac_MainConfig,
|
||||
long logicalChannelIdentity,
|
||||
LogicalChannelConfig_t * logicalChannelConfig,
|
||||
MeasGapConfig_t * measGapConfig,
|
||||
TDD_Config_t * tdd_Config,
|
||||
MobilityControlInfo_t * mobilityControlInfo,
|
||||
uint8_t * SIwindowsize,
|
||||
uint16_t * SIperiod,
|
||||
ARFCN_ValueEUTRA_t * ul_CarrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
AdditionalSpectrumEmission_t *
|
||||
additionalSpectrumEmission,
|
||||
struct MBSFN_SubframeConfigList
|
||||
*mbsfn_SubframeConfigList
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
, uint8_t MBMS_Flag,
|
||||
MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList,
|
||||
PMCH_InfoList_r9_t * pmch_InfoList
|
||||
#endif
|
||||
#ifdef CBA
|
||||
, uint8_t num_active_cba_groups, uint16_t cba_rnti
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
|
||||
|
||||
LOG_I(MAC, "[CONFIG][UE %d] Configuring MAC/PHY from eNB %d\n",
|
||||
Mod_idP, eNB_index);
|
||||
|
||||
if (tdd_Config != NULL) {
|
||||
UE_mac_inst[Mod_idP].tdd_Config = tdd_Config;
|
||||
}
|
||||
|
||||
|
||||
if (tdd_Config && SIwindowsize && SIperiod) {
|
||||
phy_config_sib1_ue(Mod_idP, 0, eNB_index, tdd_Config,
|
||||
*SIwindowsize, *SIperiod);
|
||||
}
|
||||
|
||||
if (radioResourceConfigCommon != NULL) {
|
||||
UE_mac_inst[Mod_idP].radioResourceConfigCommon =
|
||||
radioResourceConfigCommon;
|
||||
phy_config_sib2_ue(Mod_idP, 0, eNB_index,
|
||||
radioResourceConfigCommon, ul_CarrierFreq,
|
||||
ul_Bandwidth, additionalSpectrumEmission,
|
||||
mbsfn_SubframeConfigList);
|
||||
}
|
||||
// SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup
|
||||
if (logicalChannelConfig != NULL) {
|
||||
LOG_I(MAC,
|
||||
"[CONFIG][UE %d] Applying RRC logicalChannelConfig from eNB%d\n",
|
||||
Mod_idP, eNB_index);
|
||||
UE_mac_inst[Mod_idP].logicalChannelConfig[logicalChannelIdentity] =
|
||||
logicalChannelConfig;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.Bj[logicalChannelIdentity] = 0; // initilize the bucket for this lcid
|
||||
|
||||
AssertFatal(logicalChannelConfig->ul_SpecificParameters != NULL,
|
||||
"[UE %d] LCID %ld NULL ul_SpecificParameters\n",
|
||||
Mod_idP, logicalChannelIdentity);
|
||||
UE_mac_inst[Mod_idP].scheduling_info.bucket_size[logicalChannelIdentity] = logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate * logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration; // set the max bucket size
|
||||
if (logicalChannelConfig->ul_SpecificParameters->
|
||||
logicalChannelGroup != NULL) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.
|
||||
LCGID[logicalChannelIdentity] =
|
||||
*logicalChannelConfig->ul_SpecificParameters->
|
||||
logicalChannelGroup;
|
||||
LOG_D(MAC,
|
||||
"[CONFIG][UE %d] LCID %ld is attached to the LCGID %ld\n",
|
||||
Mod_idP, logicalChannelIdentity,
|
||||
*logicalChannelConfig->
|
||||
ul_SpecificParameters->logicalChannelGroup);
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.
|
||||
LCGID[logicalChannelIdentity] = MAX_NUM_LCGID;
|
||||
}
|
||||
UE_mac_inst[Mod_idP].
|
||||
scheduling_info.LCID_buffer_remain[logicalChannelIdentity] = 0;
|
||||
}
|
||||
|
||||
if (mac_MainConfig != NULL) {
|
||||
LOG_I(MAC,
|
||||
"[CONFIG][UE%d] Applying RRC macMainConfig from eNB%d\n",
|
||||
Mod_idP, eNB_index);
|
||||
UE_mac_inst[Mod_idP].macConfig = mac_MainConfig;
|
||||
UE_mac_inst[Mod_idP].measGapConfig = measGapConfig;
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config) {
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config->periodicBSR_Timer) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer =
|
||||
(uint16_t) *
|
||||
mac_MainConfig->ul_SCH_Config->periodicBSR_Timer;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer =
|
||||
#ifndef Rel14
|
||||
(uint16_t)
|
||||
MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity
|
||||
#else
|
||||
(uint16_t) PeriodicBSR_Timer_r12_infinity;
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config->maxHARQ_Tx) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx =
|
||||
(uint16_t) * mac_MainConfig->ul_SCH_Config->maxHARQ_Tx;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx =
|
||||
(uint16_t)
|
||||
MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
|
||||
}
|
||||
phy_config_harq_ue(Mod_idP, 0, eNB_index,
|
||||
UE_mac_inst[Mod_idP].
|
||||
scheduling_info.maxHARQ_Tx);
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
|
||||
(uint16_t) mac_MainConfig->ul_SCH_Config->
|
||||
retxBSR_Timer;
|
||||
} else {
|
||||
#ifndef Rel14
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
|
||||
(uint16_t)
|
||||
MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560;
|
||||
#else
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
|
||||
(uint16_t) RetxBSR_Timer_r12_sf2560;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
if (mac_MainConfig->ext1
|
||||
&& mac_MainConfig->ext1->sr_ProhibitTimer_r9) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer =
|
||||
(uint16_t) * mac_MainConfig->ext1->sr_ProhibitTimer_r9;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = 0;
|
||||
}
|
||||
|
||||
if (mac_MainConfig->ext2
|
||||
&& mac_MainConfig->ext2->mac_MainConfig_v1020) {
|
||||
if (mac_MainConfig->ext2->
|
||||
mac_MainConfig_v1020->extendedBSR_Sizes_r10) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.
|
||||
extendedBSR_Sizes_r10 =
|
||||
(uint16_t) *
|
||||
mac_MainConfig->ext2->
|
||||
mac_MainConfig_v1020->extendedBSR_Sizes_r10;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.
|
||||
extendedBSR_Sizes_r10 = (uint16_t) 0;
|
||||
}
|
||||
if (mac_MainConfig->ext2->mac_MainConfig_v1020->
|
||||
extendedPHR_r10) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 =
|
||||
(uint16_t) *
|
||||
mac_MainConfig->ext2->mac_MainConfig_v1020->
|
||||
extendedPHR_r10;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 =
|
||||
(uint16_t) 0;
|
||||
}
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 =
|
||||
(uint16_t) 0;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 =
|
||||
(uint16_t) 0;
|
||||
}
|
||||
#endif
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF =
|
||||
MAC_UE_BSR_TIMER_NOT_RUNNING;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF =
|
||||
MAC_UE_BSR_TIMER_NOT_RUNNING;
|
||||
|
||||
UE_mac_inst[Mod_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
|
||||
|
||||
LOG_D(MAC, "[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n",
|
||||
Mod_idP,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF);
|
||||
|
||||
UE_mac_inst[Mod_idP].scheduling_info.drx_config =
|
||||
mac_MainConfig->drx_Config;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.phr_config =
|
||||
mac_MainConfig->phr_Config;
|
||||
|
||||
if (mac_MainConfig->phr_Config) {
|
||||
UE_mac_inst[Mod_idP].PHR_state =
|
||||
mac_MainConfig->phr_Config->present;
|
||||
UE_mac_inst[Mod_idP].PHR_reconfigured = 1;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer =
|
||||
mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer =
|
||||
mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.PathlossChange =
|
||||
mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].PHR_reconfigured = 0;
|
||||
UE_mac_inst[Mod_idP].PHR_state =
|
||||
MAC_MainConfig__phr_Config_PR_setup;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer =
|
||||
MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer =
|
||||
MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.PathlossChange =
|
||||
MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;
|
||||
}
|
||||
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF =
|
||||
get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP].
|
||||
scheduling_info.periodicPHR_Timer);
|
||||
UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF =
|
||||
get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP].
|
||||
scheduling_info.prohibitPHR_Timer);
|
||||
UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db =
|
||||
get_db_dl_PathlossChange(UE_mac_inst[Mod_idP].
|
||||
scheduling_info.PathlossChange);
|
||||
UE_mac_inst[Mod_idP].PHR_reporting_active = 0;
|
||||
LOG_D(MAC,
|
||||
"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n",
|
||||
Mod_idP,
|
||||
(mac_MainConfig->phr_Config) ? mac_MainConfig->
|
||||
phr_Config->present : -1,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db);
|
||||
}
|
||||
|
||||
|
||||
if (physicalConfigDedicated != NULL) {
|
||||
phy_config_dedicated_ue(Mod_idP, 0, eNB_index,
|
||||
physicalConfigDedicated);
|
||||
UE_mac_inst[Mod_idP].physicalConfigDedicated = physicalConfigDedicated; // for SR proc
|
||||
}
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
if (sCellToAddMod_r10 != NULL) {
|
||||
|
||||
|
||||
phy_config_dedicated_scell_ue(Mod_idP, eNB_index,
|
||||
sCellToAddMod_r10, 1);
|
||||
UE_mac_inst[Mod_idP].physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10; // using SCell index 0
|
||||
}
|
||||
#endif
|
||||
|
||||
if (measObj != NULL) {
|
||||
if (measObj[0] != NULL) {
|
||||
UE_mac_inst[Mod_idP].n_adj_cells =
|
||||
measObj[0]->measObject.choice.
|
||||
measObjectEUTRA.cellsToAddModList->list.count;
|
||||
LOG_I(MAC, "Number of adjacent cells %d\n",
|
||||
UE_mac_inst[Mod_idP].n_adj_cells);
|
||||
|
||||
for (i = 0; i < UE_mac_inst[Mod_idP].n_adj_cells; i++) {
|
||||
UE_mac_inst[Mod_idP].adj_cell_id[i] =
|
||||
measObj[0]->measObject.choice.
|
||||
measObjectEUTRA.cellsToAddModList->list.array[i]->
|
||||
physCellId;
|
||||
LOG_I(MAC, "Cell %d : Nid_cell %d\n", i,
|
||||
UE_mac_inst[Mod_idP].adj_cell_id[i]);
|
||||
}
|
||||
|
||||
phy_config_meas_ue(Mod_idP, 0, eNB_index,
|
||||
UE_mac_inst[Mod_idP].n_adj_cells,
|
||||
UE_mac_inst[Mod_idP].adj_cell_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mobilityControlInfo != NULL) {
|
||||
|
||||
LOG_D(MAC, "[UE%d] MAC Reset procedure triggered by RRC eNB %d \n",
|
||||
Mod_idP, eNB_index);
|
||||
ue_mac_reset(Mod_idP, eNB_index);
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.
|
||||
rach_ConfigCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
rach_ConfigCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.rach_ConfigCommon,
|
||||
sizeof(RACH_ConfigCommon_t));
|
||||
}
|
||||
|
||||
memcpy((void *) &UE_mac_inst[Mod_idP].
|
||||
radioResourceConfigCommon->prach_Config.prach_ConfigInfo,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.prach_Config.prach_ConfigInfo,
|
||||
sizeof(PRACH_ConfigInfo_t));
|
||||
UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
prach_Config.rootSequenceIndex =
|
||||
mobilityControlInfo->radioResourceConfigCommon.
|
||||
prach_Config.rootSequenceIndex;
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.
|
||||
pdsch_ConfigCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
pdsch_ConfigCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.pdsch_ConfigCommon,
|
||||
sizeof(PDSCH_ConfigCommon_t));
|
||||
}
|
||||
// not a pointer: mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon
|
||||
memcpy((void *) &UE_mac_inst[Mod_idP].
|
||||
radioResourceConfigCommon->pusch_ConfigCommon,
|
||||
(void *) &mobilityControlInfo->
|
||||
radioResourceConfigCommon.pusch_ConfigCommon,
|
||||
sizeof(PUSCH_ConfigCommon_t));
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.phich_Config) {
|
||||
/* memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->phich_Config,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.phich_Config,
|
||||
sizeof(PHICH_Config_t)); */
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.
|
||||
pucch_ConfigCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
pucch_ConfigCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.pucch_ConfigCommon,
|
||||
sizeof(PUCCH_ConfigCommon_t));
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->
|
||||
radioResourceConfigCommon.soundingRS_UL_ConfigCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
soundingRS_UL_ConfigCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.soundingRS_UL_ConfigCommon,
|
||||
sizeof(SoundingRS_UL_ConfigCommon_t));
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->
|
||||
radioResourceConfigCommon.uplinkPowerControlCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
uplinkPowerControlCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.uplinkPowerControlCommon,
|
||||
sizeof(UplinkPowerControlCommon_t));
|
||||
}
|
||||
//configure antennaInfoCommon somewhere here..
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.p_Max) {
|
||||
//to be configured
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.tdd_Config) {
|
||||
UE_mac_inst[Mod_idP].tdd_Config =
|
||||
mobilityControlInfo->radioResourceConfigCommon.tdd_Config;
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->
|
||||
radioResourceConfigCommon.ul_CyclicPrefixLength) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
ul_CyclicPrefixLength,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.ul_CyclicPrefixLength,
|
||||
sizeof(UL_CyclicPrefixLength_t));
|
||||
}
|
||||
// store the previous rnti in case of failure, and set thenew rnti
|
||||
UE_mac_inst[Mod_idP].crnti_before_ho = UE_mac_inst[Mod_idP].crnti;
|
||||
UE_mac_inst[Mod_idP].crnti =
|
||||
((mobilityControlInfo->
|
||||
newUE_Identity.buf[0]) | (mobilityControlInfo->
|
||||
newUE_Identity.buf[1] << 8));
|
||||
LOG_I(MAC, "[UE %d] Received new identity %x from %d\n", Mod_idP,
|
||||
UE_mac_inst[Mod_idP].crnti, eNB_index);
|
||||
UE_mac_inst[Mod_idP].rach_ConfigDedicated =
|
||||
malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated));
|
||||
|
||||
if (mobilityControlInfo->rach_ConfigDedicated) {
|
||||
memcpy((void *) UE_mac_inst[Mod_idP].rach_ConfigDedicated,
|
||||
(void *) mobilityControlInfo->rach_ConfigDedicated,
|
||||
sizeof(*mobilityControlInfo->rach_ConfigDedicated));
|
||||
}
|
||||
|
||||
phy_config_afterHO_ue(Mod_idP, 0, eNB_index, mobilityControlInfo,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
if (mbsfn_SubframeConfigList != NULL) {
|
||||
LOG_I(MAC,
|
||||
"[UE %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n",
|
||||
Mod_idP, mbsfn_SubframeConfigList->list.count);
|
||||
UE_mac_inst[Mod_idP].num_sf_allocation_pattern =
|
||||
mbsfn_SubframeConfigList->list.count;
|
||||
|
||||
for (i = 0; i < mbsfn_SubframeConfigList->list.count; i++) {
|
||||
LOG_I(MAC,
|
||||
"[UE %d] Configuring MBSFN_SubframeConfig %d from received SIB2 \n",
|
||||
Mod_idP, i);
|
||||
UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i] =
|
||||
mbsfn_SubframeConfigList->list.array[i];
|
||||
// LOG_I("[UE %d] MBSFN_SubframeConfig[%d] pattern is %ld\n", Mod_idP,
|
||||
// UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]);
|
||||
}
|
||||
}
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
if (mbsfn_AreaInfoList != NULL) {
|
||||
LOG_I(MAC, "[UE %d][CONFIG] Received %d MBSFN Area Info\n",
|
||||
Mod_idP, mbsfn_AreaInfoList->list.count);
|
||||
UE_mac_inst[Mod_idP].num_active_mbsfn_area =
|
||||
mbsfn_AreaInfoList->list.count;
|
||||
|
||||
for (i = 0; i < mbsfn_AreaInfoList->list.count; i++) {
|
||||
UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i] =
|
||||
mbsfn_AreaInfoList->list.array[i];
|
||||
LOG_I(MAC,
|
||||
"[UE %d] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n",
|
||||
Mod_idP, i,
|
||||
UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i]->
|
||||
mcch_Config_r9.mcch_RepetitionPeriod_r9);
|
||||
phy_config_sib13_ue(Mod_idP, 0, eNB_index, i,
|
||||
UE_mac_inst[Mod_idP].
|
||||
mbsfn_AreaInfo[i]->mbsfn_AreaId_r9);
|
||||
}
|
||||
}
|
||||
|
||||
if (pmch_InfoList != NULL) {
|
||||
|
||||
// LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9));
|
||||
|
||||
LOG_I(MAC, "[UE %d] Configuring PMCH_config from MCCH MESSAGE \n",
|
||||
Mod_idP);
|
||||
|
||||
for (i = 0; i < pmch_InfoList->list.count; i++) {
|
||||
UE_mac_inst[Mod_idP].pmch_Config[i] =
|
||||
&pmch_InfoList->list.array[i]->pmch_Config_r9;
|
||||
LOG_I(MAC, "[UE %d] PMCH[%d]: MCH_Scheduling_Period = %ld\n",
|
||||
Mod_idP, i,
|
||||
UE_mac_inst[Mod_idP].
|
||||
pmch_Config[i]->mch_SchedulingPeriod_r9);
|
||||
}
|
||||
|
||||
UE_mac_inst[Mod_idP].mcch_status = 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef CBA
|
||||
|
||||
if (cba_rnti) {
|
||||
UE_mac_inst[Mod_idP].cba_rnti[num_active_cba_groups - 1] =
|
||||
cba_rnti;
|
||||
LOG_D(MAC,
|
||||
"[UE %d] configure CBA group %d RNTI %x for eNB %d (total active cba group %d)\n",
|
||||
Mod_idP, Mod_idP % num_active_cba_groups, cba_rnti,
|
||||
eNB_index, num_active_cba_groups);
|
||||
phy_config_cba_rnti(Mod_idP, CC_idP, eNB_flagP, eNB_index,
|
||||
cba_rnti, num_active_cba_groups - 1,
|
||||
num_active_cba_groups);
|
||||
}
|
||||
#endif
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
|
||||
|
||||
return (0);
|
||||
}
|
||||
+33
-16
@@ -39,15 +39,9 @@
|
||||
|
||||
|
||||
|
||||
#ifdef USER_MODE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
//#include "COMMON/openair_defs.h"
|
||||
|
||||
|
||||
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/LTE_TRANSPORT/defs.h"
|
||||
@@ -109,9 +103,7 @@
|
||||
//#define MCH_PAYLOAD_SIZE_MAX 16384// this value is using in case mcs and TBS index are high
|
||||
#endif
|
||||
|
||||
#ifdef USER_MODE
|
||||
#define printk printf
|
||||
#endif //USER_MODE
|
||||
|
||||
/*!\brief Maximum number of logical channl group IDs */
|
||||
#define MAX_NUM_LCGID 4
|
||||
@@ -163,6 +155,8 @@
|
||||
/*!\brief maximum number of slices / groups */
|
||||
#define MAX_NUM_SLICES 4
|
||||
|
||||
#define U_PLANE_INACTIVITY_VALUE 6000
|
||||
|
||||
/*
|
||||
* eNB part
|
||||
*/
|
||||
@@ -472,6 +466,15 @@ typedef struct {
|
||||
/// BCCH MCS
|
||||
uint32_t ccch_mcs;
|
||||
|
||||
/// num PCCH PDU per CC
|
||||
uint32_t total_num_pcch_pdu;
|
||||
/// PCCH buffer size
|
||||
uint32_t pcch_buffer;
|
||||
/// total PCCH buffer size
|
||||
uint32_t total_pcch_buffer;
|
||||
/// BCCH MCS
|
||||
uint32_t pcch_mcs;
|
||||
|
||||
/// num active users
|
||||
uint16_t num_dlactive_UEs;
|
||||
/// available number of PRBs for a give SF
|
||||
@@ -662,7 +665,7 @@ typedef struct {
|
||||
/// mcs from last UL scheduling
|
||||
uint8_t mcs_UL[8];
|
||||
/// TBS from last UL scheduling
|
||||
uint8_t TBS_UL[8];
|
||||
int TBS_UL[8];
|
||||
/// Flag to indicate UL has been scheduled at least once
|
||||
boolean_t ul_active;
|
||||
/// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received)
|
||||
@@ -689,7 +692,7 @@ typedef struct {
|
||||
uint16_t cshift[8]; // num_max_harq
|
||||
|
||||
/// Number of Allocated RBs by the ulsch preprocessor
|
||||
uint8_t pre_allocated_nb_rb_ul;
|
||||
uint8_t pre_allocated_nb_rb_ul[MAX_NUM_SLICES];
|
||||
|
||||
/// index of Allocated RBs by the ulsch preprocessor
|
||||
int8_t pre_allocated_rb_table_index_ul;
|
||||
@@ -717,9 +720,6 @@ typedef struct {
|
||||
|
||||
// Logical channel info for link with RLC
|
||||
|
||||
/// Last received UE BSR info for each logical channel group id
|
||||
uint8_t bsr_info[MAX_NUM_LCGID];
|
||||
|
||||
/// LCGID mapping
|
||||
long lcgidmap[11];
|
||||
|
||||
@@ -746,8 +746,6 @@ typedef struct {
|
||||
/// size of remaining size to send for the downlink head SDU
|
||||
uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID];
|
||||
|
||||
/// total uplink buffer size
|
||||
uint32_t ul_total_buffer;
|
||||
/// uplink buffer creation time for each LCID
|
||||
uint32_t ul_buffer_creation_time[MAX_NUM_LCGID];
|
||||
/// maximum uplink buffer creation time across all the LCIDs
|
||||
@@ -755,6 +753,11 @@ typedef struct {
|
||||
/// uplink buffer size per LCID
|
||||
uint32_t ul_buffer_info[MAX_NUM_LCGID];
|
||||
|
||||
/// uplink bytes that are currently scheduled
|
||||
int scheduled_ul_bytes;
|
||||
/// estimation of the UL buffer size
|
||||
int estimated_ul_buffer;
|
||||
|
||||
/// UE tx power
|
||||
int32_t ue_tx_power;
|
||||
|
||||
@@ -800,7 +803,8 @@ typedef struct {
|
||||
///Contention resolution timer used during random access
|
||||
uint8_t mac_ContentionResolutionTimer;
|
||||
|
||||
uint16_t max_allowed_rbs[MAX_NUM_LCID];
|
||||
uint16_t max_rbs_allowed_slice[MAX_NUM_CCs][MAX_NUM_SLICES];
|
||||
uint16_t max_rbs_allowed_slice_uplink[MAX_NUM_CCs][MAX_NUM_SLICES];
|
||||
|
||||
uint8_t max_mcs[MAX_NUM_LCID];
|
||||
|
||||
@@ -824,6 +828,8 @@ typedef struct {
|
||||
int32_t cqi_req_timer;
|
||||
int32_t ul_inactivity_timer;
|
||||
int32_t ul_failure_timer;
|
||||
uint32_t ue_reestablishment_reject_timer;
|
||||
uint32_t ue_reestablishment_reject_timer_thres;
|
||||
int32_t ul_scheduled;
|
||||
int32_t ra_pdcch_order_sent;
|
||||
int32_t ul_out_of_sync;
|
||||
@@ -855,6 +861,7 @@ typedef struct {
|
||||
uint8_t aperiodic_wideband_cqi1[NFAPI_CC_MAX];
|
||||
uint8_t aperiodic_wideband_pmi1[NFAPI_CC_MAX];
|
||||
uint8_t dl_cqi[NFAPI_CC_MAX];
|
||||
int32_t uplane_inactivity_timer;
|
||||
} UE_sched_ctrl;
|
||||
/*! \brief eNB template for the Random access information */
|
||||
typedef struct {
|
||||
@@ -956,6 +963,10 @@ typedef struct {
|
||||
int avail;
|
||||
int num_UEs;
|
||||
boolean_t active[NUMBER_OF_UE_MAX];
|
||||
|
||||
/// Sorting criteria for the UE list in the MAC preprocessor
|
||||
uint16_t sorting_criteria[MAX_NUM_SLICES][CR_NUM];
|
||||
|
||||
} UE_list_t;
|
||||
|
||||
/*! \brief eNB common channels */
|
||||
@@ -982,6 +993,10 @@ typedef struct {
|
||||
uint32_t BCCH_alloc_pdu;
|
||||
/// Outgoing CCCH pdu for PHY
|
||||
CCCH_PDU CCCH_pdu;
|
||||
/// Outgoing PCCH DCI allocation
|
||||
uint32_t PCCH_alloc_pdu;
|
||||
/// Outgoing PCCH pdu for PHY
|
||||
PCCH_PDU PCCH_pdu;
|
||||
/// Outgoing RAR pdu for PHY
|
||||
RAR_PDU RAR_pdu;
|
||||
/// Template for RA computations
|
||||
@@ -1102,6 +1117,8 @@ typedef struct eNB_MAC_INST_s {
|
||||
time_stats_t schedule_mch;
|
||||
/// processing time of eNB ULSCH reception
|
||||
time_stats_t rx_ulsch_sdu; // include rlc_data_ind
|
||||
/// processing time of eNB PCH scheduler
|
||||
time_stats_t schedule_pch;
|
||||
} eNB_MAC_INST;
|
||||
|
||||
/*
|
||||
|
||||
+496
-583
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -100,6 +100,7 @@ schedule_SIB1_BR(module_id_t module_idP,
|
||||
int n_NB = 0;
|
||||
int TBS;
|
||||
int k = 0, rvidx;
|
||||
uint16_t sfn_sf = frameP<<4|subframeP;
|
||||
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
|
||||
@@ -196,7 +197,7 @@ schedule_SIB1_BR(module_id_t module_idP,
|
||||
n_NB = Sj[((cc->physCellId % N_S_NB) + (i * N_S_NB / m)) % N_S_NB];
|
||||
|
||||
|
||||
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 1, &cc->BCCH_BR_pdu[0].payload[0], 1, module_idP, 0); // not used in this case
|
||||
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 1, &cc->BCCH_BR_pdu[0].payload[0], 0); // not used in this case
|
||||
|
||||
AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13 < 19,
|
||||
"schedulingInfoSIB1_BR_r13 %d > 18\n",
|
||||
@@ -234,59 +235,54 @@ schedule_SIB1_BR(module_id_t module_idP,
|
||||
memset((void *) dl_config_pdu, 0,
|
||||
sizeof(nfapi_dl_config_request_pdu_t));
|
||||
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
|
||||
dl_config_pdu->pdu_size =
|
||||
(uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
|
||||
dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length = TBS;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index =
|
||||
eNB->pdu_index[CC_id];
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id];
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFF;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding =
|
||||
getRIV(N_RB_DL, first_rb, 6);
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 6);
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = rvidx;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme =
|
||||
(cc->p_eNB == 1) ? 0 : 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
|
||||
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index =
|
||||
0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode =
|
||||
(cc->p_eNB == 1) ? 1 : 2;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB == 1) ? 1 : 2;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
|
||||
// Rel10 fields
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = 3;
|
||||
// Rel13 fields
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 1; // CEModeA UE
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 0; // SIB1-BR
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SFx
|
||||
|
||||
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
|
||||
dl_req->number_pdu++;
|
||||
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
|
||||
|
||||
// Program TX Request
|
||||
TX_req =
|
||||
&eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->
|
||||
TX_req
|
||||
[CC_id].tx_request_body.number_of_pdus];
|
||||
TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
|
||||
TX_req->pdu_length = bcch_sdu_length;
|
||||
TX_req->pdu_index = eNB->pdu_index[CC_id]++;
|
||||
TX_req->num_segments = 1;
|
||||
TX_req->segments[0].segment_length = bcch_sdu_length;
|
||||
TX_req->segments[0].segment_data = cc->BCCH_BR_pdu[0].payload;
|
||||
eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
|
||||
|
||||
eNB->TX_req[CC_id].sfn_sf = sfn_sf;
|
||||
eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
|
||||
|
||||
if (opt_enabled == 1) {
|
||||
trace_pdu(1,
|
||||
@@ -306,17 +302,11 @@ schedule_SIB1_BR(module_id_t module_idP,
|
||||
"[eNB] Frame %d : Scheduling BCCH-BR 0->DLSCH (FDD) for CC_id %d SIB1-BR %d bytes\n",
|
||||
frameP, CC_id, bcch_sdu_length);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int si_WindowLength_BR_r13tab
|
||||
[SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_spare]
|
||||
= { 20, 40, 60, 80, 120, 160, 200 };
|
||||
int si_TBS_r13tab[SchedulingInfo_BR_r13__si_TBS_r13_b936 + 1] =
|
||||
{ 152, 208, 256, 328, 408, 504, 600, 712, 808, 936 };
|
||||
int si_WindowLength_BR_r13tab[SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_spare] = { 20, 40, 60, 80, 120, 160, 200 };
|
||||
int si_TBS_r13tab[SchedulingInfo_BR_r13__si_TBS_r13_b936 + 1] = { 152, 208, 256, 328, 408, 504, 600, 712, 808, 936 };
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
@@ -324,7 +314,6 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
|
||||
sub_frame_t subframeP)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
int8_t bcch_sdu_length;
|
||||
int CC_id;
|
||||
eNB_MAC_INST *eNB = RC.mac[module_idP];
|
||||
@@ -338,6 +327,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
|
||||
int i;
|
||||
int rvidx;
|
||||
int absSF = (frameP * 10) + subframeP;
|
||||
uint16_t sfn_sf = frameP << 4 | subframeP;
|
||||
|
||||
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
@@ -351,65 +341,40 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
|
||||
if (cc->mib->message.schedulingInfoSIB1_BR_r13 == 0)
|
||||
continue;
|
||||
else {
|
||||
|
||||
|
||||
AssertFatal(cc->
|
||||
sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13
|
||||
!= NULL,
|
||||
AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL,
|
||||
"sib_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
|
||||
|
||||
SchedulingInfoList_BR_r13_t *schedulingInfoList_BR_r13 =
|
||||
cc->sib1_v13ext->
|
||||
bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13;
|
||||
SchedulingInfoList_BR_r13_t *schedulingInfoList_BR_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13;
|
||||
AssertFatal(schedulingInfoList_BR_r13 != NULL,
|
||||
"sib_v13ext->schedulingInfoList_BR_r13 is null\n");
|
||||
|
||||
SchedulingInfoList_t *schedulingInfoList =
|
||||
cc->schedulingInfoList;
|
||||
AssertFatal(schedulingInfoList_BR_r13->list.count ==
|
||||
schedulingInfoList->list.count,
|
||||
SchedulingInfoList_t *schedulingInfoList = cc->schedulingInfoList;
|
||||
AssertFatal(schedulingInfoList_BR_r13->list.count == schedulingInfoList->list.count,
|
||||
"schedulingInfolist_BR.r13->list.count %d != schedulingInfoList.list.count %d\n",
|
||||
schedulingInfoList_BR_r13->list.count,
|
||||
schedulingInfoList->list.count);
|
||||
|
||||
AssertFatal(cc->
|
||||
sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13
|
||||
<=
|
||||
SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200,
|
||||
AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13<=SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200,
|
||||
"si_WindowLength_BR_r13 %d > %d\n",
|
||||
(int) cc->
|
||||
sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13,
|
||||
(int) cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13,
|
||||
SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200);
|
||||
|
||||
// check that SI frequency-hopping is disabled
|
||||
AssertFatal(cc->
|
||||
sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13
|
||||
==
|
||||
SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_HoppingConfigCommon_r13_off,
|
||||
AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13 == SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_HoppingConfigCommon_r13_off,
|
||||
"Deactivate SI_HoppingConfigCommon_r13 in configuration file, not supported for now\n");
|
||||
long si_WindowLength_BR_r13 =
|
||||
si_WindowLength_BR_r13tab[cc->
|
||||
sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13];
|
||||
long si_WindowLength_BR_r13 = si_WindowLength_BR_r13tab[cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13];
|
||||
|
||||
long si_RepetitionPattern_r13 =
|
||||
cc->sib1_v13ext->
|
||||
bandwidthReducedAccessRelatedInfo_r13->si_RepetitionPattern_r13;
|
||||
AssertFatal(si_RepetitionPattern_r13 <=
|
||||
SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF,
|
||||
long si_RepetitionPattern_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_RepetitionPattern_r13;
|
||||
AssertFatal(si_RepetitionPattern_r13<=SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF,
|
||||
"si_RepetitionPattern_r13 %d > %d\n",
|
||||
(int) si_RepetitionPattern_r13,
|
||||
SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF);
|
||||
// cycle through SIB list
|
||||
|
||||
for (i = 0; i < schedulingInfoList_BR_r13->list.count; i++) {
|
||||
long si_Periodicity =
|
||||
schedulingInfoList->list.array[i]->si_Periodicity;
|
||||
long si_Narrowband_r13 =
|
||||
schedulingInfoList_BR_r13->list.array[i]->
|
||||
si_Narrowband_r13;
|
||||
long si_TBS_r13 =
|
||||
si_TBS_r13tab[schedulingInfoList_BR_r13->
|
||||
list.array[i]->si_TBS_r13];
|
||||
long si_Periodicity = schedulingInfoList->list.array[i]->si_Periodicity;
|
||||
long si_Narrowband_r13 = schedulingInfoList_BR_r13->list.array[i]->si_Narrowband_r13;
|
||||
long si_TBS_r13 = si_TBS_r13tab[schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13];
|
||||
|
||||
// check if the SI is to be scheduled now
|
||||
int period_in_sf = 80 << si_Periodicity; // 2^i * 80 subframes, note: si_Periodicity is 2^i * 80ms
|
||||
@@ -421,7 +386,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
|
||||
if ((sf_mod_period < si_WindowLength_BR_r13)
|
||||
&& ((frameP & (((1 << si_RepetitionPattern_r13) - 1))) == 0)) { // this SIB is to be scheduled
|
||||
|
||||
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_BR + i, 1, &cc->BCCH_BR_pdu[i + 1].payload[0], 1, module_idP, 0); // not used in this case
|
||||
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_BR + i, 1, &cc->BCCH_BR_pdu[i + 1].payload[0], 0); // not used in this case
|
||||
|
||||
AssertFatal(bcch_sdu_length > 0,
|
||||
"RRC returned 0 bytes for SI-BR %d\n", i);
|
||||
@@ -431,18 +396,14 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
|
||||
"RRC provided bcch with length %d > %d (si_TBS_r13 %d)\n",
|
||||
bcch_sdu_length,
|
||||
(int) (si_TBS_r13 >> 3),
|
||||
(int) schedulingInfoList_BR_r13->
|
||||
list.array[i]->si_TBS_r13);
|
||||
(int) schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13);
|
||||
|
||||
// allocate all 6 PRBs in narrowband for SIB1_BR
|
||||
|
||||
// check that SIB1 didn't take this narrowband
|
||||
if (vrb_map[first_rb] > 0)
|
||||
continue;
|
||||
if (vrb_map[first_rb] > 0) continue;
|
||||
|
||||
first_rb =
|
||||
narrowband_to_first_rb(cc,
|
||||
si_Narrowband_r13 - 1);
|
||||
first_rb = narrowband_to_first_rb(cc,si_Narrowband_r13 - 1);
|
||||
vrb_map[first_rb] = 1;
|
||||
vrb_map[first_rb + 1] = 1;
|
||||
vrb_map[first_rb + 2] = 1;
|
||||
@@ -462,85 +423,57 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
|
||||
|
||||
|
||||
|
||||
dl_config_pdu =
|
||||
&dl_req->dl_config_pdu_list[dl_req->
|
||||
number_pdu];
|
||||
memset((void *) dl_config_pdu, 0,
|
||||
sizeof(nfapi_dl_config_request_pdu_t));
|
||||
dl_config_pdu->pdu_type =
|
||||
NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
|
||||
dl_config_pdu->pdu_size =
|
||||
(uint8_t) (2 +
|
||||
sizeof(nfapi_dl_config_dlsch_pdu));
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length =
|
||||
si_TBS_r13 >> 3;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index =
|
||||
eNB->pdu_index[CC_id];
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti =
|
||||
0xFFFF;
|
||||
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
|
||||
memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
|
||||
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
|
||||
dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length = si_TBS_r13 >> 3;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id];
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFF;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.resource_block_coding =
|
||||
getRIV(N_RB_DL, first_rb, 6);
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 6);
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.redundancy_version = rvidx;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = rvidx;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.transport_block_to_codeword_swap_flag
|
||||
= 0;
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.transmission_scheme =
|
||||
(cc->p_eNB == 1) ? 0 : 1;
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.number_of_layers = 1;
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.number_of_subbands = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
|
||||
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.ue_category_capacity = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.delta_power_offset_index = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.transmission_mode =
|
||||
(cc->p_eNB == 1) ? 1 : 2;
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.
|
||||
num_bf_vector = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB == 1) ? 1 : 2;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
|
||||
// Rel10 fields (for PDSCH starting symbol)
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.
|
||||
pdsch_start =
|
||||
cc[CC_id].
|
||||
sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
|
||||
// Rel13 fields
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 1; // CEModeA UE
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 1; // SI-BR
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel13.initial_transmission_sf_io =
|
||||
absSF - sf_mod_period;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = absSF - sf_mod_period;
|
||||
|
||||
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
|
||||
dl_req->number_pdu++;
|
||||
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
|
||||
|
||||
// Program TX Request
|
||||
TX_req =
|
||||
&eNB->TX_req[CC_id].
|
||||
tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].
|
||||
tx_request_body.number_of_pdus];
|
||||
TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
|
||||
TX_req->pdu_length = bcch_sdu_length;
|
||||
TX_req->pdu_index = eNB->pdu_index[CC_id]++;
|
||||
TX_req->num_segments = 1;
|
||||
TX_req->segments[0].segment_length =
|
||||
bcch_sdu_length;
|
||||
TX_req->segments[0].segment_data =
|
||||
cc->BCCH_BR_pdu[i + 1].payload;
|
||||
eNB->TX_req[CC_id].tx_request_body.
|
||||
number_of_pdus++;
|
||||
TX_req->segments[0].segment_length = bcch_sdu_length;
|
||||
TX_req->segments[0].segment_data = cc->BCCH_BR_pdu[i + 1].payload;
|
||||
eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
eNB->TX_req[CC_id].sfn_sf = sfn_sf;
|
||||
eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
|
||||
|
||||
if (opt_enabled == 1) {
|
||||
trace_pdu(1,
|
||||
@@ -583,59 +516,67 @@ schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
|
||||
nfapi_tx_request_pdu_t *TX_req;
|
||||
int mib_sdu_length;
|
||||
int CC_id;
|
||||
nfapi_dl_config_request_t *dl_config_request;
|
||||
nfapi_dl_config_request_body_t *dl_req;
|
||||
uint16_t sfn_sf = frameP << 4 | subframeP;
|
||||
|
||||
AssertFatal(subframeP == 0, "Subframe must be 0\n");
|
||||
AssertFatal((frameP & 3) == 0, "Frame must be a multiple of 4\n");
|
||||
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
|
||||
dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
|
||||
dl_config_request = &eNB->DL_req[CC_id];
|
||||
dl_req = &dl_config_request->dl_config_request_body;
|
||||
cc = &eNB->common_channels[CC_id];
|
||||
|
||||
mib_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0], 1, module_idP, 0); // not used in this case
|
||||
mib_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0], 0); // not used in this case
|
||||
|
||||
LOG_D(MAC, "Frame %d, subframe %d: BCH PDU length %d\n",
|
||||
frameP, subframeP, mib_sdu_length);
|
||||
LOG_D(MAC, "Frame %d, subframe %d: BCH PDU length %d\n", frameP, subframeP, mib_sdu_length);
|
||||
|
||||
if (mib_sdu_length > 0) {
|
||||
|
||||
LOG_D(MAC,
|
||||
"Frame %d, subframe %d: Adding BCH PDU in position %d (length %d)\n",
|
||||
frameP, subframeP, dl_req->number_pdu, mib_sdu_length);
|
||||
LOG_D(MAC, "Frame %d, subframe %d: Adding BCH PDU in position %d (length %d)\n", frameP, subframeP, dl_req->number_pdu, mib_sdu_length);
|
||||
|
||||
if ((frameP & 1023) < 40)
|
||||
#ifdef Rel14
|
||||
LOG_D(MAC,
|
||||
"[eNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes (cc->mib->message.schedulingInfoSIB1_BR_r13 %d)\n",
|
||||
module_idP, frameP, CC_id, mib_sdu_length,
|
||||
(int) cc->mib->message.schedulingInfoSIB1_BR_r13);
|
||||
#else
|
||||
LOG_D(MAC,
|
||||
"[eNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n",
|
||||
module_idP, frameP, CC_id, mib_sdu_length);
|
||||
#endif
|
||||
|
||||
dl_config_pdu =
|
||||
&dl_req->dl_config_pdu_list[dl_req->number_pdu];
|
||||
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
|
||||
memset((void *) dl_config_pdu, 0,
|
||||
sizeof(nfapi_dl_config_request_pdu_t));
|
||||
dl_config_pdu->pdu_type =
|
||||
NFAPI_DL_CONFIG_BCH_PDU_TYPE, dl_config_pdu->pdu_size =
|
||||
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_BCH_PDU_TYPE, dl_config_pdu->pdu_size =
|
||||
2 + sizeof(nfapi_dl_config_bch_pdu);
|
||||
dl_config_pdu->bch_pdu.bch_pdu_rel8.length = mib_sdu_length;
|
||||
dl_config_pdu->bch_pdu.bch_pdu_rel8.pdu_index =
|
||||
eNB->pdu_index[CC_id];
|
||||
dl_config_pdu->bch_pdu.bch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG;
|
||||
dl_config_pdu->bch_pdu.bch_pdu_rel8.length = mib_sdu_length;
|
||||
dl_config_pdu->bch_pdu.bch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id];
|
||||
dl_config_pdu->bch_pdu.bch_pdu_rel8.transmission_power = 6000;
|
||||
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
|
||||
dl_req->number_pdu++;
|
||||
|
||||
LOG_D(MAC, "eNB->DL_req[0].number_pdu %d (%p)\n",
|
||||
dl_req->number_pdu, &dl_req->number_pdu);
|
||||
dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST;
|
||||
dl_config_request->sfn_sf = sfn_sf;
|
||||
|
||||
LOG_D(MAC, "eNB->DL_req[0].number_pdu %d (%p)\n", dl_req->number_pdu, &dl_req->number_pdu);
|
||||
// DL request
|
||||
|
||||
TX_req =
|
||||
&eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req
|
||||
[CC_id].tx_request_body.number_of_pdus];
|
||||
TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
|
||||
TX_req->pdu_length = 3;
|
||||
TX_req->pdu_index = eNB->pdu_index[CC_id]++;
|
||||
TX_req->num_segments = 1;
|
||||
TX_req->segments[0].segment_length = 0;
|
||||
TX_req->segments[0].segment_length = 3;
|
||||
TX_req->segments[0].segment_data = cc[CC_id].MIB_pdu.payload;
|
||||
eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
eNB->TX_req[CC_id].sfn_sf = sfn_sf;
|
||||
eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -655,9 +596,11 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
|
||||
uint8_t *vrb_map;
|
||||
int first_rb = -1;
|
||||
int N_RB_DL;
|
||||
nfapi_dl_config_request_pdu_t *dl_config_pdu;
|
||||
nfapi_dl_config_request_t *dl_config_request;
|
||||
nfapi_dl_config_request_pdu_t *dl_config_pdu;
|
||||
nfapi_tx_request_pdu_t *TX_req;
|
||||
nfapi_dl_config_request_body_t *dl_req;
|
||||
uint16_t sfn_sf = frameP << 4 | subframeP;
|
||||
|
||||
start_meas(&eNB->schedule_si);
|
||||
|
||||
@@ -669,15 +612,14 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
|
||||
cc = &eNB->common_channels[CC_id];
|
||||
vrb_map = (void *) &cc->vrb_map;
|
||||
N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
|
||||
dl_config_request = &eNB->DL_req[CC_id];
|
||||
dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
|
||||
|
||||
|
||||
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH, 1, &cc->BCCH_pdu.payload[0], 1, module_idP, 0); // not used in this case
|
||||
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH, 1, &cc->BCCH_pdu.payload[0], 0); // not used in this case
|
||||
|
||||
if (bcch_sdu_length > 0) {
|
||||
LOG_D(MAC,
|
||||
"[eNB %d] Frame %d : BCCH->DLSCH CC_id %d, Received %d bytes \n",
|
||||
module_idP, frameP, CC_id, bcch_sdu_length);
|
||||
LOG_D(MAC, "[eNB %d] Frame %d : BCCH->DLSCH CC_id %d, Received %d bytes \n", module_idP, frameP, CC_id, bcch_sdu_length);
|
||||
|
||||
// Allocate 4 PRBs in a random location
|
||||
/*
|
||||
@@ -735,108 +677,85 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
|
||||
}
|
||||
|
||||
|
||||
dl_config_pdu =
|
||||
&dl_req->dl_config_pdu_list[dl_req->number_pdu];
|
||||
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
|
||||
memset((void *) dl_config_pdu, 0,
|
||||
sizeof(nfapi_dl_config_request_pdu_t));
|
||||
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
|
||||
dl_config_pdu->pdu_size =
|
||||
(uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format =
|
||||
NFAPI_DL_DCI_FORMAT_1A;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.
|
||||
aggregation_level = 4;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = 0xFFFF;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 2; // S-RNTI : see Table 4-10 from SCF082 - nFAPI specifications
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power
|
||||
dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu));
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1A;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = 4;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = 0xFFFF;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 2; // S-RNTI : see Table 4-10 from SCF082 - nFAPI specifications
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power
|
||||
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // no TPC
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.
|
||||
new_data_indicator_1 = 0;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.
|
||||
redundancy_version_1 = 0;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // no TPC
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 0;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs;
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0;
|
||||
|
||||
dl_config_pdu->dci_dl_pdu.
|
||||
dci_dl_pdu_rel8.resource_block_coding =
|
||||
getRIV(N_RB_DL, first_rb, 4);
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 4);
|
||||
dl_config_request->sfn_sf = sfn_sf;
|
||||
|
||||
// Rel10 fields
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = 3;
|
||||
// Rel13 fields
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 0; // regular UE
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not BR
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SF
|
||||
|
||||
if (!CCE_allocation_infeasible
|
||||
(module_idP, CC_id, 0, subframeP,
|
||||
dl_config_pdu->dci_dl_pdu.
|
||||
dci_dl_pdu_rel8.aggregation_level, SI_RNTI)) {
|
||||
LOG_D(MAC,
|
||||
"Frame %d: Subframe %d : Adding common DCI for S_RNTI\n",
|
||||
frameP, subframeP);
|
||||
if (!CCE_allocation_infeasible(module_idP, CC_id, 0, subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, SI_RNTI)) {
|
||||
LOG_D(MAC, "Frame %d: Subframe %d : Adding common DCI for S_RNTI\n", frameP, subframeP);
|
||||
dl_req->number_dci++;
|
||||
dl_req->number_pdu++;
|
||||
dl_config_pdu =
|
||||
&dl_req->dl_config_pdu_list[dl_req->number_pdu];
|
||||
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
|
||||
memset((void *) dl_config_pdu, 0,
|
||||
sizeof(nfapi_dl_config_request_pdu_t));
|
||||
dl_config_pdu->pdu_type =
|
||||
NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
|
||||
dl_config_pdu->pdu_size =
|
||||
(uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index =
|
||||
eNB->pdu_index[CC_id];
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFF;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
|
||||
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
|
||||
dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id];
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length = bcch_sdu_length;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFF;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.resource_block_coding =
|
||||
getRIV(N_RB_DL, first_rb, 4);
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.
|
||||
redundancy_version = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.transport_block_to_codeword_swap_flag
|
||||
= 0;
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.transmission_scheme =
|
||||
(cc->p_eNB == 1) ? 0 : 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.
|
||||
number_of_layers = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.
|
||||
number_of_subbands = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 4);
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
|
||||
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.ue_category_capacity = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.delta_power_offset_index = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.
|
||||
transmission_mode = (cc->p_eNB == 1) ? 1 : 2;
|
||||
dl_config_pdu->dlsch_pdu.
|
||||
dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector =
|
||||
1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB == 1) ? 1 : 2;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
|
||||
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
|
||||
dl_req->number_pdu++;
|
||||
|
||||
// Rel10 fields
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = 3;
|
||||
// Rel13 fields
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 0; // regular UE
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not BR
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SF
|
||||
|
||||
dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST;
|
||||
dl_config_request->sfn_sf = sfn_sf;
|
||||
|
||||
// Program TX Request
|
||||
TX_req =
|
||||
&eNB->TX_req[CC_id].
|
||||
tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].
|
||||
tx_request_body.number_of_pdus];
|
||||
TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
|
||||
TX_req->pdu_length = bcch_sdu_length;
|
||||
TX_req->pdu_index = eNB->pdu_index[CC_id]++;
|
||||
TX_req->num_segments = 1;
|
||||
TX_req->segments[0].segment_length = bcch_sdu_length;
|
||||
TX_req->segments[0].segment_data =
|
||||
cc->BCCH_pdu.payload;
|
||||
TX_req->segments[0].segment_data = cc->BCCH_pdu.payload;
|
||||
eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
eNB->TX_req[CC_id].sfn_sf = sfn_sf;
|
||||
eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
|
||||
|
||||
} else {
|
||||
LOG_E(MAC,
|
||||
@@ -860,9 +779,7 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
|
||||
"[eNB] Frame %d : Scheduling BCCH->DLSCH (TDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n",
|
||||
frameP, CC_id, bcch_sdu_length, mcs);
|
||||
} else {
|
||||
LOG_D(MAC,
|
||||
"[eNB] Frame %d : Scheduling BCCH->DLSCH (FDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n",
|
||||
frameP, CC_id, bcch_sdu_length, mcs);
|
||||
LOG_D(MAC, "[eNB] Frame %d : Scheduling BCCH->DLSCH (FDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n", frameP, CC_id, bcch_sdu_length, mcs);
|
||||
}
|
||||
|
||||
|
||||
@@ -881,6 +798,5 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
|
||||
schedule_SI_BR(module_idP, frameP, subframeP);
|
||||
#endif
|
||||
|
||||
stop_meas(&eNB->schedule_si);
|
||||
return;
|
||||
stop_meas(&eNB->schedule_si);
|
||||
}
|
||||
|
||||
+1834
-1472
File diff suppressed because it is too large
Load Diff
@@ -545,8 +545,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
"[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE (area %d, sfAlloc %d)\n",
|
||||
module_idP, CC_id, frameP, subframeP, i, j);
|
||||
|
||||
mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 1, &cc->MCCH_pdu.payload[0], 1, // this is eNB
|
||||
module_idP, // index
|
||||
mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 1, &cc->MCCH_pdu.payload[0],
|
||||
i); // this is the mbsfn sync area index
|
||||
|
||||
if (mcch_sdu_length > 0) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+1331
-1318
File diff suppressed because it is too large
Load Diff
@@ -32,10 +32,6 @@
|
||||
#ifndef __MAC_EXTERN_H__
|
||||
#define __MAC_EXTERN_H__
|
||||
|
||||
|
||||
#ifdef USER_MODE
|
||||
//#include "stdio.h"
|
||||
#endif //USER_MODE
|
||||
#include "PHY/defs.h"
|
||||
#include "defs.h"
|
||||
|
||||
@@ -101,4 +97,4 @@ extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu1;
|
||||
extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
|
||||
extern DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E;
|
||||
|
||||
#endif //DEF_H
|
||||
#endif //DEF_H
|
||||
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* 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 flexran_agent_mac_proto.h
|
||||
* \brief MAC functions for FlexRAN agent
|
||||
* \author Xenofon Foukas and Navid Nikaein
|
||||
* \date 2016
|
||||
* \email: x.foukas@sms.ed.ac.uk
|
||||
* \version 0.1
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __LAYER2_MAC_FLEXRAN_AGENT_MAC_PROTO_H__
|
||||
#define __LAYER2_MAC_FLEXRAN_AGENT_MAC_PROTO_H__
|
||||
|
||||
#include "flexran_agent_defs.h"
|
||||
#include "header.pb-c.h"
|
||||
#include "flexran.pb-c.h"
|
||||
|
||||
/*
|
||||
* slice specific scheduler
|
||||
*/
|
||||
typedef void (*slice_scheduler) (module_id_t mod_id,
|
||||
int slice_id,
|
||||
uint32_t frame,
|
||||
uint32_t subframe,
|
||||
int *mbsfn_flag,
|
||||
Protocol__FlexranMessage ** dl_info);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* top level flexran scheduler used by the eNB scheduler
|
||||
*/
|
||||
void flexran_schedule_ue_spec_default(mid_t mod_id,
|
||||
uint32_t frame,
|
||||
uint32_t subframe,
|
||||
int *mbsfn_flag,
|
||||
Protocol__FlexranMessage ** dl_info);
|
||||
/*
|
||||
* slice specific scheduler for embb
|
||||
*/
|
||||
void
|
||||
flexran_schedule_ue_spec_embb(mid_t mod_id,
|
||||
int slice_id,
|
||||
uint32_t frame,
|
||||
uint32_t subframe,
|
||||
int *mbsfn_flag,
|
||||
Protocol__FlexranMessage ** dl_info);
|
||||
/*
|
||||
* slice specific scheduler for urllc
|
||||
*/
|
||||
void
|
||||
flexran_schedule_ue_spec_urllc(mid_t mod_id,
|
||||
int slice_id,
|
||||
uint32_t frame,
|
||||
uint32_t subframe,
|
||||
int *mbsfn_flag,
|
||||
Protocol__FlexranMessage ** dl_info);
|
||||
|
||||
/*
|
||||
* slice specific scheduler for mmtc
|
||||
*/
|
||||
void
|
||||
flexran_schedule_ue_spec_mmtc(mid_t mod_id,
|
||||
int slice_id,
|
||||
uint32_t frame,
|
||||
uint32_t subframe,
|
||||
int *mbsfn_flag,
|
||||
Protocol__FlexranMessage ** dl_info);
|
||||
/*
|
||||
* slice specific scheduler for best effort traffic
|
||||
*/
|
||||
void
|
||||
flexran_schedule_ue_spec_be(mid_t mod_id,
|
||||
int slice_id,
|
||||
uint32_t frame,
|
||||
uint32_t subframe,
|
||||
int *mbsfn_flag,
|
||||
Protocol__FlexranMessage ** dl_info);
|
||||
|
||||
/*
|
||||
* common flexran scheduler function
|
||||
*/
|
||||
void
|
||||
flexran_schedule_ue_spec_common(mid_t mod_id,
|
||||
int slice_id,
|
||||
uint32_t frame,
|
||||
uint32_t subframe,
|
||||
int *mbsfn_flag,
|
||||
Protocol__FlexranMessage ** dl_info);
|
||||
|
||||
uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs);
|
||||
|
||||
int flexran_slice_member(int UE_id, int slice_id);
|
||||
|
||||
int flexran_slice_maxmcs(int slice_id);
|
||||
|
||||
void _store_dlsch_buffer(module_id_t Mod_id,
|
||||
int slice_id,
|
||||
frame_t frameP, sub_frame_t subframeP);
|
||||
|
||||
|
||||
void _assign_rbs_required(module_id_t Mod_id,
|
||||
int slice_id,
|
||||
frame_t frameP,
|
||||
sub_frame_t subframe,
|
||||
uint16_t
|
||||
nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
|
||||
uint16_t
|
||||
nb_rbs_allowed_slice[MAX_NUM_CCs]
|
||||
[MAX_NUM_SLICES], int min_rb_unit[MAX_NUM_CCs]);
|
||||
|
||||
void _dlsch_scheduler_pre_processor(module_id_t Mod_id,
|
||||
int slice_id,
|
||||
frame_t frameP,
|
||||
sub_frame_t subframeP,
|
||||
int N_RBG[MAX_NUM_CCs],
|
||||
int *mbsfn_flag);
|
||||
|
||||
void _dlsch_scheduler_pre_processor_reset(int module_idP,
|
||||
int UE_id,
|
||||
uint8_t CC_id,
|
||||
int frameP,
|
||||
int subframeP,
|
||||
int N_RBG,
|
||||
uint16_t
|
||||
nb_rbs_required[MAX_NUM_CCs]
|
||||
[NUMBER_OF_UE_MAX],
|
||||
uint16_t
|
||||
nb_rbs_required_remaining
|
||||
[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
|
||||
uint16_t
|
||||
nb_rbs_allowed_slice[MAX_NUM_CCs]
|
||||
[MAX_NUM_SLICES],
|
||||
unsigned char
|
||||
rballoc_sub[MAX_NUM_CCs]
|
||||
[N_RBG_MAX],
|
||||
unsigned char
|
||||
MIMO_mode_indicator[MAX_NUM_CCs]
|
||||
[N_RBG_MAX]);
|
||||
|
||||
void _dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id,
|
||||
int UE_id,
|
||||
uint8_t CC_id,
|
||||
int N_RBG,
|
||||
int transmission_mode,
|
||||
int min_rb_unit,
|
||||
uint8_t N_RB_DL,
|
||||
uint16_t
|
||||
nb_rbs_required[MAX_NUM_CCs]
|
||||
[NUMBER_OF_UE_MAX],
|
||||
uint16_t
|
||||
nb_rbs_required_remaining
|
||||
[MAX_NUM_CCs]
|
||||
[NUMBER_OF_UE_MAX],
|
||||
unsigned char
|
||||
rballoc_sub[MAX_NUM_CCs]
|
||||
[N_RBG_MAX],
|
||||
unsigned char
|
||||
MIMO_mode_indicator
|
||||
[MAX_NUM_CCs][N_RBG_MAX]);
|
||||
|
||||
/*
|
||||
* Default scheduler used by the eNB agent
|
||||
*/
|
||||
void flexran_schedule_ue_spec_default(mid_t mod_id, uint32_t frame,
|
||||
uint32_t subframe, int *mbsfn_flag,
|
||||
Protocol__FlexranMessage ** dl_info);
|
||||
|
||||
/*
|
||||
* Data plane function for applying the DL decisions of the scheduler
|
||||
*/
|
||||
void flexran_apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame,
|
||||
uint32_t subframe,
|
||||
int *mbsfn_flag,
|
||||
Protocol__FlexranMessage *
|
||||
dl_scheduling_info);
|
||||
|
||||
/*
|
||||
* Data plane function for applying the UE specific DL decisions of the scheduler
|
||||
*/
|
||||
void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
|
||||
uint32_t frame,
|
||||
uint32_t subframe,
|
||||
int *mbsfn_flag,
|
||||
uint32_t n_dl_ue_data,
|
||||
Protocol__FlexDlData **
|
||||
dl_ue_data);
|
||||
|
||||
/*
|
||||
* Data plane function for filling the DCI structure
|
||||
*/
|
||||
void flexran_fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti,
|
||||
Protocol__FlexDlDci * dl_dci);
|
||||
|
||||
#endif
|
||||
@@ -1,588 +0,0 @@
|
||||
/*
|
||||
* 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 flexran_agent_scheduler_dataplane.c
|
||||
* \brief data plane procedures related to eNB scheduling
|
||||
* \author Xenofon Foukas
|
||||
* \date 2016
|
||||
* \email: x.foukas@sms.ed.ac.uk
|
||||
* \version 0.1
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
#include "assertions.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "PHY/extern.h"
|
||||
|
||||
#include "SCHED/defs.h"
|
||||
#include "SCHED/extern.h"
|
||||
|
||||
#include "LAYER2/MAC/flexran_agent_mac_proto.h"
|
||||
#include "LAYER2/MAC/defs.h"
|
||||
#include "LAYER2/MAC/proto.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "LAYER2/MAC/flexran_dci_conversions.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 "RRC/LITE/extern.h"
|
||||
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
|
||||
#include "header.pb-c.h"
|
||||
#include "flexran.pb-c.h"
|
||||
#include "flexran_agent_extern.h"
|
||||
|
||||
#include "flexran_agent_common.h"
|
||||
|
||||
#include "SIMULATION/TOOLS/defs.h" // for taus
|
||||
|
||||
void
|
||||
flexran_apply_dl_scheduling_decisions(mid_t mod_id,
|
||||
uint32_t frame,
|
||||
uint32_t subframe,
|
||||
int *mbsfn_flag,
|
||||
Protocol__FlexranMessage *
|
||||
dl_scheduling_info)
|
||||
{
|
||||
|
||||
Protocol__FlexDlMacConfig *mac_config =
|
||||
dl_scheduling_info->dl_mac_config_msg;
|
||||
|
||||
// Check if there is anything to schedule for random access
|
||||
if (mac_config->n_dl_rar > 0) {
|
||||
/*TODO: call the random access data plane function */
|
||||
}
|
||||
// Check if there is anything to schedule for paging/broadcast
|
||||
if (mac_config->n_dl_broadcast > 0) {
|
||||
/*TODO: call the broadcast/paging data plane function */
|
||||
}
|
||||
// Check if there is anything to schedule for the UEs
|
||||
if (mac_config->n_dl_ue_data > 0) {
|
||||
flexran_apply_ue_spec_scheduling_decisions(mod_id, frame, subframe,
|
||||
mbsfn_flag,
|
||||
mac_config->
|
||||
n_dl_ue_data,
|
||||
mac_config->dl_ue_data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
|
||||
uint32_t frame,
|
||||
uint32_t subframe,
|
||||
int *mbsfn_flag,
|
||||
uint32_t n_dl_ue_data,
|
||||
Protocol__FlexDlData **
|
||||
dl_ue_data)
|
||||
{
|
||||
|
||||
uint8_t CC_id;
|
||||
int UE_id;
|
||||
mac_rlc_status_resp_t rlc_status;
|
||||
unsigned char ta_len = 0;
|
||||
unsigned char header_len = 0, header_len_tmp = 0;
|
||||
unsigned char sdu_lcids[11], offset, num_sdus = 0;
|
||||
uint16_t nb_rb;
|
||||
uint16_t TBS, sdu_lengths[11], rnti, padding = 0, post_padding = 0;
|
||||
unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES];
|
||||
uint8_t round = 0;
|
||||
uint8_t harq_pid = 0;
|
||||
// LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
|
||||
LTE_eNB_UE_stats *eNB_UE_stats = NULL;
|
||||
uint16_t sdu_length_total = 0;
|
||||
short ta_update = 0;
|
||||
eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id];
|
||||
UE_list_t *UE_list = &eNB->UE_list;
|
||||
// static int32_t tpc_accumulated=0;
|
||||
UE_sched_ctrl *ue_sched_ctl;
|
||||
|
||||
int last_sdu_header_len = 0;
|
||||
|
||||
int i, j;
|
||||
|
||||
Protocol__FlexDlData *dl_data;
|
||||
Protocol__FlexDlDci *dl_dci;
|
||||
|
||||
uint32_t rlc_size, n_lc, lcid;
|
||||
|
||||
// For each UE-related command
|
||||
for (i = 0; i < n_dl_ue_data; i++) {
|
||||
|
||||
dl_data = dl_ue_data[i];
|
||||
dl_dci = dl_data->dl_dci;
|
||||
|
||||
CC_id = dl_data->serv_cell_index;
|
||||
// frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id);
|
||||
|
||||
rnti = dl_data->rnti;
|
||||
UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]);
|
||||
|
||||
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
|
||||
eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
|
||||
|
||||
round = dl_dci->rv[0];
|
||||
harq_pid = dl_dci->harq_process;
|
||||
|
||||
//LOG_I(FLEXRAN_AGENT, "[Frame %d][Subframe %d] Scheduling harq %d\n", frame, subframe, harq_pid);
|
||||
// LOG_I(FLEXRAN_AGENT, "[Frame %d][Subframe %d]Now scheduling harq_pid %d (round %d)\n", frame, subframe, harq_pid, round);
|
||||
|
||||
// If this is a new transmission
|
||||
if (round == 0) {
|
||||
// First we have to deal with the creation of the PDU based on the message instructions
|
||||
rlc_status.bytes_in_buffer = 0;
|
||||
|
||||
TBS = dl_dci->tbs_size[0];
|
||||
|
||||
if (dl_data->n_ce_bitmap > 0) {
|
||||
//Check if there is TA command and set the length appropriately
|
||||
ta_len =
|
||||
(dl_data->
|
||||
ce_bitmap[0] & PROTOCOL__FLEX_CE_TYPE__FLPCET_TA) ? 2
|
||||
: 0;
|
||||
}
|
||||
|
||||
num_sdus = 0;
|
||||
sdu_length_total = 0;
|
||||
|
||||
n_lc = dl_data->n_rlc_pdu;
|
||||
// Go through each one of the channel commands and create SDUs
|
||||
header_len = 0;
|
||||
last_sdu_header_len = 0;
|
||||
for (j = 0; j < n_lc; j++) {
|
||||
sdu_lengths[j] = 0;
|
||||
lcid =
|
||||
dl_data->rlc_pdu[j]->rlc_pdu_tb[0]->logical_channel_id;
|
||||
rlc_size = dl_data->rlc_pdu[j]->rlc_pdu_tb[0]->size;
|
||||
LOG_D(MAC,
|
||||
"[TEST] [eNB %d] [Frame %d] [Subframe %d], LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
|
||||
mod_id, frame, subframe, lcid, CC_id, rlc_size);
|
||||
if (rlc_size > 0) {
|
||||
|
||||
rlc_status = mac_rlc_status_ind(mod_id,
|
||||
rnti,
|
||||
mod_id,
|
||||
frame,
|
||||
subframe,
|
||||
ENB_FLAG_YES,
|
||||
MBMS_FLAG_NO, lcid, 0);
|
||||
|
||||
if (rlc_status.bytes_in_buffer > 0) {
|
||||
|
||||
if (rlc_status.bytes_in_buffer < rlc_size) {
|
||||
rlc_size = rlc_status.bytes_in_buffer;
|
||||
}
|
||||
|
||||
if (rlc_size <= 2) {
|
||||
rlc_size = 3;
|
||||
}
|
||||
|
||||
rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, subframe, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, rlc_size); // transport block set size
|
||||
|
||||
LOG_D(MAC,
|
||||
"[TEST] RLC can give %d bytes for LCID %d during second call\n",
|
||||
rlc_status.bytes_in_buffer, lcid);
|
||||
|
||||
if (rlc_status.bytes_in_buffer > 0) {
|
||||
|
||||
sdu_lengths[j] = mac_rlc_data_req(mod_id, rnti, mod_id, frame, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, rlc_size, //not used
|
||||
(char *)
|
||||
&dlsch_buffer
|
||||
[sdu_length_total]);
|
||||
|
||||
LOG_D(MAC,
|
||||
"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",
|
||||
mod_id, lcid, CC_id, sdu_lengths[j]);
|
||||
sdu_length_total += sdu_lengths[j];
|
||||
sdu_lcids[j] = lcid;
|
||||
|
||||
UE_list->
|
||||
eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid]
|
||||
+= 1;
|
||||
UE_list->
|
||||
eNB_UE_stats[CC_id][UE_id].num_bytes_tx
|
||||
[lcid] += sdu_lengths[j];
|
||||
|
||||
if (sdu_lengths[j] < 128) {
|
||||
header_len += 2;
|
||||
last_sdu_header_len = 2;
|
||||
} else {
|
||||
header_len += 3;
|
||||
last_sdu_header_len = 3;
|
||||
}
|
||||
num_sdus++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // SDU creation end
|
||||
|
||||
|
||||
if (((sdu_length_total + header_len + ta_len) > 0)) {
|
||||
|
||||
header_len_tmp = header_len;
|
||||
|
||||
// If we have only a single SDU, header length becomes 1
|
||||
if ((num_sdus) == 1) {
|
||||
//if (header_len == 2 || header_len == 3) {
|
||||
header_len = 1;
|
||||
} else {
|
||||
header_len = (header_len - last_sdu_header_len) + 1;
|
||||
}
|
||||
|
||||
// If we need a 1 or 2 bit padding or no padding at all
|
||||
if ((TBS - header_len - sdu_length_total - ta_len) <= 2 || (TBS - header_len - sdu_length_total - ta_len) > TBS) { //protect from overflow
|
||||
padding =
|
||||
(TBS - header_len - sdu_length_total - ta_len);
|
||||
post_padding = 0;
|
||||
} else { // The last sdu needs to have a length field, since we add padding
|
||||
padding = 0;
|
||||
header_len = header_len_tmp;
|
||||
post_padding = TBS - sdu_length_total - header_len - ta_len; // 1 is for the postpadding header
|
||||
}
|
||||
|
||||
if (ta_len > 0) {
|
||||
// Reset the measurement
|
||||
ta_update = flexran_get_TA(mod_id, UE_id, CC_id);
|
||||
ue_sched_ctl->ta_timer = 20;
|
||||
eNB_UE_stats->timing_advance_update = 0;
|
||||
} else {
|
||||
ta_update = 0;
|
||||
}
|
||||
|
||||
// If there is nothing to schedule, just leave
|
||||
if ((sdu_length_total) <= 0) {
|
||||
harq_pid_updated[UE_id][harq_pid] = 1;
|
||||
harq_pid_round[UE_id][harq_pid] = 0;
|
||||
continue;
|
||||
}
|
||||
// LOG_I(FLEXRAN_AGENT, "[Frame %d][Subframe %d] TBS is %d and bytes are %d\n", frame, subframe, TBS, sdu_length_total);
|
||||
|
||||
offset = generate_dlsch_header((unsigned char *) UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], num_sdus, //num_sdus
|
||||
sdu_lengths, //
|
||||
sdu_lcids, 255, // no drx
|
||||
ta_update, // timing advance
|
||||
NULL, // contention res id
|
||||
padding, post_padding);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG_eNB_SCHEDULER
|
||||
LOG_T(MAC, "[eNB %d] First 16 bytes of DLSCH : \n");
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
LOG_T(MAC, "%x.", dlsch_buffer[i]);
|
||||
}
|
||||
|
||||
LOG_T(MAC, "\n");
|
||||
#endif
|
||||
// cycle through SDUs and place in dlsch_buffer
|
||||
memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].
|
||||
payload[0][offset], dlsch_buffer, sdu_length_total);
|
||||
// memcpy(&eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]);
|
||||
|
||||
// fill remainder of DLSCH with random data
|
||||
for (j = 0; j < (TBS - sdu_length_total - offset); j++) {
|
||||
UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset +
|
||||
sdu_length_total
|
||||
+ j] =
|
||||
(char) (taus() & 0xff);
|
||||
}
|
||||
|
||||
//eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset+sdu_lengths[0]+j] = (char)(taus()&0xff);
|
||||
if (opt_enabled == 1) {
|
||||
trace_pdu(1,
|
||||
(uint8_t *)
|
||||
UE_list->DLSCH_pdu[CC_id][0][UE_id].
|
||||
payload[0], TBS, mod_id, 3, UE_RNTI(mod_id,
|
||||
UE_id),
|
||||
eNB->frame, eNB->subframe, 0, 0);
|
||||
LOG_D(OPT,
|
||||
"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n",
|
||||
mod_id, CC_id, frame, UE_RNTI(mod_id, UE_id),
|
||||
TBS);
|
||||
}
|
||||
// store stats
|
||||
eNB->eNB_stats[CC_id].dlsch_bytes_tx += sdu_length_total;
|
||||
eNB->eNB_stats[CC_id].dlsch_pdus_tx += 1;
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi =
|
||||
eNB_UE_stats->DL_cqi[0];
|
||||
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].crnti = rnti;
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status =
|
||||
mac_eNB_get_rrc_status(mod_id, rnti);
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid;
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round;
|
||||
|
||||
//nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
|
||||
//Find the number of resource blocks and set them to the template for retransmissions
|
||||
nb_rb = get_min_rb_unit(mod_id, CC_id);
|
||||
uint16_t stats_tbs =
|
||||
mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb);
|
||||
|
||||
while (stats_tbs < TBS) {
|
||||
nb_rb += get_min_rb_unit(mod_id, CC_id);
|
||||
stats_tbs =
|
||||
mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb);
|
||||
}
|
||||
|
||||
// LOG_I(FLEXRAN_AGENT, "The MCS was %d\n", dl_dci->mcs[0]);
|
||||
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb;
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used +=
|
||||
nb_rb;
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 =
|
||||
dl_dci->mcs[0];
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 =
|
||||
dl_dci->mcs[0];
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS;
|
||||
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes =
|
||||
TBS - sdu_length_total;
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes +=
|
||||
sdu_length_total;
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes += TBS;
|
||||
UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus += 1;
|
||||
|
||||
//eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]];
|
||||
//eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
|
||||
} else {
|
||||
LOG_D(FLEXRAN_AGENT,
|
||||
"No need to schedule a dci after all. Just drop it\n");
|
||||
harq_pid_updated[UE_id][harq_pid] = 1;
|
||||
harq_pid_round[UE_id][harq_pid] = 0;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// No need to create anything apart of DCI in case of retransmission
|
||||
/*TODO: Must add these */
|
||||
// eNB_UE_stats->dlsch_trials[round]++;
|
||||
//UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1;
|
||||
//UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb;
|
||||
//UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb;
|
||||
//UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id];
|
||||
}
|
||||
|
||||
// UE_list->UE_template[CC_id][UE_id].oldNDI[dl_dci->harq_process] = dl_dci->ndi[0];
|
||||
// eNB_UE_stats->dlsch_mcs1 = dl_dci->mcs[0];
|
||||
|
||||
//Fill the proper DCI of OAI
|
||||
flexran_fill_oai_dci(mod_id, CC_id, rnti, dl_dci);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
flexran_fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti,
|
||||
Protocol__FlexDlDci * dl_dci)
|
||||
{
|
||||
|
||||
void *DLSCH_dci = NULL;
|
||||
DCI_PDU *DCI_pdu;
|
||||
|
||||
unsigned char harq_pid = 0;
|
||||
// unsigned char round = 0;
|
||||
LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
|
||||
int size_bits = 0, size_bytes = 0;
|
||||
eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id];
|
||||
UE_list_t *UE_list = &eNB->UE_list;
|
||||
LTE_eNB_UE_stats *eNB_UE_stats = NULL;
|
||||
|
||||
int UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]);
|
||||
|
||||
uint32_t format;
|
||||
|
||||
harq_pid = dl_dci->harq_process;
|
||||
// round = dl_dci->rv[0];
|
||||
|
||||
// Note this code is for a specific DCI format
|
||||
DLSCH_dci =
|
||||
(void *) UE_list->UE_template[CC_id][UE_id].DLSCH_DCI[harq_pid];
|
||||
DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu;
|
||||
|
||||
frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id);
|
||||
|
||||
if (dl_dci->has_tpc == 1) {
|
||||
// Check if tpc has been set and reset measurement */
|
||||
if ((dl_dci->tpc == 0) || (dl_dci->tpc == 2)) {
|
||||
eNB_UE_stats =
|
||||
mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
|
||||
eNB_UE_stats->Po_PUCCH_update = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (frame_parms[CC_id]->N_RB_DL) {
|
||||
case 6:
|
||||
if (frame_parms[CC_id]->frame_type == TDD) {
|
||||
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
|
||||
FILL_DCI_TDD_1(DCI1_1_5MHz_TDD_t, DLSCH_dci, dl_dci);
|
||||
size_bytes = sizeof(DCI1_1_5MHz_TDD_t);
|
||||
size_bits = sizeof_DCI1_1_5MHz_TDD_t;
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
|
||||
//TODO
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
|
||||
//TODO
|
||||
}
|
||||
} else {
|
||||
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
|
||||
FILL_DCI_FDD_1(DCI1_1_5MHz_FDD_t, DLSCH_dci, dl_dci);
|
||||
size_bytes = sizeof(DCI1_1_5MHz_FDD_t);
|
||||
size_bits = sizeof_DCI1_1_5MHz_FDD_t;
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
|
||||
//TODO
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
if (frame_parms[CC_id]->frame_type == TDD) {
|
||||
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
|
||||
FILL_DCI_TDD_1(DCI1_5MHz_TDD_t, DLSCH_dci, dl_dci);
|
||||
size_bytes = sizeof(DCI1_5MHz_TDD_t);
|
||||
size_bits = sizeof_DCI1_5MHz_TDD_t;
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
|
||||
//TODO
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
|
||||
//TODO
|
||||
}
|
||||
} else {
|
||||
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
|
||||
FILL_DCI_FDD_1(DCI1_5MHz_FDD_t, DLSCH_dci, dl_dci);
|
||||
size_bytes = sizeof(DCI1_5MHz_FDD_t);
|
||||
size_bits = sizeof_DCI1_5MHz_FDD_t;
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
|
||||
//TODO
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 50:
|
||||
if (frame_parms[CC_id]->frame_type == TDD) {
|
||||
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
|
||||
FILL_DCI_TDD_1(DCI1_10MHz_TDD_t, DLSCH_dci, dl_dci);
|
||||
size_bytes = sizeof(DCI1_10MHz_TDD_t);
|
||||
size_bits = sizeof_DCI1_10MHz_TDD_t;
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
|
||||
//TODO
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
|
||||
//TODO
|
||||
}
|
||||
} else {
|
||||
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
|
||||
FILL_DCI_FDD_1(DCI1_10MHz_FDD_t, DLSCH_dci, dl_dci);
|
||||
size_bytes = sizeof(DCI1_10MHz_FDD_t);
|
||||
size_bits = sizeof_DCI1_10MHz_FDD_t;
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
|
||||
//TODO
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 100:
|
||||
if (frame_parms[CC_id]->frame_type == TDD) {
|
||||
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
|
||||
FILL_DCI_TDD_1(DCI1_20MHz_TDD_t, DLSCH_dci, dl_dci);
|
||||
size_bytes = sizeof(DCI1_20MHz_TDD_t);
|
||||
size_bits = sizeof_DCI1_20MHz_TDD_t;
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
|
||||
//TODO
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
|
||||
//TODO
|
||||
}
|
||||
} else {
|
||||
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
|
||||
FILL_DCI_FDD_1(DCI1_20MHz_FDD_t, DLSCH_dci, dl_dci);
|
||||
size_bytes = sizeof(DCI1_20MHz_FDD_t);
|
||||
size_bits = sizeof_DCI1_20MHz_FDD_t;
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
|
||||
//TODO
|
||||
} else if (dl_dci->format ==
|
||||
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//Set format to the proper type
|
||||
switch (dl_dci->format) {
|
||||
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1:
|
||||
format = format1;
|
||||
break;
|
||||
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1A:
|
||||
format = format1A;
|
||||
break;
|
||||
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1B:
|
||||
format = format1B;
|
||||
break;
|
||||
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1C:
|
||||
format = format1C;
|
||||
break;
|
||||
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D:
|
||||
format = format1E_2A_M10PRB;
|
||||
break;
|
||||
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2:
|
||||
format = format2;
|
||||
break;
|
||||
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A:
|
||||
format = format2A;
|
||||
break;
|
||||
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2B:
|
||||
format = format2B;
|
||||
break;
|
||||
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_3:
|
||||
format = 3;
|
||||
break;
|
||||
default:
|
||||
/*TODO: Need to deal with unsupported DCI type */
|
||||
return;
|
||||
}
|
||||
|
||||
add_ue_spec_dci(DCI_pdu,
|
||||
DLSCH_dci,
|
||||
rnti,
|
||||
size_bytes, dl_dci->aggr_level, size_bits, format, 0);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,202 +0,0 @@
|
||||
/*
|
||||
* 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 flexran_agent_scheduler_dlsch_ue_remote.c
|
||||
* \brief procedures related to remote scheduling in the DLSCH transport channel
|
||||
* \author Xenofon Foukas
|
||||
* \date 2016
|
||||
* \email: x.foukas@sms.ed.ac.uk
|
||||
* \version 0.1
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
#include "flexran_agent_common_internal.h"
|
||||
|
||||
#include "flexran_agent_scheduler_dlsch_ue_remote.h"
|
||||
|
||||
#include "LAYER2/MAC/defs.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
|
||||
struct DlMacConfigHead queue_head;
|
||||
|
||||
int queue_initialized = 0;
|
||||
|
||||
//uint32_t skip_subframe = 1;
|
||||
//uint32_t period = 10;
|
||||
//uint32_t sched [] = {1, 2, 3};
|
||||
|
||||
void
|
||||
flexran_schedule_ue_spec_remote(mid_t mod_id, uint32_t frame,
|
||||
uint32_t subframe, int *mbsfn_flag,
|
||||
Protocol__FlexranMessage ** dl_info)
|
||||
{
|
||||
|
||||
|
||||
//if ((subframe == skip_subframe) && (frame % period == 0)) {
|
||||
// LOG_I(MAC, "Will skip subframe %d %d\n", subframe, frame);
|
||||
// for (int i = 0; i < 3; i++) {
|
||||
// LOG_I(MAC, "%d\n", sched[i]);
|
||||
// }
|
||||
//}
|
||||
|
||||
/* if (frame == 500 && subframe == 1) { */
|
||||
/* char policy[] = "rrc: \n - ul_scheduler: \n behavior : tester_function\n parameters:\n period: !!int 3\nmac: \n - dl_scheduler: \n parameters: \n period : !!int 40\n skip_subframe : !!int 3\n sched : [!!int 4, !!int 5, !!int 6]"; */
|
||||
/* apply_reconfiguration_policy(mod_id, policy, strlen(policy)); */
|
||||
/* } */
|
||||
|
||||
eNB_MAC_INST *eNB;
|
||||
|
||||
if (!queue_initialized) {
|
||||
TAILQ_INIT(&queue_head);
|
||||
queue_initialized = 1;
|
||||
}
|
||||
|
||||
eNB = &eNB_mac_inst[mod_id];
|
||||
|
||||
dl_mac_config_element_t *dl_config_elem;
|
||||
|
||||
int diff;
|
||||
LOG_D(MAC, "[TEST] Current frame and subframe %d, %d\n", frame,
|
||||
subframe);
|
||||
// First we check to see if we have a scheduling decision for this sfn_sf already in our queue
|
||||
while (queue_head.tqh_first != NULL) {
|
||||
dl_config_elem = queue_head.tqh_first;
|
||||
|
||||
diff =
|
||||
get_sf_difference(mod_id,
|
||||
dl_config_elem->dl_info->
|
||||
dl_mac_config_msg->sfn_sf);
|
||||
// Check if this decision is for now, for a later or a previous subframe
|
||||
if (diff == 0) { // Now
|
||||
LOG_D(MAC,
|
||||
"Found a decision for this subframe in the queue. Let's use it!\n");
|
||||
TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs);
|
||||
*dl_info = dl_config_elem->dl_info;
|
||||
free(dl_config_elem);
|
||||
eNB->eNB_stats[mod_id].sched_decisions++;
|
||||
return;
|
||||
} else if (diff < 0) { //previous subframe , delete message and free memory
|
||||
LOG_D(MAC,
|
||||
"Found a decision for a previous subframe in the queue. Let's get rid of it\n");
|
||||
TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs);
|
||||
flexran_agent_mac_destroy_dl_config(dl_config_elem->dl_info);
|
||||
free(dl_config_elem);
|
||||
eNB->eNB_stats[mod_id].sched_decisions++;
|
||||
eNB->eNB_stats[mod_id].missed_deadlines++;
|
||||
} else { // next subframe, nothing to do now
|
||||
LOG_D(MAC,
|
||||
"Found a decision for a future subframe in the queue. Nothing to do now\n");
|
||||
flexran_agent_mac_create_empty_dl_config(mod_id, dl_info);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Done with the local cache. Now we need to check if something new arrived
|
||||
flexran_agent_get_pending_dl_mac_config(mod_id, dl_info);
|
||||
while (*dl_info != NULL) {
|
||||
|
||||
diff =
|
||||
get_sf_difference(mod_id,
|
||||
(*dl_info)->dl_mac_config_msg->sfn_sf);
|
||||
if (diff == 0) { // Got a command for this sfn_sf
|
||||
LOG_D(MAC,
|
||||
"Found a decision for this subframe pending. Let's use it\n");
|
||||
eNB->eNB_stats[mod_id].sched_decisions++;
|
||||
return;
|
||||
} else if (diff < 0) {
|
||||
LOG_D(MAC,
|
||||
"Found a decision for a previous subframe. Let's get rid of it\n");
|
||||
flexran_agent_mac_destroy_dl_config(*dl_info);
|
||||
*dl_info = NULL;
|
||||
flexran_agent_get_pending_dl_mac_config(mod_id, dl_info);
|
||||
eNB->eNB_stats[mod_id].sched_decisions++;
|
||||
eNB->eNB_stats[mod_id].missed_deadlines++;
|
||||
} else { // Intended for future subframe. Store it in local cache
|
||||
LOG_D(MAC,
|
||||
"Found a decision for a future subframe in the queue. Let's store it in the cache\n");
|
||||
dl_mac_config_element_t *e =
|
||||
malloc(sizeof(dl_mac_config_element_t));
|
||||
e->dl_info = *dl_info;
|
||||
TAILQ_INSERT_TAIL(&queue_head, e, configs);
|
||||
flexran_agent_mac_create_empty_dl_config(mod_id, dl_info);
|
||||
// No need to look for another. Messages arrive ordered
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// We found no pending command, so we will simply pass an empty one
|
||||
flexran_agent_mac_create_empty_dl_config(mod_id, dl_info);
|
||||
}
|
||||
|
||||
int get_sf_difference(mid_t mod_id, uint32_t sfn_sf)
|
||||
{
|
||||
int diff_in_subframes;
|
||||
|
||||
uint16_t current_frame = flexran_get_current_system_frame_num(mod_id);
|
||||
uint16_t current_subframe = flexran_get_current_subframe(mod_id);
|
||||
uint32_t current_sfn_sf = flexran_get_sfn_sf(mod_id);
|
||||
|
||||
if (sfn_sf == current_sfn_sf) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t frame_mask = ((1 << 12) - 1);
|
||||
uint16_t frame = (sfn_sf & (frame_mask << 4)) >> 4;
|
||||
|
||||
uint16_t sf_mask = ((1 << 4) - 1);
|
||||
uint16_t subframe = (sfn_sf & sf_mask);
|
||||
|
||||
LOG_D(MAC, "[TEST] Target frame and subframe %d, %d\n", frame,
|
||||
subframe);
|
||||
|
||||
if (frame == current_frame) {
|
||||
return subframe - current_subframe;
|
||||
} else if (frame > current_frame) {
|
||||
diff_in_subframes =
|
||||
((frame * 10) + subframe) - ((current_frame * 10) +
|
||||
current_subframe);
|
||||
|
||||
// diff_in_subframes = 9 - current_subframe;
|
||||
//diff_in_subframes += (subframe + 1);
|
||||
//diff_in_subframes += (frame-2) * 10;
|
||||
if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} else { //frame < current_frame
|
||||
//diff_in_subframes = 9 - current_subframe;
|
||||
//diff_in_subframes += (subframe + 1);
|
||||
//if (frame > 0) {
|
||||
// diff_in_subframes += (frame - 1) * 10;
|
||||
//}
|
||||
//diff_in_subframes += (1023 - current_frame) * 10;
|
||||
diff_in_subframes =
|
||||
10240 - ((current_frame * 10) + current_subframe) +
|
||||
((frame * 10) + subframe);
|
||||
if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* 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 flexran_agent_scheduler_dlsch_ue_remote.h
|
||||
* \brief Local stub for remote scheduler used by the controller
|
||||
* \author Xenofon Foukas
|
||||
* \date 2016
|
||||
* \email: x.foukas@sms.ed.ac.uk
|
||||
* \version 0.1
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __LAYER2_MAC_FLEXRAN_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H__
|
||||
#define __LAYER2_MAC_FLEXRAN_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H___
|
||||
|
||||
#include "flexran.pb-c.h"
|
||||
#include "header.pb-c.h"
|
||||
|
||||
#include "ENB_APP/flexran_agent_defs.h"
|
||||
#include "flexran_agent_mac.h"
|
||||
#include "LAYER2/MAC/flexran_agent_mac_proto.h"
|
||||
|
||||
#include <sys/queue.h>
|
||||
|
||||
// Maximum value of schedule ahead of time
|
||||
// Required to identify if a dl_command is for the future or not
|
||||
#define SCHED_AHEAD_SUBFRAMES 20
|
||||
|
||||
typedef struct dl_mac_config_element_s {
|
||||
Protocol__FlexranMessage *dl_info;
|
||||
TAILQ_ENTRY(dl_mac_config_element_s) configs;
|
||||
} dl_mac_config_element_t;
|
||||
|
||||
TAILQ_HEAD(DlMacConfigHead, dl_mac_config_element_s);
|
||||
|
||||
/*
|
||||
* Default scheduler used by the eNB agent
|
||||
*/
|
||||
void flexran_schedule_ue_spec_remote(mid_t mod_id, uint32_t frame,
|
||||
uint32_t subframe, int *mbsfn_flag,
|
||||
Protocol__FlexranMessage ** dl_info);
|
||||
|
||||
|
||||
// Find the difference in subframes from the given subframe
|
||||
// negative for older value
|
||||
// 0 for equal
|
||||
// positive for future value
|
||||
// Based on
|
||||
int get_sf_difference(mid_t mod_id, uint32_t sfn_sf);
|
||||
|
||||
#endif
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* 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 flexran_dci_conversions.h
|
||||
* \brief Conversion helpers from flexran messages to OAI formats DCI
|
||||
* \author Xenofon Foukas
|
||||
* \date 2016
|
||||
* \version 0.1
|
||||
*/
|
||||
|
||||
#ifndef LAYER2_MAC_FLEXRAN_DCI_CONVERISIONS_H__
|
||||
#define LAYER2_MAC_DCI_FLEXRAN_CONVERISIONS_H__
|
||||
|
||||
#define FILL_DCI_FDD_1(TYPE, DCI, FLEXRAN_DCI) \
|
||||
((TYPE*)DCI)->harq_pid = FLEXRAN_DCI->harq_process; \
|
||||
((TYPE*)DCI)->rv = FLEXRAN_DCI->rv[0]; \
|
||||
((TYPE*)DCI)->rballoc = FLEXRAN_DCI->rb_bitmap; \
|
||||
((TYPE*)DCI)->rah = FLEXRAN_DCI->res_alloc; \
|
||||
((TYPE*)DCI)->mcs = FLEXRAN_DCI->mcs[0]; \
|
||||
((TYPE*)DCI)->TPC = FLEXRAN_DCI->tpc; \
|
||||
((TYPE*)DCI)->ndi = FLEXRAN_DCI->ndi[0];
|
||||
|
||||
#define FILL_DCI_TDD_1(TYPE, DCI, FLEXRAN_DCI) \
|
||||
((TYPE*)DCI)->harq_pid = FLEXRAN_DCI->harq_process; \
|
||||
((TYPE*)DCI)->rv = FLEXRAN_DCI->rv[0]; \
|
||||
((TYPE*)DCI)->dai = FLEXRAN_DCI->dai; \
|
||||
((TYPE*)DCI)->rballoc = FLEXRAN_DCI->rb_bitmap; \
|
||||
((TYPE*)DCI)->rah = FLEXRAN_DCI->res_alloc; \
|
||||
((TYPE*)DCI)->mcs = FLEXRAN_DCI->mcs[0]; \
|
||||
((TYPE*)DCI)->TPC = FLEXRAN_DCI->tpc; \
|
||||
((TYPE*)DCI)->ndi = FLEXRAN_DCI->ndi[0];
|
||||
|
||||
#endif
|
||||
@@ -48,77 +48,8 @@
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char eNB_index, uint8_t first_sync) //init as MR
|
||||
{
|
||||
LOG_D(MAC, "[UE %d] Frame %d: PHY Sync to eNB_index %d successful \n",
|
||||
module_idP, frameP, eNB_index);
|
||||
#if defined(ENABLE_USE_MME)
|
||||
int mme_enabled = 1;
|
||||
#else
|
||||
int mme_enabled = 0;
|
||||
#endif
|
||||
|
||||
if (first_sync == 1 && !(mme_enabled == 1)) {
|
||||
//layer2_init_UE(module_idP);
|
||||
openair_rrc_ue_init(module_idP, eNB_index);
|
||||
} else {
|
||||
rrc_in_sync_ind(module_idP, frameP, eNB_index);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP,
|
||||
uint16_t eNB_index)
|
||||
{
|
||||
|
||||
// Mac_rlc_xface->mac_out_of_sync_ind(Mod_id, frameP, eNB_index);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mac_top_init_ue(int eMBMS_active, char *uecap_xer,
|
||||
uint8_t cba_group_active, uint8_t HO_active)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
LOG_I(MAC, "[MAIN] Init function start:Nb_UE_INST=%d\n", NB_UE_INST);
|
||||
|
||||
if (NB_UE_INST > 0) {
|
||||
UE_mac_inst =
|
||||
(UE_MAC_INST *) malloc16(NB_UE_INST * sizeof(UE_MAC_INST));
|
||||
|
||||
AssertFatal(UE_mac_inst != NULL,
|
||||
"[MAIN] Can't ALLOCATE %zu Bytes for %d UE_MAC_INST with size %zu \n",
|
||||
NB_UE_INST * sizeof(UE_MAC_INST), NB_UE_INST,
|
||||
sizeof(UE_MAC_INST));
|
||||
|
||||
LOG_D(MAC, "[MAIN] ALLOCATE %zu Bytes for %d UE_MAC_INST @ %p\n",
|
||||
NB_UE_INST * sizeof(UE_MAC_INST), NB_UE_INST, UE_mac_inst);
|
||||
|
||||
bzero(UE_mac_inst, NB_UE_INST * sizeof(UE_MAC_INST));
|
||||
|
||||
for (i = 0; i < NB_UE_INST; i++) {
|
||||
ue_init_mac(i);
|
||||
}
|
||||
} else {
|
||||
UE_mac_inst = NULL;
|
||||
}
|
||||
|
||||
|
||||
LOG_I(MAC, "[MAIN] calling RRC\n");
|
||||
openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active,
|
||||
HO_active);
|
||||
|
||||
|
||||
LOG_I(MAC, "[MAIN][INIT] Init function finished\n");
|
||||
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void mac_top_init_eNB()
|
||||
void mac_top_init_eNB(void)
|
||||
{
|
||||
|
||||
module_id_t i, j;
|
||||
@@ -247,10 +178,6 @@ int rlcmac_init_global_param(void)
|
||||
void mac_top_cleanup(void)
|
||||
{
|
||||
|
||||
#ifndef USER_MODE
|
||||
pdcp_module_cleanup();
|
||||
#endif
|
||||
|
||||
if (NB_UE_INST > 0) {
|
||||
free(UE_mac_inst);
|
||||
}
|
||||
@@ -261,21 +188,7 @@ void mac_top_cleanup(void)
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
|
||||
uint8_t HO_active)
|
||||
{
|
||||
LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
|
||||
// NB_NODE=2;
|
||||
// NB_INST=2;
|
||||
|
||||
rlcmac_init_global_param();
|
||||
LOG_I(MAC, "[MAIN] init UE MAC functions \n");
|
||||
mac_top_init_ue(eMBMS_active, uecap_xer, cba_group_active, HO_active);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int l2_init_eNB()
|
||||
int l2_init_eNB(void)
|
||||
{
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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 main.c
|
||||
* \brief top init of Layer 2
|
||||
* \author Navid Nikaein and Raymond Knopp
|
||||
* \date 2010 - 2014
|
||||
* \version 1.0
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "proto.h"
|
||||
#include "extern.h"
|
||||
#include "assertions.h"
|
||||
#include "PHY_INTERFACE/extern.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "LAYER2/PDCP_v10.1.0/pdcp.h"
|
||||
#include "RRC/LITE/defs.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
|
||||
#include "SCHED/defs.h"
|
||||
|
||||
|
||||
#include "common/ran_context.h"
|
||||
|
||||
extern void openair_rrc_top_init_ue( int eMBMS_active, char* uecap_xer, uint8_t cba_group_active, uint8_t HO_active);
|
||||
|
||||
void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char eNB_index, uint8_t first_sync) //init as MR
|
||||
{
|
||||
LOG_D(MAC, "[UE %d] Frame %d: PHY Sync to eNB_index %d successful \n",
|
||||
module_idP, frameP, eNB_index);
|
||||
#if defined(ENABLE_USE_MME)
|
||||
int mme_enabled = 1;
|
||||
#else
|
||||
int mme_enabled = 0;
|
||||
#endif
|
||||
|
||||
if (first_sync == 1 && !(mme_enabled == 1)) {
|
||||
//layer2_init_UE(module_idP);
|
||||
openair_rrc_ue_init(module_idP, eNB_index);
|
||||
} else {
|
||||
rrc_in_sync_ind(module_idP, frameP, eNB_index);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP,
|
||||
uint16_t eNB_index)
|
||||
{
|
||||
|
||||
// Mac_rlc_xface->mac_out_of_sync_ind(Mod_id, frameP, eNB_index);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mac_top_init_ue(int eMBMS_active, char *uecap_xer,
|
||||
uint8_t cba_group_active, uint8_t HO_active)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
LOG_I(MAC, "[MAIN] Init function start:Nb_UE_INST=%d\n", NB_UE_INST);
|
||||
|
||||
if (NB_UE_INST > 0) {
|
||||
UE_mac_inst =
|
||||
(UE_MAC_INST *) malloc16(NB_UE_INST * sizeof(UE_MAC_INST));
|
||||
|
||||
AssertFatal(UE_mac_inst != NULL,
|
||||
"[MAIN] Can't ALLOCATE %zu Bytes for %d UE_MAC_INST with size %zu \n",
|
||||
NB_UE_INST * sizeof(UE_MAC_INST), NB_UE_INST,
|
||||
sizeof(UE_MAC_INST));
|
||||
|
||||
LOG_D(MAC, "[MAIN] ALLOCATE %zu Bytes for %d UE_MAC_INST @ %p\n",
|
||||
NB_UE_INST * sizeof(UE_MAC_INST), NB_UE_INST, UE_mac_inst);
|
||||
|
||||
bzero(UE_mac_inst, NB_UE_INST * sizeof(UE_MAC_INST));
|
||||
|
||||
for (i = 0; i < NB_UE_INST; i++) {
|
||||
ue_init_mac(i);
|
||||
}
|
||||
} else {
|
||||
UE_mac_inst = NULL;
|
||||
}
|
||||
|
||||
|
||||
LOG_I(MAC, "[MAIN] calling RRC\n");
|
||||
openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active,
|
||||
HO_active);
|
||||
|
||||
|
||||
LOG_I(MAC, "[MAIN][INIT] Init function finished\n");
|
||||
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
int rlcmac_init_global_param_ue(void)
|
||||
{
|
||||
|
||||
|
||||
LOG_I(MAC, "[MAIN] CALLING RLC_MODULE_INIT...\n");
|
||||
|
||||
if (rlc_module_init() != 0) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
pdcp_layer_init();
|
||||
|
||||
LOG_I(MAC, "[MAIN] Init Global Param Done\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
|
||||
uint8_t HO_active)
|
||||
{
|
||||
LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
|
||||
// NB_NODE=2;
|
||||
// NB_INST=2;
|
||||
|
||||
rlcmac_init_global_param_ue();
|
||||
LOG_I(MAC, "[MAIN] init UE MAC functions \n");
|
||||
mac_top_init_ue(eMBMS_active, uecap_xer, cba_group_active, HO_active);
|
||||
return (1);
|
||||
}
|
||||
|
||||
+492
-411
File diff suppressed because it is too large
Load Diff
@@ -35,6 +35,22 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* slice specific scheduler
|
||||
*/
|
||||
typedef void (*slice_scheduler_dl)(module_id_t mod_id,
|
||||
slice_id_t slice_id,
|
||||
frame_t frame,
|
||||
sub_frame_t subframe,
|
||||
int *mbsfn_flag);
|
||||
|
||||
typedef void (*slice_scheduler_ul)(module_id_t mod_id,
|
||||
slice_id_t slice_id,
|
||||
frame_t frame,
|
||||
sub_frame_t subframe,
|
||||
unsigned char sched_subframe,
|
||||
uint16_t *first_rb);
|
||||
|
||||
/** \fn void schedule_mib(module_id_t module_idP,frame_t frameP,sub_frame_t subframe);
|
||||
\brief MIB scheduling for PBCH. This function requests the MIB from RRC and provides it to L1.
|
||||
@param Mod_id Instance ID of eNB
|
||||
@@ -102,11 +118,12 @@ void schedule_ulsch(module_id_t module_idP, frame_t frameP,
|
||||
|
||||
/** \brief ULSCH Scheduling per RNTI
|
||||
@param Mod_id Instance ID of eNB
|
||||
@param slice_id Instance slice for this eNB
|
||||
@param frame Frame index
|
||||
@param subframe Subframe number on which to act
|
||||
@param sched_subframe Subframe number where PUSCH is transmitted (for DAI lookup)
|
||||
*/
|
||||
void schedule_ulsch_rnti(module_id_t module_idP, frame_t frameP,
|
||||
void schedule_ulsch_rnti(module_id_t module_idP, slice_id_t slice_idP, frame_t frameP,
|
||||
sub_frame_t subframe,
|
||||
unsigned char sched_subframe,
|
||||
uint16_t * first_rb);
|
||||
@@ -127,9 +144,12 @@ void fill_DLSCH_dci(module_id_t module_idP, frame_t frameP,
|
||||
|
||||
@param mbsfn_flag Indicates that MCH/MCCH is in this subframe
|
||||
*/
|
||||
void schedule_ue_spec(module_id_t module_idP, frame_t frameP,
|
||||
void schedule_dlsch(module_id_t module_idP, frame_t frameP,
|
||||
sub_frame_t subframe, int *mbsfn_flag);
|
||||
|
||||
void schedule_ue_spec(module_id_t module_idP, slice_id_t slice_idP,
|
||||
frame_t frameP,sub_frame_t subframe, int *mbsfn_flag);
|
||||
|
||||
|
||||
/** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure.
|
||||
@param Mod_id Module id of UE
|
||||
@@ -192,6 +212,8 @@ void dlsch_scheduler_pre_processor_reset(int module_idP, int UE_id,
|
||||
uint16_t
|
||||
nb_rbs_required_remaining
|
||||
[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
|
||||
unsigned char total_ue_count[MAX_NUM_CCs],
|
||||
unsigned char total_rbs_used[MAX_NUM_CCs],
|
||||
unsigned char
|
||||
rballoc_sub[MAX_NUM_CCs]
|
||||
[N_RBG_MAX],
|
||||
@@ -209,6 +231,7 @@ void dlsch_scheduler_pre_processor_reset(int module_idP, int UE_id,
|
||||
|
||||
|
||||
void dlsch_scheduler_pre_processor(module_id_t module_idP,
|
||||
slice_id_t slice_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t subframe,
|
||||
int N_RBG[MAX_NUM_CCs],
|
||||
@@ -426,6 +449,14 @@ void set_ue_dai(sub_frame_t subframeP,
|
||||
int UE_id,
|
||||
uint8_t CC_id, uint8_t tdd_config, UE_list_t * UE_list);
|
||||
|
||||
/** \brief First stage of PCH Scheduling. Gets a PCH SDU from RRC if available and computes the MCS required to transport it as a function of the SDU length. It assumes a length less than or equal to 64 bytes (MCS 6, 3 PRBs).
|
||||
@param Mod_id Instance ID of eNB
|
||||
@param frame Frame index
|
||||
@param subframe Subframe number on which to act
|
||||
@param paging_ue_index
|
||||
*/
|
||||
void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP);
|
||||
|
||||
uint8_t find_num_active_UEs_in_cbagroup(module_id_t module_idP,
|
||||
unsigned char group_id);
|
||||
uint8_t UE_is_to_be_scheduled(module_id_t module_idP, int CC_id,
|
||||
@@ -633,17 +664,18 @@ int UE_PCCID(module_id_t mod_idP, int ue_idP);
|
||||
rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP);
|
||||
|
||||
|
||||
void ulsch_scheduler_pre_processor(module_id_t module_idP, int frameP,
|
||||
void ulsch_scheduler_pre_processor(module_id_t module_idP, slice_id_t slice_id, int frameP,
|
||||
sub_frame_t subframeP,
|
||||
uint16_t * first_rb);
|
||||
void store_ulsch_buffer(module_id_t module_idP, int frameP,
|
||||
sub_frame_t subframeP);
|
||||
void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP);
|
||||
void assign_max_mcs_min_rb(module_id_t module_idP, int frameP,
|
||||
void assign_max_mcs_min_rb(module_id_t module_idP, int slice_id, int frameP,
|
||||
sub_frame_t subframeP, uint16_t * first_rb);
|
||||
void adjust_bsr_info(int buffer_occupancy, uint16_t TBS,
|
||||
UE_TEMPLATE * UE_template);
|
||||
int phy_stats_exist(module_id_t Mod_id, int rnti);
|
||||
void sort_UEs(module_id_t Mod_idP, slice_id_t slice_id, int frameP, sub_frame_t subframeP);
|
||||
|
||||
/*! \fn UE_L2_state_t ue_scheduler(const module_id_t module_idP,const frame_t frameP, const sub_frame_t subframe, const lte_subframe_t direction,const uint8_t eNB_index)
|
||||
\brief UE scheduler where all the ue background tasks are done. This function performs the following: 1) Trigger PDCP every 5ms 2) Call RRC for link status return to PHY3) Perform SR/BSR procedures for scheduling feedback 4) Perform PHR procedures.
|
||||
@@ -1157,5 +1189,10 @@ int32_t get_uldl_offset(int eutra_bandP);
|
||||
int l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
|
||||
uint8_t HO_active);
|
||||
|
||||
/*Slice related functions */
|
||||
uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs);
|
||||
|
||||
int ue_slice_membership(int UE_id, int slice_id);
|
||||
|
||||
#endif
|
||||
/** @}*/
|
||||
|
||||
@@ -372,14 +372,14 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
|
||||
if (UE_mac_inst[module_idP].RA_active == 0) {
|
||||
LOG_I(MAC, "RA not active\n");
|
||||
// check if RRC is ready to initiate the RA procedure
|
||||
Size = mac_rrc_data_req(module_idP,
|
||||
Size = mac_rrc_data_req_ue(module_idP,
|
||||
CC_id,
|
||||
frameP,
|
||||
CCCH, 1,
|
||||
&UE_mac_inst[module_idP].
|
||||
CCCH_pdu.payload[sizeof
|
||||
(SCH_SUBHEADER_SHORT)
|
||||
+ 1], 0, eNB_indexP,
|
||||
+ 1], eNB_indexP,
|
||||
0);
|
||||
Size16 = (uint16_t) Size;
|
||||
|
||||
|
||||
@@ -182,104 +182,3 @@ fill_rar_br(eNB_MAC_INST * eNB,
|
||||
}
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const frame_t frameP, const rnti_t ra_rnti, uint8_t * const dlsch_buffer, rnti_t * const t_crnti, const uint8_t preamble_index, uint8_t * selected_rar_buffer // output argument for storing the selected RAR header and RAR payload
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
uint16_t ret = 0; // return value
|
||||
|
||||
RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *) dlsch_buffer;
|
||||
// RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1);
|
||||
uint8_t *rar = (uint8_t *) (dlsch_buffer + 1);
|
||||
|
||||
// get the last RAR payload for working with CMW500
|
||||
uint8_t n_rarpy = 0; // number of RAR payloads
|
||||
uint8_t n_rarh = 0; // number of MAC RAR subheaders
|
||||
uint8_t best_rx_rapid = -1; // the closest RAPID receive from all RARs
|
||||
while (1) {
|
||||
n_rarh++;
|
||||
if (rarh->T == 1) {
|
||||
n_rarpy++;
|
||||
LOG_D(MAC, "RAPID %d\n", rarh->RAPID);
|
||||
}
|
||||
|
||||
if (rarh->RAPID == preamble_index) {
|
||||
LOG_D(PHY, "Found RAR with the intended RAPID %d\n",
|
||||
rarh->RAPID);
|
||||
rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6);
|
||||
break;
|
||||
}
|
||||
|
||||
if (abs((int) rarh->RAPID - (int) preamble_index) <
|
||||
abs((int) best_rx_rapid - (int) preamble_index)) {
|
||||
best_rx_rapid = rarh->RAPID;
|
||||
rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6);
|
||||
}
|
||||
|
||||
if (rarh->E == 0) {
|
||||
LOG_I(PHY,
|
||||
"No RAR found with the intended RAPID. The closest RAPID in all RARs is %d\n",
|
||||
best_rx_rapid);
|
||||
break;
|
||||
} else {
|
||||
rarh++;
|
||||
}
|
||||
};
|
||||
LOG_D(MAC, "number of RAR subheader %d; number of RAR pyloads %d\n",
|
||||
n_rarh, n_rarpy);
|
||||
|
||||
if (CC_id > 0) {
|
||||
LOG_W(MAC, "Should not have received RAR on secondary CCs! \n");
|
||||
return (0xffff);
|
||||
}
|
||||
|
||||
LOG_I(MAC,
|
||||
"[eNB %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",
|
||||
module_idP, frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2],
|
||||
rar[3], rar[4], rar[5], rarh->RAPID, preamble_index);
|
||||
#ifdef DEBUG_RAR
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rarh->E %d\n", module_idP, rarh->E);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rarh->T %d\n", module_idP, rarh->T);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rarh->RAPID %d\n", module_idP,
|
||||
rarh->RAPID);
|
||||
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->R %d\n",module_idP,rar->R);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rar->Timing_Advance_Command %d\n",
|
||||
module_idP, (((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4));
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->hopping_flag %d\n",module_idP,rar->hopping_flag);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->rb_alloc %d\n",module_idP,rar->rb_alloc);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->mcs %d\n",module_idP,rar->mcs);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->TPC %d\n",module_idP,rar->TPC);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->UL_delay %d\n",module_idP,rar->UL_delay);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->cqi_req %d\n",module_idP,rar->cqi_req);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rar->t_crnti %x\n", module_idP,
|
||||
(uint16_t) rar[5] + (rar[4] << 8));
|
||||
#endif
|
||||
|
||||
if (opt_enabled) {
|
||||
LOG_D(OPT,
|
||||
"[UE %d][RAPROC] CC_id %d RAR Frame %d trace pdu for ra-RNTI %x\n",
|
||||
module_idP, CC_id, frameP, ra_rnti);
|
||||
trace_pdu(1, (uint8_t *) dlsch_buffer, n_rarh + n_rarpy * 6,
|
||||
module_idP, 2, ra_rnti, UE_mac_inst[module_idP].rxFrame,
|
||||
UE_mac_inst[module_idP].rxSubframe, 0, 0);
|
||||
}
|
||||
|
||||
if (preamble_index == rarh->RAPID) {
|
||||
*t_crnti = (uint16_t) rar[5] + (rar[4] << 8); //rar->t_crnti;
|
||||
UE_mac_inst[module_idP].crnti = *t_crnti; //rar->t_crnti;
|
||||
//return(rar->Timing_Advance_Command);
|
||||
ret = ((((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4));
|
||||
} else {
|
||||
UE_mac_inst[module_idP].crnti = 0;
|
||||
ret = (0xffff);
|
||||
}
|
||||
|
||||
// move the selected RAR to the front of the RA_PDSCH buffer
|
||||
memcpy(selected_rar_buffer + 0, (uint8_t *) rarh, 1);
|
||||
memcpy(selected_rar_buffer + 1, (uint8_t *) rar, 6);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* 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 rar_tools.c
|
||||
* \brief random access tools
|
||||
* \author Raymond Knopp and navid nikaein
|
||||
* \date 2011 - 2014
|
||||
* \version 1.0
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "proto.h"
|
||||
#include "extern.h"
|
||||
#include "SIMULATION/TOOLS/defs.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "OCG.h"
|
||||
#include "OCG_extern.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
#include "common/ran_context.h"
|
||||
|
||||
#define DEBUG_RAR
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const frame_t frameP, const rnti_t ra_rnti, uint8_t * const dlsch_buffer, rnti_t * const t_crnti, const uint8_t preamble_index, uint8_t * selected_rar_buffer // output argument for storing the selected RAR header and RAR payload
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
uint16_t ret = 0; // return value
|
||||
|
||||
RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *) dlsch_buffer;
|
||||
// RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1);
|
||||
uint8_t *rar = (uint8_t *) (dlsch_buffer + 1);
|
||||
|
||||
// get the last RAR payload for working with CMW500
|
||||
uint8_t n_rarpy = 0; // number of RAR payloads
|
||||
uint8_t n_rarh = 0; // number of MAC RAR subheaders
|
||||
uint8_t best_rx_rapid = -1; // the closest RAPID receive from all RARs
|
||||
while (1) {
|
||||
n_rarh++;
|
||||
if (rarh->T == 1) {
|
||||
n_rarpy++;
|
||||
LOG_D(MAC, "RAPID %d\n", rarh->RAPID);
|
||||
}
|
||||
|
||||
if (rarh->RAPID == preamble_index) {
|
||||
LOG_D(PHY, "Found RAR with the intended RAPID %d\n",
|
||||
rarh->RAPID);
|
||||
rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6);
|
||||
break;
|
||||
}
|
||||
|
||||
if (abs((int) rarh->RAPID - (int) preamble_index) <
|
||||
abs((int) best_rx_rapid - (int) preamble_index)) {
|
||||
best_rx_rapid = rarh->RAPID;
|
||||
rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6);
|
||||
}
|
||||
|
||||
if (rarh->E == 0) {
|
||||
LOG_I(PHY,
|
||||
"No RAR found with the intended RAPID. The closest RAPID in all RARs is %d\n",
|
||||
best_rx_rapid);
|
||||
break;
|
||||
} else {
|
||||
rarh++;
|
||||
}
|
||||
};
|
||||
LOG_D(MAC, "number of RAR subheader %d; number of RAR pyloads %d\n",
|
||||
n_rarh, n_rarpy);
|
||||
|
||||
if (CC_id > 0) {
|
||||
LOG_W(MAC, "Should not have received RAR on secondary CCs! \n");
|
||||
return (0xffff);
|
||||
}
|
||||
|
||||
LOG_I(MAC,
|
||||
"[eNB %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",
|
||||
module_idP, frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2],
|
||||
rar[3], rar[4], rar[5], rarh->RAPID, preamble_index);
|
||||
#ifdef DEBUG_RAR
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rarh->E %d\n", module_idP, rarh->E);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rarh->T %d\n", module_idP, rarh->T);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rarh->RAPID %d\n", module_idP,
|
||||
rarh->RAPID);
|
||||
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->R %d\n",module_idP,rar->R);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rar->Timing_Advance_Command %d\n",
|
||||
module_idP, (((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4));
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->hopping_flag %d\n",module_idP,rar->hopping_flag);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->rb_alloc %d\n",module_idP,rar->rb_alloc);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->mcs %d\n",module_idP,rar->mcs);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->TPC %d\n",module_idP,rar->TPC);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->UL_delay %d\n",module_idP,rar->UL_delay);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->cqi_req %d\n",module_idP,rar->cqi_req);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rar->t_crnti %x\n", module_idP,
|
||||
(uint16_t) rar[5] + (rar[4] << 8));
|
||||
#endif
|
||||
|
||||
if (opt_enabled) {
|
||||
LOG_D(OPT,
|
||||
"[UE %d][RAPROC] CC_id %d RAR Frame %d trace pdu for ra-RNTI %x\n",
|
||||
module_idP, CC_id, frameP, ra_rnti);
|
||||
trace_pdu(1, (uint8_t *) dlsch_buffer, n_rarh + n_rarpy * 6,
|
||||
module_idP, 2, ra_rnti, UE_mac_inst[module_idP].rxFrame,
|
||||
UE_mac_inst[module_idP].rxSubframe, 0, 0);
|
||||
}
|
||||
|
||||
if (preamble_index == rarh->RAPID) {
|
||||
*t_crnti = (uint16_t) rar[5] + (rar[4] << 8); //rar->t_crnti;
|
||||
UE_mac_inst[module_idP].crnti = *t_crnti; //rar->t_crnti;
|
||||
//return(rar->Timing_Advance_Command);
|
||||
ret = ((((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4));
|
||||
} else {
|
||||
UE_mac_inst[module_idP].crnti = 0;
|
||||
ret = (0xffff);
|
||||
}
|
||||
|
||||
// move the selected RAR to the front of the RA_PDSCH buffer
|
||||
memcpy(selected_rar_buffer + 0, (uint8_t *) rarh, 1);
|
||||
memcpy(selected_rar_buffer + 1, (uint8_t *) rar, 6);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
@@ -71,11 +71,6 @@
|
||||
|
||||
extern uint8_t usim_test;
|
||||
|
||||
/*
|
||||
#ifndef USER_MODE
|
||||
#define msg debug_msg
|
||||
#endif
|
||||
*/
|
||||
mapping BSR_names[] = {
|
||||
{"NONE", 0},
|
||||
{"SHORT BSR", 1},
|
||||
@@ -520,13 +515,13 @@ ue_send_sdu(module_id_t module_idP,
|
||||
|
||||
LOG_T(MAC, "\n");
|
||||
#endif
|
||||
mac_rrc_data_ind(module_idP,
|
||||
mac_rrc_data_ind_ue(module_idP,
|
||||
CC_id,
|
||||
frameP, subframeP,
|
||||
UE_mac_inst[module_idP].crnti,
|
||||
CCCH,
|
||||
(uint8_t *) payload_ptr,
|
||||
rx_lengths[i], ENB_FLAG_NO, eNB_index, 0);
|
||||
rx_lengths[i], eNB_index, 0);
|
||||
|
||||
} else if ((rx_lcids[i] == DCCH) || (rx_lcids[i] == DCCH1)) {
|
||||
LOG_D(MAC,
|
||||
@@ -589,9 +584,9 @@ ue_decode_si(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
LOG_D(MAC, "[UE %d] Frame %d Sending SI to RRC (LCID Id %d,len %d)\n",
|
||||
module_idP, frameP, BCCH, len);
|
||||
|
||||
mac_rrc_data_ind(module_idP, CC_id, frameP, 0, // unknown subframe
|
||||
mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0, // unknown subframe
|
||||
SI_RNTI,
|
||||
BCCH, (uint8_t *) pdu, len, ENB_FLAG_NO, eNB_index,
|
||||
BCCH, (uint8_t *) pdu, len, eNB_index,
|
||||
0);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_OUT);
|
||||
@@ -627,9 +622,9 @@ ue_decode_p(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
"[UE %d] Frame %d Sending Paging message to RRC (LCID Id %d,len %d)\n",
|
||||
module_idP, frameP, PCCH, len);
|
||||
|
||||
mac_rrc_data_ind(module_idP, CC_id, frameP, 0, // unknown subframe
|
||||
mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0, // unknown subframe
|
||||
P_RNTI,
|
||||
PCCH, (uint8_t *) pdu, len, ENB_FLAG_NO, eNB_index,
|
||||
PCCH, (uint8_t *) pdu, len, eNB_index,
|
||||
0);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_OUT);
|
||||
@@ -749,10 +744,10 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
"[UE %d] Frame %d : SDU %d MCH->MCCH for sync area %d (eNB %d, %d bytes)\n",
|
||||
module_idP, frameP, i, sync_area, eNB_index,
|
||||
rx_lengths[i]);
|
||||
mac_rrc_data_ind(module_idP, CC_id, frameP, 0, // unknown subframe
|
||||
mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0, // unknown subframe
|
||||
M_RNTI,
|
||||
MCCH,
|
||||
payload_ptr, rx_lengths[i], 0, eNB_index,
|
||||
payload_ptr, rx_lengths[i], eNB_index,
|
||||
sync_area);
|
||||
} else if (rx_lcids[i] == MTCH) {
|
||||
if (UE_mac_inst[module_idP].msi_status == 1) {
|
||||
@@ -2235,10 +2230,10 @@ ue_scheduler(const module_id_t module_idP,
|
||||
UE_mac_inst[module_idP].rxSubframe = rxSubframeP;
|
||||
|
||||
#ifdef CELLULAR
|
||||
rrc_rx_tx(module_idP, txFrameP, 0, eNB_indexP);
|
||||
rrc_rx_tx_ue(module_idP, txFrameP, 0, eNB_indexP);
|
||||
#else
|
||||
|
||||
switch (rrc_rx_tx(&ctxt, eNB_indexP, CC_id)) {
|
||||
switch (rrc_rx_tx_ue(&ctxt, eNB_indexP, CC_id)) {
|
||||
case RRC_OK:
|
||||
break;
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@
|
||||
|
||||
#ifndef __MAC_VARS_H__
|
||||
#define __MAC_VARS_H__
|
||||
#ifdef USER_MODE
|
||||
//#include "stdio.h"
|
||||
#endif //USER_MODE
|
||||
#include "PHY/defs.h"
|
||||
#include "defs.h"
|
||||
#include "COMMON/mac_rrc_primitives.h"
|
||||
|
||||
@@ -54,10 +54,6 @@ SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_reassembly.c
|
||||
SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_receiver.c
|
||||
SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_dar.c
|
||||
|
||||
ifeq ($(OPENAIR_EMU),1)
|
||||
SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_very_simple_test.c
|
||||
endif
|
||||
|
||||
SOURCES_L2 += $(RLC_DIR)/rlc_mac.c
|
||||
SOURCES_L2 += $(RLC_DIR)/rlc.c
|
||||
SOURCES_L2 += $(RLC_DIR)/rlc_rrc.c
|
||||
|
||||
+240
-120
@@ -30,9 +30,6 @@
|
||||
#define PDCP_C
|
||||
//#define DEBUG_PDCP_FIFO_FLUSH_SDU
|
||||
|
||||
#ifndef USER_MODE
|
||||
#include <rtai_fifos.h>
|
||||
#endif
|
||||
#include "assertions.h"
|
||||
#include "hashtable.h"
|
||||
#include "pdcp.h"
|
||||
@@ -64,10 +61,10 @@
|
||||
# include "gtpv1u.h"
|
||||
#endif
|
||||
|
||||
#ifndef OAI_EMU
|
||||
extern int otg_enabled;
|
||||
#endif
|
||||
|
||||
#include "common/ran_context.h"
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/*
|
||||
@@ -102,6 +99,8 @@ boolean_t pdcp_data_req(
|
||||
|
||||
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
|
||||
hashtable_rc_t h_rc;
|
||||
uint8_t rb_offset= (srb_flagP == 0) ? DTCH -1 : 0;
|
||||
uint16_t pdcp_uid=0;
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_IN);
|
||||
CHECK_CTXT_ARGS(ctxt_pP);
|
||||
|
||||
@@ -147,7 +146,7 @@ boolean_t pdcp_data_req(
|
||||
ctxt_pP->configured=TRUE;
|
||||
}
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
|
||||
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
|
||||
} else {
|
||||
start_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
|
||||
@@ -218,7 +217,7 @@ boolean_t pdcp_data_req(
|
||||
LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" Cannot fill PDU buffer with relevant header fields!\n",
|
||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p));
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
|
||||
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
|
||||
} else {
|
||||
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
|
||||
@@ -236,8 +235,9 @@ boolean_t pdcp_data_req(
|
||||
if (pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer((unsigned char*)pdcp_pdu_p->data, &pdu_header) == FALSE) {
|
||||
LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" Cannot fill PDU buffer with relevant header fields!\n",
|
||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p));
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
|
||||
} else {
|
||||
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
|
||||
@@ -259,7 +259,7 @@ boolean_t pdcp_data_req(
|
||||
|
||||
free_mem_block(pdcp_pdu_p, __func__);
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
|
||||
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
|
||||
} else {
|
||||
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
|
||||
@@ -287,7 +287,7 @@ boolean_t pdcp_data_req(
|
||||
(((pdcp_p->cipheringAlgorithm) != 0) ||
|
||||
((pdcp_p->integrityProtAlgorithm) != 0))) {
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
|
||||
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].apply_security);
|
||||
} else {
|
||||
start_meas(&UE_pdcp_stats[ctxt_pP->module_id].apply_security);
|
||||
@@ -382,7 +382,7 @@ boolean_t pdcp_data_req(
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
|
||||
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
|
||||
} else {
|
||||
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
|
||||
@@ -392,16 +392,23 @@ boolean_t pdcp_data_req(
|
||||
* Control arrives here only if rlc_data_req() returns RLC_OP_STATUS_OK
|
||||
* so we return TRUE afterwards
|
||||
*/
|
||||
/*
|
||||
if (rb_id>=DTCH) {
|
||||
if (ctxt_pP->enb_flag == 1) {
|
||||
Pdcp_stats_tx[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH]++;
|
||||
Pdcp_stats_tx_bytes[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH] += sdu_buffer_size;
|
||||
} else {
|
||||
Pdcp_stats_tx[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH]++;
|
||||
Pdcp_stats_tx_bytes[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH] += sdu_buffer_size;
|
||||
}
|
||||
}*/
|
||||
|
||||
for (pdcp_uid=0; pdcp_uid< NUMBER_OF_UE_MAX;pdcp_uid++){
|
||||
if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti )
|
||||
break;
|
||||
}
|
||||
|
||||
//LOG_I(PDCP,"ueid %d lcid %d tx seq num %d\n", pdcp_uid, rb_idP+rb_offset, current_sn);
|
||||
Pdcp_stats_tx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
|
||||
Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
|
||||
Pdcp_stats_tx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=sdu_buffer_sizeP;
|
||||
Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=sdu_buffer_sizeP;
|
||||
Pdcp_stats_tx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=current_sn;
|
||||
|
||||
Pdcp_stats_tx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_tx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
|
||||
Pdcp_stats_tx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_tx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
|
||||
Pdcp_stats_tx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT);
|
||||
return ret;
|
||||
|
||||
@@ -431,6 +438,9 @@ pdcp_data_ind(
|
||||
boolean_t packet_forwarded = FALSE;
|
||||
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
|
||||
hashtable_rc_t h_rc;
|
||||
uint8_t rb_offset= (srb_flagP == 0) ? DTCH -1 :0;
|
||||
uint16_t pdcp_uid=0;
|
||||
uint8_t oo_flag=0;
|
||||
#if defined(LINK_ENB_PDCP_TO_GTPV1U)
|
||||
MessageDef *message_p = NULL;
|
||||
uint8_t *gtpu_buffer_p = NULL;
|
||||
@@ -439,11 +449,6 @@ pdcp_data_ind(
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_IN);
|
||||
|
||||
#ifdef OAI_EMU
|
||||
|
||||
CHECK_CTXT_ARGS(ctxt_pP);
|
||||
|
||||
#endif
|
||||
#ifdef PDCP_MSG_PRINT
|
||||
int i=0;
|
||||
LOG_F(PDCP,"[MSG] PDCP UL %s PDU on rb_id %d\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP);
|
||||
@@ -585,6 +590,7 @@ pdcp_data_ind(
|
||||
else
|
||||
LOG_D(PDCP, "Passing piggybacked SDU to RRC ...\n");*/
|
||||
} else {
|
||||
oo_flag=1;
|
||||
LOG_W(PDCP,
|
||||
PROTOCOL_PDCP_CTXT_FMT"Incoming PDU has an unexpected sequence number (%d), RX window synchronisation have probably been lost!\n",
|
||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
|
||||
@@ -638,11 +644,12 @@ pdcp_data_ind(
|
||||
PROTOCOL_PDCP_CTXT_FMT" DATA-IND len %u",
|
||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
|
||||
sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len);
|
||||
rrc_data_ind(ctxt_pP,
|
||||
rrc_data_ind(ctxt_pP,
|
||||
rb_id,
|
||||
sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len,
|
||||
(uint8_t*)&sdu_buffer_pP->data[pdcp_header_len]);
|
||||
free_mem_block(sdu_buffer_pP, __func__);
|
||||
free_mem_block(sdu_buffer_pP, __func__);
|
||||
|
||||
|
||||
// free_mem_block(new_sdu, __func__);
|
||||
if (ctxt_pP->enb_flag) {
|
||||
@@ -691,49 +698,6 @@ pdcp_data_ind(
|
||||
payload_offset=0;
|
||||
}
|
||||
|
||||
#if defined(USER_MODE) && defined(OAI_EMU)
|
||||
|
||||
if (oai_emulation.info.otg_enabled == 1) {
|
||||
//unsigned int dst_instance;
|
||||
int ctime;
|
||||
|
||||
if ((pdcp_p->rlc_mode == RLC_MODE_AM)&&(MBMS_flagP==0) ) {
|
||||
pdcp_p->last_submitted_pdcp_rx_sn = sequence_number;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_PDCP_PAYLOAD)
|
||||
rlc_util_print_hex_octets(PDCP,
|
||||
(unsigned char*)&sdu_buffer_pP->data[payload_offset],
|
||||
sdu_buffer_sizeP - payload_offset);
|
||||
#endif
|
||||
|
||||
ctime = oai_emulation.info.time_ms; // avg current simulation time in ms : we may get the exact time through OCG?
|
||||
if (MBMS_flagP == 0){
|
||||
LOG_D(PDCP,
|
||||
PROTOCOL_PDCP_CTXT_FMT"Check received buffer : (dst %d)\n",
|
||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
|
||||
ctxt_pP->instance);
|
||||
}
|
||||
if (otg_rx_pkt(
|
||||
ctxt_pP->instance,
|
||||
ctime,
|
||||
(const char*)(&sdu_buffer_pP->data[payload_offset]),
|
||||
sdu_buffer_sizeP - payload_offset ) == 0 ) {
|
||||
free_mem_block(sdu_buffer_pP, __func__);
|
||||
|
||||
if (ctxt_pP->enb_flag) {
|
||||
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
|
||||
} else {
|
||||
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_ind);
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if (otg_enabled==1) {
|
||||
LOG_D(OTG,"Discarding received packed\n");
|
||||
free_mem_block(sdu_buffer_pP, __func__);
|
||||
@@ -748,9 +712,6 @@ pdcp_data_ind(
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// XXX Decompression would be done at this point
|
||||
|
||||
/*
|
||||
@@ -783,9 +744,9 @@ pdcp_data_ind(
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ctxt_pP->rnti;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4;
|
||||
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
|
||||
packet_forwarded = TRUE;
|
||||
packet_forwarded = TRUE;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
packet_forwarded = FALSE;
|
||||
#endif
|
||||
@@ -809,22 +770,15 @@ pdcp_data_ind(
|
||||
// set ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst for IP layer here
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||
((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_id;
|
||||
#if defined(OAI_EMU)
|
||||
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id + oai_emulation.info.nb_enb_local - oai_emulation.info.first_ue_local;
|
||||
#else
|
||||
# if defined(ENABLE_USE_MME)
|
||||
#if defined(ENABLE_USE_MME)
|
||||
/* for the UE compiled in S1 mode, we need 1 here
|
||||
* for the UE compiled in noS1 mode, we need 0
|
||||
* TODO: be sure of this
|
||||
*/
|
||||
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1;
|
||||
# endif
|
||||
#endif
|
||||
} else {
|
||||
((pdcp_data_ind_header_t*) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->module_id * maxDRB);
|
||||
#if defined(OAI_EMU)
|
||||
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id - oai_emulation.info.first_enb_local;
|
||||
#endif
|
||||
}
|
||||
#ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
|
||||
static uint32_t pdcp_inst = 0;
|
||||
@@ -837,28 +791,44 @@ pdcp_data_ind(
|
||||
sdu_buffer_sizeP - payload_offset);
|
||||
list_add_tail_eurecom (new_sdu_p, sdu_list_p);
|
||||
|
||||
/* Print octets of incoming data in hexadecimal form */
|
||||
LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n",
|
||||
sdu_buffer_sizeP - payload_offset + (int)sizeof(pdcp_data_ind_header_t),
|
||||
sdu_buffer_sizeP - payload_offset);
|
||||
//util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
|
||||
//util_flush_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
|
||||
|
||||
/*
|
||||
* Update PDCP statistics
|
||||
* XXX Following two actions are identical, is there a merge error?
|
||||
*/
|
||||
|
||||
/*if (ctxt_pP->enb_flag == 1) {
|
||||
Pdcp_stats_rx[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH]++;
|
||||
Pdcp_stats_rx_bytes[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH] += sdu_buffer_sizeP;
|
||||
} else {
|
||||
Pdcp_stats_rx[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH]++;
|
||||
Pdcp_stats_rx_bytes[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH] += sdu_buffer_sizeP;
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Print octets of incoming data in hexadecimal form */
|
||||
LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n",
|
||||
sdu_buffer_sizeP - payload_offset + (int)sizeof(pdcp_data_ind_header_t),
|
||||
sdu_buffer_sizeP - payload_offset);
|
||||
//util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
|
||||
//util_flush_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
|
||||
|
||||
/*
|
||||
* Update PDCP statistics
|
||||
* XXX Following two actions are identical, is there a merge error?
|
||||
*/
|
||||
|
||||
for (pdcp_uid=0; pdcp_uid< NUMBER_OF_UE_MAX;pdcp_uid++){
|
||||
if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti ){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Pdcp_stats_rx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
|
||||
Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
|
||||
Pdcp_stats_rx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset);
|
||||
Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset);
|
||||
|
||||
Pdcp_stats_rx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=sequence_number;
|
||||
|
||||
if (oo_flag == 1 )
|
||||
Pdcp_stats_rx_outoforder[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
|
||||
|
||||
Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
|
||||
Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
|
||||
Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn;
|
||||
|
||||
|
||||
#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD)
|
||||
else {
|
||||
AssertFatal(0, PROTOCOL_PDCP_CTXT_FMT" PDCP_DATA_IND SDU DROPPED, OUT OF MEMORY \n",
|
||||
@@ -879,6 +849,53 @@ pdcp_data_ind(
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void pdcp_update_stats(const protocol_ctxt_t* const ctxt_pP){
|
||||
|
||||
uint8_t pdcp_uid = 0;
|
||||
uint8_t rb_id = 0;
|
||||
|
||||
// these stats are measured for both eNB and UE on per seond basis
|
||||
for (rb_id =0; rb_id < NB_RB_MAX; rb_id ++){
|
||||
for (pdcp_uid=0; pdcp_uid< NUMBER_OF_UE_MAX;pdcp_uid++){
|
||||
//printf("frame %d and subframe %d \n", pdcp_enb[ctxt_pP->module_id].frame, pdcp_enb[ctxt_pP->module_id].subframe);
|
||||
// tx stats
|
||||
if (pdcp_enb[ctxt_pP->module_id].sfn % Pdcp_stats_tx_window_ms[ctxt_pP->module_id][pdcp_uid] == 0){
|
||||
// unit: bit/s
|
||||
Pdcp_stats_tx_throughput_w[ctxt_pP->module_id][pdcp_uid][rb_id]=Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]*8;
|
||||
Pdcp_stats_tx_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id];
|
||||
Pdcp_stats_tx_bytes_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id];
|
||||
if (Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id] > 0){
|
||||
Pdcp_stats_tx_aiat_w[ctxt_pP->module_id][pdcp_uid][rb_id]=(Pdcp_stats_tx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]/Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]);
|
||||
}else {
|
||||
Pdcp_stats_tx_aiat_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
|
||||
}
|
||||
// reset the tmp vars
|
||||
Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
|
||||
Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
|
||||
Pdcp_stats_tx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
|
||||
|
||||
}
|
||||
if (pdcp_enb[ctxt_pP->module_id].sfn % Pdcp_stats_rx_window_ms[ctxt_pP->module_id][pdcp_uid] == 0){
|
||||
// rx stats
|
||||
Pdcp_stats_rx_goodput_w[ctxt_pP->module_id][pdcp_uid][rb_id]=Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]*8;
|
||||
Pdcp_stats_rx_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id];
|
||||
Pdcp_stats_rx_bytes_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id];
|
||||
|
||||
if(Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id] > 0){
|
||||
Pdcp_stats_rx_aiat_w[ctxt_pP->module_id][pdcp_uid][rb_id]= (Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]/Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]);
|
||||
} else {
|
||||
Pdcp_stats_rx_aiat_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
|
||||
}
|
||||
|
||||
// reset the tmp vars
|
||||
Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
|
||||
Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
|
||||
Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
pdcp_run (
|
||||
@@ -886,6 +903,7 @@ pdcp_run (
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
MessageDef *msg_p;
|
||||
const char *msg_name;
|
||||
@@ -894,12 +912,18 @@ pdcp_run (
|
||||
protocol_ctxt_t ctxt;
|
||||
#endif
|
||||
|
||||
|
||||
if (ctxt_pP->enb_flag) {
|
||||
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].pdcp_run);
|
||||
} else {
|
||||
start_meas(&UE_pdcp_stats[ctxt_pP->module_id].pdcp_run);
|
||||
}
|
||||
|
||||
pdcp_enb[ctxt_pP->module_id].sfn++; // range: 0 to 18,446,744,073,709,551,615
|
||||
pdcp_enb[ctxt_pP->module_id].frame=ctxt_pP->frame; // 1023
|
||||
pdcp_enb[ctxt_pP->module_id].subframe= ctxt_pP->subframe;
|
||||
pdcp_update_stats(ctxt_pP);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_IN);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
@@ -948,6 +972,21 @@ pdcp_run (
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
break;
|
||||
|
||||
case RRC_PCCH_DATA_REQ:
|
||||
{
|
||||
sdu_size_t sdu_buffer_sizeP;
|
||||
sdu_buffer_sizeP = RRC_PCCH_DATA_REQ(msg_p).sdu_size;
|
||||
uint8_t CC_id = RRC_PCCH_DATA_REQ(msg_p).CC_id;
|
||||
uint8_t ue_index = RRC_PCCH_DATA_REQ(msg_p).ue_index;
|
||||
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_paging[ue_index] = sdu_buffer_sizeP;
|
||||
if (sdu_buffer_sizeP > 0) {
|
||||
memcpy(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].paging[ue_index], RRC_PCCH_DATA_REQ(msg_p).sdu_p, sdu_buffer_sizeP);
|
||||
}
|
||||
//paging pdcp log
|
||||
LOG_D(PDCP, "PDCP Received RRC_PCCH_DATA_REQ CC_id %d length %d \n", CC_id, sdu_buffer_sizeP);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(PDCP, "Received unexpected message %s\n", msg_name);
|
||||
break;
|
||||
@@ -981,11 +1020,6 @@ pdcp_run (
|
||||
itti_send_msg_to_task(TASK_MAC_ENB, 3, msg_resp_p);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(USER_MODE) && defined(OAI_EMU)
|
||||
pdcp_fifo_read_input_sdus_from_otg(ctxt_pP);
|
||||
|
||||
#endif
|
||||
|
||||
// IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer
|
||||
@@ -1022,6 +1056,28 @@ pdcp_run (
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT);
|
||||
}
|
||||
|
||||
void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP){
|
||||
int i, ue_flag=1; //, ret=-1; to be decied later
|
||||
for (i=0; i < NUMBER_OF_UE_MAX; i++){
|
||||
if (pdcp_enb[ctxt_pP->module_id].rnti[i] == ctxt_pP->rnti) {
|
||||
ue_flag=-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ue_flag == 1 ){
|
||||
for (i=0; i < NUMBER_OF_UE_MAX ; i++){
|
||||
if (pdcp_enb[ctxt_pP->module_id].rnti[i] == 0 ){
|
||||
pdcp_enb[ctxt_pP->module_id].rnti[i]=ctxt_pP->rnti;
|
||||
pdcp_enb[ctxt_pP->module_id].uid[i]=i;
|
||||
pdcp_enb[ctxt_pP->module_id].num_ues++;
|
||||
printf("add new uid is %d %x\n\n", i, ctxt_pP->rnti);
|
||||
// ret=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//return ret;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
boolean_t
|
||||
@@ -1034,10 +1090,17 @@ pdcp_remove_UE(
|
||||
DRB_Identity_t drb_id = 0;
|
||||
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
|
||||
hashtable_rc_t h_rc;
|
||||
int i;
|
||||
// check and remove SRBs first
|
||||
|
||||
// check and remove SRBs first
|
||||
for(int i = 0;i<NUMBER_OF_UE_MAX;i++){
|
||||
if(pdcp_eNB_UE_instance_to_rnti[i] == ctxt_pP->rnti){
|
||||
pdcp_eNB_UE_instance_to_rnti[i] = NOT_A_RNTI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (srb_id=0; srb_id<2; srb_id++) {
|
||||
for (srb_id=1; srb_id<3; srb_id++) {
|
||||
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_YES);
|
||||
h_rc = hashtable_remove(pdcp_coll_p, key);
|
||||
}
|
||||
@@ -1050,6 +1113,19 @@ pdcp_remove_UE(
|
||||
|
||||
(void)h_rc; /* remove gcc warning "set but not used" */
|
||||
|
||||
// remove ue for pdcp enb inst
|
||||
for (i=0; i < NUMBER_OF_UE_MAX; i++) {
|
||||
if (pdcp_enb[ctxt_pP->module_id].rnti[i] == ctxt_pP->rnti ) {
|
||||
LOG_I(PDCP, "remove uid is %d/%d %x\n", i,
|
||||
pdcp_enb[ctxt_pP->module_id].uid[i],
|
||||
pdcp_enb[ctxt_pP->module_id].rnti[i]);
|
||||
pdcp_enb[ctxt_pP->module_id].uid[i]=0;
|
||||
pdcp_enb[ctxt_pP->module_id].rnti[i]=0;
|
||||
pdcp_enb[ctxt_pP->module_id].num_ues--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1134,7 +1210,7 @@ rrc_pdcp_config_asn1_req (
|
||||
return TRUE;
|
||||
|
||||
} else {
|
||||
LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_ADD key 0x%"PRIx64"\n",
|
||||
LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_ADD key 0x%"PRIx64"\n",
|
||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
|
||||
key);
|
||||
}
|
||||
@@ -1344,7 +1420,7 @@ rrc_pdcp_config_asn1_req (
|
||||
for (cnt=0; cnt<drb2release_list_pP->list.count; cnt++) {
|
||||
pdrb_id_p = drb2release_list_pP->list.array[cnt];
|
||||
drb_id = *pdrb_id_p;
|
||||
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_NO);
|
||||
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO);
|
||||
h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
|
||||
|
||||
if (h_rc != HASH_TABLE_OK) {
|
||||
@@ -1444,7 +1520,6 @@ rrc_pdcp_config_asn1_req (
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
boolean_t
|
||||
pdcp_config_req_asn1 (
|
||||
@@ -1465,14 +1540,26 @@ pdcp_config_req_asn1 (
|
||||
uint8_t *const kUPenc_pP)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
|
||||
switch (actionP) {
|
||||
case CONFIG_ACTION_ADD:
|
||||
DevAssert(pdcp_pP != NULL);
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
|
||||
pdcp_pP->is_ue = FALSE;
|
||||
pdcp_add_UE(ctxt_pP);
|
||||
|
||||
//pdcp_eNB_UE_instance_to_rnti[ctxtP->module_id] = ctxt_pP->rnti;
|
||||
pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti;
|
||||
// pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti;
|
||||
if( srb_flagP == SRB_FLAG_NO ) {
|
||||
for(int i = 0;i<NUMBER_OF_UE_MAX;i++){
|
||||
if(pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] == NOT_A_RNTI){
|
||||
break;
|
||||
}
|
||||
pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % NUMBER_OF_UE_MAX;
|
||||
}
|
||||
pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti;
|
||||
pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % NUMBER_OF_UE_MAX;
|
||||
}
|
||||
//pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % NUMBER_OF_UE_MAX;
|
||||
} else {
|
||||
pdcp_pP->is_ue = TRUE;
|
||||
@@ -1570,6 +1657,10 @@ pdcp_config_req_asn1 (
|
||||
lc_idP,
|
||||
rb_idP);
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
|
||||
// pdcp_remove_UE(ctxt_pP);
|
||||
}
|
||||
|
||||
/* Security keys */
|
||||
if (pdcp_pP->kUPenc != NULL) {
|
||||
free(pdcp_pP->kUPenc);
|
||||
@@ -1821,13 +1912,14 @@ rrc_pdcp_config_req (
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// TODO PDCP module initialization code might be removed
|
||||
|
||||
int
|
||||
pdcp_module_init (
|
||||
void
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
#ifdef PDCP_USE_RT_FIFO
|
||||
int ret;
|
||||
|
||||
@@ -1903,6 +1995,7 @@ void pdcp_layer_init(void)
|
||||
{
|
||||
|
||||
module_id_t instance;
|
||||
int i,j;
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
mbms_session_id_t session_id;
|
||||
mbms_service_id_t service_id;
|
||||
@@ -1946,15 +2039,42 @@ void pdcp_layer_init(void)
|
||||
pdcp_output_header_bytes_to_write=0;
|
||||
pdcp_input_sdu_remaining_size_to_read=0;
|
||||
|
||||
memset(pdcp_enb, 0, sizeof(pdcp_enb_t));
|
||||
|
||||
|
||||
memset(Pdcp_stats_tx_window_ms, 0, sizeof(Pdcp_stats_tx_window_ms));
|
||||
memset(Pdcp_stats_rx_window_ms, 0, sizeof(Pdcp_stats_rx_window_ms));
|
||||
for (i =0; i< MAX_NUM_CCs ; i ++){
|
||||
for (j=0; j< NUMBER_OF_UE_MAX;j++){
|
||||
Pdcp_stats_tx_window_ms[i][j]=100;
|
||||
Pdcp_stats_rx_window_ms[i][j]=100;
|
||||
}
|
||||
}
|
||||
|
||||
memset(Pdcp_stats_tx, 0, sizeof(Pdcp_stats_tx));
|
||||
memset(Pdcp_stats_tx_w, 0, sizeof(Pdcp_stats_tx_w));
|
||||
memset(Pdcp_stats_tx_tmp_w, 0, sizeof(Pdcp_stats_tx_tmp_w));
|
||||
memset(Pdcp_stats_tx_bytes, 0, sizeof(Pdcp_stats_tx_bytes));
|
||||
memset(Pdcp_stats_tx_bytes_last, 0, sizeof(Pdcp_stats_tx_bytes_last));
|
||||
memset(Pdcp_stats_tx_rate, 0, sizeof(Pdcp_stats_tx_rate));
|
||||
memset(Pdcp_stats_tx_bytes_w, 0, sizeof(Pdcp_stats_tx_bytes_w));
|
||||
memset(Pdcp_stats_tx_bytes_tmp_w, 0, sizeof(Pdcp_stats_tx_bytes_tmp_w));
|
||||
memset(Pdcp_stats_tx_sn, 0, sizeof(Pdcp_stats_tx_sn));
|
||||
memset(Pdcp_stats_tx_throughput_w, 0, sizeof(Pdcp_stats_tx_throughput_w));
|
||||
memset(Pdcp_stats_tx_aiat, 0, sizeof(Pdcp_stats_tx_aiat));
|
||||
memset(Pdcp_stats_tx_iat, 0, sizeof(Pdcp_stats_tx_iat));
|
||||
|
||||
|
||||
memset(Pdcp_stats_rx, 0, sizeof(Pdcp_stats_rx));
|
||||
memset(Pdcp_stats_rx_w, 0, sizeof(Pdcp_stats_rx_w));
|
||||
memset(Pdcp_stats_rx_tmp_w, 0, sizeof(Pdcp_stats_rx_tmp_w));
|
||||
memset(Pdcp_stats_rx_bytes, 0, sizeof(Pdcp_stats_rx_bytes));
|
||||
memset(Pdcp_stats_rx_bytes_last, 0, sizeof(Pdcp_stats_rx_bytes_last));
|
||||
memset(Pdcp_stats_rx_rate, 0, sizeof(Pdcp_stats_rx_rate));
|
||||
memset(Pdcp_stats_rx_bytes_w, 0, sizeof(Pdcp_stats_rx_bytes_w));
|
||||
memset(Pdcp_stats_rx_bytes_tmp_w, 0, sizeof(Pdcp_stats_rx_bytes_tmp_w));
|
||||
memset(Pdcp_stats_rx_sn, 0, sizeof(Pdcp_stats_rx_sn));
|
||||
memset(Pdcp_stats_rx_goodput_w, 0, sizeof(Pdcp_stats_rx_goodput_w));
|
||||
memset(Pdcp_stats_rx_aiat, 0, sizeof(Pdcp_stats_rx_aiat));
|
||||
memset(Pdcp_stats_rx_iat, 0, sizeof(Pdcp_stats_rx_iat));
|
||||
memset(Pdcp_stats_rx_outoforder, 0, sizeof(Pdcp_stats_rx_outoforder));
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -94,15 +94,54 @@ extern int pdcp_instance_cnt;
|
||||
int init_pdcp_thread(void);
|
||||
void cleanup_pdcp_thread(void);
|
||||
|
||||
public_pdcp(uint32_t Pdcp_stats_tx_window_ms[MAX_NUM_CCs][NUMBER_OF_UE_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_tx_bytes[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_tx_bytes_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_tx[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_tx_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_tx_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_tx_sn[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_tx_throughput_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_tx_aiat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_tx_aiat_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_tx_iat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
|
||||
public_pdcp(unsigned int Pdcp_stats_tx[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
|
||||
public_pdcp(unsigned int Pdcp_stats_tx_bytes[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
|
||||
public_pdcp(unsigned int Pdcp_stats_tx_bytes_last[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
|
||||
public_pdcp(unsigned int Pdcp_stats_tx_rate[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
|
||||
public_pdcp(unsigned int Pdcp_stats_rx[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
|
||||
public_pdcp(unsigned int Pdcp_stats_rx_bytes[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
|
||||
public_pdcp(unsigned int Pdcp_stats_rx_bytes_last[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
|
||||
public_pdcp(unsigned int Pdcp_stats_rx_rate[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_window_ms[MAX_NUM_CCs][NUMBER_OF_UE_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_bytes[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_bytes_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_sn[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_goodput_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_aiat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_aiat_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_iat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
public_pdcp(uint32_t Pdcp_stats_rx_outoforder[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
|
||||
|
||||
public_pdcp(void pdcp_update_perioidical_stats(const protocol_ctxt_t* const ctxt_pP));
|
||||
|
||||
|
||||
/*Packet Probing for agent PDCP*/
|
||||
//public_pdcp(uint64_t *pdcp_packet_counter);
|
||||
//public_pdcp(uint64_t *pdcp_size_packet);
|
||||
typedef struct pdcp_enb_s {
|
||||
// used for eNB stats generation
|
||||
uint16_t uid[NUMBER_OF_UE_MAX];
|
||||
rnti_t rnti[NUMBER_OF_UE_MAX];
|
||||
uint16_t num_ues;
|
||||
|
||||
uint64_t sfn;
|
||||
frame_t frame;
|
||||
sub_frame_t subframe;
|
||||
|
||||
} pdcp_enb_t;
|
||||
|
||||
public_pdcp(pdcp_enb_t pdcp_enb[MAX_NUM_CCs]);
|
||||
|
||||
typedef struct pdcp_stats_s {
|
||||
time_stats_t pdcp_run;
|
||||
@@ -125,7 +164,7 @@ typedef struct pdcp_s {
|
||||
boolean_t is_ue;
|
||||
boolean_t is_srb;
|
||||
|
||||
/* Configured security algorithms */
|
||||
/* Configured security algorithms */
|
||||
uint8_t cipheringAlgorithm;
|
||||
uint8_t integrityProtAlgorithm;
|
||||
|
||||
@@ -327,9 +366,15 @@ public_pdcp(boolean_t pdcp_config_req_asn1 (
|
||||
uint8_t *const kRRCint,
|
||||
uint8_t *const kUPenc));
|
||||
|
||||
|
||||
/*! \fn void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP)
|
||||
* \brief Function (for RRC) to add a new UE in PDCP module
|
||||
* \param[in] ctxt_pP Running context.
|
||||
* \return A status about the processing, OK or error code.
|
||||
*/
|
||||
public_pdcp(void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP));
|
||||
|
||||
/*! \fn boolean_t pdcp_remove_UE(const protocol_ctxt_t* const ctxt_pP)
|
||||
* \brief Function for RRC to configure a Radio Bearer clear all PDCP resources for a particular UE
|
||||
* \brief Function for RRC to remove UE from PDCP module hashtable
|
||||
* \param[in] ctxt_pP Running context.
|
||||
* \return A status about the processing, OK or error code.
|
||||
*/
|
||||
|
||||
@@ -33,14 +33,11 @@
|
||||
#define PDCP_DEBUG 1
|
||||
//#define DEBUG_PDCP_FIFO_FLUSH_SDU
|
||||
|
||||
#ifndef OAI_EMU
|
||||
extern int otg_enabled;
|
||||
#endif
|
||||
|
||||
#include "pdcp.h"
|
||||
#include "pdcp_primitives.h"
|
||||
|
||||
#ifdef USER_MODE
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
@@ -48,9 +45,6 @@ extern int otg_enabled;
|
||||
#include <unistd.h>
|
||||
#define rtf_put write
|
||||
#define rtf_get read
|
||||
#else
|
||||
#include <rtai_fifos.h>
|
||||
#endif //USER_MODE
|
||||
|
||||
#include "../MAC/extern.h"
|
||||
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
@@ -92,6 +86,8 @@ extern Packet_OTG_List_t *otg_pdcp_buffer;
|
||||
# include "gtpv1u_eNB_defs.h"
|
||||
#endif
|
||||
|
||||
extern int gtpv1u_new_data_req( uint8_t enb_module_idP, rnti_t ue_rntiP, uint8_t rab_idP, uint8_t *buffer_pP, uint32_t buf_lenP, uint32_t buf_offsetP);
|
||||
|
||||
/* Prevent de-queueing the same PDCP SDU from the queue twice
|
||||
* by multiple threads. This has happened in TDD when thread-odd
|
||||
* is flushing a PDCP SDU after UE_RX() processing; whereas
|
||||
@@ -166,11 +162,6 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
|
||||
threadname, ctxt_pP->frame, ctxt_pP->subframe,
|
||||
((pdcp_data_ind_header_t*) sdu_p->data)->inst,
|
||||
((pdcp_data_ind_header_t *) sdu_p->data)->data_size);
|
||||
#else
|
||||
#if ! defined(OAI_EMU)
|
||||
/* TODO: do we have to reset to 0 or not? not for a scenario with 1 UE at least */
|
||||
// ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LINK_ENB_PDCP_TO_GTPV1U)
|
||||
@@ -551,29 +542,6 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
|
||||
nas_nlh_rx->nlmsg_len - sizeof(struct nlmsghdr));
|
||||
#endif
|
||||
|
||||
#ifdef OAI_EMU
|
||||
|
||||
// overwrite function input parameters, because only one netlink socket for all instances
|
||||
if (pdcp_read_header_g.inst < oai_emulation.info.nb_enb_local) {
|
||||
ctxt.frame = ctxt_cpy.frame;
|
||||
ctxt.enb_flag = ENB_FLAG_YES;
|
||||
ctxt.module_id = pdcp_read_header_g.inst + oai_emulation.info.first_enb_local;
|
||||
ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id ][pdcp_read_header_g.rb_id / maxDRB + oai_emulation.info.first_ue_local];
|
||||
rab_id = pdcp_read_header_g.rb_id % maxDRB;
|
||||
} else {
|
||||
ctxt.frame = ctxt_cpy.frame;
|
||||
ctxt.enb_flag = ENB_FLAG_NO;
|
||||
ctxt.module_id = pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local + oai_emulation.info.first_ue_local;
|
||||
ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
|
||||
rab_id = pdcp_read_header_g.rb_id % maxDRB;
|
||||
}
|
||||
|
||||
CHECK_CTXT_ARGS(&ctxt);
|
||||
AssertFatal (rab_id < maxDRB, "RB id is too high (%u/%d)!\n", rab_id, maxDRB);
|
||||
/*LGpdcp_read_header.inst = (pdcp_read_header_g.inst >= oai_emulation.info.nb_enb_local) ? \
|
||||
pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local :
|
||||
pdcp_read_header_g.inst + oai_emulation.info.first_enb_local;*/
|
||||
#else // OAI_EMU
|
||||
/* TODO: do we have to reset to 0 or not? not for a scenario with 1 UE at least */
|
||||
// pdcp_read_header_g.inst = 0;
|
||||
//#warning "TO DO CORRCT VALUES FOR ue mod id, enb mod id"
|
||||
@@ -587,16 +555,13 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
|
||||
if (ctxt_cpy.enb_flag) {
|
||||
ctxt.module_id = 0;
|
||||
rab_id = pdcp_read_header_g.rb_id % maxDRB;
|
||||
ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index];
|
||||
ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / maxDRB];
|
||||
} else {
|
||||
ctxt.module_id = 0;
|
||||
rab_id = pdcp_read_header_g.rb_id % maxDRB;
|
||||
ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
if (ctxt.enb_flag) {
|
||||
if (rab_id != 0) {
|
||||
rab_id = rab_id % maxDRB;
|
||||
@@ -808,121 +773,8 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t* const ctxt_pP)
|
||||
module_id_t dst_id; // dst for otg
|
||||
rb_id_t rb_id;
|
||||
unsigned int pkt_size=0;
|
||||
#if defined(USER_MODE) && defined(OAI_EMU)
|
||||
module_id_t src_id;
|
||||
static unsigned int pkt_cnt_enb=0, pkt_cnt_ue=0;
|
||||
|
||||
Packet_otg_elt_t *otg_pkt_info=NULL;
|
||||
int result;
|
||||
uint8_t pdcp_mode, is_ue=0;
|
||||
#endif
|
||||
protocol_ctxt_t ctxt;
|
||||
// we need to add conditions to avoid transmitting data when the UE is not RRC connected.
|
||||
#if defined(USER_MODE) && defined(OAI_EMU)
|
||||
|
||||
if (oai_emulation.info.otg_enabled ==1 ) {
|
||||
// module_id is source id
|
||||
while ((otg_pkt_info = pkt_list_remove_head(&(otg_pdcp_buffer[ctxt_pP->instance]))) != NULL) {
|
||||
LOG_I(OTG,"Mod_id %d Frame %d Got a packet (%p), HEAD of otg_pdcp_buffer[%d] is %p and Nb elements is %d\n",
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->frame,
|
||||
otg_pkt_info,
|
||||
ctxt_pP->instance,
|
||||
pkt_list_get_head(&(otg_pdcp_buffer[ctxt_pP->instance])),
|
||||
otg_pdcp_buffer[ctxt_pP->instance].nb_elements);
|
||||
//otg_pkt_info = pkt_list_remove_head(&(otg_pdcp_buffer[module_id]));
|
||||
dst_id = (otg_pkt_info->otg_pkt).dst_id; // type is module_id_t
|
||||
src_id = (otg_pkt_info->otg_pkt).module_id; // type is module_id_t
|
||||
rb_id = (otg_pkt_info->otg_pkt).rb_id;
|
||||
is_ue = (otg_pkt_info->otg_pkt).is_ue;
|
||||
pdcp_mode = (otg_pkt_info->otg_pkt).mode;
|
||||
// LOG_I(PDCP,"pdcp_fifo, pdcp mode is= %d\n",pdcp_mode);
|
||||
|
||||
// generate traffic if the ue is rrc reconfigured state
|
||||
// if (mac_get_rrc_status(module_id, ctxt_pP->enb_flag, dst_id ) > 2 /*RRC_CONNECTED*/) { // not needed: this test is already done in update_otg_enb
|
||||
otg_pkt = (unsigned char*) (otg_pkt_info->otg_pkt).sdu_buffer;
|
||||
pkt_size = (otg_pkt_info->otg_pkt).sdu_buffer_size;
|
||||
|
||||
if (otg_pkt != NULL) {
|
||||
if (is_ue == 0 ) {
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(
|
||||
&ctxt,
|
||||
src_id,
|
||||
ENB_FLAG_YES,
|
||||
oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id][dst_id],
|
||||
ctxt_pP->frame,
|
||||
ctxt_pP->subframe,
|
||||
src_id);
|
||||
|
||||
LOG_D(OTG,"[eNB %d] Frame %d sending packet %d from module %d on rab id %d (src %d, dst %d/%x) pkt size %d for pdcp mode %d\n",
|
||||
ctxt.module_id,
|
||||
ctxt.frame,
|
||||
pkt_cnt_enb++,
|
||||
src_id,
|
||||
rb_id,
|
||||
src_id,
|
||||
dst_id,
|
||||
oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id][dst_id],
|
||||
pkt_size,
|
||||
pdcp_mode);
|
||||
result = pdcp_data_req(&ctxt,
|
||||
SRB_FLAG_NO,
|
||||
rb_id,
|
||||
RLC_MUI_UNDEFINED,
|
||||
RLC_SDU_CONFIRM_NO,
|
||||
pkt_size,
|
||||
otg_pkt,
|
||||
pdcp_mode);
|
||||
if (result != TRUE) {
|
||||
LOG_W(OTG,"PDCP data request failed!\n");
|
||||
}
|
||||
} else {
|
||||
//rb_id= eNB_index * MAX_NUM_RB + DTCH;
|
||||
|
||||
|
||||
LOG_D(OTG,"[UE %d] Frame %d: sending packet %d from module %d on rab id %d (src %d/%x, dst %d) pkt size %d\n",
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->frame,
|
||||
pkt_cnt_ue++,
|
||||
ctxt_pP->module_id,
|
||||
rb_id,
|
||||
src_id,
|
||||
pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id], // [src_id]
|
||||
dst_id,
|
||||
pkt_size);
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(
|
||||
&ctxt,
|
||||
ctxt_pP->module_id, //src_id,
|
||||
ENB_FLAG_NO,
|
||||
pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id],// [src_id]
|
||||
ctxt_pP->frame,
|
||||
ctxt_pP->subframe,
|
||||
dst_id);
|
||||
|
||||
result = pdcp_data_req( &ctxt,
|
||||
SRB_FLAG_NO,
|
||||
rb_id,
|
||||
RLC_MUI_UNDEFINED,
|
||||
RLC_SDU_CONFIRM_NO,
|
||||
pkt_size,
|
||||
otg_pkt,
|
||||
PDCP_TRANSMISSION_MODE_DATA);
|
||||
if (result != TRUE) {
|
||||
LOG_W(OTG,"PDCP data request failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
free(otg_pkt);
|
||||
otg_pkt = NULL;
|
||||
}
|
||||
|
||||
// } //else LOG_D(OTG,"ctxt_pP->frame %d enb %d-> ue %d link not yet established state %d \n", ctxt_pP->frame, eNB_index,dst_id - NB_eNB_INST, mac_get_rrc_status(module_id, ctxt_pP->enb_flag, dst_id - NB_eNB_INST));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if ((otg_enabled==1) && (ctxt_pP->enb_flag == ENB_FLAG_YES)) { // generate DL traffic
|
||||
unsigned int ctime=0;
|
||||
ctime = ctxt_pP->frame * 100;
|
||||
@@ -940,9 +792,9 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t* const ctxt_pP)
|
||||
|
||||
for (dst_id = 0; dst_id<NUMBER_OF_UE_MAX; dst_id++) {
|
||||
ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id][dst_id];
|
||||
|
||||
/*
|
||||
if (ctxt.rnti != NOT_A_RNTI) {
|
||||
if (mac_eNB_get_rrc_status(ctxt.module_id, ctxt.rnti ) > 2 /*RRC_SI_RECEIVED*/) {
|
||||
if (mac_eNB_get_rrc_status(ctxt.module_id, ctxt.rnti ) > 2 ) {
|
||||
unsigned int temp = 0;
|
||||
otg_pkt=packet_gen(
|
||||
ENB_MODULE_ID_TO_INSTANCE(ctxt.module_id),
|
||||
@@ -969,8 +821,7 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t* const ctxt_pP)
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -101,13 +101,8 @@ pdcp_netlink_init(
|
||||
struct sched_param sched_param;
|
||||
|
||||
reset_meas(&ip_pdcp_stats_tmp);
|
||||
#if defined(USER_MODE) && defined(OAI_EMU)
|
||||
nb_inst_enb = oai_emulation.info.nb_enb_local;
|
||||
nb_inst_ue = oai_emulation.info.nb_ue_local;
|
||||
#else
|
||||
nb_inst_enb = 1;
|
||||
nb_inst_ue = 1;
|
||||
#endif
|
||||
|
||||
#if defined(LINK_ENB_PDCP_TO_GTPV1U)
|
||||
nb_inst_enb = 0;
|
||||
@@ -259,24 +254,7 @@ void *pdcp_netlink_thread_fct(void *arg)
|
||||
}
|
||||
} else {
|
||||
pdcp_thread_read_state = 0;
|
||||
|
||||
#ifdef OAI_EMU
|
||||
|
||||
// LG: new_data_p->pdcp_read_header.inst will contain in fact a module id
|
||||
if (new_data_p->pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) {
|
||||
module_id = new_data_p->pdcp_read_header.inst
|
||||
- oai_emulation.info.nb_enb_local +
|
||||
+ oai_emulation.info.first_ue_local;
|
||||
eNB_flag = 0;
|
||||
} else {
|
||||
module_id = new_data_p->pdcp_read_header.inst
|
||||
+ oai_emulation.info.first_enb_local;
|
||||
eNB_flag = 1;
|
||||
}
|
||||
|
||||
#else
|
||||
module_id = 0;
|
||||
#endif
|
||||
new_data_p->data = malloc(sizeof(uint8_t) * new_data_p->pdcp_read_header.data_size);
|
||||
/* Copy the data */
|
||||
memcpy(new_data_p->data, NLMSG_DATA(nas_nlh_rx), new_data_p->pdcp_read_header.data_size);
|
||||
|
||||
@@ -110,9 +110,7 @@ int init_pdcp_thread(void)
|
||||
|
||||
p.sched_priority = OPENAIR_THREAD_PRIORITY;
|
||||
pthread_attr_setschedparam (&pdcp_thread_attr, &p);
|
||||
#ifndef RTAI_ISNT_POSIX
|
||||
pthread_attr_setschedpolicy (&pdcp_thread_attr, SCHED_FIFO);
|
||||
#endif
|
||||
pthread_mutex_init(&pdcp_mutex,NULL);
|
||||
pthread_cond_init(&pdcp_cond,NULL);
|
||||
|
||||
|
||||
@@ -73,10 +73,6 @@
|
||||
# include "RLC-Config.h"
|
||||
//# include "rlc_am_test.h"
|
||||
|
||||
#ifdef USER_MODE
|
||||
//# include "rlc_am_very_simple_test.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define PROTOCOL_RLC_AM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02u]"
|
||||
#define PROTOCOL_RLC_AM_CTXT_ARGS(CTXT_Pp, rLC_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
|
||||
#define RLC_AM_MODULE 1
|
||||
#define RLC_AM_INIT_C 1
|
||||
#ifdef USER_MODE
|
||||
#include <string.h>
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "rlc_am.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
|
||||
@@ -268,11 +268,9 @@ rlc_am_reassemble_pdu(
|
||||
//}
|
||||
|
||||
break;
|
||||
#if USER_MODE
|
||||
|
||||
default:
|
||||
assert(0 != 0);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
switch (pdu_info->fi) {
|
||||
@@ -382,19 +380,13 @@ rlc_am_reassemble_pdu(
|
||||
if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
|
||||
// data is already ok, done by last loop above
|
||||
rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
|
||||
} else {
|
||||
#if USER_MODE
|
||||
//assert (5!=5);
|
||||
#endif
|
||||
}
|
||||
|
||||
//rlc_pP->reassembly_missing_sn_detected = 0;
|
||||
break;
|
||||
#if USER_MODE
|
||||
|
||||
default:
|
||||
assert(1 != 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,7 @@
|
||||
#define RLC_AM_MODULE 1
|
||||
#define RLC_AM_SEGMENT_C 1
|
||||
//-----------------------------------------------------------------------------
|
||||
#if USER_MODE
|
||||
#include <assert.h>
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "platform_types.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -468,9 +466,7 @@ void rlc_am_segment_10 (
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
sdu_mngt_p->sdu_remaining_size,
|
||||
pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
|
||||
#if USER_MODE
|
||||
assert(1!=1);
|
||||
#endif
|
||||
memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
|
||||
pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size;
|
||||
pdu_remaining_size = pdu_remaining_size - sdu_mngt_p->sdu_remaining_size;
|
||||
|
||||
@@ -36,9 +36,7 @@
|
||||
# include "list.h"
|
||||
# include "mem_block.h"
|
||||
# include "rlc_am_constants.h"
|
||||
//#ifdef USER_MODE
|
||||
# include "mac_rlc_primitives.h"
|
||||
//#endif //USER_MODE
|
||||
# include "mac_primitives.h"
|
||||
# include "rlc_primitives.h"
|
||||
/**
|
||||
|
||||
@@ -22,9 +22,7 @@
|
||||
#define RLC_AM_MODULE 1
|
||||
#define RLC_AM_WINDOWS_C 1
|
||||
//-----------------------------------------------------------------------------
|
||||
#if USER_MODE
|
||||
#include <assert.h>
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "platform_types.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -125,6 +125,7 @@ rlc_tm_cleanup (
|
||||
// RX SIDE
|
||||
if ((rlcP->output_sdu_in_construction)) {
|
||||
free_mem_block (rlcP->output_sdu_in_construction, __func__);
|
||||
rlcP->output_sdu_in_construction = NULL;
|
||||
}
|
||||
|
||||
memset(rlcP, 0, sizeof(rlc_tm_entity_t));
|
||||
|
||||
@@ -682,10 +682,6 @@ rlc_um_data_req (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, mem_block_t
|
||||
{
|
||||
rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) rlc_pP;
|
||||
|
||||
#if ! USER_MODE
|
||||
unsigned long int rlc_um_time_us;
|
||||
int min, sec, usec;
|
||||
#endif
|
||||
#if TRACE_RLC_UM_PDU
|
||||
#if ENABLE_ITTI
|
||||
MessageDef *msg_p;
|
||||
|
||||
@@ -64,9 +64,6 @@
|
||||
# include "rlc_um_receiver.h"
|
||||
# include "rlc_um_segment.h"
|
||||
# include "rlc_um_test.h"
|
||||
#ifdef USER_MODE
|
||||
//# include "rlc_um_very_simple_test.h"
|
||||
#endif
|
||||
|
||||
#define PROTOCOL_RLC_UM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02u] %s()"
|
||||
#define PROTOCOL_RLC_UM_CTXT_ARGS(CTXT_Pp, rLC_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
|
||||
|
||||
@@ -343,6 +343,7 @@ rlc_um_cleanup (
|
||||
|
||||
if ((rlc_pP->output_sdu_in_construction)) {
|
||||
free_mem_block (rlc_pP->output_sdu_in_construction, __func__);
|
||||
rlc_pP->output_sdu_in_construction = NULL;
|
||||
}
|
||||
|
||||
if (rlc_pP->dar_buffer) {
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
#define RLC_UM_REASSEMBLY_C 1
|
||||
#include "platform_types.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
#if USER_MODE
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if ENABLE_ITTI
|
||||
# include "platform_types.h"
|
||||
# include "intertask_interface.h"
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
#include "platform_types.h"
|
||||
#include "platform_constants.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
#if USER_MODE
|
||||
#include <assert.h>
|
||||
#endif
|
||||
#include "assertions.h"
|
||||
#include "msc.h"
|
||||
#include "list.h"
|
||||
@@ -367,10 +365,8 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
|
||||
sdu_mngt_p->sdu_remaining_size,
|
||||
pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
|
||||
#endif
|
||||
#if USER_MODE
|
||||
#if !EXMIMO
|
||||
assert(1!=1);
|
||||
#endif
|
||||
#endif
|
||||
memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
|
||||
// reduce the size of the PDU
|
||||
@@ -754,9 +750,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
|
||||
sdu_mngt_p->sdu_remaining_size,
|
||||
pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
|
||||
#endif
|
||||
#if USER_MODE
|
||||
assert(1!=1);
|
||||
#endif
|
||||
memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
|
||||
// reduce the size of the PDU
|
||||
continue_fill_pdu_with_sdu = 0;
|
||||
|
||||
@@ -36,9 +36,7 @@
|
||||
# include "rlc_um_constants.h"
|
||||
# include "mac_primitives.h"
|
||||
# include "rlc_primitives.h"
|
||||
//#ifdef USER_MODE
|
||||
# include "mac_rlc_primitives.h"
|
||||
//#endif //USER_MODE
|
||||
//-----------------------
|
||||
/**
|
||||
* @addtogroup _rlc_um_impl_
|
||||
|
||||
@@ -135,11 +135,6 @@ rlc_op_status_t rlc_stat_req (
|
||||
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
|
||||
hashtable_rc_t h_rc;
|
||||
|
||||
#ifdef OAI_EMU
|
||||
|
||||
CHECK_CTXT_ARGS(ctxt_pP)
|
||||
|
||||
#endif
|
||||
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
|
||||
key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
|
||||
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
|
||||
@@ -346,11 +341,6 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
|
||||
#else
|
||||
AssertFatal(MBMS_flagP == 0, "MBMS_flagP %u", MBMS_flagP);
|
||||
#endif
|
||||
#ifdef OAI_EMU
|
||||
|
||||
CHECK_CTXT_ARGS(ctxt_pP)
|
||||
|
||||
#endif
|
||||
|
||||
#if T_TRACER
|
||||
if (ctxt_pP->enb_flag)
|
||||
|
||||
@@ -662,10 +662,6 @@ public_rlc(rlc_op_status_t rlc_stat_req (
|
||||
public_rlc(int rlc_module_init(void);)
|
||||
|
||||
/** @} */
|
||||
#ifndef USER_MODE
|
||||
#define assert(x) ((x)?msg("rlc assertion fails\n"):0)
|
||||
#endif
|
||||
|
||||
|
||||
#define RLC_FG_COLOR_BLACK "\e[0;30m"
|
||||
#define RLC_FG_COLOR_RED "\e[0;31m"
|
||||
|
||||
@@ -157,13 +157,6 @@ tbs_size_t mac_rlc_data_req(
|
||||
AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX);
|
||||
}
|
||||
|
||||
#ifdef OAI_EMU
|
||||
CHECK_CTXT_ARGS(&ctxt);
|
||||
//printf("MBMS_flagP %d, MBMS_FLAG_NO %d \n",MBMS_flagP, MBMS_FLAG_NO);
|
||||
// AssertFatal (MBMS_flagP == MBMS_FLAG_NO ," MBMS FLAG SHOULD NOT BE SET IN mac_rlc_data_req in UE\n");
|
||||
|
||||
#endif
|
||||
|
||||
if (MBMS_flagP) {
|
||||
if (enb_flagP) {
|
||||
mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[module_idP][channel_idP];
|
||||
@@ -256,18 +249,6 @@ void mac_rlc_data_ind (
|
||||
}
|
||||
|
||||
#endif // DEBUG_MAC_INTERFACE
|
||||
#ifdef OAI_EMU
|
||||
|
||||
if (MBMS_flagP)
|
||||
AssertFatal (channel_idP < RLC_MAX_MBMS_LC, "channel id is too high (%u/%d)!\n",
|
||||
channel_idP, RLC_MAX_MBMS_LC);
|
||||
else
|
||||
AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n",
|
||||
channel_idP, NB_RB_MAX);
|
||||
|
||||
CHECK_CTXT_ARGS(&ctxt);
|
||||
|
||||
#endif
|
||||
|
||||
#if T_TRACER
|
||||
if (enb_flagP)
|
||||
@@ -347,31 +328,6 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
|
||||
memset (&mac_rlc_status_resp, 0, sizeof(mac_rlc_status_resp_t));
|
||||
memset (&tx_status , 0, sizeof(struct mac_status_ind));
|
||||
|
||||
#ifdef OAI_EMU
|
||||
|
||||
if (MBMS_flagP)
|
||||
AssertFatal (channel_idP < RLC_MAX_MBMS_LC,
|
||||
"%s channel id is too high (%u/%d) enb module id %u ue %u!\n",
|
||||
(enb_flagP) ? "eNB" : "UE",
|
||||
channel_idP,
|
||||
RLC_MAX_MBMS_LC,
|
||||
module_idP,
|
||||
rntiP);
|
||||
else
|
||||
AssertFatal (channel_idP < NB_RB_MAX,
|
||||
"%s channel id is too high (%u/%d) enb module id %u ue %u!\n",
|
||||
(enb_flagP) ? "eNB" : "UE",
|
||||
channel_idP,
|
||||
NB_RB_MAX,
|
||||
module_idP,
|
||||
rntiP);
|
||||
|
||||
CHECK_CTXT_ARGS(&ctxt);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (MBMS_flagP) {
|
||||
if (enb_flagP) {
|
||||
mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[module_idP][channel_idP];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user