diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-04-16 23:09:18 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2012-04-19 09:39:54 +0200 |
commit | d7718280c98cdd9a6da27fbbf90c171f49969279 (patch) | |
tree | 6f6fd82f888b5efd395478db50799c8b6390e6cc /src/common/rsl.c | |
parent | 1e2b3259b92de9885c882cd0291452d8b7ffbfed (diff) |
lchan: Send the ACT ACK/NACK after the Layer1 has handled act/deact
Send the RSL ACT ACK/NACK after the Layer1 firmware has acked the
activation/deactivation. In case the channel can not be activated
we will send a NACK. In case the channel can not be deactivated we
will send an ACK and the next time the channel is activated we will
send a NACK. The release ack will be sent once the TxDownlink of the
TCH/SDCCH is closed.
Change the rsl_tx_chan_nack method to create a new msgb to be used
by the hardware layer, change the return value to ask the caller to
delete the msgb.
Diffstat (limited to 'src/common/rsl.c')
-rw-r--r-- | src/common/rsl.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c index e426aa53..188d4391 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -517,20 +517,21 @@ int rsl_tx_chan_act_ack(struct gsm_lchan *lchan, struct gsm_time *gtime) } /* 8.4.3 sending CHANnel ACTIVation Negative ACK */ -static int rsl_tx_chan_nack(struct gsm_bts_trx *trx, struct msgb *msg, uint8_t cause) +int rsl_tx_chan_act_nack(struct gsm_lchan *lchan, uint8_t cause) { - struct abis_rsl_dchan_hdr *dch = msgb_l2(msg); - uint8_t chan_nr = dch->chan_nr; + struct msgb *msg; + uint8_t chan_nr = gsm_lchan2chan_nr(lchan); LOGP(DRSL, LOGL_NOTICE, "Sending Channel Activated NACK: cause = 0x%02x\n", cause); - msg->len = 0; - msg->data = msg->tail = msg->l3h; + msg = rsl_msgb_alloc(sizeof(struct abis_rsl_dchan_hdr)); + if (!msg) + return -ENOMEM; /* 9.3.26 Cause */ msgb_tlv_put(msg, RSL_IE_CAUSE, 1, &cause); rsl_dch_push_hdr(msg, RSL_MT_CHAN_ACTIV_NACK, chan_nr); - msg->trx = trx; + msg->trx = lchan->ts->trx; return abis_rsl_sendmsg(msg); } @@ -621,16 +622,14 @@ static int rsl_rx_chan_activ(struct msgb *msg) /* 9.3.3 Activation Type */ if (!TLVP_PRESENT(&tp, RSL_IE_ACT_TYPE)) { LOGP(DRSL, LOGL_NOTICE, "missing Activation Type\n"); - rsl_tx_chan_nack(msg->trx, msg, RSL_ERR_MAND_IE_ERROR); - return 1; + return rsl_tx_chan_act_nack(lchan, RSL_ERR_MAND_IE_ERROR); } type = *TLVP_VAL(&tp, RSL_IE_ACT_TYPE); /* 9.3.6 Channel Mode */ if (!TLVP_PRESENT(&tp, RSL_IE_CHAN_MODE)) { LOGP(DRSL, LOGL_NOTICE, "missing Channel Mode\n"); - rsl_tx_chan_nack(msg->trx, msg, RSL_ERR_MAND_IE_ERROR); - return 1; + return rsl_tx_chan_act_nack(lchan, RSL_ERR_MAND_IE_ERROR); } cm = (struct rsl_ie_chan_mode *) TLVP_VAL(&tp, RSL_IE_CHAN_MODE); lchan_tchmode_from_cmode(lchan, cm); |