cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

rxe_loc.h (6721B)


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