pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-gprs/+/34622?usp=email )

Change subject: rlcmac: tbf_ul_ass_fsm: Fix state not reset after first UL-TBF 
re-assignment
......................................................................

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
---
M src/rlcmac/tbf_ul_ass_fsm.c
1 file changed, 32 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve; Verified
  pespin: Looks good to me, approved




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 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 @@
        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 @@
        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 @@
                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:

--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/34622?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: Iaddbd1e3924036be1cf6eed41367031d3e127f57
Gerrit-Change-Number: 34622
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-Reviewer: Hoernchen <ew...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to