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

Change-Id: I86093b198c9da847f1b59fafff6104b5f21e330e
---
 .../mellanox/mlx5/core/ipoib/ipoib_vlan.c     | 29 ++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
@@ -73,8 +73,9 @@ static struct qpn_to_netdev *mlx5i_find_
 {
 	struct hlist_head *h = &buckets[hash_32(qpn, MLX5I_MAX_LOG_PKEY_SUP)];
 	struct qpn_to_netdev *node;
+	COMPAT_HL_NODE
 
-	hlist_for_each_entry(node, h, hlist) {
+	compat_hlist_for_each_entry(node, h, hlist) {
 		if (node->underlay_qpn == qpn)
 			return node;
 	}
@@ -146,10 +147,28 @@ static const struct net_device_ops mlx5i
 	.ndo_open                = mlx5i_pkey_open,
 	.ndo_stop                = mlx5i_pkey_close,
 	.ndo_init                = mlx5i_pkey_dev_init,
+#if defined(HAVE_NDO_GET_STATS64) || defined(HAVE_NDO_GET_STATS64_RET_VOID)
 	.ndo_get_stats64         = mlx5i_get_stats,
+#else
+	.ndo_get_stats           = mlx5i_get_stats,
+#endif
 	.ndo_uninit              = mlx5i_pkey_dev_cleanup,
+#ifndef HAVE_NDO_CHANGE_MTU_RH74
 	.ndo_change_mtu          = mlx5i_pkey_change_mtu,
+	.ndo_do_ioctl            = mlx5i_pkey_ioctl,
+#else
+	.ndo_change_mtu_rh74     = mlx5i_pkey_change_mtu,
+#endif
+
+#ifdef HAVE_NDO_ETH_IOCTL
 	.ndo_eth_ioctl            = mlx5i_pkey_ioctl,
+#else
+	.ndo_do_ioctl		  = mlx5i_pkey_ioctl,
+#endif
+
+#ifdef HAVE_NET_DEVICE_OPS_EXTENDED
+	.ndo_size = sizeof(struct net_device_ops),
+#endif
 };
 
 /* Child NDOs */
@@ -165,6 +184,7 @@ static int mlx5i_pkey_dev_init(struct ne
 	/* Get QPN to netdevice hash table from parent */
 	parent_ifindex = dev->netdev_ops->ndo_get_iflink(dev);
 	parent_dev = dev_get_by_index(dev_net(dev), parent_ifindex);
+
 	if (!parent_dev) {
 		mlx5_core_warn(priv->mdev, "failed to get parent device\n");
 		return -EINVAL;
@@ -286,6 +306,13 @@ static int mlx5i_pkey_init(struct mlx5_c
 	if (err)
 		return err;
 
+#ifdef CONFIG_COMPAT_LRO_ENABLED_IPOIB
+       netdev->features &= ~NETIF_F_LRO;
+       priv->netdev->hw_features &= ~NETIF_F_LRO;
+       priv->netdev->wanted_features &= ~NETIF_F_LRO;
+       priv->channels.params.lro_en = false;
+#endif
+
 	/* Override parent ndo */
 	netdev->netdev_ops = &mlx5i_pkey_netdev_ops;
 
