Change in osmo-bts[master]: l1sap: process_l1sap_meas_data() accepts pointer to lchan

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

fixeria gerrit-no-reply at lists.osmocom.org
Wed Oct 27 15:12:24 UTC 2021


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/25989 )


Change subject: l1sap: process_l1sap_meas_data() accepts pointer to lchan
......................................................................

l1sap: process_l1sap_meas_data() accepts pointer to lchan

In 2/3 cases when calling process_l1sap_meas_data() we already have
a pointer to the logical channel, so let's pass it as the first
argument instead of a pointer to the transceiver.  This way we
avoid calling get_active_lchan_by_chan_nr() two times.

In l1sap_ph_data_ind(), call process_l1sap_meas_data() below the
conditional branch handling PDCH, so it won't be called for
GSM_LCHAN_PDTCH anymore.  GPRS specific measurements are handled
by the PCU and not of interest for the BSC.

Change-Id: I9de67a0b2d2b18923f2c2003b400387a0f1af411
---
M src/common/l1sap.c
1 file changed, 21 insertions(+), 27 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/89/25989/1

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index d02676b..47ba663 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -694,16 +694,14 @@
 }
 
 /* measurement information received from bts model */
-static void process_l1sap_meas_data(struct gsm_bts_trx *trx,
+static void process_l1sap_meas_data(struct gsm_lchan *lchan,
 				    struct osmo_phsap_prim *l1sap,
 				    enum osmo_ph_prim ind_type)
 {
 	struct bts_ul_meas ulm;
-	struct gsm_lchan *lchan;
 	struct info_meas_ind_param *info_meas_ind;
 	struct ph_data_param *ph_data_ind;
 	struct ph_tch_param *ph_tch_ind;
-	uint8_t chan_nr;
 	uint32_t fn;
 	const char *ind_name;
 
@@ -711,7 +709,6 @@
 	case PRIM_MPH_INFO:
 		/* (legacy way, see also OS#2977) */
 	        info_meas_ind = &l1sap->u.info.u.meas_ind;
-		chan_nr = info_meas_ind->chan_nr;
 		fn = info_meas_ind->fn;
 		ind_name = "MPH INFO";
 		ulm = (struct bts_ul_meas) {
@@ -726,7 +723,6 @@
 		ph_tch_ind = &l1sap->u.tch;
 		if (ph_tch_ind->rssi == 0)
 			return;
-		chan_nr = ph_tch_ind->chan_nr;
 		fn = ph_tch_ind->fn;
 		ind_name = "TCH";
 		ulm = (struct bts_ul_meas) {
@@ -741,7 +737,6 @@
 		ph_data_ind = &l1sap->u.data;
 		if (ph_data_ind->rssi == 0)
 			return;
-		chan_nr = ph_data_ind->chan_nr;
 		fn = ph_data_ind->fn;
 		ind_name = "DATA";
 		ulm = (struct bts_ul_meas) {
@@ -756,24 +751,11 @@
 		OSMO_ASSERT(false);
 	}
 
-	lchan = get_active_lchan_by_chan_nr(trx, chan_nr);
-	if (!lchan) {
-		LOGPFN(DL1P, LOGL_ERROR, fn,
-		       "No lchan for %s MEAS IND (chan_nr=%s)\n",
-		       ind_name, rsl_chan_nr_str(chan_nr));
-		return;
-	}
-
 	DEBUGPFN(DL1P, fn,
 		 "%s %s meas ind, ta_offs_256bits=%d, ber10k=%d, inv_rssi=%u, C/I=%d cB\n",
 		 gsm_lchan_name(lchan), ind_name, ulm.ta_offs_256bits,
 		 ulm.ber10k, ulm.inv_rssi, ulm.c_i);
 
-	/* in the GPRS case we are not interested in measurement
-	 * processing.  The PCU will take care of it */
-	if (lchan->type == GSM_LCHAN_PDTCH)
-		return;
-
 	/* we assume that symbol period is 1 bit: */
 	set_ms_to_data(lchan, ulm.ta_offs_256bits / 256, true);
 
@@ -786,6 +768,8 @@
 static int l1sap_mph_info_ind(struct gsm_bts_trx *trx,
 	 struct osmo_phsap_prim *l1sap, struct mph_info_param *info)
 {
+	const struct info_meas_ind_param *meas_ind;
+	struct gsm_lchan *lchan;
 	int rc = 0;
 
 	switch (info->type) {
@@ -805,7 +789,17 @@
 		if (bts_internal_flag_get(trx->bts, BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB))
 			OSMO_ASSERT(false);
 
-		process_l1sap_meas_data(trx, l1sap, PRIM_MPH_INFO);
+		meas_ind = &l1sap->u.info.u.meas_ind;
+
+		lchan = get_active_lchan_by_chan_nr(trx, meas_ind->chan_nr);
+		if (!lchan) {
+			LOGPFN(DL1P, LOGL_ERROR, meas_ind->fn,
+			       "No lchan for chan_nr=%s\n",
+			       rsl_chan_nr_str(meas_ind->chan_nr));
+			return 0;
+		}
+
+		process_l1sap_meas_data(lchan, l1sap, PRIM_MPH_INFO);
 		break;
 	default:
 		LOGP(DL1P, LOGL_NOTICE, "unknown MPH_INFO ind type %d\n",
@@ -1488,12 +1482,6 @@
 	DEBUGPGT(DL1P, &g_time, "Rx PH-DATA.ind chan_nr=%s link_id=0x%02x len=%d\n",
 		 rsl_chan_nr_str(chan_nr), link_id, len);
 
-	/* The ph_data_param contained in the l1sap primitive may contain
-	 * measurement data. If this data is present, forward it for
-	 * processing */
-	if (bts_internal_flag_get(trx->bts, BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB))
-		process_l1sap_meas_data(trx, l1sap, PRIM_PH_DATA);
-
 	if (ts_is_pdch(&trx->ts[tn])) {
 		lchan = get_lchan_by_chan_nr(trx, chan_nr);
 		if (!lchan)
@@ -1535,6 +1523,12 @@
 		return 0;
 	}
 
+	/* The ph_data_param contained in the l1sap primitive may contain
+	 * measurement data. If this data is present, forward it for
+	 * processing */
+	if (bts_internal_flag_get(trx->bts, BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB))
+		process_l1sap_meas_data(lchan, l1sap, PRIM_PH_DATA);
+
 	if (L1SAP_IS_LINK_SACCH(link_id))
 		repeated_ul_sacch_active_decision(lchan, data_ind->ber10k);
 
@@ -1618,7 +1612,7 @@
 	 * measurement data. If this data is present, forward it for
 	 * processing */
 	if (bts_internal_flag_get(trx->bts, BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB))
-		process_l1sap_meas_data(trx, l1sap, PRIM_TCH);
+		process_l1sap_meas_data(lchan, l1sap, PRIM_TCH);
 
 	msgb_pull_to_l2(msg);
 

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I9de67a0b2d2b18923f2c2003b400387a0f1af411
Gerrit-Change-Number: 25989
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211027/f7eddf1a/attachment.htm>


More information about the gerrit-log mailing list