From: JC Kuo Date: Wed, 4 May 2016 11:30:39 +0000 (+0800) Subject: xhci-hcd: add success/failure soft retry counters X-Git-Tag: tegra-l4t-r24.2~71 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/sojka/nv-tegra/linux-3.10.git/commitdiff_plain/bc33fd2949d9e60d22bc36bc8cc5443316fa6b5c xhci-hcd: add success/failure soft retry counters This commit adds counters for successful and failed soft retry attempts. bug 200162414 Change-Id: I7406cea4368da85c78c8fe350398031fc8121015 Signed-off-by: JC Kuo Reviewed-on: http://git-master/r/1169997 GVS: Gerrit_Virtual_Submit Reviewed-by: ChihMin Cheng Tested-by: Mark Kuo Reviewed-by: Ashutosh Jha --- diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 5f12cd73fb3..343b2cf6059 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -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); diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c index e86bb57dc80..9eb1021cdbf 100644 --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c @@ -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; } diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index f00087344c5..e77b3647f62 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -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 */