Ensure that the DMA delay does not get rounded down to zero ticks when

a timeout value of a single tick is given. With FreeBSD-10 and newer
the current system time is used as a starting point, and the minimum
callout time of a single tick will be guaranteed. This patch mostly
affect the DMA delay timeouts, which are typically in the range from
0.125 to 2ms.

MFC after:	1 week
This commit is contained in:
Hans Petter Selasky 2014-01-22 07:48:39 +00:00
parent 3448548027
commit 924b1f5db0
3 changed files with 10 additions and 1 deletions

View File

@ -50,6 +50,13 @@
#define USB_HAVE_FIXED_CONFIG 0
#define USB_HAVE_FIXED_PORT 0
/* define zero ticks callout value */
#if (__FreeBSD_version >= 1000029)
#define USB_CALLOUT_ZERO_TICKS 0
#else
#define USB_CALLOUT_ZERO_TICKS 1
#endif
#define USB_TD_GET_PROC(td) (td)->td_proc
#define USB_PROC_GET_GID(td) (td)->p_pgid

View File

@ -50,6 +50,8 @@
#define USB_HAVE_FIXED_CONFIG 0
#define USB_HAVE_FIXED_PORT 0
#define USB_CALLOUT_ZERO_TICKS 1
#define USB_TD_GET_PROC(td) (td)->td_proc
#define USB_PROC_GET_GID(td) (td)->p_pgid

View File

@ -2723,7 +2723,7 @@ usbd_transfer_timeout_ms(struct usb_xfer *xfer,
/* defer delay */
usb_callout_reset(&xfer->timeout_handle,
USB_MS_TO_TICKS(ms), cb, xfer);
USB_MS_TO_TICKS(ms) + USB_CALLOUT_ZERO_TICKS, cb, xfer);
}
/*------------------------------------------------------------------------*