From 16616e4974e76b780d54baac64df26ee5b3d5365 Mon Sep 17 00:00:00 2001 From: hselasky Date: Mon, 13 Jan 2020 11:33:03 +0000 Subject: [PATCH] MFC r356409: Add own counter for cancelled USB transfers. Do not count these as errors. Bump the FreeBSD version to force recompilation of external modules. Sponsored by: Mellanox Technologies git-svn-id: svn://svn.freebsd.org/base/stable/10@356681 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- 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 9b928471f..709823b3a 100644 --- a/sys/dev/usb/usb_device.h +++ b/sys/dev/usb/usb_device.h @@ -189,6 +189,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 1ee82a1c1..4ee88efdf 100644 --- a/sys/dev/usb/usb_transfer.c +++ b/sys/dev/usb/usb_transfer.c @@ -2592,7 +2592,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 73ab768b9..82870b171 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1004502 /* Master, propagated to newvers */ +#define __FreeBSD_version 1004503 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, -- 2.42.0