📄 ib_verbs.h
字号:
struct ib_client { char *name; void (*add) (struct ib_device *); void (*remove)(struct ib_device *); struct list_head list;};struct ib_device *ib_alloc_device(size_t size);void ib_dealloc_device(struct ib_device *device);int ib_register_device (struct ib_device *device);void ib_unregister_device(struct ib_device *device);int ib_register_client (struct ib_client *client);void ib_unregister_client(struct ib_client *client);void *ib_get_client_data(struct ib_device *device, struct ib_client *client);void ib_set_client_data(struct ib_device *device, struct ib_client *client, void *data);int ib_register_event_handler (struct ib_event_handler *event_handler);int ib_unregister_event_handler(struct ib_event_handler *event_handler);void ib_dispatch_event(struct ib_event *event);int ib_query_device(struct ib_device *device, struct ib_device_attr *device_attr);int ib_query_port(struct ib_device *device, u8 port_num, struct ib_port_attr *port_attr);int ib_query_gid(struct ib_device *device, u8 port_num, int index, union ib_gid *gid);int ib_query_pkey(struct ib_device *device, u8 port_num, u16 index, u16 *pkey);int ib_modify_device(struct ib_device *device, int device_modify_mask, struct ib_device_modify *device_modify);int ib_modify_port(struct ib_device *device, u8 port_num, int port_modify_mask, struct ib_port_modify *port_modify);/** * ib_alloc_pd - Allocates an unused protection domain. * @device: The device on which to allocate the protection domain. * * A protection domain object provides an association between QPs, shared * receive queues, address handles, memory regions, and memory windows. */struct ib_pd *ib_alloc_pd(struct ib_device *device);/** * ib_dealloc_pd - Deallocates a protection domain. * @pd: The protection domain to deallocate. */int ib_dealloc_pd(struct ib_pd *pd);/** * ib_create_ah - Creates an address handle for the given address vector. * @pd: The protection domain associated with the address handle. * @ah_attr: The attributes of the address vector. * * The address handle is used to reference a local or global destination * in all UD QP post sends. */struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);/** * ib_modify_ah - Modifies the address vector associated with an address * handle. * @ah: The address handle to modify. * @ah_attr: The new address vector attributes to associate with the * address handle. */int ib_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);/** * ib_query_ah - Queries the address vector associated with an address * handle. * @ah: The address handle to query. * @ah_attr: The address vector attributes associated with the address * handle. */int ib_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);/** * ib_destroy_ah - Destroys an address handle. * @ah: The address handle to destroy. */int ib_destroy_ah(struct ib_ah *ah);/** * ib_create_qp - Creates a QP associated with the specified protection * domain. * @pd: The protection domain associated with the QP. * @qp_init_attr: A list of initial attributes required to create the QP. */struct ib_qp *ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *qp_init_attr);/** * ib_modify_qp - Modifies the attributes for the specified QP and then * transitions the QP to the given state. * @qp: The QP to modify. * @qp_attr: On input, specifies the QP attributes to modify. On output, * the current values of selected QP attributes are returned. * @qp_attr_mask: A bit-mask used to specify which attributes of the QP * are being modified. */int ib_modify_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr, int qp_attr_mask);/** * ib_query_qp - Returns the attribute list and current values for the * specified QP. * @qp: The QP to query. * @qp_attr: The attributes of the specified QP. * @qp_attr_mask: A bit-mask used to select specific attributes to query. * @qp_init_attr: Additional attributes of the selected QP. * * The qp_attr_mask may be used to limit the query to gathering only the * selected attributes. */int ib_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr, int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);/** * ib_destroy_qp - Destroys the specified QP. * @qp: The QP to destroy. */int ib_destroy_qp(struct ib_qp *qp);/** * ib_post_send - Posts a list of work requests to the send queue of * the specified QP. * @qp: The QP to post the work request on. * @send_wr: A list of work requests to post on the send queue. * @bad_send_wr: On an immediate failure, this parameter will reference * the work request that failed to be posted on the QP. */static inline int ib_post_send(struct ib_qp *qp, struct ib_send_wr *send_wr, struct ib_send_wr **bad_send_wr){ return qp->device->post_send(qp, send_wr, bad_send_wr);}/** * ib_post_recv - Posts a list of work requests to the receive queue of * the specified QP. * @qp: The QP to post the work request on. * @recv_wr: A list of work requests to post on the receive queue. * @bad_recv_wr: On an immediate failure, this parameter will reference * the work request that failed to be posted on the QP. */static inline int ib_post_recv(struct ib_qp *qp, struct ib_recv_wr *recv_wr, struct ib_recv_wr **bad_recv_wr){ return qp->device->post_recv(qp, recv_wr, bad_recv_wr);}/** * ib_create_cq - Creates a CQ on the specified device. * @device: The device on which to create the CQ. * @comp_handler: A user-specified callback that is invoked when a * completion event occurs on the CQ. * @event_handler: A user-specified callback that is invoked when an * asynchronous event not associated with a completion occurs on the CQ. * @cq_context: Context associated with the CQ returned to the user via * the associated completion and event handlers. * @cqe: The minimum size of the CQ. * * Users can examine the cq structure to determine the actual CQ size. */struct ib_cq *ib_create_cq(struct ib_device *device, ib_comp_handler comp_handler, void (*event_handler)(struct ib_event *, void *), void *cq_context, int cqe);/** * ib_resize_cq - Modifies the capacity of the CQ. * @cq: The CQ to resize. * @cqe: The minimum size of the CQ. * * Users can examine the cq structure to determine the actual CQ size. */int ib_resize_cq(struct ib_cq *cq, int cqe);/** * ib_destroy_cq - Destroys the specified CQ. * @cq: The CQ to destroy. */int ib_destroy_cq(struct ib_cq *cq);/** * ib_poll_cq - poll a CQ for completion(s) * @cq:the CQ being polled * @num_entries:maximum number of completions to return * @wc:array of at least @num_entries &struct ib_wc where completions * will be returned * * Poll a CQ for (possibly multiple) completions. If the return value * is < 0, an error occurred. If the return value is >= 0, it is the * number of completions returned. If the return value is * non-negative and < num_entries, then the CQ was emptied. */static inline int ib_poll_cq(struct ib_cq *cq, int num_entries, struct ib_wc *wc){ return cq->device->poll_cq(cq, num_entries, wc);}/** * ib_peek_cq - Returns the number of unreaped completions currently * on the specified CQ. * @cq: The CQ to peek. * @wc_cnt: A minimum number of unreaped completions to check for. * * If the number of unreaped completions is greater than or equal to wc_cnt, * this function returns wc_cnt, otherwise, it returns the actual number of * unreaped completions. */int ib_peek_cq(struct ib_cq *cq, int wc_cnt);/** * ib_req_notify_cq - Request completion notification on a CQ. * @cq: The CQ to generate an event for. * @cq_notify: If set to %IB_CQ_SOLICITED, completion notification will * occur on the next solicited event. If set to %IB_CQ_NEXT_COMP, * notification will occur on the next completion. */static inline int ib_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify cq_notify){ return cq->device->req_notify_cq(cq, cq_notify);}/** * ib_req_ncomp_notif - Request completion notification when there are * at least the specified number of unreaped completions on the CQ. * @cq: The CQ to generate an event for. * @wc_cnt: The number of unreaped completions that should be on the * CQ before an event is generated. */static inline int ib_req_ncomp_notif(struct ib_cq *cq, int wc_cnt){ return cq->device->req_ncomp_notif ? cq->device->req_ncomp_notif(cq, wc_cnt) : -ENOSYS;}/** * ib_get_dma_mr - Returns a memory region for system memory that is * usable for DMA. * @pd: The protection domain associated with the memory region. * @mr_access_flags: Specifies the memory access rights. */struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags);/** * ib_reg_phys_mr - Prepares a virtually addressed memory region for use * by an HCA. * @pd: The protection domain associated assigned to the registered region. * @phys_buf_array: Specifies a list of physical buffers to use in the * memory region. * @num_phys_buf: Specifies the size of the phys_buf_array. * @mr_access_flags: Specifies the memory access rights. * @iova_start: The offset of the region's starting I/O virtual address. */struct ib_mr *ib_reg_phys_mr(struct ib_pd *pd, struct ib_phys_buf *phys_buf_array, int num_phys_buf, int mr_access_flags, u64 *iova_start);/** * ib_rereg_phys_mr - Modifies the attributes of an existing memory region. * Conceptually, this call performs the functions deregister memory region * followed by register physical memory region. Where possible, * resources are reused instead of deallocated and reallocated. * @mr: The memory region to modify. * @mr_rereg_mask: A bit-mask used to indicate which of the following * properties of the memory region are being modified. * @pd: If %IB_MR_REREG_PD is set in mr_rereg_mask, this field specifies * the new protection domain to associated with the memory region, * otherwise, this parameter is ignored. * @phys_buf_array: If %IB_MR_REREG_TRANS is set in mr_rereg_mask, this * field specifies a list of physical buffers to use in the new * translation, otherwise, this parameter is ignored. * @num_phys_buf: If %IB_MR_REREG_TRANS is set in mr_rereg_mask, this * field specifies the size of the phys_buf_array, otherwise, this * parameter is ignored. * @mr_access_flags: If %IB_MR_REREG_ACCESS is set in mr_rereg_mask, this * field specifies the new memory access rights, otherwise, this * parameter is ignored. * @iova_start: The offset of the region's starting I/O virtual address. */int ib_rereg_phys_mr(struct ib_mr *mr, int mr_rereg_mask, struct ib_pd *pd, struct ib_phys_buf *phys_buf_array, int num_phys_buf, int mr_access_flags, u64 *iova_start);/** * ib_query_mr - Retrieves information about a specific memory region. * @mr: The memory region to retrieve information about. * @mr_attr: The attributes of the specified memory region. */int ib_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr);/** * ib_dereg_mr - Deregisters a memory region and removes it from the * HCA translation table. * @mr: The memory region to deregister. */int ib_dereg_mr(struct ib_mr *mr);/** * ib_alloc_mw - Allocates a memory window. * @pd: The protection domain associated with the memory window. */struct ib_mw *ib_alloc_mw(struct ib_pd *pd);/** * ib_bind_mw - Posts a work request to the send queue of the specified * QP, which binds the memory window to the given address range and * remote access attributes. * @qp: QP to post the bind work request on. * @mw: The memory window to bind. * @mw_bind: Specifies information about the memory window, including * its address range, remote access rights, and associated memory region. */static inline int ib_bind_mw(struct ib_qp *qp, struct ib_mw *mw, struct ib_mw_bind *mw_bind){ /* XXX reference counting in corresponding MR? */ return mw->device->bind_mw ? mw->device->bind_mw(qp, mw, mw_bind) : -ENOSYS;}/** * ib_dealloc_mw - Deallocates a memory window. * @mw: The memory window to deallocate. */int ib_dealloc_mw(struct ib_mw *mw);/** * ib_alloc_fmr - Allocates a unmapped fast memory region. * @pd: The protection domain associated with the unmapped region. * @mr_access_flags: Specifies the memory access rights. * @fmr_attr: Attributes of the unmapped region. * * A fast memory region must be mapped before it can be used as part of * a work request. */struct ib_fmr *ib_alloc_fmr(struct ib_pd *pd, int mr_access_flags, struct ib_fmr_attr *fmr_attr);/** * ib_map_phys_fmr - Maps a list of physical pages to a fast memory region. * @fmr: The fast memory region to associate with the pages. * @page_list: An array of physical pages to map to the fast memory region. * @list_len: The number of pages in page_list. * @iova: The I/O virtual address to use with the mapped region. */static inline int ib_map_phys_fmr(struct ib_fmr *fmr, u64 *page_list, int list_len, u64 iova){ return fmr->device->map_phys_fmr(fmr, page_list, list_len, iova);}/** * ib_unmap_fmr - Removes the mapping from a list of fast memory regions. * @fmr_list: A linked list of fast memory regions to unmap. */int ib_unmap_fmr(struct list_head *fmr_list);/** * ib_dealloc_fmr - Deallocates a fast memory region. * @fmr: The fast memory region to deallocate. */int ib_dealloc_fmr(struct ib_fmr *fmr);/** * ib_attach_mcast - Attaches the specified QP to a multicast group. * @qp: QP to attach to the multicast group. The QP must be type * IB_QPT_UD. * @gid: Multicast group GID. * @lid: Multicast group LID in host byte order. * * In order to send and receive multicast packets, subnet * administration must have created the multicast group and configured * the fabric appropriately. The port associated with the specified * QP must also be a member of the multicast group. */int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);/** * ib_detach_mcast - Detaches the specified QP from a multicast group. * @qp: QP to detach from the multicast group. * @gid: Multicast group GID. * @lid: Multicast group LID in host byte order. */int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);#endif /* IB_VERBS_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -