Change in osmo-pcu[master]: PTCCH: properly handle RACH.ind for PCU_IF_SAPI_PTCCH

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
Sat Nov 16 19:37:07 UTC 2019


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


Change subject: PTCCH: properly handle RACH.ind for PCU_IF_SAPI_PTCCH
......................................................................

PTCCH: properly handle RACH.ind for PCU_IF_SAPI_PTCCH

Change-Id: I482d60a46b9d253dfe0b16140eac9fea6420b30c
Related: OS#1545
---
M src/bts.cpp
M src/bts.h
M src/osmo-bts-litecell15/lc15_l1_if.c
M src/osmo-bts-oc2g/oc2g_l1_if.c
M src/osmo-bts-sysmo/sysmo_l1_if.c
M src/pcu_l1_if.cpp
6 files changed, 113 insertions(+), 18 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/85/16085/1

diff --git a/src/bts.cpp b/src/bts.cpp
index 24666af..cf26e77 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -842,6 +842,53 @@
 	return rc;
 }
 
+/* PTCCH/U sub-slot / frame-number mapping (see 3GPP TS 45.002, table 6) */
+static uint32_t ptcch_slot_map[PTCCH_TAI_NUM] = {
+	 12,  38,  64,  90,
+	116, 142, 168, 194,
+	220, 246, 272, 298,
+	324, 350, 376, 402,
+};
+
+int BTS::rcv_ptcch_rach(uint8_t trx_nr, uint8_t ts_nr, uint32_t fn, int16_t qta)
+{
+	struct gprs_rlcmac_bts *bts = bts_data();
+	struct gprs_rlcmac_pdch *pdch;
+	uint32_t fn416 = fn % 416;
+	uint8_t ss;
+
+	/* Prevent buffer overflow */
+	if (trx_nr >= ARRAY_SIZE(bts->trx) || ts_nr >= 8) {
+		LOGP(DRLCMAC, LOGL_ERROR, "Malformed RACH.ind message "
+		     "(TRX=%u TS=%u FN=%u)\n", trx_nr, ts_nr, fn);
+		return -EINVAL;
+	}
+
+	/* Make sure PDCH time-slot is enabled */
+	pdch = &bts->trx[trx_nr].pdch[ts_nr];
+	if (!pdch->m_is_enabled) {
+		LOGP(DRLCMAC, LOGL_NOTICE, "Rx PTCCH RACH.ind for inactive PDCH "
+		     "(TRX=%u TS=%u FN=%u)\n", trx_nr, ts_nr, fn);
+		return -EAGAIN;
+	}
+
+	/* Convert TDMA frame-number to PTCCH/U sub-slot number */
+	for (ss = 0; ss < PTCCH_TAI_NUM; ss++)
+		if (ptcch_slot_map[ss] == fn416)
+			break;
+	if (ss == PTCCH_TAI_NUM) {
+		LOGP(DRLCMAC, LOGL_ERROR, "Failed to map PTCCH/U sub-slot for fn=%u\n", fn);
+		return -ENODEV;
+	}
+
+	/* Apply a new Timing Advance value */
+	LOGP(DRLCMAC, LOGL_INFO, "Continuous Timing Advance update "
+	     "for TAI %u, new TA is %u\n", ss, qta2ta(qta));
+	pdch->update_ta(ss, qta2ta(qta));
+
+	return 0;
+}
+
 void BTS::snd_dl_ass(gprs_rlcmac_tbf *tbf, bool poll, const char *imsi)
 {
 	int plen;
diff --git a/src/bts.h b/src/bts.h
index c2cc316..54a29cb 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -301,6 +301,7 @@
 	uint32_t rfn_to_fn(int32_t rfn);
 	int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, bool is_11bit,
 		enum ph_burst_type burst_type);
+	int rcv_ptcch_rach(uint8_t trx_nr, uint8_t ts_nr, uint32_t fn, int16_t qta);
 
 	void snd_dl_ass(gprs_rlcmac_tbf *tbf, bool poll, const char *imsi);
 
