mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-bts.git
synced 2025-11-05 14:43:28 +00:00
sysmo,oc2g,lc15: Make RadioChannel MO depend on RadioCarrier MO
lower layer specific APIs require first to enable the TRX object (GsmL1_PrimId_MphInitReq, which requires ARFCN received during Set Radio Carrier Attributes) before enabling the per-TS structure. Hence, OPSTART must happen in RCARRIER MO before OPSTART can be sent to the Radio Channel MOs, otherwise the initialization of the TS objet will fail and OPSTART for the RadioChannel MO will send back a NACK. In order to avoid this, we need to keep the RadioChannel MO announced as "Disabled Dependency" until RCARRIER is OPSTARTed. Related: OS#5157 Change-Id: I8c6e5ff98c32a3cd5006f5e5ed6875bcabb1d85f
This commit is contained in:
@@ -57,6 +57,9 @@ const char *btsvariant2str(enum gsm_bts_type_variant v);
|
||||
* measurement data is passed using a separate MPH INFO MEAS IND.
|
||||
* (See also ticket: OS#2977) */
|
||||
#define BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB (1 << 1)
|
||||
/* Whether the BTS model requires RadioCarrier MO to be in Enabled state
|
||||
* (OPSTARTed) before OPSTARTing the RadioChannel MOs. See OS#5157 */
|
||||
#define BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER (1 << 2)
|
||||
|
||||
/* BTS implementation flags (internal use, not exposed via OML) */
|
||||
#define bts_internal_flag_get(bts, flag) \
|
||||
|
||||
@@ -39,7 +39,8 @@ enum nm_fsm_events {
|
||||
NM_EV_BBTRANSC_INSTALLED, /* Radio Channel only */
|
||||
NM_EV_BBTRANSC_ENABLED, /* Radio Channel only */
|
||||
NM_EV_BBTRANSC_DISABLED, /* Radio Channel only */
|
||||
|
||||
NM_EV_RCARRIER_ENABLED, /* Radio Channel only */
|
||||
NM_EV_RCARRIER_DISABLED, /* Radio Channel only */
|
||||
};
|
||||
extern const struct value_string nm_fsm_event_names[];
|
||||
|
||||
|
||||
@@ -40,6 +40,14 @@
|
||||
#define nm_chan_fsm_state_chg(fi, NEXT_STATE) \
|
||||
osmo_fsm_inst_state_chg(fi, NEXT_STATE, 0, 0)
|
||||
|
||||
/* Can the TS be enabled (OPSTARTed)? aka should it stay in "Disabled Dependency" state? */
|
||||
static bool ts_can_be_enabled(const struct gsm_bts_trx_ts *ts)
|
||||
{
|
||||
return (ts->trx->bb_transc.mo.nm_state.operational == NM_OPSTATE_ENABLED &&
|
||||
(!bts_internal_flag_get(ts->trx->bts, BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER) ||
|
||||
ts->trx->mo.nm_state.operational == NM_OPSTATE_ENABLED));
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
// FSM STATE ACTIONS
|
||||
//////////////////////////
|
||||
@@ -58,7 +66,7 @@ static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event
|
||||
switch (event) {
|
||||
case NM_EV_BBTRANSC_INSTALLED:
|
||||
oml_mo_tx_sw_act_rep(&ts->mo);
|
||||
if (ts->trx->bb_transc.mo.nm_state.operational == NM_OPSTATE_ENABLED)
|
||||
if (ts_can_be_enabled(ts))
|
||||
nm_chan_fsm_state_chg(fi, NM_CHAN_ST_OP_DISABLED_OFFLINE);
|
||||
else
|
||||
nm_chan_fsm_state_chg(fi, NM_CHAN_ST_OP_DISABLED_DEPENDENCY);
|
||||
@@ -92,8 +100,14 @@ static void st_op_disabled_dependency(struct osmo_fsm_inst *fi, uint32_t event,
|
||||
oml_mo_opstart_nack(&ts->mo, (int)(intptr_t)data);
|
||||
return;
|
||||
case NM_EV_BBTRANSC_ENABLED:
|
||||
case NM_EV_RCARRIER_ENABLED:
|
||||
if (ts_can_be_enabled(ts))
|
||||
nm_chan_fsm_state_chg(fi, NM_CHAN_ST_OP_DISABLED_OFFLINE);
|
||||
return;
|
||||
case NM_EV_BBTRANSC_DISABLED:
|
||||
case NM_EV_RCARRIER_DISABLED:
|
||||
/* do nothing, we are simply waiting for (potentially) both to be enabled */
|
||||
return;
|
||||
default:
|
||||
OSMO_ASSERT(0);
|
||||
}
|
||||
@@ -121,6 +135,8 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
|
||||
oml_mo_opstart_nack(&ts->mo, (int)(intptr_t)data);
|
||||
return;
|
||||
case NM_EV_BBTRANSC_DISABLED:
|
||||
case NM_EV_RCARRIER_DISABLED:
|
||||
if (!ts_can_be_enabled(ts))
|
||||
nm_chan_fsm_state_chg(fi, NM_CHAN_ST_OP_DISABLED_DEPENDENCY);
|
||||
return;
|
||||
default:
|
||||
@@ -136,8 +152,12 @@ static void st_op_enabled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state
|
||||
|
||||
static void st_op_enabled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
|
||||
{
|
||||
struct gsm_bts_trx_ts *ts = (struct gsm_bts_trx_ts *)fi->priv;
|
||||
|
||||
switch (event) {
|
||||
case NM_EV_BBTRANSC_DISABLED:
|
||||
case NM_EV_RCARRIER_DISABLED:
|
||||
if (!ts_can_be_enabled(ts))
|
||||
nm_chan_fsm_state_chg(fi, NM_CHAN_ST_OP_DISABLED_DEPENDENCY);
|
||||
return;
|
||||
case NM_EV_DISABLE:
|
||||
@@ -163,7 +183,10 @@ static struct osmo_fsm_state nm_chan_fsm_states[] = {
|
||||
.in_event_mask =
|
||||
X(NM_EV_OPSTART_ACK) | /* backward compatibility, buggy BSC */
|
||||
X(NM_EV_OPSTART_NACK) |
|
||||
X(NM_EV_BBTRANSC_ENABLED),
|
||||
X(NM_EV_BBTRANSC_ENABLED) |
|
||||
X(NM_EV_RCARRIER_ENABLED) |
|
||||
X(NM_EV_BBTRANSC_DISABLED) |
|
||||
X(NM_EV_RCARRIER_DISABLED),
|
||||
.out_state_mask =
|
||||
X(NM_CHAN_ST_OP_DISABLED_OFFLINE) |
|
||||
X(NM_CHAN_ST_OP_ENABLED), /* backward compatibility, buggy BSC */
|
||||
@@ -175,7 +198,8 @@ static struct osmo_fsm_state nm_chan_fsm_states[] = {
|
||||
.in_event_mask =
|
||||
X(NM_EV_OPSTART_ACK) |
|
||||
X(NM_EV_OPSTART_NACK) |
|
||||
X(NM_EV_BBTRANSC_DISABLED),
|
||||
X(NM_EV_BBTRANSC_DISABLED) |
|
||||
X(NM_EV_RCARRIER_DISABLED),
|
||||
.out_state_mask =
|
||||
X(NM_CHAN_ST_OP_ENABLED) |
|
||||
X(NM_CHAN_ST_OP_DISABLED_DEPENDENCY),
|
||||
@@ -186,6 +210,7 @@ static struct osmo_fsm_state nm_chan_fsm_states[] = {
|
||||
[NM_CHAN_ST_OP_ENABLED] = {
|
||||
.in_event_mask =
|
||||
X(NM_EV_BBTRANSC_DISABLED) |
|
||||
X(NM_EV_RCARRIER_DISABLED) |
|
||||
X(NM_EV_DISABLE),
|
||||
.out_state_mask =
|
||||
X(NM_CHAN_ST_OP_DISABLED_OFFLINE) |
|
||||
|
||||
@@ -79,8 +79,17 @@ static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event
|
||||
static void st_op_disabled_offline_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
|
||||
{
|
||||
struct gsm_bts_trx *trx = (struct gsm_bts_trx *)fi->priv;
|
||||
unsigned int i;
|
||||
|
||||
trx->mo.opstart_success = false;
|
||||
oml_mo_state_chg(&trx->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE);
|
||||
|
||||
if (prev_state == NM_RCARRIER_ST_OP_ENABLED) {
|
||||
for (i = 0; i < TRX_NR_TS; i++) {
|
||||
struct gsm_bts_trx_ts *ts = &trx->ts[i];
|
||||
osmo_fsm_inst_dispatch(ts->mo.fi, NM_EV_RCARRIER_DISABLED, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, void *data)
|
||||
@@ -136,7 +145,14 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
|
||||
static void st_op_enabled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
|
||||
{
|
||||
struct gsm_bts_trx *trx = (struct gsm_bts_trx *)fi->priv;
|
||||
unsigned int tn;
|
||||
|
||||
oml_mo_state_chg(&trx->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
|
||||
/* Mark Dependency TS as Offline (ready to be Opstarted) */
|
||||
for (tn = 0; tn < TRX_NR_TS; tn++) {
|
||||
struct gsm_bts_trx_ts *ts = &trx->ts[tn];
|
||||
osmo_fsm_inst_dispatch(ts->mo.fi, NM_EV_RCARRIER_ENABLED, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void st_op_enabled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
|
||||
|
||||
@@ -111,6 +111,7 @@ int bts_model_init(struct gsm_bts *bts)
|
||||
osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_AMR);
|
||||
|
||||
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP);
|
||||
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ int bts_model_init(struct gsm_bts *bts)
|
||||
osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_AMR);
|
||||
|
||||
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP);
|
||||
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ int bts_model_init(struct gsm_bts *bts)
|
||||
|
||||
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP);
|
||||
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB);
|
||||
bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user