]> git.openfabrics.org - compat-rdma/compat.git/commitdiff
compat: handle function netif_set_real_num_rx_queues correctly
authorErez Shitrit <erezsh@mellanox.com>
Mon, 8 Jun 2015 08:17:08 +0000 (11:17 +0300)
committerVladimir Sokolovsky <vlad@mellanox.com>
Mon, 8 Jun 2015 08:47:40 +0000 (11:47 +0300)
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 <erezsh@mellanox.com>
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
config/rdma.m4
include/linux/compat-2.6.37.h

index 077ef9bb3262fbf50ca95325e29519c2b30160ab..8919a260569afff8370236bc0558efffdd40b236 100644 (file)
@@ -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 <linux/netdevice.h>
+       ],[
+               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
index e6db8be2025255452e3978fb6ea96abdc18ba46e..a7563c899e35d431cb3bf54bfd252a50b04ecefc 100644 (file)
@@ -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;