diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bts.cpp | 2 | ||||
-rw-r--r-- | src/gprs_ms.cpp | 13 | ||||
-rw-r--r-- | src/gprs_ms.h | 8 | ||||
-rw-r--r-- | src/gprs_rlcmac_ts_alloc.cpp | 14 | ||||
-rw-r--r-- | src/tbf.cpp | 23 | ||||
-rw-r--r-- | src/tbf.h | 6 | ||||
-rw-r--r-- | src/tbf_dl.cpp | 6 |
7 files changed, 56 insertions, 16 deletions
diff --git a/src/bts.cpp b/src/bts.cpp index 7225a78c..ae0a1caa 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -833,7 +833,7 @@ void gprs_rlcmac_pdch::rcv_control_dl_ack_nack(Packet_Downlink_Ack_Nack_t *ack_n "message, so we provide one:\n"); /* This call will register the new TBF with the MS on success */ - tbf_alloc_ul(bts_data(), tbf->trx->trx_no, tbf->ms_class, + tbf_alloc_ul(bts_data(), tbf->trx->trx_no, tbf->ms_class(), tbf->tlli(), tbf->ta(), tbf); /* schedule uplink assignment */ diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp index d047cf57..1ae0fc6b 100644 --- a/src/gprs_ms.cpp +++ b/src/gprs_ms.cpp @@ -72,6 +72,7 @@ GprsMs::GprsMs(uint32_t tlli) : m_new_ul_tlli(0), m_new_dl_tlli(0), m_ta(0), + m_ms_class(0), m_is_idle(true), m_ref(0), m_list(this) @@ -325,3 +326,15 @@ void GprsMs::set_ta(uint8_t ta_) m_ta = ta_; } +void GprsMs::set_ms_class(uint8_t ms_class_) +{ + if (ms_class_ == m_ms_class) + return; + + LOGP(DRLCMAC, LOGL_INFO, + "Modifying MS object, TLLI = 0x%08x, MS class %d -> %d\n", + tlli(), m_ms_class, ms_class_); + + m_ms_class = ms_class_; +} + diff --git a/src/gprs_ms.h b/src/gprs_ms.h index 5c42c50a..8d292f1e 100644 --- a/src/gprs_ms.h +++ b/src/gprs_ms.h @@ -67,6 +67,8 @@ public: uint8_t ta() const; void set_ta(uint8_t ta); + uint8_t ms_class() const; + void set_ms_class(uint8_t ms_class); gprs_llc_queue *llc_queue(); const gprs_llc_queue *llc_queue() const; @@ -108,6 +110,7 @@ private: /* store IMSI for look-up and PCH retransmission */ char m_imsi[16]; uint8_t m_ta; + uint8_t m_ms_class; gprs_llc_queue m_llc_queue; bool m_is_idle; @@ -140,6 +143,11 @@ inline uint8_t GprsMs::ta() const return m_ta; } +inline uint8_t GprsMs::ms_class() const +{ + return m_ms_class; +} + inline void GprsMs::set_timeout(unsigned secs) { m_delay = secs; diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index 27b01d79..e8bedadd 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -146,7 +146,7 @@ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, uint8_t ts; LOGP(DRLCMAC, LOGL_DEBUG, "Slot Allocation (Algorithm A) for class " - "%d\n", tbf->ms_class); + "%d\n", tbf->ms_class()); ts = find_enabled_pdch(tbf->trx, 0); if (ts == 8) @@ -540,16 +540,16 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, uint8_t slotcount = 0; - if (tbf->ms_class >= 32) { + if (tbf->ms_class() >= 32) { LOGP(DRLCMAC, LOGL_ERROR, "Multislot class %d out of range.\n", - tbf->ms_class); + tbf->ms_class()); return -EINVAL; } - if (tbf->ms_class) { - ms_class = &gprs_ms_multislot_class[tbf->ms_class]; + if (tbf->ms_class()) { + ms_class = &gprs_ms_multislot_class[tbf->ms_class()]; LOGP(DRLCMAC, LOGL_DEBUG, "Slot Allocation (Algorithm B) for " - "class %d\n", tbf->ms_class); + "class %d\n", tbf->ms_class()); } else { ms_class = &gprs_ms_multislot_class[12]; LOGP(DRLCMAC, LOGL_DEBUG, "Slot Allocation (Algorithm B) for " @@ -558,7 +558,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, if (ms_class->tx == MS_NA) { LOGP(DRLCMAC, LOGL_NOTICE, "Multislot class %d not " - "applicable.\n", tbf->ms_class); + "applicable.\n", tbf->ms_class()); return -EINVAL; } diff --git a/src/tbf.cpp b/src/tbf.cpp index 136226cb..e058348f 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -102,6 +102,19 @@ void gprs_rlcmac_tbf::set_ta(uint8_t ta) m_ta = ta; } +uint8_t gprs_rlcmac_tbf::ms_class() const +{ + return m_ms ? m_ms->ms_class() : m_ms_class; +} + +void gprs_rlcmac_tbf::set_ms_class(uint8_t ms_class_) +{ + if (ms()) + ms()->set_ms_class(ms_class_); + + m_ms_class = ms_class_; +} + gprs_llc_queue *gprs_rlcmac_tbf::llc_queue() { return m_ms ? m_ms->llc_queue() : NULL; @@ -141,8 +154,12 @@ void gprs_rlcmac_tbf::update_ms(uint32_t tlli, enum gprs_rlcmac_tbf_direction di new_ms->set_timeout(bts->bts_data()->ms_idle_sec); } - if (dir == GPRS_RLCMAC_UL_TBF) + if (dir == GPRS_RLCMAC_UL_TBF) { new_ms->set_ta(m_ta); + } + + if (m_ms_class) + new_ms->set_ms_class(m_ms_class); set_ms(new_ms); return; @@ -440,7 +457,7 @@ static int setup_tbf(struct gprs_rlcmac_tbf *tbf, struct gprs_rlcmac_bts *bts, tbf->bts = bts->bts; tbf->m_tfi = tfi; tbf->trx = &bts->trx[trx]; - tbf->ms_class = ms_class; + tbf->set_ms_class(ms_class); /* select algorithm */ rc = bts->alloc_algorithm(bts, old_tbf, tbf, bts->alloc_algorithm_curst, single_slot); @@ -921,7 +938,7 @@ void tbf_print_vty_info(struct vty *vty, struct llist_head *ltbf) vty_out(vty, " created=%lu state=%08x 1st_TS=%d 1st_cTS=%d ctrl_TS=%d " "MS_CLASS=%d%s", tbf->created_ts(), tbf->state_flags, tbf->first_ts, - tbf->first_common_ts, tbf->control_ts, tbf->ms_class, + tbf->first_common_ts, tbf->control_ts, tbf->ms_class(), VTY_NEWLINE); vty_out(vty, " TS_alloc="); for (int i = 0; i < 8; i++) { @@ -151,6 +151,8 @@ struct gprs_rlcmac_tbf { void assign_imsi(const char *imsi); uint8_t ta() const; void set_ta(uint8_t); + uint8_t ms_class() const; + void set_ms_class(uint8_t); gprs_llc_queue *llc_queue(); const gprs_llc_queue *llc_queue() const; @@ -167,7 +169,6 @@ struct gprs_rlcmac_tbf { uint8_t first_common_ts; /* first TS that the phone can send and reveive simultaniously */ uint8_t control_ts; /* timeslot control messages and polling */ - uint8_t ms_class; struct gprs_rlcmac_pdch *pdch[8]; /* list of PDCHs allocated to TBF */ gprs_llc m_llc; @@ -229,8 +230,9 @@ protected: class GprsMs *m_ms; - /* Field to take the TA value if no MS is associated */ + /* Fields to take the TA/MS class values if no MS is associated */ uint8_t m_ta; + uint8_t m_ms_class; private: mutable char m_name_buf[60]; diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 85cd7513..d1ed1cd9 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -58,8 +58,8 @@ int bssgp_tx_llc_discarded(struct bssgp_bvc_ctx *bctx, uint32_t tlli, static inline void tbf_update_ms_class(struct gprs_rlcmac_tbf *tbf, const uint8_t ms_class) { - if (!tbf->ms_class && ms_class) - tbf->ms_class = ms_class; + if (!tbf->ms_class() && ms_class) + tbf->set_ms_class(ms_class); } static void llc_timer_cb(void *_tbf) @@ -777,7 +777,7 @@ void gprs_rlcmac_dl_tbf::reuse_tbf(const uint8_t *data, const uint16_t len) tfi = bts->tfi_find_free(GPRS_RLCMAC_DL_TBF, &trx, this->trx->trx_no); if (tfi >= 0) new_tbf = tbf_alloc_dl_tbf(bts->bts_data(), NULL, tfi, trx, - ms_class, 0); + ms_class(), 0); if (!new_tbf) { LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n"); |