svn commit: r356394 - in stable/12/sys: dev/usb sys
Hans Petter Selasky
hselasky at FreeBSD.org
Mon Jan 6 09:07:58 UTC 2020
Author: hselasky
Date: Mon Jan 6 09:07:57 2020
New Revision: 356394
URL: https://svnweb.freebsd.org/changeset/base/356394
Log:
MFC r356135:
Make USB statistics per device instead of per bus.
Bump the FreeBSD version due to structure change to
force recompilation of external USB modules.
Sponsored by: Mellanox Technologies
Modified:
stable/12/sys/dev/usb/usb_bus.h
stable/12/sys/dev/usb/usb_device.h
stable/12/sys/dev/usb/usb_generic.c
stable/12/sys/dev/usb/usb_transfer.c
stable/12/sys/sys/param.h
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/dev/usb/usb_bus.h
==============================================================================
--- stable/12/sys/dev/usb/usb_bus.h Mon Jan 6 02:51:19 2020 (r356393)
+++ stable/12/sys/dev/usb/usb_bus.h Mon Jan 6 09:07:57 2020 (r356394)
@@ -2,7 +2,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2008-2019 Hans Petter Selasky. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -42,19 +42,10 @@ struct usb_bus_msg {
};
/*
- * The following structure defines the USB statistics structure.
- */
-struct usb_bus_stat {
- uint32_t uds_requests[4];
-};
-
-/*
* The following structure defines an USB BUS. There is one USB BUS
* for every Host or Device controller.
*/
struct usb_bus {
- struct usb_bus_stat stats_err;
- struct usb_bus_stat stats_ok;
#if USB_HAVE_ROOT_MOUNT_HOLD
struct root_hold_token *bus_roothold;
#endif
Modified: stable/12/sys/dev/usb/usb_device.h
==============================================================================
--- stable/12/sys/dev/usb/usb_device.h Mon Jan 6 02:51:19 2020 (r356393)
+++ stable/12/sys/dev/usb/usb_device.h Mon Jan 6 09:07:57 2020 (r356394)
@@ -2,7 +2,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2008-2019 Hans Petter Selasky. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -177,10 +177,21 @@ union usb_device_scratch {
};
/*
+ * Helper structure to keep track of USB device statistics.
+ */
+struct usb_device_statistics {
+ uint32_t uds_requests[4];
+};
+
+/*
* The following structure defines an USB device. There exists one of
* these structures for every USB device.
*/
struct usb_device {
+ /* statistics */
+ struct usb_device_statistics stats_err;
+ struct usb_device_statistics stats_ok;
+
/* generic clear stall message */
struct usb_udev_msg cs_msg[2];
struct sx enum_sx;
Modified: stable/12/sys/dev/usb/usb_generic.c
==============================================================================
--- stable/12/sys/dev/usb/usb_generic.c Mon Jan 6 02:51:19 2020 (r356393)
+++ stable/12/sys/dev/usb/usb_generic.c Mon Jan 6 09:07:57 2020 (r356394)
@@ -2223,10 +2223,9 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *
for (n = 0; n != 4; n++) {
u.stat->uds_requests_fail[n] =
- f->udev->bus->stats_err.uds_requests[n];
-
+ f->udev->stats_err.uds_requests[n];
u.stat->uds_requests_ok[n] =
- f->udev->bus->stats_ok.uds_requests[n];
+ f->udev->stats_ok.uds_requests[n];
}
break;
Modified: stable/12/sys/dev/usb/usb_transfer.c
==============================================================================
--- stable/12/sys/dev/usb/usb_transfer.c Mon Jan 6 02:51:19 2020 (r356393)
+++ stable/12/sys/dev/usb/usb_transfer.c Mon Jan 6 09:07:57 2020 (r356394)
@@ -2594,10 +2594,10 @@ usbd_transfer_done(struct usb_xfer *xfer, usb_error_t
#endif
/* keep some statistics */
if (xfer->error) {
- info->bus->stats_err.uds_requests
+ info->udev->stats_err.uds_requests
[xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++;
} else {
- info->bus->stats_ok.uds_requests
+ info->udev->stats_ok.uds_requests
[xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE]++;
}
Modified: stable/12/sys/sys/param.h
==============================================================================
--- stable/12/sys/sys/param.h Mon Jan 6 02:51:19 2020 (r356393)
+++ stable/12/sys/sys/param.h Mon Jan 6 09:07:57 2020 (r356394)
@@ -60,7 +60,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1201507 /* Master, propagated to newvers */
+#define __FreeBSD_version 1201508 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
More information about the svn-src-stable
mailing list