usb: dwc3: gadget: Reduce TRB IOC settings
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Tue, 8 Nov 2022 00:37:55 +0000 (16:37 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Nov 2022 15:46:46 +0000 (16:46 +0100)
commit04914233561377fc0369b984c9d19ec1b6ce2845
tree54c4f916875776b5db8da350df9fadb76a057bba
parent0ce0f9d0785a7ba5637a22b63332cf747772da2a
usb: dwc3: gadget: Reduce TRB IOC settings

When the TRB ring is full, the dwc3 driver must make sure that there's
at least 1 TRB with Interrupt On Completion (IOC) set to notify of
available TRBs.

The current logic just sets the TRB's IOC whenever we run out of TRBs,
but it doesn't consider that there may be other TRBs with IOC/LST set
already. This creates more events and unnecessary delay from interrupt
handling. Only forcefully set IOC when we run out of TRBs and none of
the TRBs in the TRB ring has had IOC set.

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/72a1fa448eb1201b152e65be7902a5d1c75b9f3a.1667867687.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/gadget.c