Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox...
[linux-block.git] / include / linux / mlx5 / driver.h
index 3ef663900f4dbf8b26630ed9da099d70a3a32c05..0e6da1840c7d84e7a2056cf80233f7104b64637b 100644 (file)
@@ -139,6 +139,7 @@ enum {
        MLX5_REG_MTPPS           = 0x9053,
        MLX5_REG_MTPPSE          = 0x9054,
        MLX5_REG_MPEGC           = 0x9056,
+       MLX5_REG_MCQS            = 0x9060,
        MLX5_REG_MCQI            = 0x9061,
        MLX5_REG_MCC             = 0x9062,
        MLX5_REG_MCDA            = 0x9063,
@@ -182,6 +183,11 @@ enum port_state_policy {
        MLX5_POLICY_INVALID     = 0xffffffff
 };
 
+enum mlx5_coredev_type {
+       MLX5_COREDEV_PF,
+       MLX5_COREDEV_VF
+};
+
 struct mlx5_field_desc {
        struct dentry          *dent;
        int                     i;
@@ -468,7 +474,6 @@ struct mlx5_vf_context {
 struct mlx5_core_sriov {
        struct mlx5_vf_context  *vfs_ctx;
        int                     num_vfs;
-       int                     enabled_vfs;
        u16                     max_vfs;
 };
 
@@ -572,7 +577,6 @@ struct mlx5_priv {
        struct mlx5_core_sriov  sriov;
        struct mlx5_lag         *lag;
        struct mlx5_devcom      *devcom;
-       unsigned long           pci_dev_data;
        struct mlx5_core_roce   roce;
        struct mlx5_fc_stats            fc_stats;
        struct mlx5_rl_table            rl_table;
@@ -653,6 +657,7 @@ struct mlx5_geneve;
 
 struct mlx5_core_dev {
        struct device *device;
+       enum mlx5_coredev_type coredev_type;
        struct pci_dev         *pdev;
        /* sync pci state */
        struct mutex            pci_status_mutex;
@@ -1047,6 +1052,8 @@ int mlx5_register_interface(struct mlx5_interface *intf);
 void mlx5_unregister_interface(struct mlx5_interface *intf);
 int mlx5_notifier_register(struct mlx5_core_dev *dev, struct notifier_block *nb);
 int mlx5_notifier_unregister(struct mlx5_core_dev *dev, struct notifier_block *nb);
+int mlx5_eq_notifier_register(struct mlx5_core_dev *dev, struct mlx5_nb *nb);
+int mlx5_eq_notifier_unregister(struct mlx5_core_dev *dev, struct mlx5_nb *nb);
 
 int mlx5_core_query_vendor_id(struct mlx5_core_dev *mdev, u32 *vendor_id);
 
@@ -1087,9 +1094,9 @@ enum {
        MLX5_PCI_DEV_IS_VF              = 1 << 0,
 };
 
-static inline int mlx5_core_is_pf(struct mlx5_core_dev *dev)
+static inline bool mlx5_core_is_pf(const struct mlx5_core_dev *dev)
 {
-       return !(dev->priv.pci_dev_data & MLX5_PCI_DEV_IS_VF);
+       return dev->coredev_type == MLX5_COREDEV_PF;
 }
 
 static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev)
@@ -1097,17 +1104,18 @@ static inline bool mlx5_core_is_ecpf(struct mlx5_core_dev *dev)
        return dev->caps.embedded_cpu;
 }
 
-static inline bool mlx5_core_is_ecpf_esw_manager(struct mlx5_core_dev *dev)
+static inline bool
+mlx5_core_is_ecpf_esw_manager(const struct mlx5_core_dev *dev)
 {
        return dev->caps.embedded_cpu && MLX5_CAP_GEN(dev, eswitch_manager);
 }
 
-static inline bool mlx5_ecpf_vport_exists(struct mlx5_core_dev *dev)
+static inline bool mlx5_ecpf_vport_exists(const struct mlx5_core_dev *dev)
 {
        return mlx5_core_is_pf(dev) && MLX5_CAP_ESW(dev, ecpf_vport_exists);
 }
 
-static inline u16 mlx5_core_max_vfs(struct mlx5_core_dev *dev)
+static inline u16 mlx5_core_max_vfs(const struct mlx5_core_dev *dev)
 {
        return dev->priv.sriov.max_vfs;
 }