]> git.openfabrics.org - compat-rdma/compat-rdma.git/commitdiff
mlx5: Added RHEL7.0 support
authorVladimir Sokolovsky <vlad@mellanox.com>
Mon, 16 Jan 2017 08:25:02 +0000 (10:25 +0200)
committerVladimir Sokolovsky <vlad@mellanox.com>
Mon, 16 Jan 2017 08:25:02 +0000 (10:25 +0200)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
patches/0007-BACKPORT-mlx5.patch

index 0af4979f77337194b73ce6ef9e2f7c4374daf960..1b2b9967f4d6b4c2bc093b951e13e508c9f032f8 100644 (file)
@@ -12,8 +12,9 @@ Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
  drivers/net/ethernet/mellanox/mlx5/core/cmd.c      |  32 ++
  drivers/net/ethernet/mellanox/mlx5/core/en.h       |  24 ++
  drivers/net/ethernet/mellanox/mlx5/core/en_clock.c |  29 ++
+ drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c |   2 +
  .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   | 405 +++++++++++++++++++++
- drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 167 ++++++++-
+ drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 172 ++++++++-
  drivers/net/ethernet/mellanox/mlx5/core/en_rep.c   |   2 +
  drivers/net/ethernet/mellanox/mlx5/core/en_rx.c    |  36 ++
  drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    |  54 +++
@@ -23,12 +24,12 @@ Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
  drivers/net/ethernet/mellanox/mlx5/core/eq.c       |   6 +
  drivers/net/ethernet/mellanox/mlx5/core/eswitch.h  |   6 +
  .../ethernet/mellanox/mlx5/core/eswitch_offloads.c |   2 +
- drivers/net/ethernet/mellanox/mlx5/core/main.c     |  40 ++
+ drivers/net/ethernet/mellanox/mlx5/core/main.c     |  56 +++
  drivers/net/ethernet/mellanox/mlx5/core/port.c     |  22 ++
  drivers/net/ethernet/mellanox/mlx5/core/sriov.c    |   8 +
  include/linux/mlx5/driver.h                        |   5 +
  include/linux/mlx5/port.h                          |   5 +
- 25 files changed, 1051 insertions(+), 3 deletions(-)
+ 26 files changed, 1074 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/infiniband/hw/mlx5/gsi.c b/drivers/infiniband/hw/mlx5/gsi.c
 index xxxxxxx..xxxxxxx xxxxxx
@@ -796,6 +797,23 @@ index xxxxxxx..xxxxxxx xxxxxx
        do_div(ns, NSEC_PER_SEC / 2 / HZ);
        tstamp->overflow_period = ns;
  
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+@@ -38,6 +38,7 @@
+ #define MLX5E_100MB (100000)
+ #define MLX5E_1GB   (1000000)
++#if defined(HAVE_IEEE_DCBNL_ETS) && defined(CONFIG_MLX5_CORE_EN_DCB)
+ static int mlx5e_dcbnl_ieee_getets(struct net_device *netdev,
+                                  struct ieee_ets *ets)
+ {
+@@ -314,3 +315,4 @@ const struct dcbnl_rtnl_ops mlx5e_dcbnl_ops = {
+       .getdcbx        = mlx5e_dcbnl_getdcbx,
+       .setdcbx        = mlx5e_dcbnl_setdcbx,
+ };
++#endif
 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
 index xxxxxxx..xxxxxxx xxxxxx
 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -1444,7 +1462,20 @@ index xxxxxxx..xxxxxxx xxxxxx
  
  static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
                              struct mlx5e_channel_param *cparam,
-@@ -1490,9 +1496,13 @@ static void mlx5e_close_channels(struct mlx5e_priv *priv)
+@@ -1222,7 +1228,12 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
+       if (err)
+               goto err_close_sqs;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) || \
++      defined(CONFIG_COMPAT_IS_NETIF_SET_XPS_QUEUE_NOT_CONST_CPUMASK)
++      netif_set_xps_queue(netdev, (struct cpumask *)get_cpu_mask(c->cpu), ix);
++#else
+       netif_set_xps_queue(netdev, get_cpu_mask(c->cpu), ix);
++#endif
+       *cp = c;
+       return 0;
+@@ -1490,9 +1501,13 @@ static void mlx5e_close_channels(struct mlx5e_priv *priv)
  
  static int mlx5e_rx_hash_fn(int hfunc)
  {
@@ -1458,7 +1489,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  }
  
  static int mlx5e_bits_invert(unsigned long a, int size)
