Skip to content

Commit 0425e3e

Browse files
Yixian Liujgunthorpe
authored andcommitted
RDMA/hns: Support flush cqe for hip08 in kernel space
According to IB protocol, there are some cases that work requests must return the flush error completion status through the completion queue. Due to hardware limitation, the driver needs to assist the flush process. This patch adds the support of flush cqe for hip08 in the cases that needed, such as poll cqe, post send, post recv and aeqe handle. The patch also considered the compatibility between kernel and user space. Signed-off-by: Yixian Liu <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 75da960 commit 0425e3e

File tree

5 files changed

+241
-20
lines changed

5 files changed

+241
-20
lines changed

drivers/infiniband/hw/hns/hns_roce_db.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ int hns_roce_db_map_user(struct hns_roce_ucontext *context, unsigned long virt,
4141
found:
4242
db->dma = sg_dma_address(page->umem->sg_head.sgl) +
4343
(virt & ~PAGE_MASK);
44+
page->umem->sg_head.sgl->offset = virt & ~PAGE_MASK;
45+
db->virt_addr = sg_virt(page->umem->sg_head.sgl);
4446
db->u.user_page = page;
4547
refcount_inc(&page->refcount);
4648

drivers/infiniband/hw/hns/hns_roce_device.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110

111111
enum {
112112
HNS_ROCE_SUPPORT_RQ_RECORD_DB = 1 << 0,
113+
HNS_ROCE_SUPPORT_SQ_RECORD_DB = 1 << 1,
113114
};
114115

115116
enum {
@@ -190,7 +191,8 @@ enum {
190191
HNS_ROCE_CAP_FLAG_REREG_MR = BIT(0),
191192
HNS_ROCE_CAP_FLAG_ROCE_V1_V2 = BIT(1),
192193
HNS_ROCE_CAP_FLAG_RQ_INLINE = BIT(2),
193-
HNS_ROCE_CAP_FLAG_RECORD_DB = BIT(3)
194+
HNS_ROCE_CAP_FLAG_RECORD_DB = BIT(3),
195+
HNS_ROCE_CAP_FLAG_SQ_RECORD_DB = BIT(4),
194196
};
195197

196198
enum hns_roce_mtt_type {
@@ -385,6 +387,7 @@ struct hns_roce_db {
385387
struct hns_roce_user_db_page *user_page;
386388
} u;
387389
dma_addr_t dma;
390+
void *virt_addr;
388391
int index;
389392
int order;
390393
};
@@ -524,7 +527,9 @@ struct hns_roce_qp {
524527
struct hns_roce_buf hr_buf;
525528
struct hns_roce_wq rq;
526529
struct hns_roce_db rdb;
530+
struct hns_roce_db sdb;
527531
u8 rdb_en;
532+
u8 sdb_en;
528533
u32 doorbell_qpn;
529534
__le32 sq_signal_bits;
530535
u32 sq_next_wqe;
@@ -641,6 +646,8 @@ struct hns_roce_eq {
641646
int shift;
642647
dma_addr_t cur_eqe_ba;
643648
dma_addr_t nxt_eqe_ba;
649+
int event_type;
650+
int sub_type;
644651
};
645652

646653
struct hns_roce_eq_table {
@@ -727,6 +734,14 @@ struct hns_roce_caps {
727734
u64 flags;
728735
};
729736

737+
struct hns_roce_work {
738+
struct hns_roce_dev *hr_dev;
739+
struct work_struct work;
740+
u32 qpn;
741+
int event_type;
742+
int sub_type;
743+
};
744+
730745
struct hns_roce_hw {
731746
int (*reset)(struct hns_roce_dev *hr_dev, bool enable);
732747
int (*cmq_init)(struct hns_roce_dev *hr_dev);
@@ -819,6 +834,7 @@ struct hns_roce_dev {
819834
u32 tptr_size; /*only for hw v1*/
820835
const struct hns_roce_hw *hw;
821836
void *priv;
837+
struct workqueue_struct *irq_workq;
822838
};
823839

824840
static inline struct hns_roce_dev *to_hr_dev(struct ib_device *ib_dev)

0 commit comments

Comments
 (0)