dexter has uploaded this change for review.

View Change

rsl: allow configuration of HR GSM RTP format via CHANNEL ACTIVATE

Unfortunately there are two different RTP formats (RFC5993 and TS 101.318)
for HR GSM specified and it is unclear which should be used with GSM
networks. Also esch BTS model may have a preference for either one or the
other format. We already accept both formats but we do not have a way to
select the transmitting format yet. Lets add a new RSL IE to control which
format is used.

Depends: libosmocore I843c8a0cbe5898311f3af3294cec7c8bc96c4eb8
Change-Id: Id53ebebdf987fc59cf4e38bcddb75663fd7bb8fc
Related: OS#5688
---
M include/osmo-bts/bts.h
M include/osmo-bts/lchan.h
M src/common/l1sap.c
M src/common/rsl.c
4 files changed, 54 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/26/30726/1
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index b1a594c..e5fc90a 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -65,6 +65,11 @@
#define BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER (1 << 2)
/* Whether the BTS model reports interference measurements to L1SAP. */
#define BTS_INTERNAL_FLAG_INTERF_MEAS (1 << 3)
+/* Whether the BTS model supports HR GSM RTP payload in
+ * GSM ETSI TS.101.138 (TIPHON) format */
+#define BTS_INTERNAL_FLAG_SPEECH_H_V1_TS101318 (1 << 4)
+/* Whether the BTS model supports HR GSM RTP payload in RFC 5883 format */
+#define BTS_INTERNAL_FLAG_SPEECH_H_V1_RFC5993 (1 << 5)

/* BTS implementation flags (internal use, not exposed via OML) */
#define bts_internal_flag_get(bts, flag) \
diff --git a/include/osmo-bts/lchan.h b/include/osmo-bts/lchan.h
index d89aa1f..4a3215c 100644
--- a/include/osmo-bts/lchan.h
+++ b/include/osmo-bts/lchan.h
@@ -133,6 +133,12 @@
uint8_t current;
};

+enum hr_hsm_rtp_fmt {
+ RTP_FMT_NATIVE,
+ RTP_FMT_SPEECH_H_V1_TS101318,
+ RTP_FMT_SPEECH_H_V1_RFC5993,
+};
+
struct gsm_lchan {
/* The TS that we're part of */
struct gsm_bts_trx_ts *ts;
@@ -164,6 +170,7 @@
uint8_t rtp_payload;
uint8_t rtp_payload2;
uint8_t speech_mode;
+ bool rtp_hr_rfc5993;
struct {
bool use;
uint8_t local_cid;
@@ -311,6 +318,9 @@
struct abis_rsl_osmo_temp_ovp_acch_cap top_acch_cap;
bool top_acch_active;

+ /* HR GSM RTP format setting. This sets the RTP format the BTS emits. */
+ enum hr_hsm_rtp_fmt hr_hsm_rtp_fmt;
+
struct msgb *pending_rel_ind_msg;

/* ECU (Error Concealment Unit) state */
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 410fb91..d24161f 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1625,6 +1625,16 @@

msgb_pull_to_l2(msg);

+ /* Convert GSM HR RTP to the output format that was specified by the BSC via RSL */
+ if (lchan->tch_mode == GSM48_CMODE_SPEECH_V1 && lchan->type == GSM_LCHAN_TCH_H) {
+ if (lchan->hr_hsm_rtp_fmt == RTP_FMT_SPEECH_H_V1_TS101318 && msg->len == GSM_HR_BYTES + 1) {
+ msgb_pull(msg, 1);
+ } else if (lchan->hr_hsm_rtp_fmt == RTP_FMT_SPEECH_H_V1_RFC5993 && msg->len == GSM_HR_BYTES) {
+ msgb_push(msg, 1);
+ msg->data[0] = 0x00;
+ }
+ }
+
/* Low level layers always call us when TCH content is expected, even if
* the content is not available due to decoding issues. Content not
* available is expected as empty payload. We also check if quality is
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 91af6cb..214cb51 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -1618,6 +1618,29 @@
return 0;
}

+/* Parse RSL_IE_OSMO_HR_GSM_RTP_FMT */
+static int parse_hr_gsm_fmt_setting(struct gsm_lchan *lchan, const struct tlv_parsed *tp)
+{
+ /* When the TLV is not present the BTS will emit RTP packets in the format it natively supports. (e.g. for
+ * osmo-bts-trx this will be RFC 5993) */
+ if (!TLVP_PRES_LEN(tp, RSL_IE_OSMO_HR_GSM_RTP_FMT, 1)) {
+ lchan->hr_hsm_rtp_fmt = RTP_FMT_NATIVE;
+ return 0;
+ }
+
+ if (TLVP_VAL(tp, RSL_IE_OSMO_HR_GSM_RTP_FMT)[0] == 0x00) {
+ lchan->hr_hsm_rtp_fmt = RTP_FMT_SPEECH_H_V1_TS101318;
+ } else if (TLVP_VAL(tp, RSL_IE_OSMO_HR_GSM_RTP_FMT)[0] == 0x01) {
+ lchan->hr_hsm_rtp_fmt = RTP_FMT_SPEECH_H_V1_RFC5993;
+ } else {
+ LOGP(DRSL, LOGL_ERROR, "ignoring unknown HR GSM RTP format %02x!\n",
+ TLVP_VAL(tp, RSL_IE_OSMO_HR_GSM_RTP_FMT)[0]);
+ lchan->hr_hsm_rtp_fmt = RTP_FMT_NATIVE;
+ }
+
+ return 0;
+}
+
/* Parse (O) MultiRate configuration IE (see 9.3.52) */
static int parse_multirate_config(struct gsm_lchan *lchan,
const struct tlv_parsed *tp)
@@ -1967,6 +1990,9 @@
rc = parse_temporary_overpower_acch_capability(lchan, &tp);
if (rc < 0)
return rsl_tx_chan_act_acknack(lchan, -rc);
+ rc = parse_hr_gsm_fmt_setting(lchan, &tp);
+ if (rc < 0)
+ return rsl_tx_chan_act_acknack(lchan, -rc);

/* Take the first ACCH overpower decision (if allowed): it can be
* enabled immediately if the RxQual threshold is disabled (0). */
@@ -2239,6 +2265,9 @@
rc = parse_temporary_overpower_acch_capability(lchan, &tp);
if (rc < 0)
return rsl_tx_mode_modif_nack(lchan, -rc);
+ rc = parse_hr_gsm_fmt_setting(lchan, &tp);
+ if (rc < 0)
+ return rsl_tx_mode_modif_nack(lchan, -rc);

/* Immediately disable ACCH overpower if the value is 0 dB,
* or enable if the RxQual threshold becomes disabled (0). */

To view, visit change 30726. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id53ebebdf987fc59cf4e38bcddb75663fd7bb8fc
Gerrit-Change-Number: 30726
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-MessageType: newchange