-@@ -1514,8 +1524,12 @@ static void mlx5e_fill_indir_rqt_rqns(struct mlx5e_priv *priv, void *rqtc)
+@@ -1514,8 +1529,12 @@ static void mlx5e_fill_indir_rqt_rqns(struct mlx5e_priv *priv, void *rqtc)
                int ix = i;
                u32 rqn;
  
@@ -1471,7 +1502,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
                ix = priv->params.indirection_rqt[ix];
                rqn = test_bit(MLX5E_STATE_OPENED, &priv->state) ?
-@@ -1672,6 +1686,7 @@ void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv)
+@@ -1672,6 +1691,7 @@ void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv)
  {
        MLX5_SET(tirc, tirc, rx_hash_fn,
                 mlx5e_rx_hash_fn(priv->params.rss_hfunc));
@@ -1479,7 +1510,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        if (priv->params.rss_hfunc == ETH_RSS_HASH_TOP) {
                void *rss_key = MLX5_ADDR_OF(tirc, tirc,
                                             rx_hash_toeplitz_key);
-@@ -1681,6 +1696,7 @@ void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv)
+@@ -1681,6 +1701,7 @@ void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv)
                MLX5_SET(tirc, tirc, rx_hash_symmetric, 1);
                memcpy(rss_key, priv->params.toeplitz_hash_key, len);
        }
@@ -1487,7 +1518,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  }
  
  static int mlx5e_modify_tirs_lro(struct mlx5e_priv *priv)
-@@ -1795,7 +1811,9 @@ static void mlx5e_netdev_set_tcs(struct net_device *netdev)
+@@ -1795,7 +1816,9 @@ static void mlx5e_netdev_set_tcs(struct net_device *netdev)
  int mlx5e_open_locked(struct net_device *netdev)
  {
        struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -1497,7 +1528,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        int num_txqs;
        int err;
  
-@@ -1827,6 +1845,7 @@ int mlx5e_open_locked(struct net_device *netdev)
+@@ -1827,6 +1850,7 @@ int mlx5e_open_locked(struct net_device *netdev)
  #ifdef CONFIG_RFS_ACCEL
        priv->netdev->rx_cpu_rmap = priv->mdev->rmap;
  #endif
@@ -1505,7 +1536,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        if (priv->profile->update_stats)
                queue_delayed_work(priv->wq, &priv->update_stats_work, 0);
  
-@@ -1835,6 +1854,9 @@ int mlx5e_open_locked(struct net_device *netdev)
+@@ -1835,6 +1859,9 @@ int mlx5e_open_locked(struct net_device *netdev)
                if (err)
                        goto err_close_channels;
        }
@@ -1515,7 +1546,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        return 0;
  
  err_close_channels:
