aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-30 09:18:30 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-07-03 15:37:16 +0200
commit617c7127f434fc866ca370e8812f1ad01ad90d27 (patch)
treef96ea2cf5416e1b0d97075cea94e413191d132a4 /src
parent23f93a15ca759b55b4713148f06d9a2d152278ab (diff)
ms: Get the set of slots currently active
This commits adds methods to GprsMs and gprs_rlcmac_tbf to retrieve the slots that are actively used. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src')
-rw-r--r--src/gprs_ms.cpp26
-rw-r--r--src/gprs_ms.h2
-rw-r--r--src/tbf.cpp36
-rw-r--r--src/tbf.h2
4 files changed, 66 insertions, 0 deletions
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index f62facf5..318ebec2 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -538,6 +538,32 @@ int GprsMs::first_common_ts() const
return -1;
}
+uint8_t GprsMs::dl_slots() const
+{
+ uint8_t slots = 0;
+
+ if (m_dl_tbf)
+ slots |= m_dl_tbf->dl_slots();
+
+ if (m_ul_tbf)
+ slots |= m_ul_tbf->dl_slots();
+
+ return slots;
+}
+
+uint8_t GprsMs::ul_slots() const
+{
+ uint8_t slots = 0;
+
+ if (m_dl_tbf)
+ slots |= m_dl_tbf->ul_slots();
+
+ if (m_ul_tbf)
+ slots |= m_ul_tbf->ul_slots();
+
+ return slots;
+}
+
void GprsMs::set_reserved_slots(gprs_rlcmac_trx *trx,
uint8_t ul_slots, uint8_t dl_slots)
{
diff --git a/src/gprs_ms.h b/src/gprs_ms.h
index 910ccb83..840a2295 100644
--- a/src/gprs_ms.h
+++ b/src/gprs_ms.h
@@ -80,6 +80,8 @@ public:
uint8_t current_cs_dl() const;
int first_common_ts() const;
+ uint8_t dl_slots() const;
+ uint8_t ul_slots() const;
uint8_t reserved_dl_slots() const;
uint8_t reserved_ul_slots() const;
gprs_rlcmac_trx *current_trx() const;
diff --git a/src/tbf.cpp b/src/tbf.cpp
index e83873ab..006f66e0 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -935,6 +935,42 @@ uint8_t gprs_rlcmac_tbf::tsc() const
return trx->pdch[first_ts].tsc;
}
+uint8_t gprs_rlcmac_tbf::dl_slots() const
+{
+ uint8_t slots = 0;
+ size_t i;
+
+ if (direction == GPRS_RLCMAC_UL_TBF)
+ return 0;
+
+ for (i = 0; i < ARRAY_SIZE(pdch); i += 1)
+ if (pdch[i])
+ slots |= 1 << i;
+
+ return slots;
+}
+
+uint8_t gprs_rlcmac_tbf::ul_slots() const
+{
+ uint8_t slots = 0;
+ size_t i;
+
+ if (direction == GPRS_RLCMAC_DL_TBF) {
+ if (control_ts < 8)
+ slots |= 1 << control_ts;
+ if (first_common_ts < 8)
+ slots |= 1 << first_common_ts;
+
+ return slots;
+ }
+
+ for (i = 0; i < ARRAY_SIZE(pdch); i += 1)
+ if (pdch[i])
+ slots |= 1 << i;
+
+ return slots;
+}
+
void tbf_print_vty_info(struct vty *vty, struct llist_head *ltbf)
{
gprs_rlcmac_tbf *tbf = llist_pods_entry(ltbf, gprs_rlcmac_tbf);
diff --git a/src/tbf.h b/src/tbf.h
index 82ade4e8..f6f13f75 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -158,6 +158,8 @@ struct gprs_rlcmac_tbf {
const gprs_llc_queue *llc_queue() const;
time_t created_ts() const;
+ uint8_t dl_slots() const;
+ uint8_t ul_slots() const;
/* attempt to make things a bit more fair */
void rotate_in_list();