Don't trace short receives if URB_SHORT_NOT_OK is set. Short receives are normal for USB ethernet devices. Don't trace unexpected incomplete receives if XHCI_TRUST_TX_LENGTH is set. Ratelimit the trace. Signed-off-by: David Laight <david.laight@xxxxxxxxxx> --- If these two traces ever happen, then they will happen for every receive packet when using USB ethernet. If you need to enable the xhci_warn or xhci_dgb traces you don't want to be spammed with trace (syslogd will soon will the disk). These patches won't apply to 3.12 because the trace texts have changed, however 3.12 also needs a kernel recompile to enable the traces and anyone doing that can probably manage to patch them out. Changes for v2: Fixed so that it applies to Linus's current tree. drivers/usb/host/xhci-ring.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index a0b248c..0b3dd16 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2301,36 +2301,34 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, switch (trb_comp_code) { case COMP_SUCCESS: /* Double check that the HW transferred everything. */ - if (event_trb != td->last_trb || - EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) { - xhci_warn(xhci, "WARN Successful completion " - "on short TX\n"); - if (td->urb->transfer_flags & URB_SHORT_NOT_OK) - *status = -EREMOTEIO; - else - *status = 0; - if ((xhci->quirks & XHCI_TRUST_TX_LENGTH)) - trb_comp_code = COMP_SHORT_TX; - } else { + if (event_trb == td->last_trb && + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) { *status = 0; + break; } - break; + if (xhci->quirks & XHCI_TRUST_TX_LENGTH) + trb_comp_code = COMP_SHORT_TX; + else + xhci_warn_ratelimited(xhci, + "WARN Successful completion on short TX\n"); + /* FALLTHROUGH */ case COMP_SHORT_TX: - if (td->urb->transfer_flags & URB_SHORT_NOT_OK) + if (td->urb->transfer_flags & URB_SHORT_NOT_OK) { + xhci_dbg(xhci, + "ep %#x - asked for %d bytes, %d bytes untransferred\n", + td->urb->ep->desc.bEndpointAddress, + td->urb->transfer_buffer_length, + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len))); *status = -EREMOTEIO; - else + } else { *status = 0; + } break; default: /* Others already handled above */ break; } - if (trb_comp_code == COMP_SHORT_TX) - xhci_dbg(xhci, "ep %#x - asked for %d bytes, " - "%d bytes untransferred\n", - td->urb->ep->desc.bEndpointAddress, - td->urb->transfer_buffer_length, - EVENT_TRB_LEN(le32_to_cpu(event->transfer_len))); + /* Fast path - was this the last TRB in the TD for this URB? */ if (event_trb == td->last_trb) { if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) { -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html