tbf/sched: We pick the _last_ entry, rotate the lists
We always pick the _last_ entry from the lists. Let's rotate
so we make it a bit more fair.
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 690be30..a3211ee 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -133,6 +133,7 @@
}
/* any message */
if (msg) {
+ tbf->rotate_in_list();
LOGP(DRLCMACSCHED, LOGL_DEBUG, "Scheduling control "
"message at RTS for %s (TRX=%d, TS=%d)\n",
tbf_name(tbf), trx, ts);
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 88d4662..e882e1f 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -1742,3 +1742,12 @@
{
return dir.dl.window.window_stalled();
}
+
+void gprs_rlcmac_tbf::rotate_in_list()
+{
+ llist_del(&list);
+ if (direction == GPRS_RLCMAC_UL_TBF)
+ llist_add(&list, &bts->bts_data()->ul_tbfs);
+ else
+ llist_add(&list, &bts->bts_data()->dl_tbfs);
+}
diff --git a/src/tbf.h b/src/tbf.h
index 4d7f64b..98b9a9b 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -135,6 +135,9 @@
uint16_t sns() const;
+ /* attempt to make things a bit more fair */
+ void rotate_in_list();
+
struct llist_head list;
uint32_t state_flags;
enum gprs_rlcmac_tbf_direction direction;