linux/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h

/*
 * Copyright (c) 2012-2016 VMware, Inc.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of EITHER the GNU General Public License
 * version 2 as published by the Free Software Foundation or the BSD
 * 2-Clause License. This program is distributed in the hope that it
 * will be useful, but WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED
 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License version 2 for more details at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program available in the file COPYING in the main
 * directory of this source tree.
 *
 * The BSD 2-Clause 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 HOLDER 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 __PVRDMA_H__
#define __PVRDMA_H__

#include <linux/compiler.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/pci.h>
#include <linux/semaphore.h>
#include <linux/workqueue.h>
#include <rdma/ib_umem.h>
#include <rdma/ib_verbs.h>
#include <rdma/vmw_pvrdma-abi.h>

#include "pvrdma_ring.h"
#include "pvrdma_dev_api.h"
#include "pvrdma_verbs.h"

/* NOT the same as BIT_MASK(). */
#define PVRDMA_MASK(n)

/*
 * VMware PVRDMA PCI device id.
 */
#define PCI_DEVICE_ID_VMWARE_PVRDMA

#define PVRDMA_NUM_RING_PAGES
#define PVRDMA_QP_NUM_HEADER_PAGES

struct pvrdma_dev;

struct pvrdma_page_dir {};

struct pvrdma_cq {};

struct pvrdma_id_table {};

struct pvrdma_uar_map {};

struct pvrdma_uar_table {};

struct pvrdma_ucontext {};

struct pvrdma_pd {};

struct pvrdma_mr {};

struct pvrdma_user_mr {};

struct pvrdma_wq {};

struct pvrdma_ah {};

struct pvrdma_srq {};

struct pvrdma_qp {};

struct pvrdma_dev {};

struct pvrdma_netdevice_work {};

static inline struct pvrdma_dev *to_vdev(struct ib_device *ibdev)
{}

static inline struct
pvrdma_ucontext *to_vucontext(struct ib_ucontext *ibucontext)
{}

static inline struct pvrdma_pd *to_vpd(struct ib_pd *ibpd)
{}

static inline struct pvrdma_cq *to_vcq(struct ib_cq *ibcq)
{}

static inline struct pvrdma_srq *to_vsrq(struct ib_srq *ibsrq)
{}

static inline struct pvrdma_user_mr *to_vmr(struct ib_mr *ibmr)
{}

static inline struct pvrdma_qp *to_vqp(struct ib_qp *ibqp)
{}

static inline struct pvrdma_ah *to_vah(struct ib_ah *ibah)
{}

static inline void pvrdma_write_reg(struct pvrdma_dev *dev, u32 reg, u32 val)
{}

static inline u32 pvrdma_read_reg(struct pvrdma_dev *dev, u32 reg)
{}

static inline void pvrdma_write_uar_cq(struct pvrdma_dev *dev, u32 val)
{}

static inline void pvrdma_write_uar_qp(struct pvrdma_dev *dev, u32 val)
{}

static inline void *pvrdma_page_dir_get_ptr(struct pvrdma_page_dir *pdir,
					    u64 offset)
{}

static inline enum pvrdma_mtu ib_mtu_to_pvrdma(enum ib_mtu mtu)
{}

static inline enum ib_mtu pvrdma_mtu_to_ib(enum pvrdma_mtu mtu)
{}

static inline enum pvrdma_port_state ib_port_state_to_pvrdma(
					enum ib_port_state state)
{}

static inline enum ib_port_state pvrdma_port_state_to_ib(
					enum pvrdma_port_state state)
{}

static inline int pvrdma_port_cap_flags_to_ib(int flags)
{}

static inline enum pvrdma_port_width ib_port_width_to_pvrdma(
					enum ib_port_width width)
{}

static inline enum ib_port_width pvrdma_port_width_to_ib(
					enum pvrdma_port_width width)
{}

static inline enum pvrdma_port_speed ib_port_speed_to_pvrdma(
					enum ib_port_speed speed)
{}

static inline enum ib_port_speed pvrdma_port_speed_to_ib(
					enum pvrdma_port_speed speed)
{}

