Commit b74bab25 authored by Raymond Knopp's avatar Raymond Knopp

Merge remote-tracking branch 'origin/develop' into develop-nos1-fixes

parents b6b86292 a2d16b34
......@@ -241,6 +241,7 @@ add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs
add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace")
add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace")
add_boolean_option(DISABLE_LOG_X False "Deactivate all LOG_* macros")
add_boolean_option(USRP_REC_PLAY False "Enable USRP record playback mode")
add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
......
......@@ -66,6 +66,7 @@ UE_AUTOTEST_TRACE="False"
UE_DEBUG_TRACE="False"
UE_TIMING_TRACE="False"
DISABLE_LOG_X="False"
USRP_REC_PLAY="False"
BUILD_ECLIPSE=0
trap handle_ctrl_c INT
......@@ -158,6 +159,8 @@ Options
Disable all LOG_* macros
--build-eclipse
Build eclipse project files. Paths are auto corrected by fixprj.sh
--usrp-recplay
Build for I/Q record-playback modes
Usage (first build):
oaisim (eNB + UE): ./build_oai -I --oaisim -x --install-system-files
Eurecom EXMIMO + COTS UE : ./build_oai -I --eNB -x --install-system-files
......@@ -350,6 +353,10 @@ function main() {
BUILD_TELNETSRV=1
echo_info "Build embedded telnet server"
shift ;;
--usrp-recplay)
USRP_REC_PLAY="True"
echo_info "Enabling USRP record playback mode"
shift 1;;
-h | --help)
print_help
exit 1;;
......@@ -540,6 +547,7 @@ function main() {
echo "set (UE_DEBUG_TRACE $UE_DEBUG_TRACE)" >> $cmake_file
echo "set (UE_TIMING_TRACE $UE_TIMING_TRACE)" >> $cmake_file
echo "set (DISABLE_LOG_X $DISABLE_LOG_X)" >> $cmake_file
echo "set (USRP_REC_PLAY $USRP_REC_PLAY)" >> $cmake_file
if [ "$UE" = 1 -a "$NOS1" = "0" ] ; then
echo_info "Compiling UE S1 build : enabling Linux and NETLINK"
echo "set (LINUX True )" >> $cmake_file
......
......@@ -153,5 +153,5 @@ int config_isparamset(paramdef_t *params,int paramidx)
}
int config_getparamval_fromparamdefidx(paramdef_t *cfgoptions,int paramidx) {
return -1;
}
......@@ -1871,6 +1871,23 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
eNB->pucch1ab_stats_cnt[j][i]=0;
}
}
#if defined(USRP_REC_PLAY)
// It's probably bad to do this statically only once.
// Looks like the above is incomplete.
// Such reset needs to be done once a UE PHY structure is being used/re-used
// Don't know if this is ever possible in current architecture
for (i=0;i<10240;i++) {
for (j=0;j<NUMBER_OF_UE_MAX;j++) {
eNB->pucch1_stats[j][i]=0;
eNB->pucch1_stats_thres[j][i]=0;
}
}
for (i=0;i<20480;i++) {
for (j=0;j<NUMBER_OF_UE_MAX;j++) {
eNB->pucch1ab_stats[j][i]=0;
}
}
#endif
first_call=0;
}
......@@ -2152,8 +2169,9 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
} //phase
// stat_max *= nsymb; // normalize to energy per symbol
// stat_max /= (frame_parms->N_RB_UL*12); //
// stat_max /= (frame_parms->N_RB_UL*12); //
stat_max /= (nsymb*12);
#ifdef DEBUG_PUCCH_RX
printf("[eNB] PUCCH: stat %d, stat_max %d, phase_max %d\n", stat,stat_max,phase_max);
#endif
......@@ -2289,8 +2307,13 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
stat_im=0;
// Do detection now
#if defined(USRP_REC_PLAY)
// It looks like the value is a bit messy when RF is replayed.
// For instance i assume to skip pucch1_thres from the test below.
if (sigma2_dB<(dB_fixed(stat_max))) {//
#else
if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres)) {//
#endif
chL = (nsymb>>1)-4;
chest_mag=0;
cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase_max] : &cfo_pucch_ep[12*phase_max];
......@@ -2431,7 +2454,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
if (fmt==pucch_format1b)
*(1+payload) = (stat_im<0) ? 1 : 2;
} else { // insufficient energy on PUCCH so NAK
#if defined(USRP_REC_PLAY)
LOG_I(PHY,"PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
#else
LOG_I(PHY,"PUCCH 1a/b: subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
#endif
*payload = 4; // DTX
((int16_t*)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re);
((int16_t*)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im);
......
......@@ -128,7 +128,11 @@
/*!\brief Maximum number od control elemenets */
#define MAX_NUM_CE 5
/*!\brief Maximum number of random access process */
#if defined(USRP_REC_PLAY)
#define NB_RA_PROC_MAX 1
#else
#define NB_RA_PROC_MAX 4
#endif
/*!\brief size of buffer status report table */
#define BSR_TABLE_SIZE 64
/*!\brief The power headroom reporting range is from -23 ...+40 dB and beyond, with step 1 */
......
......@@ -352,17 +352,17 @@ schedule_SR(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
ul_req =
&RC.mac[module_idP]->UL_req[CC_id].ul_config_request_body;
// drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet
if (mac_eNB_get_rrc_status
(module_idP, UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED)
continue;
AssertFatal(UE_list->
UE_template[CC_id][UE_id].physicalConfigDedicated
!= NULL,
"physicalConfigDedicated is null for UE %d\n",
UE_id);
// drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet
if (mac_eNB_get_rrc_status
(module_idP, UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED)
continue;
if ((SRconfig =
UE_list->
UE_template[CC_id][UE_id].physicalConfigDedicated->
......
......@@ -1579,7 +1579,25 @@ initiate_ra_proc(module_id_t module_idP,
ra[i].Msg2_subframe = (subframeP + 4) % 10;
/* TODO: find better procedure to allocate RNTI */
do {
#if defined(USRP_REC_PLAY) // deterministic rnti in usrp record/playback mode
static int drnti[NUMBER_OF_UE_MAX] = { 0xbda7, 0x71da, 0x9c40, 0xc350, 0x2710, 0x4e20, 0x7530, 0x1388, 0x3a98, 0x61a8, 0x88b8, 0xafc8, 0xd6d8, 0x1b58, 0x4268, 0x6978 };
int j = 0;
int nb_ue = 0;
for (j = 0; j < NUMBER_OF_UE_MAX; j++) {
if (UE_RNTI(module_idP, j) > 0) {
nb_ue++;
} else {
break;
}
}
if (nb_ue >= NUMBER_OF_UE_MAX) {
printf("No more free RNTI available, increase NUMBER_OF_UE_MAX\n");
abort();
}
ra[i].rnti = drnti[nb_ue];
#else
ra[i].rnti = taus();
#endif
loop++;
}
while (loop != 100 &&
......
......@@ -1349,9 +1349,14 @@ fill_nfapi_harq_information(module_id_t module_idP,
AssertFatal(UE_id >= 0, "UE_id cannot be found, impossible\n");
AssertFatal(UE_list != NULL, "UE_list is null\n");
#if 0
/* TODO: revisit, don't use Assert, it's perfectly possible to
* have physicalConfigDedicated NULL here
*/
AssertFatal(UE_list->UE_template[CC_idP][UE_id].
physicalConfigDedicated != NULL,
"physicalConfigDedicated for rnti %x is null\n", rntiP);
#endif
harq_information->harq_information_rel11.num_ant_ports = 1;
......@@ -2057,6 +2062,9 @@ int add_new_ue(module_id_t mod_idP, int cc_idP, rnti_t rntiP, int harq_pidP
UE_list->ordered_ULCCids[0][UE_id] = cc_idP;
UE_list->num_UEs++;
UE_list->active[UE_id] = TRUE;
#if defined(USRP_REC_PLAY) // not specific to record/playback ?
UE_list->UE_template[cc_idP][UE_id].pre_assigned_mcs_ul = 0;
#endif
#ifdef Rel14
UE_list->UE_template[cc_idP][UE_id].rach_resource_type =
......@@ -3585,11 +3593,9 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
uint8_t *pdu;
#ifdef Rel14
AssertFatal(UE_list->
UE_template[pCCid][UE_id].physicalConfigDedicated->
pucch_ConfigDedicated != NULL,
"pucch_ConfigDedicated is null!\n");
if ((UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7)
if (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated != NULL &&
UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL &&
(UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7)
&& (UE_list->UE_template[pCCid][UE_id].
physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13)
&&
......
......@@ -268,6 +268,9 @@ rx_sdu(const module_id_t enb_mod_idP,
"[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n",
enb_mod_idP, frameP, subframeP, CC_idP, rx_ces[i], i,
num_ce, old_rnti, old_UE_id);
/* receiving CRNTI means that the current rnti has to go away */
cancel_ra_proc(enb_mod_idP, CC_idP, frameP,
current_rnti);
if (old_UE_id != -1) {
/* TODO: if the UE did random access (followed by a MAC uplink with
* CRNTI) because none of its scheduling request was granted, then
......@@ -288,9 +291,6 @@ rx_sdu(const module_id_t enb_mod_idP,
mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP,
subframeP, old_rnti);
}
/* receiving CRNTI means that the current rnti has to go away */
cancel_ra_proc(enb_mod_idP, CC_idP, frameP,
current_rnti);
current_rnti = old_rnti;
}
crnti_rx = 1;
......
......@@ -210,7 +210,7 @@ void mac_init_cell_params(int Mod_idP, int CC_idP)
UE_TEMPLATE *UE_template;
LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_eNB][MOD %02d][]\n", Mod_idP);
COMMON_channels_t *cc = &RC.mac[Mod_idP]->common_channels[CC_idP];
//COMMON_channels_t *cc = &RC.mac[Mod_idP]->common_channels[CC_idP];
memset(&RC.mac[Mod_idP]->eNB_stats, 0, sizeof(eNB_STATS));
UE_template =
......
......@@ -220,7 +220,7 @@ pdcp_validate_security(
stream_decrypt(pdcp_pP->cipheringAlgorithm,
&decrypt_params,
&buffer_decrypted);
#if !defined(USRP_REC_PLAY)
if (srb_flagP) {
/* Now check the integrity of the complete PDU */
decrypt_params.message = pdcp_pdu_buffer;
......@@ -241,7 +241,7 @@ pdcp_validate_security(
return -1;
}
}
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT);
return 0;
......
......@@ -242,7 +242,11 @@ typedef enum HO_STATE_e {
// #define NUM_MAX_CBA_GROUP 4 // in the platform_constants
/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */
#if defined(USRP_REC_PLAY)
#define RRC_TRANSACTION_IDENTIFIER_NUMBER 1
#else
#define RRC_TRANSACTION_IDENTIFIER_NUMBER 3
#endif
typedef struct {
unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */
......
......@@ -390,8 +390,10 @@ rrc_pdcp_config_security(
ue_context_pP->ue_context.kenb,
&kRRCint);
#if !defined(USRP_REC_PLAY)
#define DEBUG_SECURITY 1
#endif
#if defined (DEBUG_SECURITY)
#undef msg
#define msg printf
......
......@@ -207,6 +207,15 @@ typedef struct {
int iq_rxrescale;
//! Configuration file for LMS7002M
char *configFilename;
#if defined(USRP_REC_PLAY)
unsigned short sf_mode; // 1=record, 2=replay
char sf_filename[1024]; // subframes file path
unsigned int sf_max; // max number of recorded subframes
unsigned int sf_loops; // number of loops in replay mode
unsigned int sf_read_delay; // read delay in replay mode
unsigned int sf_write_delay; // write delay in replay mode
unsigned int eth_mtu; // ethernet MTU
#endif
} openair0_config_t;
/*! \brief RF mapping */
......
#ifndef __USRP_LIB_H
#define __USRP_LIB_H
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/** usrp_lib.h
*
* \author: bruno.mongazon-cazavet@nokia-bell-labs.com
*/
#if defined (USRP_REC_PLAY)
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "common/config/config_paramdesc.h"
#include "common/config/config_userapi.h"
#define BELL_LABS_IQ_HEADER 0xabababababababab
#define BELL_LABS_IQ_PER_SF 7680 // Up to 5MHz bw for now
#define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4)
typedef struct {
int64_t header;
int64_t ts;
int64_t rfu1;
int64_t rfu2; // pad for 256 bits alignement required by AVX2
unsigned char samples[BELL_LABS_IQ_BYTES_PER_SF]; // iq's for one subframe
} iqrec_t;
#define DEF_NB_SF 120000 // default nb of sf or ms to capture (2 minutes at 5MHz)
#define DEF_SF_FILE "/home/nokia/iqfile" // default subframes file name
#define DEF_SF_DELAY_READ 400 // default read delay µs (860=real)
#define DEF_SF_DELAY_WRITE 15 // default write delay µs (15=real)
#define DEF_SF_NB_LOOP 5 // default nb loops
/* help strings definition for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
#define CONFIG_HLP_SF_FILE "Path of the file used for subframes record or replay"
#define CONFIG_HLP_SF_REC "Record subframes from USRP driver into a file for later replay"
#define CONFIG_HLP_SF_REP "Replay subframes into USRP driver from a file"
#define CONFIG_HLP_SF_MAX "Maximum count of subframes to be recorded in subframe file"
#define CONFIG_HLP_SF_LOOPS "Number of loops to replay of the entire subframes file"
#define CONFIG_HLP_SF_RDELAY "Delay in microseconds to read a subframe in replay mode"
#define CONFIG_HLP_SF_WDELAY "Delay in microseconds to write a subframe in replay mode"
/* keyword strings for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
#define CONFIG_OPT_SF_FILE "subframes-file"
#define CONFIG_OPT_SF_REC "subframes-record"
#define CONFIG_OPT_SF_REP "subframes-replay"
#define CONFIG_OPT_SF_MAX "subframes-max"
#define CONFIG_OPT_SF_LOOPS "subframes-loops"
#define CONFIG_OPT_SF_RDELAY "subframes-read-delay"
#define CONFIG_OPT_SF_WDELAY "subframes-write-delay"
/* For information only - the macro is not usable in C++ */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for USRP record/playback */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define USRP_RECPLAY_PARAMS_DESC { \
{"subframes-file", CONFIG_HLP_SF_FILE, 0, strptr:(char **)&u_sf_filename, defstrval:DEF_SF_FILE, TYPE_STRING, sizeof(u_sf_filename)}, \
{"subframes-record", CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&u_sf_record, defuintval:0, TYPE_UINT, 0}, \
{"subframes-replay", CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&u_sf_replay, defuintval:0, TYPE_UINT, 0}, \
{"subframes-max", CONFIG_HLP_SF_MAX, 0, uptr:&u_sf_max, defintval:DEF_NB_SF, TYPE_UINT, 0}, \
{"subframes-loops", CONFIG_HLP_SF_LOOPS, 0, uptr:&u_sf_loops, defintval:DEF_SF_NB_LOOP, TYPE_UINT, 0}, \
{"subframes-read-delay", CONFIG_HLP_SF_RDELAY, 0, uptr:&u_sf_read_delay, defintval:DEF_SF_DELAY_READ, TYPE_UINT, 0}, \
{"subframes-write-delay", CONFIG_HLP_SF_WDELAY, 0, uptr:&u_sf_write_delay, defintval:DEF_SF_DELAY_WRITE, TYPE_UINT, 0}, \
}
#endif // BELL_LABS_MUST
#endif // __USRP_LIB_H
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