[MERGED] osmo-bsc[master]: cosmetic: abis_nm: use osmo_cell_global_id, parse 3-digit MNC

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 Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Mar 22 04:13:09 UTC 2018


Neels Hofmeyr has submitted this change and it was merged.

Change subject: cosmetic: abis_nm: use osmo_cell_global_id, parse 3-digit MNC
......................................................................


cosmetic: abis_nm: use osmo_cell_global_id, parse 3-digit MNC

Instead of a local redefinition, use osmo_cell_global_id.

This change is cosmetic because the decoded PLMN is currently actually never
used.

Change-Id: I38ac98a4d25159cfd4f686efbfbaf8f00625a6d8
---
M include/osmocom/bsc/abis_nm.h
M src/libbsc/abis_nm.c
2 files changed, 5 insertions(+), 24 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/abis_nm.h b/include/osmocom/bsc/abis_nm.h
index 18f87cd..9586ded 100644
--- a/include/osmocom/bsc/abis_nm.h
+++ b/include/osmocom/bsc/abis_nm.h
@@ -31,13 +31,6 @@
 /* max number of attributes represented as 3GPP TS 52.021 §9.4.62 SW Description array */
 #define MAX_BTS_ATTR 5
 
-struct cell_global_id {
-	uint16_t mcc;
-	uint16_t mnc;
-	uint16_t lac;
-	uint16_t ci;
-};
-
 /* The BCCH info from an ip.access test, in host byte order
  * and already parsed... */
 struct ipac_bcch_info {
@@ -52,7 +45,7 @@
 	uint16_t frame_offset;
 	uint32_t frame_nr_offset;
 	uint8_t bsic;
-	struct cell_global_id cgi;
+	struct osmo_cell_global_id cgi;
 	uint8_t ba_list_si2[16];
 	uint8_t ba_list_si2bis[16];
 	uint8_t ba_list_si2ter[16];
diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c
index c2cb1d0..2ee2e24 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -2871,23 +2871,11 @@
 	return get_value_string(ipacc_testres_names, res);
 }
 
-void ipac_parse_cgi(struct cell_global_id *cid, const uint8_t *buf)
+void ipac_parse_cgi(struct osmo_cell_global_id *cid, const uint8_t *buf)
 {
-	cid->mcc = (buf[0] & 0xf) * 100;
-	cid->mcc += (buf[0] >> 4) *  10;
-	cid->mcc += (buf[1] & 0xf) *  1;
-
-	if (buf[1] >> 4 == 0xf) {
-		cid->mnc = (buf[2] & 0xf) * 10;
-		cid->mnc += (buf[2] >> 4) *  1;
-	} else {
-		cid->mnc = (buf[2] & 0xf) * 100;
-		cid->mnc += (buf[2] >> 4) *  10;
-		cid->mnc += (buf[1] >> 4) *   1;
-	}
-
-	cid->lac = ntohs(*((uint16_t *)&buf[3]));
-	cid->ci = ntohs(*((uint16_t *)&buf[5]));
+	osmo_plmn_from_bcd(buf, &cid->lai.plmn);
+	cid->lai.lac = ntohs(*((uint16_t *)&buf[3]));
+	cid->cell_identity = ntohs(*((uint16_t *)&buf[5]));
 }
 
 /* parse BCCH information IEI from wire format to struct ipac_bcch_info */

-- 
To view, visit https://gerrit.osmocom.org/7415
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I38ac98a4d25159cfd4f686efbfbaf8f00625a6d8
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list