From 6c110e86118f714f4b1cf7b66b0fca845cd697d7 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Mon, 6 Jan 2020 09:49:20 +0000 Subject: [PATCH] Add own counter for cancelled USB transfers. Do not count these as errors. MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/dev/usb/usb_device.h | 1 + sys/dev/usb/usb_transfer.c | 5 ++++- sys/sys/param.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/usb_device.h b/sys/dev/usb/usb_device.h index 96f75cd832dc..691b2b3862f8 100644 --- a/sys/dev/usb/usb_device.h +++ b/sys/dev/usb/usb_device.h @@ -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]; diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c index a64a4059e5cb..b943e70a456d 100644 --- a/sys/dev/usb/usb_transfer.c +++ b/sys/dev/usb/usb_transfer.c @@ -2593,7 +2593,10 @@ usbd_transfer_done(struct usb_xfer *xfer, usb_error_t error) } #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 { diff --git a/sys/sys/param.h b/sys/sys/param.h index 930d2005938e..b79e98eef0bc 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -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,