Change in libosmocore[master]: gprs_ns2_vc_fsm: rename state UNCONFIGURED -> DISABLED

lynxis lazus gerrit-no-reply at lists.osmocom.org
Tue Jun 15 20:25:30 UTC 2021


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/24685 )


Change subject: gprs_ns2_vc_fsm: rename state UNCONFIGURED -> DISABLED
......................................................................

gprs_ns2_vc_fsm: rename state UNCONFIGURED -> DISABLED

Original the state was only used as initial state and should be left
immediate afterwards. However as the FR and SNS are using this state
and the vty will also show it to the user, use a non-confusion state.

Related: OS#5180
Change-Id: I5f46ce5e27d7556d5e17bc236f1765d42aecbe0c
---
M src/gb/gprs_ns2_fr.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
M src/gb/gprs_ns2_vc_fsm.c
M src/gb/gprs_ns2_vty.c
5 files changed, 27 insertions(+), 27 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/85/24685/1

diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 3113b00..bbc5361 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -189,7 +189,7 @@
 	if (active) {
 		ns2_vc_fsm_start(nsvc);
 	} else {
-		ns2_vc_force_unconfigured(nsvc);
+		ns2_vc_force_disabled(nsvc);
 	}
 }
 
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index 70e212a..e77731b 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -409,7 +409,7 @@
 struct osmo_fsm_inst *ns2_vc_fsm_alloc(struct gprs_ns2_vc *nsvc,
 					    const char *id, bool initiate);
 int ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc);
-int ns2_vc_force_unconfigured(struct gprs_ns2_vc *nsvc);
+int ns2_vc_force_disabled(struct gprs_ns2_vc *nsvc);
 int ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp);
 int ns2_vc_is_alive(struct gprs_ns2_vc *nsvc);
 int ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc);
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 367f77c..ea90846 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -2286,7 +2286,7 @@
 					/* keep the NSVC we need for SNS, but unconfigure it */
 					nsvc->sig_weight = 0;
 					nsvc->data_weight = 0;
