9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * CDDL HEADER START
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 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * See the License for the specific language governing permissions
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and limitations under the License.
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 * CDDL HEADER END
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
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#include <sys/ib/adapters/hermon/hermon_typedef.h>
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#define HERMON_UDAV_SIZE (1 << HERMON_UDAV_SIZE_SHIFT)
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 (((&((state)->ts_rsrc_hdl[HERMON_UDAV]))->rsrc_loc == \
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 * 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.
9fa01faf81019677b9c27c7bdf6a310284d4ccb1agiri ((((state)->hs_cfg_profile->cp_num_qp_per_mcg) + 8) << 2)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Macro to compute the offset of the QP list in a given MCG entry.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ((hermon_hw_mcg_qp_list_t *)((uintptr_t)(mcg) + \
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 * 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 * 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 * 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#define HERMON_NUM_PKEYTBL (1 << HERMON_NUM_PKEYTBL_SHIFT)
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#define HERMON_NUM_GIDTBL (1 << HERMON_NUM_GIDTBL_SHIFT)
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 * 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 * 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.
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.
dd9e16da4243358c2e9251a4ca5d50f56e0adc68agiri#define HERMON_NUM_DBR_PER_PAGE (PAGESIZE / sizeof (hermon_dbr_t))
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 * 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 * Also, the maximums will be changed here for now.
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 * 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 * Minimum number of ticks to delay between successive polls of the CQ in
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * VTS ioctl loopback test
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * UAR software table, layout and associated structures
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Doorbell record table bitmap macros
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ((bmap)[HERMON_IND_BYTE(ind)] |= HERMON_IND_BIT(ind))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ((bmap)[HERMON_IND_BYTE(ind)] &= ~HERMON_IND_BIT(ind))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ((bmap)[HERMON_IND_BYTE(ind)] & HERMON_IND_BIT(ind))
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * User doorbell record page tracking
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_udbr_page_s hermon_udbr_page_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortypedef struct hermon_udbr_mgmt_s hermon_user_dbr_t;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * doorbell tracking end
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 * 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 * 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 * It also has the always necessary backpointer to the resource for the AH
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * handle structure itself.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor_NOTE(MUTEX_PROTECTS_DATA(hermon_sw_ah_s::ah_lock,
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 * 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 * 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 * 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_NOTE(MUTEX_PROTECTS_DATA(hermon_sw_pd_s::pd_lock,
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 * 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 * 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.
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala * Index into the named data components of 64 bit "perf_counters" kstat.
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala * Data associated with the 64 bit "perf_counters" kstat. One for each port.
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummalatypedef struct hermon_perfcntr64_ks_info_s {
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala uint64_t hki64_counters[HERMON_PERFCNTR64_NUM_COUNTERS];
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala uint32_t hki64_last_read[HERMON_PERFCNTR64_NUM_COUNTERS];
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 hermon_ks_mask_t hki_ib_perfcnt[HERMON_CNTR_NUMENTRIES];
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala uint_t hki_perfcntr64_flags; /* see below */
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala hermon_perfcntr64_ks_info_t hki_perfcntr64[HERMON_MAX_PORTS];
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala/* hki_perfcntr64_flags */
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala#define HERMON_PERFCNTR64_THREAD_CREATED 0x0001
d1a5c8385583011b8adaf259d3460c22595b4a66Ramaswamy Tummala#define HERMON_PERFCNTR64_THREAD_EXIT 0x0002
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 * 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 * Mellanox FMR
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor_NOTE(MUTEX_PROTECTS_DATA(hermon_sw_fmr_s::fmr_lock,
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor_NOTE(MUTEX_PROTECTS_DATA(hermon_sw_fmr_s::dirty_lock,
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor_NOTE(DATA_READABLE_WITHOUT_LOCK(hermon_sw_fmr_s::fmr_remap_gen
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor/* FRWR guarantees 8 bits of key; avoid corner cases by using "-2" */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/* Hermon doorbell record routines */
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 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/* 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 Taylorint hermon_deregister_fmr(hermon_state_t *state, hermon_mrhdl_t mr);
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 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/* Hermon Multicast Group routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_mcg_attach(hermon_state_t *state, hermon_qphdl_t qphdl, ib_gid_t gid,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_mcg_detach(hermon_state_t *state, hermon_qphdl_t qphdl, ib_gid_t gid,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/* Hermon Protection Domain routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_pd_alloc(hermon_state_t *state, hermon_pdhdl_t *pdhdl,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_pd_free(hermon_state_t *state, hermon_pdhdl_t *pdhdl);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/* Hermon port-related routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_port_query(hermon_state_t *state, uint_t port,
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/* Hermon statistics (kstat) routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/* Miscellaneous routines */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint hermon_set_addr_path(hermon_state_t *state, ibt_adds_vect_t *av,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid hermon_get_addr_path(hermon_state_t *state, hermon_hw_addr_path_t *path,
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 Taylorvoid hermon_queue_free(hermon_qalloc_info_t *qa_info);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#endif /* _SYS_IB_ADAPTERS_HERMON_MISC_H */