Change in libosmo-sccp[master]: cosmetic: xua_asp_fsm.c: reorder functions in file

laforge gerrit-no-reply at lists.osmocom.org
Thu Jun 10 12:13:38 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/24637 )

Change subject: cosmetic: xua_asp_fsm.c: reorder functions in file
......................................................................

cosmetic: xua_asp_fsm.c: reorder functions in file

Reorder functions to follow usual order in FSM files:
1- structs and helper functions
2- for each state: first _oneneter, then the action func
3- generic state fsm functions (timers, all_state)
4- struct osmo_fsm_state
5- FSM allocator and public functions

Change-Id: Ic143db3dda48750effddaa0cafadf960f5b5c38c
---
M src/xua_asp_fsm.c
1 file changed, 44 insertions(+), 36 deletions(-)

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



diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index dd1dddb..e4fb928 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -338,6 +338,21 @@
 	[XUA_ASP_E_ASPSM_BEAT] = XUA_ASP_E_ASPSM_BEAT_ACK,
 };
 
+/* Helper function to dispatch an ASP->AS event to all AS of which this
+ * ASP is a memmber.  Ignores routing contexts for now. */
+static void dispatch_to_all_as(struct osmo_fsm_inst *fi, uint32_t event)
+{
+	struct xua_asp_fsm_priv *xafp = fi->priv;
+	struct osmo_ss7_asp *asp = xafp->asp;
+	struct osmo_ss7_instance *inst = asp->inst;
+	struct osmo_ss7_as *as;
+
+	llist_for_each_entry(as, &inst->as_list, list) {
+		if (!osmo_ss7_as_has_asp(as, asp))
+			continue;
+		osmo_fsm_inst_dispatch(as->fi, event, asp);
+	}
+}
 
 /* check if expected message was received + stop t_ack */
 static void check_stop_t_ack(struct osmo_fsm_inst *fi, uint32_t event)
@@ -381,6 +396,16 @@
 		}							\
 	} while(0)
 
+
+/***************
+** FSM states **
+***************/
+
+static void xua_asp_fsm_down_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+	dispatch_to_all_as(fi, XUA_ASPAS_ASP_DOWN_IND);
+}
+
 static void xua_asp_fsm_down(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
 	struct xua_asp_fsm_priv *xafp = fi->priv;
@@ -436,25 +461,9 @@
 	}
 }
 
-/* Helper function to dispatch an ASP->AS event to all AS of which this
- * ASP is a memmber.  Ignores routing contexts for now. */
-static void dispatch_to_all_as(struct osmo_fsm_inst *fi, uint32_t event)
+static void xua_asp_fsm_inactive_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
 {
-	struct xua_asp_fsm_priv *xafp = fi->priv;
-	struct osmo_ss7_asp *asp = xafp->asp;
-	struct osmo_ss7_instance *inst = asp->inst;
-	struct osmo_ss7_as *as;
-
-	llist_for_each_entry(as, &inst->as_list, list) {
-		if (!osmo_ss7_as_has_asp(as, asp))
-			continue;
-		osmo_fsm_inst_dispatch(as->fi, event, asp);
-	}
-}
-
-static void xua_asp_fsm_down_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
-{
-	dispatch_to_all_as(fi, XUA_ASPAS_ASP_DOWN_IND);
+	dispatch_to_all_as(fi, XUA_ASPAS_ASP_INACTIVE_IND);
 }
 
 static void xua_asp_fsm_inactive(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -571,9 +580,9 @@
 	}
 }
 
-static void xua_asp_fsm_inactive_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+static void xua_asp_fsm_active_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
 {
-	dispatch_to_all_as(fi, XUA_ASPAS_ASP_INACTIVE_IND);
+	dispatch_to_all_as(fi, XUA_ASPAS_ASP_ACTIVE_IND);
 }
 
 static void xua_asp_fsm_active(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -652,11 +661,6 @@
 	}
 }
 
-static void xua_asp_fsm_active_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
-{
-	dispatch_to_all_as(fi, XUA_ASPAS_ASP_ACTIVE_IND);
-}
-
 static void xua_asp_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
 	struct xua_asp_fsm_priv *xafp = fi->priv;
@@ -850,6 +854,10 @@
 	return ofd->fd;
 }
 
+/***************
+** FSM states **
+***************/
+
 /* Server + Client: Initial State, wait for M-ASP-UP.req */
 static void ipa_asp_fsm_down(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
@@ -999,6 +1007,12 @@
 	}
 }
 
+static void ipa_asp_fsm_active_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+	dispatch_to_all_as(fi, XUA_ASPAS_ASP_INACTIVE_IND);
+	dispatch_to_all_as(fi, XUA_ASPAS_ASP_ACTIVE_IND);
+}
+
 /* Server + Client: We're actively transmitting user data */
 static void ipa_asp_fsm_active(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
@@ -1010,6 +1024,11 @@
 	}
 }
 
+static void ipa_asp_fsm_inactive_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+	dispatch_to_all_as(fi, XUA_ASPAS_ASP_INACTIVE_IND);
+}
+
 static void ipa_asp_fsm_inactive(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
 	switch (event) {
@@ -1046,17 +1065,6 @@
 	}
 }
 
-static void ipa_asp_fsm_active_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
-{
-	dispatch_to_all_as(fi, XUA_ASPAS_ASP_INACTIVE_IND);
-	dispatch_to_all_as(fi, XUA_ASPAS_ASP_ACTIVE_IND);
-}
-
-static void ipa_asp_fsm_inactive_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
-{
-	dispatch_to_all_as(fi, XUA_ASPAS_ASP_INACTIVE_IND);
-}
-
 static void ipa_pong_timer_cb(void *_fi)
 {
 	struct osmo_fsm_inst *fi = _fi;

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/24637
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ic143db3dda48750effddaa0cafadf960f5b5c38c
Gerrit-Change-Number: 24637
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210610/57946884/attachment.htm>


More information about the gerrit-log mailing list