pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/24616 )

Change subject: rsl: Use switch statement in rsl_rx_bcch_info()
......................................................................

rsl: Use switch statement in rsl_rx_bcch_info()

This is a preparation for new commit, which makes it easier to add new
SIs being sent.

Change-Id: I27774ca36d1e740b6a502cfb280aba0ea82b9dbe
---
M src/common/rsl.c
1 file changed, 18 insertions(+), 12 deletions(-)

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



diff --git a/src/common/rsl.c b/src/common/rsl.c
index 516e609..7f9af84 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -456,6 +456,7 @@
        enum osmo_sysinfo_type osmo_si;
        struct gsm48_system_information_type_2quater *si2q;
        struct bitvec bv;
+       const uint8_t *si_buf;
        rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg));

        /* 9.3.30 System Info Type */
@@ -518,7 +519,8 @@

                bts->si_valid |= (1 << osmo_si);

-               if (SYSINFO_TYPE_3 == osmo_si) {
+               switch (osmo_si) {
+               case SYSINFO_TYPE_3:
                        if (trx->nr == 0 && num_agch(trx, "RSL") != 1) {
                                
lchan_deactivate(&trx->bts->c0->ts[0].lchan[CCCH_LCHAN]);
                                /* will be reactivated by sapi_deactivate_cb() 
*/
@@ -526,29 +528,33 @@
                                        LCHAN_REL_ACT_REACT;
                        }
                        /* decode original SI3 Rest Octets as sent by BSC */
-                       const uint8_t *si3_ro_buf = (uint8_t *) GSM_BTS_SI(bts, 
osmo_si);
-                       si3_ro_buf += offsetof(struct 
gsm48_system_information_type_3, rest_octets);
-                       osmo_gsm48_rest_octets_si3_decode(&bts->si3_ro_decoded, 
si3_ro_buf);
+                       si_buf = (const uint8_t *) GSM_BTS_SI(bts, osmo_si);
+                       si_buf += offsetof(struct 
gsm48_system_information_type_3, rest_octets);
+                       osmo_gsm48_rest_octets_si3_decode(&bts->si3_ro_decoded, 
si_buf);
                        /* patch out GPRS indicator from binary if PCU is not 
connected; will be enabled
                         * after PCU connects */
                        regenerate_si3_restoctets(bts);
                        pcu_tx_si(trx->bts, SYSINFO_TYPE_3, true);
-               } else if (SYSINFO_TYPE_4 == osmo_si) {
+                       break;
+               case SYSINFO_TYPE_4:
                        /* decode original SI4 Rest Octets as sent by BSC */
-                       const uint8_t *si4 = (uint8_t *) GSM_BTS_SI(bts, 
osmo_si);
-                       int si4_ro_offset = get_si4_ro_offset(si4);
+                       si_buf = (const uint8_t *) GSM_BTS_SI(bts, osmo_si);
+                       int si4_ro_offset = get_si4_ro_offset(si_buf);
                        if (si4_ro_offset > 0) {
                                
osmo_gsm48_rest_octets_si4_decode(&bts->si4_ro_decoded,
-                                                                 si4 + 
si4_ro_offset,
+                                                                 si_buf + 
si4_ro_offset,
                                                                  
GSM_MACBLOCK_LEN - si4_ro_offset);
                                /* patch out GPRS indicator from binary if PCU 
is not connected; will be
                                 * enabled after PCU connects */
                                regenerate_si4_restoctets(bts);
                        }
-               } else if (SYSINFO_TYPE_13 == osmo_si) {
-                       pcu_tx_si(trx->bts, SYSINFO_TYPE_13, true);
-               } else if (SYSINFO_TYPE_1 == osmo_si) {
-                       pcu_tx_si(trx->bts, SYSINFO_TYPE_1, true);
+                       break;
+               case SYSINFO_TYPE_1:
+               case SYSINFO_TYPE_13:
+                       pcu_tx_si(trx->bts, osmo_si, true);
+                       break;
+               default:
+                       break;
                }

        } else if (TLVP_PRESENT(&tp, RSL_IE_L3_INFO)) {

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I27774ca36d1e740b6a502cfb280aba0ea82b9dbe
Gerrit-Change-Number: 24616
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to