diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
| commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
| tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/mlx4 | |
| parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) | |
Patched in Tegra support.
Diffstat (limited to 'include/linux/mlx4')
| -rw-r--r-- | include/linux/mlx4/cmd.h | 59 | ||||
| -rw-r--r-- | include/linux/mlx4/device.h | 474 | ||||
| -rw-r--r-- | include/linux/mlx4/driver.h | 8 | ||||
| -rw-r--r-- | include/linux/mlx4/qp.h | 45 |
4 files changed, 39 insertions, 547 deletions
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h index 26069518625..b56e4587208 100644 --- a/include/linux/mlx4/cmd.h +++ b/include/linux/mlx4/cmd.h | |||
| @@ -59,15 +59,12 @@ enum { | |||
| 59 | MLX4_CMD_HW_HEALTH_CHECK = 0x50, | 59 | MLX4_CMD_HW_HEALTH_CHECK = 0x50, |
| 60 | MLX4_CMD_SET_PORT = 0xc, | 60 | MLX4_CMD_SET_PORT = 0xc, |
| 61 | MLX4_CMD_SET_NODE = 0x5a, | 61 | MLX4_CMD_SET_NODE = 0x5a, |
| 62 | MLX4_CMD_QUERY_FUNC = 0x56, | ||
| 63 | MLX4_CMD_ACCESS_DDR = 0x2e, | 62 | MLX4_CMD_ACCESS_DDR = 0x2e, |
| 64 | MLX4_CMD_MAP_ICM = 0xffa, | 63 | MLX4_CMD_MAP_ICM = 0xffa, |
| 65 | MLX4_CMD_UNMAP_ICM = 0xff9, | 64 | MLX4_CMD_UNMAP_ICM = 0xff9, |
| 66 | MLX4_CMD_MAP_ICM_AUX = 0xffc, | 65 | MLX4_CMD_MAP_ICM_AUX = 0xffc, |
| 67 | MLX4_CMD_UNMAP_ICM_AUX = 0xffb, | 66 | MLX4_CMD_UNMAP_ICM_AUX = 0xffb, |
| 68 | MLX4_CMD_SET_ICM_SIZE = 0xffd, | 67 | MLX4_CMD_SET_ICM_SIZE = 0xffd, |
| 69 | /*master notify fw on finish for slave's flr*/ | ||
| 70 | MLX4_CMD_INFORM_FLR_DONE = 0x5b, | ||
| 71 | 68 | ||
| 72 | /* TPT commands */ | 69 | /* TPT commands */ |
| 73 | MLX4_CMD_SW2HW_MPT = 0xd, | 70 | MLX4_CMD_SW2HW_MPT = 0xd, |
| @@ -122,26 +119,6 @@ enum { | |||
| 122 | /* miscellaneous commands */ | 119 | /* miscellaneous commands */ |
| 123 | MLX4_CMD_DIAG_RPRT = 0x30, | 120 | MLX4_CMD_DIAG_RPRT = 0x30, |
| 124 | MLX4_CMD_NOP = 0x31, | 121 | MLX4_CMD_NOP = 0x31, |
| 125 | MLX4_CMD_ACCESS_MEM = 0x2e, | ||
| 126 | MLX4_CMD_SET_VEP = 0x52, | ||
| 127 | |||
| 128 | /* Ethernet specific commands */ | ||
| 129 | MLX4_CMD_SET_VLAN_FLTR = 0x47, | ||
| 130 | MLX4_CMD_SET_MCAST_FLTR = 0x48, | ||
| 131 | MLX4_CMD_DUMP_ETH_STATS = 0x49, | ||
| 132 | |||
| 133 | /* Communication channel commands */ | ||
| 134 | MLX4_CMD_ARM_COMM_CHANNEL = 0x57, | ||
| 135 | MLX4_CMD_GEN_EQE = 0x58, | ||
| 136 | |||
| 137 | /* virtual commands */ | ||
| 138 | MLX4_CMD_ALLOC_RES = 0xf00, | ||
| 139 | MLX4_CMD_FREE_RES = 0xf01, | ||
| 140 | MLX4_CMD_MCAST_ATTACH = 0xf05, | ||
| 141 | MLX4_CMD_UCAST_ATTACH = 0xf06, | ||
| 142 | MLX4_CMD_PROMISC = 0xf08, | ||
| 143 | MLX4_CMD_QUERY_FUNC_CAP = 0xf0a, | ||
| 144 | MLX4_CMD_QP_ATTACH = 0xf0b, | ||
| 145 | 122 | ||
| 146 | /* debug commands */ | 123 | /* debug commands */ |
| 147 | MLX4_CMD_QUERY_DEBUG_MSG = 0x2a, | 124 | MLX4_CMD_QUERY_DEBUG_MSG = 0x2a, |
| @@ -149,15 +126,6 @@ enum { | |||
| 149 | 126 | ||
| 150 | /* statistics commands */ | 127 | /* statistics commands */ |
| 151 | MLX4_CMD_QUERY_IF_STAT = 0X54, | 128 | MLX4_CMD_QUERY_IF_STAT = 0X54, |
| 152 | MLX4_CMD_SET_IF_STAT = 0X55, | ||
| 153 | |||
| 154 | /* set port opcode modifiers */ | ||
| 155 | MLX4_SET_PORT_PRIO2TC = 0x8, | ||
| 156 | MLX4_SET_PORT_SCHEDULER = 0x9, | ||
| 157 | |||
| 158 | /* register/delete flow steering network rules */ | ||
| 159 | MLX4_QP_FLOW_STEERING_ATTACH = 0x65, | ||
| 160 | MLX4_QP_FLOW_STEERING_DETACH = 0x66, | ||
| 161 | }; | 129 | }; |
| 162 | 130 | ||
| 163 | enum { | 131 | enum { |
| @@ -167,8 +135,7 @@ enum { | |||
| 167 | }; | 135 | }; |
| 168 | 136 | ||
| 169 | enum { | 137 | enum { |
| 170 | MLX4_MAILBOX_SIZE = 4096, | 138 | MLX4_MAILBOX_SIZE = 4096 |
| 171 | MLX4_ACCESS_MEM_ALIGN = 256, | ||
| 172 | }; | 139 | }; |
| 173 | 140 | ||
| 174 | enum { | 141 | enum { |
| @@ -181,11 +148,6 @@ enum { | |||
| 181 | MLX4_SET_PORT_GID_TABLE = 0x5, | 148 | MLX4_SET_PORT_GID_TABLE = 0x5, |
| 182 | }; | 149 | }; |
| 183 | 150 | ||
| 184 | enum { | ||
| 185 | MLX4_CMD_WRAPPED, | ||
| 186 | MLX4_CMD_NATIVE | ||
| 187 | }; | ||
| 188 | |||
| 189 | struct mlx4_dev; | 151 | struct mlx4_dev; |
| 190 | 152 | ||
| 191 | struct mlx4_cmd_mailbox { | 153 | struct mlx4_cmd_mailbox { |
| @@ -195,24 +157,23 @@ struct mlx4_cmd_mailbox { | |||
| 195 | 157 | ||
| 196 | int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param, | 158 | int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param, |
| 197 | int out_is_imm, u32 in_modifier, u8 op_modifier, | 159 | int out_is_imm, u32 in_modifier, u8 op_modifier, |
| 198 | u16 op, unsigned long timeout, int native); | 160 | u16 op, unsigned long timeout); |
| 199 | 161 | ||
| 200 | /* Invoke a command with no output parameter */ | 162 | /* Invoke a command with no output parameter */ |
| 201 | static inline int mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u32 in_modifier, | 163 | static inline int mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u32 in_modifier, |
| 202 | u8 op_modifier, u16 op, unsigned long timeout, | 164 | u8 op_modifier, u16 op, unsigned long timeout) |
| 203 | int native) | ||
| 204 | { | 165 | { |
| 205 | return __mlx4_cmd(dev, in_param, NULL, 0, in_modifier, | 166 | return __mlx4_cmd(dev, in_param, NULL, 0, in_modifier, |
| 206 | op_modifier, op, timeout, native); | 167 | op_modifier, op, timeout); |
| 207 | } | 168 | } |
| 208 | 169 | ||
| 209 | /* Invoke a command with an output mailbox */ | 170 | /* Invoke a command with an output mailbox */ |
| 210 | static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param, | 171 | static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param, |
| 211 | u32 in_modifier, u8 op_modifier, u16 op, | 172 | u32 in_modifier, u8 op_modifier, u16 op, |
| 212 | unsigned long timeout, int native) | 173 | unsigned long timeout) |
| 213 | { | 174 | { |
| 214 | return __mlx4_cmd(dev, in_param, &out_param, 0, in_modifier, | 175 | return __mlx4_cmd(dev, in_param, &out_param, 0, in_modifier, |
| 215 | op_modifier, op, timeout, native); | 176 | op_modifier, op, timeout); |
| 216 | } | 177 | } |
| 217 | 178 | ||
| 218 | /* | 179 | /* |
| @@ -222,17 +183,13 @@ static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param | |||
| 222 | */ | 183 | */ |
| 223 | static inline int mlx4_cmd_imm(struct mlx4_dev *dev, u64 in_param, u64 *out_param, | 184 | static inline int mlx4_cmd_imm(struct mlx4_dev *dev, u64 in_param, u64 *out_param, |
| 224 | u32 in_modifier, u8 op_modifier, u16 op, | 185 | u32 in_modifier, u8 op_modifier, u16 op, |
| 225 | unsigned long timeout, int native) | 186 | unsigned long timeout) |
| 226 | { | 187 | { |
| 227 | return __mlx4_cmd(dev, in_param, out_param, 1, in_modifier, | 188 | return __mlx4_cmd(dev, in_param, out_param, 1, in_modifier, |
| 228 | op_modifier, op, timeout, native); | 189 | op_modifier, op, timeout); |
| 229 | } | 190 | } |
| 230 | 191 | ||
| 231 | struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev); | 192 | struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev); |
| 232 | void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox); | 193 | void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox); |
| 233 | 194 | ||
| 234 | u32 mlx4_comm_get_version(void); | ||
| 235 | |||
| 236 | #define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) | ||
| 237 | |||
| 238 | #endif /* MLX4_CMD_H */ | 195 | #endif /* MLX4_CMD_H */ |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 20ea939c22a..53ef894bfa0 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
| @@ -36,7 +36,6 @@ | |||
| 36 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
| 37 | #include <linux/completion.h> | 37 | #include <linux/completion.h> |
| 38 | #include <linux/radix-tree.h> | 38 | #include <linux/radix-tree.h> |
| 39 | #include <linux/cpu_rmap.h> | ||
| 40 | 39 | ||
| 41 | #include <linux/atomic.h> | 40 | #include <linux/atomic.h> |
| 42 | 41 | ||
| @@ -48,77 +47,20 @@ | |||
| 48 | enum { | 47 | enum { |
| 49 | MLX4_FLAG_MSI_X = 1 << 0, | 48 | MLX4_FLAG_MSI_X = 1 << 0, |
| 50 | MLX4_FLAG_OLD_PORT_CMDS = 1 << 1, | 49 | MLX4_FLAG_OLD_PORT_CMDS = 1 << 1, |
| 51 | MLX4_FLAG_MASTER = 1 << 2, | ||
| 52 | MLX4_FLAG_SLAVE = 1 << 3, | ||
| 53 | MLX4_FLAG_SRIOV = 1 << 4, | ||
| 54 | }; | 50 | }; |
| 55 | 51 | ||
| 56 | enum { | 52 | enum { |
| 57 | MLX4_PORT_CAP_IS_SM = 1 << 1, | 53 | MLX4_MAX_PORTS = 2 |
| 58 | MLX4_PORT_CAP_DEV_MGMT_SUP = 1 << 19, | ||
| 59 | }; | 54 | }; |
| 60 | 55 | ||
| 61 | enum { | 56 | enum { |
| 62 | MLX4_MAX_PORTS = 2, | ||
| 63 | MLX4_MAX_PORT_PKEYS = 128 | ||
| 64 | }; | ||
| 65 | |||
| 66 | /* base qkey for use in sriov tunnel-qp/proxy-qp communication. | ||
| 67 | * These qkeys must not be allowed for general use. This is a 64k range, | ||
| 68 | * and to test for violation, we use the mask (protect against future chg). | ||
| 69 | */ | ||
| 70 | #define MLX4_RESERVED_QKEY_BASE (0xFFFF0000) | ||
| 71 | #define MLX4_RESERVED_QKEY_MASK (0xFFFF0000) | ||
| 72 | |||
| 73 | enum { | ||
| 74 | MLX4_BOARD_ID_LEN = 64 | 57 | MLX4_BOARD_ID_LEN = 64 |
| 75 | }; | 58 | }; |
| 76 | 59 | ||
| 77 | enum { | 60 | enum { |
| 78 | MLX4_MAX_NUM_PF = 16, | ||
| 79 | MLX4_MAX_NUM_VF = 64, | ||
| 80 | MLX4_MFUNC_MAX = 80, | ||
| 81 | MLX4_MAX_EQ_NUM = 1024, | ||
| 82 | MLX4_MFUNC_EQ_NUM = 4, | ||
| 83 | MLX4_MFUNC_MAX_EQES = 8, | ||
| 84 | MLX4_MFUNC_EQE_MASK = (MLX4_MFUNC_MAX_EQES - 1) | ||
| 85 | }; | ||
| 86 | |||
| 87 | /* Driver supports 3 diffrent device methods to manage traffic steering: | ||
| 88 | * -device managed - High level API for ib and eth flow steering. FW is | ||
| 89 | * managing flow steering tables. | ||
| 90 | * - B0 steering mode - Common low level API for ib and (if supported) eth. | ||
| 91 | * - A0 steering mode - Limited low level API for eth. In case of IB, | ||
| 92 | * B0 mode is in use. | ||
| 93 | */ | ||
| 94 | enum { | ||
| 95 | MLX4_STEERING_MODE_A0, | ||
| 96 | MLX4_STEERING_MODE_B0, | ||
| 97 | MLX4_STEERING_MODE_DEVICE_MANAGED | ||
| 98 | }; | ||
| 99 | |||
| 100 | static inline const char *mlx4_steering_mode_str(int steering_mode) | ||
| 101 | { | ||
| 102 | switch (steering_mode) { | ||
| 103 | case MLX4_STEERING_MODE_A0: | ||
| 104 | return "A0 steering"; | ||
| 105 | |||
| 106 | case MLX4_STEERING_MODE_B0: | ||
| 107 | return "B0 steering"; | ||
| 108 | |||
| 109 | case MLX4_STEERING_MODE_DEVICE_MANAGED: | ||
| 110 | return "Device managed flow steering"; | ||
| 111 | |||
| 112 | default: | ||
| 113 | return "Unrecognize steering mode"; | ||
| 114 | } | ||
| 115 | } | ||
| 116 | |||
| 117 | enum { | ||
| 118 | MLX4_DEV_CAP_FLAG_RC = 1LL << 0, | 61 | MLX4_DEV_CAP_FLAG_RC = 1LL << 0, |
| 119 | MLX4_DEV_CAP_FLAG_UC = 1LL << 1, | 62 | MLX4_DEV_CAP_FLAG_UC = 1LL << 1, |
| 120 | MLX4_DEV_CAP_FLAG_UD = 1LL << 2, | 63 | MLX4_DEV_CAP_FLAG_UD = 1LL << 2, |
| 121 | MLX4_DEV_CAP_FLAG_XRC = 1LL << 3, | ||
| 122 | MLX4_DEV_CAP_FLAG_SRQ = 1LL << 6, | 64 | MLX4_DEV_CAP_FLAG_SRQ = 1LL << 6, |
| 123 | MLX4_DEV_CAP_FLAG_IPOIB_CSUM = 1LL << 7, | 65 | MLX4_DEV_CAP_FLAG_IPOIB_CSUM = 1LL << 7, |
| 124 | MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8, | 66 | MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8, |
| @@ -133,43 +75,14 @@ enum { | |||
| 133 | MLX4_DEV_CAP_FLAG_UD_MCAST = 1LL << 21, | 75 | MLX4_DEV_CAP_FLAG_UD_MCAST = 1LL << 21, |
| 134 | MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30, | 76 | MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30, |
| 135 | MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32, | 77 | MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32, |
| 136 | MLX4_DEV_CAP_FLAG_FCS_KEEP = 1LL << 34, | 78 | MLX4_DEV_CAP_FLAG_WOL = 1LL << 38, |
| 137 | MLX4_DEV_CAP_FLAG_WOL_PORT1 = 1LL << 37, | ||
| 138 | MLX4_DEV_CAP_FLAG_WOL_PORT2 = 1LL << 38, | ||
| 139 | MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40, | 79 | MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40, |
| 140 | MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, | 80 | MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, |
| 141 | MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, | 81 | MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, |
| 142 | MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, | 82 | MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48 |
| 143 | MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, | ||
| 144 | MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, | ||
| 145 | MLX4_DEV_CAP_FLAG_64B_EQE = 1LL << 61, | ||
| 146 | MLX4_DEV_CAP_FLAG_64B_CQE = 1LL << 62 | ||
| 147 | }; | ||
| 148 | |||
| 149 | enum { | ||
| 150 | MLX4_DEV_CAP_FLAG2_RSS = 1LL << 0, | ||
| 151 | MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, | ||
| 152 | MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, | ||
| 153 | MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3 | ||
| 154 | }; | ||
| 155 | |||
| 156 | enum { | ||
| 157 | MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0, | ||
| 158 | MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1 | ||
| 159 | }; | ||
| 160 | |||
| 161 | enum { | ||
| 162 | MLX4_USER_DEV_CAP_64B_CQE = 1L << 0 | ||
| 163 | }; | 83 | }; |
| 164 | 84 | ||
| 165 | enum { | 85 | enum { |
| 166 | MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0 | ||
| 167 | }; | ||
| 168 | |||
| 169 | |||
| 170 | #define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) | ||
| 171 | |||
| 172 | enum { | ||
| 173 | MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, | 86 | MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, |
| 174 | MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, | 87 | MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, |
| 175 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, | 88 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, |
| @@ -195,13 +108,7 @@ enum mlx4_event { | |||
| 195 | MLX4_EVENT_TYPE_PORT_CHANGE = 0x09, | 108 | MLX4_EVENT_TYPE_PORT_CHANGE = 0x09, |
| 196 | MLX4_EVENT_TYPE_EQ_OVERFLOW = 0x0f, | 109 | MLX4_EVENT_TYPE_EQ_OVERFLOW = 0x0f, |
| 197 | MLX4_EVENT_TYPE_ECC_DETECT = 0x0e, | 110 | MLX4_EVENT_TYPE_ECC_DETECT = 0x0e, |
| 198 | MLX4_EVENT_TYPE_CMD = 0x0a, | 111 | MLX4_EVENT_TYPE_CMD = 0x0a |
| 199 | MLX4_EVENT_TYPE_VEP_UPDATE = 0x19, | ||
| 200 | MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18, | ||
| 201 | MLX4_EVENT_TYPE_FATAL_WARNING = 0x1b, | ||
| 202 | MLX4_EVENT_TYPE_FLR_EVENT = 0x1c, | ||
| 203 | MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT = 0x1d, | ||
| 204 | MLX4_EVENT_TYPE_NONE = 0xff, | ||
| 205 | }; | 112 | }; |
| 206 | 113 | ||
| 207 | enum { | 114 | enum { |
| @@ -210,29 +117,6 @@ enum { | |||
| 210 | }; | 117 | }; |
| 211 | 118 | ||
| 212 | enum { | 119 | enum { |
| 213 | MLX4_FATAL_WARNING_SUBTYPE_WARMING = 0, | ||
| 214 | }; | ||
| 215 | |||
| 216 | enum slave_port_state { | ||
| 217 | SLAVE_PORT_DOWN = 0, | ||
| 218 | SLAVE_PENDING_UP, | ||
| 219 | SLAVE_PORT_UP, | ||
| 220 | }; | ||
| 221 | |||
| 222 | enum slave_port_gen_event { | ||
| 223 | SLAVE_PORT_GEN_EVENT_DOWN = 0, | ||
| 224 | SLAVE_PORT_GEN_EVENT_UP, | ||
| 225 | SLAVE_PORT_GEN_EVENT_NONE, | ||
| 226 | }; | ||
| 227 | |||
| 228 | enum slave_port_state_event { | ||
| 229 | MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN, | ||
| 230 | MLX4_PORT_STATE_DEV_EVENT_PORT_UP, | ||
| 231 | MLX4_PORT_STATE_IB_PORT_STATE_EVENT_GID_VALID, | ||
| 232 | MLX4_PORT_STATE_IB_EVENT_GID_INVALID, | ||
| 233 | }; | ||
| 234 | |||
| 235 | enum { | ||
| 236 | MLX4_PERM_LOCAL_READ = 1 << 10, | 120 | MLX4_PERM_LOCAL_READ = 1 << 10, |
| 237 | MLX4_PERM_LOCAL_WRITE = 1 << 11, | 121 | MLX4_PERM_LOCAL_WRITE = 1 << 11, |
| 238 | MLX4_PERM_REMOTE_READ = 1 << 12, | 122 | MLX4_PERM_REMOTE_READ = 1 << 12, |
| @@ -291,7 +175,6 @@ enum mlx4_qp_region { | |||
| 291 | }; | 175 | }; |
| 292 | 176 | ||
| 293 | enum mlx4_port_type { | 177 | enum mlx4_port_type { |
| 294 | MLX4_PORT_TYPE_NONE = 0, | ||
| 295 | MLX4_PORT_TYPE_IB = 1, | 178 | MLX4_PORT_TYPE_IB = 1, |
| 296 | MLX4_PORT_TYPE_ETH = 2, | 179 | MLX4_PORT_TYPE_ETH = 2, |
| 297 | MLX4_PORT_TYPE_AUTO = 3 | 180 | MLX4_PORT_TYPE_AUTO = 3 |
| @@ -317,41 +200,13 @@ enum { | |||
| 317 | MLX4_MAX_FAST_REG_PAGES = 511, | 200 | MLX4_MAX_FAST_REG_PAGES = 511, |
| 318 | }; | 201 | }; |
| 319 | 202 | ||
| 320 | enum { | ||
| 321 | MLX4_DEV_PMC_SUBTYPE_GUID_INFO = 0x14, | ||
| 322 | MLX4_DEV_PMC_SUBTYPE_PORT_INFO = 0x15, | ||
| 323 | MLX4_DEV_PMC_SUBTYPE_PKEY_TABLE = 0x16, | ||
| 324 | }; | ||
| 325 | |||
| 326 | /* Port mgmt change event handling */ | ||
| 327 | enum { | ||
| 328 | MLX4_EQ_PORT_INFO_MSTR_SM_LID_CHANGE_MASK = 1 << 0, | ||
| 329 | MLX4_EQ_PORT_INFO_GID_PFX_CHANGE_MASK = 1 << 1, | ||
| 330 | MLX4_EQ_PORT_INFO_LID_CHANGE_MASK = 1 << 2, | ||
| 331 | MLX4_EQ_PORT_INFO_CLIENT_REREG_MASK = 1 << 3, | ||
| 332 | MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK = 1 << 4, | ||
| 333 | }; | ||
| 334 | |||
| 335 | #define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \ | ||
| 336 | MLX4_EQ_PORT_INFO_MSTR_SM_LID_CHANGE_MASK) | ||
| 337 | |||
| 338 | static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) | 203 | static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) |
| 339 | { | 204 | { |
| 340 | return (major << 32) | (minor << 16) | subminor; | 205 | return (major << 32) | (minor << 16) | subminor; |
| 341 | } | 206 | } |
| 342 | 207 | ||
| 343 | struct mlx4_phys_caps { | ||
| 344 | u32 gid_phys_table_len[MLX4_MAX_PORTS + 1]; | ||
| 345 | u32 pkey_phys_table_len[MLX4_MAX_PORTS + 1]; | ||
| 346 | u32 num_phys_eqs; | ||
| 347 | u32 base_sqpn; | ||
| 348 | u32 base_proxy_sqpn; | ||
| 349 | u32 base_tunnel_sqpn; | ||
| 350 | }; | ||
| 351 | |||
| 352 | struct mlx4_caps { | 208 | struct mlx4_caps { |
| 353 | u64 fw_ver; | 209 | u64 fw_ver; |
| 354 | u32 function; | ||
| 355 | int num_ports; | 210 | int num_ports; |
| 356 | int vl_cap[MLX4_MAX_PORTS + 1]; | 211 | int vl_cap[MLX4_MAX_PORTS + 1]; |
| 357 | int ib_mtu_cap[MLX4_MAX_PORTS + 1]; | 212 | int ib_mtu_cap[MLX4_MAX_PORTS + 1]; |
| @@ -366,7 +221,6 @@ struct mlx4_caps { | |||
| 366 | u64 trans_code[MLX4_MAX_PORTS + 1]; | 221 | u64 trans_code[MLX4_MAX_PORTS + 1]; |
| 367 | int local_ca_ack_delay; | 222 | int local_ca_ack_delay; |
| 368 | int num_uars; | 223 | int num_uars; |
| 369 | u32 uar_page_size; | ||
| 370 | int bf_reg_size; | 224 | int bf_reg_size; |
| 371 | int bf_regs_per_page; | 225 | int bf_regs_per_page; |
| 372 | int max_sq_sg; | 226 | int max_sq_sg; |
| @@ -377,10 +231,7 @@ struct mlx4_caps { | |||
| 377 | int max_rq_desc_sz; | 231 | int max_rq_desc_sz; |
| 378 | int max_qp_init_rdma; | 232 | int max_qp_init_rdma; |
| 379 | int max_qp_dest_rdma; | 233 | int max_qp_dest_rdma; |
| 380 | u32 *qp0_proxy; | 234 | int sqp_start; |
| 381 | u32 *qp1_proxy; | ||
| 382 | u32 *qp0_tunnel; | ||
| 383 | u32 *qp1_tunnel; | ||
| 384 | int num_srqs; | 235 | int num_srqs; |
| 385 | int max_srq_wqes; | 236 | int max_srq_wqes; |
| 386 | int max_srq_sge; | 237 | int max_srq_sge; |
| @@ -393,8 +244,8 @@ struct mlx4_caps { | |||
| 393 | int num_comp_vectors; | 244 | int num_comp_vectors; |
| 394 | int comp_pool; | 245 | int comp_pool; |
| 395 | int num_mpts; | 246 | int num_mpts; |
| 396 | int max_fmr_maps; | 247 | int num_mtt_segs; |
| 397 | int num_mtts; | 248 | int mtts_per_seg; |
| 398 | int fmr_reserved_mtts; | 249 | int fmr_reserved_mtts; |
| 399 | int reserved_mtts; | 250 | int reserved_mtts; |
| 400 | int reserved_mrws; | 251 | int reserved_mrws; |
| @@ -403,23 +254,17 @@ struct mlx4_caps { | |||
| 403 | int num_amgms; | 254 | int num_amgms; |
| 404 | int reserved_mcgs; | 255 | int reserved_mcgs; |
| 405 | int num_qp_per_mgm; | 256 | int num_qp_per_mgm; |
| 406 | int steering_mode; | ||
| 407 | int fs_log_max_ucast_qp_range_size; | ||
| 408 | int num_pds; | 257 | int num_pds; |
| 409 | int reserved_pds; | 258 | int reserved_pds; |
| 410 | int max_xrcds; | ||
| 411 | int reserved_xrcds; | ||
| 412 | int mtt_entry_sz; | 259 | int mtt_entry_sz; |
| 413 | u32 max_msg_sz; | 260 | u32 max_msg_sz; |
| 414 | u32 page_size_cap; | 261 | u32 page_size_cap; |
| 415 | u64 flags; | 262 | u64 flags; |
| 416 | u64 flags2; | ||
| 417 | u32 bmme_flags; | 263 | u32 bmme_flags; |
| 418 | u32 reserved_lkey; | 264 | u32 reserved_lkey; |
| 419 | u16 stat_rate_support; | 265 | u16 stat_rate_support; |
| 420 | u8 port_width_cap[MLX4_MAX_PORTS + 1]; | 266 | u8 port_width_cap[MLX4_MAX_PORTS + 1]; |
| 421 | int max_gso_sz; | 267 | int max_gso_sz; |
| 422 | int max_rss_tbl_sz; | ||
| 423 | int reserved_qps_cnt[MLX4_NUM_QP_REGION]; | 268 | int reserved_qps_cnt[MLX4_NUM_QP_REGION]; |
| 424 | int reserved_qps; | 269 | int reserved_qps; |
| 425 | int reserved_qps_base[MLX4_NUM_QP_REGION]; | 270 | int reserved_qps_base[MLX4_NUM_QP_REGION]; |
| @@ -428,18 +273,9 @@ struct mlx4_caps { | |||
| 428 | int log_num_prios; | 273 | int log_num_prios; |
| 429 | enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; | 274 | enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; |
| 430 | u8 supported_type[MLX4_MAX_PORTS + 1]; | 275 | u8 supported_type[MLX4_MAX_PORTS + 1]; |
| 431 | u8 suggested_type[MLX4_MAX_PORTS + 1]; | 276 | u32 port_mask; |
| 432 | u8 default_sense[MLX4_MAX_PORTS + 1]; | ||
| 433 | u32 port_mask[MLX4_MAX_PORTS + 1]; | ||
| 434 | enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; | 277 | enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; |
| 435 | u32 max_counters; | 278 | u32 max_counters; |
| 436 | u8 port_ib_mtu[MLX4_MAX_PORTS + 1]; | ||
| 437 | u16 sqp_demux; | ||
| 438 | u32 eqe_size; | ||
| 439 | u32 cqe_size; | ||
| 440 | u8 eqe_factor; | ||
| 441 | u32 userspace_caps; /* userspace must be aware of these */ | ||
| 442 | u32 function_caps; /* VFs must be aware of these */ | ||
| 443 | }; | 279 | }; |
| 444 | 280 | ||
| 445 | struct mlx4_buf_list { | 281 | struct mlx4_buf_list { |
| @@ -456,7 +292,7 @@ struct mlx4_buf { | |||
| 456 | }; | 292 | }; |
| 457 | 293 | ||
| 458 | struct mlx4_mtt { | 294 | struct mlx4_mtt { |
| 459 | u32 offset; | 295 | u32 first_seg; |
| 460 | int order; | 296 | int order; |
| 461 | int page_shift; | 297 | int page_shift; |
| 462 | }; | 298 | }; |
| @@ -618,93 +454,12 @@ struct mlx4_counter { | |||
| 618 | struct mlx4_dev { | 454 | struct mlx4_dev { |
| 619 | struct pci_dev *pdev; | 455 | struct pci_dev *pdev; |
| 620 | unsigned long flags; | 456 | unsigned long flags; |
| 621 | unsigned long num_slaves; | ||
| 622 | struct mlx4_caps caps; | 457 | struct mlx4_caps caps; |
| 623 | struct mlx4_phys_caps phys_caps; | ||
| 624 | struct radix_tree_root qp_table_tree; | 458 | struct radix_tree_root qp_table_tree; |
| 625 | u8 rev_id; | 459 | u8 rev_id; |
| 626 | char board_id[MLX4_BOARD_ID_LEN]; | 460 | char board_id[MLX4_BOARD_ID_LEN]; |
| 627 | int num_vfs; | ||
| 628 | int oper_log_mgm_entry_size; | ||
| 629 | u64 regid_promisc_array[MLX4_MAX_PORTS + 1]; | ||
| 630 | u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; | ||
| 631 | }; | 461 | }; |
| 632 | 462 | ||
| 633 | struct mlx4_eqe { | ||
| 634 | u8 reserved1; | ||
| 635 | u8 type; | ||
| 636 | u8 reserved2; | ||
| 637 | u8 subtype; | ||
| 638 | union { | ||
| 639 | u32 raw[6]; | ||
| 640 | struct { | ||
| 641 | __be32 cqn; | ||
| 642 | } __packed comp; | ||
| 643 | struct { | ||
| 644 | u16 reserved1; | ||
| 645 | __be16 token; | ||
| 646 | u32 reserved2; | ||
| 647 | u8 reserved3[3]; | ||
| 648 | u8 status; | ||
| 649 | __be64 out_param; | ||
| 650 | } __packed cmd; | ||
| 651 | struct { | ||
| 652 | __be32 qpn; | ||
| 653 | } __packed qp; | ||
| 654 | struct { | ||
| 655 | __be32 srqn; | ||
| 656 | } __packed srq; | ||
| 657 | struct { | ||
| 658 | __be32 cqn; | ||
| 659 | u32 reserved1; | ||
| 660 | u8 reserved2[3]; | ||
| 661 | u8 syndrome; | ||
| 662 | } __packed cq_err; | ||
| 663 | struct { | ||
| 664 | u32 reserved1[2]; | ||
| 665 | __be32 port; | ||
| 666 | } __packed port_change; | ||
| 667 | struct { | ||
| 668 | #define COMM_CHANNEL_BIT_ARRAY_SIZE 4 | ||
| 669 | u32 reserved; | ||
| 670 | u32 bit_vec[COMM_CHANNEL_BIT_ARRAY_SIZE]; | ||
| 671 | } __packed comm_channel_arm; | ||
| 672 | struct { | ||
| 673 | u8 port; | ||
| 674 | u8 reserved[3]; | ||
| 675 | __be64 mac; | ||
| 676 | } __packed mac_update; | ||
| 677 | struct { | ||
| 678 | __be32 slave_id; | ||
| 679 | } __packed flr_event; | ||
| 680 | struct { | ||
| 681 | __be16 current_temperature; | ||
| 682 | __be16 warning_threshold; | ||
| 683 | } __packed warming; | ||
| 684 | struct { | ||
| 685 | u8 reserved[3]; | ||
| 686 | u8 port; | ||
| 687 | union { | ||
| 688 | struct { | ||
| 689 | __be16 mstr_sm_lid; | ||
| 690 | __be16 port_lid; | ||
| 691 | __be32 changed_attr; | ||
| 692 | u8 reserved[3]; | ||
| 693 | u8 mstr_sm_sl; | ||
| 694 | __be64 gid_prefix; | ||
| 695 | } __packed port_info; | ||
| 696 | struct { | ||
| 697 | __be32 block_ptr; | ||
| 698 | __be32 tbl_entries_mask; | ||
| 699 | } __packed tbl_change_info; | ||
| 700 | } params; | ||
| 701 | } __packed port_mgmt_change; | ||
| 702 | } event; | ||
| 703 | u8 slave_id; | ||
| 704 | u8 reserved3[2]; | ||
| 705 | u8 owner; | ||
| 706 | } __packed; | ||
| 707 | |||
| 708 | struct mlx4_init_port_param { | 463 | struct mlx4_init_port_param { |
| 709 | int set_guid0; | 464 | int set_guid0; |
| 710 | int set_node_guid; | 465 | int set_node_guid; |
| @@ -721,56 +476,14 @@ struct mlx4_init_port_param { | |||
| 721 | 476 | ||
| 722 | #define mlx4_foreach_port(port, dev, type) \ | 477 | #define mlx4_foreach_port(port, dev, type) \ |
| 723 | for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ | 478 | for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ |
| 724 | if ((type) == (dev)->caps.port_mask[(port)]) | 479 | if (((type) == MLX4_PORT_TYPE_IB ? (dev)->caps.port_mask : \ |
| 725 | 480 | ~(dev)->caps.port_mask) & 1 << ((port) - 1)) | |
| 726 | #define mlx4_foreach_non_ib_transport_port(port, dev) \ | ||
| 727 | for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ | ||
| 728 | if (((dev)->caps.port_mask[port] != MLX4_PORT_TYPE_IB)) | ||
| 729 | |||
| 730 | #define mlx4_foreach_ib_transport_port(port, dev) \ | ||
| 731 | for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ | ||
| 732 | if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \ | ||
| 733 | ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE)) | ||
| 734 | |||
| 735 | #define MLX4_INVALID_SLAVE_ID 0xFF | ||
| 736 | 481 | ||
| 737 | void handle_port_mgmt_change_event(struct work_struct *work); | 482 | #define mlx4_foreach_ib_transport_port(port, dev) \ |
| 738 | 483 | for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ | |
| 739 | static inline int mlx4_master_func_num(struct mlx4_dev *dev) | 484 | if (((dev)->caps.port_mask & 1 << ((port) - 1)) || \ |
| 740 | { | 485 | ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE)) |
| 741 | return dev->caps.function; | ||
| 742 | } | ||
| 743 | |||
| 744 | static inline int mlx4_is_master(struct mlx4_dev *dev) | ||
| 745 | { | ||
| 746 | return dev->flags & MLX4_FLAG_MASTER; | ||
| 747 | } | ||
| 748 | |||
| 749 | static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn) | ||
| 750 | { | ||
| 751 | return (qpn < dev->phys_caps.base_sqpn + 8 + | ||
| 752 | 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev)); | ||
| 753 | } | ||
| 754 | |||
| 755 | static inline int mlx4_is_guest_proxy(struct mlx4_dev *dev, int slave, u32 qpn) | ||
| 756 | { | ||
| 757 | int guest_proxy_base = dev->phys_caps.base_proxy_sqpn + slave * 8; | ||
| 758 | |||
| 759 | if (qpn >= guest_proxy_base && qpn < guest_proxy_base + 8) | ||
| 760 | return 1; | ||
| 761 | |||
| 762 | return 0; | ||
| 763 | } | ||
| 764 | 486 | ||
| 765 | static inline int mlx4_is_mfunc(struct mlx4_dev *dev) | ||
| 766 | { | ||
| 767 | return dev->flags & (MLX4_FLAG_SLAVE | MLX4_FLAG_MASTER); | ||
| 768 | } | ||
| 769 | |||
| 770 | static inline int mlx4_is_slave(struct mlx4_dev *dev) | ||
| 771 | { | ||
| 772 | return dev->flags & MLX4_FLAG_SLAVE; | ||
| 773 | } | ||
| 774 | 487 | ||
| 775 | int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, | 488 | int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, |
| 776 | struct mlx4_buf *buf); | 489 | struct mlx4_buf *buf); |
| @@ -786,8 +499,6 @@ static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset) | |||
| 786 | 499 | ||
| 787 | int mlx4_pd_alloc(struct mlx4_dev *dev, u32 *pdn); | 500 | int mlx4_pd_alloc(struct mlx4_dev *dev, u32 *pdn); |
| 788 | void mlx4_pd_free(struct mlx4_dev *dev, u32 pdn); | 501 | void mlx4_pd_free(struct mlx4_dev *dev, u32 pdn); |
| 789 | int mlx4_xrcd_alloc(struct mlx4_dev *dev, u32 *xrcdn); | ||
| 790 | void mlx4_xrcd_free(struct mlx4_dev *dev, u32 xrcdn); | ||
| 791 | 502 | ||
| 792 | int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar); | 503 | int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar); |
| 793 | void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar); | 504 | void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar); |
| @@ -827,8 +538,8 @@ void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt); | |||
| 827 | int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp); | 538 | int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp); |
| 828 | void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); | 539 | void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); |
| 829 | 540 | ||
| 830 | int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcdn, | 541 | int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, struct mlx4_mtt *mtt, |
| 831 | struct mlx4_mtt *mtt, u64 db_rec, struct mlx4_srq *srq); | 542 | u64 db_rec, struct mlx4_srq *srq); |
| 832 | void mlx4_srq_free(struct mlx4_dev *dev, struct mlx4_srq *srq); | 543 | void mlx4_srq_free(struct mlx4_dev *dev, struct mlx4_srq *srq); |
| 833 | int mlx4_srq_arm(struct mlx4_dev *dev, struct mlx4_srq *srq, int limit_watermark); | 544 | int mlx4_srq_arm(struct mlx4_dev *dev, struct mlx4_srq *srq, int limit_watermark); |
| 834 | int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_watermark); | 545 | int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_watermark); |
| @@ -836,136 +547,20 @@ int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_waterm | |||
| 836 | int mlx4_INIT_PORT(struct mlx4_dev *dev, int port); | 547 | int mlx4_INIT_PORT(struct mlx4_dev *dev, int port); |
| 837 | int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); | 548 | int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); |
| 838 | 549 | ||
| 839 | int mlx4_unicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], | ||
| 840 | int block_mcast_loopback, enum mlx4_protocol prot); | ||
| 841 | int mlx4_unicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], | ||
| 842 | enum mlx4_protocol prot); | ||
| 843 | int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], | 550 | int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], |
| 844 | u8 port, int block_mcast_loopback, | 551 | int block_mcast_loopback, enum mlx4_protocol protocol); |
| 845 | enum mlx4_protocol protocol, u64 *reg_id); | ||
| 846 | int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], | 552 | int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], |
| 847 | enum mlx4_protocol protocol, u64 reg_id); | 553 | enum mlx4_protocol protocol); |
| 848 | |||
| 849 | enum { | ||
| 850 | MLX4_DOMAIN_UVERBS = 0x1000, | ||
| 851 | MLX4_DOMAIN_ETHTOOL = 0x2000, | ||
| 852 | MLX4_DOMAIN_RFS = 0x3000, | ||
| 853 | MLX4_DOMAIN_NIC = 0x5000, | ||
| 854 | }; | ||
| 855 | |||
| 856 | enum mlx4_net_trans_rule_id { | ||
| 857 | MLX4_NET_TRANS_RULE_ID_ETH = 0, | ||
| 858 | MLX4_NET_TRANS_RULE_ID_IB, | ||
| 859 | MLX4_NET_TRANS_RULE_ID_IPV6, | ||
| 860 | MLX4_NET_TRANS_RULE_ID_IPV4, | ||
| 861 | MLX4_NET_TRANS_RULE_ID_TCP, | ||
| 862 | MLX4_NET_TRANS_RULE_ID_UDP, | ||
| 863 | MLX4_NET_TRANS_RULE_NUM, /* should be last */ | ||
| 864 | }; | ||
| 865 | |||
| 866 | extern const u16 __sw_id_hw[]; | ||
| 867 | |||
| 868 | static inline int map_hw_to_sw_id(u16 header_id) | ||
| 869 | { | ||
| 870 | |||
| 871 | int i; | ||
| 872 | for (i = 0; i < MLX4_NET_TRANS_RULE_NUM; i++) { | ||
| 873 | if (header_id == __sw_id_hw[i]) | ||
| 874 | return i; | ||
| 875 | } | ||
| 876 | return -EINVAL; | ||
| 877 | } | ||
| 878 | |||
| 879 | enum mlx4_net_trans_promisc_mode { | ||
| 880 | MLX4_FS_PROMISC_NONE = 0, | ||
| 881 | MLX4_FS_PROMISC_UPLINK, | ||
| 882 | /* For future use. Not implemented yet */ | ||
| 883 | MLX4_FS_PROMISC_FUNCTION_PORT, | ||
| 884 | MLX4_FS_PROMISC_ALL_MULTI, | ||
| 885 | }; | ||
| 886 | |||
| 887 | struct mlx4_spec_eth { | ||
| 888 | u8 dst_mac[6]; | ||
| 889 | u8 dst_mac_msk[6]; | ||
| 890 | u8 src_mac[6]; | ||
| 891 | u8 src_mac_msk[6]; | ||
| 892 | u8 ether_type_enable; | ||
| 893 | __be16 ether_type; | ||
| 894 | __be16 vlan_id_msk; | ||
| 895 | __be16 vlan_id; | ||
| 896 | }; | ||
| 897 | |||
| 898 | struct mlx4_spec_tcp_udp { | ||
| 899 | __be16 dst_port; | ||
| 900 | __be16 dst_port_msk; | ||
| 901 | __be16 src_port; | ||
| 902 | __be16 src_port_msk; | ||
| 903 | }; | ||
| 904 | |||
| 905 | struct mlx4_spec_ipv4 { | ||
| 906 | __be32 dst_ip; | ||
| 907 | __be32 dst_ip_msk; | ||
| 908 | __be32 src_ip; | ||
| 909 | __be32 src_ip_msk; | ||
| 910 | }; | ||
| 911 | |||
| 912 | struct mlx4_spec_ib { | ||
| 913 | __be32 r_qpn; | ||
| 914 | __be32 qpn_msk; | ||
| 915 | u8 dst_gid[16]; | ||
| 916 | u8 dst_gid_msk[16]; | ||
| 917 | }; | ||
| 918 | |||
| 919 | struct mlx4_spec_list { | ||
| 920 | struct list_head list; | ||
| 921 | enum mlx4_net_trans_rule_id id; | ||
| 922 | union { | ||
| 923 | struct mlx4_spec_eth eth; | ||
| 924 | struct mlx4_spec_ib ib; | ||
| 925 | struct mlx4_spec_ipv4 ipv4; | ||
| 926 | struct mlx4_spec_tcp_udp tcp_udp; | ||
| 927 | }; | ||
| 928 | }; | ||
| 929 | |||
| 930 | enum mlx4_net_trans_hw_rule_queue { | ||
| 931 | MLX4_NET_TRANS_Q_FIFO, | ||
| 932 | MLX4_NET_TRANS_Q_LIFO, | ||
| 933 | }; | ||
| 934 | |||
| 935 | struct mlx4_net_trans_rule { | ||
| 936 | struct list_head list; | ||
| 937 | enum mlx4_net_trans_hw_rule_queue queue_mode; | ||
| 938 | bool exclusive; | ||
| 939 | bool allow_loopback; | ||
| 940 | enum mlx4_net_trans_promisc_mode promisc_mode; | ||
| 941 | u8 port; | ||
| 942 | u16 priority; | ||
| 943 | u32 qpn; | ||
| 944 | }; | ||
| 945 | |||
| 946 | int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, u32 qpn, | ||
| 947 | enum mlx4_net_trans_promisc_mode mode); | ||
| 948 | int mlx4_flow_steer_promisc_remove(struct mlx4_dev *dev, u8 port, | ||
| 949 | enum mlx4_net_trans_promisc_mode mode); | ||
| 950 | int mlx4_multicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port); | 554 | int mlx4_multicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port); |
| 951 | int mlx4_multicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); | 555 | int mlx4_multicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); |
| 952 | int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port); | 556 | int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port); |
| 953 | int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); | 557 | int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); |
| 954 | int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode); | 558 | int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode); |
| 955 | 559 | ||
| 956 | int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac); | 560 | int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn, u8 wrap); |
| 957 | void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); | 561 | void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int qpn); |
| 958 | int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); | 562 | int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac, u8 wrap); |
| 959 | int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn); | 563 | |
| 960 | void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn); | ||
| 961 | void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap); | ||
| 962 | int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, | ||
| 963 | u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); | ||
| 964 | int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, | ||
| 965 | u8 promisc); | ||
| 966 | int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc); | ||
| 967 | int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw, | ||
| 968 | u8 *pg, u16 *ratelimit); | ||
| 969 | int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); | 564 | int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); |
| 970 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); | 565 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); |
| 971 | void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); | 566 | void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); |
| @@ -980,8 +575,7 @@ void mlx4_fmr_unmap(struct mlx4_dev *dev, struct mlx4_fmr *fmr, | |||
| 980 | int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr); | 575 | int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr); |
| 981 | int mlx4_SYNC_TPT(struct mlx4_dev *dev); | 576 | int mlx4_SYNC_TPT(struct mlx4_dev *dev); |
| 982 | int mlx4_test_interrupts(struct mlx4_dev *dev); | 577 | int mlx4_test_interrupts(struct mlx4_dev *dev); |
| 983 | int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap, | 578 | int mlx4_assign_eq(struct mlx4_dev *dev, char* name , int* vector); |
| 984 | int *vector); | ||
| 985 | void mlx4_release_eq(struct mlx4_dev *dev, int vec); | 579 | void mlx4_release_eq(struct mlx4_dev *dev, int vec); |
| 986 | 580 | ||
| 987 | int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port); | 581 | int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port); |
| @@ -990,24 +584,4 @@ int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port); | |||
| 990 | int mlx4_counter_alloc(struct mlx4_dev *dev, u32 *idx); | 584 | int mlx4_counter_alloc(struct mlx4_dev *dev, u32 *idx); |
| 991 | void mlx4_counter_free(struct mlx4_dev *dev, u32 idx); | 585 | void mlx4_counter_free(struct mlx4_dev *dev, u32 idx); |
| 992 | 586 | ||
| 993 | int mlx4_flow_attach(struct mlx4_dev *dev, | ||
| 994 | struct mlx4_net_trans_rule *rule, u64 *reg_id); | ||
| 995 | int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id); | ||
| 996 | |||
| 997 | void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port, | ||
| 998 | int i, int val); | ||
| 999 | |||
| 1000 | int mlx4_get_parav_qkey(struct mlx4_dev *dev, u32 qpn, u32 *qkey); | ||
| 1001 | |||
| 1002 | int mlx4_is_slave_active(struct mlx4_dev *dev, int slave); | ||
| 1003 | int mlx4_gen_pkey_eqe(struct mlx4_dev *dev, int slave, u8 port); | ||
| 1004 | int mlx4_gen_guid_change_eqe(struct mlx4_dev *dev, int slave, u8 port); | ||
| 1005 | int mlx4_gen_slaves_port_mgt_ev(struct mlx4_dev *dev, u8 port, int attr); | ||
| 1006 | int mlx4_gen_port_state_change_eqe(struct mlx4_dev *dev, int slave, u8 port, u8 port_subtype_change); | ||
| 1007 | enum slave_port_state mlx4_get_slave_port_state(struct mlx4_dev *dev, int slave, u8 port); | ||
| 1008 | int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, u8 port, int event, enum slave_port_gen_event *gen_event); | ||
| 1009 | |||
| 1010 | void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid); | ||
| 1011 | __be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); | ||
| 1012 | |||
| 1013 | #endif /* MLX4_DEVICE_H */ | 587 | #endif /* MLX4_DEVICE_H */ |
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h index c257e1b211b..e1eebf78cab 100644 --- a/include/linux/mlx4/driver.h +++ b/include/linux/mlx4/driver.h | |||
| @@ -33,27 +33,23 @@ | |||
| 33 | #ifndef MLX4_DRIVER_H | 33 | #ifndef MLX4_DRIVER_H |
| 34 | #define MLX4_DRIVER_H | 34 | #define MLX4_DRIVER_H |
| 35 | 35 | ||
| 36 | #include <linux/device.h> | ||
| 36 | #include <linux/mlx4/device.h> | 37 | #include <linux/mlx4/device.h> |
| 37 | 38 | ||
| 38 | struct mlx4_dev; | 39 | struct mlx4_dev; |
| 39 | 40 | ||
| 40 | #define MLX4_MAC_MASK 0xffffffffffffULL | ||
| 41 | |||
| 42 | enum mlx4_dev_event { | 41 | enum mlx4_dev_event { |
| 43 | MLX4_DEV_EVENT_CATASTROPHIC_ERROR, | 42 | MLX4_DEV_EVENT_CATASTROPHIC_ERROR, |
| 44 | MLX4_DEV_EVENT_PORT_UP, | 43 | MLX4_DEV_EVENT_PORT_UP, |
| 45 | MLX4_DEV_EVENT_PORT_DOWN, | 44 | MLX4_DEV_EVENT_PORT_DOWN, |
| 46 | MLX4_DEV_EVENT_PORT_REINIT, | 45 | MLX4_DEV_EVENT_PORT_REINIT, |
| 47 | MLX4_DEV_EVENT_PORT_MGMT_CHANGE, | ||
| 48 | MLX4_DEV_EVENT_SLAVE_INIT, | ||
| 49 | MLX4_DEV_EVENT_SLAVE_SHUTDOWN, | ||
| 50 | }; | 46 | }; |
| 51 | 47 | ||
| 52 | struct mlx4_interface { | 48 | struct mlx4_interface { |
| 53 | void * (*add) (struct mlx4_dev *dev); | 49 | void * (*add) (struct mlx4_dev *dev); |
| 54 | void (*remove)(struct mlx4_dev *dev, void *context); | 50 | void (*remove)(struct mlx4_dev *dev, void *context); |
| 55 | void (*event) (struct mlx4_dev *dev, void *context, | 51 | void (*event) (struct mlx4_dev *dev, void *context, |
| 56 | enum mlx4_dev_event event, unsigned long param); | 52 | enum mlx4_dev_event event, int port); |
| 57 | void * (*get_dev)(struct mlx4_dev *dev, void *context, u8 port); | 53 | void * (*get_dev)(struct mlx4_dev *dev, void *context, u8 port); |
| 58 | struct list_head list; | 54 | struct list_head list; |
| 59 | enum mlx4_protocol protocol; | 55 | enum mlx4_protocol protocol; |
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index 4b4ad6ffef9..4001c8249db 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h | |||
| @@ -75,7 +75,6 @@ enum { | |||
| 75 | MLX4_QP_ST_UC = 0x1, | 75 | MLX4_QP_ST_UC = 0x1, |
| 76 | MLX4_QP_ST_RD = 0x2, | 76 | MLX4_QP_ST_RD = 0x2, |
| 77 | MLX4_QP_ST_UD = 0x3, | 77 | MLX4_QP_ST_UD = 0x3, |
| 78 | MLX4_QP_ST_XRC = 0x6, | ||
| 79 | MLX4_QP_ST_MLX = 0x7 | 78 | MLX4_QP_ST_MLX = 0x7 |
| 80 | }; | 79 | }; |
| 81 | 80 | ||
| @@ -97,37 +96,9 @@ enum { | |||
| 97 | MLX4_QP_BIT_RIC = 1 << 4, | 96 | MLX4_QP_BIT_RIC = 1 << 4, |
| 98 | }; | 97 | }; |
| 99 | 98 | ||
| 100 | enum { | ||
| 101 | MLX4_RSS_HASH_XOR = 0, | ||
| 102 | MLX4_RSS_HASH_TOP = 1, | ||
| 103 | |||
| 104 | MLX4_RSS_UDP_IPV6 = 1 << 0, | ||
| 105 | MLX4_RSS_UDP_IPV4 = 1 << 1, | ||
| 106 | MLX4_RSS_TCP_IPV6 = 1 << 2, | ||
| 107 | MLX4_RSS_IPV6 = 1 << 3, | ||
| 108 | MLX4_RSS_TCP_IPV4 = 1 << 4, | ||
| 109 | MLX4_RSS_IPV4 = 1 << 5, | ||
| 110 | |||
| 111 | /* offset of mlx4_rss_context within mlx4_qp_context.pri_path */ | ||
| 112 | MLX4_RSS_OFFSET_IN_QPC_PRI_PATH = 0x24, | ||
| 113 | /* offset of being RSS indirection QP within mlx4_qp_context.flags */ | ||
| 114 | MLX4_RSS_QPC_FLAG_OFFSET = 13, | ||
| 115 | }; | ||
| 116 | |||
| 117 | struct mlx4_rss_context { | ||
| 118 | __be32 base_qpn; | ||
| 119 | __be32 default_qpn; | ||
| 120 | u16 reserved; | ||
| 121 | u8 hash_fn; | ||
| 122 | u8 flags; | ||
| 123 | __be32 rss_key[10]; | ||
| 124 | __be32 base_qpn_udp; | ||
| 125 | }; | ||
| 126 | |||
| 127 | struct mlx4_qp_path { | 99 | struct mlx4_qp_path { |
| 128 | u8 fl; | 100 | u8 fl; |
| 129 | u8 reserved1[1]; | 101 | u8 reserved1[2]; |
| 130 | u8 disable_pkey_check; | ||
| 131 | u8 pkey_index; | 102 | u8 pkey_index; |
| 132 | u8 counter_index; | 103 | u8 counter_index; |
| 133 | u8 grh_mylmc; | 104 | u8 grh_mylmc; |
| @@ -140,8 +111,7 @@ struct mlx4_qp_path { | |||
| 140 | u8 rgid[16]; | 111 | u8 rgid[16]; |
| 141 | u8 sched_queue; | 112 | u8 sched_queue; |
| 142 | u8 vlan_index; | 113 | u8 vlan_index; |
| 143 | u8 feup; | 114 | u8 reserved3[2]; |
| 144 | u8 reserved3; | ||
| 145 | u8 reserved4[2]; | 115 | u8 reserved4[2]; |
| 146 | u8 dmac[6]; | 116 | u8 dmac[6]; |
| 147 | }; | 117 | }; |
| @@ -167,7 +137,7 @@ struct mlx4_qp_context { | |||
| 167 | __be32 ssn; | 137 | __be32 ssn; |
| 168 | __be32 params2; | 138 | __be32 params2; |
| 169 | __be32 rnr_nextrecvpsn; | 139 | __be32 rnr_nextrecvpsn; |
| 170 | __be32 xrcd; | 140 | __be32 srcd; |
| 171 | __be32 cqn_recv; | 141 | __be32 cqn_recv; |
| 172 | __be64 db_rec_addr; | 142 | __be64 db_rec_addr; |
| 173 | __be32 qkey; | 143 | __be32 qkey; |
| @@ -212,12 +182,8 @@ struct mlx4_wqe_ctrl_seg { | |||
| 212 | * [4] IP checksum | 182 | * [4] IP checksum |
| 213 | * [3:2] C (generate completion queue entry) | 183 | * [3:2] C (generate completion queue entry) |
| 214 | * [1] SE (solicited event) | 184 | * [1] SE (solicited event) |
| 215 | * [0] FL (force loopback) | ||
| 216 | */ | 185 | */ |
| 217 | union { | 186 | __be32 srcrb_flags; |
| 218 | __be32 srcrb_flags; | ||
| 219 | __be16 srcrb_flags16[2]; | ||
| 220 | }; | ||
| 221 | /* | 187 | /* |
| 222 | * imm is immediate data for send/RDMA write w/ immediate; | 188 | * imm is immediate data for send/RDMA write w/ immediate; |
| 223 | * also invalidation key for send with invalidate; input | 189 | * also invalidation key for send with invalidate; input |
| @@ -235,8 +201,7 @@ struct mlx4_wqe_mlx_seg { | |||
| 235 | u8 owner; | 201 | u8 owner; |
| 236 | u8 reserved1[2]; | 202 | u8 reserved1[2]; |
| 237 | u8 opcode; | 203 | u8 opcode; |
| 238 | __be16 sched_prio; | 204 | u8 reserved2[3]; |
| 239 | u8 reserved2; | ||
| 240 | u8 size; | 205 | u8 size; |
| 241 | /* | 206 | /* |
| 242 | * [17] VL15 | 207 | * [17] VL15 |
