abis_nm: Merge signals S_NM_STATECHG_ADM and S_NM_STATECHG_OPER

Having 2 signals makes all code handling them more complex, specially
because S_NM_STATE_CHG_OPER could actually provide any change in
admin/oper/availability.
Both signals already provided the same kind of data (the whole
admin/oper/avail state change), so let's simply merge the signals
themselves. Current code really doesn't act differently for those 2
signals anyway.

Change-Id: Ia86d20a42b859063d0327b940ba528ec1438b04a
This commit is contained in:
Pau Espin 2022-05-04 15:37:02 +02:00
parent 5cc9ed5567
commit 633523167d
7 changed files with 10 additions and 13 deletions

View File

@ -69,8 +69,7 @@ enum signal_nm {
S_NM_IPACC_RESTART_ACK, /* nanoBTS has send a restart ack */
S_NM_IPACC_RESTART_NACK,/* nanoBTS has send a restart ack */
S_NM_TEST_REP, /* GSM 12.21 Test Report */
S_NM_STATECHG_OPER, /* Operational State changed*/
S_NM_STATECHG_ADM, /* Administrative State changed */
S_NM_STATECHG, /* NM Oper/Admin/Avail State changed. arg is struct nm_statechg_signal_data*/
S_NM_OM2K_CONF_RES, /* OM2K Configuration Result */
S_NM_OPSTART_ACK, /* Received OPSTART ACK, arg is struct msgb *oml_msg */
S_NM_OPSTART_NACK, /* Received OPSTART NACK, arg is struct msgb *oml_msg */
@ -127,6 +126,7 @@ struct ipacc_ack_signal_data {
struct abis_om2k_mo;
/* data for <SS_NM, S_NM_STATECHG>: */
struct nm_statechg_signal_data {
struct gsm_bts *bts;
uint8_t obj_class;

View File

@ -367,8 +367,7 @@ static int nm_sig_cb(unsigned int subsys, unsigned int signal,
printf("The BTS has nacked the restart. Exiting.\n");
exit(0);
break;
case S_NM_STATECHG_OPER:
case S_NM_STATECHG_ADM:
case S_NM_STATECHG:
nsd = signal_data;
nm_state_event(signal, nsd->obj_class, nsd->obj, nsd->old_state,
nsd->new_state, nsd->obj_inst);
@ -687,7 +686,7 @@ static int nm_state_event(int evt, uint8_t obj_class, void *obj,
bootstrap_om(trx);
found_trx = 1;
}
} else if (evt == S_NM_STATECHG_OPER &&
} else if (evt == S_NM_STATECHG &&
obj_class == NM_OC_RADIO_CARRIER &&
new_state->availability == NM_AVSTATE_OFF_LINE) {
struct gsm_bts_trx *trx = obj;

View File

@ -230,7 +230,7 @@ static int update_admstate(struct gsm_bts *bts, uint8_t obj_class,
nsd.old_state = nm_state;
nsd.new_state = &new_state;
nsd.obj_inst = obj_inst;
osmo_signal_dispatch(SS_NM, S_NM_STATECHG_ADM, &nsd);
osmo_signal_dispatch(SS_NM, S_NM_STATECHG, &nsd);
nm_state->administrative = adm_state;
@ -297,7 +297,7 @@ static int abis_nm_rx_statechg_rep(struct msgb *mb)
nsd.new_state = &new_state;
nsd.obj_inst = &foh->obj_inst;
nsd.bts = bts;
osmo_signal_dispatch(SS_NM, S_NM_STATECHG_OPER, &nsd);
osmo_signal_dispatch(SS_NM, S_NM_STATECHG, &nsd);
nm_state->operational = new_state.operational;
nm_state->availability = new_state.availability;
if (nm_state->administrative == 0)

View File

@ -994,7 +994,7 @@ static void update_mo_state(struct gsm_bts *bts, struct abis_om2k_mo *mo, uint8_
nsd.new_state = &new_state;
nsd.om2k_mo = mo;
osmo_signal_dispatch(SS_NM, S_NM_STATECHG_ADM, &nsd);
osmo_signal_dispatch(SS_NM, S_NM_STATECHG, &nsd);
nm_state->availability = new_state.availability;
}

View File

@ -419,7 +419,7 @@ static int acc_ramp_nm_sig_cb(unsigned int subsys, unsigned int signal, void *ha
bool trigger_ramping = false, abort_ramping = false;
/* Handled signals map to an Administrative State Change ACK, or a State Changed Event Report. */
if (signal != S_NM_STATECHG_ADM && signal != S_NM_STATECHG_OPER)
if (signal != S_NM_STATECHG)
return 0;
if (nsd->obj_class != NM_OC_RADIO_CARRIER)

View File

@ -457,8 +457,7 @@ static int bts_ipa_nm_sig_cb(unsigned int subsys, unsigned int signal,
switch (signal) {
case S_NM_SW_ACTIV_REP:
return sw_activ_rep(signal_data);
case S_NM_STATECHG_OPER:
case S_NM_STATECHG_ADM:
case S_NM_STATECHG:
return nm_statechg_event(signal, signal_data);
case S_NM_OPSTART_ACK:
nm_rx_opstart_ack(signal_data);

View File

@ -204,8 +204,7 @@ static int nm_sig_cb(unsigned int subsys, unsigned int signal,
return 0;
switch (signal) {
case S_NM_STATECHG_OPER:
case S_NM_STATECHG_ADM:
case S_NM_STATECHG:
nm_statechg_evt(signal, signal_data);
break;
default: