[MERGED] osmo-bts[master]: Support sending SI13 to PCU

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

Max gerrit-no-reply at lists.osmocom.org
Fri Sep 1 08:08:32 UTC 2017


Max has submitted this change and it was merged.

Change subject: Support sending SI13 to PCU
......................................................................


Support sending SI13 to PCU

* explicitly set SAPI when sending data_ind to PCU
* drop unused receiving code for BCCH SAPI
* send SI13 when PCU is connected
* send SI13 when new SI is received

Change-Id: I9e83ef792585aa962f99897d9973cef12f186bcf
Related: OS#2400
---
M include/osmo-bts/pcu_if.h
M src/common/l1sap.c
M src/common/pcu_sock.c
M src/common/rsl.c
4 files changed, 32 insertions(+), 17 deletions(-)

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



diff --git a/include/osmo-bts/pcu_if.h b/include/osmo-bts/pcu_if.h
index a020c05..ba3873e 100644
--- a/include/osmo-bts/pcu_if.h
+++ b/include/osmo-bts/pcu_if.h
@@ -6,6 +6,7 @@
 extern int pcu_direct;
 
 int pcu_tx_info_ind(void);
+int pcu_tx_si13(const struct gsm_bts *bts);
 int pcu_tx_rts_req(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn,
 	uint16_t arfcn, uint8_t block_nr);
 int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn,
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 21d9dc6..1b3a3ad 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -52,6 +52,7 @@
 #include <osmo-bts/handover.h>
 #include <osmo-bts/power_control.h>
 #include <osmo-bts/msg_utils.h>
+#include <osmo-bts/pcuif_proto.h>
 
 struct gsm_lchan *get_lchan_by_chan_nr(struct gsm_bts_trx *trx,
 				       unsigned int chan_nr)
