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

Change subject: xua_asp_fsm: Stop T(ack) when receiving an Error msg as response
......................................................................

xua_asp_fsm: Stop T(ack) when receiving an Error msg as response

There's no need to keep retrying retransmission if the peer already told
us something is wrong with the message.

Change-Id: Icaeb472fe67911eb15755442cf11010d3c593f1d
---
M src/m3ua.c
M src/xua_asp_fsm.c
M src/xua_asp_fsm.h
3 files changed, 26 insertions(+), 8 deletions(-)

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




diff --git a/src/m3ua.c b/src/m3ua.c
index 2dd8dfb..a22a64a 100644
--- a/src/m3ua.c
+++ b/src/m3ua.c
@@ -694,15 +694,13 @@
 static int m3ua_rx_mgmt_err(struct osmo_ss7_asp *asp, struct xua_msg *xua)
 {
        uint32_t err_code = xua_msg_get_u32(xua, M3UA_IEI_ERR_CODE);
-       struct osmo_xlm_prim *prim;

        LOGPASP(asp, DLM3UA, LOGL_ERROR, "Received MGMT_ERR '%s': %s\n",
                get_value_string(m3ua_err_names, err_code),
                xua_msg_dump(xua, &xua_dialect_m3ua));

-       /* report this to layer manager */
-       prim = xua_xlm_prim_alloc_m_error_ind(err_code);
-       xua_asp_send_xlm_prim(asp, prim);
+       /* deliver that event to the ASP FSM */
+       osmo_fsm_inst_dispatch(asp->fi, XUA_ASP_E_MGMT_ERROR, xua);

        /* NEVER return != 0 here, as we cannot respont to an ERR
         * message with another ERR! */
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 946418c..bb163a0 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -74,6 +74,8 @@
        { XUA_ASP_E_ASPSM_BEAT,         "ASPSM_BEAT" },
        { XUA_ASP_E_ASPSM_BEAT_ACK,     "ASPSM_BEAT_ACK" },

+       { XUA_ASP_E_MGMT_ERROR,         "XUA_ASP_E_MGMT_ERROR" },
+
        { XUA_ASP_E_AS_ASSIGNED,        "AS_ASSIGNED" },
        { XUA_ASP_E_ADM_BLOCKED,        "ADM_BLOCKED" },

@@ -374,6 +376,12 @@
 }

 /* check if expected message was received + stop t_ack */
+static void stop_t_ack(struct osmo_fsm_inst *fi)
+{
+       struct xua_asp_fsm_priv *xafp = fi->priv;
+       LOGPFSML(fi, LOGL_DEBUG, "T(ack) stopped\n");
+       osmo_timer_del(&xafp->t_ack.timer);
+}
 static void check_stop_t_ack(struct osmo_fsm_inst *fi, uint32_t event)
 {
        struct xua_asp_fsm_priv *xafp = fi->priv;
@@ -383,10 +391,8 @@
                return;

        exp_ack = evt_ack_map[xafp->t_ack.out_event];
-       if (exp_ack && event == exp_ack) {
-               LOGPFSML(fi, LOGL_DEBUG, "T(ack) stopped\n");
-               osmo_timer_del(&xafp->t_ack.timer);
-       }
+       if (exp_ack && event == exp_ack)
+               stop_t_ack(fi);
 }

 static void xua_t_beat_stop(struct osmo_fsm_inst *fi)
@@ -875,6 +881,7 @@
        struct xua_asp_fsm_priv *xafp = fi->priv;
        struct osmo_ss7_asp *asp = xafp->asp;
        struct xua_msg *xua;
+       struct osmo_xlm_prim *oxp;

        switch (event) {
        case XUA_ASP_E_SCTP_COMM_DOWN_IND:
@@ -892,6 +899,15 @@
                LOGPFSML(fi, LOGL_DEBUG, "Rx HEARTBEAT ACK\n");
                xafp->t_beat.unacked_beats = 0;
                break;
+       case XUA_ASP_E_MGMT_ERROR:
+               xua = data;
+               OSMO_ASSERT(xua);
+               /* Mark ongoing request as rejected, no need to retransmit: */
+               stop_t_ack(fi);
+               /* report this to layer manager */
+               oxp = xua_xlm_prim_alloc_m_error_ind(xua_msg_get_u32(xua, 
M3UA_IEI_ERR_CODE));
+               xua_asp_send_xlm_prim(asp, oxp);
+               break;
        case XUA_ASP_E_AS_ASSIGNED:
                /* Ignore, only used in IPA asps so far. */
                break;
@@ -1000,6 +1016,7 @@
                               S(XUA_ASP_E_SCTP_RESTART_IND) |
                               S(XUA_ASP_E_ASPSM_BEAT) |
                               S(XUA_ASP_E_ASPSM_BEAT_ACK) |
+                              S(XUA_ASP_E_MGMT_ERROR) |
                               S(XUA_ASP_E_AS_ASSIGNED) |
                               S(XUA_ASP_E_ADM_BLOCKED),
        .allstate_action = xua_asp_allstate,
diff --git a/src/xua_asp_fsm.h b/src/xua_asp_fsm.h
index 52d5f4b..456aec6 100644
--- a/src/xua_asp_fsm.h
+++ b/src/xua_asp_fsm.h
@@ -28,6 +28,9 @@
        XUA_ASP_E_ASPSM_BEAT,
        XUA_ASP_E_ASPSM_BEAT_ACK,

+       /* Rx M3UA MGMT Error message from peer */
+       XUA_ASP_E_MGMT_ERROR,
+
        /* The ASP was added to an AS. data: (struct osmo_ss7_as *) */
        XUA_ASP_E_AS_ASSIGNED,


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

Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: Icaeb472fe67911eb15755442cf11010d3c593f1d
Gerrit-Change-Number: 42568
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to