RSL: restructure MDCX functions

In preparation for upcoming LCLS changes we have to split IPA RSL MDCX
generation into separate function with the ability to set destination
explicitly instead of just using the value from lchan which will be used
in follow-up patches.

Change-Id: Iffe2f4f10e841fc36965cce02b4e5f017a5ae6c8
Related: OS#3659
This commit is contained in:
Max 2018-11-07 12:26:18 +01:00 committed by Harald Welte
parent 77cd112993
commit c43e871fea
2 changed files with 19 additions and 6 deletions

View File

@ -61,6 +61,7 @@ int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t len,
int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci);
/* ip.access specfic RSL extensions */
struct msgb *rsl_make_ipacc_mdcx(const struct gsm_lchan *lchan, uint32_t dest_ip, uint16_t dest_port);
int rsl_tx_ipacc_crcx(const struct gsm_lchan *lchan);
int rsl_tx_ipacc_mdcx(const struct gsm_lchan *lchan);
int rsl_ipacc_mdcx_to_rtpsock(struct gsm_lchan *lchan);

View File

@ -1847,11 +1847,12 @@ int rsl_tx_ipacc_crcx(const struct gsm_lchan *lchan)
return abis_rsl_sendmsg(msg);
}
/*! Send IPA RSL MDCX to configure the RTP port the BTS sends to (MGW).
* \param[in] lchan Logical Channel for which we issue MDCX
* Remote (MGW) IP address, port and payload types for RTP are determined from lchan->abis_ip.
/*! Allocate buffer for IPA RSL MDCX and populate it with given parameters.
* \param[in] lchan Logical Channel for which we make MDCX
* \param[in] dest_ip The IP address to connect to
* \param[in] dest_port The port to connect to
*/
int rsl_tx_ipacc_mdcx(const struct gsm_lchan *lchan)
struct msgb *rsl_make_ipacc_mdcx(const struct gsm_lchan *lchan, uint32_t dest_ip, uint16_t dest_port)
{
struct msgb *msg = rsl_msgb_alloc();
struct abis_rsl_dchan_hdr *dh;
@ -1865,8 +1866,8 @@ int rsl_tx_ipacc_mdcx(const struct gsm_lchan *lchan)
msgb_tv16_put(msg, RSL_IE_IPAC_CONN_ID, lchan->abis_ip.conn_id);
msgb_v_put(msg, RSL_IE_IPAC_REMOTE_IP);
att_ip = (uint32_t *)msgb_put(msg, sizeof(uint32_t));
*att_ip = htonl(lchan->abis_ip.connect_ip);
msgb_tv16_put(msg, RSL_IE_IPAC_REMOTE_PORT, lchan->abis_ip.connect_port);
*att_ip = htonl(dest_ip);
msgb_tv16_put(msg, RSL_IE_IPAC_REMOTE_PORT, dest_port);
msgb_tv_put(msg, RSL_IE_IPAC_SPEECH_MODE, lchan->abis_ip.speech_mode);
msgb_tv_put(msg, RSL_IE_IPAC_RTP_PAYLOAD, lchan->abis_ip.rtp_payload);
if (lchan->abis_ip.rtp_payload2)
@ -1874,6 +1875,17 @@ int rsl_tx_ipacc_mdcx(const struct gsm_lchan *lchan)
msg->dst = lchan->ts->trx->rsl_link;
return msg;
}
/*! Send IPA RSL MDCX to configure the RTP port the BTS sends to (MGW).
* \param[in] lchan Logical Channel for which we issue MDCX
* Remote (MGW) IP address, port and payload types for RTP are determined from lchan->abis_ip.
*/
int rsl_tx_ipacc_mdcx(const struct gsm_lchan *lchan)
{
struct msgb *msg = rsl_make_ipacc_mdcx(lchan, lchan->abis_ip.connect_ip, lchan->abis_ip.connect_port);
LOG_LCHAN(lchan, LOGL_DEBUG, "Sending IPACC MDCX to BTS:"
" %s:%u rtp_payload=%u rtp_payload2=%u conn_id=%u speech_mode=0x%02x\n",
ip_to_a(lchan->abis_ip.connect_ip),