aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-30 14:10:13 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-07-07 10:35:28 +0200
commitcc9358f95aca618db451faf53971c45dfe0b505a (patch)
tree84b5d5e37292e609ddfb8c7a2336ba5cad42cb4c /src
parent16c6ecc3657f62728845764731c189b3cb8daca2 (diff)
tbf: Keep a set of used TFI and USF per PDCH
Currently is is rather expensive to get TFI and USF usage per PDCH, because the TBFs need to be scanned to get that information. This commit adds corresponding bit sets which get updated by the attach_tbf/detach_tbf methods of the gprs_rlcmac_pdch class. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src')
-rw-r--r--src/bts.cpp28
-rw-r--r--src/bts.h15
2 files changed, 39 insertions, 4 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 87a22def..b96971db 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -1137,18 +1137,38 @@ gprs_rlcmac_dl_tbf *gprs_rlcmac_pdch::dl_tbf_by_tfi(uint8_t tfi)
void gprs_rlcmac_pdch::attach_tbf(gprs_rlcmac_tbf *tbf)
{
+ gprs_rlcmac_ul_tbf *ul_tbf;
+
m_num_tbfs[tbf->direction] += 1;
- LOGP(DRLCMAC, LOGL_INFO, "PDCH(TS %d, TRX %d): Attaching %s, %d TBFs.\n",
- ts_no, trx_no(), tbf->name(), m_num_tbfs[tbf->direction]);
+ if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
+ ul_tbf = static_cast<gprs_rlcmac_ul_tbf *>(tbf);
+ m_assigned_usf |= 1 << ul_tbf->m_usf[ts_no];
+ }
+ m_assigned_tfi |= 1UL << tbf->tfi();
+
+ LOGP(DRLCMAC, LOGL_INFO, "PDCH(TS %d, TRX %d): Attaching %s, %d TBFs, "
+ "USFs = %02x, TFIs = %08x.\n",
+ ts_no, trx_no(), tbf->name(), m_num_tbfs[tbf->direction],
+ m_assigned_usf, m_assigned_tfi);
}
void gprs_rlcmac_pdch::detach_tbf(gprs_rlcmac_tbf *tbf)
{
+ gprs_rlcmac_ul_tbf *ul_tbf;
+
OSMO_ASSERT(m_num_tbfs[tbf->direction] > 0);
m_num_tbfs[tbf->direction] -= 1;
- LOGP(DRLCMAC, LOGL_INFO, "PDCH(TS %d, TRX %d): Detaching %s, %d TBFs.\n",
- ts_no, trx_no(), tbf->name(), m_num_tbfs[tbf->direction]);
+ if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
+ ul_tbf = static_cast<gprs_rlcmac_ul_tbf *>(tbf);
+ m_assigned_usf &= ~(1 << ul_tbf->m_usf[ts_no]);
+ }
+ m_assigned_tfi &= ~(1UL << tbf->tfi());
+
+ LOGP(DRLCMAC, LOGL_INFO, "PDCH(TS %d, TRX %d): Detaching %s, %d TBFs, "
+ "USFs = %02x, TFIs = %08x.\n",
+ ts_no, trx_no(), tbf->name(), m_num_tbfs[tbf->direction],
+ m_assigned_usf, m_assigned_tfi);
}
void gprs_rlcmac_pdch::reserve(enum gprs_rlcmac_tbf_direction dir)
diff --git a/src/bts.h b/src/bts.h
index 79640af0..b9909ce3 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -75,6 +75,9 @@ struct gprs_rlcmac_pdch {
void reserve(enum gprs_rlcmac_tbf_direction dir);
void unreserve(enum gprs_rlcmac_tbf_direction dir);
unsigned num_reserved(enum gprs_rlcmac_tbf_direction dir) const;
+
+ uint8_t assigned_usf() const;
+ uint32_t assigned_tfi() const;
#endif
uint8_t m_is_enabled; /* TS is enabled */
@@ -105,6 +108,8 @@ private:
uint8_t m_num_tbfs[2];
uint8_t m_num_reserved[2];
+ uint8_t m_assigned_usf; /* bit set */
+ uint32_t m_assigned_tfi; /* bit set */
};
struct gprs_rlcmac_trx {
@@ -333,6 +338,16 @@ inline unsigned gprs_rlcmac_pdch::num_reserved(
return gprs_rlcmac_pdch::m_num_reserved[dir];
}
+inline uint8_t gprs_rlcmac_pdch::assigned_usf() const
+{
+ return m_assigned_usf;
+}
+
+inline uint32_t gprs_rlcmac_pdch::assigned_tfi() const
+{
+ return m_assigned_tfi;
+}
+
inline struct rate_ctr_group *BTS::rate_counters() const
{
return m_ratectrs;