aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-05-22 18:02:51 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-05-28 13:59:25 +0200
commit1db67e0a35a479ef20b871c459ea3f3e0155b620 (patch)
tree7c15b7dbd27c6f181dcb9fd827d18627f76e4213
parent9200ce60196a289968144582f1acfac25e17eed5 (diff)
tbf: Remove TimingAdvance storage
Currently the TA storage stores up to 30 TLLI->TA mappings, if more entries are created the oldest one is dropped. In theory this can lead to missing TA information if many MS are present. This commit removes the TimingAdvance class completely, since the TA value is now stored in the GprsMs objects. Note that the GprsMs objects are currently not kept after the TBFs have detached from them, so the TA values are now kept for a shorter time than before. Ticket: #1674 Sponsored-by: On-Waves ehf
-rw-r--r--src/Makefile.am2
-rw-r--r--src/bts.cpp8
-rw-r--r--src/bts.h8
-rw-r--r--src/pcu_main.cpp2
-rw-r--r--src/ta.cpp142
-rw-r--r--src/ta.h40
6 files changed, 7 insertions, 195 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index b5456e0..35ba7a9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -49,7 +49,6 @@ libgprs_la_SOURCES = \
bts.cpp \
poll_controller.cpp \
encoding.cpp \
- ta.cpp \
sba.cpp \
decoding.cpp \
llc.cpp \
@@ -92,7 +91,6 @@ noinst_HEADERS = \
bts.h \
poll_controller.h \
encoding.h \
- ta.h \
sba.h \
rlc.h \
decoding.h \
diff --git a/src/bts.cpp b/src/bts.cpp
index 010b8e8..7225a78 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -945,7 +945,13 @@ void gprs_rlcmac_pdch::rcv_measurement_report(Packet_Measurement_Report_t *repor
"block, but there is no resource request "
"scheduled! TLLI=0x%08x\n", report->TLLI);
} else {
- bts()->timing_advance()->remember(report->TLLI, sba->ta);
+ GprsMs *ms = bts()->ms_store().get_ms(report->TLLI);
+ if (!ms)
+ LOGP(DRLCMAC, LOGL_NOTICE, "MS send measurement "
+ "but TLLI 0x%08x is unknown\n", report->TLLI);
+ else
+ ms->set_ta(sba->ta);
+
bts()->sba()->free_sba(sba);
}
gprs_rlcmac_meas_rep(report);
diff --git a/src/bts.h b/src/bts.h
index 2e2d146..28ecfc1 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -30,7 +30,6 @@ extern "C" {
#include "poll_controller.h"
#include "sba.h"
-#include "ta.h"
#include "tbf.h"
#include "gprs_ms_storage.h"
#endif
@@ -197,7 +196,6 @@ public:
struct gprs_rlcmac_bts *bts_data();
SBAController *sba();
- TimingAdvance *timing_advance();
/** TODO: change the number to unsigned */
void set_current_frame_number(int frame_number);
@@ -254,7 +252,6 @@ private:
struct gprs_rlcmac_bts m_bts;
PollController m_pollController;
SBAController m_sba;
- TimingAdvance m_ta;
struct rate_ctr_group *m_ratectrs;
gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi, uint8_t trx, enum gprs_rlcmac_tbf_direction dir);
@@ -271,11 +268,6 @@ inline int BTS::current_frame_number() const
return m_cur_fn;
}
-inline TimingAdvance *BTS::timing_advance()
-{
- return &m_ta;
-}
-
inline SBAController *BTS::sba()
{
return &m_sba;
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index 08feb89..75e1263 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -244,8 +244,6 @@ int main(int argc, char *argv[])
pcu_l1if_close();
- bts->bts->timing_advance()->flush();
-
talloc_report_full(tall_pcu_ctx, stderr);
talloc_free(tall_pcu_ctx);
diff --git a/src/ta.cpp b/src/ta.cpp
deleted file mode 100644
index 0bc1d66..0000000
--- a/src/ta.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * ta.cpp timing advance handling
- * Copyright (C) 2012 Ivan Klyuchnikov
- * Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu>
- * Copyright (C) 2013 by Holger Hans Peter Freyther
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <ta.h>
-#include <gprs_rlcmac.h>
-
-extern "C" {
- #include <osmocom/core/talloc.h>
-}
-
-#include <errno.h>
-
-extern void *tall_pcu_ctx;
-
-/*
- * timing advance memory
- */
-
-/* enable to debug timing advance memory */
-//#define DEBUG_TA
-
-struct gprs_rlcmac_ta {
- struct llist_head list;
- uint32_t tlli;
- uint8_t ta;
-};
-
-TimingAdvance::TimingAdvance()
- : m_ta_len(0)
-{
- INIT_LLIST_HEAD(&m_ta_list);
-}
-
-/* remember timing advance of a given TLLI */
-int TimingAdvance::remember(uint32_t tlli, uint8_t ta)
-{
- struct gprs_rlcmac_ta *ta_entry;
-
- /* check for existing entry */
- llist_for_each_entry(ta_entry, &m_ta_list, list) {
- if (ta_entry->tlli == tlli) {
-#ifdef DEBUG_TA
- fprintf(stderr, "update %08x %d\n", tlli, ta);
-#endif
- ta_entry->ta = ta;
- /* relink to end of list */
- llist_del(&ta_entry->list);
- llist_add_tail(&ta_entry->list, &m_ta_list);
- return 0;
- }
- }
-
-#ifdef DEBUG_TA
- fprintf(stderr, "remember %08x %d\n", tlli, ta);
-#endif
- /* if list is full, remove oldest entry */
- if (m_ta_len == 30) {
- ta_entry = llist_entry(m_ta_list.next,
- struct gprs_rlcmac_ta, list);
- llist_del(&ta_entry->list);
- talloc_free(ta_entry);
- m_ta_len--;
- }
-
- /* create new TA entry */
- ta_entry = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_ta);
- if (!ta_entry)
- return -ENOMEM;
-
- ta_entry->tlli = tlli;
- ta_entry->ta = ta;
- llist_add_tail(&ta_entry->list, &m_ta_list);
- m_ta_len++;
-
- return 0;
-}
-
-int TimingAdvance::recall(uint32_t tlli)
-{
- struct gprs_rlcmac_ta *ta_entry;
- uint8_t ta;
-
- llist_for_each_entry(ta_entry, &m_ta_list, list) {
- if (ta_entry->tlli == tlli) {
- ta = ta_entry->ta;
-#ifdef DEBUG_TA
- fprintf(stderr, "recall %08x %d\n", tlli, ta);
-#endif
- return ta;
- }
- }
-#ifdef DEBUG_TA
- fprintf(stderr, "no entry for %08x\n", tlli);
-#endif
-
- return -EINVAL;
-}
-
-int TimingAdvance::flush()
-{
- struct gprs_rlcmac_ta *ta_entry;
- int count = 0;
-
- while (!llist_empty(&m_ta_list)) {
- ta_entry = llist_entry(m_ta_list.next,
- struct gprs_rlcmac_ta, list);
-#ifdef DEBUG_TA
- fprintf(stderr, "flush entry %08x %d\n", ta_entry->tlli,
- ta_entry->ta);
-#endif
- llist_del(&ta_entry->list);
- talloc_free(ta_entry);
- count++;
- }
- m_ta_len = 0;
-
- return count;
-}
-
-int TimingAdvance::update(uint32_t, uint32_t new_tlli, uint8_t ta)
-{
- /* for now just add the new entry and don't bother about the old one */
- return remember(new_tlli, ta);
-}
diff --git a/src/ta.h b/src/ta.h
deleted file mode 100644
index 9b64280..0000000
--- a/src/ta.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 Ivan Klyuchnikov
- * Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu>
- * Copyright (C) 2013 by Holger Hans Peter Freyther
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-#pragma once
-
-extern "C" {
-#include <osmocom/core/linuxlist.h>
-}
-
-#include <stdint.h>
-
-class TimingAdvance {
-public:
- TimingAdvance();
-
- int update(uint32_t old_tlli, uint32_t new_tlli, uint8_t ta);
- int remember(uint32_t tlli, uint8_t ta);
- int recall(uint32_t tlli);
- int flush();
-
-private:
- size_t m_ta_len;
- llist_head m_ta_list;
-};