Change in osmo-bsc[master]: allow explixit TSC Set and TSC on chan activ / modif / assignment

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

neels gerrit-no-reply at lists.osmocom.org
Sun May 23 23:02:24 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24369 )


Change subject: allow explixit TSC Set and TSC on chan activ / modif / assignment
......................................................................

allow explixit TSC Set and TSC on chan activ / modif / assignment

Activating / modifying to a VAMOS mode will require picking specific TSC
Set / TSC. It is a bad idea to pick the TSC in each message encoding
function, rather make this choice centrally.

So far we pick the training sequence code to use based on the timeslot
configuration, and this TSC is determined only upon encoding the RSL
messages.

Instead, pick the TSC to use upon the initial lchan activation /
modification request; store this in the request structs and pass through
the activation / modification code paths.

For VAMOS modes, we also need to pick a TSC Set. Do so also upon activ /
modif request. Note that the TSC Set is not yet applied in this patch,
it will be applied in upcoming VAMOS patches.

The activ / modif request may pass -1 for tsc_set and/or tsc to indicate
no specific choice of TSC Set and TSC, resulting in the same behavior as
before this patch.

For example, lchan->activate.info.tsc* may be passed as -1. The exact
choice for tsc_set and tsc is then stored in lchan->activate.tsc*, i.e.
one level up (the .info sub-struct is considered as immutable input
args). The lchan->activate.tsc* are the values actually encoded in RSL
messages. After the ACK, the lchan->activate.tsc* is stored in
lchan->tsc* to indicate the TSC actually in use. Same for modif.

Note that in 3GPP TS 45.002, the TSC Set are numbered 1 to 4, while the
TSC are numbered 0 to 7. On the wire, though, TSC Set is sent as 0 to 3
value. This is a weird discrepancy, odd choice made by the spec authors.
For conformance with the spec wording, I decided to pass the TSC Set
number as a 1-4 ranged value, and only convert it to the 0-3 on-the-wire
format upon message encoding. So log messages and VTY output will
indicate the first TSC Set as "1", but the first TSC as "0", as defined
in 3GPP TS 45.002, even if that is somewhat weird.

Related: SYS#5315 OS#4940
Change-Id: Ic665125255d7354f5499d10dda1dd866ab243d24
---
M include/osmocom/bsc/assignment_fsm.h
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/abis_rsl.c
M src/osmo-bsc/assignment_fsm.c
M src/osmo-bsc/bsc_vty.c
M src/osmo-bsc/gsm_04_08_rr.c
M src/osmo-bsc/lchan_fsm.c
M src/osmo-bsc/lcs_loc_req.c
8 files changed, 81 insertions(+), 14 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/69/24369/1

diff --git a/include/osmocom/bsc/assignment_fsm.h b/include/osmocom/bsc/assignment_fsm.h
index d4ed846..3a64f7d 100644
--- a/include/osmocom/bsc/assignment_fsm.h
+++ b/include/osmocom/bsc/assignment_fsm.h
@@ -41,7 +41,8 @@
 
 void assignment_fsm_init();
 
-int reassignment_request_to_lchan(enum assign_for assign_for, struct gsm_lchan *lchan, struct gsm_lchan *to_lchan);
+int reassignment_request_to_lchan(enum assign_for assign_for, struct gsm_lchan *lchan, struct gsm_lchan *to_lchan,
+				  int tsc_set, int tsc);
 int reassignment_request_to_chan_type(enum assign_for assign_for, struct gsm_lchan *lchan,
 				      enum gsm_chan_t new_lchan_type);
 
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index ab58b5c..4be1daa 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -163,6 +163,13 @@
 	 * multiplexing, user request via VTY). In these situations, select a target lchan beforehand and point
 	 * target_lchan to it. */
 	struct gsm_lchan *target_lchan;
