19e39c5baSBill Taylor /* 29e39c5baSBill Taylor * CDDL HEADER START 39e39c5baSBill Taylor * 49e39c5baSBill Taylor * The contents of this file are subject to the terms of the 59e39c5baSBill Taylor * Common Development and Distribution License (the "License"). 69e39c5baSBill Taylor * You may not use this file except in compliance with the License. 79e39c5baSBill Taylor * 89e39c5baSBill Taylor * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 99e39c5baSBill Taylor * or http://www.opensolaris.org/os/licensing. 109e39c5baSBill Taylor * See the License for the specific language governing permissions 119e39c5baSBill Taylor * and limitations under the License. 129e39c5baSBill Taylor * 139e39c5baSBill Taylor * When distributing Covered Code, include this CDDL HEADER in each 149e39c5baSBill Taylor * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 159e39c5baSBill Taylor * If applicable, add the following below this CDDL HEADER, with the 169e39c5baSBill Taylor * fields enclosed by brackets "[]" replaced with your own identifying 179e39c5baSBill Taylor * information: Portions Copyright [yyyy] [name of copyright owner] 189e39c5baSBill Taylor * 199e39c5baSBill Taylor * CDDL HEADER END 209e39c5baSBill Taylor */ 219e39c5baSBill Taylor 229e39c5baSBill Taylor /* 23*17a2b317SBill Taylor * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 249e39c5baSBill Taylor */ 259e39c5baSBill Taylor 269e39c5baSBill Taylor #ifndef _SYS_IB_ADAPTERS_HERMON_MISC_H 279e39c5baSBill Taylor #define _SYS_IB_ADAPTERS_HERMON_MISC_H 289e39c5baSBill Taylor 299e39c5baSBill Taylor /* 309e39c5baSBill Taylor * hermon_misc.h 319e39c5baSBill Taylor * Contains all of the prototypes, #defines, and structures necessary 329e39c5baSBill Taylor * for the Hermon Miscellaneous routines - Address Handle, Multicast, 339e39c5baSBill Taylor * Protection Domain, port-related, statistics (kstat) routines, and 349e39c5baSBill Taylor * extra VTS related routines. 359e39c5baSBill Taylor * Many of these functions are called by other parts of the Hermon driver 369e39c5baSBill Taylor * (and several routines are directly exposed through the IBTF CI 379e39c5baSBill Taylor * interface and/or kstat interface). 389e39c5baSBill Taylor */ 399e39c5baSBill Taylor 409e39c5baSBill Taylor #include <sys/types.h> 419e39c5baSBill Taylor #include <sys/conf.h> 429e39c5baSBill Taylor #include <sys/ddi.h> 439e39c5baSBill Taylor #include <sys/sunddi.h> 449e39c5baSBill Taylor 459e39c5baSBill Taylor #include <sys/ib/adapters/hermon/hermon_typedef.h> 469e39c5baSBill Taylor #include <sys/ib/adapters/hermon/hermon_ioctl.h> 479e39c5baSBill Taylor #include <sys/ib/adapters/hermon/hermon_rsrc.h> 489e39c5baSBill Taylor #include <sys/ib/adapters/hermon/hermon_hw.h> 499e39c5baSBill Taylor 509e39c5baSBill Taylor 519e39c5baSBill Taylor #ifdef __cplusplus 529e39c5baSBill Taylor extern "C" { 539e39c5baSBill Taylor #endif 549e39c5baSBill Taylor 559e39c5baSBill Taylor /* 569e39c5baSBill Taylor * The following defines specify the default number of Address Handles (AH) 579e39c5baSBill Taylor * and their size (in the hardware). By default the maximum number of address 589e39c5baSBill Taylor * handles is set to 32K. This value is controllable through the 599e39c5baSBill Taylor * "hermon_log_num_ah" configuration variable. Note: Hermon Address Handles 609e39c5baSBill Taylor * are also referred to as UD Address Vectors (UDAV). 619e39c5baSBill Taylor */ 629e39c5baSBill Taylor #define HERMON_NUM_AH_SHIFT 0xF 639e39c5baSBill Taylor #define HERMON_NUM_AH (1 << HERMON_NUM_AH_SHIFT) 649e39c5baSBill Taylor #define HERMON_UDAV_SIZE_SHIFT 0x5 659e39c5baSBill Taylor #define HERMON_UDAV_SIZE (1 << HERMON_UDAV_SIZE_SHIFT) 669e39c5baSBill Taylor 679e39c5baSBill Taylor /* 689e39c5baSBill Taylor * The following macro determines whether the contents of a UDAV need to be 699e39c5baSBill Taylor * sync'd (with ddi_dma_sync()). This decision is based on whether the 709e39c5baSBill Taylor * UDAV is in DDR memory (no sync) or system memory (sync required). 719e39c5baSBill Taylor */ 729e39c5baSBill Taylor 739e39c5baSBill Taylor #define HERMON_UDAV_IS_SYNC_REQ(state) \ 749e39c5baSBill Taylor (((&((state)->ts_rsrc_hdl[HERMON_UDAV]))->rsrc_loc == \ 759e39c5baSBill Taylor HERMON_IN_DDR) ? 0 : 1) 769e39c5baSBill Taylor 779e39c5baSBill Taylor /* 789e39c5baSBill Taylor * These defines are used by hermon_get_addr_path() and hermon_set_addr_path() 799e39c5baSBill Taylor * below. They indicate the type of hardware context being passed in the 809e39c5baSBill Taylor * "path" argument. Because the Hermon hardware formats for the QP address 819e39c5baSBill Taylor * path and UDAV address path structures is so similar, but not exactly the 829e39c5baSBill Taylor * same, we use these flags to indicate which type of structure is being 839e39c5baSBill Taylor * read from or written to. 849e39c5baSBill Taylor */ 859e39c5baSBill Taylor #define HERMON_ADDRPATH_QP 0x0 869e39c5baSBill Taylor #define HERMON_ADDRPATH_UDAV 0x1 879e39c5baSBill Taylor 889e39c5baSBill Taylor /* 899e39c5baSBill Taylor * The following defines specify the default number of Multicast Groups (MCG) 909e39c5baSBill Taylor * and the maximum number of QP which can be associated with each. By default 919e39c5baSBill Taylor * the maximum number of multicast groups is set to 256, and the maximum number 929fa01fafSagiri * of QP per multicast group is set to 248 (256 4-byte slots minus the 8 slots 939fa01fafSagiri * in the header). The first of these values is controllable through the 949fa01fafSagiri * "hermon_log_num_mcg" configuration variable. "hermon_num_qp_per_mcg" is 959fa01fafSagiri * also available if the customer needs such a large capability. 969e39c5baSBill Taylor */ 979e39c5baSBill Taylor #define HERMON_NUM_MCG_SHIFT 0x8 989fa01fafSagiri #define HERMON_NUM_QP_PER_MCG_MIN 0x8 999fa01fafSagiri #define HERMON_NUM_QP_PER_MCG 0xf8 1009e39c5baSBill Taylor 1019fa01fafSagiri #define HERMON_MCGMEM_SZ(state) \ 1029fa01fafSagiri ((((state)->hs_cfg_profile->cp_num_qp_per_mcg) + 8) << 2) 1039e39c5baSBill Taylor 1049e39c5baSBill Taylor /* 1059e39c5baSBill Taylor * Macro to compute the offset of the QP list in a given MCG entry. 1069e39c5baSBill Taylor */ 1079e39c5baSBill Taylor #define HERMON_MCG_GET_QPLIST_PTR(mcg) \ 1089e39c5baSBill Taylor ((hermon_hw_mcg_qp_list_t *)((uintptr_t)(mcg) + \ 1099e39c5baSBill Taylor sizeof (hermon_hw_mcg_t))) 1109e39c5baSBill Taylor 1119e39c5baSBill Taylor /* 1129e39c5baSBill Taylor * The following defines specify the characteristics of the Hermon multicast 1139e39c5baSBill Taylor * group hash table. The HERMON_NUM_MCG_HASH_SHIFT defines the size of the 1149e39c5baSBill Taylor * hash table (as a power-of-2), which is set to 16 by default. This value 1159e39c5baSBill Taylor * is controllable through the "hermon_log_num_mcg_hash" configuration variable, 1169e39c5baSBill Taylor * but serious consideration should be taken before changing this value. Note: 1179e39c5baSBill Taylor * its appropriate size should be a function of the entire table size (as 1189e39c5baSBill Taylor * defined by "hermon_log_num_mcg" and HERMON_NUM_MCG_SHIFT above). 1199e39c5baSBill Taylor */ 1209e39c5baSBill Taylor #define HERMON_NUM_MCG_HASH_SHIFT 0x4 1219e39c5baSBill Taylor 1229e39c5baSBill Taylor /* 1239e39c5baSBill Taylor * The following defines are used by the multicast routines to determine 1249e39c5baSBill Taylor * if a given "multicast GID" is valid or not (see hermon_mcg_is_mgid_valid 1259e39c5baSBill Taylor * for more details. These values are pulled from the IBA specification, 1269e39c5baSBill Taylor * rev. 1.1 1279e39c5baSBill Taylor */ 1289e39c5baSBill Taylor #define HERMON_MCG_TOPBITS_SHIFT 56 1299e39c5baSBill Taylor #define HERMON_MCG_TOPBITS_MASK 0xFF 1309e39c5baSBill Taylor #define HERMON_MCG_TOPBITS 0xFF 1319e39c5baSBill Taylor 1329e39c5baSBill Taylor #define HERMON_MCG_FLAGS_SHIFT 52 1339e39c5baSBill Taylor #define HERMON_MCG_FLAGS_MASK 0xF 1349e39c5baSBill Taylor #define HERMON_MCG_FLAGS_PERM 0x0 1359e39c5baSBill Taylor #define HERMON_MCG_FLAGS_NONPERM 0x1 1369e39c5baSBill Taylor 1379e39c5baSBill Taylor #define HERMON_MCG_SCOPE_SHIFT 48 1389e39c5baSBill Taylor #define HERMON_MCG_SCOPE_MASK 0xF 1399e39c5baSBill Taylor #define HERMON_MCG_SCOPE_LINKLOC 0x2 1409e39c5baSBill Taylor #define HERMON_MCG_SCOPE_SITELOC 0x5 1419e39c5baSBill Taylor #define HERMON_MCG_SCOPE_ORGLOC 0x8 1429e39c5baSBill Taylor #define HERMON_MCG_SCOPE_GLOBAL 0xE 1439e39c5baSBill Taylor 1449e39c5baSBill Taylor 1459e39c5baSBill Taylor /* 1469e39c5baSBill Taylor * The following defines specify the default number of Protection Domains (PD). 1479e39c5baSBill Taylor * By default the maximum number of protection domains is set to 64K. This 1489e39c5baSBill Taylor * value is controllable through the "hermon_log_num_pd" configuration variable. 1499e39c5baSBill Taylor */ 1509e39c5baSBill Taylor #define HERMON_NUM_PD_SHIFT 0x10 1519e39c5baSBill Taylor 1529e39c5baSBill Taylor /* 1539e39c5baSBill Taylor * The following defines specify the default number of Partition Keys (PKey) 1549e39c5baSBill Taylor * per port. By default the maximum number of PKeys is set to 32 per port, for 1559e39c5baSBill Taylor * a total of 64 (assuming two ports) . This value is controllable through the 1569e39c5baSBill Taylor * "hermon_log_max_pkeytbl" configuration variable. 1579e39c5baSBill Taylor */ 1589e39c5baSBill Taylor #define HERMON_NUM_PKEYTBL_SHIFT 0x5 1599e39c5baSBill Taylor #define HERMON_NUM_PKEYTBL (1 << HERMON_NUM_PKEYTBL_SHIFT) 1609e39c5baSBill Taylor 1619e39c5baSBill Taylor /* 1629e39c5baSBill Taylor * The following defines specify the default number of SGIDs per port. By 1639e39c5baSBill Taylor * default the maximum number of GIDS per port is set to 16. This value 1649e39c5baSBill Taylor * is controllable through the "hermon_log_max_gidtbl" configuration variable. 1659e39c5baSBill Taylor */ 1669e39c5baSBill Taylor #define HERMON_NUM_GIDTBL_SHIFT 0x4 1679e39c5baSBill Taylor #define HERMON_NUM_GIDTBL (1 << HERMON_NUM_GIDTBL_SHIFT) 1689e39c5baSBill Taylor 1699e39c5baSBill Taylor /* 1709e39c5baSBill Taylor * Below is a define which is the default number of UAR pages. By default, the 1719e39c5baSBill Taylor * maximum number of UAR pages is set to 1024 for hermon. Note that 1729e39c5baSBill Taylor * BlueFlame (if enabled) will take 1/2 the space behind BAR1 (the UAR BAR) 1739e39c5baSBill Taylor * and therefore we must limit this even further. This value is controllable 1749e39c5baSBill Taylor * through the "hermon_log_num_uar" configuration variable. NOTE: This value 1759e39c5baSBill Taylor * should not be set larger than 15 (0xF) because the UAR index number is 1769e39c5baSBill Taylor * used as part of the minor number calculation (see hermon_open() for details) 1779e39c5baSBill Taylor * and the minor numbers should not be larger than eighteen bits (i.e. 15 bits 1789e39c5baSBill Taylor * of UAR index, 3 bits of driver instance number). This is especially true 1799e39c5baSBill Taylor * for 32-bit kernels. 1809e39c5baSBill Taylor */ 1819e39c5baSBill Taylor #define HERMON_NUM_UAR_SHIFT 0xA 1829e39c5baSBill Taylor 1839e39c5baSBill Taylor /* 1849e39c5baSBill Taylor * A DoorBell record (DBr) will be handled uniquely. They are not in ICM now, 1859e39c5baSBill Taylor * so they don't need the mapping. And they just need to be accessible to the 1869e39c5baSBill Taylor * HCA as an address, so we don't need to register the memory. AND, since 1879e39c5baSBill Taylor * user level (uDAPL, OPEN verbs) won't ever do the unmapping of them we don't 1889e39c5baSBill Taylor * really need to worry about that either. And the DBrs will have to live in 1899e39c5baSBill Taylor * user mappable memory. So, we can shortcut a lot of things given these 1909e39c5baSBill Taylor * assumptions. 1919e39c5baSBill Taylor * 1929e39c5baSBill Taylor * Other facts: the DBrs for Hermon are only two per qp - one for the Receive 1939e39c5baSBill Taylor * side (RQ or SRQ) and one for the CQ. If a QP is associated with an SRQ, we 1949e39c5baSBill Taylor * only need the ONE for the SRQ. Also, although the RQ/SRQ DBr is only 4-bytes 1959e39c5baSBill Taylor * while the CQ DBr is 8-bytes, all DBrs will be 8-bytes (see the union below). 1969e39c5baSBill Taylor * Though it may lead to minor wastage, it also means that reuse is easier since 1979e39c5baSBill Taylor * any DBr can be used for either, and we don't have to play allocation games. 1989e39c5baSBill Taylor * 199dd9e16daSagiri * The state structure will hold the pointer to the start of a list of struct 200dd9e16daSagiri * hermon_dbr_info_s, each one containing the necessary information to manage 201dd9e16daSagiri * a page of DBr's. 2029e39c5baSBill Taylor */ 2039e39c5baSBill Taylor 2049e39c5baSBill Taylor typedef uint64_t hermon_dbr_t; 2059e39c5baSBill Taylor 2069e39c5baSBill Taylor typedef struct hermon_dbr_info_s { 207dd9e16daSagiri struct hermon_dbr_info_s *dbr_link; 208dd9e16daSagiri hermon_dbr_t *dbr_page; /* virtual addr of page */ 209dd9e16daSagiri uint64_t dbr_paddr; /* physical addr of page */ 2109e39c5baSBill Taylor ddi_acc_handle_t dbr_acchdl; 2119e39c5baSBill Taylor ddi_dma_handle_t dbr_dmahdl; 212dd9e16daSagiri uint32_t dbr_nfree; /* #free DBrs in this page */ 213dd9e16daSagiri uint32_t dbr_firstfree; /* idx of first free DBr */ 2149e39c5baSBill Taylor } hermon_dbr_info_t; 2159e39c5baSBill Taylor 216dd9e16daSagiri #define HERMON_NUM_DBR_PER_PAGE (PAGESIZE / sizeof (hermon_dbr_t)) 2179e39c5baSBill Taylor 2189e39c5baSBill Taylor 2199e39c5baSBill Taylor /* 2209e39c5baSBill Taylor * These defines specify some miscellaneous port-related configuration 2219e39c5baSBill Taylor * information. Specifically, HERMON_MAX_MTU is used to define the maximum 2229e39c5baSBill Taylor * MTU supported for each Hermon port, HERMON_MAX_PORT_WIDTH is used to define 2239e39c5baSBill Taylor * the maximum supported port width, and the HERMON_MAX_VLCAP define is used 2249e39c5baSBill Taylor * to specify the maximum number of VLs supported, excluding VL15. Both 2259e39c5baSBill Taylor * of these values are controllable and get be set using the "hermon_max_mtu" 2269e39c5baSBill Taylor * and "hermon_max_vlcap" configuration variables. Note: as with many of the 2279e39c5baSBill Taylor * configurable variables, caution should be exercised when changing these 2289e39c5baSBill Taylor * values. These values, specifically, should not be set any larger than 2299e39c5baSBill Taylor * they are defined here as these are set to the current Hermon device 2309e39c5baSBill Taylor * maximums. 2319e39c5baSBill Taylor * 2329e39c5baSBill Taylor * Note that: with Hermon, these capabilities that were formerly retrieved 2339e39c5baSBill Taylor * as part of QUERY_DEV_LIM/CAP must now be retrieved with QUERY_PORT. 2349e39c5baSBill Taylor * The init sequence will have to be altered vis-a-vis the older HCAs to 2359e39c5baSBill Taylor * accommodate this change. 2369e39c5baSBill Taylor * 2379e39c5baSBill Taylor * Also, the maximums will be changed here for now. 2389e39c5baSBill Taylor */ 2399e39c5baSBill Taylor #define HERMON_MAX_MTU 0x5 /* was 0x4, 2048 but moved to 4096 */ 2409e39c5baSBill Taylor #define HERMON_MAX_PORT_WIDTH 0x7 /* was 0x3 (1x/4x) but now 1/4/8x */ 2419e39c5baSBill Taylor #define HERMON_MAX_VLCAP 0x8 /* remain the same for now */ 2429e39c5baSBill Taylor 2439e39c5baSBill Taylor /* 2449e39c5baSBill Taylor * These last defines are used by the statistics counting routines (kstats) 2459e39c5baSBill Taylor * for initialization of the structures associated with the IB statistics 2469e39c5baSBill Taylor * access routines. The HERMON_CNTR_MASK and HERMON_CNTR_SIZE defines are 2479e39c5baSBill Taylor * used to divide the "pcr" register into two 32-bit counters (one for "pic0" 2489e39c5baSBill Taylor * and the other for "pic1") 2499e39c5baSBill Taylor */ 2509e39c5baSBill Taylor #define HERMON_CNTR_MASK 0xFFFFFFFF 2519e39c5baSBill Taylor #define HERMON_CNTR_SIZE 32 2529e39c5baSBill Taylor #define HERMON_CNTR_NUMENTRIES 17 2539e39c5baSBill Taylor 2549e39c5baSBill Taylor 2559e39c5baSBill Taylor 2569e39c5baSBill Taylor #define HERMON_QUEUE_LOCATION_NORMAL 0x1 2579e39c5baSBill Taylor #define HERMON_QUEUE_LOCATION_USERLAND 0x2 2589e39c5baSBill Taylor 2599e39c5baSBill Taylor /* 2609e39c5baSBill Taylor * Minimum number of ticks to delay between successive polls of the CQ in 2619e39c5baSBill Taylor * VTS ioctl loopback test 2629e39c5baSBill Taylor */ 2639e39c5baSBill Taylor #define HERMON_VTS_LOOPBACK_MIN_WAIT_DUR 50 2649e39c5baSBill Taylor 2659e39c5baSBill Taylor /* 2669e39c5baSBill Taylor * UAR software table, layout and associated structures 2679e39c5baSBill Taylor */ 2689e39c5baSBill Taylor 2699e39c5baSBill Taylor /* 2709e39c5baSBill Taylor * Doorbell record table bitmap macros 2719e39c5baSBill Taylor */ 2729e39c5baSBill Taylor #define HERMON_IND_BYTE(ind) ((ind) >> 3) 2739e39c5baSBill Taylor #define HERMON_IND_BIT(ind) (1 << ((ind) & 0x7)) 2749e39c5baSBill Taylor 2759e39c5baSBill Taylor #define HERMON_BMAP_BIT_SET(bmap, ind) \ 2769e39c5baSBill Taylor ((bmap)[HERMON_IND_BYTE(ind)] |= HERMON_IND_BIT(ind)) 2779e39c5baSBill Taylor #define HERMON_BMAP_BIT_CLR(bmap, ind) \ 2789e39c5baSBill Taylor ((bmap)[HERMON_IND_BYTE(ind)] &= ~HERMON_IND_BIT(ind)) 2799e39c5baSBill Taylor #define HERMON_BMAP_BIT_ISSET(bmap, ind) \ 2809e39c5baSBill Taylor ((bmap)[HERMON_IND_BYTE(ind)] & HERMON_IND_BIT(ind)) 2819e39c5baSBill Taylor 2829e39c5baSBill Taylor 2839e39c5baSBill Taylor /* 2849e39c5baSBill Taylor * User doorbell record page tracking 2859e39c5baSBill Taylor */ 2869e39c5baSBill Taylor typedef struct hermon_udbr_page_s hermon_udbr_page_t; 2879e39c5baSBill Taylor 2889e39c5baSBill Taylor struct hermon_udbr_page_s { 2899e39c5baSBill Taylor hermon_udbr_page_t *upg_link; 2909e39c5baSBill Taylor uint_t upg_index; 2919e39c5baSBill Taylor uint_t upg_nfree; 2921ed53a3fSBill Taylor uint64_t *upg_free; 2939e39c5baSBill Taylor caddr_t upg_kvaddr; 2949e39c5baSBill Taylor struct buf *upg_buf; 2959e39c5baSBill Taylor ddi_umem_cookie_t upg_umemcookie; 2969e39c5baSBill Taylor ddi_dma_handle_t upg_dmahdl; 2979e39c5baSBill Taylor ddi_dma_cookie_t upg_dmacookie; 2989e39c5baSBill Taylor }; 2999e39c5baSBill Taylor 3009e39c5baSBill Taylor typedef struct hermon_udbr_mgmt_s hermon_user_dbr_t; 3019e39c5baSBill Taylor 3029e39c5baSBill Taylor struct hermon_udbr_mgmt_s { 3039e39c5baSBill Taylor hermon_user_dbr_t *udbr_link; 3049e39c5baSBill Taylor uint_t udbr_index; /* same as uarpg */ 3059e39c5baSBill Taylor hermon_udbr_page_t *udbr_pagep; 3069e39c5baSBill Taylor }; 3079e39c5baSBill Taylor 3089e39c5baSBill Taylor 3099e39c5baSBill Taylor /* 3109e39c5baSBill Taylor * doorbell tracking end 3119e39c5baSBill Taylor */ 3129e39c5baSBill Taylor 3139e39c5baSBill Taylor /* 3149e39c5baSBill Taylor * The hermon_sw_ah_s structure is also referred to using the "hermon_ahhdl_t" 3159e39c5baSBill Taylor * typedef (see hermon_typedef.h). It encodes all the information necessary 3169e39c5baSBill Taylor * to track the various resources needed to allocate, query, modify, and 3179e39c5baSBill Taylor * free an address handle. 3189e39c5baSBill Taylor * 3199e39c5baSBill Taylor * In specific, it has a lock to ensure single-threaded access. It stores a 3209e39c5baSBill Taylor * pointer to the associated PD handle, and also contains a copy of the 3219e39c5baSBill Taylor * GUID stored into the address handle. The reason for this extra copy of 3229e39c5baSBill Taylor * the GUID info has to do with Hermon PRM compliance and is fully explained 3239e39c5baSBill Taylor * in hermon_misc.c 3249e39c5baSBill Taylor * 3259e39c5baSBill Taylor * To serve in it's primary function, it also contains a UDAV, which contains 3269e39c5baSBill Taylor * all of the data associated with the UD address vector that is being 3279e39c5baSBill Taylor * utilized by the holder of the address handle. The hardware-specific format 3289e39c5baSBill Taylor * of the UDAV is defined in the hermon_hw.h file. 3299e39c5baSBill Taylor * 3309e39c5baSBill Taylor * It also has the always necessary backpointer to the resource for the AH 3319e39c5baSBill Taylor * handle structure itself. 3329e39c5baSBill Taylor */ 3339e39c5baSBill Taylor struct hermon_sw_ah_s { 3349e39c5baSBill Taylor kmutex_t ah_lock; 3359e39c5baSBill Taylor hermon_pdhdl_t ah_pdhdl; 3369e39c5baSBill Taylor hermon_hw_udav_t *ah_udav; 3379e39c5baSBill Taylor hermon_rsrc_t *ah_rsrcp; 3389e39c5baSBill Taylor uint64_t ah_save_guid; 3399e39c5baSBill Taylor }; 3409e39c5baSBill Taylor _NOTE(READ_ONLY_DATA(hermon_sw_ah_s::ah_udav)) 3419e39c5baSBill Taylor _NOTE(MUTEX_PROTECTS_DATA(hermon_sw_ah_s::ah_lock, 3429e39c5baSBill Taylor hermon_sw_ah_s::ah_pdhdl 3439e39c5baSBill Taylor hermon_sw_ah_s::ah_rsrcp 3449e39c5baSBill Taylor hermon_sw_ah_s::ah_save_guid)) 3459e39c5baSBill Taylor 3469e39c5baSBill Taylor /* 3479e39c5baSBill Taylor * The hermon_sw_mcg_list_s structure is also referred to using the 3489e39c5baSBill Taylor * "hermon_mcghdl_t" typedef (see hermon_typedef.h). It encodes all the 3499e39c5baSBill Taylor * information necessary to track the various resources needed to for attaching 3509e39c5baSBill Taylor * and detaching QP from multicast groups. 3519e39c5baSBill Taylor * 3529e39c5baSBill Taylor * The Hermon driver keeps an array of these and uses them as a shadow for 3539e39c5baSBill Taylor * the real HW-based MCG table. They hold all the necessary information 3549e39c5baSBill Taylor * to track the resources and to allow fast access to the MCG table. First, 3559e39c5baSBill Taylor * it had a 128-bit multicast GID (stored in "mcg_mgid_h" and "mcg_mgid_l". 3569e39c5baSBill Taylor * next if has a field to indicate the index of the next hermon_mcghdl_t in 3579e39c5baSBill Taylor * the current hash chain (zero is the end of the chain). Note: this very 3589e39c5baSBill Taylor * closely mimics what the hardware MCG entry has. Then it has a field to 3599e39c5baSBill Taylor * indicate how many QP are currently attached to the given MCG. And, lastly, 3609e39c5baSBill Taylor * it has the obligatory backpointer to the resource for the MCH handle 3619e39c5baSBill Taylor * structure itself. 3629e39c5baSBill Taylor */ 3639e39c5baSBill Taylor struct hermon_sw_mcg_list_s { 3649e39c5baSBill Taylor uint64_t mcg_mgid_h; 3659e39c5baSBill Taylor uint64_t mcg_mgid_l; 3669e39c5baSBill Taylor uint_t mcg_next_indx; 3679e39c5baSBill Taylor uint_t mcg_num_qps; 3689e39c5baSBill Taylor hermon_rsrc_t *mcg_rsrcp; 3699e39c5baSBill Taylor }; 3709e39c5baSBill Taylor 3719e39c5baSBill Taylor /* 3729e39c5baSBill Taylor * The hermon_sw_pd_s structure is also referred to using the "hermon_pdhdl_t" 3739e39c5baSBill Taylor * typedef (see hermon_typedef.h). It encodes all the information necessary 3749e39c5baSBill Taylor * to track the various resources needed to allocate and free protection 3759e39c5baSBill Taylor * domains 3769e39c5baSBill Taylor * 3779e39c5baSBill Taylor * Specifically, it has reference count and a lock to ensure single threaded 3789e39c5baSBill Taylor * access to it. It has a field for the protection domain number ("pd_pdnum"). 3799e39c5baSBill Taylor * And it also has the obligatory backpointer to the resource for the PD 3809e39c5baSBill Taylor * handle structure itself. 3819e39c5baSBill Taylor */ 3829e39c5baSBill Taylor struct hermon_sw_pd_s { 3839e39c5baSBill Taylor kmutex_t pd_lock; 3849e39c5baSBill Taylor uint32_t pd_pdnum; 3859e39c5baSBill Taylor uint32_t pd_refcnt; 3869e39c5baSBill Taylor hermon_rsrc_t *pd_rsrcp; 3879e39c5baSBill Taylor }; 3889e39c5baSBill Taylor _NOTE(READ_ONLY_DATA(hermon_sw_pd_s::pd_pdnum 3899e39c5baSBill Taylor hermon_sw_pd_s::pd_rsrcp)) 3909e39c5baSBill Taylor _NOTE(MUTEX_PROTECTS_DATA(hermon_sw_pd_s::pd_lock, 3919e39c5baSBill Taylor hermon_sw_pd_s::pd_refcnt)) 3929e39c5baSBill Taylor 3939e39c5baSBill Taylor /* 3949e39c5baSBill Taylor * The hermon_qalloc_info_s structure is also referred to using the 3959e39c5baSBill Taylor * "hermon_qalloc_info_t" typedef (see hermon_typedef.h). It holds all the 3969e39c5baSBill Taylor * information necessary to track the resources for each of the various Hermon 3979e39c5baSBill Taylor * queue types (i.e. Event Queue, Completion Queue, Work Queue). 3989e39c5baSBill Taylor * 3999e39c5baSBill Taylor * Specifically, it has the size, alignment restrictions, and location (in DDR 4009e39c5baSBill Taylor * or in system memory). And depending on the location, it also has the 4019e39c5baSBill Taylor * ddi_dma_handle_t, ddi_acc_handle_t, and pointers used for reading/writing to 4029e39c5baSBill Taylor * the queue's memory. 4039e39c5baSBill Taylor */ 4049e39c5baSBill Taylor struct hermon_qalloc_info_s { 4059e39c5baSBill Taylor uint64_t qa_size; 4069e39c5baSBill Taylor uint64_t qa_alloc_align; 4079e39c5baSBill Taylor uint64_t qa_bind_align; 4089e39c5baSBill Taylor uint32_t *qa_buf_real; 4099e39c5baSBill Taylor uint32_t *qa_buf_aligned; 4109e39c5baSBill Taylor uint64_t qa_buf_realsz; 4119e39c5baSBill Taylor uint_t qa_pgoffs; 4129e39c5baSBill Taylor uint_t qa_location; 4139e39c5baSBill Taylor ddi_dma_handle_t qa_dmahdl; 4149e39c5baSBill Taylor ddi_acc_handle_t qa_acchdl; 4159e39c5baSBill Taylor ddi_umem_cookie_t qa_umemcookie; 4169e39c5baSBill Taylor }; 4179e39c5baSBill Taylor 4189e39c5baSBill Taylor /* 4199e39c5baSBill Taylor * The hermon_ks_mask_t structure encodes all the information necessary for 4209e39c5baSBill Taylor * the individual kstat entries. The "ks_reg_offset" field contains the 4219e39c5baSBill Taylor * hardware offset for the corresponding counter, and "ks_reg_shift" and 4229e39c5baSBill Taylor * "ks_reg_mask" contain shift and mask registers used by the access routines. 4239e39c5baSBill Taylor * Also the "ks_old_pic0" and "ks_old_pic1" fields contain the most recently 4249e39c5baSBill Taylor * read value for the corresponding port ("pic"). Note: An array of these 4259e39c5baSBill Taylor * structures is part of the "hermon_ks_info_t" structure below. 4269e39c5baSBill Taylor */ 4279e39c5baSBill Taylor typedef struct hermon_ks_mask_s { 4289e39c5baSBill Taylor char *ks_evt_name; 4299e39c5baSBill Taylor uint32_t ks_old_pic0; 4309e39c5baSBill Taylor uint32_t ks_old_pic1; 4319e39c5baSBill Taylor } hermon_ks_mask_t; 4329e39c5baSBill Taylor 433d1a5c838SRamaswamy Tummala /* 434d1a5c838SRamaswamy Tummala * Index into the named data components of 64 bit "perf_counters" kstat. 435d1a5c838SRamaswamy Tummala */ 436d1a5c838SRamaswamy Tummala enum { 437d1a5c838SRamaswamy Tummala HERMON_PERFCNTR64_ENABLE_IDX = 0, 438d1a5c838SRamaswamy Tummala HERMON_PERFCNTR64_XMIT_DATA_IDX, 439d1a5c838SRamaswamy Tummala HERMON_PERFCNTR64_RECV_DATA_IDX, 440d1a5c838SRamaswamy Tummala HERMON_PERFCNTR64_XMIT_PKTS_IDX, 441d1a5c838SRamaswamy Tummala HERMON_PERFCNTR64_RECV_PKTS_IDX, 442d1a5c838SRamaswamy Tummala HERMON_PERFCNTR64_NUM_COUNTERS 443d1a5c838SRamaswamy Tummala }; 444d1a5c838SRamaswamy Tummala 445d1a5c838SRamaswamy Tummala /* 446d1a5c838SRamaswamy Tummala * Data associated with the 64 bit "perf_counters" kstat. One for each port. 447d1a5c838SRamaswamy Tummala */ 448d1a5c838SRamaswamy Tummala typedef struct hermon_perfcntr64_ks_info_s { 449d1a5c838SRamaswamy Tummala struct kstat *hki64_ksp; 45030e01c53SRamaswamy Tummala int hki64_ext_port_counters_supported; 451d1a5c838SRamaswamy Tummala int hki64_enabled; 452d1a5c838SRamaswamy Tummala uint64_t hki64_counters[HERMON_PERFCNTR64_NUM_COUNTERS]; 453d1a5c838SRamaswamy Tummala uint32_t hki64_last_read[HERMON_PERFCNTR64_NUM_COUNTERS]; 454d1a5c838SRamaswamy Tummala uint_t hki64_port_num; 455d1a5c838SRamaswamy Tummala hermon_state_t *hki64_state; 456d1a5c838SRamaswamy Tummala } hermon_perfcntr64_ks_info_t; 457d1a5c838SRamaswamy Tummala 4589e39c5baSBill Taylor /* 4599e39c5baSBill Taylor * The hermon_ks_info_t structure stores all the information necessary for 4609e39c5baSBill Taylor * tracking the resources associated with each of the various kstats. In 4619e39c5baSBill Taylor * addition to containing pointers to each of the counter and pic kstats, 4629e39c5baSBill Taylor * this structure also contains "hki_pcr" which is the control register that 4639e39c5baSBill Taylor * determines which of the countable entries (from the "hki_ib_perfcnt[]" 4649e39c5baSBill Taylor * array) is being currently accessed. 4659e39c5baSBill Taylor */ 4669e39c5baSBill Taylor typedef struct hermon_ks_info_s { 4679e39c5baSBill Taylor struct kstat *hki_cntr_ksp; 4689e39c5baSBill Taylor struct kstat *hki_picN_ksp[HERMON_MAX_PORTS]; 4699e39c5baSBill Taylor uint64_t hki_pcr; 4709e39c5baSBill Taylor uint64_t hki_pic0; 4719e39c5baSBill Taylor uint64_t hki_pic1; 4729e39c5baSBill Taylor hermon_ks_mask_t hki_ib_perfcnt[HERMON_CNTR_NUMENTRIES]; 473d1a5c838SRamaswamy Tummala kt_did_t hki_perfcntr64_thread_id; 474d1a5c838SRamaswamy Tummala kmutex_t hki_perfcntr64_lock; 475d1a5c838SRamaswamy Tummala kcondvar_t hki_perfcntr64_cv; 476d1a5c838SRamaswamy Tummala uint_t hki_perfcntr64_flags; /* see below */ 477d1a5c838SRamaswamy Tummala hermon_perfcntr64_ks_info_t hki_perfcntr64[HERMON_MAX_PORTS]; 4789e39c5baSBill Taylor } hermon_ks_info_t; 4799e39c5baSBill Taylor 480d1a5c838SRamaswamy Tummala /* hki_perfcntr64_flags */ 481d1a5c838SRamaswamy Tummala #define HERMON_PERFCNTR64_THREAD_CREATED 0x0001 482d1a5c838SRamaswamy Tummala #define HERMON_PERFCNTR64_THREAD_EXIT 0x0002 483d1a5c838SRamaswamy Tummala 4849e39c5baSBill Taylor /* 4859e39c5baSBill Taylor * The hermon_ports_ioctl32_t, hermon_loopback_ioctl32_t, and 4869e39c5baSBill Taylor * hermon_flash_ioctl32_s structures are used internally by the Hermon 4879e39c5baSBill Taylor * driver to accomodate 32-bit applications which need to access the 4889e39c5baSBill Taylor * Hermon ioctls. They are 32-bit versions of externally available 4899e39c5baSBill Taylor * structures defined in hermon_ioctl.h 4909e39c5baSBill Taylor */ 4919e39c5baSBill Taylor typedef struct hermon_ports_ioctl32_s { 4929e39c5baSBill Taylor uint_t ap_revision; 4939e39c5baSBill Taylor caddr32_t ap_ports; 4949e39c5baSBill Taylor uint8_t ap_num_ports; 4959e39c5baSBill Taylor } hermon_ports_ioctl32_t; 4969e39c5baSBill Taylor 4979e39c5baSBill Taylor typedef struct hermon_loopback_ioctl32_s { 4989e39c5baSBill Taylor uint_t alb_revision; 4999e39c5baSBill Taylor caddr32_t alb_send_buf; 5009e39c5baSBill Taylor caddr32_t alb_fail_buf; 5019e39c5baSBill Taylor uint_t alb_buf_sz; 5029e39c5baSBill Taylor uint_t alb_num_iter; 5039e39c5baSBill Taylor uint_t alb_pass_done; 5049e39c5baSBill Taylor uint_t alb_timeout; 5059e39c5baSBill Taylor hermon_loopback_error_t alb_error_type; 5069e39c5baSBill Taylor uint8_t alb_port_num; 5079e39c5baSBill Taylor uint8_t alb_num_retry; 5089e39c5baSBill Taylor } hermon_loopback_ioctl32_t; 5099e39c5baSBill Taylor 5109e39c5baSBill Taylor typedef struct hermon_flash_ioctl32_s { 5119e39c5baSBill Taylor uint32_t af_type; 5129e39c5baSBill Taylor caddr32_t af_sector; 5139e39c5baSBill Taylor uint32_t af_sector_num; 5149e39c5baSBill Taylor uint32_t af_addr; 5159e39c5baSBill Taylor uint32_t af_quadlet; 5169e39c5baSBill Taylor uint8_t af_byte; 5179e39c5baSBill Taylor } hermon_flash_ioctl32_t; 5189e39c5baSBill Taylor 5199e39c5baSBill Taylor /* 5209e39c5baSBill Taylor * The hermon_loopback_comm_t and hermon_loopback_state_t structures below 5219e39c5baSBill Taylor * are used to store all of the relevant state information needed to keep 5229e39c5baSBill Taylor * track of a single VTS ioctl loopback test run. 5239e39c5baSBill Taylor */ 5249e39c5baSBill Taylor typedef struct hermon_loopback_comm_s { 5259e39c5baSBill Taylor uint8_t *hlc_buf; 5269e39c5baSBill Taylor size_t hlc_buf_sz; 5279e39c5baSBill Taylor ibt_mr_desc_t hlc_mrdesc; 5289e39c5baSBill Taylor 5299e39c5baSBill Taylor hermon_mrhdl_t hlc_mrhdl; 5309e39c5baSBill Taylor hermon_cqhdl_t hlc_cqhdl[2]; 5319e39c5baSBill Taylor hermon_qphdl_t hlc_qp_hdl; 5329e39c5baSBill Taylor 5339e39c5baSBill Taylor ibt_mr_attr_t hlc_memattr; 5349e39c5baSBill Taylor uint_t hlc_qp_num; 5359e39c5baSBill Taylor ibt_cq_attr_t hlc_cq_attr; 5369e39c5baSBill Taylor ibt_qp_alloc_attr_t hlc_qp_attr; 5379e39c5baSBill Taylor ibt_chan_sizes_t hlc_chan_sizes; 5389e39c5baSBill Taylor ibt_qp_info_t hlc_qp_info; 5399e39c5baSBill Taylor ibt_queue_sizes_t hlc_queue_sizes; 5409e39c5baSBill Taylor ibt_send_wr_t hlc_wr; 5419e39c5baSBill Taylor ibt_wr_ds_t hlc_sgl; 5429e39c5baSBill Taylor ibt_wc_t hlc_wc; 5439e39c5baSBill Taylor uint_t hlc_num_polled; 5449e39c5baSBill Taylor ibt_status_t hlc_status; 5459e39c5baSBill Taylor int hlc_complete; 5469e39c5baSBill Taylor int hlc_wrid; 5479e39c5baSBill Taylor } hermon_loopback_comm_t; 5489e39c5baSBill Taylor 5499e39c5baSBill Taylor typedef struct hermon_loopback_state_s { 5509e39c5baSBill Taylor uint8_t hls_port; 5519e39c5baSBill Taylor uint_t hls_lid; 5529e39c5baSBill Taylor uint8_t hls_retry; 5539e39c5baSBill Taylor hermon_state_t *hls_state; 5549e39c5baSBill Taylor ibc_hca_hdl_t hls_hca_hdl; 5559e39c5baSBill Taylor hermon_pdhdl_t hls_pd_hdl; 5569e39c5baSBill Taylor hermon_loopback_comm_t hls_tx; 5579e39c5baSBill Taylor hermon_loopback_comm_t hls_rx; 5589e39c5baSBill Taylor ibt_status_t hls_status; 5599e39c5baSBill Taylor int hls_err; 5609e39c5baSBill Taylor int hls_pkey_ix; 5619e39c5baSBill Taylor int hls_timeout; 5629e39c5baSBill Taylor } hermon_loopback_state_t; 5639e39c5baSBill Taylor 5649e39c5baSBill Taylor /* 5659e39c5baSBill Taylor * Mellanox FMR 5669e39c5baSBill Taylor */ 5679e39c5baSBill Taylor typedef struct hermon_fmr_list_s { 5689e39c5baSBill Taylor struct hermon_fmr_list_s *fmr_next; 5699e39c5baSBill Taylor 5709e39c5baSBill Taylor hermon_mrhdl_t fmr; 5719e39c5baSBill Taylor hermon_fmrhdl_t fmr_pool; 5729e39c5baSBill Taylor uint_t fmr_remaps; 573*17a2b317SBill Taylor uint_t fmr_remap_gen; /* generation */ 5749e39c5baSBill Taylor } hermon_fmr_list_t; 5759e39c5baSBill Taylor 5769e39c5baSBill Taylor struct hermon_sw_fmr_s { 5779e39c5baSBill Taylor hermon_state_t *fmr_state; 5789e39c5baSBill Taylor 5799e39c5baSBill Taylor kmutex_t fmr_lock; 580*17a2b317SBill Taylor hermon_fmr_list_t *fmr_free_list; 581*17a2b317SBill Taylor hermon_fmr_list_t **fmr_free_list_tail; 582*17a2b317SBill Taylor int fmr_free_len; 583*17a2b317SBill Taylor int fmr_pool_size; 584*17a2b317SBill Taylor int fmr_max_pages; 585*17a2b317SBill Taylor int fmr_flags; 586*17a2b317SBill Taylor int fmr_stat_register; 5879e39c5baSBill Taylor 5889e39c5baSBill Taylor ibt_fmr_flush_handler_t fmr_flush_function; 5899e39c5baSBill Taylor void *fmr_flush_arg; 5909e39c5baSBill Taylor 591*17a2b317SBill Taylor int fmr_max_remaps; 592*17a2b317SBill Taylor uint_t fmr_remap_gen; /* generation */ 5939e39c5baSBill Taylor int fmr_page_sz; 5949e39c5baSBill Taylor 595*17a2b317SBill Taylor kmutex_t remap_lock; 596*17a2b317SBill Taylor hermon_fmr_list_t *fmr_remap_list; 597*17a2b317SBill Taylor hermon_fmr_list_t **fmr_remap_list_tail; 598*17a2b317SBill Taylor int fmr_remap_watermark; 599*17a2b317SBill Taylor int fmr_remap_len; 6009e39c5baSBill Taylor 601*17a2b317SBill Taylor kmutex_t dirty_lock; 602*17a2b317SBill Taylor hermon_fmr_list_t *fmr_dirty_list; 603*17a2b317SBill Taylor hermon_fmr_list_t **fmr_dirty_list_tail; 604*17a2b317SBill Taylor int fmr_dirty_watermark; 605*17a2b317SBill Taylor int fmr_dirty_len; 6069e39c5baSBill Taylor }; 6079e39c5baSBill Taylor _NOTE(MUTEX_PROTECTS_DATA(hermon_sw_fmr_s::fmr_lock, 6089e39c5baSBill Taylor hermon_sw_fmr_s::fmr_pool_size 6099e39c5baSBill Taylor hermon_sw_fmr_s::fmr_page_sz 610*17a2b317SBill Taylor hermon_sw_fmr_s::fmr_flags 611*17a2b317SBill Taylor hermon_sw_fmr_s::fmr_free_list)) 612*17a2b317SBill Taylor _NOTE(MUTEX_PROTECTS_DATA(hermon_sw_fmr_s::dirty_lock, 6139e39c5baSBill Taylor hermon_sw_fmr_s::fmr_dirty_watermark 6149e39c5baSBill Taylor hermon_sw_fmr_s::fmr_dirty_len 615*17a2b317SBill Taylor hermon_sw_fmr_s::fmr_dirty_list)) 616*17a2b317SBill Taylor _NOTE(DATA_READABLE_WITHOUT_LOCK(hermon_sw_fmr_s::fmr_remap_gen 617*17a2b317SBill Taylor hermon_sw_fmr_s::fmr_state 618*17a2b317SBill Taylor hermon_sw_fmr_s::fmr_max_pages 619*17a2b317SBill Taylor hermon_sw_fmr_s::fmr_max_remaps)) 6209e39c5baSBill Taylor 621*17a2b317SBill Taylor /* FRWR guarantees 8 bits of key; avoid corner cases by using "-2" */ 622*17a2b317SBill Taylor #define HERMON_FMR_MAX_REMAPS (256 - 2) 6239e39c5baSBill Taylor 6249e39c5baSBill Taylor /* Hermon doorbell record routines */ 6259e39c5baSBill Taylor 6269e39c5baSBill Taylor int hermon_dbr_page_alloc(hermon_state_t *state, hermon_dbr_info_t **info); 6279e39c5baSBill Taylor int hermon_dbr_alloc(hermon_state_t *state, uint_t index, 6289e39c5baSBill Taylor ddi_acc_handle_t *acchdl, hermon_dbr_t **vdbr, uint64_t *pdbr, 6299e39c5baSBill Taylor uint64_t *mapoffset); 6309e39c5baSBill Taylor void hermon_dbr_free(hermon_state_t *state, uint_t indx, hermon_dbr_t *record); 6319e39c5baSBill Taylor void hermon_dbr_kern_free(hermon_state_t *state); 6329e39c5baSBill Taylor 6339e39c5baSBill Taylor /* Hermon Fast Memory Registration Routines */ 6349e39c5baSBill Taylor int hermon_create_fmr_pool(hermon_state_t *state, hermon_pdhdl_t pdhdl, 6359e39c5baSBill Taylor ibt_fmr_pool_attr_t *params, hermon_fmrhdl_t *fmrhdl); 6369e39c5baSBill Taylor int hermon_destroy_fmr_pool(hermon_state_t *state, hermon_fmrhdl_t fmrhdl); 6379e39c5baSBill Taylor int hermon_flush_fmr_pool(hermon_state_t *state, hermon_fmrhdl_t fmrhdl); 6389e39c5baSBill Taylor int hermon_register_physical_fmr(hermon_state_t *state, hermon_fmrhdl_t fmrhdl, 6399e39c5baSBill Taylor ibt_pmr_attr_t *mem_pattr_p, hermon_mrhdl_t *mrhdl, 6409e39c5baSBill Taylor ibt_pmr_desc_t *mem_desc_p); 6419e39c5baSBill Taylor int hermon_deregister_fmr(hermon_state_t *state, hermon_mrhdl_t mr); 6429e39c5baSBill Taylor 6439e39c5baSBill Taylor 6449e39c5baSBill Taylor /* Hermon Address Handle routines */ 6459e39c5baSBill Taylor int hermon_ah_alloc(hermon_state_t *state, hermon_pdhdl_t pd, 6469e39c5baSBill Taylor ibt_adds_vect_t *attr_p, hermon_ahhdl_t *ahhdl, uint_t sleepflag); 6479e39c5baSBill Taylor int hermon_ah_free(hermon_state_t *state, hermon_ahhdl_t *ahhdl, 6489e39c5baSBill Taylor uint_t sleepflag); 6499e39c5baSBill Taylor int hermon_ah_query(hermon_state_t *state, hermon_ahhdl_t ahhdl, 6509e39c5baSBill Taylor hermon_pdhdl_t *pdhdl, ibt_adds_vect_t *attr_p); 6519e39c5baSBill Taylor int hermon_ah_modify(hermon_state_t *state, hermon_ahhdl_t ahhdl, 6529e39c5baSBill Taylor ibt_adds_vect_t *attr_p); 6539e39c5baSBill Taylor 6549e39c5baSBill Taylor /* Hermon Multicast Group routines */ 6559e39c5baSBill Taylor int hermon_mcg_attach(hermon_state_t *state, hermon_qphdl_t qphdl, ib_gid_t gid, 6569e39c5baSBill Taylor ib_lid_t lid); 6579e39c5baSBill Taylor int hermon_mcg_detach(hermon_state_t *state, hermon_qphdl_t qphdl, ib_gid_t gid, 6589e39c5baSBill Taylor ib_lid_t lid); 6599e39c5baSBill Taylor 6609e39c5baSBill Taylor /* Hermon Protection Domain routines */ 6619e39c5baSBill Taylor int hermon_pd_alloc(hermon_state_t *state, hermon_pdhdl_t *pdhdl, 6629e39c5baSBill Taylor uint_t sleepflag); 6639e39c5baSBill Taylor int hermon_pd_free(hermon_state_t *state, hermon_pdhdl_t *pdhdl); 6649e39c5baSBill Taylor void hermon_pd_refcnt_inc(hermon_pdhdl_t pd); 6659e39c5baSBill Taylor void hermon_pd_refcnt_dec(hermon_pdhdl_t pd); 6669e39c5baSBill Taylor 6679e39c5baSBill Taylor /* Hermon port-related routines */ 6689e39c5baSBill Taylor int hermon_port_query(hermon_state_t *state, uint_t port, 6699e39c5baSBill Taylor ibt_hca_portinfo_t *pi); 6709e39c5baSBill Taylor int hermon_port_modify(hermon_state_t *state, uint8_t port, 6719e39c5baSBill Taylor ibt_port_modify_flags_t flags, uint8_t init_type); 6729e39c5baSBill Taylor 6739e39c5baSBill Taylor /* Hermon statistics (kstat) routines */ 6749e39c5baSBill Taylor int hermon_kstat_init(hermon_state_t *state); 6759e39c5baSBill Taylor void hermon_kstat_fini(hermon_state_t *state); 6769e39c5baSBill Taylor 6779e39c5baSBill Taylor /* Miscellaneous routines */ 6789e39c5baSBill Taylor int hermon_set_addr_path(hermon_state_t *state, ibt_adds_vect_t *av, 6799e39c5baSBill Taylor hermon_hw_addr_path_t *path, uint_t type); 6809e39c5baSBill Taylor void hermon_get_addr_path(hermon_state_t *state, hermon_hw_addr_path_t *path, 6819e39c5baSBill Taylor ibt_adds_vect_t *av, uint_t type); 6829e39c5baSBill Taylor int hermon_portnum_is_valid(hermon_state_t *state, uint_t portnum); 6839e39c5baSBill Taylor int hermon_pkeyindex_is_valid(hermon_state_t *state, uint_t pkeyindx); 6849e39c5baSBill Taylor int hermon_queue_alloc(hermon_state_t *state, hermon_qalloc_info_t *qa_info, 6859e39c5baSBill Taylor uint_t sleepflag); 6869e39c5baSBill Taylor void hermon_queue_free(hermon_qalloc_info_t *qa_info); 6879e39c5baSBill Taylor 6889e39c5baSBill Taylor #ifdef __cplusplus 6899e39c5baSBill Taylor } 6909e39c5baSBill Taylor #endif 6919e39c5baSBill Taylor 6929e39c5baSBill Taylor #endif /* _SYS_IB_ADAPTERS_HERMON_MISC_H */ 693