Skip to content

Commit

Permalink
usb: device: cdc_acm: Warn once about full ring buffer
Browse files Browse the repository at this point in the history
Generating separate log entry at INFO level for every single character
dropped is excessive and leads to log flood. Logging dropped character
in no way helps end user and is really a delayed performance killer that
triggers when CDC ACM buffer gets full.

If user does not want to lose outgoing characters then the solution is
to enable hardware flow control which properly blocks in the case the
output buffer is full.

(cherry picked from commit d034106)

Original-Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
GitOrigin-RevId: d034106
Change-Id: I11d7ad482a884659ea3a27f9dfe1cfcb20fb4871
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5580448
Commit-Queue: Tristan Honscheid <honscheid@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Tested-by: Tristan Honscheid <honscheid@google.com>
Reviewed-by: Tristan Honscheid <honscheid@google.com>
  • Loading branch information
tmon-nordic authored and Chromeos LUCI committed May 29, 2024
1 parent ce7945b commit 535e348
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/usb/device/class/cdc_acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ static void cdc_acm_poll_out(const struct device *dev, unsigned char c)

while (!ring_buf_put(dev_data->tx_ringbuf, &c, 1)) {
if (k_is_in_isr() || !dev_data->flow_ctrl) {
LOG_INF("Ring buffer full, discard %c", c);
LOG_WRN_ONCE("Ring buffer full, discard data");
break;
}

Expand Down

0 comments on commit 535e348

Please sign in to comment.