Skip to content

Commit b3971d0

Browse files
bjarki-andreasenaescolar
authored andcommitted
modem: cmux: Add DLCI receive buffer overrun LOG WRN
DLCI receive buffer may overrun if data is not processed fast enough. This error was not reported before this patch, resulting in unexplained missing bytes. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent 79e8647 commit b3971d0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

subsys/modem/modem_cmux.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,15 +546,19 @@ static void modem_cmux_on_dlci_frame_ua(struct modem_cmux_dlci *dlci)
546546
static void modem_cmux_on_dlci_frame_uih(struct modem_cmux_dlci *dlci)
547547
{
548548
struct modem_cmux *cmux = dlci->cmux;
549+
uint32_t written;
549550

550551
if (dlci->state != MODEM_CMUX_DLCI_STATE_OPEN) {
551552
LOG_DBG("Unexpected UIH frame");
552553
return;
553554
}
554555

555556
k_mutex_lock(&dlci->receive_rb_lock, K_FOREVER);
556-
ring_buf_put(&dlci->receive_rb, cmux->frame.data, cmux->frame.data_len);
557+
written = ring_buf_put(&dlci->receive_rb, cmux->frame.data, cmux->frame.data_len);
557558
k_mutex_unlock(&dlci->receive_rb_lock);
559+
if (written != cmux->frame.data_len) {
560+
LOG_WRN("DLCI %u receive buffer overrun", dlci->dlci_address);
561+
}
558562
modem_pipe_notify_receive_ready(&dlci->pipe);
559563
}
560564

0 commit comments

Comments
 (0)