Loading...
Note: File does not exist in v3.1.
1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2/*
3 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
4 * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
5 */
6
7#ifndef RXE_LOC_H
8#define RXE_LOC_H
9
10/* rxe_av.c */
11void rxe_init_av(struct rdma_ah_attr *attr, struct rxe_av *av);
12int rxe_av_chk_attr(struct rxe_qp *qp, struct rdma_ah_attr *attr);
13int rxe_ah_chk_attr(struct rxe_ah *ah, struct rdma_ah_attr *attr);
14void rxe_av_from_attr(u8 port_num, struct rxe_av *av,
15 struct rdma_ah_attr *attr);
16void rxe_av_to_attr(struct rxe_av *av, struct rdma_ah_attr *attr);
17void rxe_av_fill_ip_info(struct rxe_av *av, struct rdma_ah_attr *attr);
18struct rxe_av *rxe_get_av(struct rxe_pkt_info *pkt, struct rxe_ah **ahp);
19
20/* rxe_cq.c */
21int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *cq,
22 int cqe, int comp_vector);
23
24int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe,
25 int comp_vector, struct ib_udata *udata,
26 struct rxe_create_cq_resp __user *uresp);
27
28int rxe_cq_resize_queue(struct rxe_cq *cq, int new_cqe,
29 struct rxe_resize_cq_resp __user *uresp,
30 struct ib_udata *udata);
31
32int rxe_cq_post(struct rxe_cq *cq, struct rxe_cqe *cqe, int solicited);
33
34void rxe_cq_disable(struct rxe_cq *cq);
35
36void rxe_cq_cleanup(struct rxe_pool_elem *elem);
37
38/* rxe_mcast.c */
39struct rxe_mcg *rxe_lookup_mcg(struct rxe_dev *rxe, union ib_gid *mgid);
40int rxe_attach_mcast(struct ib_qp *ibqp, union ib_gid *mgid, u16 mlid);
41int rxe_detach_mcast(struct ib_qp *ibqp, union ib_gid *mgid, u16 mlid);
42void rxe_cleanup_mcg(struct kref *kref);
43
44/* rxe_mmap.c */
45struct rxe_mmap_info {
46 struct list_head pending_mmaps;
47 struct ib_ucontext *context;
48 struct kref ref;
49 void *obj;
50
51 struct mminfo info;
52};
53
54void rxe_mmap_release(struct kref *ref);
55
56struct rxe_mmap_info *rxe_create_mmap_info(struct rxe_dev *dev, u32 size,
57 struct ib_udata *udata, void *obj);
58
59int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
60
61/* rxe_mr.c */
62u8 rxe_get_next_key(u32 last_key);
63void rxe_mr_init_dma(int access, struct rxe_mr *mr);
64int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
65 int access, struct rxe_mr *mr);
66int rxe_mr_init_fast(int max_pages, struct rxe_mr *mr);
67int rxe_flush_pmem_iova(struct rxe_mr *mr, u64 iova, int length);
68int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
69 enum rxe_mr_copy_dir dir);
70int copy_data(struct rxe_pd *pd, int access, struct rxe_dma_info *dma,
71 void *addr, int length, enum rxe_mr_copy_dir dir);
72void *iova_to_vaddr(struct rxe_mr *mr, u64 iova, int length);
73struct rxe_mr *lookup_mr(struct rxe_pd *pd, int access, u32 key,
74 enum rxe_mr_lookup_type type);
75int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length);
76int advance_dma_data(struct rxe_dma_info *dma, unsigned int length);
77int rxe_invalidate_mr(struct rxe_qp *qp, u32 key);
78int rxe_reg_fast_mr(struct rxe_qp *qp, struct rxe_send_wqe *wqe);
79int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata);
80void rxe_mr_cleanup(struct rxe_pool_elem *elem);
81
82/* rxe_mw.c */
83int rxe_alloc_mw(struct ib_mw *ibmw, struct ib_udata *udata);
84int rxe_dealloc_mw(struct ib_mw *ibmw);
85int rxe_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe);
86int rxe_invalidate_mw(struct rxe_qp *qp, u32 rkey);
87struct rxe_mw *rxe_lookup_mw(struct rxe_qp *qp, int access, u32 rkey);
88void rxe_mw_cleanup(struct rxe_pool_elem *elem);
89
90/* rxe_net.c */
91struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
92 int paylen, struct rxe_pkt_info *pkt);
93int rxe_prepare(struct rxe_av *av, struct rxe_pkt_info *pkt,
94 struct sk_buff *skb);
95int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
96 struct sk_buff *skb);
97const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num);
98
99/* rxe_qp.c */
100int rxe_qp_chk_init(struct rxe_dev *rxe, struct ib_qp_init_attr *init);
101int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd,
102 struct ib_qp_init_attr *init,
103 struct rxe_create_qp_resp __user *uresp,
104 struct ib_pd *ibpd, struct ib_udata *udata);
105int rxe_qp_to_init(struct rxe_qp *qp, struct ib_qp_init_attr *init);
106int rxe_qp_chk_attr(struct rxe_dev *rxe, struct rxe_qp *qp,
107 struct ib_qp_attr *attr, int mask);
108int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr,
109 int mask, struct ib_udata *udata);
110int rxe_qp_to_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask);
111void rxe_qp_error(struct rxe_qp *qp);
112int rxe_qp_chk_destroy(struct rxe_qp *qp);
113void rxe_qp_cleanup(struct rxe_pool_elem *elem);
114
115static inline int qp_num(struct rxe_qp *qp)
116{
117 return qp->ibqp.qp_num;
118}
119
120static inline enum ib_qp_type qp_type(struct rxe_qp *qp)
121{
122 return qp->ibqp.qp_type;
123}
124
125static inline enum ib_qp_state qp_state(struct rxe_qp *qp)
126{
127 return qp->attr.qp_state;
128}
129
130static inline int qp_mtu(struct rxe_qp *qp)
131{
132 if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC)
133 return qp->attr.path_mtu;
134 else
135 return IB_MTU_4096;
136}
137
138static inline int rcv_wqe_size(int max_sge)
139{
140 return sizeof(struct rxe_recv_wqe) +
141 max_sge * sizeof(struct ib_sge);
142}
143
144void free_rd_atomic_resource(struct resp_res *res);
145
146static inline void rxe_advance_resp_resource(struct rxe_qp *qp)
147{
148 qp->resp.res_head++;
149 if (unlikely(qp->resp.res_head == qp->attr.max_dest_rd_atomic))
150 qp->resp.res_head = 0;
151}
152
153void retransmit_timer(struct timer_list *t);
154void rnr_nak_timer(struct timer_list *t);
155
156/* rxe_srq.c */
157int rxe_srq_chk_init(struct rxe_dev *rxe, struct ib_srq_init_attr *init);
158int rxe_srq_from_init(struct rxe_dev *rxe, struct rxe_srq *srq,
159 struct ib_srq_init_attr *init, struct ib_udata *udata,
160 struct rxe_create_srq_resp __user *uresp);
161int rxe_srq_chk_attr(struct rxe_dev *rxe, struct rxe_srq *srq,
162 struct ib_srq_attr *attr, enum ib_srq_attr_mask mask);
163int rxe_srq_from_attr(struct rxe_dev *rxe, struct rxe_srq *srq,
164 struct ib_srq_attr *attr, enum ib_srq_attr_mask mask,
165 struct rxe_modify_srq_cmd *ucmd, struct ib_udata *udata);
166void rxe_srq_cleanup(struct rxe_pool_elem *elem);
167
168void rxe_dealloc(struct ib_device *ib_dev);
169
170int rxe_completer(void *arg);
171int rxe_requester(void *arg);
172int rxe_responder(void *arg);
173
174/* rxe_icrc.c */
175int rxe_icrc_init(struct rxe_dev *rxe);
176int rxe_icrc_check(struct sk_buff *skb, struct rxe_pkt_info *pkt);
177void rxe_icrc_generate(struct sk_buff *skb, struct rxe_pkt_info *pkt);
178
179void rxe_resp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb);
180
181void rxe_comp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb);
182
183static inline unsigned int wr_opcode_mask(int opcode, struct rxe_qp *qp)
184{
185 return rxe_wr_opcode_info[opcode].mask[qp->ibqp.qp_type];
186}
187
188#endif /* RXE_LOC_H */