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

Change subject: pcu_sock: move code that fills in trx info to helper function
......................................................................

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(-)

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



diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c
index ab3b7d5..ddcf66b 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));
                        break;
                }
-               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);



1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30874
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic30185c9364adcc61d0a9d3483b0550ac1cdf894
Gerrit-Change-Number: 30874
Gerrit-PatchSet: 6
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to