diff --git a/sys/compat/linuxkpi/common/include/linux/timer.h b/sys/compat/linuxkpi/common/include/linux/timer.h --- a/sys/compat/linuxkpi/common/include/linux/timer.h +++ b/sys/compat/linuxkpi/common/include/linux/timer.h @@ -35,13 +35,20 @@ #include #include +#if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION < 41500) && !defined(_WANT_LKPI_TIMER_CONTAINER_OF) /* 354b46b1a0add */ +#define _TIMER_LIST_FUNCTION_ARG unsigned long +#else +#define _TIMER_LIST_FUNCTION_ARG struct timer_list * +#endif + +#define _TIME_LIST_DATA(_t) ((_TIMER_LIST_FUNCTION_ARG)(_t)->data) + struct timer_list { struct callout callout; - union { - void (*function) (unsigned long); /* < v4.15 */ - void (*function_415) (struct timer_list *); - }; + void (*function) (_TIMER_LIST_FUNCTION_ARG); +/* #if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION < 41500) */ /* c1eba5bcb643 */ unsigned long data; +/* #endif */ unsigned long expires; }; @@ -49,7 +56,7 @@ #define TIMER_IRQSAFE 0x0001 -#if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION < 61600) +#if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION < 61600) && !defined(_WANT_LKPI_TIMER_CONTAINER_OF) #define from_timer(var, arg, field) \ container_of(arg, typeof(*(var)), field) #else @@ -59,7 +66,7 @@ #define timer_setup(timer, func, flags) do { \ CTASSERT(((flags) & ~TIMER_IRQSAFE) == 0); \ - (timer)->function_415 = (func); \ + (timer)->function = (func); \ (timer)->data = (unsigned long)(timer); \ callout_init(&(timer)->callout, 1); \ } while (0) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -2147,7 +2147,7 @@ return; } - timer->function(timer->data); + timer->function(_TIME_LIST_DATA(timer)); } static int diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -269,13 +269,15 @@ -I$S/compat/linuxkpi/dummy/include \ -include $S/compat/linuxkpi/common/include/linux/kconfig.h LINUXKPI_C= ${NORMAL_C} ${LINUXKPI_INCLUDES} +LINUXKPI_VERSION_OLD_TIMER= -DLINUXKPI_VERSION=41499 # Infiniband C flags. Correct include paths and omit errors that linux # does not honor. OFEDINCLUDES= -I$S/ofed/include -I$S/ofed/include/uapi ${LINUXKPI_INCLUDES} OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith OFEDCFLAGS= ${CFLAGS:N-I*} -DCONFIG_INFINIBAND_USER_MEM \ - ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR} + ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR} \ + ${LINUXKPI_VERSION_OLD_TIMER} OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} OFED_C= ${OFED_C_NOIMP} ${.IMPSRC} diff --git a/sys/dev/irdma/irdma_cm.c b/sys/dev/irdma/irdma_cm.c --- a/sys/dev/irdma/irdma_cm.c +++ b/sys/dev/irdma/irdma_cm.c @@ -32,6 +32,8 @@ * SOFTWARE. */ +#define _WANT_LKPI_TIMER_CONTAINER_OF /* LinuxKPI version problem with OFED */ + #include "irdma_main.h" static void irdma_cm_post_event(struct irdma_cm_event *event); diff --git a/sys/dev/irdma/irdma_utils.c b/sys/dev/irdma/irdma_utils.c --- a/sys/dev/irdma/irdma_utils.c +++ b/sys/dev/irdma/irdma_utils.c @@ -32,6 +32,8 @@ * SOFTWARE. */ +#define _WANT_LKPI_TIMER_CONTAINER_OF /* LinuxKPI version problem with OFED */ + #include "irdma_main.h" LIST_HEAD(irdma_handlers); diff --git a/sys/modules/cxgbe/iw_cxgbe/Makefile b/sys/modules/cxgbe/iw_cxgbe/Makefile --- a/sys/modules/cxgbe/iw_cxgbe/Makefile +++ b/sys/modules/cxgbe/iw_cxgbe/Makefile @@ -17,6 +17,7 @@ CFLAGS+= -I${CXGBE} -I${SRCTOP}/sys/ofed/include -DLINUX_TYPES_DEFINED CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi CFLAGS+= ${LINUXKPI_INCLUDES} +CFLAGS+= -DLINUXKPI_VERSION=41499 # struct timer_list->function CFLAGS+= -DCONFIG_INFINIBAND_USER_MEM CFLAGS+= -DINET6 -DINET diff --git a/sys/modules/irdma/Makefile b/sys/modules/irdma/Makefile --- a/sys/modules/irdma/Makefile +++ b/sys/modules/irdma/Makefile @@ -16,6 +16,7 @@ CFLAGS+= -I${OFED_INC_DIR}/uapi CFLAGS+= ${LINUXKPI_INCLUDES} CFLAGS+= -DCONFIG_INFINIBAND_USER_MEM +CFLAGS+= -DLINUXKPI_VERSION=41499 # struct timer_list->function ice_rdma.h: cp $(ICE_DIR)/ice_rdma.h . diff --git a/sys/modules/mlx4/Makefile b/sys/modules/mlx4/Makefile --- a/sys/modules/mlx4/Makefile +++ b/sys/modules/mlx4/Makefile @@ -28,6 +28,7 @@ CFLAGS+= -I${SRCTOP}/sys/ofed/include CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi CFLAGS+= ${LINUXKPI_INCLUDES} +CFLAGS+= -DLINUXKPI_VERSION=41499 # struct timer_list->function EXPORT_SYMS= YES diff --git a/sys/modules/mlx4en/Makefile b/sys/modules/mlx4en/Makefile --- a/sys/modules/mlx4en/Makefile +++ b/sys/modules/mlx4en/Makefile @@ -14,5 +14,6 @@ CFLAGS+= -I${SRCTOP}/sys/ofed/include CFLAGS+= ${LINUXKPI_INCLUDES} +CFLAGS+= -DLINUXKPI_VERSION=41499 # struct timer_list->function .include diff --git a/sys/modules/mthca/Makefile b/sys/modules/mthca/Makefile --- a/sys/modules/mthca/Makefile +++ b/sys/modules/mthca/Makefile @@ -26,6 +26,7 @@ CFLAGS+= -I${SRCTOP}/sys/ofed/include CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi CFLAGS+= ${LINUXKPI_INCLUDES} +CFLAGS+= -DLINUXKPI_VERSION=41499 # struct timer_list->function CFLAGS+= -DCONFIG_INFINIBAND_USER_MEM CFLAGS+= -DINET6 -DINET