laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/28275 )

Change subject: smscb: Tx CBSP FAILURE/RESTART for specific cell when it 
becomes (un)operational
......................................................................

smscb: Tx CBSP FAILURE/RESTART for specific cell when it becomes (un)operational

This way the CBSP peers knows the state of specific cells and can avoid
sending messages to unoperative ones, etc.

Related: SYS#5910
Change-Id: I94f0a1ac3c59cffe5af57f972d5d96fc92281d34
---
M src/osmo-bsc/smscb.c
1 file changed, 50 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bsc/smscb.c b/src/osmo-bsc/smscb.c
index 7507703..0e9049f 100644
--- a/src/osmo-bsc/smscb.c
+++ b/src/osmo-bsc/smscb.c
@@ -476,6 +476,54 @@
        return cbsp_tx_decoded(cbc, cbsp);
 }

+/* transmit a CBSP RESTART-INDICATION message stating a cell is operative 
again */
+int cbsp_tx_restart_bts(struct bsc_cbc_link *cbc, bool is_emerg, struct 
gsm_bts *bts)
+{
+       struct osmo_cbsp_decoded *cbsp = osmo_cbsp_decoded_alloc(cbc, 
CBSP_MSGT_RESTART);
+       struct osmo_cbsp_cell_ent cell_ent;
+
+       if (is_emerg)
+               cbsp->u.restart.bcast_msg_type = 0x01;
+       cbsp->u.restart.recovery_ind = 0x00; /* message data available */
+       cbsp->u.restart.cell_list.id_discr = CELL_IDENT_LAC_AND_CI;
+
+       cell_ent = (struct osmo_cbsp_cell_ent){
+               .cell_id = {
+                       .lac_and_ci = {
+                               .lac = bts->location_area_code,
+                               .ci = bts->cell_identity,
+                       }
+               }
+       };
+       llist_add(&cell_ent.list, &cbsp->u.restart.cell_list.list);
+
+       return cbsp_tx_decoded(cbc, cbsp);
+}
+
+/* transmit a CBSP FAILURE-INDICATION message stating all message data was 
lost for one cell */
+int cbsp_tx_failure_bts(struct bsc_cbc_link *cbc, bool is_emerg, struct 
gsm_bts *bts)
+{
+       struct osmo_cbsp_decoded *cbsp = osmo_cbsp_decoded_alloc(cbc, 
CBSP_MSGT_FAILURE);
+       struct osmo_cbsp_fail_ent fail_ent;
+
+       if (is_emerg)
+               cbsp->u.failure.bcast_msg_type = 0x01;
+
+       fail_ent = (struct osmo_cbsp_fail_ent){
+               .id_discr = CELL_IDENT_LAC_AND_CI,
+               .cell_id = {
+                       .lac_and_ci = {
+                               .lac = bts->location_area_code,
+                               .ci = bts->cell_identity,
+                       }
+               },
+               .cause = OSMO_CBSP_CAUSE_CELL_BROADCAST_NOT_OPERATIONAL
+       };
+       llist_add(&fail_ent.list, &cbsp->u.failure.fail_list);
+
+       return cbsp_tx_decoded(cbc, cbsp);
+}
+
 /* transmit a CBSP KEEPALIVE COMPLETE to the CBC */
 static int tx_cbsp_keepalive_compl(struct bsc_cbc_link *cbc)
 {
@@ -1093,12 +1141,14 @@
                        bts_cbch_timer_schedule(trx->bts);
                        /* Start ETWS/PWS Primary Notification, if active */
                        bts_etws_bootstrap(trx->bts);
+                       cbsp_tx_restart_bts(bts->network->cbc, false, bts);
                }
        } else {
                if (osmo_timer_pending(&bts->cbch_timer)) {
                        /* If timer is ongoing it means CBCH was available */
                        LOG_BTS(bts, DCBS, LOGL_INFO, "BTS becomes unavailable 
for CBCH\n");
                        osmo_timer_del(&bts->cbch_timer);
+                       cbsp_tx_failure_bts(bts->network->cbc, false, bts);
                } /* else: CBCH was already unavailable before */
        }
        return 0;

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I94f0a1ac3c59cffe5af57f972d5d96fc92281d34
Gerrit-Change-Number: 28275
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-MessageType: merged

Reply via email to