/Linux-v6.6/drivers/infiniband/hw/hns/ |
D | hns_roce_main.c | 44 static int hns_roce_set_mac(struct hns_roce_dev *hr_dev, u32 port, in hns_roce_set_mac() argument 50 if (hr_dev->pci_dev->revision >= PCI_REVISION_ID_HIP09) in hns_roce_set_mac() 53 if (!memcmp(hr_dev->dev_addr[port], addr, ETH_ALEN)) in hns_roce_set_mac() 57 hr_dev->dev_addr[port][i] = addr[i]; in hns_roce_set_mac() 59 phy_port = hr_dev->iboe.phy_port[port]; in hns_roce_set_mac() 60 return hr_dev->hw->set_mac(hr_dev, phy_port, addr); in hns_roce_set_mac() 65 struct hns_roce_dev *hr_dev = to_hr_dev(attr->device); in hns_roce_add_gid() local 69 if (port >= hr_dev->caps.num_ports) in hns_roce_add_gid() 72 ret = hr_dev->hw->set_gid(hr_dev, attr->index, &attr->gid, attr); in hns_roce_add_gid() 79 struct hns_roce_dev *hr_dev = to_hr_dev(attr->device); in hns_roce_del_gid() local [all …]
|
D | hns_roce_cmd.c | 41 static int hns_roce_cmd_mbox_post_hw(struct hns_roce_dev *hr_dev, in hns_roce_cmd_mbox_post_hw() argument 44 return hr_dev->hw->post_mbox(hr_dev, mbox_msg); in hns_roce_cmd_mbox_post_hw() 48 static int __hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, in __hns_roce_cmd_mbox_poll() argument 53 ret = hns_roce_cmd_mbox_post_hw(hr_dev, mbox_msg); in __hns_roce_cmd_mbox_poll() 55 dev_err_ratelimited(hr_dev->dev, in __hns_roce_cmd_mbox_poll() 61 return hr_dev->hw->poll_mbox_done(hr_dev); in __hns_roce_cmd_mbox_poll() 64 static int hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, in hns_roce_cmd_mbox_poll() argument 69 down(&hr_dev->cmd.poll_sem); in hns_roce_cmd_mbox_poll() 70 ret = __hns_roce_cmd_mbox_poll(hr_dev, mbox_msg); in hns_roce_cmd_mbox_poll() 71 up(&hr_dev->cmd.poll_sem); in hns_roce_cmd_mbox_poll() [all …]
|
D | hns_roce_srq.c | 12 void hns_roce_srq_event(struct hns_roce_dev *hr_dev, u32 srqn, int event_type) in hns_roce_srq_event() argument 14 struct hns_roce_srq_table *srq_table = &hr_dev->srq_table; in hns_roce_srq_event() 18 srq = xa_load(&srq_table->xa, srqn & (hr_dev->caps.num_srqs - 1)); in hns_roce_srq_event() 24 dev_warn(hr_dev->dev, "Async event for bogus SRQ %08x\n", srqn); in hns_roce_srq_event() 37 struct hns_roce_dev *hr_dev = to_hr_dev(srq->ibsrq.device); in hns_roce_ib_srq_event() local 52 dev_err(hr_dev->dev, in hns_roce_ib_srq_event() 62 static int alloc_srqn(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq) in alloc_srqn() argument 64 struct hns_roce_ida *srq_ida = &hr_dev->srq_table.srq_ida; in alloc_srqn() 70 ibdev_err(&hr_dev->ib_dev, "failed to alloc srq(%d).\n", id); in alloc_srqn() 79 static void free_srqn(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq) in free_srqn() argument [all …]
|
D | hns_roce_cq.c | 58 static int alloc_cqn(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq) in alloc_cqn() argument 60 struct hns_roce_cq_table *cq_table = &hr_dev->cq_table; in alloc_cqn() 89 static void free_cqn(struct hns_roce_dev *hr_dev, unsigned long cqn) in free_cqn() argument 91 struct hns_roce_cq_table *cq_table = &hr_dev->cq_table; in free_cqn() 103 static int hns_roce_create_cqc(struct hns_roce_dev *hr_dev, in hns_roce_create_cqc() argument 107 struct ib_device *ibdev = &hr_dev->ib_dev; in hns_roce_create_cqc() 111 mailbox = hns_roce_alloc_cmd_mailbox(hr_dev); in hns_roce_create_cqc() 117 hr_dev->hw->write_cqc(hr_dev, hr_cq, mailbox->buf, mtts, dma_handle); in hns_roce_create_cqc() 119 ret = hns_roce_create_hw_ctx(hr_dev, mailbox, HNS_ROCE_CMD_CREATE_CQC, in hns_roce_create_cqc() 126 hns_roce_free_cmd_mailbox(hr_dev, mailbox); in hns_roce_create_cqc() [all …]
|
D | hns_roce_qp.c | 48 struct device *dev = flush_work->hr_dev->dev; in flush_work_handle() 71 void init_flush_work(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp) in init_flush_work() argument 75 flush_work->hr_dev = hr_dev; in init_flush_work() 78 queue_work(hr_dev->irq_workq, &flush_work->work); in init_flush_work() 96 void hns_roce_qp_event(struct hns_roce_dev *hr_dev, u32 qpn, int event_type) in hns_roce_qp_event() argument 98 struct device *dev = hr_dev->dev; in hns_roce_qp_event() 101 xa_lock(&hr_dev->qp_table_xa); in hns_roce_qp_event() 102 qp = __hns_roce_qp_lookup(hr_dev, qpn); in hns_roce_qp_event() 105 xa_unlock(&hr_dev->qp_table_xa); in hns_roce_qp_event() 119 flush_cqe(hr_dev, qp); in hns_roce_qp_event() [all …]
|
D | hns_roce_mr.c | 51 static int alloc_mr_key(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr) in alloc_mr_key() argument 53 struct hns_roce_ida *mtpt_ida = &hr_dev->mr_table.mtpt_ida; in alloc_mr_key() 54 struct ib_device *ibdev = &hr_dev->ib_dev; in alloc_mr_key() 68 err = hns_roce_table_get(hr_dev, &hr_dev->mr_table.mtpt_table, in alloc_mr_key() 81 static void free_mr_key(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr) in free_mr_key() argument 85 hns_roce_table_put(hr_dev, &hr_dev->mr_table.mtpt_table, obj); in free_mr_key() 86 ida_free(&hr_dev->mr_table.mtpt_ida.ida, (int)obj); in free_mr_key() 89 static int alloc_mr_pbl(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr, in alloc_mr_pbl() argument 92 struct ib_device *ibdev = &hr_dev->ib_dev; in alloc_mr_pbl() 97 mr->pbl_hop_num = is_fast ? 1 : hr_dev->caps.pbl_hop_num; in alloc_mr_pbl() [all …]
|
D | hns_roce_pd.c | 36 void hns_roce_init_pd_table(struct hns_roce_dev *hr_dev) in hns_roce_init_pd_table() argument 38 struct hns_roce_ida *pd_ida = &hr_dev->pd_ida; in hns_roce_init_pd_table() 41 pd_ida->max = hr_dev->caps.num_pds - 1; in hns_roce_init_pd_table() 42 pd_ida->min = hr_dev->caps.reserved_pds; in hns_roce_init_pd_table() 48 struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev); in hns_roce_alloc_pd() local 49 struct hns_roce_ida *pd_ida = &hr_dev->pd_ida; in hns_roce_alloc_pd() 78 struct hns_roce_dev *hr_dev = to_hr_dev(pd->device); in hns_roce_dealloc_pd() local 80 ida_free(&hr_dev->pd_ida.ida, (int)to_hr_pd(pd)->pdn); in hns_roce_dealloc_pd() 85 int hns_roce_uar_alloc(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar) in hns_roce_uar_alloc() argument 87 struct hns_roce_ida *uar_ida = &hr_dev->uar_ida; in hns_roce_uar_alloc() [all …]
|
D | hns_roce_hem.c | 48 bool hns_roce_check_whether_mhop(struct hns_roce_dev *hr_dev, u32 type) in hns_roce_check_whether_mhop() argument 54 hop_num = hr_dev->caps.qpc_hop_num; in hns_roce_check_whether_mhop() 57 hop_num = hr_dev->caps.mpt_hop_num; in hns_roce_check_whether_mhop() 60 hop_num = hr_dev->caps.cqc_hop_num; in hns_roce_check_whether_mhop() 63 hop_num = hr_dev->caps.srqc_hop_num; in hns_roce_check_whether_mhop() 66 hop_num = hr_dev->caps.sccc_hop_num; in hns_roce_check_whether_mhop() 69 hop_num = hr_dev->caps.qpc_timer_hop_num; in hns_roce_check_whether_mhop() 72 hop_num = hr_dev->caps.cqc_timer_hop_num; in hns_roce_check_whether_mhop() 75 hop_num = hr_dev->caps.gmv_hop_num; in hns_roce_check_whether_mhop() 122 static int get_hem_table_config(struct hns_roce_dev *hr_dev, in get_hem_table_config() argument [all …]
|
D | hns_roce_hw_v2.c | 270 struct hns_roce_dev *hr_dev = to_hr_dev(qp->ibqp.device); in check_inl_data_len() local 274 ibdev_err(&hr_dev->ib_dev, in check_inl_data_len() 287 struct hns_roce_dev *hr_dev = to_hr_dev(qp->ibqp.device); in set_rc_inl() local 289 struct ib_device *ibdev = &hr_dev->ib_dev; in set_rc_inl() 372 static int check_send_valid(struct hns_roce_dev *hr_dev, in check_send_valid() argument 375 struct ib_device *ibdev = &hr_dev->ib_dev; in check_send_valid() 383 } else if (unlikely(hr_dev->state >= HNS_ROCE_DEVICE_STATE_RST_DOWN)) { in check_send_valid() 385 hr_dev->state); in check_send_valid() 440 struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev); in fill_ud_av() local 457 if (hr_dev->pci_dev->revision >= PCI_REVISION_ID_HIP09) in fill_ud_av() [all …]
|
D | hns_roce_alloc.c | 38 void hns_roce_buf_free(struct hns_roce_dev *hr_dev, struct hns_roce_buf *buf) in hns_roce_buf_free() argument 50 dma_free_coherent(hr_dev->dev, 1 << buf->trunk_shift, in hns_roce_buf_free() 66 struct hns_roce_buf *hns_roce_buf_alloc(struct hns_roce_dev *hr_dev, u32 size, in hns_roce_buf_alloc() argument 105 trunks[i].buf = dma_alloc_coherent(hr_dev->dev, trunk_size, in hns_roce_buf_alloc() 118 dma_free_coherent(hr_dev->dev, trunk_size, in hns_roce_buf_alloc() 132 int hns_roce_get_kmem_bufs(struct hns_roce_dev *hr_dev, dma_addr_t *bufs, in hns_roce_get_kmem_bufs() argument 141 dev_err(hr_dev->dev, "failed to check kmem buf shift %u > %u\n", in hns_roce_get_kmem_bufs() 156 int hns_roce_get_umem_bufs(struct hns_roce_dev *hr_dev, dma_addr_t *bufs, in hns_roce_get_umem_bufs() argument 174 void hns_roce_cleanup_bitmap(struct hns_roce_dev *hr_dev) in hns_roce_cleanup_bitmap() argument 176 if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_XRC) in hns_roce_cleanup_bitmap() [all …]
|
D | hns_roce_device.h | 577 struct hns_roce_dev *hr_dev; member 673 struct hns_roce_dev *hr_dev; member 870 int (*cmq_init)(struct hns_roce_dev *hr_dev); 871 void (*cmq_exit)(struct hns_roce_dev *hr_dev); 872 int (*hw_profile)(struct hns_roce_dev *hr_dev); 873 int (*hw_init)(struct hns_roce_dev *hr_dev); 874 void (*hw_exit)(struct hns_roce_dev *hr_dev); 875 int (*post_mbox)(struct hns_roce_dev *hr_dev, 877 int (*poll_mbox_done)(struct hns_roce_dev *hr_dev); 878 bool (*chk_mbox_avail)(struct hns_roce_dev *hr_dev, bool *is_busy); [all …]
|
D | hns_roce_hem.h | 104 void hns_roce_free_hem(struct hns_roce_dev *hr_dev, struct hns_roce_hem *hem); 105 int hns_roce_table_get(struct hns_roce_dev *hr_dev, 107 void hns_roce_table_put(struct hns_roce_dev *hr_dev, 109 void *hns_roce_table_find(struct hns_roce_dev *hr_dev, 112 int hns_roce_init_hem_table(struct hns_roce_dev *hr_dev, 115 void hns_roce_cleanup_hem_table(struct hns_roce_dev *hr_dev, 117 void hns_roce_cleanup_hem(struct hns_roce_dev *hr_dev); 118 int hns_roce_calc_hem_mhop(struct hns_roce_dev *hr_dev, 121 bool hns_roce_check_whether_mhop(struct hns_roce_dev *hr_dev, u32 type); 126 int hns_roce_hem_list_request(struct hns_roce_dev *hr_dev, [all …]
|
D | hns_roce_restrack.c | 45 struct hns_roce_dev *hr_dev = to_hr_dev(ib_cq->device); in hns_roce_fill_res_cq_entry_raw() local 50 if (!hr_dev->hw->query_cqc) in hns_roce_fill_res_cq_entry_raw() 53 ret = hr_dev->hw->query_cqc(hr_dev, hr_cq->cqn, &context); in hns_roce_fill_res_cq_entry_raw() 98 struct hns_roce_dev *hr_dev = to_hr_dev(ib_qp->device); in hns_roce_fill_res_qp_entry_raw() local 103 if (!hr_dev->hw->query_qpc) in hns_roce_fill_res_qp_entry_raw() 106 ret = hr_dev->hw->query_qpc(hr_dev, hr_qp->qpn, &context); in hns_roce_fill_res_qp_entry_raw() 147 struct hns_roce_dev *hr_dev = to_hr_dev(ib_mr->device); in hns_roce_fill_res_mr_entry_raw() local 152 if (!hr_dev->hw->query_mpt) in hns_roce_fill_res_mr_entry_raw() 155 ret = hr_dev->hw->query_mpt(hr_dev, hr_mr->key, &context); in hns_roce_fill_res_mr_entry_raw()
|
D | hns_roce_db.c | 124 int hns_roce_alloc_db(struct hns_roce_dev *hr_dev, struct hns_roce_db *db, in hns_roce_alloc_db() argument 130 mutex_lock(&hr_dev->pgdir_mutex); in hns_roce_alloc_db() 132 list_for_each_entry(pgdir, &hr_dev->pgdir_list, list) in hns_roce_alloc_db() 136 pgdir = hns_roce_alloc_db_pgdir(hr_dev->dev); in hns_roce_alloc_db() 142 list_add(&pgdir->list, &hr_dev->pgdir_list); in hns_roce_alloc_db() 148 mutex_unlock(&hr_dev->pgdir_mutex); in hns_roce_alloc_db() 153 void hns_roce_free_db(struct hns_roce_dev *hr_dev, struct hns_roce_db *db) in hns_roce_free_db() argument 158 mutex_lock(&hr_dev->pgdir_mutex); in hns_roce_free_db() 173 dma_free_coherent(hr_dev->dev, PAGE_SIZE, db->u.pgdir->page, in hns_roce_free_db() 179 mutex_unlock(&hr_dev->pgdir_mutex); in hns_roce_free_db()
|
D | hns_roce_cmd.h | 142 int hns_roce_cmd_mbox(struct hns_roce_dev *hr_dev, u64 in_param, u64 out_param, 146 hns_roce_alloc_cmd_mailbox(struct hns_roce_dev *hr_dev); 147 void hns_roce_free_cmd_mailbox(struct hns_roce_dev *hr_dev,
|
D | hns_roce_ah.c | 57 struct hns_roce_dev *hr_dev = to_hr_dev(ibah->device); in hns_roce_create_ah() local 61 if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP08 && udata) in hns_roce_create_ah() 80 if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP08) { in hns_roce_create_ah()
|
D | hns_roce_hw_v2.h | 1437 static inline void hns_roce_write64(struct hns_roce_dev *hr_dev, __le32 val[2], in hns_roce_write64() argument 1440 struct hns_roce_v2_priv *priv = hr_dev->priv; in hns_roce_write64() 1444 if (!hr_dev->dis_db && !ops->get_hw_reset_stat(handle)) in hns_roce_write64()
|