summaryrefslogtreecommitdiff
path: root/src/class/net
diff options
context:
space:
mode:
authorTomas Rezucha <[email protected]>2025-01-15 19:16:58 +0100
committerTomas Rezucha <[email protected]>2025-01-15 19:16:58 +0100
commit6476ff12417be6df834333410f4fb2e64049fe7a (patch)
treebaa1250213753240f6ea228e7ca363605742e255 /src/class/net
parent880aae4be2556704abd4dae9c707c9fa87603cf1 (diff)
fix(ncm): Return invalid NTBs to free list
In case we received invalid datagram, we silently fail a the buffer was not returned to empty list -> it was lost. If this happened more than CFG_TUD_NCM_OUT_NTB_N times, we run out of NTBs and all OUT transfers are NACKed. Closes https://github.com/espressif/esp-usb/issues/107
Diffstat (limited to 'src/class/net')
-rw-r--r--src/class/net/ncm_device.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/class/net/ncm_device.c b/src/class/net/ncm_device.c
index aac11a058..f9fda0698 100644
--- a/src/class/net/ncm_device.c
+++ b/src/class/net/ncm_device.c
@@ -857,7 +857,8 @@ bool netd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_
// - if there is a free receive buffer, initiate reception
if (!recv_validate_datagram(ncm_interface.recv_tinyusb_ntb, xferred_bytes)) {
// verification failed: ignore NTB and return it to free
- TU_LOG_DRV("(EE) VALIDATION FAILED. WHAT CAN WE DO IN THIS CASE?\n");
+ TU_LOG_DRV("Invalid datatagram. Ignoring NTB\n");
+ recv_put_ntb_into_free_list(ncm_interface.recv_tinyusb_ntb);
} else {
// packet ok -> put it into ready list
recv_put_ntb_into_ready_list(ncm_interface.recv_tinyusb_ntb);