From: Maher Sanalla <msanalla@nvidia.com>
Subject: [PATCH] BACKPORT: drivers/net/ethernet/mellanox/mlx5/core/main.c

Change-Id: I8b6650ce5a2a5ce78b326d66ae0217c356d6943d
---
 .../net/ethernet/mellanox/mlx5/core/main.c    | 199 ++++++++++++++++--
 1 file changed, 180 insertions(+), 19 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -95,6 +95,10 @@ static unsigned int prof_sel = MLX5_DEFA
 module_param_named(prof_sel, prof_sel, uint, 0444);
 MODULE_PARM_DESC(prof_sel, "profile selector. Valid range 0 - 3");
 
+static bool probe_vf = 1;
+module_param_named(probe_vf, probe_vf, bool, 0644);
+MODULE_PARM_DESC(probe_vf, "probe VFs or not, 0 = not probe, 1 = probe. Default = 1");
+
 MODULE_ALIAS("auxiliary:mlx5_core.eth");
 MODULE_ALIAS("auxiliary:mlx5_core.eth-rep");
 
@@ -618,13 +622,18 @@ static int handle_hca_cap_odp(struct mlx
 	return set_caps(dev, set_ctx, MLX5_SET_HCA_CAP_OP_MOD_ODP);
 }
 
