UPSTREAM: usb: dwc3: gadget: keep track of allocated and queued reqs
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 30 May 2016 10:34:58 +0000 (13:34 +0300)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 16 Aug 2016 12:48:19 +0000 (20:48 +0800)
We will be using this information to change how we
figure out when we need LST bit. For now, just
update our counters.

Change-Id: I3c2019ef6649d47b89dbf1c16ef2eed6012442c6
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 68d34c8a744d16ae449577a71c67b19a4b1100d0)

drivers/usb/dwc3/core.h
drivers/usb/dwc3/gadget.c
drivers/usb/dwc3/trace.h

index a37891228e39b6585a40a817b5feab58c862c75e..4264221127be6adb3004ecb7e162c84a1fd518b0 100644 (file)
@@ -494,6 +494,8 @@ struct dwc3_event_buffer {
  * @type: set to bmAttributes & USB_ENDPOINT_XFERTYPE_MASK
  * @resource_index: Resource transfer index
  * @interval: the interval on which the ISOC transfer is started
+ * @allocated_requests: number of requests allocated
+ * @queued_requests: number of requests queued for transfer
  * @name: a human readable name e.g. ep1out-bulk
  * @direction: true for TX, false for RX
  * @stream_capable: true when streams are enabled
@@ -538,6 +540,8 @@ struct dwc3_ep {
        u8                      number;
        u8                      type;
        u8                      resource_index;
+       u32                     allocated_requests;
+       u32                     queued_requests;
        u32                     interval;
 
        char                    name[20];
index 26eb7f013ce6f36121dc2ccb286a0ce77118946f..54d2d104d78aea55431307ebcc4c7e69697214c3 100644 (file)
@@ -741,6 +741,8 @@ static struct usb_request *dwc3_gadget_ep_alloc_request(struct usb_ep *ep,
        req->epnum      = dep->number;
        req->dep        = dep;
 
+       dep->allocated_requests++;
+
        trace_dwc3_alloc_request(req);
 
        return &req->request;
@@ -750,7 +752,9 @@ static void dwc3_gadget_ep_free_request(struct usb_ep *ep,
                struct usb_request *request)
 {
        struct dwc3_request             *req = to_dwc3_request(request);
+       struct dwc3_ep                  *dep = to_dwc3_ep(ep);
 
+       dep->allocated_requests--;
        trace_dwc3_free_request(req);
        kfree(req);
 }
@@ -831,6 +835,8 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
 
        trb->ctrl |= DWC3_TRB_CTRL_HWO;
 
+       dep->queued_requests++;
+
        trace_dwc3_prepare_trb(dep, trb);
 }
 
@@ -1940,6 +1946,7 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
        unsigned int            s_pkt = 0;
        unsigned int            trb_status;
 
+       dep->queued_requests--;
        trace_dwc3_complete_trb(dep, trb);
 
        if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
index cafd69fc7eb800d3ffc0c2fb94d002cde74e87b0..d24cefd191b558e8452beab674130b7ff49b893d 100644 (file)
@@ -231,6 +231,8 @@ DECLARE_EVENT_CLASS(dwc3_log_trb,
        TP_STRUCT__entry(
                __dynamic_array(char, name, DWC3_MSG_MAX)
                __field(struct dwc3_trb *, trb)
+               __field(u32, allocated)
+               __field(u32, queued)
                __field(u32, bpl)
                __field(u32, bph)
                __field(u32, size)
@@ -239,13 +241,16 @@ DECLARE_EVENT_CLASS(dwc3_log_trb,
        TP_fast_assign(
                snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
                __entry->trb = trb;
+               __entry->allocated = dep->allocated_requests;
+               __entry->queued = dep->queued_requests;
                __entry->bpl = trb->bpl;
                __entry->bph = trb->bph;
                __entry->size = trb->size;
                __entry->ctrl = trb->ctrl;
        ),
-       TP_printk("%s: trb %p buf %08x%08x size %d ctrl %08x (%c%c%c%c:%c%c:%s)",
-               __get_str(name), __entry->trb, __entry->bph, __entry->bpl,
+       TP_printk("%s: %d/%d trb %p buf %08x%08x size %d ctrl %08x (%c%c%c%c:%c%c:%s)",
+               __get_str(name), __entry->queued, __entry->allocated,
+               __entry->trb, __entry->bph, __entry->bpl,
                __entry->size, __entry->ctrl,
                __entry->ctrl & DWC3_TRB_CTRL_HWO ? 'H' : 'h',
                __entry->ctrl & DWC3_TRB_CTRL_LST ? 'L' : 'l',