From 353fa5a14d0a02ef383bfaa4f6a7273024f94d2f Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Tue, 13 Jun 2023 13:44:32 +0200 Subject: ASCI: Add support for sending RSL UNIT-DATA towards BTS This is required to send UPLINK FREE and UPLINK BUSY messages to the BTS. Change-Id: I25e80f079989a4c7dede58c327c22b958784f3ff Related: OS#4852 --- include/osmocom/bsc/abis_rsl.h | 1 + src/osmo-bsc/abis_rsl.c | 25 +++++++++++++++++++++++++ src/osmo-bsc/gsm_04_08_rr.c | 9 +++++++++ 3 files changed, 35 insertions(+) diff --git a/include/osmocom/bsc/abis_rsl.h b/include/osmocom/bsc/abis_rsl.h index 83e8f7d17..3da0d6ce4 100644 --- a/include/osmocom/bsc/abis_rsl.h +++ b/include/osmocom/bsc/abis_rsl.h @@ -62,6 +62,7 @@ int rsl_tx_imm_ass_rej(struct gsm_bts *bts, struct gsm48_req_ref *rqd_ref); int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_command); int rsl_data_request(struct msgb *msg, uint8_t link_id); +int rsl_unit_data_request(struct msgb *msg, uint8_t link_id); int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id); int rsl_relase_request(struct gsm_lchan *lchan, uint8_t link_id); diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c index d7f5c3320..99c2822a8 100644 --- a/src/osmo-bsc/abis_rsl.c +++ b/src/osmo-bsc/abis_rsl.c @@ -1157,6 +1157,31 @@ int rsl_data_request(struct msgb *msg, uint8_t link_id) return abis_rsl_sendmsg(msg); } +/* Send "UNIT DATA REQUEST" message with given L3 Info payload */ +/* Chapter 8.3.11 */ +int rsl_unit_data_request(struct msgb *msg, uint8_t link_id) +{ + int chan_nr; + + if (msg->lchan == NULL) { + LOGP(DRSL, LOGL_ERROR, "cannot send UNIT DATA REQUEST to unknown lchan\n"); + msgb_free(msg); + return -EINVAL; + } + + chan_nr = gsm_lchan2chan_nr(msg->lchan, true); + if (chan_nr < 0) { + msgb_free(msg); + return chan_nr; + } + + rsl_rll_push_l3(msg, RSL_MT_UNIT_DATA_REQ, chan_nr, link_id, 1); + + msg->dst = rsl_chan_link(msg->lchan); + + return abis_rsl_sendmsg(msg); +} + /* Send "ESTABLISH REQUEST" message with given L3 Info payload */ /* Chapter 8.3.1 */ int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id) diff --git a/src/osmo-bsc/gsm_04_08_rr.c b/src/osmo-bsc/gsm_04_08_rr.c index ae54cf504..5c2b0f88a 100644 --- a/src/osmo-bsc/gsm_04_08_rr.c +++ b/src/osmo-bsc/gsm_04_08_rr.c @@ -57,6 +57,15 @@ int gsm48_sendmsg(struct msgb *msg) return rsl_data_request(msg, 0); } +int gsm48_sendmsg_unit(struct msgb *msg) +{ + if (msg->lchan) + msg->dst = rsl_chan_link(msg->lchan); + + msg->l3h = msg->data; + return rsl_unit_data_request(msg, 0); +} + /* Section 9.1.8 / Table 9.9 */ struct chreq { uint8_t val; -- cgit v1.2.3