From 11315ef602bcbb9ac27c823b1618bffc9d47c91a Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 9 Sep 2022 14:35:54 +0200 Subject: [PATCH 1/4] fix(build): automatically applying UHD TDD patch for LTE Signed-off-by: Raphael Defosseux --- cmake_targets/tools/build_helper | 20 +++++++++ cmake_targets/tools/uhd-3.15-tdd-patch.diff | 34 ++++++++++++++ cmake_targets/tools/uhd-4.x-tdd-patch.diff | 34 ++++++++++++++ doc/BUILD.md | 49 ++++----------------- 4 files changed, 97 insertions(+), 40 deletions(-) create mode 100644 cmake_targets/tools/uhd-3.15-tdd-patch.diff create mode 100644 cmake_targets/tools/uhd-4.x-tdd-patch.diff diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 608ace0486..473dee7edf 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -346,11 +346,31 @@ install_usrp_uhd_driver_from_source(){ rm -rf /tmp/uhd git clone https://github.com/EttusResearch/uhd.git cd uhd + # For our legacy TDD eNB running with a B2xx RF board + # the following patch has to be applied if [[ -v UHD_VERSION ]]; then git checkout tags/v${UHD_VERSION} + # We recommend to use not older than 3.15.0.0 + if [[ "$UHD_VERSION" == "3.15.0.0" ]]; then + # Tested that patch for the following versions: + # - 3.15.0.0 + git apply $OPENAIR_DIR/cmake_targets/tools/uhd-3.15-tdd-patch.diff + else + # Tested that patch for the following versions: + # - 4.0.0.0 + # - 4.1.0.0 + # - 4.1.0.5 + # - 4.2.0.0 + # - 4.2.0.1 + # - 4.3.0.0-rc1 + git apply $OPENAIR_DIR/cmake_targets/tools/uhd-4.x-tdd-patch.diff + fi else git checkout tags/v4.0.0.0 + git apply $OPENAIR_DIR/cmake_targets/tools/uhd-4.x-tdd-patch.diff fi + # Printing out the results of the patch to make sure it was properly applied + git diff mkdir -p host/build cd host/build || true $CMAKE ../ -GNinja diff --git a/cmake_targets/tools/uhd-3.15-tdd-patch.diff b/cmake_targets/tools/uhd-3.15-tdd-patch.diff new file mode 100644 index 0000000000..00746999cf --- /dev/null +++ b/cmake_targets/tools/uhd-3.15-tdd-patch.diff @@ -0,0 +1,34 @@ +diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp +index 1be8c263b..f64546914 100644 +--- a/host/lib/usrp/b200/b200_impl.cpp ++++ b/host/lib/usrp/b200/b200_impl.cpp +@@ -1269,10 +1269,10 @@ void b200_impl::update_atrs(void) + if (enb_rx and not enb_tx) fd = rxonly; + if (not enb_rx and enb_tx) fd = txonly; + gpio_atr_3000::sptr atr = perif.atr; +- atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF); +- atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly); +- atr->set_atr_reg(ATR_REG_TX_ONLY, txonly); +- atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd); ++ atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF | (1<<7)); ++ atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly | (1<<7)); ++ atr->set_atr_reg(ATR_REG_TX_ONLY, txonly | (1<<7)); ++ atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd | (1<<7)); + } + if (_radio_perifs.size() > _fe2 and _radio_perifs[_fe2].atr) + { +@@ -1287,10 +1287,10 @@ void b200_impl::update_atrs(void) + if (enb_rx and not enb_tx) fd = rxonly; + if (not enb_rx and enb_tx) fd = txonly; + gpio_atr_3000::sptr atr = perif.atr; +- atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF); +- atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly); +- atr->set_atr_reg(ATR_REG_TX_ONLY, txonly); +- atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd); ++ atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF | (1<<7)); ++ atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly | (1<<7)); ++ atr->set_atr_reg(ATR_REG_TX_ONLY, txonly | (1<<7)); ++ atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd | (1<<7)); + } + } + diff --git a/cmake_targets/tools/uhd-4.x-tdd-patch.diff b/cmake_targets/tools/uhd-4.x-tdd-patch.diff new file mode 100644 index 0000000000..64ffaf0c3e --- /dev/null +++ b/cmake_targets/tools/uhd-4.x-tdd-patch.diff @@ -0,0 +1,34 @@ +diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp +index 6de161e87..432af5784 100644 +--- a/host/lib/usrp/b200/b200_impl.cpp ++++ b/host/lib/usrp/b200/b200_impl.cpp +@@ -1410,10 +1410,10 @@ void b200_impl::update_atrs(void) + if (not enb_rx and enb_tx) + fd = txonly; + gpio_atr_3000::sptr atr = perif.atr; +- atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF); +- atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly); +- atr->set_atr_reg(ATR_REG_TX_ONLY, txonly); +- atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd); ++ atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF | (1<<7)); ++ atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly | (1<<7)); ++ atr->set_atr_reg(ATR_REG_TX_ONLY, txonly | (1<<7)); ++ atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd | (1<<7)); + } + if (_radio_perifs.size() > _fe2 and _radio_perifs[_fe2].atr) { + radio_perifs_t& perif = _radio_perifs[_fe2]; +@@ -1431,10 +1431,10 @@ void b200_impl::update_atrs(void) + if (not enb_rx and enb_tx) + fd = txonly; + gpio_atr_3000::sptr atr = perif.atr; +- atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF); +- atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly); +- atr->set_atr_reg(ATR_REG_TX_ONLY, txonly); +- atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd); ++ atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF | (1<<7)); ++ atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly | (1<<7)); ++ atr->set_atr_reg(ATR_REG_TX_ONLY, txonly | (1<<7)); ++ atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd | (1<<7)); + } + } + diff --git a/doc/BUILD.md b/doc/BUILD.md index 70d69f5afd..b93278a59f 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -88,12 +88,15 @@ You can build any oai softmodem executable separately, you may not need all of t After completing the build, the binaries are available in the `cmake_targets/ran_build/build` directory. A copy is also available in the `target/bin` directory, with all binaries suffixed by the 3GPP release number, today .Rel15. +## Installing UHD from source + When installing the pre-requisites, especially the `UHD` driver, you can now specify if you want to install from source or not. - For `fedora`-based OS, it was already the case all the time. But now you can specify which version to install. - For `ubuntu` OS, the Ettus PPA currently installs the following versions: * `Ubuntu16.04`: --> version `3.15.0.0` * `Ubuntu18.04`: --> version `4.1.0.0` + * `Ubuntu20.04`: --> version `4.2.0.1` ```bash export BUILD_UHD_FROM_SOURCE=True @@ -103,49 +106,15 @@ export UHD_VERSION=3.15.0.0 The `UHD_VERSION` env variable `SHALL` be a valid tag (minus `v`) from the `https://github.com/EttusResearch/uhd.git` repository. -## Issue when building `nasmeh` module ## +**CAUTION: Note that if you are using the OAI eNB in TDD mode with B2xx boards, a patch is mandatory.** -A lot of users and contributors have faced the issue: `nasmesh` module does not build. +Starting this commit, the patch is applied automatically in our automated builds. -The reason is that the linux headers are not properly installed. For example: +See: -```bash -$ uname -r -4.4.0-145-lowlatency -$ dpkg --list | grep 4.4.0-145-lowlatency | grep headers -ii linux-headers-4.4.0-145-lowlatency 4.4.0-145.171 -``` - -In my example it is properly installed. - -Check on your environment: - -```bash -$ uname -r -your-version -$ dpkg --list | grep your-version | grep headers -$ -``` - -Install it: - -```bash -$ sudo apt-get install --yes linux-headers-your-version -``` - -On CentOS or RedHat Entreprise Linux: - -```bash -$ uname -r -3.10.0-1062.9.1.rt56.1033.el7.x86_64 -$ yum list installed | grep kernel | grep devel -kernel-devel.x86_64 3.10.0-1062.9.1.el7 @rhel-7-server-rpms -kernel-rt-devel.x86_64 3.10.0-1062.9.1.rt56.1033.el7 -``` - -If your kernel is generic, install `kernel-devel` package: `sudo yum install kernel-devel` - -In most case, your kernel is real-time. Install `kernel-rt-devel` package: `sudo yum install kernel-rt-devel` +* `cmake_targets/tools/uhd-3.15-tdd-patch.diff` +* `cmake_targets/tools/uhd-4.x-tdd-patch.diff` +* `cmake_targets/tools/build_helper` --> function `install_usrp_uhd_driver_from_source` # Building Optional Binaries From 11839724ea19dc6f1eaa58745fe505c0634bb1b6 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 9 Sep 2022 14:38:15 +0200 Subject: [PATCH 2/4] fix(ci): typos and scenario adaptations for Legacy LTE CI bench after migration to Ubuntu22 and UHD 4.2.0.1 Signed-off-by: Raphael Defosseux --- ci-scripts/cls_oaicitest.py | 6 +++--- .../enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf | 4 ++-- .../enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf | 4 ++-- .../enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf | 4 ++-- .../enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf | 4 ++-- .../rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf | 4 ++-- .../rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf | 4 ++-- ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml | 8 ++++---- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 32d9c48966..e96338015f 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -2404,7 +2404,7 @@ class OaiCiTest(): if launchFromTrfContainer: SSH.command('docker exec -it prod-trf-gen /bin/bash -c "killall --signal SIGKILL iperf"', '\$', 5) else: - SSH.command('killall --signal SIGKILL iperf', EPC.UserName, 5) + SSH.command('killall --signal SIGKILL iperf', '\$', 5) SSH.close() else: cmd = 'killall --signal SIGKILL iperf' @@ -3894,8 +3894,8 @@ class OaiCiTest(): logging.debug('UHD Version is: ' + UhdVersion) HTML.UhdVersion[idx]=UhdVersion else: - SSH.command('uhd_config_info --version', '\$', 5) - result = re.search('UHD (?P[a-zA-Z0-9\.\-]+)', SSH.getBefore()) + SSH.command('uhd_config_info ----abi-version', '\$', 5) + result = re.search('ABI version string: (?P[a-zA-Z0-9\.\-]+)', SSH.getBefore()) if result is not None: UhdVersion = result.group('uhd_version') logging.debug('UHD Version is: ' + UhdVersion) diff --git a/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf index 0633d233ef..2df7ed455a 100644 --- a/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf @@ -198,8 +198,8 @@ RUs = ( local_rf = "yes" nb_tx = 1 nb_rx = 1 - att_tx = 0 - att_rx = 0; + att_tx = 6 + att_rx = 6; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 115; diff --git a/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf index 4de8a3f759..5738a65569 100644 --- a/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf @@ -198,8 +198,8 @@ RUs = ( local_rf = "yes" nb_tx = 1 nb_rx = 1 - att_tx = 0 - att_rx = 0; + att_tx = 6 + att_rx = 6; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 125; diff --git a/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf index df902faf8b..8ea3abf01e 100644 --- a/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf @@ -198,8 +198,8 @@ RUs = ( local_rf = "yes" nb_tx = 1 nb_rx = 1 - att_tx = 0 - att_rx = 0; + att_tx = 6 + att_rx = 6; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 120; diff --git a/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf index 0da4b1181a..926e65eddd 100644 --- a/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf @@ -196,8 +196,8 @@ RUs = ( local_rf = "yes" nb_tx = 2 nb_rx = 2 - att_tx = 0 - att_rx = 0; + att_tx = 6 + att_rx = 6; bands = [38]; max_pdschReferenceSignalPower = -27; max_rxgain = 110; diff --git a/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf index 660478ca11..f430f51ebe 100644 --- a/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf @@ -209,8 +209,8 @@ RUs = ( tr_preference = "udp_if4p5" nb_tx = 1 nb_rx = 1 - att_tx = 0 - att_rx = 0; + att_tx = 6 + att_rx = 6; eNB_instances = [0]; } ); diff --git a/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf index 6997c80234..98699aac26 100644 --- a/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf @@ -209,8 +209,8 @@ RUs = ( tr_preference = "udp_if4p5" nb_tx = 1 nb_rx = 1 - att_tx = 0 - att_rx = 0; + att_tx = 6 + att_rx = 6; eNB_instances = [0]; } ); diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml index 5b3a23dbfb..01388a5aa1 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1.xml @@ -111,16 +111,16 @@ Iperf - iperf (10MHz - UL/20Mbps/UDP)(30 sec)(balanced profile) - -u -b 20M -t 30 -i 1 -R + iperf (10MHz - UL/18Mbps/UDP)(30 sec)(balanced profile) + -u -b 18M -t 30 -i 1 -R 50 balanced Iperf - iperf (10MHz - UL/20Mbps/UDP)(30 sec)(single-ue profile) - -u -b 20M -t 30 -i 1 -R + iperf (10MHz - UL/18Mbps/UDP)(30 sec)(single-ue profile) + -u -b 18M -t 30 -i 1 -R 50 single-ue From 28155091abfacbdf6ec61a81a6758e51b7bc07fb Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 12 Sep 2022 18:12:34 +0200 Subject: [PATCH 3/4] fix(ci): little typo Signed-off-by: Raphael Defosseux --- ci-scripts/cls_oaicitest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index e96338015f..fcaa22afed 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -3894,7 +3894,7 @@ class OaiCiTest(): logging.debug('UHD Version is: ' + UhdVersion) HTML.UhdVersion[idx]=UhdVersion else: - SSH.command('uhd_config_info ----abi-version', '\$', 5) + SSH.command('uhd_config_info --abi-version', '\$', 5) result = re.search('ABI version string: (?P[a-zA-Z0-9\.\-]+)', SSH.getBefore()) if result is not None: UhdVersion = result.group('uhd_version') From 4f29e6474930f7a310059b5a3ea4ded718bde85d Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 21 Sep 2022 14:37:05 +0200 Subject: [PATCH 4/4] chore(ci): clarification on why we can/should install UHD from source Signed-off-by: Raphael Defosseux --- cmake_targets/tools/build_helper | 3 +++ doc/BUILD.md | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 473dee7edf..f4e206d0eb 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -355,6 +355,7 @@ install_usrp_uhd_driver_from_source(){ # Tested that patch for the following versions: # - 3.15.0.0 git apply $OPENAIR_DIR/cmake_targets/tools/uhd-3.15-tdd-patch.diff + ret=$?;[[ $ret -ne 0 ]] && echo_fatal "Could not apply the TDD patch" else # Tested that patch for the following versions: # - 4.0.0.0 @@ -364,10 +365,12 @@ install_usrp_uhd_driver_from_source(){ # - 4.2.0.1 # - 4.3.0.0-rc1 git apply $OPENAIR_DIR/cmake_targets/tools/uhd-4.x-tdd-patch.diff + ret=$?;[[ $ret -ne 0 ]] && echo_fatal "Could not apply the TDD patch" fi else git checkout tags/v4.0.0.0 git apply $OPENAIR_DIR/cmake_targets/tools/uhd-4.x-tdd-patch.diff + ret=$?;[[ $ret -ne 0 ]] && echo_fatal "Could not apply the TDD patch" fi # Printing out the results of the patch to make sure it was properly applied git diff diff --git a/doc/BUILD.md b/doc/BUILD.md index b93278a59f..2172475d08 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -90,13 +90,17 @@ After completing the build, the binaries are available in the `cmake_targets/ran ## Installing UHD from source -When installing the pre-requisites, especially the `UHD` driver, you can now specify if you want to install from source or not. +Previously for Ubuntu distributions, when installing the pre-requisites, most of the packages are installed from PPA. + +Especially the `UHD` driver, but you could not easily manage the version of `libuhd` that will be installed. + +Now, when installing the pre-requisites, especially the `UHD` driver, you can now specify if you want to install from source or not. - For `fedora`-based OS, it was already the case all the time. But now you can specify which version to install. -- For `ubuntu` OS, the Ettus PPA currently installs the following versions: - * `Ubuntu16.04`: --> version `3.15.0.0` - * `Ubuntu18.04`: --> version `4.1.0.0` - * `Ubuntu20.04`: --> version `4.2.0.1` +- For `ubuntu` OS, you can still install from the Ettus PPA or select a version to install from source. + * In case of PPA installation, you do nothing special, the script will install the latest version available on the PPA. + - `./build_oai -I -w USRP` + * In case of a installation from source, you do as followed: ```bash export BUILD_UHD_FROM_SOURCE=True