Merge tag 'mlx5-fixes-2020-05-22' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / include / linux / mlx5 / driver.h
index 6f8f79ef829b1829b9c19eba43857c4467d8fa9b..8397b6558dc7c086a93bba3735b8469ec22f4442 100644 (file)
@@ -213,6 +213,12 @@ enum mlx5_port_status {
        MLX5_PORT_DOWN      = 2,
 };
 
+enum mlx5_cmdif_state {
+       MLX5_CMDIF_STATE_UNINITIALIZED,
+       MLX5_CMDIF_STATE_UP,
+       MLX5_CMDIF_STATE_DOWN,
+};
+
 struct mlx5_cmd_first {
        __be32          data[4];
 };
@@ -258,6 +264,7 @@ struct mlx5_cmd_stats {
 struct mlx5_cmd {
        struct mlx5_nb    nb;
 
+       enum mlx5_cmdif_state   state;
        void           *cmd_alloc_buf;
        dma_addr_t      alloc_dma;
        int             alloc_size;
@@ -284,6 +291,7 @@ struct mlx5_cmd {
        struct semaphore sem;
        struct semaphore pages_sem;
        int     mode;
+       u16     allowed_opcode;
        struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS];
        struct dma_pool *pool;
        struct mlx5_cmd_debug dbg;
@@ -743,6 +751,7 @@ struct mlx5_cmd_work_ent {
        struct delayed_work     cb_timeout_work;
        void                   *context;
        int                     idx;
+       struct completion       handling;
        struct completion       done;
        struct mlx5_cmd        *cmd;
        struct work_struct      work;
@@ -874,10 +883,17 @@ mlx5_frag_buf_get_idx_last_contig_stride(struct mlx5_frag_buf_ctrl *fbc, u32 ix)
        return min_t(u32, last_frag_stride_idx - fbc->strides_offset, fbc->sz_m1);
 }
 
+enum {
+       CMD_ALLOWED_OPCODE_ALL,
+};
+
 int mlx5_cmd_init(struct mlx5_core_dev *dev);
 void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);
+void mlx5_cmd_set_state(struct mlx5_core_dev *dev,
+                       enum mlx5_cmdif_state cmdif_state);
 void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
 void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
+void mlx5_cmd_allowed_opcode(struct mlx5_core_dev *dev, u16 opcode);
 
 struct mlx5_async_ctx {
        struct mlx5_core_dev *dev;