aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-07-15 12:47:29 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-07-15 12:54:06 +0200
commit71b4f94601cbd1aa97729be2d789d21d20aea706 (patch)
tree3b384f67c812fcd45438cd6d81abc8c08aefe19d
parentbe32e935138b9fb340432317a3b5124474b9bddf (diff)
cosmetic: Small improvements to _select_sdcch_for_call
This commit improves some cosmetic and logical aspects from recent commit (see "Fixes" below). * Fix typo s/free_tcch/free_tchh/" * Improve some comments Fixes: fdb87343d7a747575fae0bb436cd9d105b9748e9 Change-Id: Id6217c929068b0182cb2d4a9922bfbf544c8c75d
-rw-r--r--src/osmo-bsc/abis_rsl.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index b41fe7932..42d77b35d 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -1915,10 +1915,9 @@ static bool force_free_lchan_for_emergency(struct chan_rqd *rqd)
struct gsm_lchan *_select_sdcch_for_call(struct gsm_bts *bts, const struct chan_rqd *rqd, enum gsm_chan_t lctype)
{
struct gsm_lchan *lchan = NULL;
- int free_tchf, free_tcch;
+ int free_tchf, free_tchh;
bool needs_dyn_switch;
-
lchan = lchan_avail_by_type(bts, GSM_LCHAN_SDCCH, false);
if (!lchan)
return NULL;
@@ -1927,20 +1926,21 @@ struct gsm_lchan *_select_sdcch_for_call(struct gsm_bts *bts, const struct chan_
lchan->ts->pchan_is != GSM_PCHAN_SDCCH8_SACCH8C;
free_tchf = bts_count_free_ts(bts, GSM_PCHAN_TCH_F);
- free_tcch = bts_count_free_ts(bts, GSM_PCHAN_TCH_H);
- if (free_tchf == 0 && free_tcch == 0) {
+ free_tchh = bts_count_free_ts(bts, GSM_PCHAN_TCH_H);
+ if (free_tchf == 0 && free_tchh == 0) {
LOG_BTS(bts, DRSL, LOGL_INFO,
"CHAN RQD: 0x%x Requesting %s reason=call but no TCH available\n",
rqd->ref.ra, gsm_lchant_name(lctype));
return NULL;
}
- /* There's a TCH available and we'll not switch any of them, so we are fine */
+ /* There's a TCH available and we'll not switch any dyn ts, so we are
+ * fine (we can switch one of them to SDCCH8 and still have one left) */
if (!needs_dyn_switch)
goto select_lchan;
/* We need to switch, but there's at least 2 TCH TS available so we are fine: */
- if (free_tchf > 1 || free_tcch > 2)
+ if (free_tchf > 1 || free_tchh > 2)
goto select_lchan;
/* At this point (needs_dyn_switch==true), following cases are possible:
@@ -1948,13 +1948,14 @@ struct gsm_lchan *_select_sdcch_for_call(struct gsm_bts *bts, const struct chan_
* [B] H=1, F=0
* [B] H=1, F=1
* [C] H=2, F=1
- * If condition [C] is met, it means there's 1 dynamic TS and it's the
- * same as the dynamic TS available for SDCCH requiring switch, so selecting
- * it would basically leave us without free TCH, so avoid selecting it.
- * Regarding the other conditions, it basically results in them being
- * different TS than the one we want to switch, so we are fine selecting
- * the TS for SDCCH */
- if (free_tchf == 1 && free_tcch == 2) {
+ * If condition [C] is met, it means there's 1 dynamic TS (because a dyn
+ * TS is counted both as 1 free TCH/F and 2 free TCH/H at the same time)
+ * and it's the same as the dynamic TS available for SDCCH requiring
+ * switch, so selecting it would basically leave us without free TCH, so
+ * avoid selecting it. Regarding the other conditions, it basically
+ * results in them being different TS than the one we want to switch, so
+ * we are fine selecting the TS for SDCCH */
+ if (free_tchf == 1 && free_tchh == 2) {
LOG_BTS(bts, DRSL, LOGL_INFO,
"CHAN RQD: 0x%x Requesting %s reason=call but dyn TS switch to "
"SDCCH would starve the single available TCH timeslot\n",