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

Change-Id: I473cce9631f4e0fffb8c36740056341dd9bd8c0c
---
 .../net/ethernet/mellanox/mlx5/core/en_fs.c   | 21 +++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
@@ -81,8 +81,9 @@ static void mlx5e_add_l2_to_hash(struct
 	struct mlx5e_l2_hash_node *hn;
 	int ix = mlx5e_hash_l2(addr);
 	int found = 0;
+	COMPAT_HL_NODE
 
-	hlist_for_each_entry(hn, &hash[ix], hlist)
+	compat_hlist_for_each_entry(hn, &hash[ix], hlist)
 		if (ether_addr_equal_64bits(hn->ai.addr, addr)) {
 			found = 1;
 			break;
@@ -331,6 +332,8 @@ static int mlx5e_add_any_vid_rules(struc
 	return mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_STAG_VID, 0);
 }
 
+#ifdef HAVE_DEVLINK_TRAP_SUPPORT
+
 static struct mlx5_flow_handle *
 mlx5e_add_trap_rule(struct mlx5_flow_table *ft, int trap_id, int tir_num)
 {
@@ -404,6 +407,8 @@ void mlx5e_remove_mac_trap(struct mlx5e_
 	}
 }
 
+#endif /* HAVE_DEVLINK_TRAP_SUPPORT */
+
 void mlx5e_enable_cvlan_filter(struct mlx5e_priv *priv)
 {
 	if (!priv->fs.vlan->cvlan_filter_disabled)
@@ -457,7 +462,8 @@ static int mlx5e_vlan_rx_add_svid(struct
 	return err;
 }
 
-int mlx5e_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid)
+int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto,
+			  u16 vid)
 {
 	struct mlx5e_priv *priv = netdev_priv(dev);
 
@@ -472,7 +478,8 @@ int mlx5e_vlan_rx_add_vid(struct net_dev
 	return -EOPNOTSUPP;
 }
 
-int mlx5e_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
+int mlx5e_vlan_rx_kill_vid(struct net_device *dev, __always_unused __be16 proto,
+			   u16 vid)
 {
 	struct mlx5e_priv *priv = netdev_priv(dev);
 
@@ -523,7 +530,9 @@ static void mlx5e_del_vlan_rules(struct
 
 	WARN_ON_ONCE(!(test_bit(MLX5E_STATE_DESTROYING, &priv->state)));
 
+#ifdef HAVE_DEVLINK_TRAP_SUPPORT
 	mlx5e_remove_vlan_trap(priv);
+#endif /* HAVE_DEVLINK_TRAP_SUPPORT */
 
 	/* must be called after DESTROY bit is set and
 	 * set_rx_mode is called and flushed
@@ -534,7 +543,7 @@ static void mlx5e_del_vlan_rules(struct
 
 #define mlx5e_for_each_hash_node(hn, tmp, hash, i) \
 	for (i = 0; i < MLX5E_L2_ADDR_HASH_SIZE; i++) \
-		hlist_for_each_entry_safe(hn, tmp, &hash[i], hlist)
+		compat_hlist_for_each_entry_safe(hn, tmp, &hash[i], hlist)
 
 static void mlx5e_execute_l2_action(struct mlx5e_priv *priv,
 				    struct mlx5e_l2_hash_node *hn)
@@ -597,6 +606,7 @@ static void mlx5e_fill_addr_array(struct
 	struct hlist_node *tmp;
 	int i = 0;
 	int hi;
+	COMPAT_HL_NODE
 
 	addr_list = is_uc ? priv->fs.l2.netdev_uc : priv->fs.l2.netdev_mc;
 
@@ -626,6 +636,7 @@ static void mlx5e_vport_context_update_a
 	int size;
 	int err;
 	int hi;
+	COMPAT_HL_NODE
 
 	size = is_uc ? 0 : (priv->fs.l2.broadcast_enabled ? 1 : 0);
 	max_size = is_uc ?
@@ -677,6 +688,7 @@ static void mlx5e_apply_netdev_addr(stru
 	struct mlx5e_l2_hash_node *hn;
 	struct hlist_node *tmp;
 	int i;
+	COMPAT_HL_NODE
 
 	mlx5e_for_each_hash_node(hn, tmp, priv->fs.l2.netdev_uc, i)
 		mlx5e_execute_l2_action(priv, hn);
@@ -690,6 +702,7 @@ static void mlx5e_handle_netdev_addr(str
 	struct mlx5e_l2_hash_node *hn;
 	struct hlist_node *tmp;
 	int i;
+	COMPAT_HL_NODE
 
 	mlx5e_for_each_hash_node(hn, tmp, priv->fs.l2.netdev_uc, i)
 		hn->action = MLX5E_ACTION_DEL;
