Change in osmo-bts[master]: [VAMOS] rsl: call bts_supports_cm() from rsl_handle_chan_mod_ie()

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 May 22 11:48:27 UTC 2021


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


Change subject: [VAMOS] rsl: call bts_supports_cm() from rsl_handle_chan_mod_ie()
......................................................................

[VAMOS] rsl: call bts_supports_cm() from rsl_handle_chan_mod_ie()

Ensure that we check the PHY capabilities in both cases:

  * RSL CHANnel ACTIVation, and
  * RSL CHANnel MODE MODIFY,

by calling bts_supports_cm() from rsl_handle_chan_mod_ie().

Modify bts_supports_cm() to accept a 'struct rsl_ie_chan_mode',
so we can handle VAMOS enabled channel modes and CSD later on.

Change-Id: I31a444592436705ec9d6ddade3cbfa7f8cb4bb91
Related: SYS#5315, OS#4940
---
M include/osmo-bts/bts.h
M src/common/bts.c
M src/common/rsl.c
M tests/misc/misc_test.c
4 files changed, 69 insertions(+), 35 deletions(-)



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

diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 141dce2..978a548 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -400,8 +400,8 @@
 
 int bts_main(int argc, char **argv);
 
-int bts_supports_cm(struct gsm_bts *bts, enum gsm_phys_chan_config pchan,
-		    enum gsm48_chan_mode cm);
+int bts_supports_cm(const struct gsm_bts *bts,
+		    const struct rsl_ie_chan_mode *cm);
 
 int32_t bts_get_avg_fn_advance(const struct gsm_bts *bts);
 
diff --git a/src/common/bts.c b/src/common/bts.c
index fe4d26e..b5615d6 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -854,28 +854,35 @@
 	return &bts->gsm_time;
 }
 
-int bts_supports_cm(struct gsm_bts *bts, enum gsm_phys_chan_config pchan,
-		    enum gsm48_chan_mode cm)
+int bts_supports_cm(const struct gsm_bts *bts,
+		    const struct rsl_ie_chan_mode *cm)
 {
 	enum osmo_bts_features feature = _NUM_BTS_FEAT;
 
-	/* We assume that signalling support is mandatory,
-	 * there is no BTS_FEAT_* definition to check that. */
-	if (cm == GSM48_CMODE_SIGN)
+	switch (cm->spd_ind) {
+	case RSL_CMOD_SPD_SIGN:
+		/* We assume that signalling support is mandatory,
+		 * there is no BTS_FEAT_* definition to check that. */
 		return 1;
+	case RSL_CMOD_SPD_SPEECH:
+		break;
+	case RSL_CMOD_SPD_DATA:
+	default:
+		return 0;
+	}
 
 	/* Before the requested pchan/cm combination can be checked, we need to
 	 * convert it to a feature identifier we can check */
-	switch (pchan) {
-	case GSM_PCHAN_TCH_F:
-		switch(cm) {
-		case GSM48_CMODE_SPEECH_V1:
+	switch (cm->chan_rt) {
+	case RSL_CMOD_CRT_TCH_Bm:
+		switch (cm->chan_rate) {
+		case RSL_CMOD_SP_GSM1:
 			feature	= BTS_FEAT_SPEECH_F_V1;
 			break;
-		case GSM48_CMODE_SPEECH_EFR:
+		case RSL_CMOD_SP_GSM2:
 			feature	= BTS_FEAT_SPEECH_F_EFR;
 			break;
-		case GSM48_CMODE_SPEECH_AMR:
+		case RSL_CMOD_SP_GSM3:
 			feature = BTS_FEAT_SPEECH_F_AMR;
 			break;
 		default:
@@ -884,12 +891,12 @@
 		}
 		break;
 
-	case GSM_PCHAN_TCH_H:
-		switch(cm) {
-		case GSM48_CMODE_SPEECH_V1:
+	case RSL_CMOD_CRT_TCH_Lm:
+		switch (cm->chan_rate) {
+		case RSL_CMOD_SP_GSM1:
 			feature	= BTS_FEAT_SPEECH_H_V1;
 			break;
-		case GSM48_CMODE_SPEECH_AMR:
+		case RSL_CMOD_SP_GSM3:
 			feature = BTS_FEAT_SPEECH_H_AMR;
 			break;
 		default:
@@ -899,8 +906,9 @@
 		break;
 
 	default:
-		LOGP(DRSL, LOGL_ERROR, "BTS %u: unhandled pchan %s when checking mode %s\n",
-		     bts->nr, gsm_pchan_name(pchan), gsm48_chan_mode_name(cm));
+		LOGP(DRSL, LOGL_ERROR,
+		     "Unhandled RSL channel type=0x%02x/rate=0x%02x\n",
+		     cm->chan_rt, cm->chan_rate);
 		return 0;
 	}
 
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 601e5f8..bb53aa5 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -227,6 +227,14 @@
 
 #undef RSL_CMODE
 
+	if (bts_supports_cm(lchan->ts->trx->bts, cm) != 1) {
+		LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "Channel type=0x%02x/mode=%s "
+			  "is not supported by the PHY\n", cm->chan_rt,
+			  gsm48_chan_mode_name(lchan->tch_mode));
+		*cause = RSL_ERR_SERV_OPT_UNAVAIL;
+		return -ENOTSUP;
+	}
+
 	return 0;
 }
 
@@ -1989,12 +1997,6 @@
 	if (rsl_handle_chan_ident_ie(lchan, &tp, &cause) != 0)
 		return rsl_tx_mode_modif_nack(lchan, cause);
 
-	if (bts_supports_cm(lchan->ts->trx->bts, ts_pchan(lchan->ts), lchan->tch_mode) != 1) {
-		LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "%s: invalid mode: %s (wrong BSC configuration?)\n",
-			  gsm_ts_and_pchan_name(lchan->ts), gsm48_chan_mode_name(lchan->tch_mode));
-		return rsl_tx_mode_modif_nack(lchan, RSL_ERR_SERV_OPT_UNAVAIL);
-	}
-
 	/* 9.3.7 Encryption Information */
 	if (TLVP_PRESENT(&tp, RSL_IE_ENCR_INFO)) {
 		uint8_t len = TLVP_LEN(&tp, RSL_IE_ENCR_INFO);
diff --git a/tests/misc/misc_test.c b/tests/misc/misc_test.c
index 439d6b3..e65fcb4 100644
--- a/tests/misc/misc_test.c
+++ b/tests/misc/misc_test.c
@@ -162,25 +162,49 @@
 
 static void test_bts_supports_cm(void)
 {
+	struct rsl_ie_chan_mode cm;
 	struct gsm_bts *bts;
 
 	bts = gsm_bts_alloc(ctx, 0);
 
+	/* Signalling shall be supported regardless of the features */
+	cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Bm,
+					 .spd_ind = RSL_CMOD_SPD_SIGN };
+	OSMO_ASSERT(bts_supports_cm(bts, &cm) == 1); /* TCH/F */
+
+	cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Lm,
+					 .spd_ind = RSL_CMOD_SPD_SIGN };
+	OSMO_ASSERT(bts_supports_cm(bts, &cm) == 1); /* TCH/H */
+
 	osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_V1);
 	osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_V1);
 	osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_AMR);
 	osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_AMR);
 
