pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/30537 )
Change subject: Pass gprs_rlcmac_pdch to tbf_is_control_ts ......................................................................
Pass gprs_rlcmac_pdch to tbf_is_control_ts
This will allow also validate easily the TRX is the correct one too, not only the TS number in any random TRX.
Change-Id: Ib1a62b6e7b465253ee7cba63bf5e277f8aa8eaea --- M src/gprs_rlcmac_sched.cpp M src/pcu_vty_functions.cpp M src/tbf.cpp M src/tbf.h M src/tbf_dl_ass_fsm.c 5 files changed, 12 insertions(+), 18 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/37/30537/1
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index 1857c3c..90710ab 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -48,7 +48,7 @@ ul_tbf = tbf_as_ul_tbf((struct gprs_rlcmac_tbf *)pos->entry); OSMO_ASSERT(ul_tbf); /* this trx, this ts */ - if (!ul_tbf->is_control_ts(pdch->ts_no)) + if (!tbf_is_control_ts(ul_tbf, pdch)) continue; if (tbf_ul_ack_rts(ul_tbf)) tbf_cand->ul_ack = ul_tbf; @@ -66,7 +66,7 @@ dl_tbf = tbf_as_dl_tbf((struct gprs_rlcmac_tbf *)pos->entry); OSMO_ASSERT(dl_tbf); /* this trx, this ts */ - if (!dl_tbf->is_control_ts(pdch->ts_no)) + if (!tbf_is_control_ts(dl_tbf, pdch)) continue; if (tbf_dl_ass_rts(dl_tbf)) tbf_cand->dl_ass = dl_tbf; @@ -234,17 +234,18 @@ unsigned long dl_tbf_idle_msec = osmo_tdef_get(the_pcu->T_defs, -2031, OSMO_TDEF_MS, -1); int age_thresh1 = msecs_to_frames(200); int age_thresh2 = msecs_to_frames(OSMO_MIN(msecs_t3190/2, dl_tbf_idle_msec)); + const struct gprs_rlcmac_pdch *pdch = &tbf_get_trx(tbf)->pdch[ts];
- if (tbf->is_control_ts(ts) && tbf->need_poll_for_dl_ack_nack()) + if (tbf_is_control_ts(tbf, pdch) && tbf->need_poll_for_dl_ack_nack()) return DL_PRIO_CONTROL;
- if (tbf->is_control_ts(ts) && age > age_thresh2 && age_thresh2 > 0) + if (tbf_is_control_ts(tbf, pdch) && age > age_thresh2 && age_thresh2 > 0) return DL_PRIO_HIGH_AGE;
if ((tbf->state_is(TBF_ST_FLOW) && tbf->have_data()) || w->resend_needed() >= 0) return DL_PRIO_NEW_DATA;
- if (tbf->is_control_ts(ts) && age > age_thresh1 && tbf->keep_open(fn)) + if (tbf_is_control_ts(tbf, pdch) && age > age_thresh1 && tbf->keep_open(fn)) return DL_PRIO_LOW_AGE;
if (!w->window_empty()) diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index 1fac787..76baffe 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -72,7 +72,7 @@ VTY_NEWLINE); vty_out(vty, " TS_alloc="); for (int i = 0; i < 8; i++) { - bool is_ctrl = tbf->is_control_ts(i); + bool is_ctrl = tbf_is_control_ts(tbf, tbf->pdch[i]); if (tbf->pdch[i]) vty_out(vty, "%d%s ", i, is_ctrl ? "!" : ""); } diff --git a/src/tbf.cpp b/src/tbf.cpp index 86b501e..3d9d453 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -486,7 +486,7 @@ uint32_t *poll_fn_, unsigned int *rrbp_) const { int rc; - if (!is_control_ts(ts)) { + if (!tbf_is_control_ts(this, &this->trx->pdch[ts])) { LOGPTBF(this, LOGL_DEBUG, "Polling cannot be " "scheduled in this TS %d (first control TS %d)\n", ts, control_ts); @@ -751,11 +751,6 @@ return slots; }
-bool gprs_rlcmac_tbf::is_control_ts(uint8_t ts) const -{ - return ts == control_ts; -} - void gprs_rlcmac_tbf::enable_egprs() { /* Decrease GPRS TBF count of attached PDCHs */ @@ -886,9 +881,9 @@ tbf->poll_timeout(pdch, poll_fn, reason); }
-bool tbf_is_control_ts(const struct gprs_rlcmac_tbf *tbf, uint8_t ts) +bool tbf_is_control_ts(const struct gprs_rlcmac_tbf *tbf, const struct gprs_rlcmac_pdch *pdch) { - return tbf->is_control_ts(ts); + return tbf->control_ts == pdch->ts_no; }
bool tbf_can_upgrade_to_multislot(const struct gprs_rlcmac_tbf *tbf) diff --git a/src/tbf.h b/src/tbf.h index 8155e1d..211b8a7 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -146,7 +146,7 @@ void tbf_poll_timeout(struct gprs_rlcmac_tbf *tbf, struct gprs_rlcmac_pdch *pdch, uint32_t poll_fn, enum pdch_ulc_tbf_poll_reason reason); void tbf_update_state_fsm_name(struct gprs_rlcmac_tbf *tbf); const char* tbf_rlcmac_diag(const struct gprs_rlcmac_tbf *tbf); -bool tbf_is_control_ts(const struct gprs_rlcmac_tbf *tbf, uint8_t ts); +bool tbf_is_control_ts(const struct gprs_rlcmac_tbf *tbf, const struct gprs_rlcmac_pdch *pdch); bool tbf_can_upgrade_to_multislot(const struct gprs_rlcmac_tbf *tbf); int tbf_update(struct gprs_rlcmac_tbf *tbf); struct gprs_rlcmac_trx *tbf_get_trx(struct gprs_rlcmac_tbf *tbf); @@ -211,8 +211,6 @@ uint8_t dl_slots() const; uint8_t ul_slots() const;
- bool is_control_ts(uint8_t ts) const; - /* EGPRS */ bool is_egprs_enabled() const;
diff --git a/src/tbf_dl_ass_fsm.c b/src/tbf_dl_ass_fsm.c index 37c5a1b..fe959cc 100644 --- a/src/tbf_dl_ass_fsm.c +++ b/src/tbf_dl_ass_fsm.c @@ -59,7 +59,7 @@ bool old_tfi_is_valid = tbf_is_tfi_assigned(ctx->tbf);
/* We only use this function in control TS (PACCH) so that MS can always answer the poll */ - OSMO_ASSERT(tbf_is_control_ts(ctx->tbf, d->ts)); + OSMO_ASSERT(tbf_is_control_ts(ctx->tbf, &tbf_get_trx(ctx->tbf)->pdch[d->ts]));
rc = tbf_check_polling(ctx->tbf, d->fn, d->ts, &new_poll_fn, &rrbp); if (rc < 0)