RDMA/hns: Move HIP06 related definitions into hns_roce_hw_v1.h
[linux-2.6-microblaze.git] / drivers / infiniband / hw / hns / hns_roce_device.h
index ffed82d..315c013 100644 (file)
@@ -54,6 +54,7 @@
 /* Hardware specification only for v1 engine */
 #define HNS_ROCE_MIN_CQE_NUM                   0x40
 #define HNS_ROCE_MIN_WQE_NUM                   0x20
+#define HNS_ROCE_MIN_SRQ_WQE_NUM               1
 
 /* Hardware specification only for v1 engine */
 #define HNS_ROCE_MAX_INNER_MTPT_NUM            0x7
@@ -65,6 +66,8 @@
 #define HNS_ROCE_CQE_WCMD_EMPTY_BIT            0x2
 #define HNS_ROCE_MIN_CQE_CNT                   16
 
+#define HNS_ROCE_RESERVED_SGE                  1
+
 #define HNS_ROCE_MAX_IRQ_NUM                   128
 
 #define HNS_ROCE_SGE_IN_WQE                    2
@@ -90,6 +93,7 @@
 #define HNS_ROCE_MAX_PORTS                     6
 #define HNS_ROCE_GID_SIZE                      16
 #define HNS_ROCE_SGE_SIZE                      16
+#define HNS_ROCE_DWQE_SIZE                     65536
 
 #define HNS_ROCE_HOP_NUM_0                     0xff
 
@@ -166,44 +170,6 @@ enum hns_roce_event {
        HNS_ROCE_EVENT_TYPE_FLR                       = 0x15,
 };
 
