9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * CDDL HEADER START
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The contents of this file are subject to the terms of the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Common Development and Distribution License (the "License").
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * You may not use this file except in compliance with the License.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * or http://www.opensolaris.org/os/licensing.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * See the License for the specific language governing permissions
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and limitations under the License.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * When distributing Covered Code, include this CDDL HEADER in each
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * If applicable, add the following below this CDDL HEADER, with the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * fields enclosed by brackets "[]" replaced with your own identifying
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * information: Portions Copyright [yyyy] [name of copyright owner]
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * CDDL HEADER END
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#ifndef _SYS_IB_ADAPTERS_HERMON_MISC_H
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define _SYS_IB_ADAPTERS_HERMON_MISC_H
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * hermon_misc.h
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Contains all of the prototypes, #defines, and structures necessary
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * for the Hermon Miscellaneous routines - Address Handle, Multicast,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Protection Domain, port-related, statistics (kstat) routines, and
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * extra VTS related routines.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Many of these functions are called by other parts of the Hermon driver
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * (and several routines are directly exposed through the IBTF CI
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * interface and/or kstat interface).
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <sys/types.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <sys/conf.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <sys/ddi.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <sys/sunddi.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <sys/ib/adapters/hermon/hermon_typedef.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <sys/ib/adapters/hermon/hermon_ioctl.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <sys/ib/adapters/hermon/hermon_rsrc.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <sys/ib/adapters/hermon/hermon_hw.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#ifdef __cplusplus
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorextern "C" {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#endif
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following defines specify the default number of Address Handles (AH)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and their size (in the hardware). By default the maximum number of address
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * handles is set to 32K. This value is controllable through the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * "hermon_log_num_ah" configuration variable. Note: Hermon Address Handles
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * are also referred to as UD Address Vectors (UDAV).
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_NUM_AH_SHIFT 0xF
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_NUM_AH (1 << HERMON_NUM_AH_SHIFT)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_UDAV_SIZE_SHIFT 0x5
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_UDAV_SIZE (1 << HERMON_UDAV_SIZE_SHIFT)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following macro determines whether the contents of a UDAV need to be
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * sync'd (with ddi_dma_sync()). This decision is based on whether the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * UDAV is in DDR memory (no sync) or system memory (sync required).
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_UDAV_IS_SYNC_REQ(state) \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (((&((state)->ts_rsrc_hdl[HERMON_UDAV]))->rsrc_loc == \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HERMON_IN_DDR) ? 0 : 1)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * These defines are used by hermon_get_addr_path() and hermon_set_addr_path()
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * below. They indicate the type of hardware context being passed in the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * "path" argument. Because the Hermon hardware formats for the QP address
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * path and UDAV address path structures is so similar, but not exactly the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * same, we use these flags to indicate which type of structure is being
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * read from or written to.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_ADDRPATH_QP 0x0
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_ADDRPATH_UDAV 0x1
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following defines specify the default number of Multicast Groups (MCG)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and the maximum number of QP which can be associated with each. By default
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the maximum number of multicast groups is set to 256, and the maximum number
9fa01faf81019677b9c27c7bdf6a310284d4ccb1agiri * of QP per multicast group is set to 248 (256 4-byte slots minus the 8 slots
9fa01faf81019677b9c27c7bdf6a310284d4ccb1agiri * in the header). The first of these values is controllable through the
9fa01faf81019677b9c27c7bdf6a310284d4ccb1agiri * "hermon_log_num_mcg" configuration variable. "hermon_num_qp_per_mcg" is
9fa01faf81019677b9c27c7bdf6a310284d4ccb1agiri * also available if the customer needs such a large capability.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_NUM_MCG_SHIFT 0x8
9fa01faf81019677b9c27c7bdf6a310284d4ccb1agiri#define HERMON_NUM_QP_PER_MCG_MIN 0x8
9fa01faf81019677b9c27c7bdf6a310284d4ccb1agiri#define HERMON_NUM_QP_PER_MCG 0xf8
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9fa01faf81019677b9c27c7bdf6a310284d4ccb1agiri#define HERMON_MCGMEM_SZ(state) \
9fa01faf81019677b9c27c7bdf6a310284d4ccb1agiri ((((state)->hs_cfg_profile->cp_num_qp_per_mcg) + 8) << 2)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Macro to compute the offset of the QP list in a given MCG entry.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_GET_QPLIST_PTR(mcg) \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ((hermon_hw_mcg_qp_list_t *)((uintptr_t)(mcg) + \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor sizeof (hermon_hw_mcg_t)))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following defines specify the characteristics of the Hermon multicast
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * group hash table. The HERMON_NUM_MCG_HASH_SHIFT defines the size of the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * hash table (as a power-of-2), which is set to 16 by default. This value
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * is controllable through the "hermon_log_num_mcg_hash" configuration variable,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * but serious consideration should be taken before changing this value. Note:
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * its appropriate size should be a function of the entire table size (as
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * defined by "hermon_log_num_mcg" and HERMON_NUM_MCG_SHIFT above).
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_NUM_MCG_HASH_SHIFT 0x4
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following defines are used by the multicast routines to determine
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * if a given "multicast GID" is valid or not (see hermon_mcg_is_mgid_valid
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * for more details. These values are pulled from the IBA specification,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * rev. 1.1
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_TOPBITS_SHIFT 56
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_TOPBITS_MASK 0xFF
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_TOPBITS 0xFF
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_FLAGS_SHIFT 52
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_FLAGS_MASK 0xF
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_FLAGS_PERM 0x0
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_FLAGS_NONPERM 0x1
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_SCOPE_SHIFT 48
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_SCOPE_MASK 0xF
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_SCOPE_LINKLOC 0x2
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_SCOPE_SITELOC 0x5
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_SCOPE_ORGLOC 0x8
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MCG_SCOPE_GLOBAL 0xE
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following defines specify the default number of Protection Domains (PD).
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * By default the maximum number of protection domains is set to 64K. This
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * value is controllable through the "hermon_log_num_pd" configuration variable.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_NUM_PD_SHIFT 0x10
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following defines specify the default number of Partition Keys (PKey)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * per port. By default the maximum number of PKeys is set to 32 per port, for
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * a total of 64 (assuming two ports) . This value is controllable through the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * "hermon_log_max_pkeytbl" configuration variable.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_NUM_PKEYTBL_SHIFT 0x5
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_NUM_PKEYTBL (1 << HERMON_NUM_PKEYTBL_SHIFT)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following defines specify the default number of SGIDs per port. By
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * default the maximum number of GIDS per port is set to 16. This value
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * is controllable through the "hermon_log_max_gidtbl" configuration variable.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_NUM_GIDTBL_SHIFT 0x4
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_NUM_GIDTBL (1 << HERMON_NUM_GIDTBL_SHIFT)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Below is a define which is the default number of UAR pages. By default, the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * maximum number of UAR pages is set to 1024 for hermon. Note that
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * BlueFlame (if enabled) will take 1/2 the space behind BAR1 (the UAR BAR)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and therefore we must limit this even further. This value is controllable
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * through the "hermon_log_num_uar" configuration variable. NOTE: This value
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * should not be set larger than 15 (0xF) because the UAR index number is
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * used as part of the minor number calculation (see hermon_open() for details)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and the minor numbers should not be larger than eighteen bits (i.e. 15 bits
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * of UAR index, 3 bits of driver instance number). This is especially true
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * for 32-bit kernels.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_NUM_UAR_SHIFT 0xA
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * A DoorBell record (DBr) will be handled uniquely. They are not in ICM now,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * so they don't need the mapping. And they just need to be accessible to the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * HCA as an address, so we don't need to register the memory. AND, since
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * user level (uDAPL, OPEN verbs) won't ever do the unmapping of them we don't
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * really need to worry about that either. And the DBrs will have to live in
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * user mappable memory. So, we can shortcut a lot of things given these
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * assumptions.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Other facts: the DBrs for Hermon are only two per qp - one for the Receive
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * side (RQ or SRQ) and one for the CQ. If a QP is associated with an SRQ, we
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * only need the ONE for the SRQ. Also, although the RQ/SRQ DBr is only 4-bytes
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * while the CQ DBr is 8-bytes, all DBrs will be 8-bytes (see the union below).
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Though it may lead to minor wastage, it also means that reuse is easier since
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * any DBr can be used for either, and we don't have to play allocation games.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
dd9e16da4243358c2e9251a4ca5d50f56e0adc68agiri * The state structure will hold the pointer to the start of a list of struct
dd9e16da4243358c2e9251a4ca5d50f56e0adc68agiri * hermon_dbr_info_s, each one containing the necessary information to manage
dd9e16da4243358c2e9251a4ca5d50f56e0adc68agiri * a page of DBr's.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef uint64_t hermon_dbr_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_dbr_info_s {
dd9e16da4243358c2e9251a4ca5d50f56e0adc68agiri struct hermon_dbr_info_s *dbr_link;
dd9e16da4243358c2e9251a4ca5d50f56e0adc68agiri hermon_dbr_t *dbr_page; /* virtual addr of page */
dd9e16da4243358c2e9251a4ca5d50f56e0adc68agiri uint64_t dbr_paddr; /* physical addr of page */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ddi_acc_handle_t dbr_acchdl;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ddi_dma_handle_t dbr_dmahdl;
dd9e16da4243358c2e9251a4ca5d50f56e0adc68agiri uint32_t dbr_nfree; /* #free DBrs in this page */
dd9e16da4243358c2e9251a4ca5d50f56e0adc68agiri uint32_t dbr_firstfree; /* idx of first free DBr */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor} hermon_dbr_info_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
dd9e16da4243358c2e9251a4ca5d50f56e0adc68agiri#define HERMON_NUM_DBR_PER_PAGE (PAGESIZE / sizeof (hermon_dbr_t))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * These defines specify some miscellaneous port-related configuration
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * information. Specifically, HERMON_MAX_MTU is used to define the maximum
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * MTU supported for each Hermon port, HERMON_MAX_PORT_WIDTH is used to define
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the maximum supported port width, and the HERMON_MAX_VLCAP define is used
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * to specify the maximum number of VLs supported, excluding VL15. Both
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * of these values are controllable and get be set using the "hermon_max_mtu"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and "hermon_max_vlcap" configuration variables. Note: as with many of the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * configurable variables, caution should be exercised when changing these
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * values. These values, specifically, should not be set any larger than
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * they are defined here as these are set to the current Hermon device
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * maximums.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Note that: with Hermon, these capabilities that were formerly retrieved
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * as part of QUERY_DEV_LIM/CAP must now be retrieved with QUERY_PORT.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The init sequence will have to be altered vis-a-vis the older HCAs to
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * accommodate this change.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Also, the maximums will be changed here for now.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MAX_MTU 0x5 /* was 0x4, 2048 but moved to 4096 */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MAX_PORT_WIDTH 0x7 /* was 0x3 (1x/4x) but now 1/4/8x */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_MAX_VLCAP 0x8 /* remain the same for now */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * These last defines are used by the statistics counting routines (kstats)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * for initialization of the structures associated with the IB statistics
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * access routines. The HERMON_CNTR_MASK and HERMON_CNTR_SIZE defines are
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * used to divide the "pcr" register into two 32-bit counters (one for "pic0"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and the other for "pic1")
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_CNTR_MASK 0xFFFFFFFF
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_CNTR_SIZE 32
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_CNTR_NUMENTRIES 17
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_QUEUE_LOCATION_NORMAL 0x1
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_QUEUE_LOCATION_USERLAND 0x2
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Minimum number of ticks to delay between successive polls of the CQ in
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * VTS ioctl loopback test
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_VTS_LOOPBACK_MIN_WAIT_DUR 50
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * UAR software table, layout and associated structures
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Doorbell record table bitmap macros
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_IND_BYTE(ind) ((ind) >> 3)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_IND_BIT(ind) (1 << ((ind) & 0x7))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_BMAP_BIT_SET(bmap, ind) \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ((bmap)[HERMON_IND_BYTE(ind)] |= HERMON_IND_BIT(ind))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_BMAP_BIT_CLR(bmap, ind) \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ((bmap)[HERMON_IND_BYTE(ind)] &= ~HERMON_IND_BIT(ind))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define HERMON_BMAP_BIT_ISSET(bmap, ind) \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ((bmap)[HERMON_IND_BYTE(ind)] & HERMON_IND_BIT(ind))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * User doorbell record page tracking
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_udbr_page_s hermon_udbr_page_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorstruct hermon_udbr_page_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_udbr_page_t *upg_link;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t upg_index;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t upg_nfree;
1ed53a3f65abecaadc1b967e341970ad0f6b2aebBill Taylor uint64_t *upg_free;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor caddr_t upg_kvaddr;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor struct buf *upg_buf;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ddi_umem_cookie_t upg_umemcookie;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ddi_dma_handle_t upg_dmahdl;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ddi_dma_cookie_t upg_dmacookie;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor};
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_udbr_mgmt_s hermon_user_dbr_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorstruct hermon_udbr_mgmt_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_user_dbr_t *udbr_link;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t udbr_index; /* same as uarpg */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_udbr_page_t *udbr_pagep;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor};
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * doorbell tracking end
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The hermon_sw_ah_s structure is also referred to using the "hermon_ahhdl_t"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * typedef (see hermon_typedef.h). It encodes all the information necessary
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * to track the various resources needed to allocate, query, modify, and
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * free an address handle.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * In specific, it has a lock to ensure single-threaded access. It stores a
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * pointer to the associated PD handle, and also contains a copy of the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * GUID stored into the address handle. The reason for this extra copy of
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the GUID info has to do with Hermon PRM compliance and is fully explained
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * in hermon_misc.c
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * To serve in it's primary function, it also contains a UDAV, which contains
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * all of the data associated with the UD address vector that is being
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * utilized by the holder of the address handle. The hardware-specific format
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * of the UDAV is defined in the hermon_hw.h file.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * It also has the always necessary backpointer to the resource for the AH
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * handle structure itself.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorstruct hermon_sw_ah_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor kmutex_t ah_lock;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_pdhdl_t ah_pdhdl;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_hw_udav_t *ah_udav;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_rsrc_t *ah_rsrcp;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t ah_save_guid;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor};
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor_NOTE(READ_ONLY_DATA(hermon_sw_ah_s::ah_udav))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor_NOTE(MUTEX_PROTECTS_DATA(hermon_sw_ah_s::ah_lock,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_sw_ah_s::ah_pdhdl
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_sw_ah_s::ah_rsrcp
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_sw_ah_s::ah_save_guid))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The hermon_sw_mcg_list_s structure is also referred to using the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * "hermon_mcghdl_t" typedef (see hermon_typedef.h). It encodes all the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * information necessary to track the various resources needed to for attaching
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and detaching QP from multicast groups.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The Hermon driver keeps an array of these and uses them as a shadow for
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the real HW-based MCG table. They hold all the necessary information
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * to track the resources and to allow fast access to the MCG table. First,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * it had a 128-bit multicast GID (stored in "mcg_mgid_h" and "mcg_mgid_l".
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * next if has a field to indicate the index of the next hermon_mcghdl_t in
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the current hash chain (zero is the end of the chain). Note: this very
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * closely mimics what the hardware MCG entry has. Then it has a field to
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * indicate how many QP are currently attached to the given MCG. And, lastly,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * it has the obligatory backpointer to the resource for the MCH handle
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * structure itself.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorstruct hermon_sw_mcg_list_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t mcg_mgid_h;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t mcg_mgid_l;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t mcg_next_indx;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t mcg_num_qps;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_rsrc_t *mcg_rsrcp;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor};
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The hermon_sw_pd_s structure is also referred to using the "hermon_pdhdl_t"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * typedef (see hermon_typedef.h). It encodes all the information necessary
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * to track the various resources needed to allocate and free protection
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * domains
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Specifically, it has reference count and a lock to ensure single threaded
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * access to it. It has a field for the protection domain number ("pd_pdnum").
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * And it also has the obligatory backpointer to the resource for the PD
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * handle structure itself.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorstruct hermon_sw_pd_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor kmutex_t pd_lock;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint32_t pd_pdnum;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint32_t pd_refcnt;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_rsrc_t *pd_rsrcp;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor};
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor_NOTE(READ_ONLY_DATA(hermon_sw_pd_s::pd_pdnum
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_sw_pd_s::pd_rsrcp))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor_NOTE(MUTEX_PROTECTS_DATA(hermon_sw_pd_s::pd_lock,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_sw_pd_s::pd_refcnt))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The hermon_qalloc_info_s structure is also referred to using the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * "hermon_qalloc_info_t" typedef (see hermon_typedef.h). It holds all the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * information necessary to track the resources for each of the various Hermon
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * queue types (i.e. Event Queue, Completion Queue, Work Queue).
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Specifically, it has the size, alignment restrictions, and location (in DDR
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * or in system memory). And depending on the location, it also has the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * ddi_dma_handle_t, ddi_acc_handle_t, and pointers used for reading/writing to
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the queue's memory.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorstruct hermon_qalloc_info_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t qa_size;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t qa_alloc_align;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t qa_bind_align;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint32_t *qa_buf_real;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint32_t *qa_buf_aligned;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t qa_buf_realsz;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t qa_pgoffs;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t qa_location;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ddi_dma_handle_t qa_dmahdl;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ddi_acc_handle_t qa_acchdl;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ddi_umem_cookie_t qa_umemcookie;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor};
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The hermon_ks_mask_t structure encodes all the information necessary for
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the individual kstat entries. The "ks_reg_offset" field contains the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * hardware offset for the corresponding counter, and "ks_reg_shift" and
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * "ks_reg_mask" contain shift and mask registers used by the access routines.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Also the "ks_old_pic0" and "ks_old_pic1" fields contain the most recently
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * read value for the corresponding port ("pic"). Note: An array of these
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * structures is part of the "hermon_ks_info_t" structure below.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_ks_mask_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor char *ks_evt_name;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint32_t ks_old_pic0;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint32_t ks_old_pic1;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor} hermon_ks_mask_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala/*
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala * Index into the named data components of 64 bit "perf_counters" kstat.
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala */
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummalaenum {
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala HERMON_PERFCNTR64_ENABLE_IDX = 0,
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala HERMON_PERFCNTR64_XMIT_DATA_IDX,
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala HERMON_PERFCNTR64_RECV_DATA_IDX,
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala HERMON_PERFCNTR64_XMIT_PKTS_IDX,
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala HERMON_PERFCNTR64_RECV_PKTS_IDX,
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala HERMON_PERFCNTR64_NUM_COUNTERS
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala};
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala/*
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala * Data associated with the 64 bit "perf_counters" kstat. One for each port.
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala */
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummalatypedef struct hermon_perfcntr64_ks_info_s {
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala struct kstat *hki64_ksp;
30e01c537fd78d139ff463ccb3ef064e7190f9a8Ramaswamy Tummala int hki64_ext_port_counters_supported;
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala int hki64_enabled;
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala uint64_t hki64_counters[HERMON_PERFCNTR64_NUM_COUNTERS];
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala uint32_t hki64_last_read[HERMON_PERFCNTR64_NUM_COUNTERS];
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala uint_t hki64_port_num;
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala hermon_state_t *hki64_state;
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala} hermon_perfcntr64_ks_info_t;
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The hermon_ks_info_t structure stores all the information necessary for
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * tracking the resources associated with each of the various kstats. In
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * addition to containing pointers to each of the counter and pic kstats,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * this structure also contains "hki_pcr" which is the control register that
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * determines which of the countable entries (from the "hki_ib_perfcnt[]"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * array) is being currently accessed.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_ks_info_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor struct kstat *hki_cntr_ksp;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor struct kstat *hki_picN_ksp[HERMON_MAX_PORTS];
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t hki_pcr;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t hki_pic0;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t hki_pic1;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_ks_mask_t hki_ib_perfcnt[HERMON_CNTR_NUMENTRIES];
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala kt_did_t hki_perfcntr64_thread_id;
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala kmutex_t hki_perfcntr64_lock;
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala kcondvar_t hki_perfcntr64_cv;
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala uint_t hki_perfcntr64_flags; /* see below */
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala hermon_perfcntr64_ks_info_t hki_perfcntr64[HERMON_MAX_PORTS];
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor} hermon_ks_info_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala/* hki_perfcntr64_flags */
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala#define HERMON_PERFCNTR64_THREAD_CREATED 0x0001
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala#define HERMON_PERFCNTR64_THREAD_EXIT 0x0002
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The hermon_ports_ioctl32_t, hermon_loopback_ioctl32_t, and
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * hermon_flash_ioctl32_s structures are used internally by the Hermon
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * driver to accomodate 32-bit applications which need to access the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Hermon ioctls. They are 32-bit versions of externally available
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * structures defined in hermon_ioctl.h
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_ports_ioctl32_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t ap_revision;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor caddr32_t ap_ports;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint8_t ap_num_ports;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor} hermon_ports_ioctl32_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_loopback_ioctl32_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t alb_revision;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor caddr32_t alb_send_buf;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor caddr32_t alb_fail_buf;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t alb_buf_sz;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t alb_num_iter;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t alb_pass_done;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t alb_timeout;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_loopback_error_t alb_error_type;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint8_t alb_port_num;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint8_t alb_num_retry;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor} hermon_loopback_ioctl32_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_flash_ioctl32_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint32_t af_type;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor caddr32_t af_sector;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint32_t af_sector_num;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint32_t af_addr;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint32_t af_quadlet;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint8_t af_byte;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor} hermon_flash_ioctl32_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The hermon_loopback_comm_t and hermon_loopback_state_t structures below
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * are used to store all of the relevant state information needed to keep
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * track of a single VTS ioctl loopback test run.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_loopback_comm_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint8_t *hlc_buf;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor size_t hlc_buf_sz;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_mr_desc_t hlc_mrdesc;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_mrhdl_t hlc_mrhdl;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_cqhdl_t hlc_cqhdl[2];
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_qphdl_t hlc_qp_hdl;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_mr_attr_t hlc_memattr;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t hlc_qp_num;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_cq_attr_t hlc_cq_attr;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_qp_alloc_attr_t hlc_qp_attr;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_chan_sizes_t hlc_chan_sizes;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_qp_info_t hlc_qp_info;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_queue_sizes_t hlc_queue_sizes;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_send_wr_t hlc_wr;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_wr_ds_t hlc_sgl;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_wc_t hlc_wc;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t hlc_num_polled;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_status_t hlc_status;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor int hlc_complete;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor int hlc_wrid;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor} hermon_loopback_comm_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_loopback_state_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint8_t hls_port;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t hls_lid;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint8_t hls_retry;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_state_t *hls_state;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibc_hca_hdl_t hls_hca_hdl;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_pdhdl_t hls_pd_hdl;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_loopback_comm_t hls_tx;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_loopback_comm_t hls_rx;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_status_t hls_status;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor int hls_err;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor int hls_pkey_ix;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor int hls_timeout;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor} hermon_loopback_state_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Mellanox FMR
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_fmr_list_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor struct hermon_fmr_list_s *fmr_next;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_mrhdl_t fmr;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_fmrhdl_t fmr_pool;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t fmr_remaps;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor uint_t fmr_remap_gen; /* generation */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor} hermon_fmr_list_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorstruct hermon_sw_fmr_s {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_state_t *fmr_state;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor kmutex_t fmr_lock;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor hermon_fmr_list_t *fmr_free_list;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor hermon_fmr_list_t **fmr_free_list_tail;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor int fmr_free_len;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor int fmr_pool_size;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor int fmr_max_pages;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor int fmr_flags;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor int fmr_stat_register;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_fmr_flush_handler_t fmr_flush_function;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor void *fmr_flush_arg;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor int fmr_max_remaps;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor uint_t fmr_remap_gen; /* generation */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor int fmr_page_sz;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor kmutex_t remap_lock;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor hermon_fmr_list_t *fmr_remap_list;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor hermon_fmr_list_t **fmr_remap_list_tail;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor int fmr_remap_watermark;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor int fmr_remap_len;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor kmutex_t dirty_lock;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor hermon_fmr_list_t *fmr_dirty_list;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor hermon_fmr_list_t **fmr_dirty_list_tail;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor int fmr_dirty_watermark;
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor int fmr_dirty_len;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor};
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor_NOTE(MUTEX_PROTECTS_DATA(hermon_sw_fmr_s::fmr_lock,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_sw_fmr_s::fmr_pool_size
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_sw_fmr_s::fmr_page_sz
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor hermon_sw_fmr_s::fmr_flags
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor hermon_sw_fmr_s::fmr_free_list))
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor_NOTE(MUTEX_PROTECTS_DATA(hermon_sw_fmr_s::dirty_lock,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_sw_fmr_s::fmr_dirty_watermark
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_sw_fmr_s::fmr_dirty_len
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor hermon_sw_fmr_s::fmr_dirty_list))
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor_NOTE(DATA_READABLE_WITHOUT_LOCK(hermon_sw_fmr_s::fmr_remap_gen
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor hermon_sw_fmr_s::fmr_state
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor hermon_sw_fmr_s::fmr_max_pages
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor hermon_sw_fmr_s::fmr_max_remaps))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor/* FRWR guarantees 8 bits of key; avoid corner cases by using "-2" */
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor#define HERMON_FMR_MAX_REMAPS (256 - 2)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/* Hermon doorbell record routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_dbr_page_alloc(hermon_state_t *state, hermon_dbr_info_t **info);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_dbr_alloc(hermon_state_t *state, uint_t index,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ddi_acc_handle_t *acchdl, hermon_dbr_t **vdbr, uint64_t *pdbr,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t *mapoffset);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid hermon_dbr_free(hermon_state_t *state, uint_t indx, hermon_dbr_t *record);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid hermon_dbr_kern_free(hermon_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/* Hermon Fast Memory Registration Routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_create_fmr_pool(hermon_state_t *state, hermon_pdhdl_t pdhdl,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_fmr_pool_attr_t *params, hermon_fmrhdl_t *fmrhdl);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_destroy_fmr_pool(hermon_state_t *state, hermon_fmrhdl_t fmrhdl);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_flush_fmr_pool(hermon_state_t *state, hermon_fmrhdl_t fmrhdl);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_register_physical_fmr(hermon_state_t *state, hermon_fmrhdl_t fmrhdl,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_pmr_attr_t *mem_pattr_p, hermon_mrhdl_t *mrhdl,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_pmr_desc_t *mem_desc_p);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_deregister_fmr(hermon_state_t *state, hermon_mrhdl_t mr);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/* Hermon Address Handle routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_ah_alloc(hermon_state_t *state, hermon_pdhdl_t pd,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_adds_vect_t *attr_p, hermon_ahhdl_t *ahhdl, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_ah_free(hermon_state_t *state, hermon_ahhdl_t *ahhdl,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_ah_query(hermon_state_t *state, hermon_ahhdl_t ahhdl,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_pdhdl_t *pdhdl, ibt_adds_vect_t *attr_p);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_ah_modify(hermon_state_t *state, hermon_ahhdl_t ahhdl,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_adds_vect_t *attr_p);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/* Hermon Multicast Group routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_mcg_attach(hermon_state_t *state, hermon_qphdl_t qphdl, ib_gid_t gid,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ib_lid_t lid);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_mcg_detach(hermon_state_t *state, hermon_qphdl_t qphdl, ib_gid_t gid,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ib_lid_t lid);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/* Hermon Protection Domain routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_pd_alloc(hermon_state_t *state, hermon_pdhdl_t *pdhdl,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_pd_free(hermon_state_t *state, hermon_pdhdl_t *pdhdl);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid hermon_pd_refcnt_inc(hermon_pdhdl_t pd);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid hermon_pd_refcnt_dec(hermon_pdhdl_t pd);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/* Hermon port-related routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_port_query(hermon_state_t *state, uint_t port,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_hca_portinfo_t *pi);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_port_modify(hermon_state_t *state, uint8_t port,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_port_modify_flags_t flags, uint8_t init_type);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/* Hermon statistics (kstat) routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_kstat_init(hermon_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid hermon_kstat_fini(hermon_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/* Miscellaneous routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_set_addr_path(hermon_state_t *state, ibt_adds_vect_t *av,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor hermon_hw_addr_path_t *path, uint_t type);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid hermon_get_addr_path(hermon_state_t *state, hermon_hw_addr_path_t *path,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ibt_adds_vect_t *av, uint_t type);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_portnum_is_valid(hermon_state_t *state, uint_t portnum);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_pkeyindex_is_valid(hermon_state_t *state, uint_t pkeyindx);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_queue_alloc(hermon_state_t *state, hermon_qalloc_info_t *qa_info,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid hermon_queue_free(hermon_qalloc_info_t *qa_info);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#ifdef __cplusplus
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor}
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#endif
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#endif /* _SYS_IB_ADAPTERS_HERMON_MISC_H */