From f520e6439a917777a4a456fea7eb0f214e027c67 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 22 Oct 2009 15:23:11 +0200 Subject: [gsm48] Handle the RR CHAN MODIFY ACK in the gsm04_08_utils Move the handling code to the gsm_04_08_utils.c and add a note that the method value needs to be checked. --- openbsc/include/openbsc/gsm_04_08.h | 7 ++++++- openbsc/src/gsm_04_08.c | 6 +----- openbsc/src/gsm_04_08_utils.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 6 deletions(-) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index 2afc9c5fd..186a53f97 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -42,7 +42,11 @@ struct gsm48_req_ref { t3_low:3; } __attribute__ ((packed)); -/* Chapter 9.1.5 */ +/* + * Chapter 9.1.5/9.1.6 + * + * For 9.1.6 the chan_desc has the meaning of 10.5.2.5a + */ struct gsm48_chan_mode_modify { struct gsm48_chan_desc chan_desc; u_int8_t mode; @@ -755,5 +759,6 @@ int gsm48_paging_extract_mi(struct msgb *msg, char *mi_string, u_int8_t *mi_type int gsm48_handle_paging_resp(struct msgb *msg, struct gsm_subscriber *subscr); int gsm48_lchan_modify(struct gsm_lchan *lchan, u_int8_t lchan_mode); +int gsm48_rx_rr_modif_ack(struct msgb *msg); #endif diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c index a29d0362b..12cc36245 100644 --- a/openbsc/src/gsm_04_08.c +++ b/openbsc/src/gsm_04_08.c @@ -1587,11 +1587,7 @@ static int gsm0408_rcv_rr(struct msgb *msg) rc = gsm48_rx_rr_pag_resp(msg); break; case GSM48_MT_RR_CHAN_MODE_MODIF_ACK: - DEBUGP(DRR, "CHANNEL MODE MODIFY ACK\n"); - /* We've successfully modified the MS side of the channel, - * now go on to modify the BTS side of the channel */ - msg->lchan->rsl_cmode = RSL_CMOD_SPD_SPEECH; - rc = rsl_chan_mode_modify_req(msg->lchan); + rc = gsm48_rx_rr_modif_ack(msg); break; case GSM48_MT_RR_STATUS: rc = gsm48_rx_rr_status(msg); diff --git a/openbsc/src/gsm_04_08_utils.c b/openbsc/src/gsm_04_08_utils.c index 598775c03..2545f33a6 100644 --- a/openbsc/src/gsm_04_08_utils.c +++ b/openbsc/src/gsm_04_08_utils.c @@ -559,3 +559,39 @@ int gsm48_lchan_modify(struct gsm_lchan *lchan, u_int8_t lchan_mode) return rc; } +int gsm48_rx_rr_modif_ack(struct msgb *msg) +{ + struct gsm48_hdr *gh = msgb_l3(msg); + struct gsm48_chan_mode_modify *mod = + (struct gsm48_chan_mode_modify *) gh->data; + + DEBUGP(DRR, "CHANNEL MODE MODIFY ACK\n"); + + if (mod->mode != msg->lchan->tch_mode) { + DEBUGP(DRR, "CHANNEL MODE change failed. Wanted: %d Got: %d\n", + msg->lchan->tch_mode, mod->mode); + return -1; + } + + /* update the channel type */ + switch (mod->mode) { + case GSM48_CMODE_SIGN: + msg->lchan->rsl_cmode = RSL_CMOD_SPD_SIGN; + break; + case GSM48_CMODE_SPEECH_V1: + case GSM48_CMODE_SPEECH_EFR: + case GSM48_CMODE_SPEECH_AMR: + msg->lchan->rsl_cmode = RSL_CMOD_SPD_SPEECH; + break; + case GSM48_CMODE_DATA_14k5: + case GSM48_CMODE_DATA_12k0: + case GSM48_CMODE_DATA_6k0: + case GSM48_CMODE_DATA_3k6: + msg->lchan->rsl_cmode = RSL_CMOD_SPD_DATA; + break; + } + + /* We've successfully modified the MS side of the channel, + * now go on to modify the BTS side of the channel */ + return rsl_chan_mode_modify_req(msg->lchan); +} -- cgit v1.2.3