Change in osmo-bsc[master]: [hopping] Rework generation of Cell/Mobile Allocation

2021-04-12 Thread fixeria
fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/23649 )

Change subject: [hopping] Rework generation of Cell/Mobile Allocation
..

[hopping] Rework generation of Cell/Mobile Allocation

Calculating the Cell Allocation (basically a bit-vector of all the
frequencies allocated to a cell) on the OML link establishment has
several downsides and potential problems:

  * Theoretically, more than 64 ARFCNs can be allocated for a cell
via the VTY interface.  The problem here is that the Mobile
Allocation IE cannot contain more than 64 channels.

  * The BSC's operator will neither be warned by the interactive
VTY shell during configuration, nor during the startup.

  * The BSC will accept such a configuration, but then will be
unable to encode the Mobile Allocation IEs at run-time.

This change aims to improve the situation by separating part of
the logic from generate_cell_chan_list(), and invoking this
part directly from the VTY commands.  This way it will become
impossible to configure more than 64 ARFCNs, neither via the
config file, nor interactively from the VTY.

Change-Id: I98211fb0684a973239f5760e1de52a24a1f4c33c
---
M include/osmocom/bsc/bts.h
M include/osmocom/bsc/system_information.h
M src/osmo-bsc/bsc_vty.c
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc/system_information.c
5 files changed, 92 insertions(+), 35 deletions(-)

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



diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index c8cf8b3..c03c75e 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -451,6 +451,7 @@
struct bitvec si5_neigh_list;
struct osmo_earfcn_si2q si2quater_neigh_list;
size_t uarfcn_length; /* index for uarfcn and scramble lists */
+   size_t cell_chan_num; /* number of channels in Cell Allocation 
*/
struct {
/* bitmask large enough for all possible ARFCN's */
uint8_t neigh_list[1024/8];
diff --git a/include/osmocom/bsc/system_information.h 
b/include/osmocom/bsc/system_information.h
index 35892d9..e86a349 100644
--- a/include/osmocom/bsc/system_information.h
+++ b/include/osmocom/bsc/system_information.h
@@ -7,6 +7,7 @@

 struct gsm_bts;

+int generate_cell_chan_alloc(struct gsm_bts *bts);
 int generate_cell_chan_list(uint8_t *chan_list, struct gsm_bts *bts);
 int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type);
 size_t si2q_earfcn_count(const struct osmo_earfcn_si2q *e);
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 6a6411f..5eb2393 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -5334,6 +5334,12 @@

trx->arfcn = arfcn;

+   /* Update Cell Allocation (list of all the frequencies allocated to a 
cell) */
+   if (generate_cell_chan_alloc(trx->bts) != 0) {
+   vty_out(vty, "%% Failed to re-generate Cell Allocation%s", 
VTY_NEWLINE);
+   return CMD_WARNING;
+   }
+
/* FIXME: patch ARFCN into SYSTEM INFORMATION */
/* FIXME: use OML layer to update the ARFCN */
/* FIXME: use RSL layer to update SYSTEM INFORMATION */
@@ -5604,6 +5610,13 @@

bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);

+   /* Update Cell Allocation (list of all the frequencies allocated to a 
cell) */
+   if (generate_cell_chan_alloc(ts->trx->bts) != 0) {
+   vty_out(vty, "%% Failed to re-generate Cell Allocation%s", 
VTY_NEWLINE);
+   bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, ZERO); /* 
roll-back */
+   return CMD_WARNING;
+   }
+
return CMD_SUCCESS;
 }

@@ -5630,6 +5643,13 @@

bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);

+   /* Update Cell Allocation (list of all the frequencies allocated to a 
cell) */
+   if (generate_cell_chan_alloc(ts->trx->bts) != 0) {
+   vty_out(vty, "%% Failed to re-generate Cell Allocation%s", 
VTY_NEWLINE);
+   /* It's unlikely to happen on removal, so we don't roll-back */
+   return CMD_WARNING;
+   }
+
return CMD_SUCCESS;
 }

@@ -5644,6 +5664,13 @@

bitvec_zero(&ts->hopping.arfcns);

+   /* Update Cell Allocation (list of all the frequencies allocated to a 
cell) */
+   if (generate_cell_chan_alloc(ts->trx->bts) != 0) {
+   vty_out(vty, "%% Failed to re-generate Cell Allocation%s", 
VTY_NEWLINE);
+   /* It's unlikely to happen on removal, so we don't roll-back */
+   return CMD_WARNING;
+   }
+
return CMD_SUCCESS;
 }

diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 6c7c275..2b4224f 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -260,10 +26

Change in osmo-bsc[master]: [hopping] Rework generation of Cell/Mobile Allocation

2021-04-12 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/23649 )

Change subject: [hopping] Rework generation of Cell/Mobile Allocation
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I98211fb0684a973239f5760e1de52a24a1f4c33c
Gerrit-Change-Number: 23649
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 12 Apr 2021 08:37:51 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: [hopping] Rework generation of Cell/Mobile Allocation

