Commit ac8b74ef authored by Xenofon Foukas's avatar Xenofon Foukas

Merge branch 'agent' into feature-68-enb-agent

parents cb47dad1 a8d646b1
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -48,7 +48,7 @@ set ( NEW_FFT True )
set ( NO_RRM True )
set ( OAI_EMU True )
set ( OAISIM True )
set ( OAI_NW_DRIVER_TYPE_ETHERNET True )
set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
set ( OAI_NW_DRIVER_USE_NETLINK True )
set ( OPENAIR1 True )
set ( OPENAIR2 True )
......
cmake_minimum_required(VERSION 2.8)
set(ENABLE_VCD_FIFO False )
set(ENABLE_ITTI False )
set(RF_BOARD "ETHERNET")
set(PACKAGE_NAME "\"rrh_gw\"")
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
......@@ -180,7 +180,7 @@ check_install_bladerf_driver(){
$SUDO apt-get install -y bladerf libbladerf-dev
$SUDO apt-get install -y bladerf-firmware-fx3
$SUDO apt-get install -y bladerf-fpga-hostedx40
bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img
$SUDO bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img
}
check_install_additional_tools (){
......@@ -380,3 +380,21 @@ done
}
# get from http://www.linuxjournal.com/content/validating-ip-address-bash-script
validate_ip() {
local ip=$1
local stat=1
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
OIFS=$IFS
IFS='.'
ip=($ip)
IFS=$OIFS
[[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
&& ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
stat=$?
fi
return $stat
}
\ No newline at end of file
#!/bin/bash
function main()
{
mkdir -p $1
#echo generate protobuf messages inside $1 $2
c_out=$1
shift
proto_path=$1
shift
protoc-c --c_out=$c_out --proto_path=$proto_path $*
#protoc --cpp_out=$c_out --proto_path=$proto_path $*
}
main "$@"
#!/usr/bin/env bash
CACHE_DIR=/mnt/oai_agent_cache
if [ ! -d $CACHE_DIR ]; then
echo "Creating cache dir in $CACHE_DIR"
sudo mkdir $CACHE_DIR
fi
if grep -qs "$CACHE_DIR" /proc/mounts; then
echo "Agent cache is already mounted"
else
echo "Agent cache was not mounted"
echo "Mounting..."
sudo mount -o size=100m -t tmpfs none "$CACHE_DIR"
if [ $? -eq 0 ]; then
echo "Mount success"
else
echo "Something went wrong with the mount"
fi
fi
This diff is collapsed.
......@@ -94,8 +94,8 @@ int timer_handle_signal(siginfo_t *info)
timer_p = (struct timer_elm_s *)info->si_ptr;
// LG: To many traces for msc timer:
// TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer);
TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer);
task_id = timer_p->task_id;
instance = timer_p->instance;
message_p = itti_alloc_new_message(TASK_TIMER, TIMER_HAS_EXPIRED);
......@@ -128,6 +128,10 @@ int timer_handle_signal(siginfo_t *info)
return -1;
}
#if defined(ENB_AGENT_SB_IF)
#endif
return 0;
}
......
#!/bin/sh
echo "building ctags for openair1 and openair2 ..."
ctags -e -R --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 targets
ctags -e -R --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 openair3 targets common
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
short primary_synch0[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-26120,-19785,11971,-30502,-24020,-22288,32117,6492,31311,9658,-16384,-28378,25100,-21063,-7292,-31946,20429,25618,14948,29158,11971,-30502,31311,9658,25100,-21063,-16384,28377,-24020,22287,32117,6492,-7292,31945,20429,25618,-26120,-19785,-16384,-28378,-16384,28377,-26120,-19785,-32402,4883,31311,-9659,32117,6492,-7292,-31946,32767,-1,25100,-21063,-24020,22287,-32402,4883,-32402,4883,-24020,22287,25100,-21063,32767,-1,-7292,-31946,32117,6492,31311,-9659,-32402,4883,-26120,-19785,-16384,28377,-16384,-28378,-26120,-19785,20429,25618,-7292,31945,32117,6492,-24020,22287,-16384,28377,25100,-21063,31311,9658,11971,-30502,14948,29158,20429,25618,-7292,-31946,25100,-21063,-16384,-28378,31311,9658,32117,6492,-24020,-22288,11971,-30502,-26120,-19785,32767,0,0,0,0,0,0,0,0,0,0,0};
short primary_synch1[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,-8086,-24020,-22288,2448,32675,-26120,19784,27073,18458,-16384,28377,25100,21062,-29523,14217,-7292,31945,-13477,-29868,-24020,-22288,27073,18458,25100,21062,-16384,-28378,2448,-32676,-26120,19784,-29523,-14218,-7292,31945,-31754,-8086,-16384,28377,-16384,-28378,-31754,-8086,31311,-9659,27073,-18459,-26120,19784,-29523,14217,32767,-1,25100,21062,2448,-32676,31311,-9659,31311,-9659,2448,-32676,25100,21062,32767,0,-29523,14217,-26120,19784,27073,-18459,31311,-9659,-31754,-8086,-16384,-28378,-16384,28377,-31754,-8086,-7292,31945,-29523,-14218,-26120,19784,2448,-32676,-16384,-28378,25100,21062,27073,18458,-24020,-22288,-13477,-29868,-7292,31945,-29523,14217,25100,21062,-16384,28377,27073,18458,-26120,19784,2448,32675,-24020,-22288,-31754,-8086,32767,0,0,0,0,0,0,0,0,0,0,0};
short primary_synch2[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,8085,-24020,22287,2448,-32676,-26120,-19785,27073,-18459,-16384,-28378,25100,-21063,-29523,-14218,-7292,-31946,-13477,29867,-24020,22287,27073,-18459,25100,-21063,-16384,28377,2448,32675,-26120,-19785,-29523,14217,-7292,-31946,-31754,8085,-16384,-28378,-16384,28377,-31754,8085,31311,9658,27073,18458,-26120,-19785,-29523,-14218,32767,0,25100,-21063,2448,32675,31311,9658,31311,9658,2448,32675,25100,-21063,32767,0,-29523,-14218,-26120,-19785,27073,18458,31311,9658,-31754,8085,-16384,28377,-16384,-28378,-31754,8085,-7292,-31946,-29523,14217,-26120,-19785,2448,32675,-16384,28377,25100,-21063,27073,-18459,-24020,22287,-13477,29867,-7292,-31946,-29523,-14218,25100,-21063,-16384,-28378,27073,-18459,-26120,-19785,2448,-32676,-24020,22287,-31754,8085,32767,-1,0,0,0,0,0,0,0,0,0,0};
......
......@@ -48,7 +48,7 @@
#include "gain_control.h"
#endif
#if defined(OAI_USRP) || defined(EXMIMO)
#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_LMSSDR)
#include "common_lib.h"
extern openair0_config_t openair0_cfg[];
#endif
......@@ -291,17 +291,10 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
frame_parms->Ncp=NORMAL;
frame_parms->frame_type=FDD;
init_frame_parms(frame_parms,1);
// write_output("rxdata0.m","rxd0",phy_vars_ue->lte_ue_common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
/*#ifdef OAI_USRP
for (aarx = 0; aarx<frame_parms->nb_antennas_rx;aarx++) {
rxdata128 = (__m128i*)phy_vars_ue->lte_ue_common_vars.rxdata[aarx];
for (i=0; i<(frame_parms->samples_per_tti*10)>>2; i++) {
rxdata128[i] = _mm_srai_epi16(rxdata128[i],4);
}
}
#endif*/
/*
write_output("rxdata0.m","rxd0",phy_vars_ue->lte_ue_common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
exit(-1);
*/
sync_pos = lte_sync_time(phy_vars_ue->lte_ue_common_vars.rxdata,
frame_parms,
(int *)&phy_vars_ue->lte_ue_common_vars.eNb_id);
......@@ -336,9 +329,11 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
#else
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain(phy_vars_ue,0);
#endif
#endif
#endif
#endif
#endif
......@@ -569,7 +564,7 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
phy_vars_ue->lte_frame_parms.phich_config_common.phich_duration,
phich_string[phy_vars_ue->lte_frame_parms.phich_config_common.phich_resource],
phy_vars_ue->lte_frame_parms.nb_antennas_tx_eNB);
#if defined(OAI_USRP) || defined(EXMIMO)
#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_LMSSDR)
LOG_I(PHY,"[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)\n",
phy_vars_ue->Mod_id,
phy_vars_ue->frame_rx,
......
......@@ -50,7 +50,7 @@
#endif
extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index);
#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF)
#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
#include "common_lib.h"
extern openair0_config_t openair0_cfg[];
#endif
......@@ -97,10 +97,10 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
#ifdef EXMIMO
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",phy_vars_ue->rx_total_gain_dB, openair0_cfg[0].rxg_mode[0],(int)openair0_cfg[0].rx_gain[0]);
#endif
#if defined(OAI_USRP) || defined(OAI_BLADERF)
#if defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",phy_vars_ue->rx_total_gain_dB);
#endif
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF)
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz (%d), estimated carrier frequency %f Hz\n",phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset,openair0_cfg[0].rx_freq[0]-phy_vars_ue->lte_ue_common_vars.freq_offset);
#endif
len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[phy_vars_ue->UE_mode[0]],phy_vars_ue->UE_mode[0]);
......
......@@ -88,7 +88,7 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void )
fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX );
fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED );
fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color
fl_set_xyplot_ybounds(fdui->rxsig_t,30,70);
fl_set_xyplot_ybounds(fdui->rxsig_t,10,70);
// Time-domain channel response
fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" );
......@@ -396,7 +396,7 @@ FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void )
fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX );
fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED );
fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color
fl_set_xyplot_ybounds(fdui->rxsig_t,30,70);
fl_set_xyplot_ybounds(fdui->rxsig_t,10,70);
// Time-domain channel response
fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" );
......
......@@ -76,6 +76,13 @@
#define openair_free(y,x) free((y))
#define PAGE_SIZE 4096
//#ifdef SHRLIBDEV
//extern int rxrescale;
//#define RX_IQRESCALELEN rxrescale
//#else
//#define RX_IQRESCALELEN 15
//#endif
//! \brief Allocate \c size bytes of memory on the heap with alignment 16 and zero it afterwards.
//! If no more memory is available, this function will terminate the program with an assertion error.
static inline void* malloc16_clear( size_t size )
......
......@@ -44,7 +44,14 @@
/** @defgroup _ref_implementation_ OpenAirInterface LTE Implementation
* @{
* @defgroup _PHY_RF_INTERFACE_ Generic PHY - RF Interface
* @defgroup _PHY_RF_INTERFACE_ PHY - RF Interface
* @ingroup _PHY_RF_INTERFACE_
* @{
* @defgroup _GENERIC_PHY_RF_INTERFACE_ Generic PHY - RF Interface
* @defgroup _USRP_PHY_RF_INTERFACE_ PHY - USRP RF Interface
* @defgroup _BLADERF_PHY_RF_INTERFACE_ PHY - BLADERF RF Interface
* @}
*
* @ingroup _ref_implementation_
* @{
* This module is responsible for defining the generic interface between PHY and RF Target
......
......@@ -121,7 +121,7 @@ extern int rx_sig_fifo;
#endif
#if defined(EXMIMO) || defined(OAI_USRP)
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
#endif
......@@ -197,7 +197,7 @@ void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe)
exit(-1);
}
#if defined(EXMIMO) || defined(OAI_USRP)
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
//unsigned int gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,398,447,501,562,631,708,794,891,1000,1122,1258,1412,1585,1778,1995,2239,2512,2818,3162};
/*
unsigned int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL)
......@@ -669,7 +669,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
uint8_t ack_status=0;
int8_t Po_PUCCH;
int32_t ulsch_start=0;
#if defined(EXMIMO) || defined(OAI_USRP)
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
int overflow=0;
int k,l;
#endif
......@@ -969,7 +969,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
#endif
phy_vars_ue->tx_total_RE = nb_rb*12;
#if defined(EXMIMO) || defined(OAI_USRP)
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
tx_amp = get_tx_amp(phy_vars_ue->tx_power_dBm,
phy_vars_ue->tx_power_max_dBm,
phy_vars_ue->lte_frame_parms.N_RB_UL,
......@@ -1065,7 +1065,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
#endif
phy_vars_ue->tx_total_RE = 12;
#if defined(EXMIMO) || defined(OAI_USRP)
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
tx_amp = get_tx_amp(Po_PUCCH,
phy_vars_ue->tx_power_max_dBm,
phy_vars_ue->lte_frame_parms.N_RB_UL,
......@@ -1128,7 +1128,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
#endif
phy_vars_ue->tx_total_RE = 12;
#if defined(EXMIMO) || defined(OAI_USRP)
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
tx_amp = get_tx_amp(Po_PUCCH,
phy_vars_ue->tx_power_max_dBm,
phy_vars_ue->lte_frame_parms.N_RB_UL,
......@@ -1230,7 +1230,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
if (abstraction_flag == 0) {
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
#if defined(EXMIMO) || defined(OAI_USRP) //this is the EXPRESS MIMO case
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)//this is the EXPRESS MIMO case
ulsch_start = (phy_vars_ue->rx_offset+subframe_tx*frame_parms->samples_per_tti-
openair_daq_vars.timing_advance-
phy_vars_ue->timing_advance-
......@@ -1257,7 +1257,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size],
#if defined(EXMIMO) || defined(OAI_USRP)
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
dummy_tx_buffer,
#else
&phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start],
......@@ -1268,7 +1268,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
CYCLIC_PREFIX);
else
normal_prefix_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size],
#if defined(EXMIMO) || defined(OAI_USRP)
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
dummy_tx_buffer,
#else
&phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start],
......@@ -1289,7 +1289,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
}
*/
#ifndef OFDMA_ULSCH
#if defined(EXMIMO) || defined(OAI_USRP)
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
apply_7_5_kHz(phy_vars_ue,dummy_tx_buffer,0);
apply_7_5_kHz(phy_vars_ue,dummy_tx_buffer,1);
#else
......@@ -1304,7 +1304,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
*/
#endif
#if defined(EXMIMO) || defined(OAI_USRP)
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
overflow = ulsch_start - 9*frame_parms->samples_per_tti;
//if ((slot_tx==4) && (aa==0)) printf("ulsch_start %d, overflow %d\n",ulsch_start,overflow);
......@@ -1404,7 +1404,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
phy_vars_ue->tx_total_RE = 96;
#if defined(EXMIMO) || defined(OAI_USRP)
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp = get_tx_amp(phy_vars_ue->tx_power_dBm,
phy_vars_ue->tx_power_max_dBm,
phy_vars_ue->lte_frame_parms.N_RB_UL,
......@@ -1553,9 +1553,11 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t
#else
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain (phy_vars_ue,0);
#endif
#endif
#endif
#endif
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_OUT);
......
......@@ -656,7 +656,17 @@ int main(int argc, char **argv)
printf("dual_stream_UE=%d\n", dual_stream_UE);
}
lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,tdd_config,N_RB_DL,threequarter_fs,osf,perfect_ce);
lte_param_init(n_tx,
n_rx,
transmission_mode,
extended_prefix_flag,
frame_type,
Nid_cell,
tdd_config,
N_RB_DL,
threequarter_fs,
osf,
perfect_ce);
......
......@@ -194,6 +194,7 @@ int main(int argc, char **argv)
int nb_rb_set = 0;
int sf;
int threequarter_fs=0;
opp_enabled=1; // to enable the time meas
cpu_freq_GHz = (double)get_cpu_freq_GHz();
......@@ -203,7 +204,7 @@ int main(int argc, char **argv)
logInit();
while ((c = getopt (argc, argv, "hapZbm:n:Y:X:x:s:w:e:q:d:D:O:c:r:i:f:y:c:oA:C:R:g:N:l:S:T:QB:PI:L")) != -1) {
while ((c = getopt (argc, argv, "hapZEbm:n:Y:X:x:s:w:e:q:d:D:O:c:r:i:f:y:c:oA:C:R:g:N:l:S:T:QB:PI:L")) != -1) {
switch (c) {
case 'a':
channel_model = AWGN;
......@@ -373,6 +374,10 @@ int main(int argc, char **argv)
cyclic_shift = atoi(optarg);
break;
case 'E':
threequarter_fs=1;
break;
case 'N':
N0 = atoi(optarg);
break;
......@@ -470,6 +475,7 @@ int main(int argc, char **argv)
0,
tdd_config,
N_RB_DL,
threequarter_fs,
osf,
0);
......
......@@ -63,6 +63,8 @@ TASK_DEF(TASK_X2AP, TASK_PRIORITY_MED, 200)
TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200)
/// eNB APP task
TASK_DEF(TASK_ENB_APP, TASK_PRIORITY_MED, 200)
/// eNB Agent task
TASK_DEF(TASK_ENB_AGENT, TASK_PRIORITY_MED, 200)
// UE tasks and sub-tasks:
//// Layer 2 and Layer 1 sub-tasks
......
//'syntax = "proto2";'
package protocol;
//
// Cell config related structures and enums
//
message prp_si_config {
optional uint32 sfn = 1;
optional uint32 sib1_length = 2; // The length of SIB1 in bytes
optional uint32 si_window_length = 3; // The scheduling window for all SIs in SF
repeated prp_si_message si_message = 4; // List of SI messages to be sent.
// The index identifies the type of an SI message
// 0 - SIB1
// 1..31 - SIx
// 32..63 - PCCH
}
message prp_si_message {
optional uint32 periodicity = 1; // Periodicity of SI msg in radio frames
optional uint32 length = 2; // The length of the SI message in bytes
}
enum prp_hopping_mode {
PRHM_INTER = 0;
PRHM_INTERINTRA = 1;
}
enum prp_phich_resource {
PRPR_ONE_SIXTH = 0;
PRPR_HALF = 1;
PRPR_ONE = 2;
PRPR_TWO = 3;
}
enum prp_phich_duration {
PRPD_NORMAL = 0;
PRPD_EXTENDED = 1;
}
enum prp_ul_cyclic_prefix_length {
PRUCPL_NORMAL = 0;
PRUCPL_EXTENDED = 1;
}
enum prp_dl_cyclic_prefix_length {
PRDCPL_NORMAL = 0;
PRDCPL_EXTENDED = 1;
}
enum prp_duplex_mode {
PRDM_TDD = 0;
PRDM_FDD = 1;
}
enum prp_qam {
PREQ_MOD_16QAM = 0;
PREQ_MOD_64QAM = 1;
}
//
// UE config related structures and enums
//
message prp_drx_config {
optional uint32 on_duration_timer = 1; // Timer in SF. See TS 36.321
optional uint32 drx_inactivity_timer = 2; // Timer in SF. See TS 36.321
optional uint32 drx_retransmission_timer = 3; // Timer in SF. See TS 36.321
optional uint32 long_drx_cycle = 4; // In SF. See TS 36.321
optional uint32 long_drx_cycle_start_offset = 5;// See TS 36.321
optional uint32 short_drx_cycle = 6; // In SF
optional uint32 drx_short_cycle_timer = 7; // Timer in subframes. See TS 36.321
}
message prp_sps_config {
optional uint32 semi_persistent_sched_interval_UL = 1; // SPS UL scheduling interval in SF
optional uint32 semi_persistent_sched_interval_DL = 2; // SPS DL scheduling interval in SF
optional uint32 num_of_conf_sps_proc = 3; // Number of SPS HARQ processes. See TS 36.321
repeated uint32 n1_PUCCH_AN_persistent_element = 4;// See TS36.213. Ignored when config is used
// as part of PRPT_SET_UE_CONFIG
optional uint32 implicit_release_after = 5; // number of empty transmissions before release of SPS
}
message prp_sr_config {
optional uint32 sr_action = 1; // Indicates if SR config should be changed or released
// One of the PRSRA_* enum values
optional uint32 sched_interval = 2; // SR scheduling interval in SF
optional uint32 dsr_trans_max = 3; // See TS 36.213
}
message prp_cqi_config {
optional uint32 cqi_action = 1; // Indicats if CQI changed or released.
// One of the PRSRA_* enum values
optional uint32 cqi_sched_interval = 2; // CQI scheduling interval in SF
optional uint32 ri_sched_interval = 3; // RI scheduling interval in SF
}
message prp_ue_capabilities {
optional uint32 half_duplex = 1; // Boolean value. Only half duplex support. FDD operation
optional uint32 intra_SF_hopping = 2; // Support for intra-subframe hopping. Boolean value
optional uint32 type2_sb_1 = 3; // Support for type 2 hopping with n_sb > 1
optional uint32 ue_category = 4;
optional uint32 res_alloc_type1 = 5; // Boolean value. UE support for resource allocation type 1
}
message prp_scell_config {
optional uint32 carrier_index = 1; // Id of the carrier component
optional uint32 scell_index = 2; // Index of this Scell (RRC SCellIndex)
optional uint32 use_ccs = 3; // Boolean value. Indicates if cross-carrier scheduling
// is used by this SCell
optional uint32 sched_cell_index = 4; // Index of the cell responsible for scheduling
// this SCell if cross-carrier scheduling is enabled
optional uint32 pdsch_start = 5; // Starting OFDM symbol of PDSCH data region for this SCell
}
enum prp_meas_gap_config_pattern {
PRMGCP_GP1 = 0;
PRMGCP_GP2 = 1;
PRMGCP_OFF = 2;
}
enum prp_setup_release_action {
PRSRA_SETUP = 0;
PRSRA_RELEASE = 1;
}
enum prp_ue_transmission_antenna {
PRUTA_NONE = 0;
PRUTA_OPEN_LOOP = 1;
PRUTA_CLOSED_LOOP = 2;
}
enum prp_aperiodic_cqi_report_mode {
PRACRM_RM12 = 0;
PRACRM_RM20 = 1;
PRACRM_RM22 = 2;
PRACRM_RM30 = 3;
PRACRM_RM31 = 4;
PRACRM_NONE = 5;
}
enum prp_tdd_ack_nack_feedback_mode {
PRTANFM_BUNDLING = 0;
PRTANFM_MULTIPLEXING = 1;
}
//
// Logical channel config related structures and enums
//
message prp_lc_config {
optional uint32 lcid = 1; // The logical channel id
optional uint32 lcg = 2; // The logical channel group (0..3) the LC is mapped to
optional uint32 direction = 3; // The LC direction. One of the PRLCD_* enum values
optional uint32 qos_bearer_type = 4;// GBR or NGBR bearer. One of the PRQBT_* enum values
optional uint32 qci = 5; // The QCI defined in TS 23.203, coded as defined in TS 36.413
// One less than the actual QCI value
optional uint64 e_RAB_max_bitrate_UL = 6; // In bps (GBR only)
optional uint64 e_RAB_max_bitrate_DL = 7; // In bps (GBR only)
optional uint64 e_RAB_guaranteed_bitrate_UL = 8; // In bps (GBR only)
optional uint64 e_RAB_guaranteed_bitrate_DL = 9; // In bps (GBR only)
}
enum prp_lc_direction {
PRLCD_UL = 0;
PRLCD_DL = 1;
PRLCD_BOTH = 2;
}
enum prp_qos_bearer_type {
PRQBT_NON_GBR = 0;
PRQBT_GBR = 1;
}
enum prp_ue_state_change_type {
PRUESC_UPDATED = 0;
PRUESC_ACTIVATED = 1;
PRUESC_DEACTIVATED = 2;
PRUESC_MOVED = 3;
}
\ No newline at end of file
//'syntax = "proto2";'
package protocol;
import "config_common.proto";
message prp_cell_config {
optional uint32 phy_cell_id = 1; // The PCI of this cell
optional uint32 cell_id = 2; // The PLMN cell id of this cell
optional uint32 pusch_hopping_offset = 3; // PUSCH resources in RBs for hopping
optional uint32 hopping_mode = 4; // One of the PRHM_* enum values
optional uint32 n_sb = 5; // The number of subbands
optional uint32 phich_resource = 6; // The number of REGs used for PHICH
// One of the PRPR_* enum values
optional uint32 phich_duration = 7; // One of the PRPD_* enum values
optional uint32 init_nr_PDCCH_OFDM_sym = 8; // See TS 36.211, section 6.9
optional prp_si_config si_config = 9; // The SI configuration
optional uint32 dl_bandwidth = 10; // The DL transmission bandwidth in RBs
optional uint32 ul_bandwidth = 11; // The UL transmission bandwidth in RBs
optional uint32 ul_cyclic_prefix_length = 13; // One of the PRUCPL_* enum values
optional uint32 dl_cyclic_prefix_length = 14; // One of the PRDCPL_* enum values
optional uint32 antenna_ports_count = 15; // Number of cell specific antenna ports
optional uint32 duplex_mode = 16; // One of the PRDM_* enum values
optional uint32 subframe_assignment = 17; // DL/UL subframe assignment. TDD only
optional uint32 special_subframe_patterns = 18; // TDD only. See TS 36.211, table 4.2.1
repeated uint32 mbsfn_subframe_config_rfperiod = 19; // The MBSFN radio frame period (Optional)
repeated uint32 mbsfn_subframe_config_rfoffset = 20; // The radio frame offset (Optional)
repeated uint32 mbsfn_subframe_config_sfalloc = 21; // Bitmap indicating the MBSFN subframes (Optional)
optional uint32 prach_config_index = 22; // See TS 36.211, section 5.7.1
optional uint32 prach_freq_offset = 23; // See TS 36.211, section 5.7.1
optional uint32 ra_response_window_size = 24; // The duration of the RA response window in SF
optional uint32 mac_contention_resolution_timer = 25; // Timer for RA
optional uint32 max_HARQ_Msg3Tx = 26; // See TS 36.321
optional uint32 n1PUCCH_AN = 27; // See TS 36.213, section 10.1
optional uint32 deltaPUCCH_shift = 28; // See TS 36.211, section 5.4
optional uint32 nRB_cqi = 29; // See TS 36.211, section 5.4
optional uint32 srs_subframe_config = 30; // See TS 36.211, table 5.5.3.3-1 and 2
optional uint32 srs_bw_config = 31; // See TS 36.211, section 5.5.3.2
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 PREQ_* enum values
optional uint32 carrier_index = 34; // Carrier component index
}
message prp_ue_config {
optional uint32 rnti = 1;
optional prp_drx_config drx_config = 2; // The DRX configuration (Optional)
optional uint32 time_alignment_timer = 3; // Timer in SF. Control the synchronization
// status of the UE, not the actual advance procedure
// See TS 36.321
optional uint32 meas_gap_config_pattern = 4; // Measurement gap configuration.
// One of the PRMGCP_* enum values
// See TS 36.133
optional uint32 meas_gap_config_sf_offset = 5; // Measurement gap offset if applicable
optional prp_sps_config sps_config = 6; // The SPS configuration (Optional)
optional prp_sr_config sr_config = 7; // The SR configuration (Optional)
optional prp_cqi_config cqi_config = 8; // The CQI configuration (Optional)
optional uint32 transmission_mode = 9; // The UE transmission mode
optional uint64 ue_aggregated_max_bitrate_UL = 10; // Aggregated bit-rate of non-gbr bearer
// per UE. See TS 36.413
optional uint64 ue_aggregated_max_bitrate_DL = 11; // Aggregated bit-rate of non-gbr bearer
// per UE. See TS 36.413
optional prp_ue_capabilities capabilities = 12;
optional uint32 ue_transmission_antenna = 13; // One of the PRUTA_* enum values
optional uint32 tti_bundling = 14; // Boolean value. See TS 36.321
optional uint32 max_HARQ_tx = 15; // The max HARQ retransmission for UL
optional uint32 beta_offset_ACK_index = 16; // See TS 36.213
optional uint32 beta_offset_RI_index = 17; // See TS 36.213
optional uint32 beta_offset_CQI_index = 18; // See TS 36.213
optional uint32 ack_nack_simultaneous_trans = 19;// Boolean. See TS 36.213
optional uint32 simultaneous_ack_nack_cqi = 20; // Boolean. See TS 36.213
optional uint32 aperiodic_cqi_rep_mode = 21; // One of the PRACRM_* enum values
optional uint32 tdd_ack_nack_feedback = 22; // One of the PRTANFM_* enum values
optional uint32 ack_nack_repetition_factor = 23;// See TS 36.213, section 10.1
optional uint32 extended_bsr_size = 24; // Boolean for extended BSR size
optional uint32 ca_support = 25; // Boolean. Support for carrier aggregation
optional uint32 cross_carrier_sched_support = 26; // Boolean value
optional uint32 pcell_carrier_index = 27; // Index of primary cell
repeated prp_scell_config scell_config = 28; // Secondary cells configuration
optional uint32 scell_deactivation_timer = 29;// Deactivation timer for secondary cell
}
message prp_lc_ue_config {
optional uint32 rnti = 1;
repeated prp_lc_config lc_config = 2; // A list of LC configurations for the given UE
}
//'syntax = "proto2";'
package protocol;
enum prp_control_delegation_type {
PRCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation
}
\ No newline at end of file
package protocol;
import "mac_primitives.proto";
//
// Body of UE DL MAC scheduling configuration info
//
message prp_dl_data {
optional uint32 rnti = 1;
optional prp_dl_dci dl_dci = 2;
repeated uint32 ce_bitmap = 3; // list of 2 MAC CEs, one for each TB
repeated prp_rlc_pdu rlc_pdu = 4; // list of parameters for the creation of RLC PDUs. One for each lcid
optional uint32 serv_cell_index = 5;
optional uint32 act_deact_ce = 6; //Hex content of MAC CE for Activation/Deactivation in CA
}
//
// Body of the RAR scheduler configuration
//
message prp_dl_rar {
optional uint32 rnti = 1;
optional uint32 grant = 2; // The 20-bit UL grant. TS 36.213, sec 6.2
optional prp_dl_dci rar_dci = 3;
optional uint32 carrier_index = 4; // The carrier index for the RAR
}
//
// Body of the paging/broadcast configuration message
//
message prp_dl_broadcast {
optional uint32 type = 1; // The PRBT_* values
optional uint32 index = 2; // Index of the broadcast message:
// 0 - SIB1,
// 1..31 - Six,
// 32..63 - PCCH (PCCH index obtained from prp_paging_info)
optional prp_dl_dci broad_dci = 3;
optional uint32 carrier_index = 4; // Index of the carrier for broadcast
}
//
// Body of the OFDM symbol count message
//
message prp_pdcch_ofdm_sym_count {
optional uint32 carrier_index = 1;
optional uint32 num_pdcch_ofdm_symbols = 2;
}
//
// Types of commands related enums
//
enum prp_broadcast_type {
PRBT_BCCH = 0;
PRBT_PCCH = 1;
}
\ No newline at end of file
package protocol;
message prp_header {
optional uint32 version = 1;
optional uint32 type = 2;
optional uint32 xid = 4;
}
enum prp_type {
// Discovery and maintenance messages
PRPT_HELLO = 0;
PRPT_ECHO_REQUEST = 1;
PRPT_ECHO_REPLY = 2;
// Statistics and measurement messages
PRPT_STATS_REQUEST = 3;
PRPT_STATS_REPLY = 4;
// Time indication messages
PRPT_SF_TRIGGER = 5;
// Asynchronous messages
PRPT_UL_SR_INFO = 6;
// eNB configuration messages
PRPT_GET_ENB_CONFIG_REQUEST = 7;
PRPT_GET_ENB_CONFIG_REPLY = 8;
PRPT_GET_UE_CONFIG_REQUEST = 9;
PRPT_GET_UE_CONFIG_REPLY = 10;
PRPT_GET_LC_CONFIG_REQUEST = 11;
PRPT_GET_LC_CONFIG_REPLY = 12;
//Controller command messages
PRPT_DL_MAC_CONFIG = 13;
// UE state change messages
PRPT_UE_STATE_CHANGE = 14;
// Control delegation messages
PRPT_DELEGATE_CONTROL = 15;
}
package protocol;
//
// Message containing the DL DCI info
//
message prp_dl_dci {
optional uint32 rnti = 1;
optional uint32 res_alloc = 2; // Type of resource allocation
optional uint32 rb_bitmap = 3; // Bitmap for RB allocation
optional uint32 rb_shift = 4; // See TS 36.214, section 7.1.6.2
repeated uint32 tbs_size = 5; // The size of each TBS
repeated uint32 mcs = 6; // The MCS of each TB
repeated uint32 ndi = 7; // New data indicator of each TB
repeated uint32 rv = 8; // Redundancy version of each TB
optional uint32 cce_index = 9; // CCE index used to send the DCI
optional uint32 aggr_level = 10;
optional uint32 precoding_info = 11; // 2 antenna ports:0..6,
// 4 antenna ports:0..50
optional uint32 format = 12; // DCI format. A PRDCIF_* value
optional uint32 tpc = 13; // TS 36.213, sec 5.1.1.1
optional uint32 harq_process = 14; // HARQ process ID
optional uint32 dai = 15; // TDD only
optional uint32 vrb_format = 16; // One of the PRVRBF_* values
optional uint32 tb_swap = 17; // Boolean. TB to codeword swap flag
optional uint32 sps_release = 18; // Flag value
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 n_gap = 22; // One of the PRNGV_* values
optional uint32 tbs_idx = 23; // The TBS index for Format 1A
optional uint32 dl_power_offset = 24; // For format 1D
optional uint32 pdcch_power_offset = 25; // DL PDCCH power boosting in dB
optional uint32 cif_present = 26; // Boolean. Indication of CIF field
optional uint32 cif = 27; // CIF for cross-carrier scheduling
}
//
// Messages related to the creation of RLC PDUs
//
message prp_rlc_pdu {
repeated prp_rlc_pdu_tb rlc_pdu_tb = 1; // list of parameters for the creation of RLC PDUs. One for each TB
}
message prp_rlc_pdu_tb {
optional uint32 logical_channel_id = 1;
optional uint32 size = 2; // Maximum RLC PDU to be created in bytes
}
//
// MAC content types related enums
//
enum prp_dci_format {
PRDCIF_1 = 0;
PRDCIF_1A = 1;
PRDCIF_1B = 2;
PRDCIF_1C = 3;
PRDCIF_1D = 4;
PRDCIF_2 = 5;
PRDCIF_2A = 6;
PRDCIF_2B = 7;
PRDCIF_3 = 8;
PRDCIF_3A = 9;
}
enum prp_vrb_format {
PRVRBF_LOCALIZED = 0;
PRVRBF_DISTRIBUTED = 1;
}
enum prp_ngap_val {
PRNGV_1 = 0;
PRNGV_2 = 1;
}
\ No newline at end of file
//'syntax = "proto2";'
package protocol;
import "stats_messages.proto";
import "header.proto";
import "time_common.proto";
import "config_messages.proto";
import "controller_commands.proto";
import "control_delegation.proto";
message progran_message {
optional progran_direction msg_dir = 100;
oneof msg {
prp_hello hello_msg = 1;
prp_echo_request echo_request_msg = 2;
prp_echo_reply echo_reply_msg = 3;
prp_stats_request stats_request_msg = 4;
prp_stats_reply stats_reply_msg = 5;
prp_sf_trigger sf_trigger_msg = 6;
prp_ul_sr_info ul_sr_info_msg = 7;
prp_enb_config_request enb_config_request_msg = 8;
prp_enb_config_reply enb_config_reply_msg = 9;
prp_ue_config_request ue_config_request_msg = 10;
prp_ue_config_reply ue_config_reply_msg = 11;
prp_lc_config_request lc_config_request_msg = 12;
prp_lc_config_reply lc_config_reply_msg = 13;
prp_dl_mac_config dl_mac_config_msg = 14;
prp_ue_state_change ue_state_change_msg = 15;
prp_control_delegation control_delegation_msg = 16;
}
}
enum progran_direction {
//option allow_alias = true;
NOT_SET = 0;
INITIATING_MESSAGE = 1;
SUCCESSFUL_OUTCOME=2;
UNSUCCESSFUL_OUTCOME=3;
}
enum progran_err {
option allow_alias = true;
// message errors
NO_ERR = 0;
MSG_DEQUEUING = -1;
MSG_ENQUEUING = -2;
MSG_DECODING = -3;
MSG_ENCODING = -4;
MSG_BUILD = -5;
MSG_NOT_SUPPORTED = -6;
MSG_NOT_HANDLED = -7;
MSG_NOT_VALIDATED = -8;
MSG_OUT_DATED = -9;
// other erros
UNEXPECTED = -100;
}
//
// Maintenance and discovery messages
//
message prp_hello {
optional prp_header header = 1;
}
message prp_echo_request {
optional prp_header header = 1;
extensions 100 to 199;
}
message prp_echo_reply {
optional prp_header header = 1;
extensions 100 to 199;
}
//
// Statistics request and reply message
//
message prp_stats_request {
optional prp_header header = 1;
optional prp_stats_type type = 2;
oneof body {
prp_complete_stats_request complete_stats_request = 3;
prp_cell_stats_request cell_stats_request = 4;
prp_ue_stats_request ue_stats_request = 5;
}
}
message prp_stats_reply {
optional prp_header header = 1;
repeated prp_ue_stats_report ue_report = 2;
repeated prp_cell_stats_report cell_report = 3;
}
//
// Time indication messages
//
message prp_sf_trigger {
optional prp_header header = 1;
optional uint32 sfn_sf = 2;
repeated prp_dl_info dl_info = 3;
repeated prp_ul_info ul_info = 4;
}
//
// Asynchronous messages
//
message prp_ul_sr_info {
optional prp_header header = 1;
optional uint32 sfn_sf = 2;
repeated uint32 rnti = 3;
}
//
// eNB configuration messages
//
message prp_enb_config_request {
optional prp_header header = 1;
}
message prp_enb_config_reply {
optional prp_header header = 1;
optional uint32 eNB_id = 2; // Unique id to distinguish the eNB
repeated prp_cell_config cell_config = 3;
}
message prp_ue_config_request {
optional prp_header header = 1;
}
message prp_ue_config_reply {
optional prp_header header = 1;
repeated prp_ue_config ue_config = 2;
}
message prp_lc_config_request {
optional prp_header header = 1;
}
message prp_lc_config_reply {
optional prp_header header = 1;
repeated prp_lc_ue_config lc_ue_config = 2;
}
//
// Controller command messages
//
message prp_dl_mac_config {
optional prp_header header = 1;
optional uint32 sfn_sf = 2;
repeated prp_dl_data dl_ue_data = 3;
repeated prp_dl_rar dl_rar = 4;
repeated prp_dl_broadcast dl_broadcast = 5;
repeated prp_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC
}
//
// UE state change message
//
message prp_ue_state_change {
optional prp_header header = 1;
optional uint32 type = 2; // One of the PRUESC_* values
optional prp_ue_config config = 3; // Body of the message (based on type)
}
//
// Control delegation message
//
message prp_control_delegation {
optional prp_header header = 1;
optional uint32 delegation_type = 2; // Bitmap of PRCDT_* flags
optional bytes payload = 3; // Byte array of shared lib containing the delegated functions
repeated string name = 4; // The delegated functions names ordered based on bitmap flags
}
// Extensions of the echo request and reply
// messages for carrying a latency value in ms
message prp_echo_request_latency {
extend prp_echo_request {
optional uint32 latency = 100;
}
}
message prp_echo_reply_latency {
extend prp_echo_reply {
optional uint32 latency = 100;
}
}
package protocol;
//
// UE related statistics
//
// RLC buffer status for a specific logical channel of a UE
message prp_rlc_bsr {
optional uint32 lc_id = 1;
optional uint32 tx_queue_size = 2;
optional uint32 tx_queue_hol_delay = 3;
optional uint32 retransmission_queue_size = 4;
optional uint32 retransmission_queue_hol_delay = 5;
optional uint32 status_pdu_size = 6;
}
// Flags for MAC Control Elements
enum prp_ce_type {
PRPCET_TA = 1;
PRPCET_DRX = 2;
PRPCET_CR = 4;
PRPCET_CA = 8;
}
// Types of DL CSI reports
enum prp_csi_type {
PRCSIT_P10 = 0;
PRCSIT_P11 = 1;
PRCSIT_P20 = 2;
PRCSIT_P21 = 3;
PRCSIT_A12 = 4;
PRCSIT_A22 = 5;
PRCSIT_A20 = 6;
PRCSIT_A30 = 7;
PRCSIT_A31 = 8;
}
// CSI type P10
message prp_csi_p10 {
optional uint32 wb_cqi = 1;
}
// CSI type P11
message prp_csi_p11 {
repeated uint32 wb_cqi = 1;
optional uint32 wb_pmi = 2;
}
// CSI type P20
message prp_csi_p20 {
optional uint32 wb_cqi = 1;
optional uint32 sb_cqi = 2;
optional uint32 bandwidth_part_index = 3;
optional uint32 sb_index = 4;
}
// CSI type P21
message prp_csi_p21 {
repeated uint32 wb_cqi = 1;
optional uint32 wb_pmi = 2;
repeated uint32 sb_cqi = 3;
optional uint32 badwidth_part_index = 4;
optional uint32 sb_index = 5;
}
// CSI type A12
message prp_csi_a12 {
repeated uint32 wb_cqi = 1;
repeated uint32 sb_pmi = 2;
}
// CSI type A22
message prp_csi_a22 {
repeated uint32 wb_cqi = 1;
repeated uint32 sb_cqi = 2;
optional uint32 wb_pmi = 3;
optional uint32 sb_pmi = 4;
repeated uint32 sb_list = 5;
}
// CSI type A20
message prp_csi_a20 {
optional uint32 wb_cqi = 1;
optional uint32 sb_cqi = 2;
repeated uint32 sb_list = 3;
}
// CSI type A30
message prp_csi_a30 {
optional uint32 wb_cqi = 1;
repeated uint32 sb_cqi = 2;
}
// CSI type A31
message prp_csi_a31 {
repeated uint32 wb_cqi = 1;
repeated prp_msb_cqi sb_cqi = 2;
optional uint32 wb_pmi = 3;
}
// The CQI for the M-preffered subband
message prp_msb_cqi {
repeated uint32 sb_cqi = 1;
}
// The CSI report of the UE for a specific servCellIndex
message prp_dl_csi {
optional uint32 serv_cell_index = 1;
optional uint32 ri = 2;
optional prp_csi_type type = 3;
oneof report {
prp_csi_p10 p10csi = 4;
prp_csi_p11 p11csi = 5;
prp_csi_p20 p20csi = 6;
prp_csi_p21 p21csi = 7;
prp_csi_a12 a12csi = 8;
prp_csi_a22 a22csi = 9;
prp_csi_a20 a20csi = 10;
prp_csi_a30 a30csi = 11;
prp_csi_a31 a31csi = 12;
}
}
// The full DL CQI report for all CC of a UE
message prp_dl_cqi_report {
optional uint32 sfn_sn = 1;
repeated prp_dl_csi csi_report = 2;
}
// Paging message info
message prp_paging_info {
optional uint32 paging_index = 1;
optional uint32 paging_message_size = 2;
optional uint32 paging_subframe = 3;
optional uint32 carrier_index = 4;
}
// Report for the paging buffer status
message prp_paging_buffer_report {
repeated prp_paging_info paging_info = 1;
}
// The type of UL CQI
enum prp_ul_cqi_type {
PRUCT_SRS = 0;
PRUCT_PUSCH = 1;
PRUCT_PUCCH_1 = 2;
PRUCT_PUCCH_2 = 3;
PRUCT_PRACH = 4;
}
// UL CQI report for a specific UE for a given report type
message prp_ul_cqi {
optional prp_ul_cqi_type type = 1;
repeated uint32 sinr = 2;
optional uint32 serv_cell_index = 3;
}
// Full UL CQI report for a specific UE
message prp_ul_cqi_report {
optional uint32 sfn_sn = 1;
repeated prp_ul_cqi cqi_meas = 2;
}
//
// Cell related statistics
//
// The UL noise and interference report for a UE
message prp_noise_interference_report {
optional uint32 sfn_sf = 1;
optional uint32 rip = 2;
optional uint32 tnp = 3;
}
package protocol;
//import "header.proto";
import "stats_common.proto";
//
// Bodies of statistics report requests
//
message prp_complete_stats_request {
optional prp_stats_report_freq report_frequency = 1;
optional uint32 sf = 2;
optional uint32 cell_report_flags = 3;
optional uint32 ue_report_flags = 4;
}
message prp_cell_stats_request {
repeated uint32 cell = 1;
optional uint32 flags = 2;
}
message prp_ue_stats_request {
repeated uint32 rnti = 1;
optional uint32 flags = 2;
}
//
// Bodies of statistics reports
//
// The full statistics report for a specific cell
message prp_cell_stats_report {
optional uint32 carrier_index = 1;
optional uint32 flags = 2;
optional prp_noise_interference_report noise_inter_report = 3;
}
// Statistics report for a specific UE
message prp_ue_stats_report {
optional uint32 rnti = 1;
optional uint32 flags = 2;
repeated uint32 bsr = 3;
optional uint32 phr = 4;
repeated prp_rlc_bsr rlc_report = 5;
optional uint32 pending_mac_ces = 6;
optional prp_dl_cqi_report dl_cqi_report = 7;
optional prp_paging_buffer_report pbr = 8;
optional prp_ul_cqi_report ul_cqi_report = 9;
}
//
// Types of statistics related enums
//
//Types of statistics requested by the controller
enum prp_stats_type {
PRST_COMPLETE_STATS = 0;
PRST_CELL_STATS = 1;
PRST_UE_STATS = 2;
}
// Report frequency for the requested statistics
enum prp_stats_report_freq {
PRSRF_ONCE = 0;
PRSRF_PERIODICAL = 1;
PRSRF_CONTINUOUS = 2;
PRSRF_OFF = 3;
}
// Flags for cell statistics
enum prp_cell_stats_type {
PRCST_NOISE_INTERFERENCE = 1;
}
// Flags for UE-related statistics
enum prp_ue_stats_type {
PRUST_BSR = 1;
PRUST_PRH = 2;
PRUST_RLC_BS = 4;
PRUST_MAC_CE_BS = 8;
PRUST_DL_CQI = 16;
PRUST_PBS = 32;
PRUST_UL_CQI = 64;
// To be extended with more types of stats
}
\ No newline at end of file
package protocol;
enum prp_harq_status {
PRHS_ACK = 0;
PRHS_NACK = 1;
PRHS_DTX = 2;
}
enum prp_reception_status {
PRRS_OK = 0;
PRRS_NOT_OK = 1;
PRRS_NOT_VALID = 2;
}
message prp_dl_info {
optional uint32 rnti = 1;
optional uint32 harq_process_id = 2;
repeated uint32 harq_status = 3;
optional uint32 serv_cell_index = 4;
}
message prp_ul_info {
optional uint32 rnti = 1;
repeated uint32 ul_reception = 2;
optional uint32 reception_status = 3;
optional uint32 tpc = 4;
optional uint32 serv_cell_index = 5;
}
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file enb_agent.h
* \brief top level enb agent receive thread and itti task
* \author Navid Nikaein and Xenofon Foukas
* \date 2016
* \version 0.1
*/
#include "enb_agent_common.h"
#include "log.h"
#include "enb_agent.h"
#include "enb_agent_mac_defs.h"
#include "enb_agent_extern.h"
#include "assertions.h"
#include "enb_agent_net_comm.h"
#include "enb_agent_async.h"
//#define TEST_TIMER
enb_agent_instance_t enb_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);
Protocol__ProgranMessage *enb_agent_timeout(void* args);
/*
* enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller
* and can interact with other itti tasks
*/
void *enb_agent_task(void *args){
enb_agent_instance_t *d = (enb_agent_instance_t *) args;
Protocol__ProgranMessage *msg;
void *data;
int size;
err_code_t err_code;
int priority;
MessageDef *msg_p = NULL;
const char *msg_name = NULL;
instance_t instance;
int result;
itti_mark_task_ready(TASK_ENB_AGENT);
do {
// Wait for a message
itti_receive_msg (TASK_ENB_AGENT, &msg_p);
DevAssert(msg_p != NULL);
msg_name = ITTI_MSG_NAME (msg_p);
instance = ITTI_MSG_INSTANCE (msg_p);
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
itti_exit_task ();
break;
case MESSAGE_TEST:
LOG_I(ENB_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p));
break;
case TIMER_HAS_EXPIRED:
msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg);
if (msg != NULL){
data=enb_agent_pack_message(msg,&size);
if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) {
err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(ENB_AGENT,"sent message with size %d\n", size);
}
break;
default:
LOG_E(ENB_AGENT, "Received unexpected message %s\n", msg_name);
break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
continue;
error:
LOG_E(ENB_AGENT,"enb_agent_task: error %d occured\n",err_code);
} while (1);
return NULL;
}
void *receive_thread(void *args) {
enb_agent_instance_t *d = args;
void *data;
int size;
int priority;
err_code_t err_code;
Protocol__ProgranMessage *msg;
while (1) {
if (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) {
err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING;
goto error;
}
LOG_D(ENB_AGENT,"received message with size %d\n", size);
msg=enb_agent_handle_message(d->enb_id, data, size);
free(data);
// check if there is something to send back to the controller
if (msg != NULL){
data=enb_agent_pack_message(msg,&size);
if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) {
err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(ENB_AGENT,"sent message with size %d\n", size);
}
}
return NULL;
error:
LOG_E(ENB_AGENT,"receive_thread: error %d occured\n",err_code);
return NULL;
}
/* utility function to create a thread */
pthread_t new_thread(void *(*f)(void *), void *b) {
pthread_t t;
pthread_attr_t att;
if (pthread_attr_init(&att)){
fprintf(stderr, "pthread_attr_init err\n");
exit(1);
}
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
fprintf(stderr, "pthread_attr_setdetachstate err\n");
exit(1);
}
if (pthread_create(&t, &att, f, b)) {
fprintf(stderr, "pthread_create err\n");
exit(1);
}
if (pthread_attr_destroy(&att)) {
fprintf(stderr, "pthread_attr_destroy err\n");
exit(1);
}
return t;
}
int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){
int channel_id;
set_enb_vars(mod_id, RAN_LTE_OAI);
enb_agent[mod_id].enb_id = mod_id;
/*
* check the configuration
*/
if (enb_properties->properties[mod_id]->enb_agent_cache != NULL) {
strncpy(local_cache, enb_properties->properties[mod_id]->enb_agent_cache, sizeof(local_cache));
local_cache[sizeof(local_cache) - 1] = 0;
} else {
strcpy(local_cache, DEFAULT_ENB_AGENT_CACHE);
}
if (enb_properties->properties[mod_id]->enb_agent_ipv4_address != NULL) {
strncpy(in_ip, enb_properties->properties[mod_id]->enb_agent_ipv4_address, sizeof(in_ip) );
in_ip[sizeof(in_ip) - 1] = 0; // terminate string
} else {
strcpy(in_ip, DEFAULT_ENB_AGENT_IPv4_ADDRESS );
}
if (enb_properties->properties[mod_id]->enb_agent_port != 0 ) {
in_port = enb_properties->properties[mod_id]->enb_agent_port;
} else {
in_port = DEFAULT_ENB_AGENT_PORT ;
}
LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n",
enb_agent[mod_id].enb_id,
in_ip,
in_port);
/*
* Initialize the channel container
*/
enb_agent_init_channel_container();
/*Create the async channel info*/
enb_agent_instance_t *channel_info = enb_agent_async_channel_info(mod_id, in_ip, in_port);
/*Create a channel using the async channel info*/
channel_id = enb_agent_create_channel((void *) channel_info,
enb_agent_async_msg_send,
enb_agent_async_msg_recv,
enb_agent_async_release);
if (channel_id <= 0) {
goto error;
}
enb_agent_channel_t *channel = get_channel(channel_id);
if (channel == NULL) {
goto error;
}
/*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/
enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAX);
/*Example of registration for a specific agent(MAC):
*enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC);
*/
/*Initialize the continuous MAC stats update mechanism*/
enb_agent_init_cont_mac_stats_update(mod_id);
new_thread(receive_thread, &enb_agent[mod_id]);
/*Initialize and register the mac xface. Must be modified later
*for more flexibility in agent management */
AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface));
enb_agent_register_mac_xface(mod_id, mac_agent_xface);
/*
* initilize a timer
*/
enb_agent_init_timer();
/*
* Initialize the mac agent
*/
enb_agent_init_mac_agent(mod_id);
/*
* start the enb agent task for tx and interaction with the underlying network function
*/
if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &enb_agent[mod_id]) < 0) {
LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n");
return -1;
}
LOG_I(ENB_AGENT,"client ends\n");
return 0;
error:
LOG_I(ENB_AGENT,"there was an error\n");
return 1;
}
/* int enb_agent_stop(mid_t mod_id){ */
/* int i=0; */
/* enb_agent_destroy_timers(); */
/* for ( i =0; i < enb_agent_info.nb_modules; i++) { */
/* destroy_link_manager(enb_agent[i].manager); */
/* destroy_message_queue(enb_agent[i].send_queue); */
/* destroy_message_queue(enb_agent[i].receive_queue); */
/* close_link(enb_agent[i].link); */
/* } */
/* } */
Protocol__ProgranMessage *enb_agent_timeout(void* args){
// enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args));
//memcpy (timer_args, args, sizeof(*timer_args));
enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args;
LOG_I(ENB_AGENT, "enb_agent %d timeout\n", timer_args->mod_id);
//LOG_I(ENB_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags);
//LOG_I(ENB_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags);
return NULL;
}
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file enb_agent.h
* \brief top level enb agent
* \author Navid Nikaein and Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_H_
#define ENB_AGENT_H_
#include "enb_config.h" // for enb properties
#include "enb_agent_common.h"
int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties);
int enb_agent_stop(mid_t mod_id);
void *enb_agent_task(void *args);
#endif
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file enb_agent_async.c
* \brief channel implementation for async interface
* \author Xenofon Foukas
* \date 2016
* \version 0.1
*/
#include "enb_agent_async.h"
#include "enb_agent_defs.h"
#include "log.h"
enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) {
enb_agent_async_channel_t *channel;
channel = (enb_agent_async_channel_t *) malloc(sizeof(enb_agent_channel_t));
if (channel == NULL)
goto error;
channel->enb_id = mod_id;
/*Create a socket*/
channel->link = new_link_client(dst_ip, dst_port);
if (channel->link == NULL) goto error;
LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n",
channel->enb_id,
dst_ip,
dst_port);
/*
* create a message queue
*/
channel->send_queue = new_message_queue();
if (channel->send_queue == NULL) goto error;
channel->receive_queue = new_message_queue();
if (channel->receive_queue == NULL) goto error;
/*
* create a link manager
*/
channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link);
if (channel->manager == NULL) goto error;
return channel;
error:
LOG_I(ENB_AGENT,"there was an error\n");
return 1;
}
int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info) {
enb_agent_async_channel_t *channel;
channel = (enb_agent_channel_t *)channel_info;
return message_put(channel->send_queue, data, size, priority);
}
int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) {
enb_agent_async_channel_t *channel;
channel = (enb_agent_async_channel_t *)channel_info;
return message_get(channel->receive_queue, data, size, priority);
}
void enb_agent_async_release(enb_agent_channel_t *channel) {
enb_agent_async_channel_t *channel_info;
channel_info = (enb_agent_async_channel_t *) channel->channel_info;
destroy_link_manager(channel_info->manager);
destroy_message_queue(channel_info->send_queue);
destroy_message_queue(channel_info->receive_queue);
close_link(channel_info->link);
free(channel_info);
}
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file enb_agent_async.h
* \brief channel implementation for async interface
* \author Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_ASYNC_H_
#define ENB_AGENT_ASYNC_H_
#include "enb_agent_net_comm.h"
typedef struct {
mid_t enb_id;
socket_link_t *link;
message_queue_t *send_queue;
message_queue_t *receive_queue;
link_manager_t *manager;
} enb_agent_async_channel_t;
enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port);
int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info);
int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info);
void enb_agent_async_release(enb_agent_channel_t *channel);
#endif /*ENB_AGENT_ASYNC_H_*/
This diff is collapsed.
This diff is collapsed.
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2016 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file enb_agent_defs.h
* \brief enb agent common definitions
* \author Navid Nikaein and Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_DEFS_H_
#define ENB_AGENT_DEFS_H_
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include "link_manager.h"
#define NUM_MAX_ENB 2
#define NUM_MAX_UE 2048
#define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1"
#define DEFAULT_ENB_AGENT_PORT 2210
#define DEFAULT_ENB_AGENT_CACHE "/mnt/oai_agent_cache"
typedef enum {
ENB_AGENT_DEFAULT=0,
ENB_AGENT_PHY=1,
ENB_AGENT_MAC=2,
ENB_AGENT_RLC=3,
ENB_AGENT_PDCP=4,
ENB_AGENT_RRC=5,
ENB_AGENT_S1AP=6,
ENB_AGENT_GTP=7,
ENB_AGENT_X2AP=8,
ENB_AGENT_MAX=9,
} agent_id_t;
typedef enum {
/* no action */
ENB_AGENT_ACTION_NONE = 0x0,
/* send action */
ENB_AGENT_ACTION_SEND = 0x1,
/* apply action */
ENB_AGENT_ACTION_APPLY = 0x2,
/* clear action */
ENB_AGENT_ACTION_CLEAR = 0x4,
/* write action */
ENB_AGENT_ACTION_WRITE = 0x8,
/* filter action */
ENB_AGENT_ACTION_FILTER = 0x10,
/* preprocess action */
ENB_AGENT_ACTION_PREPROCESS = 0x20,
/* meter action */
ENB_AGENT_ACTION_METER = 0x40,
/* Max number of states available */
ENB_AGENT_ACTION_MAX = 0x7f,
} agent_action_t;
typedef enum {
RAN_LTE_OAI= 0,
/* Max number of states available */
RAN_NAME_MAX = 0x7f,
} ran_name_t;
typedef uint8_t xid_t;
typedef uint8_t mid_t; // module or enb id
typedef uint8_t lcid_t;
typedef int32_t err_code_t;
typedef struct {
/* general info */
/* stats */
uint32_t total_rx_msg;
uint32_t total_tx_msg;
uint32_t rx_msg[NUM_MAX_ENB];
uint32_t tx_msg[NUM_MAX_ENB];
}enb_agent_info_t;
typedef struct {
mid_t enb_id;
enb_agent_info_t agent_info;
}enb_agent_instance_t;
#endif
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2016 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file ENB_APP/extern.h
* \brief enb agent - mac interface primitives
* \author Xenofon Foukas
* \date 2016
* \version 0.1
* \mail x.foukas@sms.ed.ac.uk
*/
#ifndef __ENB_AGENT_EXTERN_H__
#define __ENB_AGENT_EXTERN_H__
#include "enb_agent_defs.h"
#include "enb_agent_mac_defs.h"
//extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX];
extern char local_cache[40];
extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
extern unsigned int mac_agent_registered[NUM_MAX_ENB];
#endif
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file enb_agent_handler.c
* \brief enb agent tx and rx message handler
* \author Navid Nikaein and Xenofon Foukas
* \date 2016
* \version 0.1
*/
#include "enb_agent_common.h"
#include "enb_agent_mac.h"
#include "log.h"
#include "assertions.h"
enb_agent_message_decoded_callback agent_messages_callback[][3] = {
{enb_agent_hello, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/
{enb_agent_echo_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/
{0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply
{enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/
{0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/
{0, 0, 0}, /*PROTOCOK__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/
{0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/
{enb_agent_enb_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/
{0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG*/
{enb_agent_ue_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/
{0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/
{enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/
{0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/
{enb_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/
{0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/
{enb_agent_control_delegation, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/
};
enb_agent_message_destruction_callback message_destruction_callback[] = {
enb_agent_destroy_hello,
enb_agent_destroy_echo_request,
enb_agent_destroy_echo_reply,
enb_agent_mac_destroy_stats_request,
enb_agent_mac_destroy_stats_reply,
enb_agent_mac_destroy_sf_trigger,
enb_agent_mac_destroy_sr_info,
enb_agent_destroy_enb_config_request,
enb_agent_destroy_enb_config_reply,
enb_agent_destroy_ue_config_request,
enb_agent_destroy_ue_config_reply,
enb_agent_destroy_lc_config_request,
enb_agent_destroy_lc_config_reply,
enb_agent_mac_destroy_dl_config,
enb_agent_destroy_ue_state_change,
enb_agent_destroy_control_delegation,
};
static const char *enb_agent_direction2String[] = {
"", /* not_set */
"originating message", /* originating message */
"successfull outcome", /* successfull outcome */
"unsuccessfull outcome", /* unsuccessfull outcome */
};
Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id,
uint8_t *data,
uint32_t size){
Protocol__ProgranMessage *decoded_message, *reply_message;
err_code_t err_code;
DevAssert(data != NULL);
if (enb_agent_deserialize_message(data, size, &decoded_message) < 0) {
err_code= PROTOCOL__PROGRAN_ERR__MSG_DECODING;
goto error;
}
if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) ||
(decoded_message->msg_dir > PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){
err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_HANDLED;
goto error;
}
if (agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) {
err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_SUPPORTED;
goto error;
}
err_code = ((*agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message));
if ( err_code < 0 ){
goto error;
} else if (err_code == 1) { //If err_code > 1, we do not want to dispose the message yet
protocol__progran_message__free_unpacked(decoded_message, NULL);
}
return reply_message;
error:
LOG_E(ENB_AGENT,"errno %d occured\n",err_code);
return NULL;
}
void * enb_agent_pack_message(Protocol__ProgranMessage *msg,
uint32_t * size){
void * buffer;
err_code_t err_code = PROTOCOL__PROGRAN_ERR__NO_ERR;
if (enb_agent_serialize_message(msg, &buffer, size) < 0 ) {
err_code = PROTOCOL__PROGRAN_ERR__MSG_ENCODING;
goto error;
}
// free the msg --> later keep this in the data struct and just update the values
//TODO call proper destroy function
err_code = ((*message_destruction_callback[msg->msg_case-1])(msg));
DevAssert(buffer !=NULL);
LOG_D(ENB_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size);
return buffer;
error :
LOG_E(ENB_AGENT,"errno %d occured\n",err_code);
return NULL;
}
Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args) {
err_code_t err_code;
enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args;
Protocol__ProgranMessage *timed_task, *reply_message;
timed_task = timer_args->msg;
err_code = ((*agent_messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message));
if ( err_code < 0 ){
goto error;
}
return reply_message;
error:
LOG_E(ENB_AGENT,"errno %d occured\n",err_code);
return NULL;
}
Protocol__ProgranMessage* enb_agent_process_timeout(long timer_id, void* timer_args){
struct enb_agent_timer_element_s *found = get_timer_entry(timer_id);
if (found == NULL ) goto error;
LOG_I(ENB_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id);
if (timer_args == NULL)
LOG_W(ENB_AGENT,"null timer args\n");
return found->cb(timer_args);
error:
LOG_E(ENB_AGENT, "can't get the timer element\n");
return TIMER_ELEMENT_NOT_FOUND;
}
err_code_t enb_agent_destroy_progran_message(Protocol__ProgranMessage *msg) {
return ((*message_destruction_callback[msg->msg_case-1])(msg));
}
This diff is collapsed.
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file enb_agent_mac.h
* \brief enb agent message handler APIs for MAC layer
* \author Navid Nikaein and Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_MAC_H_
#define ENB_AGENT_MAC_H_
#include "header.pb-c.h"
#include "progran.pb-c.h"
#include "stats_messages.pb-c.h"
#include "stats_common.pb-c.h"
#include "enb_agent_common.h"
#include "enb_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
ProgRAN 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
ProgRAN 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 enb_agent_init_mac_agent(mid_t mod_id);
int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg);
int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__ProgranMessage **msg);
int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg);
int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg);
int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg);
int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg);
int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg);
int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg);
int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg);
int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage **msg);
int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg);
int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg);
/**********************************
* eNB agent - technology mac API
**********************************/
/*Inform controller about received scheduling requests during a subframe*/
void enb_agent_send_sr_info(mid_t mod_id);
/*Inform the controller about the current UL/DL subframe*/
void enb_agent_send_sf_trigger(mid_t mod_id);
/// Send to the controller all the mac stat updates that occured during this subframe
/// based on the stats request configuration
void enb_agent_send_update_mac_stats(mid_t mod_id);
/// Provide to the scheduler a pending dl_mac_config message
void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__ProgranMessage **msg);
/*Register technology specific interface callbacks*/
int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface);
/*Unregister technology specific callbacks*/
int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface*xface);
#endif
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2016 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file enb_agent_mac_defs.h
* \brief enb agent - mac interface primitives
* \author Xenofon Foukas
* \date 2016
* \version 0.1
* \mail x.foukas@sms.ed.ac.uk
*/
#ifndef __ENB_AGENT_MAC_PRIMITIVES_H__
#define __ENB_AGENT_MAC_PRIMITIVES_H__
#include "enb_agent_defs.h"
#include "progran.pb-c.h"
#include "header.pb-c.h"
#define RINGBUFFER_SIZE 100
/* ENB AGENT-MAC Interface */
typedef struct {
//msg_context_t *agent_ctxt;
/// Inform the controller about the scheduling requests received during the subframe
void (*enb_agent_send_sr_info)(mid_t mod_id);
/// Inform the controller about the current UL/DL subframe
void (*enb_agent_send_sf_trigger)(mid_t mod_id);
/// Send to the controller all the mac stat updates that occured during this subframe
/// based on the stats request configuration
void (*enb_agent_send_update_mac_stats)(mid_t mod_id);
/// Provide to the scheduler a pending dl_mac_config message
void (*enb_agent_get_pending_dl_mac_config)(mid_t mod_id,
Protocol__ProgranMessage **msg);
/// Run the UE DL scheduler and fill the Protocol__ProgranMessage. Assumes that
/// dl_info is already initialized as prp_dl_mac_config and fills the
/// prp_dl_data part of it
void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe,
int *mbsfn_flag, Protocol__ProgranMessage **dl_info);
/// Notify the controller for a state change of a particular UE, by sending the proper
/// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER)
void (*enb_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti,
uint32_t state_change);
/*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/
} AGENT_MAC_xface;
#endif
This diff is collapsed.
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file enb_agent_mac_internal.h
* \brief Implementation specific definitions for the eNB MAC agent
* \author Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_MAC_INTERNAL_H_
#define ENB_AGENT_MAC_INTERNAL_H_
#include <pthread.h>
#include "enb_agent_mac.h"
#include "enb_agent_common.h"
/*This will be used for producing continuous status updates for the MAC
*Needs to be thread-safe
*/
typedef struct {
/*Flag showing if continuous mac stats update is enabled*/
uint8_t is_initialized;
volatile uint8_t cont_update;
xid_t xid;
Protocol__ProgranMessage *stats_req;
Protocol__ProgranMessage *prev_stats_reply;
pthread_mutex_t *mutex;
} mac_stats_updates_context_t;
/*Array holding the last stats reports for each eNB. Used for continuous reporting*/
mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB];
/*Functions to initialize and destroy the struct required for the
*continuous stats update report*/
err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id);
err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id);
/*Enable/Disable the continuous stats update service for the MAC*/
err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, xid_t xid,
stats_request_config_t *stats_req);
err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id);
Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__ProgranMessage *new_report,
Protocol__ProgranMessage *old_report);
Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * original);
Protocol__PrpCellStatsReport * copy_cell_stats_report(Protocol__PrpCellStatsReport *original);
Protocol__PrpRlcBsr * copy_rlc_report(Protocol__PrpRlcBsr * original);
Protocol__PrpUlCqiReport * copy_ul_cqi_report(Protocol__PrpUlCqiReport * original);
Protocol__PrpDlCqiReport * copy_dl_cqi_report(Protocol__PrpDlCqiReport * original);
Protocol__PrpPagingBufferReport * copy_paging_buffer_report(Protocol__PrpPagingBufferReport *original);
Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original);
Protocol__PrpNoiseInterferenceReport * copy_noise_inter_report(Protocol__PrpNoiseInterferenceReport *original);
int compare_ue_stats_reports(Protocol__PrpUeStatsReport *rep1,
Protocol__PrpUeStatsReport *rep2);
int compare_cell_stats_reports(Protocol__PrpCellStatsReport *rep1,
Protocol__PrpCellStatsReport *rep2);
#endif /*ENB_AGENT_MAC_INTERNAL_H_*/
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2016 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file enb_agent_net_comm.c
* \brief enb agent network interface abstraction
* \author Xenofon Foukas
* \date 2016
* \version 0.1
*/
#include "enb_agent_net_comm.h"
#include "log.h"
enb_agent_channel_t *agent_channel[NUM_MAX_ENB][ENB_AGENT_MAX];
enb_agent_channel_instance_t channel_instance;
int enb_agent_channel_id = 0;
int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority) {
/*Check if agent id is valid*/
if (agent_id >= ENB_AGENT_MAX || agent_id < 0) {
goto error;
}
enb_agent_channel_t *channel;
channel = agent_channel[mod_id][agent_id];
/*Check if agent has a channel registered*/
if (channel == NULL) {
goto error;
}
return channel->msg_send(data, size, priority, channel->channel_info);
error:
LOG_E(ENB_AGENT, "No channel registered for agent with id %d\n", agent_id);
return -1;
}
int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority) {
/*Check if agent id is valid*/
if (agent_id >= ENB_AGENT_MAX || agent_id < 0) {
goto error;
}
enb_agent_channel_t *channel;
channel = agent_channel[mod_id][agent_id];
/*Check if agent has a channel registered*/
if (channel == NULL) {
goto error;
}
return channel->msg_recv(data, size, priority, channel->channel_info);
error:
LOG_E(ENB_AGENT, "No channel registered for agent with id %d\n", agent_id);
return -1;
}
int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent_id_t agent_id) {
int i;
if (channel == NULL) {
return -1;
}
if (agent_id == ENB_AGENT_MAX) {
for (i = 0; i < ENB_AGENT_MAX; i++) {
agent_channel[mod_id][i] = channel;
}
} else {
agent_channel[mod_id][agent_id] = channel;
}
return 0;
}
void enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) {
int i;
if (agent_id == ENB_AGENT_MAX) {
for (i = 0; i < ENB_AGENT_MAX; i++) {
agent_channel[mod_id][i] = NULL;
}
} else {
agent_channel[mod_id][agent_id] = NULL;
}
}
int enb_agent_create_channel(void *channel_info,
int (*msg_send)(void *data, int size, int priority, void *channel_info),
int (*msg_recv)(void **data, int *size, int *priority, void *channel_info),
void (*release)(enb_agent_channel_t *channel)) {
int channel_id = ++enb_agent_channel_id;
enb_agent_channel_t *channel = (enb_agent_channel_t *) malloc(sizeof(enb_agent_channel_t));
channel->channel_id = channel_id;
channel->channel_info = channel_info;
channel->msg_send = msg_send;
channel->msg_recv = msg_recv;
channel->release = release;
/*element should be a real pointer*/
RB_INSERT(enb_agent_channel_map, &channel_instance.enb_agent_head, channel);
LOG_I(ENB_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id);
return channel_id;
}
int enb_agent_destroy_channel(int channel_id) {
int i, j;
/*Check to see if channel exists*/
struct enb_agent_channel_s *e = NULL;
struct enb_agent_channel_s search;
memset(&search, 0, sizeof(struct enb_agent_channel_s));
e = RB_FIND(enb_agent_channel_map, &channel_instance.enb_agent_head, &search);
if (e == NULL) {
return -1;
}
/*Unregister the channel from all agents*/
for (i = 0; i < NUM_MAX_ENB; i++) {
for (j = 0; j < ENB_AGENT_MAX; j++) {
if (agent_channel[i][j] != NULL) {
if (agent_channel[i][j]->channel_id == e->channel_id) {
agent_channel[i][j] == NULL;
}
}
}
}
/*Remove the channel from the tree and free memory*/
RB_REMOVE(enb_agent_channel_map, &channel_instance.enb_agent_head, e);
e->release(e);
free(e);
return 0;
}
err_code_t enb_agent_init_channel_container(void) {
int i, j;
LOG_I(ENB_AGENT, "init RB tree for channel container\n");
RB_INIT(&channel_instance.enb_agent_head);
for (i = 0; i < NUM_MAX_ENB; i++) {
for (j = 0; j < ENB_AGENT_MAX; j++) {
agent_channel[i][j] == NULL;
}
}
return 0;
}
RB_GENERATE(enb_agent_channel_map,enb_agent_channel_s, entry, enb_agent_compare_channel);
int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_channel_s *b) {
if (a->channel_id < b->channel_id) return -1;
if (a->channel_id > b->channel_id) return 1;
// equal timers
return 0;
}
enb_agent_channel_t * get_channel(int channel_id) {
struct enb_agent_channel_s search;
memset(&search, 0, sizeof(struct enb_agent_channel_s));
search.channel_id = channel_id;
return RB_FIND(enb_agent_channel_map, &channel_instance.enb_agent_head, &search);
}
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2016 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file enb_agent_net_comm.h
* \brief enb agent network interface abstraction
* \autho Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_NET_COMM_H_
#define ENB_AGENT_NET_COMM_H_
#include "enb_agent_defs.h"
#include "tree.h"
/*Channel related information used for Tx/Rx of protocol messages*/
typedef struct enb_agent_channel_s {
RB_ENTRY(enb_agent_channel_s) entry;
int channel_id;
void *channel_info;
/*Callbacks for channel message Tx and Rx*/
int (*msg_send)(void *data, int size, int priority, void *channel_info);
int (*msg_recv)(void **data, int *size, int *priority, void *channel_info);
void (*release)(struct enb_agent_channel_s *channel);
} enb_agent_channel_t;
typedef struct enb_agent_channel_instance_s{
RB_HEAD(enb_agent_channel_map, enb_agent_channel_s) enb_agent_head;
} enb_agent_channel_instance_t;
/*Send and receive messages using the channel registered for a specific agent*/
int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority);
int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority);
/*Register a channel to an agent. Use ENB_AGENT_MAX to register the
*same channel to all agents*/
int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent_id_t agent_id);
/*Unregister the current channel of an agent. Use ENB_AGENT_MAX to unregister all channels*/
void enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id);
/*Create a new channel. Returns the id of the new channel or negative number otherwise*/
int enb_agent_create_channel(void *channel_info,
int (*msg_send)(void *data, int size, int priority, void *channel_info),
int (*msg_recv)(void **data, int *size, int *priority, void *channel_info),
void (*release)(enb_agent_channel_t *channel));
/*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/
int enb_agent_destroy_channel(int channel_id);
/*Return an agent communication channel based on its id*/
enb_agent_channel_t * get_channel(int channel_id);
/*Should be called before performing any channel operations*/
err_code_t enb_agent_init_channel_container(void);
int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_channel_s *b);
/* RB_PROTOTYPE is for .h files */
RB_PROTOTYPE(enb_agent_channel_map, enb_agent_channel_s, entry, enb_agent_compare_channel);
#endif /*ENB_AGENT_COMM_H_*/
This diff is collapsed.
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2015 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/*! \file enb_agent_task_manager.h
* \brief Implementation of scheduled tasks manager for the enb agent
* \author Xenofon Foukas
* \date January 2016
* \version 0.1
* \email: x.foukas@sms.ed.ac.uk
* @ingroup _mac
*/
#ifndef ENB_AGENT_TASK_MANAGER_
#define ENB_AGENT_TASK_MANAGER_
#include <stdint.h>
#include <pthread.h>
#include "progran.pb-c.h"
#include "enb_agent_common.h"
#ifdef __cplusplus
extern "C" {
#endif
#define DEFAULT_CAPACITY 512
/**
* The structure containing the enb agent task to be executed
*/
typedef struct enb_agent_task_s {
/* The frame in which the task needs to be executed */
uint16_t frame_num;
/* The subframe in which the task needs to be executed */
uint8_t subframe_num;
/* The task to be executed in the form of a Protocol__ProgranMessage */
Protocol__ProgranMessage *task;
} enb_agent_task_t;
/**
* Priority Queue Structure for tasks
*/
typedef struct enb_agent_task_queue_s {
mid_t mod_id;
/* The amount of allocated memory for agent tasks in the heap*/
volatile size_t capacity;
/* The actual size of the tasks heap at a certain time */
volatile size_t count;
/* The earliest frame that has a pending task */
volatile uint16_t first_frame;
/* The earliest subframe within the frame that has a pending task */
volatile uint8_t first_subframe;
/* An array of prioritized tasks stored in a heap */
enb_agent_task_t **task;
/* A pointer to a comparator function, used to prioritize elements */
int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2);
pthread_mutex_t *mutex;
} enb_agent_task_queue_t;
typedef enum {
HEAP_OK = 0,
HEAP_EMPTY,
HEAP_FAILED,
HEAP_REALLOCERROR,
HEAP_NOREALLOC,
HEAP_FATAL,
} heapstatus_e;
/**
* Allocate memory for a task in the queue
*/
enb_agent_task_t *enb_agent_task_create(Protocol__ProgranMessage *msg,
uint16_t frame_num, uint8_t subframe_num);
/**
* Free memory for a task of the queue
*/
void enb_agent_task_destroy(enb_agent_task_t *task);
/**
* Allocate initial memory for storing the tasks
*/
enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity,
int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2));
/**
* Allocate initial memory for storing the tasks using default parameters
*/
enb_agent_task_queue_t *enb_agent_task_queue_default_init(mid_t mod_id);
/**
* De-allocate memory for the tasks queue
*/
void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue);
/**
* Insert task into the queue
*/
int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *task);
/**
* Remove the task with the highest priority from the queue
* task becomes NULL if there is no task for the current frame and subframe
*/
int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task);
/**
* Check if the top priority task is for a specific frame and subframe
*/
int enb_agent_task_queue_has_upcoming_task (enb_agent_task_queue_t *queue,
const uint16_t frame, const uint8_t subframe);
/**
* Restructure heap after modifications
*/
void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx);
/**
* Reallocate memory once the heap reaches max size
*/
int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue);
/**
* Compare two agent tasks based on frame and subframe
* returns 0 if tasks t1, t2 have the same priority
* return negative value if t1 needs to be executed after t2
* return positive value if t1 preceeds t2
* Need to give eNB id for the comparisson based on the current frame-subframe
*/
int _enb_agent_task_queue_cmp(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2);
#ifdef __cplusplus
}
#endif
#endif /*ENB_AGENT_TASK_MANAGER_*/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment