197549c34SHans Petter Selasky /* 297549c34SHans Petter Selasky * Copyright (c) 2006, 2007 Cisco Systems, Inc. All rights reserved. 397549c34SHans Petter Selasky * 497549c34SHans Petter Selasky * This software is available to you under a choice of one of two 597549c34SHans Petter Selasky * licenses. You may choose to be licensed under the terms of the GNU 697549c34SHans Petter Selasky * General Public License (GPL) Version 2, available from the file 797549c34SHans Petter Selasky * COPYING in the main directory of this source tree, or the 897549c34SHans Petter Selasky * OpenIB.org BSD license below: 997549c34SHans Petter Selasky * 1097549c34SHans Petter Selasky * Redistribution and use in source and binary forms, with or 1197549c34SHans Petter Selasky * without modification, are permitted provided that the following 1297549c34SHans Petter Selasky * conditions are met: 1397549c34SHans Petter Selasky * 1497549c34SHans Petter Selasky * - Redistributions of source code must retain the above 1597549c34SHans Petter Selasky * copyright notice, this list of conditions and the following 1697549c34SHans Petter Selasky * disclaimer. 1797549c34SHans Petter Selasky * 1897549c34SHans Petter Selasky * - Redistributions in binary form must reproduce the above 1997549c34SHans Petter Selasky * copyright notice, this list of conditions and the following 2097549c34SHans Petter Selasky * disclaimer in the documentation and/or other materials 2197549c34SHans Petter Selasky * provided with the distribution. 2297549c34SHans Petter Selasky * 2397549c34SHans Petter Selasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 2497549c34SHans Petter Selasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 2597549c34SHans Petter Selasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 2697549c34SHans Petter Selasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 2797549c34SHans Petter Selasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 2897549c34SHans Petter Selasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 2997549c34SHans Petter Selasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 3097549c34SHans Petter Selasky * SOFTWARE. 3197549c34SHans Petter Selasky */ 3297549c34SHans Petter Selasky 3397549c34SHans Petter Selasky #ifndef MLX4_DEVICE_H 3497549c34SHans Petter Selasky #define MLX4_DEVICE_H 3597549c34SHans Petter Selasky 3697549c34SHans Petter Selasky #include <linux/pci.h> 3797549c34SHans Petter Selasky #include <linux/completion.h> 3897549c34SHans Petter Selasky #include <linux/radix-tree.h> 3997549c34SHans Petter Selasky #include <linux/types.h> 4097549c34SHans Petter Selasky #include <linux/bitops.h> 4197549c34SHans Petter Selasky #include <linux/workqueue.h> 4297549c34SHans Petter Selasky #include <asm/atomic.h> 4397549c34SHans Petter Selasky 4497549c34SHans Petter Selasky #include <linux/clocksource.h> 4597549c34SHans Petter Selasky 4697549c34SHans Petter Selasky #define MAX_MSIX_P_PORT 17 4797549c34SHans Petter Selasky #define MAX_MSIX 64 4897549c34SHans Petter Selasky #define MSIX_LEGACY_SZ 4 4997549c34SHans Petter Selasky #define MIN_MSIX_P_PORT 5 5097549c34SHans Petter Selasky 5197549c34SHans Petter Selasky #define MLX4_ROCE_MAX_GIDS 128 5297549c34SHans Petter Selasky #define MLX4_ROCE_PF_GIDS 16 5397549c34SHans Petter Selasky 5497549c34SHans Petter Selasky #define MLX4_NUM_UP 8 5597549c34SHans Petter Selasky #define MLX4_NUM_TC 8 5697549c34SHans Petter Selasky #define MLX4_MAX_100M_UNITS_VAL 255 /* 5797549c34SHans Petter Selasky * work around: can't set values 5897549c34SHans Petter Selasky * greater then this value when 5997549c34SHans Petter Selasky * using 100 Mbps units. 6097549c34SHans Petter Selasky */ 6197549c34SHans Petter Selasky #define MLX4_RATELIMIT_100M_UNITS 3 /* 100 Mbps */ 6297549c34SHans Petter Selasky #define MLX4_RATELIMIT_1G_UNITS 4 /* 1 Gbps */ 6397549c34SHans Petter Selasky #define MLX4_RATELIMIT_DEFAULT 0x00ff 6497549c34SHans Petter Selasky 6597549c34SHans Petter Selasky #define CORE_CLOCK_MASK 0xffffffffffffULL 6697549c34SHans Petter Selasky 6797549c34SHans Petter Selasky enum { 6897549c34SHans Petter Selasky MLX4_FLAG_MSI_X = 1 << 0, 6997549c34SHans Petter Selasky MLX4_FLAG_OLD_PORT_CMDS = 1 << 1, 7097549c34SHans Petter Selasky MLX4_FLAG_MASTER = 1 << 2, 7197549c34SHans Petter Selasky MLX4_FLAG_SLAVE = 1 << 3, 7297549c34SHans Petter Selasky MLX4_FLAG_SRIOV = 1 << 4, 7397549c34SHans Petter Selasky MLX4_FLAG_DEV_NUM_STR = 1 << 5, 7497549c34SHans Petter Selasky MLX4_FLAG_OLD_REG_MAC = 1 << 6, 7597549c34SHans Petter Selasky }; 7697549c34SHans Petter Selasky 7797549c34SHans Petter Selasky enum { 7897549c34SHans Petter Selasky MLX4_PORT_CAP_IS_SM = 1 << 1, 7997549c34SHans Petter Selasky MLX4_PORT_CAP_DEV_MGMT_SUP = 1 << 19, 8097549c34SHans Petter Selasky }; 8197549c34SHans Petter Selasky 8297549c34SHans Petter Selasky enum { 8397549c34SHans Petter Selasky MLX4_MAX_PORTS = 2, 8497549c34SHans Petter Selasky MLX4_MAX_PORT_PKEYS = 128 8597549c34SHans Petter Selasky }; 8697549c34SHans Petter Selasky 8797549c34SHans Petter Selasky /* base qkey for use in sriov tunnel-qp/proxy-qp communication. 8897549c34SHans Petter Selasky * These qkeys must not be allowed for general use. This is a 64k range, 8997549c34SHans Petter Selasky * and to test for violation, we use the mask (protect against future chg). 9097549c34SHans Petter Selasky */ 9197549c34SHans Petter Selasky #define MLX4_RESERVED_QKEY_BASE (0xFFFF0000) 9297549c34SHans Petter Selasky #define MLX4_RESERVED_QKEY_MASK (0xFFFF0000) 9397549c34SHans Petter Selasky 9497549c34SHans Petter Selasky enum { 9597549c34SHans Petter Selasky MLX4_BOARD_ID_LEN = 64, 9697549c34SHans Petter Selasky MLX4_VSD_LEN = 208 9797549c34SHans Petter Selasky }; 9897549c34SHans Petter Selasky 9997549c34SHans Petter Selasky enum { 10097549c34SHans Petter Selasky MLX4_MAX_NUM_PF = 16, 10197549c34SHans Petter Selasky MLX4_MAX_NUM_VF = 64, 10297549c34SHans Petter Selasky MLX4_MFUNC_MAX = 80, 10397549c34SHans Petter Selasky MLX4_MAX_EQ_NUM = 1024, 10497549c34SHans Petter Selasky MLX4_MFUNC_EQ_NUM = 4, 10597549c34SHans Petter Selasky MLX4_MFUNC_MAX_EQES = 8, 10697549c34SHans Petter Selasky MLX4_MFUNC_EQE_MASK = (MLX4_MFUNC_MAX_EQES - 1) 10797549c34SHans Petter Selasky }; 10897549c34SHans Petter Selasky 10997549c34SHans Petter Selasky /* Driver supports 3 different device methods to manage traffic steering: 11097549c34SHans Petter Selasky * -device managed - High level API for ib and eth flow steering. FW is 11197549c34SHans Petter Selasky * managing flow steering tables. 11297549c34SHans Petter Selasky * - B0 steering mode - Common low level API for ib and (if supported) eth. 11397549c34SHans Petter Selasky * - A0 steering mode - Limited low level API for eth. In case of IB, 11497549c34SHans Petter Selasky * B0 mode is in use. 11597549c34SHans Petter Selasky */ 11697549c34SHans Petter Selasky enum { 11797549c34SHans Petter Selasky MLX4_STEERING_MODE_A0, 11897549c34SHans Petter Selasky MLX4_STEERING_MODE_B0, 11997549c34SHans Petter Selasky MLX4_STEERING_MODE_DEVICE_MANAGED 12097549c34SHans Petter Selasky }; 12197549c34SHans Petter Selasky 12297549c34SHans Petter Selasky static inline const char *mlx4_steering_mode_str(int steering_mode) 12397549c34SHans Petter Selasky { 12497549c34SHans Petter Selasky switch (steering_mode) { 12597549c34SHans Petter Selasky case MLX4_STEERING_MODE_A0: 12697549c34SHans Petter Selasky return "A0 steering"; 12797549c34SHans Petter Selasky 12897549c34SHans Petter Selasky case MLX4_STEERING_MODE_B0: 12997549c34SHans Petter Selasky return "B0 steering"; 13097549c34SHans Petter Selasky 13197549c34SHans Petter Selasky case MLX4_STEERING_MODE_DEVICE_MANAGED: 13297549c34SHans Petter Selasky return "Device managed flow steering"; 13397549c34SHans Petter Selasky 13497549c34SHans Petter Selasky default: 13597549c34SHans Petter Selasky return "Unrecognize steering mode"; 13697549c34SHans Petter Selasky } 13797549c34SHans Petter Selasky } 13897549c34SHans Petter Selasky 13997549c34SHans Petter Selasky enum { 14097549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_RC = 1LL << 0, 14197549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_UC = 1LL << 1, 14297549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_UD = 1LL << 2, 14397549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_XRC = 1LL << 3, 14497549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_SRQ = 1LL << 6, 14597549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_IPOIB_CSUM = 1LL << 7, 14697549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8, 14797549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9, 14897549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_DPDP = 1LL << 12, 14997549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_BLH = 1LL << 15, 15097549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1LL << 16, 15197549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_APM = 1LL << 17, 15297549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_ATOMIC = 1LL << 18, 15397549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_RAW_MCAST = 1LL << 19, 15497549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_UD_AV_PORT = 1LL << 20, 15597549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_UD_MCAST = 1LL << 21, 15697549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30, 15797549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32, 15897549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_FCS_KEEP = 1LL << 34, 15997549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_WOL_PORT1 = 1LL << 37, 16097549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_WOL_PORT2 = 1LL << 38, 16197549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40, 16297549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, 16397549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, 16497549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_CROSS_CHANNEL = 1LL << 44, 16597549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, 16697549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_COUNTERS_EXT = 1LL << 49, 16797549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_SET_PORT_ETH_SCHED = 1LL << 53, 16897549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, 16997549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_FAST_DROP = 1LL << 57, 17097549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, 17197549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_64B_EQE = 1LL << 61, 17297549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG_64B_CQE = 1LL << 62 17397549c34SHans Petter Selasky }; 17497549c34SHans Petter Selasky 17597549c34SHans Petter Selasky enum { 17697549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_RSS = 1LL << 0, 17797549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, 17897549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, 17997549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3, 18097549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_FSM = 1LL << 4, 18197549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 5, 18297549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 6, 18397549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_LB_SRC_CHK = 1LL << 7, 18497549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 8, 18597549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_ETS_CFG = 1LL << 9, 18697549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_ETH_BACKPL_AN_REP = 1LL << 10, 18797549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN = 1LL << 11, 18897549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 12, 18997549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_TS = 1LL << 13, 19097549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_DRIVER_VERSION_TO_FW = 1LL << 14, 19197549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_REASSIGN_MAC_EN = 1LL << 15, 19297549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 16, 19397549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_FS_EN_NCSI = 1LL << 17, 19497549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18, 19597549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_DMFS_TAG_MODE = 1LL << 19, 19697549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_ROCEV2 = 1LL << 20, 19797549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_ETH_PROT_CTRL = 1LL << 21, 19897549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_CQE_STRIDE = 1LL << 22, 19997549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_EQE_STRIDE = 1LL << 23, 20097549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_UPDATE_QP_SRC_CHECK_LB = 1LL << 24, 20197549c34SHans Petter Selasky MLX4_DEV_CAP_FLAG2_RX_CSUM_MODE = 1LL << 25, 2022cebcdc7SHans Petter Selasky MLX4_DEV_CAP_FLAG2_SYS_EQS = 1LL << 26, 20397549c34SHans Petter Selasky }; 20497549c34SHans Petter Selasky 20597549c34SHans Petter Selasky /* bit enums for an 8-bit flags field indicating special use 20697549c34SHans Petter Selasky * QPs which require special handling in qp_reserve_range. 20797549c34SHans Petter Selasky * Currently, this only includes QPs used by the ETH interface, 20897549c34SHans Petter Selasky * where we expect to use blueflame. These QPs must not have 20997549c34SHans Petter Selasky * bits 6 and 7 set in their qp number. 21097549c34SHans Petter Selasky * 21197549c34SHans Petter Selasky * This enum may use only bits 0..7. 21297549c34SHans Petter Selasky */ 21397549c34SHans Petter Selasky enum { 21497549c34SHans Petter Selasky MLX4_RESERVE_BF_QP = 1 << 7, 21597549c34SHans Petter Selasky }; 21697549c34SHans Petter Selasky 21797549c34SHans Petter Selasky enum { 21897549c34SHans Petter Selasky MLX4_DEV_CAP_CQ_FLAG_IO = 1 << 0 21997549c34SHans Petter Selasky }; 22097549c34SHans Petter Selasky 22197549c34SHans Petter Selasky enum { 222*64968e70SHans Petter Selasky MLX4_QUERY_FUNC_FLAGS_BF_RES_QP = 1LL << 0 223*64968e70SHans Petter Selasky }; 224*64968e70SHans Petter Selasky 225*64968e70SHans Petter Selasky /* bit enums for an 8-bit flags field indicating special use 226*64968e70SHans Petter Selasky * QPs which require special handling in qp_reserve_range. 227*64968e70SHans Petter Selasky * Currently, this only includes QPs used by the ETH interface, 228*64968e70SHans Petter Selasky * where we expect to use blueflame. These QPs must not have 229*64968e70SHans Petter Selasky * bits 6 and 7 set in their qp number. 230*64968e70SHans Petter Selasky * 231*64968e70SHans Petter Selasky * This enum may use only bits 0..7. 232*64968e70SHans Petter Selasky */ 233*64968e70SHans Petter Selasky enum { 234*64968e70SHans Petter Selasky MLX4_RESERVE_ETH_BF_QP = 1 << 7, 235*64968e70SHans Petter Selasky }; 236*64968e70SHans Petter Selasky 237*64968e70SHans Petter Selasky 238*64968e70SHans Petter Selasky enum { 23997549c34SHans Petter Selasky MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0, 24097549c34SHans Petter Selasky MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1 24197549c34SHans Petter Selasky }; 24297549c34SHans Petter Selasky 24397549c34SHans Petter Selasky enum { 24497549c34SHans Petter Selasky MLX4_USER_DEV_CAP_64B_CQE = 1L << 0 24597549c34SHans Petter Selasky }; 24697549c34SHans Petter Selasky 24797549c34SHans Petter Selasky enum { 24897549c34SHans Petter Selasky MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0 24997549c34SHans Petter Selasky }; 25097549c34SHans Petter Selasky 25197549c34SHans Petter Selasky 25297549c34SHans Petter Selasky #define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) 25397549c34SHans Petter Selasky 25497549c34SHans Petter Selasky enum { 25597549c34SHans Petter Selasky MLX4_BMME_FLAG_WIN_TYPE_2B = 1 << 1, 25697549c34SHans Petter Selasky MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, 25797549c34SHans Petter Selasky MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, 25897549c34SHans Petter Selasky MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, 25997549c34SHans Petter Selasky MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10, 26097549c34SHans Petter Selasky MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11, 26197549c34SHans Petter Selasky }; 26297549c34SHans Petter Selasky 26397549c34SHans Petter Selasky enum mlx4_event { 26497549c34SHans Petter Selasky MLX4_EVENT_TYPE_COMP = 0x00, 26597549c34SHans Petter Selasky MLX4_EVENT_TYPE_PATH_MIG = 0x01, 26697549c34SHans Petter Selasky MLX4_EVENT_TYPE_COMM_EST = 0x02, 26797549c34SHans Petter Selasky MLX4_EVENT_TYPE_SQ_DRAINED = 0x03, 26897549c34SHans Petter Selasky MLX4_EVENT_TYPE_SRQ_QP_LAST_WQE = 0x13, 26997549c34SHans Petter Selasky MLX4_EVENT_TYPE_SRQ_LIMIT = 0x14, 27097549c34SHans Petter Selasky MLX4_EVENT_TYPE_CQ_ERROR = 0x04, 27197549c34SHans Petter Selasky MLX4_EVENT_TYPE_WQ_CATAS_ERROR = 0x05, 27297549c34SHans Petter Selasky MLX4_EVENT_TYPE_EEC_CATAS_ERROR = 0x06, 27397549c34SHans Petter Selasky MLX4_EVENT_TYPE_PATH_MIG_FAILED = 0x07, 27497549c34SHans Petter Selasky MLX4_EVENT_TYPE_WQ_INVAL_REQ_ERROR = 0x10, 27597549c34SHans Petter Selasky MLX4_EVENT_TYPE_WQ_ACCESS_ERROR = 0x11, 27697549c34SHans Petter Selasky MLX4_EVENT_TYPE_SRQ_CATAS_ERROR = 0x12, 27797549c34SHans Petter Selasky MLX4_EVENT_TYPE_LOCAL_CATAS_ERROR = 0x08, 27897549c34SHans Petter Selasky MLX4_EVENT_TYPE_PORT_CHANGE = 0x09, 27997549c34SHans Petter Selasky MLX4_EVENT_TYPE_EQ_OVERFLOW = 0x0f, 28097549c34SHans Petter Selasky MLX4_EVENT_TYPE_ECC_DETECT = 0x0e, 28197549c34SHans Petter Selasky MLX4_EVENT_TYPE_CMD = 0x0a, 28297549c34SHans Petter Selasky MLX4_EVENT_TYPE_VEP_UPDATE = 0x19, 28397549c34SHans Petter Selasky MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18, 28497549c34SHans Petter Selasky MLX4_EVENT_TYPE_OP_REQUIRED = 0x1a, 28597549c34SHans Petter Selasky MLX4_EVENT_TYPE_FATAL_WARNING = 0x1b, 28697549c34SHans Petter Selasky MLX4_EVENT_TYPE_FLR_EVENT = 0x1c, 28797549c34SHans Petter Selasky MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT = 0x1d, 28897549c34SHans Petter Selasky MLX4_EVENT_TYPE_RECOVERABLE_ERROR_EVENT = 0x3e, 28997549c34SHans Petter Selasky MLX4_EVENT_TYPE_NONE = 0xff, 29097549c34SHans Petter Selasky }; 29197549c34SHans Petter Selasky 29297549c34SHans Petter Selasky enum { 29397549c34SHans Petter Selasky MLX4_PORT_CHANGE_SUBTYPE_DOWN = 1, 29497549c34SHans Petter Selasky MLX4_PORT_CHANGE_SUBTYPE_ACTIVE = 4 29597549c34SHans Petter Selasky }; 29697549c34SHans Petter Selasky 29797549c34SHans Petter Selasky enum { 29897549c34SHans Petter Selasky MLX4_RECOVERABLE_ERROR_EVENT_SUBTYPE_BAD_CABLE = 1, 29997549c34SHans Petter Selasky MLX4_RECOVERABLE_ERROR_EVENT_SUBTYPE_UNSUPPORTED_CABLE = 2, 30097549c34SHans Petter Selasky }; 30197549c34SHans Petter Selasky 30297549c34SHans Petter Selasky enum { 30397549c34SHans Petter Selasky MLX4_FATAL_WARNING_SUBTYPE_WARMING = 0, 30497549c34SHans Petter Selasky }; 30597549c34SHans Petter Selasky 30697549c34SHans Petter Selasky enum slave_port_state { 30797549c34SHans Petter Selasky SLAVE_PORT_DOWN = 0, 30897549c34SHans Petter Selasky SLAVE_PENDING_UP, 30997549c34SHans Petter Selasky SLAVE_PORT_UP, 31097549c34SHans Petter Selasky }; 31197549c34SHans Petter Selasky 31297549c34SHans Petter Selasky enum slave_port_gen_event { 31397549c34SHans Petter Selasky SLAVE_PORT_GEN_EVENT_DOWN = 0, 31497549c34SHans Petter Selasky SLAVE_PORT_GEN_EVENT_UP, 31597549c34SHans Petter Selasky SLAVE_PORT_GEN_EVENT_NONE, 31697549c34SHans Petter Selasky }; 31797549c34SHans Petter Selasky 31897549c34SHans Petter Selasky enum slave_port_state_event { 31997549c34SHans Petter Selasky MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN, 32097549c34SHans Petter Selasky MLX4_PORT_STATE_DEV_EVENT_PORT_UP, 32197549c34SHans Petter Selasky MLX4_PORT_STATE_IB_PORT_STATE_EVENT_GID_VALID, 32297549c34SHans Petter Selasky MLX4_PORT_STATE_IB_EVENT_GID_INVALID, 32397549c34SHans Petter Selasky }; 32497549c34SHans Petter Selasky 32597549c34SHans Petter Selasky enum { 32697549c34SHans Petter Selasky MLX4_PERM_LOCAL_READ = 1 << 10, 32797549c34SHans Petter Selasky MLX4_PERM_LOCAL_WRITE = 1 << 11, 32897549c34SHans Petter Selasky MLX4_PERM_REMOTE_READ = 1 << 12, 32997549c34SHans Petter Selasky MLX4_PERM_REMOTE_WRITE = 1 << 13, 33097549c34SHans Petter Selasky MLX4_PERM_ATOMIC = 1 << 14, 33197549c34SHans Petter Selasky MLX4_PERM_BIND_MW = 1 << 15, 33297549c34SHans Petter Selasky }; 33397549c34SHans Petter Selasky 33497549c34SHans Petter Selasky enum { 33597549c34SHans Petter Selasky MLX4_OPCODE_NOP = 0x00, 33697549c34SHans Petter Selasky MLX4_OPCODE_SEND_INVAL = 0x01, 33797549c34SHans Petter Selasky MLX4_OPCODE_RDMA_WRITE = 0x08, 33897549c34SHans Petter Selasky MLX4_OPCODE_RDMA_WRITE_IMM = 0x09, 33997549c34SHans Petter Selasky MLX4_OPCODE_SEND = 0x0a, 34097549c34SHans Petter Selasky MLX4_OPCODE_SEND_IMM = 0x0b, 34197549c34SHans Petter Selasky MLX4_OPCODE_LSO = 0x0e, 34297549c34SHans Petter Selasky MLX4_OPCODE_RDMA_READ = 0x10, 34397549c34SHans Petter Selasky MLX4_OPCODE_ATOMIC_CS = 0x11, 34497549c34SHans Petter Selasky MLX4_OPCODE_ATOMIC_FA = 0x12, 34597549c34SHans Petter Selasky MLX4_OPCODE_MASKED_ATOMIC_CS = 0x14, 34697549c34SHans Petter Selasky MLX4_OPCODE_MASKED_ATOMIC_FA = 0x15, 34797549c34SHans Petter Selasky MLX4_OPCODE_BIND_MW = 0x18, 34897549c34SHans Petter Selasky MLX4_OPCODE_FMR = 0x19, 34997549c34SHans Petter Selasky MLX4_OPCODE_LOCAL_INVAL = 0x1b, 35097549c34SHans Petter Selasky MLX4_OPCODE_CONFIG_CMD = 0x1f, 35197549c34SHans Petter Selasky 35297549c34SHans Petter Selasky MLX4_RECV_OPCODE_RDMA_WRITE_IMM = 0x00, 35397549c34SHans Petter Selasky MLX4_RECV_OPCODE_SEND = 0x01, 35497549c34SHans Petter Selasky MLX4_RECV_OPCODE_SEND_IMM = 0x02, 35597549c34SHans Petter Selasky MLX4_RECV_OPCODE_SEND_INVAL = 0x03, 35697549c34SHans Petter Selasky 35797549c34SHans Petter Selasky MLX4_CQE_OPCODE_ERROR = 0x1e, 35897549c34SHans Petter Selasky MLX4_CQE_OPCODE_RESIZE = 0x16, 35997549c34SHans Petter Selasky }; 36097549c34SHans Petter Selasky 36197549c34SHans Petter Selasky enum { 36297549c34SHans Petter Selasky MLX4_STAT_RATE_OFFSET = 5 36397549c34SHans Petter Selasky }; 36497549c34SHans Petter Selasky 36597549c34SHans Petter Selasky enum mlx4_protocol { 36697549c34SHans Petter Selasky MLX4_PROT_IB_IPV6 = 0, 36797549c34SHans Petter Selasky MLX4_PROT_ETH, 36897549c34SHans Petter Selasky MLX4_PROT_IB_IPV4, 36997549c34SHans Petter Selasky MLX4_PROT_FCOE 37097549c34SHans Petter Selasky }; 37197549c34SHans Petter Selasky 37297549c34SHans Petter Selasky enum { 37397549c34SHans Petter Selasky MLX4_MTT_FLAG_PRESENT = 1 37497549c34SHans Petter Selasky }; 37597549c34SHans Petter Selasky 37697549c34SHans Petter Selasky enum { 37797549c34SHans Petter Selasky MLX4_MAX_MTT_SHIFT = 31 37897549c34SHans Petter Selasky }; 37997549c34SHans Petter Selasky 38097549c34SHans Petter Selasky enum mlx4_qp_region { 38197549c34SHans Petter Selasky MLX4_QP_REGION_FW = 0, 38297549c34SHans Petter Selasky MLX4_QP_REGION_ETH_ADDR, 38397549c34SHans Petter Selasky MLX4_QP_REGION_FC_ADDR, 38497549c34SHans Petter Selasky MLX4_QP_REGION_FC_EXCH, 38597549c34SHans Petter Selasky MLX4_NUM_QP_REGION 38697549c34SHans Petter Selasky }; 38797549c34SHans Petter Selasky 38897549c34SHans Petter Selasky enum mlx4_port_type { 38997549c34SHans Petter Selasky MLX4_PORT_TYPE_NONE = 0, 39097549c34SHans Petter Selasky MLX4_PORT_TYPE_IB = 1, 39197549c34SHans Petter Selasky MLX4_PORT_TYPE_ETH = 2, 39297549c34SHans Petter Selasky MLX4_PORT_TYPE_AUTO = 3, 39397549c34SHans Petter Selasky MLX4_PORT_TYPE_NA = 4 39497549c34SHans Petter Selasky }; 39597549c34SHans Petter Selasky 39697549c34SHans Petter Selasky enum mlx4_special_vlan_idx { 39797549c34SHans Petter Selasky MLX4_NO_VLAN_IDX = 0, 39897549c34SHans Petter Selasky MLX4_VLAN_MISS_IDX, 39997549c34SHans Petter Selasky MLX4_VLAN_REGULAR 40097549c34SHans Petter Selasky }; 40197549c34SHans Petter Selasky 40297549c34SHans Petter Selasky enum mlx4_steer_type { 40397549c34SHans Petter Selasky MLX4_MC_STEER = 0, 40497549c34SHans Petter Selasky MLX4_UC_STEER, 40597549c34SHans Petter Selasky MLX4_NUM_STEERS 40697549c34SHans Petter Selasky }; 40797549c34SHans Petter Selasky 40897549c34SHans Petter Selasky enum { 40997549c34SHans Petter Selasky MLX4_NUM_FEXCH = 64 * 1024, 41097549c34SHans Petter Selasky }; 41197549c34SHans Petter Selasky 41297549c34SHans Petter Selasky enum { 41397549c34SHans Petter Selasky MLX4_MAX_FAST_REG_PAGES = 511, 41497549c34SHans Petter Selasky }; 41597549c34SHans Petter Selasky 41697549c34SHans Petter Selasky enum { 41797549c34SHans Petter Selasky MLX4_DEV_PMC_SUBTYPE_GUID_INFO = 0x14, 41897549c34SHans Petter Selasky MLX4_DEV_PMC_SUBTYPE_PORT_INFO = 0x15, 41997549c34SHans Petter Selasky MLX4_DEV_PMC_SUBTYPE_PKEY_TABLE = 0x16, 42097549c34SHans Petter Selasky }; 42197549c34SHans Petter Selasky 42297549c34SHans Petter Selasky /* Port mgmt change event handling */ 42397549c34SHans Petter Selasky enum { 42497549c34SHans Petter Selasky MLX4_EQ_PORT_INFO_MSTR_SM_LID_CHANGE_MASK = 1 << 0, 42597549c34SHans Petter Selasky MLX4_EQ_PORT_INFO_GID_PFX_CHANGE_MASK = 1 << 1, 42697549c34SHans Petter Selasky MLX4_EQ_PORT_INFO_LID_CHANGE_MASK = 1 << 2, 42797549c34SHans Petter Selasky MLX4_EQ_PORT_INFO_CLIENT_REREG_MASK = 1 << 3, 42897549c34SHans Petter Selasky MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK = 1 << 4, 42997549c34SHans Petter Selasky }; 43097549c34SHans Petter Selasky 43197549c34SHans Petter Selasky #define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \ 43297549c34SHans Petter Selasky MLX4_EQ_PORT_INFO_MSTR_SM_LID_CHANGE_MASK) 43397549c34SHans Petter Selasky 43497549c34SHans Petter Selasky enum mlx4_module_id { 43597549c34SHans Petter Selasky MLX4_MODULE_ID_SFP = 0x3, 43697549c34SHans Petter Selasky MLX4_MODULE_ID_QSFP = 0xC, 43797549c34SHans Petter Selasky MLX4_MODULE_ID_QSFP_PLUS = 0xD, 43897549c34SHans Petter Selasky MLX4_MODULE_ID_QSFP28 = 0x11, 43997549c34SHans Petter Selasky }; 44097549c34SHans Petter Selasky 44197549c34SHans Petter Selasky static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) 44297549c34SHans Petter Selasky { 44397549c34SHans Petter Selasky return (major << 32) | (minor << 16) | subminor; 44497549c34SHans Petter Selasky } 44597549c34SHans Petter Selasky 44697549c34SHans Petter Selasky struct mlx4_phys_caps { 44797549c34SHans Petter Selasky u32 gid_phys_table_len[MLX4_MAX_PORTS + 1]; 44897549c34SHans Petter Selasky u32 pkey_phys_table_len[MLX4_MAX_PORTS + 1]; 44997549c34SHans Petter Selasky u32 num_phys_eqs; 45097549c34SHans Petter Selasky u32 base_sqpn; 45197549c34SHans Petter Selasky u32 base_proxy_sqpn; 45297549c34SHans Petter Selasky u32 base_tunnel_sqpn; 45397549c34SHans Petter Selasky }; 45497549c34SHans Petter Selasky 45597549c34SHans Petter Selasky struct mlx4_caps { 45697549c34SHans Petter Selasky u64 fw_ver; 45797549c34SHans Petter Selasky u32 function; 45897549c34SHans Petter Selasky int num_ports; 45997549c34SHans Petter Selasky int vl_cap[MLX4_MAX_PORTS + 1]; 46097549c34SHans Petter Selasky int ib_mtu_cap[MLX4_MAX_PORTS + 1]; 46197549c34SHans Petter Selasky __be32 ib_port_def_cap[MLX4_MAX_PORTS + 1]; 46297549c34SHans Petter Selasky u64 def_mac[MLX4_MAX_PORTS + 1]; 46397549c34SHans Petter Selasky int eth_mtu_cap[MLX4_MAX_PORTS + 1]; 46497549c34SHans Petter Selasky int gid_table_len[MLX4_MAX_PORTS + 1]; 46597549c34SHans Petter Selasky int pkey_table_len[MLX4_MAX_PORTS + 1]; 46697549c34SHans Petter Selasky int trans_type[MLX4_MAX_PORTS + 1]; 46797549c34SHans Petter Selasky int vendor_oui[MLX4_MAX_PORTS + 1]; 46897549c34SHans Petter Selasky int wavelength[MLX4_MAX_PORTS + 1]; 46997549c34SHans Petter Selasky u64 trans_code[MLX4_MAX_PORTS + 1]; 47097549c34SHans Petter Selasky int local_ca_ack_delay; 47197549c34SHans Petter Selasky int num_uars; 47297549c34SHans Petter Selasky u32 uar_page_size; 47397549c34SHans Petter Selasky int bf_reg_size; 47497549c34SHans Petter Selasky int bf_regs_per_page; 47597549c34SHans Petter Selasky int max_sq_sg; 47697549c34SHans Petter Selasky int max_rq_sg; 47797549c34SHans Petter Selasky int num_qps; 47897549c34SHans Petter Selasky int max_wqes; 47997549c34SHans Petter Selasky int max_sq_desc_sz; 48097549c34SHans Petter Selasky int max_rq_desc_sz; 48197549c34SHans Petter Selasky int max_qp_init_rdma; 48297549c34SHans Petter Selasky int max_qp_dest_rdma; 48397549c34SHans Petter Selasky u32 *qp0_proxy; 48497549c34SHans Petter Selasky u32 *qp1_proxy; 48597549c34SHans Petter Selasky u32 *qp0_tunnel; 48697549c34SHans Petter Selasky u32 *qp1_tunnel; 48797549c34SHans Petter Selasky int num_srqs; 48897549c34SHans Petter Selasky int max_srq_wqes; 48997549c34SHans Petter Selasky int max_srq_sge; 49097549c34SHans Petter Selasky int reserved_srqs; 49197549c34SHans Petter Selasky int num_cqs; 49297549c34SHans Petter Selasky int max_cqes; 49397549c34SHans Petter Selasky int reserved_cqs; 4942cebcdc7SHans Petter Selasky int num_sys_eqs; 49597549c34SHans Petter Selasky int num_eqs; 49697549c34SHans Petter Selasky int reserved_eqs; 49797549c34SHans Petter Selasky int num_comp_vectors; 49897549c34SHans Petter Selasky int comp_pool; 49997549c34SHans Petter Selasky int num_mpts; 50097549c34SHans Petter Selasky int max_fmr_maps; 50197549c34SHans Petter Selasky u64 num_mtts; 50297549c34SHans Petter Selasky int fmr_reserved_mtts; 50397549c34SHans Petter Selasky int reserved_mtts; 50497549c34SHans Petter Selasky int reserved_mrws; 50597549c34SHans Petter Selasky int reserved_uars; 50697549c34SHans Petter Selasky int num_mgms; 50797549c34SHans Petter Selasky int num_amgms; 50897549c34SHans Petter Selasky int reserved_mcgs; 50997549c34SHans Petter Selasky int num_qp_per_mgm; 51097549c34SHans Petter Selasky int steering_mode; 51197549c34SHans Petter Selasky int num_pds; 51297549c34SHans Petter Selasky int reserved_pds; 51397549c34SHans Petter Selasky int max_xrcds; 51497549c34SHans Petter Selasky int reserved_xrcds; 51597549c34SHans Petter Selasky int mtt_entry_sz; 51697549c34SHans Petter Selasky u32 max_msg_sz; 51797549c34SHans Petter Selasky u32 page_size_cap; 51897549c34SHans Petter Selasky u64 flags; 51997549c34SHans Petter Selasky u64 flags2; 52097549c34SHans Petter Selasky u32 bmme_flags; 52197549c34SHans Petter Selasky u32 reserved_lkey; 52297549c34SHans Petter Selasky u16 stat_rate_support; 52397549c34SHans Petter Selasky u8 cq_timestamp; 52497549c34SHans Petter Selasky u8 port_width_cap[MLX4_MAX_PORTS + 1]; 52597549c34SHans Petter Selasky int max_gso_sz; 52697549c34SHans Petter Selasky int max_rss_tbl_sz; 52797549c34SHans Petter Selasky int reserved_qps_cnt[MLX4_NUM_QP_REGION]; 52897549c34SHans Petter Selasky int reserved_qps; 52997549c34SHans Petter Selasky int reserved_qps_base[MLX4_NUM_QP_REGION]; 53097549c34SHans Petter Selasky int log_num_macs; 53197549c34SHans Petter Selasky int log_num_vlans; 53297549c34SHans Petter Selasky enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; 53397549c34SHans Petter Selasky u8 supported_type[MLX4_MAX_PORTS + 1]; 53497549c34SHans Petter Selasky u8 suggested_type[MLX4_MAX_PORTS + 1]; 53597549c34SHans Petter Selasky u8 default_sense[MLX4_MAX_PORTS + 1]; 53697549c34SHans Petter Selasky u32 port_mask[MLX4_MAX_PORTS + 1]; 53797549c34SHans Petter Selasky enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; 53897549c34SHans Petter Selasky u32 max_counters; 53997549c34SHans Petter Selasky u8 port_ib_mtu[MLX4_MAX_PORTS + 1]; 54097549c34SHans Petter Selasky u16 sqp_demux; 54197549c34SHans Petter Selasky u32 sync_qp; 54297549c34SHans Petter Selasky u32 cq_flags; 54397549c34SHans Petter Selasky u32 eqe_size; 54497549c34SHans Petter Selasky u32 cqe_size; 54597549c34SHans Petter Selasky u8 eqe_factor; 54697549c34SHans Petter Selasky u32 userspace_caps; /* userspace must be aware to */ 54797549c34SHans Petter Selasky u32 function_caps; /* functions must be aware to */ 54897549c34SHans Petter Selasky u8 fast_drop; 54997549c34SHans Petter Selasky u16 hca_core_clock; 55097549c34SHans Petter Selasky u32 max_basic_counters; 55197549c34SHans Petter Selasky u32 max_extended_counters; 55297549c34SHans Petter Selasky u8 def_counter_index[MLX4_MAX_PORTS + 1]; 553*64968e70SHans Petter Selasky u8 alloc_res_qp_mask; 55497549c34SHans Petter Selasky }; 55597549c34SHans Petter Selasky 55697549c34SHans Petter Selasky struct mlx4_buf_list { 55797549c34SHans Petter Selasky void *buf; 55897549c34SHans Petter Selasky dma_addr_t map; 55997549c34SHans Petter Selasky }; 56097549c34SHans Petter Selasky 56197549c34SHans Petter Selasky struct mlx4_buf { 56297549c34SHans Petter Selasky struct mlx4_buf_list direct; 56397549c34SHans Petter Selasky struct mlx4_buf_list *page_list; 56497549c34SHans Petter Selasky int nbufs; 56597549c34SHans Petter Selasky int npages; 56697549c34SHans Petter Selasky int page_shift; 56797549c34SHans Petter Selasky }; 56897549c34SHans Petter Selasky 56997549c34SHans Petter Selasky struct mlx4_mtt { 57097549c34SHans Petter Selasky u32 offset; 57197549c34SHans Petter Selasky int order; 57297549c34SHans Petter Selasky int page_shift; 57397549c34SHans Petter Selasky }; 57497549c34SHans Petter Selasky 57597549c34SHans Petter Selasky enum { 57697549c34SHans Petter Selasky MLX4_DB_PER_PAGE = PAGE_SIZE / 4 57797549c34SHans Petter Selasky }; 57897549c34SHans Petter Selasky 57997549c34SHans Petter Selasky struct mlx4_db_pgdir { 58097549c34SHans Petter Selasky struct list_head list; 58197549c34SHans Petter Selasky DECLARE_BITMAP(order0, MLX4_DB_PER_PAGE); 58297549c34SHans Petter Selasky DECLARE_BITMAP(order1, MLX4_DB_PER_PAGE / 2); 58397549c34SHans Petter Selasky unsigned long *bits[2]; 58497549c34SHans Petter Selasky __be32 *db_page; 58597549c34SHans Petter Selasky dma_addr_t db_dma; 58697549c34SHans Petter Selasky }; 58797549c34SHans Petter Selasky 58897549c34SHans Petter Selasky struct mlx4_ib_user_db_page; 58997549c34SHans Petter Selasky 59097549c34SHans Petter Selasky struct mlx4_db { 59197549c34SHans Petter Selasky __be32 *db; 59297549c34SHans Petter Selasky union { 59397549c34SHans Petter Selasky struct mlx4_db_pgdir *pgdir; 59497549c34SHans Petter Selasky struct mlx4_ib_user_db_page *user_page; 59597549c34SHans Petter Selasky } u; 59697549c34SHans Petter Selasky dma_addr_t dma; 59797549c34SHans Petter Selasky int index; 59897549c34SHans Petter Selasky int order; 59997549c34SHans Petter Selasky }; 60097549c34SHans Petter Selasky 60197549c34SHans Petter Selasky struct mlx4_hwq_resources { 60297549c34SHans Petter Selasky struct mlx4_db db; 60397549c34SHans Petter Selasky struct mlx4_mtt mtt; 60497549c34SHans Petter Selasky struct mlx4_buf buf; 60597549c34SHans Petter Selasky }; 60697549c34SHans Petter Selasky 60797549c34SHans Petter Selasky struct mlx4_mr { 60897549c34SHans Petter Selasky struct mlx4_mtt mtt; 60997549c34SHans Petter Selasky u64 iova; 61097549c34SHans Petter Selasky u64 size; 61197549c34SHans Petter Selasky u32 key; 61297549c34SHans Petter Selasky u32 pd; 61397549c34SHans Petter Selasky u32 access; 61497549c34SHans Petter Selasky int enabled; 61597549c34SHans Petter Selasky }; 61697549c34SHans Petter Selasky 61797549c34SHans Petter Selasky enum mlx4_mw_type { 61897549c34SHans Petter Selasky MLX4_MW_TYPE_1 = 1, 61997549c34SHans Petter Selasky MLX4_MW_TYPE_2 = 2, 62097549c34SHans Petter Selasky }; 62197549c34SHans Petter Selasky 62297549c34SHans Petter Selasky struct mlx4_mw { 62397549c34SHans Petter Selasky u32 key; 62497549c34SHans Petter Selasky u32 pd; 62597549c34SHans Petter Selasky enum mlx4_mw_type type; 62697549c34SHans Petter Selasky int enabled; 62797549c34SHans Petter Selasky }; 62897549c34SHans Petter Selasky 62997549c34SHans Petter Selasky struct mlx4_fmr { 63097549c34SHans Petter Selasky struct mlx4_mr mr; 63197549c34SHans Petter Selasky struct mlx4_mpt_entry *mpt; 63297549c34SHans Petter Selasky __be64 *mtts; 63397549c34SHans Petter Selasky dma_addr_t dma_handle; 63497549c34SHans Petter Selasky int max_pages; 63597549c34SHans Petter Selasky int max_maps; 63697549c34SHans Petter Selasky int maps; 63797549c34SHans Petter Selasky u8 page_shift; 63897549c34SHans Petter Selasky }; 63997549c34SHans Petter Selasky 64097549c34SHans Petter Selasky struct mlx4_uar { 64197549c34SHans Petter Selasky unsigned long pfn; 64297549c34SHans Petter Selasky int index; 64397549c34SHans Petter Selasky struct list_head bf_list; 64497549c34SHans Petter Selasky unsigned free_bf_bmap; 64597549c34SHans Petter Selasky void __iomem *map; 64697549c34SHans Petter Selasky void __iomem *bf_map; 64797549c34SHans Petter Selasky }; 64897549c34SHans Petter Selasky 64997549c34SHans Petter Selasky struct mlx4_bf { 65097549c34SHans Petter Selasky unsigned long offset; 65197549c34SHans Petter Selasky int buf_size; 65297549c34SHans Petter Selasky struct mlx4_uar *uar; 65397549c34SHans Petter Selasky void __iomem *reg; 65497549c34SHans Petter Selasky }; 65597549c34SHans Petter Selasky 65697549c34SHans Petter Selasky struct mlx4_cq { 65797549c34SHans Petter Selasky void (*comp) (struct mlx4_cq *); 65897549c34SHans Petter Selasky void (*event) (struct mlx4_cq *, enum mlx4_event); 65997549c34SHans Petter Selasky 66097549c34SHans Petter Selasky struct mlx4_uar *uar; 66197549c34SHans Petter Selasky 66297549c34SHans Petter Selasky u32 cons_index; 66397549c34SHans Petter Selasky 66497549c34SHans Petter Selasky __be32 *set_ci_db; 66597549c34SHans Petter Selasky __be32 *arm_db; 66697549c34SHans Petter Selasky int arm_sn; 66797549c34SHans Petter Selasky 66897549c34SHans Petter Selasky int cqn; 66997549c34SHans Petter Selasky unsigned vector; 67097549c34SHans Petter Selasky 67197549c34SHans Petter Selasky atomic_t refcount; 67297549c34SHans Petter Selasky struct completion free; 67397549c34SHans Petter Selasky int eqn; 67497549c34SHans Petter Selasky u16 irq; 67597549c34SHans Petter Selasky }; 67697549c34SHans Petter Selasky 67797549c34SHans Petter Selasky struct mlx4_qp { 67897549c34SHans Petter Selasky void (*event) (struct mlx4_qp *, enum mlx4_event); 67997549c34SHans Petter Selasky 68097549c34SHans Petter Selasky int qpn; 68197549c34SHans Petter Selasky 68297549c34SHans Petter Selasky atomic_t refcount; 68397549c34SHans Petter Selasky struct completion free; 68497549c34SHans Petter Selasky }; 68597549c34SHans Petter Selasky 68697549c34SHans Petter Selasky struct mlx4_srq { 68797549c34SHans Petter Selasky void (*event) (struct mlx4_srq *, enum mlx4_event); 68897549c34SHans Petter Selasky 68997549c34SHans Petter Selasky int srqn; 69097549c34SHans Petter Selasky int max; 69197549c34SHans Petter Selasky int max_gs; 69297549c34SHans Petter Selasky int wqe_shift; 69397549c34SHans Petter Selasky 69497549c34SHans Petter Selasky atomic_t refcount; 69597549c34SHans Petter Selasky struct completion free; 69697549c34SHans Petter Selasky }; 69797549c34SHans Petter Selasky 69897549c34SHans Petter Selasky struct mlx4_av { 69997549c34SHans Petter Selasky __be32 port_pd; 70097549c34SHans Petter Selasky u8 reserved1; 70197549c34SHans Petter Selasky u8 g_slid; 70297549c34SHans Petter Selasky __be16 dlid; 70397549c34SHans Petter Selasky u8 reserved2; 70497549c34SHans Petter Selasky u8 gid_index; 70597549c34SHans Petter Selasky u8 stat_rate; 70697549c34SHans Petter Selasky u8 hop_limit; 70797549c34SHans Petter Selasky __be32 sl_tclass_flowlabel; 70897549c34SHans Petter Selasky u8 dgid[16]; 70997549c34SHans Petter Selasky }; 71097549c34SHans Petter Selasky 71197549c34SHans Petter Selasky struct mlx4_eth_av { 71297549c34SHans Petter Selasky __be32 port_pd; 71397549c34SHans Petter Selasky u8 reserved1; 71497549c34SHans Petter Selasky u8 smac_idx; 71597549c34SHans Petter Selasky u16 reserved2; 71697549c34SHans Petter Selasky u8 reserved3; 71797549c34SHans Petter Selasky u8 gid_index; 71897549c34SHans Petter Selasky u8 stat_rate; 71997549c34SHans Petter Selasky u8 hop_limit; 72097549c34SHans Petter Selasky __be32 sl_tclass_flowlabel; 72197549c34SHans Petter Selasky u8 dgid[16]; 72297549c34SHans Petter Selasky u8 s_mac[6]; 72397549c34SHans Petter Selasky u8 reserved4[2]; 72497549c34SHans Petter Selasky __be16 vlan; 72597549c34SHans Petter Selasky u8 mac[6]; 72697549c34SHans Petter Selasky }; 72797549c34SHans Petter Selasky 72897549c34SHans Petter Selasky union mlx4_ext_av { 72997549c34SHans Petter Selasky struct mlx4_av ib; 73097549c34SHans Petter Selasky struct mlx4_eth_av eth; 73197549c34SHans Petter Selasky }; 73297549c34SHans Petter Selasky 73397549c34SHans Petter Selasky struct mlx4_if_stat_control { 73497549c34SHans Petter Selasky u8 reserved1[3]; 73597549c34SHans Petter Selasky /* Extended counters enabled */ 73697549c34SHans Petter Selasky u8 cnt_mode; 73797549c34SHans Petter Selasky /* Number of interfaces */ 73897549c34SHans Petter Selasky __be32 num_of_if; 73997549c34SHans Petter Selasky __be32 reserved[2]; 74097549c34SHans Petter Selasky }; 74197549c34SHans Petter Selasky 74297549c34SHans Petter Selasky struct mlx4_if_stat_basic { 74397549c34SHans Petter Selasky struct mlx4_if_stat_control control; 74497549c34SHans Petter Selasky struct { 74597549c34SHans Petter Selasky __be64 IfRxFrames; 74697549c34SHans Petter Selasky __be64 IfRxOctets; 74797549c34SHans Petter Selasky __be64 IfTxFrames; 74897549c34SHans Petter Selasky __be64 IfTxOctets; 74997549c34SHans Petter Selasky } counters[]; 75097549c34SHans Petter Selasky }; 75197549c34SHans Petter Selasky #define MLX4_IF_STAT_BSC_SZ(ports)(sizeof(struct mlx4_if_stat_extended) +\ 75297549c34SHans Petter Selasky sizeof(((struct mlx4_if_stat_extended *)0)->\ 75397549c34SHans Petter Selasky counters[0]) * ports) 75497549c34SHans Petter Selasky 75597549c34SHans Petter Selasky struct mlx4_if_stat_extended { 75697549c34SHans Petter Selasky struct mlx4_if_stat_control control; 75797549c34SHans Petter Selasky struct { 75897549c34SHans Petter Selasky __be64 IfRxUnicastFrames; 75997549c34SHans Petter Selasky __be64 IfRxUnicastOctets; 76097549c34SHans Petter Selasky __be64 IfRxMulticastFrames; 76197549c34SHans Petter Selasky __be64 IfRxMulticastOctets; 76297549c34SHans Petter Selasky __be64 IfRxBroadcastFrames; 76397549c34SHans Petter Selasky __be64 IfRxBroadcastOctets; 76497549c34SHans Petter Selasky __be64 IfRxNoBufferFrames; 76597549c34SHans Petter Selasky __be64 IfRxNoBufferOctets; 76697549c34SHans Petter Selasky __be64 IfRxErrorFrames; 76797549c34SHans Petter Selasky __be64 IfRxErrorOctets; 76897549c34SHans Petter Selasky __be32 reserved[39]; 76997549c34SHans Petter Selasky __be64 IfTxUnicastFrames; 77097549c34SHans Petter Selasky __be64 IfTxUnicastOctets; 77197549c34SHans Petter Selasky __be64 IfTxMulticastFrames; 77297549c34SHans Petter Selasky __be64 IfTxMulticastOctets; 77397549c34SHans Petter Selasky __be64 IfTxBroadcastFrames; 77497549c34SHans Petter Selasky __be64 IfTxBroadcastOctets; 77597549c34SHans Petter Selasky __be64 IfTxDroppedFrames; 77697549c34SHans Petter Selasky __be64 IfTxDroppedOctets; 77797549c34SHans Petter Selasky __be64 IfTxRequestedFramesSent; 77897549c34SHans Petter Selasky __be64 IfTxGeneratedFramesSent; 77997549c34SHans Petter Selasky __be64 IfTxTsoOctets; 78097549c34SHans Petter Selasky } __packed counters[]; 78197549c34SHans Petter Selasky }; 78297549c34SHans Petter Selasky #define MLX4_IF_STAT_EXT_SZ(ports) (sizeof(struct mlx4_if_stat_extended) +\ 78397549c34SHans Petter Selasky sizeof(((struct mlx4_if_stat_extended *)\ 78497549c34SHans Petter Selasky 0)->counters[0]) * ports) 78597549c34SHans Petter Selasky 78697549c34SHans Petter Selasky union mlx4_counter { 78797549c34SHans Petter Selasky struct mlx4_if_stat_control control; 78897549c34SHans Petter Selasky struct mlx4_if_stat_basic basic; 78997549c34SHans Petter Selasky struct mlx4_if_stat_extended ext; 79097549c34SHans Petter Selasky }; 79197549c34SHans Petter Selasky #define MLX4_IF_STAT_SZ(ports) MLX4_IF_STAT_EXT_SZ(ports) 79297549c34SHans Petter Selasky 79397549c34SHans Petter Selasky struct mlx4_quotas { 79497549c34SHans Petter Selasky int qp; 79597549c34SHans Petter Selasky int cq; 79697549c34SHans Petter Selasky int srq; 79797549c34SHans Petter Selasky int mpt; 79897549c34SHans Petter Selasky int mtt; 79997549c34SHans Petter Selasky int counter; 80097549c34SHans Petter Selasky int xrcd; 80197549c34SHans Petter Selasky }; 80297549c34SHans Petter Selasky 80397549c34SHans Petter Selasky struct mlx4_dev { 80497549c34SHans Petter Selasky struct pci_dev *pdev; 80597549c34SHans Petter Selasky unsigned long flags; 80697549c34SHans Petter Selasky unsigned long num_slaves; 80797549c34SHans Petter Selasky struct mlx4_caps caps; 80897549c34SHans Petter Selasky struct mlx4_phys_caps phys_caps; 80997549c34SHans Petter Selasky struct mlx4_quotas quotas; 81097549c34SHans Petter Selasky struct radix_tree_root qp_table_tree; 81197549c34SHans Petter Selasky u8 rev_id; 81297549c34SHans Petter Selasky char board_id[MLX4_BOARD_ID_LEN]; 81397549c34SHans Petter Selasky u16 vsd_vendor_id; 81497549c34SHans Petter Selasky char vsd[MLX4_VSD_LEN]; 81597549c34SHans Petter Selasky int num_vfs; 81697549c34SHans Petter Selasky int numa_node; 81797549c34SHans Petter Selasky int oper_log_mgm_entry_size; 81897549c34SHans Petter Selasky u64 regid_promisc_array[MLX4_MAX_PORTS + 1]; 81997549c34SHans Petter Selasky u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; 82097549c34SHans Petter Selasky }; 82197549c34SHans Petter Selasky 82297549c34SHans Petter Selasky struct mlx4_clock_params { 82397549c34SHans Petter Selasky u64 offset; 82497549c34SHans Petter Selasky u8 bar; 82597549c34SHans Petter Selasky u8 size; 82697549c34SHans Petter Selasky }; 82797549c34SHans Petter Selasky 82897549c34SHans Petter Selasky struct mlx4_eqe { 82997549c34SHans Petter Selasky u8 reserved1; 83097549c34SHans Petter Selasky u8 type; 83197549c34SHans Petter Selasky u8 reserved2; 83297549c34SHans Petter Selasky u8 subtype; 83397549c34SHans Petter Selasky union { 83497549c34SHans Petter Selasky u32 raw[6]; 83597549c34SHans Petter Selasky struct { 83697549c34SHans Petter Selasky __be32 cqn; 83797549c34SHans Petter Selasky } __packed comp; 83897549c34SHans Petter Selasky struct { 83997549c34SHans Petter Selasky u16 reserved1; 84097549c34SHans Petter Selasky __be16 token; 84197549c34SHans Petter Selasky u32 reserved2; 84297549c34SHans Petter Selasky u8 reserved3[3]; 84397549c34SHans Petter Selasky u8 status; 84497549c34SHans Petter Selasky __be64 out_param; 84597549c34SHans Petter Selasky } __packed cmd; 84697549c34SHans Petter Selasky struct { 84797549c34SHans Petter Selasky __be32 qpn; 84897549c34SHans Petter Selasky } __packed qp; 84997549c34SHans Petter Selasky struct { 85097549c34SHans Petter Selasky __be32 srqn; 85197549c34SHans Petter Selasky } __packed srq; 85297549c34SHans Petter Selasky struct { 85397549c34SHans Petter Selasky __be32 cqn; 85497549c34SHans Petter Selasky u32 reserved1; 85597549c34SHans Petter Selasky u8 reserved2[3]; 85697549c34SHans Petter Selasky u8 syndrome; 85797549c34SHans Petter Selasky } __packed cq_err; 85897549c34SHans Petter Selasky struct { 85997549c34SHans Petter Selasky u32 reserved1[2]; 86097549c34SHans Petter Selasky __be32 port; 86197549c34SHans Petter Selasky } __packed port_change; 86297549c34SHans Petter Selasky struct { 86397549c34SHans Petter Selasky #define COMM_CHANNEL_BIT_ARRAY_SIZE 4 86497549c34SHans Petter Selasky u32 reserved; 86597549c34SHans Petter Selasky u32 bit_vec[COMM_CHANNEL_BIT_ARRAY_SIZE]; 86697549c34SHans Petter Selasky } __packed comm_channel_arm; 86797549c34SHans Petter Selasky struct { 86897549c34SHans Petter Selasky u8 port; 86997549c34SHans Petter Selasky u8 reserved[3]; 87097549c34SHans Petter Selasky __be64 mac; 87197549c34SHans Petter Selasky } __packed mac_update; 87297549c34SHans Petter Selasky struct { 87397549c34SHans Petter Selasky __be32 slave_id; 87497549c34SHans Petter Selasky } __packed flr_event; 87597549c34SHans Petter Selasky struct { 87697549c34SHans Petter Selasky __be16 current_temperature; 87797549c34SHans Petter Selasky __be16 warning_threshold; 87897549c34SHans Petter Selasky } __packed warming; 87997549c34SHans Petter Selasky struct { 88097549c34SHans Petter Selasky u8 reserved[3]; 88197549c34SHans Petter Selasky u8 port; 88297549c34SHans Petter Selasky union { 88397549c34SHans Petter Selasky struct { 88497549c34SHans Petter Selasky __be16 mstr_sm_lid; 88597549c34SHans Petter Selasky __be16 port_lid; 88697549c34SHans Petter Selasky __be32 changed_attr; 88797549c34SHans Petter Selasky u8 reserved[3]; 88897549c34SHans Petter Selasky u8 mstr_sm_sl; 88997549c34SHans Petter Selasky __be64 gid_prefix; 89097549c34SHans Petter Selasky } __packed port_info; 89197549c34SHans Petter Selasky struct { 89297549c34SHans Petter Selasky __be32 block_ptr; 89397549c34SHans Petter Selasky __be32 tbl_entries_mask; 89497549c34SHans Petter Selasky } __packed tbl_change_info; 89597549c34SHans Petter Selasky } params; 89697549c34SHans Petter Selasky } __packed port_mgmt_change; 89797549c34SHans Petter Selasky struct { 89897549c34SHans Petter Selasky u8 reserved[3]; 89997549c34SHans Petter Selasky u8 port; 90097549c34SHans Petter Selasky u32 reserved1[5]; 90197549c34SHans Petter Selasky } __packed bad_cable; 90297549c34SHans Petter Selasky } event; 90397549c34SHans Petter Selasky u8 slave_id; 90497549c34SHans Petter Selasky u8 reserved3[2]; 90597549c34SHans Petter Selasky u8 owner; 90697549c34SHans Petter Selasky } __packed; 90797549c34SHans Petter Selasky 90897549c34SHans Petter Selasky struct mlx4_init_port_param { 90997549c34SHans Petter Selasky int set_guid0; 91097549c34SHans Petter Selasky int set_node_guid; 91197549c34SHans Petter Selasky int set_si_guid; 91297549c34SHans Petter Selasky u16 mtu; 91397549c34SHans Petter Selasky int port_width_cap; 91497549c34SHans Petter Selasky u16 vl_cap; 91597549c34SHans Petter Selasky u16 max_gid; 91697549c34SHans Petter Selasky u16 max_pkey; 91797549c34SHans Petter Selasky u64 guid0; 91897549c34SHans Petter Selasky u64 node_guid; 91997549c34SHans Petter Selasky u64 si_guid; 92097549c34SHans Petter Selasky }; 92197549c34SHans Petter Selasky 92297549c34SHans Petter Selasky #define MAD_IFC_DATA_SZ 192 92397549c34SHans Petter Selasky /* MAD IFC Mailbox */ 92497549c34SHans Petter Selasky struct mlx4_mad_ifc { 92597549c34SHans Petter Selasky u8 base_version; 92697549c34SHans Petter Selasky u8 mgmt_class; 92797549c34SHans Petter Selasky u8 class_version; 92897549c34SHans Petter Selasky u8 method; 92997549c34SHans Petter Selasky __be16 status; 93097549c34SHans Petter Selasky __be16 class_specific; 93197549c34SHans Petter Selasky __be64 tid; 93297549c34SHans Petter Selasky __be16 attr_id; 93397549c34SHans Petter Selasky __be16 resv; 93497549c34SHans Petter Selasky __be32 attr_mod; 93597549c34SHans Petter Selasky __be64 mkey; 93697549c34SHans Petter Selasky __be16 dr_slid; 93797549c34SHans Petter Selasky __be16 dr_dlid; 93897549c34SHans Petter Selasky u8 reserved[28]; 93997549c34SHans Petter Selasky u8 data[MAD_IFC_DATA_SZ]; 94097549c34SHans Petter Selasky } __packed; 94197549c34SHans Petter Selasky 94297549c34SHans Petter Selasky #define mlx4_foreach_port(port, dev, type) \ 94397549c34SHans Petter Selasky for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 94497549c34SHans Petter Selasky if ((type) == (dev)->caps.port_mask[(port)]) 94597549c34SHans Petter Selasky 94697549c34SHans Petter Selasky #define mlx4_foreach_non_ib_transport_port(port, dev) \ 94797549c34SHans Petter Selasky for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 94897549c34SHans Petter Selasky if (((dev)->caps.port_mask[port] != MLX4_PORT_TYPE_IB)) 94997549c34SHans Petter Selasky 95097549c34SHans Petter Selasky #define mlx4_foreach_ib_transport_port(port, dev) \ 95197549c34SHans Petter Selasky for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 95297549c34SHans Petter Selasky if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \ 95397549c34SHans Petter Selasky ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE)) 95497549c34SHans Petter Selasky 95597549c34SHans Petter Selasky #define MLX4_INVALID_SLAVE_ID 0xFF 95697549c34SHans Petter Selasky 95797549c34SHans Petter Selasky #define MLX4_SINK_COUNTER_INDEX 0xff 95897549c34SHans Petter Selasky 95997549c34SHans Petter Selasky void handle_port_mgmt_change_event(struct work_struct *work); 96097549c34SHans Petter Selasky 96197549c34SHans Petter Selasky static inline int mlx4_master_func_num(struct mlx4_dev *dev) 96297549c34SHans Petter Selasky { 96397549c34SHans Petter Selasky return dev->caps.function; 96497549c34SHans Petter Selasky } 96597549c34SHans Petter Selasky 96697549c34SHans Petter Selasky static inline int mlx4_is_master(struct mlx4_dev *dev) 96797549c34SHans Petter Selasky { 96897549c34SHans Petter Selasky return dev->flags & MLX4_FLAG_MASTER; 96997549c34SHans Petter Selasky } 97097549c34SHans Petter Selasky 97197549c34SHans Petter Selasky static inline int mlx4_num_reserved_sqps(struct mlx4_dev *dev) 97297549c34SHans Petter Selasky { 97397549c34SHans Petter Selasky return dev->phys_caps.base_sqpn + 8 + 97497549c34SHans Petter Selasky 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev); 97597549c34SHans Petter Selasky } 97697549c34SHans Petter Selasky 97797549c34SHans Petter Selasky static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn) 97897549c34SHans Petter Selasky { 97997549c34SHans Petter Selasky return (qpn < dev->phys_caps.base_sqpn + 8 + 98097549c34SHans Petter Selasky 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev)); 98197549c34SHans Petter Selasky } 98297549c34SHans Petter Selasky 98397549c34SHans Petter Selasky static inline int mlx4_is_guest_proxy(struct mlx4_dev *dev, int slave, u32 qpn) 98497549c34SHans Petter Selasky { 98597549c34SHans Petter Selasky int guest_proxy_base = dev->phys_caps.base_proxy_sqpn + slave * 8; 98697549c34SHans Petter Selasky 98797549c34SHans Petter Selasky if (qpn >= guest_proxy_base && qpn < guest_proxy_base + 8) 98897549c34SHans Petter Selasky return 1; 98997549c34SHans Petter Selasky 99097549c34SHans Petter Selasky return 0; 99197549c34SHans Petter Selasky } 99297549c34SHans Petter Selasky 99397549c34SHans Petter Selasky static inline int mlx4_is_mfunc(struct mlx4_dev *dev) 99497549c34SHans Petter Selasky { 99597549c34SHans Petter Selasky return dev->flags & (MLX4_FLAG_SLAVE | MLX4_FLAG_MASTER); 99697549c34SHans Petter Selasky } 99797549c34SHans Petter Selasky 99897549c34SHans Petter Selasky static inline int mlx4_is_slave(struct mlx4_dev *dev) 99997549c34SHans Petter Selasky { 100097549c34SHans Petter Selasky return dev->flags & MLX4_FLAG_SLAVE; 100197549c34SHans Petter Selasky } 100297549c34SHans Petter Selasky 100397549c34SHans Petter Selasky int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 100497549c34SHans Petter Selasky struct mlx4_buf *buf); 100597549c34SHans Petter Selasky void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); 100697549c34SHans Petter Selasky static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset) 100797549c34SHans Petter Selasky { 100897549c34SHans Petter Selasky if (BITS_PER_LONG == 64 || buf->nbufs == 1) 100997549c34SHans Petter Selasky return (u8 *)buf->direct.buf + offset; 101097549c34SHans Petter Selasky else 101197549c34SHans Petter Selasky return (u8 *)buf->page_list[offset >> PAGE_SHIFT].buf + 101297549c34SHans Petter Selasky (offset & (PAGE_SIZE - 1)); 101397549c34SHans Petter Selasky } 101497549c34SHans Petter Selasky 101597549c34SHans Petter Selasky int mlx4_pd_alloc(struct mlx4_dev *dev, u32 *pdn); 101697549c34SHans Petter Selasky void mlx4_pd_free(struct mlx4_dev *dev, u32 pdn); 101797549c34SHans Petter Selasky int mlx4_xrcd_alloc(struct mlx4_dev *dev, u32 *xrcdn); 101897549c34SHans Petter Selasky void mlx4_xrcd_free(struct mlx4_dev *dev, u32 xrcdn); 101997549c34SHans Petter Selasky 102097549c34SHans Petter Selasky int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar); 102197549c34SHans Petter Selasky void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar); 102297549c34SHans Petter Selasky int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf *bf, int node); 102397549c34SHans Petter Selasky void mlx4_bf_free(struct mlx4_dev *dev, struct mlx4_bf *bf); 102497549c34SHans Petter Selasky 102597549c34SHans Petter Selasky int mlx4_mtt_init(struct mlx4_dev *dev, int npages, int page_shift, 102697549c34SHans Petter Selasky struct mlx4_mtt *mtt); 102797549c34SHans Petter Selasky void mlx4_mtt_cleanup(struct mlx4_dev *dev, struct mlx4_mtt *mtt); 102897549c34SHans Petter Selasky u64 mlx4_mtt_addr(struct mlx4_dev *dev, struct mlx4_mtt *mtt); 102997549c34SHans Petter Selasky 103097549c34SHans Petter Selasky int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access, 103197549c34SHans Petter Selasky int npages, int page_shift, struct mlx4_mr *mr); 103297549c34SHans Petter Selasky int mlx4_mr_free(struct mlx4_dev *dev, struct mlx4_mr *mr); 103397549c34SHans Petter Selasky int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr); 103497549c34SHans Petter Selasky int mlx4_mw_alloc(struct mlx4_dev *dev, u32 pd, enum mlx4_mw_type type, 103597549c34SHans Petter Selasky struct mlx4_mw *mw); 103697549c34SHans Petter Selasky void mlx4_mw_free(struct mlx4_dev *dev, struct mlx4_mw *mw); 103797549c34SHans Petter Selasky int mlx4_mw_enable(struct mlx4_dev *dev, struct mlx4_mw *mw); 103897549c34SHans Petter Selasky int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 103997549c34SHans Petter Selasky int start_index, int npages, u64 *page_list); 104097549c34SHans Petter Selasky int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 104197549c34SHans Petter Selasky struct mlx4_buf *buf); 104297549c34SHans Petter Selasky 104397549c34SHans Petter Selasky int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order); 104497549c34SHans Petter Selasky void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db); 104597549c34SHans Petter Selasky 104697549c34SHans Petter Selasky int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres, 104797549c34SHans Petter Selasky int size, int max_direct); 104897549c34SHans Petter Selasky void mlx4_free_hwq_res(struct mlx4_dev *mdev, struct mlx4_hwq_resources *wqres, 104997549c34SHans Petter Selasky int size); 105097549c34SHans Petter Selasky 105197549c34SHans Petter Selasky int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, 105297549c34SHans Petter Selasky struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, 105397549c34SHans Petter Selasky unsigned vector, int collapsed, int timestamp_en); 105497549c34SHans Petter Selasky void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); 105597549c34SHans Petter Selasky 105697549c34SHans Petter Selasky int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, 105797549c34SHans Petter Selasky int *base, u8 flags); 105897549c34SHans Petter Selasky void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt); 105997549c34SHans Petter Selasky 106097549c34SHans Petter Selasky int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp); 106197549c34SHans Petter Selasky void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); 106297549c34SHans Petter Selasky 106397549c34SHans Petter Selasky int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcdn, 106497549c34SHans Petter Selasky struct mlx4_mtt *mtt, u64 db_rec, struct mlx4_srq *srq); 106597549c34SHans Petter Selasky void mlx4_srq_free(struct mlx4_dev *dev, struct mlx4_srq *srq); 106697549c34SHans Petter Selasky int mlx4_srq_arm(struct mlx4_dev *dev, struct mlx4_srq *srq, int limit_watermark); 106797549c34SHans Petter Selasky int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_watermark); 106897549c34SHans Petter Selasky 106997549c34SHans Petter Selasky int mlx4_INIT_PORT(struct mlx4_dev *dev, int port); 107097549c34SHans Petter Selasky int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); 107197549c34SHans Petter Selasky 107297549c34SHans Petter Selasky int mlx4_unicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 107397549c34SHans Petter Selasky int block_mcast_loopback, enum mlx4_protocol prot); 107497549c34SHans Petter Selasky int mlx4_unicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 107597549c34SHans Petter Selasky enum mlx4_protocol prot); 107697549c34SHans Petter Selasky int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 107797549c34SHans Petter Selasky u8 port, int block_mcast_loopback, 107897549c34SHans Petter Selasky enum mlx4_protocol protocol, u64 *reg_id); 107997549c34SHans Petter Selasky int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 108097549c34SHans Petter Selasky enum mlx4_protocol protocol, u64 reg_id); 108197549c34SHans Petter Selasky 108297549c34SHans Petter Selasky enum { 108397549c34SHans Petter Selasky MLX4_DOMAIN_UVERBS = 0x1000, 108497549c34SHans Petter Selasky MLX4_DOMAIN_ETHTOOL = 0x2000, 108597549c34SHans Petter Selasky MLX4_DOMAIN_RFS = 0x3000, 108697549c34SHans Petter Selasky MLX4_DOMAIN_NIC = 0x5000, 108797549c34SHans Petter Selasky }; 108897549c34SHans Petter Selasky 108997549c34SHans Petter Selasky enum mlx4_net_trans_rule_id { 109097549c34SHans Petter Selasky MLX4_NET_TRANS_RULE_ID_ETH = 0, 109197549c34SHans Petter Selasky MLX4_NET_TRANS_RULE_ID_IB, 109297549c34SHans Petter Selasky MLX4_NET_TRANS_RULE_ID_IPV6, 109397549c34SHans Petter Selasky MLX4_NET_TRANS_RULE_ID_IPV4, 109497549c34SHans Petter Selasky MLX4_NET_TRANS_RULE_ID_TCP, 109597549c34SHans Petter Selasky MLX4_NET_TRANS_RULE_ID_UDP, 109697549c34SHans Petter Selasky MLX4_NET_TRANS_RULE_NUM, /* should be last */ 109797549c34SHans Petter Selasky MLX4_NET_TRANS_RULE_DUMMY = -1, /* force enum to be signed */ 109897549c34SHans Petter Selasky }; 109997549c34SHans Petter Selasky 110097549c34SHans Petter Selasky extern const u16 __sw_id_hw[]; 110197549c34SHans Petter Selasky 110297549c34SHans Petter Selasky static inline int map_hw_to_sw_id(u16 header_id) 110397549c34SHans Petter Selasky { 110497549c34SHans Petter Selasky 110597549c34SHans Petter Selasky int i; 110697549c34SHans Petter Selasky for (i = 0; i < MLX4_NET_TRANS_RULE_NUM; i++) { 110797549c34SHans Petter Selasky if (header_id == __sw_id_hw[i]) 110897549c34SHans Petter Selasky return i; 110997549c34SHans Petter Selasky } 111097549c34SHans Petter Selasky return -EINVAL; 111197549c34SHans Petter Selasky } 111297549c34SHans Petter Selasky 111397549c34SHans Petter Selasky enum mlx4_net_trans_promisc_mode { 111497549c34SHans Petter Selasky MLX4_FS_REGULAR = 1, 111597549c34SHans Petter Selasky MLX4_FS_ALL_DEFAULT, 111697549c34SHans Petter Selasky MLX4_FS_MC_DEFAULT, 111797549c34SHans Petter Selasky MLX4_FS_UC_SNIFFER, 111897549c34SHans Petter Selasky MLX4_FS_MC_SNIFFER, 111997549c34SHans Petter Selasky MLX4_FS_MODE_NUM, /* should be last */ 112097549c34SHans Petter Selasky MLX4_FS_MODE_DUMMY = -1, /* force enum to be signed */ 112197549c34SHans Petter Selasky }; 112297549c34SHans Petter Selasky 112397549c34SHans Petter Selasky struct mlx4_spec_eth { 112497549c34SHans Petter Selasky u8 dst_mac[6]; 112597549c34SHans Petter Selasky u8 dst_mac_msk[6]; 112697549c34SHans Petter Selasky u8 src_mac[6]; 112797549c34SHans Petter Selasky u8 src_mac_msk[6]; 112897549c34SHans Petter Selasky u8 ether_type_enable; 112997549c34SHans Petter Selasky __be16 ether_type; 113097549c34SHans Petter Selasky __be16 vlan_id_msk; 113197549c34SHans Petter Selasky __be16 vlan_id; 113297549c34SHans Petter Selasky }; 113397549c34SHans Petter Selasky 113497549c34SHans Petter Selasky struct mlx4_spec_tcp_udp { 113597549c34SHans Petter Selasky __be16 dst_port; 113697549c34SHans Petter Selasky __be16 dst_port_msk; 113797549c34SHans Petter Selasky __be16 src_port; 113897549c34SHans Petter Selasky __be16 src_port_msk; 113997549c34SHans Petter Selasky }; 114097549c34SHans Petter Selasky 114197549c34SHans Petter Selasky struct mlx4_spec_ipv4 { 114297549c34SHans Petter Selasky __be32 dst_ip; 114397549c34SHans Petter Selasky __be32 dst_ip_msk; 114497549c34SHans Petter Selasky __be32 src_ip; 114597549c34SHans Petter Selasky __be32 src_ip_msk; 114697549c34SHans Petter Selasky }; 114797549c34SHans Petter Selasky 114897549c34SHans Petter Selasky struct mlx4_spec_ib { 114997549c34SHans Petter Selasky __be32 l3_qpn; 115097549c34SHans Petter Selasky __be32 qpn_msk; 115197549c34SHans Petter Selasky u8 dst_gid[16]; 115297549c34SHans Petter Selasky u8 dst_gid_msk[16]; 115397549c34SHans Petter Selasky }; 115497549c34SHans Petter Selasky 115597549c34SHans Petter Selasky struct mlx4_spec_list { 115697549c34SHans Petter Selasky struct list_head list; 115797549c34SHans Petter Selasky enum mlx4_net_trans_rule_id id; 115897549c34SHans Petter Selasky union { 115997549c34SHans Petter Selasky struct mlx4_spec_eth eth; 116097549c34SHans Petter Selasky struct mlx4_spec_ib ib; 116197549c34SHans Petter Selasky struct mlx4_spec_ipv4 ipv4; 116297549c34SHans Petter Selasky struct mlx4_spec_tcp_udp tcp_udp; 116397549c34SHans Petter Selasky }; 116497549c34SHans Petter Selasky }; 116597549c34SHans Petter Selasky 116697549c34SHans Petter Selasky enum mlx4_net_trans_hw_rule_queue { 116797549c34SHans Petter Selasky MLX4_NET_TRANS_Q_FIFO, 116897549c34SHans Petter Selasky MLX4_NET_TRANS_Q_LIFO, 116997549c34SHans Petter Selasky }; 117097549c34SHans Petter Selasky 117197549c34SHans Petter Selasky struct mlx4_net_trans_rule { 117297549c34SHans Petter Selasky struct list_head list; 117397549c34SHans Petter Selasky enum mlx4_net_trans_hw_rule_queue queue_mode; 117497549c34SHans Petter Selasky bool exclusive; 117597549c34SHans Petter Selasky bool allow_loopback; 117697549c34SHans Petter Selasky enum mlx4_net_trans_promisc_mode promisc_mode; 117797549c34SHans Petter Selasky u8 port; 117897549c34SHans Petter Selasky u16 priority; 117997549c34SHans Petter Selasky u32 qpn; 118097549c34SHans Petter Selasky }; 118197549c34SHans Petter Selasky 118297549c34SHans Petter Selasky struct mlx4_net_trans_rule_hw_ctrl { 118397549c34SHans Petter Selasky __be16 prio; 118497549c34SHans Petter Selasky u8 type; 118597549c34SHans Petter Selasky u8 flags; 118697549c34SHans Petter Selasky u8 rsvd1; 118797549c34SHans Petter Selasky u8 funcid; 118897549c34SHans Petter Selasky u8 vep; 118997549c34SHans Petter Selasky u8 port; 119097549c34SHans Petter Selasky __be32 qpn; 119197549c34SHans Petter Selasky __be32 rsvd2; 119297549c34SHans Petter Selasky }; 119397549c34SHans Petter Selasky 119497549c34SHans Petter Selasky struct mlx4_net_trans_rule_hw_ib { 119597549c34SHans Petter Selasky u8 size; 119697549c34SHans Petter Selasky u8 rsvd1; 119797549c34SHans Petter Selasky __be16 id; 119897549c34SHans Petter Selasky u32 rsvd2; 119997549c34SHans Petter Selasky __be32 l3_qpn; 120097549c34SHans Petter Selasky __be32 qpn_mask; 120197549c34SHans Petter Selasky u8 dst_gid[16]; 120297549c34SHans Petter Selasky u8 dst_gid_msk[16]; 120397549c34SHans Petter Selasky } __packed; 120497549c34SHans Petter Selasky 120597549c34SHans Petter Selasky struct mlx4_net_trans_rule_hw_eth { 120697549c34SHans Petter Selasky u8 size; 120797549c34SHans Petter Selasky u8 rsvd; 120897549c34SHans Petter Selasky __be16 id; 120997549c34SHans Petter Selasky u8 rsvd1[6]; 121097549c34SHans Petter Selasky u8 dst_mac[6]; 121197549c34SHans Petter Selasky u16 rsvd2; 121297549c34SHans Petter Selasky u8 dst_mac_msk[6]; 121397549c34SHans Petter Selasky u16 rsvd3; 121497549c34SHans Petter Selasky u8 src_mac[6]; 121597549c34SHans Petter Selasky u16 rsvd4; 121697549c34SHans Petter Selasky u8 src_mac_msk[6]; 121797549c34SHans Petter Selasky u8 rsvd5; 121897549c34SHans Petter Selasky u8 ether_type_enable; 121997549c34SHans Petter Selasky __be16 ether_type; 122097549c34SHans Petter Selasky __be16 vlan_tag_msk; 122197549c34SHans Petter Selasky __be16 vlan_tag; 122297549c34SHans Petter Selasky } __packed; 122397549c34SHans Petter Selasky 122497549c34SHans Petter Selasky struct mlx4_net_trans_rule_hw_tcp_udp { 122597549c34SHans Petter Selasky u8 size; 122697549c34SHans Petter Selasky u8 rsvd; 122797549c34SHans Petter Selasky __be16 id; 122897549c34SHans Petter Selasky __be16 rsvd1[3]; 122997549c34SHans Petter Selasky __be16 dst_port; 123097549c34SHans Petter Selasky __be16 rsvd2; 123197549c34SHans Petter Selasky __be16 dst_port_msk; 123297549c34SHans Petter Selasky __be16 rsvd3; 123397549c34SHans Petter Selasky __be16 src_port; 123497549c34SHans Petter Selasky __be16 rsvd4; 123597549c34SHans Petter Selasky __be16 src_port_msk; 123697549c34SHans Petter Selasky } __packed; 123797549c34SHans Petter Selasky 123897549c34SHans Petter Selasky struct mlx4_net_trans_rule_hw_ipv4 { 123997549c34SHans Petter Selasky u8 size; 124097549c34SHans Petter Selasky u8 rsvd; 124197549c34SHans Petter Selasky __be16 id; 124297549c34SHans Petter Selasky __be32 rsvd1; 124397549c34SHans Petter Selasky __be32 dst_ip; 124497549c34SHans Petter Selasky __be32 dst_ip_msk; 124597549c34SHans Petter Selasky __be32 src_ip; 124697549c34SHans Petter Selasky __be32 src_ip_msk; 124797549c34SHans Petter Selasky } __packed; 124897549c34SHans Petter Selasky 124997549c34SHans Petter Selasky struct _rule_hw { 125097549c34SHans Petter Selasky union { 125197549c34SHans Petter Selasky struct { 125297549c34SHans Petter Selasky u8 size; 125397549c34SHans Petter Selasky u8 rsvd; 125497549c34SHans Petter Selasky __be16 id; 125597549c34SHans Petter Selasky }; 125697549c34SHans Petter Selasky struct mlx4_net_trans_rule_hw_eth eth; 125797549c34SHans Petter Selasky struct mlx4_net_trans_rule_hw_ib ib; 125897549c34SHans Petter Selasky struct mlx4_net_trans_rule_hw_ipv4 ipv4; 125997549c34SHans Petter Selasky struct mlx4_net_trans_rule_hw_tcp_udp tcp_udp; 126097549c34SHans Petter Selasky }; 126197549c34SHans Petter Selasky }; 126297549c34SHans Petter Selasky 126397549c34SHans Petter Selasky int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, u32 qpn, 126497549c34SHans Petter Selasky enum mlx4_net_trans_promisc_mode mode); 126597549c34SHans Petter Selasky int mlx4_flow_steer_promisc_remove(struct mlx4_dev *dev, u8 port, 126697549c34SHans Petter Selasky enum mlx4_net_trans_promisc_mode mode); 126797549c34SHans Petter Selasky int mlx4_multicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port); 126897549c34SHans Petter Selasky int mlx4_multicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); 126997549c34SHans Petter Selasky int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port); 127097549c34SHans Petter Selasky int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); 127197549c34SHans Petter Selasky 127297549c34SHans Petter Selasky int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac); 127397549c34SHans Petter Selasky void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); 127497549c34SHans Petter Selasky int mlx4_get_base_qpn(struct mlx4_dev *dev, u8 port); 127597549c34SHans Petter Selasky int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); 127697549c34SHans Petter Selasky void mlx4_set_stats_bitmap(struct mlx4_dev *dev, unsigned long *stats_bitmap); 127797549c34SHans Petter Selasky int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, 127897549c34SHans Petter Selasky u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); 127997549c34SHans Petter Selasky int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, 128097549c34SHans Petter Selasky u8 promisc); 128197549c34SHans Petter Selasky int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc); 128297549c34SHans Petter Selasky int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw, 128397549c34SHans Petter Selasky u8 *pg, u16 *ratelimit); 128497549c34SHans Petter Selasky int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 128597549c34SHans Petter Selasky int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 128697549c34SHans Petter Selasky void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, u16 vlan); 128797549c34SHans Petter Selasky 128897549c34SHans Petter Selasky int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list, 128997549c34SHans Petter Selasky int npages, u64 iova, u32 *lkey, u32 *rkey); 129097549c34SHans Petter Selasky int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages, 129197549c34SHans Petter Selasky int max_maps, u8 page_shift, struct mlx4_fmr *fmr); 129297549c34SHans Petter Selasky int mlx4_fmr_enable(struct mlx4_dev *dev, struct mlx4_fmr *fmr); 129397549c34SHans Petter Selasky void mlx4_fmr_unmap(struct mlx4_dev *dev, struct mlx4_fmr *fmr, 129497549c34SHans Petter Selasky u32 *lkey, u32 *rkey); 129597549c34SHans Petter Selasky int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr); 129697549c34SHans Petter Selasky int mlx4_SYNC_TPT(struct mlx4_dev *dev); 129797549c34SHans Petter Selasky int mlx4_query_diag_counters(struct mlx4_dev *mlx4_dev, int array_length, 129897549c34SHans Petter Selasky u8 op_modifier, u32 in_offset[], 129997549c34SHans Petter Selasky u32 counter_out[]); 130097549c34SHans Petter Selasky 130197549c34SHans Petter Selasky int mlx4_test_interrupts(struct mlx4_dev *dev); 130297549c34SHans Petter Selasky int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector); 130397549c34SHans Petter Selasky void mlx4_release_eq(struct mlx4_dev *dev, int vec); 130497549c34SHans Petter Selasky 130597549c34SHans Petter Selasky int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port); 130697549c34SHans Petter Selasky int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port); 130797549c34SHans Petter Selasky 130897549c34SHans Petter Selasky int mlx4_counter_alloc(struct mlx4_dev *dev, u8 port, u32 *idx); 130997549c34SHans Petter Selasky void mlx4_counter_free(struct mlx4_dev *dev, u8 port, u32 idx); 131097549c34SHans Petter Selasky 131197549c34SHans Petter Selasky int mlx4_flow_attach(struct mlx4_dev *dev, 131297549c34SHans Petter Selasky struct mlx4_net_trans_rule *rule, u64 *reg_id); 131397549c34SHans Petter Selasky int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id); 131497549c34SHans Petter Selasky int map_sw_to_hw_steering_mode(struct mlx4_dev *dev, 131597549c34SHans Petter Selasky enum mlx4_net_trans_promisc_mode flow_type); 131697549c34SHans Petter Selasky int map_sw_to_hw_steering_id(struct mlx4_dev *dev, 131797549c34SHans Petter Selasky enum mlx4_net_trans_rule_id id); 131897549c34SHans Petter Selasky int hw_rule_sz(struct mlx4_dev *dev, enum mlx4_net_trans_rule_id id); 131997549c34SHans Petter Selasky 132097549c34SHans Petter Selasky void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port, 132197549c34SHans Petter Selasky int i, int val); 132297549c34SHans Petter Selasky 132397549c34SHans Petter Selasky int mlx4_get_parav_qkey(struct mlx4_dev *dev, u32 qpn, u32 *qkey); 132497549c34SHans Petter Selasky 132597549c34SHans Petter Selasky int mlx4_is_slave_active(struct mlx4_dev *dev, int slave); 132697549c34SHans Petter Selasky int mlx4_gen_pkey_eqe(struct mlx4_dev *dev, int slave, u8 port); 132797549c34SHans Petter Selasky int mlx4_gen_guid_change_eqe(struct mlx4_dev *dev, int slave, u8 port); 132897549c34SHans Petter Selasky int mlx4_gen_slaves_port_mgt_ev(struct mlx4_dev *dev, u8 port, int attr, u16 lid, u8 sl); 132997549c34SHans Petter Selasky int mlx4_gen_port_state_change_eqe(struct mlx4_dev *dev, int slave, u8 port, u8 port_subtype_change); 133097549c34SHans Petter Selasky enum slave_port_state mlx4_get_slave_port_state(struct mlx4_dev *dev, int slave, u8 port); 133197549c34SHans Petter Selasky int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, u8 port, int event, enum slave_port_gen_event *gen_event); 133297549c34SHans Petter Selasky 133397549c34SHans Petter Selasky void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid); 133497549c34SHans Petter Selasky __be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); 133597549c34SHans Petter Selasky int mlx4_get_slave_from_roce_gid(struct mlx4_dev *dev, int port, u8 *gid, int *slave_id); 133697549c34SHans Petter Selasky int mlx4_get_roce_gid_from_slave(struct mlx4_dev *dev, int port, int slave_id, u8 *gid); 133797549c34SHans Petter Selasky 133897549c34SHans Petter Selasky int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, u32 max_range_qpn); 133997549c34SHans Petter Selasky 134097549c34SHans Petter Selasky int mlx4_read_clock(struct mlx4_dev *dev); 134197549c34SHans Petter Selasky int mlx4_get_internal_clock_params(struct mlx4_dev *dev, 134297549c34SHans Petter Selasky struct mlx4_clock_params *params); 134397549c34SHans Petter Selasky 134497549c34SHans Petter Selasky int mlx4_get_module_info(struct mlx4_dev *dev, u8 port, 134597549c34SHans Petter Selasky u16 offset, u16 size, u8 *data); 134697549c34SHans Petter Selasky 134797549c34SHans Petter Selasky #endif /* MLX4_DEVICE_H */ 1348