37 #include <linux/module.h>
52 static bool enable_qos;
54 MODULE_PARM_DESC(enable_qos,
"Enable Quality of Service support in the HCA (default: off)");
56 #define MLX4_GET(dest, source, offset) \
58 void *__p = (char *) (source) + (offset); \
59 switch (sizeof (dest)) { \
60 case 1: (dest) = *(u8 *) __p; break; \
61 case 2: (dest) = be16_to_cpup(__p); break; \
62 case 4: (dest) = be32_to_cpup(__p); break; \
63 case 8: (dest) = be64_to_cpup(__p); break; \
64 default: __buggy_use_of_MLX4_GET(); \
68 #define MLX4_PUT(dest, source, offset) \
70 void *__d = ((char *) (dest) + (offset)); \
71 switch (sizeof(source)) { \
72 case 1: *(u8 *) __d = (source); break; \
73 case 2: *(__be16 *) __d = cpu_to_be16(source); break; \
74 case 4: *(__be32 *) __d = cpu_to_be32(source); break; \
75 case 8: *(__be64 *) __d = cpu_to_be64(source); break; \
76 default: __buggy_use_of_MLX4_PUT(); \
82 static const char *
fname[] = {
83 [ 0] =
"RC transport",
84 [ 1] =
"UC transport",
85 [ 2] =
"UD transport",
86 [ 3] =
"XRC transport",
87 [ 4] =
"reliable multicast",
88 [ 5] =
"FCoIB support",
90 [ 7] =
"IPoIB checksum offload",
91 [ 8] =
"P_Key violation counter",
92 [ 9] =
"Q_Key violation counter",
95 [15] =
"Big LSO headers",
98 [18] =
"Atomic ops support",
99 [19] =
"Raw multicast support",
100 [20] =
"Address vector port checking support",
101 [21] =
"UD multicast support",
102 [24] =
"Demand paging support",
103 [25] =
"Router support",
104 [30] =
"IBoE support",
105 [32] =
"Unicast loopback support",
106 [34] =
"FCS header control",
107 [38] =
"Wake On LAN support",
108 [40] =
"UDP RSS support",
109 [41] =
"Unicast VEP steering support",
110 [42] =
"Multicast VEP steering support",
111 [48] =
"Counters support",
112 [59] =
"Port management change event support",
118 if (fname[i] && (flags & (1
LL << i)))
124 static const char *
const fname[] = {
126 [1] =
"RSS Toeplitz Hash Function support",
127 [2] =
"RSS XOR Hash Function support",
128 [3] =
"Device manage flow steering support"
133 if (fname[i] && (flags & (1
LL << i)))
143 #define MOD_STAT_CFG_IN_SIZE 0x100
145 #define MOD_STAT_CFG_PG_SZ_M_OFFSET 0x002
146 #define MOD_STAT_CFG_PG_SZ_OFFSET 0x003
150 return PTR_ERR(mailbox);
151 inbox = mailbox->
buf;
175 #define QUERY_FUNC_CAP_FLAGS_OFFSET 0x0
176 #define QUERY_FUNC_CAP_NUM_PORTS_OFFSET 0x1
177 #define QUERY_FUNC_CAP_PF_BHVR_OFFSET 0x4
178 #define QUERY_FUNC_CAP_FMR_OFFSET 0x8
179 #define QUERY_FUNC_CAP_QP_QUOTA_OFFSET 0x10
180 #define QUERY_FUNC_CAP_CQ_QUOTA_OFFSET 0x14
181 #define QUERY_FUNC_CAP_SRQ_QUOTA_OFFSET 0x18
182 #define QUERY_FUNC_CAP_MPT_QUOTA_OFFSET 0x20
183 #define QUERY_FUNC_CAP_MTT_QUOTA_OFFSET 0x24
184 #define QUERY_FUNC_CAP_MCG_QUOTA_OFFSET 0x28
185 #define QUERY_FUNC_CAP_MAX_EQ_OFFSET 0x2c
186 #define QUERY_FUNC_CAP_RESERVED_EQ_OFFSET 0x30
188 #define QUERY_FUNC_CAP_FMR_FLAG 0x80
189 #define QUERY_FUNC_CAP_FLAG_RDMA 0x40
190 #define QUERY_FUNC_CAP_FLAG_ETH 0x80
193 #define QUERY_FUNC_CAP_PHYS_PORT_OFFSET 0x3
194 #define QUERY_FUNC_CAP_RDMA_PROPS_OFFSET 0x8
195 #define QUERY_FUNC_CAP_ETH_PROPS_OFFSET 0xc
197 #define QUERY_FUNC_CAP_QP0_TUNNEL 0x10
198 #define QUERY_FUNC_CAP_QP0_PROXY 0x14
199 #define QUERY_FUNC_CAP_QP1_TUNNEL 0x18
200 #define QUERY_FUNC_CAP_QP1_PROXY 0x1c
202 #define QUERY_FUNC_CAP_ETH_PROPS_FORCE_MAC 0x40
203 #define QUERY_FUNC_CAP_ETH_PROPS_FORCE_VLAN 0x80
205 #define QUERY_FUNC_CAP_RDMA_PROPS_FORCE_PHY_WQE_GID 0x80
218 size = dev->
phys_caps.base_tunnel_sqpn + 8 * slave + field - 1;
224 size = dev->
phys_caps.base_proxy_sqpn + 8 * slave + field - 1;
235 field = dev->
caps.num_ports;
244 size = dev->
caps.num_qps;
247 size = dev->
caps.num_srqs;
250 size = dev->
caps.num_cqs;
253 size = dev->
caps.num_eqs;
256 size = dev->
caps.reserved_eqs;
259 size = dev->
caps.num_mpts;
262 size = dev->
caps.num_mtts;
265 size = dev->
caps.num_mgms + dev->
caps.num_amgms;
283 op_modifier = !!gen_or_port;
287 return PTR_ERR(mailbox);
289 err = mlx4_cmd_box(dev, 0, mailbox->
dma, gen_or_port, op_modifier,
295 outbox = mailbox->
buf;
300 mlx4_err(dev,
"The host supports neither eth nor rdma interfaces\n");
313 func_cap->
qp_quota = size & 0xFFFFFF;
319 func_cap->
cq_quota = size & 0xFFFFFF;
322 func_cap->
max_eq = size & 0xFFFFFF;
339 if (gen_or_port > dev->
caps.num_ports) {
347 mlx4_err(dev,
"VLAN is enforced on this port\n");
353 mlx4_err(dev,
"Force mac is enabled on this port\n");
361 "enforced on this ib port\n");
410 #define QUERY_DEV_CAP_OUT_SIZE 0x100
411 #define QUERY_DEV_CAP_MAX_SRQ_SZ_OFFSET 0x10
412 #define QUERY_DEV_CAP_MAX_QP_SZ_OFFSET 0x11
413 #define QUERY_DEV_CAP_RSVD_QP_OFFSET 0x12
414 #define QUERY_DEV_CAP_MAX_QP_OFFSET 0x13
415 #define QUERY_DEV_CAP_RSVD_SRQ_OFFSET 0x14
416 #define QUERY_DEV_CAP_MAX_SRQ_OFFSET 0x15
417 #define QUERY_DEV_CAP_RSVD_EEC_OFFSET 0x16
418 #define QUERY_DEV_CAP_MAX_EEC_OFFSET 0x17
419 #define QUERY_DEV_CAP_MAX_CQ_SZ_OFFSET 0x19
420 #define QUERY_DEV_CAP_RSVD_CQ_OFFSET 0x1a
421 #define QUERY_DEV_CAP_MAX_CQ_OFFSET 0x1b
422 #define QUERY_DEV_CAP_MAX_MPT_OFFSET 0x1d
423 #define QUERY_DEV_CAP_RSVD_EQ_OFFSET 0x1e
424 #define QUERY_DEV_CAP_MAX_EQ_OFFSET 0x1f
425 #define QUERY_DEV_CAP_RSVD_MTT_OFFSET 0x20
426 #define QUERY_DEV_CAP_MAX_MRW_SZ_OFFSET 0x21
427 #define QUERY_DEV_CAP_RSVD_MRW_OFFSET 0x22
428 #define QUERY_DEV_CAP_MAX_MTT_SEG_OFFSET 0x23
429 #define QUERY_DEV_CAP_MAX_AV_OFFSET 0x27
430 #define QUERY_DEV_CAP_MAX_REQ_QP_OFFSET 0x29
431 #define QUERY_DEV_CAP_MAX_RES_QP_OFFSET 0x2b
432 #define QUERY_DEV_CAP_MAX_GSO_OFFSET 0x2d
433 #define QUERY_DEV_CAP_RSS_OFFSET 0x2e
434 #define QUERY_DEV_CAP_MAX_RDMA_OFFSET 0x2f
435 #define QUERY_DEV_CAP_RSZ_SRQ_OFFSET 0x33
436 #define QUERY_DEV_CAP_ACK_DELAY_OFFSET 0x35
437 #define QUERY_DEV_CAP_MTU_WIDTH_OFFSET 0x36
438 #define QUERY_DEV_CAP_VL_PORT_OFFSET 0x37
439 #define QUERY_DEV_CAP_MAX_MSG_SZ_OFFSET 0x38
440 #define QUERY_DEV_CAP_MAX_GID_OFFSET 0x3b
441 #define QUERY_DEV_CAP_RATE_SUPPORT_OFFSET 0x3c
442 #define QUERY_DEV_CAP_MAX_PKEY_OFFSET 0x3f
443 #define QUERY_DEV_CAP_EXT_FLAGS_OFFSET 0x40
444 #define QUERY_DEV_CAP_FLAGS_OFFSET 0x44
445 #define QUERY_DEV_CAP_RSVD_UAR_OFFSET 0x48
446 #define QUERY_DEV_CAP_UAR_SZ_OFFSET 0x49
447 #define QUERY_DEV_CAP_PAGE_SZ_OFFSET 0x4b
448 #define QUERY_DEV_CAP_BF_OFFSET 0x4c
449 #define QUERY_DEV_CAP_LOG_BF_REG_SZ_OFFSET 0x4d
450 #define QUERY_DEV_CAP_LOG_MAX_BF_REGS_PER_PAGE_OFFSET 0x4e
451 #define QUERY_DEV_CAP_LOG_MAX_BF_PAGES_OFFSET 0x4f
452 #define QUERY_DEV_CAP_MAX_SG_SQ_OFFSET 0x51
453 #define QUERY_DEV_CAP_MAX_DESC_SZ_SQ_OFFSET 0x52
454 #define QUERY_DEV_CAP_MAX_SG_RQ_OFFSET 0x55
455 #define QUERY_DEV_CAP_MAX_DESC_SZ_RQ_OFFSET 0x56
456 #define QUERY_DEV_CAP_MAX_QP_MCG_OFFSET 0x61
457 #define QUERY_DEV_CAP_RSVD_MCG_OFFSET 0x62
458 #define QUERY_DEV_CAP_MAX_MCG_OFFSET 0x63
459 #define QUERY_DEV_CAP_RSVD_PD_OFFSET 0x64
460 #define QUERY_DEV_CAP_MAX_PD_OFFSET 0x65
461 #define QUERY_DEV_CAP_RSVD_XRC_OFFSET 0x66
462 #define QUERY_DEV_CAP_MAX_XRC_OFFSET 0x67
463 #define QUERY_DEV_CAP_MAX_COUNTERS_OFFSET 0x68
464 #define QUERY_DEV_CAP_FLOW_STEERING_RANGE_EN_OFFSET 0x76
465 #define QUERY_DEV_CAP_FLOW_STEERING_MAX_QP_OFFSET 0x77
466 #define QUERY_DEV_CAP_RDMARC_ENTRY_SZ_OFFSET 0x80
467 #define QUERY_DEV_CAP_QPC_ENTRY_SZ_OFFSET 0x82
468 #define QUERY_DEV_CAP_AUX_ENTRY_SZ_OFFSET 0x84
469 #define QUERY_DEV_CAP_ALTC_ENTRY_SZ_OFFSET 0x86
470 #define QUERY_DEV_CAP_EQC_ENTRY_SZ_OFFSET 0x88
471 #define QUERY_DEV_CAP_CQC_ENTRY_SZ_OFFSET 0x8a
472 #define QUERY_DEV_CAP_SRQ_ENTRY_SZ_OFFSET 0x8c
473 #define QUERY_DEV_CAP_C_MPT_ENTRY_SZ_OFFSET 0x8e
474 #define QUERY_DEV_CAP_MTT_ENTRY_SZ_OFFSET 0x90
475 #define QUERY_DEV_CAP_D_MPT_ENTRY_SZ_OFFSET 0x92
476 #define QUERY_DEV_CAP_BMME_FLAGS_OFFSET 0x94
477 #define QUERY_DEV_CAP_RSVD_LKEY_OFFSET 0x98
478 #define QUERY_DEV_CAP_MAX_ICM_SZ_OFFSET 0xa0
483 return PTR_ERR(mailbox);
484 outbox = mailbox->
buf;
494 dev_cap->
max_qps = 1 << (field & 0x1f);
498 dev_cap->
max_srqs = 1 << (field & 0x1f);
504 dev_cap->
max_cqs = 1 << (field & 0x1f);
506 dev_cap->
max_mpts = 1 << (field & 0x3f);
510 dev_cap->
max_eqs = 1 << (field & 0xf);
559 dev_cap->
flags = flags | (
u64)ext_flags << 32;
563 dev_cap->
uar_size = 1 << ((field & 0x3f) + 20);
575 mlx4_dbg(dev,
"BlueFlame available (reg size %d, regs/page %d)\n",
579 mlx4_dbg(dev,
"BlueFlame not available\n");
596 dev_cap->
max_pds = 1 << (field & 0x3f);
600 dev_cap->
max_xrcds = 1 << (field & 0x1f);
647 dev_cap->
max_vl[
i] = field >> 4;
649 dev_cap->
ib_mtu[
i] = field >> 4;
652 dev_cap->
max_gids[
i] = 1 << (field & 0xf);
657 #define QUERY_PORT_SUPPORTED_TYPE_OFFSET 0x00
658 #define QUERY_PORT_MTU_OFFSET 0x01
659 #define QUERY_PORT_ETH_MTU_OFFSET 0x02
660 #define QUERY_PORT_WIDTH_OFFSET 0x06
661 #define QUERY_PORT_MAX_GID_PKEY_OFFSET 0x07
662 #define QUERY_PORT_MAX_MACVLAN_OFFSET 0x0a
663 #define QUERY_PORT_MAX_VL_OFFSET 0x0b
664 #define QUERY_PORT_MAC_OFFSET 0x10
665 #define QUERY_PORT_TRANS_VENDOR_OFFSET 0x18
666 #define QUERY_PORT_WAVELENGTH_OFFSET 0x1c
667 #define QUERY_PORT_TRANS_CODE_OFFSET 0x20
680 dev_cap->
ib_mtu[
i] = field & 0xf;
684 dev_cap->
max_gids[
i] = 1 << (field >> 4);
687 dev_cap->
max_vl[
i] = field & 0xf;
701 mlx4_dbg(dev,
"Base MM extensions: flags %08x, rsvd L_Key %08x\n",
712 mlx4_dbg(dev,
"Max ICM size %lld MB\n",
713 (
unsigned long long) dev_cap->
max_icm_sz >> 20);
714 mlx4_dbg(dev,
"Max QPs: %d, reserved QPs: %d, entry size: %d\n",
716 mlx4_dbg(dev,
"Max SRQs: %d, reserved SRQs: %d, entry size: %d\n",
718 mlx4_dbg(dev,
"Max CQs: %d, reserved CQs: %d, entry size: %d\n",
720 mlx4_dbg(dev,
"Max EQs: %d, reserved EQs: %d, entry size: %d\n",
722 mlx4_dbg(dev,
"reserved MPTs: %d, reserved MTTs: %d\n",
724 mlx4_dbg(dev,
"Max PDs: %d, reserved PDs: %d, reserved UARs: %d\n",
726 mlx4_dbg(dev,
"Max QP/MCG: %d, reserved MGMs: %d\n",
728 mlx4_dbg(dev,
"Max CQEs: %d, max WQEs: %d, max SRQ WQEs: %d\n",
730 mlx4_dbg(dev,
"Local CA ACK delay: %d, max MTU: %d, port width cap: %d\n",
733 mlx4_dbg(dev,
"Max SQ desc size: %d, max SQ S/G: %d\n",
735 mlx4_dbg(dev,
"Max RQ desc size: %d, max RQ S/G: %d\n",
741 dump_dev_cap_flags(dev, dev_cap->
flags);
742 dump_dev_cap_flags2(dev, dev_cap->
flags2);
788 #define MLX4_VF_PORT_NO_LINK_SENSE_MASK 0xE0
789 #define QUERY_PORT_CUR_MAX_PKEY_OFFSET 0x0c
790 #define QUERY_PORT_CUR_MAX_GID_OFFSET 0x0e
796 if (!err && dev->
caps.function != slave) {
799 def_mac += slave << 8;
836 return PTR_ERR(mailbox);
838 err = mlx4_cmd_box(dev, 0, mailbox->
dma, port, 0,
844 outbox = mailbox->
buf;
847 *gid_tbl_len =
field;
850 *pkey_tbl_len =
field;
871 return PTR_ERR(mailbox);
873 pages = mailbox->
buf;
875 for (mlx4_icm_first(icm, &iter);
876 !mlx4_icm_last(&iter);
877 mlx4_icm_next(&iter)) {
883 lg =
ffs(mlx4_icm_addr(&iter) | mlx4_icm_size(&iter)) - 1;
885 mlx4_warn(dev,
"Got FW area not aligned to %d (%llx/%lx).\n",
887 (
unsigned long long) mlx4_icm_addr(&iter),
888 mlx4_icm_size(&iter));
893 for (i = 0; i < mlx4_icm_size(&iter) >> lg; ++
i) {
899 pages[nent * 2 + 1] =
902 ts += 1 << (lg - 10);
924 mlx4_dbg(dev,
"Mapped %d chunks/%d KB for FW.\n",
tc, ts);
927 mlx4_dbg(dev,
"Mapped %d chunks/%d KB for ICM aux.\n",
tc, ts);
930 mlx4_dbg(dev,
"Mapped %d chunks/%d KB at %llx for ICM.\n",
931 tc, ts, (
unsigned long long) virt - (ts << 10));
969 #define QUERY_FW_OUT_SIZE 0x100
970 #define QUERY_FW_VER_OFFSET 0x00
971 #define QUERY_FW_PPF_ID 0x09
972 #define QUERY_FW_CMD_IF_REV_OFFSET 0x0a
973 #define QUERY_FW_MAX_CMD_OFFSET 0x0f
974 #define QUERY_FW_ERR_START_OFFSET 0x30
975 #define QUERY_FW_ERR_SIZE_OFFSET 0x38
976 #define QUERY_FW_ERR_BAR_OFFSET 0x3c
978 #define QUERY_FW_SIZE_OFFSET 0x00
979 #define QUERY_FW_CLR_INT_BASE_OFFSET 0x20
980 #define QUERY_FW_CLR_INT_BAR_OFFSET 0x28
982 #define QUERY_FW_COMM_BASE_OFFSET 0x40
983 #define QUERY_FW_COMM_BAR_OFFSET 0x48
987 return PTR_ERR(mailbox);
988 outbox = mailbox->
buf;
1000 dev->
caps.fw_ver = (fw_ver & 0xffff00000000ull) |
1001 ((fw_ver & 0xffff0000ull) >> 16) |
1002 ((fw_ver & 0x0000ffffull) << 16);
1005 dev->
caps.function = lg;
1007 if (mlx4_is_slave(dev))
1014 mlx4_err(dev,
"Installed FW has unsupported "
1015 "command interface revision %d.\n",
1017 mlx4_err(dev,
"(Installed FW version is %d.%d.%03d)\n",
1018 (
int) (dev->
caps.fw_ver >> 32),
1019 (
int) (dev->
caps.fw_ver >> 16) & 0xffff,
1020 (
int) dev->
caps.fw_ver & 0xffff);
1021 mlx4_err(dev,
"This driver version supports only revisions %d to %d.\n",
1033 mlx4_dbg(dev,
"FW version %d.%d.%03d (cmd intf rev %d), max commands %d\n",
1034 (
int) (dev->
caps.fw_ver >> 32),
1035 (
int) (dev->
caps.fw_ver >> 16) & 0xffff,
1036 (
int) dev->
caps.fw_ver & 0xffff,
1044 mlx4_dbg(dev,
"Catastrophic error buffer at 0x%llx, size 0x%x, BAR %d\n",
1055 mlx4_dbg(dev,
"Communication vector bar:%d offset:0x%llx\n",
1067 mlx4_dbg(dev,
"Clear int @ %llx, BAR %d\n",
1084 outbuf = outbox->
buf;
1092 outbuf[0] = outbuf[1] = 0;
1099 static void get_board_id(
void *vsd,
char *
board_id)
1103 #define VSD_OFFSET_SIG1 0x00
1104 #define VSD_OFFSET_SIG2 0xde
1105 #define VSD_OFFSET_MLX_BOARD_ID 0xd0
1106 #define VSD_OFFSET_TS_BOARD_ID 0x20
1108 #define VSD_SIGNATURE_TOPSPIN 0x5ad
1112 if (
be16_to_cpup(vsd + VSD_OFFSET_SIG1) == VSD_SIGNATURE_TOPSPIN &&
1113 be16_to_cpup(vsd + VSD_OFFSET_SIG2) == VSD_SIGNATURE_TOPSPIN) {
1121 for (i = 0; i < 4; ++
i)
1122 ((
u32 *) board_id)[
i] =
1123 swab32(*(
u32 *) (vsd + VSD_OFFSET_MLX_BOARD_ID + i * 4));
1133 #define QUERY_ADAPTER_OUT_SIZE 0x100
1134 #define QUERY_ADAPTER_INTA_PIN_OFFSET 0x10
1135 #define QUERY_ADAPTER_VSD_OFFSET 0x20
1138 if (IS_ERR(mailbox))
1139 return PTR_ERR(mailbox);
1140 outbox = mailbox->
buf;
1163 #define INIT_HCA_IN_SIZE 0x200
1164 #define INIT_HCA_VERSION_OFFSET 0x000
1165 #define INIT_HCA_VERSION 2
1166 #define INIT_HCA_CACHELINE_SZ_OFFSET 0x0e
1167 #define INIT_HCA_FLAGS_OFFSET 0x014
1168 #define INIT_HCA_QPC_OFFSET 0x020
1169 #define INIT_HCA_QPC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x10)
1170 #define INIT_HCA_LOG_QP_OFFSET (INIT_HCA_QPC_OFFSET + 0x17)
1171 #define INIT_HCA_SRQC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x28)
1172 #define INIT_HCA_LOG_SRQ_OFFSET (INIT_HCA_QPC_OFFSET + 0x2f)
1173 #define INIT_HCA_CQC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x30)
1174 #define INIT_HCA_LOG_CQ_OFFSET (INIT_HCA_QPC_OFFSET + 0x37)
1175 #define INIT_HCA_EQE_CQE_OFFSETS (INIT_HCA_QPC_OFFSET + 0x38)
1176 #define INIT_HCA_ALTC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x40)
1177 #define INIT_HCA_AUXC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x50)
1178 #define INIT_HCA_EQC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x60)
1179 #define INIT_HCA_LOG_EQ_OFFSET (INIT_HCA_QPC_OFFSET + 0x67)
1180 #define INIT_HCA_RDMARC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x70)
1181 #define INIT_HCA_LOG_RD_OFFSET (INIT_HCA_QPC_OFFSET + 0x77)
1182 #define INIT_HCA_MCAST_OFFSET 0x0c0
1183 #define INIT_HCA_MC_BASE_OFFSET (INIT_HCA_MCAST_OFFSET + 0x00)
1184 #define INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x12)
1185 #define INIT_HCA_LOG_MC_HASH_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x16)
1186 #define INIT_HCA_UC_STEERING_OFFSET (INIT_HCA_MCAST_OFFSET + 0x18)
1187 #define INIT_HCA_LOG_MC_TABLE_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x1b)
1188 #define INIT_HCA_DEVICE_MANAGED_FLOW_STEERING_EN 0x6
1189 #define INIT_HCA_FS_PARAM_OFFSET 0x1d0
1190 #define INIT_HCA_FS_BASE_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x00)
1191 #define INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x12)
1192 #define INIT_HCA_FS_LOG_TABLE_SZ_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x1b)
1193 #define INIT_HCA_FS_ETH_BITS_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x21)
1194 #define INIT_HCA_FS_ETH_NUM_ADDRS_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x22)
1195 #define INIT_HCA_FS_IB_BITS_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x25)
1196 #define INIT_HCA_FS_IB_NUM_ADDRS_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x26)
1197 #define INIT_HCA_TPT_OFFSET 0x0f0
1198 #define INIT_HCA_DMPT_BASE_OFFSET (INIT_HCA_TPT_OFFSET + 0x00)
1199 #define INIT_HCA_LOG_MPT_SZ_OFFSET (INIT_HCA_TPT_OFFSET + 0x0b)
1200 #define INIT_HCA_MTT_BASE_OFFSET (INIT_HCA_TPT_OFFSET + 0x10)
1201 #define INIT_HCA_CMPT_BASE_OFFSET (INIT_HCA_TPT_OFFSET + 0x18)
1202 #define INIT_HCA_UAR_OFFSET 0x120
1203 #define INIT_HCA_LOG_UAR_SZ_OFFSET (INIT_HCA_UAR_OFFSET + 0x0a)
1204 #define INIT_HCA_UAR_PAGE_SZ_OFFSET (INIT_HCA_UAR_OFFSET + 0x0b)
1207 if (IS_ERR(mailbox))
1208 return PTR_ERR(mailbox);
1209 inbox = mailbox->
buf;
1218 #if defined(__LITTLE_ENDIAN)
1220 #elif defined(__BIG_ENDIAN)
1223 #error Host endianness not defined
1256 if (dev->
caps.steering_mode ==
1310 mlx4_err(dev,
"INIT_HCA returns %d\n", err);
1323 #define QUERY_HCA_GLOBAL_CAPS_OFFSET 0x04
1326 if (IS_ERR(mailbox))
1327 return PTR_ERR(mailbox);
1328 outbox = mailbox->
buf;
1330 err = mlx4_cmd_box(dev, 0, mailbox->
dma, 0, 0,
1333 !mlx4_is_slave(dev));
1355 if (dev->
caps.steering_mode ==
1394 static int check_qp0_state(
struct mlx4_dev *dev,
int function,
int port)
1398 if (priv->
mfunc.master.qp0_state[port].proxy_qp0_active &&
1399 priv->
mfunc.master.qp0_state[port].qp0_active)
1414 if (priv->
mfunc.master.slave_state[slave].init_port_mask & (1 << port))
1419 if (!priv->
mfunc.master.init_port_ref[port]) {
1425 priv->
mfunc.master.slave_state[slave].init_port_mask |= (1 <<
port);
1427 if (slave == mlx4_master_func_num(dev)) {
1428 if (check_qp0_state(dev, slave, port) &&
1429 !priv->
mfunc.master.qp0_state[
port].port_active) {
1434 priv->
mfunc.master.qp0_state[
port].port_active = 1;
1435 priv->
mfunc.master.slave_state[slave].init_port_mask |= (1 <<
port);
1438 priv->
mfunc.master.slave_state[slave].init_port_mask |= (1 <<
port);
1440 ++priv->
mfunc.master.init_port_ref[
port];
1453 #define INIT_PORT_IN_SIZE 256
1454 #define INIT_PORT_FLAGS_OFFSET 0x00
1455 #define INIT_PORT_FLAG_SIG (1 << 18)
1456 #define INIT_PORT_FLAG_NG (1 << 17)
1457 #define INIT_PORT_FLAG_G0 (1 << 16)
1458 #define INIT_PORT_VL_SHIFT 4
1459 #define INIT_PORT_PORT_WIDTH_SHIFT 8
1460 #define INIT_PORT_MTU_OFFSET 0x04
1461 #define INIT_PORT_MAX_GID_OFFSET 0x06
1462 #define INIT_PORT_MAX_PKEY_OFFSET 0x0a
1463 #define INIT_PORT_GUID0_OFFSET 0x10
1464 #define INIT_PORT_NODE_GUID_OFFSET 0x18
1465 #define INIT_PORT_SI_GUID_OFFSET 0x20
1468 if (IS_ERR(mailbox))
1469 return PTR_ERR(mailbox);
1470 inbox = mailbox->
buf;
1479 field = 128 << dev->
caps.ib_mtu_cap[
port];
1481 field = dev->
caps.gid_table_len[
port];
1483 field = dev->
caps.pkey_table_len[
port];
1508 if (!(priv->
mfunc.master.slave_state[slave].init_port_mask &
1513 if (priv->
mfunc.master.init_port_ref[port] == 1) {
1519 priv->
mfunc.master.slave_state[slave].init_port_mask &= ~(1 <<
port);
1522 if (slave == mlx4_master_func_num(dev)) {
1523 if (!priv->
mfunc.master.qp0_state[port].qp0_active &&
1524 priv->
mfunc.master.qp0_state[port].port_active) {
1529 priv->
mfunc.master.slave_state[slave].init_port_mask &= ~(1 <<
port);
1530 priv->
mfunc.master.qp0_state[
port].port_active = 0;
1533 priv->
mfunc.master.slave_state[slave].init_port_mask &= ~(1 <<
port);
1535 --priv->
mfunc.master.init_port_ref[
port];
1554 int ret = mlx4_cmd_imm(dev, icm_size, aux_pages, 0, 0,
1576 #define MLX4_WOL_SETUP_MODE (5 << 28)
1581 return mlx4_cmd_imm(dev, 0, config, in_mod, 0x3,