[PATCH] osmo-pcu[master]: Simplify TS alloc: improve readability

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
Thu Sep 28 15:51:12 UTC 2017


Review at  https://gerrit.osmocom.org/4086

Simplify TS alloc: improve readability

* consistently format log messages to make it possible to grep for test
  output in source code
* remove dead code

Change-Id: I31600462e48d945bc8b7abf86a3718ac83e1dcbb
Related: OS#2282
---
M src/gprs_rlcmac_ts_alloc.cpp
1 file changed, 12 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/86/4086/1

diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 57faebf..190f18d 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -250,8 +250,7 @@
 				tfi = find_free_tfi(pdch, dir);
 				if (tfi < 0) {
 					LOGP(DRLCMAC, LOGL_DEBUG,
-						"- Skipping TS %d, because "
-						"no TFI available\n", ts);
+					     "- Skipping TS %d, because no TFI available\n", ts);
 					continue;
 				}
 			}
@@ -260,25 +259,22 @@
 				usf = find_free_usf(pdch);
 				if (usf < 0) {
 					LOGP(DRLCMAC, LOGL_DEBUG,
-						"- Skipping TS %d, because "
-						"no USF available\n", ts);
+					     "- Skipping TS %d, because no USF available\n", ts);
 					continue;
 				}
 			}
 			if (min_ts >= 0)
 				LOGP(DRLCMAC, LOGL_DEBUG,
-					"- Skipping TS %d, because "
-					"num TBFs %d > %d\n",
-					min_ts, min_used, num_tbfs);
+				     "- Skipping TS %d, because num TBFs %d > %d\n",
+				     min_ts, min_used, num_tbfs);
 			min_used = num_tbfs;
 			min_ts = ts;
 			min_tfi = tfi;
 			min_usf = usf;
 		} else {
 			LOGP(DRLCMAC, LOGL_DEBUG,
-				"- Skipping TS %d, because "
-				"num TBFs %d >= %d\n",
-				ts, num_tbfs, min_used);
+			     "- Skipping TS %d, because num TBFs %d >= %d\n",
+			     ts, num_tbfs, min_used);
 		}
 	}
 
@@ -688,17 +684,17 @@
 
 	if (ms->ms_class()) {
 		ms_class = &gprs_ms_multislot_class[ms->ms_class()];
-		LOGP(DRLCMAC, LOGL_DEBUG, "Slot Allocation (Algorithm B) for "
-			"class %d\n", ms->ms_class());
+		LOGP(DRLCMAC, LOGL_DEBUG,
+		     "Slot Allocation (Algorithm B) for class %d\n", ms->ms_class());
 	} else {
 		ms_class = &gprs_ms_multislot_class[12];
-		LOGP(DRLCMAC, LOGL_DEBUG, "Slot Allocation (Algorithm B) for "
-			"unknown class (assuming 12)\n");
+		LOGP(DRLCMAC, LOGL_DEBUG,
+		     "Slot Allocation (Algorithm B) for unknown class (assuming 12)\n");
 	}
 
 	if (ms_class->tx == MS_NA) {
-		LOGP(DRLCMAC, LOGL_NOTICE, "Multislot class %d not "
-			"applicable.\n", ms->ms_class());
+		LOGP(DRLCMAC, LOGL_NOTICE,
+		     "Multislot class %d not applicable.\n", ms->ms_class());
 		return -EINVAL;
 	}
 
@@ -777,19 +773,6 @@
 
 		/* Compute capacity */
 		capacity = compute_capacity(trx, rx_window, tx_window);
-
-#ifdef ENABLE_TS_ALLOC_DEBUG
-		LOGP(DRLCMAC, LOGL_DEBUG,
-			"- Considering DL/UL slots: (TS=0)\"%s\"(TS=7), "
-			"capacity = %d\n",
-			set_flag_chars(set_flag_chars(set_flag_chars(set_flag_chars(
-					slot_info,
-					rx_bad, 'x', '.'),
-					rx_window, 'D'),
-					tx_window, 'U'),
-					rx_window & tx_window, 'C'),
-			capacity);
-#endif
 
 		if (capacity <= max_capacity)
 			continue;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I31600462e48d945bc8b7abf86a3718ac83e1dcbb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list