+
+	/* TSC Set to use, or -1 for automatically determining the TSC Set to use. Valid range is 1 to 4, as described
+	 * in 3GPP TS 45.002. */
+	int tsc_set;
+	/* TSC to use, or -1 for automatically determining the TSC to use. Valid range is 0 to 7, as described in 3GPP
+	 * TS 45.002. */
+	int tsc;
 };
 
 /* State of an ongoing Assignment, while the assignment_fsm is still busy. This serves as state separation to keep the
@@ -609,6 +616,13 @@
 	struct gsm_lchan *re_use_mgw_endpoint_from_lchan;
 	bool ta_known;
 	uint8_t ta;
+
+	/* TSC Set to use, or -1 for automatically determining the TSC Set to use. Valid range is 1 to 4, as described
+	 * in 3GPP TS 45.002. */
+	int tsc_set;
+	/* TSC to use, or -1 for automatically determining the TSC to use. Valid range is 0 to 7, as described in 3GPP
+	 * TS 45.002. */
+	int tsc;
 };
 
 enum lchan_modify_for {
@@ -626,6 +640,13 @@
 	struct channel_mode_and_rate ch_mode_rate;
 	bool requires_voice_stream;
 	uint16_t msc_assigned_cic;
+
+	/* TSC Set to use, or -1 for automatically determining the TSC Set to use. Valid range is 1 to 4, as described
+	 * in 3GPP TS 45.002. */
+	int tsc_set;
+	/* TSC to use, or -1 for automatically determining the TSC to use. Valid range is 0 to 7, as described in 3GPP
+	 * TS 45.002. */
+	int tsc;
 };
 
 struct gsm_lchan {
@@ -651,11 +672,15 @@
 		 * occur later, e.g. during release, that we don't send a NACK out of context. */
 		bool concluded;
 		enum gsm0808_cause gsm0808_error_cause;
+		int tsc_set;
+		uint8_t tsc;
 	} activate;
 
 	struct {
 		struct lchan_modify_info info;
 		struct gsm48_multi_rate_conf mr_conf_filtered;
+		int tsc_set;
+		uint8_t tsc;
 		bool concluded;
 	} modify;
 
@@ -736,6 +761,12 @@
 		 * "normal" lchan */
 		bool is_secondary;
 	} vamos;
+
+	/* Circuit-Switched TSC Set in use, or -1 if no specific TSC Set was requested. The valid range is 1-4 as
+	 * described in the spec 3GPP TS 45.002. */
+	int tsc_set;
+	/* Training Sequence Code in use. The valid range is 0-7 as described in the spec 3GPP TS 45.002. */
+	uint8_t tsc;
 };
 
 /* One Timeslot in a TRX */
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index 7895bb1..3434258 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -530,7 +530,7 @@
 	}
 
 	memset(&cd, 0, sizeof(cd));
-	gsm48_lchan2chan_desc(&cd, lchan, gsm_ts_tsc(lchan->ts));
+	gsm48_lchan2chan_desc(&cd, lchan, lchan->activate.tsc);
 
 	msg = rsl_msgb_alloc();
 	dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
@@ -1803,7 +1803,7 @@
 	ia->proto_discr = GSM48_PDISC_RR;
 	ia->msg_type = GSM48_MT_RR_IMM_ASS;
 	ia->page_mode = GSM48_PM_SAME;
-	gsm48_lchan2chan_desc(&ia->chan_desc, lchan, gsm_ts_tsc(lchan->ts));
+	gsm48_lchan2chan_desc(&ia->chan_desc, lchan, lchan->tsc);
 
 	/* use request reference extracted from CHAN_RQD */
 	memcpy(&ia->req_ref, lchan->rqd_ref, sizeof(ia->req_ref));
diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index 062fcb4..d3bdaf1 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -439,7 +439,7 @@
 }
 
 static int _reassignment_request(enum assign_for assign_for, struct gsm_lchan *lchan, struct gsm_lchan *to_lchan,
-				 enum gsm_chan_t new_lchan_type)
+				 enum gsm_chan_t new_lchan_type, int tsc_set, int tsc)
 {
 	struct gsm_subscriber_connection *conn = lchan->conn;
 	struct assignment_request req = {
@@ -450,6 +450,8 @@
 		.n_ch_mode_rate = 1,
 		.ch_mode_rate_list = { lchan->current_ch_mode_rate },
 		.target_lchan = to_lchan,
+		.tsc_set = tsc_set,
+		.tsc = tsc,
 	};
 
 	if (to_lchan)
@@ -466,15 +468,16 @@
 	return osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_ASSIGNMENT_START, &req);
 }
 
-int reassignment_request_to_lchan(enum assign_for assign_for, struct gsm_lchan *lchan, struct gsm_lchan *to_lchan)
+int reassignment_request_to_lchan(enum assign_for assign_for, struct gsm_lchan *lchan, struct gsm_lchan *to_lchan,
+				  int tsc_set, int tsc)
 {
-	return _reassignment_request(assign_for, lchan, to_lchan, 0);
+	return _reassignment_request(assign_for, lchan, to_lchan, 0, tsc_set, tsc);
 }
 
 int reassignment_request_to_chan_type(enum assign_for assign_for, struct gsm_lchan *lchan,
 				      enum gsm_chan_t new_lchan_type)
 {
-	return _reassignment_request(assign_for, lchan, NULL, new_lchan_type);
+	return _reassignment_request(assign_for, lchan, NULL, new_lchan_type, -1, -1);
 }
 
 void assignment_fsm_start(struct gsm_subscriber_connection *conn, struct gsm_bts *bts,
@@ -632,6 +635,8 @@
 		.re_use_mgw_endpoint_from_lchan = conn->lchan,
 		.ta = conn->lchan->last_ta,
 		.ta_known = true,
+		.tsc_set = req->tsc_set,
+		.tsc = req->tsc,
 	};
 	lchan_activate(conn->assignment.new_lchan, &activ_info);
 }
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 18b35ad..da56824 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -1878,7 +1878,7 @@
 		vty_out(vty, "Error: cannot find free lchan of type %s%s",
 			gsm_lchant_name(from_lchan->type), VTY_NEWLINE);
 	}
