IB/mlx4: Reset flow support for IB kernel ULPs
[firefly-linux-kernel-4.4.55.git] / include / linux / mlx4 / device.h
index 5f3a9aa7225d917d5d769d565d3ceb58ad5c4aa0..e4ebff7e9d02fba498e8d5ae9792666e45c3fa3b 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <linux/atomic.h>
 
-#include <linux/clocksource.h>
+#include <linux/timecounter.h>
 
 #define MAX_MSIX_P_PORT                17
 #define MAX_MSIX               64
@@ -70,6 +70,7 @@ enum {
        MLX4_FLAG_SLAVE         = 1 << 3,
        MLX4_FLAG_SRIOV         = 1 << 4,
        MLX4_FLAG_OLD_REG_MAC   = 1 << 6,
+       MLX4_FLAG_BONDED        = 1 << 7
 };
 
 enum {
@@ -200,7 +201,9 @@ enum {
        MLX4_DEV_CAP_FLAG2_CONFIG_DEV           = 1LL <<  16,
        MLX4_DEV_CAP_FLAG2_SYS_EQS              = 1LL <<  17,
        MLX4_DEV_CAP_FLAG2_80_VFS               = 1LL <<  18,
-       MLX4_DEV_CAP_FLAG2_FS_A0                = 1LL <<  19
+       MLX4_DEV_CAP_FLAG2_FS_A0                = 1LL <<  19,
+       MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 20,
+       MLX4_DEV_CAP_FLAG2_PORT_REMAP           = 1LL <<  21
 };
 
 enum {
@@ -208,6 +211,10 @@ enum {
        MLX4_QUERY_FUNC_FLAGS_A0_RES_QP         = 1LL << 1
 };
 
+enum {
+       MLX4_VF_CAP_FLAG_RESET                  = 1 << 0
+};
+
 /* bit enums for an 8-bit flags field indicating special use
  * QPs which require special handling in qp_reserve_range.
  * Currently, this only includes QPs used by the ETH interface,
@@ -248,9 +255,14 @@ enum {
        MLX4_BMME_FLAG_TYPE_2_WIN       = 1 <<  9,
        MLX4_BMME_FLAG_RESERVED_LKEY    = 1 << 10,
        MLX4_BMME_FLAG_FAST_REG_WR      = 1 << 11,
+       MLX4_BMME_FLAG_PORT_REMAP       = 1 << 24,
        MLX4_BMME_FLAG_VSD_INIT2RTR     = 1 << 28,
 };
 
+enum {
+       MLX4_FLAG_PORT_REMAP            = MLX4_BMME_FLAG_PORT_REMAP
+};
+
 enum mlx4_event {
        MLX4_EVENT_TYPE_COMP               = 0x00,
        MLX4_EVENT_TYPE_PATH_MIG           = 0x01,
@@ -276,6 +288,7 @@ enum mlx4_event {
        MLX4_EVENT_TYPE_FATAL_WARNING      = 0x1b,
        MLX4_EVENT_TYPE_FLR_EVENT          = 0x1c,
        MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT = 0x1d,
+       MLX4_EVENT_TYPE_RECOVERABLE_ERROR_EVENT  = 0x3e,
        MLX4_EVENT_TYPE_NONE               = 0xff,
 };
 
@@ -284,6 +297,11 @@ enum {
        MLX4_PORT_CHANGE_SUBTYPE_ACTIVE = 4
 };
 
+enum {
+       MLX4_RECOVERABLE_ERROR_EVENT_SUBTYPE_BAD_CABLE          = 1,
+       MLX4_RECOVERABLE_ERROR_EVENT_SUBTYPE_UNSUPPORTED_CABLE  = 2,
+};
+
 enum {
        MLX4_FATAL_WARNING_SUBTYPE_WARMING = 0,
 };
@@ -411,6 +429,16 @@ enum {
        MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK        = 1 << 4,
 };
 
+enum {
+       MLX4_DEVICE_STATE_UP                    = 1 << 0,
+       MLX4_DEVICE_STATE_INTERNAL_ERROR        = 1 << 1,
+};
+
+enum {
+       MLX4_INTERFACE_STATE_UP         = 1 << 0,
+       MLX4_INTERFACE_STATE_DELETION   = 1 << 1,
+};
+
 #define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \
                             MLX4_EQ_PORT_INFO_MSTR_SM_LID_CHANGE_MASK)
 
@@ -535,6 +563,7 @@ struct mlx4_caps {
        u8                      alloc_res_qp_mask;
        u32                     dmfs_high_rate_qpn_base;
        u32                     dmfs_high_rate_qpn_range;
+       u32                     vf_caps;
 };
 
 struct mlx4_buf_list {
@@ -660,6 +689,8 @@ struct mlx4_cq {
                void (*comp)(struct mlx4_cq *);
                void            *priv;
        } tasklet_ctx;
+       int             reset_notify_added;
+       struct list_head        reset_notify;
 };
 
 struct mlx4_qp {
@@ -744,8 +775,23 @@ struct mlx4_vf_dev {
        u8                      n_ports;
 };
 
-struct mlx4_dev {
+struct mlx4_dev_persistent {
        struct pci_dev         *pdev;
+       struct mlx4_dev        *dev;
+       int                     nvfs[MLX4_MAX_PORTS + 1];
+       int                     num_vfs;
+       enum mlx4_port_type curr_port_type[MLX4_MAX_PORTS + 1];
+       enum mlx4_port_type curr_port_poss_type[MLX4_MAX_PORTS + 1];
+       struct work_struct      catas_work;
+       struct workqueue_struct *catas_wq;
+       struct mutex    device_state_mutex; /* protect HW state */
+       u8              state;
+       struct mutex    interface_state_mutex; /* protect SW state */
+       u8      interface_state;
+};
+
+struct mlx4_dev {
+       struct mlx4_dev_persistent *persist;
        unsigned long           flags;
        unsigned long           num_slaves;
        struct mlx4_caps        caps;
@@ -754,13 +800,11 @@ struct mlx4_dev {
        struct radix_tree_root  qp_table_tree;
        u8                      rev_id;
        char                    board_id[MLX4_BOARD_ID_LEN];
-       int                     num_vfs;
        int                     numa_node;
        int                     oper_log_mgm_entry_size;
        u64                     regid_promisc_array[MLX4_MAX_PORTS + 1];
        u64                     regid_allmulti_array[MLX4_MAX_PORTS + 1];
        struct mlx4_vf_dev     *dev_vfs;
-       int                     nvfs[MLX4_MAX_PORTS + 1];
 };
 
 struct mlx4_eqe {
@@ -832,6 +876,11 @@ struct mlx4_eqe {
                                } __packed tbl_change_info;
                        } params;
                } __packed port_mgmt_change;
+               struct {
+                       u8 reserved[3];
+                       u8 port;
+                       u32 reserved1[5];
+               } __packed bad_cable;
        }                       event;
        u8                      slave_id;
        u8                      reserved3[2];
@@ -1338,6 +1387,8 @@ int mlx4_phys_to_slave_port(struct mlx4_dev *dev, int slave, int port);
 int mlx4_get_base_gid_ix(struct mlx4_dev *dev, int slave, int port);
 
 int mlx4_config_vxlan_port(struct mlx4_dev *dev, __be16 udp_port);
+int mlx4_disable_rx_port_check(struct mlx4_dev *dev, bool dis);
+int mlx4_virt2phy_port_map(struct mlx4_dev *dev, u32 port1, u32 port2);
 int mlx4_vf_smi_enabled(struct mlx4_dev *dev, int slave, int port);
 int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port);
 int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port,