pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/37678?usp=email )


Change subject: X2001 timeout: Update UL TBF's dl_ass_fsm state
......................................................................

X2001 timeout: Update UL TBF's dl_ass_fsm state

X2001 is the timer triggered after 2 seconds when a DL TBF is being
assigned but the assignment never completes.
A DL TBF can be PACCH-assigned using either:
* Another DL TBF (usually the same object when upgrading to multislot)
* A UL TBF.

The active UL/DL TBF doing the assignment of thew new DL TBF is the one
holding the assignment state in its tbf.dl_ass_fsm.
That FSM is checked by the scheduler to figure out whether a Pkt DL Ass
needs to be transmitted.

if the new DL TBF being assigned was freed due to X2001, then the
tbf.dl_ass_fsm of the TBF doing the assignment was not updating, meaning
it was trying to send Pkt DL Ass by the scheduler, but it was erroring
(properly) by a check in create_packet_dl_assign() validating a DL TBF
(the oen being assigned) exists in the MS.

Change-Id: I42cc264b1b77bf8d91ec01a18d8985e182a20024
---
M src/tbf_dl_ass_fsm.c
M src/tbf_dl_ass_fsm.h
M src/tbf_dl_fsm.c
3 files changed, 50 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/78/37678/1

diff --git a/src/tbf_dl_ass_fsm.c b/src/tbf_dl_ass_fsm.c
index d811b71..1b6d97b 100644
--- a/src/tbf_dl_ass_fsm.c
+++ b/src/tbf_dl_ass_fsm.c
@@ -42,6 +42,7 @@
        { TBF_DL_ASS_EV_CREATE_RLCMAC_MSG, "CREATE_RLCMAC_MSG" },
        { TBF_DL_ASS_EV_RX_ASS_CTRL_ACK, "RX_ASS_CTRL_ACK" },
        { TBF_DL_ASS_EV_ASS_POLL_TIMEOUT, "ASS_POLL_TIMEOUT" },
+       { TBF_DL_ASS_EV_ABORT, "ABORT" },
        { 0, NULL }
 };

@@ -163,6 +164,10 @@
                        return;
                tbf_dl_ass_fsm_state_chg(fi, TBF_DL_ASS_WAIT_ACK);
                break;
+       case TBF_DL_ASS_EV_ABORT:
+               /* Cancel pending schedule for Pkt Ul Ass: */
+               tbf_dl_ass_fsm_state_chg(fi, TBF_DL_ASS_NONE);
+               break;
        default:
                OSMO_ASSERT(0);
        }
@@ -183,6 +188,9 @@
                /* Reschedule Pkt Dl Ass */
                tbf_dl_ass_fsm_state_chg(fi, TBF_DL_ASS_SEND_ASS);
                break;
+       case TBF_DL_ASS_EV_ABORT:
+               tbf_dl_ass_fsm_state_chg(fi, TBF_DL_ASS_NONE);
+               break;
        default:
                OSMO_ASSERT(0);
        }
@@ -208,7 +216,8 @@
                .onenter = st_none_on_enter,
        },
        [TBF_DL_ASS_SEND_ASS] = {
-               .in_event_mask = X(TBF_DL_ASS_EV_CREATE_RLCMAC_MSG),
+               .in_event_mask = X(TBF_DL_ASS_EV_CREATE_RLCMAC_MSG) |
+                                X(TBF_DL_ASS_EV_ABORT),
                .out_state_mask =
                        X(TBF_DL_ASS_WAIT_ACK) |
                        X(TBF_DL_ASS_NONE),
@@ -218,7 +227,8 @@
        [TBF_DL_ASS_WAIT_ACK] = {
                .in_event_mask =
                        X(TBF_DL_ASS_EV_RX_ASS_CTRL_ACK) |
-                       X(TBF_DL_ASS_EV_ASS_POLL_TIMEOUT),
+                       X(TBF_DL_ASS_EV_ASS_POLL_TIMEOUT) |
+                       X(TBF_DL_ASS_EV_ABORT),
                .out_state_mask =
                        X(TBF_DL_ASS_NONE) |
                        X(TBF_DL_ASS_SEND_ASS),
diff --git a/src/tbf_dl_ass_fsm.h b/src/tbf_dl_ass_fsm.h
index cb7be8d..56c71c4 100644
--- a/src/tbf_dl_ass_fsm.h
+++ b/src/tbf_dl_ass_fsm.h
@@ -28,6 +28,7 @@
        TBF_DL_ASS_EV_CREATE_RLCMAC_MSG, /* Scheduler wants to gen+Tx the Ass 
(rej): data=tbf_dl_ass_ev_create_rlcmac_msg_ctx */
        TBF_DL_ASS_EV_RX_ASS_CTRL_ACK, /* Received CTRL ACK answering poll set 
on Pkt Dl Ass */
        TBF_DL_ASS_EV_ASS_POLL_TIMEOUT, /* Pdch Ul Controller signals timeout 
for poll set on Pkt Dl Ass */
+       TBF_DL_ASS_EV_ABORT, /* DL TBF being assigned was internally released */
 };

 enum tbf_dl_ass_fsm_states {
diff --git a/src/tbf_dl_fsm.c b/src/tbf_dl_fsm.c
index 917c4b1..400c242 100644
--- a/src/tbf_dl_fsm.c
+++ b/src/tbf_dl_fsm.c
@@ -411,6 +411,10 @@
 static int tbf_dl_fsm_timer_cb(struct osmo_fsm_inst *fi)
 {
        struct tbf_dl_fsm_ctx *ctx = (struct tbf_dl_fsm_ctx *)fi->priv;
+       struct GprsMs *ms = NULL;
+       struct gprs_rlcmac_ul_tbf *ul_tbf = NULL;
+       struct gprs_rlcmac_tbf *tbf = NULL;
+
        switch (fi->T) {
        case -2002:
                handle_timeout_X2002(fi);
@@ -419,7 +423,14 @@
                tbf_dl_fsm_state_chg(fi, TBF_ST_WAIT_REUSE_TFI);
                break;
        case -2001:
+               ms = tbf_ms(ctx->tbf);
+               ul_tbf = ms_ul_tbf(ms);
+               tbf = ul_tbf_as_tbf(ul_tbf);
                LOGPTBFDL(ctx->dl_tbf, LOGL_NOTICE, "releasing due to PACCH 
assignment timeout.\n");
+               /* If a UL TBF is trying to assign us, notify it that we are
+                * dying so it avoids continuing the assignment. */
+               if (ul_tbf && tbf_dl_ass_fi(tbf)->state != TBF_DL_ASS_NONE)
+                       osmo_fsm_inst_dispatch(tbf_dl_ass_fi(tbf), 
TBF_DL_ASS_EV_ABORT, NULL);
                /* fall-through */
        case 3193:
        case 3195:

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I42cc264b1b77bf8d91ec01a18d8985e182a20024
Gerrit-Change-Number: 37678
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to