From ac85b34476afc341af7e09e9eca368835cd9d68b Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 12 Jul 2018 21:23:26 +0200 Subject: lchan_fsm: split off lchan_rtp_fsm, establish RTP a bit earlier Change-Id: Id7a4407d9b63be05ce63f5f2768b7d7e3d5c86fb --- src/osmo-bsc/abis_rsl.c | 51 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 6 deletions(-) (limited to 'src/osmo-bsc/abis_rsl.c') diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c index 8b944d96d..8b14b499c 100644 --- a/src/osmo-bsc/abis_rsl.c +++ b/src/osmo-bsc/abis_rsl.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #define RSL_ALLOC_SIZE 1024 @@ -1878,6 +1879,11 @@ static int abis_rsl_rx_ipacc_crcx_ack(struct msgb *msg) struct tlv_parsed tv; struct gsm_lchan *lchan = msg->lchan; + if (!lchan->fi_rtp) { + LOG_LCHAN(msg->lchan, LOGL_ERROR, "Rx RSL IPACC: CRCX ACK message for unconfigured lchan"); + return -EINVAL; + } + /* the BTS has acknowledged a local bind, it now tells us the IP * address and port number to which it has bound the given logical * channel */ @@ -1892,17 +1898,37 @@ static int abis_rsl_rx_ipacc_crcx_ack(struct msgb *msg) ipac_parse_rtp(lchan, &tv, "CRCX"); - osmo_fsm_inst_dispatch(lchan->fi, LCHAN_EV_IPACC_CRCX_ACK, 0); + osmo_fsm_inst_dispatch(lchan->fi_rtp, LCHAN_RTP_EV_IPACC_CRCX_ACK, 0); return 0; } +static int abis_rsl_rx_ipacc_crcx_nack(struct msgb *msg) +{ + struct e1inp_sign_link *sign_link = msg->dst; + struct gsm_lchan *lchan = msg->lchan; + + rate_ctr_inc(&sign_link->trx->bts->bts_ctrs->ctr[BTS_CTR_RSL_IPA_NACK]); + + if (!lchan->fi_rtp) { + LOG_LCHAN(msg->lchan, LOGL_ERROR, "Rx RSL IPACC: CRCX NACK message for unconfigured lchan"); + return -EINVAL; + } + osmo_fsm_inst_dispatch(msg->lchan->fi_rtp, LCHAN_RTP_EV_IPACC_CRCX_NACK, 0); + return 0; +} + static int abis_rsl_rx_ipacc_mdcx_ack(struct msgb *msg) { struct abis_rsl_dchan_hdr *dh = msgb_l2(msg); struct tlv_parsed tv; struct gsm_lchan *lchan = msg->lchan; + if (!lchan->fi_rtp) { + LOG_LCHAN(msg->lchan, LOGL_ERROR, "Rx RSL IPACC: MDCX ACK message for unconfigured lchan"); + return -EINVAL; + } + /* the BTS has acknowledged a remote connect request and * it now tells us the IP address and port number to which it has * connected the given logical channel */ @@ -1910,11 +1936,26 @@ static int abis_rsl_rx_ipacc_mdcx_ack(struct msgb *msg) rsl_tlv_parse(&tv, dh->data, msgb_l2len(msg)-sizeof(*dh)); ipac_parse_rtp(lchan, &tv, "MDCX"); - osmo_fsm_inst_dispatch(lchan->fi, LCHAN_EV_IPACC_MDCX_ACK, 0); + osmo_fsm_inst_dispatch(lchan->fi_rtp, LCHAN_RTP_EV_IPACC_MDCX_ACK, 0); return 0; } +static int abis_rsl_rx_ipacc_mdcx_nack(struct msgb *msg) +{ + struct e1inp_sign_link *sign_link = msg->dst; + struct gsm_lchan *lchan = msg->lchan; + + rate_ctr_inc(&sign_link->trx->bts->bts_ctrs->ctr[BTS_CTR_RSL_IPA_NACK]); + + if (!lchan->fi_rtp) { + LOG_LCHAN(msg->lchan, LOGL_ERROR, "Rx RSL IPACC: MDCX NACK message for unconfigured lchan"); + return -EINVAL; + } + osmo_fsm_inst_dispatch(msg->lchan->fi_rtp, LCHAN_RTP_EV_IPACC_MDCX_NACK, 0); + return 0; +} + static int abis_rsl_rx_ipacc_dlcx_ind(struct msgb *msg) { struct abis_rsl_dchan_hdr *dh = msgb_l2(msg); @@ -1957,8 +1998,7 @@ static int abis_rsl_rx_ipacc(struct msgb *msg) case RSL_MT_IPAC_CRCX_NACK: /* somehow the BTS was unable to bind the lchan to its local * port?!? */ - rate_ctr_inc(&sign_link->trx->bts->bts_ctrs->ctr[BTS_CTR_RSL_IPA_NACK]); - osmo_fsm_inst_dispatch(msg->lchan->fi, LCHAN_EV_IPACC_CRCX_NACK, 0); + rc = abis_rsl_rx_ipacc_crcx_nack(msg); break; case RSL_MT_IPAC_MDCX_ACK: /* the BTS tells us that a connect operation was successful */ @@ -1967,8 +2007,7 @@ static int abis_rsl_rx_ipacc(struct msgb *msg) case RSL_MT_IPAC_MDCX_NACK: /* somehow the BTS was unable to connect the lchan to a remote * port */ - rate_ctr_inc(&sign_link->trx->bts->bts_ctrs->ctr[BTS_CTR_RSL_IPA_NACK]); - osmo_fsm_inst_dispatch(msg->lchan->fi, LCHAN_EV_IPACC_MDCX_NACK, 0); + rc = abis_rsl_rx_ipacc_mdcx_nack(msg); break; case RSL_MT_IPAC_DLCX_IND: rc = abis_rsl_rx_ipacc_dlcx_ind(msg); -- cgit v1.2.3