aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_ms.cpp
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-30 08:52:54 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-07-03 15:37:16 +0200
commit23f93a15ca759b55b4713148f06d9a2d152278ab (patch)
treeb3a3d73b9985ad109c66c39a5392f3df91d5f9b5 /src/gprs_ms.cpp
parentec478756ccc8e8df264811741bfc9c362cb9233d (diff)
ms: Add support for slot reservation
In contrast to the slots currently used by existing TBFs, the reserved slots refer to the time slots that can be used for newly allocated TBFs without causing conflicts (given that the first common TS does not change). They correspond to the potential use of the PDCHs and can be used to achieve a more uniform slot allocation. This commit adds bit set based methods to GprsMs and gprs_rlcmac_trx and a counter to gprs_rlcmac_pdch. The current TRX will also be stored in the MS object. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/gprs_ms.cpp')
-rw-r--r--src/gprs_ms.cpp37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index 4c0ecfde..f62facf5 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -91,7 +91,10 @@ GprsMs::GprsMs(BTS *bts, uint32_t tlli) :
m_ref(0),
m_list(this),
m_delay(0),
- m_nack_rate_dl(0)
+ m_nack_rate_dl(0),
+ m_reserved_dl_slots(0),
+ m_reserved_ul_slots(0),
+ m_current_trx(NULL)
{
LOGP(DRLCMAC, LOGL_INFO, "Creating MS object, TLLI = 0x%08x\n", tlli);
@@ -115,6 +118,8 @@ GprsMs::~GprsMs()
{
LOGP(DRLCMAC, LOGL_INFO, "Destroying MS object, TLLI = 0x%08x\n", tlli());
+ set_reserved_slots(NULL, 0, 0);
+
if (osmo_timer_pending(&m_timer))
osmo_timer_del(&m_timer);
@@ -240,8 +245,12 @@ void GprsMs::detach_tbf(gprs_rlcmac_tbf *tbf)
if (tbf->ms() == this)
tbf->set_ms(NULL);
- if (!m_dl_tbf && !m_ul_tbf && tlli() != 0)
- start_timer();
+ if (!m_dl_tbf && !m_ul_tbf) {
+ set_reserved_slots(NULL, 0, 0);
+
+ if (tlli() != 0)
+ start_timer();
+ }
update_status();
}
@@ -529,6 +538,28 @@ int GprsMs::first_common_ts() const
return -1;
}
+void GprsMs::set_reserved_slots(gprs_rlcmac_trx *trx,
+ uint8_t ul_slots, uint8_t dl_slots)
+{
+ if (m_current_trx) {
+ m_current_trx->unreserve_slots(GPRS_RLCMAC_DL_TBF,
+ m_reserved_dl_slots);
+ m_current_trx->unreserve_slots(GPRS_RLCMAC_UL_TBF,
+ m_reserved_ul_slots);
+ m_reserved_dl_slots = 0;
+ m_reserved_ul_slots = 0;
+ }
+ m_current_trx = trx;
+ if (trx) {
+ m_reserved_dl_slots = dl_slots;
+ m_reserved_ul_slots = ul_slots;
+ m_current_trx->reserve_slots(GPRS_RLCMAC_DL_TBF,
+ m_reserved_dl_slots);
+ m_current_trx->reserve_slots(GPRS_RLCMAC_UL_TBF,
+ m_reserved_ul_slots);
+ }
+}
+
gprs_rlcmac_tbf *GprsMs::tbf(enum gprs_rlcmac_tbf_direction dir) const
{
switch (dir) {