Path: blob/master/drivers/infiniband/hw/ehca/ehca_iverbs.h
15112 views
/*1* IBM eServer eHCA Infiniband device driver for Linux on POWER2*3* Function definitions for internal functions4*5* Authors: Heiko J Schick <[email protected]>6* Dietmar Decker <[email protected]>7*8* Copyright (c) 2005 IBM Corporation9*10* All rights reserved.11*12* This source code is distributed under a dual license of GPL v2.0 and OpenIB13* BSD.14*15* OpenIB BSD License16*17* Redistribution and use in source and binary forms, with or without18* modification, are permitted provided that the following conditions are met:19*20* Redistributions of source code must retain the above copyright notice, this21* list of conditions and the following disclaimer.22*23* Redistributions in binary form must reproduce the above copyright notice,24* this list of conditions and the following disclaimer in the documentation25* and/or other materials26* provided with the distribution.27*28* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"29* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE30* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE31* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE32* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR33* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF34* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR35* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER36* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)37* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE38* POSSIBILITY OF SUCH DAMAGE.39*/4041#ifndef __EHCA_IVERBS_H__42#define __EHCA_IVERBS_H__4344#include "ehca_classes.h"4546int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props);4748int ehca_query_port(struct ib_device *ibdev, u8 port,49struct ib_port_attr *props);5051int ehca_query_sma_attr(struct ehca_shca *shca, u8 port,52struct ehca_sma_attr *attr);5354int ehca_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 * pkey);5556int ehca_query_gid(struct ib_device *ibdev, u8 port, int index,57union ib_gid *gid);5859int ehca_modify_port(struct ib_device *ibdev, u8 port, int port_modify_mask,60struct ib_port_modify *props);6162struct ib_pd *ehca_alloc_pd(struct ib_device *device,63struct ib_ucontext *context,64struct ib_udata *udata);6566int ehca_dealloc_pd(struct ib_pd *pd);6768struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);6970int ehca_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);7172int ehca_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);7374int ehca_destroy_ah(struct ib_ah *ah);7576struct ib_mr *ehca_get_dma_mr(struct ib_pd *pd, int mr_access_flags);7778struct ib_mr *ehca_reg_phys_mr(struct ib_pd *pd,79struct ib_phys_buf *phys_buf_array,80int num_phys_buf,81int mr_access_flags, u64 *iova_start);8283struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,84u64 virt, int mr_access_flags,85struct ib_udata *udata);8687int ehca_rereg_phys_mr(struct ib_mr *mr,88int mr_rereg_mask,89struct ib_pd *pd,90struct ib_phys_buf *phys_buf_array,91int num_phys_buf, int mr_access_flags, u64 *iova_start);9293int ehca_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr);9495int ehca_dereg_mr(struct ib_mr *mr);9697struct ib_mw *ehca_alloc_mw(struct ib_pd *pd);9899int ehca_bind_mw(struct ib_qp *qp, struct ib_mw *mw,100struct ib_mw_bind *mw_bind);101102int ehca_dealloc_mw(struct ib_mw *mw);103104struct ib_fmr *ehca_alloc_fmr(struct ib_pd *pd,105int mr_access_flags,106struct ib_fmr_attr *fmr_attr);107108int ehca_map_phys_fmr(struct ib_fmr *fmr,109u64 *page_list, int list_len, u64 iova);110111int ehca_unmap_fmr(struct list_head *fmr_list);112113int ehca_dealloc_fmr(struct ib_fmr *fmr);114115enum ehca_eq_type {116EHCA_EQ = 0, /* Event Queue */117EHCA_NEQ /* Notification Event Queue */118};119120int ehca_create_eq(struct ehca_shca *shca, struct ehca_eq *eq,121enum ehca_eq_type type, const u32 length);122123int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq);124125void *ehca_poll_eq(struct ehca_shca *shca, struct ehca_eq *eq);126127128struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,129struct ib_ucontext *context,130struct ib_udata *udata);131132int ehca_destroy_cq(struct ib_cq *cq);133134int ehca_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata);135136int ehca_poll_cq(struct ib_cq *cq, int num_entries, struct ib_wc *wc);137138int ehca_peek_cq(struct ib_cq *cq, int wc_cnt);139140int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags notify_flags);141142struct ib_qp *ehca_create_qp(struct ib_pd *pd,143struct ib_qp_init_attr *init_attr,144struct ib_udata *udata);145146int ehca_destroy_qp(struct ib_qp *qp);147148int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,149struct ib_udata *udata);150151int ehca_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,152int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);153154int ehca_post_send(struct ib_qp *qp, struct ib_send_wr *send_wr,155struct ib_send_wr **bad_send_wr);156157int ehca_post_recv(struct ib_qp *qp, struct ib_recv_wr *recv_wr,158struct ib_recv_wr **bad_recv_wr);159160int ehca_post_srq_recv(struct ib_srq *srq,161struct ib_recv_wr *recv_wr,162struct ib_recv_wr **bad_recv_wr);163164struct ib_srq *ehca_create_srq(struct ib_pd *pd,165struct ib_srq_init_attr *init_attr,166struct ib_udata *udata);167168int ehca_modify_srq(struct ib_srq *srq, struct ib_srq_attr *attr,169enum ib_srq_attr_mask attr_mask, struct ib_udata *udata);170171int ehca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);172173int ehca_destroy_srq(struct ib_srq *srq);174175u64 ehca_define_sqp(struct ehca_shca *shca, struct ehca_qp *ibqp,176struct ib_qp_init_attr *qp_init_attr);177178int ehca_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);179180int ehca_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);181182struct ib_ucontext *ehca_alloc_ucontext(struct ib_device *device,183struct ib_udata *udata);184185int ehca_dealloc_ucontext(struct ib_ucontext *context);186187int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);188189int ehca_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,190struct ib_wc *in_wc, struct ib_grh *in_grh,191struct ib_mad *in_mad,192struct ib_mad *out_mad);193194void ehca_poll_eqs(unsigned long data);195196int ehca_calc_ipd(struct ehca_shca *shca, int port,197enum ib_rate path_rate, u32 *ipd);198199void ehca_add_to_err_list(struct ehca_qp *qp, int on_sq);200201#ifdef CONFIG_PPC_64K_PAGES202void *ehca_alloc_fw_ctrlblock(gfp_t flags);203void ehca_free_fw_ctrlblock(void *ptr);204#else205#define ehca_alloc_fw_ctrlblock(flags) ((void *)get_zeroed_page(flags))206#define ehca_free_fw_ctrlblock(ptr) free_page((unsigned long)(ptr))207#endif208209void ehca_recover_sqp(struct ib_qp *sqp);210211#endif212213214