aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/l1_if.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-09-17 21:26:50 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-09-22 12:56:58 +0200
commit68a39a86177cad0c49d9f892d1f12a49df5b9bd0 (patch)
treef4c3dbc5ce9a1be6c1922cdfdb962d117f421ba7 /src/osmo-bts-trx/l1_if.c
parent5a2d8716ef412f11bdd61c353894e0725836c3ff (diff)
nm_*fsm: Make FSMs aware of object being properly configured or not
This will allow in the future advertising children objects that the parent object has been configured. It is useful for instance to let TRX know that the BTS is configured. Change-Id: Ie319465fd0e991bab8451ea34ec72ff3702533d2
Diffstat (limited to 'src/osmo-bts-trx/l1_if.c')
-rw-r--r--src/osmo-bts-trx/l1_if.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 6b417f40..90adde29 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -555,21 +555,38 @@ int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
struct tlv_parsed *new_attr, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
- int cause = 0;
+ struct gsm_abis_mo *mo = gsm_objclass2mo(bts, foh->obj_class, &foh->obj_inst);
+ struct nm_fsm_ev_setattr_data ev_data = {
+ .msg = msg,
+ .cause = 0,
+ };
+ int rc;
+
+ /* TODO: NM Object without FSM: */
+ switch (foh->obj_class) {
+ case NM_OC_GPRS_NSE:
+ case NM_OC_GPRS_CELL:
+ case NM_OC_GPRS_NSVC:
+ return oml_fom_ack_nack(ev_data.msg, ev_data.cause);
+ }
switch (foh->msg_type) {
case NM_MT_SET_BTS_ATTR:
- cause = trx_set_bts(obj, new_attr);
+ ev_data.cause = trx_set_bts(obj, new_attr);
break;
case NM_MT_SET_RADIO_ATTR:
- cause = trx_set_trx(obj);
+ ev_data.cause = trx_set_trx(obj);
break;
case NM_MT_SET_CHAN_ATTR:
- cause = trx_set_ts(obj);
+ ev_data.cause = trx_set_ts(obj);
break;
}
- return oml_fom_ack_nack(msg, cause);
+ rc = osmo_fsm_inst_dispatch(mo->fi,
+ ev_data.cause == 0 ? NM_EV_SETATTR_ACK : NM_EV_SETATTR_NACK,
+ &ev_data);
+ /* msgb ownsership is transferred to FSM if it received ev: */
+ return rc == 0 ? 1 : 0;
}
/* callback from OML */