2021-04-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/23649 )

Change subject: [hopping] Rework generation of Cell/Mobile Allocation
..


Patch Set 1: Code-Review+1


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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I98211fb0684a973239f5760e1de52a24a1f4c33c
Gerrit-Change-Number: 23649
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 07 Apr 2021 16:28:43 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: [hopping] Rework generation of Cell/Mobile Allocation

2021-04-05 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/23649 )


Change subject: [hopping] Rework generation of Cell/Mobile Allocation
..

[hopping] Rework generation of Cell/Mobile Allocation

Calculating the Cell Allocation (basically a bit-vector of all the
frequencies allocated to a cell) on the OML link establishment has
several downsides and potential problems:

  * Theoretically, more than 64 ARFCNs can be allocated for a cell
via the VTY interface.  The problem here is that the Mobile
Allocation IE cannot contain more than 64 channels.

  * The BSC's operator will neither be warned by the interactive
VTY shell during configuration, nor during the startup.

  * The BSC will accept such a configuration, but then will be
unable to encode the Mobile Allocation IEs at run-time.

This change aims to improve the situation by separating part of
the logic from generate_cell_chan_list(), and invoking this
part directly from the VTY commands.  This way it will become
impossible to configure more than 64 ARFCNs, neither via the
config file, nor interactively from the VTY.

Change-Id: I98211fb0684a973239f5760e1de52a24a1f4c33c
---
M include/osmocom/bsc/bts.h
M include/osmocom/bsc/system_information.h
M src/osmo-bsc/bsc_vty.c
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc/system_information.c
5 files changed, 92 insertions(+), 35 deletions(-)



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

diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index c8cf8b3..c03c75e 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -451,6 +451,7 @@
struct bitvec si5_neigh_list;
struct osmo_earfcn_si2q si2quater_neigh_list;
size_t uarfcn_length; /* index for uarfcn and scramble lists */
+   size_t cell_chan_num; /* number of channels in Cell Allocation 
*/
struct {
/* bitmask large enough for all possible ARFCN's */
uint8_t neigh_list[1024/8];
diff --git a/include/osmocom/bsc/system_information.h 
b/include/osmocom/bsc/system_information.h
index 35892d9..e86a349 100644
--- a/include/osmocom/bsc/system_information.h
+++ b/include/osmocom/bsc/system_information.h
@@ -7,6 +7,7 @@

 struct gsm_bts;

+int generate_cell_chan_alloc(struct gsm_bts *bts);
 int generate_cell_chan_list(uint8_t *chan_list, struct gsm_bts *bts);
 int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type);
 size_t si2q_earfcn_count(const struct osmo_earfcn_si2q *e);
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 6a6411f..5eb2393 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -5334,6 +5334,12 @@

trx->arfcn = arfcn;

+   /* Update Cell Allocation (list of all the frequencies allocated to a 
cell) */
+   if (generate_cell_chan_alloc(trx->bts) != 0) {
+   vty_out(vty, "%% Failed to re-generate Cell Allocation%s", 
VTY_NEWLINE);
+   return CMD_WARNING;
+   }
+
/* FIXME: patch ARFCN into SYSTEM INFORMATION */
/* FIXME: use OML layer to update the ARFCN */
/* FIXME: use RSL layer to update SYSTEM INFORMATION */
@@ -5604,6 +5610,13 @@

bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1);

+   /* Update Cell Allocation (list of all the frequencies allocated to a 
cell) */
+   if (generate_cell_chan_alloc(ts->trx->bts) != 0) {
+   vty_out(vty, "%% Failed to re-generate Cell Allocation%s", 
VTY_NEWLINE);
+   bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, ZERO); /* 
roll-back */
+   return CMD_WARNING;
+   }
+
return CMD_SUCCESS;
 }

@@ -5630,6 +5643,13 @@

bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0);

+   /* Update Cell Allocation (list of all the frequencies allocated to a 
cell) */
+   if (generate_cell_chan_alloc(ts->trx->bts) != 0) {
+   vty_out(vty, "%% Failed to re-generate Cell Allocation%s", 
VTY_NEWLINE);
+   /* It's unlikely to happen on removal, so we don't roll-back */
+   return CMD_WARNING;
+   }
+
return CMD_SUCCESS;
 }

@@ -5644,6 +5664,13 @@

bitvec_zero(&ts->hopping.arfcns);

+   /* Update Cell Allocation (list of all the frequencies allocated to a 
cell) */
+   if (generate_cell_chan_alloc(ts->trx->bts) != 0) {
+   vty_out(vty, "%% Failed to re-generate Cell Allocation%s", 
VTY_NEWLINE);
+   /* It's unlikely to happen on removal, so we don't roll-back */
+   return CMD_WARNING;
+   }
+
return CMD_SUCCESS;
 }

diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 6c7c275..2b4224f 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -260,10 +260,10 @@
 {
/* we have three bitvecs: the