From: Erez Shitrit Date: Mon, 8 Jun 2015 08:17:08 +0000 (+0300) Subject: compat: handle function netif_set_real_num_rx_queues correctly X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=6ead2ab63ef9a3daea451ba28279a56469bb9482;p=~aditr%2Fcompat.git compat: handle function netif_set_real_num_rx_queues correctly In few distros (RH6.6 for example) there is already the implementation for netif_set_real_num_rx_queues function, so check if exists otherwise use the backport and return 0 for doing nothing. Signed-off-by: Erez Shitrit Signed-off-by: Vladimir Sokolovsky --- diff --git a/config/rdma.m4 b/config/rdma.m4 index 077ef9b..8919a26 100644 --- a/config/rdma.m4 +++ b/config/rdma.m4 @@ -2146,6 +2146,21 @@ AC_DEFUN([LINUX_CONFIG_COMPAT], [AC_DEFINE(HAVE_ELFCOREHDR_ADDR_EXPORTED, 1, [elfcorehdr_addr is exported by the kernel])], []) + + AC_MSG_CHECKING([if netif_set_real_num_rx_queues is defined]) + MLNX_BG_LB_LINUX_TRY_COMPILE([ + #include + ],[ + int rc = netif_set_real_num_rx_queues(NULL, 0); + + return rc; + ],[ + AC_MSG_RESULT(yes) + MLNX_AC_DEFINE(HAVE_NETIF_SET_REAL_NUM_RX_QUEUES, 1, + [netif_set_real_num_rx_queues is defined]) + ],[ + AC_MSG_RESULT(no) + ]) ]) # # COMPAT_CONFIG_HEADERS diff --git a/include/linux/compat-2.6.37.h b/include/linux/compat-2.6.37.h index e6db8be..a7563c8 100644 --- a/include/linux/compat-2.6.37.h +++ b/include/linux/compat-2.6.37.h @@ -67,12 +67,13 @@ enum { * code and making this function to always return success. */ /* mask netif_set_real_num_rx_queues as RHEL6.4 backports this */ -#define netif_set_real_num_rx_queues(a, b) compat_netif_set_real_num_rx_queues(a, b) +#ifndef HAVE_NETIF_SET_REAL_NUM_RX_QUEUES static inline int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq) { return 0; } +#endif #define net_ns_type_operations LINUX_BACKPORT(net_ns_type_operations) extern struct kobj_ns_type_operations net_ns_type_operations;