enic: set skb->hash type properly
authorGovindarajulu Varadarajan <_govind@gmx.com>
Wed, 2 Nov 2016 00:58:50 +0000 (17:58 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Nov 2016 19:32:53 +0000 (15:32 -0400)
Driver sets the skb l4/l3 hash based on NIC_CFG_RSS_HASH_TYPE_*,
which is bit mask. This is wrong. Hw actually provides us enum.
Use CQ_ENET_RQ_DESC_RSS_TYPE_* to set l3 and l4 hash type.

Fixes: bf751ba802fe ("driver/net: enic: record q_number and rss_hash for skb")
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cisco/enic/enic.h
drivers/net/ethernet/cisco/enic/enic_main.c

index 130f910e47854958e7278c255eee742dd5f46d2b..9023c858715d5759064081eee54b120ddaace673 100644 (file)
@@ -33,7 +33,7 @@
 
 #define DRV_NAME               "enic"
 #define DRV_DESCRIPTION                "Cisco VIC Ethernet NIC Driver"
-#define DRV_VERSION            "2.3.0.20"
+#define DRV_VERSION            "2.3.0.31"
 #define DRV_COPYRIGHT          "Copyright 2008-2013 Cisco Systems, Inc"
 
 #define ENIC_BARS_MAX          6
index f514faf8b7093f883595569efedf338abdaee73c..cdd7a1a59aa7b4f8c1d13a41a02b3e20694270ff 100644 (file)
@@ -1166,12 +1166,18 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq,
                skb->protocol = eth_type_trans(skb, netdev);
                skb_record_rx_queue(skb, q_number);
                if (netdev->features & NETIF_F_RXHASH) {
-                       skb_set_hash(skb, rss_hash,
-                                    (rss_type &
-                                     (NIC_CFG_RSS_HASH_TYPE_TCP_IPV6_EX |
-                                      NIC_CFG_RSS_HASH_TYPE_TCP_IPV6 |
-                                      NIC_CFG_RSS_HASH_TYPE_TCP_IPV4)) ?
-                                    PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3);
+                       switch (rss_type) {
+                       case CQ_ENET_RQ_DESC_RSS_TYPE_TCP_IPv4:
+                       case CQ_ENET_RQ_DESC_RSS_TYPE_TCP_IPv6:
+                       case CQ_ENET_RQ_DESC_RSS_TYPE_TCP_IPv6_EX:
+                               skb_set_hash(skb, rss_hash, PKT_HASH_TYPE_L4);
+                               break;
+                       case CQ_ENET_RQ_DESC_RSS_TYPE_IPv4:
+                       case CQ_ENET_RQ_DESC_RSS_TYPE_IPv6:
+                       case CQ_ENET_RQ_DESC_RSS_TYPE_IPv6_EX:
+                               skb_set_hash(skb, rss_hash, PKT_HASH_TYPE_L3);
+                               break;
+                       }
                }
 
                /* Hardware does not provide whole packet checksum. It only