dexter has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30850 )


Change subject: pcu_sock: fill in TRX parameters properly
......................................................................

pcu_sock: fill in TRX parameters properly

The pcu_sock interface has eveolved. There is a trx info indication that
transfers trx (and hopping parameter) to the PCU. Fill in those
parameters and send them to the PCU.

Change-Id: Ie5c1abcf7b25fe00b6c228c49648e018f94190f0
Related: OS#5198
---
M src/osmo-bsc/pcu_sock.c
1 file changed, 59 insertions(+), 25 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/50/30850/1

diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c
index 3e9a889..33b6588 100644
--- a/src/osmo-bsc/pcu_sock.c
+++ b/src/osmo-bsc/pcu_sock.c
@@ -100,6 +100,58 @@
        return (ts->pchan_is == GSM_PCHAN_PDCH);
 }

+/* Fill the frequency hopping parameter */
+static void info_ind_fill_fhp(struct gsm_pcu_if_info_trx_ts *ts_info,
+                             const struct gsm_bts_trx_ts *ts)
+{
+       ts_info->maio = ts->hopping.maio;
+       ts_info->hsn = ts->hopping.hsn;
+       ts_info->hopping = 0x1;
+
+       memcpy(&ts_info->ma, ts->hopping.ma_data, ts->hopping.ma_len);
+       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;
+
+       trx_info->pdch_mask = 0;
+       trx_info->arfcn = trx->arfcn;
+       trx_info->hlayer1 = 0x2342;
+
+       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 < ARRAY_SIZE(trx->ts); tn++) {
+               const struct gsm_bts_trx_ts *ts = &trx->ts[tn];
+
+               if (ts->mo.nm_state.operational != NM_OPSTATE_ENABLED)
+                       continue;
+               if (!ts_is_pdch(ts))
+                       continue;
+
+               trx_info->pdch_mask |= (1 << tn);
+               trx_info->ts[tn].tsc = ts->tsc;
+
+               if (ts->hopping.enabled)
+                       info_ind_fill_fhp(&trx_info->ts[tn], ts);
+
+               LOGPTRX(trx, DPCU, LOGL_INFO, "PDCH on ts=%u is available " 
"(tsc=%u ", 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_info->ts[tn].ma_bit_len);
+               } 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)
 {
@@ -110,8 +162,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);
@@ -226,30 +277,13 @@
                trx = gsm_bts_trx_num(bts, i);
                if (!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);
+               if (trx->nr >= ARRAY_SIZE(info_ind->trx)) {
+                       LOGPTRX(trx, DPCU, LOGL_NOTICE, "PCU interface (version 
%u) "
+                               "cannot handle more than %zu transceivers => 
skipped\n",
+                               PCU_IF_VERSION, ARRAY_SIZE(info_ind->trx));
+                       continue;
                }
+               info_ind_fill_trx(&info_ind->trx[trx->nr], trx);
        }

        return pcu_sock_send(bts, msg);

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ie5c1abcf7b25fe00b6c228c49648e018f94190f0
Gerrit-Change-Number: 30850
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <[email protected]>
Gerrit-MessageType: newchange

Reply via email to