pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/30624 )
Change subject: Pass gprc_rlcmac_pdch to tbf_check_polling ......................................................................
Pass gprc_rlcmac_pdch to tbf_check_polling
Change-Id: I1c7140b35b7c93d3df4156841e908d3b44d7336d --- M src/nacc_fsm.c M src/tbf.cpp M src/tbf.h M src/tbf_dl.cpp M src/tbf_dl_ass_fsm.c M src/tbf_ul_ack_fsm.c M src/tbf_ul_ass_fsm.c 7 files changed, 28 insertions(+), 32 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/24/30624/1
diff --git a/src/nacc_fsm.c b/src/nacc_fsm.c index 21af485..cc75238 100644 --- a/src/nacc_fsm.c +++ b/src/nacc_fsm.c @@ -168,7 +168,7 @@ struct GprsMs *ms = tbf_ms(tbf); unsigned int rrbp;
- rc = tbf_check_polling(tbf, data->fn, data->pdch->ts_no, new_poll_fn, &rrbp); + rc = tbf_check_polling(tbf, data->pdch, data->fn, new_poll_fn, &rrbp); if (rc < 0) { LOGP(DTBF, LOGL_ERROR, "Failed registering poll for Pkt Cell Chg Continue (%d)\n", rc); return NULL; diff --git a/src/tbf.cpp b/src/tbf.cpp index 0af738d..70e3e6c 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -458,27 +458,6 @@ osmo_timer_schedule(&Tarr[t], sec, microsec); }
-int gprs_rlcmac_tbf::check_polling(uint32_t fn, uint8_t ts, - uint32_t *poll_fn_, unsigned int *rrbp_) const -{ - int rc; - if (!tbf_is_control_ts(this, &this->trx->pdch[ts])) { - LOGPTBF(this, LOGL_DEBUG, "Polling cannot be " - "scheduled in this TS %d (control TS %s)\n", - ts, pdch_name(control_ts)); - return -EINVAL; - } - - if ((rc = pdch_ulc_get_next_free_rrbp_fn(trx->pdch[ts].ulc, fn, poll_fn_, rrbp_)) < 0) { - LOGPTBF(this, LOGL_NOTICE, - "(bts=%u,trx=%u,ts=%u) FN=%u No suitable free RRBP offset found!\n", - trx->bts->nr, trx->trx_no, ts, fn); - return rc; - } - - return 0; -} - void gprs_rlcmac_tbf::set_polling(uint32_t new_poll_fn, uint8_t ts, enum pdch_ulc_tbf_poll_reason reason) { /* schedule polling */ @@ -839,9 +818,29 @@ return tbf->is_egprs_enabled(); }
-int tbf_check_polling(const struct gprs_rlcmac_tbf *tbf, uint32_t fn, uint8_t ts, uint32_t *poll_fn, unsigned int *rrbp) +int tbf_check_polling(const struct gprs_rlcmac_tbf *tbf, const struct gprs_rlcmac_pdch *pdch, + uint32_t fn, uint32_t *poll_fn, unsigned int *rrbp) { - return tbf->check_polling(fn, ts, poll_fn, rrbp); + int rc; + OSMO_ASSERT(pdch); + + if (!tbf_is_control_ts(tbf, pdch)) { + char buf[128]; + LOGPTBF(tbf, LOGL_DEBUG, "Polling cannot be " + "scheduled in this TS %s (control TS %s)\n", + pdch_name(pdch), + tbf->control_ts ? pdch_name_buf(tbf->control_ts, buf, sizeof(buf)) : "none"); + return -EINVAL; + } + + if ((rc = pdch_ulc_get_next_free_rrbp_fn(pdch->ulc, fn, poll_fn, rrbp)) < 0) { + LOGPTBF(tbf, LOGL_NOTICE, + "FN=%u No suitable free RRBP offset found on %s!\n", + fn, pdch_name(pdch)); + return rc; + } + + return 0; }
void tbf_set_polling(struct gprs_rlcmac_tbf *tbf, uint32_t new_poll_fn, uint8_t ts, enum pdch_ulc_tbf_poll_reason t) diff --git a/src/tbf.h b/src/tbf.h index a02b8e2..1d5d4f1 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -139,7 +139,7 @@ uint8_t tbf_tfi(const struct gprs_rlcmac_tbf *tbf); bool tbf_is_egprs_enabled(const struct gprs_rlcmac_tbf *tbf); void tbf_assign_control_ts(struct gprs_rlcmac_tbf *tbf); -int tbf_check_polling(const struct gprs_rlcmac_tbf *tbf, uint32_t fn, uint8_t ts, uint32_t *poll_fn, unsigned int *rrbp); +int tbf_check_polling(const struct gprs_rlcmac_tbf *tbf, const struct gprs_rlcmac_pdch *pdch, uint32_t fn, uint32_t *poll_fn, unsigned int *rrbp); void tbf_set_polling(struct gprs_rlcmac_tbf *tbf, uint32_t new_poll_fn, uint8_t ts, enum pdch_ulc_tbf_poll_reason t); 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); @@ -188,9 +188,6 @@ void t_stop(enum tbf_timers t, const char *reason); void t_start(enum tbf_timers t, int T, const char *reason, bool force, const char *file, unsigned line); - - int check_polling(uint32_t fn, uint8_t ts, - uint32_t *poll_fn, unsigned int *rrbp) const; void set_polling(uint32_t poll_fn, uint8_t ts, enum pdch_ulc_tbf_poll_reason reason); void poll_timeout(struct gprs_rlcmac_pdch *pdch, uint32_t poll_fn, enum pdch_ulc_tbf_poll_reason reason);
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 9214aae..25aea48 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -803,7 +803,7 @@ POLL_ACK_AFTER_FRAMES); }
- rc = check_polling(fn, pdch->ts_no, &new_poll_fn, &rrbp); + rc = tbf_check_polling(this, pdch, fn, &new_poll_fn, &rrbp); if (rc >= 0) { set_polling(new_poll_fn, pdch->ts_no, PDCH_ULC_POLL_DL_ACK); LOGPTBFDL(this, LOGL_DEBUG, diff --git a/src/tbf_dl_ass_fsm.c b/src/tbf_dl_ass_fsm.c index 207e4d3..6a1bc92 100644 --- a/src/tbf_dl_ass_fsm.c +++ b/src/tbf_dl_ass_fsm.c @@ -61,7 +61,7 @@ /* 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->pdch));
- rc = tbf_check_polling(ctx->tbf, d->fn, d->pdch->ts_no, &new_poll_fn, &rrbp); + rc = tbf_check_polling(ctx->tbf, d->pdch, d->fn, &new_poll_fn, &rrbp); if (rc < 0) return NULL;
diff --git a/src/tbf_ul_ack_fsm.c b/src/tbf_ul_ack_fsm.c index 9501190..a188b08 100644 --- a/src/tbf_ul_ack_fsm.c +++ b/src/tbf_ul_ack_fsm.c @@ -59,7 +59,7 @@ struct GprsMs *ms = tbf_ms(ul_tbf_as_tbf(tbf));
if (final) { - rc = tbf_check_polling(ul_tbf_as_tbf(tbf), d->fn, d->pdch->ts_no, &new_poll_fn, &rrbp); + rc = tbf_check_polling(ul_tbf_as_tbf(tbf), d->pdch, d->fn, &new_poll_fn, &rrbp); if (rc < 0) return NULL; } diff --git a/src/tbf_ul_ass_fsm.c b/src/tbf_ul_ass_fsm.c index d910095..8f2b70c 100644 --- a/src/tbf_ul_ass_fsm.c +++ b/src/tbf_ul_ass_fsm.c @@ -83,7 +83,7 @@ unsigned int rrbp; uint32_t new_poll_fn;
- rc = tbf_check_polling(ctx->tbf, d->fn, d->pdch->ts_no, &new_poll_fn, &rrbp); + rc = tbf_check_polling(ctx->tbf, d->pdch, d->fn, &new_poll_fn, &rrbp); if (rc < 0) return NULL;