summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Undheim <ruben.undheim@gmail.com>2018-10-02 08:31:41 +0200
committerRuben Undheim <ruben.undheim@gmail.com>2018-10-02 08:31:41 +0200
commitf2b7a19048cea71b01165887f4314dd59fb3de5b (patch)
tree3bf56050b7b984bf2e3e6693d30e56dc24509b76
parent6c70b89d4336ede49977fc955b4db1c2462ca7af (diff)
New upstream version 0.5.1
-rw-r--r--configure.ac8
-rwxr-xr-xcontrib/jenkins.sh4
-rw-r--r--src/gprs_bssgp_pcu.cpp7
-rw-r--r--src/gprs_rlcmac_meas.cpp49
-rw-r--r--src/pcu_l1_if.cpp3
-rw-r--r--src/pcu_main.cpp5
-rw-r--r--src/rlc.cpp13
-rw-r--r--src/rlc.h7
-rw-r--r--src/tbf.cpp105
-rw-r--r--src/tbf.h6
-rw-r--r--tests/tbf/TbfTest.err1
11 files changed, 118 insertions, 90 deletions
diff --git a/configure.ac b/configure.ac
index 86b4ee1..69e0775 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,10 +73,10 @@ then
fi
dnl checks for libraries
-PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.11.0)
-PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.11.0)
-PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.11.0)
-PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.11.0)
+PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.12.0)
+PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.12.0)
+PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.12.0)
+PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.12.0)
AC_MSG_CHECKING([whether to enable direct DSP access for PDCH of sysmocom-bts])
AC_ARG_ENABLE(sysmocom-dsp,
diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index 2527127..5f81978 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -26,7 +26,7 @@ mkdir "$deps" || true
# Collect configure options for osmo-pcu
PCU_CONFIG=""
if [ "$with_dsp" = sysmo ]; then
- PCU_CONFIG="$PCU_CONFIG --enable-sysmocom-dsp --with-sysmobts=$inst/include/"
+ PCU_CONFIG="$PCU_CONFIG --enable-werror --enable-sysmocom-dsp --with-sysmobts=$inst/include/"
# For direct sysmo DSP access, provide the SysmoBTS Layer 1 API
cd "$deps"
@@ -43,7 +43,7 @@ elif [ "$with_dsp" = lc15 ]; then
elif [ -z "$with_dsp" -o "$with_dsp" = none ]; then
echo "Direct DSP access disabled, sanitizer enabled"
- PCU_CONFIG="$PCU_CONFIG --enable-sanitize"
+ PCU_CONFIG="$PCU_CONFIG --enable-werror --enable-sanitize"
else
echo 'Invalid $with_dsp value:' $with_dsp
exit 1
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 1524fb3..100e33d 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -388,6 +388,13 @@ static int gprs_bssgp_pcu_rcvmsg(struct msgb *msg)
data_len = msgb_bssgp_len(msg) - sizeof(*budh);
rc = bssgp_tlv_parse(&tp, budh->data, data_len);
}
+ if (rc < 0) {
+ LOGP(DBSSGP, LOGL_ERROR, "Failed to parse BSSGP %s message. Invalid message was: %s\n",
+ bssgp_pdu_str(pdu_type), msgb_hexdump(msg));
+ if (pdu_type != BSSGP_PDUT_STATUS)
+ return bssgp_tx_status(BSSGP_CAUSE_INV_MAND_INF, NULL, msg);
+ return rc;
+ }
if (pdu_type == BSSGP_PDUT_BVC_RESET) {
rc = bssgp_rcvmsg(msg);
diff --git a/src/gprs_rlcmac_meas.cpp b/src/gprs_rlcmac_meas.cpp
index 41a7531..f6448d5 100644
--- a/src/gprs_rlcmac_meas.cpp
+++ b/src/gprs_rlcmac_meas.cpp
@@ -17,6 +17,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include <osmocom/core/timer_compat.h>
+
#include <gprs_rlcmac.h>
#include <gprs_debug.h>
#include <pcu_l1_if.h>
@@ -71,22 +73,22 @@ int gprs_rlcmac_meas_rep(Packet_Measurement_Report_t *pmr)
/* RSSI values received from MS */
int gprs_rlcmac_rssi(struct gprs_rlcmac_tbf *tbf, int8_t rssi)
{
- struct timeval now_tv, *rssi_tv = &tbf->meas.rssi_tv;
- uint32_t elapsed;
+ struct timespec now_tv, *rssi_tv = &tbf->meas.rssi_tv;
+ struct timespec elapsed;
tbf->meas.rssi_sum += rssi;
tbf->meas.rssi_num++;
- gettimeofday(&now_tv, NULL);
- elapsed = ((now_tv.tv_sec - rssi_tv->tv_sec) << 7)
- + ((now_tv.tv_usec - rssi_tv->tv_usec) << 7) / 1000000;
- if (elapsed < 128)
+ osmo_clock_gettime(CLOCK_MONOTONIC, &now_tv);
+
+ timespecsub(&now_tv, rssi_tv, &elapsed);
+ if (elapsed.tv_sec < 1)
return 0;
gprs_rlcmac_rssi_rep(tbf);
/* reset rssi values and timestamp */
- memcpy(rssi_tv, &now_tv, sizeof(struct timeval));
+ memcpy(rssi_tv, &now_tv, sizeof(*rssi_tv));
tbf->meas.rssi_sum = 0;
tbf->meas.rssi_num = 0;
@@ -115,8 +117,8 @@ int gprs_rlcmac_rssi_rep(struct gprs_rlcmac_tbf *tbf)
int gprs_rlcmac_received_lost(struct gprs_rlcmac_dl_tbf *tbf, uint16_t received,
uint16_t lost)
{
- struct timeval now_tv, *loss_tv = &tbf->m_bw.dl_loss_tv;
- uint32_t elapsed;
+ struct timespec now_tv, *loss_tv = &tbf->m_bw.dl_loss_tv;
+ struct timespec elapsed;
uint16_t sum = received + lost;
/* No measurement values */
@@ -129,16 +131,14 @@ int gprs_rlcmac_received_lost(struct gprs_rlcmac_dl_tbf *tbf, uint16_t received,
tbf->m_bw.dl_loss_received += received;
tbf->m_bw.dl_loss_lost += lost;
- gettimeofday(&now_tv, NULL);
- elapsed = ((now_tv.tv_sec - loss_tv->tv_sec) << 7)
- + ((now_tv.tv_usec - loss_tv->tv_usec) << 7) / 1000000;
- if (elapsed < 128)
+ timespecsub(&now_tv, loss_tv, &elapsed);
+ if (elapsed.tv_sec < 1)
return 0;
gprs_rlcmac_lost_rep(tbf);
/* reset lost values and timestamp */
- memcpy(loss_tv, &now_tv, sizeof(struct timeval));
+ memcpy(loss_tv, &now_tv, sizeof(*loss_tv));
tbf->m_bw.dl_loss_received = 0;
tbf->m_bw.dl_loss_lost = 0;
@@ -154,7 +154,7 @@ int gprs_rlcmac_lost_rep(struct gprs_rlcmac_dl_tbf *tbf)
if (!sum)
return -EINVAL;
- LOGP(DRLCMACMEAS, LOGL_INFO, "DL packet loss of IMSI=%s / TLLI=0x%08x: "
+ LOGP(DRLCMACMEAS, LOGL_DEBUG, "DL packet loss of IMSI=%s / TLLI=0x%08x: "
"%d%%\n", tbf->imsi(), tbf->tlli(),
tbf->m_bw.dl_loss_lost * 100 / sum);
@@ -168,25 +168,22 @@ int gprs_rlcmac_lost_rep(struct gprs_rlcmac_dl_tbf *tbf)
int gprs_rlcmac_dl_bw(struct gprs_rlcmac_dl_tbf *tbf, uint16_t octets)
{
- struct timeval now_tv, *bw_tv = &tbf->m_bw.dl_bw_tv;
- uint32_t elapsed;
+ struct timespec now_tv, *bw_tv = &tbf->m_bw.dl_bw_tv;
+ struct timespec elapsed;
tbf->m_bw.dl_bw_octets += octets;
- gettimeofday(&now_tv, NULL);
- elapsed = ((now_tv.tv_sec - bw_tv->tv_sec) << 7)
- + ((now_tv.tv_usec - bw_tv->tv_usec) << 7) / 1000000;
- if (elapsed < 128)
+ osmo_clock_gettime(CLOCK_MONOTONIC, &now_tv);
+ timespecsub(&now_tv, bw_tv, &elapsed);
+ if (elapsed.tv_sec < 1)
return 0;
- tbf->m_bw.dl_throughput = (tbf->m_bw.dl_bw_octets/elapsed);
-
+ tbf->m_bw.dl_throughput = (tbf->m_bw.dl_bw_octets << 10) / ((elapsed.tv_sec << 10) + (elapsed.tv_nsec >> 20));
LOGP(DRLCMACMEAS, LOGL_INFO, "DL Bandwitdh of IMSI=%s / TLLI=0x%08x: "
- "%d KBits/s\n", tbf->imsi(), tbf->tlli(),
- tbf->m_bw.dl_bw_octets / elapsed);
+ "%d KBits/s\n", tbf->imsi(), tbf->tlli(), tbf->m_bw.dl_throughput);
/* reset bandwidth values timestamp */
- memcpy(bw_tv, &now_tv, sizeof(struct timeval));
+ memcpy(bw_tv, &now_tv, sizeof(*bw_tv));
tbf->m_bw.dl_bw_octets = 0;
return 0;
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 4b54707..27e86dd 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -217,7 +217,7 @@ void pcu_l1if_tx_agch(bitvec * block, int plen)
void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi)
{
- uint8_t data[23+3]; /* prefix PLEN */
+ uint8_t data[3+1+23]; /* prefix PLEN */
/* paging group */
if (!imsi || strlen(imsi) < 3)
@@ -227,6 +227,7 @@ void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi)
data[1] = imsi[1];
data[2] = imsi[2];
+ OSMO_ASSERT(block->data_len <= sizeof(data) - (3+1));
bitvec_pack(block, data + 3+1);
data[3] = (plen << 2) | 0x01;
pcu_tx_data_req(0, 0, PCU_IF_SAPI_PCH, 0, 0, 0, data, 23+3);
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index 5b1b1be..7480842 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -143,7 +143,7 @@ static void handle_options(int argc, char **argv)
void sighandler(int sigset)
{
- if (sigset == SIGHUP || sigset == SIGPIPE)
+ if (sigset == SIGPIPE)
return;
fprintf(stderr, "Signal %d received.\n", sigset);
@@ -155,7 +155,6 @@ void sighandler(int sigset)
* is terminated without finishing shutdown process.
*/
signal(SIGINT, SIG_DFL);
- signal(SIGHUP, SIG_DFL);
signal(SIGTERM, SIG_DFL);
signal(SIGPIPE, SIG_DFL);
signal(SIGABRT, SIG_DFL);
@@ -311,12 +310,12 @@ int main(int argc, char *argv[])
return rc;
signal(SIGINT, sighandler);
- signal(SIGHUP, sighandler);
signal(SIGTERM, sighandler);
signal(SIGPIPE, sighandler);
signal(SIGABRT, sighandler);
signal(SIGUSR1, sighandler);
signal(SIGUSR2, sighandler);
+ osmo_init_ignore_signals();
/* enable realtime priority for us */
if (rt_prio != -1) {
diff --git a/src/rlc.cpp b/src/rlc.cpp
index a82f550..ee88bd9 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -326,11 +326,18 @@ static void gprs_rlc_data_header_init(struct gprs_rlc_data_info *rlc,
unsigned int i;
unsigned int padding_bits = with_padding ? cs.optionalPaddingBits() : 0;
- memset(rlc, 0, sizeof(*rlc));
-
rlc->cs = cs;
- rlc->with_padding = with_padding;
+ rlc->r = 0;
+ rlc->si = 0;
+ rlc->tfi = 0;
+ rlc->cps = 0;
+ rlc->rsb = 0;
+ rlc->usf = 0;
+ rlc->es_p = 0;
+ rlc->rrbp = 0;
+ rlc->pr = 0;
rlc->num_data_blocks = cs.numDataBlocks();
+ rlc->with_padding = with_padding;
OSMO_ASSERT(rlc->num_data_blocks <= ARRAY_SIZE(rlc->block_info));
diff --git a/src/rlc.h b/src/rlc.h
index aac6b13..5b6a0dd 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -24,6 +24,7 @@
#include <osmocom/core/endian.h>
#include <stdint.h>
+#include <string.h>
#define RLC_GPRS_SNS 128 /* GPRS, must be power of 2 */
#define RLC_GPRS_WS 64 /* max window size */
@@ -232,6 +233,7 @@ void gprs_update_punct_scheme(enum egprs_puncturing_values *punct,
* the routines to manipulate these arrays.
*/
struct gprs_rlc {
+ void init();
gprs_rlc_data *block(int bsn);
gprs_rlc_data m_blocks[RLC_MAX_SNS/2];
};
@@ -647,6 +649,11 @@ inline gprs_rlc_ul_bsn_state gprs_rlc_v_n::state(int bsn) const
return m_v_n[bsn & mod_sns_half()];
}
+inline void gprs_rlc::init()
+{
+ memset(m_blocks, 0, sizeof(m_blocks));
+}
+
inline gprs_rlc_data *gprs_rlc::block(int bsn)
{
return &m_blocks[bsn & mod_sns_half()];
diff --git a/src/tbf.cpp b/src/tbf.cpp
index d5fbb3f..6792d08 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -40,6 +40,7 @@ extern "C" {
#include <osmocom/core/talloc.h>
#include <osmocom/core/stats.h>
#include <osmocom/core/logging.h>
+#include <osmocom/core/timer_compat.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
@@ -50,6 +51,8 @@ extern "C" {
extern void *tall_pcu_ctx;
+static unsigned int next_tbf_ctr_group_id = 0; /* Incrementing group id */
+
static void tbf_timer_cb(void *_tbf);
const struct value_string gprs_rlcmac_tbf_poll_state_names[] = {
@@ -97,49 +100,49 @@ static const struct value_string tbf_timers_names[] = {
};
static const struct rate_ctr_desc tbf_ctr_description[] = {
- { "rlc.nacked", "RLC Nacked " },
+ { "rlc:nacked", "RLC Nacked " },
};
static const struct rate_ctr_desc tbf_dl_gprs_ctr_description[] = {
- { "gprs.downlink.cs1", "CS1 " },
- { "gprs.downlink.cs2", "CS2 " },
- { "gprs.downlink.cs3", "CS3 " },
- { "gprs.downlink.cs4", "CS4 " },
+ { "gprs:downlink:cs1", "CS1 " },
+ { "gprs:downlink:cs2", "CS2 " },
+ { "gprs:downlink:cs3", "CS3 " },
+ { "gprs:downlink:cs4", "CS4 " },
};
static const struct rate_ctr_desc tbf_dl_egprs_ctr_description[] = {
- { "egprs.downlink.mcs1", "MCS1 " },
- { "egprs.downlink.mcs2", "MCS2 " },
- { "egprs.downlink.mcs3", "MCS3 " },
- { "egprs.downlink.mcs4", "MCS4 " },
- { "egprs.downlink.mcs5", "MCS5 " },
- { "egprs.downlink.mcs6", "MCS6 " },
- { "egprs.downlink.mcs7", "MCS7 " },
- { "egprs.downlink.mcs8", "MCS8 " },
- { "egprs.downlink.mcs9", "MCS9 " },
+ { "egprs:downlink:mcs1", "MCS1 " },
+ { "egprs:downlink:mcs2", "MCS2 " },
+ { "egprs:downlink:mcs3", "MCS3 " },
+ { "egprs:downlink:mcs4", "MCS4 " },
+ { "egprs:downlink:mcs5", "MCS5 " },
+ { "egprs:downlink:mcs6", "MCS6 " },
+ { "egprs:downlink:mcs7", "MCS7 " },
+ { "egprs:downlink:mcs8", "MCS8 " },
+ { "egprs:downlink:mcs9", "MCS9 " },
};
static const struct rate_ctr_desc tbf_ul_gprs_ctr_description[] = {
- { "gprs.uplink.cs1", "CS1 " },
- { "gprs.uplink.cs2", "CS2 " },
- { "gprs.uplink.cs3", "CS3 " },
- { "gprs.uplink.cs4", "CS4 " },
+ { "gprs:uplink:cs1", "CS1 " },
+ { "gprs:uplink:cs2", "CS2 " },
+ { "gprs:uplink:cs3", "CS3 " },
+ { "gprs:uplink:cs4", "CS4 " },
};
static const struct rate_ctr_desc tbf_ul_egprs_ctr_description[] = {
- { "egprs.uplink.mcs1", "MCS1 " },
- { "egprs.uplink.mcs2", "MCS2 " },
- { "egprs.uplink.mcs3", "MCS3 " },
- { "egprs.uplink.mcs4", "MCS4 " },
- { "egprs.uplink.mcs5", "MCS5 " },
- { "egprs.uplink.mcs6", "MCS6 " },
- { "egprs.uplink.mcs7", "MCS7 " },
- { "egprs.uplink.mcs8", "MCS8 " },
- { "egprs.uplink.mcs9", "MCS9 " },
+ { "egprs:uplink:mcs1", "MCS1 " },
+ { "egprs:uplink:mcs2", "MCS2 " },
+ { "egprs:uplink:mcs3", "MCS3 " },
+ { "egprs:uplink:mcs4", "MCS4 " },
+ { "egprs:uplink:mcs5", "MCS5 " },
+ { "egprs:uplink:mcs6", "MCS6 " },
+ { "egprs:uplink:mcs7", "MCS7 " },
+ { "egprs:uplink:mcs8", "MCS8 " },
+ { "egprs:uplink:mcs9", "MCS9 " },
};
static const struct rate_ctr_group_desc tbf_ctrg_desc = {
- "pcu.tbf",
+ "pcu:tbf",
"TBF Statistics",
OSMO_STATS_CLASS_SUBSCRIBER,
ARRAY_SIZE(tbf_ctr_description),
@@ -147,7 +150,7 @@ static const struct rate_ctr_group_desc tbf_ctrg_desc = {
};
static const struct rate_ctr_group_desc tbf_dl_gprs_ctrg_desc = {
- "tbf.gprs",
+ "tbf:gprs",
"Data Blocks",
OSMO_STATS_CLASS_SUBSCRIBER,
ARRAY_SIZE(tbf_dl_gprs_ctr_description),
@@ -155,7 +158,7 @@ static const struct rate_ctr_group_desc tbf_dl_gprs_ctrg_desc = {
};
static const struct rate_ctr_group_desc tbf_dl_egprs_ctrg_desc = {
- "tbf.egprs",
+ "tbf:egprs",
"Data Blocks",
OSMO_STATS_CLASS_SUBSCRIBER,
ARRAY_SIZE(tbf_dl_egprs_ctr_description),
@@ -163,7 +166,7 @@ static const struct rate_ctr_group_desc tbf_dl_egprs_ctrg_desc = {
};
static const struct rate_ctr_group_desc tbf_ul_gprs_ctrg_desc = {
- "tbf.gprs",
+ "tbf:gprs",
"Data Blocks",
OSMO_STATS_CLASS_SUBSCRIBER,
ARRAY_SIZE(tbf_ul_gprs_ctr_description),
@@ -171,7 +174,7 @@ static const struct rate_ctr_group_desc tbf_ul_gprs_ctrg_desc = {
};
static const struct rate_ctr_group_desc tbf_ul_egprs_ctrg_desc = {
- "tbf.egprs",
+ "tbf:egprs",
"Data Blocks",
OSMO_STATS_CLASS_SUBSCRIBER,
ARRAY_SIZE(tbf_ul_egprs_ctr_description),
@@ -182,7 +185,7 @@ gprs_rlcmac_tbf::Meas::Meas() :
rssi_sum(0),
rssi_num(0)
{
- timerclear(&rssi_tv);
+ timespecclear(&rssi_tv);
}
gprs_rlcmac_tbf::gprs_rlcmac_tbf(BTS *bts_, gprs_rlcmac_tbf_direction dir) :
@@ -219,9 +222,9 @@ gprs_rlcmac_tbf::gprs_rlcmac_tbf(BTS *bts_, gprs_rlcmac_tbf_direction dir) :
memset(&pdch, 0, sizeof(pdch));
memset(&T, 0, sizeof(T));
memset(&N, 0, sizeof(N));
- memset(&m_rlc, 0, sizeof(m_rlc));
memset(&gsm_timer, 0, sizeof(gsm_timer));
+ m_rlc.init();
m_llc.init();
m_name_buf[0] = '\0';
@@ -913,7 +916,7 @@ static int setup_tbf(struct gprs_rlcmac_tbf *tbf, GprsMs *ms, int8_t use_trx, ui
}
/* set timestamp */
- gettimeofday(&tbf->meas.rssi_tv, NULL);
+ osmo_clock_gettime(CLOCK_MONOTONIC, &tbf->meas.rssi_tv);
tbf->set_ms(ms);
@@ -921,7 +924,7 @@ static int setup_tbf(struct gprs_rlcmac_tbf *tbf, GprsMs *ms, int8_t use_trx, ui
"Allocated: trx = %d, ul_slots = %02x, dl_slots = %02x\n",
tbf->trx->trx_no, tbf->ul_slots(), tbf->dl_slots());
- tbf->m_ctrs = rate_ctr_group_alloc(tbf, &tbf_ctrg_desc, 0);
+ tbf->m_ctrs = rate_ctr_group_alloc(tbf, &tbf_ctrg_desc, next_tbf_ctr_group_id++);
if (!tbf->m_ctrs) {
LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate TBF counters\n");
return -1;
@@ -1004,8 +1007,10 @@ struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs
return NULL;
}
- tbf->m_ul_egprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_ul_egprs_ctrg_desc, 0);
- tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_ul_gprs_ctrg_desc, 0);
+ tbf->m_ul_egprs_ctrs = rate_ctr_group_alloc(tbf,
+ &tbf_ul_egprs_ctrg_desc, tbf->m_ctrs->idx);
+ tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(tbf,
+ &tbf_ul_gprs_ctrg_desc, tbf->m_ctrs->idx);
if (!tbf->m_ul_egprs_ctrs || !tbf->m_ul_gprs_ctrs) {
LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate TBF UL counters\n");
talloc_free(tbf);
@@ -1024,8 +1029,8 @@ gprs_rlcmac_dl_tbf::BandWidth::BandWidth() :
dl_loss_lost(0),
dl_loss_received(0)
{
- timerclear(&dl_bw_tv);
- timerclear(&dl_loss_tv);
+ timespecclear(&dl_bw_tv);
+ timespecclear(&dl_loss_tv);
}
gprs_rlcmac_dl_tbf::gprs_rlcmac_dl_tbf(BTS *bts_) :
@@ -1093,14 +1098,18 @@ struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts, GprsMs
if (tbf->is_egprs_enabled()) {
tbf->set_window_size();
- tbf->m_dl_egprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_dl_egprs_ctrg_desc, 0);
+ tbf->m_dl_egprs_ctrs = rate_ctr_group_alloc(tbf,
+ &tbf_dl_egprs_ctrg_desc,
+ tbf->m_ctrs->idx);
if (!tbf->m_dl_egprs_ctrs) {
LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate EGPRS DL counters\n");
talloc_free(tbf);
return NULL;
}
} else {
- tbf->m_dl_gprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_dl_gprs_ctrg_desc, 0);
+ tbf->m_dl_gprs_ctrs = rate_ctr_group_alloc(tbf,
+ &tbf_dl_gprs_ctrg_desc,
+ tbf->m_ctrs->idx);
if (!tbf->m_dl_gprs_ctrs) {
LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate GPRS DL counters\n");
talloc_free(tbf);
@@ -1114,8 +1123,8 @@ struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts, GprsMs
tbf->m_last_dl_poll_fn = -1;
tbf->m_last_dl_drained_fn = -1;
- gettimeofday(&tbf->m_bw.dl_bw_tv, NULL);
- gettimeofday(&tbf->m_bw.dl_loss_tv, NULL);
+ osmo_clock_gettime(CLOCK_MONOTONIC, &tbf->m_bw.dl_bw_tv);
+ osmo_clock_gettime(CLOCK_MONOTONIC, &tbf->m_bw.dl_loss_tv);
return tbf;
}
@@ -1568,11 +1577,13 @@ struct gprs_rlcmac_ul_tbf *handle_tbf_reject(struct gprs_rlcmac_bts *bts,
TBF_SET_ASS_STATE_UL(ul_tbf, GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ);
ul_tbf->control_ts = ts;
ul_tbf->trx = trx;
- ul_tbf->m_ctrs = rate_ctr_group_alloc(ul_tbf, &tbf_ctrg_desc, 0);
+ ul_tbf->m_ctrs = rate_ctr_group_alloc(ul_tbf, &tbf_ctrg_desc, next_tbf_ctr_group_id++);
ul_tbf->m_ul_egprs_ctrs = rate_ctr_group_alloc(ul_tbf,
- &tbf_ul_egprs_ctrg_desc, 0);
+ &tbf_ul_egprs_ctrg_desc,
+ ul_tbf->m_ctrs->idx);
ul_tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(ul_tbf,
- &tbf_ul_gprs_ctrg_desc, 0);
+ &tbf_ul_gprs_ctrg_desc,
+ ul_tbf->m_ctrs->idx);
if (!ul_tbf->m_ctrs || !ul_tbf->m_ul_egprs_ctrs || !ul_tbf->m_ul_gprs_ctrs) {
LOGPTBF(ul_tbf, LOGL_ERROR, "Cound not allocate TBF UL rate counters\n");
talloc_free(ul_tbf);
diff --git a/src/tbf.h b/src/tbf.h
index 803b294..dc0b050 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -318,7 +318,7 @@ struct gprs_rlcmac_tbf {
unsigned int num_fT_exp; /* number of consecutive fT expirations */
struct Meas {
- struct timeval rssi_tv; /* timestamp for rssi calculation */
+ struct timespec rssi_tv; /* timestamp for rssi calculation */
int32_t rssi_sum; /* sum of rssi values */
int rssi_num; /* number of rssi values added since rssi_tv */
@@ -665,11 +665,11 @@ struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
int32_t m_last_dl_drained_fn;
struct BandWidth {
- struct timeval dl_bw_tv; /* timestamp for dl bw calculation */
+ struct timespec dl_bw_tv; /* timestamp for dl bw calculation */
uint32_t dl_bw_octets; /* number of octets since bw_tv */
uint32_t dl_throughput; /* throughput to be displayed in stats */
- struct timeval dl_loss_tv; /* timestamp for loss calculation */
+ struct timespec dl_loss_tv; /* timestamp for loss calculation */
uint16_t dl_loss_lost; /* sum of lost packets */
uint16_t dl_loss_received; /* sum of received packets */
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index 42b3b1c..e788ccc 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -6091,7 +6091,6 @@ TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) downlink acknowledge
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) ack: (BSN=1176)"RRRRRRRRRRIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIRRRIRRRRRRRRRRRRRRRRRRRRRRRRRRI"(BSN=1287) R=ACK I=NACK
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) DL analysis, range=1176:1288, lost=73, recv=39, skipped=0, bsn=1944, info='RRRRRRRRRRRRRRRRRRRRRRRRRRLRRRLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLRRRRRRRRRR................................................................................................................................................................................................................................................................................................................................................................................'
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) V(B): (V(A)=1186)"NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNAAANAAAAAAAAAAAAAAAAAAAAAAAAAA"(V(S)-1=1287) A=Acked N=Nacked U=Unacked X=Resend-Unacked I=Invalid
-DL packet loss of IMSI= / TLLI=0xffeeddcc: 78%
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) changes state from FLOW to RELEASING
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) free
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) FIXME: Software error: Pending downlink assignment in state GPRS_RLCMAC_DL_ASS_SEND_ASS. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!