aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2023-07-13 08:22:13 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2023-07-21 13:33:55 +0200
commit7200b0157795093393a35e3da24994e86a5cd285 (patch)
treee8d78b617882ec0d90ca6e66e586c5f39f260adf
parent2d93d61fe3b9a36d76e446a49c11de522c5243cc (diff)
Select channel type by enum instead of three boolean
struct lchan_activate_info and struct lchan_modify_info use an enum to define, if the channel type is for a normal channel, a VAMOS channel or a VGCS/VBS channel. Change-Id: I21167eb4192c02cd7b5e1574cddb382a3feaebe0
-rw-r--r--include/osmocom/bsc/lchan.h14
-rw-r--r--src/osmo-bsc/abis_rsl.c38
-rw-r--r--src/osmo-bsc/assignment_fsm.c3
-rw-r--r--src/osmo-bsc/bsc_vty.c5
-rw-r--r--src/osmo-bsc/gsm_04_08_rr.c2
-rw-r--r--src/osmo-bsc/lchan_fsm.c21
-rw-r--r--src/osmo-bsc/vgcs_fsm.c4
7 files changed, 52 insertions, 35 deletions
diff --git a/include/osmocom/bsc/lchan.h b/include/osmocom/bsc/lchan.h
index 3099c6351..c0c57615d 100644
--- a/include/osmocom/bsc/lchan.h
+++ b/include/osmocom/bsc/lchan.h
@@ -106,6 +106,13 @@ enum lchan_activate_for {
ACTIVATE_FOR_MODE_MODIFY_RTP,
};
+enum lchan_type_for {
+ LCHAN_TYPE_FOR_NORMAL = 0,
+ LCHAN_TYPE_FOR_VAMOS,
+ LCHAN_TYPE_FOR_VGCS,
+ LCHAN_TYPE_FOR_VBS,
+};
+
extern const struct value_string lchan_activate_mode_names[];
static inline const char *lchan_activate_mode_name(enum lchan_activate_for activ_for)
{ return get_value_string(lchan_activate_mode_names, activ_for); }
@@ -139,10 +146,7 @@ struct lchan_activate_info {
* 7, as described in 3GPP TS 45.002. */
struct optional_val tsc;
- bool vamos;
-
- /* In case of ASCI channel: Flags, if a VGCS channel or VBS channel is activated. */
- bool vgcs, vbs;
+ enum lchan_type_for type_for;
/* A copy of bts->imm_ass_time at the time where Channel Activation was requested. A change in the VTY
* configuration has immediate effect on the value, so make sure we don't get mixed up when it gets changed
@@ -173,7 +177,7 @@ struct lchan_modify_info {
* 7, as described in 3GPP TS 45.002. */
struct optional_val tsc;
- bool vamos;
+ enum lchan_type_for type_for;
};
/* Measurement pre-processing state */
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index 125f0bab5..3bc580839 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -406,7 +406,7 @@ int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan)
static int channel_mode_from_lchan(struct rsl_ie_chan_mode *cm,
struct gsm_lchan *lchan,
const struct channel_mode_and_rate *ch_mode_rate,
- bool vamos, bool vgcs, bool vbs)
+ enum lchan_type_for type_for)
{
int rc;
memset(cm, 0, sizeof(*cm));
@@ -430,24 +430,34 @@ static int channel_mode_from_lchan(struct rsl_ie_chan_mode *cm,
cm->chan_rt = RSL_CMOD_CRT_SDCCH;
break;
case GSM_LCHAN_TCH_F:
- if (vamos)
+ switch (type_for) {
+ case LCHAN_TYPE_FOR_VAMOS:
cm->chan_rt = RSL_CMOD_CRT_OSMO_TCH_VAMOS_Bm;
- else if (vgcs)
+ break;
+ case LCHAN_TYPE_FOR_VGCS:
cm->chan_rt = RSL_CMOD_CRT_TCH_GROUP_Bm;
- else if (vbs)
+ break;
+ case LCHAN_TYPE_FOR_VBS:
cm->chan_rt = RSL_CMOD_CRT_TCH_BCAST_Bm;
- else
+ break;
+ default:
cm->chan_rt = RSL_CMOD_CRT_TCH_Bm;
+ }
break;
case GSM_LCHAN_TCH_H:
- if (vamos)
+ switch (type_for) {
+ case LCHAN_TYPE_FOR_VAMOS:
cm->chan_rt = RSL_CMOD_CRT_OSMO_TCH_VAMOS_Lm;
- else if (vgcs)
+ break;
+ case LCHAN_TYPE_FOR_VGCS:
cm->chan_rt = RSL_CMOD_CRT_TCH_GROUP_Lm;
- else if (vbs)
+ break;
+ case LCHAN_TYPE_FOR_VBS:
cm->chan_rt = RSL_CMOD_CRT_TCH_BCAST_Lm;
- else
+ break;
+ default:
cm->chan_rt = RSL_CMOD_CRT_TCH_Lm;
+ }
break;
case GSM_LCHAN_NONE:
case GSM_LCHAN_UNKNOWN:
@@ -589,8 +599,7 @@ int rsl_tx_chan_activ(struct gsm_lchan *lchan, uint8_t act_type, uint8_t ho_ref)
/* PDCH activation is a job for rsl_tx_dyn_ts_pdch_act_deact(); */
OSMO_ASSERT(act_type != RSL_ACT_OSMO_PDCH);
- rc = channel_mode_from_lchan(&cm, lchan, &lchan->activate.ch_mode_rate, lchan->activate.info.vamos,
- lchan->activate.info.vgcs, lchan->activate.info.vbs);
+ rc = channel_mode_from_lchan(&cm, lchan, &lchan->activate.ch_mode_rate, lchan->activate.info.type_for);
if (rc < 0) {
LOGP(DRSL, LOGL_ERROR,
"%s Cannot find channel mode from lchan type\n",
@@ -692,7 +701,7 @@ int rsl_tx_chan_activ(struct gsm_lchan *lchan, uint8_t act_type, uint8_t ho_ref)
put_top_acch_cap_ie(lchan, &cm, msg);
/* Selecting a specific TSC Set is only applicable to VAMOS mode */
- if (lchan->activate.info.vamos && lchan->activate.tsc_set >= 1)
+ if (lchan->activate.info.type_for == LCHAN_TYPE_FOR_VAMOS && lchan->activate.tsc_set >= 1)
put_osmo_training_sequence_ie(msg, lchan->activate.tsc_set, lchan->activate.tsc);
msg->dst = rsl_chan_link(lchan);
@@ -727,7 +736,7 @@ int rsl_chan_mode_modify_req(struct gsm_lchan *lchan)
if (chan_nr < 0)
return chan_nr;
- rc = channel_mode_from_lchan(&cm, lchan, &lchan->modify.ch_mode_rate, lchan->modify.info.vamos, false, false);
+ rc = channel_mode_from_lchan(&cm, lchan, &lchan->modify.ch_mode_rate, lchan->modify.info.type_for);
if (rc < 0)
return rc;
@@ -765,7 +774,8 @@ int rsl_chan_mode_modify_req(struct gsm_lchan *lchan)
/* Selecting a specific TSC Set is only applicable to VAMOS mode. Send this Osmocom specific IE only to OsmoBTS
* types. */
- if (lchan->modify.info.vamos && lchan->modify.tsc_set >= 1 && bts->model->type == GSM_BTS_TYPE_OSMOBTS)
+ if (lchan->modify.info.type_for == LCHAN_TYPE_FOR_VAMOS && lchan->modify.tsc_set >= 1 &&
+ bts->model->type == GSM_BTS_TYPE_OSMOBTS)
put_osmo_training_sequence_ie(msg, lchan->modify.tsc_set, lchan->modify.tsc);
msg->dst = rsl_chan_link(lchan);
diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index 3ae1367a4..9a53652e3 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -669,8 +669,9 @@ static void assignment_fsm_wait_lchan_active_onenter(struct osmo_fsm_inst *fi, u
.ta_known = true,
.tsc_set = req->tsc_set,
.tsc = req->tsc,
- .vamos = conn->assignment.new_lchan->vamos.is_secondary,
};
+ if (conn->assignment.new_lchan->vamos.is_secondary)
+ activ_info.type_for = LCHAN_TYPE_FOR_VAMOS;
lchan_activate(conn->assignment.new_lchan, &activ_info);
}
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index e53b14548..7918d81c0 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -870,7 +870,6 @@ static int trigger_vamos_mode_modify(struct vty *vty, struct gsm_lchan *lchan, b
.modify_for = MODIFY_FOR_VTY,
.ch_mode_rate = lchan->current_ch_mode_rate,
.ch_indctr = lchan->current_ch_indctr,
- .vamos = vamos,
.tsc_set = {
.present = (tsc_set >= 0),
.val = tsc_set,
@@ -880,6 +879,8 @@ static int trigger_vamos_mode_modify(struct vty *vty, struct gsm_lchan *lchan, b
.val = tsc,
},
};
+ if (vamos)
+ info.type_for = LCHAN_TYPE_FOR_VAMOS;
lchan_mode_modify(lchan, &info);
return CMD_SUCCESS;
@@ -1640,7 +1641,7 @@ static int lchan_act_single(struct vty *vty, struct gsm_lchan *lchan, const char
info.ch_mode_rate.chan_rate = chan_t_to_chan_rate(lchan_t);
if (activate == 2 || lchan->vamos.is_secondary) {
- info.vamos = true;
+ info.type_for = LCHAN_TYPE_FOR_VAMOS;
if (lchan->vamos.is_secondary) {
info.tsc_set.present = true;
info.tsc_set.val = 1;
diff --git a/src/osmo-bsc/gsm_04_08_rr.c b/src/osmo-bsc/gsm_04_08_rr.c
index 60ccb5ac9..67896b128 100644
--- a/src/osmo-bsc/gsm_04_08_rr.c
+++ b/src/osmo-bsc/gsm_04_08_rr.c
@@ -758,7 +758,7 @@ int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t mode)
}
}
- if (lchan->modify.info.vamos && lchan->modify.tsc_set > 0) {
+ if (lchan->modify.info.type_for == LCHAN_TYPE_FOR_VAMOS && lchan->modify.tsc_set > 0) {
/* Add the Extended TSC Set IE. So far we only need a TSC Set sent for VAMOS.
* Convert from spec conforming "human readable" TSC Set 1-4 to 0-3 on the wire */
msgb_tv_put(msg, GSM48_IE_EXTENDED_TSC_SET, (lchan->modify.tsc_set - 1) & 0x3);
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 26c188236..1b012bd8a 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -72,7 +72,8 @@ bool lchan_may_receive_data(struct gsm_lchan *lchan)
bool lchan_is_asci(struct gsm_lchan *lchan)
{
- if (lchan->activate.info.vgcs || lchan->activate.info.vbs)
+ if (lchan->activate.info.type_for == LCHAN_TYPE_FOR_VGCS ||
+ lchan->activate.info.type_for == LCHAN_TYPE_FOR_VBS)
return true;
return false;
}
@@ -389,7 +390,7 @@ void lchan_activate(struct gsm_lchan *lchan, struct lchan_activate_info *info)
OSMO_ASSERT(lchan && info);
- if ((info->vamos || lchan->vamos.is_secondary)
+ if ((info->type_for == LCHAN_TYPE_FOR_VAMOS || lchan->vamos.is_secondary)
&& !osmo_bts_has_feature(&lchan->ts->trx->bts->features, BTS_FEAT_VAMOS)) {
lchan->last_error = talloc_strdup(lchan->ts->trx, "VAMOS related channel activation requested,"
" but BTS does not support VAMOS");
@@ -492,7 +493,7 @@ void lchan_mode_modify(struct gsm_lchan *lchan, struct lchan_modify_info *info)
{
OSMO_ASSERT(lchan && info);
- if ((info->vamos || lchan->vamos.is_secondary)
+ if ((info->type_for == LCHAN_TYPE_FOR_VAMOS || lchan->vamos.is_secondary)
&& !osmo_bts_has_feature(&lchan->ts->trx->bts->features, BTS_FEAT_VAMOS)) {
lchan->last_error = talloc_strdup(lchan->ts->trx, "VAMOS related Channel Mode Modify requested,"
" but BTS does not support VAMOS");
@@ -739,9 +740,9 @@ static int lchan_activate_set_ch_mode_rate_and_mr_config(struct gsm_lchan *lchan
{
struct osmo_fsm_inst *fi = lchan->fi;
lchan->activate.ch_mode_rate = lchan->activate.info.ch_mode_rate;
- lchan->activate.ch_mode_rate.chan_mode = (lchan->activate.info.vamos
+ lchan->activate.ch_mode_rate.chan_mode = (lchan->activate.info.type_for == LCHAN_TYPE_FOR_VAMOS)
? gsm48_chan_mode_to_vamos(lchan->activate.info.ch_mode_rate.chan_mode)
- : gsm48_chan_mode_to_non_vamos(lchan->activate.info.ch_mode_rate.chan_mode));
+ : gsm48_chan_mode_to_non_vamos(lchan->activate.info.ch_mode_rate.chan_mode);
if (lchan->activate.ch_mode_rate.chan_mode < 0) {
lchan_fail("Invalid chan_mode: %s", gsm48_chan_mode_name(lchan->activate.info.ch_mode_rate.chan_mode));
return -EINVAL;
@@ -1008,7 +1009,7 @@ static void post_activ_ack_accept_preliminary_settings(struct gsm_lchan *lchan)
lchan->current_ch_mode_rate = lchan->activate.ch_mode_rate;
lchan->current_mr_conf = lchan->activate.mr_conf_filtered;
lchan->current_ch_indctr = lchan->activate.ch_indctr;
- lchan->vamos.enabled = lchan->activate.info.vamos;
+ lchan->vamos.enabled = (lchan->activate.info.type_for == LCHAN_TYPE_FOR_VAMOS);
lchan->tsc_set = lchan->activate.tsc_set;
lchan->tsc = lchan->activate.tsc;
}
@@ -1197,7 +1198,7 @@ static void lchan_fsm_wait_rsl_chan_mode_modify_ack(struct osmo_fsm_inst *fi, ui
lchan->current_ch_indctr = lchan->modify.ch_indctr;
lchan->tsc_set = lchan->modify.tsc_set;
lchan->tsc = lchan->modify.tsc;
- lchan->vamos.enabled = lchan->modify.info.vamos;
+ lchan->vamos.enabled = (lchan->modify.info.type_for == LCHAN_TYPE_FOR_VAMOS);
if (bsc_chan_ind_requires_rtp_stream(lchan->modify.info.ch_indctr) && !lchan->fi_rtp) {
/* Continue with RTP stream establishing as done in lchan_activate(). Place the requested values in
@@ -1356,9 +1357,9 @@ static void lchan_fsm_established(struct osmo_fsm_inst *fi, uint32_t event, void
use_mgwep_ci = lchan_use_mgw_endpoint_ci_bts(lchan);
lchan->modify.ch_mode_rate = lchan->modify.info.ch_mode_rate;
- lchan->modify.ch_mode_rate.chan_mode = (lchan->modify.info.vamos
- ? gsm48_chan_mode_to_vamos(lchan->modify.info.ch_mode_rate.chan_mode)
- : gsm48_chan_mode_to_non_vamos(lchan->modify.info.ch_mode_rate.chan_mode));
+ lchan->modify.ch_mode_rate.chan_mode = (lchan->modify.info.type_for == LCHAN_TYPE_FOR_VAMOS)
+ ? gsm48_chan_mode_to_vamos(lchan->modify.info.ch_mode_rate.chan_mode)
+ : gsm48_chan_mode_to_non_vamos(lchan->modify.info.ch_mode_rate.chan_mode);
if (lchan->modify.ch_mode_rate.chan_mode < 0) {
lchan_fail("Invalid chan_mode: %s", gsm48_chan_mode_name(lchan->modify.info.ch_mode_rate.chan_mode));
return;
diff --git a/src/osmo-bsc/vgcs_fsm.c b/src/osmo-bsc/vgcs_fsm.c
index d445eee8f..6b7893374 100644
--- a/src/osmo-bsc/vgcs_fsm.c
+++ b/src/osmo-bsc/vgcs_fsm.c
@@ -616,9 +616,9 @@ static void vgcs_chan_fsm_null(struct osmo_fsm_inst *fi, uint32_t event, void *d
.ta = 0,
};
if (conn->vgcs_chan.call->vgcs_call.sf == GSM0808_SF_VGCS)
- info.vgcs = 1;
+ info.type_for = LCHAN_TYPE_FOR_VGCS;
else
- info.vbs = 1;
+ info.type_for = LCHAN_TYPE_FOR_VBS;
/* Activate lchan. If an error occurs, this the function call may trigger VGCS_EV_LCHAN_ERROR event.
* This means that this must be the last action in this handler. */
lchan_activate(conn->vgcs_chan.new_lchan, &info);