Change in libosmocore[master]: ns2: refactor ns2_prim_status_ind()

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/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Sat Oct 3 18:06:45 UTC 2020


lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/20390 )

Change subject: ns2: refactor ns2_prim_status_ind()
......................................................................

ns2: refactor ns2_prim_status_ind()

Replace parameters nsi + nsei with a single nse pointer.

Change-Id: I35f6381110ba7ba1e013f21120e971362bdff55b
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
3 files changed, 12 insertions(+), 16 deletions(-)

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



diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 05d4972..53500d1 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -344,18 +344,18 @@
  *  \param[in] nsei NSEI to which the statue relates
  *  \param[in] bvci BVCI to which the status relates
  *  \param[in] cause The cause of the status */
-void ns2_prim_status_ind(struct gprs_ns2_inst *nsi,
-			 uint16_t nsei, uint16_t bvci,
+void ns2_prim_status_ind(struct gprs_ns2_nse *nse,
+			 uint16_t bvci,
 			 enum gprs_ns2_affecting_cause cause)
 {
 	struct osmo_gprs_ns2_prim nsp = {};
-	nsp.nsei = nsei;
+	nsp.nsei = nse->nsei;
 	nsp.bvci = bvci;
 	nsp.u.status.cause = cause;
 	nsp.u.status.transfer = -1;
 	osmo_prim_init(&nsp.oph, SAP_NS, PRIM_NS_STATUS,
 			PRIM_OP_INDICATION, NULL);
-	nsi->cb(&nsp.oph, nsi->cb_data);
+	nse->nsi->cb(&nsp.oph, nse->nsi->cb_data);
 }
 
 /*! Allocate a NS-VC within the given bind + NSE.
@@ -410,8 +410,7 @@
 	if (!nsvc)
 		return;
 
-	ns2_prim_status_ind(nsvc->nse->nsi, nsvc->nse->nsei,
-			    0, NS_AFF_CAUSE_VC_FAILURE);
+	ns2_prim_status_ind(nsvc->nse, 0, NS_AFF_CAUSE_VC_FAILURE);
 
 	llist_del(&nsvc->list);
 	llist_del(&nsvc->blist);
@@ -579,8 +578,7 @@
 		gprs_ns2_free_nsvc(nsvc);
 	}
 
-	ns2_prim_status_ind(nse->nsi, nse->nsei,
-			    0, NS_AFF_CAUSE_FAILURE);
+	ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_FAILURE);
 
 	llist_del(&nse->list);
 	if (nse->bss_sns_fi)
@@ -932,8 +930,7 @@
 	if (unblocked) {
 		/* this is the first unblocked NSVC on an unavailable NSE */
 		nse->alive = true;
-		ns2_prim_status_ind(nse->nsi, nse->nsei,
-				    0, NS_AFF_CAUSE_RECOVERY);
+		ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_RECOVERY);
 		return;
 	}
 
@@ -950,8 +947,7 @@
 
 	/* nse became unavailable */
 	nse->alive = false;
-	ns2_prim_status_ind(nse->nsi, nse->nsei,
-			    0, NS_AFF_CAUSE_FAILURE);
+	ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_FAILURE);
 }
 
 /*! Create a new GPRS NS instance
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index 15b0bc5..1980ef8 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -213,8 +213,8 @@
 struct msgb *gprs_ns2_msgb_alloc(void);
 
 void gprs_ns2_sns_dump_vty(struct vty *vty, const struct gprs_ns2_nse *nse, bool stats);
-void ns2_prim_status_ind(struct gprs_ns2_inst *nsi,
-			 uint16_t nsei, uint16_t bvci,
+void ns2_prim_status_ind(struct gprs_ns2_nse *nse,
+			 uint16_t bvci,
 			 enum gprs_ns2_affecting_cause cause);
 void ns2_nse_notify_alive(struct gprs_ns2_vc *nsvc, bool alive);
 
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 753ac4d..9ffb152 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -670,7 +670,7 @@
 	struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
 
 	if (old_state != GPRS_SNS_ST_UNCONFIGURED)
-		ns2_prim_status_ind(gss->nse->nsi, gss->nse->nsei, 0, NS_AFF_CAUSE_SNS_FAILURE);
+		ns2_prim_status_ind(gss->nse, 0, NS_AFF_CAUSE_SNS_FAILURE);
 
 	if (gss->num_max_ip4_remote > 0)
 		ns2_tx_sns_size(gss->sns_nsvc, true, gss->num_max_nsvcs, gss->num_max_ip4_remote, -1);
@@ -1110,7 +1110,7 @@
 static void ns2_sns_st_configured_onenter(struct osmo_fsm_inst *fi, uint32_t old_state)
 {
 	struct gprs_ns2_nse *nse = nse_inst_from_fi(fi);
-	ns2_prim_status_ind(nse->nsi, nse->nsei, 0, NS_AFF_CAUSE_SNS_CONFIGURED);
+	ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_SNS_CONFIGURED);
 }
 
 static const struct osmo_fsm_state ns2_sns_bss_states[] = {

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I35f6381110ba7ba1e013f21120e971362bdff55b
Gerrit-Change-Number: 20390
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201003/de5068d1/attachment.htm>


More information about the gerrit-log mailing list