From 535e348164c91ba7ac6eb9d1bcbaf086e8cd7f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Mon, 13 Nov 2023 10:27:59 +0100 Subject: [PATCH] usb: device: cdc_acm: Warn once about full ring buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 d034106b4035f26002c938f33ed59f6802ff235b) Original-Signed-off-by: Tomasz Moń GitOrigin-RevId: d034106b4035f26002c938f33ed59f6802ff235b Change-Id: I11d7ad482a884659ea3a27f9dfe1cfcb20fb4871 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5580448 Commit-Queue: Tristan Honscheid Tested-by: ChromeOS Prod (Robot) Tested-by: Tristan Honscheid Reviewed-by: Tristan Honscheid --- subsys/usb/device/class/cdc_acm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/usb/device/class/cdc_acm.c b/subsys/usb/device/class/cdc_acm.c index 80e9b561059..d3148fba48f 100644 --- a/subsys/usb/device/class/cdc_acm.c +++ b/subsys/usb/device/class/cdc_acm.c @@ -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; }