]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
xhci-hcd: add success/failure soft retry counters
authorJC Kuo <jckuo@nvidia.com>
Wed, 4 May 2016 11:30:39 +0000 (19:30 +0800)
committermobile promotions <svcmobile_promotions@nvidia.com>
Sat, 16 Jul 2016 01:10:37 +0000 (18:10 -0700)
This commit adds counters for successful and failed soft retry
attempts.

bug 200162414

Change-Id: I7406cea4368da85c78c8fe350398031fc8121015
Signed-off-by: JC Kuo <jckuo@nvidia.com>
Reviewed-on: http://git-master/r/1169997
GVS: Gerrit_Virtual_Submit
Reviewed-by: ChihMin Cheng <ccheng@nvidia.com>
Tested-by: Mark Kuo <mkuo@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci-tegra.c
drivers/usb/host/xhci.h

index 5f12cd73fb3b4efa06a6b04f7f3d14fa3154401e..343b2cf605907c714276baa50b0b22c475480428 100644 (file)
@@ -2512,6 +2512,11 @@ check_soft_try:
                if (ep_ring->soft_try) {
                        xhci_dbg(xhci, "soft retry completed successfully\n");
                        ep_ring->soft_try = false;
+                       xhci->xhci_ereport.soft_retry_success++;
+                       xhci_dbg(xhci, "soft_retry_success counter %u\n",
+                               xhci->xhci_ereport.soft_retry_success);
+                       xhci_dbg(xhci, "soft_retry_failure counter %u\n",
+                               xhci->xhci_ereport.soft_retry_failure);
                        xhci_endpoint_soft_retry(xhci,
                                                slot_id, ep_index + 1, false);
                }
@@ -2555,6 +2560,11 @@ check_soft_try:
                        } else {
                                xhci_dbg(xhci, "soft retry complete but transfer still failed\n");
                                ep_ring->soft_try = false;
+                               xhci->xhci_ereport.soft_retry_failure++;
+                               xhci_dbg(xhci, "soft_retry_success counter %u\n",
+                                       xhci->xhci_ereport.soft_retry_success);
+                               xhci_dbg(xhci, "soft_retry_failure counter %u\n",
+                                       xhci->xhci_ereport.soft_retry_failure);
                        }
                        xhci_endpoint_soft_retry(xhci,
                                                slot_id, ep_index + 1, false);
index e86bb57dc80d1b65937e1ceeee1bfd1a1ee68f13..9eb1021cdbf82ea74e1935ddf5057f92cdf2f186 100644 (file)
@@ -68,7 +68,7 @@ static ssize_t show_xhci_stats(struct device *dev,
        struct platform_device *pdev = NULL;
        struct tegra_xhci_hcd *tegra = NULL;
        struct xhci_hcd *xhci = NULL;
-       ssize_t ret;
+       ssize_t ret = 0;
 
        if (dev != NULL)
                pdev = to_platform_device(dev);
@@ -78,11 +78,18 @@ static ssize_t show_xhci_stats(struct device *dev,
 
        if (tegra != NULL) {
                xhci = tegra->xhci;
-               ret =  snprintf(buf, PAGE_SIZE, "comp_tx_err:%u\nversion:%u\n",
-                       xhci->xhci_ereport.comp_tx_err,
+               ret += snprintf(&buf[ret], PAGE_SIZE - ret, "version:%u\n",
                        xhci->xhci_ereport.version);
+               ret += snprintf(&buf[ret], PAGE_SIZE - ret, "comp_tx_err:%u\n",
+                       xhci->xhci_ereport.comp_tx_err);
+               ret += snprintf(&buf[ret], PAGE_SIZE - ret,
+                       "soft_retry_success:%u\n",
+                       xhci->xhci_ereport.soft_retry_success);
+               ret += snprintf(&buf[ret], PAGE_SIZE - ret,
+                       "soft_retry_failure:%u\n",
+                       xhci->xhci_ereport.soft_retry_failure);
        } else
-               ret = snprintf(buf, PAGE_SIZE, "comp_tx_err:0\nversion:0\n");
+               ret = snprintf(buf, PAGE_SIZE, "counters are not available\n");
 
        return ret;
 }
index f00087344c5616c1128f22f5aa75bd194d934b38..e77b3647f623be1a8eb7d734883d0f3c9fd7f6ba 100644 (file)
@@ -1411,6 +1411,8 @@ static inline unsigned int hcd_index(struct usb_hcd *hcd)
 struct xhci_err_cnt {
        unsigned int version;
        unsigned int comp_tx_err;
+       unsigned int soft_retry_success;
+       unsigned int soft_retry_failure;
 };
 
 /* There is one xhci_hcd structure per controller */