fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/python/osmo-python-tests/+/41051?usp=email )
Change subject: debian: do not install osmo-ctrl2cgi.service
......................................................................
debian: do not install osmo-ctrl2cgi.service
This service is calling scripts/ctrl2cgi.py, which has been deprecated
and is no longer part of the package (there's no /usr/bin/ctrl2cgi.py).
Change-Id: I6250f92d12774c69a8647b8cd26d0aa715646724
Fixes: 36cfd17 ("setup.py: do not install scripts/{soap,ctrl2cgi}.py")
---
D debian/python3-osmopy-utils.osmo-ctrl2cgi.service
M debian/rules
2 files changed, 0 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/51/41051/1
diff --git a/debian/python3-osmopy-utils.osmo-ctrl2cgi.service b/debian/python3-osmopy-utils.osmo-ctrl2cgi.service
deleted file mode 120000
index 9d9498d..0000000
--- a/debian/python3-osmopy-utils.osmo-ctrl2cgi.service
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/systemd/osmo-ctrl2cgi.service
\ No newline at end of file
diff --git a/debian/rules b/debian/rules
index ff16a03..84ef719 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,5 +12,4 @@
override_dh_installinit:
# Install service file with different name than package name:
# https://unix.stackexchange.com/questions/306234/is-it-possible-to-install-t…
- dh_installinit --name=osmo-ctrl2cgi
dh_installinit --name=osmo-trap2cgi
--
To view, visit https://gerrit.osmocom.org/c/python/osmo-python-tests/+/41051?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-Change-Id: I6250f92d12774c69a8647b8cd26d0aa715646724
Gerrit-Change-Number: 41051
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/python/osmo-python-tests/+/41052?usp=email )
Change subject: debian: python3-osmopy-utils does not need python3-treq
......................................................................
debian: python3-osmopy-utils does not need python3-treq
This module is only used by scripts/{ctrl2cgi.py,soap.py}, which
have been deprecated and are no longer part of the package.
Change-Id: I8a36109de244efaaa40bf5ac309bd5061cf0596d
Fixes: 36cfd17 ("setup.py: do not install scripts/{soap,ctrl2cgi}.py")
---
M debian/control
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/52/41052/1
diff --git a/debian/control b/debian/control
index c6bd48f..e02fd77 100644
--- a/debian/control
+++ b/debian/control
@@ -17,7 +17,7 @@
Package: python3-osmopy-utils
Architecture: all
-Depends: ${python3:Depends}, ${misc:Depends}, python3-osmopy-libs, python3-twisted, python3-treq, python3-aiohttp
+Depends: ${python3:Depends}, ${misc:Depends}, python3-osmopy-libs, python3-twisted, python3-aiohttp
Description: Python code (not only) for testing of Osmocom programs
.
This package contains the Python 3 version of osmopy utils.
--
To view, visit https://gerrit.osmocom.org/c/python/osmo-python-tests/+/41052?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-Change-Id: I8a36109de244efaaa40bf5ac309bd5061cf0596d
Gerrit-Change-Number: 41052
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/41047?usp=email )
Change subject: TCH UL path: add out-of-band BFI flag
......................................................................
TCH UL path: add out-of-band BFI flag
In original OsmoBTS architecture prior to Themyscira patches,
BFI (Bad Frame Indication) condition was signaled internally by
zero-length payload passed from BTS model to l1sap, and externally
by absence of RTP output (intentional gap) or a zero-length RTP
payload emitted in 'rtp continuous-streaming' mode. However, this
paradigm is contrary to classic GSM BSS architecture in which BFI
is an out-of-band metadata flag that travels alongside with frame
payload bits, whether the latter are valid or invalid.
Since 2024 OsmoBTS supports the option of TW-TS-001 output for
FR and EFR codecs, which allows the possibility of BFI-with-data
in RTP. OsmoBTS can already emit such BFI-with-data packets when
the BTS model delivered a deemed-good traffic frame, but that frame
was subsequently deemed bad by the link quality check in l1sap -
but there is still no explicit out-of-band BFI flag inside OsmoBTS
TCH UL path.
By introducing an out-of-band BFI flag, we make it possible for BTS
model PHYs to deliver marked-bad traffic frames: when CRC fails
in GSM 05.03 channel decoding step, a PHY that permits modification
(libosmocoding or future FOSS DSP PHY) can be enhanced to preserve
channel-decoded bits while conveying BFI.
The link quality check in l1sap is reworked to use the new OOB BFI
flag. Follow-on patches will introduce further logic that can also
assert BFI at high level, above BTS model PHYs.
While reworking the link quality check in l1sap, restrict it to
speech modes only: per GSM specs, BFI does not exist in CSD.
Change-Id: I8097946429e83eae90f89e49d17ffb8eb0636fcb
---
M include/osmo-bts/msg_utils.h
M src/common/l1sap.c
2 files changed, 48 insertions(+), 20 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/47/41047/1
diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h
index db7142d..7363bcf 100644
--- a/include/osmo-bts/msg_utils.h
+++ b/include/osmo-bts/msg_utils.h
@@ -13,21 +13,31 @@
struct msgb;
-/* Access 1st part of msgb control buffer */
+/* Control buffer words in struct msgb are used for two purposes in OsmoBTS:
+ *
+ * 1) In the direction from RTP input to TCH DL they are used to transport
+ * RTP header fields and payload preparsing results from RTP Rx callback
+ * function to deeper TCH DL handling code;
+ *
+ * 2) In TCH UL direction, we provide an ability for BTS models to indicate
+ * BFI along with payload bits, and the same BFI flag can then be set
+ * by model-independent functions for higher-level BFI conditions.
+ */
+
+/* Accessor macros for control buffer words in RTP input path */
+
+/* storing RTP header fields */
#define rtpmsg_marker_bit(x) ((x)->cb[0])
-
-/* Access 2nd part of msgb control buffer */
#define rtpmsg_seq(x) ((x)->cb[1])
-
-/* Access 3rd part of msgb control buffer */
#define rtpmsg_ts(x) ((x)->cb[2])
-
-/* Access 4th part of msgb control buffer */
+/* storing payload preparsing results */
#define rtpmsg_is_rfc5993_sid(x) ((x)->cb[3])
-
-/* Access 5th part of msgb control buffer */
#define rtpmsg_csd_align_bits(x) ((x)->cb[4])
+/* Accessor macros for control buffer words in TCH UL path */
+
+#define tch_ul_msg_bfi(x) ((x)->cb[0])
+
/**
* Classification of OML message. ETSI for plain GSM 12.21
* messages and IPA/Osmo for manufacturer messages.
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 09f6a90..f4dea35 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -2220,16 +2220,13 @@
/* a helper function for emitting FR/EFR UL in TW-TS-001 format */
static void send_rtp_twts001(struct gsm_lchan *lchan, uint32_t fn,
- struct msgb *msg, bool good_frame)
+ struct msgb *msg)
{
uint8_t teh;
bool send_frame;
if (msg->len == GSM_FR_BYTES || msg->len == GSM_EFR_BYTES) {
- if (good_frame)
- teh = 0xE0;
- else
- teh = 0xE2;
+ teh = 0xE0 | (tch_ul_msg_bfi(msg) << 1);
send_frame = true;
} else {
teh = 0xE6;
@@ -2272,7 +2269,7 @@
lchan->type == GSM_LCHAN_TCH_F &&
(lchan->tch_mode == GSM48_CMODE_SPEECH_V1 ||
lchan->tch_mode == GSM48_CMODE_SPEECH_EFR)) {
- send_rtp_twts001(lchan, fn, msg, false);
+ send_rtp_twts001(lchan, fn, msg);
return;
}
@@ -2345,10 +2342,31 @@
msgb_pull_to_l2(msg);
/* 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
- * good enough. */
- if (msg->len && tch_ind->lqual_cb >= bts->min_qual_norm) {
+ * the content is not available due to decoding issues. Content not
+ * available is indicated as empty payload, also termed BFI w/o data.
+ * Alternatively, a BTS model can supply channel-decoded payload bits,
+ * but also set BFI flag, just like in TRAU-UL frames on E1 Abis.
+ *
+ * If the channel mode is speech (not CSD), we also check if quality is
+ * good enough - if it isn't, we set BFI. This quality check is
+ * essential with FRv1 codec and DTXu, otherwise DTXu pauses will be
+ * filled with very unpleasant sounds as channel-decoded radio noise
+ * gets declared as good traffic frames with 1/8 probability given
+ * only a 3-bit CRC. However, this check is restricted to speech
+ * because per the specs, BFI does not exist in CSD: every channel-
+ * decoded frame is passed along, error handling either falls on RLP
+ * or is the responsibility of user applications in Transparent mode.
+ */
+ if ((lchan->rsl_cmode == RSL_CMOD_SPD_SPEECH) &&
+ (tch_ind->lqual_cb < bts->min_qual_norm))
+ tch_ul_msg_bfi(msg) = true;
+
+ /* FR/HR/EFR SID classification, with potential effects on BFI flag,
+ * will go here - further patches in the series. */
+
+ /* Good RTP output happens when we got some payload AND it is not
+ * marked as BFI. */
+ if (msg->len && !tch_ul_msg_bfi(msg)) {
/* feed the good frame to the ECU, if we are applying one */
if (lchan->ecu_state)
osmo_ecu_frame_in(lchan->ecu_state, false, msg->data, msg->len);
@@ -2361,7 +2379,7 @@
lchan->tch_mode == GSM48_CMODE_SPEECH_EFR)) {
/* FR and EFR codecs */
if (lchan->abis_ip.rtp_extensions & OSMO_RTP_EXT_TWTS001)
- send_rtp_twts001(lchan, fn, msg, true);
+ send_rtp_twts001(lchan, fn, msg);
else
send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
} else if (lchan->type == GSM_LCHAN_TCH_H &&
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/41047?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I8097946429e83eae90f89e49d17ffb8eb0636fcb
Gerrit-Change-Number: 41047
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/41048?usp=email )
Change subject: FR/HR/EFR: centralize TCH UL SID classification
......................................................................
FR/HR/EFR: centralize TCH UL SID classification
In any environment where GSM MS may exercise DTXu on TCH/FS, TCH/HS or
TCH/EFS, the BTS receiving this TCH UL has to classify each received
traffic frame as valid SID, invalid SID or non-SID speech. For E1 BTS
this SID classification requirement is explicit as there are dedicated
bits in TRAU-UL frames carrying the SID code. For an IP BTS the need
for this classification is less obvious as most RTP payload formats
omit SID indicator bits - however:
* For HR codec, RTP output in RFC 5993 and TW-TS-002 formats does
include explicit SID classification;
* Also for HR output in both TS 101 318 and RFC 5993 formats
(but not TW-TS-002), SID classification must be considered in order
to turn valid SID with some bit errors into perfect SID codeword;
* OsmoBTS already had logic for all 3 of FR/HR/EFR whereby if a frame
is received that is an accepted SID frame in GSM 06.31/06.41/06.81
definition, a flag is set so that the next good speech frame will
be emitted in RTP with marker bit set. This logic implies SID
classification in TCH UL path.
Prior to this patch, OsmoBTS performed limited, non-consolidated
SID classification:
* For FR and EFR, the only SID classification in TCH UL path was done
for RTP marker purposes by way of osmo_{fr,efr}_is_any_sid() Boolean
result fed to lchan_set_marker();
* For the same RTP marker logic with HR codec, only perfect, error-free
SID frames were detected;
* The same limitation applied to SID classification for RFC 5993 output.
Centralize this SID classification by moving it from BTS model to common
l1sap code and unifying it across all 3 codecs. Immediate functional
effects from this change are:
* On TCH/HS we now detect imperfect (partially corrupted) SID frames
and classify them as valid or invalid SID as intended by ETSI,
like we already did for TCH/FS and TCH/EFS;
* When emitting TS 101 318 or RFC 5993, we apply the inherent limitations
of those RTP formats to valid and invalid SID;
* With all 3 codecs, the check for a good speech frame as exit criterion
from DTXu state now happens after the link quality check in l1sap,
rather than before.
AMR speech mode is not affected at all by these changes: AMR DTX model
is completely different from that of FR/HR/EFR.
Related: OS#6036
Change-Id: Id6c8c146962de2f173760889eb232693bb4229d3
---
M include/osmo-bts/msg_utils.h
M src/common/l1sap.c
M src/osmo-bts-lc15/tch.c
M src/osmo-bts-oc2g/tch.c
M src/osmo-bts-sysmo/tch.c
M src/osmo-bts-trx/sched_lchan_tchf.c
M src/osmo-bts-trx/sched_lchan_tchh.c
7 files changed, 123 insertions(+), 50 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/48/41048/1
diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h
index 7363bcf..e82dc44 100644
--- a/include/osmo-bts/msg_utils.h
+++ b/include/osmo-bts/msg_utils.h
@@ -22,6 +22,9 @@
* 2) In TCH UL direction, we provide an ability for BTS models to indicate
* BFI along with payload bits, and the same BFI flag can then be set
* by model-independent functions for higher-level BFI conditions.
+ * Additionally for HRv1 codec, we use a control buffer word to pass
+ * SID classification from the function that makes the initial determination
+ * to TS 101 318, RFC 5993 and TW-TS-002 output functions.
*/
/* Accessor macros for control buffer words in RTP input path */
@@ -37,6 +40,7 @@
/* Accessor macros for control buffer words in TCH UL path */
#define tch_ul_msg_bfi(x) ((x)->cb[0])
+#define tch_ul_msg_sid(x) ((x)->cb[1])
/**
* Classification of OML message. ETSI for plain GSM 12.21
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index f4dea35..8226648 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -2200,24 +2200,6 @@
handle_tch_ind_csd_hr(lchan, tch_ind, data, data_len);
}
-/* a helper function for emitting HR1 UL in RFC 5993 format */
-static void send_rtp_rfc5993(struct gsm_lchan *lchan, uint32_t fn,
- struct msgb *msg)
-{
- uint8_t toc;
-
- OSMO_ASSERT(msg->len == GSM_HR_BYTES);
- /* FIXME: implement proper SID classification per GSM 06.41 section
- * 6.1.1; see OS#6036. Until then, detect error-free SID frames
- * using our existing osmo_hr_check_sid() function. */
- if (osmo_hr_check_sid(msg->data, msg->len))
- toc = 0x20;
- else
- toc = 0x00;
- msgb_push_u8(msg, toc);
- send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
-}
-
/* a helper function for emitting FR/EFR UL in TW-TS-001 format */
static void send_rtp_twts001(struct gsm_lchan *lchan, uint32_t fn,
struct msgb *msg)
@@ -2303,6 +2285,117 @@
lchan->rtp_tx_marker = true;
}
+/* Helper function for l1sap_tch_ind(): RTP output for GSM-HR in either
+ * of the two standard, non-ThemWi-extended payload formats, with restrictions
+ * inherent to these non-TRAU-UL-like formats. */
+static void send_gsmhr_std_rtp(struct gsm_lchan *lchan,
+ const struct gsm_time *g_time, struct msgb *msg,
+ bool emit_rfc5993)
+{
+ uint32_t fn = g_time->fn;
+
+ OSMO_ASSERT(msg->len == GSM_HR_BYTES);
+
+ switch (tch_ul_msg_sid(msg)) {
+ case OSMO_GSM631_SID_CLASS_SPEECH:
+ break;
+ case OSMO_GSM631_SID_CLASS_INVALID:
+ /* neither of these RTP formats allows invalid SID */
+ tch_ul_bfi_handler(lchan, g_time, msg);
+ return;
+ case OSMO_GSM631_SID_CLASS_VALID:
+ /* both formats require perfect, error-free SID output */
+ osmo_hr_sid_reset(msg->data);
+ break;
+ default:
+ OSMO_ASSERT(0);
+ }
+
+ /* Are we emitting "bare" TS 101 318 or "decorated" RFC 5993? */
+ if (emit_rfc5993) {
+ uint8_t toc = tch_ul_msg_sid(msg) << 4;
+ msgb_push_u8(msg, toc);
+ }
+
+ send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
+}
+
+/* Helper function for l1sap_tch_ind(): SID classification and related logic
+ * for FR, HR and EFR speech codecs. */
+static void tch_ul_fr_hr_efr(struct gsm_lchan *lchan, uint32_t fn, struct msgb *msg)
+{
+ enum osmo_gsm631_sid_class sidc;
+
+ /* If we got no payload (BFI without data), there is nothing
+ * for us to do here. */
+ if (msg->len == 0)
+ return;
+
+ /* GSM 06.31, 06.41 and 06.81 are DTX specs for FR, HR and EFR,
+ * respectively. Section 6.1.1 in each of these specs defines a
+ * ternary SID classification whereby each channel-decoded traffic
+ * frame is valid SID, invalid SID or non-SID speech. Perform
+ * this classification. */
+ switch (lchan->tch_mode) {
+ case GSM48_CMODE_SPEECH_V1:
+ if (lchan->type == GSM_LCHAN_TCH_F) {
+ sidc = osmo_fr_sid_classify(msg->data);
+ } else {
+ /* None of our current BTS models has UFI or BCI
+ * error flags for TCH/HS UL Rx, hence we have to
+ * perform SID classification without BCI. */
+ sidc = osmo_hr_sid_classify(msg->data, false, NULL);
+ /* Pass it to RTP output functions */
+ tch_ul_msg_sid(msg) = sidc;
+ }
+ break;
+ case GSM48_CMODE_SPEECH_EFR:
+ sidc = osmo_efr_sid_classify(msg->data);
+ break;
+ default:
+ /* This static function should never be called except for
+ * V1 and EFR speech modes. */
+ OSMO_ASSERT(0);
+ }
+
+ /* We use this SID classification for three purposes:
+ *
+ * 1) For those users who desire to have RTP marker bit set in the
+ * output packet corresponding to the first speech frame after
+ * a DTX pause, the logic of lchan_set_marker() is driven by
+ * the determination of whether or not each received traffic frame
+ * is an accepted SID frame in the definition of GSM 06.31
+ * and its HR & EFR counterparts.
+ *
+ * 2) Next patch in the series will introduce logic that sets BFI
+ * under certain conditions dependent on SID classification and
+ * previous state, in order to suppress false indications of
+ * "valid" SID to the Rx DTX handler on the RTP receiving end
+ * during "half-block" conditions.
+ *
+ * 3) For HR codec only, RTP output format functions need to know
+ * both BFI flag and SID classification.
+ */
+ switch (sidc) {
+ case OSMO_GSM631_SID_CLASS_SPEECH:
+ /* Only a good speech frame, not an unusable frame,
+ * using GSM 06.31 definitions, marks exit from a DTX pause. */
+ if (!tch_ul_msg_bfi(msg))
+ lchan_set_marker(false, lchan);
+ break;
+ case OSMO_GSM631_SID_CLASS_INVALID:
+ case OSMO_GSM631_SID_CLASS_VALID:
+ lchan_set_marker(true, lchan);
+ break;
+ default:
+ /* There are only 3 possible SID classifications per
+ * section 6.1.1 of each of the three DTX specs,
+ * and correspondingly only 3 possible output values
+ * from osmo_*_sid_classify() functions. */
+ OSMO_ASSERT(0);
+ }
+}
+
/* TCH received from bts model */
static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
struct ph_tch_param *tch_ind)
@@ -2361,8 +2454,12 @@
(tch_ind->lqual_cb < bts->min_qual_norm))
tch_ul_msg_bfi(msg) = true;
- /* FR/HR/EFR SID classification, with potential effects on BFI flag,
- * will go here - further patches in the series. */
+ /* For FR, HR or EFR speech we also have to perform SID classification
+ * and apply logic that results from such. This logic can also set
+ * BFI that wasn't set before! */
+ if (lchan->tch_mode == GSM48_CMODE_SPEECH_V1 ||
+ lchan->tch_mode == GSM48_CMODE_SPEECH_EFR)
+ tch_ul_fr_hr_efr(lchan, fn, msg);
/* Good RTP output happens when we got some payload AND it is not
* marked as BFI. */
@@ -2386,10 +2483,8 @@
lchan->tch_mode == GSM48_CMODE_SPEECH_V1) {
/* HR codec: TS 101 318 or RFC 5993,
* will also support TW-TS-002 in the future. */
- if (bts->emit_hr_rfc5993)
- send_rtp_rfc5993(lchan, fn, msg);
- else
- send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
+ send_gsmhr_std_rtp(lchan, &g_time, msg,
+ bts->emit_hr_rfc5993);
} else {
/* generic case, no RTP alterations */
send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
diff --git a/src/osmo-bts-lc15/tch.c b/src/osmo-bts-lc15/tch.c
index afd5b53..048b6d3 100644
--- a/src/osmo-bts-lc15/tch.c
+++ b/src/osmo-bts-lc15/tch.c
@@ -68,8 +68,6 @@
cur = msgb_put(msg, GSM_FR_BYTES);
memcpy(cur, l1_payload, GSM_FR_BYTES);
- lchan_set_marker(osmo_fr_is_any_sid(l1_payload), lchan);
-
return msg;
}
@@ -102,8 +100,6 @@
cur = msgb_put(msg, GSM_EFR_BYTES);
memcpy(cur, l1_payload, GSM_EFR_BYTES);
- lchan_set_marker(osmo_efr_is_any_sid(l1_payload), lchan);
-
return msg;
}
@@ -134,8 +130,6 @@
cur = msgb_put(msg, GSM_HR_BYTES);
memcpy(cur, l1_payload, GSM_HR_BYTES);
- lchan_set_marker(osmo_hr_check_sid(l1_payload, payload_len), lchan);
-
return msg;
}
diff --git a/src/osmo-bts-oc2g/tch.c b/src/osmo-bts-oc2g/tch.c
index 4ea1eb6..c3f0417 100644
--- a/src/osmo-bts-oc2g/tch.c
+++ b/src/osmo-bts-oc2g/tch.c
@@ -68,8 +68,6 @@
cur = msgb_put(msg, GSM_FR_BYTES);
memcpy(cur, l1_payload, GSM_FR_BYTES);
- lchan_set_marker(osmo_fr_is_any_sid(l1_payload), lchan);
-
return msg;
}
@@ -102,8 +100,6 @@
cur = msgb_put(msg, GSM_EFR_BYTES);
memcpy(cur, l1_payload, GSM_EFR_BYTES);
- lchan_set_marker(osmo_efr_is_any_sid(l1_payload), lchan);
-
return msg;
}
@@ -134,8 +130,6 @@
cur = msgb_put(msg, GSM_HR_BYTES);
memcpy(cur, l1_payload, GSM_HR_BYTES);
- lchan_set_marker(osmo_hr_check_sid(l1_payload, payload_len), lchan);
-
return msg;
}
diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c
index 2cf784e..b5bf04b 100644
--- a/src/osmo-bts-sysmo/tch.c
+++ b/src/osmo-bts-sysmo/tch.c
@@ -77,8 +77,6 @@
cur[0] |= 0xD0;
#endif /* USE_L1_RTP_MODE */
- lchan_set_marker(osmo_fr_is_any_sid(l1_payload), lchan);
-
return msg;
}
@@ -132,8 +130,6 @@
cur[0] |= 0xC0;
#endif /* USE_L1_RTP_MODE */
- lchan_set_marker(osmo_efr_is_any_sid(l1_payload), lchan);
-
return msg;
}
@@ -218,8 +214,6 @@
osmo_revbytebits_buf(cur, GSM_HR_BYTES);
#endif /* USE_L1_RTP_MODE */
- lchan_set_marker(osmo_hr_check_sid(l1_payload, payload_len), lchan);
-
return msg;
}
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index 5a3e80a..2403392 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -166,14 +166,10 @@
case GSM48_CMODE_SPEECH_V1: /* FR */
rc = gsm0503_tch_fr_decode(tch_data, BUFTAIL8(bursts_p),
1, 0, &n_errors, &n_bits_total);
- if (rc == GSM_FR_BYTES) /* only for valid *speech* frames */
- lchan_set_marker(osmo_fr_is_any_sid(tch_data), lchan); /* DTXu */
break;
case GSM48_CMODE_SPEECH_EFR: /* EFR */
rc = gsm0503_tch_fr_decode(tch_data, BUFTAIL8(bursts_p),
1, 1, &n_errors, &n_bits_total);
- if (rc == GSM_EFR_BYTES) /* only for valid *speech* frames */
- lchan_set_marker(osmo_efr_is_any_sid(tch_data), lchan); /* DTXu */
break;
case GSM48_CMODE_SPEECH_AMR: /* AMR */
/* the first FN 0,8,17 defines that CMI is included in frame,
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index 01ac155..5d5f246 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -232,10 +232,6 @@
rc = gsm0503_tch_hr_decode2(tch_data, BUFTAIL8(bursts_p),
!sched_tchh_ul_facch_map[bi->fn % 26],
&n_errors, &n_bits_total);
- if (rc == GSM_HR_BYTES) { /* only for valid *speech* frames */
- bool is_sid = osmo_hr_check_sid(tch_data, GSM_HR_BYTES);
- lchan_set_marker(is_sid, lchan); /* DTXu */
- }
break;
case GSM48_CMODE_SPEECH_AMR: /* AMR */
/* the first FN 0,8,17 or 1,9,18 defines that CMI is included
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/41048?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id6c8c146962de2f173760889eb232693bb4229d3
Gerrit-Change-Number: 41048
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/41049?usp=email )
Change subject: FR/HR/EFR: implement SID filter in TCH UL path
......................................................................
FR/HR/EFR: implement SID filter in TCH UL path
As a result of how FR/HR/EFR DTX interacts with block diagonal
interleaving, at the beginning and end of each DTX pause a
correctly functioning TCH receiver will always pick up an
artifact consisting of 4 received bursts (2 for TCH/HS)
and same number of omitted bursts. Standard channel decoding
of this Rx artifact will produce a "half-block" in which half
of the bits prior to convolutional decoding will come from
a SID repetition whose Tx was notionally suppressed, while
the other half will be garbage. As a result of convolutional
decoding, the result will often appear as valid SID per
classification rules - but passing it as such to the Rx DTX
handler is wrong. Classic E1 BTS and GSM MS implementations
include a kind of SID filter at this point, setting BFI on
these received half-blocks, so that the Rx DTX handler will
see an invalid SID condition. Invalid SID means that comfort
noise generation is to be continued, but no updated CN
parameters are available - which is the truth in half-block
Rx situations. Implement the same filter.
Additional background info can be found here:
https://osmocom.org/projects/retro-gsm/wiki/DTXu_half-blocks
Change-Id: I46c62312316b04567bcadf6050597673f071247d
---
M include/osmo-bts/lchan.h
M src/common/l1sap.c
2 files changed, 55 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/49/41049/1
diff --git a/include/osmo-bts/lchan.h b/include/osmo-bts/lchan.h
index 5c34015..70ca5b9 100644
--- a/include/osmo-bts/lchan.h
+++ b/include/osmo-bts/lchan.h
@@ -292,6 +292,8 @@
bool dl_sid_transmitted;
/* The current frame in the DL is taken up by FACCH */
bool dl_facch_stealing;
+ /* UL SID filter to catch DTXu half-blocks */
+ bool ul_sid_filter;
} dtx_fr_hr_efr;
uint8_t last_cmr;
uint32_t last_fn;
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 8226648..e8453b8 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -2326,7 +2326,19 @@
{
enum osmo_gsm631_sid_class sidc;
- /* If we got no payload (BFI without data), there is nothing
+ /* No matter what else is happening, even if we are about to bail out
+ * early because we received FACCH and thus BFI-no-data, if we are
+ * at a mandatory-Tx position for SID, we need to clear UL SID filter
+ * state so that the next valid SID frame will be allowed through,
+ * whether it occurs right now or in a later frame position because
+ * of FACCH. See the note in GSM 06.31 section 5.1.2: if the
+ * SACCH-aligned SID update position is stolen by FACCH, the next
+ * frame position shall carry the SID update as soon as FACCH stealing
+ * is over. */
+ if (fr_hr_efr_sid_position(lchan, fn))
+ lchan->tch.dtx_fr_hr_efr.ul_sid_filter = false;
+
+ /* If we got no payload (BFI without data), there is nothing more
* for us to do here. */
if (msg->len == 0)
return;
@@ -2367,11 +2379,24 @@
* is an accepted SID frame in the definition of GSM 06.31
* and its HR & EFR counterparts.
*
- * 2) Next patch in the series will introduce logic that sets BFI
- * under certain conditions dependent on SID classification and
- * previous state, in order to suppress false indications of
- * "valid" SID to the Rx DTX handler on the RTP receiving end
- * during "half-block" conditions.
+ * 2) As a result of how FR/HR/EFR DTX interacts with block diagonal
+ * interleaving, at the beginning and end of each DTX pause a
+ * correctly functioning TCH receiver will always pick up an
+ * artifact consisting of 4 received bursts (2 for TCH/HS)
+ * and same number of omitted bursts. Standard channel decoding
+ * of this Rx artifact will produce a "half-block" in which half
+ * of the bits prior to convolutional decoding will come from
+ * a SID repetition whose Tx was notionally suppressed, while
+ * the other half will be garbage. As a result of convolutional
+ * decoding, the result will often appear as valid SID per
+ * classification rules - but passing it as such to the Rx DTX
+ * handler is wrong. Classic E1 BTS and GSM MS implementations
+ * include a kind of SID filter at this point, setting BFI on
+ * these received half-blocks, so that the Rx DTX handler will
+ * see an invalid SID condition. Invalid SID means that comfort
+ * noise generation is to be continued, but no updated CN
+ * parameters are available - which is the truth in half-block
+ * Rx situations. We implement the same filter.
*
* 3) For HR codec only, RTP output format functions need to know
* both BFI flag and SID classification.
@@ -2380,12 +2405,32 @@
case OSMO_GSM631_SID_CLASS_SPEECH:
/* Only a good speech frame, not an unusable frame,
* using GSM 06.31 definitions, marks exit from a DTX pause. */
- if (!tch_ul_msg_bfi(msg))
+ if (!tch_ul_msg_bfi(msg)) {
lchan_set_marker(false, lchan);
+ lchan->tch.dtx_fr_hr_efr.ul_sid_filter = false;
+ }
break;
- case OSMO_GSM631_SID_CLASS_INVALID:
case OSMO_GSM631_SID_CLASS_VALID:
+ /* Here comes the just-described SID filter. The logic is
+ * thus: a valid SID is allowed through to the Rx DTX handler
+ * if it follows speech (end of talkspurt), if it appears
+ * in the expected mandatory-Tx position for SID updates,
+ * or if it happens after that mandatory-Tx position due to
+ * FACCH stealing. Otherwise, valid SID is converted to
+ * invalid by setting BFI.
+ */
+ if (lchan->tch.dtx_fr_hr_efr.ul_sid_filter)
+ tch_ul_msg_bfi(msg) = true;
+ /* fall through */
+ case OSMO_GSM631_SID_CLASS_INVALID:
+ /* Whether we got valid or invalid SID, we know that the MS
+ * has entered or remains in a DTXu pause. (Invalid SID
+ * means that MS state is known to be DTXu, but no CN
+ * parameters are available.) Hence we indicate DTXu pause
+ * state for both RTP marker bit and SID filter mechanisms.
+ */
lchan_set_marker(true, lchan);
+ lchan->tch.dtx_fr_hr_efr.ul_sid_filter = true;
break;
default:
/* There are only 3 possible SID classifications per
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/41049?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I46c62312316b04567bcadf6050597673f071247d
Gerrit-Change-Number: 41049
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/41050?usp=email )
Change subject: HRv1 codec: add support for TW-TS-002
......................................................................
HRv1 codec: add support for TW-TS-002
OsmoBTS supports TW-TS-001 enhanced RTP format for FR and EFR codecs
since 2024, providing functional equivalent of GSM 08.60 TRAU-UL
output over IP physical transport. Now do the same with TW-TS-002,
IP equivalent of GSM 08.61 for HRv1 codec.
Only TCH UL path is affected; no changes are needed to TCH DL path
because existing RTP Rx handling for RFC 5993 also covers TW-TS-002.
Related: OS#6036
Change-Id: Icf11e43d4ce9df990d0e0a856d62d9ea11cb837c
---
M src/common/bts.c
M src/common/l1sap.c
2 files changed, 74 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/50/41050/1
diff --git a/src/common/bts.c b/src/common/bts.c
index 282d730..73cb8a6 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -394,6 +394,7 @@
osmo_bts_set_feature(bts->features, BTS_FEAT_IPV6_NSVC);
osmo_bts_set_feature(bts->features, BTS_FEAT_PAGING_COORDINATION);
osmo_bts_set_feature(bts->features, BTS_FEAT_TWTS001);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_TWTS002);
/* Maximum TA supported by the PHY (can be overridden by PHY specific code) */
bts->support.max_ta = MAX_TA_DEF;
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index e8453b8..d8754f6 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -2227,12 +2227,66 @@
}
}
+/* See Section 5.2 of RFC5993 and TW-TS-002 */
+enum super5993_ft {
+ FT_GOOD_SPEECH = 0,
+ FT_INVALID_SID = 1,
+ FT_GOOD_SID = 2,
+ FT_BFI_WITH_DATA = 6,
+ FT_NO_DATA = 7,
+};
+
+/* a helper function for emitting GSM-HR UL in TW-TS-002 format */
+static void send_rtp_twts002(struct gsm_lchan *lchan, uint32_t fn,
+ struct msgb *msg)
+{
+ enum super5993_ft ft;
+ uint8_t toc;
+ bool send_frame;
+
+ if (msg->len == GSM_HR_BYTES) {
+ switch (tch_ul_msg_sid(msg)) {
+ case OSMO_GSM631_SID_CLASS_SPEECH:
+ ft = tch_ul_msg_bfi(msg) ? FT_BFI_WITH_DATA
+ : FT_GOOD_SPEECH;
+ break;
+ case OSMO_GSM631_SID_CLASS_INVALID:
+ ft = FT_INVALID_SID;
+ break;
+ case OSMO_GSM631_SID_CLASS_VALID:
+ ft = tch_ul_msg_bfi(msg) ? FT_INVALID_SID : FT_GOOD_SID;
+ break;
+ default:
+ OSMO_ASSERT(0);
+ }
+ send_frame = true;
+ } else {
+ ft = FT_NO_DATA;
+ send_frame = false;
+ }
+ /* ToC octet of TW-TS-002 is an extension of RFC 5993 */
+ toc = ft << 4;
+ if (ft == FT_INVALID_SID)
+ toc |= 0x04; /* TW-TS-002 version 1.2.0 */
+ /* always set DTXd and TAF bits */
+ if (lchan->ts->trx->bts->dtxd)
+ toc |= 0x08;
+ if (fr_hr_efr_sid_position(lchan, fn))
+ toc |= 0x01;
+ if (send_frame) {
+ msgb_push_u8(msg, toc);
+ send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
+ } else {
+ send_ul_rtp_packet(lchan, fn, &toc, 1);
+ }
+}
+
/* A helper function for l1sap_tch_ind(): handling BFI
*
* Please note that the msgb passed to this function is used only when
- * the CN asked the BSS to emit extended RTP formats (currently TW-TS-001,
- * later TW-TS-002 as well) that can indicate BFI along with deemed-bad
- * frame data bits, just like GSM 08.60 and 08.61 TRAU-UL frames.
+ * the CN asked the BSS to emit extended RTP formats of TW-TS-001 or
+ * TW-TS-002 that can indicate BFI along with deemed-bad frame data bits,
+ * just like GSM 08.60 and 08.61 TRAU-UL frames.
*/
static void tch_ul_bfi_handler(struct gsm_lchan *lchan,
const struct gsm_time *g_time, struct msgb *msg)
@@ -2255,6 +2309,14 @@
return;
}
+ /* Ditto for TCH/HS and TW-TS-002. */
+ if ((lchan->abis_ip.rtp_extensions & OSMO_RTP_EXT_TWTS002) &&
+ lchan->type == GSM_LCHAN_TCH_H &&
+ lchan->tch_mode == GSM48_CMODE_SPEECH_V1) {
+ send_rtp_twts002(lchan, fn, msg);
+ return;
+ }
+
/* Are we applying an ECU to this uplink, and are we in a state
* (not DTX pause) where we emit ECU output? */
if (lchan->ecu_state && !osmo_ecu_is_dtx_pause(lchan->ecu_state)) {
@@ -2526,10 +2588,14 @@
send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
} else if (lchan->type == GSM_LCHAN_TCH_H &&
lchan->tch_mode == GSM48_CMODE_SPEECH_V1) {
- /* HR codec: TS 101 318 or RFC 5993,
- * will also support TW-TS-002 in the future. */
- send_gsmhr_std_rtp(lchan, &g_time, msg,
- bts->emit_hr_rfc5993);
+ /* HR codec: TW-TS-002 in ThemWi environment,
+ * or TS 101 318 or RFC 5993 in traditional
+ * 3GPP or Osmocom environments. */
+ if (lchan->abis_ip.rtp_extensions & OSMO_RTP_EXT_TWTS002)
+ send_rtp_twts002(lchan, fn, msg);
+ else
+ send_gsmhr_std_rtp(lchan, &g_time, msg,
+ bts->emit_hr_rfc5993);
} else {
/* generic case, no RTP alterations */
send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/41050?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Icf11e43d4ce9df990d0e0a856d62d9ea11cb837c
Gerrit-Change-Number: 41050
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>