neels has submitted this change. ( 
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

Related: osmo-bts Id9a930e5c67122812b229dc27ea2bfe246b67611
Related: SYS#6655
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, 67 insertions(+), 3 deletions(-)

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




diff --git a/src/osmo-bsc/bts_trx_vty.c b/src/osmo-bsc/bts_trx_vty.c
index 385336b..9a58089 100644
--- a/src/osmo-bsc/bts_trx_vty.c
+++ b/src/osmo-bsc/bts_trx_vty.c
@@ -349,6 +349,13 @@
                return CMD_WARNING;
        }

+       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;
+       }
+
        ts->hopping.enabled = enabled;

        return CMD_SUCCESS;
diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c
index 54eb5cf..8b97dce 100644
--- a/src/osmo-bsc/bts_vty.c
+++ b/src/osmo-bsc/bts_vty.c
@@ -3242,13 +3242,35 @@
           CMD_ATTR_IMMEDIATE)
 {
        struct gsm_bts *bts = vty->index;
+       enum imm_ass_time imm_ass_time;

        if (!strcmp(argv[0], "pre-ts-ack"))
-               bts->imm_ass_time = IMM_ASS_TIME_PRE_TS_ACK;
+               imm_ass_time = IMM_ASS_TIME_PRE_TS_ACK;
        else if (!strcmp(argv[0], "pre-chan-ack"))
-               bts->imm_ass_time = IMM_ASS_TIME_PRE_CHAN_ACK;
+               imm_ass_time = IMM_ASS_TIME_PRE_CHAN_ACK;
        else
-               bts->imm_ass_time = IMM_ASS_TIME_POST_CHAN_ACK;
+               imm_ass_time = IMM_ASS_TIME_POST_CHAN_ACK;
+
+       if (imm_ass_time != IMM_ASS_TIME_POST_CHAN_ACK) {
+               struct gsm_bts_trx *trx;
+
+               /* Early-IA does not work with frequency hopping, because the 
IMM ASS does not convey an ARFCN when
+                * frequency hopping 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) {
+                                       vty_out(vty, "%% ERROR: 'hopping 
enabled 1' works only with"
+                                               " 'immediate-assignment 
post-chan-ack', see timeslot %s%s",
+                                               ts->fi->id, VTY_NEWLINE);
+                                       return CMD_WARNING;
+                               }
+                       }
+               }
+       }
+
+       bts->imm_ass_time = imm_ass_time;
        return CMD_SUCCESS;
 }

diff --git a/tests/early_ia.vty b/tests/early_ia.vty
new file mode 100644
index 0000000..4ba6b3a
--- /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', see timeslot 0-0-2-NONE

--
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: 5
Gerrit-Owner: neels <nhofm...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: neels <nhofm...@sysmocom.de>
Gerrit-Reviewer: osmith <osm...@sysmocom.de>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to