-/* Local Work Queue Catastrophic Error,SUBTYPE 0x5 */
-enum {
-       HNS_ROCE_LWQCE_QPC_ERROR                = 1,
-       HNS_ROCE_LWQCE_MTU_ERROR                = 2,
-       HNS_ROCE_LWQCE_WQE_BA_ADDR_ERROR        = 3,
-       HNS_ROCE_LWQCE_WQE_ADDR_ERROR           = 4,
-       HNS_ROCE_LWQCE_SQ_WQE_SHIFT_ERROR       = 5,
-       HNS_ROCE_LWQCE_SL_ERROR                 = 6,
-       HNS_ROCE_LWQCE_PORT_ERROR               = 7,
-};
-
-/* Local Access Violation Work Queue Error,SUBTYPE 0x7 */
-enum {
-       HNS_ROCE_LAVWQE_R_KEY_VIOLATION         = 1,
-       HNS_ROCE_LAVWQE_LENGTH_ERROR            = 2,
-       HNS_ROCE_LAVWQE_VA_ERROR                = 3,
-       HNS_ROCE_LAVWQE_PD_ERROR                = 4,
-       HNS_ROCE_LAVWQE_RW_ACC_ERROR            = 5,
-       HNS_ROCE_LAVWQE_KEY_STATE_ERROR         = 6,
-       HNS_ROCE_LAVWQE_MR_OPERATION_ERROR      = 7,
-};
-
-/* DOORBELL overflow subtype */
-enum {
-       HNS_ROCE_DB_SUBTYPE_SDB_OVF             = 1,
-       HNS_ROCE_DB_SUBTYPE_SDB_ALM_OVF         = 2,
-       HNS_ROCE_DB_SUBTYPE_ODB_OVF             = 3,
-       HNS_ROCE_DB_SUBTYPE_ODB_ALM_OVF         = 4,
-       HNS_ROCE_DB_SUBTYPE_SDB_ALM_EMP         = 5,
-       HNS_ROCE_DB_SUBTYPE_ODB_ALM_EMP         = 6,
-};
-
-enum {
-       /* RQ&SRQ related operations */
-       HNS_ROCE_OPCODE_SEND_DATA_RECEIVE       = 0x06,
-       HNS_ROCE_OPCODE_RDMA_WITH_IMM_RECEIVE   = 0x07,
-};
-
 #define HNS_ROCE_CAP_FLAGS_EX_SHIFT 12
 
 enum {
@@ -256,9 +222,6 @@ enum {
 
 #define HNS_ROCE_CMD_SUCCESS                   1
 
-#define HNS_ROCE_PORT_DOWN                     0
-#define HNS_ROCE_PORT_UP                       1
-
 /* The minimum page size is 4K for hardware */
 #define HNS_HW_PAGE_SHIFT                      12
 #define HNS_HW_PAGE_SIZE                       (1 << HNS_HW_PAGE_SHIFT)
@@ -395,6 +358,7 @@ struct hns_roce_wq {
        spinlock_t      lock;
        u32             wqe_cnt;  /* WQE num */
        u32             max_gs;
+       u32             rsv_sge;
        int             offset;
        int             wqe_shift;      /* WQE size */
        u32             head;
@@ -491,6 +455,8 @@ struct hns_roce_idx_que {
        struct hns_roce_mtr             mtr;
        int                             entry_shift;
        unsigned long                   *bitmap;
+       u32                             head;
+       u32                             tail;
 };
 
 struct hns_roce_srq {
@@ -498,7 +464,9 @@ struct hns_roce_srq {
        unsigned long           srqn;
        u32                     wqe_cnt;
        int                     max_gs;
+       u32                     rsv_sge;
        int                     wqe_shift;
+       u32                     cqn;
        void __iomem            *db_reg_l;
 
        atomic_t                refcount;
@@ -509,8 +477,6 @@ struct hns_roce_srq {
        u64                    *wrid;
        struct hns_roce_idx_que idx_que;
        spinlock_t              lock;
-       u16                     head;
-       u16                     tail;
        struct mutex            mutex;
        void (*event)(struct hns_roce_srq *srq, enum hns_roce_event event);
 };
@@ -643,6 +609,10 @@ struct hns_roce_work {
        u32 queue_num;
 };
 
+enum {
+       HNS_ROCE_QP_CAP_DIRECT_WQE = BIT(5),
+};
+
 struct hns_roce_qp {
        struct ib_qp            ibqp;
        struct hns_roce_wq      rq;
@@ -650,7 +620,7 @@ struct hns_roce_qp {
        struct hns_roce_db      sdb;
        unsigned long           en_flags;
        u32                     doorbell_qpn;
-       u32                     sq_signal_bits;
+       enum ib_sig_type        sq_signal_bits;
        struct hns_roce_wq      sq;
 
        struct hns_roce_mtr     mtr;
@@ -914,8 +884,7 @@ struct hns_roce_hw {
        int (*write_mtpt)(struct hns_roce_dev *hr_dev, void *mb_buf,
                          struct hns_roce_mr *mr, unsigned long mtpt_idx);
        int (*rereg_write_mtpt)(struct hns_roce_dev *hr_dev,
-                               struct hns_roce_mr *mr, int flags, u32 pdn,
-                               int mr_access_flags, u64 iova, u64 size,
+                               struct hns_roce_mr *mr, int flags,
                                void *mb_buf);
        int (*frmr_write_mtpt)(struct hns_roce_dev *hr_dev, void *mb_buf,
                               struct hns_roce_mr *mr);
@@ -948,11 +917,7 @@ struct hns_roce_hw {
        int (*modify_cq)(struct ib_cq *cq, u16 cq_count, u16 cq_period);
        int (*init_eq)(struct hns_roce_dev *hr_dev);
        void (*cleanup_eq)(struct hns_roce_dev *hr_dev);
-       void (*write_srqc)(struct hns_roce_dev *hr_dev,
-                          struct hns_roce_srq *srq, u32 pdn, u16 xrcd, u32 cqn,
-                          void *mb_buf, u64 *mtts_wqe, u64 *mtts_idx,
-                          dma_addr_t dma_handle_wqe,
-                          dma_addr_t dma_handle_idx);
+       int (*write_srqc)(struct hns_roce_srq *srq, void *mb_buf);
        int (*modify_srq)(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr,
                       enum ib_srq_attr_mask srq_attr_mask,
                       struct ib_udata *udata);
@@ -985,6 +950,7 @@ struct hns_roce_dev {
        struct mutex            pgdir_mutex;
        int                     irq[HNS_ROCE_MAX_IRQ_NUM];
        u8 __iomem              *reg_base;
+       void __iomem            *mem_base;
        struct hns_roce_caps    caps;
        struct xarray           qp_table_xa;
 
@@ -1070,7 +1036,7 @@ static inline struct hns_roce_srq *to_hr_srq(struct ib_srq *ibsrq)
 
 static inline void hns_roce_write64_k(__le32 val[2], void __iomem *dest)
 {
-       __raw_writeq(*(u64 *) val, dest);
+       writeq(*(u64 *)val, dest);
 }
 
 static inline struct hns_roce_qp
@@ -1284,7 +1250,6 @@ u8 hns_get_gid_index(struct hns_roce_dev *hr_dev, u8 port, int gid_index);
 void hns_roce_handle_device_err(struct hns_roce_dev *hr_dev);
 int hns_roce_init(struct hns_roce_dev *hr_dev);
 void hns_roce_exit(struct hns_roce_dev *hr_dev);
-
 int hns_roce_fill_res_cq_entry(struct sk_buff *msg,
                               struct ib_cq *ib_cq);
 #endif /* _HNS_ROCE_DEVICE_H */