Change in osmo-bts[master]: [VAMOS] osmo-bts-trx: rework handling of Training Sequence

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

laforge gerrit-no-reply at lists.osmocom.org
Fri Jun 4 20:04:14 UTC 2021


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

Change subject: [VAMOS] osmo-bts-trx: rework handling of Training Sequence
......................................................................

[VAMOS] osmo-bts-trx: rework handling of Training Sequence

The TSC (Training Sequence Code) value in 'struct gsm_bts_trx_ts'
is always initialized in oml_rx_set_chan_attr() during the OML
bootstrapping, so there is no need for gsm_ts_tsc() - remove it.

Store the initial TSC value in 'struct gsm_bts_trx_ts', so we can
apply a different TSC value during the RSL CHANnel ACTIVation.

Store the Training Sequence Code/Set in 'struct trx_dl_burst_req'.
These values are indicated to the transceiver (TRXDv2 PDUs, 'MTS'
field) and used by the new TRX_{GMSK,8PSK}_NB_TSC macros.

Change-Id: I3744bc308b99ef941e6e9d139444e414abebc14b
Related: SYS#4895, OS#4941
---
M include/osmo-bts/gsm_data.h
M include/osmo-bts/scheduler.h
M src/common/bts_trx.c
M src/common/gsm_data.c
M src/common/oml.c
M src/common/pcu_sock.c
M src/common/scheduler.c
M src/common/vty.c
M src/osmo-bts-trx/sched_lchan_pdtch.c
M src/osmo-bts-trx/sched_lchan_tchf.c
M src/osmo-bts-trx/sched_lchan_tchh.c
M src/osmo-bts-trx/sched_lchan_xcch.c
12 files changed, 23 insertions(+), 23 deletions(-)

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



diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 3dfd5b7..cd63f6f 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -441,7 +441,12 @@
 
 	unsigned int flags;
 	struct gsm_abis_mo mo;
-	int tsc;		/* -1 == use BTS TSC */
+
+	/* Training Sequence Code (range 0..7) */
+	uint8_t tsc_oml; /* configured via OML */
+	uint8_t tsc; /* currently in use */
+	/* Training Sequence Set (range 0..3) */
+	uint8_t tsc_set;
 
 	/* Frequency hopping parameters (configured via OML) */
 	struct {
@@ -522,8 +527,6 @@
 #define BSIC2BCC(bsic) ((bsic) & 0x07)
 #define BTS_TSC(bts) BSIC2BCC((bts)->bsic)
 
-uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts);
-
 struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr,
 				   int *rc);
 
diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index beb2716..72858f5 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -12,6 +12,12 @@
 #define TRX_CHAN_IS_ACTIVE(state, chan) \
 	(trx_chan_desc[chan].flags & TRX_CHAN_FLAG_AUTO_ACTIVE || (state)->active)
 
+#define TRX_GMSK_NB_TSC(br) \
+	_sched_train_seq_gmsk_nb[(br)->tsc]
+
+#define TRX_8PSK_NB_TSC(br) \
+	_sched_train_seq_8psk_nb[(br)->tsc]
+
 /* These types define the different channels on a multiframe.
  * Each channel has queues and can be activated individually.
  */
diff --git a/src/common/bts_trx.c b/src/common/bts_trx.c
index 635c4d3..ee03b9a 100644
--- a/src/common/bts_trx.c
+++ b/src/common/bts_trx.c
@@ -86,7 +86,6 @@
 		ts->pchan = GSM_PCHAN_NONE;
 		ts->dyn.pchan_is = GSM_PCHAN_NONE;
 		ts->dyn.pchan_want = GSM_PCHAN_NONE;
-		ts->tsc = -1;
 
 		ts->mo.fi = osmo_fsm_inst_alloc(&nm_chan_fsm, trx, ts,
 						     LOGL_INFO, NULL);
diff --git a/src/common/gsm_data.c b/src/common/gsm_data.c
index f014acf..d0fe479 100644
--- a/src/common/gsm_data.c
+++ b/src/common/gsm_data.c
@@ -272,14 +272,6 @@
 	return gsm_pchan2chan_nr(as_pchan, lchan->ts->nr, lchan->nr);
 }
 
-uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts)
-{
-	if (ts->tsc != -1)
-		return ts->tsc;
-	else
-		return BTS_TSC(ts->trx->bts);
-}
-
 /* determine logical channel based on TRX and channel number IE */
 struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr,
 				   int *rc)
diff --git a/src/common/oml.c b/src/common/oml.c
index 0bbe0a6..0a502c1 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -961,10 +961,10 @@
 
 	/* 9.4.60 TSC */
 	if (TLVP_PRES_LEN(&tp, NM_ATT_TSC, 1)) {
-		ts->tsc = *TLVP_VAL(&tp, NM_ATT_TSC);
+		ts->tsc_oml = ts->tsc = *TLVP_VAL(&tp, NM_ATT_TSC);
 	} else {
 		/* If there is no TSC specified, use the BCC */
-		ts->tsc = BTS_TSC(bts);
+		ts->tsc_oml = ts->tsc = BTS_TSC(bts);
 	}
 	LOGPFOH(DOML, LOGL_INFO, foh, "SET CHAN ATTR (TSC=%u pchan=%s",
 		ts->tsc, gsm_pchan_name(ts->pchan));
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 91ad90f..83aa0a1 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -217,7 +217,7 @@
 			continue;
 
 		trx_info->pdch_mask |= (1 << tn);