-@@ -1859,7 +1881,9 @@ int mlx5e_open(struct net_device *netdev)
+@@ -1859,7 +1886,9 @@ int mlx5e_open(struct net_device *netdev)
  int mlx5e_close_locked(struct net_device *netdev)
  {
        struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -1525,7 +1556,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
        /* May already be CLOSED in case a previous configuration operation
         * (e.g RX/TX queue size change) that involves close&open failed.
-@@ -1869,8 +1893,10 @@ int mlx5e_close_locked(struct net_device *netdev)
+@@ -1869,8 +1898,10 @@ int mlx5e_close_locked(struct net_device *netdev)
  
        clear_bit(MLX5E_STATE_OPENED, &priv->state);
  
@@ -1536,7 +1567,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
        mlx5e_timestamp_cleanup(priv);
        netif_carrier_off(priv->netdev);
-@@ -2274,6 +2300,7 @@ int mlx5e_modify_rqs_vsd(struct mlx5e_priv *priv, bool vsd)
+@@ -2274,6 +2305,7 @@ int mlx5e_modify_rqs_vsd(struct mlx5e_priv *priv, bool vsd)
        return 0;
  }
  
@@ -1544,7 +1575,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  static int mlx5e_setup_tc(struct net_device *netdev, u8 tc)
  {
        struct mlx5e_priv *priv = netdev_priv(netdev);
-@@ -2298,38 +2325,50 @@ static int mlx5e_setup_tc(struct net_device *netdev, u8 tc)
+@@ -2298,38 +2330,50 @@ static int mlx5e_setup_tc(struct net_device *netdev, u8 tc)
  
        return err;
  }
@@ -1596,7 +1627,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  {
        struct mlx5e_priv *priv = netdev_priv(dev);
        struct mlx5e_sw_stats *sstats = &priv->stats.sw;
-@@ -2439,6 +2478,7 @@ static int set_feature_vlan_filter(struct net_device *netdev, bool enable)
+@@ -2439,6 +2483,7 @@ static int set_feature_vlan_filter(struct net_device *netdev, bool enable)
        return 0;
  }
  
@@ -1604,7 +1635,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  static int set_feature_tc_num_filters(struct net_device *netdev, bool enable)
  {
        struct mlx5e_priv *priv = netdev_priv(netdev);
-@@ -2451,6 +2491,7 @@ static int set_feature_tc_num_filters(struct net_device *netdev, bool enable)
+@@ -2451,6 +2496,7 @@ static int set_feature_tc_num_filters(struct net_device *netdev, bool enable)
  
        return 0;
  }
@@ -1612,7 +1643,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
  static int set_feature_rx_all(struct net_device *netdev, bool enable)
  {
-@@ -2525,8 +2566,10 @@ static int mlx5e_set_features(struct net_device *netdev,
+@@ -2525,8 +2571,10 @@ static int mlx5e_set_features(struct net_device *netdev,
        err |= mlx5e_handle_feature(netdev, features,
                                    NETIF_F_HW_VLAN_CTAG_FILTER,
                                    set_feature_vlan_filter);
@@ -1623,7 +1654,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        err |= mlx5e_handle_feature(netdev, features, NETIF_F_RXALL,
                                    set_feature_rx_all);
        err |= mlx5e_handle_feature(netdev, features, NETIF_F_HW_VLAN_CTAG_RX,
-@@ -2597,6 +2640,7 @@ static int mlx5e_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+@@ -2597,6 +2645,7 @@ static int mlx5e_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        }
  }
  
@@ -1631,7 +1662,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  static int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
  {
        struct mlx5e_priv *priv = netdev_priv(dev);
-@@ -2622,6 +2666,7 @@ static int mlx5e_set_vf_spoofchk(struct net_device *dev, int vf, bool setting)
+@@ -2622,6 +2671,7 @@ static int mlx5e_set_vf_spoofchk(struct net_device *dev, int vf, bool setting)
        return mlx5_eswitch_set_vport_spoofchk(mdev->priv.eswitch, vf + 1, setting);
  }
  
@@ -1639,7 +1670,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  static int mlx5e_set_vf_trust(struct net_device *dev, int vf, bool setting)
  {
        struct mlx5e_priv *priv = netdev_priv(dev);
-@@ -2629,6 +2674,7 @@ static int mlx5e_set_vf_trust(struct net_device *dev, int vf, bool setting)
+@@ -2629,6 +2679,7 @@ static int mlx5e_set_vf_trust(struct net_device *dev, int vf, bool setting)
  
        return mlx5_eswitch_set_vport_trust(mdev->priv.eswitch, vf + 1, setting);
  }
@@ -1647,7 +1678,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  static int mlx5_vport_link2ifla(u8 esw_link)
  {
        switch (esw_link) {
-@@ -2684,7 +2730,9 @@ static int mlx5e_get_vf_stats(struct net_device *dev,
+@@ -2684,7 +2735,9 @@ static int mlx5e_get_vf_stats(struct net_device *dev,
        return mlx5_eswitch_get_vport_stats(mdev->priv.eswitch, vf + 1,
                                            vf_stats);
  }
@@ -1657,7 +1688,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  static void mlx5e_add_vxlan_port(struct net_device *netdev,
                                 struct udp_tunnel_info *ti)
  {
-@@ -2712,7 +2760,31 @@ static void mlx5e_del_vxlan_port(struct net_device *netdev,
+@@ -2712,7 +2765,31 @@ static void mlx5e_del_vxlan_port(struct net_device *netdev,
  
        mlx5e_vxlan_queue_work(priv, ti->sa_family, be16_to_cpu(ti->port), 0);
  }
@@ -1680,16 +1711,16 @@ index xxxxxxx..xxxxxxx xxxxxx
 +
 +      if (!mlx5e_vxlan_allowed(priv->mdev))
 +              return;
++
 +      mlx5e_vxlan_queue_work(priv, sa_family, be16_to_cpu(port), 0);
 +}
 +#endif
-+
 +#ifdef HAVE_NETDEV_FEATURES_T
  static netdev_features_t mlx5e_vxlan_features_check(struct mlx5e_priv *priv,
                                                    struct sk_buff *skb,
                                                    netdev_features_t features)
-@@ -2752,7 +2824,9 @@ static netdev_features_t mlx5e_features_check(struct sk_buff *skb,
+@@ -2752,7 +2829,9 @@ static netdev_features_t mlx5e_features_check(struct sk_buff *skb,
  {
        struct mlx5e_priv *priv = netdev_priv(netdev);
  
@@ -1699,7 +1730,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        features = vxlan_features_check(skb, features);
  
        /* Validate if the tunneled packet is being offloaded by HW */
-@@ -2762,6 +2836,7 @@ static netdev_features_t mlx5e_features_check(struct sk_buff *skb,
+@@ -2762,6 +2841,7 @@ static netdev_features_t mlx5e_features_check(struct sk_buff *skb,
  
        return features;
  }
@@ -1707,7 +1738,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
  static void mlx5e_tx_timeout(struct net_device *dev)
  {
-@@ -2790,20 +2865,36 @@ static const struct net_device_ops mlx5e_netdev_ops_basic = {
+@@ -2790,20 +2870,36 @@ static const struct net_device_ops mlx5e_netdev_ops_basic = {
        .ndo_open                = mlx5e_open,
        .ndo_stop                = mlx5e_close,
        .ndo_start_xmit          = mlx5e_xmit,
@@ -1744,7 +1775,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        .ndo_tx_timeout          = mlx5e_tx_timeout,
  };
  
-@@ -2811,7 +2902,13 @@ static const struct net_device_ops mlx5e_netdev_ops_sriov = {
+@@ -2811,7 +2907,13 @@ static const struct net_device_ops mlx5e_netdev_ops_sriov = {
        .ndo_open                = mlx5e_open,
        .ndo_stop                = mlx5e_close,
        .ndo_start_xmit          = mlx5e_xmit,
@@ -1758,7 +1789,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        .ndo_select_queue        = mlx5e_select_queue,
        .ndo_get_stats64         = mlx5e_get_stats,
        .ndo_set_rx_mode         = mlx5e_set_rx_mode,
-@@ -2821,20 +2918,35 @@ static const struct net_device_ops mlx5e_netdev_ops_sriov = {
+@@ -2821,20 +2923,35 @@ static const struct net_device_ops mlx5e_netdev_ops_sriov = {
        .ndo_set_features        = mlx5e_set_features,
        .ndo_change_mtu          = mlx5e_change_mtu,
        .ndo_do_ioctl            = mlx5e_ioctl,
@@ -1794,7 +1825,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        .ndo_tx_timeout          = mlx5e_tx_timeout,
  };
  
-@@ -3051,7 +3163,9 @@ static void mlx5e_build_nic_netdev_priv(struct mlx5_core_dev *mdev,
+@@ -3051,7 +3168,9 @@ static void mlx5e_build_nic_netdev_priv(struct mlx5_core_dev *mdev,
        priv->params.tx_max_inline         = mlx5e_get_max_inline_cap(mdev);
        mlx5e_query_min_inline(mdev, &priv->params.tx_min_inline_mode);
        priv->params.num_tc                = 1;
@@ -1804,7 +1835,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
        netdev_rss_key_fill(priv->params.toeplitz_hash_key,
                            sizeof(priv->params.toeplitz_hash_key));
-@@ -3096,9 +3210,11 @@ static void mlx5e_set_netdev_dev_addr(struct net_device *netdev)
+@@ -3096,9 +3215,11 @@ static void mlx5e_set_netdev_dev_addr(struct net_device *netdev)
        }
  }
  
@@ -1816,7 +1847,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
  static void mlx5e_build_nic_netdev(struct net_device *netdev)
  {
-@@ -3129,7 +3245,9 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
+@@ -3129,7 +3250,9 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
        netdev->vlan_features    |= NETIF_F_TSO;
        netdev->vlan_features    |= NETIF_F_TSO6;
        netdev->vlan_features    |= NETIF_F_RXCSUM;
@@ -1826,7 +1857,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
        if (!!MLX5_CAP_ETH(mdev, lro_cap))
                netdev->vlan_features    |= NETIF_F_LRO;
-@@ -3140,17 +3258,26 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
+@@ -3140,17 +3263,26 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
        netdev->hw_features      |= NETIF_F_HW_VLAN_CTAG_FILTER;
  
        if (mlx5e_vxlan_allowed(mdev)) {
@@ -1853,7 +1884,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        }
  
        mlx5_query_port_fcs(mdev, &fcs_supported, &fcs_enabled);
-@@ -3165,16 +3292,20 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
+@@ -3165,16 +3297,20 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
        if (fcs_enabled)
                netdev->features  &= ~NETIF_F_RXALL;
  
@@ -1874,7 +1905,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
        netdev->features         |= NETIF_F_HIGHDMA;
  
-@@ -3259,13 +3390,17 @@ static void mlx5e_nic_init(struct mlx5_core_dev *mdev,
+@@ -3259,13 +3395,17 @@ static void mlx5e_nic_init(struct mlx5_core_dev *mdev,
  
  static void mlx5e_nic_cleanup(struct mlx5e_priv *priv)
  {
@@ -1892,7 +1923,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  }
  
  static int mlx5e_init_nic_rx(struct mlx5e_priv *priv)
-@@ -3304,14 +3439,18 @@ static int mlx5e_init_nic_rx(struct mlx5e_priv *priv)
+@@ -3304,14 +3444,18 @@ static int mlx5e_init_nic_rx(struct mlx5e_priv *priv)
                goto err_destroy_direct_tirs;
        }
  
@@ -1911,7 +1942,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  err_destroy_direct_tirs:
        mlx5e_destroy_direct_tirs(priv);
  err_destroy_indirect_tirs:
-@@ -3328,7 +3467,9 @@ static void mlx5e_cleanup_nic_rx(struct mlx5e_priv *priv)
+@@ -3328,7 +3472,9 @@ static void mlx5e_cleanup_nic_rx(struct mlx5e_priv *priv)
  {
        int i;
  
@@ -1921,7 +1952,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        mlx5e_destroy_flow_steering(priv);
        mlx5e_destroy_direct_tirs(priv);
        mlx5e_destroy_indirect_tirs(priv);
-@@ -3355,20 +3496,29 @@ static int mlx5e_init_nic_tx(struct mlx5e_priv *priv)
+@@ -3355,20 +3501,29 @@ static int mlx5e_init_nic_tx(struct mlx5e_priv *priv)
  
  static void mlx5e_nic_enable(struct mlx5e_priv *priv)
  {
@@ -1951,7 +1982,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
                mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id);
                rep.load = mlx5e_nic_rep_load;
-@@ -3377,6 +3527,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
+@@ -3377,6 +3532,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
                rep.priv_data = priv;
                mlx5_eswitch_register_vport_rep(esw, &rep);
        }
@@ -1959,7 +1990,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  }
  
  static void mlx5e_nic_disable(struct mlx5e_priv *priv)
-@@ -3484,6 +3635,7 @@ err_free_netdev:
+@@ -3484,6 +3640,7 @@ err_free_netdev:
        return NULL;
  }
  
@@ -1967,7 +1998,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  static void mlx5e_register_vport_rep(struct mlx5_core_dev *mdev)
  {
        struct mlx5_eswitch *esw = mdev->priv.eswitch;
-@@ -3506,10 +3658,13 @@ static void mlx5e_register_vport_rep(struct mlx5_core_dev *mdev)
+@@ -3506,10 +3663,13 @@ static void mlx5e_register_vport_rep(struct mlx5_core_dev *mdev)
                mlx5_eswitch_register_vport_rep(esw, &rep);
        }
  }
@@ -1981,7 +2012,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        void *ppriv = NULL;
        void *ret;
  
-@@ -3519,10 +3674,12 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
+@@ -3519,10 +3679,12 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
        if (mlx5e_create_mdev_resources(mdev))
                return NULL;
  
@@ -1994,7 +2025,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
        ret = mlx5e_create_netdev(mdev, &mlx5e_nic_profile, ppriv);
        if (!ret) {
-@@ -3565,15 +3722,21 @@ void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv)
+@@ -3565,15 +3727,21 @@ void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv)
  
  static void mlx5e_remove(struct mlx5_core_dev *mdev, void *vpriv)
  {
@@ -2016,7 +2047,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
        mlx5e_destroy_mdev_resources(mdev);
  }
-@@ -3595,7 +3758,9 @@ static struct mlx5_interface mlx5e_interface = {
+@@ -3595,7 +3763,9 @@ static struct mlx5_interface mlx5e_interface = {
  
  void mlx5e_init(void)
  {
@@ -2694,7 +2725,43 @@ index xxxxxxx..xxxxxxx xxxxxx
  
  MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>");
  MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver");
-@@ -1152,6 +1156,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
+@@ -270,6 +274,9 @@ static int mlx5_enable_msix(struct mlx5_core_dev *dev)
+       struct mlx5_eq_table *table = &priv->eq_table;
+       int num_eqs = 1 << MLX5_CAP_GEN(dev, log_max_eq);
+       int nvec;
++#ifndef HAVE_PCI_ENABLE_MSIX_RANGE
++      int err;
++#endif
+       int i;
+       nvec = MLX5_CAP_GEN(dev, num_ports) * num_online_cpus() +
+@@ -287,12 +294,25 @@ static int mlx5_enable_msix(struct mlx5_core_dev *dev)
+       for (i = 0; i < nvec; i++)
+               priv->msix_arr[i].entry = i;
++#ifdef HAVE_PCI_ENABLE_MSIX_RANGE
+       nvec = pci_enable_msix_range(dev->pdev, priv->msix_arr,
+                                    MLX5_EQ_VEC_COMP_BASE + 1, nvec);
+       if (nvec < 0)
+               return nvec;
+       table->num_comp_vectors = nvec - MLX5_EQ_VEC_COMP_BASE;
++#else
++retry:
++      table->num_comp_vectors = nvec - MLX5_EQ_VEC_COMP_BASE;
++      err = pci_enable_msix(dev->pdev, priv->msix_arr, nvec);
++      if (err <= 0) {
++              return err;
++      } else if (err > 2) {
++              nvec = err;
++              goto retry;
++      }
++      mlx5_core_dbg(dev, "received %d MSI vectors out of %d requested\n", err, nvec);
++#endif
+       return 0;
+@@ -1152,6 +1172,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
                goto err_rl;
        }
  
@@ -2702,7 +2769,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  #ifdef CONFIG_MLX5_CORE_EN
        err = mlx5_eswitch_init(dev);
        if (err) {
-@@ -1159,6 +1164,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
+@@ -1159,6 +1180,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
                goto err_reg_dev;
        }
  #endif
@@ -2710,7 +2777,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
        err = mlx5_sriov_init(dev);
        if (err) {
-@@ -1187,9 +1193,11 @@ err_sriov:
+@@ -1187,9 +1209,11 @@ err_sriov:
        if (mlx5_sriov_cleanup(dev))
                dev_err(&dev->pdev->dev, "sriov cleanup failed\n");
  
@@ -2722,7 +2789,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  err_reg_dev:
        mlx5_cleanup_rl_table(dev);
  err_rl:
-@@ -1259,9 +1267,11 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
+@@ -1259,9 +1283,11 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
                goto out;
        }
        mlx5_unregister_device(dev);
@@ -2734,7 +2801,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
        mlx5_cleanup_rl_table(dev);
        mlx5_cleanup_fs(dev);
-@@ -1316,21 +1326,28 @@ struct mlx5_core_event_handler {
+@@ -1316,21 +1342,28 @@ struct mlx5_core_event_handler {
                      void *data);
  };
  
@@ -2763,7 +2830,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        devlink = devlink_alloc(&mlx5_devlink_ops, sizeof(*dev));
        if (!devlink) {
                dev_err(&pdev->dev, "kzalloc failed\n");
-@@ -1338,6 +1355,13 @@ static int init_one(struct pci_dev *pdev,
+@@ -1338,6 +1371,13 @@ static int init_one(struct pci_dev *pdev,
        }
  
        dev = devlink_priv(devlink);
@@ -2777,7 +2844,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        priv = &dev->priv;
        priv->pci_dev_data = id->driver_data;
  
-@@ -1374,21 +1398,29 @@ static int init_one(struct pci_dev *pdev,
+@@ -1374,21 +1414,29 @@ static int init_one(struct pci_dev *pdev,
                goto clean_health;
        }
  
@@ -2807,7 +2874,7 @@ index xxxxxxx..xxxxxxx xxxxxx
  
        return err;
  }
-@@ -1396,10 +1428,14 @@ clean_dev:
+@@ -1396,10 +1444,14 @@ clean_dev:
  static void remove_one(struct pci_dev *pdev)
  {
        struct mlx5_core_dev *dev  = pci_get_drvdata(pdev);
@@ -2822,7 +2889,7 @@ index xxxxxxx..xxxxxxx xxxxxx
        if (mlx5_unload_one(dev, priv)) {
                dev_err(&dev->pdev->dev, "mlx5_unload_one failed\n");
                mlx5_health_cleanup(dev);
-@@ -1408,7 +1444,11 @@ static void remove_one(struct pci_dev *pdev)
+@@ -1408,7 +1460,11 @@ static void remove_one(struct pci_dev *pdev)
        mlx5_health_cleanup(dev);
        mlx5_pci_close(dev, priv);
        pci_set_drvdata(pdev, NULL);