diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2023-09-26 15:24:29 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2023-10-03 23:29:17 -0400 |
commit | 6adff3954b149877c8a587893b18b291e34856b2 (patch) | |
tree | d2e12053b09f4267e2b74aab70e59517cf2a9d3e /src | |
parent | 78ae83c3141e5e46ca109e92adc015e3698f078b (diff) | |
download | kutter-6adff3954b149877c8a587893b18b291e34856b2.tar.gz kutter-6adff3954b149877c8a587893b18b291e34856b2.tar.xz kutter-6adff3954b149877c8a587893b18b291e34856b2.zip |
usb_canbus: Prioritize local response sending over new host messages
Prioritize sending responses back to the host over transmitting new
messages from the host. Otherwise, the gs_usb host usb
acknowledgments could saturate the usb bandwidth for extended periods.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/generic/usb_canbus.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/generic/usb_canbus.c b/src/generic/usb_canbus.c index 9d09adf9..9c2893bf 100644 --- a/src/generic/usb_canbus.c +++ b/src/generic/usb_canbus.c @@ -244,9 +244,9 @@ usbcan_task(void) // Send any previous echo frames if (host_status) { - if (UsbCan.usb_send_busy) + if (UsbCan.notify_local || UsbCan.usb_send_busy) // Don't send echo frame until other traffic is sent - return; + break; int ret = usb_send_bulk_in(gs, sizeof(*gs)); if (ret < 0) return; @@ -281,6 +281,8 @@ canbus_send(struct canbus_msg *msg) int ret = send_frame(msg); if (ret < 0) goto retry_later; + if (UsbCan.notify_local && UsbCan.host_status) + canbus_notify_tx(); UsbCan.notify_local = 0; return msg->dlc; retry_later: |