neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/35097?usp=email )


Change subject: vty: disallow combination of early-IA and frequency hopping
......................................................................

vty: disallow combination of early-IA and frequency hopping

Change-Id: I8d375e5155be7b53034d5c0be5566d2f33af5db0
---
M src/osmo-bsc/bts_trx_vty.c
M src/osmo-bsc/bts_vty.c
A tests/early_ia.vty
3 files changed, 62 insertions(+), 0 deletions(-)



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

diff --git a/src/osmo-bsc/bts_trx_vty.c b/src/osmo-bsc/bts_trx_vty.c
index 385336b..b349951 100644
--- a/src/osmo-bsc/bts_trx_vty.c
+++ b/src/osmo-bsc/bts_trx_vty.c
@@ -351,6 +351,13 @@

        ts->hopping.enabled = enabled;

+       if (enabled && bts->imm_ass_time != IMM_ASS_TIME_POST_CHAN_ACK) {
+               vty_out(vty,
+                       "%% ERROR: 'hopping enabled 1' works only with 
'immediate-assignment post-chan-ack'%s",
+                       VTY_NEWLINE);
+               return CMD_WARNING;
+       }
+
        return CMD_SUCCESS;
 }

diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c
index 3af7296..afe71b1 100644
--- a/src/osmo-bsc/bts_vty.c
+++ b/src/osmo-bsc/bts_vty.c
@@ -3229,6 +3229,28 @@
                bts->imm_ass_time = IMM_ASS_TIME_PRE_CHAN_ACK;
        else
                bts->imm_ass_time = IMM_ASS_TIME_POST_CHAN_ACK;
+
+       if (bts->imm_ass_time != IMM_ASS_TIME_POST_CHAN_ACK) {
+               struct gsm_bts_trx *trx;
+               int hopping_enabled = 0;
+
+               /* Early-IA does not work with frequency hopping, because the 
IMM ASS does not convey an ARFCN when
+                * frequency is in use. Make sure the user knows that. */
+               llist_for_each_entry(trx, &bts->trx_list, list) {
+                       int ts_nr;
+                       for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
+                               struct gsm_bts_trx_ts *ts = &trx->ts[ts_nr];
+                               if (ts->hopping.enabled)
+                                       hopping_enabled++;
+                       }
+               }
+               if (hopping_enabled) {
+                       vty_out(vty,
+                               "%% ERROR: 'hopping enabled 1' works only with 
'immediate-assignment post-chan-ack'%s",
+                               VTY_NEWLINE);
+                       return CMD_WARNING;
+               }
+       }
        return CMD_SUCCESS;
 }

diff --git a/tests/early_ia.vty b/tests/early_ia.vty
new file mode 100644
index 0000000..d97aeed
--- /dev/null
+++ b/tests/early_ia.vty
@@ -0,0 +1,24 @@
+OsmoBSC> enable
+OsmoBSC# configure terminal
+OsmoBSC(config)# network
+OsmoBSC(config-net)# bts 0
+
+OsmoBSC(config-net-bts)# ### Check that first setting early-IA and then 
enabling frequency hopping throws an error
+OsmoBSC(config-net-bts)# immediate-assignment pre-chan-ack
+OsmoBSC(config-net-bts)# trx 0
+OsmoBSC(config-net-bts-trx)# timeslot 2
+OsmoBSC(config-net-bts-trx-ts)# hopping enabled 1
+% ERROR: 'hopping enabled 1' works only with 'immediate-assignment 
post-chan-ack'
+OsmoBSC(config-net-bts-trx-ts)# hopping enabled 0
+OsmoBSC(config-net-bts-trx-ts)# exit
+OsmoBSC(config-net-bts-trx)# exit
+OsmoBSC(config-net-bts)# immediate-assignment post-chan-ack
+
+OsmoBSC(config-net-bts)# ### Check that first enabling frequency hopping and 
then setting early-IA throws an error
+OsmoBSC(config-net-bts)# trx 0
+OsmoBSC(config-net-bts-trx)# timeslot 2
+OsmoBSC(config-net-bts-trx-ts)# hopping enabled 1
+OsmoBSC(config-net-bts-trx-ts)# exit
+OsmoBSC(config-net-bts-trx)# exit
+OsmoBSC(config-net-bts)# immediate-assignment pre-chan-ack
+% ERROR: 'hopping enabled 1' works only with 'immediate-assignment 
post-chan-ack'

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I8d375e5155be7b53034d5c0be5566d2f33af5db0
Gerrit-Change-Number: 35097
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>
Gerrit-MessageType: newchange

Reply via email to