@@ -381,6 +381,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
[OVS_DEFINE([HAVE_NF_CT_TMPL_ALLOC_TAKES_STRUCT_ZONE])])
OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32])
+ OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max])
OVS_GREP_IFELSE([$KSRC/include/net/rtnetlink.h], [get_link_net])
OVS_GREP_IFELSE([$KSRC/include/net/rtnetlink.h], [name_assign_type])
@@ -7,4 +7,11 @@
#define prandom_u32() random32()
#endif
+#ifndef HAVE_PRANDOM_U32_MAX
+static inline u32 prandom_u32_max(u32 ep_ro)
+{
+ return (u32)(((u64) prandom_u32() * ep_ro) >> 32);
+}
+#endif
+
#endif