This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/24227 )
Change subject: Move TBF list from BTS to the TRX structure
......................................................................
Move TBF list from BTS to the TRX structure
The TBFs are managed per TRX. Move the global list from BTS to TRX.
Related: OS#1541
Change-Id: Id3c59c11d57d765fe68aaebaac94290c0d84feb2
---
M src/bts.cpp
M src/bts.h
M src/gprs_rlcmac_sched.cpp
M src/pcu_vty_functions.cpp
M src/tbf.cpp
M src/tbf.h
M src/tbf_dl.cpp
M src/tbf_ul.cpp
M tests/alloc/AllocTest.cpp
M tests/ulc/PdchUlcTest.cpp
10 files changed, 41 insertions(+), 34 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/27/24227/1
diff --git a/src/bts.cpp b/src/bts.cpp
index c84f5c4..6e84f01 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -263,9 +263,6 @@
bts->T_defs_bts = T_defs_bts;
osmo_tdefs_reset(bts->T_defs_bts);
- INIT_LLIST_HEAD(&bts->ul_tbfs);
- INIT_LLIST_HEAD(&bts->dl_tbfs);
-
/* initialize back pointers */
for (size_t trx_no = 0; trx_no < ARRAY_SIZE(bts->trx); ++trx_no)
bts_trx_init(&bts->trx[trx_no], bts, trx_no);
@@ -1176,6 +1173,9 @@
trx->trx_no = trx_no;
trx->bts = bts;
+ INIT_LLIST_HEAD(&trx->ul_tbfs);
+ INIT_LLIST_HEAD(&trx->dl_tbfs);
+
for (size_t ts_no = 0; ts_no < ARRAY_SIZE(trx->pdch); ts_no++)
pdch_init(&trx->pdch[ts_no], trx, ts_no);
}
diff --git a/src/bts.h b/src/bts.h
index 11b5113..52c89b9 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -59,6 +59,11 @@
struct gprs_rlcmac_bts *bts;
uint8_t trx_no;
+ /* list of uplink TBFs */
+ struct llist_head ul_tbfs; /* list of gprs_rlcmac_tbf */
+ /* list of downlink TBFs */
+ struct llist_head dl_tbfs; /* list of gprs_rlcmac_tbf */
+
};
@@ -254,11 +259,6 @@
struct osmo_stat_item_group *statg;
struct GprsMsStorage *ms_store;
-
- /* list of uplink TBFs */
- struct llist_head ul_tbfs; /* list of gprs_rlcmac_tbf */
- /* list of downlink TBFs */
- struct llist_head dl_tbfs; /* list of gprs_rlcmac_tbf */
};
#ifdef __cplusplus
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 0068eae..5751799 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -41,15 +41,14 @@
struct gprs_rlcmac_ul_tbf *ul_ack;
};
-static void get_ctrl_msg_tbf_candidates(const struct gprs_rlcmac_bts *bts,
- const struct gprs_rlcmac_pdch *pdch,
+static void get_ctrl_msg_tbf_candidates(const struct gprs_rlcmac_pdch *pdch,
struct tbf_sched_candidates *tbf_cand)
{
struct gprs_rlcmac_ul_tbf *ul_tbf;
struct gprs_rlcmac_dl_tbf *dl_tbf;
struct llist_item *pos;
- llist_for_each_entry(pos, &bts->ul_tbfs, list) {
+ llist_for_each_entry(pos, &pdch->trx->ul_tbfs, list) {
ul_tbf = as_ul_tbf((struct gprs_rlcmac_tbf *)pos->entry);
OSMO_ASSERT(ul_tbf);
/* this trx, this ts */
@@ -68,7 +67,7 @@
/* FIXME: Is this supposed to be fair? The last TBF for each wins? Maybe use llist_add_tail and skip once we have all
states? */
}
- llist_for_each_entry(pos, &bts->dl_tbfs, list) {
+ llist_for_each_entry(pos, &pdch->trx->dl_tbfs, list) {
dl_tbf = as_dl_tbf((struct gprs_rlcmac_tbf *)pos->entry);
OSMO_ASSERT(dl_tbf);
/* this trx, this ts */
@@ -481,7 +480,7 @@
if (usf_tbf && req_mcs_kind == EGPRS && ms_mode(usf_tbf->ms()) != EGPRS)
req_mcs_kind = EGPRS_GMSK;
- get_ctrl_msg_tbf_candidates(bts, pdch, &tbf_cand);
+ get_ctrl_msg_tbf_candidates(pdch, &tbf_cand);
/* Prio 1: select control message */
if ((msg = sched_select_ctrl_msg(pdch, fn, block_nr, &tbf_cand))) {
diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp
index c2250d9..0b83a68 100644
--- a/src/pcu_vty_functions.cpp
+++ b/src/pcu_vty_functions.cpp
@@ -44,7 +44,7 @@
#include "coding_scheme.h"
}
-static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf)
+static void tbf_print_vty_info(struct vty *vty, struct gprs_rlcmac_tbf *tbf)
{
gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(tbf);
gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf);
@@ -104,20 +104,28 @@
int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts, uint32_t flags)
{
struct llist_item *iter;
+ const struct gprs_rlcmac_trx *trx;
struct gprs_rlcmac_tbf *tbf;
+ size_t trx_no;
vty_out(vty, "UL TBFs%s", VTY_NEWLINE);
- llist_for_each_entry(iter, &bts->ul_tbfs, list) {
- tbf = (struct gprs_rlcmac_tbf *)iter->entry;
- if (tbf->state_flags & flags)
- tbf_print_vty_info(vty, tbf);
+ for (trx_no = 0; trx_no < ARRAY_SIZE(bts->trx); trx_no++) {
+ trx = &bts->trx[trx_no];
+ llist_for_each_entry(iter, &trx->ul_tbfs, list) {
+ tbf = (struct gprs_rlcmac_tbf *)iter->entry;
+ if (tbf->state_flags & flags)
+ tbf_print_vty_info(vty, tbf);
+ }
}
vty_out(vty, "%sDL TBFs%s", VTY_NEWLINE, VTY_NEWLINE);
- llist_for_each_entry(iter, &bts->dl_tbfs, list) {
- tbf = (struct gprs_rlcmac_tbf *)iter->entry;
- if (tbf->state_flags & flags)
- tbf_print_vty_info(vty, tbf);
+ for (trx_no = 0; trx_no < ARRAY_SIZE(bts->trx); trx_no++) {
+ trx = &bts->trx[trx_no];
+ llist_for_each_entry(iter, &trx->dl_tbfs, list) {
+ tbf = (struct gprs_rlcmac_tbf *)iter->entry;
+ if (tbf->state_flags & flags)
+ tbf_print_vty_info(vty, tbf);
+ }
}
return CMD_SUCCESS;
diff --git a/src/tbf.cpp b/src/tbf.cpp
index adfda95..4dd74ec 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -293,7 +293,7 @@
tbf->stop_timers("freeing TBF");
/* TODO: Could/Should generate bssgp_tx_llc_discarded */
tbf_unlink_pdch(tbf);
- llist_del(tbf_bts_list(tbf));
+ llist_del(tbf_trx_list(tbf));
if (tbf->ms())
tbf->set_ms(NULL);
@@ -1092,11 +1092,11 @@
void gprs_rlcmac_tbf::rotate_in_list()
{
- llist_del(tbf_bts_list((struct gprs_rlcmac_tbf *)this));
+ llist_del(tbf_trx_list((struct gprs_rlcmac_tbf *)this));
if (direction == GPRS_RLCMAC_UL_TBF)
- llist_add(tbf_bts_list((struct gprs_rlcmac_tbf *)this), &bts->ul_tbfs);
+ llist_add(tbf_trx_list((struct gprs_rlcmac_tbf *)this), &trx->ul_tbfs);
else
- llist_add(tbf_bts_list((struct gprs_rlcmac_tbf *)this), &bts->dl_tbfs);
+ llist_add(tbf_trx_list((struct gprs_rlcmac_tbf *)this), &trx->dl_tbfs);
}
uint8_t gprs_rlcmac_tbf::tsc() const
@@ -1166,7 +1166,7 @@
return &tbf->m_ms_list.list;
}
-struct llist_head *tbf_bts_list(struct gprs_rlcmac_tbf *tbf)
+struct llist_head *tbf_trx_list(struct gprs_rlcmac_tbf *tbf)
{
return &tbf->m_bts_list.list;
}
diff --git a/src/tbf.h b/src/tbf.h
index 17f5b18..a9c580c 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -183,7 +183,7 @@
enum gprs_rlcmac_tbf_direction tbf_direction(const struct gprs_rlcmac_tbf *tbf);
void tbf_set_ms(struct gprs_rlcmac_tbf *tbf, struct GprsMs *ms);
struct llist_head *tbf_ms_list(struct gprs_rlcmac_tbf *tbf);
-struct llist_head *tbf_bts_list(struct gprs_rlcmac_tbf *tbf);
+struct llist_head *tbf_trx_list(struct gprs_rlcmac_tbf *tbf);
struct GprsMs *tbf_ms(const struct gprs_rlcmac_tbf *tbf);
bool tbf_timers_pending(struct gprs_rlcmac_tbf *tbf, enum tbf_timers t);
void tbf_free(struct gprs_rlcmac_tbf *tbf);
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 27dc4cf..45856e8 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -168,7 +168,7 @@
}
}
- llist_add(tbf_bts_list((struct gprs_rlcmac_tbf *)tbf), &bts->dl_tbfs);
+ llist_add(tbf_trx_list((struct gprs_rlcmac_tbf *)tbf), &tbf->trx->dl_tbfs);
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_DL_ALLOCATED);
osmo_clock_gettime(CLOCK_MONOTONIC, &tbf->m_bw.dl_bw_tv);
diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp
index 231ed06..4450684 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -134,7 +134,7 @@
return NULL;
}
- llist_add_tail(tbf_bts_list(tbf), &bts->ul_tbfs);
+ llist_add_tail(tbf_trx_list(tbf), &tbf->trx->ul_tbfs);
bts_do_rate_ctr_inc(tbf->bts, CTR_TBF_UL_ALLOCATED);
return tbf;
@@ -212,7 +212,7 @@
}
ms_attach_tbf(ms, ul_tbf);
- llist_add(tbf_bts_list((struct gprs_rlcmac_tbf *)ul_tbf), &bts->ul_tbfs);
+ llist_add(tbf_trx_list((struct gprs_rlcmac_tbf *)ul_tbf), &trx->ul_tbfs);
bts_do_rate_ctr_inc(ul_tbf->bts, CTR_TBF_UL_ALLOCATED);
TBF_SET_ASS_ON(ul_tbf, GPRS_RLCMAC_FLAG_PACCH, false);
TBF_SET_ASS_STATE_UL(ul_tbf, GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ);
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp
index fe803e3..e3e9614 100644
--- a/tests/alloc/AllocTest.cpp
+++ b/tests/alloc/AllocTest.cpp
@@ -59,8 +59,8 @@
struct gprs_rlcmac_tbf *tfi_usage[8][8][2][32] = {{{{NULL}}}};
struct llist_head *tbf_lists[2] = {
- &bts->ul_tbfs,
- &bts->dl_tbfs
+ &bts->trx[0].ul_tbfs,
+ &bts->trx[0].dl_tbfs
};
struct llist_item *pos;
diff --git a/tests/ulc/PdchUlcTest.cpp b/tests/ulc/PdchUlcTest.cpp
index 84035d1..c980e33 100644
--- a/tests/ulc/PdchUlcTest.cpp
+++ b/tests/ulc/PdchUlcTest.cpp
@@ -160,6 +160,7 @@
int _alloc_algorithm_dummy(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf,
bool single, int8_t use_tbf)
{
+ tbf->trx = &bts->trx[0];
return 0;
}
@@ -174,7 +175,6 @@
struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
struct GprsMs *ms = ms_alloc(bts, 0x12345678);
struct gprs_rlcmac_tbf *tbf1 = tbf_alloc_dl_tbf(bts, ms, 0, true);
- tbf1->trx = &bts->trx[0];
struct gprs_rlcmac_pdch *pdch = &tbf1->trx->pdch[0];
int rc;
uint32_t fn, last_fn;
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/24227
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Id3c59c11d57d765fe68aaebaac94290c0d84feb2
Gerrit-Change-Number: 24227
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210513/89230d14/attachment.htm>