0001
0002
0003
0004
0005
0006
0007 #ifndef RXE_LOC_H
0008 #define RXE_LOC_H
0009
0010
0011 void rxe_init_av(struct rdma_ah_attr *attr, struct rxe_av *av);
0012
0013 int rxe_av_chk_attr(struct rxe_dev *rxe, struct rdma_ah_attr *attr);
0014
0015 void rxe_av_from_attr(u8 port_num, struct rxe_av *av,
0016 struct rdma_ah_attr *attr);
0017
0018 void rxe_av_to_attr(struct rxe_av *av, struct rdma_ah_attr *attr);
0019
0020 void rxe_av_fill_ip_info(struct rxe_av *av, struct rdma_ah_attr *attr);
0021
0022 struct rxe_av *rxe_get_av(struct rxe_pkt_info *pkt, struct rxe_ah **ahp);
0023
0024
0025 int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *cq,
0026 int cqe, int comp_vector);
0027
0028 int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe,
0029 int comp_vector, struct ib_udata *udata,
0030 struct rxe_create_cq_resp __user *uresp);
0031
0032 int rxe_cq_resize_queue(struct rxe_cq *cq, int new_cqe,
0033 struct rxe_resize_cq_resp __user *uresp,
0034 struct ib_udata *udata);
0035
0036 int rxe_cq_post(struct rxe_cq *cq, struct rxe_cqe *cqe, int solicited);
0037
0038 void rxe_cq_disable(struct rxe_cq *cq);
0039
0040 void rxe_cq_cleanup(struct rxe_pool_elem *elem);
0041
0042
0043 struct rxe_mcg *rxe_lookup_mcg(struct rxe_dev *rxe, union ib_gid *mgid);
0044 int rxe_attach_mcast(struct ib_qp *ibqp, union ib_gid *mgid, u16 mlid);
0045 int rxe_detach_mcast(struct ib_qp *ibqp, union ib_gid *mgid, u16 mlid);
0046 void rxe_cleanup_mcg(struct kref *kref);
0047
0048
0049 struct rxe_mmap_info {
0050 struct list_head pending_mmaps;
0051 struct ib_ucontext *context;
0052 struct kref ref;
0053 void *obj;
0054
0055 struct mminfo info;
0056 };
0057
0058 void rxe_mmap_release(struct kref *ref);
0059
0060 struct rxe_mmap_info *rxe_create_mmap_info(struct rxe_dev *dev, u32 size,
0061 struct ib_udata *udata, void *obj);
0062
0063 int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
0064
0065
0066 u8 rxe_get_next_key(u32 last_key);
0067 void rxe_mr_init_dma(struct rxe_pd *pd, int access, struct rxe_mr *mr);
0068 int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
0069 int access, struct rxe_mr *mr);
0070 int rxe_mr_init_fast(struct rxe_pd *pd, int max_pages, struct rxe_mr *mr);
0071 int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
0072 enum rxe_mr_copy_dir dir);
0073 int copy_data(struct rxe_pd *pd, int access, struct rxe_dma_info *dma,
0074 void *addr, int length, enum rxe_mr_copy_dir dir);
0075 void *iova_to_vaddr(struct rxe_mr *mr, u64 iova, int length);
0076 struct rxe_mr *lookup_mr(struct rxe_pd *pd, int access, u32 key,
0077 enum rxe_mr_lookup_type type);
0078 int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length);
0079 int advance_dma_data(struct rxe_dma_info *dma, unsigned int length);
0080 int rxe_invalidate_mr(struct rxe_qp *qp, u32 key);
0081 int rxe_reg_fast_mr(struct rxe_qp *qp, struct rxe_send_wqe *wqe);
0082 int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata);
0083 void rxe_mr_cleanup(struct rxe_pool_elem *elem);
0084
0085
0086 int rxe_alloc_mw(struct ib_mw *ibmw, struct ib_udata *udata);
0087 int rxe_dealloc_mw(struct ib_mw *ibmw);
0088 int rxe_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe);
0089 int rxe_invalidate_mw(struct rxe_qp *qp, u32 rkey);
0090 struct rxe_mw *rxe_lookup_mw(struct rxe_qp *qp, int access, u32 rkey);
0091 void rxe_mw_cleanup(struct rxe_pool_elem *elem);
0092
0093
0094 struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
0095 int paylen, struct rxe_pkt_info *pkt);
0096 int rxe_prepare(struct rxe_av *av, struct rxe_pkt_info *pkt,
0097 struct sk_buff *skb);
0098 int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
0099 struct sk_buff *skb);
0100 const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num);
0101
0102
0103 int rxe_qp_chk_init(struct rxe_dev *rxe, struct ib_qp_init_attr *init);
0104 int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd,
0105 struct ib_qp_init_attr *init,
0106 struct rxe_create_qp_resp __user *uresp,
0107 struct ib_pd *ibpd, struct ib_udata *udata);
0108 int rxe_qp_to_init(struct rxe_qp *qp, struct ib_qp_init_attr *init);
0109 int rxe_qp_chk_attr(struct rxe_dev *rxe, struct rxe_qp *qp,
0110 struct ib_qp_attr *attr, int mask);
0111 int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr,
0112 int mask, struct ib_udata *udata);
0113 int rxe_qp_to_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask);
0114 void rxe_qp_error(struct rxe_qp *qp);
0115 int rxe_qp_chk_destroy(struct rxe_qp *qp);
0116 void rxe_qp_cleanup(struct rxe_pool_elem *elem);
0117
0118 static inline int qp_num(struct rxe_qp *qp)
0119 {
0120 return qp->ibqp.qp_num;
0121 }
0122
0123 static inline enum ib_qp_type qp_type(struct rxe_qp *qp)
0124 {
0125 return qp->ibqp.qp_type;
0126 }
0127
0128 static inline enum ib_qp_state qp_state(struct rxe_qp *qp)
0129 {
0130 return qp->attr.qp_state;
0131 }
0132
0133 static inline int qp_mtu(struct rxe_qp *qp)
0134 {
0135 if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC)
0136 return qp->attr.path_mtu;
0137 else
0138 return IB_MTU_4096;
0139 }
0140
0141 static inline int rcv_wqe_size(int max_sge)
0142 {
0143 return sizeof(struct rxe_recv_wqe) +
0144 max_sge * sizeof(struct ib_sge);
0145 }
0146
0147 void free_rd_atomic_resource(struct resp_res *res);
0148
0149 static inline void rxe_advance_resp_resource(struct rxe_qp *qp)
0150 {
0151 qp->resp.res_head++;
0152 if (unlikely(qp->resp.res_head == qp->attr.max_dest_rd_atomic))
0153 qp->resp.res_head = 0;
0154 }
0155
0156 void retransmit_timer(struct timer_list *t);
0157 void rnr_nak_timer(struct timer_list *t);
0158
0159
0160 int rxe_srq_chk_init(struct rxe_dev *rxe, struct ib_srq_init_attr *init);
0161 int rxe_srq_from_init(struct rxe_dev *rxe, struct rxe_srq *srq,
0162 struct ib_srq_init_attr *init, struct ib_udata *udata,
0163 struct rxe_create_srq_resp __user *uresp);
0164 int rxe_srq_chk_attr(struct rxe_dev *rxe, struct rxe_srq *srq,
0165 struct ib_srq_attr *attr, enum ib_srq_attr_mask mask);
0166 int rxe_srq_from_attr(struct rxe_dev *rxe, struct rxe_srq *srq,
0167 struct ib_srq_attr *attr, enum ib_srq_attr_mask mask,
0168 struct rxe_modify_srq_cmd *ucmd, struct ib_udata *udata);
0169 void rxe_srq_cleanup(struct rxe_pool_elem *elem);
0170
0171 void rxe_dealloc(struct ib_device *ib_dev);
0172
0173 int rxe_completer(void *arg);
0174 int rxe_requester(void *arg);
0175 int rxe_responder(void *arg);
0176
0177
0178 int rxe_icrc_init(struct rxe_dev *rxe);
0179 int rxe_icrc_check(struct sk_buff *skb, struct rxe_pkt_info *pkt);
0180 void rxe_icrc_generate(struct sk_buff *skb, struct rxe_pkt_info *pkt);
0181
0182 void rxe_resp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb);
0183
0184 void rxe_comp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb);
0185
0186 static inline unsigned int wr_opcode_mask(int opcode, struct rxe_qp *qp)
0187 {
0188 return rxe_wr_opcode_info[opcode].mask[qp->ibqp.qp_type];
0189 }
0190
0191 #endif