Change in osmo-bsc[master]: cosmetic: Small improvements to _select_sdcch_for_call

pespin gerrit-no-reply at lists.osmocom.org
Thu Jul 15 19:42:40 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24947 )

Change subject: cosmetic: Small improvements to _select_sdcch_for_call
......................................................................

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
---
M src/osmo-bsc/abis_rsl.c
1 file changed, 14 insertions(+), 13 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  daniel: Looks good to me, approved



diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index b41fe79..42d77b3 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -1915,10 +1915,9 @@
 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 @@
 					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 @@
 	 * [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",

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/24947
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Id6217c929068b0182cb2d4a9922bfbf544c8c75d
Gerrit-Change-Number: 24947
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210715/51783aa4/attachment.htm>


More information about the gerrit-log mailing list