]> git.openfabrics.org - compat-rdma/compat.git/commitdiff
compat/3.9: switch to check pick_tx and set_xps_queue with compat-config
authorVladimir Sokolovsky <vlad@mellanox.com>
Thu, 21 May 2015 13:03:03 +0000 (16:03 +0300)
committerVladimir Sokolovsky <vlad@mellanox.com>
Thu, 21 May 2015 13:03:03 +0000 (16:03 +0300)
instead of using the Linux kernel version of 3.9.
Redhat6.5 for example, would call to those function, but it has them
inside the kernel.

Signed-off-by: Ido Shamay <idos@mellanox.com>
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
compat/compat-3.9.c
include/linux/compat-3.9.h

index 95047ee0c96abab44d510ed916d3d3f8d5eb1ad2..53fa1f202679332cfa3c0edc9e92a19e08e7a2ea 100644 (file)
@@ -28,6 +28,7 @@
 static u32 hashrnd __read_mostly;
 #endif
 
+#ifndef CONFIG_COMPAT_NETIF_HAS_PICK_TX
 #define get_xps_queue LINUX_BACKPORT(get_xps_queue)
 static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb)
 {
@@ -70,26 +71,37 @@ static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb)
 #define __netdev_pick_tx LINUX_BACKPORT(__netdev_pick_tx)
 u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb)
 {
+       int new_index;
+#ifdef CONFIG_COMPAT_SOCK_HAS_QUEUE
        struct sock *sk = skb->sk;
        int queue_index = sk_tx_queue_get(sk);
 
-       if (queue_index < 0 || skb->ooo_okay ||
-           queue_index >= dev->real_num_tx_queues) {
-               int new_index = get_xps_queue(dev, skb);
-               if (new_index < 0)
-                       new_index = skb_tx_hash(dev, skb);
+       if (queue_index >= 0 && queue_index < dev->real_num_tx_queues) {
+#ifdef CONFIG_COMPAT_NETIF_IS_XPS
+               if (!skb->ooo_okay)
+#endif /* CONFIG_COMPAT_NETIF_IS_XPS */
+                       return queue_index;
+       }
+#endif /* CONFIG_COMPAT_SOCK_HAS_QUEUE */
 
-               if (queue_index != new_index && sk &&
-                   rcu_access_pointer(sk->sk_dst_cache))
-                       sk_tx_queue_set(sk, new_index);
+       new_index = get_xps_queue(dev, skb);
+       if (new_index < 0)
+               new_index = skb_tx_hash(dev, skb);
 
-               queue_index = new_index;
+#ifdef CONFIG_COMPAT_SOCK_HAS_QUEUE
+       if (queue_index != new_index && sk) {
+               struct dst_entry *dst = rcu_dereference(sk->sk_dst_cache);
+               if (dst && skb_dst(skb) == dst)
+                       sk_tx_queue_set(sk, new_index);
        }
+#endif /* CONFIG_COMPAT_SOCK_HAS_QUEUE */
 
-       return queue_index;
+       return new_index;
 }
 EXPORT_SYMBOL(__netdev_pick_tx);
+#endif /* CONFIG_COMPAT_NETIF_HAS_PICK_TX */
 
+#ifndef CONFIG_COMPAT_NETIF_HAS_SET_XPS_QUEUE
 #define netif_set_xps_queue LINUX_BACKPORT(netif_set_xps_queue)
 int netif_set_xps_queue(struct net_device *dev, struct cpumask *msk, u16 idx)
 {
@@ -134,3 +146,4 @@ int netif_set_xps_queue(struct net_device *dev, struct cpumask *msk, u16 idx)
 #endif /* HAVE_XPS_MAP */
 }
 EXPORT_SYMBOL(netif_set_xps_queue);
+#endif /* CONFIG_COMPAT_NETIF_HAS_SET_XPS_QUEUE */
index 94ace12975c14982d63b9d933fce3938832bef21..45ab260b16e50a43bf55c4a694cd6e1239c8388a 100644 (file)
@@ -8,9 +8,13 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 
+#ifndef CONFIG_COMPAT_NETIF_HAS_PICK_TX
+
 #define __netdev_pick_tx LINUX_BACKPORT(__netdev_pick_tx)
 u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
 
+#endif /* CONFIG_COMPAT_NETIF_HAS_PICK_TX */
+
 #if NR_CPUS < 64
 #define MAX_XPS_CPUS           NR_CPUS
 #else