diff --git a/src/osmo-bts-litecell15/lc15_l1_if.c b/src/osmo-bts-litecell15/lc15_l1_if.c
index 670263f..307bc7b 100644
--- a/src/osmo-bts-litecell15/lc15_l1_if.c
+++ b/src/osmo-bts-litecell15/lc15_l1_if.c
@@ -223,10 +223,6 @@
 			data_ind->u32Fn,
 			&meas);
 		break;
-	case GsmL1_Sapi_Ptcch:
-		// FIXME
-		rc = -1;
-		break;
 	default:
 		LOGP(DL1IF, LOGL_NOTICE, "Rx PH-DATA.ind for unknown L1 SAPI %s\n",
 			get_value_string(lc15bts_l1sapi_names, data_ind->sapi));
@@ -251,8 +247,26 @@
 		return 0;
 
 	DEBUGP(DL1IF, "Rx PH-RA.ind");
-	bts_update_tbf_ta("PH-RA", ra_ind->u32Fn, fl1h->trx_no, ra_ind->u8Tn,
-			qta2ta(ra_ind->measParam.i16BurstTiming), true);
+
+	switch (ra_ind->sapi) {
+#if 0
+	case GsmL1_Sapi_Ptcch:
+		/* FIXME: we need a pure C function for that */
+		BTS::main_bts()->rcv_ptcch_rach(
+			fl1h->trx_no, ra_ind->u8Tn, ra_ind->u32Fn,
+			ra_ind->measParam.i16BurstTiming);
+		break;
+#endif
+	case GsmL1_Sapi_Pdtch:
+		bts_update_tbf_ta("PH-RA", ra_ind->u32Fn, fl1h->trx_no, ra_ind->u8Tn,
+				  qta2ta(ra_ind->measParam.i16BurstTiming), true);
+		break;
+
+	default:
+		LOGP(DL1IF, LOGL_NOTICE, "Rx PH-RA.ind for unknown L1 SAPI %s\n",
+		     get_value_string(femtobts_l1sapi_names, ra_ind->sapi));
+		return -ENOTSUP;
+	}
 
 	return 0;
 }
diff --git a/src/osmo-bts-oc2g/oc2g_l1_if.c b/src/osmo-bts-oc2g/oc2g_l1_if.c
index a02e962..90c1ec4 100644
--- a/src/osmo-bts-oc2g/oc2g_l1_if.c
+++ b/src/osmo-bts-oc2g/oc2g_l1_if.c
@@ -229,9 +229,6 @@
 			data_ind->u32Fn,
 			&meas);
 		break;
-	case GsmL1_Sapi_Ptcch:
-		// FIXME
-		break;
 	default:
 		LOGP(DL1IF, LOGL_NOTICE, "Rx PH-DATA.ind for unknown L1 SAPI %s\n",
 			get_value_string(oc2gbts_l1sapi_names, data_ind->sapi));
@@ -243,15 +240,32 @@
 
 #define MIN_QUAL_RACH	5.0f
 
