fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/34992?usp=email )


Change subject: osmo-bts-trx: tx_tch[fh]_fn(): fix sending idle CSD frames
......................................................................

osmo-bts-trx: tx_tch[fh]_fn(): fix sending idle CSD frames

In accordance with 3GPP TS 44.021, sections 8.1.6 and 10.2.3, the
transmission of idle frames to the DTE is mandated when no data is
received from the radio interface.  An idle frame has all data,
status, and E-bits to binary '1' (excluding the alignment pattern).
This requirement is currently implemented for the Uplink, see
function csd_v110_rtp_encode().

However, 3GPP TS 44.021 does not explicitly specify whether the same
rule is applicable to the Downlink, perhaps assuming a continuous
stream of bits on the CSD-over-TDM link.  Currently, we transmit
a sequence of binary '0' on the Downlink instead of idle frames.

* In non-transparent (RLP) mode, whether all bits in a block are
  set to binary '0' or '1' has no impact, as both scenarios lead
  to an incorrect FCS.
* In transparent sync mode, any filling be it binary '0' or '1'
  is perceived as incorrect or unexpected.
* In transparent async mode, it is more logical to transmit a
  sequence of binary '1,' which will be interpreted as
  a sequence of stop bits.

Let's align the Downlink with the Uplink for consistency and transmit
idle frames when no data is available for transmission.  The modified
60-bit V.110 frames exclude the alignment pattern, so sending a
sequence of binary '1' is enough to achieve the intended goal.

Change-Id: I0b25cfac41b6d8dcf3bfd9d46d51a9665f1b047a
Related: OS#1572
---
M src/osmo-bts-trx/sched_lchan_tchf.c
M src/osmo-bts-trx/sched_lchan_tchh.c
2 files changed, 80 insertions(+), 20 deletions(-)



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

diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c 
b/src/osmo-bts-trx/sched_lchan_tchf.c
index c0dfd47..0138a2a 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -535,16 +535,25 @@
                int rc;

                LOGL1SB(DL1P, LOGL_DEBUG, l1ts, br, "No TCH or FACCH prim for 
transmit.\n");
-               /* If the channel mode is TCH/FS or TCH/EFS, transmit a dummy
-                * speech block with inverted CRC3, designed to induce a BFI
-                * condition in the MS receiver.  In all other channel modes,
-                * transmit dummy FACCH like we always did before.
+               /* - If the channel mode is TCH/FS or TCH/EFS, transmit a dummy
+                *   speech block with inverted CRC3, designed to induce a BFI
+                *   condition in the MS receiver.
+                * - If the channel mode is one of the CSD modes, transmit an
+                *   idle frame as described in 3GPP TS 44.021, sections 8.1.6
+                *   and 10.2.3 (all data, status and E-bits set to binary '1').
+                * - In all other channel modes, transmit dummy FACCH
+                *   like we always did before.
                 *
                 * FIXME: someone who knows AMR needs to look at this problem
                 * and decide what is the correct BTS Tx behavior for frame
                 * gaps in TCH/AFS.  See OS#6049.
                 */
                switch (tch_mode) {
+               case GSM48_CMODE_DATA_12k0:
+               case GSM48_CMODE_DATA_6k0:
+               case GSM48_CMODE_DATA_3k6:
+               case GSM48_CMODE_DATA_14k5:
+                       break; /* see below */
                case GSM48_CMODE_SPEECH_V1:
                case GSM48_CMODE_SPEECH_EFR:
                        rc = gsm0503_tch_fr_encode(BUFPOS(bursts_p, 0), NULL, 
0, 1);
@@ -591,30 +600,36 @@
                break;
        /* CSD (TCH/F9.6): 12.0 kbit/s radio interface rate */
        case GSM48_CMODE_DATA_12k0:
-               if (msg_tch != NULL)
-                       gsm0503_tch_fr96_encode(BUFPOS(bursts_p, 0), 
msgb_l2(msg_tch));
+               if (msg_tch == NULL)
+                       msg_tch = tch_dummy_msgb(4 * 60, 0x01);
+               gsm0503_tch_fr96_encode(BUFPOS(bursts_p, 0), msgb_l2(msg_tch));
                if (msg_facch != NULL)
                        gsm0503_tch_fr_facch_encode(BUFPOS(bursts_p, 0), 
msgb_l2(msg_facch));
                break;
        /* CSD (TCH/F4.8): 6.0 kbit/s radio interface rate */
        case GSM48_CMODE_DATA_6k0:
-               if (msg_tch != NULL)
-                       gsm0503_tch_fr48_encode(BUFPOS(bursts_p, 0), 
msgb_l2(msg_tch));
+               if (msg_tch == NULL)
+                       msg_tch = tch_dummy_msgb(2 * 60, 0x01);
+               gsm0503_tch_fr48_encode(BUFPOS(bursts_p, 0), msgb_l2(msg_tch));
                if (msg_facch != NULL)
                        gsm0503_tch_fr_facch_encode(BUFPOS(bursts_p, 0), 
msgb_l2(msg_facch));
                break;
        /* CSD (TCH/F2.4): 3.6 kbit/s radio interface rate */
        case GSM48_CMODE_DATA_3k6:
                /* FACCH/F does steal a TCH/F2.4 frame completely */
-               if (msg == msg_facch)
+               if (msg_facch != NULL) {
                        gsm0503_tch_fr_facch_encode(BUFPOS(bursts_p, 0), 
msgb_l2(msg_facch));
-               else
+               } else {
+                       if (msg_tch == NULL)
+                               msg_tch = tch_dummy_msgb(2 * 36, 0x01);
                        gsm0503_tch_fr24_encode(BUFPOS(bursts_p, 0), 
msgb_l2(msg_tch));
+               }
                break;
        /* CSD (TCH/F14.4): 14.5 kbit/s radio interface rate */
        case GSM48_CMODE_DATA_14k5:
-               if (msg_tch != NULL)
-                       gsm0503_tch_fr144_encode(BUFPOS(bursts_p, 0), 
msgb_l2(msg_tch));
+               if (msg_tch == NULL)
+                       msg_tch = tch_dummy_msgb(290, 0x01);
+               gsm0503_tch_fr144_encode(BUFPOS(bursts_p, 0), msgb_l2(msg_tch));
                if (msg_facch != NULL)
                        gsm0503_tch_fr_facch_encode(BUFPOS(bursts_p, 0), 
msgb_l2(msg_facch));
                break;
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c 
b/src/osmo-bts-trx/sched_lchan_tchh.c
index 96ee5e8..e0d7aca 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -450,16 +450,23 @@
                int rc;

                LOGL1SB(DL1P, LOGL_INFO, l1ts, br, "No TCH or FACCH prim for 
transmit.\n");
-               /* If the channel mode is TCH/HS, transmit a dummy speech block
-                * with inverted CRC3, designed to induce a BFI condition in
-                * the MS receiver.  In all other channel modes, transmit
-                * dummy FACCH like we always did before.
+               /* - If the channel mode is TCH/HS, transmit a dummy speech 
block
+                *   with inverted CRC3, designed to induce a BFI condition in
+                *   the MS receiver.
+                * - If the channel mode is one of the CSD modes, transmit an
+                *   idle frame as described in 3GPP TS 44.021, sections 8.1.6
+                *   and 10.2.3 (all data, status and E-bits set to binary '1').
+                * - In all other channel modes, transmit dummy FACCH
+                *   like we always did before.
                 *
                 * FIXME: someone who knows AMR needs to look at this problem
                 * and decide what is the correct BTS Tx behavior for frame
                 * gaps in TCH/AHS.  See OS#6049.
                 */
                switch (tch_mode) {
+               case GSM48_CMODE_DATA_6k0:
+               case GSM48_CMODE_DATA_3k6:
+                       break; /* see below */
                case GSM48_CMODE_SPEECH_V1:
                        rc = gsm0503_tch_hr_encode(BUFPOS(bursts_p, 0), NULL, 
0);
                        if (rc == 0)
@@ -515,15 +522,17 @@
                break;
        /* CSD (TCH/H4.8): 6.0 kbit/s radio interface rate */
        case GSM48_CMODE_DATA_6k0:
-               if (msg_tch != NULL)
-                       gsm0503_tch_hr48_encode(BUFPOS(bursts_p, 0), 
msgb_l2(msg_tch));
+               if (msg_tch == NULL)
+                       msg_tch = tch_dummy_msgb(4 * 60, 0x01);
+               gsm0503_tch_hr48_encode(BUFPOS(bursts_p, 0), msgb_l2(msg_tch));
                if (msg_facch != NULL)
                        gsm0503_tch_hr_facch_encode(BUFPOS(bursts_p, 0), 
msgb_l2(msg_facch));
                break;
        /* CSD (TCH/H2.4): 3.6 kbit/s radio interface rate */
        case GSM48_CMODE_DATA_3k6:
-               if (msg_tch != NULL)
-                       gsm0503_tch_hr24_encode(BUFPOS(bursts_p, 0), 
msgb_l2(msg_tch));
+               if (msg_tch == NULL)
+                       msg_tch = tch_dummy_msgb(4 * 36, 0x01);
+               gsm0503_tch_hr24_encode(BUFPOS(bursts_p, 0), msgb_l2(msg_tch));
                if (msg_facch != NULL)
                        gsm0503_tch_hr_facch_encode(BUFPOS(bursts_p, 0), 
msgb_l2(msg_facch));
                break;

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I0b25cfac41b6d8dcf3bfd9d46d51a9665f1b047a
Gerrit-Change-Number: 34992
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanits...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to