gerrit-log
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
April 2023
- 1 participants
- 2252 discussions
Attention is currently required from: pespin.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-mgw/+/32218
to look at the new patch set (#3).
Change subject: mgcp_codec: fix codec decision
......................................................................
mgcp_codec: fix codec decision
Unfortunately OsmoMGW was never really tested with multiple different
codecs on either side of the connection. While OsmoMSC and OsmoBSC only
assign exactly one codec on each side this has never been a problem,
however it might become a problem when a call againt assigns multiple
codecs on one side. This has been observed in a setup where OsmoMGW had
one leg towards an external call agent. Also due to recent upgrades to
the TTCN3 tests we are now able to simulate different codecs on both
sides to pinpoint issues.
Testing has shown that OsmoMGW has difficulties with multiple codecs.
The reason for this is that the function that makes the codec decision
was not fully finished. So let's finish the codec decision function and
let's also use that decision when patching the payload type of outgoing
RTP packets.
Related: OS#5461
Change-Id: I6c3291f825488e5d8ce136aeb18450156794aeb5
---
M include/osmocom/mgcp/mgcp_codec.h
M include/osmocom/mgcp/mgcp_trunk.h
M src/libosmo-mgcp/mgcp_codec.c
M src/libosmo-mgcp/mgcp_network.c
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_vty.c
M tests/mgcp/mgcp_test.c
M tests/mgcp/mgcp_test.ok
8 files changed, 286 insertions(+), 266 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/18/32218/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/32218
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I6c3291f825488e5d8ce136aeb18450156794aeb5
Gerrit-Change-Number: 32218
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
1
0
Attention is currently required from: pespin.
dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/32218 )
Change subject: mgcp_codec: fix codec decision
......................................................................
Patch Set 3:
(8 comments)
File include/osmocom/mgcp/mgcp_codec.h:
https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/3ce0af72_57723ec1
PS2, Line 16: int mgcp_codec_decide(struct mgcp_conn_rtp *conn, struct mgcp_conn_rtp *conn_opposite);
> my understanding is that this decides which codec is used in one direction between conn A and conn B […]
Done
File src/libosmo-mgcp/mgcp_codec.c:
https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/28f2c879_c1d1d047
PS2, Line 440: conn->end.codec = mgcp_codec_find_same(conn, found_same_codec_opposite);
> I wonder why do you need to call mgcp_codec_find_same() twice here, something looks wrong imho.
The problem is that it is not possible to assign codec_conn_dst to conn_src->end.codec since then the pointer in conn_src->end.codec becomes stale when conn_dst is freed. So we just search once more to get the pointer from the list within conn_src
https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/563f1f24_4f257dd8
PS2, Line 449: found_same_codec_opposite = codec_find_convertible(conn_opposite, &conn->end.codecs[i]);
> I wonder why do you need to call codec_find_convertible() twice here, something looks wrong imho.
(same as above)
https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/257caf90_c3a7843a
PS2, Line 461: }
> IIUC you are finding/selecting/setting the same codec A->B and B->A here, but I wonder if that reall […]
When we trying to find a convertible codec, then it indeed may be the case that A ends up with a different codec than B. But it will always be a compatible codec. What however is true is when you swap conn_src and conn_dst, then the result will be different but I see no problem with this, it would still be two codecs that are compatible.
This is also more a theoretical issue, normally one side (the leg pointing to the MSC) will assign exactly one codec.
File src/libosmo-mgcp/mgcp_network.c:
https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/bf1d569b_dc6ce036
PS2, Line 514: /* Lookup a suitable codec in the destination connection. */
> I see no lookup being done here anymore.
There was even more that I have overlooked.
File src/libosmo-mgcp/mgcp_protocol.c:
https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/f870f6af_3802cde0
PS2, Line 809: conn_opposite = mgcp_find_dst_conn(conn->conn);
> see, here we have a clear concept of conn_src ("conn" here) and conn_dst (returned by mgcp_find_dst_ […]
Done
https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/3ce68c38_04c74e72
PS2, Line 816: if (mgcp_codec_decide(conn, conn_rtp_opposite) != 0)
> in here you are deciding what codec is used to forward/transmit from conn_src to conn_dst.
Done
File src/libosmo-mgcp/mgcp_vty.c:
https://gerrit.osmocom.org/c/osmo-mgw/+/32218/comment/0f544b7f_291209de
PS2, Line 703: "allow-transcoding", "Allow transcoding\n")
> Add vty_out telling the user that this command is deprecated and is a NO-OP, so that they can drop i […]
Oh, looks like this has been forgotten on all other DEFUN_DEPRECATED functions as well.
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/32218
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I6c3291f825488e5d8ce136aeb18450156794aeb5
Gerrit-Change-Number: 32218
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 06 Apr 2023 11:25:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
1
0
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32221 )
Change subject: Fix octet 2 of NM GPRS Cell
......................................................................
Fix octet 2 of NM GPRS Cell
Octet 2 should contain the address of the GPRS cell in the GPRS NSE
object. Since there's 1 GPRS Cell per BTS and we have only 1 BTS in
osmo-bts, then this address should be 0.
Otherwise, osmo-bts answers sometimes using (0x00, 0xff,0xff) instead of
requested (0x00, 0x00, 0xff), for instance when ACKing an Admin Unlock.
This is kinda still fine since value 0xff has the meaning of "all"
addresses, and that means the only one available.
Still, it's not the proper way to identify the object, so this patch
fixes it.
Change-Id: I2ea05778f5b5ac335c75f3958324664553da7f0d
---
M src/common/bts.c
1 file changed, 20 insertions(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/common/bts.c b/src/common/bts.c
index 051f41b..29f0c56 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -280,7 +280,7 @@
memcpy(&bts->gprs.cell.timer, bts_cell_timer_default,
sizeof(bts->gprs.cell.timer));
gsm_mo_init(&bts->gprs.cell.mo, bts, NM_OC_GPRS_CELL,
- bts->nr, 0xff, 0xff);
+ bts->nr, 0, 0xff);
memcpy(&bts->gprs.cell.rlc_cfg, &rlc_cfg_default,
sizeof(bts->gprs.cell.rlc_cfg));
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32221
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I2ea05778f5b5ac335c75f3958324664553da7f0d
Gerrit-Change-Number: 32221
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
1
0
06 Apr '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32213 )
Change subject: Introduce NM FSM for GPRS NSE object
......................................................................
Introduce NM FSM for GPRS NSE object
Related: OS#5994
Change-Id: I01eadc63214a2eb5e1bce455c7e5b62bd41905ea
---
M include/osmo-bts/bts.h
M include/osmo-bts/nm_common_fsm.h
M src/common/Makefile.am
M src/common/bts.c
M src/common/nm_bts_sm_fsm.c
A src/common/nm_gprs_nse_fsm.c
M src/common/oml.c
M src/osmo-bts-lc15/oml.c
M src/osmo-bts-oc2g/oml.c
M src/osmo-bts-octphy/l1_oml.c
M src/osmo-bts-omldummy/bts_model.c
M src/osmo-bts-sysmo/oml.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-virtual/bts_model.c
14 files changed, 378 insertions(+), 56 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 2d0eec7..bbf5dc4 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -136,6 +136,13 @@
struct gsm_abis_mo mo;
};
+/* GPRS NSE; ip.access specific NM Object */
+struct gsm_gprs_nse {
+ struct gsm_abis_mo mo;
+ uint16_t nsei;
+ uint8_t timer[7];
+};
+
/* Struct that holds one OML-Address (Address of the BSC) */
struct bsc_oml_host {
struct llist_head list;
@@ -224,11 +231,7 @@
/* Not entirely sure how ip.access specific this is */
struct {
- struct {
- struct gsm_abis_mo mo;
- uint16_t nsei;
- uint8_t timer[7];
- } nse;
+ struct gsm_gprs_nse nse;
struct {
struct gsm_abis_mo mo;
uint16_t bvci;
@@ -396,6 +399,11 @@
return (struct gsm_bts *)container_of(site_mgr, struct gsm_bts, site_mgr);
}
+static inline struct gsm_bts *gsm_gprs_nse_get_bts(struct gsm_gprs_nse *nse)
+{
+ return (struct gsm_bts *)container_of(nse, struct gsm_bts, gprs.nse);
+}
+
struct gsm_bts *gsm_bts_alloc(void *talloc_ctx, uint8_t bts_num);
struct gsm_bts *gsm_bts_num(const struct gsm_network *net, int num);
diff --git a/include/osmo-bts/nm_common_fsm.h b/include/osmo-bts/nm_common_fsm.h
index 22a4be0..9264eea 100644
--- a/include/osmo-bts/nm_common_fsm.h
+++ b/include/osmo-bts/nm_common_fsm.h
@@ -94,3 +94,12 @@
NM_CHAN_ST_OP_ENABLED,
};
extern struct osmo_fsm nm_chan_fsm;
+
+/* GPRS NSE */
+enum nm_gprs_nse_op_fsm_states {
+ NM_GPRS_NSE_ST_OP_DISABLED_NOTINSTALLED,
+ NM_GPRS_NSE_ST_OP_DISABLED_DEPENDENCY,
+ NM_GPRS_NSE_ST_OP_DISABLED_OFFLINE,
+ NM_GPRS_NSE_ST_OP_ENABLED,
+};
+extern struct osmo_fsm nm_gprs_nse_fsm;
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 99f9924..cb5ff50 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -61,6 +61,7 @@
nm_bts_fsm.c \
nm_bb_transc_fsm.c \
nm_channel_fsm.c \
+ nm_gprs_nse_fsm.c \
nm_radio_carrier_fsm.c \
probes.d \
$(NULL)
diff --git a/src/common/bts.c b/src/common/bts.c
index de27ad8..051f41b 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -251,26 +251,32 @@
LOGL_INFO, NULL);
osmo_fsm_inst_update_id_f(bts->shutdown_fi, "bts%d", bts->nr);
+ /* NM SITE_MGR */
bts->site_mgr.mo.fi = osmo_fsm_inst_alloc(&nm_bts_sm_fsm, bts, &bts->site_mgr,
LOGL_INFO, "bts_sm");
gsm_mo_init(&bts->site_mgr.mo, bts, NM_OC_SITE_MANAGER,
0xff, 0xff, 0xff);
+ /* NM BTS */
bts->mo.fi = osmo_fsm_inst_alloc(&nm_bts_fsm, bts, bts,
LOGL_INFO, NULL);
osmo_fsm_inst_update_id_f(bts->mo.fi, "bts%d", bts->nr);
gsm_mo_init(&bts->mo, bts, NM_OC_BTS, bts->nr, 0xff, 0xff);
+ /* NM GPRS NSE */
+ bts->gprs.nse.mo.fi = osmo_fsm_inst_alloc(&nm_gprs_nse_fsm, bts, &bts->gprs.nse,
+ LOGL_INFO, NULL);
+ osmo_fsm_inst_update_id_f(bts->gprs.nse.mo.fi, "gprs_nse%d", bts->nr);
+ gsm_mo_init(&bts->gprs.nse.mo, bts, NM_OC_GPRS_NSE, bts->nr, 0xff, 0xff);
+ memcpy(&bts->gprs.nse.timer, bts_nse_timer_default,
+ sizeof(bts->gprs.nse.timer));
+
for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
bts->gprs.nsvc[i].bts = bts;
bts->gprs.nsvc[i].id = i;
gsm_mo_init(&bts->gprs.nsvc[i].mo, bts, NM_OC_GPRS_NSVC,
bts->nr, i, 0xff);
}
- memcpy(&bts->gprs.nse.timer, bts_nse_timer_default,
- sizeof(bts->gprs.nse.timer));
- gsm_mo_init(&bts->gprs.nse.mo, bts, NM_OC_GPRS_NSE,
- bts->nr, 0xff, 0xff);
memcpy(&bts->gprs.cell.timer, bts_cell_timer_default,
sizeof(bts->gprs.cell.timer));
gsm_mo_init(&bts->gprs.cell.mo, bts, NM_OC_GPRS_CELL,
@@ -372,9 +378,9 @@
/* Start with the site manager */
oml_mo_state_init(&bts->site_mgr.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
oml_mo_state_init(&bts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
+ oml_mo_state_init(&bts->gprs.nse.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
/* set BTS attr to dependency */
- oml_mo_state_init(&bts->gprs.nse.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
oml_mo_state_init(&bts->gprs.cell.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
oml_mo_state_init(&bts->gprs.nsvc[0].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
oml_mo_state_init(&bts->gprs.nsvc[1].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
@@ -446,12 +452,12 @@
LOGP(DOML, LOGL_INFO, "Main link established, sending NM Status.\n");
- /* BTS SITE MGR becomes Offline (tx SW ACT Report), BTS is DEPENDENCY */
+ /* BTS SITE MGR becomes Offline (tx SW ACT Report), BTS, NSE is DEPENDENCY */
osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_SW_ACT, NULL);
osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_SW_ACT, NULL);
+ osmo_fsm_inst_dispatch(bts->gprs.nse.mo.fi, NM_EV_SW_ACT, NULL);
/* those should all be in DEPENDENCY */
- oml_tx_state_changed(&bts->gprs.nse.mo);
oml_tx_state_changed(&bts->gprs.cell.mo);
oml_tx_state_changed(&bts->gprs.nsvc[0].mo);
oml_tx_state_changed(&bts->gprs.nsvc[1].mo);
diff --git a/src/common/nm_bts_sm_fsm.c b/src/common/nm_bts_sm_fsm.c
index 4767f9c..f775265 100644
--- a/src/common/nm_bts_sm_fsm.c
+++ b/src/common/nm_bts_sm_fsm.c
@@ -45,6 +45,7 @@
static void ev_dispatch_children(struct gsm_bts_sm *site_mgr, uint32_t event)
{
struct gsm_bts *bts = gsm_bts_sm_get_bts(site_mgr);
+ osmo_fsm_inst_dispatch(bts->gprs.nse.mo.fi, event, NULL);
osmo_fsm_inst_dispatch(bts->mo.fi, event, NULL);
}
diff --git a/src/common/nm_gprs_nse_fsm.c b/src/common/nm_gprs_nse_fsm.c
new file mode 100644
index 0000000..b658828
--- /dev/null
+++ b/src/common/nm_gprs_nse_fsm.c
@@ -0,0 +1,278 @@
+/* NM GPRS NSE FSM */
+
+/* (C) 2023 by sysmocom - s.m.f.c. GmbH <info(a)sysmocom.de>
+ * Author: Pau Espin Pedrol <pespin(a)sysmocom.de>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>
+
+#include <osmocom/core/fsm.h>
+#include <osmocom/core/tdef.h>
+#include <osmocom/gsm/protocol/gsm_12_21.h>
+
+#include <osmo-bts/logging.h>
+#include <osmo-bts/gsm_data.h>
+#include <osmo-bts/bts_model.h>
+#include <osmo-bts/bts.h>
+#include <osmo-bts/rsl.h>
+#include <osmo-bts/nm_common_fsm.h>
+#include <osmo-bts/phy_link.h>
+#include <osmo-bts/cbch.h>
+
+#define X(s) (1 << (s))
+
+#define nm_gprs_nse_fsm_state_chg(fi, NEXT_STATE) \
+ osmo_fsm_inst_state_chg(fi, NEXT_STATE, 0, 0)
+
+static void ev_dispatch_children(struct gsm_gprs_nse *nse, uint32_t event)
+{
+ /* TODO: once we have FSMs for GPRS Cell and GPRS NSVC: */
+#if 0
+ struct gsm_bts *bts = gsm_gprs_nse_get_bts(nse);
+ osmo_fsm_inst_dispatch(bts->gprs.cell.mo.fi, event, NULL);
+ if (bts->gprs.nsvc[0].fi)
+ osmo_fsm_inst_dispatch(bts->gprs.nsvc[0].fi, event, NULL);
+ if (bts->gprs.nsvc[1].fi)
+ osmo_fsm_inst_dispatch(bts->gprs.nsvc[1].fi, event, NULL);
+#endif
+}
+
+/* Can the NSE be enabled (OPSTARTed)? aka should it stay in "Disabled Dependency" state? */
+static bool nse_can_be_enabled(struct gsm_gprs_nse *nse)
+{
+ struct gsm_bts *bts = gsm_gprs_nse_get_bts(nse);
+ return bts->mo.nm_state.operational == NM_OPSTATE_ENABLED;
+}
+
+
+//////////////////////////
+// FSM STATE ACTIONS
+//////////////////////////
+
+static void st_op_disabled_notinstalled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+ struct gsm_gprs_nse *nse = (struct gsm_gprs_nse *)fi->priv;
+ /* Reset state here: */
+
+ nse->mo.setattr_success = false;
+ nse->mo.opstart_success = false;
+ oml_mo_state_chg(&nse->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED, NM_STATE_LOCKED);
+}
+
+static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+ struct gsm_gprs_nse *nse = (struct gsm_gprs_nse *)fi->priv;
+
+ switch (event) {
+ case NM_EV_SW_ACT:
+ oml_mo_tx_sw_act_rep(&nse->mo);
+ if (nse_can_be_enabled(nse))
+ nm_gprs_nse_fsm_state_chg(fi, NM_GPRS_NSE_ST_OP_DISABLED_OFFLINE);
+ else
+ nm_gprs_nse_fsm_state_chg(fi, NM_GPRS_NSE_ST_OP_DISABLED_DEPENDENCY);
+ return;
+ default:
+ OSMO_ASSERT(0);
+ }
+}
+
+static void st_op_disabled_dependency_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+ struct gsm_gprs_nse *nse = (struct gsm_gprs_nse *)fi->priv;
+ nse->mo.setattr_success = false;
+ nse->mo.opstart_success = false;
+ oml_mo_state_chg(&nse->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY, -1);
+}
+
+static void st_op_disabled_dependency(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+ struct gsm_gprs_nse *nse = (struct gsm_gprs_nse *)fi->priv;
+ struct gsm_bts *bts = gsm_gprs_nse_get_bts(nse);
+ struct nm_fsm_ev_setattr_data *setattr_data;
+ int rc;
+
+ switch (event) {
+ case NM_EV_RX_SETATTR:
+ setattr_data = (struct nm_fsm_ev_setattr_data *)data;
+ rc = bts_model_apply_oml(bts, setattr_data->msg,
+ &nse->mo, nse);
+ nse->mo.setattr_success = rc == 0;
+ oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
+ break;
+ case NM_EV_RX_OPSTART:
+ if (!nse->mo.setattr_success) {
+ oml_mo_opstart_nack(&nse->mo, NM_NACK_CANT_PERFORM);
+ return;
+ }
+ bts_model_opstart(bts, &nse->mo, nse);
+ break;
+ case NM_EV_OPSTART_ACK:
+ nse->mo.opstart_success = true;
+ oml_mo_opstart_ack(&nse->mo);
+ nm_gprs_nse_fsm_state_chg(fi, NM_CHAN_ST_OP_ENABLED);
+ return;
+ case NM_EV_OPSTART_NACK:
+ nse->mo.opstart_success = false;
+ oml_mo_opstart_nack(&nse->mo, (int)(intptr_t)data);
+ return;
+ default:
+ OSMO_ASSERT(0);
+ }
+}
+
+static void st_op_disabled_offline_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+ struct gsm_gprs_nse *nse = (struct gsm_gprs_nse *)fi->priv;
+ nse->mo.opstart_success = false;
+ oml_mo_state_chg(&nse->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE, -1);
+}
+
+static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+ struct gsm_gprs_nse *nse = (struct gsm_gprs_nse *)fi->priv;
+ struct gsm_bts *bts = gsm_gprs_nse_get_bts(nse);
+ struct nm_fsm_ev_setattr_data *setattr_data;
+ int rc;
+
+ switch (event) {
+ case NM_EV_RX_SETATTR:
+ setattr_data = (struct nm_fsm_ev_setattr_data *)data;
+ rc = bts_model_apply_oml(bts, setattr_data->msg, &nse->mo, bts);
+ nse->mo.setattr_success = rc == 0;
+ oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
+ break;
+ case NM_EV_RX_OPSTART:
+ if (!nse->mo.setattr_success) {
+ oml_mo_opstart_nack(&nse->mo, NM_NACK_CANT_PERFORM);
+ return;
+ }
+ bts_model_opstart(bts, &nse->mo, bts);
+ break;
+ case NM_EV_OPSTART_ACK:
+ nse->mo.opstart_success = true;
+ oml_mo_opstart_ack(&nse->mo);
+ nm_gprs_nse_fsm_state_chg(fi, NM_GPRS_NSE_ST_OP_ENABLED);
+ break; /* check statechg below */
+ case NM_EV_OPSTART_NACK:
+ nse->mo.opstart_success = false;
+ oml_mo_opstart_nack(&nse->mo, (int)(intptr_t)data);
+ return;
+ default:
+ OSMO_ASSERT(0);
+ }
+}
+
+static void st_op_enabled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+ struct gsm_gprs_nse *nse = (struct gsm_gprs_nse *)fi->priv;
+ oml_mo_state_chg(&nse->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
+}
+
+static void st_op_enabled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+}
+
+static void nm_gprs_nse_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+ struct gsm_gprs_nse *nse = (struct gsm_gprs_nse *)fi->priv;
+
+ switch (event) {
+ case NM_EV_SHUTDOWN_START:
+ /* Announce we start shutting down */
+ oml_mo_state_chg(&nse->mo, -1, -1, NM_STATE_SHUTDOWN);
+
+ /* Propagate event to children: */
+ ev_dispatch_children(nse, event);
+ break;
+ case NM_EV_SHUTDOWN_FINISH:
+ /* Propagate event to children: */
+ ev_dispatch_children(nse, event);
+ nm_gprs_nse_fsm_state_chg(fi, NM_GPRS_NSE_ST_OP_DISABLED_NOTINSTALLED);
+ break;
+ default:
+ OSMO_ASSERT(false);
+ }
+}
+
+static struct osmo_fsm_state nm_gprs_nse_fsm_states[] = {
+ [NM_GPRS_NSE_ST_OP_DISABLED_NOTINSTALLED] = {
+ .in_event_mask =
+ X(NM_EV_SW_ACT),
+ .out_state_mask =
+ X(NM_GPRS_NSE_ST_OP_DISABLED_NOTINSTALLED) |
+ X(NM_GPRS_NSE_ST_OP_DISABLED_DEPENDENCY) |
+ X(NM_GPRS_NSE_ST_OP_DISABLED_OFFLINE),
+ .name = "DISABLED_NOTINSTALLED",
+ .onenter = st_op_disabled_notinstalled_on_enter,
+ .action = st_op_disabled_notinstalled,
+ },
+ [NM_GPRS_NSE_ST_OP_DISABLED_DEPENDENCY] = {
+ .in_event_mask =
+ X(NM_EV_RX_SETATTR) |
+ 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 */
+ .out_state_mask =
+ X(NM_CHAN_ST_OP_DISABLED_NOTINSTALLED) |
+ X(NM_CHAN_ST_OP_DISABLED_OFFLINE) |
+ X(NM_CHAN_ST_OP_ENABLED), /* backward compatibility, buggy BSC */
+ .name = "DISABLED_DEPENDENCY",
+ .onenter = st_op_disabled_dependency_on_enter,
+ .action = st_op_disabled_dependency,
+ },
+ [NM_GPRS_NSE_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 =
+ X(NM_GPRS_NSE_ST_OP_DISABLED_NOTINSTALLED) |
+ X(NM_GPRS_NSE_ST_OP_ENABLED),
+ .name = "DISABLED_OFFLINE",
+ .onenter = st_op_disabled_offline_on_enter,
+ .action = st_op_disabled_offline,
+ },
+ [NM_GPRS_NSE_ST_OP_ENABLED] = {
+ .in_event_mask = 0,
+ .out_state_mask =
+ X(NM_GPRS_NSE_ST_OP_DISABLED_NOTINSTALLED),
+ .name = "ENABLED",
+ .onenter = st_op_enabled_on_enter,
+ .action = st_op_enabled,
+ },
+};
+
+struct osmo_fsm nm_gprs_nse_fsm = {
+ .name = "NM_GPRS_NSE_OP",
+ .states = nm_gprs_nse_fsm_states,
+ .num_states = ARRAY_SIZE(nm_gprs_nse_fsm_states),
+ .event_names = nm_fsm_event_names,
+ .allstate_action = nm_gprs_nse_allstate,
+ .allstate_event_mask = X(NM_EV_SHUTDOWN_START) |
+ X(NM_EV_SHUTDOWN_FINISH),
+ .log_subsys = DOML,
+};
+
+static __attribute__((constructor)) void nm_gprs_nse_fsm_init(void)
+{
+ OSMO_ASSERT(osmo_fsm_register(&nm_gprs_nse_fsm) == 0);
+}
diff --git a/src/common/oml.c b/src/common/oml.c
index a55ba44..5e8f0ad 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -1096,7 +1096,7 @@
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:
+ * NM_OC_GPRS_CELL or NM_OC_GPRS_NSVC. For those, don't go through FSM:
*/
return bts_model_opstart(bts, mo, obj);
}
@@ -1257,16 +1257,21 @@
* manufacturer related messages
*/
-static int oml_ipa_mo_set_attr_nse(void *obj, const struct tlv_parsed *tp)
+static int oml_ipa_mo_set_attr_nse(void *obj,
+ const struct msgb *msg,
+ const struct tlv_parsed *tp)
{
- struct gsm_bts *bts = container_of(obj, struct gsm_bts, gprs.nse);
+ struct gsm_gprs_nse *nse = obj;
+ struct gsm_bts *bts = gsm_gprs_nse_get_bts(nse);
+ struct nm_fsm_ev_setattr_data ev_data;
+ int rc;
if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_NSEI, 2))
- bts->gprs.nse.nsei =
+ nse->nsei =
ntohs(tlvp_val16_unal(tp, NM_ATT_IPACC_NSEI));
if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_NS_CFG, 7)) {
- memcpy(&bts->gprs.nse.timer,
+ memcpy(&nse->timer,
TLVP_VAL(tp, NM_ATT_IPACC_NS_CFG), 7);
}
@@ -1275,6 +1280,13 @@
TLVP_VAL(tp, NM_ATT_IPACC_BSSGP_CFG), 11);
}
+ ev_data = (struct nm_fsm_ev_setattr_data){
+ .msg = msg,
+ };
+ rc = osmo_fsm_inst_dispatch(nse->mo.fi, NM_EV_RX_SETATTR, &ev_data);
+ if (rc < 0)
+ return NM_NACK_CANT_PERFORM;
+
osmo_signal_dispatch(SS_GLOBAL, S_NEW_NSE_ATTR, bts);
return 0;
@@ -1420,28 +1432,6 @@
return 0;
}
-static int oml_ipa_mo_set_attr(struct gsm_bts *bts, const struct gsm_abis_mo *mo,
- void *obj, const struct tlv_parsed *tp)
-{
- int rc;
-
- switch (mo->obj_class) {
- case NM_OC_GPRS_NSE:
- rc = oml_ipa_mo_set_attr_nse(obj, tp);
- break;
- case NM_OC_GPRS_CELL:
- rc = oml_ipa_mo_set_attr_cell(obj, tp);
- break;
- case NM_OC_GPRS_NSVC:
- rc = oml_ipa_mo_set_attr_nsvc(obj, tp);
- break;
- default:
- rc = NM_NACK_OBJINST_UNKN;
- }
-
- return rc;
-}
-
static int oml_ipa_set_attr(struct gsm_bts *bts, struct msgb *msg)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
@@ -1468,18 +1458,37 @@
if (!mo || !obj)
return oml_fom_ack_nack(msg, NM_NACK_OBJINST_UNKN);
- rc = oml_ipa_mo_set_attr(bts, mo, obj, &tp);
- if (rc == 0) {
- /* Success: replace old MO attributes with new */
- /* merge existing MO attributes with new attributes */
- tp_merged = osmo_tlvp_copy(mo->nm_attr, bts);
- talloc_set_name_const(tp_merged, "oml_ipa_attr");
- osmo_tlvp_merge(tp_merged, &tp);
- talloc_free(mo->nm_attr);
- mo->nm_attr = tp_merged;
+
+ switch (mo->obj_class) {
+ case NM_OC_GPRS_NSE:
+ rc = oml_ipa_mo_set_attr_nse(obj, msg, &tp);
+ break;
+ case NM_OC_GPRS_CELL:
+ rc = oml_ipa_mo_set_attr_cell(obj, &tp);
+ break;
+ case NM_OC_GPRS_NSVC:
+ rc = oml_ipa_mo_set_attr_nsvc(obj, &tp);
+ break;
+ default:
+ rc = NM_NACK_OBJINST_UNKN;
}
- return oml_fom_ack_nack(msg, rc);
+ if (rc != 0)
+ return oml_fom_ack_nack(msg, rc);
+
+ /* Success: replace old MO attributes with new */
+ /* merge existing MO attributes with new attributes */
+ tp_merged = osmo_tlvp_copy(mo->nm_attr, bts);
+ talloc_set_name_const(tp_merged, "oml_ipa_attr");
+ osmo_tlvp_merge(tp_merged, &tp);
+ talloc_free(mo->nm_attr);
+ mo->nm_attr = tp_merged;
+
+ /* These are not yet handled through NM FSM: */
+ if (mo->obj_class == NM_OC_GPRS_CELL ||
+ mo->obj_class == NM_OC_GPRS_NSVC)
+ return oml_fom_ack_nack(msg, rc);
+ return rc;
}
static int rx_oml_ipa_rsl_connect(struct gsm_bts_trx *trx, struct msgb *msg,
diff --git a/src/osmo-bts-lc15/oml.c b/src/osmo-bts-lc15/oml.c
index 1ba5337..aec639d 100644
--- a/src/osmo-bts-lc15/oml.c
+++ b/src/osmo-bts-lc15/oml.c
@@ -1866,6 +1866,7 @@
case NM_OC_SITE_MANAGER:
case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
+ case NM_OC_GPRS_NSE:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
case NM_OC_RADIO_CARRIER:
@@ -1876,7 +1877,6 @@
ts = (struct gsm_bts_trx_ts*) obj;
rc = ts_opstart(ts);
break;
- case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
diff --git a/src/osmo-bts-oc2g/oml.c b/src/osmo-bts-oc2g/oml.c
index b679181..a3e09aa 100644
--- a/src/osmo-bts-oc2g/oml.c
+++ b/src/osmo-bts-oc2g/oml.c
@@ -1871,6 +1871,7 @@
case NM_OC_SITE_MANAGER:
case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
+ case NM_OC_GPRS_NSE:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
case NM_OC_RADIO_CARRIER:
@@ -1881,7 +1882,6 @@
ts = (struct gsm_bts_trx_ts*) obj;
rc = ts_opstart(ts);
break;
- case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index d0fd3b5..08d120b 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -1770,6 +1770,7 @@
case NM_OC_SITE_MANAGER:
case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
+ case NM_OC_GPRS_NSE:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
case NM_OC_RADIO_CARRIER:
@@ -1780,7 +1781,6 @@
ts = (struct gsm_bts_trx_ts*) obj;
rc = ts_connect_as(ts, ts->pchan, pchan_act_compl_cb, NULL);
break;
- case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -1, -1);
diff --git a/src/osmo-bts-omldummy/bts_model.c b/src/osmo-bts-omldummy/bts_model.c
index b9be5ff..04c4ab9 100644
--- a/src/osmo-bts-omldummy/bts_model.c
+++ b/src/osmo-bts-omldummy/bts_model.c
@@ -128,9 +128,9 @@
case NM_OC_BASEB_TRANSC:
case NM_OC_RADIO_CARRIER:
case NM_OC_CHANNEL:
+ case NM_OC_GPRS_NSE:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
- case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index 772e9f2..725ab09 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -1747,6 +1747,7 @@
case NM_OC_SITE_MANAGER:
case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
+ case NM_OC_GPRS_NSE:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
case NM_OC_RADIO_CARRIER:
@@ -1757,7 +1758,6 @@
ts = (struct gsm_bts_trx_ts*) obj;
rc = ts_opstart(ts);
break;
- case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index a135479..bf8393c 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -584,6 +584,7 @@
case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
case NM_OC_CHANNEL:
+ case NM_OC_GPRS_NSE:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
case NM_OC_RADIO_CARRIER:
@@ -591,7 +592,6 @@
trx = (struct gsm_bts_trx *) obj;
rc = trx_init(trx);
break;
- case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
diff --git a/src/osmo-bts-virtual/bts_model.c b/src/osmo-bts-virtual/bts_model.c
index b9f060c..a69e1d8 100644
--- a/src/osmo-bts-virtual/bts_model.c
+++ b/src/osmo-bts-virtual/bts_model.c
@@ -163,9 +163,9 @@
case NM_OC_RADIO_CARRIER:
case NM_OC_BASEB_TRANSC:
case NM_OC_CHANNEL:
+ case NM_OC_GPRS_NSE:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
- case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32213
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I01eadc63214a2eb5e1bce455c7e5b62bd41905ea
Gerrit-Change-Number: 32213
Gerrit-PatchSet: 9
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: merged
1
0
[S] Change in osmo-bts[master]: Rearrange declaration of struct gsm_bts_gprs_nsvc
by pespin 06 Apr '23
by pespin 06 Apr '23
06 Apr '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32224 )
Change subject: Rearrange declaration of struct gsm_bts_gprs_nsvc
......................................................................
Rearrange declaration of struct gsm_bts_gprs_nsvc
Move it together with the other similar objects like gprs_nse and
gprs_cell.
Move the "mo" field to the start of the struct, similar to the other
types.
Change-Id: I5dc020a6bab8c94ab831b6ca506bc5cb681d07a3
---
M include/osmo-bts/bts.h
1 file changed, 26 insertions(+), 12 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index c5a0709..03a29e4 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -72,18 +72,6 @@
#define bts_internal_flag_set(bts, flag) \
bts->flags |= (typeof(bts->flags)) flag
-struct gsm_bts_gprs_nsvc {
- struct gsm_bts *bts;
- /* data read via VTY config file, to configure the BTS
- * via OML from BSC */
- int id;
- uint16_t nsvci;
- struct osmo_sockaddr local; /* on the BTS */
- struct osmo_sockaddr remote; /* on the SGSN */
-
- struct gsm_abis_mo mo;
-};
-
struct gprs_rlc_cfg {
uint16_t parameter[_NUM_RLC_PAR];
struct {
@@ -136,6 +124,18 @@
struct gsm_abis_mo mo;
};
+/* GPRS NSVC; ip.access specific NM Object */
+struct gsm_bts_gprs_nsvc {
+ struct gsm_abis_mo mo;
+ struct gsm_bts *bts;
+ /* data read via VTY config file, to configure the BTS
+ * via OML from BSC */
+ int id;
+ uint16_t nsvci;
+ struct osmo_sockaddr local; /* on the BTS */
+ struct osmo_sockaddr remote; /* on the SGSN */
+};
+
/* GPRS NSE; ip.access specific NM Object */
struct gsm_gprs_nse {
struct gsm_abis_mo mo;
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32224
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I5dc020a6bab8c94ab831b6ca506bc5cb681d07a3
Gerrit-Change-Number: 32224
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
1
0
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32225 )
Change subject: Move NSVC structs to be part of NSE
......................................................................
Move NSVC structs to be part of NSE
The NSVCs exist inside an NSE. Rearrange data model to have proper
relations.
Change-Id: I1cfe9366594836c622673d461ab8b2edd1a2b58a
---
M include/osmo-bts/bts.h
M src/common/bts.c
M src/common/oml.c
M src/common/pcu_sock.c
M src/common/vty.c
5 files changed, 47 insertions(+), 31 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 03a29e4..6a4d23e 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -125,9 +125,10 @@
};
/* GPRS NSVC; ip.access specific NM Object */
-struct gsm_bts_gprs_nsvc {
+struct gsm_gprs_nse;
+struct gsm_gprs_nsvc {
struct gsm_abis_mo mo;
- struct gsm_bts *bts;
+ struct gsm_gprs_nse *nse;
/* data read via VTY config file, to configure the BTS
* via OML from BSC */
int id;
@@ -141,6 +142,7 @@
struct gsm_abis_mo mo;
uint16_t nsei;
uint8_t timer[7];
+ struct gsm_gprs_nsvc nsvc[2];
};
/* GPRS CELL; ip.access specific NM Object */
@@ -241,7 +243,6 @@
struct {
struct gsm_gprs_nse nse;
struct gsm_gprs_cell cell;
- struct gsm_bts_gprs_nsvc nsvc[2];
uint8_t rac;
} gprs;
diff --git a/src/common/bts.c b/src/common/bts.c
index 5845fb2..23e4456 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -232,6 +232,7 @@
struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num)
{
struct gsm_bts *bts = talloc_zero(ctx, struct gsm_bts);
+ struct gsm_gprs_nse *nse = &bts->gprs.nse;
int i;
if (!bts)
@@ -264,12 +265,11 @@
gsm_mo_init(&bts->mo, bts, NM_OC_BTS, bts->nr, 0xff, 0xff);
/* NM GPRS NSE */
- bts->gprs.nse.mo.fi = osmo_fsm_inst_alloc(&nm_gprs_nse_fsm, bts, &bts->gprs.nse,
+ nse->mo.fi = osmo_fsm_inst_alloc(&nm_gprs_nse_fsm, bts, nse,
LOGL_INFO, NULL);
- osmo_fsm_inst_update_id_f(bts->gprs.nse.mo.fi, "gprs_nse%d", bts->nr);
- gsm_mo_init(&bts->gprs.nse.mo, bts, NM_OC_GPRS_NSE, bts->nr, 0xff, 0xff);
- memcpy(&bts->gprs.nse.timer, bts_nse_timer_default,
- sizeof(bts->gprs.nse.timer));
+ osmo_fsm_inst_update_id_f(nse->mo.fi, "gprs_nse%d", bts->nr);
+ gsm_mo_init(&nse->mo, bts, NM_OC_GPRS_NSE, bts->nr, 0xff, 0xff);
+ memcpy(&nse->timer, bts_nse_timer_default, sizeof(nse->timer));
/* NM GPRS CELL */
bts->gprs.cell.mo.fi = osmo_fsm_inst_alloc(&nm_gprs_cell_fsm, bts, &bts->gprs.cell,
@@ -279,11 +279,11 @@
memcpy(&bts->gprs.cell.rlc_cfg, &rlc_cfg_default, sizeof(bts->gprs.cell.rlc_cfg));
memcpy(&bts->gprs.cell.timer, bts_cell_timer_default, sizeof(bts->gprs.cell.timer));
- for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
- bts->gprs.nsvc[i].bts = bts;
- bts->gprs.nsvc[i].id = i;
- gsm_mo_init(&bts->gprs.nsvc[i].mo, bts, NM_OC_GPRS_NSVC,
- bts->nr, i, 0xff);
+ for (i = 0; i < ARRAY_SIZE(nse->nsvc); i++) {
+ struct gsm_gprs_nsvc *nsvc = &nse->nsvc[i];
+ nsvc->nse = nse;
+ nsvc->id = i;
+ gsm_mo_init(&nsvc->mo, bts, NM_OC_GPRS_NSVC, nse->mo.obj_inst.bts_nr, i, 0xff);
}
/* create our primary TRX. It will be initialized during bts_init() */
@@ -384,8 +384,8 @@
oml_mo_state_init(&bts->gprs.cell.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
/* set BTS attr to dependency */
- oml_mo_state_init(&bts->gprs.nsvc[0].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
- oml_mo_state_init(&bts->gprs.nsvc[1].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
+ oml_mo_state_init(&bts->gprs.nse.nsvc[0].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
+ oml_mo_state_init(&bts->gprs.nse.nsvc[1].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
/* allocate a talloc pool for ORTP to ensure it doesn't have to go back
* to the libc malloc all the time */
@@ -460,8 +460,8 @@
osmo_fsm_inst_dispatch(bts->gprs.nse.mo.fi, NM_EV_SW_ACT, NULL);
/* those should all be in DEPENDENCY */
- oml_tx_state_changed(&bts->gprs.nsvc[0].mo);
- oml_tx_state_changed(&bts->gprs.nsvc[1].mo);
+ oml_tx_state_changed(&bts->gprs.nse.nsvc[0].mo);
+ oml_tx_state_changed(&bts->gprs.nse.nsvc[1].mo);
/* All other objects start off-line until the BTS Model code says otherwise */
for (i = 0; i < bts->num_trx; i++) {
diff --git a/src/common/oml.c b/src/common/oml.c
index e23a087..fd8c22c 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -1373,7 +1373,7 @@
return 0;
}
-static int oml_ipa_mo_set_attr_nsvc(struct gsm_bts_gprs_nsvc *nsvc,
+static int oml_ipa_mo_set_attr_nsvc(struct gsm_gprs_nsvc *nsvc,
const struct tlv_parsed *tp)
{
if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_NSVCI, 2))
@@ -1746,9 +1746,9 @@
mo = &bts->gprs.cell.mo;
break;
case NM_OC_GPRS_NSVC:
- if (obj_inst->trx_nr >= ARRAY_SIZE(bts->gprs.nsvc))
+ if (obj_inst->trx_nr >= ARRAY_SIZE(bts->gprs.nse.nsvc))
return NULL;
- mo = &bts->gprs.nsvc[obj_inst->trx_nr].mo;
+ mo = &bts->gprs.nse.nsvc[obj_inst->trx_nr].mo;
break;
}
return mo;
@@ -1813,9 +1813,9 @@
obj = &bts->gprs.cell;
break;
case NM_OC_GPRS_NSVC:
- if (obj_inst->trx_nr >= ARRAY_SIZE(bts->gprs.nsvc))
+ if (obj_inst->trx_nr >= ARRAY_SIZE(bts->gprs.nse.nsvc))
return NULL;
- obj = &bts->gprs.nsvc[obj_inst->trx_nr];
+ obj = &bts->gprs.nse.nsvc[obj_inst->trx_nr];
break;
}
return obj;
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 5e4b06b..bce067a 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -239,11 +239,13 @@
struct gprs_rlc_cfg *rlcc;
struct gsm_bts_trx *trx;
int i;
+ struct gsm_gprs_nse *nse;
LOGP(DPCU, LOGL_INFO, "Sending info\n");
/* FIXME: allow multiple BTS */
bts = llist_entry(net->bts_list.next, struct gsm_bts, list);
+ nse = &bts->gprs.nse;
rlcc = &bts->gprs.cell.rlc_cfg;
msg = pcu_msgb_alloc(PCU_IF_MSG_INFO_IND, bts->nr);
@@ -271,8 +273,8 @@
info_ind->rac = bts->gprs.rac;
/* NSE */
- info_ind->nsei = bts->gprs.nse.nsei;
- memcpy(info_ind->nse_timer, bts->gprs.nse.timer, 7);
+ info_ind->nsei = nse->nsei;
+ memcpy(info_ind->nse_timer, nse->timer, 7);
memcpy(info_ind->cell_timer, bts->gprs.cell.timer, 11);
/* cell attributes */
@@ -323,8 +325,8 @@
info_ind->initial_mcs = rlcc->initial_mcs;
/* NSVC */
- for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
- const struct gsm_bts_gprs_nsvc *nsvc = &bts->gprs.nsvc[i];
+ for (i = 0; i < ARRAY_SIZE(nse->nsvc); i++) {
+ const struct gsm_gprs_nsvc *nsvc = &nse->nsvc[i];
info_ind->nsvci[i] = nsvc->nsvci;
/* PCUIF beauty: the NSVC addresses are sent in the network byte order,
* while the port numbers need to be send in the host order. Sigh. */
@@ -363,7 +365,7 @@
void *hdlr_data, void *signal_data)
{
struct gsm_network *net = &bts_gsmnet;
- struct gsm_bts_gprs_nsvc *nsvc;
+ struct gsm_gprs_nsvc *nsvc;
struct gsm_bts *bts;
struct gsm48_system_information_type_3 *si3;
int id;
diff --git a/src/common/vty.c b/src/common/vty.c
index 1ef79f0..bc2afb6 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1361,21 +1361,22 @@
static void gprs_dump_vty(struct vty *vty, const struct gsm_bts *bts)
{
unsigned int i;
+ const struct gsm_gprs_nse *nse = &bts->gprs.nse;
/* GPRS parameters received from the BSC */
vty_out(vty, "BTS %u, RAC %u, NSEI %u, BVCI %u%s",
bts->nr, bts->gprs.rac,
- bts->gprs.nse.nsei,
+ nse->nsei,
bts->gprs.cell.bvci,
VTY_NEWLINE);
vty_out(vty, " Cell NM state: ");
net_dump_nmstate(vty, &bts->gprs.cell.mo.nm_state);
vty_out(vty, " NSE NM state: ");
- net_dump_nmstate(vty, &bts->gprs.nse.mo.nm_state);
+ net_dump_nmstate(vty, &nse->mo.nm_state);
- for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
- const struct gsm_bts_gprs_nsvc *nsvc = &bts->gprs.nsvc[i];
+ for (i = 0; i < ARRAY_SIZE(nse->nsvc); i++) {
+ const struct gsm_gprs_nsvc *nsvc = &nse->nsvc[i];
vty_out(vty, " NSVC%u (NSVCI %u) NM state: ", i, nsvc->nsvci);
net_dump_nmstate(vty, &nsvc->mo.nm_state);
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32225
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I1cfe9366594836c622673d461ab8b2edd1a2b58a
Gerrit-Change-Number: 32225
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
1
0
06 Apr '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32222 )
Change subject: Introduce NM FSM for GPRS Cell object
......................................................................
Introduce NM FSM for GPRS Cell object
Change-Id: I5fd1d17da09a5f0eee3d69fcb4788c106a240e21
Related: OS#5994
---
M include/osmo-bts/bts.h
M include/osmo-bts/nm_common_fsm.h
M src/common/Makefile.am
M src/common/bts.c
A src/common/nm_gprs_cell_fsm.c
M src/common/nm_gprs_nse_fsm.c
M src/common/oml.c
M src/osmo-bts-lc15/oml.c
M src/osmo-bts-oc2g/oml.c
M src/osmo-bts-octphy/l1_oml.c
M src/osmo-bts-omldummy/bts_model.c
M src/osmo-bts-sysmo/oml.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-virtual/bts_model.c
14 files changed, 330 insertions(+), 32 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index bbf5dc4..c5a0709 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -143,6 +143,14 @@
uint8_t timer[7];
};
+/* GPRS CELL; ip.access specific NM Object */
+struct gsm_gprs_cell {
+ struct gsm_abis_mo mo;
+ uint16_t bvci;
+ uint8_t timer[11];
+ struct gprs_rlc_cfg rlc_cfg;
+};
+
/* Struct that holds one OML-Address (Address of the BSC) */
struct bsc_oml_host {
struct llist_head list;
@@ -232,12 +240,7 @@
/* Not entirely sure how ip.access specific this is */
struct {
struct gsm_gprs_nse nse;
- struct {
- struct gsm_abis_mo mo;
- uint16_t bvci;
- uint8_t timer[11];
- struct gprs_rlc_cfg rlc_cfg;
- } cell;
+ struct gsm_gprs_cell cell;
struct gsm_bts_gprs_nsvc nsvc[2];
uint8_t rac;
} gprs;
@@ -404,6 +407,11 @@
return (struct gsm_bts *)container_of(nse, struct gsm_bts, gprs.nse);
}
+static inline struct gsm_bts *gsm_gprs_cell_get_bts(struct gsm_gprs_cell *cell)
+{
+ return (struct gsm_bts *)container_of(cell, struct gsm_bts, gprs.cell);
+}
+
struct gsm_bts *gsm_bts_alloc(void *talloc_ctx, uint8_t bts_num);
struct gsm_bts *gsm_bts_num(const struct gsm_network *net, int num);
diff --git a/include/osmo-bts/nm_common_fsm.h b/include/osmo-bts/nm_common_fsm.h
index 9264eea..c599a21 100644
--- a/include/osmo-bts/nm_common_fsm.h
+++ b/include/osmo-bts/nm_common_fsm.h
@@ -103,3 +103,12 @@
NM_GPRS_NSE_ST_OP_ENABLED,
};
extern struct osmo_fsm nm_gprs_nse_fsm;
+
+/* GPRS CELL */
+enum nm_gprs_cell_op_fsm_states {
+ NM_GPRS_CELL_ST_OP_DISABLED_NOTINSTALLED,
+ NM_GPRS_CELL_ST_OP_DISABLED_DEPENDENCY,
+ NM_GPRS_CELL_ST_OP_DISABLED_OFFLINE,
+ NM_GPRS_CELL_ST_OP_ENABLED,
+};
+extern struct osmo_fsm nm_gprs_cell_fsm;
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index cb5ff50..d904ab1 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -61,6 +61,7 @@
nm_bts_fsm.c \
nm_bb_transc_fsm.c \
nm_channel_fsm.c \
+ nm_gprs_cell_fsm.c \
nm_gprs_nse_fsm.c \
nm_radio_carrier_fsm.c \
probes.d \
diff --git a/src/common/bts.c b/src/common/bts.c
index 29f0c56..5845fb2 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -271,18 +271,20 @@
memcpy(&bts->gprs.nse.timer, bts_nse_timer_default,
sizeof(bts->gprs.nse.timer));
+ /* NM GPRS CELL */
+ bts->gprs.cell.mo.fi = osmo_fsm_inst_alloc(&nm_gprs_cell_fsm, bts, &bts->gprs.cell,
+ LOGL_INFO, NULL);
+ osmo_fsm_inst_update_id_f(bts->gprs.cell.mo.fi, "gprs_cell%d-0", bts->nr);
+ gsm_mo_init(&bts->gprs.cell.mo, bts, NM_OC_GPRS_CELL, bts->nr, 0, 0xff);
+ memcpy(&bts->gprs.cell.rlc_cfg, &rlc_cfg_default, sizeof(bts->gprs.cell.rlc_cfg));
+ memcpy(&bts->gprs.cell.timer, bts_cell_timer_default, sizeof(bts->gprs.cell.timer));
+
for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
bts->gprs.nsvc[i].bts = bts;
bts->gprs.nsvc[i].id = i;
gsm_mo_init(&bts->gprs.nsvc[i].mo, bts, NM_OC_GPRS_NSVC,
bts->nr, i, 0xff);
}
- memcpy(&bts->gprs.cell.timer, bts_cell_timer_default,
- sizeof(bts->gprs.cell.timer));
- gsm_mo_init(&bts->gprs.cell.mo, bts, NM_OC_GPRS_CELL,
- bts->nr, 0, 0xff);
- memcpy(&bts->gprs.cell.rlc_cfg, &rlc_cfg_default,
- sizeof(bts->gprs.cell.rlc_cfg));
/* create our primary TRX. It will be initialized during bts_init() */
bts->c0 = gsm_bts_trx_alloc(bts);
@@ -379,9 +381,9 @@
oml_mo_state_init(&bts->site_mgr.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
oml_mo_state_init(&bts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
oml_mo_state_init(&bts->gprs.nse.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
+ oml_mo_state_init(&bts->gprs.cell.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
/* set BTS attr to dependency */
- oml_mo_state_init(&bts->gprs.cell.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
oml_mo_state_init(&bts->gprs.nsvc[0].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
oml_mo_state_init(&bts->gprs.nsvc[1].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
@@ -458,7 +460,6 @@
osmo_fsm_inst_dispatch(bts->gprs.nse.mo.fi, NM_EV_SW_ACT, NULL);
/* those should all be in DEPENDENCY */
- oml_tx_state_changed(&bts->gprs.cell.mo);
oml_tx_state_changed(&bts->gprs.nsvc[0].mo);
oml_tx_state_changed(&bts->gprs.nsvc[1].mo);
diff --git a/src/common/nm_gprs_cell_fsm.c b/src/common/nm_gprs_cell_fsm.c
new file mode 100644
index 0000000..036df3e
--- /dev/null
+++ b/src/common/nm_gprs_cell_fsm.c
@@ -0,0 +1,258 @@
+/* NM GPRS Cell FSM */
+
+/* (C) 2023 by sysmocom - s.m.f.c. GmbH <info(a)sysmocom.de>
+ * Author: Pau Espin Pedrol <pespin(a)sysmocom.de>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public Licecell as published by
+ * the Free Software Foundation; either version 3 of the Licecell, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public Licecell for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public Licecell
+ * along with this program. If not, see <http://www.gnu.org/licecells/>.
+ *
+ */
+
+#include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>
+
+#include <osmocom/core/fsm.h>
+#include <osmocom/core/tdef.h>
+#include <osmocom/gsm/protocol/gsm_12_21.h>
+
+#include <osmo-bts/logging.h>
+#include <osmo-bts/gsm_data.h>
+#include <osmo-bts/bts_model.h>
+#include <osmo-bts/bts.h>
+#include <osmo-bts/rsl.h>
+#include <osmo-bts/nm_common_fsm.h>
+
+#define X(s) (1 << (s))
+
+#define nm_gprs_cell_fsm_state_chg(fi, NEXT_STATE) \
+ osmo_fsm_inst_state_chg(fi, NEXT_STATE, 0, 0)
+
+/* Can the GPRS Cell be enabled (OPSTARTed)? aka should it stay in "Disabled Dependency" state? */
+static bool gprs_cell_can_be_enabled(struct gsm_gprs_cell *cell)
+{
+ struct gsm_bts *bts = gsm_gprs_cell_get_bts(cell);
+ return bts->gprs.nse.mo.nm_state.operational == NM_OPSTATE_ENABLED;
+}
+
+
+//////////////////////////
+// FSM STATE ACTIONS
+//////////////////////////
+
+static void st_op_disabled_notinstalled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+ struct gsm_gprs_cell *cell = (struct gsm_gprs_cell *)fi->priv;
+ /* Reset state here: */
+
+ cell->mo.setattr_success = false;
+ cell->mo.opstart_success = false;
+ oml_mo_state_chg(&cell->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED, NM_STATE_LOCKED);
+}
+
+static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+ struct gsm_gprs_cell *cell = (struct gsm_gprs_cell *)fi->priv;
+
+ switch (event) {
+ case NM_EV_SW_ACT:
+ oml_mo_tx_sw_act_rep(&cell->mo);
+ if (gprs_cell_can_be_enabled(cell))
+ nm_gprs_cell_fsm_state_chg(fi, NM_GPRS_CELL_ST_OP_DISABLED_OFFLINE);
+ else
+ nm_gprs_cell_fsm_state_chg(fi, NM_GPRS_CELL_ST_OP_DISABLED_DEPENDENCY);
+ return;
+ default:
+ OSMO_ASSERT(0);
+ }
+}
+
+static void st_op_disabled_dependency_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+ struct gsm_gprs_cell *cell = (struct gsm_gprs_cell *)fi->priv;
+ cell->mo.setattr_success = false;
+ cell->mo.opstart_success = false;
+ oml_mo_state_chg(&cell->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY, -1);
+}
+
+static void st_op_disabled_dependency(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+ struct gsm_gprs_cell *cell = (struct gsm_gprs_cell *)fi->priv;
+ struct gsm_bts *bts = gsm_gprs_cell_get_bts(cell);
+ struct nm_fsm_ev_setattr_data *setattr_data;
+ int rc;
+
+ switch (event) {
+ case NM_EV_RX_SETATTR:
+ setattr_data = (struct nm_fsm_ev_setattr_data *)data;
+ rc = bts_model_apply_oml(bts, setattr_data->msg,
+ &cell->mo, cell);
+ cell->mo.setattr_success = rc == 0;
+ oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
+ break;
+ case NM_EV_RX_OPSTART:
+ if (!cell->mo.setattr_success) {
+ oml_mo_opstart_nack(&cell->mo, NM_NACK_CANT_PERFORM);
+ return;
+ }
+ bts_model_opstart(bts, &cell->mo, cell);
+ break;
+ case NM_EV_OPSTART_ACK:
+ cell->mo.opstart_success = true;
+ oml_mo_opstart_ack(&cell->mo);
+ nm_gprs_cell_fsm_state_chg(fi, NM_CHAN_ST_OP_ENABLED);
+ return;
+ case NM_EV_OPSTART_NACK:
+ cell->mo.opstart_success = false;
+ oml_mo_opstart_nack(&cell->mo, (int)(intptr_t)data);
+ return;
+ default:
+ OSMO_ASSERT(0);
+ }
+}
+
+static void st_op_disabled_offline_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+ struct gsm_gprs_cell *cell = (struct gsm_gprs_cell *)fi->priv;
+ cell->mo.opstart_success = false;
+ oml_mo_state_chg(&cell->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE, -1);
+}
+
+static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+ struct gsm_gprs_cell *cell = (struct gsm_gprs_cell *)fi->priv;
+ struct gsm_bts *bts = gsm_gprs_cell_get_bts(cell);
+ struct nm_fsm_ev_setattr_data *setattr_data;
+ int rc;
+
+ switch (event) {
+ case NM_EV_RX_SETATTR:
+ setattr_data = (struct nm_fsm_ev_setattr_data *)data;
+ rc = bts_model_apply_oml(bts, setattr_data->msg, &cell->mo, bts);
+ cell->mo.setattr_success = rc == 0;
+ oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
+ break;
+ case NM_EV_RX_OPSTART:
+ if (!cell->mo.setattr_success) {
+ oml_mo_opstart_nack(&cell->mo, NM_NACK_CANT_PERFORM);
+ return;
+ }
+ bts_model_opstart(bts, &cell->mo, bts);
+ break;
+ case NM_EV_OPSTART_ACK:
+ cell->mo.opstart_success = true;
+ oml_mo_opstart_ack(&cell->mo);
+ nm_gprs_cell_fsm_state_chg(fi, NM_GPRS_CELL_ST_OP_ENABLED);
+ break; /* check statechg below */
+ case NM_EV_OPSTART_NACK:
+ cell->mo.opstart_success = false;
+ oml_mo_opstart_nack(&cell->mo, (int)(intptr_t)data);
+ return;
+ default:
+ OSMO_ASSERT(0);
+ }
+}
+
+static void st_op_enabled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+ struct gsm_gprs_cell *cell = (struct gsm_gprs_cell *)fi->priv;
+ oml_mo_state_chg(&cell->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
+}
+
+static void st_op_enabled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+}
+
+static void nm_gprs_cell_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+ struct gsm_gprs_cell *cell = (struct gsm_gprs_cell *)fi->priv;
+
+ switch (event) {
+ case NM_EV_SHUTDOWN_START:
+ /* Announce we start shutting down */
+ oml_mo_state_chg(&cell->mo, -1, -1, NM_STATE_SHUTDOWN);
+ break;
+ case NM_EV_SHUTDOWN_FINISH:
+ nm_gprs_cell_fsm_state_chg(fi, NM_GPRS_CELL_ST_OP_DISABLED_NOTINSTALLED);
+ break;
+ default:
+ OSMO_ASSERT(false);
+ }
+}
+
+static struct osmo_fsm_state nm_gprs_cell_fsm_states[] = {
+ [NM_GPRS_CELL_ST_OP_DISABLED_NOTINSTALLED] = {
+ .in_event_mask =
+ X(NM_EV_SW_ACT),
+ .out_state_mask =
+ X(NM_GPRS_CELL_ST_OP_DISABLED_NOTINSTALLED) |
+ X(NM_GPRS_CELL_ST_OP_DISABLED_DEPENDENCY) |
+ X(NM_GPRS_CELL_ST_OP_DISABLED_OFFLINE),
+ .name = "DISABLED_NOTINSTALLED",
+ .onenter = st_op_disabled_notinstalled_on_enter,
+ .action = st_op_disabled_notinstalled,
+ },
+ [NM_GPRS_CELL_ST_OP_DISABLED_DEPENDENCY] = {
+ .in_event_mask =
+ X(NM_EV_RX_SETATTR) |
+ 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 */
+ .out_state_mask =
+ X(NM_CHAN_ST_OP_DISABLED_NOTINSTALLED) |
+ X(NM_CHAN_ST_OP_DISABLED_OFFLINE) |
+ X(NM_CHAN_ST_OP_ENABLED), /* backward compatibility, buggy BSC */
+ .name = "DISABLED_DEPENDENCY",
+ .onenter = st_op_disabled_dependency_on_enter,
+ .action = st_op_disabled_dependency,
+ },
+ [NM_GPRS_CELL_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 =
+ X(NM_GPRS_CELL_ST_OP_DISABLED_NOTINSTALLED) |
+ X(NM_GPRS_CELL_ST_OP_ENABLED),
+ .name = "DISABLED_OFFLINE",
+ .onenter = st_op_disabled_offline_on_enter,
+ .action = st_op_disabled_offline,
+ },
+ [NM_GPRS_CELL_ST_OP_ENABLED] = {
+ .in_event_mask = 0,
+ .out_state_mask =
+ X(NM_GPRS_CELL_ST_OP_DISABLED_NOTINSTALLED),
+ .name = "ENABLED",
+ .onenter = st_op_enabled_on_enter,
+ .action = st_op_enabled,
+ },
+};
+
+struct osmo_fsm nm_gprs_cell_fsm = {
+ .name = "NM_GPRS_CELL_OP",
+ .states = nm_gprs_cell_fsm_states,
+ .num_states = ARRAY_SIZE(nm_gprs_cell_fsm_states),
+ .event_names = nm_fsm_event_names,
+ .allstate_action = nm_gprs_cell_allstate,
+ .allstate_event_mask = X(NM_EV_SHUTDOWN_START) |
+ X(NM_EV_SHUTDOWN_FINISH),
+ .log_subsys = DOML,
+};
+
+static __attribute__((constructor)) void nm_gprs_cell_fsm_init(void)
+{
+ OSMO_ASSERT(osmo_fsm_register(&nm_gprs_cell_fsm) == 0);
+}
diff --git a/src/common/nm_gprs_nse_fsm.c b/src/common/nm_gprs_nse_fsm.c
index b658828..ba956fd 100644
--- a/src/common/nm_gprs_nse_fsm.c
+++ b/src/common/nm_gprs_nse_fsm.c
@@ -44,10 +44,10 @@
static void ev_dispatch_children(struct gsm_gprs_nse *nse, uint32_t event)
{
- /* TODO: once we have FSMs for GPRS Cell and GPRS NSVC: */
-#if 0
struct gsm_bts *bts = gsm_gprs_nse_get_bts(nse);
osmo_fsm_inst_dispatch(bts->gprs.cell.mo.fi, event, NULL);
+ /* TODO: once we have FSMs for GPRS Cell and GPRS NSVC: */
+#if 0
if (bts->gprs.nsvc[0].fi)
osmo_fsm_inst_dispatch(bts->gprs.nsvc[0].fi, event, NULL);
if (bts->gprs.nsvc[1].fi)
@@ -84,6 +84,7 @@
switch (event) {
case NM_EV_SW_ACT:
oml_mo_tx_sw_act_rep(&nse->mo);
+ ev_dispatch_children(nse, event);
if (nse_can_be_enabled(nse))
nm_gprs_nse_fsm_state_chg(fi, NM_GPRS_NSE_ST_OP_DISABLED_OFFLINE);
else
diff --git a/src/common/oml.c b/src/common/oml.c
index 5e8f0ad..e23a087 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -1096,7 +1096,7 @@
if (!mo->fi) {
/* Some NM objets still don't have FSMs implemented, such as
- * NM_OC_GPRS_CELL or NM_OC_GPRS_NSVC. For those, don't go through FSM:
+ * NM_OC_GPRS_NSVC. For those, don't go through FSM:
*/
return bts_model_opstart(bts, mo, obj);
}
@@ -1292,10 +1292,15 @@
return 0;
}
-static int oml_ipa_mo_set_attr_cell(void *obj, const struct tlv_parsed *tp)
+static int oml_ipa_mo_set_attr_cell(void *obj,
+ const struct msgb *msg,
+ const struct tlv_parsed *tp)
{
- struct gsm_bts *bts = container_of(obj, struct gsm_bts, gprs.cell);
- struct gprs_rlc_cfg *rlcc = &bts->gprs.cell.rlc_cfg;
+ struct gsm_gprs_cell *gprs_cell = obj;
+ struct gsm_bts *bts = gsm_gprs_cell_get_bts(gprs_cell);
+ struct gprs_rlc_cfg *rlcc = &gprs_cell->rlc_cfg;
+ struct nm_fsm_ev_setattr_data ev_data;
+ int rc;
const uint8_t *cur;
uint16_t _cur_s;
@@ -1309,8 +1314,7 @@
}
if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_BVCI, 2))
- bts->gprs.cell.bvci =
- ntohs(tlvp_val16_unal(tp, NM_ATT_IPACC_BVCI));
+ gprs_cell->bvci = ntohs(tlvp_val16_unal(tp, NM_ATT_IPACC_BVCI));
if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_RLC_CFG, 9)) {
cur = TLVP_VAL(tp, NM_ATT_IPACC_RLC_CFG);
@@ -1357,6 +1361,13 @@
rlcc->initial_mcs = *TLVP_VAL(tp, NM_ATT_IPACC_RLC_CFG_3);
}
+ ev_data = (struct nm_fsm_ev_setattr_data){
+ .msg = msg,
+ };
+ rc = osmo_fsm_inst_dispatch(gprs_cell->mo.fi, NM_EV_RX_SETATTR, &ev_data);
+ if (rc < 0)
+ return NM_NACK_CANT_PERFORM;
+
osmo_signal_dispatch(SS_GLOBAL, S_NEW_CELL_ATTR, bts);
return 0;
@@ -1464,7 +1475,7 @@
rc = oml_ipa_mo_set_attr_nse(obj, msg, &tp);
break;
case NM_OC_GPRS_CELL:
- rc = oml_ipa_mo_set_attr_cell(obj, &tp);
+ rc = oml_ipa_mo_set_attr_cell(obj, msg, &tp);
break;
case NM_OC_GPRS_NSVC:
rc = oml_ipa_mo_set_attr_nsvc(obj, &tp);
@@ -1485,8 +1496,7 @@
mo->nm_attr = tp_merged;
/* These are not yet handled through NM FSM: */
- if (mo->obj_class == NM_OC_GPRS_CELL ||
- mo->obj_class == NM_OC_GPRS_NSVC)
+ if (mo->obj_class == NM_OC_GPRS_NSVC)
return oml_fom_ack_nack(msg, rc);
return rc;
}
diff --git a/src/osmo-bts-lc15/oml.c b/src/osmo-bts-lc15/oml.c
index aec639d..fb1dc2d 100644
--- a/src/osmo-bts-lc15/oml.c
+++ b/src/osmo-bts-lc15/oml.c
@@ -1867,6 +1867,7 @@
case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
case NM_OC_GPRS_NSE:
+ case NM_OC_GPRS_CELL:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
case NM_OC_RADIO_CARRIER:
@@ -1877,7 +1878,6 @@
ts = (struct gsm_bts_trx_ts*) obj;
rc = ts_opstart(ts);
break;
- case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
rc = oml_mo_opstart_ack(mo);
diff --git a/src/osmo-bts-oc2g/oml.c b/src/osmo-bts-oc2g/oml.c
index a3e09aa..6690681 100644
--- a/src/osmo-bts-oc2g/oml.c
+++ b/src/osmo-bts-oc2g/oml.c
@@ -1872,6 +1872,7 @@
case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
case NM_OC_GPRS_NSE:
+ case NM_OC_GPRS_CELL:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
case NM_OC_RADIO_CARRIER:
@@ -1882,7 +1883,6 @@
ts = (struct gsm_bts_trx_ts*) obj;
rc = ts_opstart(ts);
break;
- case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
rc = oml_mo_opstart_ack(mo);
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index 08d120b..73daa2b 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -1771,6 +1771,7 @@
case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
case NM_OC_GPRS_NSE:
+ case NM_OC_GPRS_CELL:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
case NM_OC_RADIO_CARRIER:
@@ -1781,7 +1782,6 @@
ts = (struct gsm_bts_trx_ts*) obj;
rc = ts_connect_as(ts, ts->pchan, pchan_act_compl_cb, NULL);
break;
- case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -1, -1);
rc = oml_mo_opstart_ack(mo);
diff --git a/src/osmo-bts-omldummy/bts_model.c b/src/osmo-bts-omldummy/bts_model.c
index 04c4ab9..d85d9cd 100644
--- a/src/osmo-bts-omldummy/bts_model.c
+++ b/src/osmo-bts-omldummy/bts_model.c
@@ -129,9 +129,9 @@
case NM_OC_RADIO_CARRIER:
case NM_OC_CHANNEL:
case NM_OC_GPRS_NSE:
+ case NM_OC_GPRS_CELL:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
- case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
rc = oml_mo_opstart_ack(mo);
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index 725ab09..bf65b49 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -1748,6 +1748,7 @@
case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
case NM_OC_GPRS_NSE:
+ case NM_OC_GPRS_CELL:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
case NM_OC_RADIO_CARRIER:
@@ -1758,7 +1759,6 @@
ts = (struct gsm_bts_trx_ts*) obj;
rc = ts_opstart(ts);
break;
- case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
rc = oml_mo_opstart_ack(mo);
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index bf8393c..af7d034 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -585,6 +585,7 @@
case NM_OC_BASEB_TRANSC:
case NM_OC_CHANNEL:
case NM_OC_GPRS_NSE:
+ case NM_OC_GPRS_CELL:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
case NM_OC_RADIO_CARRIER:
@@ -592,7 +593,6 @@
trx = (struct gsm_bts_trx *) obj;
rc = trx_init(trx);
break;
- case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
rc = oml_mo_opstart_ack(mo);
diff --git a/src/osmo-bts-virtual/bts_model.c b/src/osmo-bts-virtual/bts_model.c
index a69e1d8..d758a82 100644
--- a/src/osmo-bts-virtual/bts_model.c
+++ b/src/osmo-bts-virtual/bts_model.c
@@ -164,9 +164,9 @@
case NM_OC_BASEB_TRANSC:
case NM_OC_CHANNEL:
case NM_OC_GPRS_NSE:
+ case NM_OC_GPRS_CELL:
rc = osmo_fsm_inst_dispatch(mo->fi, NM_EV_OPSTART_ACK, NULL);
break;
- case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
rc = oml_mo_opstart_ack(mo);
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32222
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I5fd1d17da09a5f0eee3d69fcb4788c106a240e21
Gerrit-Change-Number: 32222
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
1
0
06 Apr '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32232 )
Change subject: bts: Simplify lifecycle of BTS inside bts_list
......................................................................
bts: Simplify lifecycle of BTS inside bts_list
Add the BTS object to the BTS list as the first thing after it is created,
this way it's always attached and hence simply always detach it during
object free.
Change-Id: Ica4fe2a4be0c85b10702011e978be03bf970b0c8
---
M src/common/bts.c
1 file changed, 21 insertions(+), 12 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/common/bts.c b/src/common/bts.c
index 23e4456..af66311 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -226,6 +226,8 @@
}
bts_osmux_release(bts);
+
+ llist_del(&bts->list);
return 0;
}
@@ -240,6 +242,9 @@
talloc_set_destructor(bts, gsm_bts_talloc_destructor);
+ /* add to list of BTSs */
+ llist_add_tail(&bts->list, &bts_gsmnet.bts_list);
+
bts->nr = bts_num;
bts->num_trx = 0;
INIT_LLIST_HEAD(&bts->trx_list);
@@ -323,19 +328,14 @@
static int initialized = 0;
void *tall_rtp_ctx;
- /* add to list of BTSs */
- llist_add_tail(&bts->list, &bts_gsmnet.bts_list);
-
bts->band = GSM_BAND_1800;
INIT_LLIST_HEAD(&bts->agch_queue.queue);
bts->agch_queue.length = 0;
bts->ctrs = rate_ctr_group_alloc(bts, &bts_ctrg_desc, bts->nr);
- if (!bts->ctrs) {
- llist_del(&bts->list);
+ if (!bts->ctrs)
return -1;
- }
/* enable management with default levels,
* raise threshold to GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DISABLE to
@@ -394,10 +394,8 @@
/* Osmux */
rc = bts_osmux_init(bts);
- if (rc < 0) {
- llist_del(&bts->list);
+ if (rc < 0)
return rc;
- }
/* features implemented in 'common', available for all models,
* order alphabetically */
@@ -409,10 +407,8 @@
osmo_bts_set_feature(bts->features, BTS_FEAT_PAGING_COORDINATION);
rc = bts_model_init(bts);
- if (rc < 0) {
- llist_del(&bts->list);
+ if (rc < 0)
return rc;
- }
/* TRX0 was allocated early during gsm_bts_alloc, not later through VTY */
bts_model_trx_init(bts->c0);
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32232
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ica4fe2a4be0c85b10702011e978be03bf970b0c8
Gerrit-Change-Number: 32232
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
1
0
[M] Change in osmo-bts[master]: oml: Get rid of unused tlv_parsed param in bts_model_apply_oml()
by pespin 06 Apr '23
by pespin 06 Apr '23
06 Apr '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32203 )
Change subject: oml: Get rid of unused tlv_parsed param in bts_model_apply_oml()
......................................................................
oml: Get rid of unused tlv_parsed param in bts_model_apply_oml()
This way we simplify the common lower level interface. It can be added
in the future again if it is really required at any point to pass/use
specific TLV values in the device-specific code.
Change-Id: I64c6c6834e277b1d75a97d6f408e7e1b7ca85832
---
M include/osmo-bts/bts_model.h
M include/osmo-bts/nm_common_fsm.h
M src/common/nm_bb_transc_fsm.c
M src/common/nm_bts_fsm.c
M src/common/nm_channel_fsm.c
M src/common/nm_radio_carrier_fsm.c
M src/common/oml.c
M src/osmo-bts-lc15/oml.c
M src/osmo-bts-oc2g/oml.c
M src/osmo-bts-octphy/l1_oml.c
M src/osmo-bts-omldummy/bts_model.c
M src/osmo-bts-sysmo/oml.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-virtual/bts_model.c
M tests/stubs.c
15 files changed, 27 insertions(+), 28 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/osmo-bts/bts_model.h b/include/osmo-bts/bts_model.h
index 23a36ad..a8d25c1 100644
--- a/include/osmo-bts/bts_model.h
+++ b/include/osmo-bts/bts_model.h
@@ -20,8 +20,7 @@
struct tlv_parsed *old_attr, struct tlv_parsed *new_attr,
void *obj);
-int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
- struct tlv_parsed *new_attr, int obj_kind, void *obj);
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg, int obj_kind, void *obj);
int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo,
void *obj);
diff --git a/include/osmo-bts/nm_common_fsm.h b/include/osmo-bts/nm_common_fsm.h
index fddc76e..bc4077e 100644
--- a/include/osmo-bts/nm_common_fsm.h
+++ b/include/osmo-bts/nm_common_fsm.h
@@ -50,7 +50,6 @@
struct nm_fsm_ev_setattr_data {
const struct msgb *msg;
- struct tlv_parsed *tp;
};
diff --git a/src/common/nm_bb_transc_fsm.c b/src/common/nm_bb_transc_fsm.c
index 32cbaea..a14c869 100644
--- a/src/common/nm_bb_transc_fsm.c
+++ b/src/common/nm_bb_transc_fsm.c
@@ -127,7 +127,7 @@
switch (event) {
case NM_EV_RX_SETATTR:
setattr_data = (struct nm_fsm_ev_setattr_data *)data;
- rc = bts_model_apply_oml(trx->bts, setattr_data->msg, setattr_data->tp,
+ rc = bts_model_apply_oml(trx->bts, setattr_data->msg,
NM_OC_BASEB_TRANSC, bb_transc);
bb_transc->mo.setattr_success = rc == 0;
oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
diff --git a/src/common/nm_bts_fsm.c b/src/common/nm_bts_fsm.c
index 4fabbcd..b37a871 100644
--- a/src/common/nm_bts_fsm.c
+++ b/src/common/nm_bts_fsm.c
@@ -116,8 +116,7 @@
switch (event) {
case NM_EV_RX_SETATTR:
setattr_data = (struct nm_fsm_ev_setattr_data *)data;
- rc = bts_model_apply_oml(bts, setattr_data->msg, setattr_data->tp,
- NM_OC_BTS, bts);
+ rc = bts_model_apply_oml(bts, setattr_data->msg, NM_OC_BTS, bts);
bts->mo.setattr_success = rc == 0;
oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
break;
diff --git a/src/common/nm_channel_fsm.c b/src/common/nm_channel_fsm.c
index a2cf807..7a3cb84 100644
--- a/src/common/nm_channel_fsm.c
+++ b/src/common/nm_channel_fsm.c
@@ -99,7 +99,7 @@
switch (event) {
case NM_EV_RX_SETATTR:
setattr_data = (struct nm_fsm_ev_setattr_data *)data;
- rc = bts_model_apply_oml(ts->trx->bts, setattr_data->msg, setattr_data->tp,
+ rc = bts_model_apply_oml(ts->trx->bts, setattr_data->msg,
NM_OC_CHANNEL, ts);
ts->mo.setattr_success = rc == 0;
oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
@@ -145,7 +145,7 @@
switch (event) {
case NM_EV_RX_SETATTR:
setattr_data = (struct nm_fsm_ev_setattr_data *)data;
- rc = bts_model_apply_oml(ts->trx->bts, setattr_data->msg, setattr_data->tp,
+ rc = bts_model_apply_oml(ts->trx->bts, setattr_data->msg,
NM_OC_CHANNEL, ts);
ts->mo.setattr_success = rc == 0;
oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
diff --git a/src/common/nm_radio_carrier_fsm.c b/src/common/nm_radio_carrier_fsm.c
index 40bccb5..5e152b8 100644
--- a/src/common/nm_radio_carrier_fsm.c
+++ b/src/common/nm_radio_carrier_fsm.c
@@ -108,7 +108,7 @@
switch (event) {
case NM_EV_RX_SETATTR:
setattr_data = (struct nm_fsm_ev_setattr_data *)data;
- rc = bts_model_apply_oml(trx->bts, setattr_data->msg, setattr_data->tp,
+ rc = bts_model_apply_oml(trx->bts, setattr_data->msg,
NM_OC_RADIO_CARRIER, trx);
trx->mo.setattr_success = rc == 0;
oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
diff --git a/src/common/oml.c b/src/common/oml.c
index 2d81054..54996ea 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -755,7 +755,6 @@
ev_data = (struct nm_fsm_ev_setattr_data){
.msg = msg,
- .tp = tp_merged,
};
rc = osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_RX_SETATTR, &ev_data);
@@ -852,7 +851,6 @@
ev_data = (struct nm_fsm_ev_setattr_data){
.msg = msg,
- .tp = tp_merged,
};
rc = osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_RX_SETATTR, &ev_data);
@@ -1066,7 +1064,6 @@
ev_data = (struct nm_fsm_ev_setattr_data){
.msg = msg,
- .tp = tp_merged,
};
rc = osmo_fsm_inst_dispatch(ts->mo.fi, NM_EV_RX_SETATTR, &ev_data);
diff --git a/src/osmo-bts-lc15/oml.c b/src/osmo-bts-lc15/oml.c
index ad2653b..3c1a67a 100644
--- a/src/osmo-bts-lc15/oml.c
+++ b/src/osmo-bts-lc15/oml.c
@@ -1801,8 +1801,7 @@
}
/* callback from OML */
-int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
- struct tlv_parsed *new_attr, int kind, void *obj)
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
struct gsm_bts_trx *trx;
diff --git a/src/osmo-bts-oc2g/oml.c b/src/osmo-bts-oc2g/oml.c
index 6e42154..ead78fa 100644
--- a/src/osmo-bts-oc2g/oml.c
+++ b/src/osmo-bts-oc2g/oml.c
@@ -1810,8 +1810,7 @@
}
/* callback from OML */
-int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
- struct tlv_parsed *new_attr, int kind, void *obj)
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
struct gsm_bts_trx *trx;
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index 6b3148c..eaff105 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -1742,8 +1742,7 @@
}
/* callback from OML */
-int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
- struct tlv_parsed *new_attr, int kind, void *obj)
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
struct gsm_bts_trx *trx;
diff --git a/src/osmo-bts-omldummy/bts_model.c b/src/osmo-bts-omldummy/bts_model.c
index 18f1b2c..dad8ad9 100644
--- a/src/osmo-bts-omldummy/bts_model.c
+++ b/src/osmo-bts-omldummy/bts_model.c
@@ -93,8 +93,7 @@
return 0;
}
-int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
- struct tlv_parsed *new_attr, int kind, void *obj)
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
int rc;
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index 89f990c..aa63888 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -1714,8 +1714,7 @@
}
/* callback from OML */
-int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
- struct tlv_parsed *new_attr, int kind, void *obj)
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
struct gsm_bts_trx *trx;
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index bf8c75e..298d979 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -548,8 +548,7 @@
}
/* callback from OML */
-int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
- struct tlv_parsed *new_attr, int kind, void *obj)
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
int rc;
diff --git a/src/osmo-bts-virtual/bts_model.c b/src/osmo-bts-virtual/bts_model.c
index 7461ce6..04f2fc5 100644
--- a/src/osmo-bts-virtual/bts_model.c
+++ b/src/osmo-bts-virtual/bts_model.c
@@ -128,8 +128,7 @@
return 0;
}
-int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
- struct tlv_parsed *new_attr, int kind, void *obj)
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
int rc;
diff --git a/tests/stubs.c b/tests/stubs.c
index d05703c..d6fe643 100644
--- a/tests/stubs.c
+++ b/tests/stubs.c
@@ -18,8 +18,7 @@
{ return 0; }
int bts_model_trx_init(struct gsm_bts_trx *trx)
{ return 0; }
-int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
- struct tlv_parsed *new_attr, int kind, void *obj)
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg, int kind, void *obj)
{ return 0; }
int bts_model_trx_deact_rf(struct gsm_bts_trx *trx)
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32203
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I64c6c6834e277b1d75a97d6f408e7e1b7ca85832
Gerrit-Change-Number: 32203
Gerrit-PatchSet: 5
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
1
0
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32196 )
Change subject: nm: Drop NM_EV_SETATTR_{ACK/NACK}
......................................................................
nm: Drop NM_EV_SETATTR_{ACK/NACK}
Simply return error codes from lower layer implementations, and do
the OML handling in the common NM TS 12.21 FSMs.
As a result, we simplify the logic in the lower layers.
Change-Id: I281c07bb5ad88ee03542f092141cebe036d10aee
---
M include/osmo-bts/bts_model.h
M include/osmo-bts/nm_common_fsm.h
M src/common/nm_bb_transc_fsm.c
M src/common/nm_bts_fsm.c
M src/common/nm_bts_sm_fsm.c
M src/common/nm_channel_fsm.c
M src/common/nm_common_fsm.c
M src/common/nm_radio_carrier_fsm.c
M src/osmo-bts-lc15/oml.c
M src/osmo-bts-oc2g/oml.c
M src/osmo-bts-octphy/l1_oml.c
M src/osmo-bts-omldummy/bts_model.c
M src/osmo-bts-sysmo/oml.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-virtual/bts_model.c
M tests/stubs.c
16 files changed, 69 insertions(+), 138 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/osmo-bts/bts_model.h b/include/osmo-bts/bts_model.h
index ef93fda..23a36ad 100644
--- a/include/osmo-bts/bts_model.h
+++ b/include/osmo-bts/bts_model.h
@@ -20,7 +20,7 @@
struct tlv_parsed *old_attr, struct tlv_parsed *new_attr,
void *obj);
-int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
struct tlv_parsed *new_attr, int obj_kind, void *obj);
int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo,
diff --git a/include/osmo-bts/nm_common_fsm.h b/include/osmo-bts/nm_common_fsm.h
index 2363779..fddc76e 100644
--- a/include/osmo-bts/nm_common_fsm.h
+++ b/include/osmo-bts/nm_common_fsm.h
@@ -31,8 +31,6 @@
enum nm_fsm_events {
NM_EV_SW_ACT,
NM_EV_RX_SETATTR, /* data: struct nm_fsm_ev_setattr_data */
- NM_EV_SETATTR_ACK, /* data: struct nm_fsm_ev_setattr_data */
- NM_EV_SETATTR_NACK, /* data: struct nm_fsm_ev_setattr_data */
NM_EV_OPSTART_ACK,
NM_EV_OPSTART_NACK,
NM_EV_SHUTDOWN_START,
@@ -51,9 +49,8 @@
extern const struct value_string nm_fsm_event_names[];
struct nm_fsm_ev_setattr_data {
- struct msgb *msg;
+ const struct msgb *msg;
struct tlv_parsed *tp;
- int cause; /* set in NM_EV_SETATTR_(N)ACK */
};
diff --git a/src/common/nm_bb_transc_fsm.c b/src/common/nm_bb_transc_fsm.c
index 82ef89d..32cbaea 100644
--- a/src/common/nm_bb_transc_fsm.c
+++ b/src/common/nm_bb_transc_fsm.c
@@ -122,13 +122,15 @@
struct nm_fsm_ev_setattr_data *setattr_data;
bool phy_state_connected;
bool rsl_link_connected;
+ int rc;
switch (event) {
- case NM_EV_SETATTR_ACK:
- case NM_EV_SETATTR_NACK:
+ case NM_EV_RX_SETATTR:
setattr_data = (struct nm_fsm_ev_setattr_data *)data;
- bb_transc->mo.setattr_success = setattr_data->cause == 0;
- oml_fom_ack_nack_copy_msg(setattr_data->msg, setattr_data->cause);
+ rc = bts_model_apply_oml(trx->bts, setattr_data->msg, setattr_data->tp,
+ NM_OC_BASEB_TRANSC, bb_transc);
+ bb_transc->mo.setattr_success = rc == 0;
+ oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
break;
case NM_EV_OPSTART_ACK:
bb_transc->mo.opstart_success = true;
@@ -245,8 +247,7 @@
},
[NM_BBTRANSC_ST_OP_DISABLED_OFFLINE] = {
.in_event_mask =
- X(NM_EV_SETATTR_ACK) |
- X(NM_EV_SETATTR_NACK) |
+ X(NM_EV_RX_SETATTR) |
X(NM_EV_OPSTART_ACK) |
X(NM_EV_OPSTART_NACK) |
X(NM_EV_RSL_UP) |
diff --git a/src/common/nm_bts_fsm.c b/src/common/nm_bts_fsm.c
index 8ff57fe..4fabbcd 100644
--- a/src/common/nm_bts_fsm.c
+++ b/src/common/nm_bts_fsm.c
@@ -118,13 +118,8 @@
setattr_data = (struct nm_fsm_ev_setattr_data *)data;
rc = bts_model_apply_oml(bts, setattr_data->msg, setattr_data->tp,
NM_OC_BTS, bts);
- (void)rc;
- break;
- case NM_EV_SETATTR_ACK:
- case NM_EV_SETATTR_NACK:
- setattr_data = (struct nm_fsm_ev_setattr_data *)data;
- bts->mo.setattr_success = setattr_data->cause == 0;
- oml_fom_ack_nack_copy_msg(setattr_data->msg, setattr_data->cause);
+ bts->mo.setattr_success = rc == 0;
+ oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
break;
case NM_EV_OPSTART_ACK:
bts->mo.opstart_success = true;
@@ -186,8 +181,6 @@
[NM_BTS_ST_OP_DISABLED_OFFLINE] = {
.in_event_mask =
X(NM_EV_RX_SETATTR) |
- X(NM_EV_SETATTR_ACK) |
- X(NM_EV_SETATTR_NACK) |
X(NM_EV_OPSTART_ACK) |
X(NM_EV_OPSTART_NACK),
.out_state_mask =
diff --git a/src/common/nm_bts_sm_fsm.c b/src/common/nm_bts_sm_fsm.c
index 66c4077..708656f 100644
--- a/src/common/nm_bts_sm_fsm.c
+++ b/src/common/nm_bts_sm_fsm.c
@@ -86,13 +86,15 @@
{
struct gsm_bts_sm *site_mgr = (struct gsm_bts_sm *)fi->priv;
struct nm_fsm_ev_setattr_data *setattr_data;
+ int rc;
switch (event) {
- case NM_EV_SETATTR_ACK:
- case NM_EV_SETATTR_NACK:
+ case NM_EV_RX_SETATTR:
setattr_data = (struct nm_fsm_ev_setattr_data *)data;
- site_mgr->mo.setattr_success = setattr_data->cause == 0;
- oml_fom_ack_nack_copy_msg(setattr_data->msg, setattr_data->cause);
+ /* No bts_model_apply_oml() needed yet for site_mgr obj yet: */
+ rc = 0;
+ site_mgr->mo.setattr_success = rc == 0;
+ oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
break;
case NM_EV_OPSTART_ACK:
site_mgr->mo.opstart_success = true;
@@ -153,8 +155,7 @@
},
[NM_BTS_SM_ST_OP_DISABLED_OFFLINE] = {
.in_event_mask =
- X(NM_EV_SETATTR_ACK) |
- X(NM_EV_SETATTR_NACK) |
+ X(NM_EV_RX_SETATTR) |
X(NM_EV_OPSTART_ACK) |
X(NM_EV_OPSTART_NACK),
.out_state_mask =
diff --git a/src/common/nm_channel_fsm.c b/src/common/nm_channel_fsm.c
index 557d5b9..a2cf807 100644
--- a/src/common/nm_channel_fsm.c
+++ b/src/common/nm_channel_fsm.c
@@ -101,13 +101,8 @@
setattr_data = (struct nm_fsm_ev_setattr_data *)data;
rc = bts_model_apply_oml(ts->trx->bts, setattr_data->msg, setattr_data->tp,
NM_OC_CHANNEL, ts);
- (void)rc;
- break;
- case NM_EV_SETATTR_ACK:
- case NM_EV_SETATTR_NACK:
- setattr_data = (struct nm_fsm_ev_setattr_data *)data;
- ts->mo.setattr_success = setattr_data->cause == 0;
- oml_fom_ack_nack_copy_msg(setattr_data->msg, setattr_data->cause);
+ ts->mo.setattr_success = rc == 0;
+ oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
break;
case NM_EV_OPSTART_ACK:
LOGPFSML(fi, LOGL_NOTICE, "BSC trying to activate TS while still in avail=dependency. "
@@ -152,13 +147,8 @@
setattr_data = (struct nm_fsm_ev_setattr_data *)data;
rc = bts_model_apply_oml(ts->trx->bts, setattr_data->msg, setattr_data->tp,
NM_OC_CHANNEL, ts);
- (void)rc;
- break;
- case NM_EV_SETATTR_ACK:
- case NM_EV_SETATTR_NACK:
- setattr_data = (struct nm_fsm_ev_setattr_data *)data;
- ts->mo.setattr_success = setattr_data->cause == 0;
- oml_fom_ack_nack_copy_msg(setattr_data->msg, setattr_data->cause);
+ ts->mo.setattr_success = rc == 0;
+ oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
break;
case NM_EV_OPSTART_ACK:
ts->mo.opstart_success = true;
@@ -235,8 +225,6 @@
[NM_CHAN_ST_OP_DISABLED_DEPENDENCY] = {
.in_event_mask =
X(NM_EV_RX_SETATTR) |
- X(NM_EV_SETATTR_ACK) |
- X(NM_EV_SETATTR_NACK) |
X(NM_EV_OPSTART_ACK) | /* backward compatibility, buggy BSC */
X(NM_EV_OPSTART_NACK) |
X(NM_EV_BBTRANSC_ENABLED) |
@@ -254,8 +242,6 @@
[NM_CHAN_ST_OP_DISABLED_OFFLINE] = {
.in_event_mask =
X(NM_EV_RX_SETATTR) |
- X(NM_EV_SETATTR_ACK) |
- X(NM_EV_SETATTR_NACK) |
X(NM_EV_OPSTART_ACK) |
X(NM_EV_OPSTART_NACK) |
X(NM_EV_BBTRANSC_DISABLED) |
diff --git a/src/common/nm_common_fsm.c b/src/common/nm_common_fsm.c
index 6a8d3d1..5298e4d 100644
--- a/src/common/nm_common_fsm.c
+++ b/src/common/nm_common_fsm.c
@@ -25,9 +25,7 @@
const struct value_string nm_fsm_event_names[] = {
{ NM_EV_SW_ACT, "SW_ACT" },
- { NM_EV_SETATTR_ACK, "RX_SETATTR" },
- { NM_EV_SETATTR_ACK, "SETATTR_ACK" },
- { NM_EV_SETATTR_NACK, "SETATTR_NACK" },
+ { NM_EV_RX_SETATTR, "RX_SETATTR" },
{ NM_EV_OPSTART_ACK, "OPSTART_ACK" },
{ NM_EV_OPSTART_NACK, "OPSTART_NACK" },
{ NM_EV_SHUTDOWN_START, "SHUTDOWN_START" },
diff --git a/src/common/nm_radio_carrier_fsm.c b/src/common/nm_radio_carrier_fsm.c
index 587847f..40bccb5 100644
--- a/src/common/nm_radio_carrier_fsm.c
+++ b/src/common/nm_radio_carrier_fsm.c
@@ -110,13 +110,8 @@
setattr_data = (struct nm_fsm_ev_setattr_data *)data;
rc = bts_model_apply_oml(trx->bts, setattr_data->msg, setattr_data->tp,
NM_OC_RADIO_CARRIER, trx);
- (void)rc;
- break;
- case NM_EV_SETATTR_ACK:
- case NM_EV_SETATTR_NACK:
- setattr_data = (struct nm_fsm_ev_setattr_data *)data;
- trx->mo.setattr_success = setattr_data->cause == 0;
- oml_fom_ack_nack_copy_msg(setattr_data->msg, setattr_data->cause);
+ trx->mo.setattr_success = rc == 0;
+ oml_fom_ack_nack_copy_msg(setattr_data->msg, rc);
break;
case NM_EV_OPSTART_ACK:
trx->mo.opstart_success = true;
@@ -227,8 +222,6 @@
[NM_RCARRIER_ST_OP_DISABLED_OFFLINE] = {
.in_event_mask =
X(NM_EV_RX_SETATTR) |
- X(NM_EV_SETATTR_ACK) |
- X(NM_EV_SETATTR_NACK) |
X(NM_EV_OPSTART_ACK) |
X(NM_EV_OPSTART_NACK) |
X(NM_EV_RSL_UP) |
diff --git a/src/osmo-bts-lc15/oml.c b/src/osmo-bts-lc15/oml.c
index 9502765..ad2653b 100644
--- a/src/osmo-bts-lc15/oml.c
+++ b/src/osmo-bts-lc15/oml.c
@@ -1801,16 +1801,10 @@
}
/* callback from OML */
-int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
struct tlv_parsed *new_attr, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
- 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;
struct gsm_bts_trx *trx;
struct lc15l1_hdl *fl1h;
@@ -1856,10 +1850,7 @@
break;
}
- rc = osmo_fsm_inst_dispatch(mo->fi,
- ev_data.cause == 0 ? NM_EV_SETATTR_ACK : NM_EV_SETATTR_NACK,
- &ev_data);
- return rc;
+ return 0;
}
/* callback from OML */
diff --git a/src/osmo-bts-oc2g/oml.c b/src/osmo-bts-oc2g/oml.c
index 40c1c85..6e42154 100644
--- a/src/osmo-bts-oc2g/oml.c
+++ b/src/osmo-bts-oc2g/oml.c
@@ -1810,16 +1810,10 @@
}
/* callback from OML */
-int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
struct tlv_parsed *new_attr, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
- 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;
struct gsm_bts_trx *trx;
struct oc2gl1_hdl *fl1h;
uint8_t cell_size;
@@ -1861,10 +1855,7 @@
break;
}
- rc = osmo_fsm_inst_dispatch(mo->fi,
- ev_data.cause == 0 ? NM_EV_SETATTR_ACK : NM_EV_SETATTR_NACK,
- &ev_data);
- return rc;
+ return 0;
}
/* callback from OML */
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index 8ffd1ac..6b3148c 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -1742,30 +1742,20 @@
}
/* callback from OML */
-int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
struct tlv_parsed *new_attr, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
- 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;
struct gsm_bts_trx *trx;
switch (foh->msg_type) {
case NM_MT_SET_RADIO_ATTR:
trx = obj;
- /*struct octphy_hdl *fl1h = trx_octphy_hdl(trx); */
power_ramp_start(trx, get_p_target_mdBm(trx, 0), 0, NULL);
break;
}
- rc = osmo_fsm_inst_dispatch(mo->fi,
- ev_data.cause == 0 ? NM_EV_SETATTR_ACK : NM_EV_SETATTR_NACK,
- &ev_data);
- return rc;
+ return 0;
}
diff --git a/src/osmo-bts-omldummy/bts_model.c b/src/osmo-bts-omldummy/bts_model.c
index af358b6..18f1b2c 100644
--- a/src/osmo-bts-omldummy/bts_model.c
+++ b/src/osmo-bts-omldummy/bts_model.c
@@ -93,32 +93,27 @@
return 0;
}
-int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
struct tlv_parsed *new_attr, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
- 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;
switch (foh->msg_type) {
case NM_MT_SET_BTS_ATTR:
- ev_data.cause = vbts_set_bts(obj);
+ rc = vbts_set_bts(obj);
break;
case NM_MT_SET_RADIO_ATTR:
- ev_data.cause = vbts_set_trx(obj);
+ rc = vbts_set_trx(obj);
break;
case NM_MT_SET_CHAN_ATTR:
- ev_data.cause = vbts_set_ts(obj);
+ rc = vbts_set_ts(obj);
+ break;
+ default:
+ rc = 0;
break;
}
- rc = osmo_fsm_inst_dispatch(mo->fi,
- ev_data.cause == 0 ? NM_EV_SETATTR_ACK : NM_EV_SETATTR_NACK,
- &ev_data);
return rc;
}
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index 12b50bf..89f990c 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -1714,16 +1714,10 @@
}
/* callback from OML */
-int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
struct tlv_parsed *new_attr, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
- 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;
struct gsm_bts_trx *trx;
struct femtol1_hdl *fl1h;
@@ -1738,10 +1732,7 @@
break;
}
- rc = osmo_fsm_inst_dispatch(mo->fi,
- ev_data.cause == 0 ? NM_EV_SETATTR_ACK : NM_EV_SETATTR_NACK,
- &ev_data);
- return rc;
+ return 0;
}
/* callback from OML */
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 1834cf5..bf8c75e 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -548,32 +548,27 @@
}
/* callback from OML */
-int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
struct tlv_parsed *new_attr, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
- 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;
switch (foh->msg_type) {
case NM_MT_SET_BTS_ATTR:
- ev_data.cause = trx_set_bts(obj);
+ rc = trx_set_bts(obj);
break;
case NM_MT_SET_RADIO_ATTR:
- ev_data.cause = trx_set_trx(obj);
+ rc = trx_set_trx(obj);
break;
case NM_MT_SET_CHAN_ATTR:
- ev_data.cause = trx_set_ts(obj);
+ rc = trx_set_ts(obj);
+ break;
+ default:
+ rc = 0;
break;
}
- rc = osmo_fsm_inst_dispatch(mo->fi,
- ev_data.cause == 0 ? NM_EV_SETATTR_ACK : NM_EV_SETATTR_NACK,
- &ev_data);
return rc;
}
diff --git a/src/osmo-bts-virtual/bts_model.c b/src/osmo-bts-virtual/bts_model.c
index 477ffb3..7461ce6 100644
--- a/src/osmo-bts-virtual/bts_model.c
+++ b/src/osmo-bts-virtual/bts_model.c
@@ -128,32 +128,27 @@
return 0;
}
-int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
struct tlv_parsed *new_attr, int kind, void *obj)
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
- 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;
switch (foh->msg_type) {
case NM_MT_SET_BTS_ATTR:
- ev_data.cause = vbts_set_bts(obj);
+ rc = vbts_set_bts(obj);
break;
case NM_MT_SET_RADIO_ATTR:
- ev_data.cause = vbts_set_trx(obj);
+ rc = vbts_set_trx(obj);
break;
case NM_MT_SET_CHAN_ATTR:
- ev_data.cause = vbts_set_ts(obj);
+ rc = vbts_set_ts(obj);
+ break;
+ default:
+ rc = 0;
break;
}
- rc = osmo_fsm_inst_dispatch(mo->fi,
- ev_data.cause == 0 ? NM_EV_SETATTR_ACK : NM_EV_SETATTR_NACK,
- &ev_data);
return rc;
}
diff --git a/tests/stubs.c b/tests/stubs.c
index b24dfc9..d05703c 100644
--- a/tests/stubs.c
+++ b/tests/stubs.c
@@ -18,7 +18,7 @@
{ return 0; }
int bts_model_trx_init(struct gsm_bts_trx *trx)
{ return 0; }
-int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
+int bts_model_apply_oml(struct gsm_bts *bts, const struct msgb *msg,
struct tlv_parsed *new_attr, int kind, void *obj)
{ return 0; }
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32196
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I281c07bb5ad88ee03542f092141cebe036d10aee
Gerrit-Change-Number: 32196
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
1
0