aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2018-05-03 19:03:03 +0200
committerHarald Welte <laforge@gnumonks.org>2018-05-04 09:25:40 +0000
commitad7277073c1a8e24a24969ee38747a7cc74dcd1b (patch)
tree13950a9bd57c67703ff6507cc15040a4cd4ca3cc
parent1b11bc808f9fe4234bb3b42965f8b7ca5c33e303 (diff)
bsc_api/GSCON: prevent unnecessary channel mode modifications
gsm0808_assign_req() checks if the new channel mode is compatible with the new mode. If it is, it does a gsm48_lchan_modify(), but it does not actually check if the new mode is equal to the current mode. - skip when the channel is compatible and the new mode is equal to the old mode. - send the ASSIGNMENT COMPLETE directly from ST_ACTIVE when no mode modify was necessary. Change-Id: I86a2d52836c54d2dbd77441b182f757327ec7262 Related: OS#2936
-rw-r--r--src/libbsc/bsc_api.c22
-rw-r--r--src/libbsc/bsc_subscr_conn_fsm.c6
2 files changed, 19 insertions, 9 deletions
diff --git a/src/libbsc/bsc_api.c b/src/libbsc/bsc_api.c
index 142efef02..19859cf8a 100644
--- a/src/libbsc/bsc_api.c
+++ b/src/libbsc/bsc_api.c
@@ -296,16 +296,17 @@ static int chan_compat_with_mode(struct gsm_lchan *lchan, int chan_mode, int ful
}
}
-/**
- * Send a GSM08.08 Assignment Request. Right now this does not contain the
- * audio codec type or the allowed rates for the config. It is assumed that
- * this is for audio handling only. In case the current channel does not allow
- * the selected mode a new one will be allocated.
- *
- * TODO: Add multirate configuration, make it work for more than audio.
- */
+/*! Send a GSM08.08 Assignment Request. Right now this does not contain the
+ * audio codec type or the allowed rates for the config. In case the current
+ * channel does not allow the selected mode a new one will be allocated.
+ * \param[out] conn related subscriber connection
+ * \param[in] chan_mode mode of the channel (see enum gsm48_chan_mode)
+ * \param[in] full_rate select full rate or half rate channel
+ * \returns 0 on success, 1 when no operation is neccessary, -1 on failure */
int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate)
{
+ /* TODO: Add multirate configuration, make it work for more than audio. */
+
struct bsc_api *api;
api = conn->network->bsc_api;
@@ -313,6 +314,11 @@ int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, in
if (handle_new_assignment(conn, chan_mode, full_rate) != 0)
goto error;
} else {
+ /* Check if the channel is already in the requested mode, if
+ * yes, we skip unnecessary channel mode modify operations. */
+ if (conn->lchan->tch_mode == chan_mode)
+ return 1;
+
if (chan_mode == GSM48_CMODE_SPEECH_AMR)
handle_mr_config(conn, conn->lchan, full_rate);
diff --git a/src/libbsc/bsc_subscr_conn_fsm.c b/src/libbsc/bsc_subscr_conn_fsm.c
index b5e7e7d8e..7f53f1b8a 100644
--- a/src/libbsc/bsc_subscr_conn_fsm.c
+++ b/src/libbsc/bsc_subscr_conn_fsm.c
@@ -438,7 +438,11 @@ static void gscon_fsm_active(struct osmo_fsm_inst *fi, uint32_t event, void *dat
* change back to ST_ACTIVE (here) immediately. */
rc = gsm0808_assign_req(conn, conn->user_plane.chan_mode,
conn->user_plane.full_rate);
- if (rc != 0) {
+
+ if (rc == 1) {
+ send_ass_compl(conn->lchan, fi, false);
+ return;
+ } else if (rc != 0) {
resp = gsm0808_create_assignment_failure(GSM0808_CAUSE_EQUIPMENT_FAILURE, NULL);
sigtran_send(conn, resp, fi);
return;