aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-12-04 17:10:54 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-12-18 12:09:47 +0100
commit4df5f1d8f07c54542a8d7f577957632fa6c67314 (patch)
tree6a4b9aa8b1269cff04fabdf68f9a1128448fdc92
parent0d80dba26a2f3c204f6a7897c119bd0c1ca87988 (diff)
llc: Count the number of frames queued inside the LLC queue
-rw-r--r--src/llc.cpp6
-rw-r--r--src/llc.h2
-rw-r--r--src/tbf.cpp4
3 files changed, 10 insertions, 2 deletions
diff --git a/src/llc.cpp b/src/llc.cpp
index 6ad04c0..c557584 100644
--- a/src/llc.cpp
+++ b/src/llc.cpp
@@ -44,6 +44,7 @@ void gprs_llc::reset_frame_space()
void gprs_llc::enqueue(struct msgb *llc_msg)
{
+ m_queue_size += 1;
msgb_enqueue(&queue, llc_msg);
}
@@ -69,16 +70,21 @@ void gprs_llc::clear(BTS *bts)
bts->llc_dropped_frame();
msgb_free(msg);
}
+
+ m_queue_size = 0;
}
void gprs_llc::init()
{
INIT_LLIST_HEAD(&queue);
+ m_queue_size = 0;
reset();
}
struct msgb *gprs_llc::dequeue()
{
+ if (m_queue_size > 0)
+ m_queue_size -= 1;
return msgb_dequeue(&queue);
}
diff --git a/src/llc.h b/src/llc.h
index f50419c..f29c929 100644
--- a/src/llc.h
+++ b/src/llc.h
@@ -54,6 +54,8 @@ struct gprs_llc {
uint16_t m_index; /* current write/read position of frame */
uint16_t m_length; /* len of current DL LLC_frame, 0 == no frame */
struct llist_head queue; /* queued LLC DL data */
+
+ size_t m_queue_size;
};
inline uint16_t gprs_llc::chunk_size() const
diff --git a/src/tbf.cpp b/src/tbf.cpp
index f2ea9dc..6442108 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -636,8 +636,8 @@ struct msgb *gprs_rlcmac_tbf::llc_dequeue(bssgp_bvc_ctx *bctx)
if (gprs_llc::is_frame_expired(&tv_now, tv)) {
LOGP(DRLCMACDL, LOGL_NOTICE, "%s Discarding LLC PDU "
- "because lifetime limit reached\n",
- tbf_name(this));
+ "because lifetime limit reached. Queue size %zu\n",
+ tbf_name(this), m_llc.m_queue_size);
bts->llc_timedout_frame();
frames++;
octets += msg->len;