From 3f33929119ab98de589db60aaa3a640776d1b7a8 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 28 Oct 2022 18:29:18 +0200 Subject: [PATCH] tbf_fsm: Identify several events as Dl-TBF only This will help in the future when splitting tbf_fsm into different FSMs for UL-TBF and DL-TBF, since only some of the events and states are shared. That means we can keep a single state and event enum, but the FSMs can be implemented separately in different files, easing a lot extending and understanding the logic. Change-Id: Id97f0d532d2d7ab2791a35c1f836d7c8da050124 --- src/tbf_fsm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tbf_fsm.c b/src/tbf_fsm.c index f0192149..9118fd7e 100644 --- a/src/tbf_fsm.c +++ b/src/tbf_fsm.c @@ -202,6 +202,7 @@ static void st_flow(struct osmo_fsm_inst *fi, uint32_t event, void *data) switch (event) { case TBF_EV_DL_ACKNACK_MISS: + OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_DL_TBF); /* DL TBF: we missed a DL ACK/NACK. If we started assignment * over CCCH and never received any DL ACK/NACK yet, it means we * don't even know if the MS successfuly received the Imm Ass on @@ -223,6 +224,7 @@ static void st_flow(struct osmo_fsm_inst *fi, uint32_t event, void *data) tbf_fsm_state_chg(fi, TBF_ST_FINISHED); break; case TBF_EV_FINAL_ACK_RECVD: + OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_DL_TBF); /* We received Final Ack (DL ACK/NACK) from MS. move to WAIT_RELEASE, we wait there for release or re-use the TBF in case we receive more DL data to tx */ @@ -249,8 +251,10 @@ static void st_finished(struct osmo_fsm_inst *fi, uint32_t event, void *data) switch (event) { case TBF_EV_DL_ACKNACK_MISS: + OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_DL_TBF); break; case TBF_EV_FINAL_ACK_RECVD: + OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_DL_TBF); /* We received Final Ack (DL ACK/NACK) from MS. move to WAIT_RELEASE, we wait there for release or re-use the TBF in case we receive more DL data to tx */ @@ -314,6 +318,7 @@ static void st_wait_release(struct osmo_fsm_inst *fi, uint32_t event, void *data struct tbf_fsm_ctx *ctx = (struct tbf_fsm_ctx *)fi->priv; switch (event) { case TBF_EV_FINAL_ACK_RECVD: + OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_DL_TBF); /* ignore, duplicate ACK, we already know about since we are in WAIT_RELEASE */ break; case TBF_EV_MAX_N3101: @@ -351,8 +356,10 @@ static void st_releasing_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) static void st_releasing(struct osmo_fsm_inst *fi, uint32_t event, void *data) { + struct tbf_fsm_ctx *ctx = (struct tbf_fsm_ctx *)fi->priv; switch (event) { case TBF_EV_DL_ACKNACK_MISS: + OSMO_ASSERT(tbf_direction(ctx->tbf) == GPRS_RLCMAC_DL_TBF); /* Ignore, we don't care about missed DL ACK/NACK poll timeouts * anymore, we are already releasing the TBF */ break;