diff options
author | Harald Welte (local) <laflocal@hanuman.gnumonks.org> | 2009-08-14 11:41:12 +0200 |
---|---|---|
committer | Harald Welte (local) <laflocal@hanuman.gnumonks.org> | 2009-08-14 11:41:12 +0200 |
commit | daef606502373b642776325a5989a283858b78d2 (patch) | |
tree | cd61b8be347221e72bb74e1137f80e9548818270 /openbsc | |
parent | c89a5116169174d54abe509f46368691f86d94de (diff) |
respect the link_id, not only the SAPI from SMS code
SMS related messages are all sent over SAPI=3. But in addition
to that, we also need to send it over the correct link identifier,
i.e. SACCH or main signalling channel
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/include/openbsc/gsm_04_08.h | 2 | ||||
-rw-r--r-- | openbsc/include/openbsc/gsm_04_11.h | 2 | ||||
-rw-r--r-- | openbsc/include/openbsc/transaction.h | 1 | ||||
-rw-r--r-- | openbsc/src/abis_rsl.c | 10 | ||||
-rw-r--r-- | openbsc/src/gsm_04_08.c | 4 | ||||
-rw-r--r-- | openbsc/src/gsm_04_11.c | 19 |
6 files changed, 24 insertions, 14 deletions
diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index 75d93fb93..1ca1ccdb8 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -691,7 +691,7 @@ struct gsm_trans; void gsm0408_allow_everyone(int allow); void gsm0408_set_reject_cause(int cause); -int gsm0408_rcvmsg(struct msgb *msg); +int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id); void gsm0408_generate_lai(struct gsm48_loc_area_id *lai48, u_int16_t mcc, u_int16_t mnc, u_int16_t lac); enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra); diff --git a/openbsc/include/openbsc/gsm_04_11.h b/openbsc/include/openbsc/gsm_04_11.h index dd6a2631f..bfa90b522 100644 --- a/openbsc/include/openbsc/gsm_04_11.h +++ b/openbsc/include/openbsc/gsm_04_11.h @@ -203,7 +203,7 @@ struct sms_deliver { struct msgb; -int gsm0411_rcv_sms(struct msgb *msg); +int gsm0411_rcv_sms(struct msgb *msg, u_int8_t link_id); int gsm411_send_sms_lchan(struct gsm_lchan *lchan, struct gsm_sms *sms); diff --git a/openbsc/include/openbsc/transaction.h b/openbsc/include/openbsc/transaction.h index 466e88aaa..961a64923 100644 --- a/openbsc/include/openbsc/transaction.h +++ b/openbsc/include/openbsc/transaction.h @@ -39,6 +39,7 @@ struct gsm_trans { struct gsm_mncc msg; /* stores setup/disconnect/release message */ } cc; struct { + u_int8_t link_id; /* RSL Link ID to be used for this trans */ int is_mt; /* is this a MO (0) or MT (1) transfer */ enum gsm411_cp_state cp_state; struct timer_list cp_timer; diff --git a/openbsc/src/abis_rsl.c b/openbsc/src/abis_rsl.c index d54f2fd9f..8cec2b6c3 100644 --- a/openbsc/src/abis_rsl.c +++ b/openbsc/src/abis_rsl.c @@ -923,7 +923,7 @@ static int rsl_rx_meas_res(struct msgb *msg) if (TLVP_PRESENT(&tp, RSL_IE_L3_INFO)) { DEBUGPC(DMEAS, "L3\n"); msg->l3h = TLVP_VAL(&tp, RSL_IE_L3_INFO); - return gsm0408_rcvmsg(msg); + return gsm0408_rcvmsg(msg, 0); } else DEBUGPC(DMEAS, "\n"); @@ -1206,10 +1206,12 @@ static int abis_rsl_rx_rll(struct msgb *msg) struct abis_rsl_rll_hdr *rllh = msgb_l2(msg); int rc = 0; char *ts_name; + u_int8_t sapi = rllh->link_id & 7; msg->lchan = lchan_lookup(msg->trx, rllh->chan_nr); ts_name = gsm_ts_name(msg->lchan->ts); - DEBUGP(DRLL, "channel=%s chan_nr=0x%02x ", ts_name, rllh->chan_nr); + DEBUGP(DRLL, "channel=%s chan_nr=0x%02x sapi=%u ", ts_name, + rllh->chan_nr, sapi); switch (rllh->c.msg_type) { case RSL_MT_DATA_IND: @@ -1218,7 +1220,7 @@ static int abis_rsl_rx_rll(struct msgb *msg) sizeof(struct abis_rsl_common_hdr) + sizeof(*rllh) && rllh->data[0] == RSL_IE_L3_INFO) { msg->l3h = &rllh->data[3]; - return gsm0408_rcvmsg(msg); + return gsm0408_rcvmsg(msg, rllh->link_id); } break; case RSL_MT_EST_IND: @@ -1229,7 +1231,7 @@ static int abis_rsl_rx_rll(struct msgb *msg) sizeof(struct abis_rsl_common_hdr) + sizeof(*rllh) && rllh->data[0] == RSL_IE_L3_INFO) { msg->l3h = &rllh->data[3]; - return gsm0408_rcvmsg(msg); + return gsm0408_rcvmsg(msg, rllh->link_id); } break; case RSL_MT_EST_CONF: diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c index 3e6c149ae..dc2bd199b 100644 --- a/openbsc/src/gsm_04_08.c +++ b/openbsc/src/gsm_04_08.c @@ -3745,7 +3745,7 @@ static int gsm0408_rcv_cc(struct msgb *msg) } /* here we pass in a msgb from the RSL->RLL. We expect the l3 pointer to be set */ -int gsm0408_rcvmsg(struct msgb *msg) +int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id) { struct gsm48_hdr *gh = msgb_l3(msg); u_int8_t pdisc = gh->proto_discr & 0x0f; @@ -3762,7 +3762,7 @@ int gsm0408_rcvmsg(struct msgb *msg) rc = gsm0408_rcv_rr(msg); break; case GSM48_PDISC_SMS: - rc = gsm0411_rcv_sms(msg); + rc = gsm0411_rcv_sms(msg, link_id); break; case GSM48_PDISC_MM_GPRS: case GSM48_PDISC_SM_GPRS: diff --git a/openbsc/src/gsm_04_11.c b/openbsc/src/gsm_04_11.c index bebd07d34..9580b0727 100644 --- a/openbsc/src/gsm_04_11.c +++ b/openbsc/src/gsm_04_11.c @@ -139,7 +139,7 @@ struct msgb *gsm411_msgb_alloc(void) "GSM 04.11"); } -static int gsm411_sendmsg(struct msgb *msg) +static int gsm411_sendmsg(struct msgb *msg, u_int8_t link_id) { if (msg->lchan) msg->trx = msg->lchan->ts->trx; @@ -148,7 +148,7 @@ static int gsm411_sendmsg(struct msgb *msg) DEBUGP(DSMS, "GSM4.11 TX %s\n", hexdump(msg->data, msg->len)); - return rsl_data_request(msg, UM_SAPI_SMS); + return rsl_data_request(msg, link_id); } /* SMC TC1* is expired */ @@ -197,7 +197,7 @@ static int gsm411_cp_sendmsg(struct msgb *msg, struct gsm_trans *trans, DEBUGPC(DSMS, "trans=%x\n", trans->transaction_id); - return gsm411_sendmsg(msg); + return gsm411_sendmsg(msg, trans->sms.link_id); } /* Prefix msg with a RP-DATA header and send as CP-DATA */ @@ -645,7 +645,7 @@ static int gsm411_rx_rp_ack(struct msgb *msg, struct gsm_trans *trans, if (sms) gsm411_send_sms_lchan(msg->lchan, sms); else - rsl_release_request(msg->lchan, UM_SAPI_SMS); + rsl_release_request(msg->lchan, trans->sms.link_id); return 0; } @@ -710,7 +710,7 @@ static int gsm411_rx_rp_smma(struct msgb *msg, struct gsm_trans *trans, if (sms) gsm411_send_sms_lchan(msg->lchan, sms); else - rsl_release_request(msg->lchan, UM_SAPI_SMS); + rsl_release_request(msg->lchan, trans->sms.link_id); return rc; } @@ -784,7 +784,7 @@ static int gsm411_tx_cp_error(struct gsm_trans *trans, u_int8_t cause) } /* Entry point for incoming GSM48_PDISC_SMS from abis_rsl.c */ -int gsm0411_rcv_sms(struct msgb *msg) +int gsm0411_rcv_sms(struct msgb *msg, u_int8_t link_id) { struct gsm48_hdr *gh = msgb_l3(msg); u_int8_t msg_type = gh->msg_type; @@ -812,6 +812,7 @@ int gsm0411_rcv_sms(struct msgb *msg) trans->sms.cp_state = GSM411_CPS_IDLE; trans->sms.rp_state = GSM411_RPS_IDLE; trans->sms.is_mt = 0; + trans->sms.link_id = link_id; trans->lchan = lchan; use_lchan(lchan); @@ -826,12 +827,17 @@ int gsm0411_rcv_sms(struct msgb *msg) * CP-DATA, including sending of the assoc. CP-ACK */ trans->sms.cp_state = GSM411_CPS_MM_ESTABLISHED; + /* SMC instance acknowledges the CP-DATA frame */ + gsm411_tx_cp_ack(trans); + rc = gsm411_rx_cp_data(msg, gh, trans); +#if 0 /* Send CP-ACK or CP-ERORR in response */ if (rc < 0) { rc = gsm411_tx_cp_error(trans, GSM411_CP_CAUSE_NET_FAIL); } else rc = gsm411_tx_cp_ack(trans); +#endif break; case GSM411_MT_CP_ACK: /* previous CP-DATA in this transaction was confirmed */ @@ -908,6 +914,7 @@ int gsm411_send_sms_lchan(struct gsm_lchan *lchan, struct gsm_sms *sms) trans->sms.rp_state = GSM411_RPS_IDLE; trans->sms.is_mt = 1; trans->sms.sms = sms; + trans->sms.link_id = UM_SAPI_SMS; /* FIXME: main or SACCH ? */ trans->lchan = lchan; use_lchan(lchan); |