IB/mlx4: Reset flow support for IB kernel ULPs
[firefly-linux-kernel-4.4.55.git] / drivers / infiniband / hw / mlx4 / mlx4_ib.h
index 6eb743f65f6f5633eb126ae5fe7ac768299fe77d..f829fd935b7901b82649a9d3307b46add1aa2ed5 100644 (file)
@@ -110,6 +110,9 @@ struct mlx4_ib_cq {
        struct mutex            resize_mutex;
        struct ib_umem         *umem;
        struct ib_umem         *resize_umem;
+       /* List of qps that it serves.*/
+       struct list_head                send_qp_list;
+       struct list_head                recv_qp_list;
 };
 
 struct mlx4_ib_mr {
@@ -134,10 +137,17 @@ struct mlx4_ib_fmr {
        struct mlx4_fmr         mfmr;
 };
 
+#define MAX_REGS_PER_FLOW 2
+
+struct mlx4_flow_reg_id {
+       u64 id;
+       u64 mirror;
+};
+
 struct mlx4_ib_flow {
        struct ib_flow ibflow;
        /* translating DMFS verbs sniffer rule to FW API requires two reg IDs */
-       u64 reg_id[2];
+       struct mlx4_flow_reg_id reg_id[MAX_REGS_PER_FLOW];
 };
 
 struct mlx4_ib_wq {
@@ -293,6 +303,9 @@ struct mlx4_ib_qp {
        struct mlx4_roce_smac_vlan_info pri;
        struct mlx4_roce_smac_vlan_info alt;
        u64                     reg_id;
+       struct list_head        qps_list;
+       struct list_head        cq_recv_list;
+       struct list_head        cq_send_list;
 };
 
 struct mlx4_ib_srq {
@@ -527,6 +540,10 @@ struct mlx4_ib_dev {
        struct mlx4_ib_qp      *qp1_proxy[MLX4_MAX_PORTS];
        /* lock when destroying qp1_proxy and getting netdev events */
        struct mutex            qp1_proxy_lock[MLX4_MAX_PORTS];
+       u8                      bond_next_port;
+       /* protect resources needed as part of reset flow */
+       spinlock_t              reset_flow_resource_lock;
+       struct list_head                qp_list;
 };
 
 struct ib_event_work {
@@ -622,6 +639,13 @@ static inline struct mlx4_ib_ah *to_mah(struct ib_ah *ibah)
        return container_of(ibah, struct mlx4_ib_ah, ibah);
 }
 
+static inline u8 mlx4_ib_bond_next_port(struct mlx4_ib_dev *dev)
+{
+       dev->bond_next_port = (dev->bond_next_port + 1) % dev->num_ports;
+
+       return dev->bond_next_port + 1;
+}
+
 int mlx4_ib_init_sriov(struct mlx4_ib_dev *dev);
 void mlx4_ib_close_sriov(struct mlx4_ib_dev *dev);