From 6dbe822062d54a6c765c6fa7e2c6b79a5dff29b1 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Fri, 29 May 2015 10:37:09 +0200 Subject: llc: Separate LLC queue handling from gprs_llc Currently the gprs_llc class handles both LLC queueing and the partition into smaller pieces for RLC/MAC encapsulation. This hinders the separation of TBF and MS related data, since LLC queueing belongs to the MS related code while the RLC/MAC encoding/decoding belongs to the TBF layer. This commits takes the LLC queueing related methods and members and puts them into a new class gprs_llc_queue. It puts the queueing object into gprs_rlcmac_tbf and adds accessor functions. The implementation in tbf.cpp and tbf_dl.cpp is adapted accordingly. Ticket: #1674 Sponsored-by: On-Waves ehf --- src/llc.h | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'src/llc.h') diff --git a/src/llc.h b/src/llc.h index 11a0c7ed..251712a3 100644 --- a/src/llc.h +++ b/src/llc.h @@ -27,24 +27,18 @@ * I represent the LLC data to a MS */ struct gprs_llc { - static void calc_pdu_lifetime(BTS *bts, const uint16_t pdu_delay_csec, struct timeval *tv); - static bool is_frame_expired(struct timeval *now, struct timeval *tv); static bool is_user_data_frame(uint8_t *data, size_t len); void init(); void reset(); void reset_frame_space(); - void enqueue(struct msgb *llc_msg); - struct msgb *dequeue(); - void put_frame(const uint8_t *data, size_t len); void put_dummy_frame(size_t req_len); void append_frame(const uint8_t *data, size_t len); void consume(size_t len); void consume(uint8_t *data, size_t len); - void clear(BTS *bts); uint16_t chunk_size() const; uint16_t remaining_space() const; @@ -55,12 +49,31 @@ struct gprs_llc { uint8_t frame[LLC_MAX_LEN]; /* current DL or UL frame */ 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 */ +}; + +/** + * I store the LLC frames that come from the SGSN. + */ +struct gprs_llc_queue { + static void calc_pdu_lifetime(BTS *bts, const uint16_t pdu_delay_csec, struct timeval *tv); + static bool is_frame_expired(struct timeval *now, struct timeval *tv); + static bool is_user_data_frame(uint8_t *data, size_t len); + + void init(); + + void enqueue(struct msgb *llc_msg); + struct msgb *dequeue(); + void clear(BTS *bts); + size_t size() const; +private: uint32_t m_avg_queue_delay; /* Average delay of data going through the queue */ size_t m_queue_size; + struct llist_head m_queue; /* queued LLC DL data */ + }; + inline uint16_t gprs_llc::chunk_size() const { return m_length - m_index; @@ -92,3 +105,8 @@ inline bool gprs_llc::fits_in_current_frame(uint8_t chunk_size) const { return m_length + chunk_size <= LLC_MAX_LEN; } + +inline size_t gprs_llc_queue::size() const +{ + return this ? m_queue_size : 0; +} -- cgit v1.2.3