aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-30 09:18:30 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-30 10:13:36 +0200
commitbbdca1b43caaa47ae71e35872909c25ffc091900 (patch)
treebe990e222818fc60f3a9802036ab61f598a95330
parentb70f7ca553b4747618383b5c631f7023dc0b2f84 (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
-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 a87fb606..1960ff48 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -536,6 +536,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 ddc3b91f..1d72ffcd 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -929,6 +929,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 840125a5..7f1dd765 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();