[rtems commit] Synchronize kernel <sys/time.h> with FreeBSD

Sebastian Huber sebh at rtems.org
Mon Nov 18 06:26:00 UTC 2019


Module:    rtems
Branch:    master
Commit:    c6d8589bb00a9d2a5a094c68c90290df1dc44807
Changeset: http://git.rtems.org/rtems/commit/?id=c6d8589bb00a9d2a5a094c68c90290df1dc44807

Author:    rrs <rrs at FreeBSD.org>
Date:      Thu Jun  7 18:18:13 2018 +0000

Synchronize kernel <sys/time.h> with FreeBSD

Integrate parts of this commit:

This commit brings in a new refactored TCP stack
called Rack. Rack includes the following features: - A different SACK
processing scheme (the old sack structures are not used). - RACK (Recent
acknowledgment) where counting dup-acks is no longer done instead time
is used to knwo when to retransmit. (see the I-D) - TLP (Tail Loss
Probe) where we will probe for tail-losses to attempt to try not to take
a retransmit time-out. (see the I-D) - Burst mitigation using TCPHTPS -
PRR (partial rate reduction) see the RFC.

Once built into your kernel, you can select this stack by either
socket option with the name of the stack is "rack" or by setting
the global sysctl so the default is rack.

Note that any connection that does not support SACK will be kicked
back to the "default" base  FreeBSD stack (currently known as "default").

To build this into your kernel you will need to enable in your
kernel:
   makeoptions WITH_EXTRA_TCP_STACKS=1
   options TCPHPTS

Sponsored by:	Netflix Inc.
Differential Revision:		https://reviews.freebsd.org/D15525

---

 cpukit/include/machine/_kernel_time.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/cpukit/include/machine/_kernel_time.h b/cpukit/include/machine/_kernel_time.h
index d99daa0..f0b6bdf 100644
--- a/cpukit/include/machine/_kernel_time.h
+++ b/cpukit/include/machine/_kernel_time.h
@@ -67,6 +67,23 @@
 	} while (0)
 #endif
 
+/*
+ * Simple macros to convert ticks to milliseconds
+ * or microseconds and vice-versa. The answer
+ * will always be at least 1. Note the return
+ * value is a uint32_t however we step up the
+ * operations to 64 bit to avoid any overflow/underflow
+ * problems.
+ */
+#define TICKS_2_MSEC(t) max(1, (uint32_t)(hz == 1000) ? \
+	  (t) : (((uint64_t)(t) * (uint64_t)1000)/(uint64_t)hz))
+#define TICKS_2_USEC(t) max(1, (uint32_t)(hz == 1000) ? \
+	  ((t) * 1000) : (((uint64_t)(t) * (uint64_t)1000000)/(uint64_t)hz))
+#define MSEC_2_TICKS(m) max(1, (uint32_t)((hz == 1000) ? \
+	  (m) : ((uint64_t)(m) * (uint64_t)hz)/(uint64_t)1000))
+#define USEC_2_TICKS(u) max(1, (uint32_t)((hz == 1000) ? \
+	 ((u) / 1000) : ((uint64_t)(u) * (uint64_t)hz)/(uint64_t)1000000))
+
 /* Operations on timevals. */
 
 #define	timevalclear(tvp)		((tvp)->tv_sec = (tvp)->tv_usec = 0)



More information about the vc mailing list