From 6da3f494f4daaf0696a929746807e6768164122f Mon Sep 17 00:00:00 2001
From: Laurent THOMAS <laurent.thomas@open-cells.com>
Date: Fri, 5 Aug 2016 15:26:36 +0200
Subject: [PATCH] update nettle to new interface, update deadline scheduler
option (doesnt compile without this), update build/install script to use
regular nettle and gnutls in ubuntu 16.04 (should also be fine with 14.04
up-to-date), update init_exmimo2 for ubuntu 16.04)
---
cmake_targets/tools/build_helper | 11 ++++++++---
cmake_targets/tools/init_exmimo2 | 8 --------
openair2/UTIL/OSA/osa_stream_eea.c | 2 +-
openair3/SECU/nas_stream_eea2.c | 2 +-
openair3/TEST/test_aes128_ctr_decrypt.c | 2 +-
targets/RT/USER/lte-enb.c | 18 ++++++++++--------
6 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index 4738acb7f3..8dbdd33823 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -386,9 +386,14 @@ check_install_oai_software() {
$SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
# First we remove gnutls/nettle installation and then install from sources
- $SUDO apt-get remove -y libgnutls-dev nettle-dev nettle-bin
- install_nettle_from_source
- install_gnutls_from_source
+ v=$(lsb_release -ris | tr -d '\n')
+ if [ "$v" == Ubuntu16.04 ] ; then
+ $SUDO apt-get install libgnutls-dev nettle-dev nettle-bin
+ else
+ $SUDO apt-get remove -y libgnutls-dev nettle-dev nettle-bin
+ install_nettle_from_source
+ install_gnutls_from_source
+ fi
install_asn1c_from_source
}
diff --git a/cmake_targets/tools/init_exmimo2 b/cmake_targets/tools/init_exmimo2
index 66eedf93dd..363e42ea25 100755
--- a/cmake_targets/tools/init_exmimo2
+++ b/cmake_targets/tools/init_exmimo2
@@ -71,15 +71,7 @@ if [ ! -e /dev/openair0 ]; then
sudo chmod a+rw /dev/openair0
fi
-DEVICE=`echo $PCI | awk -F\" '{print $(NF-1)}' | awk '{print $2}'`
-DEVICE_SWID=${DEVICE:2:2}
-if [ $DEVICE_SWID == '0a' ]; then
- echo "Using firware version 10"
$OPENAIR_DIR/targets/bin/updatefw -s 0x43fffff0 -b -f $OPENAIR_TARGETS/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/sdr_expressmimo2_v10
-else
- echo 'No corresponding firmware found'
- return
-fi
}
main "$@"
diff --git a/openair2/UTIL/OSA/osa_stream_eea.c b/openair2/UTIL/OSA/osa_stream_eea.c
index 8e346631ec..acd341232e 100644
--- a/openair2/UTIL/OSA/osa_stream_eea.c
+++ b/openair2/UTIL/OSA/osa_stream_eea.c
@@ -199,7 +199,7 @@ int stream_encrypt_eea2(stream_cipher_t *stream_cipher, uint8_t **out)
}
#endif
- nettle_aes128.set_encrypt_key(ctx, stream_cipher->key_length,
+ nettle_aes128.set_encrypt_key(ctx,
stream_cipher->key);
nettle_ctr_crypt(ctx, nettle_aes128.encrypt,
diff --git a/openair3/SECU/nas_stream_eea2.c b/openair3/SECU/nas_stream_eea2.c
index 25ef340f4e..799aaaf432 100644
--- a/openair3/SECU/nas_stream_eea2.c
+++ b/openair3/SECU/nas_stream_eea2.c
@@ -85,7 +85,7 @@ int nas_stream_encrypt_eea2(nas_stream_cipher_t *stream_cipher, uint8_t *out)
}
#endif
- nettle_aes128.set_encrypt_key(ctx, stream_cipher->key_length,
+ nettle_aes128.set_encrypt_key(ctx,
stream_cipher->key);
nettle_ctr_crypt(ctx, nettle_aes128.encrypt,
diff --git a/openair3/TEST/test_aes128_ctr_decrypt.c b/openair3/TEST/test_aes128_ctr_decrypt.c
index f3740b48ff..251f80fa70 100644
--- a/openair3/TEST/test_aes128_ctr_decrypt.c
+++ b/openair3/TEST/test_aes128_ctr_decrypt.c
@@ -48,7 +48,7 @@ void test_uncipher_ctr(const struct nettle_cipher *cipher, const uint8_t *key,
uint8_t *data = malloc(length);
uint8_t *ctr = malloc(cipher->block_size);
- cipher->set_encrypt_key(ctx, key_length, key);
+ cipher->set_encrypt_key(ctx, key);
memcpy(ctr, ictr, cipher->block_size);
ctr_crypt(ctx, cipher->encrypt,
diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c
index 7381e37bff..ae781092f0 100644
--- a/targets/RT/USER/lte-enb.c
+++ b/targets/RT/USER/lte-enb.c
@@ -157,6 +157,8 @@ static struct {
volatile uint8_t phy_proc_CC_id;
} sync_phy_proc;
+extern double cpuf;
+
void exit_fun(const char* s);
void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst,eth_params_t *);
@@ -432,6 +434,10 @@ static void* eNB_thread_rxtx( void* param ) {
MSC_START_USE();
+ struct timespec wait;
+
+ wait.tv_sec=0;
+ wait.tv_nsec=5000000L;
#ifdef DEADLINE_SCHEDULER
struct sched_attr attr;
@@ -462,10 +468,6 @@ static void* eNB_thread_rxtx( void* param ) {
struct sched_param sparam;
char cpu_affinity[1024];
cpu_set_t cpuset;
- struct timespec wait;
-
- wait.tv_sec=0;
- wait.tv_nsec=5000000L;
/* Set affinity mask to include CPUs 1 to MAX_CPUS */
/* CPU 0 is reserved for UHD threads */
@@ -819,7 +821,7 @@ static void* eNB_thread_asynch_rxtx( void* param ) {
if (sched_setattr(0, &attr, flags) < 0 ) {
perror("[SCHED] eNB FH sched_setattr failed\n");
- return &eNB_thread_FH_status;
+ return &eNB_thread_asynch_rxtx_status;
}
LOG_I( HW, "[SCHED] eNB asynch RX deadline thread (TID %ld) started on CPU %d\n", gettid(), sched_getcpu() );
@@ -1403,7 +1405,7 @@ static void* eNB_thread_FH( void* param ) {
#ifdef DEADLINE_SCHEDULER
if (opp_enabled){
if(softmodem_stats_rxtx_sf.diff_now/(cpuf) > attr.sched_runtime) {
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RXTX_ENB, (softmodem_stats_rxtx_sf.diff_now/cpuf - attr.sched_runtime)/1000000.0);
+ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, (softmodem_stats_rxtx_sf.diff_now/cpuf - attr.sched_runtime)/1000000.0);
}
}
#endif // DEADLINE_SCHEDULER
@@ -1664,8 +1666,8 @@ void init_eNB_proc(int inst) {
(eNB->node_function == NGFI_RRU_IF4p5))
pthread_create( &proc->pthread_asynch_rxtx, &proc->attr_asynch_rxtx, eNB_thread_asynch_rxtx, &eNB->proc );
#else
- pthread_create( &proc_rxtx[0].pthread_rxtx, NULL, eNB_thread_rxtx, &eNB->proc_rxtx[0] );
- pthread_create( &proc_rxtx[1].pthread_rxtx, NULL, eNB_thread_rxtx, &eNB->proc_rxtx[1] );
+ pthread_create( &proc_rxtx[0].pthread_rxtx, NULL, eNB_thread_rxtx, &proc_rxtx[0] );
+ pthread_create( &proc_rxtx[1].pthread_rxtx, NULL, eNB_thread_rxtx, &proc_rxtx[1] );
pthread_create( &proc->pthread_FH, NULL, eNB_thread_FH, &eNB->proc );
pthread_create( &proc->pthread_prach, NULL, eNB_thread_prach, &eNB->proc );
if (eNB->node_timing == synch_to_other)
--
GitLab