2006-09-23 06:22:22 +08:00
|
|
|
/*
|
|
|
|
* IBM eServer eHCA Infiniband device driver for Linux on POWER
|
|
|
|
*
|
|
|
|
* Function definitions for internal functions
|
|
|
|
*
|
|
|
|
* Authors: Heiko J Schick <schickhj@de.ibm.com>
|
|
|
|
* Dietmar Decker <ddecker@de.ibm.com>
|
|
|
|
*
|
|
|
|
* Copyright (c) 2005 IBM Corporation
|
|
|
|
*
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is distributed under a dual license of GPL v2.0 and OpenIB
|
|
|
|
* BSD.
|
|
|
|
*
|
|
|
|
* OpenIB BSD License
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* Redistributions of source code must retain the above copyright notice, this
|
|
|
|
* list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials
|
|
|
|
* provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
|
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
|
|
|
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __EHCA_IVERBS_H__
|
|
|
|
#define __EHCA_IVERBS_H__
|
|
|
|
|
|
|
|
#include "ehca_classes.h"
|
|
|
|
|
|
|
|
int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props);
|
|
|
|
|
|
|
|
int ehca_query_port(struct ib_device *ibdev, u8 port,
|
|
|
|
struct ib_port_attr *props);
|
|
|
|
|
2007-07-09 21:32:22 +08:00
|
|
|
int ehca_query_sma_attr(struct ehca_shca *shca, u8 port,
|
|
|
|
struct ehca_sma_attr *attr);
|
|
|
|
|
2006-09-23 06:22:22 +08:00
|
|
|
int ehca_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 * pkey);
|
|
|
|
|
|
|
|
int ehca_query_gid(struct ib_device *ibdev, u8 port, int index,
|
|
|
|
union ib_gid *gid);
|
|
|
|
|
|
|
|
int ehca_modify_port(struct ib_device *ibdev, u8 port, int port_modify_mask,
|
|
|
|
struct ib_port_modify *props);
|
|
|
|
|
|
|
|
struct ib_pd *ehca_alloc_pd(struct ib_device *device,
|
|
|
|
struct ib_ucontext *context,
|
|
|
|
struct ib_udata *udata);
|
|
|
|
|
|
|
|
int ehca_dealloc_pd(struct ib_pd *pd);
|
|
|
|
|
|
|
|
struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);
|
|
|
|
|
|
|
|
int ehca_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
|
|
|
|
|
|
|
|
int ehca_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
|
|
|
|
|
|
|
|
int ehca_destroy_ah(struct ib_ah *ah);
|
|
|
|
|
|
|
|
struct ib_mr *ehca_get_dma_mr(struct ib_pd *pd, int mr_access_flags);
|
|
|
|
|
|
|
|
struct ib_mr *ehca_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);
|
|
|
|
|
2007-07-12 23:53:47 +08:00
|
|
|
struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
|
|
|
|
u64 virt, int mr_access_flags,
|
|
|
|
struct ib_udata *udata);
|
2006-09-23 06:22:22 +08:00
|
|
|
|
|
|
|
int ehca_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);
|
|
|
|
|
|
|
|
int ehca_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr);
|
|
|
|
|
|
|
|
int ehca_dereg_mr(struct ib_mr *mr);
|
|
|
|
|
|
|
|
struct ib_mw *ehca_alloc_mw(struct ib_pd *pd);
|
|
|
|
|
|
|
|
int ehca_bind_mw(struct ib_qp *qp, struct ib_mw *mw,
|
|
|
|
struct ib_mw_bind *mw_bind);
|
|
|
|
|
|
|
|
int ehca_dealloc_mw(struct ib_mw *mw);
|
|
|
|
|
|
|
|
struct ib_fmr *ehca_alloc_fmr(struct ib_pd *pd,
|
|
|
|
int mr_access_flags,
|
|
|
|
struct ib_fmr_attr *fmr_attr);
|
|
|
|
|
|
|
|
int ehca_map_phys_fmr(struct ib_fmr *fmr,
|
|
|
|
u64 *page_list, int list_len, u64 iova);
|
|
|
|
|
|
|
|
int ehca_unmap_fmr(struct list_head *fmr_list);
|
|
|
|
|
|
|
|
int ehca_dealloc_fmr(struct ib_fmr *fmr);
|
|
|
|
|
|
|
|
enum ehca_eq_type {
|
|
|
|
EHCA_EQ = 0, /* Event Queue */
|
|
|
|
EHCA_NEQ /* Notification Event Queue */
|
|
|
|
};
|
|
|
|
|
|
|
|
int ehca_create_eq(struct ehca_shca *shca, struct ehca_eq *eq,
|
|
|
|
enum ehca_eq_type type, const u32 length);
|
|
|
|
|
|
|
|
int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq);
|
|
|
|
|
|
|
|
void *ehca_poll_eq(struct ehca_shca *shca, struct ehca_eq *eq);
|
|
|
|
|
|
|
|
|
2007-05-03 18:48:47 +08:00
|
|
|
struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
|
2006-09-23 06:22:22 +08:00
|
|
|
struct ib_ucontext *context,
|
|
|
|
struct ib_udata *udata);
|
|
|
|
|
|
|
|
int ehca_destroy_cq(struct ib_cq *cq);
|
|
|
|
|
|
|
|
int ehca_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata);
|
|
|
|
|
|
|
|
int ehca_poll_cq(struct ib_cq *cq, int num_entries, struct ib_wc *wc);
|
|
|
|
|
|
|
|
int ehca_peek_cq(struct ib_cq *cq, int wc_cnt);
|
|
|
|
|
IB: Return "maybe missed event" hint from ib_req_notify_cq()
The semantics defined by the InfiniBand specification say that
completion events are only generated when a completions is added to a
completion queue (CQ) after completion notification is requested. In
other words, this means that the following race is possible:
while (CQ is not empty)
ib_poll_cq(CQ);
// new completion is added after while loop is exited
ib_req_notify_cq(CQ);
// no event is generated for the existing completion
To close this race, the IB spec recommends doing another poll of the
CQ after requesting notification.
However, it is not always possible to arrange code this way (for
example, we have found that NAPI for IPoIB cannot poll after
requesting notification). Also, some hardware (eg Mellanox HCAs)
actually will generate an event for completions added before the call
to ib_req_notify_cq() -- which is allowed by the spec, since there's
no way for any upper-layer consumer to know exactly when a completion
was really added -- so the extra poll of the CQ is just a waste.
Motivated by this, we add a new flag "IB_CQ_REPORT_MISSED_EVENTS" for
ib_req_notify_cq() so that it can return a hint about whether the a
completion may have been added before the request for notification.
The return value of ib_req_notify_cq() is extended so:
< 0 means an error occurred while requesting notification
== 0 means notification was requested successfully, and if
IB_CQ_REPORT_MISSED_EVENTS was passed in, then no
events were missed and it is safe to wait for another
event.
> 0 is only returned if IB_CQ_REPORT_MISSED_EVENTS was
passed in. It means that the consumer must poll the
CQ again to make sure it is empty to avoid the race
described above.
We add a flag to enable this behavior rather than turning it on
unconditionally, because checking for missed events may incur
significant overhead for some low-level drivers, and consumers that
don't care about the results of this test shouldn't be forced to pay
for the test.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2007-05-07 12:02:48 +08:00
|
|
|
int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags notify_flags);
|
2006-09-23 06:22:22 +08:00
|
|
|
|
|
|
|
struct ib_qp *ehca_create_qp(struct ib_pd *pd,
|
|
|
|
struct ib_qp_init_attr *init_attr,
|
|
|
|
struct ib_udata *udata);
|
|
|
|
|
|
|
|
int ehca_destroy_qp(struct ib_qp *qp);
|
|
|
|
|
2006-08-12 05:58:09 +08:00
|
|
|
int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
|
|
|
|
struct ib_udata *udata);
|
2006-09-23 06:22:22 +08:00
|
|
|
|
|
|
|
int ehca_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
|
|
|
|
int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
|
|
|
|
|
|
|
|
int ehca_post_send(struct ib_qp *qp, struct ib_send_wr *send_wr,
|
|
|
|
struct ib_send_wr **bad_send_wr);
|
|
|
|
|
|
|
|
int ehca_post_recv(struct ib_qp *qp, struct ib_recv_wr *recv_wr,
|
|
|
|
struct ib_recv_wr **bad_recv_wr);
|
|
|
|
|
2007-07-09 21:25:10 +08:00
|
|
|
int ehca_post_srq_recv(struct ib_srq *srq,
|
|
|
|
struct ib_recv_wr *recv_wr,
|
|
|
|
struct ib_recv_wr **bad_recv_wr);
|
|
|
|
|
|
|
|
struct ib_srq *ehca_create_srq(struct ib_pd *pd,
|
|
|
|
struct ib_srq_init_attr *init_attr,
|
|
|
|
struct ib_udata *udata);
|
|
|
|
|
|
|
|
int ehca_modify_srq(struct ib_srq *srq, struct ib_srq_attr *attr,
|
|
|
|
enum ib_srq_attr_mask attr_mask, struct ib_udata *udata);
|
|
|
|
|
|
|
|
int ehca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
|
|
|
|
|
|
|
|
int ehca_destroy_srq(struct ib_srq *srq);
|
|
|
|
|
2006-09-23 06:22:22 +08:00
|
|
|
u64 ehca_define_sqp(struct ehca_shca *shca, struct ehca_qp *ibqp,
|
|
|
|
struct ib_qp_init_attr *qp_init_attr);
|
|
|
|
|
|
|
|
int ehca_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
|
|
|
|
|
|
|
|
int ehca_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
|
|
|
|
|
|
|
|
struct ib_ucontext *ehca_alloc_ucontext(struct ib_device *device,
|
|
|
|
struct ib_udata *udata);
|
|
|
|
|
|
|
|
int ehca_dealloc_ucontext(struct ib_ucontext *context);
|
|
|
|
|
|
|
|
int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
|
|
|
|
|
2008-01-26 04:18:27 +08:00
|
|
|
int ehca_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);
|
|
|
|
|
2006-09-23 06:22:22 +08:00
|
|
|
void ehca_poll_eqs(unsigned long data);
|
|
|
|
|
2007-11-02 21:41:49 +08:00
|
|
|
int ehca_calc_ipd(struct ehca_shca *shca, int port,
|
|
|
|
enum ib_rate path_rate, u32 *ipd);
|
|
|
|
|
2008-09-21 11:05:21 +08:00
|
|
|
void ehca_add_to_err_list(struct ehca_qp *qp, int on_sq);
|
|
|
|
|
2006-11-07 07:56:39 +08:00
|
|
|
#ifdef CONFIG_PPC_64K_PAGES
|
2007-01-10 01:04:14 +08:00
|
|
|
void *ehca_alloc_fw_ctrlblock(gfp_t flags);
|
2006-11-07 07:56:39 +08:00
|
|
|
void ehca_free_fw_ctrlblock(void *ptr);
|
|
|
|
#else
|
2007-07-12 23:53:47 +08:00
|
|
|
#define ehca_alloc_fw_ctrlblock(flags) ((void *)get_zeroed_page(flags))
|
2006-11-07 07:56:39 +08:00
|
|
|
#define ehca_free_fw_ctrlblock(ptr) free_page((unsigned long)(ptr))
|
|
|
|
#endif
|
|
|
|
|
2008-01-17 22:05:45 +08:00
|
|
|
void ehca_recover_sqp(struct ib_qp *sqp);
|
|
|
|
|
2006-09-23 06:22:22 +08:00
|
|
|
#endif
|