I have a test app which basically sends block of characters over USB by using NCM connection. When packet size is exact 512 bytes i see NCM is getting hung. By analyzing further i have found that it is related to handling usb endpoint ZLP request.
From open source i have found one link whic has fix for ZLP request, https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/usb/dwc3/gadget.c?h=v4.9.138&id=04c03d10e507052cfce6910ddf34091196e79e1c
By taking the changes mentioned in above link i could solve the problem.
Code change which mentioned in the link has the USB EP request length is set to ZERO but ZLP buffer has been allocated of 1024 bytes.
+ request->length = 0; + request->buf = dwc->zlp_buf;
Is this allocating 1024 bytes of ZLP buffer required? What is the purpose of this buffer if
request->length = 0;?