Change in osmo-msc[master]: Autofill LCLS parameters for A-interface transactions

Max gerrit-no-reply at lists.osmocom.org
Tue Mar 26 14:14:39 UTC 2019


Max has uploaded this change for review. ( https://gerrit.osmocom.org/13422


Change subject: Autofill LCLS parameters for A-interface transactions
......................................................................

Autofill LCLS parameters for A-interface transactions

That's experimental patch to facilitate testing of BSC implementation of
LCLS.

Change-Id: I35ae6b6ca04925c8d300bc1a0269af00eac727f3
---
M include/osmocom/msc/debug.h
M include/osmocom/msc/transaction.h
M src/libmsc/a_iface.c
M src/libmsc/transaction.c
4 files changed, 62 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/22/13422/1

diff --git a/include/osmocom/msc/debug.h b/include/osmocom/msc/debug.h
index 28ba482..3d3f5e6 100644
--- a/include/osmocom/msc/debug.h
+++ b/include/osmocom/msc/debug.h
@@ -8,6 +8,7 @@
 	DCC,
 	DMM,
 	DRR,
+	DLCLS,
 	DMNCC,
 	DPAG,
 	DMSC,
diff --git a/include/osmocom/msc/transaction.h b/include/osmocom/msc/transaction.h
index 830328b..eb5a0d0 100644
--- a/include/osmocom/msc/transaction.h
+++ b/include/osmocom/msc/transaction.h
@@ -108,6 +108,8 @@
 					 const struct vlr_subscr *vsub,
 					 uint8_t sm_rp_mr);
 
+struct osmo_lcls *trans_fill_lcls(const struct gsm_trans *trans, bool use_lac);
+
 struct gsm_trans *trans_alloc(struct gsm_network *net,
 			      struct vlr_subscr *vsub,
 			      uint8_t protocol, uint8_t trans_id,
diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index 91a2b6a..b707b59 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -425,7 +425,11 @@
 	memset(&rtp_addr, 0, sizeof(rtp_addr));
 	memcpy(&rtp_addr, &rtp_addr_in, sizeof(rtp_addr_in));
 
-	msg = gsm0808_create_ass(&ct, NULL, &rtp_addr, &scl, NULL);
+	LOGPCONN(conn, LOGL_NOTICE, "Preparing LCLS...\n");
+	bool use_lac = true;
+	msg = gsm0808_create_ass2(&ct, NULL, &rtp_addr, &scl, NULL, NULL, trans_fill_lcls(trans, use_lac));
+	LOGPCONN(conn, LOGL_DEBUG, "N-DATA.req(%s)\n", msgb_hexdump_l2(msg));
+
 	return a_iface_tx_bssap(conn, msg);
 }
 
diff --git a/src/libmsc/transaction.c b/src/libmsc/transaction.c
index 66126e6..8aa81c6 100644
--- a/src/libmsc/transaction.c
+++ b/src/libmsc/transaction.c
@@ -93,6 +93,60 @@
 	return NULL;
 }
 
+struct osmo_lcls *trans_fill_lcls(const struct gsm_trans *trans, bool use_lac)
+{
+	struct osmo_ss7_instance *ss7 = osmo_sccp_get_ss7(trans->net->a.sccp);//FIXME: ensure that a interface is in use for this transaction
+	struct osmo_lcls *lcls;
+	uint8_t w = osmo_ss7_pc_width(&ss7->cfg.pc_fmt);
+
+	if(!trans->vsub->vlr->cfg.lcls_enabled) {
+		LOGP(DCC, LOGL_NOTICE, "LCLS disabled globally\n");
+		return NULL;
+	}
+
+	if(!trans) {
+		LOGP(DCC, LOGL_ERROR, "LCLS: unable to fill parameters for unallocated transaction\n");
+		return NULL;
+	}
+
+	if(!trans->conn) {
+		LOGP(DCC, LOGL_ERROR, "LCLS: unable to fill parameters for transaction without connection\n");
+		return NULL;
+	}
+
+	if (trans->conn->via_ran != OSMO_RAT_GERAN_A) {
+		LOGP(DCC, LOGL_ERROR, "LCLS: only A interface is supported at the moment\n");
+		return NULL;
+	}
+
+	lcls = talloc_zero(trans, struct osmo_lcls);
+	if (!lcls) {
+		LOGP(DCC, LOGL_ERROR, "LCLS: failed to allocate osmo_lcls\n");
+		return NULL;
+	}
+
+	LOGP(DCC, LOGL_INFO, "LCLS: using %u bits (%u bytes) for node ID\n", w, w / 8);
+
+	lcls->gcr.net_len = 3;
+	lcls->gcr.node = ss7->cfg.primary_pc;
+
+	osmo_plmn_to_bcd(lcls->gcr.net, &trans->net->plmn); /* net id from Q.1902.3 3-5 bytes, this function gives 3 bytes exactly */
+
+	osmo_store32be(trans->callref, lcls->gcr.cr);
+	osmo_store16be(use_lac ? trans->conn->lac : trans->conn->ci, lcls->gcr.cr + 3);
+
+	LOGP(DCC, LOGL_INFO, "LCLS: allocated %s-based CR-ID %s\n", use_lac ? "LAC" : "CI", osmo_hexdump(lcls->gcr.cr, 5));
+
+	lcls->config = GSM0808_LCLS_CFG_BOTH_WAY;
+	lcls->control = GSM0808_LCLS_CSC_CONNECT;
+	lcls->corr_needed = true;
+	lcls->gcr_available = true;
+
+	LOGP(DCC, LOGL_INFO, "Filled %s, %s\n", osmo_lcls_dump(lcls), osmo_gcr_dump(lcls));
+
+	return lcls;
+}
+
 /*! Allocate a new transaction and add it to network list
  *  \param[in] net Netwokr in which we allocate transaction
  *  \param[in] subscr Subscriber for which we allocate transaction

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I35ae6b6ca04925c8d300bc1a0269af00eac727f3
Gerrit-Change-Number: 13422
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190326/73518208/attachment.html>


More information about the gerrit-log mailing list