ipath_verbs.h

来自「linux 内核源代码」· C头文件 代码 · 共 864 行 · 第 1/2 页

H
864
字号
#define IPATH_PSN_CREDIT	512/* * Since struct ipath_swqe is not a fixed size, we can't simply index into * struct ipath_qp.s_wq.  This function does the array index computation. */static inline struct ipath_swqe *get_swqe_ptr(struct ipath_qp *qp,					      unsigned n){	return (struct ipath_swqe *)((char *)qp->s_wq +				     (sizeof(struct ipath_swqe) +				      qp->s_max_sge *				      sizeof(struct ipath_sge)) * n);}/* * Since struct ipath_rwqe is not a fixed size, we can't simply index into * struct ipath_rwq.wq.  This function does the array index computation. */static inline struct ipath_rwqe *get_rwqe_ptr(struct ipath_rq *rq,					      unsigned n){	return (struct ipath_rwqe *)		((char *) rq->wq->wq +		 (sizeof(struct ipath_rwqe) +		  rq->max_sge * sizeof(struct ib_sge)) * n);}/* * QPN-map pages start out as NULL, they get allocated upon * first use and are never deallocated. This way, * large bitmaps are not allocated unless large numbers of QPs are used. */struct qpn_map {	atomic_t n_free;	void *page;};struct ipath_qp_table {	spinlock_t lock;	u32 last;		/* last QP number allocated */	u32 max;		/* size of the hash table */	u32 nmaps;		/* size of the map table */	struct ipath_qp **table;	/* bit map of free numbers */	struct qpn_map map[QPNMAP_ENTRIES];};struct ipath_lkey_table {	spinlock_t lock;	u32 next;		/* next unused index (speeds search) */	u32 gen;		/* generation count */	u32 max;		/* size of the table */	struct ipath_mregion **table;};struct ipath_opcode_stats {	u64 n_packets;		/* number of packets */	u64 n_bytes;		/* total number of bytes */};struct ipath_ibdev {	struct ib_device ibdev;	struct ipath_devdata *dd;	struct list_head pending_mmaps;	spinlock_t mmap_offset_lock;	u32 mmap_offset;	int ib_unit;		/* This is the device number */	u16 sm_lid;		/* in host order */	u8 sm_sl;	u8 mkeyprot;	/* non-zero when timer is set */	unsigned long mkey_lease_timeout;	/* The following fields are really per port. */	struct ipath_qp_table qp_table;	struct ipath_lkey_table lk_table;	struct list_head pending[3];	/* FIFO of QPs waiting for ACKs */	struct list_head piowait;	/* list for wait PIO buf */	/* list of QPs waiting for RNR timer */	struct list_head rnrwait;	spinlock_t pending_lock;	__be64 sys_image_guid;	/* in network order */	__be64 gid_prefix;	/* in network order */	__be64 mkey;	u32 n_pds_allocated;	/* number of PDs allocated for device */	spinlock_t n_pds_lock;	u32 n_ahs_allocated;	/* number of AHs allocated for device */	spinlock_t n_ahs_lock;	u32 n_cqs_allocated;	/* number of CQs allocated for device */	spinlock_t n_cqs_lock;	u32 n_qps_allocated;	/* number of QPs allocated for device */	spinlock_t n_qps_lock;	u32 n_srqs_allocated;	/* number of SRQs allocated for device */	spinlock_t n_srqs_lock;	u32 n_mcast_grps_allocated; /* number of mcast groups allocated */	spinlock_t n_mcast_grps_lock;	u64 ipath_sword;	/* total dwords sent (sample result) */	u64 ipath_rword;	/* total dwords received (sample result) */	u64 ipath_spkts;	/* total packets sent (sample result) */	u64 ipath_rpkts;	/* total packets received (sample result) */	/* # of ticks no data sent (sample result) */	u64 ipath_xmit_wait;	u64 rcv_errors;		/* # of packets with SW detected rcv errs */	u64 n_unicast_xmit;	/* total unicast packets sent */	u64 n_unicast_rcv;	/* total unicast packets received */	u64 n_multicast_xmit;	/* total multicast packets sent */	u64 n_multicast_rcv;	/* total multicast packets received */	u64 z_symbol_error_counter;		/* starting count for PMA */	u64 z_link_error_recovery_counter;	/* starting count for PMA */	u64 z_link_downed_counter;		/* starting count for PMA */	u64 z_port_rcv_errors;			/* starting count for PMA */	u64 z_port_rcv_remphys_errors;		/* starting count for PMA */	u64 z_port_xmit_discards;		/* starting count for PMA */	u64 z_port_xmit_data;			/* starting count for PMA */	u64 z_port_rcv_data;			/* starting count for PMA */	u64 z_port_xmit_packets;		/* starting count for PMA */	u64 z_port_rcv_packets;			/* starting count for PMA */	u32 z_pkey_violations;			/* starting count for PMA */	u32 z_local_link_integrity_errors;	/* starting count for PMA */	u32 z_excessive_buffer_overrun_errors;	/* starting count for PMA */	u32 n_rc_resends;	u32 n_rc_acks;	u32 n_rc_qacks;	u32 n_seq_naks;	u32 n_rdma_seq;	u32 n_rnr_naks;	u32 n_other_naks;	u32 n_timeouts;	u32 n_rc_stalls;	u32 n_pkt_drops;	u32 n_vl15_dropped;	u32 n_wqe_errs;	u32 n_rdma_dup_busy;	u32 n_piowait;	u32 n_no_piobuf;	u32 port_cap_flags;	u32 pma_sample_start;	u32 pma_sample_interval;	__be16 pma_counter_select[5];	u16 pma_tag;	u16 qkey_violations;	u16 mkey_violations;	u16 mkey_lease_period;	u16 pending_index;	/* which pending queue is active */	u8 pma_sample_status;	u8 subnet_timeout;	u8 link_width_enabled;	u8 vl_high_limit;	struct ipath_opcode_stats opstats[128];};struct ipath_verbs_counters {	u64 symbol_error_counter;	u64 link_error_recovery_counter;	u64 link_downed_counter;	u64 port_rcv_errors;	u64 port_rcv_remphys_errors;	u64 port_xmit_discards;	u64 port_xmit_data;	u64 port_rcv_data;	u64 port_xmit_packets;	u64 port_rcv_packets;	u32 local_link_integrity_errors;	u32 excessive_buffer_overrun_errors;};static inline struct ipath_mr *to_imr(struct ib_mr *ibmr){	return container_of(ibmr, struct ipath_mr, ibmr);}static inline struct ipath_pd *to_ipd(struct ib_pd *ibpd){	return container_of(ibpd, struct ipath_pd, ibpd);}static inline struct ipath_ah *to_iah(struct ib_ah *ibah){	return container_of(ibah, struct ipath_ah, ibah);}static inline struct ipath_cq *to_icq(struct ib_cq *ibcq){	return container_of(ibcq, struct ipath_cq, ibcq);}static inline struct ipath_srq *to_isrq(struct ib_srq *ibsrq){	return container_of(ibsrq, struct ipath_srq, ibsrq);}static inline struct ipath_qp *to_iqp(struct ib_qp *ibqp){	return container_of(ibqp, struct ipath_qp, ibqp);}static inline struct ipath_ibdev *to_idev(struct ib_device *ibdev){	return container_of(ibdev, struct ipath_ibdev, ibdev);}int ipath_process_mad(struct ib_device *ibdev,		      int mad_flags,		      u8 port_num,		      struct ib_wc *in_wc,		      struct ib_grh *in_grh,		      struct ib_mad *in_mad, struct ib_mad *out_mad);/* * Compare the lower 24 bits of the two values. * Returns an integer <, ==, or > than zero. */static inline int ipath_cmp24(u32 a, u32 b){	return (((int) a) - ((int) b)) << 8;}struct ipath_mcast *ipath_mcast_find(union ib_gid *mgid);int ipath_snapshot_counters(struct ipath_devdata *dd, u64 *swords,			    u64 *rwords, u64 *spkts, u64 *rpkts,			    u64 *xmit_wait);int ipath_get_counters(struct ipath_devdata *dd,		       struct ipath_verbs_counters *cntrs);int ipath_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid);int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid);int ipath_mcast_tree_empty(void);__be32 ipath_compute_aeth(struct ipath_qp *qp);struct ipath_qp *ipath_lookup_qpn(struct ipath_qp_table *qpt, u32 qpn);struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,			      struct ib_qp_init_attr *init_attr,			      struct ib_udata *udata);int ipath_destroy_qp(struct ib_qp *ibqp);int ipath_error_qp(struct ipath_qp *qp, enum ib_wc_status err);int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,		    int attr_mask, struct ib_udata *udata);int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,		   int attr_mask, struct ib_qp_init_attr *init_attr);void ipath_free_all_qps(struct ipath_qp_table *qpt);int ipath_init_qp_table(struct ipath_ibdev *idev, int size);void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc);void ipath_get_credit(struct ipath_qp *qp, u32 aeth);int ipath_verbs_send(struct ipath_qp *qp, struct ipath_ib_header *hdr,		     u32 hdrwords, struct ipath_sge_state *ss, u32 len);void ipath_cq_enter(struct ipath_cq *cq, struct ib_wc *entry, int sig);void ipath_copy_sge(struct ipath_sge_state *ss, void *data, u32 length);void ipath_skip_sge(struct ipath_sge_state *ss, u32 length);void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,		  int has_grh, void *data, u32 tlen, struct ipath_qp *qp);void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,		  int has_grh, void *data, u32 tlen, struct ipath_qp *qp);void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc);int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr);void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,		  int has_grh, void *data, u32 tlen, struct ipath_qp *qp);int ipath_alloc_lkey(struct ipath_lkey_table *rkt,		     struct ipath_mregion *mr);void ipath_free_lkey(struct ipath_lkey_table *rkt, u32 lkey);int ipath_lkey_ok(struct ipath_qp *qp, struct ipath_sge *isge,		  struct ib_sge *sge, int acc);int ipath_rkey_ok(struct ipath_qp *qp, struct ipath_sge_state *ss,		  u32 len, u64 vaddr, u32 rkey, int acc);int ipath_post_srq_receive(struct ib_srq *ibsrq, struct ib_recv_wr *wr,			   struct ib_recv_wr **bad_wr);struct ib_srq *ipath_create_srq(struct ib_pd *ibpd,				struct ib_srq_init_attr *srq_init_attr,				struct ib_udata *udata);int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,		     enum ib_srq_attr_mask attr_mask,		     struct ib_udata *udata);int ipath_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr);int ipath_destroy_srq(struct ib_srq *ibsrq);void ipath_cq_enter(struct ipath_cq *cq, struct ib_wc *entry, int sig);int ipath_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry);struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, int comp_vector,			      struct ib_ucontext *context,			      struct ib_udata *udata);int ipath_destroy_cq(struct ib_cq *ibcq);int ipath_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags notify_flags);int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata);struct ib_mr *ipath_get_dma_mr(struct ib_pd *pd, int acc);struct ib_mr *ipath_reg_phys_mr(struct ib_pd *pd,				struct ib_phys_buf *buffer_list,				int num_phys_buf, int acc, u64 *iova_start);struct ib_mr *ipath_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,				u64 virt_addr, int mr_access_flags,				struct ib_udata *udata);int ipath_dereg_mr(struct ib_mr *ibmr);struct ib_fmr *ipath_alloc_fmr(struct ib_pd *pd, int mr_access_flags,			       struct ib_fmr_attr *fmr_attr);int ipath_map_phys_fmr(struct ib_fmr *ibfmr, u64 * page_list,		       int list_len, u64 iova);int ipath_unmap_fmr(struct list_head *fmr_list);int ipath_dealloc_fmr(struct ib_fmr *ibfmr);void ipath_release_mmap_info(struct kref *ref);struct ipath_mmap_info *ipath_create_mmap_info(struct ipath_ibdev *dev,					       u32 size,					       struct ib_ucontext *context,					       void *obj);void ipath_update_mmap_info(struct ipath_ibdev *dev,			    struct ipath_mmap_info *ip,			    u32 size, void *obj);int ipath_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);void ipath_insert_rnr_queue(struct ipath_qp *qp);int ipath_init_sge(struct ipath_qp *qp, struct ipath_rwqe *wqe,		   u32 *lengthp, struct ipath_sge_state *ss);int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only);u32 ipath_make_grh(struct ipath_ibdev *dev, struct ib_grh *hdr,		   struct ib_global_route *grh, u32 hwords, u32 nwords);void ipath_make_ruc_header(struct ipath_ibdev *dev, struct ipath_qp *qp,			   struct ipath_other_headers *ohdr,			   u32 bth0, u32 bth2);void ipath_do_send(unsigned long data);void ipath_send_complete(struct ipath_qp *qp, struct ipath_swqe *wqe,			 enum ib_wc_status status);int ipath_make_rc_req(struct ipath_qp *qp);int ipath_make_uc_req(struct ipath_qp *qp);int ipath_make_ud_req(struct ipath_qp *qp);int ipath_register_ib_device(struct ipath_devdata *);void ipath_unregister_ib_device(struct ipath_ibdev *);void ipath_ib_rcv(struct ipath_ibdev *, void *, void *, u32);int ipath_ib_piobufavail(struct ipath_ibdev *);unsigned ipath_get_npkeys(struct ipath_devdata *);u32 ipath_get_cr_errpkey(struct ipath_devdata *);unsigned ipath_get_pkey(struct ipath_devdata *, unsigned);extern const enum ib_wc_opcode ib_ipath_wc_opcode[];extern const u8 ipath_cvt_physportstate[];extern const int ib_ipath_state_ops[];extern unsigned int ib_ipath_lkey_table_size;extern unsigned int ib_ipath_max_cqes;extern unsigned int ib_ipath_max_cqs;extern unsigned int ib_ipath_max_qp_wrs;extern unsigned int ib_ipath_max_qps;extern unsigned int ib_ipath_max_sges;extern unsigned int ib_ipath_max_mcast_grps;extern unsigned int ib_ipath_max_mcast_qp_attached;extern unsigned int ib_ipath_max_srqs;extern unsigned int ib_ipath_max_srq_sges;extern unsigned int ib_ipath_max_srq_wrs;extern const u32 ib_ipath_rnr_table[];extern struct ib_dma_mapping_ops ipath_dma_mapping_ops;#endif				/* IPATH_VERBS_H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?