nm: Apply OPSTART through NM FSMs
This way we have further control on how to handle the OPSTART messages received. For instance, NACK them if the NM object FSMs are not at the expected correct state. Related: OS#5992 Change-Id: I5df0bfb4cc812c11c7a00a8ffa882ae1915d562f
This commit is contained in:
parent
92d1d1582b
commit
cea6c230ad
|
@ -31,6 +31,7 @@
|
|||
enum nm_fsm_events {
|
||||
NM_EV_SW_ACT,
|
||||
NM_EV_RX_SETATTR, /* data: struct nm_fsm_ev_setattr_data */
|
||||
NM_EV_RX_OPSTART,
|
||||
NM_EV_OPSTART_ACK,
|
||||
NM_EV_OPSTART_NACK,
|
||||
NM_EV_SHUTDOWN_START,
|
||||
|
|
|
@ -132,6 +132,9 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
|
|||
bb_transc->mo.setattr_success = rc == 0;
|
||||
oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
|
||||
break;
|
||||
case NM_EV_RX_OPSTART:
|
||||
bts_model_opstart(trx->bts, &bb_transc->mo, bb_transc);
|
||||
break;
|
||||
case NM_EV_OPSTART_ACK:
|
||||
bb_transc->mo.opstart_success = true;
|
||||
oml_mo_opstart_ack(&bb_transc->mo);
|
||||
|
@ -248,6 +251,7 @@ static struct osmo_fsm_state nm_bb_transc_fsm_states[] = {
|
|||
[NM_BBTRANSC_ST_OP_DISABLED_OFFLINE] = {
|
||||
.in_event_mask =
|
||||
X(NM_EV_RX_SETATTR) |
|
||||
X(NM_EV_RX_OPSTART) |
|
||||
X(NM_EV_OPSTART_ACK) |
|
||||
X(NM_EV_OPSTART_NACK) |
|
||||
X(NM_EV_RSL_UP) |
|
||||
|
|
|
@ -120,6 +120,9 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
|
|||
bts->mo.setattr_success = rc == 0;
|
||||
oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
|
||||
break;
|
||||
case NM_EV_RX_OPSTART:
|
||||
bts_model_opstart(bts, &bts->mo, bts);
|
||||
break;
|
||||
case NM_EV_OPSTART_ACK:
|
||||
bts->mo.opstart_success = true;
|
||||
oml_mo_opstart_ack(&bts->mo);
|
||||
|
@ -180,6 +183,7 @@ static struct osmo_fsm_state nm_bts_fsm_states[] = {
|
|||
[NM_BTS_ST_OP_DISABLED_OFFLINE] = {
|
||||
.in_event_mask =
|
||||
X(NM_EV_RX_SETATTR) |
|
||||
X(NM_EV_RX_OPSTART) |
|
||||
X(NM_EV_OPSTART_ACK) |
|
||||
X(NM_EV_OPSTART_NACK),
|
||||
.out_state_mask =
|
||||
|
|
|
@ -96,6 +96,9 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
|
|||
site_mgr->mo.setattr_success = rc == 0;
|
||||
oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
|
||||
break;
|
||||
case NM_EV_RX_OPSTART:
|
||||
bts_model_opstart(NULL, &site_mgr->mo, site_mgr);
|
||||
break;
|
||||
case NM_EV_OPSTART_ACK:
|
||||
site_mgr->mo.opstart_success = true;
|
||||
oml_mo_opstart_ack(&site_mgr->mo);
|
||||
|
@ -156,6 +159,7 @@ static struct osmo_fsm_state nm_bts_sm_fsm_states[] = {
|
|||
[NM_BTS_SM_ST_OP_DISABLED_OFFLINE] = {
|
||||
.in_event_mask =
|
||||
X(NM_EV_RX_SETATTR) |
|
||||
X(NM_EV_RX_OPSTART) |
|
||||
X(NM_EV_OPSTART_ACK) |
|
||||
X(NM_EV_OPSTART_NACK),
|
||||
.out_state_mask =
|
||||
|
|
|
@ -104,9 +104,12 @@ static void st_op_disabled_dependency(struct osmo_fsm_inst *fi, uint32_t event,
|
|||
ts->mo.setattr_success = rc == 0;
|
||||
oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
|
||||
break;
|
||||
case NM_EV_RX_OPSTART:
|
||||
LOGPFSML(fi, LOGL_NOTICE, "BSC trying to activate TS while still in avail=dependency. "
|
||||
"Allowing it to stay backward-compatible with older osmo-bts versions, but BSC is wrong.\n");
|
||||
bts_model_opstart(ts->trx->bts, &ts->mo, ts);
|
||||
break;
|
||||
case NM_EV_OPSTART_ACK:
|
||||
LOGPFSML(fi, LOGL_NOTICE, "BSC trying to activate TS while still in avail=dependency. "
|
||||
"Allowing it to stay backward-compatible with older osmo-bts versions, but BSC is wrong.\n");
|
||||
ts->mo.opstart_success = true;
|
||||
oml_mo_opstart_ack(&ts->mo);
|
||||
nm_chan_fsm_state_chg(fi, NM_CHAN_ST_OP_ENABLED);
|
||||
|
@ -150,6 +153,9 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
|
|||
ts->mo.setattr_success = rc == 0;
|
||||
oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
|
||||
break;
|
||||
case NM_EV_RX_OPSTART:
|
||||
bts_model_opstart(ts->trx->bts, &ts->mo, ts);
|
||||
break;
|
||||
case NM_EV_OPSTART_ACK:
|
||||
ts->mo.opstart_success = true;
|
||||
oml_mo_opstart_ack(&ts->mo);
|
||||
|
@ -225,8 +231,9 @@ static struct osmo_fsm_state nm_chan_fsm_states[] = {
|
|||
[NM_CHAN_ST_OP_DISABLED_DEPENDENCY] = {
|
||||
.in_event_mask =
|
||||
X(NM_EV_RX_SETATTR) |
|
||||
X(NM_EV_OPSTART_ACK) | /* backward compatibility, buggy BSC */
|
||||
X(NM_EV_OPSTART_NACK) |
|
||||
X(NM_EV_RX_OPSTART) | /* backward compatibility, buggy BSC */
|
||||
X(NM_EV_OPSTART_ACK) | /* backward compatibility, buggy BSC */
|
||||
X(NM_EV_OPSTART_NACK) | /* backward compatibility, buggy BSC */
|
||||
X(NM_EV_BBTRANSC_ENABLED) |
|
||||
X(NM_EV_RCARRIER_ENABLED) |
|
||||
X(NM_EV_BBTRANSC_DISABLED) |
|
||||
|
@ -242,6 +249,7 @@ static struct osmo_fsm_state nm_chan_fsm_states[] = {
|
|||
[NM_CHAN_ST_OP_DISABLED_OFFLINE] = {
|
||||
.in_event_mask =
|
||||
X(NM_EV_RX_SETATTR) |
|
||||
X(NM_EV_RX_OPSTART) |
|
||||
X(NM_EV_OPSTART_ACK) |
|
||||
X(NM_EV_OPSTART_NACK) |
|
||||
X(NM_EV_BBTRANSC_DISABLED) |
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
const struct value_string nm_fsm_event_names[] = {
|
||||
{ NM_EV_SW_ACT, "SW_ACT" },
|
||||
{ NM_EV_RX_SETATTR, "RX_SETATTR" },
|
||||
{ NM_EV_RX_OPSTART, "RX_OPSTART" },
|
||||
{ NM_EV_OPSTART_ACK, "OPSTART_ACK" },
|
||||
{ NM_EV_OPSTART_NACK, "OPSTART_NACK" },
|
||||
{ NM_EV_SHUTDOWN_START, "SHUTDOWN_START" },
|
||||
|
|
|
@ -113,6 +113,9 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
|
|||
trx->mo.setattr_success = rc == 0;
|
||||
oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
|
||||
break;
|
||||
case NM_EV_RX_OPSTART:
|
||||
bts_model_opstart(trx->bts, &trx->mo, trx);
|
||||
break;
|
||||
case NM_EV_OPSTART_ACK:
|
||||
trx->mo.opstart_success = true;
|
||||
oml_mo_opstart_ack(&trx->mo);
|
||||
|
@ -222,6 +225,7 @@ static struct osmo_fsm_state nm_rcarrier_fsm_states[] = {
|
|||
[NM_RCARRIER_ST_OP_DISABLED_OFFLINE] = {
|
||||
.in_event_mask =
|
||||
X(NM_EV_RX_SETATTR) |
|
||||
X(NM_EV_RX_OPSTART) |
|
||||
X(NM_EV_OPSTART_ACK) |
|
||||
X(NM_EV_OPSTART_NACK) |
|
||||
X(NM_EV_RSL_UP) |
|
||||
|
|
|
@ -1078,6 +1078,7 @@ static int oml_rx_opstart(struct gsm_bts *bts, struct msgb *msg)
|
|||
struct abis_om_fom_hdr *foh = msgb_l3(msg);
|
||||
struct gsm_abis_mo *mo;
|
||||
void *obj;
|
||||
int rc;
|
||||
|
||||
DEBUGPFOH(DOML, foh, "Rx OPSTART\n");
|
||||
|
||||
|
@ -1093,8 +1094,17 @@ static int oml_rx_opstart(struct gsm_bts *bts, struct msgb *msg)
|
|||
return oml_mo_opstart_ack(mo);
|
||||
}
|
||||
|
||||
/* Step 3: Ask BTS driver to apply the opstart */
|
||||
return bts_model_opstart(bts, mo, obj);
|
||||
if (!mo->fi) {
|
||||
/* Some NM objets still don't have FSMs implemented, such as
|
||||
* NM_OC_GPRS_NSE, NM_OC_GPRS_CELL or NM_OC_GPRS_NSVC. For those, don't go through FSM:
|
||||
*/
|
||||
return bts_model_opstart(bts, mo, obj);
|
||||
}
|
||||
|
||||
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_RX_OPSTART, NULL);
|
||||
if (rc < 0)
|
||||
return oml_fom_ack_nack(msg, NM_NACK_CANT_PERFORM);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int oml_rx_chg_adm_state(struct gsm_bts *bts, struct msgb *msg)
|
||||
|
|
Loading…
Reference in New Issue