[MERGED] osmo-pcu[master]: Simplify TS alloc: internalize TRX check

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Wed Jan 31 12:52:18 UTC 2018


Max has submitted this change and it was merged.

Change subject: Simplify TS alloc: internalize TRX check
......................................................................


Simplify TS alloc: internalize TRX check

Move TRX check inside local tfi_find_free() wrapper to make main
algorithm easier to follow.

Change-Id: I02da2b8ba8c9c8815dae0e39e1fed277ca0df171
Related: OS#2282
---
M src/gprs_rlcmac_ts_alloc.cpp
1 file changed, 10 insertions(+), 11 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index e394a6e..c45aa39 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -329,7 +329,7 @@
 /*! Return free TFI
  *
  *  \param[in] bts Pointer to BTS struct
- *  \param[in] trx Pointer to TRX struct
+ *  \param[in] trx Optional pointer to TRX struct
  *  \param[in] ms Pointer to MS object
  *  \param[in] dir DL or UL direction
  *  \param[in] use_trx which TRX to use or -1 if it should be selected based on what MS uses
@@ -341,6 +341,15 @@
 {
 	int tfi;
 	uint8_t trx_no;
+
+	if (trx) {
+		if (use_trx >= 0 && use_trx != trx->trx_no) {
+			LOGP(DRLCMAC, LOGL_ERROR, "- Requested incompatible TRX %d (current is %d)\n",
+			     use_trx, trx->trx_no);
+			return -EINVAL;
+		}
+		use_trx = trx->trx_no;
+	}
 
 	if (use_trx == -1 && ms->current_trx())
 		use_trx = ms->current_trx()->trx_no;
@@ -785,16 +794,6 @@
 	ul_slots = ms->reserved_ul_slots();
 	first_common_ts = ms->first_common_ts();
 	trx = ms->current_trx();
-
-	if (trx) {
-		if (use_trx >= 0 && use_trx != trx->trx_no) {
-			LOGP(DRLCMAC, LOGL_ERROR,
-				"- Requested incompatible TRX %d (current is %d)\n",
-				use_trx, trx->trx_no);
-			return -EINVAL;
-		}
-		use_trx = trx->trx_no;
-	}
 
 	/* Step 2a: Find usable TRX and TFI */
 	tfi = tfi_find_free(bts->bts, trx, ms, tbf->direction, use_trx, &trx_no);

-- 
To view, visit https://gerrit.osmocom.org/3760
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I02da2b8ba8c9c8815dae0e39e1fed277ca0df171
Gerrit-PatchSet: 22
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list