@@ -1013,7 +1014,7 @@
 		if (len == 0)
 			return -EINVAL;
 		if (L1SAP_IS_PTCCH(fn)) {
-			pcu_tx_data_ind(&trx->ts[tn], 1, fn,
+			pcu_tx_data_ind(&trx->ts[tn], PCU_IF_SAPI_PTCCH, fn,
 					0 /* ARFCN */, L1SAP_FN2PTCCHBLOCK(fn),
 					data, len, rssi, data_ind->ber10k,
 					data_ind->ta_offs_qbits,
@@ -1023,7 +1024,7 @@
 			if (pr_info != PRES_INFO_BOTH)
 				return 0;
 			/* PDTCH / PACCH frame handling */
-			pcu_tx_data_ind(&trx->ts[tn], 0, fn, 0 /* ARFCN */,
+			pcu_tx_data_ind(&trx->ts[tn], PCU_IF_SAPI_PDTCH, fn, 0 /* ARFCN */,
 					L1SAP_FN2MACBLOCK(fn), data, len, rssi, data_ind->ber10k,
 					data_ind->ta_offs_qbits, data_ind->lqual_cb);
 		}
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index a4ddc05..0a9ba2d 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -322,7 +322,7 @@
 	return pcu_sock_send(&bts_gsmnet, msg);
 }
 
-int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn,
+int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t sapi, uint32_t fn,
 	uint16_t arfcn, uint8_t block_nr, uint8_t *data, uint8_t len,
 	int8_t rssi, uint16_t ber10k, int16_t bto, int16_t lqual)
 {
@@ -332,9 +332,8 @@
 	struct gsm_bts *bts = ts->trx->bts;
 	struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
 
-	LOGP(DPCU, LOGL_DEBUG, "Sending data indication: is_ptcch=%d arfcn=%d "
-		"block=%d data=%s\n", is_ptcch, arfcn, block_nr,
-		osmo_hexdump(data, len));
+	LOGP(DPCU, LOGL_DEBUG, "Sending data indication: sapi=%s arfcn=%d block=%d data=%s\n",
+	     sapi_string[sapi], arfcn, block_nr, osmo_hexdump(data, len));
 
 	if (lqual / 10 < btsb->min_qual_norm) {
 		LOGP(DPCU, LOGL_DEBUG, "Link quality %"PRId16" is below threshold %f, dropping packet\n",
@@ -348,7 +347,7 @@
 	pcu_prim = (struct gsm_pcu_if *) msg->data;
 	data_ind = &pcu_prim->u.data_ind;
 
-	data_ind->sapi = (is_ptcch) ? PCU_IF_SAPI_PTCCH : PCU_IF_SAPI_PDTCH;
+	data_ind->sapi = sapi;
 	data_ind->rssi = rssi;
 	data_ind->fn = fn;
 	data_ind->arfcn = arfcn;
@@ -488,16 +487,6 @@
 		osmo_hexdump(data_req->data, data_req->len));
 
 	switch (data_req->sapi) {
-	case PCU_IF_SAPI_BCCH:
-		if (data_req->len == 23) {
-			bts->si_valid |= (1 << SYSINFO_TYPE_13);
-			memcpy(bts->si_buf[SYSINFO_TYPE_13], data_req->data,
-				data_req->len);
-		} else {
-			bts->si_valid &= ~(1 << SYSINFO_TYPE_13);
-		}
-		osmo_signal_dispatch(SS_GLOBAL, S_NEW_SYSINFO, bts);
-		break;
 	case PCU_IF_SAPI_PCH:
 		if (msg_type == PCU_IF_MSG_PAG_REQ) {
 			/* FIXME: Add function to schedule paging request.
@@ -546,6 +535,21 @@
 	return rc;
 }
 
+int pcu_tx_si13(const struct gsm_bts *bts)
+{
+	/* the SI is per-BTS so it doesn't matter which TRX we use */
+	struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, 0);
+
+	/* The low-level data like FN, ARFCN etc will be ignored but we have to set lqual high enough to bypass
+	   the check at lower levels */
+	int rc = pcu_tx_data_ind(&trx->ts[0], PCU_IF_SAPI_BCCH, 0, 0, 0, GSM_BTS_SI(bts, SYSINFO_TYPE_13),
+				 GSM_MACBLOCK_LEN, 0, 0, 0, INT16_MAX);
+	if (rc < 0)
+		LOGP(DPCU, LOGL_NOTICE, "Failed to send SI13 to PCU: %d\n", rc);
+
+	return rc;
+}
+
 static int pcu_rx_txt_ind(struct gsm_bts *bts,
 			  struct gsm_pcu_if_txt_ind *txt)
 {
@@ -555,6 +559,11 @@
 		     txt->text);
 		osmo_signal_dispatch(SS_FAIL, OSMO_EVT_PCU_VERS, txt->text);
 		osmo_strlcpy(bts->pcu_version, txt->text, MAX_VERSION_LENGTH);
+
+		if (GSM_BTS_HAS_SI(bts, SYSINFO_TYPE_13))
+			return pcu_tx_si13(bts);
+		else
+			LOGP(DPCU, LOGL_INFO, "SI13 is not available on PCU connection\n");
 		break;
 	case PCU_OML_ALERT:
 		osmo_signal_dispatch(SS_FAIL, OSMO_EVT_EXT_ALARM, txt->text);
diff --git a/src/common/rsl.c b/src/common/rsl.c
index dc176ea..69ecf2e 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -50,6 +50,7 @@
 #include <osmo-bts/cbch.h>
 #include <osmo-bts/l1sap.h>
 #include <osmo-bts/bts_model.h>
+#include <osmo-bts/pcuif_proto.h>
 
 //#define FAKE_CIPH_MODE_COMPL
 
@@ -306,6 +307,9 @@
 				LCHAN_REL_ACT_REACT;
 		}
 
+		if (SYSINFO_TYPE_13 == osmo_si)
+			pcu_tx_si13(trx->bts);
+
 		if (SYSINFO_TYPE_2quater == osmo_si) {
 			si2q = (struct gsm48_system_information_type_2quater *) TLVP_VAL(&tp, RSL_IE_FULL_BCCH_INFO);
 			bv.data = si2q->rest_octets;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9e83ef792585aa962f99897d9973cef12f186bcf
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list