-					ns2_vc_force_unconfigured(nsvc);
+					ns2_vc_force_disabled(nsvc);
 				} else {
 					/* free all other NS-VCs */
 					gprs_ns2_free_nsvc(nsvc);
diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 05118b2..36bb3a9 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -76,10 +76,10 @@
 /* The FSM covers both the VC with RESET/BLOCK and without RESET/BLOCK procedure..
  *
  * With RESET/BLOCK, the state should follow:
- * - UNCONFIGURED -> RESET -> BLOCK -> UNBLOCKED
+ * - DISABLED -> RESET -> BLOCK -> UNBLOCKED
  *
  * Without RESET/BLOCK, the state should follow:
- * - UNCONFIGURED -> RECOVERY -> UNBLOCKED
+ * - DISABLED -> RECOVERY -> UNBLOCKED
  *
  * The UNBLOCKED and TEST states are used to send ALIVE PDU using the timeout Tns-test and Tns-alive.
  * UNBLOCKED -> TEST: on expire of Tns-Test, send Alive PDU.
@@ -90,7 +90,7 @@
  */
 
 enum gprs_ns2_vc_state {
-	GPRS_NS2_ST_UNCONFIGURED,
+	GPRS_NS2_ST_DISABLED,
 	GPRS_NS2_ST_RESET,
 	GPRS_NS2_ST_BLOCKED,
 	GPRS_NS2_ST_UNBLOCKED, /* allows sending NS_UNITDATA */
@@ -114,7 +114,7 @@
 
 	GPRS_NS2_EV_RX_UNITDATA,
 
-	GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED,	/* called via vty for tests */
+	GPRS_NS2_EV_REQ_FORCE_DISABLED,	/* called via vty for tests */
 	GPRS_NS2_EV_REQ_OM_RESET,		/* vty cmd: reset */
 	GPRS_NS2_EV_REQ_OM_BLOCK,		/* vty cmd: block */
 	GPRS_NS2_EV_REQ_OM_UNBLOCK,		/* vty cmd: unblock*/
@@ -132,7 +132,7 @@
 	{ GPRS_NS2_EV_RX_ALIVE_ACK,		"RX-ALIVE_ACK" },
 	{ GPRS_NS2_EV_RX_STATUS,		"RX-STATUS" },
 	{ GPRS_NS2_EV_RX_UNITDATA,		"RX-UNITDATA" },
-	{ GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED,	"REQ-FORCE_UNCONFIGURED" },
+	{ GPRS_NS2_EV_REQ_FORCE_DISABLED,	"REQ-FORCE-DISABLED" },
 	{ GPRS_NS2_EV_REQ_OM_RESET,		"REQ-O&M-RESET"},
 	{ GPRS_NS2_EV_REQ_OM_BLOCK,		"REQ-O&M-BLOCK"},
 	{ GPRS_NS2_EV_REQ_OM_UNBLOCK,		"REQ-O&M-UNBLOCK"},
@@ -252,12 +252,12 @@
 }
 
 
-static void ns2_st_unconfigured_onenter(struct osmo_fsm_inst *fi, uint32_t old_state)
+static void ns2_st_disabled_onenter(struct osmo_fsm_inst *fi, uint32_t old_state)
 {
 	stop_test_procedure(fi->priv);
 }
 
-static void ns2_st_unconfigured(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+static void ns2_st_disabled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
 	struct gprs_ns2_vc_priv *priv = fi->priv;
 	struct gprs_ns2_inst *nsi = priv->nsvc->nse->nsi;
@@ -467,20 +467,20 @@
 }
 
 static const struct osmo_fsm_state ns2_vc_states[] = {
-	[GPRS_NS2_ST_UNCONFIGURED] = {
+	[GPRS_NS2_ST_DISABLED] = {
 		.in_event_mask = S(GPRS_NS2_EV_REQ_START),
 		.out_state_mask = S(GPRS_NS2_ST_RESET) |
 				  S(GPRS_NS2_ST_RECOVERING) |
 				  S(GPRS_NS2_ST_UNBLOCKED),
-		.name = "UNCONFIGURED",
-		.action = ns2_st_unconfigured,
-		.onenter = ns2_st_unconfigured_onenter,
+		.name = "DISABLED",
+		.action = ns2_st_disabled,
+		.onenter = ns2_st_disabled_onenter,
 	},
 	[GPRS_NS2_ST_RESET] = {
 		.in_event_mask = S(GPRS_NS2_EV_RX_RESET_ACK) | S(GPRS_NS2_EV_RX_RESET),
 		.out_state_mask = S(GPRS_NS2_ST_RESET) |
 				  S(GPRS_NS2_ST_BLOCKED) |
-				  S(GPRS_NS2_ST_UNCONFIGURED),
+				  S(GPRS_NS2_ST_DISABLED),
 		.name = "RESET",
 		.action = ns2_st_reset,
 		.onenter = ns2_st_reset_onenter,
@@ -491,7 +491,7 @@
 		.out_state_mask = S(GPRS_NS2_ST_RESET) |
 				  S(GPRS_NS2_ST_UNBLOCKED) |
 				  S(GPRS_NS2_ST_BLOCKED) |
-				  S(GPRS_NS2_ST_UNCONFIGURED),
+				  S(GPRS_NS2_ST_DISABLED),
 		.name = "BLOCKED",
 		.action = ns2_st_blocked,
 		.onenter = ns2_st_blocked_onenter,
@@ -501,7 +501,7 @@
 				 S(GPRS_NS2_EV_RX_UNBLOCK),
 		.out_state_mask = S(GPRS_NS2_ST_RESET) | S(GPRS_NS2_ST_RECOVERING) |
 				  S(GPRS_NS2_ST_BLOCKED) |
-				  S(GPRS_NS2_ST_UNCONFIGURED),
+				  S(GPRS_NS2_ST_DISABLED),
 		.name = "UNBLOCKED",
 		.action = ns2_st_unblocked,
 		.onenter = ns2_st_unblocked_on_enter,
@@ -512,7 +512,7 @@
 		.in_event_mask = S(GPRS_NS2_EV_RX_ALIVE_ACK),
 		.out_state_mask = S(GPRS_NS2_ST_RECOVERING) |
 				  S(GPRS_NS2_ST_UNBLOCKED) |
-				  S(GPRS_NS2_ST_UNCONFIGURED),
+				  S(GPRS_NS2_ST_DISABLED),
 		.name = "RECOVERING",
 		.action = ns2_st_alive,
 		.onenter = ns2_st_alive_onenter,
@@ -638,7 +638,7 @@
 		break;
 	case GPRS_NS2_EV_RX_ALIVE:
 		switch (fi->state) {
-		case GPRS_NS2_ST_UNCONFIGURED:
+		case GPRS_NS2_ST_DISABLED:
 		case GPRS_NS2_ST_RESET:
 			/* ignore ALIVE */
 			break;
@@ -682,10 +682,10 @@
 
 		msgb_free(msg);
 		break;
-	case GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED:
-		if (fi->state != GPRS_NS2_ST_UNCONFIGURED) {
+	case GPRS_NS2_EV_REQ_FORCE_DISABLED:
+		if (fi->state != GPRS_NS2_ST_DISABLED) {
 			/* Force the NSVC back to its initial state */
-			osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_UNCONFIGURED, 0, 0);
+			osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_DISABLED, 0, 0);
 			return;
 		}
 		break;
@@ -722,7 +722,7 @@
 			       S(GPRS_NS2_EV_RX_RESET) |
 			       S(GPRS_NS2_EV_RX_ALIVE) |
 			       S(GPRS_NS2_EV_RX_ALIVE_ACK) |
-			       S(GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED) |
+			       S(GPRS_NS2_EV_REQ_FORCE_DISABLED) |
 			       S(GPRS_NS2_EV_REQ_OM_RESET) |
 			       S(GPRS_NS2_EV_REQ_OM_BLOCK) |
 			       S(GPRS_NS2_EV_REQ_OM_UNBLOCK),
@@ -768,7 +768,7 @@
 int ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc)
 {
 	/* allows to call this function even for started nsvc by gprs_ns2_start_alive_all_nsvcs */
-	if (nsvc->fi->state == GPRS_NS2_ST_UNCONFIGURED)
+	if (nsvc->fi->state == GPRS_NS2_ST_DISABLED)
 		return osmo_fsm_inst_dispatch(nsvc->fi, GPRS_NS2_EV_REQ_START, NULL);
 	return 0;
 }
@@ -776,9 +776,9 @@
 /*! Reset a NS-VC FSM.
  *  \param nsvc the virtual circuit
  *  \return 0 on success; negative on error */
-int ns2_vc_force_unconfigured(struct gprs_ns2_vc *nsvc)
+int ns2_vc_force_disabled(struct gprs_ns2_vc *nsvc)
 {
-	return osmo_fsm_inst_dispatch(nsvc->fi, GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED, NULL);
+	return osmo_fsm_inst_dispatch(nsvc->fi, GPRS_NS2_EV_REQ_FORCE_DISABLED, NULL);
 }
 
 /*! Block a NS-VC.
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 705b60e..819e0c8 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -2027,7 +2027,7 @@
 
 static int nsvc_force_unconf_cb(struct gprs_ns2_vc *nsvc, void *ctx)
 {
-	ns2_vc_force_unconfigured(nsvc);
+	ns2_vc_force_disabled(nsvc);
 	ns2_vc_fsm_start(nsvc);
 	return 0;
 }

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I5f46ce5e27d7556d5e17bc236f1765d42aecbe0c
Gerrit-Change-Number: 24685
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210615/f21a089c/attachment.htm>


More information about the gerrit-log mailing list