/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _SYS_IB_ADAPTERS_HERMON_MISC_H
#define _SYS_IB_ADAPTERS_HERMON_MISC_H
/*
* Contains all of the prototypes, #defines, and structures necessary
* for the Hermon Miscellaneous routines - Address Handle, Multicast,
* Protection Domain, port-related, statistics (kstat) routines, and
* extra VTS related routines.
* Many of these functions are called by other parts of the Hermon driver
* (and several routines are directly exposed through the IBTF CI
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* The following defines specify the default number of Address Handles (AH)
* and their size (in the hardware). By default the maximum number of address
* handles is set to 32K. This value is controllable through the
* "hermon_log_num_ah" configuration variable. Note: Hermon Address Handles
* are also referred to as UD Address Vectors (UDAV).
*/
/*
* The following macro determines whether the contents of a UDAV need to be
* sync'd (with ddi_dma_sync()). This decision is based on whether the
* UDAV is in DDR memory (no sync) or system memory (sync required).
*/
HERMON_IN_DDR) ? 0 : 1)
/*
* These defines are used by hermon_get_addr_path() and hermon_set_addr_path()
* below. They indicate the type of hardware context being passed in the
* "path" argument. Because the Hermon hardware formats for the QP address
* path and UDAV address path structures is so similar, but not exactly the
* same, we use these flags to indicate which type of structure is being
* read from or written to.
*/
/*
* The following defines specify the default number of Multicast Groups (MCG)
* and the maximum number of QP which can be associated with each. By default
* the maximum number of multicast groups is set to 256, and the maximum number
* of QP per multicast group is set to 248 (256 4-byte slots minus the 8 slots
* in the header). The first of these values is controllable through the
* "hermon_log_num_mcg" configuration variable. "hermon_num_qp_per_mcg" is
* also available if the customer needs such a large capability.
*/
/*
* Macro to compute the offset of the QP list in a given MCG entry.
*/
sizeof (hermon_hw_mcg_t)))
/*
* The following defines specify the characteristics of the Hermon multicast
* group hash table. The HERMON_NUM_MCG_HASH_SHIFT defines the size of the
* hash table (as a power-of-2), which is set to 16 by default. This value
* is controllable through the "hermon_log_num_mcg_hash" configuration variable,
* but serious consideration should be taken before changing this value. Note:
* its appropriate size should be a function of the entire table size (as
* defined by "hermon_log_num_mcg" and HERMON_NUM_MCG_SHIFT above).
*/
/*
* The following defines are used by the multicast routines to determine
* if a given "multicast GID" is valid or not (see hermon_mcg_is_mgid_valid
* for more details. These values are pulled from the IBA specification,
* rev. 1.1
*/
/*
* The following defines specify the default number of Protection Domains (PD).
* By default the maximum number of protection domains is set to 64K. This
* value is controllable through the "hermon_log_num_pd" configuration variable.
*/
/*
* The following defines specify the default number of Partition Keys (PKey)
* per port. By default the maximum number of PKeys is set to 32 per port, for
* a total of 64 (assuming two ports) . This value is controllable through the
* "hermon_log_max_pkeytbl" configuration variable.
*/
/*
* The following defines specify the default number of SGIDs per port. By
* default the maximum number of GIDS per port is set to 16. This value
* is controllable through the "hermon_log_max_gidtbl" configuration variable.
*/
/*
* Below is a define which is the default number of UAR pages. By default, the
* maximum number of UAR pages is set to 1024 for hermon. Note that
* BlueFlame (if enabled) will take 1/2 the space behind BAR1 (the UAR BAR)
* and therefore we must limit this even further. This value is controllable
* through the "hermon_log_num_uar" configuration variable. NOTE: This value
* should not be set larger than 15 (0xF) because the UAR index number is
* used as part of the minor number calculation (see hermon_open() for details)
* and the minor numbers should not be larger than eighteen bits (i.e. 15 bits
* of UAR index, 3 bits of driver instance number). This is especially true
* for 32-bit kernels.
*/
/*
* A DoorBell record (DBr) will be handled uniquely. They are not in ICM now,
* so they don't need the mapping. And they just need to be accessible to the
* HCA as an address, so we don't need to register the memory. AND, since
* user level (uDAPL, OPEN verbs) won't ever do the unmapping of them we don't
* really need to worry about that either. And the DBrs will have to live in
* user mappable memory. So, we can shortcut a lot of things given these
* assumptions.
*
* Other facts: the DBrs for Hermon are only two per qp - one for the Receive
* side (RQ or SRQ) and one for the CQ. If a QP is associated with an SRQ, we
* while the CQ DBr is 8-bytes, all DBrs will be 8-bytes (see the union below).
* Though it may lead to minor wastage, it also means that reuse is easier since
* any DBr can be used for either, and we don't have to play allocation games.
*
* The state structure will hold the pointer to the start of a list of struct
* hermon_dbr_info_s, each one containing the necessary information to manage
* a page of DBr's.
*/
typedef struct hermon_dbr_info_s {
/*
* These defines specify some miscellaneous port-related configuration
* information. Specifically, HERMON_MAX_MTU is used to define the maximum
* MTU supported for each Hermon port, HERMON_MAX_PORT_WIDTH is used to define
* the maximum supported port width, and the HERMON_MAX_VLCAP define is used
* to specify the maximum number of VLs supported, excluding VL15. Both
* of these values are controllable and get be set using the "hermon_max_mtu"
* and "hermon_max_vlcap" configuration variables. Note: as with many of the
* configurable variables, caution should be exercised when changing these
* values. These values, specifically, should not be set any larger than
* they are defined here as these are set to the current Hermon device
* maximums.
*
* Note that: with Hermon, these capabilities that were formerly retrieved
* as part of QUERY_DEV_LIM/CAP must now be retrieved with QUERY_PORT.
* The init sequence will have to be altered vis-a-vis the older HCAs to
* accommodate this change.
*
* Also, the maximums will be changed here for now.
*/
/*
* These last defines are used by the statistics counting routines (kstats)
* for initialization of the structures associated with the IB statistics
* access routines. The HERMON_CNTR_MASK and HERMON_CNTR_SIZE defines are
* used to divide the "pcr" register into two 32-bit counters (one for "pic0"
* and the other for "pic1")
*/
/*
* Minimum number of ticks to delay between successive polls of the CQ in
* VTS ioctl loopback test
*/
/*
* UAR software table, layout and associated structures
*/
/*
* Doorbell record table bitmap macros
*/
/*
* User doorbell record page tracking
*/
struct hermon_udbr_page_s {
};
struct hermon_udbr_mgmt_s {
};
/*
* doorbell tracking end
*/
/*
* The hermon_sw_ah_s structure is also referred to using the "hermon_ahhdl_t"
* typedef (see hermon_typedef.h). It encodes all the information necessary
* to track the various resources needed to allocate, query, modify, and
* free an address handle.
*
* In specific, it has a lock to ensure single-threaded access. It stores a
* pointer to the associated PD handle, and also contains a copy of the
* GUID stored into the address handle. The reason for this extra copy of
* the GUID info has to do with Hermon PRM compliance and is fully explained
* in hermon_misc.c
*
* To serve in it's primary function, it also contains a UDAV, which contains
* all of the data associated with the UD address vector that is being
* utilized by the holder of the address handle. The hardware-specific format
* of the UDAV is defined in the hermon_hw.h file.
*
* It also has the always necessary backpointer to the resource for the AH
* handle structure itself.
*/
struct hermon_sw_ah_s {
};
/*
* The hermon_sw_mcg_list_s structure is also referred to using the
* "hermon_mcghdl_t" typedef (see hermon_typedef.h). It encodes all the
* information necessary to track the various resources needed to for attaching
* and detaching QP from multicast groups.
*
* The Hermon driver keeps an array of these and uses them as a shadow for
* the real HW-based MCG table. They hold all the necessary information
* to track the resources and to allow fast access to the MCG table. First,
* it had a 128-bit multicast GID (stored in "mcg_mgid_h" and "mcg_mgid_l".
* next if has a field to indicate the index of the next hermon_mcghdl_t in
* the current hash chain (zero is the end of the chain). Note: this very
* closely mimics what the hardware MCG entry has. Then it has a field to
* indicate how many QP are currently attached to the given MCG. And, lastly,
* it has the obligatory backpointer to the resource for the MCH handle
* structure itself.
*/
struct hermon_sw_mcg_list_s {
};
/*
* The hermon_sw_pd_s structure is also referred to using the "hermon_pdhdl_t"
* typedef (see hermon_typedef.h). It encodes all the information necessary
* to track the various resources needed to allocate and free protection
* domains
*
* Specifically, it has reference count and a lock to ensure single threaded
* access to it. It has a field for the protection domain number ("pd_pdnum").
* And it also has the obligatory backpointer to the resource for the PD
* handle structure itself.
*/
struct hermon_sw_pd_s {
};
/*
* The hermon_qalloc_info_s structure is also referred to using the
* "hermon_qalloc_info_t" typedef (see hermon_typedef.h). It holds all the
* information necessary to track the resources for each of the various Hermon
* queue types (i.e. Event Queue, Completion Queue, Work Queue).
*
* Specifically, it has the size, alignment restrictions, and location (in DDR
* or in system memory). And depending on the location, it also has the
* the queue's memory.
*/
struct hermon_qalloc_info_s {
};
/*
* The hermon_ks_mask_t structure encodes all the information necessary for
* the individual kstat entries. The "ks_reg_offset" field contains the
* hardware offset for the corresponding counter, and "ks_reg_shift" and
* "ks_reg_mask" contain shift and mask registers used by the access routines.
* Also the "ks_old_pic0" and "ks_old_pic1" fields contain the most recently
* read value for the corresponding port ("pic"). Note: An array of these
* structures is part of the "hermon_ks_info_t" structure below.
*/
typedef struct hermon_ks_mask_s {
char *ks_evt_name;
/*
* Index into the named data components of 64 bit "perf_counters" kstat.
*/
enum {
};
/*
* Data associated with the 64 bit "perf_counters" kstat. One for each port.
*/
typedef struct hermon_perfcntr64_ks_info_s {
int hki64_enabled;
/*
* The hermon_ks_info_t structure stores all the information necessary for
* tracking the resources associated with each of the various kstats. In
* addition to containing pointers to each of the counter and pic kstats,
* this structure also contains "hki_pcr" which is the control register that
* determines which of the countable entries (from the "hki_ib_perfcnt[]"
* array) is being currently accessed.
*/
typedef struct hermon_ks_info_s {
/* hki_perfcntr64_flags */
/*
* The hermon_ports_ioctl32_t, hermon_loopback_ioctl32_t, and
* hermon_flash_ioctl32_s structures are used internally by the Hermon
* driver to accomodate 32-bit applications which need to access the
* Hermon ioctls. They are 32-bit versions of externally available
* structures defined in hermon_ioctl.h
*/
typedef struct hermon_ports_ioctl32_s {
typedef struct hermon_loopback_ioctl32_s {
typedef struct hermon_flash_ioctl32_s {
/*
* The hermon_loopback_comm_t and hermon_loopback_state_t structures below
* are used to store all of the relevant state information needed to keep
* track of a single VTS ioctl loopback test run.
*/
typedef struct hermon_loopback_comm_s {
int hlc_complete;
int hlc_wrid;
typedef struct hermon_loopback_state_s {
int hls_err;
int hls_pkey_ix;
int hls_timeout;
/*
* Mellanox FMR
*/
typedef struct hermon_fmr_list_s {
struct hermon_sw_fmr_s {
int fmr_free_len;
int fmr_pool_size;
int fmr_max_pages;
int fmr_flags;
int fmr_stat_register;
void *fmr_flush_arg;
int fmr_max_remaps;
int fmr_page_sz;
int fmr_remap_watermark;
int fmr_remap_len;
int fmr_dirty_watermark;
int fmr_dirty_len;
};
/* FRWR guarantees 8 bits of key; avoid corner cases by using "-2" */
/* Hermon doorbell record routines */
/* Hermon Fast Memory Registration Routines */
/* Hermon Address Handle routines */
/* Hermon Multicast Group routines */
/* Hermon Protection Domain routines */
/* Hermon port-related routines */
/* Hermon statistics (kstat) routines */
/* Miscellaneous routines */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_IB_ADAPTERS_HERMON_MISC_H */