svn commit: r356409 - in head/sys: dev/usb sys

Hans Petter Selasky hselasky at FreeBSD.org
Mon Jan 6 09:49:21 UTC 2020


Author: hselasky
Date: Mon Jan  6 09:49:20 2020
New Revision: 356409
URL: https://svnweb.freebsd.org/changeset/base/356409

Log:
  Add own counter for cancelled USB transfers.
  Do not count these as errors.
  
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/dev/usb/usb_device.h
  head/sys/dev/usb/usb_transfer.c
  head/sys/sys/param.h

Modified: head/sys/dev/usb/usb_device.h
==============================================================================
--- head/sys/dev/usb/usb_device.h	Mon Jan  6 09:40:59 2020	(r356408)
+++ head/sys/dev/usb/usb_device.h	Mon Jan  6 09:49:20 2020	(r356409)
@@ -191,6 +191,7 @@ struct usb_device {
 	/* statistics */
 	struct usb_device_statistics stats_err;
 	struct usb_device_statistics stats_ok;
+  	struct usb_device_statistics stats_cancelled;
 
 	/* generic clear stall message */
 	struct usb_udev_msg cs_msg[2];

Modified: head/sys/dev/usb/usb_transfer.c
==============================================================================
--- head/sys/dev/usb/usb_transfer.c	Mon Jan  6 09:40:59 2020	(r356408)
+++ head/sys/dev/usb/usb_transfer.c	Mon Jan  6 09:49:20 2020	(r356409)
@@ -2593,7 +2593,10 @@ usbd_transfer_done(struct usb_xfer *xfer, usb_error_t 
 	}
 #endif
 	/* keep some statistics */
-	if (xfer->error) {
+	if (xfer->error == USB_ERR_CANCELLED) {
+		info->udev->stats_cancelled.uds_requests
+		    [xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++;
+	} else if (xfer->error != USB_ERR_NORMAL_COMPLETION) {
 		info->udev->stats_err.uds_requests
 		    [xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++;
 	} else {

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Mon Jan  6 09:40:59 2020	(r356408)
+++ head/sys/sys/param.h	Mon Jan  6 09:49:20 2020	(r356409)
@@ -60,7 +60,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300074	/* Master, propagated to newvers */
+#define __FreeBSD_version 1300075	/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,


More information about the svn-src-head mailing list