Pass gprc_rlcmac_pdch to tbf_check_polling

Change-Id: I1c7140b35b7c93d3df4156841e908d3b44d7336d
This commit is contained in:
Pau Espin 2022-12-15 18:23:12 +01:00
parent d29a1435ad
commit fd74e79ab3
7 changed files with 28 additions and 32 deletions

View File

@ -168,7 +168,7 @@ static struct msgb *create_packet_cell_chg_continue(const struct nacc_fsm_ctx *c
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;

View File

@ -458,27 +458,6 @@ void gprs_rlcmac_tbf::t_start(enum tbf_timers t, int T, const char *reason, bool
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 @@ bool tbf_is_egprs_enabled(const struct gprs_rlcmac_tbf *tbf)
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)

View File

@ -139,7 +139,7 @@ bool tbf_is_tfi_assigned(const struct gprs_rlcmac_tbf *tbf);
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 @@ struct gprs_rlcmac_tbf {
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);

View File

@ -803,7 +803,7 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
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,

View File

@ -61,7 +61,7 @@ struct msgb *create_packet_dl_assign(const struct tbf_dl_ass_fsm_ctx *ctx,
/* 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;

View File

@ -59,7 +59,7 @@ static struct msgb *create_ul_ack_nack(const struct tbf_ul_ack_fsm_ctx *ctx,
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;
}

View File

@ -83,7 +83,7 @@ struct msgb *create_packet_ul_assign(const struct tbf_ul_ass_fsm_ctx *ctx,
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;