Change in osmo-bts[master]: osmo-bts-trx: report PDCH interference levels to the PCU

laforge gerrit-no-reply at lists.osmocom.org
Mon Jun 21 16:24:25 UTC 2021


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

Change subject: osmo-bts-trx: report PDCH interference levels to the PCU
......................................................................

osmo-bts-trx: report PDCH interference levels to the PCU

The PDCH multiframe contains 48 data slots, 2 PTCCH slots, and
2 IDLE slots.  The later two can be used for the interference
measurements, since the UEs shall not transmit on them.

bts_report_interf_meas() is called every 104 TDMA frames, what
corresponds to 2 PDCH multiframe periods.  Report interference
levels on PDCH timeslots from this function.

Change-Id: I56f83db5264c246ec1b4b8a973105a4fc09931fb
Related: SYS#5313, OS#1569
---
M include/osmo-bts/pcu_if.h
M include/osmo-bts/pcuif_proto.h
M src/common/pcu_sock.c
M src/osmo-bts-trx/scheduler_trx.c
4 files changed, 65 insertions(+), 7 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve



diff --git a/include/osmo-bts/pcu_if.h b/include/osmo-bts/pcu_if.h
index add37f8..6ef8dc5 100644
--- a/include/osmo-bts/pcu_if.h
+++ b/include/osmo-bts/pcu_if.h
@@ -15,6 +15,8 @@
 		    int16_t qta, uint16_t ra, uint32_t fn, uint8_t is_11bit,
 		    enum ph_burst_type burst_type, uint8_t sapi);
 int pcu_tx_time_ind(uint32_t fn);
+int pcu_tx_interf_ind(uint8_t bts_nr, uint8_t trx_nr, uint32_t fn,
+		      const uint8_t *pdch_interf);
 int pcu_tx_pag_req(const uint8_t *identity_lv, uint8_t chan_needed);
 int pcu_tx_pch_data_cnf(uint32_t fn, uint8_t *data, uint8_t len);
 int pcu_tx_susp_req(struct gsm_lchan *lchan, uint32_t tlli, const uint8_t *ra_id, uint8_t cause);
diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h
index 8f72602..38ca4b6 100644
--- a/include/osmo-bts/pcuif_proto.h
+++ b/include/osmo-bts/pcuif_proto.h
@@ -21,6 +21,7 @@
 #define PCU_IF_MSG_INFO_IND	0x32	/* retrieve BTS info */
 #define PCU_IF_MSG_ACT_REQ	0x40	/* activate/deactivate PDCH */
 #define PCU_IF_MSG_TIME_IND	0x52	/* GSM time indication */
+#define PCU_IF_MSG_INTERF_IND	0x53	/* interference report */
 #define PCU_IF_MSG_PAG_REQ	0x60	/* paging request */
 #define PCU_IF_MSG_TXT_IND	0x70	/* Text indication for BTS */
 
@@ -208,6 +209,14 @@
 	uint8_t		cause;
 } __attribute__ ((packed));
 
+/* Interference measurements on PDCH timeslots */
+struct gsm_pcu_if_interf_ind {
+	uint8_t		trx_nr;
+	uint8_t		spare[3];
+	uint32_t	fn;
+	uint8_t		interf[8];
+} __attribute__ ((packed));
+
 struct gsm_pcu_if {
 	/* context based information */
 	uint8_t		msg_type;	/* message type */
@@ -228,6 +237,7 @@
 		struct gsm_pcu_if_time_ind	time_ind;
 		struct gsm_pcu_if_pag_req	pag_req;
 		struct gsm_pcu_if_app_info_req	app_info_req;
+		struct gsm_pcu_if_interf_ind	interf_ind;
 	} u;
 } __attribute__ ((packed));
 
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 3a73570..5a04bf0 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -560,6 +560,27 @@
 	return pcu_sock_send(&bts_gsmnet, msg);
 }
 
