aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-05-28 19:07:01 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-08 09:38:44 +0200
commit489a2b35d87610fb077a51de696555a54e5fb247 (patch)
tree6986b156cbb3f1a7a01b211e919a25d2c39edea6
parent10ed79553a8e7241b69c4155325c29105c7a606d (diff)
tbf: Move the LLC queue to GprsMs
Currently the enqueued DL LLC messages which have not yet passed to RLC/MAC encoding are eventually copied from one TBF to the next one (see gprs_rlcmac_dl_tbf::reuse_tbf). Since the enqueued LLC messages are related to a specific MS, they should be stored at that layer. This commit moves the gprs_llc_queue object to GprsMs and changes the TBF's accessor methods accordingly. The LLC copying code is removed from gprs_rlcmac_dl_tbf::reuse_tbf(). Sponsored-by: On-Waves ehf
-rw-r--r--src/gprs_ms.cpp2
-rw-r--r--src/gprs_ms.h16
-rw-r--r--src/tbf.cpp12
-rw-r--r--src/tbf.h11
-rw-r--r--src/tbf_dl.cpp9
5 files changed, 31 insertions, 19 deletions
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index f5b92d2..d047cf5 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -81,6 +81,7 @@ GprsMs::GprsMs(uint32_t tlli) :
m_imsi[0] = 0;
memset(&m_timer, 0, sizeof(m_timer));
m_timer.cb = GprsMs::timeout;
+ m_llc_queue.init();
}
GprsMs::~GprsMs()
@@ -99,6 +100,7 @@ GprsMs::~GprsMs()
m_dl_tbf->set_ms(NULL);
m_dl_tbf = NULL;
}
+ m_llc_queue.clear(NULL);
}
void* GprsMs::operator new(size_t size)
diff --git a/src/gprs_ms.h b/src/gprs_ms.h
index db55bad..5c42c50 100644
--- a/src/gprs_ms.h
+++ b/src/gprs_ms.h
@@ -25,6 +25,7 @@ struct gprs_rlcmac_dl_tbf;
struct gprs_rlcmac_ul_tbf;
#include "cxx_linuxlist.h"
+#include "llc.h"
extern "C" {
#include <osmocom/core/timer.h>
@@ -67,6 +68,9 @@ public:
uint8_t ta() const;
void set_ta(uint8_t ta);
+ gprs_llc_queue *llc_queue();
+ const gprs_llc_queue *llc_queue() const;
+
void set_timeout(unsigned secs);
void attach_tbf(gprs_rlcmac_tbf *tbf);
@@ -104,6 +108,7 @@ private:
/* store IMSI for look-up and PCH retransmission */
char m_imsi[16];
uint8_t m_ta;
+ gprs_llc_queue m_llc_queue;
bool m_is_idle;
int m_ref;
@@ -139,3 +144,14 @@ inline void GprsMs::set_timeout(unsigned secs)
{
m_delay = secs;
}
+
+inline gprs_llc_queue *GprsMs::llc_queue()
+{
+ return &m_llc_queue;
+}
+
+inline const gprs_llc_queue *GprsMs::llc_queue() const
+{
+ return &m_llc_queue;
+}
+
diff --git a/src/tbf.cpp b/src/tbf.cpp
index dc26cc7..136226c 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -102,6 +102,16 @@ void gprs_rlcmac_tbf::set_ta(uint8_t ta)
m_ta = ta;
}
+gprs_llc_queue *gprs_rlcmac_tbf::llc_queue()
+{
+ return m_ms ? m_ms->llc_queue() : NULL;
+}
+
+const gprs_llc_queue *gprs_rlcmac_tbf::llc_queue() const
+{
+ return m_ms ? m_ms->llc_queue() : NULL;
+}
+
void gprs_rlcmac_tbf::set_ms(GprsMs *ms)
{
if (m_ms == ms)
@@ -219,7 +229,6 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf)
tbf_name(tbf));
tbf->stop_timer();
#warning "TODO: Could/Should generate bssgp_tx_llc_discarded"
- tbf->llc_queue()->clear(tbf->bts);
tbf_unlink_pdch(tbf);
llist_del(&tbf->list.list);
@@ -451,7 +460,6 @@ static int setup_tbf(struct gprs_rlcmac_tbf *tbf, struct gprs_rlcmac_bts *bts,
gettimeofday(&tbf->meas.rssi_tv, NULL);
tbf->m_llc.init();
- tbf->llc_queue()->init();
return 0;
}
diff --git a/src/tbf.h b/src/tbf.h
index b665a88..7f8d660 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -232,7 +232,6 @@ protected:
/* Field to take the TA value if no MS is associated */
uint8_t m_ta;
- gprs_llc_queue m_llc_queue;
private:
mutable char m_name_buf[60];
};
@@ -289,16 +288,6 @@ inline GprsMs *gprs_rlcmac_tbf::ms() const
return m_ms;
}
-inline gprs_llc_queue *gprs_rlcmac_tbf::llc_queue()
-{
- return &m_llc_queue;
-}
-
-inline const gprs_llc_queue *gprs_rlcmac_tbf::llc_queue() const
-{
- return &m_llc_queue;
-}
-
inline bool gprs_rlcmac_tbf::is_tlli_valid() const
{
return tlli() != 0;
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 5b9c06c..85cd751 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -771,7 +771,6 @@ void gprs_rlcmac_dl_tbf::reuse_tbf(const uint8_t *data, const uint16_t len)
uint8_t trx;
struct gprs_rlcmac_dl_tbf *new_tbf = NULL;
int8_t tfi; /* must be signed */
- struct msgb *msg;
bts->tbf_reused();
@@ -790,13 +789,10 @@ void gprs_rlcmac_dl_tbf::reuse_tbf(const uint8_t *data, const uint16_t len)
new_tbf->set_ms(ms());
- /* Copy over all data to the new TBF */
+ /* Start with the passed frame */
new_tbf->m_llc.put_frame(data, len);
bts->llc_frame_sched();
- while ((msg = llc_queue()->dequeue()))
- new_tbf->llc_queue()->enqueue(msg);
-
/* reset rlc states */
m_tx_counter = 0;
m_wait_confirm = 0;
@@ -836,7 +832,8 @@ bool gprs_rlcmac_dl_tbf::need_control_ts() const
bool gprs_rlcmac_dl_tbf::have_data() const
{
- return m_llc.chunk_size() > 0 || llc_queue()->size() > 0;
+ return m_llc.chunk_size() > 0 ||
+ (llc_queue() && llc_queue()->size() > 0);
}
int gprs_rlcmac_dl_tbf::frames_since_last_poll(unsigned fn) const