llc: Count the number of frames queued inside the LLC queue

This commit is contained in:
Holger Hans Peter Freyther 2013-12-04 17:10:54 +01:00
parent 88553abf4d
commit 550bb88a9e
3 changed files with 10 additions and 2 deletions

View File

@ -42,6 +42,7 @@ void gprs_llc::reset_frame_space()
void gprs_llc::enqueue(struct msgb *llc_msg) void gprs_llc::enqueue(struct msgb *llc_msg)
{ {
m_queue_size += 1;
msgb_enqueue(&queue, llc_msg); msgb_enqueue(&queue, llc_msg);
} }
@ -67,16 +68,21 @@ void gprs_llc::clear(BTS *bts)
bts->llc_dropped_frame(); bts->llc_dropped_frame();
msgb_free(msg); msgb_free(msg);
} }
m_queue_size = 0;
} }
void gprs_llc::init() void gprs_llc::init()
{ {
INIT_LLIST_HEAD(&queue); INIT_LLIST_HEAD(&queue);
m_queue_size = 0;
reset(); reset();
} }
struct msgb *gprs_llc::dequeue() struct msgb *gprs_llc::dequeue()
{ {
if (m_queue_size > 0)
m_queue_size -= 1;
return msgb_dequeue(&queue); return msgb_dequeue(&queue);
} }

View File

@ -54,6 +54,8 @@ struct gprs_llc {
uint16_t m_index; /* current write/read position of frame */ uint16_t m_index; /* current write/read position of frame */
uint16_t m_length; /* len of current DL LLC_frame, 0 == no frame */ uint16_t m_length; /* len of current DL LLC_frame, 0 == no frame */
struct llist_head queue; /* queued LLC DL data */ struct llist_head queue; /* queued LLC DL data */
size_t m_queue_size;
}; };
inline uint16_t gprs_llc::chunk_size() const inline uint16_t gprs_llc::chunk_size() const

View File

@ -636,8 +636,8 @@ struct msgb *gprs_rlcmac_tbf::llc_dequeue(bssgp_bvc_ctx *bctx)
if (gprs_llc::is_frame_expired(&tv_now, tv)) { if (gprs_llc::is_frame_expired(&tv_now, tv)) {
LOGP(DRLCMACDL, LOGL_NOTICE, "%s Discarding LLC PDU " LOGP(DRLCMACDL, LOGL_NOTICE, "%s Discarding LLC PDU "
"because lifetime limit reached\n", "because lifetime limit reached. Queue size %zu\n",
tbf_name(this)); tbf_name(this), m_llc.m_queue_size);
bts->llc_timedout_frame(); bts->llc_timedout_frame();
frames++; frames++;
octets += msg->len; octets += msg->len;