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
This commit is contained in:
Andreas Eversberg 2023-05-10 13:00:23 +02:00 committed by laforge
parent 532b8e92c5
commit 6799741699
1 changed files with 12 additions and 6 deletions

View File

@ -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;