<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bts/+/17221">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">dtx: add detection of AMR DTX frames<br><br>Currently we do not detect any of the DTX frames (SID_FIRST, SID_UPDATE<br>etc.) Detecting and tagging those frames as is_sub is important for<br>measurement processing. Also the RTP marker bit must be set on each<br>ONSET frame.<br><br> - Add detection of DTX frames<br> - Tag DTX frames as is_sub<br> - Set RTP marker bit when ONSET frames are received<br><br>Change-Id: I5afe730fff2fa3199a5913b0de4f5c7b23a39f31<br>Related: OS#2978<br>---<br>M include/osmo-bts/scheduler_backend.h<br>M src/common/scheduler.c<br>M src/osmo-bts-trx/scheduler_trx.c<br>3 files changed, 37 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/21/17221/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmo-bts/scheduler_backend.h b/include/osmo-bts/scheduler_backend.h</span><br><span>index aa2d6e9..bdb5224 100644</span><br><span>--- a/include/osmo-bts/scheduler_backend.h</span><br><span>+++ b/include/osmo-bts/scheduler_backend.h</span><br><span>@@ -55,7 +55,8 @@</span><br><span> </span><br><span> int _sched_compose_tch_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,</span><br><span>                     enum trx_chan_type chan, uint8_t *tch, uint8_t tch_len,</span><br><span style="color: hsl(0, 100%, 40%);">-                         int16_t ta_offs_256bits, uint16_t ber10k, float rssi);</span><br><span style="color: hsl(120, 100%, 40%);">+                        int16_t ta_offs_256bits, uint16_t ber10k, float rssi,</span><br><span style="color: hsl(120, 100%, 40%);">+                         uint8_t is_sub);</span><br><span> </span><br><span> ubit_t *tx_idle_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,</span><br><span>      enum trx_chan_type chan, uint8_t bid, uint16_t *nbits);</span><br><span>diff --git a/src/common/scheduler.c b/src/common/scheduler.c</span><br><span>index e8df537..20c665a 100644</span><br><span>--- a/src/common/scheduler.c</span><br><span>+++ b/src/common/scheduler.c</span><br><span>@@ -754,7 +754,8 @@</span><br><span> </span><br><span> int _sched_compose_tch_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,</span><br><span>                          enum trx_chan_type chan, uint8_t *tch, uint8_t tch_len,</span><br><span style="color: hsl(0, 100%, 40%);">-                         int16_t ta_offs_256bits, uint16_t ber10k, float rssi)</span><br><span style="color: hsl(120, 100%, 40%);">+                         int16_t ta_offs_256bits, uint16_t ber10k, float rssi,</span><br><span style="color: hsl(120, 100%, 40%);">+                         uint8_t is_sub)</span><br><span> {</span><br><span>      struct msgb *msg;</span><br><span>    struct osmo_phsap_prim *l1sap;</span><br><span>@@ -773,6 +774,7 @@</span><br><span>         l1sap->u.tch.rssi = (int8_t) (rssi);</span><br><span>      l1sap->u.tch.ber10k = ber10k;</span><br><span>     l1sap->u.tch.ta_offs_256bits = ta_offs_256bits;</span><br><span style="color: hsl(120, 100%, 40%);">+    l1sap->u.tch.is_sub = is_sub & 1;</span><br><span> </span><br><span>         msg->l2h = msgb_put(msg, tch_len);</span><br><span>        if (tch_len)</span><br><span>diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c</span><br><span>index 5abb73b..5bf8cff 100644</span><br><span>--- a/src/osmo-bts-trx/scheduler_trx.c</span><br><span>+++ b/src/osmo-bts-trx/scheduler_trx.c</span><br><span>@@ -37,6 +37,8 @@</span><br><span> #include <osmocom/core/bits.h></span><br><span> #include <osmocom/gsm/a5.h></span><br><span> #include <osmocom/coding/gsm0503_coding.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <osmocom/coding/gsm0503_amr_dtx.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> </span><br><span> #include <osmo-bts/gsm_data.h></span><br><span> #include <osmo-bts/logging.h></span><br><span>@@ -400,7 +402,7 @@</span><br><span> </span><br><span>                     /* Note: RSSI is set to 0 to indicate to the higher</span><br><span>                   * layers that this is a faked tch_ind */</span><br><span style="color: hsl(0, 100%, 40%);">-                       _sched_compose_tch_ind(l1t, tn, fn, chan, tch_data, len, toa256, 10000, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+                   _sched_compose_tch_ind(l1t, tn, fn, chan, tch_data, len, toa256, 10000, 0, 0);</span><br><span>               }</span><br><span>    }</span><br><span> </span><br><span>@@ -1138,6 +1140,8 @@</span><br><span>                get_lchan_by_chan_nr(l1t->trx, trx_chan_desc[chan].chan_nr | bi->tn);</span><br><span>  unsigned int fn_begin;</span><br><span>       uint16_t ber10k;</span><br><span style="color: hsl(120, 100%, 40%);">+      uint8_t amr_dtx;</span><br><span style="color: hsl(120, 100%, 40%);">+      uint8_t is_sub = 0;</span><br><span> </span><br><span>      /* handle rach, if handover rach detection is turned on */</span><br><span>   if (chan_state->ho_rach_detect == 1)</span><br><span>@@ -1197,10 +1201,19 @@</span><br><span>             * the first FN 4,13,21 defines that CMR is included in frame.</span><br><span>                * NOTE: A frame ends 7 FN after start.</span><br><span>               */</span><br><span style="color: hsl(0, 100%, 40%);">-             rc = gsm0503_tch_afs_decode(tch_data + 2, *bursts_p,</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                memset(tch_data, 0, sizeof(tch_data));</span><br><span style="color: hsl(120, 100%, 40%);">+                </span><br><span style="color: hsl(120, 100%, 40%);">+              rc = gsm0503_tch_afs_decode_dtx(tch_data + 2, *bursts_p,</span><br><span>                     (((bi->fn + 26 - 7) % 26) >> 2) & 1, chan_state->codec,</span><br><span>                      chan_state->codecs, &chan_state->ul_ft,</span><br><span style="color: hsl(0, 100%, 40%);">-                       &chan_state->ul_cmr, &n_errors, &n_bits_total);</span><br><span style="color: hsl(120, 100%, 40%);">+                        &chan_state->ul_cmr, &n_errors, &n_bits_total, &amr_dtx);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                if (amr_dtx != AMR_OTHER)</span><br><span style="color: hsl(120, 100%, 40%);">+                     is_sub = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+           if (amr_dtx == AFS_ONSET)</span><br><span style="color: hsl(120, 100%, 40%);">+                     lchan->rtp_tx_marker = true;</span><br><span style="color: hsl(120, 100%, 40%);">+               </span><br><span>             if (rc)</span><br><span>                      trx_loop_amr_input(l1t,</span><br><span>                              trx_chan_desc[chan].chan_nr | bi->tn, chan_state,</span><br><span>@@ -1305,7 +1318,7 @@</span><br><span> compose_l1sap:</span><br><span>       fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_TCH_F);</span><br><span>      return _sched_compose_tch_ind(l1t, bi->tn, fn_begin, chan,</span><br><span style="color: hsl(0, 100%, 40%);">-                                 tch_data, rc, bi->toa256, ber10k, bi->rssi);</span><br><span style="color: hsl(120, 100%, 40%);">+                                    tch_data, rc, bi->toa256, ber10k, bi->rssi, is_sub);</span><br><span> }</span><br><span> </span><br><span> /*! \brief a single TCH/H burst was received by the PHY, process it */</span><br><span>@@ -1333,6 +1346,8 @@</span><br><span>  int fn_is_odd = (((bi->fn + 26 - 10) % 26) >> 2) & 1;</span><br><span>   unsigned int fn_begin;</span><br><span>       uint16_t ber10k;</span><br><span style="color: hsl(120, 100%, 40%);">+      uint8_t amr_dtx;</span><br><span style="color: hsl(120, 100%, 40%);">+      uint8_t is_sub = 0;</span><br><span> </span><br><span>      /* handle RACH, if handover RACH detection is turned on */</span><br><span>   if (chan_state->ho_rach_detect == 1)</span><br><span>@@ -1404,10 +1419,20 @@</span><br><span>             * in frame, the first FN 4,13,21 or 5,14,22 defines that CMR</span><br><span>                 * is included in frame.</span><br><span>              */</span><br><span style="color: hsl(0, 100%, 40%);">-             rc = gsm0503_tch_ahs_decode(tch_data + 2, *bursts_p,</span><br><span style="color: hsl(120, 100%, 40%);">+          rc = gsm0503_tch_ahs_decode_dtx(tch_data + 2, *bursts_p,</span><br><span>                     fn_is_odd, fn_is_odd, chan_state->codec,</span><br><span>                  chan_state->codecs, &chan_state->ul_ft,</span><br><span style="color: hsl(0, 100%, 40%);">-                       &chan_state->ul_cmr, &n_errors, &n_bits_total);</span><br><span style="color: hsl(120, 100%, 40%);">+                        &chan_state->ul_cmr, &n_errors, &n_bits_total, &amr_dtx);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                if (amr_dtx != AMR_OTHER)</span><br><span style="color: hsl(120, 100%, 40%);">+                     is_sub = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+           if (amr_dtx == AHS_ONSET)</span><br><span style="color: hsl(120, 100%, 40%);">+                     lchan->rtp_tx_marker = true;</span><br><span style="color: hsl(120, 100%, 40%);">+               else if (amr_dtx == AHS_SID_FIRST_INH)</span><br><span style="color: hsl(120, 100%, 40%);">+                        lchan->rtp_tx_marker = true;</span><br><span style="color: hsl(120, 100%, 40%);">+               else if (amr_dtx == AHS_SID_UPDATE_INH)</span><br><span style="color: hsl(120, 100%, 40%);">+                       lchan->rtp_tx_marker = true;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>            if (rc)</span><br><span>                      trx_loop_amr_input(l1t,</span><br><span>                              trx_chan_desc[chan].chan_nr | bi->tn, chan_state,</span><br><span>@@ -1522,7 +1547,7 @@</span><br><span>         else</span><br><span>                 fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_TCH_H1);</span><br><span>     return _sched_compose_tch_ind(l1t, bi->tn, fn_begin, chan,</span><br><span style="color: hsl(0, 100%, 40%);">-                                 tch_data, rc, bi->toa256, ber10k, bi->rssi);</span><br><span style="color: hsl(120, 100%, 40%);">+                                    tch_data, rc, bi->toa256, ber10k, bi->rssi, is_sub);</span><br><span> }</span><br><span> </span><br><span> /* schedule all frames of all TRX for given FN */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bts/+/17221">change 17221</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bts/+/17221"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I5afe730fff2fa3199a5913b0de4f5c7b23a39f31 </div>
<div style="display:none"> Gerrit-Change-Number: 17221 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>