diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-10-03 16:54:56 +0200 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2023-10-04 10:15:44 +0000 |
commit | f81a7389f1bcbbb008c52ee0904586b15a4678b0 (patch) | |
tree | 8c4c47539a6e49420110e406c080d3834964c081 | |
parent | 0e62f970dca80c083d7f534f03597b9a3d8b39fd (diff) |
rlcmac: tbf_ul_ass_fsm: Fix state not reset after first UL-TBF re-assignment
The FSM can be reused several times to assign a UL TBF over its
lifespan, eg. if a DL TBF DL ACK/NACK is reuse to request allocation of
a UL TBF several times.
Some state like ctx->tbf_starting_time_exists was being left as =true
during the initial run of the FSM, and as a result subsequent runs going
through the check delaying completing after sending the PKT CTRL ACK.
Change-Id: Iaddbd1e3924036be1cf6eed41367031d3e127f57
-rw-r--r-- | src/rlcmac/tbf_ul_ass_fsm.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/rlcmac/tbf_ul_ass_fsm.c b/src/rlcmac/tbf_ul_ass_fsm.c index b1be58c..df5b799 100644 --- a/src/rlcmac/tbf_ul_ass_fsm.c +++ b/src/rlcmac/tbf_ul_ass_fsm.c @@ -128,6 +128,12 @@ static int submit_packet_access_req(const struct gprs_rlcmac_tbf_ul_ass_fsm_ctx static int handle_imm_ass(struct gprs_rlcmac_tbf_ul_ass_fsm_ctx *ctx, const struct tbf_ul_ass_ev_rx_ccch_imm_ass_ctx *d) { + /* reset previous state: */ + memset(&ctx->phase1_alloc, 0, sizeof(ctx->phase1_alloc)); + ctx->sba = true; + ctx->tbf_starting_time_exists = false; + ctx->tbf_starting_time = 0; + /* TS 44.018 10.5.2.16 IA Rest Octets */ switch (d->iaro->UnionType) { case 1: /* d->iaro->u.lh.* (IA_RestOctetsLH_t) */ @@ -195,6 +201,12 @@ static int handle_pkt_ul_ass(struct gprs_rlcmac_tbf_ul_ass_fsm_ctx *ctx, const s const Timeslot_Allocation_t *ts_alloc; const Timeslot_Allocation_Power_Ctrl_Param_t *ts_alloc_pwr_ctl; + /* reset previous state: */ + memset(&ctx->phase2_alloc, 0, sizeof(ctx->phase2_alloc)); + ctx->sba = false; + ctx->tbf_starting_time_exists = false; + ctx->tbf_starting_time = 0; + switch (ulass->UnionType) { case 0: /* ulass->u.PUA_GPRS_Struct.* (PUA_GPRS_t) */ ctx->ul_tbf->tx_cs = ulass->u.PUA_GPRS_Struct.CHANNEL_CODING_COMMAND + 1; @@ -258,6 +270,9 @@ static void st_idle_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) ctx->dl_tbf = NULL; memset(&ctx->phase1_alloc, 0, sizeof(ctx->phase1_alloc)); memset(&ctx->phase2_alloc, 0, sizeof(ctx->phase2_alloc)); + ctx->sba = false; + ctx->tbf_starting_time_exists = false; + ctx->tbf_starting_time = 0; } static void st_idle(struct osmo_fsm_inst *fi, uint32_t event, void *data) @@ -368,7 +383,6 @@ static void st_sched_pkt_res_req(struct osmo_fsm_inst *fi, uint32_t event, void data_ctx->msg = create_pkt_resource_req(ctx, data_ctx); if (!data_ctx->msg) return; - ctx->sba = false; /* Reset state */ tbf_ul_ass_fsm_state_chg(fi, GPRS_RLCMAC_TBF_UL_ASS_ST_WAIT_PKT_UL_ASS); break; default: |