Home
last modified time | relevance | path

Searched refs:hr_dev (Results 1 – 19 of 19) sorted by relevance

/Linux-v5.4/drivers/infiniband/hw/hns/
Dhns_roce_main.c56 int hns_get_gid_index(struct hns_roce_dev *hr_dev, u8 port, int gid_index) in hns_get_gid_index() argument
58 return gid_index * hr_dev->caps.num_ports + port; in hns_get_gid_index()
61 static int hns_roce_set_mac(struct hns_roce_dev *hr_dev, u8 port, u8 *addr) in hns_roce_set_mac() argument
66 if (!memcmp(hr_dev->dev_addr[port], addr, ETH_ALEN)) in hns_roce_set_mac()
70 hr_dev->dev_addr[port][i] = addr[i]; in hns_roce_set_mac()
72 phy_port = hr_dev->iboe.phy_port[port]; in hns_roce_set_mac()
73 return hr_dev->hw->set_mac(hr_dev, phy_port, addr); in hns_roce_set_mac()
78 struct hns_roce_dev *hr_dev = to_hr_dev(attr->device); in hns_roce_add_gid() local
82 if (port >= hr_dev->caps.num_ports) in hns_roce_add_gid()
85 ret = hr_dev->hw->set_gid(hr_dev, port, attr->index, &attr->gid, attr); in hns_roce_add_gid()
[all …]
Dhns_roce_cq.c52 struct hns_roce_dev *hr_dev; in hns_roce_ib_cq_event() local
57 hr_dev = to_hr_dev(ibcq->device); in hns_roce_ib_cq_event()
62 dev_err(hr_dev->dev, in hns_roce_ib_cq_event()
84 static int hns_roce_cq_alloc(struct hns_roce_dev *hr_dev, int nent, in hns_roce_cq_alloc() argument
91 struct device *dev = hr_dev->dev; in hns_roce_cq_alloc()
96 cq_table = &hr_dev->cq_table; in hns_roce_cq_alloc()
99 if (hns_roce_check_whether_mhop(hr_dev, HEM_TYPE_CQE)) in hns_roce_cq_alloc()
100 mtt_table = &hr_dev->mr_table.mtt_cqe_table; in hns_roce_cq_alloc()
102 mtt_table = &hr_dev->mr_table.mtt_table; in hns_roce_cq_alloc()
104 mtts = hns_roce_table_find(hr_dev, mtt_table, in hns_roce_cq_alloc()
[all …]
Dhns_roce_cmd.c43 static int hns_roce_cmd_mbox_post_hw(struct hns_roce_dev *hr_dev, u64 in_param, in hns_roce_cmd_mbox_post_hw() argument
48 struct hns_roce_cmdq *cmd = &hr_dev->cmd; in hns_roce_cmd_mbox_post_hw()
52 ret = hr_dev->hw->post_mbox(hr_dev, in_param, out_param, in_modifier, in hns_roce_cmd_mbox_post_hw()
60 static int __hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, u64 in_param, in __hns_roce_cmd_mbox_poll() argument
65 struct device *dev = hr_dev->dev; in __hns_roce_cmd_mbox_poll()
68 ret = hns_roce_cmd_mbox_post_hw(hr_dev, in_param, out_param, in __hns_roce_cmd_mbox_poll()
76 return hr_dev->hw->chk_mbox(hr_dev, timeout); in __hns_roce_cmd_mbox_poll()
79 static int hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, u64 in_param, in hns_roce_cmd_mbox_poll() argument
85 down(&hr_dev->cmd.poll_sem); in hns_roce_cmd_mbox_poll()
86 ret = __hns_roce_cmd_mbox_poll(hr_dev, in_param, out_param, in_modifier, in hns_roce_cmd_mbox_poll()
[all …]
Dhns_roce_pd.c38 static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn) in hns_roce_pd_alloc() argument
40 return hns_roce_bitmap_alloc(&hr_dev->pd_bitmap, pdn) ? -ENOMEM : 0; in hns_roce_pd_alloc()
43 static void hns_roce_pd_free(struct hns_roce_dev *hr_dev, unsigned long pdn) in hns_roce_pd_free() argument
45 hns_roce_bitmap_free(&hr_dev->pd_bitmap, pdn, BITMAP_NO_RR); in hns_roce_pd_free()
48 int hns_roce_init_pd_table(struct hns_roce_dev *hr_dev) in hns_roce_init_pd_table() argument
50 return hns_roce_bitmap_init(&hr_dev->pd_bitmap, hr_dev->caps.num_pds, in hns_roce_init_pd_table()
51 hr_dev->caps.num_pds - 1, in hns_roce_init_pd_table()
52 hr_dev->caps.reserved_pds, 0); in hns_roce_init_pd_table()
55 void hns_roce_cleanup_pd_table(struct hns_roce_dev *hr_dev) in hns_roce_cleanup_pd_table() argument
57 hns_roce_bitmap_cleanup(&hr_dev->pd_bitmap); in hns_roce_cleanup_pd_table()
[all …]
Dhns_roce_srq.c12 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()
80 static int hns_roce_srq_alloc(struct hns_roce_dev *hr_dev, u32 pdn, u32 cqn, in hns_roce_srq_alloc() argument
84 struct hns_roce_srq_table *srq_table = &hr_dev->srq_table; in hns_roce_srq_alloc()
93 mtts_wqe = hns_roce_table_find(hr_dev, in hns_roce_srq_alloc()
94 &hr_dev->mr_table.mtt_srqwqe_table, in hns_roce_srq_alloc()
[all …]
Dhns_roce_mr.c51 static int hns_roce_sw2hw_mpt(struct hns_roce_dev *hr_dev, in hns_roce_sw2hw_mpt() argument
55 return hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, mpt_index, 0, in hns_roce_sw2hw_mpt()
60 int hns_roce_hw2sw_mpt(struct hns_roce_dev *hr_dev, in hns_roce_hw2sw_mpt() argument
64 return hns_roce_cmd_mbox(hr_dev, 0, mailbox ? mailbox->dma : 0, in hns_roce_hw2sw_mpt()
177 static int hns_roce_alloc_mtt_range(struct hns_roce_dev *hr_dev, int order, in hns_roce_alloc_mtt_range() argument
180 struct hns_roce_mr_table *mr_table = &hr_dev->mr_table; in hns_roce_alloc_mtt_range()
203 dev_err(hr_dev->dev, "Unsupport MTT table type: %d\n", in hns_roce_alloc_mtt_range()
212 if (hns_roce_table_get_range(hr_dev, table, *seg, in hns_roce_alloc_mtt_range()
221 int hns_roce_mtt_init(struct hns_roce_dev *hr_dev, int npages, int page_shift, in hns_roce_mtt_init() argument
243 ret = hns_roce_alloc_mtt_range(hr_dev, mtt->order, &mtt->first_seg, in hns_roce_mtt_init()
[all …]
Dhns_roce_hem.c42 bool hns_roce_check_whether_mhop(struct hns_roce_dev *hr_dev, u32 type) in hns_roce_check_whether_mhop() argument
48 hop_num = hr_dev->caps.qpc_hop_num; in hns_roce_check_whether_mhop()
51 hop_num = hr_dev->caps.mpt_hop_num; in hns_roce_check_whether_mhop()
54 hop_num = hr_dev->caps.cqc_hop_num; in hns_roce_check_whether_mhop()
57 hop_num = hr_dev->caps.srqc_hop_num; in hns_roce_check_whether_mhop()
60 hop_num = hr_dev->caps.sccc_hop_num; in hns_roce_check_whether_mhop()
63 hop_num = hr_dev->caps.qpc_timer_hop_num; in hns_roce_check_whether_mhop()
66 hop_num = hr_dev->caps.cqc_timer_hop_num; in hns_roce_check_whether_mhop()
69 hop_num = hr_dev->caps.cqe_hop_num; in hns_roce_check_whether_mhop()
72 hop_num = hr_dev->caps.mtt_hop_num; in hns_roce_check_whether_mhop()
[all …]
Dhns_roce_qp.c46 void hns_roce_qp_event(struct hns_roce_dev *hr_dev, u32 qpn, int event_type) in hns_roce_qp_event() argument
48 struct device *dev = hr_dev->dev; in hns_roce_qp_event()
51 xa_lock(&hr_dev->qp_table_xa); in hns_roce_qp_event()
52 qp = __hns_roce_qp_lookup(hr_dev, qpn); in hns_roce_qp_event()
55 xa_unlock(&hr_dev->qp_table_xa); in hns_roce_qp_event()
111 static int hns_roce_reserve_range_qp(struct hns_roce_dev *hr_dev, int cnt, in hns_roce_reserve_range_qp() argument
114 struct hns_roce_qp_table *qp_table = &hr_dev->qp_table; in hns_roce_reserve_range_qp()
142 static int hns_roce_gsi_qp_alloc(struct hns_roce_dev *hr_dev, unsigned long qpn, in hns_roce_gsi_qp_alloc() argument
145 struct xarray *xa = &hr_dev->qp_table_xa; in hns_roce_gsi_qp_alloc()
155 ret = xa_err(xa_store_irq(xa, hr_qp->qpn & (hr_dev->caps.num_qps - 1), in hns_roce_gsi_qp_alloc()
[all …]
Dhns_roce_hw_v1.c65 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in hns_roce_v1_post_send() local
71 struct device *dev = &hr_dev->pdev->dev; in hns_roce_v1_post_send()
140 smac = (u8 *)hr_dev->dev_addr[qp->port]; in hns_roce_v1_post_send()
186 hns_get_gid_index(hr_dev, qp->phy_port, in hns_roce_v1_post_send()
288 hr_dev->caps.max_sq_inline) { in hns_roce_v1_post_send()
293 hr_dev->caps.max_sq_inline); in hns_roce_v1_post_send()
360 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in hns_roce_v1_post_recv() local
361 struct device *dev = &hr_dev->pdev->dev; in hns_roce_v1_post_recv()
448 static void hns_roce_set_db_event_mode(struct hns_roce_dev *hr_dev, in hns_roce_set_db_event_mode() argument
454 val = roce_read(hr_dev, ROCEE_GLB_CFG_REG); in hns_roce_set_db_event_mode()
[all …]
Dhns_roce_hw_v2.c164 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in set_rwqe_data_seg() local
171 hr_dev->caps.max_sq_inline) { in set_rwqe_data_seg()
173 dev_err(hr_dev->dev, "inline len(1-%d)=%d, illegal", in set_rwqe_data_seg()
174 rc_sq_wqe->msg_len, hr_dev->caps.max_sq_inline); in set_rwqe_data_seg()
180 dev_err(hr_dev->dev, "Not support inline data!\n"); in set_rwqe_data_seg()
233 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in hns_roce_v2_post_send() local
239 struct device *dev = hr_dev->dev; in hns_roce_v2_post_send()
321 smac = (u8 *)hr_dev->dev_addr[qp->port]; in hns_roce_v2_post_send()
420 hns_get_gid_index(hr_dev, qp->phy_port, in hns_roce_v2_post_send()
589 hns_roce_write64(hr_dev, (__le32 *)&sq_db, qp->sq.db_reg_l); in hns_roce_v2_post_send()
[all …]
Dhns_roce_device.h755 struct hns_roce_dev *hr_dev; member
916 struct hns_roce_dev *hr_dev; member
925 int (*query_cqc_info)(struct hns_roce_dev *hr_dev, u32 cqn,
930 int (*reset)(struct hns_roce_dev *hr_dev, bool enable);
931 int (*cmq_init)(struct hns_roce_dev *hr_dev);
932 void (*cmq_exit)(struct hns_roce_dev *hr_dev);
933 int (*hw_profile)(struct hns_roce_dev *hr_dev);
934 int (*hw_init)(struct hns_roce_dev *hr_dev);
935 void (*hw_exit)(struct hns_roce_dev *hr_dev);
936 int (*post_mbox)(struct hns_roce_dev *hr_dev, u64 in_param,
[all …]
Dhns_roce_hem.h110 void hns_roce_free_hem(struct hns_roce_dev *hr_dev, struct hns_roce_hem *hem);
111 int hns_roce_table_get(struct hns_roce_dev *hr_dev,
113 void hns_roce_table_put(struct hns_roce_dev *hr_dev,
115 void *hns_roce_table_find(struct hns_roce_dev *hr_dev,
118 int hns_roce_table_get_range(struct hns_roce_dev *hr_dev,
121 void hns_roce_table_put_range(struct hns_roce_dev *hr_dev,
124 int hns_roce_init_hem_table(struct hns_roce_dev *hr_dev,
128 void hns_roce_cleanup_hem_table(struct hns_roce_dev *hr_dev,
130 void hns_roce_cleanup_hem(struct hns_roce_dev *hr_dev);
131 int hns_roce_calc_hem_mhop(struct hns_roce_dev *hr_dev,
[all …]
Dhns_roce_alloc.c160 void hns_roce_buf_free(struct hns_roce_dev *hr_dev, u32 size, in hns_roce_buf_free() argument
164 struct device *dev = hr_dev->dev; in hns_roce_buf_free()
178 int hns_roce_buf_alloc(struct hns_roce_dev *hr_dev, u32 size, u32 max_direct, in hns_roce_buf_alloc() argument
183 struct device *dev = hr_dev->dev; in hns_roce_buf_alloc()
236 hns_roce_buf_free(hr_dev, size, buf); in hns_roce_buf_alloc()
240 int hns_roce_get_kmem_bufs(struct hns_roce_dev *hr_dev, dma_addr_t *bufs, in hns_roce_get_kmem_bufs() argument
248 dev_err(hr_dev->dev, in hns_roce_get_kmem_bufs()
265 int hns_roce_get_umem_bufs(struct hns_roce_dev *hr_dev, dma_addr_t *bufs, in hns_roce_get_umem_bufs() argument
275 dev_err(hr_dev->dev, "invalid page shift %d!\n", page_shift); in hns_roce_get_umem_bufs()
338 void hns_roce_cleanup_bitmap(struct hns_roce_dev *hr_dev) in hns_roce_cleanup_bitmap() argument
[all …]
Dhns_roce_hw_v2_dfx.c9 int hns_roce_v2_query_cqc_info(struct hns_roce_dev *hr_dev, u32 cqn, in hns_roce_v2_query_cqc_info() argument
16 mailbox = hns_roce_alloc_cmd_mailbox(hr_dev); in hns_roce_v2_query_cqc_info()
21 ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, cqn, 0, in hns_roce_v2_query_cqc_info()
25 dev_err(hr_dev->dev, "QUERY cqc cmd process error\n"); in hns_roce_v2_query_cqc_info()
32 hns_roce_free_cmd_mailbox(hr_dev, mailbox); in hns_roce_v2_query_cqc_info()
Dhns_roce_db.c125 int hns_roce_alloc_db(struct hns_roce_dev *hr_dev, struct hns_roce_db *db, in hns_roce_alloc_db() argument
131 mutex_lock(&hr_dev->pgdir_mutex); in hns_roce_alloc_db()
133 list_for_each_entry(pgdir, &hr_dev->pgdir_list, list) in hns_roce_alloc_db()
137 pgdir = hns_roce_alloc_db_pgdir(hr_dev->dev); in hns_roce_alloc_db()
143 list_add(&pgdir->list, &hr_dev->pgdir_list); in hns_roce_alloc_db()
149 mutex_unlock(&hr_dev->pgdir_mutex); in hns_roce_alloc_db()
154 void hns_roce_free_db(struct hns_roce_dev *hr_dev, struct hns_roce_db *db) in hns_roce_free_db() argument
159 mutex_lock(&hr_dev->pgdir_mutex); in hns_roce_free_db()
174 dma_free_coherent(hr_dev->dev, PAGE_SIZE, db->u.pgdir->page, in hns_roce_free_db()
180 mutex_unlock(&hr_dev->pgdir_mutex); in hns_roce_free_db()
Dhns_roce_restrack.c83 struct hns_roce_dev *hr_dev = to_hr_dev(ib_cq->device); in hns_roce_fill_res_cq_entry() local
89 if (!hr_dev->dfx->query_cqc_info) in hns_roce_fill_res_cq_entry()
96 ret = hr_dev->dfx->query_cqc_info(hr_dev, hr_cq->cqn, (int *)context); in hns_roce_fill_res_cq_entry()
Dhns_roce_cmd.h142 int hns_roce_cmd_mbox(struct hns_roce_dev *hr_dev, u64 in_param, u64 out_param,
147 *hns_roce_alloc_cmd_mailbox(struct hns_roce_dev *hr_dev);
148 void hns_roce_free_cmd_mailbox(struct hns_roce_dev *hr_dev,
Dhns_roce_ah.c45 struct hns_roce_dev *hr_dev = to_hr_dev(ibah->device); in hns_roce_create_ah() local
47 struct device *dev = hr_dev->dev; in hns_roce_create_ah()
Dhns_roce_hw_v2.h1824 int hns_roce_v2_query_cqc_info(struct hns_roce_dev *hr_dev, u32 cqn,
1827 static inline void hns_roce_write64(struct hns_roce_dev *hr_dev, __le32 val[2], in hns_roce_write64() argument
1830 struct hns_roce_v2_priv *priv = (struct hns_roce_v2_priv *)hr_dev->priv; in hns_roce_write64()
1834 if (!hr_dev->dis_db && !ops->get_hw_reset_stat(handle)) in hns_roce_write64()