+int pcu_tx_interf_ind(uint8_t bts_nr, uint8_t trx_nr, uint32_t fn,
+		      const uint8_t *pdch_interf)
+{
+	struct gsm_pcu_if_interf_ind *interf_ind;
+	struct gsm_pcu_if *pcu_prim;
+	struct msgb *msg;
+
+	msg = pcu_msgb_alloc(PCU_IF_MSG_INTERF_IND, bts_nr);
+	if (!msg)
+		return -ENOMEM;
+	pcu_prim = (struct gsm_pcu_if *) msg->data;
+	interf_ind = &pcu_prim->u.interf_ind;
+
+	interf_ind->trx_nr = trx_nr;
+	interf_ind->fn = fn;
+	memcpy(&interf_ind->interf[0], &pdch_interf[0],
+	       sizeof(interf_ind->interf));
+
+	return pcu_sock_send(&bts_gsmnet, msg);
+}
+
 int pcu_tx_pag_req(const uint8_t *identity_lv, uint8_t chan_needed)
 {
 	struct pcu_sock_state *state = bts_gsmnet.pcu_state;
@@ -914,7 +935,8 @@
 	struct gsm_pcu_if *pcu_prim = (struct gsm_pcu_if *) msg->data;
 
 	if (!state) {
-		if (pcu_prim->msg_type != PCU_IF_MSG_TIME_IND)
+		if (pcu_prim->msg_type != PCU_IF_MSG_TIME_IND &&
+		    pcu_prim->msg_type != PCU_IF_MSG_INTERF_IND)
 			LOGP(DPCU, LOGL_INFO, "PCU socket not created, "
 				"dropping message\n");
 		msgb_free(msg);
@@ -922,7 +944,8 @@
 	}
 	conn_bfd = &state->conn_bfd;
 	if (conn_bfd->fd <= 0) {
-		if (pcu_prim->msg_type != PCU_IF_MSG_TIME_IND)
+		if (pcu_prim->msg_type != PCU_IF_MSG_TIME_IND &&
+		    pcu_prim->msg_type != PCU_IF_MSG_INTERF_IND)
 			LOGP(DPCU, LOGL_NOTICE, "PCU socket not connected, "
 				"dropping message\n");
 		msgb_free(msg);
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 97c5ff3..ef50e8d 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -45,6 +45,7 @@
 #include <osmo-bts/l1sap.h>
 #include <osmo-bts/scheduler.h>
 #include <osmo-bts/scheduler_backend.h>
+#include <osmo-bts/pcu_if.h>
 
 #include "l1_if.h"
 #include "trx_if.h"
@@ -101,14 +102,36 @@
 	}
 }
 
-static void bts_report_interf_meas(const struct gsm_bts *bts)
+static void bts_report_interf_meas(const struct gsm_bts *bts,
+				   const uint32_t fn)
 {
 	const struct gsm_bts_trx *trx;
-	unsigned int tn;
 
 	llist_for_each_entry(trx, &bts->trx_list, list) {
-		for (tn = 0; tn < ARRAY_SIZE(trx->ts); tn++)
-			ts_report_interf_meas(&trx->ts[tn]);
+		uint8_t pdch_interf[8] = { 0 };
+		unsigned int tn, pdch_num = 0;
+
+		for (tn = 0; tn < ARRAY_SIZE(trx->ts); tn++) {
+			const struct gsm_bts_trx_ts *ts = &trx->ts[tn];
+			const struct l1sched_ts *l1ts = ts->priv;
+			const struct l1sched_chan_state *l1cs;
+
+			/* PS interference reports for the PCU */
+			if (ts_pchan(ts) == GSM_PCHAN_PDCH) {
+				l1cs = &l1ts->chan_state[TRXC_IDLE];
+				/* Interference value is encoded as -x dBm */
+				pdch_interf[tn] = -1 * l1cs->meas.interf_avg;
+				pdch_num++;
+				continue;
+			}
+
+			/* CS interference reports for the BSC */
+			ts_report_interf_meas(ts);
+		}
+
+		/* Report interference levels on PDCH to the PCU */
+		if (pdch_num > 0)
+			pcu_tx_interf_ind(bts->nr, trx->nr, fn, pdch_interf);
 	}
 }
 
@@ -243,7 +266,7 @@
 
 	/* Report interference measurements */
 	if (fn % 104 == 0) /* SACCH period */
-		bts_report_interf_meas(bts);
+		bts_report_interf_meas(bts, fn);
 
 	/* send time indication */
 	l1if_mph_time_ind(bts, fn);

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I56f83db5264c246ec1b4b8a973105a4fc09931fb
Gerrit-Change-Number: 24718
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210621/e80fff3c/attachment.htm>


More information about the gerrit-log mailing list