From ac3865557b274aa3984982c383b8cc66bbb42053 Mon Sep 17 00:00:00 2001 From: Matthieu CASTET Date: Fri, 1 Dec 2017 14:33:21 +0100 Subject: [PATCH] gadget event trace : add request pointer This allows to identify transfer request, if more than one are in queue. This is allowed by usb_ep_queue : "Any endpoint (except control endpoints like ep0) may have more than one transfer request queued; they complete in FIFO order." For example with adb gadget with function fs : <-transport-225 [002] d..1 47.136641: usb_ep_queue: ep1out: req ffffffc07b93ef10 length 0/24 sgs 0/0 stream 0 zsI status -115 --> 0 ->transport-224 [000] d..1 47.153947: usb_ep_queue: ep1in: req ffffffc07c0def10 length 0/24 sgs 0/0 stream 0 zsI status -115 --> 0 sh-452 [000] d.h2 47.153984: usb_gadget_giveback_request: ep1in: req ffffffc07c0def10 length 24/24 sgs 0/0 stream 0 zsI status 0 --> 0 sh-452 [000] d.h. 47.154305: usb_gadget_giveback_request: ep1out: req ffffffc07b93ef10 length 24/24 sgs 0/0 stream 0 zsI status 0 --> 0 <-transport-225 [002] d..1 47.154363: usb_ep_queue: ep1out: req ffffffc07b93ef10 length 0/21 sgs 0/0 stream 0 zsI status -115 --> 0 sh-452 [000] d.h. 47.154378: usb_gadget_giveback_request: ep1out: req ffffffc07b93ef10 length 21/21 sgs 0/0 stream 0 zsI status 0 --> 0 <-transport-225 [002] d..1 47.154463: usb_ep_queue: ep1out: req ffffffc07b93ef10 length 0/24 sgs 0/0 stream 0 zsI status -115 --> 0 ->transport-224 [000] d..1 47.154583: usb_ep_queue: ep1in: req ffffffc07c0def10 length 0/24 sgs 0/0 stream 0 zsI status -115 --> 0 sh-452 [000] d.h2 47.154600: usb_gadget_giveback_request: ep1in: req ffffffc07c0def10 length 24/24 sgs 0/0 stream 0 zsI status 0 --> 0 ->transport-224 [000] d..1 47.164863: usb_ep_queue: ep1in: req ffffffc07c0def10 length 0/24 sgs 0/0 stream 0 zsI status -115 --> 0 ->transport-224 [000] d.h1 47.164887: usb_gadget_giveback_request: ep1in: req ffffffc07c0def10 length 24/24 sgs 0/0 stream 0 zsI status 0 --> 0 ->transport-224 [000] d..1 47.164907: usb_ep_queue: ep1in: req ffffffc07c0def10 length 0/122 sgs 0/0 stream 0 zsI status -115 --> 0 Signed-off-by: Matthieu CASTET Signed-off-by: Felipe Balbi --- drivers/usb/gadget/udc/trace.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/trace.h b/drivers/usb/gadget/udc/trace.h index f07ddb3..2d1f68b 100644 --- a/drivers/usb/gadget/udc/trace.h +++ b/drivers/usb/gadget/udc/trace.h @@ -225,6 +225,7 @@ DECLARE_EVENT_CLASS(udc_log_req, __field(unsigned, short_not_ok) __field(int, status) __field(int, ret) + __field(struct usb_request *, req) ), TP_fast_assign( snprintf(__get_str(name), UDC_TRACE_STR_MAX, "%s", ep->name); @@ -238,9 +239,10 @@ DECLARE_EVENT_CLASS(udc_log_req, __entry->short_not_ok = req->short_not_ok; __entry->status = req->status; __entry->ret = ret; + __entry->req = req; ), - TP_printk("%s: length %d/%d sgs %d/%d stream %d %s%s%s status %d --> %d", - __get_str(name), __entry->actual, __entry->length, + TP_printk("%s: req %p length %d/%d sgs %d/%d stream %d %s%s%s status %d --> %d", + __get_str(name),__entry->req, __entry->actual, __entry->length, __entry->num_mapped_sgs, __entry->num_sgs, __entry->stream_id, __entry->zero ? "Z" : "z", __entry->short_not_ok ? "S" : "s", -- 2.7.4