pespin has uploaded this change for review.
SI13: constify and copy si13_default
It's really confusing having a "default" struct whose inner values are
changing based on previous state. Let's make it const and copy it over
every time we need to modify it, to avoid dragging previous state over
and over.
Change-Id: I3ae4dd017dd4dad10c0365d21727666dd8e9fd41
---
M src/osmo-bsc/system_information.c
1 file changed, 16 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/42/27542/1
diff --git a/src/osmo-bsc/system_information.c b/src/osmo-bsc/system_information.c
index 797c556..1f8d8da 100644
--- a/src/osmo-bsc/system_information.c
+++ b/src/osmo-bsc/system_information.c
@@ -1200,7 +1200,7 @@
return l2_plen + rc;
}
-static struct osmo_gsm48_si13_info si13_default = {
+const static struct osmo_gsm48_si13_info si13_default = {
.cell_opts = {
.nmo = GPRS_NMO_II,
.t3168 = 2000,
@@ -1238,6 +1238,7 @@
{
struct gsm48_system_information_type_13 *si13 =
(struct gsm48_system_information_type_13 *) GSM_BTS_SI(bts, t);
+ struct osmo_gsm48_si13_info si13_info = si13_default;
int ret;
memset(si13, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN);
@@ -1246,43 +1247,43 @@
si13->header.skip_indicator = 0;
si13->header.system_information = GSM48_MT_RR_SYSINFO_13;
- si13_default.rac = bts->gprs.rac;
- si13_default.net_ctrl_ord = bts->gprs.net_ctrl_ord;
+ si13_info.rac = bts->gprs.rac;
+ si13_info.net_ctrl_ord = bts->gprs.net_ctrl_ord;
- si13_default.cell_opts.ctrl_ack_type_use_block =
+ si13_info.cell_opts.ctrl_ack_type_use_block =
bts->gprs.ctrl_ack_type_use_block;
/* Information about the other SIs */
- si13_default.bcch_change_mark = bts->bcch_change_mark;
+ si13_info.bcch_change_mark = bts->bcch_change_mark;
switch (bts->gprs.mode) {
case BTS_GPRS_EGPRS:
- si13_default.cell_opts.ext_info.egprs_supported = 1;
+ si13_info.cell_opts.ext_info.egprs_supported = 1;
/* Whether EGPRS capable MSs shall use EGPRS PACKET CHANNEL REQUEST */
if (bts->gprs.egprs_pkt_chan_request)
- si13_default.cell_opts.ext_info.use_egprs_p_ch_req = 1;
+ si13_info.cell_opts.ext_info.use_egprs_p_ch_req = 1;
else
- si13_default.cell_opts.ext_info.use_egprs_p_ch_req = 0;
+ si13_info.cell_opts.ext_info.use_egprs_p_ch_req = 0;
break;
case BTS_GPRS_GPRS:
case BTS_GPRS_NONE:
- si13_default.cell_opts.ext_info.egprs_supported = 0;
- si13_default.cell_opts.ext_info.use_egprs_p_ch_req = 0;
+ si13_info.cell_opts.ext_info.egprs_supported = 0;
+ si13_info.cell_opts.ext_info.use_egprs_p_ch_req = 0;
break;
}
if (osmo_bts_has_feature(&bts->features, BTS_FEAT_PAGING_COORDINATION))
- si13_default.cell_opts.ext_info.bss_paging_coordination = 1;
+ si13_info.cell_opts.ext_info.bss_paging_coordination = 1;
else
- si13_default.cell_opts.ext_info.bss_paging_coordination = 0;
+ si13_info.cell_opts.ext_info.bss_paging_coordination = 0;
- si13_default.cell_opts.ext_info.ccn_active = bts->gprs.ccn.forced_vty ?
+ si13_info.cell_opts.ext_info.ccn_active = bts->gprs.ccn.forced_vty ?
bts->gprs.ccn.active :
osmo_bts_has_feature(&bts->model->features,
BTS_FEAT_CCN);
- si13_default.pwr_ctrl_pars.alpha = bts->gprs.pwr_ctrl.alpha;
+ si13_info.pwr_ctrl_pars.alpha = bts->gprs.pwr_ctrl.alpha;
- ret = osmo_gsm48_rest_octets_si13_encode(si13->rest_octets, &si13_default);
+ ret = osmo_gsm48_rest_octets_si13_encode(si13->rest_octets, &si13_info);
if (ret < 0)
return ret;
To view, visit change 27542. To unsubscribe, or for help writing mail filters, visit settings.