-	if (reassignment_request_to_lchan(ACTIVATE_FOR_VTY, from_lchan, to_lchan)) {
+	if (reassignment_request_to_lchan(ACTIVATE_FOR_VTY, from_lchan, to_lchan, -1, -1)) {
 		vty_out(vty, "Error: not allowed to start assignment for %s%s",
 			gsm_lchan_name(from_lchan), VTY_NEWLINE);
 		return CMD_WARNING;
@@ -6047,7 +6047,10 @@
 /* Activate / Deactivate a single lchan with a specific codec mode */
 static int lchan_act_single(struct vty *vty, struct gsm_lchan *lchan, const char *codec_str, int amr_mode, int activate)
 {
-	struct lchan_activate_info info = { };
+	struct lchan_activate_info info = {
+		.tsc_set = -1,
+		.tsc = -1,
+	};
 	uint16_t amr_modes[8] =
 	    { GSM0808_SC_CFG_AMR_4_75, GSM0808_SC_CFG_AMR_4_75_5_90_7_40_12_20, GSM0808_SC_CFG_AMR_5_90,
 	      GSM0808_SC_CFG_AMR_6_70, GSM0808_SC_CFG_AMR_7_40, GSM0808_SC_CFG_AMR_7_95, GSM0808_SC_CFG_AMR_10_2,
diff --git a/src/osmo-bsc/gsm_04_08_rr.c b/src/osmo-bsc/gsm_04_08_rr.c
index dbeefcb..8febd54 100644
--- a/src/osmo-bsc/gsm_04_08_rr.c
+++ b/src/osmo-bsc/gsm_04_08_rr.c
@@ -618,7 +618,7 @@
 	 * the chan_desc. But as long as multi-slot configurations
 	 * are not used we seem to be fine.
 	 */
-	gsm48_lchan2chan_desc(&ass->chan_desc, new_lchan, gsm_ts_tsc(new_lchan->ts));
+	gsm48_lchan2chan_desc(&ass->chan_desc, new_lchan, new_lchan->tsc);
 	ass->power_command = power_command;
 
 	/* Cell Channel Description (freq. hopping), TV (see 3GPP TS 44.018, 10.5.2.1b) */
@@ -681,6 +681,7 @@
 	struct gsm48_chan_mode_modify *cmm =
 		(struct gsm48_chan_mode_modify *) msgb_put(msg, sizeof(*cmm));
 	struct gsm_bts *bts = lchan->ts->trx->bts;
+	uint8_t tsc;
 
 	DEBUGP(DRR, "-> CHANNEL MODE MODIFY mode=0x%02x\n", mode);
 
@@ -690,7 +691,8 @@
 
 	/* fill the channel information element, this code
 	 * should probably be shared with rsl_rx_chan_rqd() */
-	gsm48_lchan2chan_desc(&cmm->chan_desc, lchan, gsm_ts_tsc(lchan->ts));
+	tsc = (lchan->modify.info.tsc >= 0) ? lchan->modify.info.tsc : gsm_ts_tsc(lchan->ts); /* FIXME */
+	gsm48_lchan2chan_desc(&cmm->chan_desc, lchan, tsc);
 	cmm->mode = mode;
 
 	/* in case of multi rate we need to attach a config */
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 0e0f1aa..e25a6de 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -457,6 +457,8 @@
 		.last_error = lchan->last_error,
 
 		.release.rr_cause = GSM48_RR_CAUSE_NORMAL,
+
+		.tsc_set = 1,
 	};
 }
 
@@ -713,6 +715,15 @@
 
 	lchan->encr = lchan->activate.info.encr;
 
+	if (lchan->activate.info.tsc_set > 0)
+		lchan->activate.tsc_set = lchan->activate.info.tsc_set;
+	else
+		lchan->activate.tsc_set = 1;
+
+	/* Use the TSC provided in the modification request, if any. Otherwise use the timeslot's configured
+	 * TSC. */
+	lchan->activate.tsc = (lchan->activate.info.tsc >= 0) ? lchan->activate.info.tsc : gsm_ts_tsc(lchan->ts);
+
 	rc = rsl_tx_chan_activ(lchan, act_type, ho_ref);
 	if (rc) {
 		lchan_fail_to(LCHAN_ST_UNUSED, "Tx Chan Activ failed: %s (%d)", strerror(-rc), rc);
@@ -786,6 +797,8 @@
 
 	lchan->current_ch_mode_rate = lchan->activate.info.ch_mode_rate;
 	lchan->current_mr_conf = lchan->activate.mr_conf_filtered;
+	lchan->tsc_set = lchan->activate.tsc_set;
+	lchan->tsc = lchan->activate.tsc;
 	LOG_LCHAN(lchan, LOGL_INFO, "Rx Activ ACK %s\n",
 		  gsm48_chan_mode_name(lchan->current_ch_mode_rate.chan_mode));
 
@@ -958,6 +971,8 @@
 		/* The Channel Mode Modify was ACKed, now the requested values become the accepted and used values. */
 		lchan->current_ch_mode_rate = lchan->modify.info.ch_mode_rate;
 		lchan->current_mr_conf = lchan->modify.mr_conf_filtered;
+		lchan->tsc_set = lchan->modify.tsc_set;
+		lchan->tsc = lchan->modify.tsc;
 
 		if (lchan->modify.info.requires_voice_stream
 		    && !lchan->fi_rtp) {
@@ -1117,15 +1132,25 @@
 			}
 		}
 
+		if (lchan->modify.info.tsc_set > 0)
+			lchan->modify.tsc_set = lchan->modify.info.tsc_set;
+		else
+			lchan->modify.tsc_set = 1;
+
+		/* Use the TSC provided in the modification request, if any. Otherwise use the timeslot's configured
+		 * TSC. */
+		lchan->modify.tsc = (lchan->modify.info.tsc >= 0) ? lchan->modify.info.tsc : gsm_ts_tsc(lchan->ts);
+
 		LOG_LCHAN(lchan, LOGL_INFO,
-			  "Modification requested: %s voice=%s MGW-ci=%s type=%s tch-mode=%s\n",
+			  "Modification requested: %s voice=%s MGW-ci=%s type=%s tch-mode=%s tsc=%d/%u\n",
 			  lchan_modify_for_name(lchan->modify.info.modify_for),
 			  lchan->modify.info.requires_voice_stream ? "yes" : "no",
 			  lchan->modify.info.requires_voice_stream ?
 			  (use_mgwep_ci ? osmo_mgcpc_ep_ci_name(use_mgwep_ci) : "new")
 			  : "none",
 			  gsm_lchant_name(lchan->type),
-			  gsm48_chan_mode_name(lchan->modify.info.ch_mode_rate.chan_mode));
+			  gsm48_chan_mode_name(lchan->modify.info.ch_mode_rate.chan_mode),
+			  lchan->modify.tsc_set, lchan->modify.tsc);
 
 		lchan_fsm_state_chg(LCHAN_ST_WAIT_RR_CHAN_MODE_MODIFY_ACK);
 		return;
diff --git a/src/osmo-bsc/lcs_loc_req.c b/src/osmo-bsc/lcs_loc_req.c
index ef9ee27..ee85c91 100644
--- a/src/osmo-bsc/lcs_loc_req.c
+++ b/src/osmo-bsc/lcs_loc_req.c
@@ -369,7 +369,7 @@
 				.cause = BSSLAP_CAUSE_INTRA_BSS_HO,
 			},
 		};
-		gsm48_lchan2chan_desc(&apdu->reset.chan_desc, lchan, gsm_ts_tsc(lchan->ts));
+		gsm48_lchan2chan_desc(&apdu->reset.chan_desc, lchan, lchan->tsc);
 	}
 
 	lcs_loc_req_send(lcs_loc_req, &bsslap);

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic665125255d7354f5499d10dda1dd866ab243d24
Gerrit-Change-Number: 24369
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210523/d30fe89d/attachment.htm>


More information about the gerrit-log mailing list