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
This commit is contained in:
Pau Espin 2022-10-28 18:29:18 +02:00
parent 0f85956991
commit 3f33929119
1 changed files with 7 additions and 0 deletions

View File

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