aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2023-05-10 13:00:23 +0200
committerlaforge <laforge@osmocom.org>2023-06-09 15:06:34 +0000
commit6799741699946d916f38c4ec46ac7c4223d204cc (patch)
treed3f6a045922b3d44f82593a535789f88e08d4bc7 /src/gsm
parent532b8e92c5a33ac4fd7e62f8355abf64292736c7 (diff)
Add support for sending Bter UI frames at lapdm.c
Bter frames may be used on downlink of a main DCCH or SACCH channel. It applies to SAPI 0 and UI frames only. It includes a short layer 2 header with 2 bits only. All other bits are used for the message. The message size is 23 bytes on main DCCH and 21 bytes on SACCH. The length of the L3 messsage is used to distinguish between Bter frames and other (UI) frames. Note that the L3 message header is different, so that the length of the UI frame will determine which header is used. Change-Id: Ia3a25c009d1ff09f83258bdb226a85b81466d7a1
Diffstat (limited to 'src/gsm')
-rw-r--r--src/gsm/lapdm.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c
index b7f57694..67e53f83 100644
--- a/src/gsm/lapdm.c
+++ b/src/gsm/lapdm.c
@@ -1030,6 +1030,7 @@ static int rslms_rx_rll_udata_req(struct msgb *msg, struct lapdm_datalink *dl)
uint8_t sapi = link_id & 7;
struct tlv_parsed tv;
int length, ui_bts;
+ bool use_b_ter;
if (!le) {
LOGDL(&dl->dl, LOGL_ERROR, "lapdm_datalink without entity error\n");
@@ -1055,8 +1056,10 @@ static int rslms_rx_rll_udata_req(struct msgb *msg, struct lapdm_datalink *dl)
}
msg->l3h = (uint8_t *) TLVP_VAL(&tv, RSL_IE_L3_INFO);
length = TLVP_LEN(&tv, RSL_IE_L3_INFO);
+ /* check for Bter frame */
+ use_b_ter = (length == ((link_id & 0x40) ? 21 : 23) && sapi == 0);
/* check if the layer3 message length exceeds N201 */
- if (length + ((link_id & 0x40) ? 4 : 2) + !ui_bts > 23) {
+ if (length + ((link_id & 0x40) ? 4 : 2) + !ui_bts > 23 && !use_b_ter) {
LOGDL(&dl->dl, LOGL_ERROR, "frame too large: %d > N201(%d) "
"(discarding)\n", length,
((link_id & 0x40) ? 18 : 20) + ui_bts);
@@ -1071,11 +1074,14 @@ static int rslms_rx_rll_udata_req(struct msgb *msg, struct lapdm_datalink *dl)
msgb_trim(msg, length);
/* Push L1 + LAPDm header on msgb */
- msg->l2h = msgb_push(msg, 2 + !ui_bts);
- msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, dl->dl.cr.loc2rem.cmd);
- msg->l2h[1] = LAPDm_CTRL_U(LAPDm_U_UI, 0);
- if (!ui_bts)
- msg->l2h[2] = LAPDm_LEN(length);
+ if (!use_b_ter) {
+ msg->l2h = msgb_push(msg, 2 + !ui_bts);
+ msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, dl->dl.cr.loc2rem.cmd);
+ msg->l2h[1] = LAPDm_CTRL_U(LAPDm_U_UI, 0);
+ if (!ui_bts)
+ msg->l2h[2] = LAPDm_LEN(length);
+ } else
+ msg->l2h = msg->data;
if (link_id & 0x40) {
msg->l2h = msgb_push(msg, 2);
msg->l2h[0] = le->tx_power;