[PATCH] osmo-pcu[master]: Move DL scheduling and RTS handler to trx level
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/3150 to look at the new patch set (#9). Move DL scheduling and RTS handler to trx level Use TRX object directly instead of BTS singleton and trx_no. This is necessary to facilitate the move of UL/DL TBF lists to TRX level. Change-Id: Ia176245647c19fa1551fb6f5c8225b2529f73cbf Related: OS#1541 --- M src/bts.cpp M src/bts.h M src/gprs_rlcmac.h M src/gprs_rlcmac_sched.cpp M src/pcu_l1_if.cpp M src/tbf.cpp M src/tbf.h M tests/tbf/TbfTest.cpp 8 files changed, 66 insertions(+), 76 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/50/3150/9 diff --git a/src/bts.cpp b/src/bts.cpp index b768569..5cf3d7c 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -1375,8 +1375,7 @@ egprs_ms_class, tlli, ta, ms); if (!ul_tbf) { - handle_tbf_reject(bts_data(), ms, tlli, - trx_no(), ts_no); + handle_tbf_reject(get_trx(), ms, tlli, ts_no); return; } diff --git a/src/bts.h b/src/bts.h index d65cd2f..37e065e 100644 --- a/src/bts.h +++ b/src/bts.h @@ -92,7 +92,7 @@ gprs_rlcmac_bts *bts_data() const; BTS *bts() const; uint8_t trx_no() const; - + gprs_rlcmac_trx *get_trx(); struct gprs_rlcmac_ul_tbf *ul_tbf_by_tfi(uint8_t tfi); struct gprs_rlcmac_dl_tbf *dl_tbf_by_tfi(uint8_t tfi); @@ -695,6 +695,11 @@ return trx->bts->bts_data(); } +inline gprs_rlcmac_trx *gprs_rlcmac_pdch::get_trx() +{ + return trx; +} + inline uint8_t gprs_rlcmac_pdch::trx_no() const { return trx->trx_no; diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index be1e686..3d825a8 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -89,9 +89,7 @@ int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len, const char *imsi); -int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, -uint32_t fn, uint8_t block_nr); +int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr); int gprs_alloc_max_dl_slots_per_ms(struct gprs_rlcmac_bts *bts, uint8_t ms_class = 0); diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index 2350808..4585622 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -25,12 +25,10 @@ #include "pcu_utils.h" -static uint32_t sched_poll(BTS *bts, - uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr, - struct gprs_rlcmac_tbf **poll_tbf, - struct gprs_rlcmac_tbf **ul_ass_tbf, - struct gprs_rlcmac_tbf **dl_ass_tbf, - struct gprs_rlcmac_ul_tbf **ul_ack_tbf) +static uint32_t sched_poll(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr, + struct gprs_rlcmac_tbf **poll_tbf, + struct gprs_rlcmac_tbf **ul_ass_tbf, struct gprs_rlcmac_tbf **dl_ass_tbf, + struct gprs_rlcmac_ul_tbf **ul_ack_tbf) { struct gprs_rlcmac_ul_tbf *ul_tbf; struct gprs_rlcmac_dl_tbf *dl_tbf; @@ -42,11 +40,11 @@ if ((block_nr % 3) == 2) poll_fn ++; poll_fn = poll_fn % GSM_MAX_FN; - llist_for_each(pos, >ul_tbfs()) { + llist_for_each(pos, >bts->ul_tbfs()) { ul_tbf = as_ul_tbf(pos->entry()); OSMO_ASSERT(ul_tbf); /* this trx, this ts */ - if (ul_tbf->trx->trx_no != trx || !ul_tbf->is_control_ts(ts)) + if (ul_tbf->trx->trx_no != trx->trx_no || !ul_tbf->is_control_ts(ts)) continue; /* polling for next uplink block */ if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED @@ -63,11 +61,11 @@ /* 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(pos, >dl_tbfs()) { + llist_for_each(pos, >bts->dl_tbfs()) { dl_tbf = as_dl_tbf(pos->entry()); OSMO_ASSERT(dl_tbf); /* this trx, this ts */ - if (dl_tbf->trx->trx_no != trx || !dl_tbf->is_control_ts(ts)) + if (dl_tbf->trx->trx_no != trx->trx_no || !dl_tbf->is_control_ts(ts)) continue; /* polling for next uplink block */ if (dl_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED @@ -207,9 +205,8 @@ return NULL; } -static struct msgb *sched_select_downlink(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, uint32_t fn, - uint8_t block_nr, struct gprs_rlcmac_pdch *pdch) +static struct msgb *sched_select_downlink(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn,
[PATCH] osmo-pcu[master]: Move DL scheduling and RTS handler to trx level
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/3150 to look at the new patch set (#7). Move DL scheduling and RTS handler to trx level Use TRX object directly instead of BTS singleton and trx_no. This is necessary to facilitate the move of UL/DL TBF lists to TRX level. Change-Id: Ia176245647c19fa1551fb6f5c8225b2529f73cbf Related: OS#1541 --- M src/bts.cpp M src/bts.h M src/gprs_rlcmac.h M src/gprs_rlcmac_sched.cpp M src/pcu_l1_if.cpp M src/tbf.cpp M src/tbf.h M tests/tbf/TbfTest.cpp 8 files changed, 58 insertions(+), 68 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/50/3150/7 diff --git a/src/bts.cpp b/src/bts.cpp index add6ab3..ada8456 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -1375,8 +1375,7 @@ egprs_ms_class, tlli, ta, ms); if (!ul_tbf) { - handle_tbf_reject(bts_data(), ms, tlli, - trx_no(), ts_no); + handle_tbf_reject(get_trx(), ms, tlli, ts_no); return; } diff --git a/src/bts.h b/src/bts.h index 1f1dae2..71dfb7b 100644 --- a/src/bts.h +++ b/src/bts.h @@ -91,7 +91,7 @@ gprs_rlcmac_bts *bts_data() const; BTS *bts() const; uint8_t trx_no() const; - + gprs_rlcmac_trx *get_trx(); struct gprs_rlcmac_ul_tbf *ul_tbf_by_tfi(uint8_t tfi); struct gprs_rlcmac_dl_tbf *dl_tbf_by_tfi(uint8_t tfi); @@ -692,6 +692,11 @@ return trx->bts->bts_data(); } +inline gprs_rlcmac_trx *gprs_rlcmac_pdch::get_trx() +{ + return trx; +} + inline uint8_t gprs_rlcmac_pdch::trx_no() const { return trx->trx_no; diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index be1e686..3d825a8 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -89,9 +89,7 @@ int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len, const char *imsi); -int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, -uint32_t fn, uint8_t block_nr); +int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr); int gprs_alloc_max_dl_slots_per_ms(struct gprs_rlcmac_bts *bts, uint8_t ms_class = 0); diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index 42f0308..af9c3bf 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -25,12 +25,10 @@ #include "pcu_utils.h" -static uint32_t sched_poll(BTS *bts, - uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr, - struct gprs_rlcmac_tbf **poll_tbf, - struct gprs_rlcmac_tbf **ul_ass_tbf, - struct gprs_rlcmac_tbf **dl_ass_tbf, - struct gprs_rlcmac_ul_tbf **ul_ack_tbf) +static uint32_t sched_poll(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr, + struct gprs_rlcmac_tbf **poll_tbf, + struct gprs_rlcmac_tbf **ul_ass_tbf, struct gprs_rlcmac_tbf **dl_ass_tbf, + struct gprs_rlcmac_ul_tbf **ul_ack_tbf) { struct gprs_rlcmac_ul_tbf *ul_tbf; struct gprs_rlcmac_dl_tbf *dl_tbf; @@ -42,11 +40,11 @@ if ((block_nr % 3) == 2) poll_fn ++; poll_fn = poll_fn % GSM_MAX_FN; - llist_for_each(pos, >ul_tbfs()) { + llist_for_each(pos, >bts->ul_tbfs()) { ul_tbf = as_ul_tbf(pos->entry()); OSMO_ASSERT(ul_tbf); /* this trx, this ts */ - if (ul_tbf->trx->trx_no != trx || !ul_tbf->is_control_ts(ts)) + if (ul_tbf->trx->trx_no != trx->trx_no || !ul_tbf->is_control_ts(ts)) continue; /* polling for next uplink block */ if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED @@ -62,11 +60,11 @@ *ul_ass_tbf = ul_tbf; #warning "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(pos, >dl_tbfs()) { + llist_for_each(pos, >bts->dl_tbfs()) { dl_tbf = as_dl_tbf(pos->entry()); OSMO_ASSERT(dl_tbf); /* this trx, this ts */ - if (dl_tbf->trx->trx_no != trx || !dl_tbf->is_control_ts(ts)) + if (dl_tbf->trx->trx_no != trx->trx_no || !dl_tbf->is_control_ts(ts)) continue; /* polling for next uplink block */ if (dl_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED @@ -206,9 +204,8 @@ return NULL; } -static struct msgb *sched_select_downlink(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, uint32_t fn, - uint8_t block_nr, struct gprs_rlcmac_pdch *pdch) +static struct msgb *sched_select_downlink(struct
[PATCH] osmo-pcu[master]: Move DL scheduling and RTS handler to trx level
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/3150 to look at the new patch set (#6). Move DL scheduling and RTS handler to trx level Use TRX object directly instead of BTS singleton and trx_no. This is necessary to facilitate the move of UL/DL TBF lists to TRX level. Change-Id: Ia176245647c19fa1551fb6f5c8225b2529f73cbf Related: OS#1541 --- M src/bts.cpp M src/bts.h M src/gprs_rlcmac.h M src/gprs_rlcmac_sched.cpp M src/pcu_l1_if.cpp M src/tbf.cpp M src/tbf.h M tests/tbf/TbfTest.cpp 8 files changed, 58 insertions(+), 68 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/50/3150/6 diff --git a/src/bts.cpp b/src/bts.cpp index add6ab3..ada8456 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -1375,8 +1375,7 @@ egprs_ms_class, tlli, ta, ms); if (!ul_tbf) { - handle_tbf_reject(bts_data(), ms, tlli, - trx_no(), ts_no); + handle_tbf_reject(get_trx(), ms, tlli, ts_no); return; } diff --git a/src/bts.h b/src/bts.h index 1f1dae2..71dfb7b 100644 --- a/src/bts.h +++ b/src/bts.h @@ -91,7 +91,7 @@ gprs_rlcmac_bts *bts_data() const; BTS *bts() const; uint8_t trx_no() const; - + gprs_rlcmac_trx *get_trx(); struct gprs_rlcmac_ul_tbf *ul_tbf_by_tfi(uint8_t tfi); struct gprs_rlcmac_dl_tbf *dl_tbf_by_tfi(uint8_t tfi); @@ -692,6 +692,11 @@ return trx->bts->bts_data(); } +inline gprs_rlcmac_trx *gprs_rlcmac_pdch::get_trx() +{ + return trx; +} + inline uint8_t gprs_rlcmac_pdch::trx_no() const { return trx->trx_no; diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index be1e686..3d825a8 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -89,9 +89,7 @@ int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len, const char *imsi); -int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, -uint32_t fn, uint8_t block_nr); +int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr); int gprs_alloc_max_dl_slots_per_ms(struct gprs_rlcmac_bts *bts, uint8_t ms_class = 0); diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index 42f0308..c5fbf84 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -25,12 +25,10 @@ #include "pcu_utils.h" -static uint32_t sched_poll(BTS *bts, - uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr, - struct gprs_rlcmac_tbf **poll_tbf, - struct gprs_rlcmac_tbf **ul_ass_tbf, - struct gprs_rlcmac_tbf **dl_ass_tbf, - struct gprs_rlcmac_ul_tbf **ul_ack_tbf) +static uint32_t sched_poll(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr, + struct gprs_rlcmac_tbf **poll_tbf, + struct gprs_rlcmac_tbf **ul_ass_tbf, struct gprs_rlcmac_tbf **dl_ass_tbf, + struct gprs_rlcmac_ul_tbf **ul_ack_tbf) { struct gprs_rlcmac_ul_tbf *ul_tbf; struct gprs_rlcmac_dl_tbf *dl_tbf; @@ -42,11 +40,11 @@ if ((block_nr % 3) == 2) poll_fn ++; poll_fn = poll_fn % GSM_MAX_FN; - llist_for_each(pos, >ul_tbfs()) { + llist_for_each(pos, >bts->ul_tbfs()) { ul_tbf = as_ul_tbf(pos->entry()); OSMO_ASSERT(ul_tbf); /* this trx, this ts */ - if (ul_tbf->trx->trx_no != trx || !ul_tbf->is_control_ts(ts)) + if (ul_tbf->trx->trx_no != trx->trx_no || !ul_tbf->is_control_ts(ts)) continue; /* polling for next uplink block */ if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED @@ -62,11 +60,11 @@ *ul_ass_tbf = ul_tbf; #warning "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(pos, >dl_tbfs()) { + llist_for_each(pos, >bts->dl_tbfs()) { dl_tbf = as_dl_tbf(pos->entry()); OSMO_ASSERT(dl_tbf); /* this trx, this ts */ - if (dl_tbf->trx->trx_no != trx || !dl_tbf->is_control_ts(ts)) + if (dl_tbf->trx->trx_no != trx->trx_no || !dl_tbf->is_control_ts(ts)) continue; /* polling for next uplink block */ if (dl_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED @@ -206,9 +204,8 @@ return NULL; } -static struct msgb *sched_select_downlink(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, uint32_t fn, - uint8_t block_nr, struct gprs_rlcmac_pdch *pdch) +static struct msgb *sched_select_downlink(struct
[PATCH] osmo-pcu[master]: Move DL scheduling and RTS handler to trx level
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/3150 to look at the new patch set (#5). Move DL scheduling and RTS handler to trx level Use TRX object directly instead of BTS singleton and trx_no. This is necessary to facilitate the move of UL/DL TBF lists to TRX level. Change-Id: Ia176245647c19fa1551fb6f5c8225b2529f73cbf Related: OS#1541 --- M src/bts.cpp M src/bts.h M src/gprs_rlcmac.h M src/gprs_rlcmac_sched.cpp M src/pcu_l1_if.cpp M src/tbf.cpp M src/tbf.h M tests/tbf/TbfTest.cpp 8 files changed, 58 insertions(+), 68 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/50/3150/5 diff --git a/src/bts.cpp b/src/bts.cpp index add6ab3..ada8456 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -1375,8 +1375,7 @@ egprs_ms_class, tlli, ta, ms); if (!ul_tbf) { - handle_tbf_reject(bts_data(), ms, tlli, - trx_no(), ts_no); + handle_tbf_reject(get_trx(), ms, tlli, ts_no); return; } diff --git a/src/bts.h b/src/bts.h index 1f1dae2..71dfb7b 100644 --- a/src/bts.h +++ b/src/bts.h @@ -91,7 +91,7 @@ gprs_rlcmac_bts *bts_data() const; BTS *bts() const; uint8_t trx_no() const; - + gprs_rlcmac_trx *get_trx(); struct gprs_rlcmac_ul_tbf *ul_tbf_by_tfi(uint8_t tfi); struct gprs_rlcmac_dl_tbf *dl_tbf_by_tfi(uint8_t tfi); @@ -692,6 +692,11 @@ return trx->bts->bts_data(); } +inline gprs_rlcmac_trx *gprs_rlcmac_pdch::get_trx() +{ + return trx; +} + inline uint8_t gprs_rlcmac_pdch::trx_no() const { return trx->trx_no; diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index be1e686..3d825a8 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -89,9 +89,7 @@ int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len, const char *imsi); -int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, -uint32_t fn, uint8_t block_nr); +int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr); int gprs_alloc_max_dl_slots_per_ms(struct gprs_rlcmac_bts *bts, uint8_t ms_class = 0); diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index 42f0308..007fb79 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -25,12 +25,10 @@ #include "pcu_utils.h" -static uint32_t sched_poll(BTS *bts, - uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr, - struct gprs_rlcmac_tbf **poll_tbf, - struct gprs_rlcmac_tbf **ul_ass_tbf, - struct gprs_rlcmac_tbf **dl_ass_tbf, - struct gprs_rlcmac_ul_tbf **ul_ack_tbf) +static uint32_t sched_poll(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr, + struct gprs_rlcmac_tbf **poll_tbf, + struct gprs_rlcmac_tbf **ul_ass_tbf, struct gprs_rlcmac_tbf **dl_ass_tbf, + struct gprs_rlcmac_ul_tbf **ul_ack_tbf) { struct gprs_rlcmac_ul_tbf *ul_tbf; struct gprs_rlcmac_dl_tbf *dl_tbf; @@ -42,11 +40,11 @@ if ((block_nr % 3) == 2) poll_fn ++; poll_fn = poll_fn % GSM_MAX_FN; - llist_for_each(pos, >ul_tbfs()) { + llist_for_each(pos, >bts->ul_tbfs()) { ul_tbf = as_ul_tbf(pos->entry()); OSMO_ASSERT(ul_tbf); /* this trx, this ts */ - if (ul_tbf->trx->trx_no != trx || !ul_tbf->is_control_ts(ts)) + if (ul_tbf->trx->trx_no != trx->trx_no || !ul_tbf->is_control_ts(ts)) continue; /* polling for next uplink block */ if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED @@ -62,11 +60,11 @@ *ul_ass_tbf = ul_tbf; #warning "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(pos, >dl_tbfs()) { + llist_for_each(pos, >bts->dl_tbfs()) { dl_tbf = as_dl_tbf(pos->entry()); OSMO_ASSERT(dl_tbf); /* this trx, this ts */ - if (dl_tbf->trx->trx_no != trx || !dl_tbf->is_control_ts(ts)) + if (dl_tbf->trx->trx_no != trx->trx_no || !dl_tbf->is_control_ts(ts)) continue; /* polling for next uplink block */ if (dl_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED @@ -206,9 +204,8 @@ return NULL; } -static struct msgb *sched_select_downlink(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, uint32_t fn, - uint8_t block_nr, struct gprs_rlcmac_pdch *pdch) +static struct msgb *sched_select_downlink(struct
[PATCH] osmo-pcu[master]: Move DL scheduling and RTS handler to trx level
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/3150 to look at the new patch set (#2). Move DL scheduling and RTS handler to trx level Use TRX object directly instead of BTS singleton and trx_no. This is necessary to facilitate the move of UL/DL TBF lists to TRX level. Change-Id: Ia176245647c19fa1551fb6f5c8225b2529f73cbf Related: OS#1541 --- M src/bts.cpp M src/bts.h M src/gprs_rlcmac.h M src/gprs_rlcmac_sched.cpp M src/pcu_l1_if.cpp M src/tbf.cpp M src/tbf.h M tests/tbf/TbfTest.cpp 8 files changed, 55 insertions(+), 65 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/50/3150/2 diff --git a/src/bts.cpp b/src/bts.cpp index 1d27284..e66699f 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -1425,8 +1425,7 @@ egprs_ms_class, tlli, ta, ms); if (!ul_tbf) { - handle_tbf_reject(bts_data(), ms, tlli, - trx_no(), ts_no); + handle_tbf_reject(get_trx(), ms, tlli, ts_no); return; } diff --git a/src/bts.h b/src/bts.h index 78ed002..7983fa2 100644 --- a/src/bts.h +++ b/src/bts.h @@ -76,7 +76,7 @@ gprs_rlcmac_bts *bts_data() const; BTS *bts() const; uint8_t trx_no() const; - + gprs_rlcmac_trx *get_trx(); struct gprs_rlcmac_ul_tbf *ul_tbf_by_tfi(uint8_t tfi); struct gprs_rlcmac_dl_tbf *dl_tbf_by_tfi(uint8_t tfi); @@ -671,6 +671,11 @@ return trx->bts->bts_data(); } +inline gprs_rlcmac_trx *gprs_rlcmac_pdch::get_trx() +{ + return trx; +} + inline uint8_t gprs_rlcmac_pdch::trx_no() const { return trx->trx_no; diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index be1e686..3d825a8 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -89,9 +89,7 @@ int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len, const char *imsi); -int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, -uint32_t fn, uint8_t block_nr); +int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr); int gprs_alloc_max_dl_slots_per_ms(struct gprs_rlcmac_bts *bts, uint8_t ms_class = 0); diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index a21c023..a8392cb 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -25,12 +25,10 @@ #include "pcu_utils.h" -static uint32_t sched_poll(BTS *bts, - uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr, - struct gprs_rlcmac_tbf **poll_tbf, - struct gprs_rlcmac_tbf **ul_ass_tbf, - struct gprs_rlcmac_tbf **dl_ass_tbf, - struct gprs_rlcmac_ul_tbf **ul_ack_tbf) +static uint32_t sched_poll(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr, + struct gprs_rlcmac_tbf **poll_tbf, + struct gprs_rlcmac_tbf **ul_ass_tbf, struct gprs_rlcmac_tbf **dl_ass_tbf, + struct gprs_rlcmac_ul_tbf **ul_ack_tbf) { struct gprs_rlcmac_ul_tbf *ul_tbf; struct gprs_rlcmac_dl_tbf *dl_tbf; @@ -42,11 +40,11 @@ if ((block_nr % 3) == 2) poll_fn ++; poll_fn = poll_fn % GSM_MAX_FN; - llist_for_each(pos, >ul_tbfs()) { + llist_for_each(pos, >bts->ul_tbfs()) { ul_tbf = as_ul_tbf(pos->entry()); OSMO_ASSERT(ul_tbf); /* this trx, this ts */ - if (ul_tbf->trx->trx_no != trx || !ul_tbf->is_control_ts(ts)) + if (ul_tbf->trx->trx_no != trx->trx_no || !ul_tbf->is_control_ts(ts)) continue; /* polling for next uplink block */ if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED @@ -62,11 +60,11 @@ *ul_ass_tbf = ul_tbf; #warning "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(pos, >dl_tbfs()) { + llist_for_each(pos, >bts->dl_tbfs()) { dl_tbf = as_dl_tbf(pos->entry()); OSMO_ASSERT(dl_tbf); /* this trx, this ts */ - if (dl_tbf->trx->trx_no != trx || !dl_tbf->is_control_ts(ts)) + if (dl_tbf->trx->trx_no != trx->trx_no || !dl_tbf->is_control_ts(ts)) continue; /* polling for next uplink block */ if (dl_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED @@ -206,9 +204,8 @@ return NULL; } -static struct msgb *sched_select_downlink(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, uint32_t fn, - uint8_t block_nr, struct gprs_rlcmac_pdch *pdch) +static struct msgb *sched_select_downlink(struct gprs_rlcmac_trx *trx,
[PATCH] osmo-pcu[master]: Move DL scheduling and RTS handler to trx level
Review at https://gerrit.osmocom.org/3150 Move DL scheduling and RTS handler to trx level Use TRX object directly instead of BTS singleton and trx_no. Change-Id: Ia176245647c19fa1551fb6f5c8225b2529f73cbf Related: OS#1541 --- M src/gprs_rlcmac.h M src/gprs_rlcmac_sched.cpp M src/pcu_l1_if.cpp M tests/tbf/TbfTest.cpp 4 files changed, 42 insertions(+), 51 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/50/3150/1 diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index be1e686..3d825a8 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -89,9 +89,7 @@ int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len, const char *imsi); -int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, -uint32_t fn, uint8_t block_nr); +int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr); int gprs_alloc_max_dl_slots_per_ms(struct gprs_rlcmac_bts *bts, uint8_t ms_class = 0); diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index a21c023..a8392cb 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -25,12 +25,10 @@ #include "pcu_utils.h" -static uint32_t sched_poll(BTS *bts, - uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr, - struct gprs_rlcmac_tbf **poll_tbf, - struct gprs_rlcmac_tbf **ul_ass_tbf, - struct gprs_rlcmac_tbf **dl_ass_tbf, - struct gprs_rlcmac_ul_tbf **ul_ack_tbf) +static uint32_t sched_poll(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr, + struct gprs_rlcmac_tbf **poll_tbf, + struct gprs_rlcmac_tbf **ul_ass_tbf, struct gprs_rlcmac_tbf **dl_ass_tbf, + struct gprs_rlcmac_ul_tbf **ul_ack_tbf) { struct gprs_rlcmac_ul_tbf *ul_tbf; struct gprs_rlcmac_dl_tbf *dl_tbf; @@ -42,11 +40,11 @@ if ((block_nr % 3) == 2) poll_fn ++; poll_fn = poll_fn % GSM_MAX_FN; - llist_for_each(pos, >ul_tbfs()) { + llist_for_each(pos, >bts->ul_tbfs()) { ul_tbf = as_ul_tbf(pos->entry()); OSMO_ASSERT(ul_tbf); /* this trx, this ts */ - if (ul_tbf->trx->trx_no != trx || !ul_tbf->is_control_ts(ts)) + if (ul_tbf->trx->trx_no != trx->trx_no || !ul_tbf->is_control_ts(ts)) continue; /* polling for next uplink block */ if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED @@ -62,11 +60,11 @@ *ul_ass_tbf = ul_tbf; #warning "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(pos, >dl_tbfs()) { + llist_for_each(pos, >bts->dl_tbfs()) { dl_tbf = as_dl_tbf(pos->entry()); OSMO_ASSERT(dl_tbf); /* this trx, this ts */ - if (dl_tbf->trx->trx_no != trx || !dl_tbf->is_control_ts(ts)) + if (dl_tbf->trx->trx_no != trx->trx_no || !dl_tbf->is_control_ts(ts)) continue; /* polling for next uplink block */ if (dl_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED @@ -206,9 +204,8 @@ return NULL; } -static struct msgb *sched_select_downlink(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, uint32_t fn, - uint8_t block_nr, struct gprs_rlcmac_pdch *pdch) +static struct msgb *sched_select_downlink(struct gprs_rlcmac_trx *trx, uint8_t ts, uint32_t fn, uint8_t block_nr, + struct gprs_rlcmac_pdch *pdch) { struct msgb *msg = NULL; struct gprs_rlcmac_dl_tbf *tbf, *prio_tbf = NULL; @@ -225,7 +222,7 @@ int age; const int age_thresh1 = msecs_to_frames(200); const int high_prio_msecs = - OSMO_MIN(BTS::TIMER_T3190_MSEC/2, bts->dl_tbf_idle_msec); + OSMO_MIN(BTS::TIMER_T3190_MSEC/2, trx->bts->bts_data()->dl_tbf_idle_msec); const int age_thresh2 = msecs_to_frames(high_prio_msecs); /* select downlink resource */ @@ -277,7 +274,7 @@ if (prio_tbf) { LOGP(DRLCMACSCHED, LOGL_DEBUG, "Scheduling data message at " "RTS for DL TFI=%d (TRX=%d, TS=%d) prio=%d\n", - prio_tfi, trx, ts, max_prio); + prio_tfi, trx->trx_no, ts, max_prio); /* next TBF to handle resource is the next one */ pdch->next_dl_tfi = (prio_tfi + 1) & 31; /* generate DL data block */ @@ -307,9 +304,7 @@ return msg; } -int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts, - uint8_t trx, uint8_t ts, -uint32_t fn, uint8_t block_nr) +int