1db23ae64SCheng Xu /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2db23ae64SCheng Xu
3db23ae64SCheng Xu /* Authors: Cheng Xu <chengyou@linux.alibaba.com> */
4db23ae64SCheng Xu /* Kai Shen <kaishen@linux.alibaba.com> */
5db23ae64SCheng Xu /* Copyright (c) 2020-2022, Alibaba Group. */
6db23ae64SCheng Xu
7db23ae64SCheng Xu #ifndef __ERDMA_VERBS_H__
8db23ae64SCheng Xu #define __ERDMA_VERBS_H__
9db23ae64SCheng Xu
10db23ae64SCheng Xu #include "erdma.h"
11db23ae64SCheng Xu
12db23ae64SCheng Xu /* RDMA Capability. */
13db23ae64SCheng Xu #define ERDMA_MAX_PD (128 * 1024)
146256aa9aSCheng Xu #define ERDMA_MAX_SEND_WR 8192
15db23ae64SCheng Xu #define ERDMA_MAX_ORD 128
16db23ae64SCheng Xu #define ERDMA_MAX_IRD 128
17db23ae64SCheng Xu #define ERDMA_MAX_SGE_RD 1
18db23ae64SCheng Xu #define ERDMA_MAX_CONTEXT (128 * 1024)
19db23ae64SCheng Xu #define ERDMA_MAX_SEND_SGE 6
20db23ae64SCheng Xu #define ERDMA_MAX_RECV_SGE 1
21db23ae64SCheng Xu #define ERDMA_MAX_INLINE (sizeof(struct erdma_sge) * (ERDMA_MAX_SEND_SGE))
22db23ae64SCheng Xu #define ERDMA_MAX_FRMR_PA 512
23db23ae64SCheng Xu
24db23ae64SCheng Xu enum {
25db23ae64SCheng Xu ERDMA_MMAP_IO_NC = 0, /* no cache */
26db23ae64SCheng Xu };
27db23ae64SCheng Xu
28db23ae64SCheng Xu struct erdma_user_mmap_entry {
29db23ae64SCheng Xu struct rdma_user_mmap_entry rdma_entry;
30db23ae64SCheng Xu u64 address;
31db23ae64SCheng Xu u8 mmap_flag;
32db23ae64SCheng Xu };
33db23ae64SCheng Xu
347e9a1dadSCheng Xu struct erdma_ext_db_info {
357e9a1dadSCheng Xu bool enable;
367e9a1dadSCheng Xu u16 sdb_off;
377e9a1dadSCheng Xu u16 rdb_off;
387e9a1dadSCheng Xu u16 cdb_off;
397e9a1dadSCheng Xu };
407e9a1dadSCheng Xu
41db23ae64SCheng Xu struct erdma_ucontext {
42db23ae64SCheng Xu struct ib_ucontext ibucontext;
43db23ae64SCheng Xu
447e9a1dadSCheng Xu struct erdma_ext_db_info ext_db;
457e9a1dadSCheng Xu
46db23ae64SCheng Xu u64 sdb;
47db23ae64SCheng Xu u64 rdb;
48db23ae64SCheng Xu u64 cdb;
49db23ae64SCheng Xu
50db23ae64SCheng Xu struct rdma_user_mmap_entry *sq_db_mmap_entry;
51db23ae64SCheng Xu struct rdma_user_mmap_entry *rq_db_mmap_entry;
52db23ae64SCheng Xu struct rdma_user_mmap_entry *cq_db_mmap_entry;
53db23ae64SCheng Xu
54db23ae64SCheng Xu /* doorbell records */
55db23ae64SCheng Xu struct list_head dbrecords_page_list;
56db23ae64SCheng Xu struct mutex dbrecords_page_mutex;
57db23ae64SCheng Xu };
58db23ae64SCheng Xu
59db23ae64SCheng Xu struct erdma_pd {
60db23ae64SCheng Xu struct ib_pd ibpd;
61db23ae64SCheng Xu u32 pdn;
62db23ae64SCheng Xu };
63db23ae64SCheng Xu
64db23ae64SCheng Xu /*
65db23ae64SCheng Xu * MemoryRegion definition.
66db23ae64SCheng Xu */
67db23ae64SCheng Xu #define ERDMA_MAX_INLINE_MTT_ENTRIES 4
687244b4aaSCheng Xu #define MTT_SIZE(mtt_cnt) ((mtt_cnt) << 3) /* per mtt entry takes 8 Bytes. */
69db23ae64SCheng Xu #define ERDMA_MR_MAX_MTT_CNT 524288
70db23ae64SCheng Xu #define ERDMA_MTT_ENTRY_SIZE 8
71db23ae64SCheng Xu
72db23ae64SCheng Xu #define ERDMA_MR_TYPE_NORMAL 0
73db23ae64SCheng Xu #define ERDMA_MR_TYPE_FRMR 1
74db23ae64SCheng Xu #define ERDMA_MR_TYPE_DMA 2
75db23ae64SCheng Xu
76ed10435dSCheng Xu #define ERDMA_MR_MTT_0LEVEL 0
77ed10435dSCheng Xu #define ERDMA_MR_MTT_1LEVEL 1
78db23ae64SCheng Xu
79ece43fadSCheng Xu #define ERDMA_MR_ACC_RA BIT(0)
80ece43fadSCheng Xu #define ERDMA_MR_ACC_LR BIT(1)
81ece43fadSCheng Xu #define ERDMA_MR_ACC_LW BIT(2)
82ece43fadSCheng Xu #define ERDMA_MR_ACC_RR BIT(3)
83ece43fadSCheng Xu #define ERDMA_MR_ACC_RW BIT(4)
84db23ae64SCheng Xu
to_erdma_access_flags(int access)85db23ae64SCheng Xu static inline u8 to_erdma_access_flags(int access)
86db23ae64SCheng Xu {
87db23ae64SCheng Xu return (access & IB_ACCESS_REMOTE_READ ? ERDMA_MR_ACC_RR : 0) |
88db23ae64SCheng Xu (access & IB_ACCESS_LOCAL_WRITE ? ERDMA_MR_ACC_LW : 0) |
89ece43fadSCheng Xu (access & IB_ACCESS_REMOTE_WRITE ? ERDMA_MR_ACC_RW : 0) |
90ece43fadSCheng Xu (access & IB_ACCESS_REMOTE_ATOMIC ? ERDMA_MR_ACC_RA : 0);
91db23ae64SCheng Xu }
92db23ae64SCheng Xu
937244b4aaSCheng Xu /* Hierarchical storage structure for MTT entries */
947244b4aaSCheng Xu struct erdma_mtt {
957244b4aaSCheng Xu u64 *buf;
967244b4aaSCheng Xu size_t size;
977244b4aaSCheng Xu
987244b4aaSCheng Xu bool continuous;
997244b4aaSCheng Xu union {
1007244b4aaSCheng Xu dma_addr_t buf_dma;
1017244b4aaSCheng Xu struct {
1027244b4aaSCheng Xu struct scatterlist *sglist;
1037244b4aaSCheng Xu u32 nsg;
1047244b4aaSCheng Xu u32 level;
1057244b4aaSCheng Xu };
1067244b4aaSCheng Xu };
1077244b4aaSCheng Xu
1087244b4aaSCheng Xu struct erdma_mtt *low_level;
1097244b4aaSCheng Xu };
1107244b4aaSCheng Xu
111db23ae64SCheng Xu struct erdma_mem {
112db23ae64SCheng Xu struct ib_umem *umem;
1137244b4aaSCheng Xu struct erdma_mtt *mtt;
1147244b4aaSCheng Xu
115db23ae64SCheng Xu u32 page_size;
116db23ae64SCheng Xu u32 page_offset;
117db23ae64SCheng Xu u32 page_cnt;
118db23ae64SCheng Xu u32 mtt_nents;
119db23ae64SCheng Xu
120db23ae64SCheng Xu u64 va;
121db23ae64SCheng Xu u64 len;
122db23ae64SCheng Xu };
123db23ae64SCheng Xu
124db23ae64SCheng Xu struct erdma_mr {
125db23ae64SCheng Xu struct ib_mr ibmr;
126db23ae64SCheng Xu struct erdma_mem mem;
127db23ae64SCheng Xu u8 type;
128db23ae64SCheng Xu u8 access;
129db23ae64SCheng Xu u8 valid;
130db23ae64SCheng Xu };
131db23ae64SCheng Xu
132db23ae64SCheng Xu struct erdma_user_dbrecords_page {
133db23ae64SCheng Xu struct list_head list;
134db23ae64SCheng Xu struct ib_umem *umem;
135db23ae64SCheng Xu u64 va;
136db23ae64SCheng Xu int refcnt;
137db23ae64SCheng Xu };
138db23ae64SCheng Xu
139db23ae64SCheng Xu struct erdma_uqp {
140d7cfbba9SCheng Xu struct erdma_mem sq_mem;
141d7cfbba9SCheng Xu struct erdma_mem rq_mem;
142db23ae64SCheng Xu
143fdb09ed1SBoshi Yu dma_addr_t sq_dbrec_dma;
144fdb09ed1SBoshi Yu dma_addr_t rq_dbrec_dma;
145db23ae64SCheng Xu
146db23ae64SCheng Xu struct erdma_user_dbrecords_page *user_dbr_page;
147db23ae64SCheng Xu
148db23ae64SCheng Xu u32 rq_offset;
149db23ae64SCheng Xu };
150db23ae64SCheng Xu
151db23ae64SCheng Xu struct erdma_kqp {
152db23ae64SCheng Xu u16 sq_pi;
153db23ae64SCheng Xu u16 sq_ci;
154db23ae64SCheng Xu
155db23ae64SCheng Xu u16 rq_pi;
156db23ae64SCheng Xu u16 rq_ci;
157db23ae64SCheng Xu
158db23ae64SCheng Xu u64 *swr_tbl;
159db23ae64SCheng Xu u64 *rwr_tbl;
160db23ae64SCheng Xu
161db23ae64SCheng Xu void __iomem *hw_sq_db;
162db23ae64SCheng Xu void __iomem *hw_rq_db;
163db23ae64SCheng Xu
164db23ae64SCheng Xu void *sq_buf;
165db23ae64SCheng Xu dma_addr_t sq_buf_dma_addr;
166db23ae64SCheng Xu
167db23ae64SCheng Xu void *rq_buf;
168db23ae64SCheng Xu dma_addr_t rq_buf_dma_addr;
169db23ae64SCheng Xu
170fdb09ed1SBoshi Yu void *sq_dbrec;
171fdb09ed1SBoshi Yu void *rq_dbrec;
172db23ae64SCheng Xu
173fdb09ed1SBoshi Yu dma_addr_t sq_dbrec_dma;
174fdb09ed1SBoshi Yu dma_addr_t rq_dbrec_dma;
175f0697bf0SBoshi Yu
176db23ae64SCheng Xu u8 sig_all;
177db23ae64SCheng Xu };
178db23ae64SCheng Xu
179db23ae64SCheng Xu enum erdma_qp_state {
180db23ae64SCheng Xu ERDMA_QP_STATE_IDLE = 0,
181db23ae64SCheng Xu ERDMA_QP_STATE_RTR = 1,
182db23ae64SCheng Xu ERDMA_QP_STATE_RTS = 2,
183db23ae64SCheng Xu ERDMA_QP_STATE_CLOSING = 3,
184db23ae64SCheng Xu ERDMA_QP_STATE_TERMINATE = 4,
185db23ae64SCheng Xu ERDMA_QP_STATE_ERROR = 5,
186db23ae64SCheng Xu ERDMA_QP_STATE_UNDEF = 7,
187db23ae64SCheng Xu ERDMA_QP_STATE_COUNT = 8
188db23ae64SCheng Xu };
189db23ae64SCheng Xu
190db23ae64SCheng Xu enum erdma_qp_attr_mask {
191db23ae64SCheng Xu ERDMA_QP_ATTR_STATE = (1 << 0),
192db23ae64SCheng Xu ERDMA_QP_ATTR_LLP_HANDLE = (1 << 2),
193db23ae64SCheng Xu ERDMA_QP_ATTR_ORD = (1 << 3),
194db23ae64SCheng Xu ERDMA_QP_ATTR_IRD = (1 << 4),
195db23ae64SCheng Xu ERDMA_QP_ATTR_SQ_SIZE = (1 << 5),
196db23ae64SCheng Xu ERDMA_QP_ATTR_RQ_SIZE = (1 << 6),
197db23ae64SCheng Xu ERDMA_QP_ATTR_MPA = (1 << 7)
198db23ae64SCheng Xu };
199db23ae64SCheng Xu
2000edf42cbSCheng Xu enum erdma_qp_flags {
2010edf42cbSCheng Xu ERDMA_QP_IN_FLUSHING = (1 << 0),
2020edf42cbSCheng Xu };
2030edf42cbSCheng Xu
204db23ae64SCheng Xu struct erdma_qp_attrs {
205db23ae64SCheng Xu enum erdma_qp_state state;
206db23ae64SCheng Xu enum erdma_cc_alg cc; /* Congestion control algorithm */
207db23ae64SCheng Xu u32 sq_size;
208db23ae64SCheng Xu u32 rq_size;
209db23ae64SCheng Xu u32 orq_size;
210db23ae64SCheng Xu u32 irq_size;
211db23ae64SCheng Xu u32 max_send_sge;
212db23ae64SCheng Xu u32 max_recv_sge;
213db23ae64SCheng Xu u32 cookie;
214db23ae64SCheng Xu #define ERDMA_QP_ACTIVE 0
215db23ae64SCheng Xu #define ERDMA_QP_PASSIVE 1
216db23ae64SCheng Xu u8 qp_type;
217db23ae64SCheng Xu u8 pd_len;
218db23ae64SCheng Xu };
219db23ae64SCheng Xu
220db23ae64SCheng Xu struct erdma_qp {
221db23ae64SCheng Xu struct ib_qp ibqp;
222db23ae64SCheng Xu struct kref ref;
223db23ae64SCheng Xu struct completion safe_free;
224db23ae64SCheng Xu struct erdma_dev *dev;
225db23ae64SCheng Xu struct erdma_cep *cep;
226db23ae64SCheng Xu struct rw_semaphore state_lock;
227db23ae64SCheng Xu
2280edf42cbSCheng Xu unsigned long flags;
22954d8fffcSCheng Xu struct delayed_work reflush_dwork;
23054d8fffcSCheng Xu
231db23ae64SCheng Xu union {
232db23ae64SCheng Xu struct erdma_kqp kern_qp;
233db23ae64SCheng Xu struct erdma_uqp user_qp;
234db23ae64SCheng Xu };
235db23ae64SCheng Xu
236db23ae64SCheng Xu struct erdma_cq *scq;
237db23ae64SCheng Xu struct erdma_cq *rcq;
238db23ae64SCheng Xu
239db23ae64SCheng Xu struct erdma_qp_attrs attrs;
240db23ae64SCheng Xu spinlock_t lock;
241db23ae64SCheng Xu };
242db23ae64SCheng Xu
243db23ae64SCheng Xu struct erdma_kcq_info {
244db23ae64SCheng Xu void *qbuf;
245db23ae64SCheng Xu dma_addr_t qbuf_dma_addr;
246db23ae64SCheng Xu u32 ci;
247db23ae64SCheng Xu u32 cmdsn;
248db23ae64SCheng Xu u32 notify_cnt;
249db23ae64SCheng Xu
250db23ae64SCheng Xu spinlock_t lock;
251db23ae64SCheng Xu u8 __iomem *db;
252fdb09ed1SBoshi Yu u64 *dbrec;
253fdb09ed1SBoshi Yu dma_addr_t dbrec_dma;
254db23ae64SCheng Xu };
255db23ae64SCheng Xu
256db23ae64SCheng Xu struct erdma_ucq_info {
257d7cfbba9SCheng Xu struct erdma_mem qbuf_mem;
258db23ae64SCheng Xu struct erdma_user_dbrecords_page *user_dbr_page;
259fdb09ed1SBoshi Yu dma_addr_t dbrec_dma;
260db23ae64SCheng Xu };
261db23ae64SCheng Xu
262db23ae64SCheng Xu struct erdma_cq {
263db23ae64SCheng Xu struct ib_cq ibcq;
264db23ae64SCheng Xu u32 cqn;
265db23ae64SCheng Xu
266db23ae64SCheng Xu u32 depth;
267db23ae64SCheng Xu u32 assoc_eqn;
268db23ae64SCheng Xu
269db23ae64SCheng Xu union {
270db23ae64SCheng Xu struct erdma_kcq_info kern_cq;
271db23ae64SCheng Xu struct erdma_ucq_info user_cq;
272db23ae64SCheng Xu };
273db23ae64SCheng Xu };
274db23ae64SCheng Xu
275db23ae64SCheng Xu #define QP_ID(qp) ((qp)->ibqp.qp_num)
276db23ae64SCheng Xu
find_qp_by_qpn(struct erdma_dev * dev,int id)277db23ae64SCheng Xu static inline struct erdma_qp *find_qp_by_qpn(struct erdma_dev *dev, int id)
278db23ae64SCheng Xu {
279db23ae64SCheng Xu return (struct erdma_qp *)xa_load(&dev->qp_xa, id);
280db23ae64SCheng Xu }
281db23ae64SCheng Xu
find_cq_by_cqn(struct erdma_dev * dev,int id)282db23ae64SCheng Xu static inline struct erdma_cq *find_cq_by_cqn(struct erdma_dev *dev, int id)
283db23ae64SCheng Xu {
284db23ae64SCheng Xu return (struct erdma_cq *)xa_load(&dev->cq_xa, id);
285db23ae64SCheng Xu }
286db23ae64SCheng Xu
287db23ae64SCheng Xu void erdma_qp_get(struct erdma_qp *qp);
288db23ae64SCheng Xu void erdma_qp_put(struct erdma_qp *qp);
289db23ae64SCheng Xu int erdma_modify_qp_internal(struct erdma_qp *qp, struct erdma_qp_attrs *attrs,
290db23ae64SCheng Xu enum erdma_qp_attr_mask mask);
291db23ae64SCheng Xu void erdma_qp_llp_close(struct erdma_qp *qp);
292db23ae64SCheng Xu void erdma_qp_cm_drop(struct erdma_qp *qp);
293db23ae64SCheng Xu
to_ectx(struct ib_ucontext * ibctx)294db23ae64SCheng Xu static inline struct erdma_ucontext *to_ectx(struct ib_ucontext *ibctx)
295db23ae64SCheng Xu {
296db23ae64SCheng Xu return container_of(ibctx, struct erdma_ucontext, ibucontext);
297db23ae64SCheng Xu }
298db23ae64SCheng Xu
to_epd(struct ib_pd * pd)299db23ae64SCheng Xu static inline struct erdma_pd *to_epd(struct ib_pd *pd)
300db23ae64SCheng Xu {
301db23ae64SCheng Xu return container_of(pd, struct erdma_pd, ibpd);
302db23ae64SCheng Xu }
303db23ae64SCheng Xu
to_emr(struct ib_mr * ibmr)304db23ae64SCheng Xu static inline struct erdma_mr *to_emr(struct ib_mr *ibmr)
305db23ae64SCheng Xu {
306db23ae64SCheng Xu return container_of(ibmr, struct erdma_mr, ibmr);
307db23ae64SCheng Xu }
308db23ae64SCheng Xu
to_eqp(struct ib_qp * qp)309db23ae64SCheng Xu static inline struct erdma_qp *to_eqp(struct ib_qp *qp)
310db23ae64SCheng Xu {
311db23ae64SCheng Xu return container_of(qp, struct erdma_qp, ibqp);
312db23ae64SCheng Xu }
313db23ae64SCheng Xu
to_ecq(struct ib_cq * ibcq)314db23ae64SCheng Xu static inline struct erdma_cq *to_ecq(struct ib_cq *ibcq)
315db23ae64SCheng Xu {
316db23ae64SCheng Xu return container_of(ibcq, struct erdma_cq, ibcq);
317db23ae64SCheng Xu }
318db23ae64SCheng Xu
319db23ae64SCheng Xu static inline struct erdma_user_mmap_entry *
to_emmap(struct rdma_user_mmap_entry * ibmmap)320db23ae64SCheng Xu to_emmap(struct rdma_user_mmap_entry *ibmmap)
321db23ae64SCheng Xu {
322db23ae64SCheng Xu return container_of(ibmmap, struct erdma_user_mmap_entry, rdma_entry);
323db23ae64SCheng Xu }
324db23ae64SCheng Xu
325db23ae64SCheng Xu int erdma_alloc_ucontext(struct ib_ucontext *ibctx, struct ib_udata *data);
326db23ae64SCheng Xu void erdma_dealloc_ucontext(struct ib_ucontext *ibctx);
327db23ae64SCheng Xu int erdma_query_device(struct ib_device *dev, struct ib_device_attr *attr,
328db23ae64SCheng Xu struct ib_udata *data);
329db23ae64SCheng Xu int erdma_get_port_immutable(struct ib_device *dev, u32 port,
330db23ae64SCheng Xu struct ib_port_immutable *ib_port_immutable);
331db23ae64SCheng Xu int erdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
332dd6d7f85SAkiva Goldberger struct uverbs_attr_bundle *attrs);
333db23ae64SCheng Xu int erdma_query_port(struct ib_device *dev, u32 port,
334db23ae64SCheng Xu struct ib_port_attr *attr);
335db23ae64SCheng Xu int erdma_query_gid(struct ib_device *dev, u32 port, int idx,
336db23ae64SCheng Xu union ib_gid *gid);
337db23ae64SCheng Xu int erdma_alloc_pd(struct ib_pd *ibpd, struct ib_udata *data);
338db23ae64SCheng Xu int erdma_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata);
339db23ae64SCheng Xu int erdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr,
340db23ae64SCheng Xu struct ib_udata *data);
341db23ae64SCheng Xu int erdma_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int mask,
342db23ae64SCheng Xu struct ib_qp_init_attr *init_attr);
343db23ae64SCheng Xu int erdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int mask,
344db23ae64SCheng Xu struct ib_udata *data);
345db23ae64SCheng Xu int erdma_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata);
346db23ae64SCheng Xu int erdma_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata);
347*b80330f1SCheng Xu void erdma_disassociate_ucontext(struct ib_ucontext *ibcontext);
348db23ae64SCheng Xu int erdma_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags);
349db23ae64SCheng Xu struct ib_mr *erdma_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 len,
350db23ae64SCheng Xu u64 virt, int access, struct ib_udata *udata);
351db23ae64SCheng Xu struct ib_mr *erdma_get_dma_mr(struct ib_pd *ibpd, int rights);
352db23ae64SCheng Xu int erdma_dereg_mr(struct ib_mr *ibmr, struct ib_udata *data);
353db23ae64SCheng Xu int erdma_mmap(struct ib_ucontext *ctx, struct vm_area_struct *vma);
354db23ae64SCheng Xu void erdma_mmap_free(struct rdma_user_mmap_entry *rdma_entry);
355db23ae64SCheng Xu void erdma_qp_get_ref(struct ib_qp *ibqp);
356db23ae64SCheng Xu void erdma_qp_put_ref(struct ib_qp *ibqp);
357db23ae64SCheng Xu struct ib_qp *erdma_get_ibqp(struct ib_device *dev, int id);
358db23ae64SCheng Xu int erdma_post_send(struct ib_qp *ibqp, const struct ib_send_wr *send_wr,
359db23ae64SCheng Xu const struct ib_send_wr **bad_send_wr);
360db23ae64SCheng Xu int erdma_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *recv_wr,
361db23ae64SCheng Xu const struct ib_recv_wr **bad_recv_wr);
362db23ae64SCheng Xu int erdma_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc);
363db23ae64SCheng Xu struct ib_mr *erdma_ib_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type,
364db23ae64SCheng Xu u32 max_num_sg);
365db23ae64SCheng Xu int erdma_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents,
366db23ae64SCheng Xu unsigned int *sg_offset);
367db23ae64SCheng Xu void erdma_port_event(struct erdma_dev *dev, enum ib_event_type reason);
3689bdb9350SCheng Xu void erdma_set_mtu(struct erdma_dev *dev, u32 mtu);
36963a43a67SCheng Xu struct rdma_hw_stats *erdma_alloc_hw_port_stats(struct ib_device *device,
37063a43a67SCheng Xu u32 port_num);
37163a43a67SCheng Xu int erdma_get_hw_stats(struct ib_device *ibdev, struct rdma_hw_stats *stats,
37263a43a67SCheng Xu u32 port, int index);
373db23ae64SCheng Xu
374db23ae64SCheng Xu #endif
375