dexter has uploaded this change for review.
pcu_sock: move code that fills in trx info to helper function
The function pcu_tx_info_ind() fills the trx information in the info
indication. Since the function is already quite long, move the trx
related part into a sperate helper function.
Change-Id: Ic30185c9364adcc61d0a9d3483b0550ac1cdf894
Related: OS#5198
---
M src/osmo-bsc/pcu_sock.c
1 file changed, 35 insertions(+), 26 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/74/30874/1
diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c
index c7a6560..a1174dd 100644
--- a/src/osmo-bsc/pcu_sock.c
+++ b/src/osmo-bsc/pcu_sock.c
@@ -103,6 +103,39 @@
ts_info->ma_bit_len = ts->hopping.ma_len * 8 - ts->hopping.ma.cur_bit;
}
+/* Fill the TRX parameter */
+static void info_ind_fill_trx(struct gsm_pcu_if_info_trx *trx_info, const struct gsm_bts_trx *trx)
+{
+ unsigned int tn;
+ const struct gsm_bts_trx_ts *ts;
+
+ trx_info->hlayer1 = 0x2342;
+ trx_info->pdch_mask = 0;
+ trx_info->arfcn = trx->arfcn;
+
+ for (tn = 0; tn < ARRAY_SIZE(trx->ts); tn++) {
+ ts = &trx->ts[tn];
+ if (ts->mo.nm_state.operational != NM_OPSTATE_ENABLED ||
+ ts->pchan_is != GSM_PCHAN_PDCH)
+ continue;
+
+ trx_info->pdch_mask |= (1 << tn);
+ trx_info->ts[tn].tsc =
+ (ts->tsc >= 0) ? ts->tsc : trx->bts->bsic & 7;
+
+ if (ts->hopping.enabled)
+ info_ind_fill_fhp(&trx_info->ts[tn], ts);
+
+ LOGP(DPCU, LOGL_INFO, "trx=%d ts=%d: PDCH is available "
+ "(tsc=%u ", trx->nr, ts->nr, trx_info->ts[tn].tsc);
+ if (ts->hopping.enabled)
+ LOGPC(DPCU, LOGL_INFO, "hopping=yes hsn=%u maio=%u ma_bit_len=%u)\n",
+ ts->hopping.hsn, ts->hopping.maio, trx->ts[tn].hopping.ma.data_len - trx->ts[tn].hopping.ma.cur_bit);
+ else
+ LOGPC(DPCU, LOGL_INFO, "hopping=no arfcn=%u)\n", trx->arfcn);
+ }
+}
+
/* Send BTS properties to the PCU */
static int pcu_tx_info_ind(struct gsm_bts *bts)
{
@@ -113,8 +146,7 @@
struct gsm_bts_sm *bts_sm;
struct gsm_gprs_nsvc *nsvc;
struct gsm_bts_trx *trx;
- struct gsm_bts_trx_ts *ts;
- int i, tn;
+ int i;
OSMO_ASSERT(bts);
OSMO_ASSERT(bts->network);
@@ -232,30 +264,7 @@
PCU_IF_VERSION, ARRAY_SIZE(info_ind->trx));
continue;
}
- info_ind->trx[i].hlayer1 = 0x2342;
- info_ind->trx[i].pdch_mask = 0;
- info_ind->trx[i].arfcn = trx->arfcn;
- for (tn = 0; tn < ARRAY_SIZE(trx->ts); tn++) {
- ts = &trx->ts[tn];
- if (ts->mo.nm_state.operational != NM_OPSTATE_ENABLED ||
- ts->pchan_is != GSM_PCHAN_PDCH)
- continue;
-
- info_ind->trx[i].pdch_mask |= (1 << tn);
- info_ind->trx[i].ts[tn].tsc =
- (ts->tsc >= 0) ? ts->tsc : bts->bsic & 7;
-
- if (ts->hopping.enabled)
- info_ind_fill_fhp(&info_ind->trx[i].ts[tn], ts);
-
- LOGP(DPCU, LOGL_INFO, "trx=%d ts=%d: PDCH is available "
- "(tsc=%u ", trx->nr, ts->nr, info_ind->trx[i].ts[tn].tsc);
- if (ts->hopping.enabled)
- LOGPC(DPCU, LOGL_INFO, "hopping=yes hsn=%u maio=%u ma_bit_len=%u)\n",
- ts->hopping.hsn, ts->hopping.maio, trx->ts[tn].hopping.ma.data_len - trx->ts[tn].hopping.ma.cur_bit);
- else
- LOGPC(DPCU, LOGL_INFO, "hopping=no arfcn=%u)\n", trx->arfcn);
- }
+ info_ind_fill_trx(&info_ind->trx[trx->nr], trx);
}
return pcu_sock_send(bts, msg);
To view, visit change 30874. To unsubscribe, or for help writing mail filters, visit settings.