Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions drivers/usbdev/cdcncm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1302,8 +1302,18 @@ static int cdcncm_send(FAR struct netdev_lowerhalf_s *dev, FAR netpkt_t *pkt)
}
else
{
work_queue(ETHWORK, &self->delaywork, cdcncm_transmit_work, self,
MSEC2TICK(CDCNCM_DGRAM_COMBINE_PERIOD));
/* Defer the transmit to the work thread so the caller is not blocked

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another too long docstring. Do we really need so long docstring? Claude is very verbose by default

* on wrreq_idle, but do so with ZERO delay. A non-zero delay here is
* quantized to the system tick: MSEC2TICK(1) rounds *up* to a full
* tick (10ms at the default 100Hz), so the reply to every single
* datagram (ping, TCP ACK, one-MSS HTTP segment) was being held for
* 10-20ms, dominating the USB-NIC round-trip time. Delay 0 wakes the
* work thread immediately (sub-ms) while still coalescing any further
* datagrams that the network stack appends in the same TX burst before
* the worker gets to run.
*/

work_queue(ETHWORK, &self->delaywork, cdcncm_transmit_work, self, 0);
}

return OK;
Expand Down
Loading