bts: Use ms_store when calculating set of target PDCHs for Pkt Paging Request
The ul_tbfs/dl_tbfs lists will become per-trx. Since in this case we
want to operate on the BTS globally, let's iterate over MS objects
instead. This makes more sense too since here we really aim at reaching
a MS (subscriber) instead of specific TBFs. Later on the code can be
optimized easily to schedule a Pkt Paging Request for only 1 of the TBFs
of each MS instad of scheduling it for each TBFs in the MS.
Change-Id: I671e531921bbea2f5cc0f2bfcb8a39ea5c6673b8
diff --git a/src/bts.cpp b/src/bts.cpp
index e9864e7..94cdcb3 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -373,17 +373,11 @@
{
uint8_t l, trx, ts, any_tbf = 0;
struct gprs_rlcmac_tbf *tbf;
- struct llist_item *pos;
+ struct llist_head *tmp;
const struct osmo_mobile_identity *mi;
uint8_t slot_mask[8];
int8_t first_ts; /* must be signed */
- struct llist_head *tbfs_lists[] = {
- &bts->ul_tbfs,
- &bts->dl_tbfs,
- NULL
- };
-
/* First, build the MI used to page on PDCH from available subscriber info: */
if (req->mi_tmsi_present) {
mi = &req->mi_tmsi;
@@ -409,13 +403,18 @@
/* We don't know the target MS.
* collect slots to page
- * Mark slots for every TBF, but only mark one of it.
+ * Mark up to one slot attached to each of the TBF of the MS.
* Mark only the first slot found.
* Don't mark, if TBF uses a different slot that is already marked. */
memset(slot_mask, 0, sizeof(slot_mask));
- for (l = 0; tbfs_lists[l]; l++) {
- llist_for_each_entry(pos, tbfs_lists[l], list) {
- tbf = (struct gprs_rlcmac_tbf *)pos->entry;
+
+ llist_for_each(tmp, bts_ms_store(bts)->ms_list()) {
+ ms = llist_entry(tmp, typeof(*ms), list);
+ struct gprs_rlcmac_tbf *tbfs[] = { ms->ul_tbf, ms->dl_tbf };
+ for (l = 0; l < ARRAY_SIZE(tbfs); l++) {
+ tbf = (struct gprs_rlcmac_tbf *)tbfs[l];
+ if (!tbf)
+ continue;
first_ts = -1;
for (ts = 0; ts < 8; ts++) {
if (tbf->pdch[ts]) {