pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmo-bsc/+/33736 )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: Select channel type by enum instead of three boolean
......................................................................
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
---
M include/osmocom/bsc/lchan.h
M src/osmo-bsc/abis_rsl.c
M src/osmo-bsc/assignment_fsm.c
M src/osmo-bsc/bsc_vty.c
M src/osmo-bsc/gsm_04_08_rr.c
M src/osmo-bsc/lchan_fsm.c
M src/osmo-bsc/vgcs_fsm.c
7 files changed, 65 insertions(+), 35 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/osmocom/bsc/lchan.h b/include/osmocom/bsc/lchan.h
index 3099c63..c0c5761 100644
--- a/include/osmocom/bsc/lchan.h
+++ b/include/osmocom/bsc/lchan.h
@@ -106,6 +106,13 @@
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 @@
* 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 @@
* 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 125f0ba..3bc5808 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -406,7 +406,7 @@
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 @@
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 @@
/* 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 @@
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 @@
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 @@
/* 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 3ae1367..9a53652 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -669,8 +669,9 @@
.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 e53b145..7918d81 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -870,7 +870,6 @@
.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 @@
.val = tsc,
},
};
+ if (vamos)
+ info.type_for = LCHAN_TYPE_FOR_VAMOS;
lchan_mode_modify(lchan, &info);
return CMD_SUCCESS;
@@ -1640,7 +1641,7 @@
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 60ccb5a..67896b1 100644
--- a/src/osmo-bsc/gsm_04_08_rr.c
+++ b/src/osmo-bsc/gsm_04_08_rr.c
@@ -758,7 +758,7 @@
}
}
- 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 26c1882..1b012bd 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -72,7 +72,8 @@
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 @@
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 @@
{
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 @@
{
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 @@
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 @@
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 @@
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 d445eee..6b78933 100644
--- a/src/osmo-bsc/vgcs_fsm.c
+++ b/src/osmo-bsc/vgcs_fsm.c
@@ -616,9 +616,9 @@
.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);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bsc/+/33736
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I21167eb4192c02cd7b5e1574cddb382a3feaebe0
Gerrit-Change-Number: 33736
Gerrit-PatchSet: 3
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged