<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18119">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">om2k: Fix the frequency specifier for TX/RX/TS conf requests<br><br>* OM2K_DEI_FREQ_SPEC_RX:<br><br>  (hop << 15) | (rx_addr << 10) | arfcn<br><br>  . hop     Hopping marker<br>  . rx_addr is not really the TRX number, it's just a sequential number<br>            different for all TRX, doesn't need to be 'in-order' of TRX<br>  . arfcn   The ARFCN number (0 for hopping and 1023 for 'no frequency')<br><br>* OM2K_DEI_FREQ_SPEC_TX:<br><br>  (hop << 15) | (tx_id << 10) | arfcn<br><br>  tx_id Pretty much same as rx_id except here we know that the order<br>  doesn't have to match TRX order. It seems to even vary from one<br>  reboot to another on some real-world capture we got.<br><br>  . hop     Hopping marker<br>  . tx_addr Same as 'rx_addr' above but for TX<br>  . arfcn   The ARFCN number (0 for hopping and 1023 for 'no frequency')<br><br>* OM2K_DEI_FREQ_LIST:<br><br>  Groups of 3 bytes (24 bits), 1 per frequency used.<br><br>  (tx_addr << 20) | (rx_addr << 16) | (is_c0 << 10) | arfcn<br><br>  . tx_addr See above<br>  . rx_addr See above<br>  . is_c0   Must be 1 if that ARFCN hosts the C0. (first TRX of a MCTR)<br>  . arfcn   The ARFCN number<br><br>  (Note MAIO must also be set properly on the different TRX/TS sharing<br>   a frequency ... )<br><br>The way we generate theses here is what we gathered from real-world<br>traces:<br> - Each 'TX' of each TRX is set to the ARFCN set in that TRX config<br> - Each 'RX' of each TRX is configures as 'hopping'<br>   (which I assume means it will just pick the appropriate freq ?)<br> - For each TS, we use :<br>   . tx_addr of the TRX that has the ARFCN we want to TX on<br>   . rx_addr of the TRX where the TS we're configuring is<br>   . arfcn   The actual ARFCN we want to add to the list<br><br>This is incomplete but will work for the 1 MCTR case.<br><br>Config for multiple MCTR or multiple virtual-bts still need to be<br>handled but it's not yet known exactly how those need to be<br>configured.<br><br>Signed-off-by: Sylvain Munaut <tnt@246tNt.com><br>Change-Id: Ie39a857543adaa11d1822346d8563ce3718412c8<br>---<br>M src/osmo-bsc/abis_om2000.c<br>1 file changed, 38 insertions(+), 7 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/abis_om2000.c b/src/osmo-bsc/abis_om2000.c</span><br><span>index 9ae5a26..e20d9a6 100644</span><br><span>--- a/src/osmo-bsc/abis_om2000.c</span><br><span>+++ b/src/osmo-bsc/abis_om2000.c</span><br><span>@@ -1285,7 +1285,8 @@</span><br><span>        o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));</span><br><span>  fill_om2k_hdr(o2k, &mo, OM2K_MSGT_RX_CONF_REQ);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- msgb_tv16_put(msg, OM2K_DEI_FREQ_SPEC_RX, trx->arfcn);</span><br><span style="color: hsl(120, 100%, 40%);">+     /* OM2K_DEI_FREQ_SPEC_RX: Using trx_nr as "RX address" only works for single MCTR case */</span><br><span style="color: hsl(120, 100%, 40%);">+   msgb_tv16_put(msg, OM2K_DEI_FREQ_SPEC_RX, 0x8000 | ((uint16_t)trx->nr << 10));</span><br><span>      msgb_tv_put(msg, OM2K_DEI_RX_DIVERSITY, 0x02); /* A */</span><br><span> </span><br><span>   return abis_om2k_sendmsg(trx->bts, msg);</span><br><span>@@ -1303,9 +1304,10 @@</span><br><span>         o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));</span><br><span>  fill_om2k_hdr(o2k, &mo, OM2K_MSGT_TX_CONF_REQ);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- msgb_tv16_put(msg, OM2K_DEI_FREQ_SPEC_TX, trx->arfcn);</span><br><span style="color: hsl(120, 100%, 40%);">+     /* OM2K_DEI_FREQ_SPEC_TX: Using trx_nr as "TX address" only works for single MCTR case */</span><br><span style="color: hsl(120, 100%, 40%);">+   msgb_tv16_put(msg, OM2K_DEI_FREQ_SPEC_TX, trx->arfcn | ((uint16_t)trx->nr << 10));</span><br><span>       msgb_tv_put(msg, OM2K_DEI_POWER, trx->nominal_power-trx->max_power_red);</span><br><span style="color: hsl(0, 100%, 40%);">-  msgb_tv_put(msg, OM2K_DEI_FILLING_MARKER, 0);   /* Filling enabled */</span><br><span style="color: hsl(120, 100%, 40%);">+ msgb_tv_put(msg, OM2K_DEI_FILLING_MARKER, trx != trx->bts->c0); /* Filling enabled for C0 only */</span><br><span>      msgb_tv_put(msg, OM2K_DEI_BCC, trx->bts->bsic & 0x7);</span><br><span>      /* Dedication Information is optional */</span><br><span> </span><br><span>@@ -1378,12 +1380,41 @@</span><br><span>       return pchan2comb(ts->pchan_from_config);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static int put_freq_list(uint8_t *buf, uint16_t arfcn)</span><br><span style="color: hsl(120, 100%, 40%);">+static int put_freq_list(uint8_t *buf, struct gsm_bts_trx_ts *ts, uint16_t arfcn)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-     buf[0] = 0x00; /* TX/RX address */</span><br><span style="color: hsl(120, 100%, 40%);">+    struct gsm_bts_trx *trx;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* Find the TRX that's configured for that ARFCN */</span><br><span style="color: hsl(120, 100%, 40%);">+       llist_for_each_entry(trx, &ts->trx->bts->trx_list, list)</span><br><span style="color: hsl(120, 100%, 40%);">+         if (trx->arfcn == arfcn)</span><br><span style="color: hsl(120, 100%, 40%);">+                   break;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      if (!trx || (trx->arfcn != arfcn)) {</span><br><span style="color: hsl(120, 100%, 40%);">+               LOGP(DNM, LOGL_ERROR, "Trying to use ARFCN %d for hopping with no TRX configured for it", arfcn);</span><br><span style="color: hsl(120, 100%, 40%);">+           return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   /*</span><br><span style="color: hsl(120, 100%, 40%);">+     * [7:4] - TX address</span><br><span style="color: hsl(120, 100%, 40%);">+  *         This must be the same number that was used when configuring the TX</span><br><span style="color: hsl(120, 100%, 40%);">+  *         MO object with that target arfcn</span><br><span style="color: hsl(120, 100%, 40%);">+    *</span><br><span style="color: hsl(120, 100%, 40%);">+     * [3:0] - RX address</span><br><span style="color: hsl(120, 100%, 40%);">+  *         The logical TRX number we're configuring the hopping sequence for</span><br><span style="color: hsl(120, 100%, 40%);">+       *         This must basically match the MO object instance number</span><br><span style="color: hsl(120, 100%, 40%);">+     *</span><br><span style="color: hsl(120, 100%, 40%);">+     * ATM since we only support 1 MCTR, we use trx->nr</span><br><span style="color: hsl(120, 100%, 40%);">+         */</span><br><span style="color: hsl(120, 100%, 40%);">+   buf[0] = (trx->nr << 4) | ts->trx->nr;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* ARFCN Number */</span><br><span>   buf[1] = (arfcn >> 8);</span><br><span>         buf[2] = (arfcn & 0xff);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+      /* C0 marker */</span><br><span style="color: hsl(120, 100%, 40%);">+       if (trx == trx->bts->c0)</span><br><span style="color: hsl(120, 100%, 40%);">+                buf[1] |= 0x04;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>    return 3;</span><br><span> }</span><br><span> </span><br><span>@@ -1397,10 +1428,10 @@</span><br><span>                 unsigned int i;</span><br><span>              for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) {</span><br><span>                  if (bitvec_get_bit_pos(&ts->hopping.arfcns, i))</span><br><span style="color: hsl(0, 100%, 40%);">-                          cur += put_freq_list(cur, i);</span><br><span style="color: hsl(120, 100%, 40%);">+                         cur += put_freq_list(cur, ts, i);</span><br><span>            }</span><br><span>    } else</span><br><span style="color: hsl(0, 100%, 40%);">-          cur += put_freq_list(cur, ts->trx->arfcn);</span><br><span style="color: hsl(120, 100%, 40%);">+              cur += put_freq_list(cur, ts, ts->trx->arfcn);</span><br><span> </span><br><span>     len = cur - list;</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18119">change 18119</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bsc/+/18119"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ie39a857543adaa11d1822346d8563ce3718412c8 </div>
<div style="display:none"> Gerrit-Change-Number: 18119 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: tnt <tnt@246tNt.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: tnt <tnt@246tNt.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>