[PATCH] osmo-bts[master]: Add MS TO to RSL measurements

Max gerrit-no-reply at lists.osmocom.org
Fri Jan 27 18:45:58 UTC 2017


Review at  https://gerrit.osmocom.org/1700

Add MS TO to RSL measurements

Add optional MS timing offset (3GPP TS 45.010 § 1.2) to RSL MEASUREMENT
RESULT (3GPP TS 48.058 § 8.4.8). The value is calculated either directly
from corresponding BTS measurement or from 3GPP TS 48.058 § 9.3.17
Access Delay (for known TA) and invalidated after RSL report is sent
until new measurement indication or RACH is received.

Change-Id: I4dfe5c48834a083e757d5de3236a02e15a238b28
Related: OS#1574
---
M src/common/l1sap.c
M src/common/rsl.c
2 files changed, 35 insertions(+), 5 deletions(-)


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

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 9116e23..e1bb264 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -431,6 +431,22 @@
 
 	return 0;
 }
+
+static void set_ms_to_data(struct gsm_lchan *lchan, uint8_t data, bool set_ms_to)
+{
+	if (!lchan)
+		return;
+	if (set_ms_to) {
+		lchan->ms_t_offs = data;
+		lchan->ms_t_offs_valid = true;
+		lchan->p_offs_valid = false;
+	} else {
+		lchan->p_offs = data;
+		lchan->p_offs_valid = true;
+		lchan->ms_t_offs_valid = false;
+	}
+}
+
 /* measurement information received from bts model */
 static int l1sap_info_meas_ind(struct gsm_bts_trx *trx,
 	struct osmo_phsap_prim *l1sap,
@@ -455,6 +471,8 @@
 	ulm.ta_offs_qbits = info_meas_ind->ta_offs_qbits;
 	ulm.ber10k = info_meas_ind->ber10k;
 	ulm.inv_rssi = info_meas_ind->inv_rssi;
+	/* we assume that symbol period is 1 bit: */
+	set_ms_to_data(lchan, info_meas_ind->ta_offs_qbits / 4, true);
 
 	lchan_new_ul_meas(lchan, &ulm);
 
@@ -997,6 +1015,7 @@
 	struct gsm_bts *bts = trx->bts;
 	struct gsm_bts_role_bts *btsb = bts->role;
 	struct lapdm_channel *lc;
+	struct gsm_lchan *lchan = get_lchan_by_chan_nr(trx, rach_ind->chan_nr);
 	uint8_t acc_delay;
 
 	DEBUGP(DL1P, "Rx PH-RA.ind");
@@ -1010,6 +1029,10 @@
 		return 0;
 	}
 
+	/* According to 3GPP TS 48.058 § 9.3.17 Access Delay is expressed same
+	   way as TA (number of symbols) */
+	set_ms_to_data(lchan, acc_delay, false);
+
 	/* check for handover rach */
 	if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr))
 		return l1sap_handover_rach(trx, l1sap, rach_ind);
diff --git a/src/common/rsl.c b/src/common/rsl.c
index a34c455..1c8966d 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -2219,7 +2219,8 @@
 }
 
 /* 8.4.8 MEASUREMENT RESult */
-static int rsl_tx_meas_res(struct gsm_lchan *lchan, uint8_t *l3, int l3_len)
+static int rsl_tx_meas_res(struct gsm_lchan *lchan, uint8_t *l3, int l3_len,
+			   uint8_t ms_to, bool use_ms_to)
 {
 	struct msgb *msg;
 	uint8_t meas_res[16];
@@ -2251,7 +2252,11 @@
 		lchan->meas.flags &= ~LC_UL_M_F_L1_VALID;
 	}
 	msgb_tl16v_put(msg, RSL_IE_L3_INFO, l3_len, l3);
-		//msgb_tv_put(msg, RSL_IE_MS_TIMING_OFFSET, FIXME);
+	if (use_ms_to) {
+		msgb_tv_put(msg, RSL_IE_MS_TIMING_OFFSET, ms_to);
+		lchan->ms_t_offs_valid = false;
+		lchan->p_offs_valid = false;
+	}
 
 	rsl_dch_push_hdr(msg, RSL_MT_MEAS_RES, chan_nr);
 	msg->trx = lchan->ts->trx;
@@ -2264,8 +2269,6 @@
 {
 	struct gsm_lchan *lchan = ctx;
 	struct abis_rsl_common_hdr *rh;
-
-	/* NOTE: Parameter lapdm_entity *le is ignored */
 
 	OSMO_ASSERT(msg);
 	rh = msgb_l2(msg);
@@ -2286,7 +2289,11 @@
 
 		LOGP(DRSL, LOGL_INFO, "%s Handing RLL msg %s from LAPDm to MEAS REP\n",
 			gsm_lchan_name(lchan), rsl_msg_name(rh->msg_type));
-		rc = rsl_tx_meas_res(lchan, msgb_l3(msg), msgb_l3len(msg));
+		rc = rsl_tx_meas_res(lchan, msgb_l3(msg), msgb_l3len(msg),
+				     lchan->ms_t_offs_valid ? lchan->ms_t_offs :
+				     (lchan->p_offs - le->ta),
+				     lchan->ms_t_offs_valid ||
+				     lchan->p_offs_valid);
 		msgb_free(msg);
 		return rc;
 	} else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4dfe5c48834a083e757d5de3236a02e15a238b28
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>


More information about the gerrit-log mailing list