+#ifdef HAVE_DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH
 static int max_uc_list_get_devlink_param(struct mlx5_core_dev *dev)
 {
 	struct devlink *devlink = priv_to_devlink(dev);
 	union devlink_param_value val;
 	int err;
 
-	err = devlink_param_driverinit_value_get(devlink,
+#ifdef HAVE_DEVL_PARAM_DRIVERINIT_VALUE_GET
+	err = devl_param_driverinit_value_get(devlink,
+#else
+        err = devlink_param_driverinit_value_get(devlink,
+#endif
 						 DEVLINK_PARAM_GENERIC_ID_MAX_MACS,
 						 &val);
 	if (!err)
@@ -632,6 +641,7 @@ static int max_uc_list_get_devlink_param
 	mlx5_core_dbg(dev, "Failed to get param. err = %d\n", err);
 	return err;
 }
+#endif
 
 int mlx5_core_other_function_set_caps(struct mlx5_core_dev *dev,
 				      const void *hca_cap_on_behalf,
@@ -658,11 +668,16 @@ int mlx5_core_other_function_set_caps(st
 
 bool mlx5_is_roce_on(struct mlx5_core_dev *dev)
 {
+#if defined(HAVE_DEVLINK_PARAM) && defined(HAVE_DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE)
 	struct devlink *devlink = priv_to_devlink(dev);
 	union devlink_param_value val;
 	int err;
 
-	err = devlink_param_driverinit_value_get(devlink,
+#ifdef HAVE_DEVL_PARAM_DRIVERINIT_VALUE_GET
+	err = devl_param_driverinit_value_get(devlink,
+#else
+        err = devlink_param_driverinit_value_get(devlink,
+#endif
 						 DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
 						 &val);
 
@@ -671,6 +686,9 @@ bool mlx5_is_roce_on(struct mlx5_core_de
 
 	mlx5_core_dbg(dev, "Failed to get param. err = %d\n", err);
 	return MLX5_CAP_GEN(dev, roce);
+#else
+	return MLX5_CAP_GEN(dev, roce) && dev->roce.enabled;
+#endif
 }
 EXPORT_SYMBOL(mlx5_is_roce_on);
 
@@ -678,7 +696,9 @@ static int handle_hca_cap(struct mlx5_co
 {
 	struct mlx5_profile *prof = &dev->profile;
 	void *set_hca_cap;
+#ifdef HAVE_DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH
 	int max_uc_list;
+#endif
 	int err;
 
 	err = mlx5_core_get_caps(dev, MLX5_CAP_GENERAL);
@@ -750,17 +770,23 @@ static int handle_hca_cap(struct mlx5_co
 
 	mlx5_vhca_state_cap_handle(dev, set_hca_cap);
 
+#ifdef HAVE_SRIOV_GET_SET_MSIX_VEC_COUNT
 	if (MLX5_CAP_GEN_MAX(dev, num_total_dynamic_vf_msix))
 		MLX5_SET(cmd_hca_cap, set_hca_cap, num_total_dynamic_vf_msix,
 			 MLX5_CAP_GEN_MAX(dev, num_total_dynamic_vf_msix));
+#endif
 
+#if defined(HAVE_DEVLINK_PARAM) && defined(HAVE_DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE)
 	if (MLX5_CAP_GEN(dev, roce_rw_supported))
 		MLX5_SET(cmd_hca_cap, set_hca_cap, roce, mlx5_is_roce_on(dev));
+#endif
 
+#ifdef HAVE_DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH
 	max_uc_list = max_uc_list_get_devlink_param(dev);
 	if (max_uc_list > 0)
 		MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_current_uc_list,
 			 ilog2(max_uc_list));
+#endif
 
 	return set_caps(dev, set_ctx, MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE);
 }
@@ -781,8 +807,12 @@ static int handle_hca_cap(struct mlx5_co
  */
 static bool is_roce_fw_disabled(struct mlx5_core_dev *dev)
 {
+#if defined(HAVE_DEVLINK_PARAM) && defined(HAVE_DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE)
 	return (MLX5_CAP_GEN(dev, roce_rw_supported) && !mlx5_is_roce_on(dev)) ||
 		(!MLX5_CAP_GEN(dev, roce_rw_supported) && !MLX5_CAP_GEN(dev, roce));
+#else
+	return !MLX5_CAP_GEN(dev, roce);
+#endif
 }
 
 static int handle_hca_cap_roce(struct mlx5_core_dev *dev, void *set_ctx)
@@ -1015,6 +1045,9 @@ static ssize_t mlx5_roce_enable_show_ena
 	struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
 	int ret;
 
+#if defined(HAVE_DEVLINK_PARAM) && defined(HAVE_DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE)
+	return -EOPNOTSUPP;
+#endif
 	mutex_lock(&dev->roce.state_lock);
 	ret = dev->roce.enabled;
 	mutex_unlock(&dev->roce.state_lock);
@@ -1028,11 +1061,15 @@ static ssize_t mlx5_roce_enable_set_enab
 {
 	struct pci_dev *pdev = container_of(device, struct pci_dev, dev);
 	struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
-	struct devlink *devlink = priv_to_devlink(dev);
-	union devlink_param_value value;
+#if !defined(HAVE_DEVLINK_HAS_RELOAD) && !defined(HAVE_DEVLINK_HAS_RELOAD_UP_DOWN)
+	bool change;
+#endif
 	int ret;
 	bool val;
 
+#if defined(HAVE_DEVLINK_PARAM) && defined(HAVE_DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE)
+	return -EOPNOTSUPP;
+#endif
 	ret = kstrtobool(buf, &val);
 	if (ret)
 		return -EINVAL;
@@ -1040,15 +1077,26 @@ static ssize_t mlx5_roce_enable_set_enab
 	if (val && !MLX5_CAP_GEN(dev, roce))
 		return -EOPNOTSUPP;
 
+	if (mlx5_core_is_mp_slave(dev) || mlx5_lag_is_active(dev))
+		return -EOPNOTSUPP;
+
 	mutex_lock(&dev->roce.state_lock);
+#if !defined(HAVE_DEVLINK_HAS_RELOAD) && !defined(HAVE_DEVLINK_HAS_RELOAD_UP_DOWN)
+	change = dev->roce.enabled != val;
+#endif
 	dev->roce.enabled = val;
-	value.vbool = val;
-	devlink_param_driverinit_value_set(devlink,
-			DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
-			value);
 	mutex_unlock(&dev->roce.state_lock);
+#if !defined(HAVE_DEVLINK_HAS_RELOAD) && !defined(HAVE_DEVLINK_HAS_RELOAD_UP_DOWN)
+	if (mlx5_sf_dev_allocated(dev))
+		return -EOPNOTSUPP;
+
+	if (!change)
+		return count;
 
-	return count;
+	mlx5_unload_one(dev);
+	ret = mlx5_load_one(dev, false);
+#endif
+	return (ret != 0 ? ret : count);
 }
 
 static DEVICE_ATTR(roce_enable, 0644, mlx5_roce_enable_show_enabled,
@@ -1515,12 +1563,13 @@ static int mlx5_load(struct mlx5_core_de
 
 	mlx5_accel_ipsec_init(dev);
 
+#ifdef HAVE_UAPI_LINUX_TLS_H
 	err = mlx5_accel_tls_init(dev);
 	if (err) {
 		mlx5_core_err(dev, "TLS device start failed %d\n", err);
 		goto err_tls_start;
 	}
-
+#endif
 	err = mlx5_init_fs(dev);
 	if (err) {
 		mlx5_core_err(dev, "Failed to init flow steering\n");
@@ -1575,8 +1624,10 @@ err_vhca:
 err_set_hca:
 	mlx5_cleanup_fs(dev);
 err_fs:
+#ifdef HAVE_UAPI_LINUX_TLS_H
 	mlx5_accel_tls_cleanup(dev);
 err_tls_start:
+#endif
 	mlx5_accel_ipsec_cleanup(dev);
 	mlx5_fpga_device_stop(dev);
 err_fpga_start:
@@ -1607,7 +1658,9 @@ static void mlx5_unload(struct mlx5_core
 	mlx5_vhca_event_stop(dev);
 	mlx5_cleanup_fs(dev);
 	mlx5_accel_ipsec_cleanup(dev);
+#ifdef HAVE_UAPI_LINUX_TLS_H
 	mlx5_accel_tls_cleanup(dev);
+#endif
 	mlx5_fpga_device_stop(dev);
 	mlx5_rsc_dump_cleanup(dev);
 	mlx5_hv_vhca_cleanup(dev->hv_vhca);
@@ -1622,8 +1675,14 @@ static void mlx5_unload(struct mlx5_core
 
 int mlx5_init_one(struct mlx5_core_dev *dev)
 {
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+	struct devlink *devlink = priv_to_devlink(dev);
+#endif
 	int err = 0;
 
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+	devl_lock(devlink);
+#endif
 	mutex_lock(&dev->intf_state_mutex);
 	dev->state = MLX5_DEVICE_STATE_UP;
 
@@ -1648,7 +1707,11 @@ int mlx5_init_one(struct mlx5_core_dev *
 	mlx5_devm_params_publish(dev);
 	set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state);
 
+#ifdef HAVE_DEVLINK_REGISTER_GET_1_PARAMS
 	err = mlx5_devlink_register(priv_to_devlink(dev));
+#else
+	err = mlx5_devlink_register(priv_to_devlink(dev), dev->device);
+#endif
 	if (err)
 		goto err_devlink_reg;
 
@@ -1657,6 +1720,9 @@ int mlx5_init_one(struct mlx5_core_dev *
 		goto err_register;
 
 	mutex_unlock(&dev->intf_state_mutex);
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+	devl_unlock(devlink);
+#endif
 	return 0;
 
 err_register:
@@ -1671,11 +1737,19 @@ function_teardown:
 err_function:
 	dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
 	mutex_unlock(&dev->intf_state_mutex);
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+	devl_unlock(devlink);
+#endif
 	return err;
 }
 
 void mlx5_uninit_one(struct mlx5_core_dev *dev)
 {
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+	struct devlink *devlink = priv_to_devlink(dev);
+
+	devl_lock(devlink);
+#endif
 	mutex_lock(&dev->intf_state_mutex);
 
 	mlx5_unregister_device(dev);
@@ -1694,12 +1768,22 @@ void mlx5_uninit_one(struct mlx5_core_de
 	mlx5_function_teardown(dev, true);
 out:
 	mutex_unlock(&dev->intf_state_mutex);
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+	devl_unlock(devlink);
+#endif
 }
 
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+int mlx5_load_one_devl_locked(struct mlx5_core_dev *dev, bool recovery)
+#else
 int mlx5_load_one(struct mlx5_core_dev *dev, bool recovery)
+#endif
 {
 	int err = 0;
 
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+	devl_assert_locked(priv_to_devlink(dev));
+#endif
 	mutex_lock(&dev->intf_state_mutex);
 	if (test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) {
 		mlx5_core_warn(dev, "interface is up, NOP\n");
@@ -1743,6 +1827,19 @@ out:
 	return err;
 }
 
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+int mlx5_load_one(struct mlx5_core_dev *dev, bool recovery)
+{
+	struct devlink *devlink = priv_to_devlink(dev);
+	int ret;
+
+	devl_lock(devlink);
+	ret = mlx5_load_one_devl_locked(dev, recovery);
+	devl_unlock(devlink);
+	return ret;
+}
+#endif
+
 static int mlx5_try_fast_unload(struct mlx5_core_dev *dev)
 {
 	bool fast_teardown = false, force_teardown = false;
@@ -1797,8 +1894,15 @@ succeed:
 	return 0;
 }
 
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev)
+#else
 void mlx5_unload_one(struct mlx5_core_dev *dev)
+#endif
 {
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+	devl_assert_locked(priv_to_devlink(dev));
+#endif
 	mutex_lock(&dev->intf_state_mutex);
 
 	mlx5_detach_device(dev);
@@ -1816,6 +1920,17 @@ out:
 	mutex_unlock(&dev->intf_state_mutex);
 }
 
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+void mlx5_unload_one(struct mlx5_core_dev *dev)
+{
+	struct devlink *devlink = priv_to_devlink(dev);
+
+	devl_lock(devlink);
+	mlx5_unload_one_devl_locked(dev);
+	devl_unlock(devlink);
+}
+#endif
+
 static const int types[] = {
 	MLX5_CAP_GENERAL,
 	MLX5_CAP_GENERAL_2,
@@ -1882,9 +1997,13 @@ int mlx5_mdev_init(struct mlx5_core_dev
 	memcpy(&dev->profile, &profile[profile_idx], sizeof(dev->profile));
 	INIT_LIST_HEAD(&priv->ctx_list);
 	spin_lock_init(&priv->ctx_lock);
+#ifdef HAVE_LOCKDEP_UNREGISTER_KEY
 	lockdep_register_key(&dev->lock_key);
+#endif
 	mutex_init(&dev->intf_state_mutex);
+#ifdef HAVE_LOCKDEP_UNREGISTER_KEY
 	lockdep_set_class(&dev->intf_state_mutex, &dev->lock_key);
+#endif
 
 	mutex_init(&priv->bfregs.reg_head.lock);
 	mutex_init(&priv->bfregs.wc_head.lock);
@@ -1939,7 +2058,9 @@ err_timeout_init:
 	mutex_destroy(&priv->bfregs.wc_head.lock);
 	mutex_destroy(&priv->bfregs.reg_head.lock);
 	mutex_destroy(&dev->intf_state_mutex);
+#ifdef HAVE_LOCKDEP_UNREGISTER_KEY
 	lockdep_unregister_key(&dev->lock_key);
+#endif
 	return err;
 }
 
@@ -1958,13 +2079,16 @@ void mlx5_mdev_uninit(struct mlx5_core_d
 	mutex_destroy(&priv->bfregs.wc_head.lock);
 	mutex_destroy(&priv->bfregs.reg_head.lock);
 	mutex_destroy(&dev->intf_state_mutex);
+#ifdef HAVE_LOCKDEP_UNREGISTER_KEY
 	lockdep_unregister_key(&dev->lock_key);
+#endif
 }
 
 static int probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
-	struct mlx5_core_dev *dev;
+	struct mlx5_core_dev *dev = NULL;
 	struct devlink *devlink;
+	struct mlx5_priv *priv;
 	int err;
 
 	devlink = mlx5_devlink_alloc(&pdev->dev);
@@ -1978,14 +2102,21 @@ static int probe_one(struct pci_dev *pde
 		goto remove_roce_file;
 
 	dev = devlink_priv(devlink);
+	priv = &dev->priv;
 	dev->device = &pdev->dev;
 	dev->pdev = pdev;
+	priv->sriov.probe_vf = probe_vf;
 
 	dev->coredev_type = id->driver_data & MLX5_PCI_DEV_IS_VF ?
 			 MLX5_COREDEV_VF : MLX5_COREDEV_PF;
 
 	pci_set_drvdata(dev->pdev, dev);
 
+	if (pdev->is_virtfn && !probe_vf) {
+		dev_info(&pdev->dev, "Avoid probing VFs\n");
+		return 0;
+	}
+
 	dev->priv.adev_idx = mlx5_adev_idx_alloc();
 	if (dev->priv.adev_idx < 0) {
 		err = dev->priv.adev_idx;
@@ -2022,7 +2153,13 @@ static int probe_one(struct pci_dev *pde
 		dev_err(&pdev->dev, "mlx5_crdump_enable failed with error code %d\n", err);
 
 	pci_save_state(pdev);
+#ifdef HAVE_DEVLINK_REGISTER_GET_1_PARAMS
 	devlink_register(devlink);
+#endif
+#if defined(HAVE_DEVLINK_RELOAD_ENABLE) && !defined(HAVE_DEVLINK_SET_FEATURES)
+       if (!mlx5_core_is_mp_slave(dev))
+	       devlink_reload_enable(devlink);
+#endif
 	return 0;
 
 err_init_one:
@@ -2043,8 +2180,16 @@ remove_roce_file:
 
 static void remove_one(struct pci_dev *pdev)
 {
-	struct mlx5_core_dev *dev  = pci_get_drvdata(pdev);
-	struct devlink *devlink = priv_to_devlink(dev);
+	struct mlx5_core_dev *dev;
+	struct devlink *devlink;
+	struct mlx5_priv *priv;
+
+	dev  = pci_get_drvdata(pdev);
+	devlink = priv_to_devlink(dev);
+	priv = &dev->priv;
+
+	if (pdev->is_virtfn && !priv->sriov.probe_vf)
+		goto out;
 
 	/* mlx5_drain_fw_reset() is using devlink APIs. Hence, we must drain
 	 * fw_reset before unregistering the devlink.
@@ -2054,7 +2199,12 @@ static void remove_one(struct pci_dev *p
 	if (mlx5_try_fast_unload(dev))
 		dev_dbg(&dev->pdev->dev, "mlx5_try_fast_unload failed\n");
 
+#if defined(HAVE_DEVLINK_RELOAD_DISABLE) && !defined(HAVE_DEVLINK_SET_FEATURES)
+	devlink_reload_disable(devlink);
+#endif
+#ifdef HAVE_DEVLINK_REGISTER_GET_1_PARAMS
 	devlink_unregister(devlink);
+#endif
 	mlx5_crdump_disable(dev);
 	mlx5_drain_health_wq(dev);
 	mlx5_uninit_one(dev);
@@ -2062,6 +2212,7 @@ static void remove_one(struct pci_dev *p
 	mlx5_pci_close(dev);
 	mlx5_mdev_uninit(dev);
 	mlx5_adev_idx_free(dev->priv.adev_idx);
+out:
 	device_remove_file(&pdev->dev, mlx5_roce_enable_dev_attrs);
 	mlx5_devlink_free(devlink);
 }
@@ -2090,7 +2241,7 @@ static int suspend(struct device *device
 
 	dev_info(&pdev->dev, "suspend was called\n");
 
-	if (pdev->is_virtfn)
+	if (pdev->is_virtfn && !dev->priv.sriov.probe_vf)
 		return 0;
 
 	mlx5_unload_one(dev);
@@ -2125,7 +2276,7 @@ static int resume(struct device *device)
 
 	dev_info(&pdev->dev, "resume was called\n");
 
-	if (pdev->is_virtfn)
+	if (pdev->is_virtfn && !dev->priv.sriov.probe_vf)
 		return 0;
 
 	err = pci_set_power_state(pdev, PCI_D0);
@@ -2170,7 +2321,7 @@ static pci_ers_result_t mlx5_pci_err_det
 
 	mlx5_pci_trace(dev, "Enter, pci channel state = %d\n", state);
 
-	if (pdev->is_virtfn)
+	if (pdev->is_virtfn && !dev->priv.sriov.probe_vf)
 		return PCI_ERS_RESULT_CAN_RECOVER;
 
 	mlx5_enter_error_state(dev, false);
@@ -2223,7 +2374,7 @@ static pci_ers_result_t mlx5_pci_slot_re
 
 	mlx5_core_info(dev, "%s was called\n", __func__);
 
-	if (pdev->is_virtfn)
+	if (pdev->is_virtfn && !dev->priv.sriov.probe_vf)
 		return PCI_ERS_RESULT_NEED_RESET;
 
 	err = mlx5_pci_enable_device(dev);
@@ -2257,7 +2408,7 @@ static void mlx5_pci_resume(struct pci_d
 
 	mlx5_pci_trace(dev, "Enter, loading driver..\n");
 
-	if (pdev->is_virtfn)
+	if (pdev->is_virtfn && !dev->priv.sriov.probe_vf)
 		return;
 
 	dev->priv.sw_reset_lag = dev->priv.lag_enabled;
@@ -2280,7 +2431,7 @@ static void shutdown(struct pci_dev *pde
 
 	mlx5_core_info(dev, "Shutdown was called\n");
 
-	if (pdev->is_virtfn)
+	if (pdev->is_virtfn && !dev->priv.sriov.probe_vf)
 		return;
 
 	set_bit(MLX5_INTERFACE_STATE_TEARDOWN, &dev->intf_state);
@@ -2344,7 +2495,11 @@ MODULE_DEVICE_TABLE(pci, mlx5_core_pci_t
 void mlx5_disable_device(struct mlx5_core_dev *dev)
 {
 	mlx5_error_sw_reset(dev);
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+	mlx5_unload_one_devl_locked(dev);
+#else
 	mlx5_unload_one(dev);
+#endif
 }
 
 int mlx5_recover_device(struct mlx5_core_dev *dev)
@@ -2355,7 +2510,11 @@ int mlx5_recover_device(struct mlx5_core
 			return -EIO;
 	}
 
+#ifdef HAVE_DEVL_TRAP_GROUPS_REGISTER //forward port
+	return mlx5_load_one_devl_locked(dev, true);
+#else
 	return mlx5_load_one(dev, true);
+#endif
 }
 
 static struct pci_driver mlx5_core_driver = {
@@ -2373,8 +2532,10 @@ static struct pci_driver mlx5_core_drive
 	.shutdown	= shutdown,
 	.err_handler	= &mlx5_err_handler,
 	.sriov_configure   = mlx5_core_sriov_configure,
+#ifdef HAVE_SRIOV_GET_SET_MSIX_VEC_COUNT
 	.sriov_get_vf_total_msix = mlx5_sriov_get_vf_total_msix,
 	.sriov_set_msix_vec_count = mlx5_core_sriov_set_msix_vec_count,
+#endif
 };
 
 static void mlx5_core_verify_params(void)