static inline int ib_qp_attr_mask_to_pvrdma(int attr_mask)
{}

static inline enum pvrdma_mig_state ib_mig_state_to_pvrdma(
					enum ib_mig_state state)
{}

static inline enum ib_mig_state pvrdma_mig_state_to_ib(
					enum pvrdma_mig_state state)
{}

static inline int ib_access_flags_to_pvrdma(int flags)
{}

static inline int pvrdma_access_flags_to_ib(int flags)
{}

static inline enum pvrdma_qp_type ib_qp_type_to_pvrdma(enum ib_qp_type type)
{}

static inline enum pvrdma_qp_state ib_qp_state_to_pvrdma(enum ib_qp_state state)
{}

static inline enum ib_qp_state pvrdma_qp_state_to_ib(enum pvrdma_qp_state state)
{}

static inline enum pvrdma_wr_opcode ib_wr_opcode_to_pvrdma(enum ib_wr_opcode op)
{}

static inline enum ib_wc_status pvrdma_wc_status_to_ib(
					enum pvrdma_wc_status status)
{}

static inline int pvrdma_wc_opcode_to_ib(unsigned int opcode)
{}

static inline int pvrdma_wc_flags_to_ib(int flags)
{}

static inline int ib_send_flags_to_pvrdma(int flags)
{}

static inline int pvrdma_network_type_to_ib(enum pvrdma_network_type type)
{}

void pvrdma_qp_cap_to_ib(struct ib_qp_cap *dst,
			 const struct pvrdma_qp_cap *src);
void ib_qp_cap_to_pvrdma(struct pvrdma_qp_cap *dst,
			 const struct ib_qp_cap *src);
void pvrdma_gid_to_ib(union ib_gid *dst, const union pvrdma_gid *src);
void ib_gid_to_pvrdma(union pvrdma_gid *dst, const union ib_gid *src);
void pvrdma_global_route_to_ib(struct ib_global_route *dst,
			       const struct pvrdma_global_route *src);
void ib_global_route_to_pvrdma(struct pvrdma_global_route *dst,
			       const struct ib_global_route *src);
void pvrdma_ah_attr_to_rdma(struct rdma_ah_attr *dst,
			    const struct pvrdma_ah_attr *src);
void rdma_ah_attr_to_pvrdma(struct pvrdma_ah_attr *dst,
			    const struct rdma_ah_attr *src);
u8 ib_gid_type_to_pvrdma(enum ib_gid_type gid_type);

int pvrdma_uar_table_init(struct pvrdma_dev *dev);
void pvrdma_uar_table_cleanup(struct pvrdma_dev *dev);

int pvrdma_uar_alloc(struct pvrdma_dev *dev, struct pvrdma_uar_map *uar);
void pvrdma_uar_free(struct pvrdma_dev *dev, struct pvrdma_uar_map *uar);

void _pvrdma_flush_cqe(struct pvrdma_qp *qp, struct pvrdma_cq *cq);

int pvrdma_page_dir_init(struct pvrdma_dev *dev, struct pvrdma_page_dir *pdir,
			 u64 npages, bool alloc_pages);
void pvrdma_page_dir_cleanup(struct pvrdma_dev *dev,
			     struct pvrdma_page_dir *pdir);
int pvrdma_page_dir_insert_dma(struct pvrdma_page_dir *pdir, u64 idx,
			       dma_addr_t daddr);
int pvrdma_page_dir_insert_umem(struct pvrdma_page_dir *pdir,
				struct ib_umem *umem, u64 offset);
dma_addr_t pvrdma_page_dir_get_dma(struct pvrdma_page_dir *pdir, u64 idx);
int pvrdma_page_dir_insert_page_list(struct pvrdma_page_dir *pdir,
				     u64 *page_list, int num_pages);

int pvrdma_cmd_post(struct pvrdma_dev *dev, union pvrdma_cmd_req *req,
		    union pvrdma_cmd_resp *rsp, unsigned resp_code);

#endif /* __PVRDMA_H__ */