Commit b9c84be6 authored by Thomas Pugliese's avatar Thomas Pugliese Committed by Greg Kroah-Hartman

usb: wusbcore: include the xfer_id in debug prints

Include the xfer_id in debug prints for transfers and transfer segments.
This makes it much easier to correlate debug logs to USB analyzer logs.
Signed-off-by: default avatarThomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fdd160c3
...@@ -237,6 +237,31 @@ static void wa_xfer_completion(struct wa_xfer *xfer) ...@@ -237,6 +237,31 @@ static void wa_xfer_completion(struct wa_xfer *xfer)
wa_xfer_giveback(xfer); wa_xfer_giveback(xfer);
} }
/*
* Initialize a transfer's ID
*
* We need to use a sequential number; if we use the pointer or the
* hash of the pointer, it can repeat over sequential transfers and
* then it will confuse the HWA....wonder why in hell they put a 32
* bit handle in there then.
*/
static void wa_xfer_id_init(struct wa_xfer *xfer)
{
xfer->id = atomic_add_return(1, &xfer->wa->xfer_id_count);
}
/* Return the xfer's ID. */
static inline u32 wa_xfer_id(struct wa_xfer *xfer)
{
return xfer->id;
}
/* Return the xfer's ID in transport format (little endian). */
static inline __le32 wa_xfer_id_le32(struct wa_xfer *xfer)
{
return cpu_to_le32(xfer->id);
}
/* /*
* If transfer is done, wrap it up and return true * If transfer is done, wrap it up and return true
* *
...@@ -259,8 +284,9 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer) ...@@ -259,8 +284,9 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer)
switch (seg->status) { switch (seg->status) {
case WA_SEG_DONE: case WA_SEG_DONE:
if (found_short && seg->result > 0) { if (found_short && seg->result > 0) {
dev_dbg(dev, "xfer %p#%u: bad short segments (%zu)\n", dev_dbg(dev, "xfer %p ID %08X#%u: bad short segments (%zu)\n",
xfer, cnt, seg->result); xfer, wa_xfer_id(xfer), cnt,
seg->result);
urb->status = -EINVAL; urb->status = -EINVAL;
goto out; goto out;
} }
...@@ -268,24 +294,26 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer) ...@@ -268,24 +294,26 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer)
if (seg->result < xfer->seg_size if (seg->result < xfer->seg_size
&& cnt != xfer->segs-1) && cnt != xfer->segs-1)
found_short = 1; found_short = 1;
dev_dbg(dev, "xfer %p#%u: DONE short %d " dev_dbg(dev, "xfer %p ID %08X#%u: DONE short %d "
"result %zu urb->actual_length %d\n", "result %zu urb->actual_length %d\n",
xfer, seg->index, found_short, seg->result, xfer, wa_xfer_id(xfer), seg->index, found_short,
urb->actual_length); seg->result, urb->actual_length);
break; break;
case WA_SEG_ERROR: case WA_SEG_ERROR:
xfer->result = seg->result; xfer->result = seg->result;
dev_dbg(dev, "xfer %p#%u: ERROR result %zu\n", dev_dbg(dev, "xfer %p ID %08X#%u: ERROR result %zu(0x%08X)\n",
xfer, seg->index, seg->result); xfer, wa_xfer_id(xfer), seg->index, seg->result,
seg->result);
goto out; goto out;
case WA_SEG_ABORTED: case WA_SEG_ABORTED:
dev_dbg(dev, "xfer %p#%u ABORTED: result %d\n", dev_dbg(dev, "xfer %p ID %08X#%u ABORTED: result %d\n",
xfer, seg->index, urb->status); xfer, wa_xfer_id(xfer), seg->index,
urb->status);
xfer->result = urb->status; xfer->result = urb->status;
goto out; goto out;
default: default:
dev_warn(dev, "xfer %p#%u: is_done bad state %d\n", dev_warn(dev, "xfer %p ID %08X#%u: is_done bad state %d\n",
xfer, cnt, seg->status); xfer, wa_xfer_id(xfer), cnt, seg->status);
xfer->result = -EINVAL; xfer->result = -EINVAL;
goto out; goto out;
} }
...@@ -295,31 +323,6 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer) ...@@ -295,31 +323,6 @@ static unsigned __wa_xfer_is_done(struct wa_xfer *xfer)
return result; return result;
} }
/*
* Initialize a transfer's ID
*
* We need to use a sequential number; if we use the pointer or the
* hash of the pointer, it can repeat over sequential transfers and
* then it will confuse the HWA....wonder why in hell they put a 32
* bit handle in there then.
*/
static void wa_xfer_id_init(struct wa_xfer *xfer)
{
xfer->id = atomic_add_return(1, &xfer->wa->xfer_id_count);
}
/* Return the xfer's ID. */
static inline u32 wa_xfer_id(struct wa_xfer *xfer)
{
return xfer->id;
}
/* Return the xfer's ID in transport format (little endian). */
static inline __le32 wa_xfer_id_le32(struct wa_xfer *xfer)
{
return cpu_to_le32(xfer->id);
}
/* /*
* Search for a transfer list ID on the HCD's URB list * Search for a transfer list ID on the HCD's URB list
* *
...@@ -618,8 +621,9 @@ static void wa_seg_tr_cb(struct urb *urb) ...@@ -618,8 +621,9 @@ static void wa_seg_tr_cb(struct urb *urb)
dev = &wa->usb_iface->dev; dev = &wa->usb_iface->dev;
rpipe = xfer->ep->hcpriv; rpipe = xfer->ep->hcpriv;
if (printk_ratelimit()) if (printk_ratelimit())
dev_err(dev, "xfer %p#%u: request error %d\n", dev_err(dev, "xfer %p ID 0x%08X#%u: request error %d\n",
xfer, seg->index, urb->status); xfer, wa_xfer_id(xfer), seg->index,
urb->status);
if (edc_inc(&wa->nep_edc, EDC_MAX_ERRORS, if (edc_inc(&wa->nep_edc, EDC_MAX_ERRORS,
EDC_ERROR_TIMEFRAME)){ EDC_ERROR_TIMEFRAME)){
dev_err(dev, "DTO: URB max acceptable errors " dev_err(dev, "DTO: URB max acceptable errors "
...@@ -964,8 +968,9 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe) ...@@ -964,8 +968,9 @@ static void wa_xfer_delayed_run(struct wa_rpipe *rpipe)
list_del(&seg->list_node); list_del(&seg->list_node);
xfer = seg->xfer; xfer = seg->xfer;
result = __wa_seg_submit(rpipe, xfer, seg); result = __wa_seg_submit(rpipe, xfer, seg);
dev_dbg(dev, "xfer %p#%u submitted from delayed [%d segments available] %d\n", dev_dbg(dev, "xfer %p ID %08X#%u submitted from delayed [%d segments available] %d\n",
xfer, seg->index, atomic_read(&rpipe->segs_available), result); xfer, wa_xfer_id(xfer), seg->index,
atomic_read(&rpipe->segs_available), result);
if (unlikely(result < 0)) { if (unlikely(result < 0)) {
spin_unlock_irqrestore(&rpipe->seg_lock, flags); spin_unlock_irqrestore(&rpipe->seg_lock, flags);
spin_lock_irqsave(&xfer->lock, flags); spin_lock_irqsave(&xfer->lock, flags);
...@@ -1009,11 +1014,10 @@ static int __wa_xfer_submit(struct wa_xfer *xfer) ...@@ -1009,11 +1014,10 @@ static int __wa_xfer_submit(struct wa_xfer *xfer)
available = atomic_read(&rpipe->segs_available); available = atomic_read(&rpipe->segs_available);
empty = list_empty(&rpipe->seg_list); empty = list_empty(&rpipe->seg_list);
seg = xfer->seg[cnt]; seg = xfer->seg[cnt];
dev_dbg(dev, "xfer %p#%u: available %u empty %u (%s)\n", dev_dbg(dev, "xfer %p ID 0x%08X#%u: available %u empty %u (%s)\n",
xfer, cnt, available, empty, xfer, wa_xfer_id(xfer), cnt, available, empty,
available == 0 || !empty ? "delayed" : "submitted"); available == 0 || !empty ? "delayed" : "submitted");
if (available == 0 || !empty) { if (available == 0 || !empty) {
dev_dbg(dev, "xfer %p#%u: delayed\n", xfer, cnt);
seg->status = WA_SEG_DELAYED; seg->status = WA_SEG_DELAYED;
list_add_tail(&seg->list_node, &rpipe->seg_list); list_add_tail(&seg->list_node, &rpipe->seg_list);
} else { } else {
...@@ -1463,8 +1467,8 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer, ...@@ -1463,8 +1467,8 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer,
seg = xfer->seg[seg_idx]; seg = xfer->seg[seg_idx];
rpipe = xfer->ep->hcpriv; rpipe = xfer->ep->hcpriv;
usb_status = xfer_result->bTransferStatus; usb_status = xfer_result->bTransferStatus;
dev_dbg(dev, "xfer %p#%u: bTransferStatus 0x%02x (seg status %u)\n", dev_dbg(dev, "xfer %p ID 0x%08X#%u: bTransferStatus 0x%02x (seg status %u)\n",
xfer, seg_idx, usb_status, seg->status); xfer, wa_xfer_id(xfer), seg_idx, usb_status, seg->status);
if (seg->status == WA_SEG_ABORTED if (seg->status == WA_SEG_ABORTED
|| seg->status == WA_SEG_ERROR) /* already handled */ || seg->status == WA_SEG_ERROR) /* already handled */
goto segment_aborted; goto segment_aborted;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment