From: Valentine Fatiev <valentinef@nvidia.com>
Subject: [PATCH] BACKPORT: drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c

Change-Id: I8ca092e44ac03af49a2043ff7c0b1d9bcd52a2d3
---
 .../net/ethernet/mellanox/mlx5/core/en_arfs.c | 24 +++++++++++++------
 1 file changed, 17 insertions(+), 7 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
@@ -30,6 +30,8 @@
  * SOFTWARE.
  */
 
+#ifndef HAVE_NET_FLOW_KEYS_H
+
 #include <linux/hash.h>
 #include <linux/mlx5/fs.h>
 #include <linux/ip.h>
@@ -96,7 +98,7 @@ struct arfs_rule {
 
 #define mlx5e_for_each_hash_arfs_rule(hn, tmp, hash, j) \
 	for (j = 0; j < ARFS_HASH_SIZE; j++) \
-		hlist_for_each_entry_safe(hn, tmp, &hash[j], hlist)
+		compat_hlist_for_each_entry_safe(hn, tmp, &hash[j], hlist)
 
 static enum mlx5_traffic_types arfs_get_tt(enum arfs_type type)
 {
@@ -406,6 +408,8 @@ static void arfs_may_expire_flow(struct
 	int i;
 	int j;
 
+	COMPAT_HL_NODE
+
 	spin_lock_bh(&priv->fs.arfs->arfs_lock);
 	mlx5e_for_each_arfs_rule(arfs_rule, htmp, priv->fs.arfs->arfs_tables, i, j) {
 		if (!work_pending(&arfs_rule->arfs_work) &&
@@ -419,7 +423,7 @@ static void arfs_may_expire_flow(struct
 		}
 	}
 	spin_unlock_bh(&priv->fs.arfs->arfs_lock);
-	hlist_for_each_entry_safe(arfs_rule, htmp, &del_list, hlist) {
+	compat_hlist_for_each_entry_safe(arfs_rule, htmp, &del_list, hlist) {
 		if (arfs_rule->rule)
 			mlx5_del_flow_rules(arfs_rule->rule);
 		hlist_del(&arfs_rule->hlist);
@@ -435,6 +439,8 @@ static void arfs_del_rules(struct mlx5e_
 	int i;
 	int j;
 
+	COMPAT_HL_NODE
+
 	spin_lock_bh(&priv->fs.arfs->arfs_lock);
 	mlx5e_for_each_arfs_rule(rule, htmp, priv->fs.arfs->arfs_tables, i, j) {
 		hlist_del_init(&rule->hlist);
@@ -442,7 +448,7 @@ static void arfs_del_rules(struct mlx5e_
 	}
 	spin_unlock_bh(&priv->fs.arfs->arfs_lock);
 
-	hlist_for_each_entry_safe(rule, htmp, &del_list, hlist) {
+	compat_hlist_for_each_entry_safe(rule, htmp, &del_list, hlist) {
 		cancel_work_sync(&rule->arfs_work);
 		if (rule->rule)
 			mlx5_del_flow_rules(rule->rule);
@@ -687,9 +693,10 @@ static struct arfs_rule *arfs_find_rule(
 {
 	struct arfs_rule *arfs_rule;
 	struct hlist_head *head;
+	COMPAT_HL_NODE
 
 	head = arfs_hash_bucket(arfs_t, fk->ports.src, fk->ports.dst);
-	hlist_for_each_entry(arfs_rule, head, hlist) {
+	compat_hlist_for_each_entry(arfs_rule, head, hlist) {
 		if (arfs_cmp(&arfs_rule->tuple, fk))
 			return arfs_rule;
 	}
@@ -705,8 +712,11 @@ int mlx5e_rx_flow_steer(struct net_devic
 	struct arfs_table *arfs_t;
 	struct arfs_rule *arfs_rule;
 	struct flow_keys fk;
-
-	if (!skb_flow_dissect_flow_keys(skb, &fk, 0))
+#ifdef HAVE_SKB_FLOW_DISSECT_FLOW_KEYS_HAS_3_PARAMS
+	if (!skb_flow_dissect_flow_keys(skb, &fk , 0))
+#else
+	if (!skb_flow_dissect_flow_keys(skb, &fk))
+#endif
 		return -EPROTONOSUPPORT;
 
 	if (fk.basic.n_proto != htons(ETH_P_IP) &&
@@ -739,4 +749,4 @@ int mlx5e_rx_flow_steer(struct net_devic
 	spin_unlock_bh(&arfs->arfs_lock);
 	return arfs_rule->filter_id;
 }
-
+#endif /* HAVE_NET_FLOW_KEYS_H */
