Change in osmo-bsc[master]: RSL/BSSAP: fix: properly convert between RSL Link ID and DLCI

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

laforge gerrit-no-reply at lists.osmocom.org
Thu Oct 8 07:15:01 UTC 2020


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

Change subject: RSL/BSSAP: fix: properly convert between RSL Link ID and DLCI
......................................................................

RSL/BSSAP: fix: properly convert between RSL Link ID and DLCI

Data Link Connection Identifier (DLCI) is defined in 3GPP TS 48.006,
section 9.3.2, and coded as follows:

  .... .SSS - SAPI value used on the radio link;
  CC.. .... - control channel identification:
    00.. .... - indicates that the control channel is not further specified,
    10.. .... - represents the FACCH or the SDCCH,
    11.. .... - represents the SACCH,
    other values are reserved.

RSL Link Identifier is defined in 3GPP TS 3GPP TS 48.058,
section 9.3.2, and coded as follows:

  .... .SSS - SAPI value used on the radio link;
  ...P P... - priority for SAPI0 messages;
  CC.. .... - control channel identification:
    00.. .... - main signalling channel (FACCH or SDCCH),
    01.. .... - SACCH,
    other values are reserved.

As can be seen, CC bits in both DLCI and RSL Link Identifier
are coded differently.  Therefore, we cannot just assign
one identifier to another, we need to do conversion.

I noticed that osmo-bsc indicates DLCI '01000011'B for SMS
messages sent over SACCH/F (SAPI3), and this is wrong because
'01'B is reserved.  Let's fix this.

P.S. Interesting coincidence: section 9.3.2 in both documents.

Change-Id: If4d479a54cad467f53b49065c1c435a4471ac7d2
Related: Ica69ae95b47a67ba99ba9cc36629b6bd210d11e4
Related: OS#3716
---
M src/osmo-bsc/gsm_08_08.c
M src/osmo-bsc/osmo_bsc_bssap.c
2 files changed, 27 insertions(+), 4 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index a4b53f0..f3214c7 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -537,6 +537,16 @@
 	return rc;
 }
 
+/* Data Link Connection Identifier (DLCI) is defined in 3GPP TS 48.006, section 9.3.2.
+ * .... .SSS - SAPI value used on the radio link;
+ * CC.. .... - control channel identification:
+ *   00.. .... - indicates that the control channel is not further specified,
+ *   10.. .... - represents the FACCH or the SDCCH,
+ *   11.. .... - represents the SACCH,
+ *   other values are reserved. */
+#define RSL_LINK_ID2DLCI(link_id) \
+	(link_id & 0x40 ? 0xc0 : 0x80) | (link_id & 0x07)
+
 /*! MS->BSC/MSC: Um L3 message. */
 void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg)
 {
@@ -549,8 +559,9 @@
 
 	parse_powercap(conn, msg);
 
-	/* Store link_id in msg->cb */
-	OBSC_LINKID_CB(msg) = link_id;
+	/* convert RSL link ID to DLCI, store in msg->cb */
+	OBSC_LINKID_CB(msg) = RSL_LINK_ID2DLCI(link_id);
+
 	osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_MO_DTAP, msg);
 done:
 	log_set_context(LOG_CTX_BSC_SUBSCR, NULL);
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 124f613..10f0edd 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -1186,6 +1186,16 @@
 	return ret;
 }
 
+/* RSL Link Identifier is defined in 3GPP TS 3GPP TS 48.058, section 9.3.2.
+ * .... .SSS - SAPI value used on the radio link;
+ * ...P P... - priority for SAPI0 messages;
+ * CC.. .... - control channel identification:
+ *   00.. .... - main signalling channel (FACCH or SDCCH),
+ *   01.. .... - SACCH,
+ *   other values are reserved. */
+#define DLCI2RSL_LINK_ID(dlci) \
+	((dlci & 0xc0) == 0xc0 ? 0x40 : 0x00) | (dlci & 0x07)
+
 static int dtap_rcvmsg(struct gsm_subscriber_connection *conn,
 		       struct msgb *msg, unsigned int length)
 {
@@ -1235,8 +1245,10 @@
 
 	/* pass it to the filter for extra actions */
 	bsc_scan_msc_msg(conn, gsm48);
-	/* Store link_id in msgb->cb */
-	OBSC_LINKID_CB(gsm48) = header->link_id;
+
+	/* convert DLCI to RSL link ID, store in msg->cb */
+	OBSC_LINKID_CB(gsm48) = DLCI2RSL_LINK_ID(header->link_id);
+
 	dtap_rc = osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_MT_DTAP, gsm48);
 	return dtap_rc;
 }

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: If4d479a54cad467f53b49065c1c435a4471ac7d2
Gerrit-Change-Number: 20386
Gerrit-PatchSet: 4
Gerrit-Owner: Vadim Yanitskiy <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201008/f329eff0/attachment.htm>


More information about the gerrit-log mailing list