From 78ddfbc413219aeb05b868ce3f0b315a91f0c517 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 12 Oct 2021 13:08:27 +0200 Subject: [PATCH] tbf_dl_ass_fsm: Move block msg generation conditions to rts() function Move the required conditions to generate a message to the rts() function, this way the scheduler knows this TBF cannot yet attempt the procedure and hence will not request it to create a message which will fail. This way the scheduler will schedule other itneresting messages instead of failing and scheduling a dummy block as a result. Change-Id: Idbe4f9bbd23005a43c586b737cf9adc2114287e2 --- src/tbf_dl_ass_fsm.c | 45 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/tbf_dl_ass_fsm.c b/src/tbf_dl_ass_fsm.c index 5ac1c1a1..37ced616 100644 --- a/src/tbf_dl_ass_fsm.c +++ b/src/tbf_dl_ass_fsm.c @@ -65,31 +65,10 @@ 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->ts)); - if (tbf_ul_ass_fi(ctx->tbf)->state == TBF_UL_ASS_WAIT_ACK) - { - LOGPTBF(ctx->tbf, LOGL_DEBUG, - "Polling is already scheduled, so we must wait for the uplink assignment...\n"); - // FIXME: call tbf_dl_ass_fsm_state_chg(ctx->fi, TBF_DL_ASS_NONE); ? - return NULL; - } rc = tbf_check_polling(ctx->tbf, d->fn, d->ts, &new_poll_fn, &rrbp); if (rc < 0) return NULL; - /* on uplink TBF we get the downlink TBF to be assigned. */ - if (tbf_direction(ctx->tbf) == GPRS_RLCMAC_UL_TBF) { - struct gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(ctx->tbf); - - /* be sure to check first, if contention resolution is done, - * otherwise we cannot send the assignment yet (3GPP TS 44.060 sec 7.1.3.1) */ - if (!ul_tbf_contention_resolution_done(ul_tbf)) { - LOGPTBF(ctx->tbf, LOGL_DEBUG, - "Cannot assign DL TBF now, because contention resolution is not finished.\n"); - // FIXME: call tbf_dl_ass_fsm_state_chg(ctx->fi, TBF_DL_ASS_NONE); ? - return NULL; - } - } - new_dl_tbf = ms_dl_tbf(ms); if (!new_dl_tbf) { LOGPTBF(ctx->tbf, LOGL_ERROR, @@ -273,8 +252,28 @@ struct msgb *tbf_dl_ass_create_rlcmac_msg(const struct gprs_rlcmac_tbf* tbf, uin return data_ctx.msg; } -bool tbf_dl_ass_rts(const struct gprs_rlcmac_tbf* tbf) +bool tbf_dl_ass_rts(const struct gprs_rlcmac_tbf *tbf) { struct osmo_fsm_inst *fi = tbf_dl_ass_fi(tbf); - return fi->state == TBF_DL_ASS_SEND_ASS; + if (fi->state != TBF_DL_ASS_SEND_ASS) + return false; + + if (tbf_ul_ass_fi(tbf)->state == TBF_UL_ASS_WAIT_ACK) { + LOGPTBF(tbf, LOGL_DEBUG, + "Polling is already scheduled, so we must wait for the uplink assignment...\n"); + return false; + } + + /* on uplink TBF we get the downlink TBF to be assigned. */ + if (tbf_direction(tbf) == GPRS_RLCMAC_UL_TBF) { + const struct gprs_rlcmac_ul_tbf *ul_tbf = (const struct gprs_rlcmac_ul_tbf *)tbf; + /* be sure to check first, if contention resolution is done, + * otherwise we cannot send the assignment yet (3GPP TS 44.060 sec 7.1.3.1) */ + if (!ul_tbf_contention_resolution_done(ul_tbf)) { + LOGPTBF(tbf, LOGL_DEBUG, + "Cannot assign DL TBF now, because contention resolution is not finished.\n"); + return false; + } + } + return true; }