-		trx_info->ts[tn].tsc = gsm_ts_tsc(ts);
+		trx_info->ts[tn].tsc = ts->tsc;
 
 		if (ts->hopping.enabled)
 			info_ind_fill_fhp(&trx_info->ts[tn], ts);
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index a3647a9..0b9c5d5 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -1218,8 +1218,8 @@
 		return;
 
 	/* Training Sequence Code and Set */
-	br->tsc = gsm_ts_tsc(l1ts->ts);
-	br->tsc_set = 0;
+	br->tsc_set = l1ts->ts->tsc_set;
+	br->tsc = l1ts->ts->tsc;
 
 	/* get burst from function */
 	if (func(l1ts, br) != 0)
diff --git a/src/common/vty.c b/src/common/vty.c
index d4e2902..ccc63e6 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1409,7 +1409,7 @@
 {
 	vty_out(vty, "BTS %u, TRX %u, Timeslot %u, phys cfg %s, TSC %u",
 		ts->trx->bts->nr, ts->trx->nr, ts->nr,
-		gsm_pchan_name(ts->pchan), gsm_ts_tsc(ts));
+		gsm_pchan_name(ts->pchan), ts->tsc);
 	if (ts->pchan == GSM_PCHAN_TCH_F_PDCH)
 		vty_out(vty, " (%s mode)",
 			ts->flags & TS_F_PDCH_ACTIVE ? "PDCH" : "TCH/F");
diff --git a/src/osmo-bts-trx/sched_lchan_pdtch.c b/src/osmo-bts-trx/sched_lchan_pdtch.c
index dede371..335ba6f 100644
--- a/src/osmo-bts-trx/sched_lchan_pdtch.c
+++ b/src/osmo-bts-trx/sched_lchan_pdtch.c
@@ -212,7 +212,7 @@
 		burst = *bursts_p + br->bid * 348;
 		memset(br->burst, 1, 9);
 		memcpy(br->burst + 9, burst, 174);
-		memcpy(br->burst + 183, _sched_train_seq_8psk_nb[gsm_ts_tsc(l1ts->ts)], 78);
+		memcpy(br->burst + 183, TRX_8PSK_NB_TSC(br), 78);
 		memcpy(br->burst + 261, burst + 174, 174);
 		memset(br->burst + 435, 1, 9);
 
@@ -220,7 +220,7 @@
 	} else {
 		burst = *bursts_p + br->bid * 116;
 		memcpy(br->burst + 3, burst, 58);
-		memcpy(br->burst + 61, _sched_train_seq_gmsk_nb[gsm_ts_tsc(l1ts->ts)], 26);
+		memcpy(br->burst + 61, TRX_GMSK_NB_TSC(br), 26);
 		memcpy(br->burst + 87, burst + 58, 58);
 
 		br->burst_len = GSM_BURST_LEN;
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index 5605969..689925f 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -562,7 +562,7 @@
 	/* compose burst */
 	burst = *bursts_p + br->bid * 116;
 	memcpy(br->burst + 3, burst, 58);
-	memcpy(br->burst + 61, _sched_train_seq_gmsk_nb[gsm_ts_tsc(l1ts->ts)], 26);
+	memcpy(br->burst + 61, TRX_GMSK_NB_TSC(br), 26);
 	memcpy(br->burst + 87, burst + 58, 58);
 
 	br->burst_len = GSM_BURST_LEN;
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index 91ce02f..4f03bd1 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -451,7 +451,7 @@
 	/* compose burst */
 	burst = *bursts_p + br->bid * 116;
 	memcpy(br->burst + 3, burst, 58);
-	memcpy(br->burst + 61, _sched_train_seq_gmsk_nb[gsm_ts_tsc(l1ts->ts)], 26);
+	memcpy(br->burst + 61, TRX_GMSK_NB_TSC(br), 26);
 	memcpy(br->burst + 87, burst + 58, 58);
 
 	br->burst_len = GSM_BURST_LEN;
diff --git a/src/osmo-bts-trx/sched_lchan_xcch.c b/src/osmo-bts-trx/sched_lchan_xcch.c
index b31175e..4bfc101 100644
--- a/src/osmo-bts-trx/sched_lchan_xcch.c
+++ b/src/osmo-bts-trx/sched_lchan_xcch.c
@@ -239,7 +239,7 @@
 	/* compose burst */
 	burst = *bursts_p + br->bid * 116;
 	memcpy(br->burst + 3, burst, 58);
-	memcpy(br->burst + 61, _sched_train_seq_gmsk_nb[gsm_ts_tsc(l1ts->ts)], 26);
+	memcpy(br->burst + 61, TRX_GMSK_NB_TSC(br), 26);
 	memcpy(br->burst + 87, burst + 58, 58);
 
 	br->burst_len = GSM_BURST_LEN;

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I3744bc308b99ef941e6e9d139444e414abebc14b
Gerrit-Change-Number: 24327
Gerrit-PatchSet: 8
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/20210604/e2c8b81a/attachment.htm>


More information about the gerrit-log mailing list