Change in osmo-bts[master]: pcu_sock: separate trx / ts filling from pcu_tx_info_ind()

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Sun Aug 2 19:50:05 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/19511 )


Change subject: pcu_sock: separate trx / ts filling from pcu_tx_info_ind()
......................................................................

pcu_sock: separate trx / ts filling from pcu_tx_info_ind()

This would allow to avoid further nasting in 'for' loops.

Change-Id: Idb102c77751ccf77fd246f538e62fd7acf6ee88b
---
M src/common/pcu_sock.c
1 file changed, 35 insertions(+), 26 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/11/19511/1

diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index ca8dd15..392900a 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -112,6 +112,39 @@
 	}
 }
 
+static void info_ind_fill_trx(struct gsm_pcu_if_info_trx *trx_info,
+			      const struct gsm_bts_trx *trx)
+{
+	unsigned int tn;
+
+	trx_info->pdch_mask = 0;
+	trx_info->arfcn = trx->arfcn;
+	trx_info->hlayer1 = trx_get_hlayer1(trx);
+
+	if (trx->mo.nm_state.operational != NM_OPSTATE_ENABLED ||
+	    trx->mo.nm_state.administrative != NM_STATE_UNLOCKED) {
+		LOGPTRX(trx, DPCU, LOGL_INFO, "unavailable for PCU (op=%s adm=%s)\n",
+		    abis_nm_opstate_name(trx->mo.nm_state.operational),
+		    abis_nm_admin_name(trx->mo.nm_state.administrative));
+		return;
+	}
+
+	for (tn = 0; tn < 8; tn++) {
+		const struct gsm_bts_trx_ts *ts = &trx->ts[tn];
+
+		if (ts->mo.nm_state.operational != NM_OPSTATE_ENABLED)
+			continue;
+		if (!ts_should_be_pdch(ts))
+			continue;
+
+		trx_info->pdch_mask |= (1 << tn);
+		trx_info->tsc[tn] = gsm_ts_tsc(ts);
+
+		LOGP(DPCU, LOGL_INFO, "(trx=%u,ts=%u) PDCH available (tsc=%u arfcn=%u)\n",
+			trx->nr, ts->nr, trx_info->tsc[tn], trx->arfcn);
+	}
+}
+
 int pcu_tx_info_ind(void)
 {
 	struct gsm_network *net = &bts_gsmnet;
@@ -122,8 +155,7 @@
 	struct gprs_rlc_cfg *rlcc;
 	struct gsm_bts_gprs_nsvc *nsvc;
 	struct gsm_bts_trx *trx;
-	struct gsm_bts_trx_ts *ts;
-	int i, j;
+	int i;
 
 	LOGP(DPCU, LOGL_INFO, "Sending info\n");
 
@@ -223,30 +255,7 @@
 			continue;
 		}
 
-		info_ind->trx[trx->nr].pdch_mask = 0;
-		info_ind->trx[trx->nr].arfcn = trx->arfcn;
-		info_ind->trx[trx->nr].hlayer1 = trx_get_hlayer1(trx);
-		if (trx->mo.nm_state.operational != NM_OPSTATE_ENABLED ||
-		    trx->mo.nm_state.administrative != NM_STATE_UNLOCKED) {
-			    LOGPTRX(trx, DPCU, LOGL_INFO, "unavailable for PCU (op=%s adm=%s)\n",
-				    abis_nm_opstate_name(trx->mo.nm_state.operational),
-				    abis_nm_admin_name(trx->mo.nm_state.administrative));
-			continue;
-		}
-		for (j = 0; j < 8; j++) {
-			ts = &trx->ts[j];
-			if (ts->mo.nm_state.operational == NM_OPSTATE_ENABLED
-			    && ts_should_be_pdch(ts)) {
-				info_ind->trx[trx->nr].pdch_mask |= (1 << j);
-				info_ind->trx[trx->nr].tsc[j] = gsm_ts_tsc(ts);
-
-				LOGP(DPCU, LOGL_INFO, "trx=%d ts=%d: "
-					"available (tsc=%d arfcn=%d)\n",
-					trx->nr, ts->nr,
-					info_ind->trx[trx->nr].tsc[j],
-					info_ind->trx[trx->nr].arfcn);
-			}
-		}
+		info_ind_fill_trx(&info_ind->trx[trx->nr], trx);
 	}
 
 	return pcu_sock_send(net, msg);

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Idb102c77751ccf77fd246f538e62fd7acf6ee88b
Gerrit-Change-Number: 19511
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200802/93fd8ee6/attachment.htm>


More information about the gerrit-log mailing list