This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.
Holger Hans Peter Freyther holger at freyther.deOn Wed, Apr 16, 2014 at 02:09:39PM +0200, Alvaro Neira Ayuso wrote: > +static void update_transmiter_power(struct gsm_bts_trx *trx, int reduce_power) > +{ > + struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx); > + int power_transmitter = trx->nominal_power - trx->max_power_red; > + > + power_transmitter -= reduce_power; > + if (power_transmitter < 0) > + power_transmitter = 0; This would be third place we calculate "trx->nominal_power - trx->max_power_red". The code is also fragile in regard to a sequence like this: 1.) BTS is powering up with lower power output 2.) It gets too hot already and the manager reduces the power 3.) BTS is increasing the power. With 3rd your reduction in 2nd would be undone. The right and safe way to handle it is to: * Store the manager power reduction in another variable (e.g. inside the fl1h or the trx) * Assign this variable * Have one function that works on the trx and returns you the nominal power to be used by the DSP/FPGA. This way the order of power reduction changes does not matter. > + > + if (last_power_transmitter != power_transmitter) { > + if (fl1h->hLayer1) { > + l1if_set_txpower(fl1h, power_transmitter); > + last_power_transmitter = power_transmitter; global state? Why is that needed? > +static struct osmo_timer_list power_timer; > +static void change_transmitter_power_cb(void *data) > +{ > + struct gsm_bts *bts = data; > + struct gsm_bts_trx *trx = bts->c0; > + > + if (status_change_power_red == SBTS2050_ENABLE_CHANGE_POWER) { > + update_transmiter_power(trx, reduce_max_power); > + status_change_power_red = SBTS2050_DISABLE_CHANGE_POWER; > + osmo_timer_schedule(&power_timer, TEMP_TIMER_SECS, 0); > + } else if (status_change_power_red == SBTS2050_DISABLE_CHANGE_POWER) > + update_transmiter_power(trx, 0); > +} > + > +static int take_max_power_red(struct msgb *msg) > +{ > + struct sbts2050_config_info *config_info; > + struct tlv_parsed tlv_out; > + int rc; > + > + rc = oml_tlv_parse(&tlv_out, msg->tail - TLV_ADD_INFO_LEN, > + TLV_ADD_INFO_LEN); > + > + if (rc < 0) > + return -1; > + > + config_info = > + (struct sbts2050_config_info *) TLVP_VAL(&tlv_out, NM_ATT_ADD_INFO); > + > + reduce_max_power = config_info->reduce_max_power; > + > + status_change_power_red = SBTS2050_ENABLE_CHANGE_POWER; > + change_transmitter_power_cb(bts); > + > + return 0; > +} Why do we need a timer in the sysmobts binary? If the switching of the power should be delayed, the manager should do this as part of the management.