4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
26 #ifndef _SYS_IB_ADAPTERS_HERMON_HW_H
27 #define _SYS_IB_ADAPTERS_HERMON_HW_H
31 * Contains all the structure definitions and #defines for all Hermon
32 * hardware resources and registers (as defined by the Hermon register
33 * specification). Wherever possible, the names in the Hermon spec
34 * have been preserved in the structure and field names below.
37 #include <sys/types.h>
40 #include <sys/sunddi.h>
48 * PCI IDs for supported chipsets
50 #define PCI_VENID_MLX 0x15b3
51 #define PCI_DEVID_HERMON_SDR 0x6340 /* Mellanox MT25208-SDR PCIe Gen1 */
52 #define PCI_DEVID_HERMON_DDR 0x634A /* Mellanox MT25208-DDR PCIe Gen1 */
53 #define PCI_DEVID_HERMON_DDRG2 0x6732 /* Mellanox MT25208-DDR PCIe Gen2 */
54 #define PCI_DEVID_HERMON_QDRG2 0x673C /* Mellanox MT25208-QDR PCIe Gen2 */
55 #define PCI_DEVID_HERMON_QDRG2V 0x6746 /* Mellanox MT25208-QDR PCIe Gen2 */
56 #define PCI_DEVID_HERMON_MAINT 0x0191 /* Maintenance/Mem Controller Mode */
59 * Native page size of the adapter
61 #define HERMON_PAGESIZE 0x1000 /* 4Kb */
62 #define HERMON_PAGEOFFSET (HERMON_PAGESIZE - 1)
63 #define HERMON_PAGEMASK (~HERMON_PAGEOFFSET)
64 #define HERMON_PAGESHIFT 0xC /* 12 */
67 * Offsets into the CMD BAR (BAR 0) for many of the more interesting hardware
68 * registers. These registers include the HCR (more below), and the software
69 * reset register (SW_RESET).
71 #define HERMON_CMD_HCR_OFFSET 0x80680 /* PRM */
72 #define HERMON_CMD_SW_RESET_OFFSET 0xF0010 /* PRM */
73 #define HERMON_CMD_SW_SEMAPHORE_OFFSET 0xF03FC /* PRM */
74 #define HERMON_CMD_OFFSET_MASK 0xFFFFF /* per MLX instruction */
78 * Ownership flags used to define hardware or software ownership for
79 * various Hermon resources
81 #define HERMON_HW_OWNER 0x1
82 #define HERMON_SW_OWNER 0x0
85 * Determines whether or not virtual-to-physical address translation is
86 * required. Several of the Hermon hardware structures can be optionally
87 * accessed by Hermon without going through the TPT address translation
90 #define HERMON_VA2PA_XLAT_ENABLED 0x1
91 #define HERMON_VA2PA_XLAT_DISABLED 0x0
94 * HCA Command Register (HCR)
95 * The HCR command interface provides privileged access to the HCA in
96 * order to query, configure and modify HCA execution. It is the
97 * primary mechanism through which mailboxes may be posted to Hermon
98 * firmware. To use this interface software fills the HCR with pointers
99 * to input and output mailboxes. Some commands support immediate
100 * parameters, however, and for these commands the HCR will contain the
101 * input or output parameters. Command execution completion can be
102 * detected either by the software polling the HCR or by waiting for a
103 * command completion event.
105 struct hermon_hw_hcr_s
{
108 uint32_t input_modifier
;
114 #define HERMON_HCR_TOKEN_MASK 0xFFFF0000
115 #define HERMON_HCR_TOKEN_SHIFT 16
117 #define HERMON_HCR_CMD_STATUS_MASK 0xFF000000
118 #define HERMON_HCR_CMD_GO_MASK 0x00800000
119 #define HERMON_HCR_CMD_E_MASK 0x00400000
120 #define HERMON_HCR_CMD_T_MASK 0x00200000
121 #define HERMON_HCR_CMD_OPMOD_MASK 0x0000F000
122 #define HERMON_HCR_CMD_OPCODE_MASK 0x00000FFF
123 #define HERMON_HCR_CMD_STATUS_SHFT 24
124 #define HERMON_HCR_CMD_GO_SHFT 23
125 #define HERMON_HCR_CMD_E_SHFT 22
126 #define HERMON_HCR_CMD_T_SHFT 21
127 #define HERMON_HCR_CMD_OPMOD_SHFT 12
130 * Arbel/tavor "QUERY_DEV_LIM" == Hermon "QUERY_DEV_CAP" - Same hex code
131 * same function as tavor/arbel QUERY_DEV_LIM, just renamed (whatever).
132 * The QUERY_DEV_LIM command returns the device limits and capabilities
133 * supported by the Hermon device. This command must be run before
134 * running the INIT_HCA command (below) in order to determine the maximum
135 * capabilities of the device and which optional features are supported.
137 #ifdef _LITTLE_ENDIAN
138 struct hermon_hw_querydevlim_s
{
141 uint32_t log_max_scqs
:4;
143 uint32_t num_rsvd_scqs
:6;
145 uint32_t log_max_srq
:5;
147 uint32_t log_rsvd_srq
:4;
149 uint32_t log_max_qp
:5;
151 uint32_t log_rsvd_qp
:4;
153 uint32_t log_max_qp_sz
:8;
154 uint32_t log_max_srq_sz
:8;
156 uint32_t log_max_eq
:4;
158 uint32_t num_rsvd_eq
:4;
160 uint32_t log_max_dmpt
:6;
162 uint32_t log_max_eq_sz
:8;
164 uint32_t log_max_cq
:5;
166 uint32_t log_rsvd_cq
:4;
168 uint32_t log_max_cq_sz
:8;
174 uint32_t log_max_mtt
:6;
176 uint32_t log_rsvd_dmpt
:4;
178 uint32_t log_max_mrw_sz
:7;
180 uint32_t log_rsvd_mtt
:4;
182 uint32_t log_max_ra_glob
:6;
184 uint32_t log_max_rss_tbl_sz
:4;
185 uint32_t rss_toep
:1; /* rss toeplitz hashing */
186 uint32_t rss_xor
:1; /* rss xor hashing */
188 uint32_t log_max_gso_sz
:5; /* Lge Send Offload */
189 uint32_t :11; /* new w/ 0.35, RSS info */
191 uint32_t log_max_ra_res_qp
:6;
193 uint32_t log_max_ra_req_qp
:6;
196 uint32_t num_ports
:4;
198 uint32_t ca_ack_delay
:5;
199 uint32_t cqmep
:3; /* cq moderation policies */
204 uint32_t mod_wr_srq
:1; /* resize SRQ supported */
208 uint32_t stat_rate_sup
:16;
214 uint32_t log_max_msg
:5;
217 uint32_t rc
:1; /* 0x44 */
224 uint32_t ipoib_cksm
:1;
229 uint32_t dpdp
:1; /* dual port diff protocol */
230 uint32_t raw_etype
:1;
231 uint32_t raw_ipv4
:1;
232 uint32_t blh
:1; /* big LSO header, bit in WQE */
236 uint32_t raw_multi
:1;
238 uint32_t ud_multi
:1;
239 uint32_t udm_ipv4
:1;
240 uint32_t dif
:1; /* DIF supported */
241 uint32_t pg_on_demand
:1;
243 uint32_t l2mc
:1; /* lev 2 enet multicast */
245 uint32_t ud_swp
:1; /* sw parse for UD xport */
246 uint32_t ipv6_ex
:1; /* offload w/ IPV6 ext hdrs */
247 uint32_t lle
:1; /* low latency enet */
248 uint32_t fcoe_t11
:1; /* fcoenet T11 frame support */
251 uint32_t eth_uc_lb
:1; /* enet unicast loopback */
253 uint32_t hdr_split
:1;
254 uint32_t hdr_lookahead
:1;
260 uint32_t log_max_bf_page
:6; /* 0x4c */
262 uint32_t log_max_bf_req_ppg
:6;
264 uint32_t log_bf_reg_sz
:5;
268 uint32_t log_pg_sz
:8; /* 0x48 */
270 uint32_t log_max_uar_sz
:6;
272 uint32_t num_rsvd_uar
:4;
274 uint32_t max_desc_sz_rq
:16; /* 0x54 */
275 uint32_t max_sg_rq
:8;
278 uint32_t max_desc_sz_sq
:16; /* 0x50 */
279 uint32_t max_sg_sq
:8;
283 uint32_t rsvd_fcoib
; /* 0x5C */
285 uint32_t :1; /* 0x58 */
286 uint32_t fexch_base_mpt
:7; /* FC exch base mpt num */
287 uint32_t fcp_ud_base_qp
:16; /* RC UD base qp num */
288 uint32_t fexch_base_qp
:8; /* FC exch base qp num */
291 uint32_t log_max_xrcd
:5; /* 0x64 */
293 uint32_t num_rsvd_xrcds
:4;
294 uint32_t log_max_pd
:5;
296 uint32_t num_rsvd_pd
:4;
298 uint32_t log_max_mcg
:8; /* 0x60 */
299 uint32_t num_rsvd_mcg
:4;
301 uint32_t log_max_qp_mcg
:8;
306 uint32_t altc_entry_sz
:16; /* 0x84 */
307 uint32_t aux_entry_sz
:16;
309 uint32_t qpc_entry_sz
:16; /* 0x80 */
310 uint32_t rdmardc_entry_sz
:16;
312 uint32_t cmpt_entry_sz
:16; /* 0x8C */
313 uint32_t srq_entry_sz
:16;
315 uint32_t cqc_entry_sz
:16; /* 0x88 */
316 uint32_t eqc_entry_sz
:16;
318 uint32_t bmme
:1; /* 0x94 */
319 uint32_t win_type
:1;
324 uint32_t local_inv
:1;
325 uint32_t remote_inv
:1;
327 uint32_t win_type2
:1;
328 uint32_t reserved_lkey
:1;
329 uint32_t fast_reg_wr
:1;
332 uint32_t dmpt_entry_sz
:16; /* 0x90 */
333 uint32_t mtt_entry_sz
:16;
339 uint64_t max_icm_size
;
344 #else /* BIG ENDIAN */
346 struct hermon_hw_querydevlim_s
{
349 uint32_t log_max_srq_sz
:8;
350 uint32_t log_max_qp_sz
:8;
352 uint32_t log_rsvd_qp
:4;
354 uint32_t log_max_qp
:5;
356 uint32_t log_rsvd_srq
:4;
358 uint32_t log_max_srq
:5;
360 uint32_t num_rsvd_scqs
:6;
362 uint32_t log_max_scqs
:4;
365 uint32_t log_max_cq_sz
:8;
367 uint32_t log_rsvd_cq
:4;
369 uint32_t log_max_cq
:5;
371 uint32_t log_max_eq_sz
:8;
373 uint32_t log_max_dmpt
:6;
375 uint32_t num_rsvd_eq
:4;
377 uint32_t log_max_eq
:4;
379 uint32_t log_rsvd_mtt
:4;
381 uint32_t log_max_mrw_sz
:7;
383 uint32_t log_rsvd_dmpt
:4;
385 uint32_t log_max_mtt
:6;
390 uint32_t log_max_ra_req_qp
:6;
392 uint32_t log_max_ra_res_qp
:6;
394 uint32_t :11; /* new w/ 0.35, RSS info */
395 uint32_t log_max_gso_sz
:5; /* Lge Send Offload */
397 uint32_t rss_xor
:1; /* rss xor hashing */
398 uint32_t rss_toep
:1; /* rss toeplitz hashing */
399 uint32_t log_max_rss_tbl_sz
:4;
401 uint32_t log_max_ra_glob
:6;
404 uint32_t mod_wr_srq
:1; /* resize SRQ supported */
409 uint32_t cqmep
:3; /* cq moderation policies */
410 uint32_t ca_ack_delay
:5;
412 uint32_t num_ports
:4;
415 uint32_t log_max_msg
:5;
421 uint32_t stat_rate_sup
:16;
424 uint32_t :16; /* 0x40 */
428 uint32_t hdr_lookahead
:1;
429 uint32_t hdr_split
:1;
431 uint32_t eth_uc_lb
:1; /* enet unicast loopback */
433 uint32_t fcoe_t11
:1; /* fcoenet T11 frame support */
434 uint32_t lle
:1; /* low latency enet */
435 uint32_t ipv6_ex
:1; /* offload w/ IPV6 ext hdrs */
436 uint32_t ud_swp
:1; /* sw parse for UD xport */
438 uint32_t l2mc
:1; /* lev 2 enet multicast */
440 uint32_t pg_on_demand
:1;
441 uint32_t dif
:1; /* DIF supported */
442 uint32_t udm_ipv4
:1;
443 uint32_t ud_multi
:1;
445 uint32_t raw_multi
:1;
449 uint32_t blh
:1; /* big LSO header, bit in WQE */
450 uint32_t raw_ipv4
:1;
451 uint32_t raw_etype
:1;
452 uint32_t dpdp
:1; /* dual port diff protocol */
457 uint32_t ipoib_cksm
:1;
466 uint32_t num_rsvd_uar
:4; /* 0x48 */
468 uint32_t log_max_uar_sz
:6;
470 uint32_t log_pg_sz
:8;
472 uint32_t blu_flm
:1; /* 0x4c */
474 uint32_t log_bf_reg_sz
:5;
476 uint32_t log_max_bf_req_ppg
:6;
478 uint32_t log_max_bf_page
:6;
480 uint32_t :8; /* 0x50 */
481 uint32_t max_sg_sq
:8;
482 uint32_t max_desc_sz_sq
:16;
484 uint32_t :8; /* 0x54 */
485 uint32_t max_sg_rq
:8;
486 uint32_t max_desc_sz_rq
:16;
489 uint32_t fexch_base_qp
:8; /* FC exch base qp num */
490 uint32_t fcp_ud_base_qp
:16; /* RC UD base qp num */
491 uint32_t fexch_base_mpt
:7; /* FC exch base mpt num */
494 uint32_t rsvd_fcoib
; /* 0x5C */
496 uint32_t :8; /* 0x60 */
497 uint32_t log_max_qp_mcg
:8;
499 uint32_t num_rsvd_mcg
:4;
500 uint32_t log_max_mcg
:8;
502 uint32_t num_rsvd_pd
:4; /* 0x64 */
504 uint32_t log_max_pd
:5;
505 uint32_t num_rsvd_xrcds
:4;
507 uint32_t log_max_xrcd
:5;
511 uint32_t rdmardc_entry_sz
:16; /* 0x80 */
512 uint32_t qpc_entry_sz
:16;
514 uint32_t aux_entry_sz
:16; /* 0x84 */
515 uint32_t altc_entry_sz
:16;
517 uint32_t eqc_entry_sz
:16; /* 0x88 */
518 uint32_t cqc_entry_sz
:16;
520 uint32_t srq_entry_sz
:16; /* 0x8C */
521 uint32_t cmpt_entry_sz
:16;
523 uint32_t mtt_entry_sz
:16; /* 0x90 */
524 uint32_t dmpt_entry_sz
:16;
526 uint32_t :20; /* 0x94 */
527 uint32_t fast_reg_wr
:1;
528 uint32_t reserved_lkey
:1;
529 uint32_t win_type2
:1;
531 uint32_t remote_inv
:1;
532 uint32_t local_inv
:1;
537 uint32_t win_type
:1;
544 uint64_t max_icm_size
;
553 * Hermon "QUERY_FW" command
554 * The QUERY_FW command retrieves the firmware revision and the Command
555 * Interface revision. The command also returns the HCA attached local
556 * memory area (DDR) which is used by the firmware. Below we also
557 * include some defines which are used to enforce a minimum firmware
558 * version check (see hermon_fw_version_check() for more details).
561 #ifdef _LITTLE_ENDIAN
562 struct hermon_hw_queryfw_s
{
563 uint32_t fw_rev_minor
:16;
564 uint32_t fw_rev_subminor
:16;
566 uint32_t fw_rev_major
:16;
567 uint32_t fw_pages
:16;
569 uint32_t log_max_cmd
:8;
571 uint32_t dbg_trace
:1;
573 uint32_t cmd_intf_rev
:16;
577 uint32_t fw_month
:8;
578 uint32_t fw_year
:16;
581 uint32_t ccq
:1; /* currently not def'd */
589 uint64_t clr_intr_offs
;
594 uint32_t clr_int_bar
:2;
596 uint64_t error_buf_addr
;
599 uint32_t err_buf_bar
:2;
601 uint32_t error_buf_sz
;
603 uint64_t vf_com_ch_addr
;
608 uint32_t vf_com_ch_bar
:2;
612 #else /* BIG ENDIAN */
613 struct hermon_hw_queryfw_s
{
614 uint32_t fw_pages
:16;
615 uint32_t fw_rev_major
:16;
617 uint32_t fw_rev_subminor
:16;
618 uint32_t fw_rev_minor
:16;
621 uint32_t cmd_intf_rev
:16;
623 uint32_t dbg_trace
:1;
625 uint32_t log_max_cmd
:8;
631 uint32_t ccq
:1; /* currently not def'd */
634 uint32_t fw_year
:16;
635 uint32_t fw_month
:8;
640 uint64_t clr_intr_offs
;
642 uint32_t clr_int_bar
:2;
647 uint64_t error_buf_addr
;
649 uint32_t error_buf_sz
;
651 uint32_t err_buf_bar
:2;
654 uint64_t vf_com_ch_addr
;
656 uint32_t vf_com_ch_bar
:2;
666 * 2.6.000 is critical for some performance features, e.g., Reserved_Lkey,
667 * and 2.7.000 is needed for FRWR and FCoIB. Requiring 2.6.000 now so that
668 * existing customers get the performance, but are not required to upgrade
669 * to the latest. Less than 2.6.000 will cause the driver to attach in
670 * maintenance mode, and throw an FMA event about upgrading the firmware.
673 #define HERMON_FW_VER_MAJOR 0x0002
674 #define HERMON_FW_VER_MINOR 0x0006
675 #define HERMON_FW_VER_SUBMINOR 0x0000
678 * Hermon "QUERY_ADAPTER" command
679 * The QUERY_ADAPTER command retrieves adapter specific parameters. The
680 * command also retrieves the PCI(X) interrupt pin routing for each of
681 * the INTx# pins supported by the device. This information is used by
682 * the driver during interrupt processing in order to clear the appropriate
685 #ifdef _LITTLE_ENDIAN
686 struct hermon_hw_queryadapter_s
{
692 uint32_t inta_pin
:8;
694 uint32_t vsd_vend_id
:16; /* added v35 hermon */
703 struct hermon_hw_queryadapter_s
{
706 uint32_t inta_pin
:8;
714 uint32_t vsd_vend_id
:16; /* added v35 hermon */
720 #define HERMON_REV_A0 0xA0
721 #define HERMON_REV_A1 0xA1
724 * Virtual physical mapping structure for: MAP_FA, MAP_ICM_AUX, and
728 #ifdef _LITTLE_ENDIAN
729 struct hermon_hw_vpm_s
{
731 uint32_t vaddr_l
:20;
735 uint32_t log2sz
:5; /* in 4KB pages */
737 uint32_t paddr_l
:20;
742 struct hermon_hw_vpm_s
{
745 uint32_t vaddr_l
:20;
750 uint32_t paddr_l
:20;
752 uint32_t log2sz
:5; /* in 4KB pages */
760 * Hermon "INIT_HCA" and "QUERY_HCA" commands
761 * The INIT_HCA command configures all HCA resources in HCA attached local
762 * memory and some system relevant information. The same mailbox output
763 * format is used by the QUERY_HCA command. All parameters, which are
764 * specifically the output of the QUERY_HCA command are marked as
765 * "QUERY_HCA only". These parameters are not configurable through the
766 * INIT_HCA command, but can be retrieved as read-only through the
769 * Below we first define several structures which help make up the whole
770 * of the INIT_HCA/QUERY_HCA command. These are:
771 * hermon_hw_qp_ee_cq_eq_rdb_t for "QPC/EEC/CQC/EQC/RDB Parameters",
772 * hermon_udav_mem_param_t for "Memory Access Parameters for UDAV Table",
773 * hermon_multicast_param_t for "Multicast Support Parameters",
774 * hermon_tpt_param_t for "Translation and Protection Table Parameters",
775 * and hermon_uar_param_t for Hermon "UAR Parameters".
779 * need to consider removing any ref to "ee", hermon doesn't support
780 * ee/rd stuff, and they've taken away the pretense
784 #ifdef _LITTLE_ENDIAN
785 typedef struct hermon_hw_qp_ee_cq_eq_rdb_s
{
788 uint32_t log_num_qp
:5;
789 uint32_t qpc_baseaddr_l
:27;
790 uint32_t qpc_baseaddr_h
;
794 uint32_t log_num_srq
:5;
795 uint32_t srqc_baseaddr_l
:27;
796 uint32_t srqc_baseaddr_h
;
798 uint32_t log_num_cq
:5;
799 uint32_t cqc_baseaddr_l
:27;
800 uint32_t cqc_baseaddr_h
;
804 uint64_t altc_baseaddr
;
808 uint64_t auxc_baseaddr
;
812 uint32_t log_num_eq
:5;
813 uint32_t eqc_baseaddr_l
:27;
814 uint32_t eqc_baseaddr_h
;
818 uint32_t log_num_rdmardc
:3;
820 uint32_t rdmardc_baseaddr_l
:27;
821 uint32_t rdmardc_baseaddr_h
;
824 } hermon_hw_qp_ee_cq_eq_rdb_t
;
825 #else /* BIG ENDIAN */
826 typedef struct hermon_hw_qp_ee_cq_eq_rdb_s
{
829 uint32_t qpc_baseaddr_h
;
830 uint32_t qpc_baseaddr_l
:27;
831 uint32_t log_num_qp
:5;
835 uint32_t srqc_baseaddr_h
;
836 uint32_t srqc_baseaddr_l
:27;
837 uint32_t log_num_srq
:5;
839 uint32_t cqc_baseaddr_h
;
840 uint32_t cqc_baseaddr_l
:27;
841 uint32_t log_num_cq
:5;
845 uint64_t altc_baseaddr
;
849 uint64_t auxc_baseaddr
;
853 uint32_t eqc_baseaddr_h
;
854 uint32_t eqc_baseaddr_l
:27;
855 uint32_t log_num_eq
:5;
859 uint32_t rdmardc_baseaddr_h
;
860 uint32_t rdmardc_baseaddr_l
:27;
862 uint32_t log_num_rdmardc
:3;
865 } hermon_hw_qp_ee_cq_eq_rdb_t
;
871 #ifdef _LITTLE_ENDIAN
872 typedef struct hermon_multicast_param_s
{
873 uint64_t mc_baseaddr
;
877 uint32_t log_mc_tbl_hash_sz
:5;
880 uint32_t log_mc_tbl_ent
:5;
885 uint32_t log_mc_tbl_sz
:5;
887 uint32_t mc_hash_fn
:3;
889 } hermon_multicast_param_t
;
890 #else /* BIG ENDIAN */
891 typedef struct hermon_multicast_param_s
{
892 uint64_t mc_baseaddr
;
897 uint32_t log_mc_tbl_ent
:5;
900 uint32_t log_mc_tbl_hash_sz
:5;
903 uint32_t mc_hash_fn
:3;
905 uint32_t log_mc_tbl_sz
:5;
908 } hermon_multicast_param_t
;
911 #define HERMON_MCG_DEFAULT_HASH_FN 0x0
913 #ifdef _LITTLE_ENDIAN
914 typedef struct hermon_tpt_param_s
{
915 uint64_t dmpt_baseaddr
;
919 uint32_t log_dmpt_sz
:6;
921 uint32_t pgfault_rnr_to
:5;
924 uint64_t mtt_baseaddr
;
926 uint64_t cmpt_baseaddr
;
927 } hermon_tpt_param_t
;
928 #else /* BIG ENDIAN */
929 typedef struct hermon_tpt_param_s
{
930 uint64_t dmpt_baseaddr
;
933 uint32_t pgfault_rnr_to
:5;
935 uint32_t log_dmpt_sz
:6;
939 uint64_t mtt_baseaddr
;
941 uint64_t cmpt_baseaddr
;
942 } hermon_tpt_param_t
;
946 #ifdef _LITTLE_ENDIAN
947 typedef struct hermon_uar_param_s
{
952 uint32_t uar_pg_sz
:8;
953 uint32_t log_max_uars
:4;
957 } hermon_uar_param_t
;
959 typedef struct hermon_uar_param_s
{
963 uint32_t log_max_uars
:4;
964 uint32_t uar_pg_sz
:8;
969 } hermon_uar_param_t
;
974 * QP Allocation Params
975 * NOTE: as of PRM v0.50 no longer needed (ccq not supported
976 * leave structure here, just in case ccq comes back )
977 * but adjust the overall structure
982 #ifdef _LITTLE_ENDIAN
983 typedef struct hermon_qp_alloc_param_s
{
986 uint32_t ccq_base
:24;
987 uint32_t log2ccqs
:5;
991 uint32_t rsvd
[6]; /* but 0x14 def'd for fibre channel */
992 } hermon_qp_alloc_param_t
;
993 #else /* BIG ENDIAN */
994 typedef struct hermon_qp_alloc_param_s
{
997 uint32_t log2ccqs
:5;
998 uint32_t ccq_base
:24;
1002 uint32_t rsvd
[6]; /* but 0x14 def'd for fibre channel */
1003 } hermon_qp_alloc_param_t
;
1007 #ifdef _LITTLE_ENDIAN
1008 struct hermon_hw_initqueryhca_s
{
1012 uint32_t version
:8;
1015 uint32_t log2_cacheline
:3;
1016 uint32_t hca_core_clock
:16; /* QUERY_HCA only */
1020 uint32_t udav_port_chk
:1;
1021 uint32_t big_endian
:1;
1023 uint32_t chsum_en
:1;
1025 uint32_t cqpm_short_pkt_lim
:14; /* short pkt limit for qpm */
1026 uint32_t cqmp
:2; /* cq moderation policy */
1028 uint32_t router_qp
:24;
1032 uint32_t router_en
:1;
1036 hermon_hw_qp_ee_cq_eq_rdb_t context
;
1040 hermon_multicast_param_t multi
;
1044 hermon_tpt_param_t tpt
;
1048 hermon_uar_param_t uar
;
1052 hermon_multicast_param_t enet_multi
;
1054 uint32_t rsrv6
[24]; /* to 0x24C */
1058 uint32_t fcoe_t11
:1; /* fcoe t11 frame enable */
1061 uint32_t rsrv7
[42]; /* 0x254 - 0x2FC */
1063 #else /* BIG ENDIAN */
1064 struct hermon_hw_initqueryhca_s
{
1065 uint32_t version
:8;
1072 uint32_t hca_core_clock
:16; /* QUERY_HCA only */
1073 uint32_t log2_cacheline
:3;
1076 uint32_t router_en
:1;
1080 uint32_t router_qp
:24;
1082 uint32_t cqmp
:2; /* cq moderation policy */
1083 uint32_t cqpm_short_pkt_lim
:14; /* short pkt limit for qpm */
1085 uint32_t chsum_en
:1;
1087 uint32_t big_endian
:1;
1088 uint32_t udav_port_chk
:1;
1092 hermon_hw_qp_ee_cq_eq_rdb_t context
;
1096 hermon_multicast_param_t multi
;
1100 hermon_tpt_param_t tpt
;
1104 hermon_uar_param_t uar
;
1108 hermon_multicast_param_t enet_multi
;
1110 uint32_t rsrv6
[24]; /* to 0x24C */
1113 uint32_t fcoe_t11
:1; /* fcoe t11 frame enable */
1117 uint32_t rsrv7
[42]; /* 0x254 - 0x2FC */
1120 #define HERMON_UDAV_PROTECT_DISABLED 0x0
1121 #define HERMON_UDAV_PROTECT_ENABLED 0x1
1122 #define HERMON_UDAV_PORTCHK_DISABLED 0x0
1123 #define HERMON_UDAV_PORTCHK_ENABLED 0x1
1127 * Hermon "INIT_IB"/"INIT_PORT" command
1128 * The INIT_IB/INIT_PORT command enables the physical layer of an IB port.
1129 * It provides control over the IB port attributes. The capabilities
1130 * requested here should not exceed the device limits, as retrieved by
1131 * the QUERY_DEV_LIM/CAP command (above). To query information about the IB
1132 * port or node, the driver may submit GetPortInfo or GetNodeInfo MADs
1133 * through the Hermon MAD_IFC command.
1135 * Changed name to initport, but operates similar to initib - but as of
1136 * PRM v0.35c the initport just does that, and the params set previously
1137 * by initib are now set in SET_PORT
1144 * HERMON query_port and set_port commands. QUERY_PORT is new for hermon,
1145 * doing some of what used to be done in the QUERY_DEV_CAP command. It is
1146 * introduced in PRM v0.35 and will need to be added to the list of
1147 * supported HCA commands
1149 * SET_PORT is similar to the SET_IB command from tavor and arbel. Here,
1150 * tho, it's more extensive and will be easier to deal with I suspect by
1151 * making it a structure and filling it in and then doing the copy to the
1152 * mailbox (instead of just writing the minimal information to the mailbox
1153 * directly as was done for the previous HCAs).
1157 * PRM 0.4X and 0.50 changed the query_port to integrate the ethernet
1158 * stuff as well, so this is a signficant change to the structure
1161 #ifdef _LITTLE_ENDIAN
1162 struct hermon_hw_query_port_s
{
1164 uint32_t log_max_pkey
:4; /* pkey table size */
1165 uint32_t log_max_gid
:4; /* max gids / port */
1166 uint32_t ib_port_wid
:8;
1168 * Enet link speed - 0x0 10Gb XAUI, 0x01 10Gb XFI,
1169 * 0x02 1Gb, 0xF other
1171 uint32_t eth_link_spd
:4;
1174 * IB Link speed - bit 0 SDR, bit1 DDR, Bit 2 QDR
1176 uint32_t ib_link_spd
:8;
1179 uint32_t eth_mtu
:16; /* in bytes */
1181 * IB MTU - 0x0 rsvd, 0x1=256, 0x2=512, 0x3=1024, 0x4=2048, 0x5=4096
1186 * for next two if link down
1187 * -> what port supports, if up
1188 * -> what port is running
1191 uint32_t ib_link
:1;
1192 uint32_t eth_link
:1;
1196 uint32_t link_up
:1;
1199 uint32_t :32; /* 0x0C */
1201 /* max vl's supported (not incl vl_15) */
1202 uint32_t max_vl
:4; /* 0x08 */
1204 uint32_t log_max_mac
:4;
1205 uint32_t log_max_vlan
:4;
1210 uint32_t mac_hi
:16;
1216 #else /* BIG ENDIAN */
1217 struct hermon_hw_query_port_s
{
1219 uint32_t link_up
:1;
1224 * for next two if link down
1225 * -> what port supports, if up
1226 * -> what port is running
1228 uint32_t eth_link
:1;
1229 uint32_t ib_link
:1;
1232 * IB MTU - 0x0 rsvd, 0x1=256, 0x2=512, 0x3=1024, 0x4=2048, 0x5=4096
1235 uint32_t eth_mtu
:16; /* in bytes */
1239 * IB Link speed - bit 0 SDR, bit1 DDR, Bit 2 QDR
1241 uint32_t ib_link_spd
:8;
1244 * Enet link speed - 0x0 10Gb XAUI, 0x01 10Gb XFI,
1245 * 0x02 1Gb, 0xF other
1247 uint32_t eth_link_spd
:4;
1248 uint32_t ib_port_wid
:8;
1249 uint32_t log_max_gid
:4; /* max gids / port */
1250 uint32_t log_max_pkey
:4; /* pkey table size */
1252 uint32_t :16; /* 0x08 */
1253 uint32_t log_max_vlan
:4;
1254 uint32_t log_max_mac
:4;
1256 /* max vl's supported (not incl vl_15) */
1259 uint32_t :32; /* 0x0C */
1262 uint32_t mac_hi
:16;
1272 * the following structure is used for IB set port
1273 * others following are for ethernet set port
1276 #define HERMON_HW_OPMOD_SETPORT_IB 0x0
1277 #define HERMON_HW_OPMOD_SETPORT_EN 0x1
1278 #define HERMON_HW_OPMOD_SETPORT_EXT 0x2
1281 #ifdef _LITTLE_ENDIAN
1282 struct hermon_hw_set_port_s
{
1285 uint32_t rqk
:1; /* reset qkey violation cntr */
1286 uint32_t rcm
:1; /* reset capability mask */
1290 uint32_t mtu_cap
:4;
1291 uint32_t g0
:1; /* set port GUID0 */
1292 uint32_t ng
:1; /* set node GUID (all ports) */
1293 uint32_t sig
:1; /* set sys image */
1294 uint32_t mg
:1; /* change GID table */
1295 uint32_t mp
:1; /* change pkey table size */
1296 uint32_t mvc
:1; /* change vl_cap */
1297 uint32_t mmc
:1; /* change mtu_cap */
1300 uint64_t sys_img_guid
;
1306 uint32_t ingress_sniff_qpn
:24;
1307 uint32_t ingress_sniff_mode
:1;
1310 uint32_t egress_sniff_qpn
:24;
1311 uint32_t egress_sniff_mode
:1;
1316 uint32_t max_gid
:16; /* valid if noted above */
1317 uint32_t max_pkey
:16; /* valid if noted above */
1319 uint32_t rsrd0
[500];
1321 #else /* BIG ENDIAN */
1322 struct hermon_hw_set_port_s
{
1324 uint32_t mmc
:1; /* change mtu_cap */
1325 uint32_t mvc
:1; /* change vl_cap */
1326 uint32_t mp
:1; /* change pkey table size */
1327 uint32_t mg
:1; /* change GID table size */
1328 uint32_t sig
:1; /* set sys image GUID */
1329 uint32_t ng
:1; /* set node GUID (all ports) */
1330 uint32_t g0
:1; /* set port GUID0 */
1331 uint32_t mtu_cap
:4;
1335 uint32_t rcm
:1; /* reset capability mask */
1336 uint32_t rqk
:1; /* reset qkey violation cntr */
1340 uint64_t sys_img_guid
;
1347 uint32_t egress_sniff_mode
:1;
1348 uint32_t egress_sniff_qpn
:24;
1351 uint32_t ingress_sniff_mode
:1;
1352 uint32_t ingress_sniff_qpn
:24;
1355 uint32_t max_pkey
:16; /* valid if noted above */
1356 uint32_t max_gid
:16; /* valid if noted above */
1360 uint32_t rsrd0
[500];
1365 * structures for ethernet setport
1366 * Which structure is used depends on low-16 of opmod
1367 * Low 8 == port number, 15:8 == selector
1368 * Or the following with port number
1371 #define HERMON_HW_ENET_OPMOD_SELECT_GEN 0x0000 /* general params */
1372 #define HERMON_HW_ENET_OPMOD_SELECT_RQN 0x0100 /* rcv qpn calc */
1373 #define HERMON_HW_ENET_OPMOD_SELECT_MAC 0x0200 /* MAC table conf */
1374 #define HERMON_HW_ENET_OPMOD_SELECT_VLAN 0x0300 /* VLAN table conf */
1375 #define HERMON_HW_ENET_OPMOD_SELECT_PRIO 0x0400 /* Priority table */
1376 #define HERMON_HW_ENET_OPMOD_SELECT_GID 0x0500 /* GID Table */
1379 * set port for enthernet, general parameters
1383 #ifdef _LITTLE_ENDIAN
1384 struct hermon_hw_set_port_en_s
{
1406 #else /* BIG ENDIAN */
1407 struct hermon_hw_set_port_en_s
{
1431 /* set_port for enet, RX QPM calculations Parameters */
1433 #ifdef _LITTLE_ENDIAN
1434 struct hermon_hw_set_port_en_rqpn_s
{
1442 uint32_t base_qpn
:24;
1445 uint32_t vlan_miss_idx
:7;
1447 uint32_t intra_vlan_miss
:1;
1448 uint32_t no_vlan_idx
:7;
1450 uint32_t intra_no_vlan
:1;
1452 uint32_t mac_miss_idx
:8;
1455 uint32_t promisc_qpn
:24;
1457 uint32_t en_uc_promisc
:1;
1459 uint32_t no_vlan_prio
:3;
1464 uint32_t def_mcast_qpn
:24;
1466 uint32_t mc_by_vlan
:1;
1467 uint32_t mc_promisc_mode
:2;
1472 #else /* BIG ENDIAN */
1473 struct hermon_hw_set_port_en_rqpn_s
{
1475 uint32_t base_qpn
:24;
1485 uint32_t mac_miss_idx
:8;
1487 uint32_t intra_no_vlan
:1;
1489 uint32_t no_vlan_idx
:7;
1490 uint32_t intra_vlan_miss
:1;
1492 uint32_t vlan_miss_idx
:7;
1495 uint32_t no_vlan_prio
:3;
1497 uint32_t en_uc_promisc
:1;
1499 uint32_t promisc_qpn
:24;
1501 uint32_t mc_promisc_mode
:2;
1502 uint32_t mc_by_vlan
:1;
1504 uint32_t def_mcast_qpn
:24;
1513 #ifdef _LITTLE_ENDIAN
1514 struct hermon_hw_set_port_mact_entry_s
{
1515 uint32_t mac_lo
:32;
1517 uint32_t mac_hi
:16;
1519 uint32_t mac_valid
:1;
1521 #else /* BIG ENDIAN */
1522 struct hermon_hw_set_port_mact_entry_s
{
1523 uint32_t mac_valid
:1;
1525 uint32_t mac_hi
:16;
1527 uint32_t mac_lo
:32;
1533 /* set_port for enet, MAC Table Configuration */
1535 #ifdef _LITTLE_ENDIAN
1536 struct hermon_hw_set_port_en_mact_s
{
1537 struct hermon_hw_set_port_mact_entry_s mtable
[128];
1539 #else /* BIG ENDIAN */
1540 struct hermon_hw_set_port_en_mact_s
{
1541 struct hermon_hw_set_port_mact_entry_s mtable
[128];
1546 /* set_port for enet, VLAN Table Configuration */
1548 #ifdef _LITTLE_ENDIAN
1549 struct hermon_hw_set_port_vlant_entry_s
{
1550 uint32_t vlan_id
:12;
1555 #else /* BIG ENDIAN */
1556 struct hermon_hw_set_port_vlant_entry_s
{
1560 uint32_t vlan_id
:12;
1564 #ifdef _LITTLE_ENDIAN
1565 struct hermon_hw_set_port_en_vlant_s
{
1567 struct hermon_hw_set_port_vlant_entry_s table
[126];
1569 #else /* BIG ENDIAN */
1570 struct hermon_hw_set_port_en_vlant_s
{
1572 struct hermon_hw_set_port_vlant_entry_s table
[126];
1576 /* set_port for enet, Priority table Parameters */
1578 #ifdef _LITTLE_ENDIAN
1579 struct hermon_hw_set_port_en_priot_s
{
1601 #else /* BIG ENDIAN */
1602 struct hermon_hw_set_port_en_priot_s
{
1628 /* note: GID table is same BIG or LITTLE ENDIAN */
1630 struct hermon_hw_set_port_gidtable_s
{
1634 #ifdef _LITTLE_ENDIAN
1635 struct hermon_hw_conf_int_mod_s
{
1638 uint32_t int_vect
:16;
1639 uint32_t min_delay
:16;
1641 #else /* BIG ENDIAN */
1642 struct hermon_hw_conf_int_mod_s
{
1643 uint32_t min_delay
:16;
1644 uint32_t int_vect
:16;
1654 * Hermon Memory Protection Table (MPT) entries
1656 * The Memory Protection Table (MPT) contains the information associated
1657 * with all the regions and windows. The MPT table resides in a virtually-
1658 * contiguous area in ICM, and the memory key (R_Key or L_Key) is used to
1659 * calculate the physical address for accessing the entries in the table.
1662 * The SW2HW_MPT command transfers ownership of an MPT entry from software
1663 * to hardware. The command takes the MPT entry from the input mailbox and
1664 * stores it in the MPT in the hardware. The command will fail if the
1665 * requested MPT entry is already owned by the hardware or if the MPT index
1666 * given in the command is inconsistent with the MPT entry memory key.
1667 * The QUERY_MPT command retrieves a snapshot of an MPT entry. The command
1668 * takes the current state of an MPT entry from the hardware and stores it
1669 * in the output mailbox. The command will fail if the requested MPT entry
1670 * is already owned by software.
1671 * Finally, the HW2SW_MPT command transfers ownership of an MPT entry from
1672 * the hardware to the software. The command takes the MPT entry from the
1673 * hardware, invalidates it, and stores it in the output mailbox. The
1674 * command will fail if the requested entry is already owned by software.
1675 * The command will also fail if the MPT entry in question is a Memory
1676 * Region which has Memory Windows currently bound to it.
1678 * The following structure is used in the SW2HW_MPT, QUERY_MPT, and
1679 * HW2SW_MPT commands, and ONLY for the dMPT - for data.
1682 #ifdef _LITTLE_ENDIAN
1683 struct hermon_hw_dmpt_s
{
1686 uint32_t qpn
:24; /* dw 1, byte 4-7 */
1689 uint32_t reg_win
:1;
1690 uint32_t phys_addr
:1;
1696 uint32_t en_bind
:1;
1697 uint32_t atc_req
:1;
1698 uint32_t atc_xlat
:1;
1700 uint32_t no_snoop
:1;
1702 uint32_t status
:4; /* dw 0, byte 0-3 */
1705 uint32_t ren_inval
:1;
1706 uint32_t en_inval
:1;
1707 uint32_t net_cache
:1;
1708 uint32_t fast_reg_en
:1;
1709 uint32_t rem_acc_en
:1;
1712 uint32_t :1; /* dw 2, byte 0xc-f */
1716 uint64_t start_addr
; /* dw 4-5, byte 0x10-17 */
1718 uint64_t reg_win_len
; /* dw 6-7, byte 0x18-1f */
1720 uint32_t win_cnt
:24;
1721 uint32_t :8; /* dw 9, byte 0x24-27 */
1723 uint32_t lkey
; /* dw 8, byte 0x20-23 */
1725 uint32_t mtt_addr_h
:8;
1726 uint32_t :24; /* dw 11, byte 0x2c-2f */
1728 uint32_t mtt_rep
:4;
1730 uint32_t blk_mode
:1;
1731 uint32_t len_b64
:1; /* bit 64 of length */
1733 uint32_t :8; /* dw 10, byte 0x28-2b */
1735 uint32_t mtt_size
; /* dw 13, byte 0x34-37 */
1738 uint32_t mtt_addr_l
:29; /* dw 12, byte 0x30-33 */
1740 uint32_t mtt_fbo
:21;
1741 uint32_t :11; /* dw 15, byte 0x3c-3f */
1743 uint32_t entity_sz
:21;
1744 uint32_t :11; /* dw 14, byte 0x38-3b */
1746 uint32_t dif_m_atag
:16;
1747 uint32_t :16; /* dw 17, 0x44-47 */
1749 uint32_t dif_a_msk
:16;
1750 uint32_t dif_v_msk
:2;
1751 uint32_t dif_rep
:2;
1753 uint32_t dif_err
:3;
1754 uint32_t :5; /* dw 16, 0x40-43 */
1756 uint32_t dif_w_atag
:16;
1757 uint32_t :16; /* dw 19, 0x4c-4f */
1759 uint32_t dif_m_rtagb
; /* dw 18, 0x48-4b */
1763 uint32_t dif_w_rtagb
; /* dw 20, 0x50-53 */
1769 #else /* BIG ENDIAN */
1770 struct hermon_hw_dmpt_s
{
1773 uint32_t no_snoop
:1;
1775 uint32_t atc_xlat
:1;
1776 uint32_t atc_req
:1;
1777 uint32_t en_bind
:1;
1783 uint32_t phys_addr
:1;
1784 uint32_t reg_win
:1;
1785 uint32_t :8; /* dw 0, byte 0x0-3 */
1789 uint32_t :7; /* dw 1, byte 0x4-7 */
1791 uint32_t mem_key
; /* dw 2, byte 0x8-b */
1796 uint32_t rem_acc_en
:1;
1797 uint32_t fast_reg_en
:1;
1798 uint32_t net_cache
:1;
1799 uint32_t en_inval
:1;
1800 uint32_t ren_inval
:1;
1801 uint32_t pd
:24; /* dw 3, byte 0xc-f */
1803 uint64_t start_addr
; /* dw 4-5, byte 0x10-17 */
1805 uint64_t reg_win_len
; /* dw 6-7, byte 0x18-1f */
1807 uint32_t lkey
; /* dw 8, bytd 0x20-23 */
1810 uint32_t win_cnt
:24; /* dw 9, byte 0x24-27 */
1814 uint32_t len_b64
:1; /* bit 64 of length */
1815 uint32_t blk_mode
:1;
1817 uint32_t mtt_rep
:4; /* dw 10, byte 0x28-2b */
1820 uint32_t mtt_addr_h
:8; /* dw 11, byte 0x2c-2f */
1822 uint32_t mtt_addr_l
:29;
1823 uint32_t :3; /* dw 12, byte 0x30-33 */
1825 uint32_t mtt_size
; /* dw 13, byte 0x34-37 */
1828 uint32_t entity_sz
:21; /* dw 14, byte 0x38-3b */
1831 uint32_t mtt_fbo
:21; /* dw 15, byte 0x3c-3f */
1834 uint32_t dif_err
:3;
1836 uint32_t dif_rep
:2;
1837 uint32_t dif_v_msk
:2;
1838 uint32_t dif_a_msk
:16; /* dw 16, 0x40-43 */
1841 uint32_t dif_m_atag
:16; /* dw 17, 0x44-47 */
1843 uint32_t dif_m_rtagb
; /* dw 18, 0x48-4b */
1846 uint32_t dif_w_atag
:16; /* dw 19, 0x4c-4f */
1848 uint32_t dif_w_rtagb
; /* dw 20, 0x50-53 */
1858 * The following structure is for the CMPTs. This is NEVER actually built and
1859 * passed to the hardware - we use it to track information needed for the
1860 * context entries, and to facilitate the alloc tracking. It differs from
1861 * the dMPT sturcture above in that it does not have/need the "dif" stuff.
1867 #ifdef _LITTLE_ENDIAN
1868 struct hermon_hw_cmpt_s
{
1871 uint32_t qpn
:24; /* dw 1, byte 4-7 */
1874 uint32_t reg_win
:1;
1875 uint32_t phys_addr
:1;
1881 uint32_t en_bind
:1;
1882 uint32_t atc_req
:1;
1883 uint32_t atc_xlat
:1;
1885 uint32_t no_snoop
:1;
1887 uint32_t status
:4; /* dw 0, byte 0-3 */
1890 uint32_t ren_inval
:1;
1891 uint32_t en_inval
:1;
1892 uint32_t net_cache
:1;
1893 uint32_t fast_reg_en
:1;
1894 uint32_t rem_acc_en
:1;
1897 uint32_t :1; /* dw 2, byte 0xc-f */
1900 uint64_t start_addr
; /* dw 4-5, byte 0x10-17 */
1902 uint64_t reg_win_len
; /* dw 6-7, byte 0x18-1f */
1904 uint32_t win_cnt
:24;
1905 uint32_t :8; /* dw 9, byte 0x24-27 */
1907 uint32_t lkey
; /* dw 8, byte 0x20-23 */
1909 uint32_t mtt_addr_h
:8;
1910 uint32_t :24; /* dw 11, byte 0x2c-2f */
1912 uint32_t mtt_rep
:4;
1914 uint32_t blk_mode
:1;
1915 uint32_t len_b64
:1; /* bit 64 of length */
1917 uint32_t :8; /* dw 10, byte 0x28-2b */
1919 uint32_t mtt_size
; /* dw 13, byte 0x34-37 */
1922 uint32_t mtt_addr_l
:29; /* dw 12, byte 0x30-33 */
1924 uint32_t mtt_fbo
:21;
1925 uint32_t :11; /* dw 15, byte 0x3c-3f */
1927 uint32_t entity_sz
:21;
1928 uint32_t :11; /* dw 14, byte 0x38-3b */
1933 #else /* BIG ENDIAN */
1934 struct hermon_hw_cmpt_s
{
1937 uint32_t no_snoop
:1;
1939 uint32_t atc_xlat
:1;
1940 uint32_t atc_req
:1;
1941 uint32_t en_bind
:1;
1947 uint32_t phys_addr
:1;
1948 uint32_t reg_win
:1;
1949 uint32_t :8; /* dw 0, byte 0x0-3 */
1953 uint32_t :7; /* dw 1, byte 0x4-7 */
1955 uint32_t mem_key
; /* dw 2, byte 0x8-b */
1960 uint32_t rem_acc_en
:1;
1961 uint32_t fast_reg_en
:1;
1962 uint32_t net_cache
:1;
1963 uint32_t en_inval
:1;
1964 uint32_t ren_inval
:1;
1965 uint32_t pd
:24; /* dw 3, byte 0xc-f */
1967 uint64_t start_addr
; /* dw 4-5, byte 0x10-17 */
1969 uint64_t reg_win_len
; /* dw 6-7, byte 0x18-1f */
1971 uint32_t lkey
; /* dw 8, bytd 0x20-23 */
1974 uint32_t win_cnt
:24; /* dw 9, byte 0x24-27 */
1978 uint32_t len_b64
:1; /* bit 64 of length */
1979 uint32_t blk_mode
:1;
1981 uint32_t mtt_rep
:4; /* dw 10, byte 0x28-2b */
1984 uint32_t mtt_addr_h
:8; /* dw 11, byte 0x2c-2f */
1986 uint32_t mtt_addr_l
:29;
1987 uint32_t :3; /* dw 12, byte 0x30-33 */
1989 uint32_t mtt_size
; /* dw 13, byte 0x34-37 */
1992 uint32_t entity_sz
:21; /* dw 14, byte 0x38-3b */
1994 uint32_t :11; /* dw 15, byte 0x3c-3f */
1995 uint32_t mtt_fbo
:21;
2000 #define HERMON_MEM_CYCLE_GENERATE 0x1
2001 #define HERMON_IO_CYCLE_GENERATE 0x0
2003 #define HERMON_MPT_IS_WINDOW 0x0
2004 #define HERMON_MPT_IS_REGION 0x1
2006 #define HERMON_MPT_DEFAULT_VERSION 0x0
2008 #define HERMON_UNLIMITED_WIN_BIND 0x0
2010 #define HERMON_PHYSADDR_ENABLED 0x1
2011 #define HERMON_PHYSADDR_DISABLED 0x0
2015 * Hermon Memory Translation Table (MTT) entries
2016 * After accessing the MPT table (above) and validating the access rights
2017 * to the region/window, Hermon address translation moves to the next step
2018 * where it translates the virtual address to a physical address. This
2019 * translation is performed using the Memory Translation Table entries
2020 * (MTT). Note: The MTT in hardware is organized into segments and each
2021 * segment contains multiple address translation pages (MTT entries).
2022 * Each memory region (MPT above) points to the first segment in the MTT
2023 * that corresponds to that region.
2026 #ifdef _LITTLE_ENDIAN
2027 struct hermon_hw_mtt_s
{
2028 uint32_t present
:1;
2030 uint32_t ptag_l
:29;
2034 #else /* BIG_ENDIAN */
2035 struct hermon_hw_mtt_s
{
2038 uint32_t ptag_l
:29;
2040 uint32_t present
:1;
2044 #define HERMON_MTT_ENTRY_NOTPRESENT 0x0
2045 #define HERMON_MTT_ENTRY_PRESENT 0x1
2049 * Hermon Event Queue Context Table (EQC) entries
2050 * Hermon supports 512 Event Queues, and the status of Event Queues is stored
2051 * in the Event Queue Context (EQC) table. The EQC table is a virtually-
2052 * contiguous memory structure in the ICM. Each EQC
2053 * table entry contains Event Queue status and information required by
2054 * the hardware in order to access the event queue.
2055 * NOTE that in Hermon (as opposed to earlier HCAs),
2056 * you have to allocate ICM for 2**32 (or about 16 M), even though
2057 * it doesn't support that many. See PRM v35. Also, some set of them
2058 * will be available for each domain in a virtual environment, needing to
2059 * rething the allocation and usage model for EQs - in the future.
2061 * The following structure is used in the SW2HW_EQ, QUERY_EQ, and HW2SW_EQ
2063 * The SW2HW_EQ command transfers ownership of an EQ context from software
2064 * to hardware. The command takes the EQC entry from the input mailbox and
2065 * stores it in the EQC in the hardware. The command will fail if the
2066 * requested EQC entry is already owned by the hardware. NOTE: the
2067 * initialization of the cMPT for the EQC occurs implicitly as a result
2068 * of executing this command, and MR has/had to be adjusted for it.
2069 * The QUERY_EQ command retrieves a snapshot of an EQC entry. The command
2070 * stores the snapshot in the output mailbox. The EQC state and its values
2071 * are not affected by the QUERY_EQ command.
2072 * Finally, the HW2SW_EQ command transfers ownership of an EQC entry from
2073 * the hardware to the software. The command takes the EQC entry from the
2074 * hardware and stores it in the output mailbox. The EQC entry will be
2075 * invalidated as a result of the command. It is the responsibility of the
2076 * software to unmap all the events, which might have been previously
2077 * mapped to the EQ, prior to issuing the HW2SW_EQ command.
2081 #ifdef _LITTLE_ENDIAN
2082 struct hermon_hw_eqc_s
{
2088 uint32_t overrun_ignore
:1;
2089 uint32_t ev_coalesc
:1;
2094 uint32_t log_eq_sz
:5;
2098 uint32_t pg_offs
:7;
2104 uint32_t eq_max_cnt
:16;
2105 uint32_t eq_period
:16;
2108 uint32_t mtt_base_addrl
:29;
2110 uint32_t mtt_base_addrh
:8;
2112 uint32_t log2_pgsz
:6; /* in 4K pages */
2117 uint32_t prod_indx
:24;
2120 uint32_t cons_indx
:24;
2123 uint64_t rsrv1
[2]; /* force it to 8b alignment */
2125 #else /* BIG ENDIAN */
2126 struct hermon_hw_eqc_s
{
2129 uint32_t ev_coalesc
:1;
2130 uint32_t overrun_ignore
:1;
2138 uint32_t pg_offs
:7;
2142 uint32_t log_eq_sz
:5;
2145 uint32_t eq_period
:16;
2146 uint32_t eq_max_cnt
:16;
2152 uint32_t log2_pgsz
:6; /* in 4K pages */
2154 uint32_t mtt_base_addrh
:8;
2156 uint32_t mtt_base_addrl
:29;
2162 uint32_t cons_indx
:24;
2165 uint32_t prod_indx
:24;
2167 uint64_t rsrv1
[2]; /* force it to 8b alignment */
2170 #define HERMON_EQ_STATUS_OK 0x0
2171 #define HERMON_EQ_STATUS_OVERFLOW 0x9
2172 #define HERMON_EQ_STATUS_WRITE_FAILURE 0xA
2174 #define HERMON_EQ_ARMED 0x9
2175 #define HERMON_EQ_FIRED 0xA
2176 #define HERMON_EQ_ALWAYS_ARMED 0xB
2180 * Hermon Event Queue Entries (EQE)
2181 * Each EQE contains enough information for the software to identify the
2182 * source of the event. The following structures are used to define each
2183 * of the various kinds of events that the Hermon hardware will generate.
2184 * Note: The hermon_hw_eqe_t below is the generic "Event Queue Entry". All
2185 * other EQEs differ only in the contents of their "event_data" field.
2187 * Below we first define several structures which define the contents of
2188 * the "event_data" fields:
2189 * hermon_hw_eqe_cq_t for "Completion Queue Events"
2190 * hermon_hw_eqe_qp_evt_t for "Queue Pair Events" such as Path Migration
2191 * Succeeded, Path Migration Failed, Communication Established, Send
2192 * Queue Drained, Local WQ Catastrophic Error, Invalid Request Local
2193 * WQ Error, and Local Access Violation WQ Error.
2194 * hermon_hw_eqe_cqerr_t for "Completion Queue Error Events"
2195 * hermon_hw_eqe_portstate_t for "Port State Change Events"
2196 * hermon_hw_eqe_gpio_t for "GPIO State Change Events"
2197 * hermon_hw_eqe_cmdcmpl_t for "Command Interface Completion Events"
2198 * hermon_hw_eqe_operr_t for "Operational and Catastrophic Error Events"
2199 * such as EQ Overflow, Misbehaved UAR page, Internal Parity Error,
2200 * Uplink bus error, and DDR data error.
2201 * hermon_hw_eqe_pgflt_t for "Not-present Page Fault on WQE or Data
2202 * Buffer Access". (Note: Currently, this event is unsupported).
2204 * Note also: The following structures are not #define'd with both
2205 * little-endian and big-endian definitions. This is because their
2206 * individual fields are not directly accessed except through the macros
2211 typedef struct hermon_hw_eqe_cq_s
{
2215 } hermon_hw_eqe_cq_t
;
2219 typedef struct hermon_hw_eqe_qp_evt_s
{
2224 } hermon_hw_eqe_qpevt_t
;
2227 typedef struct hermon_hw_eqe_cqerr_s
{
2234 uint32_t syndrome
:8;
2237 } hermon_hw_eqe_cqerr_t
;
2238 #define HERMON_CQERR_OVERFLOW 0x1
2239 #define HERMON_CQERR_ACCESS_VIOLATION 0x2
2242 typedef struct hermon_hw_eqe_portstate_s
{
2250 } hermon_hw_eqe_portstate_t
;
2251 #define HERMON_PORT_LINK_ACTIVE 0x4
2252 #define HERMON_PORT_LINK_DOWN 0x1
2255 typedef struct hermon_hw_eqe_gpio_s
{
2263 } hermon_hw_eqe_gpio_t
;
2266 typedef struct hermon_hw_eqe_cmdcmpl_s
{
2275 uint32_t out_param0
;
2277 uint32_t out_param1
;
2280 } hermon_hw_eqe_cmdcmpl_t
;
2283 typedef struct hermon_hw_eqe_operr_s
{
2287 uint32_t error_type
:8;
2292 } hermon_hw_eqe_operr_t
;
2293 #define HERMON_ERREVT_EQ_OVERFLOW 0x1
2294 #define HERMON_ERREVT_BAD_UARPG 0x2
2295 #define HERMON_ERREVT_UPLINK_BUSERR 0x3
2296 #define HERMON_ERREVT_DDR_DATAERR 0x4
2297 #define HERMON_ERREVT_INTERNAL_PARITY 0x5
2300 typedef struct hermon_hw_eqe_fcerr_s
{
2303 uint32_t fexch
:16; /* fexch number */
2308 uint32_t fcsyndrome
:8;
2311 } hermon_hw_eqe_fcerr_t
;
2313 #define HERMON_ERR_FC_BADIU 0x0
2314 #define HERMON_ERR_FC_SEQUENCE 0x01
2316 typedef struct hermon_hw_eqe_pgflt_s
{
2319 uint32_t fault_type
:4;
2321 uint32_t wqe_data
:1;
2322 uint32_t rem_loc
:1;
2323 uint32_t snd_rcv
:1;
2327 } hermon_hw_eqe_pgflt_t
;
2328 #define HERMON_PGFLT_PG_NOTPRESENT 0x8
2329 #define HERMON_PGFLT_PG_WRACC_VIOL 0xA
2330 #define HERMON_PGFLT_UNSUP_NOTPRESENT 0xE
2331 #define HERMON_PGFLT_UNSUP_WRACC_VIOL 0xF
2332 #define HERMON_PGFLT_WQE_CAUSED 0x1
2333 #define HERMON_PGFLT_DATA_CAUSED 0x0
2334 #define HERMON_PGFLT_REMOTE_CAUSED 0x1
2335 #define HERMON_PGFLT_LOCAL_CAUSED 0x0
2336 #define HERMON_PGFLT_SEND_CAUSED 0x1
2337 #define HERMON_PGFLT_RECV_CAUSED 0x0
2338 #define HERMON_PGFLT_DESC_CONSUMED 0x1
2339 #define HERMON_PGFLT_DESC_NOTCONSUMED 0x0
2341 struct hermon_hw_eqe_s
{
2343 uint32_t event_type
:8;
2345 uint32_t event_subtype
:8;
2347 hermon_hw_eqe_cq_t eqe_cq
;
2348 hermon_hw_eqe_qpevt_t eqe_qpevt
;
2349 hermon_hw_eqe_cqerr_t eqe_cqerr
;
2350 hermon_hw_eqe_portstate_t eqe_portstate
;
2351 hermon_hw_eqe_gpio_t eqe_gpio
;
2352 hermon_hw_eqe_cmdcmpl_t eqe_cmdcmpl
;
2353 hermon_hw_eqe_operr_t eqe_operr
;
2354 hermon_hw_eqe_pgflt_t eqe_pgflt
;
2355 hermon_hw_eqe_fcerr_t eqe_fcerr
;
2361 #define eqe_cq event_data.eqe_cq
2362 #define eqe_qpevt event_data.eqe_qpevt
2363 #define eqe_cqerr event_data.eqe_cqerr
2364 #define eqe_portstate event_data.eqe_portstate
2365 #define eqe_gpio event_data.eqe_gpio
2366 #define eqe_cmdcmpl event_data.eqe_cmdcmpl
2367 #define eqe_operr event_data.eqe_operr
2368 #define eqe_pgflt event_data.eqe_pgflt
2369 #define eqe_fcerr event_data.eqe_fcerr
2372 * The following macros are used for extracting (and in some cases filling in)
2373 * information from EQEs
2375 #define HERMON_EQE_CQNUM_MASK 0x00FFFFFF
2376 #define HERMON_EQE_CQNUM_SHIFT 0
2377 #define HERMON_EQE_QPNUM_MASK 0x00FFFFFF
2378 #define HERMON_EQE_QPNUM_SHIFT 0
2379 #define HERMON_EQE_PORTNUM_MASK 0x30
2380 #define HERMON_EQE_PORTNUM_SHIFT 4
2381 #define HERMON_EQE_OWNER_MASK 0x00000080
2382 #define HERMON_EQE_OWNER_SHIFT 7
2384 #define HERMON_EQE_EVTTYPE_GET(eq, eqe) \
2385 (((uint8_t *)(eqe))[1])
2386 #define HERMON_EQE_EVTSUBTYPE_GET(eq, eqe) \
2387 (((uint8_t *)(eqe))[3])
2388 #define HERMON_EQE_CQNUM_GET(eq, eqe) \
2389 ((htonl(((uint32_t *)(eqe))[1]) & HERMON_EQE_CQNUM_MASK) >> \
2390 HERMON_EQE_CQNUM_SHIFT)
2391 #define HERMON_EQE_QPNUM_GET(eq, eqe) \
2392 ((htonl(((uint32_t *)(eqe))[1]) & HERMON_EQE_QPNUM_MASK) >> \
2393 HERMON_EQE_QPNUM_SHIFT)
2394 #define HERMON_EQE_PORTNUM_GET(eq, eqe) \
2395 (((((uint8_t *)(eqe))[12]) & HERMON_EQE_PORTNUM_MASK) >> \
2396 HERMON_EQE_PORTNUM_SHIFT)
2397 #define HERMON_EQE_CMDTOKEN_GET(eq, eqe) \
2398 htons(((uint16_t *)(eqe))[3])
2399 #define HERMON_EQE_CMDSTATUS_GET(eq, eqe) \
2400 (((uint8_t *)(eqe))[0xf])
2401 #define HERMON_EQE_CMDOUTP0_GET(eq, eqe) \
2402 htonl(((uint32_t *)(eqe))[4])
2403 #define HERMON_EQE_CMDOUTP1_GET(eq, eqe) \
2404 htonl(((uint32_t *)(eqe))[5])
2405 #define HERMON_EQE_OPERRTYPE_GET(eq, eqe) \
2406 (((uint8_t *)(eqe))[0xf])
2407 #define HERMON_EQE_OPERRDATA_GET(eq, eqe) \
2408 htonl(((uint32_t *)(eqe))[4])
2409 #define HERMON_EQE_FEXCH_PORTNUM_GET(eq, eqe) \
2410 (((uint8_t *)(eqe))[5] & 0x3)
2411 #define HERMON_EQE_FEXCH_FEXCH_GET(eq, eqe) \
2412 htons(((uint16_t *)(eqe))[3])
2413 #define HERMON_EQE_FEXCH_SYNDROME_GET(eq, eqe) \
2414 (((uint8_t *)(eqe))[15])
2417 * Hermon does ownership of CQ and EQ differently from Arbel & Tavor.
2418 * Now, you keep track of the TOTAL number of CQE's or EQE's that have been
2419 * processed, and the sense of the ownership bit changes each time through.
2420 * That is, if the size of the queue is 16, so 4 bits [3:0] are the index
2421 * number, then bit [4] is the ownership bit in the count. So you mask that
2422 * bit and compare it to the owner bit in the entry - if the same, then the
2423 * entry is in SW onwership. Otherwise, it's in hardware and the driver
2424 * does not consume it.
2427 #define HERMON_EQE_OWNER_IS_SW(eq, eqe, consindx, shift) \
2428 ((((uint8_t *)(eqe))[0x1f] & HERMON_EQE_OWNER_MASK) == \
2429 (((consindx) & eq->eq_bufsz) >> (shift)))
2432 * Hermon Completion Queue Context Table (CQC) entries
2433 * The CQC table is a virtually-contiguous memory area residing in HCA's
2434 * ICM. Each CQC table entry contains information
2435 * required by the hardware to access the completion queue to post
2436 * completions (CQE).
2438 * The following structure is used in the SW2HW_CQ, QUERY_CQ, RESIZE_CQ,
2439 * and HW2SW_CQ commands.
2440 * The SW2HW_CQ command transfers ownership of an CQ context from software
2441 * to hardware. The command takes the CQC entry from the input mailbox and
2442 * stores it in the CQC in the hardware. The command will fail if the
2443 * requested CQC entry is already owned by the hardware.
2444 * The QUERY_CQ command retrieves a snapshot of a CQC entry. The command
2445 * stores the snapshot in the output mailbox. The CQC state and its values
2446 * are not affected by the QUERY_CQ command.
2447 * Finally, the HW2SW_CQ command transfers ownership of a CQC entry from
2448 * the hardware to the software. The command takes the CQC entry from the
2449 * hardware and stores it in the output mailbox. The CQC entry will be
2450 * invalidated as a result of the command.
2454 #ifdef _LITTLE_ENDIAN
2455 struct hermon_hw_cqc_s
{
2461 uint32_t overrun_ignore
:1;
2462 uint32_t cqe_coalesc
:1;
2466 uint32_t usr_page
:24;
2467 uint32_t log_cq_sz
:5;
2471 uint32_t pg_offs
:7;
2477 uint32_t cq_max_cnt
:16;
2478 uint32_t cq_period
:16;
2481 uint32_t mtt_base_addl
:29;
2483 uint32_t mtt_base_addh
:8;
2485 uint32_t log2_pgsz
:6;
2488 uint32_t solicit_prod_indx
:24;
2491 uint32_t last_notified_indx
:24;
2494 uint32_t prod_cntr
:24; /* producer counter */
2497 uint32_t cons_cntr
:24; /* consumer counter */
2503 uint32_t dbr_addrl
:29;
2507 uint64_t rsrv1
[8]; /* hermon, match DEV_CAP size */
2510 struct hermon_hw_cqc_s
{
2513 uint32_t cqe_coalesc
:1;
2514 uint32_t overrun_ignore
:1;
2522 uint32_t pg_offs
:7;
2526 uint32_t log_cq_sz
:5;
2527 uint32_t usr_page
:24;
2529 uint32_t cq_period
:16;
2530 uint32_t cq_max_cnt
:16;
2536 uint32_t log2_pgsz
:6;
2538 uint32_t mtt_base_addh
:8;
2540 uint32_t mtt_base_addl
:29;
2544 uint32_t last_notified_indx
:24;
2547 uint32_t solicit_prod_indx
:24;
2550 uint32_t cons_cntr
:24; /* consumer counter */
2553 uint32_t prod_cntr
:24; /* priducer counter */
2559 uint32_t dbr_addrl
:29;
2562 uint64_t rsrv1
[8]; /* hermon, match DEV_CAP size */
2565 #define HERMON_CQ_STATUS_OK 0x0
2566 #define HERMON_CQ_STATUS_OVERFLOW 0x9
2567 #define HERMON_CQ_STATUS_WRITE_FAILURE 0xA
2569 #define HERMON_CQ_DISARMED 0x0
2570 #define HERMON_CQ_ARMED 0x1
2571 #define HERMON_CQ_ARMED_SOLICITED 0x4
2572 #define HERMON_CQ_FIRED 0xA
2575 * Hermon Completion Queue Entries (CQE)
2576 * Each CQE contains enough information for the software to associate the
2577 * completion with the Work Queue Element (WQE) to which it corresponds.
2579 * Note: The following structure is not #define'd with both little-endian
2580 * and big-endian definitions. This is because each CQE's individual
2581 * fields are not directly accessed except through the macros defined below.
2585 struct hermon_hw_cqe_s
{
2589 uint32_t fcrc_sd
:1;
2592 uint32_t my_qpn
:24;
2594 uint32_t immed_rss_val_key
;
2597 uint32_t ml_path
:7;
2598 uint32_t srq_rqpn
:24;
2602 uint32_t slid
:16; /* SMAC 47:32 or SLID */
2604 uint32_t ipoib_status
; /* SMAC 31:0 or enet/ipoib/EoIB status */
2608 uint32_t wqe_cntr
:16;
2609 uint32_t checksum
:16;
2614 uint32_t send_or_recv
:1;
2615 uint32_t inline_scatter
:1;
2618 #define HERMON_COMPLETION_RECV 0x0
2619 #define HERMON_COMPLETION_SEND 0x1
2621 #define HERMON_CQE_DEFAULT_VERSION 0x0
2624 * The following macros are used for extracting (and in some cases filling in)
2625 * information from CQEs
2627 #define HERMON_CQE_QPNUM_MASK 0x00FFFFFF
2628 #define HERMON_CQE_QPNUM_SHIFT 0
2631 #define HERMON_CQE_DQPN_MASK 0x00FFFFFF
2632 #define HERMON_CQE_DQPN_SHIFT 0
2635 #define HERMON_CQE_SL_SHIFT 4
2636 #define HERMON_CQE_GRH_MASK 0x80
2637 #define HERMON_CQE_PATHBITS_MASK 0x7F
2638 #define HERMON_CQE_SLID_15_8 0xe
2639 #define HERMON_CQE_SLID_7_0 0xf
2640 #define HERMON_CQE_OPCODE_MASK 0x1F
2641 #define HERMON_CQE_SENDRECV_MASK 0x40
2642 #define HERMON_CQE_SENDRECV_SHIFT 6
2643 #define HERMON_CQE_OWNER_MASK 0x80
2644 #define HERMON_CQE_OWNER_SHIFT 7
2645 #define HERMON_CQE_WQECNTR_15_8 0x18
2646 #define HERMON_CQE_WQECNTR_7_0 0x19
2647 /* Byte offsets for IPoIB Checksum Offload fields */
2648 #define HERMON_CQE_CKSUM_15_8 0x1a
2649 #define HERMON_CQE_CKSUM_7_0 0x1b
2650 #define HERMON_CQE_IPOK 0x10 /* byte 0x10 in cqe */
2651 #define HERMON_CQE_IPOK_BIT 0x10 /* bitmask for OK bit */
2653 #define HERMON_CQE_IS_IPOK(cq, cqe) \
2654 (((uint8_t *)(cqe))[HERMON_CQE_IPOK] & HERMON_CQE_IPOK_BIT)
2656 #define HERMON_CQE_CKSUM(cq, cqe) \
2657 ((((uint8_t *)(cqe))[HERMON_CQE_CKSUM_15_8] << 8) | \
2658 (((uint8_t *)(cqe))[HERMON_CQE_CKSUM_7_0]))
2660 #define HERMON_CQE_IPOIB_STATUS(cq, cqe) \
2661 htonl((((uint32_t *)(cqe)))[4])
2663 #define HERMON_CQE_QPNUM_GET(cq, cqe) \
2664 ((htonl((((uint32_t *)(cqe)))[0]) & HERMON_CQE_QPNUM_MASK) >> \
2665 HERMON_CQE_QPNUM_SHIFT)
2667 #define HERMON_CQE_IMM_ETH_PKEY_CRED_GET(cq, cqe) \
2668 htonl(((uint32_t *)(cqe))[1])
2670 #define HERMON_CQE_DQPN_GET(cq, cqe) \
2671 ((htonl(((uint32_t *)(cqe))[2]) & HERMON_CQE_DQPN_MASK) >> \
2672 HERMON_CQE_DQPN_SHIFT)
2674 #define HERMON_CQE_GRH_GET(cq, cqe) \
2675 (((uint8_t *)(cqe))[8] & HERMON_CQE_GRH_MASK)
2677 #define HERMON_CQE_PATHBITS_GET(cq, cqe) \
2678 (((uint8_t *)(cqe))[8] & HERMON_CQE_PATHBITS_MASK)
2680 #define HERMON_CQE_DLID_GET(cq, cqe) \
2681 ((((uint8_t *)(cqe))[HERMON_CQE_SLID_15_8] << 8) | \
2682 (((uint8_t *)(cqe))[HERMON_CQE_SLID_7_0]))
2684 #define HERMON_CQE_SL_GET(cq, cqe) \
2685 ((((uint8_t *)(cqe))[12]) >> HERMON_CQE_SL_SHIFT)
2687 #define HERMON_CQE_BYTECNT_GET(cq, cqe) \
2688 htonl(((uint32_t *)(cqe))[5])
2690 #define HERMON_CQE_WQECNTR_GET(cq, cqe) \
2691 ((((uint8_t *)(cqe))[HERMON_CQE_WQECNTR_15_8] << 8) | \
2692 (((uint8_t *)(cqe))[HERMON_CQE_WQECNTR_7_0]))
2694 #define HERMON_CQE_ERROR_SYNDROME_GET(cq, cqe) \
2695 (((uint8_t *)(cqe))[27])
2697 #define HERMON_CQE_ERROR_VENDOR_SYNDROME_GET(cq, cqe) \
2698 (((uint8_t *)(cqe))[26])
2700 #define HERMON_CQE_OPCODE_GET(cq, cqe) \
2701 ((((uint8_t *)(cqe))[31]) & HERMON_CQE_OPCODE_MASK)
2703 #define HERMON_CQE_SENDRECV_GET(cq, cqe) \
2704 (((((uint8_t *)(cqe))[31]) & HERMON_CQE_SENDRECV_MASK) >> \
2705 HERMON_CQE_SENDRECV_SHIFT)
2707 #define HERMON_CQE_FEXCH_SEQ_CNT(cq, cqe) \
2708 HERMON_CQE_CKSUM(cq, cqe)
2710 #define HERMON_CQE_FEXCH_TX_BYTES(cq, cqe) \
2711 htonl(((uint32_t *)(cqe))[3])
2713 #define HERMON_CQE_FEXCH_RX_BYTES(cq, cqe) \
2714 htonl(((uint32_t *)(cqe))[4])
2716 #define HERMON_CQE_FEXCH_SEQ_ID(cq, cqe) \
2717 (((uint8_t *)(cqe))[8])
2719 #define HERMON_CQE_FEXCH_DETAIL(cq, cqe) \
2720 htonl(((uint32_t *)(cqe))[0])
2722 #define HERMON_CQE_FEXCH_DIFE(cq, cqe) \
2723 ((((uint8_t *)(cqe))[0]) & 0x80)
2725 /* See Comment above for EQE - ownership of CQE is handled the same */
2727 #define HERMON_CQE_OWNER_IS_SW(cq, cqe, considx, shift, mask) \
2728 (((((uint8_t *)(cqe))[31] & HERMON_CQE_OWNER_MASK) >> \
2729 HERMON_CQE_OWNER_SHIFT) == \
2730 (((considx) & (mask)) >> (shift)))
2733 * Hermon Shared Receive Queue (SRQ) Context Entry Format
2736 #ifdef _LITTLE_ENDIAN
2737 struct hermon_hw_srqc_s
{
2738 uint32_t xrc_domain
:16;
2740 uint32_t log_rq_stride
:3;
2744 uint32_t log_srq_size
:4;
2749 uint32_t cqn_xrc
:24;
2751 uint32_t page_offs
:6;
2754 uint32_t mtt_base_addrl
:29;
2756 uint32_t mtt_base_addrh
:8;
2758 uint32_t log2_pgsz
:6;
2761 uint32_t wqe_cnt
:16;
2769 uint32_t srq_wqe_cntr
:16;
2773 uint32_t dbr_addrl
:30;
2777 uint32_t rsrc0
[80]; /* to match DEV_CAP size of 0x80 */
2780 #else /* BIG ENDIAN */
2781 struct hermon_hw_srqc_s
{
2783 uint32_t log_srq_size
:4;
2787 uint32_t log_rq_stride
:3;
2789 uint32_t xrc_domain
:16;
2791 uint32_t page_offs
:6;
2793 uint32_t cqn_xrc
:24;
2798 uint32_t log2_pgsz
:6;
2800 uint32_t mtt_base_addrh
:8;
2802 uint32_t mtt_base_addrl
:29;
2809 uint32_t wqe_cnt
:16;
2812 uint32_t srq_wqe_cntr
:16;
2818 uint32_t dbr_addrl
:30;
2821 uint32_t rsrc0
[80]; /* to match DEV_CAP size of 0x80 */
2826 * Hermon MOD_STAT_CFG input mailbox structure
2830 #ifdef _LITTLE_ENDIAN
2831 struct hermon_hw_mod_stat_cfg_s
{
2833 uint32_t qdr_rx_op
:4;
2835 uint32_t qdr_rx_opt_m
:1;
2836 uint32_t qdr_tx_op
:4;
2838 uint32_t qdr_tx_opt_m
:1;
2840 uint32_t log_pg_sz
:8;
2841 uint32_t log_pg_sz_m
:1;
2845 uint32_t rx_options
:4;
2847 uint32_t rx_options_m
:1;
2848 uint32_t tx_options
:4;
2850 uint32_t tx_options_m
:1;
2855 uint32_t port_en
:1;
2856 uint32_t port_en_m
:1;
2864 uint32_t guid_hi_m
:1;
2869 uint32_t guid_lo_m
:1;
2873 uint32_t inbuf_ind_en
:3;
2875 uint32_t sd_main
:4;
2877 uint32_t sd_equal
:4;
2879 uint32_t sd_mux_main
:2;
2883 uint32_t sigdet_th
:3;
2886 uint32_t ob_preemp_pre
:5;
2888 uint32_t op_preemp_post
:5;
2890 uint32_t ob_preemp_main
:5;
2892 uint32_t ob_preemp
:5;
2894 uint32_t serdes_m
:1;
2896 uint32_t reserved
[22];
2898 uint32_t mac_lo
:32;
2900 uint32_t mac_hi
:16;
2904 #else /* BIG ENDIAN */
2905 struct hermon_hw_mod_stat_cfg_s
{
2906 uint32_t tx_options_m
:1;
2908 uint32_t tx_options
:4;
2909 uint32_t rx_options_m
:1;
2911 uint32_t rx_options
:4;
2915 uint32_t log_pg_sz_m
:1;
2916 uint32_t log_pg_sz
:8;
2918 uint32_t qdr_tx_opt_m
:1;
2920 uint32_t qdr_tx_op
:4;
2921 uint32_t qdr_rx_opt_m
:1;
2923 uint32_t qdr_rx_op
:4;
2929 uint32_t port_en_m
:1;
2930 uint32_t port_en
:1;
2935 uint32_t guid_hi_m
:1;
2940 uint32_t guid_lo_m
:1;
2947 uint32_t serdes_m
:1;
2949 uint32_t ob_preemp
:5;
2951 uint32_t ob_preemp_main
:5;
2953 uint32_t op_preemp_post
:5;
2955 uint32_t ob_preemp_pre
:5;
2958 uint32_t sigdet_th
:3;
2962 uint32_t sd_mux_main
:2;
2964 uint32_t sd_equal
:4;
2966 uint32_t sd_main
:4;
2968 uint32_t inbuf_ind_en
:3;
2970 uint32_t reserved
[22]; /* get to new enet stuff */
2974 uint32_t mac_hi
:16;
2976 uint32_t mac_lo
:32;
2981 * Hermon MOD_STAT_CFG input modifier structure
2982 * NOTE: this might end up defined ONLY one way,
2983 * if usage is access via macros
2985 struct hermon_hw_msg_in_mod_s
{
2986 #ifdef _LITTLE_ENDIAN
2988 uint32_t port_num
:8;
2989 uint32_t lane_num
:4;
2990 uint32_t link_speed
:3;
2991 uint32_t auto_neg
:1;
2995 uint32_t auto_neg
:1;
2996 uint32_t link_speed
:3;
2997 uint32_t lane_num
:4;
2998 uint32_t port_num
:8;
3005 * Hermon UD Address Vector (UDAV)
3006 * Hermon UDAV are used in conjunction with Unreliable Datagram (UD) send
3007 * WQEs. Each UD send message contains an address vector in in the datagram
3008 * segment. The verbs consumer must use special verbs to create and modify
3009 * address handles, each of which contains a UDAV structure. When posting
3010 * send WQEs to UD QP, the verbs consumer must supply a valid address
3015 #ifdef _LITTLE_ENDIAN
3016 struct hermon_hw_udav_s
{
3018 uint32_t ml_path
:7; /* mlid or SMAC idx */
3023 uint32_t portnum
:2;
3025 uint32_t force_lb
:1;
3027 uint32_t flow_label
:20;
3031 uint32_t hop_limit
:8;
3032 uint32_t max_stat_rate
:4;
3034 uint32_t mgid_index
:7;
3041 struct hermon_hw_udav_s
{
3042 uint32_t force_lb
:1;
3044 uint32_t portnum
:2;
3049 uint32_t ml_path
:7; /* mlid or SMAC idx */
3053 uint32_t mgid_index
:7;
3055 uint32_t max_stat_rate
:4;
3056 uint32_t hop_limit
:8;
3060 uint32_t flow_label
:20;
3066 #define HERMON_UDAV_MODIFY_MASK0 0xFCFFFFFFFF000000ULL
3067 #define HERMON_UDAV_MODIFY_MASK1 0xFF80F00000000000ULL
3069 /* UDAV for enthernet */
3071 #ifdef _LITTLE_ENDIAN
3072 struct hermon_hw_udav_enet_s
{
3074 uint32_t smac_idx
:7;
3078 uint32_t portnum
:2;
3082 uint32_t force_lb
:1;
3084 uint32_t flow_label
:20;
3088 uint32_t hop_limit
:8;
3089 uint32_t max_stat_rate
:4;
3091 uint32_t mgid_index
:7;
3101 uint32_t dmac_hi
:16;
3105 struct hermon_hw_udav_enet_s
{
3106 uint32_t force_lb
:1;
3110 uint32_t portnum
:2;
3114 uint32_t smac_idx
:7;
3118 uint32_t mgid_index
:7;
3120 uint32_t max_stat_rate
:4;
3121 uint32_t hop_limit
:8;
3125 uint32_t flow_label
:20;
3133 uint32_t dmac_hi
:16;
3140 * Hermon Queue Pair Context Table (QPC) entries
3141 * The QPC table is a virtually-contiguous memory area residing in HCA
3142 * ICM. Each QPC entry is accessed for reads and writes
3143 * by the HCA while executing work requests on the associated QP.
3145 * The following structure is used in the RST2INIT_QP, INIT2INIT_QP,
3146 * INIT2RTR_QP, RTR2RTS_QP, RTS2RTS_QP, SQERR2RTS_QP, TOERR_QP, RTS2SQD_QP,
3147 * SQD2RTS_QP, TORST_QP, and QUERY_QP commands.
3148 * With the exception of the QUERY_QP command, each of these commands reads
3149 * from some portion of the QPC in the input mailbox and modified the QPC
3150 * stored in the hardware. The QUERY_QP command retrieves a snapshot of a
3151 * QPC entry. The command stores the snapshot in the output mailbox. The
3152 * QPC state and its values are not affected by the QUERY_QP command.
3154 * Below we first define the hermon_hw_addr_path_t or "Hermon Address Path"
3155 * structure. This structure is used to provide address path information
3156 * (both primary and secondary) for each QP context. Note: Since this
3157 * structure is _very_ similar to the hermon_hw_udav_t structure above,
3158 * we are able to leverage the similarity with filling in and reading from
3159 * the two types of structures. See hermon_get_addr_path() and
3160 * hermon_set_addr_path() in hermon_misc.c for more details.
3162 #if (DATAMODEL_NATIVE == DATAMODEL_LP64)
3166 #ifdef _LITTLE_ENDIAN
3167 struct hermon_hw_addr_path_s
{
3169 uint32_t mlid
:7; /* mlid or SMAC idx */
3171 uint32_t cntr_idx
:8;
3173 uint32_t pkey_indx
:7;
3175 uint32_t :1; /* but may be used for enet */
3177 uint32_t force_lb
:1;
3179 uint32_t flow_label
:20;
3181 uint32_t sniff_s_in
:1;
3182 uint32_t sniff_s_out
:1;
3183 uint32_t sniff_r_in
:1;
3184 uint32_t sniff_r_out
:1; /* sniff-rcv-egress */
3186 uint32_t hop_limit
:8;
3187 uint32_t max_stat_rate
:4;
3189 uint32_t mgid_index
:7;
3191 uint32_t link_type
:3;
3192 uint32_t ack_timeout
:5;
3197 uint32_t dmac_hi
:16;
3200 uint32_t :8; /* but may be used for enet */
3207 uint32_t vlan_idx
:7;
3209 uint32_t sched_q
:8;
3211 uint32_t dmac_lo
:32;
3214 struct hermon_hw_addr_path_s
{
3215 uint32_t force_lb
:1;
3217 uint32_t :1; /* but may be used for enet */
3219 uint32_t pkey_indx
:7;
3221 uint32_t cntr_idx
:8;
3223 uint32_t mlid
:7; /* mlid or SMAC idx */
3226 uint32_t ack_timeout
:5;
3227 uint32_t link_type
:3;
3229 uint32_t mgid_index
:7;
3231 uint32_t max_stat_rate
:4;
3232 uint32_t hop_limit
:8;
3234 uint32_t sniff_r_out
:1; /* sniff-rcv-egress */
3235 uint32_t sniff_r_in
:1;
3236 uint32_t sniff_s_out
:1;
3237 uint32_t sniff_s_in
:1;
3239 uint32_t flow_label
:20;
3244 uint32_t sched_q
:8;
3246 uint32_t vlan_idx
:7;
3253 uint32_t :8; /* but may be used for enet */
3256 uint32_t dmac_hi
:16;
3258 uint32_t dmac_lo
:32;
3260 #endif /* LITTLE ENDIAN */
3262 /* The addr path includes RSS fields for RSS QPs */
3263 #ifdef _LITTLE_ENDIAN
3264 struct hermon_hw_rss_s
{
3268 uint32_t cntr_idx
:8;
3270 uint32_t pkey_indx
:7;
3272 uint32_t :1; /* but may be used for enet */
3274 uint32_t force_lb
:1;
3276 uint32_t flow_label
:20;
3278 uint32_t sniff_s_in
:1;
3279 uint32_t sniff_s_out
:1;
3280 uint32_t sniff_r_in
:1;
3281 uint32_t sniff_r_out
:1; /* sniff-rcv-egress */
3283 uint32_t hop_limit
:8;
3284 uint32_t max_stat_rate
:4;
3286 uint32_t mgid_index
:7;
3288 uint32_t link_type
:3;
3289 uint32_t ack_timeout
:5;
3294 uint32_t base_qpn
:24;
3295 uint32_t log2_tbl_sz
:4;
3298 uint32_t :8; /* but may be used for enet */
3305 uint32_t vlan_idx
:7;
3307 uint32_t sched_q
:8;
3310 uint32_t tcp_ipv6
:1;
3312 uint32_t tcp_ipv4
:1;
3315 uint32_t hash_fn
:2;
3318 uint32_t default_qpn
:24;
3321 uint8_t rss_key
[40];
3323 #else /* BIG ENDIAN */
3324 struct hermon_hw_rss_s
{
3325 uint32_t force_lb
:1;
3327 uint32_t :1; /* but may be used for enet */
3329 uint32_t pkey_indx
:7;
3331 uint32_t cntr_idx
:8;
3336 uint32_t ack_timeout
:5;
3337 uint32_t link_type
:3;
3339 uint32_t mgid_index
:7;
3341 uint32_t max_stat_rate
:4;
3342 uint32_t hop_limit
:8;
3344 uint32_t sniff_r_out
:1; /* sniff-rcv-egress */
3345 uint32_t sniff_r_in
:1;
3346 uint32_t sniff_s_out
:1;
3347 uint32_t sniff_s_in
:1;
3349 uint32_t flow_label
:20;
3354 uint32_t sched_q
:8;
3356 uint32_t vlan_idx
:7;
3363 uint32_t :8; /* but may be used for enet */
3366 uint32_t log2_tbl_sz
:4;
3367 uint32_t base_qpn
:24;
3370 uint32_t default_qpn
:24;
3373 uint32_t hash_fn
:2;
3376 uint32_t tcp_ipv4
:1;
3378 uint32_t tcp_ipv6
:1;
3381 uint8_t rss_key
[40];
3383 #endif /* LITTLE ENDIAN */
3385 #if (DATAMODEL_NATIVE == DATAMODEL_LP64)
3389 #if (DATAMODEL_NATIVE == DATAMODEL_LP64)
3392 #ifdef _LITTLE_ENDIAN
3393 struct hermon_hw_qpc_s
{
3398 uint32_t pm_state
:2;
3401 uint32_t serv_type
:8;
3405 uint32_t usr_page
:24;
3411 uint32_t log_sq_stride
:3;
3412 uint32_t log_sq_size
:4;
3413 uint32_t sq_no_prefetch
:1;
3414 uint32_t log_rq_stride
:3;
3415 uint32_t log_rq_size
:4;
3417 uint32_t msg_max
:5;
3420 uint32_t rem_qpn
:24;
3423 uint32_t loc_qpn
:24;
3426 hermon_hw_addr_path_t pri_addr_path
;
3428 hermon_hw_addr_path_t alt_addr_path
;
3433 uint32_t cur_retry_cnt
:3;
3434 uint32_t cur_rnr_retry
:3;
3437 uint32_t rnr_retry
:3;
3438 uint32_t retry_cnt
:3;
3440 uint32_t sra_max
:3;
3442 uint32_t ack_req_freq
:4;
3444 uint32_t cqn_snd
:24;
3447 uint32_t next_snd_psn
:24;
3457 uint32_t last_acked_psn
:24;
3460 uint32_t next_rcv_psn
:24;
3461 uint32_t min_rnr_nak
:5;
3467 uint32_t page_offs
:6;
3473 uint32_t rra_max
:3;
3476 uint32_t cqn_rcv
:24;
3483 uint32_t dbr_addrl
:30;
3485 uint32_t dbr_addrh
:32;
3487 uint32_t srq_number
:24;
3493 uint32_t sq_wqe_counter
:16;
3494 uint32_t rq_wqe_counter
:16;
3503 uint32_t base_mkey
:24; /* bits 32-8, low 7 m/b 0 */
3504 uint32_t num_rmc_peers
:8;
3506 uint32_t rmc_parent_qpn
:24;
3507 uint32_t header_sep
:1;
3508 uint32_t inline_scatter
:1; /* m/b 0 for srq */
3510 uint32_t rmc_enable
:2;
3511 uint32_t :2; /* may use one bit for enet */
3512 uint32_t mkey_remap
:1;
3515 uint32_t mtt_base_addrl
:29;
3517 uint32_t mtt_base_addrh
:8;
3519 uint32_t log2_pgsz
:6;
3522 uint32_t exch_base
:16;
3523 uint32_t exch_size
:4;
3526 uint32_t vft_vf_id
:12;
3527 uint32_t vft_prior
:3;
3534 uint32_t my_fc_id_idx
:8;
3535 uint32_t vft_hop_cnt
:8;
3539 #else /* BIG ENDIAN */
3540 struct hermon_hw_qpc_s
{
3543 uint32_t serv_type
:8;
3546 uint32_t pm_state
:2;
3553 uint32_t msg_max
:5;
3555 uint32_t log_rq_size
:4;
3556 uint32_t log_rq_stride
:3;
3557 uint32_t sq_no_prefetch
:1;
3558 uint32_t log_sq_size
:4;
3559 uint32_t log_sq_stride
:3;
3565 uint32_t usr_page
:24;
3568 uint32_t loc_qpn
:24;
3571 uint32_t rem_qpn
:24;
3573 hermon_hw_addr_path_t pri_addr_path
;
3575 hermon_hw_addr_path_t alt_addr_path
;
3577 uint32_t ack_req_freq
:4;
3579 uint32_t sra_max
:3;
3581 uint32_t retry_cnt
:3;
3582 uint32_t rnr_retry
:3;
3585 uint32_t cur_rnr_retry
:3;
3586 uint32_t cur_retry_cnt
:3;
3592 uint32_t next_snd_psn
:24;
3595 uint32_t cqn_snd
:24;
3602 uint32_t last_acked_psn
:24;
3608 uint32_t rra_max
:3;
3614 uint32_t page_offs
:6;
3620 uint32_t min_rnr_nak
:5;
3621 uint32_t next_rcv_psn
:24;
3627 uint32_t cqn_rcv
:24;
3629 uint32_t dbr_addrh
:32;
3631 uint32_t dbr_addrl
:30;
3638 uint32_t srq_number
:24;
3643 uint32_t rq_wqe_counter
:16;
3644 uint32_t sq_wqe_counter
:16;
3650 uint32_t mkey_remap
:1;
3651 uint32_t :2; /* may use one bit for enet */
3652 uint32_t rmc_enable
:2;
3654 uint32_t inline_scatter
:1; /* m/b 0 for srq */
3655 uint32_t header_sep
:1;
3656 uint32_t rmc_parent_qpn
:24;
3658 uint32_t num_rmc_peers
:8;
3659 uint32_t base_mkey
:24; /* bits 32-8, low 7 m/b 0 */
3662 uint32_t log2_pgsz
:6;
3664 uint32_t mtt_base_addrh
:8;
3666 uint32_t mtt_base_addrl
:29;
3671 uint32_t vft_prior
:3;
3672 uint32_t vft_vf_id
:12;
3675 uint32_t exch_size
:4;
3676 uint32_t exch_base
:16;
3678 uint32_t vft_hop_cnt
:8;
3679 uint32_t my_fc_id_idx
:8;
3686 #endif /* LITTLE ENDIAN */
3688 #if (DATAMODEL_NATIVE == DATAMODEL_LP64)
3692 #define HERMON_QP_RESET 0x0
3693 #define HERMON_QP_INIT 0x1
3694 #define HERMON_QP_RTR 0x2
3695 #define HERMON_QP_RTS 0x3
3696 #define HERMON_QP_SQERR 0x4
3697 #define HERMON_QP_SQD 0x5
3698 #define HERMON_QP_ERR 0x6
3699 #define HERMON_QP_SQDRAINING 0x7
3701 #define HERMON_QP_RC 0x0
3702 #define HERMON_QP_UC 0x1
3703 #define HERMON_QP_UD 0x3
3704 #define HERMON_QP_FCMND 0x4
3705 #define HERMON_QP_FEXCH 0x5
3706 #define HERMON_QP_XRC 0x6
3707 #define HERMON_QP_MLX 0x7
3708 #define HERMON_QP_RFCI 0x9
3710 #define HERMON_QP_PMSTATE_MIGRATED 0x3
3711 #define HERMON_QP_PMSTATE_ARMED 0x0
3712 #define HERMON_QP_PMSTATE_REARM 0x1
3714 #define HERMON_QP_DESC_EVT_DISABLED 0x0
3715 #define HERMON_QP_DESC_EVT_ENABLED 0x1
3717 #define HERMON_QP_FLIGHT_LIM_UNLIMITED 0xF
3719 #define HERMON_QP_SQ_ALL_SIGNALED 0x1
3720 #define HERMON_QP_SQ_WR_SIGNALED 0x0
3721 #define HERMON_QP_RQ_ALL_SIGNALED 0x1
3722 #define HERMON_QP_RQ_WR_SIGNALED 0x0
3724 #define HERMON_QP_SRQ_ENABLED 0x1
3725 #define HERMON_QP_SRQ_DISABLED 0x0
3727 #define HERMON_QP_WQE_BASE_SHIFT 0x6
3730 * Hermon Multicast Group Member (MCG)
3731 * Hermon MCG are organized in a virtually-contiguous memory table (the
3732 * Multicast Group Table) in the ICM. This table is
3733 * actually comprised of two consecutive tables: the Multicast Group Hash
3734 * Table (MGHT) and the Additional Multicast Group Members Table (AMGM).
3735 * Each such entry contains an MGID and a list of QPs that are attached to
3736 * the multicast group. Each such entry may also include an index to an
3737 * Additional Multicast Group Member Table (AMGM) entry. The AMGMs are
3738 * used to form a linked list of MCG entries that all map to the same hash
3739 * value. The MCG entry size is configured through the INIT_HCA command.
3740 * Note: An MCG actually consists of a single hermon_hw_mcg_t and some
3741 * number of hermon_hw_mcg_qp_list_t (such that the combined structure is a
3744 * The following structures are used in the READ_MGM and WRITE_MGM commands.
3745 * The READ_MGM command reads an MCG entry from the multicast table and
3746 * returns it in the output mailbox. Note: This operation does not affect
3747 * the MCG entry state or values.
3748 * The WRITE_MGM command retrieves an MCG entry from the input mailbox and
3749 * stores it in the multicast group table at the index specified in the
3750 * command. Once the command has finished execution, the multicast group
3751 * table is updated. The old entry contents are lost.
3753 #ifdef _LITTLE_ENDIAN
3754 struct hermon_hw_mcg_s
{
3755 uint32_t member_cnt
:24;
3757 uint32_t protocol
:2;
3760 uint32_t next_gid_indx
:26;
3769 struct hermon_hw_mcg_s
{
3770 uint32_t next_gid_indx
:26;
3773 uint32_t protocol
:2;
3775 uint32_t member_cnt
:24;
3785 #ifdef _LITTLE_ENDIAN
3786 struct hermon_hw_mcg_en_s
{
3787 uint32_t member_cnt
:24;
3789 uint32_t protocol
:2;
3792 uint32_t next_gid_indx
:26;
3797 uint32_t vlan_present
:1;
3802 uint32_t mac_lo
:32;
3804 uint32_t mac_hi
:16;
3805 uint32_t vlan_id
:12;
3806 uint32_t vlan_cfi
:1;
3807 uint32_t vlan_prior
:3;
3811 struct hermon_hw_mcg_en_s
{
3812 uint32_t next_gid_indx
:26;
3815 uint32_t protocol
:2;
3817 uint32_t member_cnt
:24;
3825 uint32_t vlan_present
:1;
3827 uint32_t vlan_prior
:3;
3828 uint32_t vlan_cfi
:1;
3829 uint32_t vlan_id
:12;
3830 uint32_t mac_hi
:16;
3832 uint32_t mac_lo
:32;
3838 /* Multicast Group Member - QP List entries */
3839 #ifdef _LITTLE_ENDIAN
3840 struct hermon_hw_mcg_qp_list_s
{
3847 struct hermon_hw_mcg_qp_list_s
{
3855 #define HERMON_MCG_QPN_BLOCK_LB 0x40000000
3858 * ETHERNET ONLY Commands
3859 * The follow are new commands, used only for an Ethernet Port
3862 #ifdef _LITTLE_ENDIAN
3863 struct hermon_hw_set_mcast_fltr_s
{
3866 uint32_t mac_hi
:16;
3870 #else /* BIG ENDIAN */
3871 struct hermon_hw_set_mcast_fltr_s
{
3874 uint32_t mac_hi
:16;
3880 /* opmod for set_mcast_fltr */
3881 #define HERMON_SET_MCAST_FLTR_CONF 0x0
3882 #define HERMON_SET_MCAST_FLTR_DIS 0x1
3883 #define HERMON_SET_MCAST_FLTR_EN 0x2
3887 * FC Command structures
3892 #ifdef _LITTLE_ENDIAN
3893 struct hermon_hw_config_fc_basic_s
{
3902 uint32_t fexch_base_hi
:8;
3905 uint32_t rfci_base
:24;
3906 uint32_t log2_num_rfci
:3;
3909 uint32_t fx_base_mpt_lo
:8;
3911 uint32_t fx_base_mpt_hi
:7;
3913 uint32_t fcoe_prom_qpn
:24;
3914 uint32_t uint32_t :8;
3921 struct hermon_hw_config_fc_basic_s
{
3923 uint32_t fexch_base_hi
:8;
3933 uint32_t fx_base_mpt_hi
:7;
3935 uint32_t fx_base_mpt_lo
:8;
3938 uint32_t log2_num_rfci
:3;
3939 uint32_t rfci_base
:24;
3943 uint32_t uint32_t :8;
3944 uint32_t fcoe_prom_qpn
:24;
3950 #define HERMON_HW_FC_PORT_ENABLE 0x0
3951 #define HERMON_HW_FC_PORT_DISABLE 0x1
3952 #define HERMON_HW_FC_CONF_BASIC 0x0000
3953 #define HERMON_HW_FC_CONF_NPORT 0x0100
3955 #ifdef _LITTLE_ENDIAN
3956 struct hermon_hw_query_fc_s
{
3959 uint32_t log2_max_rfci
:3;
3961 uint32_t log2_max_fexch
:5;
3963 uint32_t log2_max_nports
:3;
3969 struct hermon_hw_query_fc_s
{
3971 uint32_t log2_max_nports
:3;
3973 uint32_t log2_max_fexch
:5;
3975 uint32_t log2_max_rfci
:3;
3986 /* ARM_RQ - limit water mark for srq & rq */
3987 #ifdef _LITTLE_ENDIAN
3988 struct hermon_hw_arm_req_s
{
3995 struct hermon_hw_arm_req_s
{
4004 * Structure for getting the peformance counters from the HCA
4007 #ifdef _LITTLE_ENDIAN
4008 struct hermon_hw_sm_perfcntr_s
{
4009 uint32_t linkdown
:8;
4010 uint32_t linkerrrec
:8;
4011 uint32_t symerr
:16;
4013 uint32_t cntrsel
:16;
4014 uint32_t portsel
:8;
4017 uint32_t portxmdiscard
:16;
4018 uint32_t portrcvswrelay
:16;
4020 uint32_t portrcvrem
:16;
4021 uint32_t portrcv
:16;
4023 uint32_t vl15drop
:16;
4026 uint32_t xsbuffovrun
:4;
4027 uint32_t locallinkint
:4;
4029 uint32_t portrcconstr
:8;
4030 uint32_t portxmconstr
:8;
4032 uint32_t portrcdata
;
4034 uint32_t portxmdata
;
4036 uint32_t portrcpkts
;
4038 uint32_t portxmpkts
;
4042 uint32_t portxmwait
;
4044 #else /* BIG ENDIAN */
4045 struct hermon_hw_sm_perfcntr_s
{
4047 uint32_t portsel
:8;
4048 uint32_t cntrsel
:16;
4050 uint32_t symerr
:16;
4051 uint32_t linkerrrec
:8;
4052 uint32_t linkdown
:8;
4054 uint32_t portrcv
:16;
4055 uint32_t portrcvrem
:16;
4057 uint32_t portrcvswrelay
:16;
4058 uint32_t portxmdiscard
:16;
4060 uint32_t portxmconstr
:8;
4061 uint32_t portrcconstr
:8;
4063 uint32_t locallinkint
:4;
4064 uint32_t xsbuffovrun
:4;
4067 uint32_t vl15drop
:16;
4069 uint32_t portxmdata
;
4071 uint32_t portrcdata
;
4073 uint32_t portxmpkts
;
4075 uint32_t portrcpkts
;
4077 uint32_t portxmwait
;
4084 * Structure for getting the extended peformance counters from the HCA
4087 #ifdef _LITTLE_ENDIAN
4088 struct hermon_hw_sm_extperfcntr_s
{
4090 uint32_t cntrsel
:16;
4091 uint32_t portsel
:8;
4094 uint64_t portxmdata
;
4096 uint64_t portrcdata
;
4098 uint64_t portxmpkts
;
4100 uint64_t portrcpkts
;
4102 uint64_t portunicastxmpkts
;
4104 uint64_t portunicastrcpkts
;
4106 uint64_t portmulticastxmpkts
;
4108 uint64_t portmulticastrcpkts
;
4110 #else /* BIG ENDIAN */
4111 struct hermon_hw_sm_extperfcntr_s
{
4113 uint32_t portsel
:8;
4114 uint32_t cntrsel
:16;
4117 uint64_t portxmdata
;
4119 uint64_t portrcdata
;
4121 uint64_t portxmpkts
;
4123 uint64_t portrcpkts
;
4125 uint64_t portunicastxmpkts
;
4127 uint64_t portunicastrcpkts
;
4129 uint64_t portmulticastxmpkts
;
4131 uint64_t portmulticastrcpkts
;
4137 * Hermon User Access Region (UAR)
4139 * JBDB : writeup on the UAR for memfree
4141 * JBDB : writeup on the structures
4147 * [es] and change it even further for hermon
4148 * the whole UAR and doorbell record (dbr) approach is changed again
4149 * from arbel, and needs commenting
4154 * Tavor doorbells are each rung by writing to the doorbell registers that
4155 * form a User Access Region (UAR). A doorbell is a write-only hardware
4156 * register which enables passing information from software to hardware
4157 * with minimum software latency. A write operation from the host software
4158 * to these doorbell registers passes information about the HCA resources
4159 * and initiates processing of the doorbell data. There are 6 types of
4160 * doorbells in Tavor.
4162 * "Send Doorbell" for synchronizing the attachment of a WQE (or a chain
4163 * of WQEs) to the send queue.
4164 * "RD Send Doorbell" (Same as above, except for RD QPs) is not supported.
4165 * "Receive Doorbell" for synchronizing the attachment of a WQE (or a chain
4166 * of WQEs) to the receive queue.
4167 * "CQ Doorbell" for updating the CQ consumer index and requesting
4168 * completion notifications.
4169 * "EQ Doorbell" for updating the EQ consumer index, arming interrupt
4170 * triggering, and disarming CQ notification requests.
4171 * "InfiniBlast" (which would have enabled access to the "InfiniBlast
4172 * buffer") is not supported.
4174 * Note: The tavor_hw_uar_t below is the container for all of the various
4175 * doorbell types. Below we first define several structures which make up
4176 * the contents of those doorbell types.
4178 * Note also: The following structures are not #define'd with both little-
4179 * endian and big-endian definitions. This is because each doorbell type
4180 * is not directly accessed except through a single ddi_put64() operation
4181 * (see tavor_qp_send_doorbell, tavor_qp_recv_doorbell, tavor_cq_doorbell,
4182 * or tavor_eq_doorbell)
4186 * Send doorbell register structure
4188 typedef struct hermon_hw_send_db_reg_s
{
4191 uint32_t snd_q_num
:24;
4193 } hermon_hw_send_db_reg_t
;
4195 #define HERMON_QPSNDDB_QPN_SHIFT 0x8
4197 /* Max descriptors per Hermon doorbell */
4198 #define HERMON_QP_MAXDESC_PER_DB 256
4201 * CQ doorbell register structure
4203 typedef struct hermon_hw_cq_db_reg_s
{
4211 /* consumer cntr of last polled completion */
4213 } hermon_hw_cq_db_reg_t
;
4215 #define HERMON_CQDB_CMD_SHIFT 0x18 /* dec 24 */
4216 #define HERMON_CQDB_CMDSN_SHIFT 0x1C /* dec 28 */
4219 #define HERMON_CQDB_NOTIFY_CQ 0x02
4220 #define HERMON_CQDB_NOTIFY_CQ_SOLICIT 0x01
4222 /* Default value for use in NOTIFY_CQ doorbell */
4223 #define HERMON_CQDB_DEFAULT_PARAM 0xFFFFFFFF
4225 typedef struct hermon_hw_guest_eq_ci_s
{ /* guest op eq consumer index */
4228 uint32_t guestos_ci
:24;
4231 } hermon_hw_guest_eq_ci_t
;
4236 * UAR page structure, containing all doorbell registers
4238 struct hermon_hw_uar_s
{
4241 hermon_hw_send_db_reg_t send
;
4245 hermon_hw_cq_db_reg_t cq
;
4247 uint32_t rsrv2
[502]; /* next is at offset 0x800 */
4249 hermon_hw_guest_eq_ci_t g_eq0
;
4250 hermon_hw_guest_eq_ci_t g_eq1
;
4251 hermon_hw_guest_eq_ci_t g_eq2
;
4252 hermon_hw_guest_eq_ci_t g_eq3
;
4254 uint32_t rsrv3
[504]; /* end of page */
4258 * QP (RQ, SRQ) doorbell record-specific data
4259 * Note that this structure is NOT in ICM, but just kept in host memory
4260 * and managed independently of PRM or other constraints. Also, though
4261 * the qp/srq doorbell need to be only 4 bytes, it is 8 bytes in memory for
4262 * ease of management. Hermon defines its usage in the QP chapter.
4264 typedef struct hermon_hw_qp_db_s
{
4266 uint32_t rcv_wqe_cntr
:16; /* wqe_counter */
4269 } hermon_hw_qp_db_t
;
4272 * CQ (ARM and SET_CI) doorbell record-specific data
4273 * See comment above re: QP doorbell. This dbr is 8 bytes long, and its
4274 * usage is defined in PRM chapter on Completion Queues
4276 typedef struct hermon_hw_cq_arm_db_s
{
4278 uint32_t update_ci
:24;
4281 /* sequence number of the doorbell ring % 4 */
4284 uint32_t cmd
:3; /* command */
4286 } hermon_hw_cq_db_t
;
4288 #define HERMON_CQ_DB_CMD_SOLICTED 0x01
4289 #define HERMON_CQ_DB_CMD_NEXT 0x02
4293 * Hermon Blue Flame (BF)
4294 * Hermon has the ability to do a low-latency write of successive WQEs
4295 * for the HCA. This utilizes part of the memory area behind the
4296 * same BAR as the UAR page (see above) - half the area is devoted to
4297 * UAR pages, the other half to BlueFlame (though in fairness, the return
4298 * information from QUERY_DEV_CAP should be consulted _in case_ they ever
4299 * decide to change it.
4301 * We define the structures to access them below.
4306 * Hermon Send Work Queue Element (WQE)
4307 * A Hermon Send WQE is built of the following segments, each of which is a
4308 * multiple of 16 bytes. Note: Each individual WQE may contain only a
4309 * subset of these segments described below (according to the operation type
4310 * and transport type of the QP).
4312 * The first 16 bytes of ever WQE are formed from the "Ctrl" segment.
4313 * This segment contains the address of the next WQE to be executed and the
4314 * information required in order to allocate the resources to execute the
4315 * next WQE. The "Ctrl" part of this segment contains the control
4316 * information required to execute the WQE, including the opcode and other
4317 * control information.
4318 * The "Datagram" segment contains address information required in order to
4319 * form a UD message.
4320 * The "Bind" segment contains the parameters required for a Bind Memory
4322 * The "Remote Address" segment is present only in RDMA or Atomic WQEs and
4323 * specifies remote virtual addresses and RKey, respectively. Length of
4324 * the remote access is calculated from the scatter/gather list (for
4325 * RDMA-write/RDMA-read) or set to eight (for Atomic).
4326 * The "Atomic" segment is present only in Atomic WQEs and specifies
4327 * Swap/Add and Compare data.
4329 * Note: The following structures are not #define'd with both little-endian
4330 * and big-endian definitions. This is because their individual fields are
4331 * not directly accessed except through macros defined below.
4335 struct hermon_hw_snd_wqe_ctrl_s
{
4351 uint32_t ds
:6; /* WQE size in octowords */
4354 * XRC remote buffer if impl
4355 * XRC 23:0, or DMAC 47:32& 8 bits of pad
4357 uint32_t xrc_rem_buf
:24;
4359 uint32_t fcrc
:1; /* fc crc calc */
4360 uint32_t tcp_udp
:1; /* Checksumming */
4361 uint32_t ip
:1; /* Checksumming */
4362 uint32_t cq_gen
:2; /* 00=no cqe, 11= gen cqe */
4363 /* s-bit set means solicit bit in last packet */
4365 uint32_t force_lb
:1;
4368 * immediate OR invalidation key OR DMAC 31:0 depending
4370 uint32_t immediate
:32;
4373 struct hermon_hw_srq_wqe_next_s
{
4375 uint32_t next_wqe_idx
:16;
4381 struct hermonw_hw_fcp3_ctrl_s
{
4406 struct hermon_hw_fcp3_init_s
{
4411 uint32_t csctl_prior
:8;
4412 uint32_t seqid_tx
:8;
4416 uint32_t rem_id
:24;
4424 uint32_t rem_exch
:16;
4425 uint32_t loc_exch_idx
:16;
4428 struct hermon_hw_fcmd_o_enet_s
{
4430 uint32_t stat_rate
:4;
4436 uint32_t dmac_hi
:16;
4438 uint32_t dmac_lo
:32;
4441 struct hermon_hw_fcmd_o_ib_s
{
4450 uint32_t stat_rate
:4;
4451 uint32_t hop_limit
:8;
4455 uint32_t flow_label
:20;
4471 #define HERMON_WQE_SEND_FENCE_MASK 0x40
4473 #define HERMON_WQE_SEND_NOPCODE_NOP 0x00
4474 #define HERMON_WQE_SEND_NOPCODE_SND_INV 0x01
4475 #define HERMON_WQE_SEND_NOPCODE_RDMAW 0x8
4476 #define HERMON_WQE_SEND_NOPCODE_RDMAWI 0x9
4477 #define HERMON_WQE_SEND_NOPCODE_SEND 0xA
4478 #define HERMON_WQE_SEND_NOPCODE_SENDI 0xB
4479 #define HERMON_WQE_SEND_NOPCODE_INIT_AND_SEND 0xD
4480 #define HERMON_WQE_SEND_NOPCODE_LSO 0xE
4481 #define HERMON_WQE_SEND_NOPCODE_RDMAR 0x10
4482 #define HERMON_WQE_SEND_NOPCODE_ATMCS 0x11
4483 #define HERMON_WQE_SEND_NOPCODE_ATMFA 0x12
4484 #define HERMON_WQE_SEND_NOPCODE_ATMCSE 0x14
4485 #define HERMON_WQE_SEND_NOPCODE_ATMFAE 0x15
4486 #define HERMON_WQE_SEND_NOPCODE_BIND 0x18
4487 #define HERMON_WQE_SEND_NOPCODE_FRWR 0x19
4488 #define HERMON_WQE_SEND_NOPCODE_LCL_INV 0x1B
4489 #define HERMON_WQE_SEND_NOPCODE_CONFIG 0x1F /* for ccq only */
4491 #define HERMON_WQE_FCP_OPCODE_INIT_AND_SEND 0xD
4492 #define HERMON_WQE_FCP_OPCODE_INIT_FEXCH 0xC
4494 #define HERMON_WQE_SEND_SIGNALED_MASK 0x0000000C00000000ull
4495 #define HERMON_WQE_SEND_SOLICIT_MASK 0x0000000200000000ull
4496 #define HERMON_WQE_SEND_IMMEDIATE_MASK 0x0000000100000000ull
4498 struct hermon_hw_snd_wqe_ud_s
{
4499 struct hermon_hw_udav_s ud_addr_v
;
4502 uint32_t dest_qp
:24;
4507 uint32_t dmac_hi
:16;
4509 uint32_t dmac_lo
:32;
4511 #define HERMON_WQE_SENDHDR_UD_AV_MASK 0xFFFFFFFFFFFFFFE0ull
4512 #define HERMON_WQE_SENDHDR_UD_DQPN_MASK 0xFFFFFF
4514 struct hermon_hw_snd_wqe_bind_s
{
4531 #define HERMON_WQE_SENDHDR_BIND_ATOM 0x8000000000000000ull
4532 #define HERMON_WQE_SENDHDR_BIND_WR 0x4000000000000000ull
4533 #define HERMON_WQE_SENDHDR_BIND_RD 0x2000000000000000ull
4535 struct hermon_hw_snd_wqe_lso_s
{
4538 uint32_t hdr_size
:10;
4541 struct hermon_hw_snd_wqe_remaddr_s
{
4547 struct hermon_hw_snd_wqe_atomic_s
{
4552 struct hermon_hw_snd_wqe_atomic_ext_s
{
4559 struct hermon_hw_snd_wqe_local_inv_s
{
4561 uint32_t atc_shoot
:1;
4572 uint32_t guest_id
:7; /* for atc shootdown */
4575 uint32_t p_addrl
:23;
4579 struct hermon_hw_snd_rem_addr_s
{
4587 struct hermon_hw_snd_wqe_frwr_s
{
4588 uint32_t rem_atomic
:1;
4589 uint32_t rem_write
:1;
4590 uint32_t rem_read
:1;
4591 uint32_t loc_write
:1;
4592 uint32_t loc_read
:1;
4596 uint32_t dif
:1; /* FCoIB */
4597 uint32_t bind_en
:1;
4598 uint32_t blk_pg_mode
:1;
4599 uint32_t mtt_rep
:4;
4602 uint32_t mkey
; /* swapped w/ addrh relative to arbel */
4606 uint64_t start_addr
;
4608 uint64_t reg_len
; /* w/ len_64 allows 65 bits of length */
4614 uint32_t pge_blk_sz
:21;
4619 struct hermon_hw_snd_wqe_frwr_ext_s
{
4620 uint32_t dif_in_mem
:1;
4621 uint32_t dif_on_wire
:1;
4622 uint32_t valid_ref
:1;
4623 uint32_t valid_crc
:1;
4624 uint32_t repl_ref_tag
:1;
4625 uint32_t repl_app_tag
:1;
4627 uint32_t app_mask
:16;
4629 uint32_t wire_app_tag
:16;
4630 uint32_t mem_app_tag
:16;
4632 uint32_t wire_ref_tag_base
;
4634 uint32_t mem_ref_tag_base
;
4640 * Hermon "MLX transport" Work Queue Element (WQE)
4641 * The format of the MLX WQE is similar to that of the Send WQE (above)
4642 * with the following exceptions. MLX WQEs are used for sending MADs on
4643 * special QPs 0 and 1. Everything following the "Next/Ctrl" header
4644 * (defined below) consists of scatter-gather list entries. The contents
4645 * of these SGLs (also defined below) will be put on the wire exactly as
4646 * they appear in the buffers. In addition, the VCRC and the ICRC of each
4647 * sent packet can be modified by changing values in the following header
4648 * or in the payload of the packet itself.
4652 struct hermon_hw_mlx_wqe_nextctrl_s
{
4656 uint32_t opcode
:5; /* is 0x0A (send) for MLX */
4659 uint32_t ds
:6; /* WQE size in octowords */
4664 uint32_t max_srate
:4;
4666 uint32_t :3; /* FCoIB usage */
4667 uint32_t icrc
:1; /* 1==don't replace icrc fld */
4668 uint32_t cq_gen
:2; /* 00= no cqe, 11==cqe */
4670 uint32_t force_lb
:1;
4677 #define HERMON_WQE_MLXHDR_VL15_MASK 0x0002000000000000ull
4678 #define HERMON_WQE_MLXHDR_SLR_MASK 0x0001000000000000ull
4679 #define HERMON_WQE_MLXHDR_SRATE_SHIFT 44
4680 #define HERMON_WQE_MLXHDR_SL_SHIFT 40
4681 #define HERMON_WQE_MLXHDR_SIGNALED_MASK 0x0000000800000000ull
4682 #define HERMON_WQE_MLXHDR_RLID_SHIFT 16
4686 * Hermon Receive Work Queue Element (WQE)
4687 * Unlike the Send WQE, the Receive WQE is built ONLY of 16-byte segments. A
4688 * "Next/Ctrl" segment is no longer needed, because of the fixed
4689 * receive queue stride (RQ.STRIDE). It contains just
4690 * some number of scatter list entries for the incoming message.
4692 * The format of the scatter-gather list entries is shown below. For
4693 * Receive WQEs the "inline_data" field must be cleared (i.e. data segments
4694 * cannot contain inline data).
4698 struct hermon_hw_wqe_sgl_s
{
4699 uint32_t inline_data
:1;
4700 uint32_t byte_cnt
:31;
4706 #define HERMON_WQE_SGL_BYTE_CNT_MASK 0x7FFFFFFF
4707 #define HERMON_WQE_SGL_INLINE_MASK 0x80000000
4710 * The following defines are used when building descriptors for special QP
4711 * work requests (i.e. MLX transport WQEs). Note: Because Hermon MLX transport
4712 * requires the driver to build actual IB packet headers, we use these defines
4713 * for the most common fields in those headers.
4717 #define HERMON_MLX_VL15_LVER 0xF0000000
4718 #define HERMON_MLX_VL0_LVER 0x00000000
4719 #define HERMON_MLX_IPVER_TC_FLOW 0x60000000
4720 #define HERMON_MLX_TC_SHIFT 20
4721 #define HERMON_MLX_DEF_PKEY 0xFFFF
4722 #define HERMON_MLX_GSI_QKEY 0x80010000
4723 #define HERMON_MLX_UDSEND_OPCODE 0x64000000
4724 #define HERMON_MLX_DQPN_MASK 0xFFFFFF
4727 * The following macros are used for building each of the individual
4728 * segments that can make up a Hermon WQE. Note: We try not to use the
4729 * structures (with their associated bitfields) here, instead opting to
4730 * build and put 64-bit or 32-bit chunks to the WQEs as appropriate,
4731 * primarily because using the bitfields appears to force more read-modify-
4734 * HERMON_WQE_BUILD_UD - Builds Unreliable Datagram Segment
4736 * HERMON_WQE_BUILD_REMADDR - Builds Remote Address Segment using
4737 * RDMA info from the work request
4738 * HERMON_WQE_BUILD_RC_ATOMIC_REMADDR - Builds Remote Address Segment
4739 * for RC Atomic work requests
4740 * HERMON_WQE_BUILD_ATOMIC - Builds Atomic Segment using atomic
4741 * info from the work request
4742 * HERMON_WQE_BUILD_BIND - Builds the Bind Memory Window
4743 * Segment using bind info from the
4745 * HERMON_WQE_BUILD_DATA_SEG - Builds the individual Data Segments
4746 * for Send, Receive, and MLX WQEs
4747 * HERMON_WQE_BUILD_INLINE - Builds an "inline" Data Segment
4748 * (primarily for MLX transport)
4749 * HERMON_WQE_BUILD_INLINE_ICRC - Also builds an "inline" Data Segment
4750 * (but used primarily in the ICRC
4751 * portion of MLX transport WQEs)
4752 * HERMON_WQE_LINKNEXT - Links the current WQE to the
4754 * HERMON_WQE_LINKFIRST - Links the first WQE on the current
4755 * chain to the previous WQE
4756 * HERMON_WQE_BUILD_MLX_LRH - Builds the inline LRH header for
4757 * MLX transport MADs
4758 * HERMON_WQE_BUILD_MLX_GRH - Builds the inline GRH header for
4759 * MLX transport MADs
4760 * HERMON_WQE_BUILD_MLX_BTH - Builds the inline BTH header for
4761 * MLX transport MADs
4762 * HERMON_WQE_BUILD_MLX_DETH - Builds the inline DETH header for
4763 * MLX transport MADs
4765 #define HERMON_WQE_BUILD_UD(qp, ud, ah, dest) \
4770 tmp = (uint64_t *)(ud); \
4771 udav = (uint64_t *)(ah)->ah_udav; \
4772 tmp[0] = ntohll(udav[0]); \
4773 tmp[1] = ntohll(udav[1]); \
4774 tmp[2] = ntohll(udav[2]); \
4775 tmp[3] = ntohll(udav[3]); \
4776 tmp[4] = ntohll((((uint64_t)((dest)->ud_dst_qpn & \
4777 HERMON_WQE_SENDHDR_UD_DQPN_MASK) << 32) | \
4778 (dest)->ud_qkey)); \
4782 #define HERMON_WQE_BUILD_LSO(qp, ds, mss, hdr_sz) \
4783 *(uint32_t *)(ds) = htonl(((mss) << 16) | hdr_sz);
4785 #define HERMON_WQE_BUILD_REMADDR(qp, ra, wr_rdma) \
4789 tmp = (uint64_t *)(ra); \
4790 tmp[0] = htonll((wr_rdma)->rdma_raddr); \
4791 tmp[1] = htonll((uint64_t)(wr_rdma)->rdma_rkey << 32); \
4794 #define HERMON_WQE_BUILD_RC_ATOMIC_REMADDR(qp, rc, wr) \
4798 tmp = (uint64_t *)(rc); \
4799 tmp[0] = htonll((wr)->wr.rc.rcwr.atomic->atom_raddr); \
4800 tmp[1] = htonll((uint64_t)(wr)->wr.rc.rcwr.atomic->atom_rkey << 32); \
4803 #define HERMON_WQE_BUILD_ATOMIC(qp, at, wr_atom) \
4807 tmp = (uint64_t *)(at); \
4808 tmp[0] = htonll((wr_atom)->atom_arg2); \
4809 tmp[1] = htonll((wr_atom)->atom_arg1); \
4812 #define HERMON_WQE_BUILD_BIND(qp, bn, wr_bind) \
4816 ibt_bind_flags_t bind_flags; \
4818 tmp = (uint64_t *)(bn); \
4819 bind_flags = (wr_bind)->bind_flags; \
4820 bn0_tmp = (bind_flags & IBT_WR_BIND_ATOMIC) ? \
4821 HERMON_WQE_SENDHDR_BIND_ATOM : 0; \
4822 bn0_tmp |= (bind_flags & IBT_WR_BIND_WRITE) ? \
4823 HERMON_WQE_SENDHDR_BIND_WR : 0; \
4824 bn0_tmp |= (bind_flags & IBT_WR_BIND_READ) ? \
4825 HERMON_WQE_SENDHDR_BIND_RD : 0; \
4826 tmp[0] = htonll(bn0_tmp); \
4827 tmp[1] = htonll(((uint64_t)(wr_bind)->bind_rkey_out << 32) | \
4828 (wr_bind)->bind_lkey); \
4829 tmp[2] = htonll((wr_bind)->bind_va); \
4830 tmp[3] = htonll((wr_bind)->bind_len); \
4833 #define HERMON_WQE_BUILD_FRWR(qp, frwr_arg, pmr_arg) \
4835 ibt_mr_flags_t flags; \
4837 ibt_wr_reg_pmr_t *pmr = (pmr_arg); \
4838 uint64_t *frwr64 = (uint64_t *)(frwr_arg); \
4840 flags = pmr->pmr_flags; \
4841 ((uint32_t *)frwr64)[0] = htonl(0x08000000 | \
4842 ((flags & IBT_MR_ENABLE_REMOTE_ATOMIC) ? 0x80000000 : 0) | \
4843 ((flags & IBT_MR_ENABLE_REMOTE_WRITE) ? 0x40000000 : 0) | \
4844 ((flags & IBT_MR_ENABLE_REMOTE_READ) ? 0x20000000 : 0) | \
4845 ((flags & IBT_MR_ENABLE_LOCAL_WRITE) ? 0x10000000 : 0) | \
4846 ((flags & IBT_MR_ENABLE_WINDOW_BIND) ? 0x00200000 : 0)); \
4847 lkey = (pmr->pmr_lkey & ~0xff) | pmr->pmr_key; \
4848 pmr->pmr_rkey = pmr->pmr_lkey = lkey; \
4849 ((uint32_t *)frwr64)[1] = htonl(lkey); \
4850 frwr64[1] = htonll(pmr->pmr_addr_list->p_laddr); \
4851 frwr64[2] = htonll(pmr->pmr_iova); \
4852 frwr64[3] = htonll(pmr->pmr_len); \
4853 ((uint32_t *)frwr64)[8] = htonl(pmr->pmr_offset); \
4854 ((uint32_t *)frwr64)[9] = htonl(pmr->pmr_buf_sz); \
4858 #define HERMON_WQE_BUILD_LI(qp, li_arg, wr_li) \
4860 uint64_t *li64 = (uint64_t *)(void *)(li_arg); \
4863 ((uint32_t *)li64)[2] = htonl((wr_li)->li_rkey); \
4864 ((uint32_t *)li64)[3] = 0; \
4869 #define HERMON_WQE_BUILD_FCP3_INIT(ds, fctl, cs_pri, seq_id, mtu, \
4870 dest_id, op, rem_exch, local_exch_idx) \
4872 uint32_t *fc_init; \
4874 fc_init = (uint32_t *)ds; \
4875 fc_init[1] = htonl((cs_pri) << 24 | (seq_id) << 16 | (mtu)); \
4876 fc_init[2] = htonl((dest_id) << 8 | \
4877 IBT_FCTL_GET_ABORT_FIELD(fctl) << 6 | (op) << 3 | 0x2); \
4878 fc_init[3] = htonl((rem_exch) << 16 | (local_exch_idx)); \
4879 membar_producer(); /* fc_init[0] is where the stamping is */ \
4880 fc_init[0] = htonl(((fctl) & IBT_FCTL_PRIO) << 6); \
4883 #define HERMON_WQE_BUILD_DATA_SEG_RECV(ds, sgl) \
4887 tmp = (uint64_t *)(ds); \
4888 tmp[0] = htonll((((uint64_t)((sgl)->ds_len & \
4889 HERMON_WQE_SGL_BYTE_CNT_MASK) << 32) | (sgl)->ds_key)); \
4890 tmp[1] = htonll((sgl)->ds_va); \
4893 #define HERMON_WQE_BUILD_DATA_SEG_SEND(ds, sgl) \
4895 ((uint64_t *)(ds))[1] = htonll((sgl)->ds_va); \
4896 ((uint32_t *)(ds))[1] = htonl((sgl)->ds_key); \
4897 membar_producer(); \
4898 ((uint32_t *)(ds))[0] = \
4899 htonl((sgl)->ds_len & HERMON_WQE_SGL_BYTE_CNT_MASK); \
4902 #define HERMON_WQE_BUILD_INLINE(qp, ds, sz) \
4903 *(uint32_t *)(ds) = htonl(HERMON_WQE_SGL_INLINE_MASK | (sz))
4905 #define HERMON_WQE_BUILD_INLINE_ICRC(qp, ds, sz, icrc) \
4909 tmp = (uint32_t *)(ds); \
4910 tmp[1] = htonl(icrc); \
4911 membar_producer(); \
4912 tmp[0] = htonl(HERMON_WQE_SGL_INLINE_MASK | (sz)); \
4915 #define HERMON_WQE_SET_CTRL_SEGMENT(desc, desc_sz, fence, \
4916 imm, sol, sig, cksum, qp, strong, fccrc) \
4919 uint32_t cntr_tmp; \
4921 /* do not set the first dword (owner/opcode) here */ \
4922 tmp = (uint32_t *)desc; \
4923 cntr_tmp = (fence << 6) | desc_sz; \
4924 tmp[1] = ntohl(cntr_tmp); \
4925 cntr_tmp = strong | fccrc | sol | sig | cksum; \
4926 tmp[2] = ntohl(cntr_tmp); \
4927 tmp[3] = ntohl(imm); \
4930 #define HERMON_WQE_SET_MLX_CTRL_SEGMENT(desc, desc_sz, sig, maxstat, \
4934 uint32_t cntr_tmp; \
4936 tmp = (uint32_t *)desc; \
4937 cntr_tmp = htonl(tmp[0]); \
4938 cntr_tmp &= 0x80000000; \
4939 cntr_tmp |= HERMON_WQE_SEND_NOPCODE_SEND; \
4940 tmp[0] = ntohl(cntr_tmp); \
4941 tmp[1] = ntohl(desc_sz); \
4942 cntr_tmp = (((maxstat << 4) | (sl & 0xff)) << 8) | sig; \
4943 if (qp->qp_is_special == HERMON_QP_SMI) \
4944 cntr_tmp |= (0x02 << 16); \
4945 if (lid == IB_LID_PERMISSIVE) \
4946 cntr_tmp |= (0x01 << 16); \
4947 tmp[2] = ntohl(cntr_tmp); \
4948 tmp[3] = ntohl((lid) << 16); \
4951 #define HERMON_WQE_BUILD_MLX_LRH(lrh, qp, udav, pktlen) \
4956 tmp = (uint32_t *)(void *)(lrh); \
4958 if ((qp)->qp_is_special == HERMON_QP_SMI) { \
4959 lrh_tmp = HERMON_MLX_VL15_LVER; \
4961 lrh_tmp = HERMON_MLX_VL0_LVER | ((udav)->sl << 20); \
4963 if ((udav)->grh) { \
4964 lrh_tmp |= (IB_LRH_NEXT_HDR_GRH << 16); \
4966 lrh_tmp |= (IB_LRH_NEXT_HDR_BTH << 16); \
4968 lrh_tmp |= (udav)->rlid; \
4969 tmp[0] = htonl(lrh_tmp); \
4971 lrh_tmp = (pktlen) << 16; \
4972 if ((udav)->rlid == IB_LID_PERMISSIVE) { \
4973 lrh_tmp |= IB_LID_PERMISSIVE; \
4975 lrh_tmp |= (udav)->ml_path; \
4977 tmp[1] = htonl(lrh_tmp); \
4981 * Note: The GRH payload length, calculated below, is the overall packet
4982 * length (in bytes) minus LRH header and GRH headers.
4984 * Also note: Filling in the GIDs in the way we do below is helpful because
4985 * it avoids potential alignment restrictions and/or conflicts.
4987 #define HERMON_WQE_BUILD_MLX_GRH(state, grh, qp, udav, pktlen) \
4993 tmp = (uint32_t *)(grh); \
4995 grh_tmp = HERMON_MLX_IPVER_TC_FLOW; \
4996 grh_tmp |= (udav)->tclass << HERMON_MLX_TC_SHIFT; \
4997 grh_tmp |= (udav)->flow_label; \
4998 tmp[0] = htonl(grh_tmp); \
5000 grh_tmp = (((pktlen) << 2) - (sizeof (ib_lrh_hdr_t) + \
5001 sizeof (ib_grh_t))) << 16; \
5002 grh_tmp |= (IB_GRH_NEXT_HDR_BTH << 8); \
5003 grh_tmp |= (udav)->hop_limit; \
5004 tmp[1] = htonl(grh_tmp); \
5006 sgid.gid_prefix = (state)->hs_sn_prefix[(qp)->qp_portnum]; \
5007 sgid.gid_guid = (state)->hs_guid[(qp)->qp_portnum] \
5008 [(udav)->mgid_index]; \
5009 bcopy(&sgid, &tmp[2], sizeof (ib_gid_t)); \
5010 bcopy(&(udav)->rgid_h, &tmp[6], sizeof (ib_gid_t)); \
5013 #define HERMON_WQE_BUILD_MLX_BTH(state, bth, qp, wr) \
5018 tmp = (uint32_t *)(bth); \
5020 bth_tmp = HERMON_MLX_UDSEND_OPCODE; \
5021 if ((wr)->wr_flags & IBT_WR_SEND_SOLICIT) { \
5022 bth_tmp |= (IB_BTH_SOLICITED_EVENT_MASK << 16); \
5024 if (qp->qp_is_special == HERMON_QP_SMI) { \
5025 bth_tmp |= HERMON_MLX_DEF_PKEY; \
5027 bth_tmp |= (state)->hs_pkey[(qp)->qp_portnum] \
5028 [(qp)->qp_pkeyindx]; \
5030 tmp[0] = htonl(bth_tmp); \
5031 tmp[1] = htonl((wr)->wr.ud.udwr_dest->ud_dst_qpn & \
5032 HERMON_MLX_DQPN_MASK); \
5036 #define HERMON_WQE_BUILD_MLX_DETH(deth, qp) \
5040 tmp = (uint32_t *)(deth); \
5042 if ((qp)->qp_is_special == HERMON_QP_SMI) { \
5046 tmp[0] = htonl(HERMON_MLX_GSI_QKEY); \
5047 tmp[1] = htonl(0x1); \
5054 * Below we have PCI config space space offsets for flash interface
5055 * access, offsets within Hermon CR space for accessing flash-specific
5056 * information or settings, masks used for flash settings, and
5057 * timeout values for flash operations.
5059 #define HERMON_HW_FLASH_CFG_HWREV 8
5060 #define HERMON_HW_FLASH_CFG_ADDR 88
5061 #define HERMON_HW_FLASH_CFG_DATA 92
5063 #define HERMON_HW_FLASH_RESET_AMD 0xF0
5064 #define HERMON_HW_FLASH_RESET_INTEL 0xFF
5065 #define HERMON_HW_FLASH_CPUMODE 0xF0150
5066 #define HERMON_HW_FLASH_ADDR 0xF01A4
5067 #define HERMON_HW_FLASH_DATA 0xF01A8
5068 #define HERMON_HW_FLASH_GPIO_SEMA 0xF03FC
5069 #define HERMON_HW_FLASH_WRCONF_SEMA 0xF0380
5070 #define HERMON_HW_FLASH_GPIO_DATA 0xF0040
5071 #define HERMON_HW_FLASH_GPIO_MOD1 0xF004C
5072 #define HERMON_HW_FLASH_GPIO_MOD0 0xF0050
5073 #define HERMON_HW_FLASH_GPIO_DATACLEAR 0xF00D4
5074 #define HERMON_HW_FLASH_GPIO_DATASET 0xF00DC
5075 #define HERMON_HW_FLASH_GPIO_LOCK 0xF0048
5076 #define HERMON_HW_FLASH_GPIO_UNLOCK_VAL 0xD42F
5077 #define HERMON_HW_FLASH_GPIO_PIN_ENABLE 0x1E000000
5079 #define HERMON_HW_FLASH_CPU_MASK 0xC0000000
5080 #define HERMON_HW_FLASH_CPU_SHIFT 30
5081 #define HERMON_HW_FLASH_ADDR_MASK 0x0007FFFC
5082 #define HERMON_HW_FLASH_CMD_MASK 0xE0000000
5083 #define HERMON_HW_FLASH_BANK_MASK 0xFFF80000
5085 #define HERMON_HW_FLASH_SPI_BUSY 0x40000000
5086 #define HERMON_HW_FLASH_SPI_WIP 0x01000000
5087 #define HERMON_HW_FLASH_SPI_READ_OP 0x00000001
5088 #define HERMON_HW_FLASH_SPI_USE_INSTR 0x00000040
5089 #define HERMON_HW_FLASH_SPI_NO_ADDR 0x00000020
5090 #define HERMON_HW_FLASH_SPI_NO_DATA 0x00000010
5091 #define HERMON_HW_FLASH_SPI_TRANS_SZ_4B 0x00000200
5093 #define HERMON_HW_FLASH_SPI_SECTOR_ERASE 0xD8
5094 #define HERMON_HW_FLASH_SPI_READ 0x03
5095 #define HERMON_HW_FLASH_SPI_PAGE_PROGRAM 0x02
5096 #define HERMON_HW_FLASH_SPI_READ_STATUS_REG 0x05
5097 #define HERMON_HW_FLASH_SPI_WRITE_ENABLE 0x06
5098 #define HERMON_HW_FLASH_SPI_READ_ESIGNATURE 0xAB
5100 #define HERMON_HW_FLASH_SPI_GW 0xF0400
5101 #define HERMON_HW_FLASH_SPI_ADDR 0xF0404
5102 #define HERMON_HW_FLASH_SPI_DATA 0xF0410
5103 #define HERMON_HW_FLASH_SPI_DATA4 0xF0414
5104 #define HERMON_HW_FLASH_SPI_DATA8 0xF0418
5105 #define HERMON_HW_FLASH_SPI_DATA12 0xF041C
5106 #define HERMON_HW_FLASH_SPI_ADDR_MASK 0x00FFFFFF
5107 #define HERMON_HW_FLASH_SPI_INSTR_PHASE_OFF 0x04
5108 #define HERMON_HW_FLASH_SPI_ADDR_PHASE_OFF 0x08
5109 #define HERMON_HW_FLASH_SPI_DATA_PHASE_OFF 0x10
5110 #define HERMON_HW_FLASH_SPI_ENABLE_OFF 0x2000
5111 #define HERMON_HW_FLASH_SPI_CS_OFF 0x800
5112 #define HERMON_HW_FLASH_SPI_INSTR_OFF 0x10000
5113 #define HERMON_HW_FLASH_SPI_INSTR_SHIFT 0x10
5114 #define HERMON_HW_FLASH_SPI_BOOT_ADDR_REG 0xF0000
5116 #define HERMON_HW_FLASH_TIMEOUT_WRITE 300
5117 #define HERMON_HW_FLASH_TIMEOUT_ERASE 1000000
5118 #define HERMON_HW_FLASH_TIMEOUT_GPIO_SEMA 1000
5119 #define HERMON_HW_FLASH_TIMEOUT_CONFIG 50
5121 #define HERMON_HW_FLASH_ICS_ERASE 0x20
5122 #define HERMON_HW_FLASH_ICS_ERROR 0x3E
5123 #define HERMON_HW_FLASH_ICS_WRITE 0x40
5124 #define HERMON_HW_FLASH_ICS_STATUS 0x70
5125 #define HERMON_HW_FLASH_ICS_READY 0x80
5126 #define HERMON_HW_FLASH_ICS_CONFIRM 0xD0
5127 #define HERMON_HW_FLASH_ICS_READ 0xFF
5133 #endif /* _SYS_IB_ADAPTERS_HERMON_HW_H */