aboutsummaryrefslogtreecommitdiffstats
path: root/src/llc.h
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-05-29 10:37:09 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-08 09:35:11 +0200
commit6dbe822062d54a6c765c6fa7e2c6b79a5dff29b1 (patch)
tree7f1f703d29edfc1b03b3e0c4d70123b7571c9e0c /src/llc.h
parentb3f713bd7be2af9bf7c3168099d35df089020164 (diff)
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
Diffstat (limited to 'src/llc.h')
-rw-r--r--src/llc.h32
1 files changed, 25 insertions, 7 deletions
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;
+}