-	OSMO_ASSERT(bts_supports_cm
-		    (bts, GSM_PCHAN_TCH_F, GSM48_CMODE_SPEECH_V1) == 1);
-	OSMO_ASSERT(bts_supports_cm
-		    (bts, GSM_PCHAN_TCH_H, GSM48_CMODE_SPEECH_V1) == 1);
-	OSMO_ASSERT(bts_supports_cm
-		    (bts, GSM_PCHAN_TCH_F, GSM48_CMODE_SPEECH_EFR) == 0);
-	OSMO_ASSERT(bts_supports_cm
-		    (bts, GSM_PCHAN_TCH_F, GSM48_CMODE_SPEECH_AMR) == 1);
-	OSMO_ASSERT(bts_supports_cm
-		    (bts, GSM_PCHAN_TCH_H, GSM48_CMODE_SPEECH_AMR) == 1);
+	cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Bm,
+					 .spd_ind = RSL_CMOD_SPD_SPEECH,
+					 .chan_rate = RSL_CMOD_SP_GSM1 };
+	OSMO_ASSERT(bts_supports_cm(bts, &cm) == 1); /* TCH/FS */
+
+	cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Lm,
+					 .spd_ind = RSL_CMOD_SPD_SPEECH,
+					 .chan_rate = RSL_CMOD_SP_GSM1 };
+	OSMO_ASSERT(bts_supports_cm(bts, &cm) == 1); /* TCH/HS */
+
+	cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Bm,
+					 .spd_ind = RSL_CMOD_SPD_SPEECH,
+					 .chan_rate = RSL_CMOD_SP_GSM2 };
+	OSMO_ASSERT(bts_supports_cm(bts, &cm) == 0); /* TCH/EFS */
+
+	cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Bm,
+					 .spd_ind = RSL_CMOD_SPD_SPEECH,
+					 .chan_rate = RSL_CMOD_SP_GSM3 };
+	OSMO_ASSERT(bts_supports_cm(bts, &cm) == 1); /* TCH/AFS */
+
+	cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Lm,
+					 .spd_ind = RSL_CMOD_SPD_SPEECH,
+					 .chan_rate = RSL_CMOD_SP_GSM3 };
+	OSMO_ASSERT(bts_supports_cm(bts, &cm) == 1); /* TCH/AHS */
 
 	talloc_free(bts);
 }

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I31a444592436705ec9d6ddade3cbfa7f8cb4bb91
Gerrit-Change-Number: 24340
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210522/2f88c98e/attachment.htm>


More information about the gerrit-log mailing list