Change in libosmocore[master]: ns2: Split initiater into init_reset and init_block

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

daniel gerrit-no-reply at lists.osmocom.org
Wed Nov 18 17:53:38 UTC 2020


daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21240 )


Change subject: ns2: Split initiater into init_reset and init_block
......................................................................

ns2: Split initiater into init_reset and init_block

Change-Id: Iff5aff0cf8d19d9c718dd11c4e731ced2aeb16ba
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 27 insertions(+), 20 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/21240/1

diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 0d30f12..0dcaf5e 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -55,9 +55,10 @@
 	struct gprs_ns2_vc *nsvc;
 	/* how often the timer was triggered */
 	int N;
-	/* The initiater is responsible to UNBLOCK the VC. The BSS is usually the initiater.
+	/* The initiator is responsible to UNBLOCK the VC. The BSS is usually the initiator.
 	 * It can change while runtime. The side which blocks an unblocked side.*/
-	bool initiater;
+	bool init_block;
+	bool init_reset;
 
 	/* the alive counter is present in all states */
 	struct {
@@ -241,7 +242,7 @@
 	if (old_state != GPRS_NS2_ST_RESET)
 		priv->N = 0;
 
-	if (priv->initiater)
+	if (priv->init_reset)
 		ns2_tx_reset(priv->nsvc, NS_CAUSE_OM_INTERVENTION);
 
 	stop_test_procedure(priv);
@@ -253,7 +254,7 @@
 	struct gprs_ns2_inst *nsi = ns_inst_from_fi(fi);
 	struct gprs_ns2_vc_priv *priv = fi->priv;
 
-	if (priv->initiater) {
+	if (priv->init_reset) {
 		switch (event) {
 		case GPRS_NS2_EV_RESET_ACK:
 			osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED,
@@ -279,7 +280,7 @@
 	if (old_state != GPRS_NS2_ST_BLOCKED)
 		priv->N = 0;
 
-	if (priv->initiater)
+	if (priv->init_block)
 		ns2_tx_unblock(priv->nsvc);
 
 	start_test_procedure(priv);
@@ -289,7 +290,7 @@
 {
 	struct gprs_ns2_vc_priv *priv = fi->priv;
 
-	if (priv->initiater) {
+	if (priv->init_block) {
 		switch (event) {
 		case GPRS_NS2_EV_BLOCK:
 			/* TODO: BLOCK is a UNBLOCK_NACK */
@@ -331,7 +332,7 @@
 
 	switch (event) {
 	case GPRS_NS2_EV_BLOCK:
-		priv->initiater = false;
+		priv->init_block = false;
 		ns2_tx_block_ack(priv->nsvc);
 		osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED,
 					0, 2);
@@ -419,10 +420,10 @@
 	struct gprs_ns2_inst *nsi = ns_inst_from_fi(fi);
 	struct gprs_ns2_vc_priv *priv = fi->priv;
 
-	if (priv->initiater) {
-		/* PCU timeouts */
-		switch (fi->state) {
-		case GPRS_NS2_ST_RESET:
+	/* PCU timeouts */
+	switch (fi->state) {
+	case GPRS_NS2_ST_RESET:
+		if (priv->init_reset) {
 			priv->N++;
 			if (priv->N <= nsi->timeout[NS_TOUT_TNS_RESET_RETRIES]) {
 				osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_RESET, nsi->timeout[NS_TOUT_TNS_RESET], 0);
@@ -430,16 +431,20 @@
 				priv->N = 0;
 				osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_RESET, nsi->timeout[NS_TOUT_TNS_RESET], 0);
 			}
-			break;
-		case GPRS_NS2_ST_BLOCKED:
+		}
+		break;
+	case GPRS_NS2_ST_BLOCKED:
+		if (priv->init_block) {
 			priv->N++;
 			if (priv->N <= nsi->timeout[NS_TOUT_TNS_BLOCK_RETRIES]) {
 				osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED, nsi->timeout[NS_TOUT_TNS_BLOCK], 0);
 			} else {
 				osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_RESET, nsi->timeout[NS_TOUT_TNS_RESET], 0);
 			}
-			break;
-		case GPRS_NS2_ST_ALIVE:
+		}
+		break;
+	case GPRS_NS2_ST_ALIVE:
+		if (priv->init_reset) {
 			priv->N++;
 			if (priv->N <= nsi->timeout[NS_TOUT_TNS_ALIVE_RETRIES]) {
 				osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_ALIVE, 0, 0);
@@ -449,6 +454,7 @@
 			}
 			break;
 		}
+		break;
 	}
 	return 0;
 }
@@ -502,7 +508,7 @@
 
 		/* move the FSM into reset */
 		if (fi->state != GPRS_NS2_ST_RESET) {
-			priv->initiater = false;
+			priv->init_reset = false;
 			osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_RESET, nsi->timeout[NS_TOUT_TNS_RESET], NS_TOUT_TNS_RESET);
 		}
 		/* pass the event down into FSM action */
@@ -534,7 +540,7 @@
 		switch (fi->state) {
 		case GPRS_NS2_ST_BLOCKED:
 			/* 7.2.1: the BLOCKED_ACK might be lost */
-			if (priv->initiater) {
+			if (priv->init_block) {
 				gprs_ns2_recv_unitdata(fi, msg);
 				return;
 			}
@@ -585,11 +591,11 @@
  * \param ctx
  * \param vc
  * \param id a char representation of the virtual curcuit
- * \param initiater initiater is the site which starts the connection. Usually the BSS.
+ * \param initiator initiator is the site which starts the connection. Usually the BSS.
  * \return NULL on error, otherwise the fsm
  */
 struct osmo_fsm_inst *gprs_ns2_vc_fsm_alloc(struct gprs_ns2_vc *nsvc,
-					    const char *id, bool initiater)
+					    const char *id, bool initiator)
 {
 	struct osmo_fsm_inst *fi;
 	struct gprs_ns2_vc_priv *priv;
@@ -601,7 +607,8 @@
 	nsvc->fi = fi;
 	priv = fi->priv = talloc_zero(fi, struct gprs_ns2_vc_priv);
 	priv->nsvc = nsvc;
-	priv->initiater = initiater;
+	priv->init_reset = initiator;
+	priv->init_block = initiator;
 
 	osmo_timer_setup(&priv->alive.timer, alive_timeout_handler, fi);
 

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iff5aff0cf8d19d9c718dd11c4e731ced2aeb16ba
Gerrit-Change-Number: 21240
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201118/7c7fef16/attachment.htm>


More information about the gerrit-log mailing list