fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/27758 )
Change subject: osmo-bts-trx: use C/I in the AMR link adaptation loop
......................................................................
Patch Set 4:
This change is ready for review.
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/27758
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ide84bf864f56020c0265cfb9731615d4f7bad7f5
Gerrit-Change-Number: 27758
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 13 Apr 2022 23:00:03 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/27777 )
Change subject: osmo-bts-trx: amr_loop: trigger the loop unconditionally
......................................................................
osmo-bts-trx: amr_loop: trigger the loop unconditionally
The logic responsible for enabling and disabling the loop appears
to be broken: during my experiments trx_loop_amr_set() was never
called with loop=1. It's not clear what's the motivation behind
this breaker, so I propose to rip it out for now. This patch
finally makes the loop work (confirmed with a TEMS phone).
Change-Id: I09b649973d4269c4082a4fafa493c37825f95a9c
Related: SYS#5917, OS#4984
---
M include/osmo-bts/scheduler.h
M src/osmo-bts-trx/amr_loop.c
M src/osmo-bts-trx/sched_lchan_tchf.c
3 files changed, 1 insertion(+), 30 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/77/27777/1
diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index eab904c..cdfb17f 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -120,7 +120,6 @@
uint8_t dl_ft; /* current downlink FT index */
uint8_t ul_cmr; /* current uplink CMR index */
uint8_t dl_cmr; /* current downlink CMR index */
- uint8_t amr_loop; /* if AMR loop is enabled */
uint8_t amr_last_dtx; /* last received dtx frame type */
/* TCH/H */
diff --git a/src/osmo-bts-trx/amr_loop.c b/src/osmo-bts-trx/amr_loop.c
index 1771d7a..6194beb 100644
--- a/src/osmo-bts-trx/amr_loop.c
+++ b/src/osmo-bts-trx/amr_loop.c
@@ -40,10 +40,6 @@
const uint8_t mi = chan_state->ul_ft; /* mode index 0..3 */
int lqual_cb = meas_set->ci_cb; /* cB (centibel) */
- /* check if loop is enabled */
- if (!chan_state->amr_loop)
- return;
-
/* wait for MS to use the requested codec */
if (mi != chan_state->dl_cmr)
return;
@@ -109,16 +105,3 @@
LOGPLCHAN(lchan, DLOOP, LOGL_DEBUG, "Keeping the current AMR codec "
"mode[%u]=%u\n", mi, cfg->mode[mi].mode);
}
-
-void trx_loop_amr_set(struct l1sched_chan_state *chan_state, int loop)
-{
- if (chan_state->amr_loop == loop)
- return;
- if (!chan_state->amr_loop) {
- /* reset the link quality measurements */
- chan_state->lqual_cb_num = 0;
- chan_state->lqual_cb_sum = 0;
- }
-
- chan_state->amr_loop = loop;
-}
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index fb19dd2..24a8d6d 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -424,7 +424,7 @@
if (!msg_facch && msg_tch) {
int len;
uint8_t cmr_codec;
- int cmr, ft, i;
+ int ft, i;
enum osmo_amr_type ft_codec;
enum osmo_amr_quality bfi;
int8_t sti, cmi;
@@ -456,22 +456,11 @@
LOGL1SB(DL1P, LOGL_ERROR, l1ts, br, "Cannot send invalid AMR payload\n");
goto free_bad_msg;
}
- cmr = -1;
ft = -1;
for (i = 0; i < chan_state->codecs; i++) {
- if (chan_state->codec[i] == cmr_codec)
- cmr = i;
if (chan_state->codec[i] == ft_codec)
ft = i;
}
- if (cmr >= 0) { /* new request */
- chan_state->dl_cmr = cmr;
- /* disable AMR loop */
- trx_loop_amr_set(chan_state, 0);
- } else {
- /* enable AMR loop */
- trx_loop_amr_set(chan_state, 1);
- }
if (ft < 0) {
LOGL1SB(DL1P, LOGL_ERROR, l1ts, br,
"Codec (FT = %d) of RTP frame not in list\n", ft_codec);
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/27777
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I09b649973d4269c4082a4fafa493c37825f95a9c
Gerrit-Change-Number: 27777
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/27778 )
Change subject: osmo-bts-trx: amr_loop: do not miss C/I samples
......................................................................
osmo-bts-trx: amr_loop: do not miss C/I samples
Keep collecting C/I samples even if the MS has not yet applied
previously requested codec mode.
Change-Id: Ieb5473ead7200f652b5d0e339e4e252d6567482d
Related: SYS#5917, OS#4984
---
M src/osmo-bts-trx/amr_loop.c
1 file changed, 4 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/78/27778/1
diff --git a/src/osmo-bts-trx/amr_loop.c b/src/osmo-bts-trx/amr_loop.c
index 6194beb..859f39b 100644
--- a/src/osmo-bts-trx/amr_loop.c
+++ b/src/osmo-bts-trx/amr_loop.c
@@ -40,10 +40,6 @@
const uint8_t mi = chan_state->ul_ft; /* mode index 0..3 */
int lqual_cb = meas_set->ci_cb; /* cB (centibel) */
- /* wait for MS to use the requested codec */
- if (mi != chan_state->dl_cmr)
- return;
-
/* count per-block C/I samples for further averaging */
if (lchan->type == GSM_LCHAN_TCH_H) {
chan_state->lqual_cb_num += 2;
@@ -53,6 +49,10 @@
chan_state->lqual_cb_sum += lqual_cb;
}
+ /* wait for MS to use the requested codec */
+ if (mi != chan_state->dl_cmr)
+ return;
+
/* count frames */
if (chan_state->lqual_cb_num < 48)
return;
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/27778
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ieb5473ead7200f652b5d0e339e4e252d6567482d
Gerrit-Change-Number: 27778
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/27774 )
Change subject: osmo-bts-trx: amr_loop: improve logging in trx_loop_amr_input()
......................................................................
osmo-bts-trx: amr_loop: improve logging in trx_loop_amr_input()
Currently we're logging AMR mode *indexes*, not the actual modes.
Let's make it cleaner for the user by logging both mode and index.
Change-Id: I4feb3a3823799a290a50a48275e45f3331874d1a
Related: SYS#5917, OS#4984
---
M src/osmo-bts-trx/amr_loop.c
1 file changed, 12 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/74/27774/1
diff --git a/src/osmo-bts-trx/amr_loop.c b/src/osmo-bts-trx/amr_loop.c
index 5793d03..90b156c 100644
--- a/src/osmo-bts-trx/amr_loop.c
+++ b/src/osmo-bts-trx/amr_loop.c
@@ -37,6 +37,7 @@
{
const struct gsm_lchan *lchan = chan_state->lchan;
const struct amr_multirate_conf *cfg = &lchan->tch.amr_mr;
+ const uint8_t mi = chan_state->ul_ft; /* mode index 0..3 */
int lqual_cb = meas_set->ci_cb; /* cB (centibel) */
/* check if loop is enabled */
@@ -44,7 +45,7 @@
return;
/* wait for MS to use the requested codec */
- if (chan_state->ul_ft != chan_state->dl_cmr)
+ if (mi != chan_state->dl_cmr)
return;
/* count per-block C/I samples for further averaging */
@@ -64,36 +65,36 @@
lqual_cb = chan_state->lqual_cb_sum / chan_state->lqual_cb_num;
LOGPLCHAN(lchan, DLOOP, LOGL_DEBUG, "AMR link quality (C/I) is %d cB, "
- "codec mode=%d\n", lqual_cb, chan_state->ul_ft);
+ "codec mode[%u]=%u\n", lqual_cb, mi, cfg->mode[mi].mode);
/* reset the link quality measurements */
chan_state->lqual_cb_num = 0;
chan_state->lqual_cb_sum = 0;
- if (chan_state->dl_cmr > 0) {
+ if (mi > 0) {
/* The threshold/hysteresis is in 0.5 dB steps, convert to cB:
* 1dB is 10cB, so 0.5dB is 5cB - this is why we multiply by 5. */
- const int thresh_lower_cb = cfg->mode[chan_state->dl_cmr - 1].threshold * 5;
+ const int thresh_lower_cb = cfg->mode[mi - 1].threshold * 5;
/* Degrade if the link quality is below THR_MX_Dn(i - 1) */
if (lqual_cb < thresh_lower_cb) {
LOGPLCHAN(lchan, DLOOP, LOGL_INFO, "Degrading AMR codec mode: "
- "%d -> %d due to link quality %d cB < THR_MX_Dn=%d cB\n",
- chan_state->dl_cmr, chan_state->dl_cmr - 1,
+ "[%u]=%u -> [%u]=%u due to link quality %d cB < THR_MX_Dn=%d cB\n",
+ mi, cfg->mode[mi].mode, mi - 1, cfg->mode[mi - 1].mode,
lqual_cb, thresh_lower_cb);
chan_state->dl_cmr--;
}
- } else if (chan_state->dl_cmr < chan_state->codecs - 1) {
+ } else if (mi < chan_state->codecs - 1) {
/* The threshold/hysteresis is in 0.5 dB steps, convert to cB:
* 1dB is 10cB, so 0.5dB is 5cB - this is why we multiply by 5. */
- const int thresh_upper_cb = cfg->mode[chan_state->dl_cmr].threshold * 5 \
- + cfg->mode[chan_state->dl_cmr].hysteresis * 5;
+ const int thresh_upper_cb = cfg->mode[mi].threshold * 5 \
+ + cfg->mode[mi].hysteresis * 5;
/* Upgrade if the link quality is above THR_MX_Up(i) */
if (lqual_cb > thresh_upper_cb) {
LOGPLCHAN(lchan, DLOOP, LOGL_INFO, "Upgrading AMR codec mode: "
- "%d -> %d due to link quality %d cB > THR_MX_Up=%d cB\n",
- chan_state->dl_cmr, chan_state->dl_cmr + 1,
+ "[%u]=%u -> [%u]=%u due to link quality %d cB > THR_MX_Up=%d cB\n",
+ mi, cfg->mode[mi].mode, mi + 1, cfg->mode[mi + 1].mode,
lqual_cb, thresh_upper_cb);
chan_state->dl_cmr++;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/27774
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I4feb3a3823799a290a50a48275e45f3331874d1a
Gerrit-Change-Number: 27774
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/27775 )
Change subject: osmo-bts-trx: amr_loop: allow upgrading codec mode > 0
......................................................................
osmo-bts-trx: amr_loop: allow upgrading codec mode > 0
With the current implementation the AMR loop is unable to upgrade
the current codec mode unless it reaches the worst possible value.
The problem is in the 'else' statement connection both 'if's.
Change-Id: I4c0fb28813373c3d4addd28c66f5136d2c4f9ed8
Related: SYS#5917, OS#4984
---
M src/osmo-bts-trx/amr_loop.c
1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/75/27775/1
diff --git a/src/osmo-bts-trx/amr_loop.c b/src/osmo-bts-trx/amr_loop.c
index 90b156c..6afb5f3 100644
--- a/src/osmo-bts-trx/amr_loop.c
+++ b/src/osmo-bts-trx/amr_loop.c
@@ -71,6 +71,7 @@
chan_state->lqual_cb_num = 0;
chan_state->lqual_cb_sum = 0;
+ /* If the current codec mode can be degraded */
if (mi > 0) {
/* The threshold/hysteresis is in 0.5 dB steps, convert to cB:
* 1dB is 10cB, so 0.5dB is 5cB - this is why we multiply by 5. */
@@ -83,8 +84,12 @@
mi, cfg->mode[mi].mode, mi - 1, cfg->mode[mi - 1].mode,
lqual_cb, thresh_lower_cb);
chan_state->dl_cmr--;
+ return;
}
- } else if (mi < chan_state->codecs - 1) {
+ }
+
+ /* If the current codec mode can be upgraded */
+ if (mi < chan_state->codecs - 1) {
/* The threshold/hysteresis is in 0.5 dB steps, convert to cB:
* 1dB is 10cB, so 0.5dB is 5cB - this is why we multiply by 5. */
const int thresh_upper_cb = cfg->mode[mi].threshold * 5 \
@@ -97,6 +102,7 @@
mi, cfg->mode[mi].mode, mi + 1, cfg->mode[mi + 1].mode,
lqual_cb, thresh_upper_cb);
chan_state->dl_cmr++;
+ return;
}
}
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/27775
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I4c0fb28813373c3d4addd28c66f5136d2c4f9ed8
Gerrit-Change-Number: 27775
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange