Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jan 2014 07:48:39 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r261005 - head/sys/dev/usb
Message-ID:  <201401220748.s0M7md9R019374@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Jan 22 07:48:39 2014
New Revision: 261005
URL: http://svnweb.freebsd.org/changeset/base/261005

Log:
  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

Modified:
  head/sys/dev/usb/usb_freebsd.h
  head/sys/dev/usb/usb_freebsd_loader.h
  head/sys/dev/usb/usb_transfer.c

Modified: head/sys/dev/usb/usb_freebsd.h
==============================================================================
--- head/sys/dev/usb/usb_freebsd.h	Wed Jan 22 07:32:55 2014	(r261004)
+++ head/sys/dev/usb/usb_freebsd.h	Wed Jan 22 07:48:39 2014	(r261005)
@@ -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
 

Modified: head/sys/dev/usb/usb_freebsd_loader.h
==============================================================================
--- head/sys/dev/usb/usb_freebsd_loader.h	Wed Jan 22 07:32:55 2014	(r261004)
+++ head/sys/dev/usb/usb_freebsd_loader.h	Wed Jan 22 07:48:39 2014	(r261005)
@@ -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
 

Modified: head/sys/dev/usb/usb_transfer.c
==============================================================================
--- head/sys/dev/usb/usb_transfer.c	Wed Jan 22 07:32:55 2014	(r261004)
+++ head/sys/dev/usb/usb_transfer.c	Wed Jan 22 07:48:39 2014	(r261005)
@@ -2723,7 +2723,7 @@ usbd_transfer_timeout_ms(struct usb_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);
 }
 
 /*------------------------------------------------------------------------*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401220748.s0M7md9R019374>