From 3bea905e0d013de9a0b9d77fdc5318a133a6af9b Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 8 Jun 2015 11:26:38 +0200 Subject: [PATCH] ms: Store the L1 measurement values in the MS objects This commits adds the GprsMs::update_l1_meas() and GprsMs::l1_meas() methods to store and access the measurement values. The internal state is updated depending on which values are actually set. In addition, these values are shown in the output of the 'show ms imsi|tlli' command. Sponsored-by: On-Waves ehf --- src/gprs_ms.cpp | 12 ++++++++++++ src/gprs_ms.h | 6 ++++++ src/pcu_vty_functions.cpp | 12 ++++++++++++ src/tbf_ul.cpp | 4 ++++ 4 files changed, 34 insertions(+) diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp index f0379ce8..189e4bd2 100644 --- a/src/gprs_ms.cpp +++ b/src/gprs_ms.cpp @@ -421,3 +421,15 @@ void GprsMs::update_error_rate(gprs_rlcmac_tbf *tbf, int error_rate) m_last_cs_not_low = now; } } + +void GprsMs::update_l1_meas(const pcu_l1_meas *meas) +{ + if (meas->have_rssi) + m_l1_meas.set_rssi(meas->rssi); + if (meas->have_bto) + m_l1_meas.set_bto(meas->bto); + if (meas->have_ber) + m_l1_meas.set_ber(meas->ber); + if (meas->have_link_qual) + m_l1_meas.set_link_qual(meas->link_qual); +} diff --git a/src/gprs_ms.h b/src/gprs_ms.h index 90b81fee..6752b2b6 100644 --- a/src/gprs_ms.h +++ b/src/gprs_ms.h @@ -26,6 +26,7 @@ struct gprs_rlcmac_ul_tbf; #include "cxx_linuxlist.h" #include "llc.h" +#include "pcu_l1_if.h" extern "C" { #include @@ -96,6 +97,9 @@ public: LListHead& list() {return this->m_list;} const LListHead& list() const {return this->m_list;} + void update_l1_meas(const pcu_l1_meas *meas); + const pcu_l1_meas* l1_meas() const {return &m_l1_meas;}; + /* internal use */ static void timeout(void *priv_); @@ -132,6 +136,8 @@ private: unsigned m_delay; int64_t m_last_cs_not_low; + + pcu_l1_meas m_l1_meas; }; inline uint32_t GprsMs::tlli() const diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index 39c5ee44..bf4843f1 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -67,6 +67,18 @@ static int show_ms(struct vty *vty, GprsMs *ms) vty_out(vty, " MS class: %d%s", ms->ms_class(), VTY_NEWLINE); vty_out(vty, " LLC queue length: %d%s", ms->llc_queue()->size(), VTY_NEWLINE); + if (ms->l1_meas()->have_rssi) + vty_out(vty, " RSSI: %d dBm%s", + ms->l1_meas()->rssi, VTY_NEWLINE); + if (ms->l1_meas()->have_ber) + vty_out(vty, " Bit error rate: %d %%%s", + ms->l1_meas()->ber, VTY_NEWLINE); + if (ms->l1_meas()->have_link_qual) + vty_out(vty, " Link quality: %d dB%s", + ms->l1_meas()->link_qual, VTY_NEWLINE); + if (ms->l1_meas()->have_bto) + vty_out(vty, " Burst timing offset: %d/4 bit%s", + ms->l1_meas()->bto, VTY_NEWLINE); if (ms->ul_tbf()) vty_out(vty, " Uplink TBF: TFI=%d, state=%s%s", ms->ul_tbf()->tfi(), diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index b9ea6599..a79657d7 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -281,6 +281,10 @@ int gprs_rlcmac_ul_tbf::rcv_data_block_acknowledged(const uint8_t *data, /* process RSSI */ gprs_rlcmac_rssi(this, rssi); + /* store measurement values */ + if (ms()) + ms()->update_l1_meas(meas); + /* get TLLI */ if (!this->is_tlli_valid()) { if (!extract_tlli(data, len))