aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-05-22 03:33:13 +0200
committerlaforge <laforge@osmocom.org>2021-06-04 20:04:13 +0000
commit207d56afe5ce3ad1e78b54aa3d5a8cac65382924 (patch)
tree1393fe4d7fb92eca33b357f97edeef8aa5cbade9
parent163ff40dd5cb7794d84f01741a5b40b05023d0b0 (diff)
[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
-rw-r--r--include/osmo-bts/gsm_data.h9
-rw-r--r--include/osmo-bts/scheduler.h6
-rw-r--r--src/common/bts_trx.c1
-rw-r--r--src/common/gsm_data.c8
-rw-r--r--src/common/oml.c4
-rw-r--r--src/common/pcu_sock.c2
-rw-r--r--src/common/scheduler.c4
-rw-r--r--src/common/vty.c2
-rw-r--r--src/osmo-bts-trx/sched_lchan_pdtch.c4
-rw-r--r--src/osmo-bts-trx/sched_lchan_tchf.c2
-rw-r--r--src/osmo-bts-trx/sched_lchan_tchh.c2
-rw-r--r--src/osmo-bts-trx/sched_lchan_xcch.c2
12 files changed, 23 insertions, 23 deletions
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 3dfd5b75..cd63f6fb 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -441,7 +441,12 @@ struct gsm_bts_trx_ts {
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 @@ uint8_t gsm_lchan_as_pchan2chan_nr(const struct gsm_lchan *lchan,
#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 beb27163..72858f5a 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 635c4d36..ee03b9ab 100644
--- a/src/common/bts_trx.c
+++ b/src/common/bts_trx.c
@@ -86,7 +86,6 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
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 f014acff..d0fe479e 100644
--- a/src/common/gsm_data.c
+++ b/src/common/gsm_data.c
@@ -272,14 +272,6 @@ uint8_t gsm_lchan_as_pchan2chan_nr(const struct gsm_lchan *lchan,
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 0bbe0a62..0a502c10 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -961,10 +961,10 @@ static int oml_rx_set_chan_attr(struct gsm_bts_trx_ts *ts, struct msgb *msg)
/* 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 91ad90fc..83aa0a19 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -217,7 +217,7 @@ static void info_ind_fill_trx(struct gsm_pcu_if_info_trx *trx_info,
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 a3647a96..0b9c5d52 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -1218,8 +1218,8 @@ void _sched_dl_burst(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
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 d4e29024..ccc63e66 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1409,7 +1409,7 @@ static void ts_dump_vty(struct vty *vty, const struct gsm_bts_trx_ts *ts)
{
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 dede3714..335ba6fe 100644
--- a/src/osmo-bts-trx/sched_lchan_pdtch.c
+++ b/src/osmo-bts-trx/sched_lchan_pdtch.c
@@ -212,7 +212,7 @@ send_burst:
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 @@ send_burst:
} 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 5605969c..689925fb 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -562,7 +562,7 @@ send_burst:
/* 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 91ce02fd..4f03bd12 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -451,7 +451,7 @@ send_burst:
/* 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 b31175e5..4bfc101a 100644
--- a/src/osmo-bts-trx/sched_lchan_xcch.c
+++ b/src/osmo-bts-trx/sched_lchan_xcch.c
@@ -239,7 +239,7 @@ send_burst:
/* 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;