-static int handle_ph_ra_ind(struct oc2gl1_hdl *fl1h, GsmL1_PhRaInd_t *ra_ind)
+static int handle_ph_ra_ind(struct oc3gl1_hdl *fl1h, GsmL1_PhRaInd_t *ra_ind)
 {
 	if (ra_ind->measParam.fLinkQuality < MIN_QUAL_RACH)
 		return 0;
 
 	LOGP(DL1IF, LOGL_DEBUG, "PH-RA-IND L1 qta=%d\n", ra_ind->measParam.i16BurstTiming);
 
-	bts_update_tbf_ta("PH-RA", ra_ind->u32Fn, fl1h->trx_no, ra_ind->u8Tn,
-			qta2ta(ra_ind->measParam.i16BurstTiming), true);
+	switch (ra_ind->sapi) {
+#if 0
+	case GsmL1_Sapi_Ptcch:
+		/* FIXME: we need a pure C function for that */
+		BTS::main_bts()->rcv_ptcch_rach(
+			fl1h->trx_no, ra_ind->u8Tn, ra_ind->u32Fn,
+			ra_ind->measParam.i16BurstTiming);
+		break;
+#endif
+	case GsmL1_Sapi_Pdtch:
+		bts_update_tbf_ta("PH-RA", ra_ind->u32Fn, fl1h->trx_no, ra_ind->u8Tn,
+				  qta2ta(ra_ind->measParam.i16BurstTiming), true);
+		break;
+
+	default:
+		LOGP(DL1IF, LOGL_NOTICE, "Rx PH-RA.ind for unknown L1 SAPI %s\n",
+		     get_value_string(femtobts_l1sapi_names, ra_ind->sapi));
+		return -ENOTSUP;
+	}
 
 	return 0;
 }
diff --git a/src/osmo-bts-sysmo/sysmo_l1_if.c b/src/osmo-bts-sysmo/sysmo_l1_if.c
index 9b310cc..3ac5f69 100644
--- a/src/osmo-bts-sysmo/sysmo_l1_if.c
+++ b/src/osmo-bts-sysmo/sysmo_l1_if.c
@@ -208,10 +208,6 @@
 			data_ind->u32Fn,
 			&meas);
 		break;
-	case GsmL1_Sapi_Ptcch:
-		// FIXME
-		rc = -1;
-		break;
 	default:
 		LOGP(DL1IF, LOGL_NOTICE, "Rx PH-DATA.ind for unknown L1 SAPI %s\n",
 			get_value_string(femtobts_l1sapi_names, data_ind->sapi));
@@ -240,8 +236,26 @@
 		return 0;
 
 	DEBUGP(DL1IF, "Rx PH-RA.ind");
-	bts_update_tbf_ta("PH-RA", ra_ind->u32Fn, fl1h->trx_no, ra_ind->u8Tn,
-			qta2ta(ra_ind->measParam.i16BurstTiming), true);
+
+	switch (ra_ind->sapi) {
+#if 0
+	case GsmL1_Sapi_Ptcch:
+		/* FIXME: we need a pure C function for that */
+		BTS::main_bts()->rcv_ptcch_rach(
+			fl1h->trx_no, ra_ind->u8Tn, ra_ind->u32Fn,
+			ra_ind->measParam.i16BurstTiming);
+		break;
+#endif
+	case GsmL1_Sapi_Pdtch:
+		bts_update_tbf_ta("PH-RA", ra_ind->u32Fn, fl1h->trx_no, ra_ind->u8Tn,
+				  qta2ta(ra_ind->measParam.i16BurstTiming), true);
+		break;
+
+	default:
+		LOGP(DL1IF, LOGL_NOTICE, "Rx PH-RA.ind for unknown L1 SAPI %s\n",
+		     get_value_string(femtobts_l1sapi_names, ra_ind->sapi));
+		return -ENOTSUP;
+	}
 
 	return 0;
 }
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index b8aa401..017c3b0 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -421,6 +421,11 @@
 			rach_ind->qta, rach_ind->is_11bit,
 			(ph_burst_type)rach_ind->burst_type);
 		break;
+	case PCU_IF_SAPI_PTCCH:
+		rc = BTS::main_bts()->rcv_ptcch_rach(
+			rach_ind->trx_nr, rach_ind->ts_nr,
+			rach_ind->fn, rach_ind->qta);
+		break;
 	default:
 		LOGP(DL1IF, LOGL_ERROR, "Received PCU rach request with "
 			"unsupported sapi %d\n", rach_ind->sapi);

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I482d60a46b9d253dfe0b16140eac9fea6420b30c
Gerrit-Change-Number: 16085
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191116/ee3e82ea/attachment.htm>


More information about the gerrit-log mailing list