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>
This commit is contained in:
parent
78ae83c314
commit
6adff3954b
|
@ -244,9 +244,9 @@ usbcan_task(void)
|
||||||
|
|
||||||
// Send any previous echo frames
|
// Send any previous echo frames
|
||||||
if (host_status) {
|
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
|
// Don't send echo frame until other traffic is sent
|
||||||
return;
|
break;
|
||||||
int ret = usb_send_bulk_in(gs, sizeof(*gs));
|
int ret = usb_send_bulk_in(gs, sizeof(*gs));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return;
|
return;
|
||||||
|
@ -281,6 +281,8 @@ canbus_send(struct canbus_msg *msg)
|
||||||
int ret = send_frame(msg);
|
int ret = send_frame(msg);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto retry_later;
|
goto retry_later;
|
||||||
|
if (UsbCan.notify_local && UsbCan.host_status)
|
||||||
|
canbus_notify_tx();
|
||||||
UsbCan.notify_local = 0;
|
UsbCan.notify_local = 0;
|
||||||
return msg->dlc;
|
return msg->dlc;
|
||||||
retry_later:
|
retry_later:
|
||||||
|
|
Loading…
Reference in New Issue