Change in osmo-bsc[master]: code cleanup: absorb complete_layer3() into bsc_compl_l3()

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

neels gerrit-no-reply at lists.osmocom.org
Fri May 29 20:16:41 UTC 2020


neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/18497 )

Change subject: code cleanup: absorb complete_layer3() into bsc_compl_l3()
......................................................................

code cleanup: absorb complete_layer3() into bsc_compl_l3()

Tweak return code handling: also return a failure code when dispatching the
GSCON_EV_A_CONN_REQ event failed.

Change-Id: I939e8a9a865250033e4837439a6b9ec251e5ce4c
---
M src/osmo-bsc/gsm_08_08.c
1 file changed, 18 insertions(+), 29 deletions(-)

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



diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index e9918ac..7295f0c 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -55,9 +55,6 @@
 	return true;
 }
 
-static bool complete_layer3(struct gsm_subscriber_connection *conn,
-			    struct msgb *msg, struct bsc_msc_data *msc);
-
 /*! BTS->MSC: tell MSC a SAPI was not established. */
 void bsc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci)
 {
@@ -299,25 +296,6 @@
 	return NULL;
 }
 
-/*! MS->MSC: New MM context with L3 payload. */
-int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg, uint16_t chosen_channel)
-{
-	struct bsc_msc_data *msc;
-
-	LOGP(DMSC, LOGL_INFO, "Tx MSC COMPL L3\n");
-
-	/* find the MSC link we want to use */
-	msc = bsc_find_msc(conn, msg);
-	if (!msc) {
-		LOGP(DMSC, LOGL_ERROR, "Failed to find a MSC for a connection.\n");
-		bsc_send_ussd_no_srv(conn, msg,
-				     conn_get_bts(conn)->network->bsc_data->ussd_no_msc_txt);
-		return -1;
-	}
-
-	return complete_layer3(conn, msg, msc) ? 0 : -2;
-}
-
 static int handle_page_resp(struct gsm_subscriber_connection *conn, struct msgb *msg)
 {
 	struct bsc_subscr *subscr = extract_sub(conn, msg);
@@ -422,15 +400,29 @@
 	return 0;
 }
 
-static bool complete_layer3(struct gsm_subscriber_connection *conn,
-			    struct msgb *msg, struct bsc_msc_data *msc)
+/*! MS->MSC: New MM context with L3 payload. */
+int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg, uint16_t chosen_channel)
 {
+	struct bsc_msc_data *msc;
 	struct msgb *resp;
 	enum bsc_con ret;
 	struct gsm0808_speech_codec_list scl;
+	int rc = -2;
 
 	log_set_context(LOG_CTX_BSC_SUBSCR, conn->bsub);
 
+	LOGP(DMSC, LOGL_INFO, "Tx MSC COMPL L3\n");
+
+	/* find the MSC link we want to use */
+	msc = bsc_find_msc(conn, msg);
+	if (!msc) {
+		LOGP(DMSC, LOGL_ERROR, "Failed to find a MSC for a connection.\n");
+		bsc_send_ussd_no_srv(conn, msg,
+				     conn_get_bts(conn)->network->bsc_data->ussd_no_msc_txt);
+		rc = -1;
+		goto early_fail;
+	}
+
 	/* allocate resource for a new connection */
 	ret = osmo_bsc_sigtran_new_conn(conn, msc);
 
@@ -464,15 +456,12 @@
 		resp = gsm0808_create_layer3_2(msg, cgi_for_msc(conn->sccp.msc, conn_get_bts(conn)), NULL);
 
 	if (resp)
-		osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_A_CONN_REQ, resp);
+		rc = osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_A_CONN_REQ, resp);
 	else
 		LOGP(DMSC, LOGL_DEBUG, "Failed to create layer3 message.\n");
-
-	log_set_context(LOG_CTX_BSC_SUBSCR, NULL);
-	return !!resp;
 early_fail:
 	log_set_context(LOG_CTX_BSC_SUBSCR, NULL);
-	return false;
+	return rc;
 }
 
 /*! MS->BSC/MSC: Um L3 message. */

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I939e8a9a865250033e4837439a6b9ec251e5ce4c
Gerrit-Change-Number: 18497
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
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/20200529/c81eff76/attachment.htm>


More information about the gerrit-log mailing list