2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _DAPL_TAVOR_IMPL_H
2N/A#define _DAPL_TAVOR_IMPL_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <sys/types.h>
2N/A
2N/A#include "dapl_hash.h"
2N/A#include "dapl_tavor_ibtf.h"
2N/A#include "dapl_tavor_wr.h"
2N/A
2N/A/*
2N/A * Struct defining the hca handle
2N/A */
2N/Astruct dapls_ib_hca_handle {
2N/A int ia_fd; /* fd corresponding to the IA */
2N/A minor_t ia_rnum; /* Kernel resource number of the IA */
2N/A int hca_fd; /* fd for the HCA ie. tavor */
2N/A int *ia_bf_toggle; /* toggle between the 2 bf buffers */
2N/A dapls_hw_uar_t ia_uar; /* pointer to the HCA UAR page */
2N/A void *ia_bf; /* pointer to the Hermon Blueflame page */
2N/A};
2N/A
2N/A/*
2N/A * Struct defining the CQ handle
2N/A */
2N/Astruct dapls_ib_cq_handle {
2N/A uint64_t evd_hkey;
2N/A uint32_t cq_num;
2N/A uint32_t cq_size;
2N/A uint32_t cq_cqesz;
2N/A off64_t cq_map_offset;
2N/A uint64_t cq_map_len;
2N/A dapls_hw_uar_t cq_iauar; /* copy of the UAR doorbell page */
2N/A dapls_hw_cqe_t cq_addr;
2N/A uint32_t cq_consindx;
2N/A uint32_t cq_log_cqsz;
2N/A /* For Work Request ID processing */
2N/A DAPL_OS_LOCK cq_wrid_wqhdr_lock;
2N/A DAPL_HASH_TABLE *cq_wrid_wqhdr_list;
2N/A dapls_tavor_wrid_list_hdr_t *cq_wrid_reap_head;
2N/A dapls_tavor_wrid_list_hdr_t *cq_wrid_reap_tail;
2N/A /* For Arbel or Hermon */
2N/A uint32_t *cq_poll_dbp;
2N/A uint32_t *cq_arm_dbp;
2N/A /* For Hermon cq_resize */
2N/A dapls_hw_cqe_t cq_resize_addr;
2N/A off64_t cq_resize_map_offset;
2N/A uint64_t cq_resize_map_len;
2N/A uint32_t cq_resize_size;
2N/A uint32_t cq_resize_cqesz;
2N/A};
2N/A
2N/Astruct dapls_ib_qp_handle {
2N/A uint64_t ep_hkey;
2N/A caddr_t qp_addr;
2N/A uint64_t qp_map_len;
2N/A uint32_t qp_num;
2N/A dapls_hw_uar_t qp_iauar; /* copy of the UAR doorbell page */
2N/A void *qp_ia_bf; /* copy of the Hermon Blueflame pg */
2N/A int *qp_ia_bf_toggle; /* ptr to adapter toggle */
2N/A uint32_t qp_num_mpt_shift; /* Max # of MPT entries */
2N/A /* in bit shift */
2N/A uint32_t qp_num_premature_events;
2N/A ib_work_completion_t *qp_premature_events;
2N/A
2N/A /* Send Work Queue */
2N/A ib_cq_handle_t qp_sq_cqhdl;
2N/A uint64_t *qp_sq_lastwqeaddr;
2N/A dapls_tavor_workq_hdr_t *qp_sq_wqhdr;
2N/A caddr_t qp_sq_buf;
2N/A uint32_t qp_sq_desc_addr;
2N/A uint32_t qp_sq_numwqe;
2N/A uint32_t qp_sq_wqesz;
2N/A uint32_t qp_sq_sgl;
2N/A uint16_t qp_sq_counter;
2N/A uint32_t qp_sq_headroom; /* For Hermon */
2N/A int qp_sq_inline;
2N/A uint32_t *qp_sq_dbp; /* For Arbel */
2N/A
2N/A /* Receive Work Queue */
2N/A ib_cq_handle_t qp_rq_cqhdl;
2N/A uint64_t *qp_rq_lastwqeaddr;
2N/A dapls_tavor_workq_hdr_t *qp_rq_wqhdr;
2N/A caddr_t qp_rq_buf;
2N/A uint32_t qp_rq_desc_addr;
2N/A uint32_t qp_rq_numwqe;
2N/A uint32_t qp_rq_wqesz;
2N/A uint32_t qp_rq_sgl;
2N/A uint32_t *qp_rq_dbp; /* For Arbel or Hermon */
2N/A uint16_t qp_rq_counter; /* For Arbel or Hermon */
2N/A
2N/A /* SRQ related */
2N/A uint32_t qp_srq_enabled; /* QP will use an SRQ */
2N/A ib_srq_handle_t qp_srq;
2N/A};
2N/A
2N/A/*
2N/A * Structure defining the protection domain handle
2N/A */
2N/Astruct dapls_ib_pd_handle {
2N/A uint64_t pd_hkey;
2N/A};
2N/A
2N/A/*
2N/A * Structure defining the memory region handle
2N/A */
2N/Astruct dapls_ib_mr_handle {
2N/A uint64_t mr_hkey;
2N/A};
2N/A
2N/A/*
2N/A * Structure defining the memory window handle
2N/A */
2N/Astruct dapls_ib_mw_handle {
2N/A uint64_t mw_hkey;
2N/A};
2N/A
2N/A/*
2N/A * Structure defining the service provider handle
2N/A */
2N/Astruct dapls_ib_cm_srvc_handle {
2N/A uint64_t sv_sp_hkey;
2N/A};
2N/A
2N/A/*
2N/A * Structure defining the service provider handle
2N/A */
2N/Astruct dapls_ib_srq_handle {
2N/A uint64_t srq_hkey;
2N/A caddr_t srq_addr;
2N/A uint64_t srq_map_offset;
2N/A uint64_t srq_map_len;
2N/A uint32_t srq_num;
2N/A dapls_hw_uar_t srq_iauar; /* copy of the UAR doorbell page */
2N/A uint32_t *srq_dbp; /* For Arbel or Hermon */
2N/A
2N/A /* Work Queue */
2N/A int32_t srq_wq_lastwqeindex;
2N/A uint32_t srq_wq_desc_addr;
2N/A uint32_t srq_wq_numwqe;
2N/A uint32_t srq_wq_wqesz;
2N/A uint32_t srq_wq_sgl;
2N/A uint16_t srq_counter;
2N/A /* premature events */
2N/A ib_work_completion_t *srq_premature_events;
2N/A uint32_t *srq_freepr_events; /* free premature events */
2N/A uint32_t srq_freepr_head;
2N/A uint32_t srq_freepr_tail;
2N/A uint32_t srq_freepr_num_events;
2N/A /* For Work Request ID processing */
2N/A dapls_tavor_wrid_list_hdr_t *srq_wridlist;
2N/A /* EP Hash Table, key is QP number */
2N/A DAPL_HASH_TABLE *srq_ep_table;
2N/A};
2N/A
2N/A/*
2N/A * Struct that defines key per HCA instance information for OS
2N/A * bypass implementation.
2N/A */
2N/Astruct dapls_ib_hca_state {
2N/A int hca_fd;
2N/A void *uarpg_baseaddr; /* base addr of the UAR page */
2N/A size_t uarpg_size; /* size of the UAR page */
2N/A void *bf_pg_baseaddr; /* base addr of the Hermon Blueflame page */
2N/A int bf_toggle;
2N/A char hca_path[MAXPATHLEN];
2N/A};
2N/A
2N/ADAPL_OS_LOCK dapls_ib_dbp_lock;
2N/A
2N/A/* Function that returns a pointer to the specified doorbell entry */
2N/Auint32_t *dapls_ib_get_dbp(uint64_t maplen, int fd, uint64_t mapoffset,
2N/A uint32_t offset);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _DAPL_TAVOR_IMPL_H */