[PATCH] osmo-bsc[master]: pcu_sock: reorganize calculation of paging group

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
Tue Apr 24 09:49:29 UTC 2018


Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/6204

to look at the new patch set (#2).

pcu_sock: reorganize calculation of paging group

pcu_sock.c:pcu_rx_data_req() needs to calculate the paging group
at two positions, this commit adds a functions for that to avoid
code duplication

Change-Id: Iee8926d5bc017d912912916e4898e968bf4dd29b
---
M src/libbsc/pcu_sock.c
1 file changed, 21 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/04/6204/2

diff --git a/src/libbsc/pcu_sock.c b/src/libbsc/pcu_sock.c
index 64422c7..f5a82cc 100644
--- a/src/libbsc/pcu_sock.c
+++ b/src/libbsc/pcu_sock.c
@@ -354,11 +354,30 @@
 	return rc;
 }
 
+/* Helper function for pcu_rx_data_req() to extract paging group info */
+static uint8_t extract_paging_group(struct gsm_bts *bts, uint8_t *data)
+{
+	char imsi_digit_buf[4];
+	uint8_t pag_grp;
+
+	/* the first three bytes are the last three digits of
+	 * the IMSI, which we need to compute the paging group */
+	imsi_digit_buf[0] = data[0];
+	imsi_digit_buf[1] = data[1];
+	imsi_digit_buf[2] = data[2];
+	imsi_digit_buf[3] = '\0';
+
+	pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
+					    str_to_imsi(imsi_digit_buf));
+
+	return pag_grp;
+}
+
+
 static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
 	struct gsm_pcu_if_data *data_req)
 {
 	struct msgb *msg;
-	char imsi_digit_buf[4];
 	uint32_t tlli = -1;
 	uint8_t pag_grp;
 	int rc = 0;
@@ -370,15 +389,7 @@
 
 	switch (data_req->sapi) {
 	case PCU_IF_SAPI_PCH:
-		/* the first three bytes are the last three digits of
-		 * the IMSI, which we need to compute the paging group */
-		imsi_digit_buf[0] = data_req->data[0];
-		imsi_digit_buf[1] = data_req->data[1];
-		imsi_digit_buf[2] = data_req->data[2];
-		imsi_digit_buf[3] = '\0';
-		LOGP(DPCU, LOGL_DEBUG, "SAPI PCH imsi %s\n", imsi_digit_buf);
-		pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
-						str_to_imsi(imsi_digit_buf));
+		pag_grp = extract_paging_group(bts,data_req->data);
 		pcu_rx_rr_paging(bts, pag_grp, data_req->data+3);
 		break;
 	case PCU_IF_SAPI_AGCH:

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iee8926d5bc017d912912916e4898e968bf4dd29b
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>



More information about the gerrit-log mailing list