net/bnxt: refactor for 1.5.1 HWRM API
[dpdk.git] / drivers / net / bnxt / hsi_struct_def_dpdk.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) Broadcom Limited.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Broadcom Corporation nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef _HSI_STRUCT_DEF_EXTERNAL_H_
35 #define _HSI_STRUCT_DEF_EXTERNAL_H_
36
37 /*
38  * per-context HW statistics -- chip view
39  */
40
41 struct ctx_hw_stats64 {
42         uint64_t rx_ucast_pkts;
43         uint64_t rx_mcast_pkts;
44         uint64_t rx_bcast_pkts;
45         uint64_t rx_drop_pkts;
46         uint64_t rx_discard_pkts;
47         uint64_t rx_ucast_bytes;
48         uint64_t rx_mcast_bytes;
49         uint64_t rx_bcast_bytes;
50
51         uint64_t tx_ucast_pkts;
52         uint64_t tx_mcast_pkts;
53         uint64_t tx_bcast_pkts;
54         uint64_t tx_drop_pkts;
55         uint64_t tx_discard_pkts;
56         uint64_t tx_ucast_bytes;
57         uint64_t tx_mcast_bytes;
58         uint64_t tx_bcast_bytes;
59
60         uint64_t tpa_pkts;
61         uint64_t tpa_bytes;
62         uint64_t tpa_events;
63         uint64_t tpa_aborts;
64 } __attribute__((packed));
65
66 /* HW Resource Manager Specification 1.5.1 */
67 #define HWRM_VERSION_MAJOR      1
68 #define HWRM_VERSION_MINOR      5
69 #define HWRM_VERSION_UPDATE     1
70
71 #define HWRM_VERSION_STR        "1.5.1"
72
73 /*
74  * Following is the signature for HWRM message field that indicates not
75  * applicable (All F's). Need to cast it the size of the field if needed.
76  */
77 #define HWRM_NA_SIGNATURE        ((uint32_t)(-1))
78 #define HWRM_MAX_REQ_LEN        (128)  /* hwrm_func_buf_rgtr */
79 #define HWRM_MAX_RESP_LEN       (176)  /* hwrm_func_qstats */
80 #define HW_HASH_INDEX_SIZE      0x80    /* 7 bit indirection table index. */
81 #define HW_HASH_KEY_SIZE        40
82 #define HWRM_RESP_VALID_KEY     1 /* valid key for HWRM response */
83
84 /*
85  * Request types
86  */
87 #define HWRM_VER_GET                    (UINT32_C(0x0))
88 #define HWRM_FUNC_RESET                 (UINT32_C(0x11))
89 #define HWRM_FUNC_QCAPS                 (UINT32_C(0x15))
90 #define HWRM_FUNC_QCFG                  (UINT32_C(0x16))
91 #define HWRM_FUNC_DRV_UNRGTR            (UINT32_C(0x1a))
92 #define HWRM_FUNC_DRV_RGTR              (UINT32_C(0x1d))
93 #define HWRM_PORT_PHY_CFG               (UINT32_C(0x20))
94 #define HWRM_PORT_PHY_QCFG              (UINT32_C(0x27))
95 #define HWRM_QUEUE_QPORTCFG             (UINT32_C(0x30))
96 #define HWRM_VNIC_ALLOC                 (UINT32_C(0x40))
97 #define HWRM_VNIC_FREE                  (UINT32_C(0x41))
98 #define HWRM_VNIC_CFG                   (UINT32_C(0x42))
99 #define HWRM_VNIC_RSS_CFG               (UINT32_C(0x46))
100 #define HWRM_RING_ALLOC                 (UINT32_C(0x50))
101 #define HWRM_RING_FREE                  (UINT32_C(0x51))
102 #define HWRM_RING_GRP_ALLOC             (UINT32_C(0x60))
103 #define HWRM_RING_GRP_FREE              (UINT32_C(0x61))
104 #define HWRM_VNIC_RSS_COS_LB_CTX_ALLOC  (UINT32_C(0x70))
105 #define HWRM_VNIC_RSS_COS_LB_CTX_FREE   (UINT32_C(0x71))
106 #define HWRM_CFA_L2_FILTER_ALLOC        (UINT32_C(0x90))
107 #define HWRM_CFA_L2_FILTER_FREE         (UINT32_C(0x91))
108 #define HWRM_CFA_L2_FILTER_CFG          (UINT32_C(0x92))
109 #define HWRM_CFA_L2_SET_RX_MASK         (UINT32_C(0x93))
110 #define HWRM_STAT_CTX_ALLOC             (UINT32_C(0xb0))
111 #define HWRM_STAT_CTX_FREE              (UINT32_C(0xb1))
112 #define HWRM_STAT_CTX_CLR_STATS         (UINT32_C(0xb3))
113 #define HWRM_EXEC_FWD_RESP              (UINT32_C(0xd0))
114
115 /* Return Codes */
116 #define HWRM_ERR_CODE_INVALID_PARAMS                      (UINT32_C(0x2))
117 #define HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED              (UINT32_C(0x3))
118
119 /* Short TX BD (16 bytes) */
120 struct tx_bd_short {
121         /*
122          * All bits in this field must be valid on the first BD of a packet.
123          * Only the packet_end bit must be valid for the remaining BDs of a
124          * packet.
125          */
126         /* This value identifies the type of buffer descriptor. */
127         #define TX_BD_SHORT_TYPE_MASK                   UINT32_C(0x3f)
128         #define TX_BD_SHORT_TYPE_SFT                    0
129                 /*
130                  * Indicates that this BD is 16B long and is used for normal L2
131                  * packet transmission.
132                  */
133         #define TX_BD_SHORT_TYPE_TX_BD_SHORT            (UINT32_C(0x0) << 0)
134         /*
135          * If set to 1, the packet ends with the data in the buffer pointed to
136          * by this descriptor. This flag must be valid on every BD.
137          */
138         #define TX_BD_SHORT_FLAGS_PACKET_END            UINT32_C(0x40)
139         /*
140          * If set to 1, the device will not generate a completion for this
141          * transmit packet unless there is an error in it's processing. If this
142          * bit is set to 0, then the packet will be completed normally. This bit
143          * must be valid only on the first BD of a packet.
144          */
145         #define TX_BD_SHORT_FLAGS_NO_CMPL               UINT32_C(0x80)
146         /*
147          * This value indicates how many 16B BD locations are consumed in the
148          * ring by this packet. A value of 1 indicates that this BD is the only
149          * BD (and that the it is a short BD). A value of 3 indicates either 3
150          * short BDs or 1 long BD and one short BD in the packet. A value of 0
151          * indicates that there are 32 BD locations in the packet (the maximum).
152          * This field is valid only on the first BD of a packet.
153          */
154         #define TX_BD_SHORT_FLAGS_BD_CNT_MASK           UINT32_C(0x1f00)
155         #define TX_BD_SHORT_FLAGS_BD_CNT_SFT            8
156         /*
157          * This value is a hint for the length of the entire packet. It is used
158          * by the chip to optimize internal processing. The packet will be
159          * dropped if the hint is too short. This field is valid only on the
160          * first BD of a packet.
161          */
162         #define TX_BD_SHORT_FLAGS_LHINT_MASK            UINT32_C(0x6000)
163         #define TX_BD_SHORT_FLAGS_LHINT_SFT             13
164                 /* indicates packet length < 512B */
165         #define TX_BD_SHORT_FLAGS_LHINT_LT512           (UINT32_C(0x0) << 13)
166                 /* indicates 512 <= packet length < 1KB */
167         #define TX_BD_SHORT_FLAGS_LHINT_LT1K            (UINT32_C(0x1) << 13)
168                 /* indicates 1KB <= packet length < 2KB */
169         #define TX_BD_SHORT_FLAGS_LHINT_LT2K            (UINT32_C(0x2) << 13)
170                 /* indicates packet length >= 2KB */
171         #define TX_BD_SHORT_FLAGS_LHINT_GTE2K           (UINT32_C(0x3) << 13)
172         #define TX_BD_SHORT_FLAGS_LHINT_LAST    TX_BD_SHORT_FLAGS_LHINT_GTE2K
173         /*
174          * If set to 1, the device immediately updates the Send Consumer Index
175          * after the buffer associated with this descriptor has been transferred
176          * via DMA to NIC memory from host memory. An interrupt may or may not
177          * be generated according to the state of the interrupt avoidance
178          * mechanisms. If this bit is set to 0, then the Consumer Index is only
179          * updated as soon as one of the host interrupt coalescing conditions
180          * has been met. This bit must be valid on the first BD of a packet.
181          */
182         #define TX_BD_SHORT_FLAGS_COAL_NOW              UINT32_C(0x8000)
183         /*
184          * All bits in this field must be valid on the first BD of a packet.
185          * Only the packet_end bit must be valid for the remaining BDs of a
186          * packet.
187          */
188         #define TX_BD_SHORT_FLAGS_MASK                  UINT32_C(0xffc0)
189         #define TX_BD_SHORT_FLAGS_SFT                   6
190         uint16_t flags_type;
191
192         /*
193          * This is the length of the host physical buffer this BD describes in
194          * bytes. This field must be valid on all BDs of a packet.
195          */
196         uint16_t len;
197         /*
198          * The opaque data field is pass through to the completion and can be
199          * used for any data that the driver wants to associate with the
200          * transmit BD. This field must be valid on the first BD of a packet.
201          */
202         uint32_t opaque;
203
204         /*
205          * This is the host physical address for the portion of the packet
206          * described by this TX BD. This value must be valid on all BDs of a
207          * packet.
208          */
209         uint64_t addr;
210 } __attribute__((packed));
211
212 /* Long TX BD (32 bytes split to 2 16-byte struct) */
213 struct tx_bd_long {
214         /*
215          * All bits in this field must be valid on the first BD of a packet.
216          * Only the packet_end bit must be valid for the remaining BDs of a
217          * packet.
218          */
219         /* This value identifies the type of buffer descriptor. */
220         #define TX_BD_LONG_TYPE_MASK                    UINT32_C(0x3f)
221         #define TX_BD_LONG_TYPE_SFT                     0
222                 /*
223                  * Indicates that this BD is 32B long and is used for normal L2
224                  * packet transmission.
225                  */
226         #define TX_BD_LONG_TYPE_TX_BD_LONG              (UINT32_C(0x10) << 0)
227         /*
228          * If set to 1, the packet ends with the data in the buffer pointed to
229          * by this descriptor. This flag must be valid on every BD.
230          */
231         #define TX_BD_LONG_FLAGS_PACKET_END             UINT32_C(0x40)
232         /*
233          * If set to 1, the device will not generate a completion for this
234          * transmit packet unless there is an error in it's processing. If this
235          * bit is set to 0, then the packet will be completed normally. This bit
236          * must be valid only on the first BD of a packet.
237          */
238         #define TX_BD_LONG_FLAGS_NO_CMPL                UINT32_C(0x80)
239         /*
240          * This value indicates how many 16B BD locations are consumed in the
241          * ring by this packet. A value of 1 indicates that this BD is the only
242          * BD (and that the it is a short BD). A value of 3 indicates either 3
243          * short BDs or 1 long BD and one short BD in the packet. A value of 0
244          * indicates that there are 32 BD locations in the packet (the maximum).
245          * This field is valid only on the first BD of a packet.
246          */
247         #define TX_BD_LONG_FLAGS_BD_CNT_MASK            UINT32_C(0x1f00)
248         #define TX_BD_LONG_FLAGS_BD_CNT_SFT             8
249         /*
250          * This value is a hint for the length of the entire packet. It is used
251          * by the chip to optimize internal processing. The packet will be
252          * dropped if the hint is too short. This field is valid only on the
253          * first BD of a packet.
254          */
255         #define TX_BD_LONG_FLAGS_LHINT_MASK             UINT32_C(0x6000)
256         #define TX_BD_LONG_FLAGS_LHINT_SFT              13
257                 /* indicates packet length < 512B */
258         #define TX_BD_LONG_FLAGS_LHINT_LT512            (UINT32_C(0x0) << 13)
259                 /* indicates 512 <= packet length < 1KB */
260         #define TX_BD_LONG_FLAGS_LHINT_LT1K             (UINT32_C(0x1) << 13)
261                 /* indicates 1KB <= packet length < 2KB */
262         #define TX_BD_LONG_FLAGS_LHINT_LT2K             (UINT32_C(0x2) << 13)
263                 /* indicates packet length >= 2KB */
264         #define TX_BD_LONG_FLAGS_LHINT_GTE2K            (UINT32_C(0x3) << 13)
265         #define TX_BD_LONG_FLAGS_LHINT_LAST     TX_BD_LONG_FLAGS_LHINT_GTE2K
266         /*
267          * If set to 1, the device immediately updates the Send Consumer Index
268          * after the buffer associated with this descriptor has been transferred
269          * via DMA to NIC memory from host memory. An interrupt may or may not
270          * be generated according to the state of the interrupt avoidance
271          * mechanisms. If this bit is set to 0, then the Consumer Index is only
272          * updated as soon as one of the host interrupt coalescing conditions
273          * has been met. This bit must be valid on the first BD of a packet.
274          */
275         #define TX_BD_LONG_FLAGS_COAL_NOW               UINT32_C(0x8000)
276         /*
277          * All bits in this field must be valid on the first BD of a packet.
278          * Only the packet_end bit must be valid for the remaining BDs of a
279          * packet.
280          */
281         #define TX_BD_LONG_FLAGS_MASK                   UINT32_C(0xffc0)
282         #define TX_BD_LONG_FLAGS_SFT                    6
283         uint16_t flags_type;
284
285         /*
286          * This is the length of the host physical buffer this BD describes in
287          * bytes. This field must be valid on all BDs of a packet.
288          */
289         uint16_t len;
290
291         /*
292          * The opaque data field is pass through to the completion and can be
293          * used for any data that the driver wants to associate with the
294          * transmit BD. This field must be valid on the first BD of a packet.
295          */
296         uint32_t opaque;
297
298         /*
299          * This is the host physical address for the portion of the packet
300          * described by this TX BD. This value must be valid on all BDs of a
301          * packet.
302          */
303         uint64_t addr;
304 } __attribute__((packed));
305
306 /* last 16 bytes of Long TX BD */
307
308 struct tx_bd_long_hi {
309         /*
310          * All bits in this field must be valid on the first BD of a packet.
311          * Their value on other BDs of the packet will be ignored.
312          */
313         /*
314          * If set to 1, the controller replaces the TCP/UPD checksum fields of
315          * normal TCP/UPD checksum, or the inner TCP/UDP checksum field of the
316          * encapsulated TCP/UDP packets with the hardware calculated TCP/UDP
317          * checksum for the packet associated with this descriptor. This bit
318          * must be valid on the first BD of a packet.
319          */
320         #define TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM        UINT32_C(0x1)
321         /*
322          * If set to 1, the controller replaces the IP checksum of the normal
323          * packets, or the inner IP checksum of the encapsulated packets with
324          * the hardware calculated IP checksum for the packet associated with
325          * this descriptor. This bit must be valid on the first BD of a packet.
326          */
327         #define TX_BD_LONG_LFLAGS_IP_CHKSUM             UINT32_C(0x2)
328         /*
329          * If set to 1, the controller will not append an Ethernet CRC to the
330          * end of the frame. This bit must be valid on the first BD of a packet.
331          * Packet must be 64B or longer when this flag is set. It is not useful
332          * to use this bit with any form of TX offload such as CSO or LSO. The
333          * intent is that the packet from the host already has a valid Ethernet
334          * CRC on the packet.
335          */
336         #define TX_BD_LONG_LFLAGS_NOCRC                 UINT32_C(0x4)
337         /*
338          * If set to 1, the device will record the time at which the packet was
339          * actually transmitted at the TX MAC. This bit must be valid on the
340          * first BD of a packet.
341          */
342         #define TX_BD_LONG_LFLAGS_STAMP                 UINT32_C(0x8)
343         /*
344          * If set to 1, The controller replaces the tunnel IP checksum field
345          * with hardware calculated IP checksum for the IP header of the packet
346          * associated with this descriptor. In case of VXLAN, the controller
347          * also replaces the outer header UDP checksum with hardware calculated
348          * UDP checksum for the packet associated with this descriptor.
349          */
350         #define TX_BD_LONG_LFLAGS_T_IP_CHKSUM           UINT32_C(0x10)
351         /*
352          * If set to 1, the device will treat this packet with LSO(Large Send
353          * Offload) processing for both normal or encapsulated packets, which is
354          * a form of TCP segmentation. When this bit is 1, the hdr_size and mss
355          * fields must be valid. The driver doesn't need to set t_ip_chksum,
356          * ip_chksum, and tcp_udp_chksum flags since the controller will replace
357          * the appropriate checksum fields for segmented packets. When this bit
358          * is 1, the hdr_size and mss fields must be valid.
359          */
360         #define TX_BD_LONG_LFLAGS_LSO                   UINT32_C(0x20)
361         /*
362          * If set to zero when LSO is '1', then the IPID will be treated as a
363          * 16b number and will be wrapped if it exceeds a value of 0xffff. If
364          * set to one when LSO is '1', then the IPID will be treated as a 15b
365          * number and will be wrapped if it exceeds a value 0f 0x7fff.
366          */
367         #define TX_BD_LONG_LFLAGS_IPID_FMT              UINT32_C(0x40)
368         /*
369          * If set to zero when LSO is '1', then the IPID of the tunnel IP header
370          * will not be modified during LSO operations. If set to one when LSO is
371          * '1', then the IPID of the tunnel IP header will be incremented for
372          * each subsequent segment of an LSO operation.
373          */
374         #define TX_BD_LONG_LFLAGS_T_IPID                UINT32_C(0x80)
375         /*
376          * If set to '1', then the RoCE ICRC will be appended to the packet.
377          * Packet must be a valid RoCE format packet.
378          */
379         #define TX_BD_LONG_LFLAGS_ROCE_CRC              UINT32_C(0x100)
380         /*
381          * If set to '1', then the FCoE CRC will be appended to the packet.
382          * Packet must be a valid FCoE format packet.
383          */
384         #define TX_BD_LONG_LFLAGS_FCOE_CRC              UINT32_C(0x200)
385         uint16_t lflags;
386
387         /*
388          * When LSO is '1', this field must contain the offset of the TCP
389          * payload from the beginning of the packet in as 16b words. In case of
390          * encapsulated/tunneling packet, this field contains the offset of the
391          * inner TCP payload from beginning of the packet as 16-bit words. This
392          * value must be valid on the first BD of a packet.
393          */
394         #define TX_BD_LONG_HDR_SIZE_MASK                UINT32_C(0x1ff)
395         #define TX_BD_LONG_HDR_SIZE_SFT                 0
396         uint16_t hdr_size;
397
398         /*
399          * This is the MSS value that will be used to do the LSO processing. The
400          * value is the length in bytes of the TCP payload for each segment
401          * generated by the LSO operation. This value must be valid on the first
402          * BD of a packet.
403          */
404         #define TX_BD_LONG_MSS_MASK                     UINT32_C(0x7fff)
405         #define TX_BD_LONG_MSS_SFT                      0
406         uint32_t mss;
407
408         uint16_t unused_2;
409
410         /*
411          * This value selects a CFA action to perform on the packet. Set this
412          * value to zero if no CFA action is desired. This value must be valid
413          * on the first BD of a packet.
414          */
415         uint16_t cfa_action;
416
417         /*
418          * This value is action meta-data that defines CFA edit operations that
419          * are done in addition to any action editing.
420          */
421         /* When key=1, This is the VLAN tag VID value. */
422         #define TX_BD_LONG_CFA_META_VLAN_VID_MASK       UINT32_C(0xfff)
423         #define TX_BD_LONG_CFA_META_VLAN_VID_SFT        0
424         /* When key=1, This is the VLAN tag DE value. */
425         #define TX_BD_LONG_CFA_META_VLAN_DE             UINT32_C(0x1000)
426         /* When key=1, This is the VLAN tag PRI value. */
427         #define TX_BD_LONG_CFA_META_VLAN_PRI_MASK       UINT32_C(0xe000)
428         #define TX_BD_LONG_CFA_META_VLAN_PRI_SFT        13
429         /* When key=1, This is the VLAN tag TPID select value. */
430         #define TX_BD_LONG_CFA_META_VLAN_TPID_MASK      UINT32_C(0x70000)
431         #define TX_BD_LONG_CFA_META_VLAN_TPID_SFT       16
432                 /* 0x88a8 */
433         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID88A8  (UINT32_C(0x0) << 16)
434                 /* 0x8100 */
435         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100  (UINT32_C(0x1) << 16)
436                 /* 0x9100 */
437         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9100  (UINT32_C(0x2) << 16)
438                 /* 0x9200 */
439         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9200  (UINT32_C(0x3) << 16)
440                 /* 0x9300 */
441         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9300  (UINT32_C(0x4) << 16)
442                 /* Value programmed in CFA VLANTPID register. */
443         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPIDCFG   (UINT32_C(0x5) << 16)
444         #define TX_BD_LONG_CFA_META_VLAN_TPID_LAST \
445                                         TX_BD_LONG_CFA_META_VLAN_TPID_TPIDCFG
446         /* When key=1, This is the VLAN tag TPID select value. */
447         #define TX_BD_LONG_CFA_META_VLAN_RESERVED_MASK  UINT32_C(0xff80000)
448         #define TX_BD_LONG_CFA_META_VLAN_RESERVED_SFT   19
449         /*
450          * This field identifies the type of edit to be performed on the packet.
451          * This value must be valid on the first BD of a packet.
452          */
453         #define TX_BD_LONG_CFA_META_KEY_MASK            UINT32_C(0xf0000000)
454         #define TX_BD_LONG_CFA_META_KEY_SFT             28
455                 /* No editing */
456         #define TX_BD_LONG_CFA_META_KEY_NONE            (UINT32_C(0x0) << 28)
457                 /*
458                  * - meta[17:16] - TPID select value (0 = 0x8100). - meta[15:12]
459                  * - PRI/DE value. - meta[11:0] - VID value.
460                  */
461         #define TX_BD_LONG_CFA_META_KEY_VLAN_TAG        (UINT32_C(0x1) << 28)
462         #define TX_BD_LONG_CFA_META_KEY_LAST    TX_BD_LONG_CFA_META_KEY_VLAN_TAG
463         uint32_t cfa_meta;
464 } __attribute__((packed));
465
466 /* RX Producer Packet BD (16 bytes) */
467 struct rx_prod_pkt_bd {
468         /* This value identifies the type of buffer descriptor. */
469         #define RX_PROD_PKT_BD_TYPE_MASK                UINT32_C(0x3f)
470         #define RX_PROD_PKT_BD_TYPE_SFT                 0
471                 /*
472                  * Indicates that this BD is 16B long and is an RX Producer (ie.
473                  * empty) buffer descriptor.
474                  */
475         #define RX_PROD_PKT_BD_TYPE_RX_PROD_PKT         (UINT32_C(0x4) << 0)
476         /*
477          * If set to 1, the packet will be placed at the address plus 2B. The 2
478          * Bytes of padding will be written as zero.
479          */
480         /*
481          * This is intended to be used when the host buffer is cache-line
482          * aligned to produce packets that are easy to parse in host memory
483          * while still allowing writes to be cache line aligned.
484          */
485         #define RX_PROD_PKT_BD_FLAGS_SOP_PAD            UINT32_C(0x40)
486         /*
487          * If set to 1, the packet write will be padded out to the nearest
488          * cache-line with zero value padding.
489          */
490         /*
491          * If receive buffers start/end on cache-line boundaries, this feature
492          * will ensure that all data writes on the PCI bus start/end on cache
493          * line boundaries.
494          */
495         #define RX_PROD_PKT_BD_FLAGS_EOP_PAD            UINT32_C(0x80)
496         /*
497          * This value is the number of additional buffers in the ring that
498          * describe the buffer space to be consumed for the this packet. If the
499          * value is zero, then the packet must fit within the space described by
500          * this BD. If this value is 1 or more, it indicates how many additional
501          * "buffer" BDs are in the ring immediately following this BD to be used
502          * for the same network packet. Even if the packet to be placed does not
503          * need all the additional buffers, they will be consumed anyway.
504          */
505         #define RX_PROD_PKT_BD_FLAGS_BUFFERS_MASK       UINT32_C(0x300)
506         #define RX_PROD_PKT_BD_FLAGS_BUFFERS_SFT        8
507         #define RX_PROD_PKT_BD_FLAGS_MASK               UINT32_C(0xffc0)
508         #define RX_PROD_PKT_BD_FLAGS_SFT                6
509         uint16_t flags_type;
510
511         /*
512          * This is the length in Bytes of the host physical buffer where data
513          * for the packet may be placed in host memory.
514          */
515         /*
516          * While this is a Byte resolution value, it is often advantageous to
517          * ensure that the buffers provided end on a host cache line.
518          */
519         uint16_t len;
520
521         /*
522          * The opaque data field is pass through to the completion and can be
523          * used for any data that the driver wants to associate with this
524          * receive buffer set.
525          */
526         uint32_t opaque;
527
528         /*
529          * This is the host physical address where data for the packet may by
530          * placed in host memory.
531          */
532         /*
533          * While this is a Byte resolution value, it is often advantageous to
534          * ensure that the buffers provide start on a host cache line.
535          */
536         uint64_t addr;
537 } __attribute__((packed));
538
539 /* Completion Ring Structures */
540 /* Note: This structure is used by the HWRM to communicate HWRM Error. */
541 /* Base Completion Record (16 bytes) */
542 struct cmpl_base {
543         /* unused is 10 b */
544         /*
545          * This field indicates the exact type of the completion. By convention,
546          * the LSB identifies the length of the record in 16B units. Even values
547          * indicate 16B records. Odd values indicate 32B records.
548          */
549         #define CMPL_BASE_TYPE_MASK                     UINT32_C(0x3f)
550         #define CMPL_BASE_TYPE_SFT                      0
551                 /* TX L2 completion: Completion of TX packet. Length = 16B */
552         #define CMPL_BASE_TYPE_TX_L2                    (UINT32_C(0x0) << 0)
553                 /*
554                  * RX L2 completion: Completion of and L2 RX packet.
555                  * Length = 32B
556                 */
557         #define CMPL_BASE_TYPE_RX_L2                    (UINT32_C(0x11) << 0)
558                 /*
559                  * RX Aggregation Buffer completion : Completion of an L2
560                  * aggregation buffer in support of TPA, HDS, or Jumbo packet
561                  * completion. Length = 16B
562                  */
563         #define CMPL_BASE_TYPE_RX_AGG                   (UINT32_C(0x12) << 0)
564                 /*
565                  * RX L2 TPA Start Completion: Completion at the beginning of a
566                  * TPA operation. Length = 32B
567                  */
568         #define CMPL_BASE_TYPE_RX_TPA_START             (UINT32_C(0x13) << 0)
569                 /*
570                  * RX L2 TPA End Completion: Completion at the end of a TPA
571                  * operation. Length = 32B
572                  */
573         #define CMPL_BASE_TYPE_RX_TPA_END               (UINT32_C(0x15) << 0)
574                 /*
575                  * Statistics Ejection Completion: Completion of statistics data
576                  * ejection buffer. Length = 16B
577                  */
578         #define CMPL_BASE_TYPE_STAT_EJECT               (UINT32_C(0x1a) << 0)
579                 /* HWRM Command Completion: Completion of an HWRM command. */
580         #define CMPL_BASE_TYPE_HWRM_DONE                (UINT32_C(0x20) << 0)
581                 /* Forwarded HWRM Request */
582         #define CMPL_BASE_TYPE_HWRM_FWD_REQ             (UINT32_C(0x22) << 0)
583                 /* Forwarded HWRM Response */
584         #define CMPL_BASE_TYPE_HWRM_FWD_RESP            (UINT32_C(0x24) << 0)
585                 /* HWRM Asynchronous Event Information */
586         #define CMPL_BASE_TYPE_HWRM_ASYNC_EVENT         (UINT32_C(0x2e) << 0)
587                 /* CQ Notification */
588         #define CMPL_BASE_TYPE_CQ_NOTIFICATION          (UINT32_C(0x30) << 0)
589                 /* SRQ Threshold Event */
590         #define CMPL_BASE_TYPE_SRQ_EVENT                (UINT32_C(0x32) << 0)
591                 /* DBQ Threshold Event */
592         #define CMPL_BASE_TYPE_DBQ_EVENT                (UINT32_C(0x34) << 0)
593                 /* QP Async Notification */
594         #define CMPL_BASE_TYPE_QP_EVENT                 (UINT32_C(0x38) << 0)
595                 /* Function Async Notification */
596         #define CMPL_BASE_TYPE_FUNC_EVENT               (UINT32_C(0x3a) << 0)
597         uint16_t type;
598
599         uint16_t info1;
600         uint32_t info2;
601
602         /*
603          * This value is written by the NIC such that it will be different for
604          * each pass through the completion queue. The even passes will write 1.
605          * The odd passes will write 0.
606          */
607         #define CMPL_BASE_V                             UINT32_C(0x1)
608         /* info3 is 31 b */
609         #define CMPL_BASE_INFO3_MASK                    UINT32_C(0xfffffffe)
610         #define CMPL_BASE_INFO3_SFT                     1
611         uint32_t info3_v;
612
613         uint32_t info4;
614 } __attribute__((packed));
615
616 /* TX Completion Record (16 bytes) */
617 struct tx_cmpl {
618         /*
619          * This field indicates the exact type of the completion. By convention,
620          * the LSB identifies the length of the record in 16B units. Even values
621          * indicate 16B records. Odd values indicate 32B records.
622          */
623         #define TX_CMPL_TYPE_MASK                       UINT32_C(0x3f)
624         #define TX_CMPL_TYPE_SFT                        0
625                 /* TX L2 completion: Completion of TX packet. Length = 16B */
626         #define TX_CMPL_TYPE_TX_L2                      (UINT32_C(0x0) << 0)
627         /*
628          * When this bit is '1', it indicates a packet that has an error of some
629          * type. Type of error is indicated in error_flags.
630          */
631         #define TX_CMPL_FLAGS_ERROR                     UINT32_C(0x40)
632         /*
633          * When this bit is '1', it indicates that the packet completed was
634          * transmitted using the push acceleration data provided by the driver.
635          * When this bit is '0', it indicates that the packet had not push
636          * acceleration data written or was executed as a normal packet even
637          * though push data was provided.
638          */
639         #define TX_CMPL_FLAGS_PUSH                      UINT32_C(0x80)
640         #define TX_CMPL_FLAGS_MASK                      UINT32_C(0xffc0)
641         #define TX_CMPL_FLAGS_SFT                       6
642         uint16_t flags_type;
643
644         uint16_t unused_0;
645
646         /*
647          * This is a copy of the opaque field from the first TX BD of this
648          * transmitted packet.
649          */
650         uint32_t opaque;
651
652         /*
653          * This value is written by the NIC such that it will be different for
654          * each pass through the completion queue. The even passes will write 1.
655          * The odd passes will write 0.
656          */
657         #define TX_CMPL_V                               UINT32_C(0x1)
658         /*
659          * This error indicates that there was some sort of problem with the BDs
660          * for the packet.
661          */
662         #define TX_CMPL_ERRORS_BUFFER_ERROR_MASK        UINT32_C(0xe)
663         #define TX_CMPL_ERRORS_BUFFER_ERROR_SFT         1
664                 /* No error */
665         #define TX_CMPL_ERRORS_BUFFER_ERROR_NO_ERROR    (UINT32_C(0x0) << 1)
666                 /* Bad Format: BDs were not formatted correctly. */
667         #define TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT     (UINT32_C(0x2) << 1)
668         #define TX_CMPL_ERRORS_BUFFER_ERROR_LAST \
669                                         TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT
670         /*
671          * When this bit is '1', it indicates that the length of the packet was
672          * zero. No packet was transmitted.
673          */
674         #define TX_CMPL_ERRORS_ZERO_LENGTH_PKT          UINT32_C(0x10)
675         /*
676          * When this bit is '1', it indicates that the packet was longer than
677          * the programmed limit in TDI. No packet was transmitted.
678          */
679         #define TX_CMPL_ERRORS_EXCESSIVE_BD_LENGTH      UINT32_C(0x20)
680         /*
681          * When this bit is '1', it indicates that one or more of the BDs
682          * associated with this packet generated a PCI error. This probably
683          * means the address was not valid.
684          */
685         #define TX_CMPL_ERRORS_DMA_ERROR                UINT32_C(0x40)
686         /*
687          * When this bit is '1', it indicates that the packet was longer than
688          * indicated by the hint. No packet was transmitted.
689          */
690         #define TX_CMPL_ERRORS_HINT_TOO_SHORT           UINT32_C(0x80)
691         /*
692          * When this bit is '1', it indicates that the packet was dropped due to
693          * Poison TLP error on one or more of the TLPs in the PXP completion.
694          */
695         #define TX_CMPL_ERRORS_POISON_TLP_ERROR         UINT32_C(0x100)
696         #define TX_CMPL_ERRORS_MASK                     UINT32_C(0xfffe)
697         #define TX_CMPL_ERRORS_SFT                      1
698         uint16_t errors_v;
699
700         uint16_t unused_1;
701         uint32_t unused_2;
702 } __attribute__((packed)) tx_cmpl_t, *ptx_cmpl_t;
703
704 /* RX Packet Completion Record (32 bytes split to 2 16-byte struct) */
705 struct rx_pkt_cmpl {
706         /*
707          * This field indicates the exact type of the completion. By convention,
708          * the LSB identifies the length of the record in 16B units. Even values
709          * indicate 16B records. Odd values indicate 32B records.
710          */
711         #define RX_PKT_CMPL_TYPE_MASK                   UINT32_C(0x3f)
712         #define RX_PKT_CMPL_TYPE_SFT                    0
713                 /*
714                  * RX L2 completion: Completion of and L2 RX packet.
715                  * Length = 32B
716                  */
717         #define RX_PKT_CMPL_TYPE_RX_L2                  (UINT32_C(0x11) << 0)
718         /*
719          * When this bit is '1', it indicates a packet that has an error of some
720          * type. Type of error is indicated in error_flags.
721          */
722         #define RX_PKT_CMPL_FLAGS_ERROR                 UINT32_C(0x40)
723         /* This field indicates how the packet was placed in the buffer. */
724         #define RX_PKT_CMPL_FLAGS_PLACEMENT_MASK        UINT32_C(0x380)
725         #define RX_PKT_CMPL_FLAGS_PLACEMENT_SFT         7
726                 /* Normal: Packet was placed using normal algorithm. */
727         #define RX_PKT_CMPL_FLAGS_PLACEMENT_NORMAL      (UINT32_C(0x0) << 7)
728                 /* Jumbo: Packet was placed using jumbo algorithm. */
729         #define RX_PKT_CMPL_FLAGS_PLACEMENT_JUMBO       (UINT32_C(0x1) << 7)
730                 /*
731                  * Header/Data Separation: Packet was placed using Header/Data
732                  * separation algorithm. The separation location is indicated by
733                  * the itype field.
734                  */
735         #define RX_PKT_CMPL_FLAGS_PLACEMENT_HDS         (UINT32_C(0x2) << 7)
736         #define RX_PKT_CMPL_FLAGS_PLACEMENT_LAST \
737                                                 RX_PKT_CMPL_FLAGS_PLACEMENT_HDS
738         /* This bit is '1' if the RSS field in this completion is valid. */
739         #define RX_PKT_CMPL_FLAGS_RSS_VALID             UINT32_C(0x400)
740         /*
741          * This value indicates what the inner packet determined for the packet
742          * was.
743          */
744         #define RX_PKT_CMPL_FLAGS_ITYPE_MASK            UINT32_C(0xf000)
745         #define RX_PKT_CMPL_FLAGS_ITYPE_SFT             12
746                 /* Not Known: Indicates that the packet type was not known. */
747         #define RX_PKT_CMPL_FLAGS_ITYPE_NOT_KNOWN       (UINT32_C(0x0) << 12)
748                 /*
749                  * IP Packet: Indicates that the packet was an IP packet, but
750                  * further classification was not possible.
751                  */
752         #define RX_PKT_CMPL_FLAGS_ITYPE_IP              (UINT32_C(0x1) << 12)
753                 /*
754                  * TCP Packet: Indicates that the packet was IP and TCP. This
755                  * indicates that the payload_offset field is valid.
756                  */
757         #define RX_PKT_CMPL_FLAGS_ITYPE_TCP             (UINT32_C(0x2) << 12)
758                 /*
759                  * UDP Packet: Indicates that the packet was IP and UDP. This
760                  * indicates that the payload_offset field is valid.
761                  */
762         #define RX_PKT_CMPL_FLAGS_ITYPE_UDP             (UINT32_C(0x3) << 12)
763                 /*
764                  * FCoE Packet: Indicates that the packet was recognized as a
765                  * FCoE. This also indicates that the payload_offset field is
766                  * valid.
767                  */
768         #define RX_PKT_CMPL_FLAGS_ITYPE_FCOE            (UINT32_C(0x4) << 12)
769                 /*
770                  * RoCE Packet: Indicates that the packet was recognized as a
771                  * RoCE. This also indicates that the payload_offset field is
772                  * valid.
773                  */
774         #define RX_PKT_CMPL_FLAGS_ITYPE_ROCE            (UINT32_C(0x5) << 12)
775                 /*
776                  * ICMP Packet: Indicates that the packet was recognized as
777                  * ICMP. This indicates that the payload_offset field is valid.
778                  */
779         #define RX_PKT_CMPL_FLAGS_ITYPE_ICMP            (UINT32_C(0x7) << 12)
780                 /*
781                  * PtP packet wo/timestamp: Indicates that the packet was
782                  * recognized as a PtP packet.
783                  */
784         #define RX_PKT_CMPL_FLAGS_ITYPE_PTP_WO_TIMESTAMP \
785                                                         (UINT32_C(0x8) << 12)
786                 /*
787                  * PtP packet w/timestamp: Indicates that the packet was
788                  * recognized as a PtP packet and that a timestamp was taken for
789                  * the packet.
790                  */
791         #define RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP (UINT32_C(0x9) << 12)
792         #define RX_PKT_CMPL_FLAGS_ITYPE_LAST \
793                                         RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP
794         #define RX_PKT_CMPL_FLAGS_MASK                  UINT32_C(0xffc0)
795         #define RX_PKT_CMPL_FLAGS_SFT                   6
796         uint16_t flags_type;
797
798         /*
799          * This is the length of the data for the packet stored in the buffer(s)
800          * identified by the opaque value. This includes the packet BD and any
801          * associated buffer BDs. This does not include the the length of any
802          * data places in aggregation BDs.
803          */
804         uint16_t len;
805
806         /*
807          * This is a copy of the opaque field from the RX BD this completion
808          * corresponds to.
809          */
810         uint32_t opaque;
811
812         /*
813          * This value is written by the NIC such that it will be different for
814          * each pass through the completion queue. The even passes will write 1.
815          * The odd passes will write 0.
816          */
817         #define RX_PKT_CMPL_V1                          UINT32_C(0x1)
818         /*
819          * This value is the number of aggregation buffers that follow this
820          * entry in the completion ring that are a part of this packet. If the
821          * value is zero, then the packet is completely contained in the buffer
822          * space provided for the packet in the RX ring.
823          */
824         #define RX_PKT_CMPL_AGG_BUFS_MASK               UINT32_C(0x3e)
825         #define RX_PKT_CMPL_AGG_BUFS_SFT                1
826         uint8_t agg_bufs_v1;
827
828         /*
829          * This is the RSS hash type for the packet. The value is packed
830          * {tuple_extrac_op[1:0],rss_profile_id[4:0],tuple_extrac_op[2]}.
831          */
832         uint8_t rss_hash_type;
833
834         /*
835          * This value indicates the offset from the beginning of the packet
836          * where the inner payload starts. This value is valid for TCP, UDP,
837          * FCoE, and RoCE packets.
838          */
839         uint8_t payload_offset;
840
841         uint8_t unused_1;
842
843         /*
844          * This value is the RSS hash value calculated for the packet based on
845          * the mode bits and key value in the VNIC.
846          */
847         uint32_t rss_hash;
848 } __attribute__((packed));
849
850 /* last 16 bytes of RX Packet Completion Record */
851 struct rx_pkt_cmpl_hi {
852         /*
853          * This indicates that the ip checksum was calculated for the inner
854          * packet and that the ip_cs_error field indicates if there was an
855          * error.
856          */
857         #define RX_PKT_CMPL_FLAGS2_IP_CS_CALC           UINT32_C(0x1)
858         /*
859          * This indicates that the TCP, UDP or ICMP checksum was calculated for
860          * the inner packet and that the l4_cs_error field indicates if there
861          * was an error.
862          */
863         #define RX_PKT_CMPL_FLAGS2_L4_CS_CALC           UINT32_C(0x2)
864         /*
865          * This indicates that the ip checksum was calculated for the tunnel
866          * header and that the t_ip_cs_error field indicates if there was an
867          * error.
868          */
869         #define RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC         UINT32_C(0x4)
870         /*
871          * This indicates that the UDP checksum was calculated for the tunnel
872          * packet and that the t_l4_cs_error field indicates if there was an
873          * error.
874          */
875         #define RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC         UINT32_C(0x8)
876         /* This value indicates what format the metadata field is. */
877         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_MASK     UINT32_C(0xf0)
878         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_SFT      4
879                 /* No metadata informtaion. Value is zero. */
880         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_NONE     (UINT32_C(0x0) << 4)
881                 /*
882                  * The metadata field contains the VLAN tag and TPID value. -
883                  * metadata[11:0] contains the vlan VID value. - metadata[12]
884                  * contains the vlan DE value. - metadata[15:13] contains the
885                  * vlan PRI value. - metadata[31:16] contains the vlan TPID
886                  * value.
887                  */
888         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN     (UINT32_C(0x1) << 4)
889         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_LAST \
890                                         RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN
891         /*
892          * This field indicates the IP type for the inner-most IP header. A
893          * value of '0' indicates IPv4. A value of '1' indicates IPv6. This
894          * value is only valid if itype indicates a packet with an IP header.
895          */
896         #define RX_PKT_CMPL_FLAGS2_IP_TYPE              UINT32_C(0x100)
897         uint32_t flags2;
898
899         /*
900          * This is data from the CFA block as indicated by the meta_format
901          * field.
902          */
903         /* When meta_format=1, this value is the VLAN VID. */
904         #define RX_PKT_CMPL_METADATA_VID_MASK           UINT32_C(0xfff)
905         #define RX_PKT_CMPL_METADATA_VID_SFT            0
906         /* When meta_format=1, this value is the VLAN DE. */
907         #define RX_PKT_CMPL_METADATA_DE                 UINT32_C(0x1000)
908         /* When meta_format=1, this value is the VLAN PRI. */
909         #define RX_PKT_CMPL_METADATA_PRI_MASK           UINT32_C(0xe000)
910         #define RX_PKT_CMPL_METADATA_PRI_SFT            13
911         /* When meta_format=1, this value is the VLAN TPID. */
912         #define RX_PKT_CMPL_METADATA_TPID_MASK          UINT32_C(0xffff0000)
913         #define RX_PKT_CMPL_METADATA_TPID_SFT           16
914         uint32_t metadata;
915
916         /*
917          * This value is written by the NIC such that it will be different for
918          * each pass through the completion queue. The even passes will write 1.
919          * The odd passes will write 0.
920          */
921         #define RX_PKT_CMPL_V2                          UINT32_C(0x1)
922         /*
923          * This error indicates that there was some sort of problem with the BDs
924          * for the packet that was found after part of the packet was already
925          * placed. The packet should be treated as invalid.
926          */
927         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_MASK    UINT32_C(0xe)
928         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_SFT     1
929                 /* No buffer error */
930         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_NO_BUFFER \
931                                                         (UINT32_C(0x0) << 1)
932                 /*
933                  * Did Not Fit: Packet did not fit into packet buffer provided.
934                  * For regular placement, this means the packet did not fit in
935                  * the buffer provided. For HDS and jumbo placement, this means
936                  * that the packet could not be placed into 7 physical buffers
937                  * or less.
938                  */
939         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_DID_NOT_FIT \
940                                                         (UINT32_C(0x1) << 1)
941                 /*
942                  * Not On Chip: All BDs needed for the packet were not on-chip
943                  * when the packet arrived.
944                  */
945         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_NOT_ON_CHIP \
946                                                         (UINT32_C(0x2) << 1)
947                 /* Bad Format: BDs were not formatted correctly. */
948         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT \
949                                                         (UINT32_C(0x3) << 1)
950         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_LAST \
951                                 RX_PKT_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT
952         /* This indicates that there was an error in the IP header checksum. */
953         #define RX_PKT_CMPL_ERRORS_IP_CS_ERROR          UINT32_C(0x10)
954         /*
955          * This indicates that there was an error in the TCP, UDP or ICMP
956          * checksum.
957          */
958         #define RX_PKT_CMPL_ERRORS_L4_CS_ERROR          UINT32_C(0x20)
959         /*
960          * This indicates that there was an error in the tunnel IP header
961          * checksum.
962          */
963         #define RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR        UINT32_C(0x40)
964         /* This indicates that there was an error in the tunnel UDP checksum. */
965         #define RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR        UINT32_C(0x80)
966         /*
967          * This indicates that there was a CRC error on either an FCoE or RoCE
968          * packet. The itype indicates the packet type.
969          */
970         #define RX_PKT_CMPL_ERRORS_CRC_ERROR            UINT32_C(0x100)
971         /*
972          * This indicates that there was an error in the tunnel portion of the
973          * packet when this field is non-zero.
974          */
975         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_MASK     UINT32_C(0xe00)
976         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_SFT      9
977                 /*
978                  * No additional error occurred on the tunnel portion of the
979                  * packet of the packet does not have a tunnel.
980                  */
981         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_NO_ERROR (UINT32_C(0x0) << 9)
982                 /*
983                  * Indicates that IP header version does not match expectation
984                  * from L2 Ethertype for IPv4 and IPv6 in the tunnel header.
985                  */
986         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_VERSION \
987                                                         (UINT32_C(0x1) << 9)
988                 /*
989                  * Indicates that header length is out of range in the tunnel
990                  * header. Valid for IPv4.
991                  */
992         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_HDR_LEN \
993                                                         (UINT32_C(0x2) << 9)
994                 /*
995                  * Indicates that the physical packet is shorter than that
996                  * claimed by the PPPoE header length for a tunnel PPPoE packet.
997                  */
998         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_TUNNEL_TOTAL_ERROR \
999                                                         (UINT32_C(0x3) << 9)
1000                 /*
1001                  * Indicates that physical packet is shorter than that claimed
1002                  * by the tunnel l3 header length. Valid for IPv4, or IPv6
1003                  * tunnel packet packets.
1004                  */
1005         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_IP_TOTAL_ERROR \
1006                                                         (UINT32_C(0x4) << 9)
1007                 /*
1008                  * Indicates that the physical packet is shorter than that
1009                  * claimed by the tunnel UDP header length for a tunnel UDP
1010                  * packet that is not fragmented.
1011                  */
1012         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_UDP_TOTAL_ERROR \
1013                                                         (UINT32_C(0x5) << 9)
1014                 /*
1015                  * indicates that the IPv4 TTL or IPv6 hop limit check have
1016                  * failed (e.g. TTL = 0) in the tunnel header. Valid for IPv4,
1017                  * and IPv6.
1018                  */
1019         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL \
1020                                                         (UINT32_C(0x6) << 9)
1021         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_LAST \
1022                                 RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL
1023         /*
1024          * This indicates that there was an error in the inner portion of the
1025          * packet when this field is non-zero.
1026          */
1027         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_MASK       UINT32_C(0xf000)
1028         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_SFT        12
1029                 /*
1030                  * No additional error occurred on the tunnel portion of the
1031                  * packet of the packet does not have a tunnel.
1032                  */
1033         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_NO_ERROR   (UINT32_C(0x0) << 12)
1034                 /*
1035                  * Indicates that IP header version does not match expectation
1036                  * from L2 Ethertype for IPv4 and IPv6 or that option other than
1037                  * VFT was parsed on FCoE packet.
1038                  */
1039         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_VERSION \
1040                                                         (UINT32_C(0x1) << 12)
1041                 /*
1042                  * indicates that header length is out of range. Valid for IPv4
1043                  * and RoCE
1044                  */
1045         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_HDR_LEN \
1046                                                         (UINT32_C(0x2) << 12)
1047                 /*
1048                  * indicates that the IPv4 TTL or IPv6 hop limit check have
1049                  * failed (e.g. TTL = 0). Valid for IPv4, and IPv6
1050                  */
1051         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_TTL (UINT32_C(0x3) << 12)
1052                 /*
1053                  * Indicates that physical packet is shorter than that claimed
1054                  * by the l3 header length. Valid for IPv4, IPv6 packet or RoCE
1055                  * packets.
1056                  */
1057         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_IP_TOTAL_ERROR \
1058                                                         (UINT32_C(0x4) << 12)
1059                 /*
1060                  * Indicates that the physical packet is shorter than that
1061                  * claimed by the UDP header length for a UDP packet that is not
1062                  * fragmented.
1063                  */
1064         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_UDP_TOTAL_ERROR \
1065                                                         (UINT32_C(0x5) << 12)
1066                 /*
1067                  * Indicates that TCP header length > IP payload. Valid for TCP
1068                  * packets only.
1069                  */
1070         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN \
1071                                                         (UINT32_C(0x6) << 12)
1072                 /* Indicates that TCP header length < 5. Valid for TCP. */
1073         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN_TOO_SMALL \
1074                                                         (UINT32_C(0x7) << 12)
1075                 /*
1076                  * Indicates that TCP option headers result in a TCP header size
1077                  * that does not match data offset in TCP header. Valid for TCP.
1078                  */
1079         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN \
1080                                                         (UINT32_C(0x8) << 12)
1081         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_LAST \
1082                                 RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN
1083         #define RX_PKT_CMPL_ERRORS_MASK                 UINT32_C(0xfffe)
1084         #define RX_PKT_CMPL_ERRORS_SFT                  1
1085         uint16_t errors_v2;
1086
1087         /*
1088          * This field identifies the CFA action rule that was used for this
1089          * packet.
1090          */
1091         uint16_t cfa_code;
1092
1093         /*
1094          * This value holds the reordering sequence number for the packet. If
1095          * the reordering sequence is not valid, then this value is zero. The
1096          * reordering domain for the packet is in the bottom 8 to 10b of the
1097          * rss_hash value. The bottom 20b of this value contain the ordering
1098          * domain value for the packet.
1099          */
1100         #define RX_PKT_CMPL_REORDER_MASK                UINT32_C(0xffffff)
1101         #define RX_PKT_CMPL_REORDER_SFT                 0
1102         uint32_t reorder;
1103 } __attribute__((packed));
1104
1105 /* HWRM Forwarded Request (16 bytes) */
1106 struct hwrm_fwd_req_cmpl {
1107         /* Length of forwarded request in bytes. */
1108         /*
1109          * This field indicates the exact type of the completion. By convention,
1110          * the LSB identifies the length of the record in 16B units. Even values
1111          * indicate 16B records. Odd values indicate 32B records.
1112          */
1113         #define HWRM_FWD_REQ_CMPL_TYPE_MASK             UINT32_C(0x3f)
1114         #define HWRM_FWD_REQ_CMPL_TYPE_SFT              0
1115                 /* Forwarded HWRM Request */
1116         #define HWRM_FWD_REQ_CMPL_TYPE_HWRM_FWD_REQ     (UINT32_C(0x22) << 0)
1117         /* Length of forwarded request in bytes. */
1118         #define HWRM_FWD_REQ_CMPL_REQ_LEN_MASK          UINT32_C(0xffc0)
1119         #define HWRM_FWD_REQ_CMPL_REQ_LEN_SFT           6
1120         uint16_t req_len_type;
1121
1122         /*
1123          * Source ID of this request. Typically used in forwarding requests and
1124          * responses. 0x0 - 0xFFF8 - Used for function ids 0xFFF8 - 0xFFFE -
1125          * Reserved for internal processors 0xFFFF - HWRM
1126          */
1127         uint16_t source_id;
1128
1129         uint32_t unused_0;
1130
1131         /* Address of forwarded request. */
1132         /*
1133          * This value is written by the NIC such that it will be different for
1134          * each pass through the completion queue. The even passes will write 1.
1135          * The odd passes will write 0.
1136          */
1137         #define HWRM_FWD_REQ_CMPL_V                     UINT32_C(0x1)
1138         /* Address of forwarded request. */
1139         #define HWRM_FWD_REQ_CMPL_REQ_BUF_ADDR_MASK     UINT32_C(0xfffffffe)
1140         #define HWRM_FWD_REQ_CMPL_REQ_BUF_ADDR_SFT      1
1141         uint64_t req_buf_addr_v;
1142 } __attribute__((packed));
1143
1144 /* HWRM Asynchronous Event Completion Record (16 bytes) */
1145 struct hwrm_async_event_cmpl {
1146         /*
1147          * This field indicates the exact type of the completion. By convention,
1148          * the LSB identifies the length of the record in 16B units. Even values
1149          * indicate 16B records. Odd values indicate 32B records.
1150          */
1151         #define HWRM_ASYNC_EVENT_CMPL_TYPE_MASK         UINT32_C(0x3f)
1152         #define HWRM_ASYNC_EVENT_CMPL_TYPE_SFT          0
1153                 /* HWRM Asynchronous Event Information */
1154         #define HWRM_ASYNC_EVENT_CMPL_TYPE_HWRM_ASYNC_EVENT \
1155                                                         (UINT32_C(0x2e) << 0)
1156         uint16_t type;
1157
1158         /* Identifiers of events. */
1159                 /* Link status changed */
1160         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE \
1161                                                         (UINT32_C(0x0) << 0)
1162                 /* Link MTU changed */
1163         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_MTU_CHANGE \
1164                                                         (UINT32_C(0x1) << 0)
1165                 /* Link speed changed */
1166         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE \
1167                                                         (UINT32_C(0x2) << 0)
1168                 /* DCB Configuration changed */
1169         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DCB_CONFIG_CHANGE \
1170                                                         (UINT32_C(0x3) << 0)
1171                 /* Port connection not allowed */
1172         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED \
1173                                                         (UINT32_C(0x4) << 0)
1174                 /* Link speed configuration was not allowed */
1175         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_NOT_ALLOWED \
1176                                                         (UINT32_C(0x5) << 0)
1177                 /* Function driver unloaded */
1178         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_FUNC_DRVR_UNLOAD \
1179                                                         (UINT32_C(0x10) << 0)
1180                 /* Function driver loaded */
1181         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_FUNC_DRVR_LOAD \
1182                                                         (UINT32_C(0x11) << 0)
1183                 /* PF driver unloaded */
1184         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD \
1185                                                         (UINT32_C(0x20) << 0)
1186                 /* PF driver loaded */
1187         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_LOAD \
1188                                                         (UINT32_C(0x21) << 0)
1189                 /* VF Function Level Reset (FLR) */
1190         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_FLR   (UINT32_C(0x30) << 0)
1191                 /* VF MAC Address Change */
1192         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_MAC_ADDR_CHANGE \
1193                                                         (UINT32_C(0x31) << 0)
1194                 /* PF-VF communication channel status change. */
1195         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_VF_COMM_STATUS_CHANGE \
1196                                                         (UINT32_C(0x32) << 0)
1197                 /* HWRM Error */
1198         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_HWRM_ERROR \
1199                                                         (UINT32_C(0xff) << 0)
1200         uint16_t event_id;
1201
1202         /* Event specific data */
1203         uint32_t event_data2;
1204
1205         /* opaque is 7 b */
1206         /*
1207          * This value is written by the NIC such that it will be different for
1208          * each pass through the completion queue. The even passes will write 1.
1209          * The odd passes will write 0.
1210          */
1211         #define HWRM_ASYNC_EVENT_CMPL_V                         UINT32_C(0x1)
1212         /* opaque is 7 b */
1213         #define HWRM_ASYNC_EVENT_CMPL_OPAQUE_MASK               UINT32_C(0xfe)
1214         #define HWRM_ASYNC_EVENT_CMPL_OPAQUE_SFT                1
1215         uint8_t opaque_v;
1216
1217         /* 8-lsb timestamp from POR (100-msec resolution) */
1218         uint8_t timestamp_lo;
1219
1220         /* 16-lsb timestamp from POR (100-msec resolution) */
1221         uint16_t timestamp_hi;
1222
1223         /* Event specific data */
1224         uint32_t event_data1;
1225 } __attribute__((packed));
1226
1227 /*
1228  * Note: The Hardware Resource Manager (HWRM) manages various hardware resources
1229  * inside the chip. The HWRM is implemented in firmware, and runs on embedded
1230  * processors inside the chip. This firmware is vital part of the chip's
1231  * hardware. The chip can not be used by driver without it.
1232  */
1233
1234 /* Input (16 bytes) */
1235 struct input {
1236         /*
1237          * This value indicates what type of request this is. The format for the
1238          * rest of the command is determined by this field.
1239          */
1240         uint16_t req_type;
1241
1242         /*
1243          * This value indicates the what completion ring the request will be
1244          * optionally completed on. If the value is -1, then no CR completion
1245          * will be generated. Any other value must be a valid CR ring_id value
1246          * for this function.
1247          */
1248         uint16_t cmpl_ring;
1249
1250         /* This value indicates the command sequence number. */
1251         uint16_t seq_id;
1252
1253         /*
1254          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1255          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1256          */
1257         uint16_t target_id;
1258
1259         /*
1260          * This is the host address where the response will be written when the
1261          * request is complete. This area must be 16B aligned and must be
1262          * cleared to zero before the request is made.
1263          */
1264         uint64_t resp_addr;
1265 } __attribute__((packed));
1266
1267 /* Output (8 bytes) */
1268 struct output {
1269         /*
1270          * Pass/Fail or error type Note: receiver to verify the in parameters,
1271          * and fail the call with an error when appropriate
1272          */
1273         uint16_t error_code;
1274
1275         /* This field returns the type of original request. */
1276         uint16_t req_type;
1277
1278         /* This field provides original sequence number of the command. */
1279         uint16_t seq_id;
1280
1281         /*
1282          * This field is the length of the response in bytes. The last byte of
1283          * the response is a valid flag that will read as '1' when the command
1284          * has been completely written to memory.
1285          */
1286         uint16_t resp_len;
1287 } __attribute__((packed));
1288
1289 /* hwrm_cfa_l2_filter_alloc */
1290 /*
1291  * A filter is used to identify traffic that contains a matching set of
1292  * parameters like unicast or broadcast MAC address or a VLAN tag amongst
1293  * other things which then allows the ASIC to direct the  incoming traffic
1294  * to an appropriate VNIC or Rx ring.
1295  */
1296
1297 /* Input (96 bytes) */
1298 struct hwrm_cfa_l2_filter_alloc_input {
1299         /*
1300          * This value indicates what type of request this is. The format for the
1301          * rest of the command is determined by this field.
1302          */
1303         uint16_t req_type;
1304
1305         /*
1306          * This value indicates the what completion ring the request will be
1307          * optionally completed on. If the value is -1, then no CR completion
1308          * will be generated. Any other value must be a valid CR ring_id value
1309          * for this function.
1310          */
1311         uint16_t cmpl_ring;
1312
1313         /* This value indicates the command sequence number. */
1314         uint16_t seq_id;
1315
1316         /*
1317          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1318          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1319          */
1320         uint16_t target_id;
1321
1322         /*
1323          * This is the host address where the response will be written when the
1324          * request is complete. This area must be 16B aligned and must be
1325          * cleared to zero before the request is made.
1326          */
1327         uint64_t resp_addr;
1328
1329         /*
1330          * Enumeration denoting the RX, TX type of the resource. This
1331          * enumeration is used for resources that are similar for both TX and RX
1332          * paths of the chip.
1333          */
1334         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH \
1335                                                         UINT32_C(0x1)
1336                 /* tx path */
1337         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_TX \
1338                                                         (UINT32_C(0x0) << 0)
1339                 /* rx path */
1340         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX \
1341                                                         (UINT32_C(0x1) << 0)
1342         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_LAST \
1343                                 HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX
1344         /*
1345          * Setting of this flag indicates the applicability to the loopback
1346          * path.
1347          */
1348         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_LOOPBACK \
1349                                                         UINT32_C(0x2)
1350         /*
1351          * Setting of this flag indicates drop action. If this flag is not set,
1352          * then it should be considered accept action.
1353          */
1354         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_DROP \
1355                                                         UINT32_C(0x4)
1356         /*
1357          * If this flag is set, all t_l2_* fields are invalid and they should
1358          * not be specified. If this flag is set, then l2_* fields refer to
1359          * fields of outermost L2 header.
1360          */
1361         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST \
1362                                                         UINT32_C(0x8)
1363         uint32_t flags;
1364
1365         /* This bit must be '1' for the l2_addr field to be configured. */
1366         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR \
1367                                                         UINT32_C(0x1)
1368         /* This bit must be '1' for the l2_addr_mask field to be configured. */
1369         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK \
1370                                                         UINT32_C(0x2)
1371         /* This bit must be '1' for the l2_ovlan field to be configured. */
1372         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN \
1373                                                         UINT32_C(0x4)
1374         /* This bit must be '1' for the l2_ovlan_mask field to be configured. */
1375         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN_MASK \
1376                                                         UINT32_C(0x8)
1377         /* This bit must be '1' for the l2_ivlan field to be configured. */
1378         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN \
1379                                                         UINT32_C(0x10)
1380         /* This bit must be '1' for the l2_ivlan_mask field to be configured. */
1381         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN_MASK \
1382                                                         UINT32_C(0x20)
1383         /* This bit must be '1' for the t_l2_addr field to be configured. */
1384         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR \
1385                                                         UINT32_C(0x40)
1386         /*
1387          * This bit must be '1' for the t_l2_addr_mask field to be configured.
1388          */
1389         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR_MASK \
1390                                                         UINT32_C(0x80)
1391         /* This bit must be '1' for the t_l2_ovlan field to be configured. */
1392         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN \
1393                                                         UINT32_C(0x100)
1394         /*
1395          * This bit must be '1' for the t_l2_ovlan_mask field to be configured.
1396          */
1397         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN_MASK \
1398                                                         UINT32_C(0x200)
1399         /* This bit must be '1' for the t_l2_ivlan field to be configured. */
1400         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN \
1401                                                         UINT32_C(0x400)
1402         /*
1403          * This bit must be '1' for the t_l2_ivlan_mask field to be configured.
1404          */
1405         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN_MASK \
1406                                                         UINT32_C(0x800)
1407         /* This bit must be '1' for the src_type field to be configured. */
1408         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_TYPE \
1409                                                         UINT32_C(0x1000)
1410         /* This bit must be '1' for the src_id field to be configured. */
1411         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_ID \
1412                                                         UINT32_C(0x2000)
1413         /* This bit must be '1' for the tunnel_type field to be configured. */
1414         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_TUNNEL_TYPE \
1415                                                         UINT32_C(0x4000)
1416         /* This bit must be '1' for the dst_id field to be configured. */
1417         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_DST_ID \
1418                                                         UINT32_C(0x8000)
1419         /*
1420          * This bit must be '1' for the mirror_vnic_id field to be configured.
1421          */
1422         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID \
1423                                                         UINT32_C(0x10000)
1424         uint32_t enables;
1425
1426         /*
1427          * This value sets the match value for the L2 MAC address. Destination
1428          * MAC address for RX path. Source MAC address for TX path.
1429          */
1430         uint8_t l2_addr[6];
1431
1432         uint8_t unused_0;
1433         uint8_t unused_1;
1434
1435         /*
1436          * This value sets the mask value for the L2 address. A value of 0 will
1437          * mask the corresponding bit from compare.
1438          */
1439         uint8_t l2_addr_mask[6];
1440
1441         /* This value sets VLAN ID value for outer VLAN. */
1442         uint16_t l2_ovlan;
1443
1444         /*
1445          * This value sets the mask value for the ovlan id. A value of 0 will
1446          * mask the corresponding bit from compare.
1447          */
1448         uint16_t l2_ovlan_mask;
1449
1450         /* This value sets VLAN ID value for inner VLAN. */
1451         uint16_t l2_ivlan;
1452
1453         /*
1454          * This value sets the mask value for the ivlan id. A value of 0 will
1455          * mask the corresponding bit from compare.
1456          */
1457         uint16_t l2_ivlan_mask;
1458
1459         uint8_t unused_2;
1460         uint8_t unused_3;
1461
1462         /*
1463          * This value sets the match value for the tunnel L2 MAC address.
1464          * Destination MAC address for RX path. Source MAC address for TX path.
1465          */
1466         uint8_t t_l2_addr[6];
1467
1468         uint8_t unused_4;
1469         uint8_t unused_5;
1470
1471         /*
1472          * This value sets the mask value for the tunnel L2 address. A value of
1473          * 0 will mask the corresponding bit from compare.
1474          */
1475         uint8_t t_l2_addr_mask[6];
1476
1477         /* This value sets VLAN ID value for tunnel outer VLAN. */
1478         uint16_t t_l2_ovlan;
1479
1480         /*
1481          * This value sets the mask value for the tunnel ovlan id. A value of 0
1482          * will mask the corresponding bit from compare.
1483          */
1484         uint16_t t_l2_ovlan_mask;
1485
1486         /* This value sets VLAN ID value for tunnel inner VLAN. */
1487         uint16_t t_l2_ivlan;
1488
1489         /*
1490          * This value sets the mask value for the tunnel ivlan id. A value of 0
1491          * will mask the corresponding bit from compare.
1492          */
1493         uint16_t t_l2_ivlan_mask;
1494
1495         /* This value identifies the type of source of the packet. */
1496                 /* Network port */
1497         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_NPORT \
1498                                                         (UINT32_C(0x0) << 0)
1499                 /* Physical function */
1500         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_PF \
1501                                                         (UINT32_C(0x1) << 0)
1502                 /* Virtual function */
1503         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VF \
1504                                                         (UINT32_C(0x2) << 0)
1505                 /* Virtual NIC of a function */
1506         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VNIC \
1507                                                         (UINT32_C(0x3) << 0)
1508                 /* Embedded processor for CFA management */
1509         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_KONG \
1510                                                         (UINT32_C(0x4) << 0)
1511                 /* Embedded processor for OOB management */
1512         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_APE \
1513                                                         (UINT32_C(0x5) << 0)
1514                 /* Embedded processor for RoCE */
1515         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_BONO \
1516                                                         (UINT32_C(0x6) << 0)
1517                 /* Embedded processor for network proxy functions */
1518         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_TANG \
1519                                                         (UINT32_C(0x7) << 0)
1520         uint8_t src_type;
1521
1522         uint8_t unused_6;
1523         /*
1524          * This value is the id of the source. For a network port, it represents
1525          * port_id. For a physical function, it represents fid. For a virtual
1526          * function, it represents vf_id. For a vnic, it represents vnic_id. For
1527          * embedded processors, this id is not valid. Notes: 1. The function ID
1528          * is implied if it src_id is not provided for a src_type that is either
1529          */
1530         uint32_t src_id;
1531
1532         /* Tunnel Type. */
1533                 /* Non-tunnel */
1534         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NONTUNNEL \
1535                                                         (UINT32_C(0x0) << 0)
1536                 /* Virtual eXtensible Local Area Network (VXLAN) */
1537         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_VXLAN \
1538                                                         (UINT32_C(0x1) << 0)
1539                 /*
1540                  * Network Virtualization Generic Routing Encapsulation (NVGRE)
1541                  */
1542         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NVGRE \
1543                                                         (UINT32_C(0x2) << 0)
1544                 /*
1545                  * Generic Routing Encapsulation (GRE) inside Ethernet payload
1546                  */
1547         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_L2GRE \
1548                                                         (UINT32_C(0x3) << 0)
1549                 /* IP in IP */
1550         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPIP \
1551                                                         (UINT32_C(0x4) << 0)
1552                 /* Generic Network Virtualization Encapsulation (Geneve) */
1553         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_GENEVE \
1554                                                         (UINT32_C(0x5) << 0)
1555                 /* Multi-Protocol Lable Switching (MPLS) */
1556         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_MPLS \
1557                                                         (UINT32_C(0x6) << 0)
1558                 /* Stateless Transport Tunnel (STT) */
1559         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_STT \
1560                                                         (UINT32_C(0x7) << 0)
1561                 /*
1562                  * Generic Routing Encapsulation (GRE) inside IP datagram
1563                  * payload
1564                  */
1565         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPGRE \
1566                                                         (UINT32_C(0x8) << 0)
1567                 /* Any tunneled traffic */
1568         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_ANYTUNNEL \
1569                                                         (UINT32_C(0xff) << 0)
1570         uint8_t tunnel_type;
1571
1572         uint8_t unused_7;
1573
1574         /*
1575          * If set, this value shall represent the Logical VNIC ID of the
1576          * destination VNIC for the RX path and network port id of the
1577          * destination port for the TX path.
1578          */
1579         uint16_t dst_id;
1580
1581         /* Logical VNIC ID of the VNIC where traffic is mirrored. */
1582         uint16_t mirror_vnic_id;
1583
1584         /*
1585          * This hint is provided to help in placing the filter in the filter
1586          * table.
1587          */
1588                 /* No preference */
1589         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_NO_PREFER \
1590                                                         (UINT32_C(0x0) << 0)
1591                 /* Above the given filter */
1592         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_ABOVE_FILTER \
1593                                                         (UINT32_C(0x1) << 0)
1594                 /* Below the given filter */
1595         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_BELOW_FILTER \
1596                                                         (UINT32_C(0x2) << 0)
1597                 /* As high as possible */
1598         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MAX \
1599                                                         (UINT32_C(0x3) << 0)
1600                 /* As low as possible */
1601         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MIN \
1602                                                         (UINT32_C(0x4) << 0)
1603         uint8_t pri_hint;
1604
1605         uint8_t unused_8;
1606         uint32_t unused_9;
1607
1608         /*
1609          * This is the ID of the filter that goes along with the pri_hint. This
1610          * field is valid only for the following values. 1 - Above the given
1611          * filter 2 - Below the given filter
1612          */
1613         uint64_t l2_filter_id_hint;
1614 } __attribute__((packed));
1615
1616 /* Output (24 bytes) */
1617 struct hwrm_cfa_l2_filter_alloc_output {
1618         /*
1619          * Pass/Fail or error type Note: receiver to verify the in parameters,
1620          * and fail the call with an error when appropriate
1621          */
1622         uint16_t error_code;
1623
1624         /* This field returns the type of original request. */
1625         uint16_t req_type;
1626
1627         /* This field provides original sequence number of the command. */
1628         uint16_t seq_id;
1629
1630         /*
1631          * This field is the length of the response in bytes. The last byte of
1632          * the response is a valid flag that will read as '1' when the command
1633          * has been completely written to memory.
1634          */
1635         uint16_t resp_len;
1636
1637         /*
1638          * This value identifies a set of CFA data structures used for an L2
1639          * context.
1640          */
1641         uint64_t l2_filter_id;
1642
1643         /*
1644          * This is the ID of the flow associated with this filter. This value
1645          * shall be used to match and associate the flow identifier returned in
1646          * completion records. A value of 0xFFFFFFFF shall indicate no flow id.
1647          */
1648         uint32_t flow_id;
1649
1650         uint8_t unused_0;
1651         uint8_t unused_1;
1652         uint8_t unused_2;
1653
1654         /*
1655          * This field is used in Output records to indicate that the output is
1656          * completely written to RAM. This field should be read as '1' to
1657          * indicate that the output has been completely written. When writing a
1658          * command completion or response to an internal processor, the order of
1659          * writes has to be such that this field is written last.
1660          */
1661         uint8_t valid;
1662 } __attribute__((packed));
1663
1664 /* hwrm_cfa_l2_filter_free */
1665 /*
1666  * Description: Free a L2 filter. The HWRM shall free all associated filter
1667  * resources with the L2 filter.
1668  */
1669
1670 /* Input (24 bytes) */
1671 struct hwrm_cfa_l2_filter_free_input {
1672         /*
1673          * This value indicates what type of request this is. The format for the
1674          * rest of the command is determined by this field.
1675          */
1676         uint16_t req_type;
1677
1678         /*
1679          * This value indicates the what completion ring the request will be
1680          * optionally completed on. If the value is -1, then no CR completion
1681          * will be generated. Any other value must be a valid CR ring_id value
1682          * for this function.
1683          */
1684         uint16_t cmpl_ring;
1685
1686         /* This value indicates the command sequence number. */
1687         uint16_t seq_id;
1688
1689         /*
1690          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1691          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1692          */
1693         uint16_t target_id;
1694
1695         /*
1696          * This is the host address where the response will be written when the
1697          * request is complete. This area must be 16B aligned and must be
1698          * cleared to zero before the request is made.
1699          */
1700         uint64_t resp_addr;
1701
1702         /*
1703          * This value identifies a set of CFA data structures used for an L2
1704          * context.
1705          */
1706         uint64_t l2_filter_id;
1707 } __attribute__((packed));
1708
1709 /* Output (16 bytes) */
1710 struct hwrm_cfa_l2_filter_free_output {
1711         /*
1712          * Pass/Fail or error type Note: receiver to verify the in parameters,
1713          * and fail the call with an error when appropriate
1714          */
1715         uint16_t error_code;
1716
1717         /* This field returns the type of original request. */
1718         uint16_t req_type;
1719
1720         /* This field provides original sequence number of the command. */
1721         uint16_t seq_id;
1722
1723         /*
1724          * This field is the length of the response in bytes. The last byte of
1725          * the response is a valid flag that will read as '1' when the command
1726          * has been completely written to memory.
1727          */
1728         uint16_t resp_len;
1729
1730         uint32_t unused_0;
1731         uint8_t unused_1;
1732         uint8_t unused_2;
1733         uint8_t unused_3;
1734
1735         /*
1736          * This field is used in Output records to indicate that the output is
1737          * completely written to RAM. This field should be read as '1' to
1738          * indicate that the output has been completely written. When writing a
1739          * command completion or response to an internal processor, the order of
1740          * writes has to be such that this field is written last.
1741          */
1742         uint8_t valid;
1743 } __attribute__((packed));
1744
1745 /* hwrm_cfa_l2_set_rx_mask */
1746 /* Description: This command will set rx mask of the function. */
1747
1748 /* Input (40 bytes) */
1749 struct hwrm_cfa_l2_set_rx_mask_input {
1750         /*
1751          * This value indicates what type of request this is. The format for the
1752          * rest of the command is determined by this field.
1753          */
1754         uint16_t req_type;
1755
1756         /*
1757          * This value indicates the what completion ring the request will be
1758          * optionally completed on. If the value is -1, then no CR completion
1759          * will be generated. Any other value must be a valid CR ring_id value
1760          * for this function.
1761          */
1762         uint16_t cmpl_ring;
1763
1764         /* This value indicates the command sequence number. */
1765         uint16_t seq_id;
1766
1767         /*
1768          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1769          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1770          */
1771         uint16_t target_id;
1772
1773         /*
1774          * This is the host address where the response will be written when the
1775          * request is complete. This area must be 16B aligned and must be
1776          * cleared to zero before the request is made.
1777          */
1778         uint64_t resp_addr;
1779
1780         /* VNIC ID */
1781         uint32_t vnic_id;
1782
1783         /* Reserved for future use. */
1784         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_RESERVED     UINT32_C(0x1)
1785         /*
1786          * When this bit is '1', the function is requested to accept multi-cast
1787          * packets specified by the multicast addr table.
1788          */
1789         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST        UINT32_C(0x2)
1790         /*
1791          * When this bit is '1', the function is requested to accept all multi-
1792          * cast packets.
1793          */
1794         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST    UINT32_C(0x4)
1795         /*
1796          * When this bit is '1', the function is requested to accept broadcast
1797          * packets.
1798          */
1799         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST        UINT32_C(0x8)
1800         /*
1801          * When this bit is '1', the function is requested to be put in the
1802          * promiscuous mode. The HWRM should accept any function to set up
1803          * promiscuous mode. The HWRM shall follow the semantics below for the
1804          * promiscuous mode support. # When partitioning is not enabled on a
1805          * port (i.e. single PF on the port), then the PF shall be allowed to be
1806          * in the promiscuous mode. When the PF is in the promiscuous mode, then
1807          * it shall receive all host bound traffic on that port. # When
1808          * partitioning is enabled on a port (i.e. multiple PFs per port) and a
1809          * PF on that port is in the promiscuous mode, then the PF receives all
1810          * traffic within that partition as identified by a unique identifier
1811          * for the PF (e.g. S-Tag). If a unique outer VLAN for the PF is
1812          * specified, then the setting of promiscuous mode on that PF shall
1813          * result in the PF receiving all host bound traffic with matching outer
1814          * VLAN. # A VF shall can be set in the promiscuous mode. In the
1815          * promiscuous mode, the VF does not receive any traffic unless a unique
1816          * outer VLAN for the VF is specified. If a unique outer VLAN for the VF
1817          * is specified, then the setting of promiscuous mode on that VF shall
1818          * result in the VF receiving all host bound traffic with the matching
1819          * outer VLAN. # The HWRM shall allow the setting of promiscuous mode on
1820          * a function independently from the promiscuous mode settings on other
1821          * functions.
1822          */
1823         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS  UINT32_C(0x10)
1824         /*
1825          * If this flag is set, the corresponding RX filters shall be set up to
1826          * cover multicast/broadcast filters for the outermost Layer 2
1827          * destination MAC address field.
1828          */
1829         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_OUTERMOST    UINT32_C(0x20)
1830         uint32_t mask;
1831
1832         /* This is the address for mcast address tbl. */
1833         uint64_t mc_tbl_addr;
1834
1835         /*
1836          * This value indicates how many entries in mc_tbl are valid. Each entry
1837          * is 6 bytes.
1838          */
1839         uint32_t num_mc_entries;
1840
1841         uint32_t unused_0;
1842 } __attribute__((packed));
1843
1844 /* Output (16 bytes) */
1845 struct hwrm_cfa_l2_set_rx_mask_output {
1846         /*
1847          * Pass/Fail or error type Note: receiver to verify the in parameters,
1848          * and fail the call with an error when appropriate
1849          */
1850         uint16_t error_code;
1851
1852         /* This field returns the type of original request. */
1853         uint16_t req_type;
1854
1855         /* This field provides original sequence number of the command. */
1856         uint16_t seq_id;
1857
1858         /*
1859          * This field is the length of the response in bytes. The last byte of
1860          * the response is a valid flag that will read as '1' when the command
1861          * has been completely written to memory.
1862          */
1863         uint16_t resp_len;
1864
1865         uint32_t unused_0;
1866         uint8_t unused_1;
1867         uint8_t unused_2;
1868         uint8_t unused_3;
1869
1870         /*
1871          * This field is used in Output records to indicate that the output is
1872          * completely written to RAM. This field should be read as '1' to
1873          * indicate that the output has been completely written. When writing a
1874          * command completion or response to an internal processor, the order of
1875          * writes has to be such that this field is written last.
1876          */
1877         uint8_t valid;
1878 } __attribute__((packed));
1879
1880 /* hwrm_exec_fwd_resp */
1881 /*
1882  * Description: This command is used to send an encapsulated request to the
1883  * HWRM. This command instructs the HWRM to execute the request and forward the
1884  * response of the encapsulated request to the location specified in the
1885  * original request that is encapsulated. The target id of this command shall be
1886  * set to 0xFFFF (HWRM). The response location in this command shall be used to
1887  * acknowledge the receipt of the encapsulated request and forwarding of the
1888  * response.
1889  */
1890
1891 /* Input (128 bytes) */
1892 struct hwrm_exec_fwd_resp_input {
1893         /*
1894          * This value indicates what type of request this is. The format for the
1895          * rest of the command is determined by this field.
1896          */
1897         uint16_t req_type;
1898
1899         /*
1900          * This value indicates the what completion ring the request will be
1901          * optionally completed on. If the value is -1, then no CR completion
1902          * will be generated. Any other value must be a valid CR ring_id value
1903          * for this function.
1904          */
1905         uint16_t cmpl_ring;
1906
1907         /* This value indicates the command sequence number. */
1908         uint16_t seq_id;
1909
1910         /*
1911          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1912          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1913          */
1914         uint16_t target_id;
1915
1916         /*
1917          * This is the host address where the response will be written when the
1918          * request is complete. This area must be 16B aligned and must be
1919          * cleared to zero before the request is made.
1920          */
1921         uint64_t resp_addr;
1922
1923         /*
1924          * This is an encapsulated request. This request should be executed by
1925          * the HWRM and the response should be provided in the response buffer
1926          * inside the encapsulated request.
1927          */
1928         uint32_t encap_request[26];
1929
1930         /*
1931          * This value indicates the target id of the response to the
1932          * encapsulated request. 0x0 - 0xFFF8 - Used for function ids 0xFFF8 -
1933          * 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1934          */
1935         uint16_t encap_resp_target_id;
1936
1937         uint16_t unused_0[3];
1938 } __attribute__((packed));
1939
1940 /* Output (16 bytes) */
1941 struct hwrm_exec_fwd_resp_output {
1942         /*
1943          * Pass/Fail or error type Note: receiver to verify the in parameters,
1944          * and fail the call with an error when appropriate
1945          */
1946         uint16_t error_code;
1947
1948         /* This field returns the type of original request. */
1949         uint16_t req_type;
1950
1951         /* This field provides original sequence number of the command. */
1952         uint16_t seq_id;
1953
1954         /*
1955          * This field is the length of the response in bytes. The last byte of
1956          * the response is a valid flag that will read as '1' when the command
1957          * has been completely written to memory.
1958          */
1959         uint16_t resp_len;
1960
1961         uint32_t unused_0;
1962         uint8_t unused_1;
1963         uint8_t unused_2;
1964         uint8_t unused_3;
1965
1966         /*
1967          * This field is used in Output records to indicate that the output is
1968          * completely written to RAM. This field should be read as '1' to
1969          * indicate that the output has been completely written. When writing a
1970          * command completion or response to an internal processor, the order of
1971          * writes has to be such that this field is written last.
1972          */
1973         uint8_t valid;
1974 } __attribute__((packed));
1975
1976 /* hwrm_func_qcaps */
1977 /*
1978  * Description: This command returns capabilities of a function. The input FID
1979  * value is used to indicate what function is being queried. This allows a
1980  * physical function driver to query virtual functions that are children of the
1981  * physical function. The output FID value is needed to configure Rings and
1982  * MSI-X vectors so their DMA operations appear correctly on the PCI bus.
1983  */
1984
1985 /* Input (24 bytes) */
1986 struct hwrm_func_qcaps_input {
1987         /*
1988          * This value indicates what type of request this is. The format for the
1989          * rest of the command is determined by this field.
1990          */
1991         uint16_t req_type;
1992
1993         /*
1994          * This value indicates the what completion ring the request will be
1995          * optionally completed on. If the value is -1, then no CR completion
1996          * will be generated. Any other value must be a valid CR ring_id value
1997          * for this function.
1998          */
1999         uint16_t cmpl_ring;
2000
2001         /* This value indicates the command sequence number. */
2002         uint16_t seq_id;
2003
2004         /*
2005          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
2006          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
2007          */
2008         uint16_t target_id;
2009
2010         /*
2011          * This is the host address where the response will be written when the
2012          * request is complete. This area must be 16B aligned and must be
2013          * cleared to zero before the request is made.
2014          */
2015         uint64_t resp_addr;
2016
2017         /*
2018          * Function ID of the function that is being queried. 0xFF... (All Fs)
2019          * if the query is for the requesting function.
2020          */
2021         uint16_t fid;
2022
2023         uint16_t unused_0[3];
2024 } __attribute__((packed));
2025
2026 /* Output (80 bytes) */
2027 struct hwrm_func_qcaps_output {
2028         uint16_t error_code;
2029         /*
2030          * Pass/Fail or error type Note: receiver to verify the in
2031          * parameters, and fail the call with an error when appropriate
2032          */
2033         uint16_t req_type;
2034         /* This field returns the type of original request. */
2035         uint16_t seq_id;
2036         /* This field provides original sequence number of the command. */
2037         uint16_t resp_len;
2038         /*
2039          * This field is the length of the response in bytes. The last
2040          * byte of the response is a valid flag that will read as '1'
2041          * when the command has been completely written to memory.
2042          */
2043         uint16_t fid;
2044         /*
2045          * FID value. This value is used to identify operations on the
2046          * PCI bus as belonging to a particular PCI function.
2047          */
2048         uint16_t port_id;
2049         /*
2050          * Port ID of port that this function is associated with. Valid
2051          * only for the PF. 0xFF... (All Fs) if this function is not
2052          * associated with any port. 0xFF... (All Fs) if this function
2053          * is called from a VF.
2054          */
2055         uint32_t flags;
2056         /* If 1, then Push mode is supported on this function. */
2057         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PUSH_MODE_SUPPORTED        UINT32_C(0x1)
2058         /*
2059          * If 1, then the global MSI-X auto-masking is enabled for the
2060          * device.
2061          */
2062         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_GLOBAL_MSIX_AUTOMASKING    UINT32_C(0x2)
2063         /*
2064          * If 1, then the Precision Time Protocol (PTP) processing is
2065          * supported on this function. The HWRM should enable PTP on
2066          * only a single Physical Function (PF) per port.
2067          */
2068         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED      UINT32_C(0x4)
2069         /*
2070          * If 1, then RDMA over Converged Ethernet (RoCE) v1 is
2071          * supported on this function.
2072          */
2073         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ROCE_V1_SUPPORTED  UINT32_C(0x8)
2074         /*
2075          * If 1, then RDMA over Converged Ethernet (RoCE) v2 is
2076          * supported on this function.
2077          */
2078         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ROCE_V2_SUPPORTED  UINT32_C(0x10)
2079         /*
2080          * If 1, then control and configuration of WoL magic packet are
2081          * supported on this function.
2082          */
2083         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_WOL_MAGICPKT_SUPPORTED     UINT32_C(0x20)
2084         /*
2085          * If 1, then control and configuration of bitmap pattern packet
2086          * are supported on this function.
2087          */
2088         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_WOL_BMP_SUPPORTED  UINT32_C(0x40)
2089         /*
2090          * If set to 1, then the control and configuration of rate limit
2091          * of an allocated TX ring on the queried function is supported.
2092          */
2093         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_TX_RING_RL_SUPPORTED       UINT32_C(0x80)
2094         /*
2095          * If 1, then control and configuration of minimum and maximum
2096          * bandwidths are supported on the queried function.
2097          */
2098         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_TX_BW_CFG_SUPPORTED        UINT32_C(0x100)
2099         /*
2100          * If the query is for a VF, then this flag shall be ignored. If
2101          * this query is for a PF and this flag is set to 1, then the PF
2102          * has the capability to set the rate limits on the TX rings of
2103          * its children VFs. If this query is for a PF and this flag is
2104          * set to 0, then the PF does not have the capability to set the
2105          * rate limits on the TX rings of its children VFs.
2106          */
2107         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VF_TX_RING_RL_SUPPORTED    UINT32_C(0x200)
2108         /*
2109          * If the query is for a VF, then this flag shall be ignored. If
2110          * this query is for a PF and this flag is set to 1, then the PF
2111          * has the capability to set the minimum and/or maximum
2112          * bandwidths for its children VFs. If this query is for a PF
2113          * and this flag is set to 0, then the PF does not have the
2114          * capability to set the minimum or maximum bandwidths for its
2115          * children VFs.
2116          */
2117         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VF_BW_CFG_SUPPORTED        UINT32_C(0x400)
2118         uint8_t mac_address[6];
2119         /*
2120          * This value is current MAC address configured for this
2121          * function. A value of 00-00-00-00-00-00 indicates no MAC
2122          * address is currently configured.
2123          */
2124         uint16_t max_rsscos_ctx;
2125         /*
2126          * The maximum number of RSS/COS contexts that can be allocated
2127          * to the function.
2128          */
2129         uint16_t max_cmpl_rings;
2130         /*
2131          * The maximum number of completion rings that can be allocated
2132          * to the function.
2133          */
2134         uint16_t max_tx_rings;
2135         /*
2136          * The maximum number of transmit rings that can be allocated to
2137          * the function.
2138          */
2139         uint16_t max_rx_rings;
2140         /*
2141          * The maximum number of receive rings that can be allocated to
2142          * the function.
2143          */
2144         uint16_t max_l2_ctxs;
2145         /*
2146          * The maximum number of L2 contexts that can be allocated to
2147          * the function.
2148          */
2149         uint16_t max_vnics;
2150         /*
2151          * The maximum number of VNICs that can be allocated to the
2152          * function.
2153          */
2154         uint16_t first_vf_id;
2155         /*
2156          * The identifier for the first VF enabled on a PF. This is
2157          * valid only on the PF with SR-IOV enabled. 0xFF... (All Fs) if
2158          * this command is called on a PF with SR-IOV disabled or on a
2159          * VF.
2160          */
2161         uint16_t max_vfs;
2162         /*
2163          * The maximum number of VFs that can be allocated to the
2164          * function. This is valid only on the PF with SR-IOV enabled.
2165          * 0xFF... (All Fs) if this command is called on a PF with SR-
2166          * IOV disabled or on a VF.
2167          */
2168         uint16_t max_stat_ctx;
2169         /*
2170          * The maximum number of statistic contexts that can be
2171          * allocated to the function.
2172          */
2173         uint32_t max_encap_records;
2174         /*
2175          * The maximum number of Encapsulation records that can be
2176          * offloaded by this function.
2177          */
2178         uint32_t max_decap_records;
2179         /*
2180          * The maximum number of decapsulation records that can be
2181          * offloaded by this function.
2182          */
2183         uint32_t max_tx_em_flows;
2184         /*
2185          * The maximum number of Exact Match (EM) flows that can be
2186          * offloaded by this function on the TX side.
2187          */
2188         uint32_t max_tx_wm_flows;
2189         /*
2190          * The maximum number of Wildcard Match (WM) flows that can be
2191          * offloaded by this function on the TX side.
2192          */
2193         uint32_t max_rx_em_flows;
2194         /*
2195          * The maximum number of Exact Match (EM) flows that can be
2196          * offloaded by this function on the RX side.
2197          */
2198         uint32_t max_rx_wm_flows;
2199         /*
2200          * The maximum number of Wildcard Match (WM) flows that can be
2201          * offloaded by this function on the RX side.
2202          */
2203         uint32_t max_mcast_filters;
2204         /*
2205          * The maximum number of multicast filters that can be supported
2206          * by this function on the RX side.
2207          */
2208         uint32_t max_flow_id;
2209         /*
2210          * The maximum value of flow_id that can be supported in
2211          * completion records.
2212          */
2213         uint32_t max_hw_ring_grps;
2214         /*
2215          * The maximum number of HW ring groups that can be supported on
2216          * this function.
2217          */
2218         uint16_t max_sp_tx_rings;
2219         /*
2220          * The maximum number of strict priority transmit rings that can
2221          * be allocated to the function. This number indicates the
2222          * maximum number of TX rings that can be assigned strict
2223          * priorities out of the maximum number of TX rings that can be
2224          * allocated (max_tx_rings) to the function.
2225          */
2226         uint8_t unused_0;
2227         uint8_t valid;
2228         /*
2229          * This field is used in Output records to indicate that the
2230          * output is completely written to RAM. This field should be
2231          * read as '1' to indicate that the output has been completely
2232          * written. When writing a command completion or response to an
2233          * internal processor, the order of writes has to be such that
2234          * this field is written last.
2235          */
2236 } __attribute__((packed));
2237
2238 /* hwrm_func_reset */
2239 /*
2240  * Description: This command resets a hardware function (PCIe function) and
2241  * frees any resources used by the function. This command shall be initiated by
2242  * the driver after an FLR has occurred to prepare the function for re-use. This
2243  * command may also be initiated by a driver prior to doing it's own
2244  * configuration. This command puts the function into the reset state. In the
2245  * reset state, global and port related features of the chip are not available.
2246  */
2247 /*
2248  * Note: This command will reset a function that has already been disabled or
2249  * idled. The command returns all the resources owned by the function so a new
2250  * driver may allocate and configure resources normally.
2251  */
2252
2253 /* Input (24 bytes) */
2254 struct hwrm_func_reset_input {
2255         /*
2256          * This value indicates what type of request this is. The format for the
2257          * rest of the command is determined by this field.
2258          */
2259         uint16_t req_type;
2260
2261         /*
2262          * This value indicates the what completion ring the request will be
2263          * optionally completed on. If the value is -1, then no CR completion
2264          * will be generated. Any other value must be a valid CR ring_id value
2265          * for this function.
2266          */
2267         uint16_t cmpl_ring;
2268
2269         /* This value indicates the command sequence number. */
2270         uint16_t seq_id;
2271
2272         /*
2273          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
2274          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
2275          */
2276         uint16_t target_id;
2277
2278         /*
2279          * This is the host address where the response will be written when the
2280          * request is complete. This area must be 16B aligned and must be
2281          * cleared to zero before the request is made.
2282          */
2283         uint64_t resp_addr;
2284
2285         /* This bit must be '1' for the vf_id_valid field to be configured. */
2286         #define HWRM_FUNC_RESET_INPUT_ENABLES_VF_ID_VALID \
2287                                                         UINT32_C(0x1)
2288         uint32_t enables;
2289
2290         /*
2291          * The ID of the VF that this PF is trying to reset. Only the parent PF
2292          * shall be allowed to reset a child VF. A parent PF driver shall use
2293          * this field only when a specific child VF is requested to be reset.
2294          */
2295         uint16_t vf_id;
2296
2297         /* This value indicates the level of a function reset. */
2298                 /*
2299                  * Reset the caller function and its children VFs (if any). If
2300                  * no children functions exist, then reset the caller function
2301                  * only.
2302                  */
2303         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETALL \
2304                                                         (UINT32_C(0x0) << 0)
2305                 /* Reset the caller function only */
2306         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETME \
2307                                                         (UINT32_C(0x1) << 0)
2308                 /*
2309                  * Reset all children VFs of the caller function driver if the
2310                  * caller is a PF driver. It is an error to specify this level
2311                  * by a VF driver. It is an error to specify this level by a PF
2312                  * driver with no children VFs.
2313                  */
2314         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETCHILDREN \
2315                                                         (UINT32_C(0x2) << 0)
2316                 /*
2317                  * Reset a specific VF of the caller function driver if the
2318                  * caller is the parent PF driver. It is an error to specify
2319                  * this level by a VF driver. It is an error to specify this
2320                  * level by a PF driver that is not the parent of the VF that is
2321                  * being requested to reset.
2322                  */
2323         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETVF \
2324                                                         (UINT32_C(0x3) << 0)
2325         uint8_t func_reset_level;
2326
2327         uint8_t unused_0;
2328 } __attribute__((packed));
2329
2330 /* Output (16 bytes) */
2331 struct hwrm_func_reset_output {
2332         /*
2333          * Pass/Fail or error type Note: receiver to verify the in parameters,
2334          * and fail the call with an error when appropriate
2335          */
2336         uint16_t error_code;
2337
2338         /* This field returns the type of original request. */
2339         uint16_t req_type;
2340
2341         /* This field provides original sequence number of the command. */
2342         uint16_t seq_id;
2343
2344         /*
2345          * This field is the length of the response in bytes. The last byte of
2346          * the response is a valid flag that will read as '1' when the command
2347          * has been completely written to memory.
2348          */
2349         uint16_t resp_len;
2350
2351         uint32_t unused_0;
2352         uint8_t unused_1;
2353         uint8_t unused_2;
2354         uint8_t unused_3;
2355
2356         /*
2357          * This field is used in Output records to indicate that the output is
2358          * completely written to RAM. This field should be read as '1' to
2359          * indicate that the output has been completely written. When writing a
2360          * command completion or response to an internal processor, the order of
2361          * writes has to be such that this field is written last.
2362          */
2363         uint8_t valid;
2364 } __attribute__((packed));
2365
2366 /* hwrm_port_phy_cfg */
2367 /*
2368  * Description: This command configures the PHY device for the port. It allows
2369  * setting of the most generic settings for the PHY. The HWRM shall complete
2370  * this command as soon as PHY settings are configured. They may not be applied
2371  * when the command response is provided. A VF driver shall not be allowed to
2372  * configure PHY using this command. In a network partition mode, a PF driver
2373  * shall not be allowed to configure PHY using this command.
2374  */
2375
2376 /* Input (56 bytes) */
2377 struct hwrm_port_phy_cfg_input {
2378         /*
2379          * This value indicates what type of request this is. The format for the
2380          * rest of the command is determined by this field.
2381          */
2382         uint16_t req_type;
2383
2384         /*
2385          * This value indicates the what completion ring the request will be
2386          * optionally completed on. If the value is -1, then no CR completion
2387          * will be generated. Any other value must be a valid CR ring_id value
2388          * for this function.
2389          */
2390         uint16_t cmpl_ring;
2391
2392         /* This value indicates the command sequence number. */
2393         uint16_t seq_id;
2394
2395         /*
2396          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
2397          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
2398          */
2399         uint16_t target_id;
2400
2401         /*
2402          * This is the host address where the response will be written when the
2403          * request is complete. This area must be 16B aligned and must be
2404          * cleared to zero before the request is made.
2405          */
2406         uint64_t resp_addr;
2407
2408         /*
2409          * When this bit is set to '1', the PHY for the port shall be reset. #
2410          * If this bit is set to 1, then the HWRM shall reset the PHY after
2411          * applying PHY configuration changes specified in this command. # In
2412          * order to guarantee that PHY configuration changes specified in this
2413          * command take effect, the HWRM client should set this flag to 1. # If
2414          * this bit is not set to 1, then the HWRM may reset the PHY depending
2415          * on the current PHY configuration and settings specified in this
2416          * command.
2417          */
2418         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY            UINT32_C(0x1)
2419         /*
2420          * When this bit is set to '1', the link shall be forced to be taken
2421          * down. # When this bit is set to '1", all other command input settings
2422          * related to the link speed shall be ignored. Once the link state is
2423          * forced down, it can be explicitly cleared from that state by setting
2424          * this flag to '0'. # If this flag is set to '0', then the link shall
2425          * be cleared from forced down state if the link is in forced down
2426          * state. There may be conditions (e.g. out-of-band or sideband
2427          * configuration changes for the link) outside the scope of the HWRM
2428          * implementation that may clear forced down link state.
2429          */
2430         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE_LINK_DOWN      UINT32_C(0x2)
2431         /*
2432          * When this bit is set to '1', the link shall be forced to the
2433          * force_link_speed value. When this bit is set to '1', the HWRM client
2434          * should not enable any of the auto negotiation related fields
2435          * represented by auto_XXX fields in this command. When this bit is set
2436          * to '1' and the HWRM client has enabled a auto_XXX field in this
2437          * command, then the HWRM shall ignore the enabled auto_XXX field. When
2438          * this bit is set to zero, the link shall be allowed to autoneg.
2439          */
2440         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE                UINT32_C(0x4)
2441         /*
2442          * When this bit is set to '1', the auto-negotiation process shall be
2443          * restarted on the link.
2444          */
2445         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG      UINT32_C(0x8)
2446         /*
2447          * When this bit is set to '1', Energy Efficient Ethernet (EEE) is
2448          * requested to be enabled on this link. If EEE is not supported on this
2449          * port, then this flag shall be ignored by the HWRM.
2450          */
2451         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_ENABLE        UINT32_C(0x10)
2452         /*
2453          * When this bit is set to '1', Energy Efficient Ethernet (EEE) is
2454          * requested to be disabled on this link. If EEE is not supported on
2455          * this port, then this flag shall be ignored by the HWRM.
2456          */
2457         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_DISABLE       UINT32_C(0x20)
2458         /*
2459          * When this bit is set to '1' and EEE is enabled on this link, then TX
2460          * LPI is requested to be enabled on the link. If EEE is not supported
2461          * on this port, then this flag shall be ignored by the HWRM. If EEE is
2462          * disabled on this port, then this flag shall be ignored by the HWRM.
2463          */
2464         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_TX_LPI        UINT32_C(0x40)
2465         uint32_t flags;
2466
2467         /* This bit must be '1' for the auto_mode field to be configured. */
2468         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE          UINT32_C(0x1)
2469         /* This bit must be '1' for the auto_duplex field to be configured. */
2470         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_DUPLEX        UINT32_C(0x2)
2471         /* This bit must be '1' for the auto_pause field to be configured. */
2472         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_PAUSE         UINT32_C(0x4)
2473         /*
2474          * This bit must be '1' for the auto_link_speed field to be configured.
2475          */
2476         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED    UINT32_C(0x8)
2477         /*
2478          * This bit must be '1' for the auto_link_speed_mask field to be
2479          * configured.
2480          */
2481         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK \
2482                                                                 UINT32_C(0x10)
2483         /* This bit must be '1' for the wirespeed field to be configured. */
2484         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_WIRESPEED       UINT32_C(0x20)
2485         /* This bit must be '1' for the lpbk field to be configured. */
2486         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_LPBK            UINT32_C(0x40)
2487         /* This bit must be '1' for the preemphasis field to be configured. */
2488         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_PREEMPHASIS     UINT32_C(0x80)
2489         /* This bit must be '1' for the force_pause field to be configured. */
2490         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_FORCE_PAUSE     UINT32_C(0x100)
2491         /*
2492          * This bit must be '1' for the eee_link_speed_mask field to be
2493          * configured.
2494          */
2495         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_EEE_LINK_SPEED_MASK \
2496                                                                 UINT32_C(0x200)
2497         /* This bit must be '1' for the tx_lpi_timer field to be configured. */
2498         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_TX_LPI_TIMER    UINT32_C(0x400)
2499         uint32_t enables;
2500
2501         /* Port ID of port that is to be configured. */
2502         uint16_t port_id;
2503
2504         /*
2505          * This is the speed that will be used if the force bit is '1'. If
2506          * unsupported speed is selected, an error will be generated.
2507          */
2508                 /* 100Mb link speed */
2509         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100MB \
2510                                                         (UINT32_C(0x1) << 0)
2511                 /* 1Gb link speed */
2512         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_1GB \
2513                                                         (UINT32_C(0xa) << 0)
2514                 /* 2Gb link speed */
2515         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2GB \
2516                                                         (UINT32_C(0x14) << 0)
2517                 /* 2.5Gb link speed */
2518         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2_5GB \
2519                                                         (UINT32_C(0x19) << 0)
2520                 /* 10Gb link speed */
2521         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10GB \
2522                                                         (UINT32_C(0x64) << 0)
2523                 /* 20Mb link speed */
2524         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_20GB \
2525                                                         (UINT32_C(0xc8) << 0)
2526                 /* 25Gb link speed */
2527         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_25GB \
2528                                                         (UINT32_C(0xfa) << 0)
2529                 /* 40Gb link speed */
2530         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_40GB \
2531                                                         (UINT32_C(0x190) << 0)
2532                 /* 50Gb link speed */
2533         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_50GB \
2534                                                         (UINT32_C(0x1f4) << 0)
2535                 /* 100Gb link speed */
2536         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100GB \
2537                                                         (UINT32_C(0x3e8) << 0)
2538                 /* 10Mb link speed */
2539         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10MB \
2540                                                         (UINT32_C(0xffff) << 0)
2541         uint16_t force_link_speed;
2542
2543         /*
2544          * This value is used to identify what autoneg mode is used when the
2545          * link speed is not being forced.
2546          */
2547                 /*
2548                  * Disable autoneg or autoneg disabled. No speeds are selected.
2549                  */
2550         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_NONE  (UINT32_C(0x0) << 0)
2551                 /* Select all possible speeds for autoneg mode. */
2552         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ALL_SPEEDS \
2553                                                         (UINT32_C(0x1) << 0)
2554                 /*
2555                  * Select only the auto_link_speed speed for autoneg mode. This
2556                  * mode has been DEPRECATED. An HWRM client should not use this
2557                  * mode.
2558                  */
2559         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ONE_SPEED \
2560                                                         (UINT32_C(0x2) << 0)
2561                 /*
2562                  * Select the auto_link_speed or any speed below that speed for
2563                  * autoneg. This mode has been DEPRECATED. An HWRM client should
2564                  * not use this mode.
2565                  */
2566         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ONE_OR_BELOW \
2567                                                         (UINT32_C(0x3) << 0)
2568                 /*
2569                  * Select the speeds based on the corresponding link speed mask
2570                  * value that is provided.
2571                  */
2572         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK \
2573                                                         (UINT32_C(0x4) << 0)
2574         uint8_t auto_mode;
2575
2576         /*
2577          * This is the duplex setting that will be used if the autoneg_mode is
2578          * "one_speed" or "one_or_below".
2579          */
2580                 /* Half Duplex will be requested. */
2581         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_HALF \
2582                                                         (UINT32_C(0x0) << 0)
2583                 /* Full duplex will be requested. */
2584         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_FULL \
2585                                                         (UINT32_C(0x1) << 0)
2586                 /* Both Half and Full dupex will be requested. */
2587         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_BOTH \
2588                                                         (UINT32_C(0x2) << 0)
2589         uint8_t auto_duplex;
2590
2591         /*
2592          * This value is used to configure the pause that will be used for
2593          * autonegotiation. Add text on the usage of auto_pause and force_pause.
2594          */
2595         /*
2596          * When this bit is '1', Generation of tx pause messages has been
2597          * requested. Disabled otherwise.
2598          */
2599         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_TX              UINT32_C(0x1)
2600         /*
2601          * When this bit is '1', Reception of rx pause messages has been
2602          * requested. Disabled otherwise.
2603          */
2604         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_RX              UINT32_C(0x2)
2605         /*
2606          * When set to 1, the advertisement of pause is enabled. # When the
2607          * auto_mode is not set to none and this flag is set to 1, then the
2608          * auto_pause bits on this port are being advertised and autoneg pause
2609          * results are being interpreted. # When the auto_mode is not set to
2610          * none and this flag is set to 0, the pause is forced as indicated in
2611          * force_pause, and also advertised as auto_pause bits, but the autoneg
2612          * results are not interpreted since the pause configuration is being
2613          * forced. # When the auto_mode is set to none and this flag is set to
2614          * 1, auto_pause bits should be ignored and should be set to 0.
2615          */
2616         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_AUTONEG_PAUSE   UINT32_C(0x4)
2617         uint8_t auto_pause;
2618
2619         uint8_t unused_0;
2620
2621         /*
2622          * This is the speed that will be used if the autoneg_mode is
2623          * "one_speed" or "one_or_below". If an unsupported speed is selected,
2624          * an error will be generated.
2625          */
2626                 /* 100Mb link speed */
2627         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100MB \
2628                                                         (UINT32_C(0x1) << 0)
2629                 /* 1Gb link speed */
2630         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_1GB \
2631                                                         (UINT32_C(0xa) << 0)
2632                 /* 2Gb link speed */
2633         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2GB \
2634                                                         (UINT32_C(0x14) << 0)
2635                 /* 2.5Gb link speed */
2636         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2_5GB \
2637                                                         (UINT32_C(0x19) << 0)
2638                 /* 10Gb link speed */
2639         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_10GB \
2640                                                         (UINT32_C(0x64) << 0)
2641                 /* 20Mb link speed */
2642         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_20GB \
2643                                                         (UINT32_C(0xc8) << 0)
2644                 /* 25Gb link speed */
2645         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_25GB \
2646                                                         (UINT32_C(0xfa) << 0)
2647                 /* 40Gb link speed */
2648         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_40GB \
2649                                                         (UINT32_C(0x190) << 0)
2650                 /* 50Gb link speed */
2651         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_50GB \
2652                                                         (UINT32_C(0x1f4) << 0)
2653                 /* 100Gb link speed */
2654         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100GB \
2655                                                         (UINT32_C(0x3e8) << 0)
2656                 /* 10Mb link speed */
2657         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_10MB \
2658                                                         (UINT32_C(0xffff) << 0)
2659         uint16_t auto_link_speed;
2660
2661         /*
2662          * This is a mask of link speeds that will be used if autoneg_mode is
2663          * "mask". If unsupported speed is enabled an error will be generated.
2664          */
2665         /* 100Mb link speed (Half-duplex) */
2666         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MBHD \
2667                                                         UINT32_C(0x1)
2668         /* 100Mb link speed (Full-duplex) */
2669         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MB \
2670                                                         UINT32_C(0x2)
2671         /* 1Gb link speed (Half-duplex) */
2672         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GBHD \
2673                                                         UINT32_C(0x4)
2674         /* 1Gb link speed (Full-duplex) */
2675         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GB \
2676                                                         UINT32_C(0x8)
2677         /* 2Gb link speed */
2678         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_2GB \
2679                                                         UINT32_C(0x10)
2680         /* 2.5Gb link speed */
2681         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_2_5GB \
2682                                                         UINT32_C(0x20)
2683         /* 10Gb link speed */
2684         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10GB \
2685                                                         UINT32_C(0x40)
2686         /* 20Gb link speed */
2687         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_20GB \
2688                                                         UINT32_C(0x80)
2689         /* 25Gb link speed */
2690         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_25GB \
2691                                                         UINT32_C(0x100)
2692         /* 40Gb link speed */
2693         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_40GB \
2694                                                         UINT32_C(0x200)
2695         /* 50Gb link speed */
2696         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_50GB \
2697                                                         UINT32_C(0x400)
2698         /* 100Gb link speed */
2699         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100GB \
2700                                                         UINT32_C(0x800)
2701         /* 10Mb link speed (Half-duplex) */
2702         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10MBHD \
2703                                                         UINT32_C(0x1000)
2704         /* 10Mb link speed (Full-duplex) */
2705         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10MB \
2706                                                         UINT32_C(0x2000)
2707         uint16_t auto_link_speed_mask;
2708
2709         /* This value controls the wirespeed feature. */
2710                 /* Wirespeed feature is disabled. */
2711         #define HWRM_PORT_PHY_CFG_INPUT_WIRESPEED_OFF   (UINT32_C(0x0) << 0)
2712                 /* Wirespeed feature is enabled. */
2713         #define HWRM_PORT_PHY_CFG_INPUT_WIRESPEED_ON    (UINT32_C(0x1) << 0)
2714         uint8_t wirespeed;
2715
2716         /* This value controls the loopback setting for the PHY. */
2717                 /* No loopback is selected. Normal operation. */
2718         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_NONE       (UINT32_C(0x0) << 0)
2719                 /*
2720                  * The HW will be configured with local loopback such that host
2721                  * data is sent back to the host without modification.
2722                  */
2723         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_LOCAL      (UINT32_C(0x1) << 0)
2724                 /*
2725                  * The HW will be configured with remote loopback such that port
2726                  * logic will send packets back out the transmitter that are
2727                  * received.
2728                  */
2729         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_REMOTE     (UINT32_C(0x2) << 0)
2730         uint8_t lpbk;
2731
2732         /*
2733          * This value is used to configure the pause that will be used for force
2734          * mode.
2735          */
2736         /*
2737          * When this bit is '1', Generation of tx pause messages is supported.
2738          * Disabled otherwise.
2739          */
2740         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_TX             UINT32_C(0x1)
2741         /*
2742          * When this bit is '1', Reception of rx pause messages is supported.
2743          * Disabled otherwise.
2744          */
2745         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_RX             UINT32_C(0x2)
2746         uint8_t force_pause;
2747
2748         uint8_t unused_1;
2749
2750         /*
2751          * This value controls the pre-emphasis to be used for the link. Driver
2752          * should not set this value (use enable.preemphasis = 0) unless driver
2753          * is sure of setting. Normally HWRM FW will determine proper pre-
2754          * emphasis.
2755          */
2756         uint32_t preemphasis;
2757
2758         /*
2759          * Setting for link speed mask that is used to advertise speeds during
2760          * autonegotiation when EEE is enabled. This field is valid only when
2761          * EEE is enabled. The speeds specified in this field shall be a subset
2762          * of speeds specified in auto_link_speed_mask. If EEE is enabled,then
2763          * at least one speed shall be provided in this mask.
2764          */
2765         /* Reserved */
2766         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD1  UINT32_C(0x1)
2767         /* 100Mb link speed (Full-duplex) */
2768         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_100MB  UINT32_C(0x2)
2769         /* Reserved */
2770         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD2  UINT32_C(0x4)
2771         /* 1Gb link speed (Full-duplex) */
2772         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_1GB    UINT32_C(0x8)
2773         /* Reserved */
2774         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD3 \
2775                                                                 UINT32_C(0x10)
2776         /* Reserved */
2777         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD4 \
2778                                                                 UINT32_C(0x20)
2779         /* 10Gb link speed */
2780         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_10GB \
2781                                                                 UINT32_C(0x40)
2782         uint16_t eee_link_speed_mask;
2783
2784         uint8_t unused_2;
2785         uint8_t unused_3;
2786
2787         /*
2788          * Reuested setting of TX LPI timer in microseconds. This field is valid
2789          * only when EEE is enabled and TX LPI is enabled.
2790          */
2791         #define HWRM_PORT_PHY_CFG_INPUT_TX_LPI_TIMER_MASK \
2792                                                         UINT32_C(0xffffff)
2793         #define HWRM_PORT_PHY_CFG_INPUT_TX_LPI_TIMER_SFT           0
2794         uint32_t tx_lpi_timer;
2795
2796         uint32_t unused_4;
2797 } __attribute__((packed));
2798
2799 /* Output (16 bytes) */
2800 struct hwrm_port_phy_cfg_output {
2801         /*
2802          * Pass/Fail or error type Note: receiver to verify the in parameters,
2803          * and fail the call with an error when appropriate
2804          */
2805         uint16_t error_code;
2806
2807         /* This field returns the type of original request. */
2808         uint16_t req_type;
2809
2810         /* This field provides original sequence number of the command. */
2811         uint16_t seq_id;
2812
2813         /*
2814          * This field is the length of the response in bytes. The last byte of
2815          * the response is a valid flag that will read as '1' when the command
2816          * has been completely written to memory.
2817          */
2818         uint16_t resp_len;
2819
2820         uint32_t unused_0;
2821         uint8_t unused_1;
2822         uint8_t unused_2;
2823         uint8_t unused_3;
2824
2825         /*
2826          * This field is used in Output records to indicate that the output is
2827          * completely written to RAM. This field should be read as '1' to
2828          * indicate that the output has been completely written. When writing a
2829          * command completion or response to an internal processor, the order of
2830          * writes has to be such that this field is written last.
2831          */
2832         uint8_t valid;
2833 } __attribute__((packed));
2834
2835 /* hwrm_port_phy_qcfg */
2836 /* Description: This command queries the PHY configuration for the port. */
2837 /* Input (24 bytes) */
2838
2839 struct hwrm_port_phy_qcfg_input {
2840         /*
2841          * This value indicates what type of request this is. The format for the
2842          * rest of the command is determined by this field.
2843          */
2844         uint16_t req_type;
2845
2846         /*
2847          * This value indicates the what completion ring the request will be
2848          * optionally completed on. If the value is -1, then no CR completion
2849          * will be generated. Any other value must be a valid CR ring_id value
2850          * for this function.
2851          */
2852         uint16_t cmpl_ring;
2853
2854         /* This value indicates the command sequence number. */
2855         uint16_t seq_id;
2856
2857         /*
2858          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
2859          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
2860          */
2861         uint16_t target_id;
2862
2863         /*
2864          * This is the host address where the response will be written when the
2865          * request is complete. This area must be 16B aligned and must be
2866          * cleared to zero before the request is made.
2867          */
2868         uint64_t resp_addr;
2869
2870         /* Port ID of port that is to be queried. */
2871         uint16_t port_id;
2872
2873         uint16_t unused_0[3];
2874 } __attribute__((packed));
2875
2876 /* Output (96 bytes) */
2877 struct hwrm_port_phy_qcfg_output {
2878         /*
2879          * Pass/Fail or error type Note: receiver to verify the in parameters,
2880          * and fail the call with an error when appropriate
2881          */
2882         uint16_t error_code;
2883
2884         /* This field returns the type of original request. */
2885         uint16_t req_type;
2886
2887         /* This field provides original sequence number of the command. */
2888         uint16_t seq_id;
2889
2890         /*
2891          * This field is the length of the response in bytes. The last byte of
2892          * the response is a valid flag that will read as '1' when the command
2893          * has been completely written to memory.
2894          */
2895         uint16_t resp_len;
2896
2897         /* This value indicates the current link status. */
2898                 /* There is no link or cable detected. */
2899         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_NO_LINK  (UINT32_C(0x0) << 0)
2900                 /* There is no link, but a cable has been detected. */
2901         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SIGNAL   (UINT32_C(0x1) << 0)
2902                 /* There is a link. */
2903         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK     (UINT32_C(0x2) << 0)
2904         uint8_t link;
2905
2906         uint8_t unused_0;
2907
2908         /* This value indicates the current link speed of the connection. */
2909                 /* 100Mb link speed */
2910         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100MB \
2911                                                         (UINT32_C(0x1) << 0)
2912                 /* 1Gb link speed */
2913         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_1GB \
2914                                                         (UINT32_C(0xa) << 0)
2915                 /* 2Gb link speed */
2916         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_2GB \
2917                                                         (UINT32_C(0x14) << 0)
2918                 /* 2.5Gb link speed */
2919         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_2_5GB \
2920                                                         (UINT32_C(0x19) << 0)
2921                 /* 10Gb link speed */
2922         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_10GB \
2923                                                         (UINT32_C(0x64) << 0)
2924                 /* 20Mb link speed */
2925         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_20GB \
2926                                                         (UINT32_C(0xc8) << 0)
2927                 /* 25Gb link speed */
2928         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_25GB \
2929                                                         (UINT32_C(0xfa) << 0)
2930                 /* 40Gb link speed */
2931         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_40GB \
2932                                                         (UINT32_C(0x190) << 0)
2933                 /* 50Gb link speed */
2934         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_50GB \
2935                                                         (UINT32_C(0x1f4) << 0)
2936                 /* 100Gb link speed */
2937         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100GB \
2938                                                         (UINT32_C(0x3e8) << 0)
2939                 /* 10Mb link speed */
2940         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_10MB \
2941                                                         (UINT32_C(0xffff) << 0)
2942         uint16_t link_speed;
2943
2944         /* This value is indicates the duplex of the current connection. */
2945                 /* Half Duplex connection. */
2946         #define HWRM_PORT_PHY_QCFG_OUTPUT_DUPLEX_HALF   (UINT32_C(0x0) << 0)
2947                 /* Full duplex connection. */
2948         #define HWRM_PORT_PHY_QCFG_OUTPUT_DUPLEX_FULL   (UINT32_C(0x1) << 0)
2949         uint8_t duplex;
2950
2951         /*
2952          * This value is used to indicate the current pause configuration. When
2953          * autoneg is enabled, this value represents the autoneg results of
2954          * pause configuration.
2955          */
2956         /*
2957          * When this bit is '1', Generation of tx pause messages is supported.
2958          * Disabled otherwise.
2959          */
2960         #define HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX      UINT32_C(0x1)
2961         /*
2962          * When this bit is '1', Reception of rx pause messages is supported.
2963          * Disabled otherwise.
2964          */
2965         #define HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX      UINT32_C(0x2)
2966         uint8_t pause;
2967
2968         /*
2969          * The supported speeds for the port. This is a bit mask. For each speed
2970          * that is supported, the corrresponding bit will be set to '1'.
2971          */
2972         /* 100Mb link speed (Half-duplex) */
2973         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100MBHD \
2974                                                         UINT32_C(0x1)
2975         /* 100Mb link speed (Full-duplex) */
2976         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100MB \
2977                                                         UINT32_C(0x2)
2978         /* 1Gb link speed (Half-duplex) */
2979         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_1GBHD \
2980                                                         UINT32_C(0x4)
2981         /* 1Gb link speed (Full-duplex) */
2982         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_1GB \
2983                                                         UINT32_C(0x8)
2984         /* 2Gb link speed */
2985         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_2GB \
2986                                                         UINT32_C(0x10)
2987         /* 2.5Gb link speed */
2988         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_2_5GB \
2989                                                         UINT32_C(0x20)
2990         /* 10Gb link speed */
2991         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10GB \
2992                                                         UINT32_C(0x40)
2993         /* 20Gb link speed */
2994         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_20GB \
2995                                                         UINT32_C(0x80)
2996         /* 25Gb link speed */
2997         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_25GB \
2998                                                         UINT32_C(0x100)
2999         /* 40Gb link speed */
3000         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_40GB \
3001                                                         UINT32_C(0x200)
3002         /* 50Gb link speed */
3003         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_50GB \
3004                                                         UINT32_C(0x400)
3005         /* 100Gb link speed */
3006         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100GB \
3007                                                         UINT32_C(0x800)
3008         /* 10Mb link speed (Half-duplex) */
3009         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10MBHD \
3010                                                         UINT32_C(0x1000)
3011         /* 10Mb link speed (Full-duplex) */
3012         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10MB \
3013                                                         UINT32_C(0x2000)
3014         uint16_t support_speeds;
3015
3016         /*
3017          * Current setting of forced link speed. When the link speed is not
3018          * being forced, this value shall be set to 0.
3019          */
3020                 /* 100Mb link speed */
3021         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_100MB \
3022                                                         (UINT32_C(0x1) << 0)
3023                 /* 1Gb link speed */
3024         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_1GB \
3025                                                         (UINT32_C(0xa) << 0)
3026                 /* 2Gb link speed */
3027         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_2GB \
3028                                                         (UINT32_C(0x14) << 0)
3029                 /* 2.5Gb link speed */
3030         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_2_5GB \
3031                                                         (UINT32_C(0x19) << 0)
3032                 /* 10Gb link speed */
3033         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_10GB \
3034                                                         (UINT32_C(0x64) << 0)
3035                 /* 20Mb link speed */
3036         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_20GB \
3037                                                         (UINT32_C(0xc8) << 0)
3038                 /* 25Gb link speed */
3039         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_25GB \
3040                                                         (UINT32_C(0xfa) << 0)
3041                 /* 40Gb link speed */
3042         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_40GB \
3043                                                         (UINT32_C(0x190) << 0)
3044                 /* 50Gb link speed */
3045         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_50GB \
3046                                                         (UINT32_C(0x1f4) << 0)
3047                 /* 100Gb link speed */
3048         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_100GB \
3049                                                         (UINT32_C(0x3e8) << 0)
3050                 /* 10Mb link speed */
3051         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_10MB \
3052                                                         (UINT32_C(0xffff) << 0)
3053         uint16_t force_link_speed;
3054
3055         /* Current setting of auto negotiation mode. */
3056                 /*
3057                  * Disable autoneg or autoneg disabled. No speeds are selected.
3058                  */
3059         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE \
3060                                                         (UINT32_C(0x0) << 0)
3061                 /* Select all possible speeds for autoneg mode. */
3062         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_ALL_SPEEDS \
3063                                                         (UINT32_C(0x1) << 0)
3064                 /*
3065                  * Select only the auto_link_speed speed for autoneg mode. This
3066                  * mode has been DEPRECATED. An HWRM client should not use this
3067                  * mode.
3068                  */
3069         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_ONE_SPEED \
3070                                                         (UINT32_C(0x2) << 0)
3071                 /*
3072                  * Select the auto_link_speed or any speed below that speed for
3073                  * autoneg. This mode has been DEPRECATED. An HWRM client should
3074                  * not use this mode.
3075                  */
3076         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_ONE_OR_BELOW \
3077                                                         (UINT32_C(0x3) << 0)
3078                 /*
3079                  * Select the speeds based on the corresponding link speed mask
3080                  * value that is provided.
3081                  */
3082         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_SPEED_MASK \
3083                                                         (UINT32_C(0x4) << 0)
3084         uint8_t auto_mode;
3085
3086         /*
3087          * Current setting of pause autonegotiation. Move autoneg_pause flag
3088          * here.
3089          */
3090         /*
3091          * When this bit is '1', Generation of tx pause messages has been
3092          * requested. Disabled otherwise.
3093          */
3094         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_TX UINT32_C(0x1)
3095         /*
3096          * When this bit is '1', Reception of rx pause messages has been
3097          * requested. Disabled otherwise.
3098          */
3099         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_RX UINT32_C(0x2)
3100         /*
3101          * When set to 1, the advertisement of pause is enabled. # When the
3102          * auto_mode is not set to none and this flag is set to 1, then the
3103          * auto_pause bits on this port are being advertised and autoneg pause
3104          * results are being interpreted. # When the auto_mode is not set to
3105          * none and this flag is set to 0, the pause is forced as indicated in
3106          * force_pause, and also advertised as auto_pause bits, but the autoneg
3107          * results are not interpreted since the pause configuration is being
3108          * forced. # When the auto_mode is set to none and this flag is set to
3109          * 1, auto_pause bits should be ignored and should be set to 0.
3110          */
3111         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_AUTONEG_PAUSE \
3112                                                         UINT32_C(0x4)
3113         uint8_t auto_pause;
3114
3115         /*
3116          * Current setting for auto_link_speed. This field is only valid when
3117          * auto_mode is set to "one_speed" or "one_or_below".
3118          */
3119                 /* 100Mb link speed */
3120         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_100MB \
3121                                                         (UINT32_C(0x1) << 0)
3122                 /* 1Gb link speed */
3123         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_1GB \
3124                                                         (UINT32_C(0xa) << 0)
3125                 /* 2Gb link speed */
3126         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_2GB \
3127                                                         (UINT32_C(0x14) << 0)
3128                 /* 2.5Gb link speed */
3129         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_2_5GB \
3130                                                         (UINT32_C(0x19) << 0)
3131                 /* 10Gb link speed */
3132         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_10GB \
3133                                                         (UINT32_C(0x64) << 0)
3134                 /* 20Mb link speed */
3135         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_20GB \
3136                                                         (UINT32_C(0xc8) << 0)
3137                 /* 25Gb link speed */
3138         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_25GB \
3139                                                         (UINT32_C(0xfa) << 0)
3140                 /* 40Gb link speed */
3141         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_40GB \
3142                                                         (UINT32_C(0x190) << 0)
3143                 /* 50Gb link speed */
3144         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_50GB \
3145                                                         (UINT32_C(0x1f4) << 0)
3146                 /* 100Gb link speed */
3147         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_100GB \
3148                                                         (UINT32_C(0x3e8) << 0)
3149                 /* 10Mb link speed */
3150         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_10MB \
3151                                                         (UINT32_C(0xffff) << 0)
3152         uint16_t auto_link_speed;
3153
3154         /*
3155          * Current setting for auto_link_speed_mask that is used to advertise
3156          * speeds during autonegotiation. This field is only valid when
3157          * auto_mode is set to "mask". The speeds specified in this field shall
3158          * be a subset of supported speeds on this port.
3159          */
3160         /* 100Mb link speed (Half-duplex) */
3161         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_100MBHD \
3162                                                         UINT32_C(0x1)
3163         /* 100Mb link speed (Full-duplex) */
3164         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_100MB \
3165                                                         UINT32_C(0x2)
3166         /* 1Gb link speed (Half-duplex) */
3167         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_1GBHD \
3168                                                         UINT32_C(0x4)
3169         /* 1Gb link speed (Full-duplex) */
3170         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_1GB \
3171                                                         UINT32_C(0x8)
3172         /* 2Gb link speed */
3173         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_2GB \
3174                                                         UINT32_C(0x10)
3175         /* 2.5Gb link speed */
3176         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_2_5GB \
3177                                                         UINT32_C(0x20)
3178         /* 10Gb link speed */
3179         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_10GB \
3180                                                         UINT32_C(0x40)
3181         /* 20Gb link speed */
3182         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_20GB \
3183                                                         UINT32_C(0x80)
3184         /* 25Gb link speed */
3185         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_25GB \
3186                                                         UINT32_C(0x100)
3187         /* 40Gb link speed */
3188         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_40GB \
3189                                                         UINT32_C(0x200)
3190         /* 50Gb link speed */
3191         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_50GB \
3192                                                         UINT32_C(0x400)
3193         /* 100Gb link speed */
3194         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_100GB \
3195                                                         UINT32_C(0x800)
3196         /* 10Mb link speed (Half-duplex) */
3197         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_10MBHD \
3198                                                         UINT32_C(0x1000)
3199         /* 10Mb link speed (Full-duplex) */
3200         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_10MB \
3201                                                         UINT32_C(0x2000)
3202         uint16_t auto_link_speed_mask;
3203
3204         /* Current setting for wirespeed. */
3205                 /* Wirespeed feature is disabled. */
3206         #define HWRM_PORT_PHY_QCFG_OUTPUT_WIRESPEED_OFF (UINT32_C(0x0) << 0)
3207                 /* Wirespeed feature is enabled. */
3208         #define HWRM_PORT_PHY_QCFG_OUTPUT_WIRESPEED_ON  (UINT32_C(0x1) << 0)
3209         uint8_t wirespeed;
3210
3211         /* Current setting for loopback. */
3212                 /* No loopback is selected. Normal operation. */
3213         #define HWRM_PORT_PHY_QCFG_OUTPUT_LPBK_NONE     (UINT32_C(0x0) << 0)
3214                 /*
3215                  * The HW will be configured with local loopback such that host
3216                  * data is sent back to the host without modification.
3217                  */
3218         #define HWRM_PORT_PHY_QCFG_OUTPUT_LPBK_LOCAL    (UINT32_C(0x1) << 0)
3219                 /*
3220                  * The HW will be configured with remote loopback such that port
3221                  * logic will send packets back out the transmitter that are
3222                  * received.
3223                  */
3224         #define HWRM_PORT_PHY_QCFG_OUTPUT_LPBK_REMOTE   (UINT32_C(0x2) << 0)
3225         uint8_t lpbk;
3226
3227         /*
3228          * Current setting of forced pause. When the pause configuration is not
3229          * being forced, then this value shall be set to 0.
3230          */
3231         /*
3232          * When this bit is '1', Generation of tx pause messages is supported.
3233          * Disabled otherwise.
3234          */
3235         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_PAUSE_TX \
3236                                                         UINT32_C(0x1)
3237         /*
3238          * When this bit is '1', Reception of rx pause messages is supported.
3239          * Disabled otherwise.
3240          */
3241         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_PAUSE_RX \
3242                                                         UINT32_C(0x2)
3243         uint8_t force_pause;
3244
3245         /*
3246          * This value indicates the current status of the optics module on this
3247          * port.
3248          */
3249                 /* Module is inserted and accepted */
3250         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_NONE \
3251                                                         (UINT32_C(0x0) << 0)
3252                 /* Module is rejected and transmit side Laser is disabled. */
3253         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_DISABLETX \
3254                                                         (UINT32_C(0x1) << 0)
3255                 /* Module mismatch warning. */
3256         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_WARNINGMSG \
3257                                                         (UINT32_C(0x2) << 0)
3258                 /* Module is rejected and powered down. */
3259         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_PWRDOWN \
3260                                                         (UINT32_C(0x3) << 0)
3261                 /* Module is not inserted. */
3262         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_NOTINSERTED \
3263                                                         (UINT32_C(0x4) << 0)
3264                 /* Module status is not applicable. */
3265         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_NOTAPPLICABLE \
3266                                                         (UINT32_C(0xff) << 0)
3267         uint8_t module_status;
3268
3269         /* Current setting for preemphasis. */
3270         uint32_t preemphasis;
3271
3272         /* This field represents the major version of the PHY. */
3273         uint8_t phy_maj;
3274
3275         /* This field represents the minor version of the PHY. */
3276         uint8_t phy_min;
3277
3278         /* This field represents the build version of the PHY. */
3279         uint8_t phy_bld;
3280
3281         /* This value represents a PHY type. */
3282                 /* Unknown */
3283         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_UNKNOWN \
3284                                                         (UINT32_C(0x0) << 0)
3285                 /* BASE-CR */
3286         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASECR \
3287                                                         (UINT32_C(0x1) << 0)
3288                 /* BASE-KR4 (Deprecated) */
3289         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR4 \
3290                                                         (UINT32_C(0x2) << 0)
3291                 /* BASE-LR */
3292         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASELR \
3293                                                         (UINT32_C(0x3) << 0)
3294                 /* BASE-SR */
3295         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASESR \
3296                                                         (UINT32_C(0x4) << 0)
3297                 /* BASE-KR2 (Deprecated) */
3298         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR2 \
3299                                                         (UINT32_C(0x5) << 0)
3300                 /* BASE-KX */
3301         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKX \
3302                                                         (UINT32_C(0x6) << 0)
3303                 /* BASE-KR */
3304         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR \
3305                                                         (UINT32_C(0x7) << 0)
3306                 /* BASE-T */
3307         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASET \
3308                                                         (UINT32_C(0x8) << 0)
3309                 /* EEE capable BASE-T */
3310         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASETE \
3311                                                         (UINT32_C(0x9) << 0)
3312                 /* SGMII connected external PHY */
3313         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_SGMIIEXTPHY \
3314                                                         (UINT32_C(0xa) << 0)
3315         uint8_t phy_type;
3316
3317         /* This value represents a media type. */
3318                 /* Unknown */
3319         #define HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_UNKNOWN \
3320                                                         (UINT32_C(0x0) << 0)
3321                 /* Twisted Pair */
3322         #define HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_TP (UINT32_C(0x1) << 0)
3323                 /* Direct Attached Copper */
3324         #define HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_DAC \
3325                                                         (UINT32_C(0x2) << 0)
3326                 /* Fiber */
3327         #define HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_FIBRE \
3328                                                         (UINT32_C(0x3) << 0)
3329         uint8_t media_type;
3330
3331         /* This value represents a transceiver type. */
3332                 /* PHY and MAC are in the same package */
3333         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_PKG_TYPE_XCVR_INTERNAL \
3334                                                         (UINT32_C(0x1) << 0)
3335                 /* PHY and MAC are in different packages */
3336         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_PKG_TYPE_XCVR_EXTERNAL \
3337                                                         (UINT32_C(0x2) << 0)
3338         uint8_t xcvr_pkg_type;
3339
3340         /*
3341          * This field represents flags related to EEE configuration. These EEE
3342          * configuration flags are valid only when the auto_mode is not set to
3343          * none (in other words autonegotiation is enabled).
3344          */
3345         /* This field represents PHY address. */
3346         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_ADDR_MASK UINT32_C(0x1f)
3347         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_ADDR_SFT  0
3348         /*
3349          * When set to 1, Energy Efficient Ethernet (EEE) mode is enabled.
3350          * Speeds for autoneg with EEE mode enabled are based on
3351          * eee_link_speed_mask.
3352          */
3353         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_EEE_ENABLED \
3354                                                         UINT32_C(0x20)
3355         /*
3356          * This flag is valid only when eee_enabled is set to 1. # If
3357          * eee_enabled is set to 0, then EEE mode is disabled and this flag
3358          * shall be ignored. # If eee_enabled is set to 1 and this flag is set
3359          * to 1, then Energy Efficient Ethernet (EEE) mode is enabled and in
3360          * use. # If eee_enabled is set to 1 and this flag is set to 0, then
3361          * Energy Efficient Ethernet (EEE) mode is enabled but is currently not
3362          * in use.
3363          */
3364         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_EEE_ACTIVE \
3365                                                         UINT32_C(0x40)
3366         /*
3367          * This flag is valid only when eee_enabled is set to 1. # If
3368          * eee_enabled is set to 0, then EEE mode is disabled and this flag
3369          * shall be ignored. # If eee_enabled is set to 1 and this flag is set
3370          * to 1, then Energy Efficient Ethernet (EEE) mode is enabled and TX LPI
3371          * is enabled. # If eee_enabled is set to 1 and this flag is set to 0,
3372          * then Energy Efficient Ethernet (EEE) mode is enabled but TX LPI is
3373          * disabled.
3374          */
3375         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_EEE_TX_LPI \
3376                                                         UINT32_C(0x80)
3377         /*
3378          * This field represents flags related to EEE configuration. These EEE
3379          * configuration flags are valid only when the auto_mode is not set to
3380          * none (in other words autonegotiation is enabled).
3381          */
3382         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_MASK \
3383                                                         UINT32_C(0xe0)
3384         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_SFT        5
3385         uint8_t eee_config_phy_addr;
3386
3387         /* Reserved field, set to 0 */
3388         /*
3389          * When set to 1, the parallel detection is used to determine the speed
3390          * of the link partner. Parallel detection is used when a
3391          * autonegotiation capable device is connected to a link parter that is
3392          * not capable of autonegotiation.
3393          */
3394         #define HWRM_PORT_PHY_QCFG_OUTPUT_PARALLEL_DETECT \
3395                                                         UINT32_C(0x1)
3396         /* Reserved field, set to 0 */
3397         #define HWRM_PORT_PHY_QCFG_OUTPUT_RESERVED_MASK UINT32_C(0xfe)
3398         #define HWRM_PORT_PHY_QCFG_OUTPUT_RESERVED_SFT  1
3399         uint8_t parallel_detect;
3400
3401         /*
3402          * The advertised speeds for the port by the link partner. Each
3403          * advertised speed will be set to '1'.
3404          */
3405         /* 100Mb link speed (Half-duplex) */
3406         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_100MBHD \
3407                                                         UINT32_C(0x1)
3408         /* 100Mb link speed (Full-duplex) */
3409         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_100MB \
3410                                                         UINT32_C(0x2)
3411         /* 1Gb link speed (Half-duplex) */
3412         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_1GBHD \
3413                                                         UINT32_C(0x4)
3414         /* 1Gb link speed (Full-duplex) */
3415         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_1GB \
3416                                                         UINT32_C(0x8)
3417         /* 2Gb link speed */
3418         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_2GB \
3419                                                         UINT32_C(0x10)
3420         /* 2.5Gb link speed */
3421         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_2_5GB \
3422                                                         UINT32_C(0x20)
3423         /* 10Gb link speed */
3424         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_10GB \
3425                                                         UINT32_C(0x40)
3426         /* 20Gb link speed */
3427         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_20GB \
3428                                                         UINT32_C(0x80)
3429         /* 25Gb link speed */
3430         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_25GB \
3431                                                         UINT32_C(0x100)
3432         /* 40Gb link speed */
3433         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_40GB \
3434                                                         UINT32_C(0x200)
3435         /* 50Gb link speed */
3436         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_50GB \
3437                                                         UINT32_C(0x400)
3438         /* 100Gb link speed */
3439         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_100GB \
3440                                                         UINT32_C(0x800)
3441         /* 10Mb link speed (Half-duplex) */
3442         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_10MBHD \
3443                                                         UINT32_C(0x1000)
3444         /* 10Mb link speed (Full-duplex) */
3445         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_10MB \
3446                                                         UINT32_C(0x2000)
3447         uint16_t link_partner_adv_speeds;
3448
3449         /*
3450          * The advertised autoneg for the port by the link partner. This field
3451          * is deprecated and should be set to 0.
3452          */
3453                 /*
3454                  * Disable autoneg or autoneg disabled. No speeds are selected.
3455                  */
3456         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_NONE \
3457                                                         (UINT32_C(0x0) << 0)
3458                 /* Select all possible speeds for autoneg mode. */
3459         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_ALL_SPEEDS\
3460                                                         (UINT32_C(0x1) << 0)
3461                 /*
3462                  * Select only the auto_link_speed speed for autoneg mode. This
3463                  * mode has been DEPRECATED. An HWRM client should not use this
3464                  * mode.
3465                  */
3466         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_ONE_SPEED \
3467                                                         (UINT32_C(0x2) << 0)
3468                 /*
3469                  * Select the auto_link_speed or any speed below that speed for
3470                  * autoneg. This mode has been DEPRECATED. An HWRM client should
3471                  * not use this mode.
3472                  */
3473         #define \
3474         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_ONE_OR_BELOW \
3475                                                         (UINT32_C(0x3) << 0)
3476                 /*
3477                  * Select the speeds based on the corresponding link speed mask
3478                  * value that is provided.
3479                  */
3480         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_SPEED_MASK\
3481                                                         (UINT32_C(0x4) << 0)
3482         uint8_t link_partner_adv_auto_mode;
3483
3484         /* The advertised pause settings on the port by the link partner. */
3485         /*
3486          * When this bit is '1', Generation of tx pause messages is supported.
3487          * Disabled otherwise.
3488          */
3489         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_PAUSE_TX \
3490                                                         UINT32_C(0x1)
3491         /*
3492          * When this bit is '1', Reception of rx pause messages is supported.
3493          * Disabled otherwise.
3494          */
3495         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_PAUSE_RX \
3496                                                         UINT32_C(0x2)
3497         uint8_t link_partner_adv_pause;
3498
3499         /*
3500          * Current setting for link speed mask that is used to advertise speeds
3501          * during autonegotiation when EEE is enabled. This field is valid only
3502          * when eee_enabled flags is set to 1. The speeds specified in this
3503          * field shall be a subset of speeds specified in auto_link_speed_mask.
3504          */
3505         /* Reserved */
3506         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_RSVD1 \
3507                                                         UINT32_C(0x1)
3508         /* 100Mb link speed (Full-duplex) */
3509         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_100MB \
3510                                                         UINT32_C(0x2)
3511         /* Reserved */
3512         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_RSVD2 \
3513                                                         UINT32_C(0x4)
3514         /* 1Gb link speed (Full-duplex) */
3515         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_1GB \
3516                                                         UINT32_C(0x8)
3517         /* Reserved */
3518         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_RSVD3 \
3519                                                         UINT32_C(0x10)
3520         /* Reserved */
3521         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_RSVD4 \
3522                                                         UINT32_C(0x20)
3523         /* 10Gb link speed */
3524         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_10GB \
3525                                                         UINT32_C(0x40)
3526         uint16_t adv_eee_link_speed_mask;
3527
3528         /*
3529          * Current setting for link speed mask that is advertised by the link
3530          * partner when EEE is enabled. This field is valid only when
3531          * eee_enabled flags is set to 1.
3532          */
3533         /* Reserved */
3534         #define \
3535         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_RSVD1 \
3536                                                         UINT32_C(0x1)
3537         /* 100Mb link speed (Full-duplex) */
3538         #define \
3539         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_100MB \
3540                                                         UINT32_C(0x2)
3541         /* Reserved */
3542         #define \
3543         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_RSVD2 \
3544                                                         UINT32_C(0x4)
3545         /* 1Gb link speed (Full-duplex) */
3546         #define \
3547         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_1GB \
3548                                                         UINT32_C(0x8)
3549         /* Reserved */
3550         #define \
3551         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_RSVD3 \
3552                                                         UINT32_C(0x10)
3553         /* Reserved */
3554         #define \
3555         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_RSVD4 \
3556                                                         UINT32_C(0x20)
3557         /* 10Gb link speed */
3558         #define \
3559         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_10GB \
3560                                                         UINT32_C(0x40)
3561         uint16_t link_partner_adv_eee_link_speed_mask;
3562
3563         /* This value represents transceiver identifier type. */
3564         /*
3565          * Current setting of TX LPI timer in microseconds. This field is valid
3566          * only when_eee_enabled flag is set to 1 and tx_lpi_enabled is set to
3567          * 1.
3568          */
3569         #define HWRM_PORT_PHY_QCFG_OUTPUT_TX_LPI_TIMER_MASK \
3570                                                         UINT32_C(0xffffff)
3571         #define HWRM_PORT_PHY_QCFG_OUTPUT_TX_LPI_TIMER_SFT         0
3572         /* This value represents transceiver identifier type. */
3573         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_MASK \
3574                                                         UINT32_C(0xff000000)
3575         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_SFT \
3576                                                         24
3577                 /* Unknown */
3578         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_UNKNOWN \
3579                                                         (UINT32_C(0x0) << 24)
3580                 /* SFP/SFP+/SFP28 */
3581         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_SFP \
3582                                                         (UINT32_C(0x3) << 24)
3583                 /* QSFP */
3584         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFP \
3585                                                         (UINT32_C(0xc) << 24)
3586                 /* QSFP+ */
3587         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFPPLUS \
3588                                                         (UINT32_C(0xd) << 24)
3589                 /* QSFP28 */
3590         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFP28 \
3591                                                         (UINT32_C(0x11) << 24)
3592         uint32_t xcvr_identifier_type_tx_lpi_timer;
3593
3594         uint32_t unused_1;
3595
3596         /*
3597          * Up to 16 bytes of null padded ASCII string representing PHY vendor.
3598          * If the string is set to null, then the vendor name is not available.
3599          */
3600         char phy_vendor_name[16];
3601
3602         /*
3603          * Up to 16 bytes of null padded ASCII string that identifies vendor
3604          * specific part number of the PHY. If the string is set to null, then
3605          * the vendor specific part number is not available.
3606          */
3607         char phy_vendor_partnumber[16];
3608
3609         uint32_t unused_2;
3610         uint8_t unused_3;
3611         uint8_t unused_4;
3612         uint8_t unused_5;
3613
3614         /*
3615          * This field is used in Output records to indicate that the output is
3616          * completely written to RAM. This field should be read as '1' to
3617          * indicate that the output has been completely written. When writing a
3618          * command completion or response to an internal processor, the order of
3619          * writes has to be such that this field is written last.
3620          */
3621         uint8_t valid;
3622 } __attribute__((packed));
3623
3624 /* hwrm_ver_get */
3625 /*
3626  * Description: This function is called by a driver to determine the HWRM
3627  * interface version supported by the HWRM firmware, the version of HWRM
3628  * firmware implementation, the name of HWRM firmware, the versions of other
3629  * embedded firmwares, and the names of other embedded firmwares, etc. Any
3630  * interface or firmware version with major = 0, minor = 0, and update = 0 shall
3631  * be considered an invalid version.
3632  */
3633
3634 /* Input (24 bytes) */
3635 struct hwrm_ver_get_input {
3636         /*
3637          * This value indicates what type of request this is. The format for the
3638          * rest of the command is determined by this field.
3639          */
3640         uint16_t req_type;
3641
3642         /*
3643          * This value indicates the what completion ring the request will be
3644          * optionally completed on. If the value is -1, then no CR completion
3645          * will be generated. Any other value must be a valid CR ring_id value
3646          * for this function.
3647          */
3648         uint16_t cmpl_ring;
3649
3650         /* This value indicates the command sequence number. */
3651         uint16_t seq_id;
3652
3653         /*
3654          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
3655          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
3656          */
3657         uint16_t target_id;
3658
3659         /*
3660          * This is the host address where the response will be written when the
3661          * request is complete. This area must be 16B aligned and must be
3662          * cleared to zero before the request is made.
3663          */
3664         uint64_t resp_addr;
3665
3666         /*
3667          * This field represents the major version of HWRM interface
3668          * specification supported by the driver HWRM implementation. The
3669          * interface major version is intended to change only when non backward
3670          * compatible changes are made to the HWRM interface specification.
3671          */
3672         uint8_t hwrm_intf_maj;
3673
3674         /*
3675          * This field represents the minor version of HWRM interface
3676          * specification supported by the driver HWRM implementation. A change
3677          * in interface minor version is used to reflect significant backward
3678          * compatible modification to HWRM interface specification. This can be
3679          * due to addition or removal of functionality. HWRM interface
3680          * specifications with the same major version but different minor
3681          * versions are compatible.
3682          */
3683         uint8_t hwrm_intf_min;
3684
3685         /*
3686          * This field represents the update version of HWRM interface
3687          * specification supported by the driver HWRM implementation. The
3688          * interface update version is used to reflect minor changes or bug
3689          * fixes to a released HWRM interface specification.
3690          */
3691         uint8_t hwrm_intf_upd;
3692
3693         uint8_t unused_0[5];
3694 } __attribute__((packed));
3695
3696 /* Output (128 bytes) */
3697 struct hwrm_ver_get_output {
3698         /*
3699          * Pass/Fail or error type Note: receiver to verify the in parameters,
3700          * and fail the call with an error when appropriate
3701          */
3702         uint16_t error_code;
3703
3704         /* This field returns the type of original request. */
3705         uint16_t req_type;
3706
3707         /* This field provides original sequence number of the command. */
3708         uint16_t seq_id;
3709
3710         /*
3711          * This field is the length of the response in bytes. The last byte of
3712          * the response is a valid flag that will read as '1' when the command
3713          * has been completely written to memory.
3714          */
3715         uint16_t resp_len;
3716
3717         /*
3718          * This field represents the major version of HWRM interface
3719          * specification supported by the HWRM implementation. The interface
3720          * major version is intended to change only when non backward compatible
3721          * changes are made to the HWRM interface specification. A HWRM
3722          * implementation that is compliant with this specification shall
3723          * provide value of 1 in this field.
3724          */
3725         uint8_t hwrm_intf_maj;
3726
3727         /*
3728          * This field represents the minor version of HWRM interface
3729          * specification supported by the HWRM implementation. A change in
3730          * interface minor version is used to reflect significant backward
3731          * compatible modification to HWRM interface specification. This can be
3732          * due to addition or removal of functionality. HWRM interface
3733          * specifications with the same major version but different minor
3734          * versions are compatible. A HWRM implementation that is compliant with
3735          * this specification shall provide value of 0 in this field.
3736          */
3737         uint8_t hwrm_intf_min;
3738
3739         /*
3740          * This field represents the update version of HWRM interface
3741          * specification supported by the HWRM implementation. The interface
3742          * update version is used to reflect minor changes or bug fixes to a
3743          * released HWRM interface specification. A HWRM implementation that is
3744          * compliant with this specification shall provide value of 1 in this
3745          * field.
3746          */
3747         uint8_t hwrm_intf_upd;
3748
3749         uint8_t hwrm_intf_rsvd;
3750
3751         /*
3752          * This field represents the major version of HWRM firmware. A change in
3753          * firmware major version represents a major firmware release.
3754          */
3755         uint8_t hwrm_fw_maj;
3756
3757         /*
3758          * This field represents the minor version of HWRM firmware. A change in
3759          * firmware minor version represents significant firmware functionality
3760          * changes.
3761          */
3762         uint8_t hwrm_fw_min;
3763
3764         /*
3765          * This field represents the build version of HWRM firmware. A change in
3766          * firmware build version represents bug fixes to a released firmware.
3767          */
3768         uint8_t hwrm_fw_bld;
3769
3770         /*
3771          * This field is a reserved field. This field can be used to represent
3772          * firmware branches or customer specific releases tied to a specific
3773          * (major,minor,update) version of the HWRM firmware.
3774          */
3775         uint8_t hwrm_fw_rsvd;
3776
3777         /*
3778          * This field represents the major version of mgmt firmware. A change in
3779          * major version represents a major release.
3780          */
3781         uint8_t mgmt_fw_maj;
3782
3783         /*
3784          * This field represents the minor version of mgmt firmware. A change in
3785          * minor version represents significant functionality changes.
3786          */
3787         uint8_t mgmt_fw_min;
3788
3789         /*
3790          * This field represents the build version of mgmt firmware. A change in
3791          * update version represents bug fixes.
3792          */
3793         uint8_t mgmt_fw_bld;
3794
3795         /*
3796          * This field is a reserved field. This field can be used to represent
3797          * firmware branches or customer specific releases tied to a specific
3798          * (major,minor,update) version
3799          */
3800         uint8_t mgmt_fw_rsvd;
3801
3802         /*
3803          * This field represents the major version of network control firmware.
3804          * A change in major version represents a major release.
3805          */
3806         uint8_t netctrl_fw_maj;
3807
3808         /*
3809          * This field represents the minor version of network control firmware.
3810          * A change in minor version represents significant functionality
3811          * changes.
3812          */
3813         uint8_t netctrl_fw_min;
3814
3815         /*
3816          * This field represents the build version of network control firmware.
3817          * A change in update version represents bug fixes.
3818          */
3819         uint8_t netctrl_fw_bld;
3820
3821         /*
3822          * This field is a reserved field. This field can be used to represent
3823          * firmware branches or customer specific releases tied to a specific
3824          * (major,minor,update) version
3825          */
3826         uint8_t netctrl_fw_rsvd;
3827
3828         /*
3829          * This field is reserved for future use. The responder should set it to
3830          * 0. The requester should ignore this field.
3831          */
3832         uint32_t reserved1;
3833
3834         /*
3835          * This field represents the major version of RoCE firmware. A change in
3836          * major version represents a major release.
3837          */
3838         uint8_t roce_fw_maj;
3839
3840         /*
3841          * This field represents the minor version of RoCE firmware. A change in
3842          * minor version represents significant functionality changes.
3843          */
3844         uint8_t roce_fw_min;
3845
3846         /*
3847          * This field represents the build version of RoCE firmware. A change in
3848          * update version represents bug fixes.
3849          */
3850         uint8_t roce_fw_bld;
3851
3852         /*
3853          * This field is a reserved field. This field can be used to represent
3854          * firmware branches or customer specific releases tied to a specific
3855          * (major,minor,update) version
3856          */
3857         uint8_t roce_fw_rsvd;
3858
3859         /*
3860          * This field represents the name of HWRM FW (ASCII chars without NULL
3861          * at the end).
3862          */
3863         char hwrm_fw_name[16];
3864
3865         /*
3866          * This field represents the name of mgmt FW (ASCII chars without NULL
3867          * at the end).
3868          */
3869         char mgmt_fw_name[16];
3870
3871         /*
3872          * This field represents the name of network control firmware (ASCII
3873          * chars without NULL at the end).
3874          */
3875         char netctrl_fw_name[16];
3876
3877         /*
3878          * This field is reserved for future use. The responder should set it to
3879          * 0. The requester should ignore this field.
3880          */
3881         uint32_t reserved2[4];
3882
3883         /*
3884          * This field represents the name of RoCE FW (ASCII chars without NULL
3885          * at the end).
3886          */
3887         char roce_fw_name[16];
3888
3889         /* This field returns the chip number. */
3890         uint16_t chip_num;
3891
3892         /* This field returns the revision of chip. */
3893         uint8_t chip_rev;
3894
3895         /* This field returns the chip metal number. */
3896         uint8_t chip_metal;
3897
3898         /* This field returns the bond id of the chip. */
3899         uint8_t chip_bond_id;
3900
3901         /*
3902          * This value indicates the type of platform used for chip
3903          * implementation.
3904          */
3905         /* ASIC */
3906         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_ASIC \
3907                                                         (UINT32_C(0x0) << 0)
3908         /* FPGA platform of the chip. */
3909         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_FPGA \
3910                                                         (UINT32_C(0x1) << 0)
3911         /* Palladium platform of the chip. */
3912         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_PALLADIUM \
3913                                                         (UINT32_C(0x2) << 0)
3914         uint8_t chip_platform_type;
3915
3916         /*
3917          * This field returns the maximum value of request window that is
3918          * supported by the HWRM. The request window is mapped into device
3919          * address space using MMIO.
3920          */
3921         uint16_t max_req_win_len;
3922
3923         /*
3924          * This field returns the maximum value of response buffer in bytes. If
3925          * a request specifies the response buffer length that is greater than
3926          * this value, then the HWRM should fail it. The value of this field
3927          * shall be 4KB or more.
3928          */
3929         uint16_t max_resp_len;
3930
3931         /*
3932          * This field returns the default request timeout value in milliseconds.
3933          */
3934         uint16_t def_req_timeout;
3935
3936         uint8_t unused_0;
3937         uint8_t unused_1;
3938         uint8_t unused_2;
3939
3940         /*
3941          * This field is used in Output records to indicate that the output is
3942          * completely written to RAM. This field should be read as '1' to
3943          * indicate that the output has been completely written. When writing a
3944          * command completion or response to an internal processor, the order of
3945          * writes has to be such that this field is written last.
3946          */
3947         uint8_t valid;
3948 } __attribute__((packed));
3949
3950 /* hwrm_queue_qportcfg */
3951 /*
3952  * Description: This function is called by a driver to query queue configuration
3953  * of a port. # The HWRM shall at least advertise one queue with lossy service
3954  * profile. # The driver shall use this command to query queue ids before
3955  * configuring or using any queues. # If a service profile is not set for a
3956  * queue, then the driver shall not use that queue without configuring a service
3957  * profile for it. # If the driver is not allowed to configure service profiles,
3958  * then the driver shall only use queues for which service profiles are pre-
3959  * configured.
3960  */
3961
3962 /* Input (24 bytes) */
3963 struct hwrm_queue_qportcfg_input {
3964         /*
3965          * This value indicates what type of request this is. The format for the
3966          * rest of the command is determined by this field.
3967          */
3968         uint16_t req_type;
3969
3970         /*
3971          * This value indicates the what completion ring the request will be
3972          * optionally completed on. If the value is -1, then no CR completion
3973          * will be generated. Any other value must be a valid CR ring_id value
3974          * for this function.
3975          */
3976         uint16_t cmpl_ring;
3977
3978         /* This value indicates the command sequence number. */
3979         uint16_t seq_id;
3980
3981         /*
3982          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
3983          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
3984          */
3985         uint16_t target_id;
3986
3987         /*
3988          * This is the host address where the response will be written when the
3989          * request is complete. This area must be 16B aligned and must be
3990          * cleared to zero before the request is made.
3991          */
3992         uint64_t resp_addr;
3993
3994         /*
3995          * Enumeration denoting the RX, TX type of the resource. This
3996          * enumeration is used for resources that are similar for both TX and RX
3997          * paths of the chip.
3998          */
3999         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH \
4000                                                         UINT32_C(0x1)
4001                 /* tx path */
4002         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_TX \
4003                                                         (UINT32_C(0x0) << 0)
4004                 /* rx path */
4005         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX \
4006                                                         (UINT32_C(0x1) << 0)
4007         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_LAST \
4008                                         HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX
4009         uint32_t flags;
4010
4011         /*
4012          * Port ID of port for which the queue configuration is being queried.
4013          * This field is only required when sent by IPC.
4014          */
4015         uint16_t port_id;
4016
4017         uint16_t unused_0;
4018 } __attribute__((packed));
4019
4020 /* hwrm_ring_alloc */
4021 /*
4022  * Description: This command allocates and does basic preparation for a ring.
4023  */
4024
4025 /* Input (80 bytes) */
4026 struct hwrm_ring_alloc_input {
4027         /*
4028          * This value indicates what type of request this is. The format for the
4029          * rest of the command is determined by this field.
4030          */
4031         uint16_t req_type;
4032
4033         /*
4034          * This value indicates the what completion ring the request will be
4035          * optionally completed on. If the value is -1, then no CR completion
4036          * will be generated. Any other value must be a valid CR ring_id value
4037          * for this function.
4038          */
4039         uint16_t cmpl_ring;
4040
4041         /* This value indicates the command sequence number. */
4042         uint16_t seq_id;
4043
4044         /*
4045          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
4046          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
4047          */
4048         uint16_t target_id;
4049
4050         /*
4051          * This is the host address where the response will be written when the
4052          * request is complete. This area must be 16B aligned and must be
4053          * cleared to zero before the request is made.
4054          */
4055         uint64_t resp_addr;
4056
4057         /* This bit must be '1' for the Reserved1 field to be configured. */
4058         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED1         UINT32_C(0x1)
4059         /* This bit must be '1' for the Reserved2 field to be configured. */
4060         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED2         UINT32_C(0x2)
4061         /* This bit must be '1' for the Reserved3 field to be configured. */
4062         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED3         UINT32_C(0x4)
4063         /*
4064          * This bit must be '1' for the stat_ctx_id_valid field to be
4065          * configured.
4066          */
4067         #define HWRM_RING_ALLOC_INPUT_ENABLES_STAT_CTX_ID_VALID UINT32_C(0x8)
4068         /* This bit must be '1' for the Reserved4 field to be configured. */
4069         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED4         UINT32_C(0x10)
4070         /* This bit must be '1' for the max_bw_valid field to be configured. */
4071         #define HWRM_RING_ALLOC_INPUT_ENABLES_MAX_BW_VALID      UINT32_C(0x20)
4072         uint32_t enables;
4073
4074         /* Ring Type. */
4075                 /* Completion Ring (CR) */
4076         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_CMPL    (UINT32_C(0x0) << 0)
4077                 /* TX Ring (TR) */
4078         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_TX      (UINT32_C(0x1) << 0)
4079                 /* RX Ring (RR) */
4080         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_RX      (UINT32_C(0x2) << 0)
4081         uint8_t ring_type;
4082
4083         uint8_t unused_0;
4084         uint16_t unused_1;
4085
4086         /* This value is a pointer to the page table for the Ring. */
4087         uint64_t page_tbl_addr;
4088
4089         /* First Byte Offset of the first entry in the first page. */
4090         uint32_t fbo;
4091
4092         /*
4093          * Actual page size in 2^page_size. The supported range is increments in
4094          * powers of 2 from 16 bytes to 1GB. - 4 = 16 B Page size is 16 B. - 12
4095          * = 4 KB Page size is 4 KB. - 13 = 8 KB Page size is 8 KB. - 16 = 64 KB
4096          * Page size is 64 KB. - 22 = 2 MB Page size is 2 MB. - 23 = 4 MB Page
4097          * size is 4 MB. - 31 = 1 GB Page size is 1 GB.
4098          */
4099         uint8_t page_size;
4100
4101         /*
4102          * This value indicates the depth of page table. For this version of the
4103          * specification, value other than 0 or 1 shall be considered as an
4104          * invalid value. When the page_tbl_depth = 0, then it is treated as a
4105          * special case with the following. 1. FBO and page size fields are not
4106          * valid. 2. page_tbl_addr is the physical address of the first element
4107          * of the ring.
4108          */
4109         uint8_t page_tbl_depth;
4110
4111         uint8_t unused_2;
4112         uint8_t unused_3;
4113
4114         /*
4115          * Number of 16B units in the ring. Minimum size for a ring is 16 16B
4116          * entries.
4117          */
4118         uint32_t length;
4119
4120         /*
4121          * Logical ring number for the ring to be allocated. This value
4122          * determines the position in the doorbell area where the update to the
4123          * ring will be made. For completion rings, this value is also the MSI-X
4124          * vector number for the function the completion ring is associated
4125          * with.
4126          */
4127         uint16_t logical_id;
4128
4129         /*
4130          * This field is used only when ring_type is a TX ring. This value
4131          * indicates what completion ring the TX ring is associated with.
4132          */
4133         uint16_t cmpl_ring_id;
4134
4135         /*
4136          * This field is used only when ring_type is a TX ring. This value
4137          * indicates what CoS queue the TX ring is associated with.
4138          */
4139         uint16_t queue_id;
4140
4141         uint8_t unused_4;
4142         uint8_t unused_5;
4143
4144         /* This field is reserved for the future use. It shall be set to 0. */
4145         uint32_t reserved1;
4146         /* This field is reserved for the future use. It shall be set to 0. */
4147         uint16_t reserved2;
4148
4149         uint8_t unused_6;
4150         uint8_t unused_7;
4151         /* This field is reserved for the future use. It shall be set to 0. */
4152         uint32_t reserved3;
4153
4154         /*
4155          * This field is used only when ring_type is a TX ring. This input
4156          * indicates what statistics context this ring should be associated
4157          * with.
4158          */
4159         uint32_t stat_ctx_id;
4160
4161         /* This field is reserved for the future use. It shall be set to 0. */
4162         uint32_t reserved4;
4163
4164         /*
4165          * This field is used only when ring_type is a TX ring. Maximum BW
4166          * allocated to this TX ring in Mbps. The HWRM will translate this value
4167          * into byte counter and time interval used for this ring inside the
4168          * device.
4169          */
4170         uint32_t max_bw;
4171
4172         /*
4173          * This field is used only when ring_type is a Completion ring. This
4174          * value indicates what interrupt mode should be used on this completion
4175          * ring. Note: In the legacy interrupt mode, no more than 16 completion
4176          * rings are allowed.
4177          */
4178                 /* Legacy INTA */
4179         #define HWRM_RING_ALLOC_INPUT_INT_MODE_LEGACY   (UINT32_C(0x0) << 0)
4180                 /* Reserved */
4181         #define HWRM_RING_ALLOC_INPUT_INT_MODE_RSVD     (UINT32_C(0x1) << 0)
4182                 /* MSI-X */
4183         #define HWRM_RING_ALLOC_INPUT_INT_MODE_MSIX     (UINT32_C(0x2) << 0)
4184                 /* No Interrupt - Polled mode */
4185         #define HWRM_RING_ALLOC_INPUT_INT_MODE_POLL     (UINT32_C(0x3) << 0)
4186         uint8_t int_mode;
4187
4188         uint8_t unused_8[3];
4189 } __attribute__((packed));
4190
4191 /* Output (16 bytes) */
4192
4193 struct hwrm_ring_alloc_output {
4194         /*
4195          * Pass/Fail or error type Note: receiver to verify the in parameters,
4196          * and fail the call with an error when appropriate
4197          */
4198         uint16_t error_code;
4199
4200         /* This field returns the type of original request. */
4201         uint16_t req_type;
4202
4203         /* This field provides original sequence number of the command. */
4204         uint16_t seq_id;
4205
4206         /*
4207          * This field is the length of the response in bytes. The last byte of
4208          * the response is a valid flag that will read as '1' when the command
4209          * has been completely written to memory.
4210          */
4211         uint16_t resp_len;
4212
4213         /* Physical number of ring allocated. */
4214         uint16_t ring_id;
4215
4216         /* Logical number of ring allocated. */
4217         uint16_t logical_ring_id;
4218
4219         uint8_t unused_0;
4220         uint8_t unused_1;
4221         uint8_t unused_2;
4222
4223         /*
4224          * This field is used in Output records to indicate that the output is
4225          * completely written to RAM. This field should be read as '1' to
4226          * indicate that the output has been completely written. When writing a
4227          * command completion or response to an internal processor, the order of
4228          * writes has to be such that this field is written last.
4229          */
4230         uint8_t valid;
4231 } __attribute__((packed));
4232
4233 /* hwrm_ring_free */
4234 /*
4235  * Description: This command is used to free a ring and associated resources.
4236  */
4237 /* Input (24 bytes) */
4238
4239 struct hwrm_ring_free_input {
4240         /*
4241          * This value indicates what type of request this is. The format for the
4242          * rest of the command is determined by this field.
4243          */
4244         uint16_t req_type;
4245
4246         /*
4247          * This value indicates the what completion ring the request will be
4248          * optionally completed on. If the value is -1, then no CR completion
4249          * will be generated. Any other value must be a valid CR ring_id value
4250          * for this function.
4251          */
4252         uint16_t cmpl_ring;
4253
4254         /* This value indicates the command sequence number. */
4255         uint16_t seq_id;
4256
4257         /*
4258          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
4259          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
4260          */
4261         uint16_t target_id;
4262
4263         /*
4264          * This is the host address where the response will be written when the
4265          * request is complete. This area must be 16B aligned and must be
4266          * cleared to zero before the request is made.
4267          */
4268         uint64_t resp_addr;
4269
4270         /* Ring Type. */
4271                 /* Completion Ring (CR) */
4272         #define HWRM_RING_FREE_INPUT_RING_TYPE_CMPL     (UINT32_C(0x0) << 0)
4273                 /* TX Ring (TR) */
4274         #define HWRM_RING_FREE_INPUT_RING_TYPE_TX       (UINT32_C(0x1) << 0)
4275                 /* RX Ring (RR) */
4276         #define HWRM_RING_FREE_INPUT_RING_TYPE_RX       (UINT32_C(0x2) << 0)
4277         uint8_t ring_type;
4278
4279         uint8_t unused_0;
4280
4281         /* Physical number of ring allocated. */
4282         uint16_t ring_id;
4283
4284         uint32_t unused_1;
4285 } __attribute__((packed));
4286
4287 /* Output (16 bytes) */
4288 struct hwrm_ring_free_output {
4289         /*
4290          * Pass/Fail or error type Note: receiver to verify the in parameters,
4291          * and fail the call with an error when appropriate
4292          */
4293         uint16_t error_code;
4294
4295         /* This field returns the type of original request. */
4296         uint16_t req_type;
4297
4298         /* This field provides original sequence number of the command. */
4299         uint16_t seq_id;
4300
4301         /*
4302          * This field is the length of the response in bytes. The last byte of
4303          * the response is a valid flag that will read as '1' when the command
4304          * has been completely written to memory.
4305          */
4306         uint16_t resp_len;
4307
4308         uint32_t unused_0;
4309         uint8_t unused_1;
4310         uint8_t unused_2;
4311         uint8_t unused_3;
4312
4313         /*
4314          * This field is used in Output records to indicate that the output is
4315          * completely written to RAM. This field should be read as '1' to
4316          * indicate that the output has been completely written. When writing a
4317          * command completion or response to an internal processor, the order of
4318          * writes has to be such that this field is written last.
4319          */
4320         uint8_t valid;
4321 } __attribute__((packed));
4322
4323 /* hwrm_ring_grp_alloc */
4324 /*
4325  * Description: This API allocates and does basic preparation for a ring group.
4326  */
4327
4328 /* Input (24 bytes) */
4329 struct hwrm_ring_grp_alloc_input {
4330         /*
4331          * This value indicates what type of request this is. The format for the
4332          * rest of the command is determined by this field.
4333          */
4334         uint16_t req_type;
4335
4336         /*
4337          * This value indicates the what completion ring the request will be
4338          * optionally completed on. If the value is -1, then no CR completion
4339          * will be generated. Any other value must be a valid CR ring_id value
4340          * for this function.
4341          */
4342         uint16_t cmpl_ring;
4343
4344         /* This value indicates the command sequence number. */
4345         uint16_t seq_id;
4346
4347         /*
4348          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
4349          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
4350          */
4351         uint16_t target_id;
4352
4353         /*
4354          * This is the host address where the response will be written when the
4355          * request is complete. This area must be 16B aligned and must be
4356          * cleared to zero before the request is made.
4357          */
4358         uint64_t resp_addr;
4359
4360         /* This value identifies the CR associated with the ring group. */
4361         uint16_t cr;
4362
4363         /* This value identifies the main RR associated with the ring group. */
4364         uint16_t rr;
4365
4366         /*
4367          * This value identifies the aggregation RR associated with the ring
4368          * group. If this value is 0xFF... (All Fs), then no Aggregation ring
4369          * will be set.
4370          */
4371         uint16_t ar;
4372
4373         /*
4374          * This value identifies the statistics context associated with the ring
4375          * group.
4376          */
4377         uint16_t sc;
4378 } __attribute__((packed));
4379
4380 /* Output (16 bytes) */
4381 struct hwrm_ring_grp_alloc_output {
4382         /*
4383          * Pass/Fail or error type Note: receiver to verify the in parameters,
4384          * and fail the call with an error when appropriate
4385          */
4386         uint16_t error_code;
4387
4388         /* This field returns the type of original request. */
4389         uint16_t req_type;
4390
4391         /* This field provides original sequence number of the command. */
4392         uint16_t seq_id;
4393
4394         /*
4395          * This field is the length of the response in bytes. The last byte of
4396          * the response is a valid flag that will read as '1' when the command
4397          * has been completely written to memory.
4398          */
4399         uint16_t resp_len;
4400
4401         /*
4402          * This is the ring group ID value. Use this value to program the
4403          * default ring group for the VNIC or as table entries in an RSS/COS
4404          * context.
4405          */
4406         uint32_t ring_group_id;
4407
4408         uint8_t unused_0;
4409         uint8_t unused_1;
4410         uint8_t unused_2;
4411
4412         /*
4413          * This field is used in Output records to indicate that the output is
4414          * completely written to RAM. This field should be read as '1' to
4415          * indicate that the output has been completely written. When writing a
4416          * command completion or response to an internal processor, the order of
4417          * writes has to be such that this field is written last.
4418          */
4419         uint8_t valid;
4420 } __attribute__((packed));
4421
4422 /* hwrm_ring_grp_free */
4423 /*
4424  * Description: This API frees a ring group and associated resources. # If a
4425  * ring in the ring group is reset or free, then the associated rings in the
4426  * ring group shall also be reset/free using hwrm_ring_free. # A function driver
4427  * shall always use hwrm_ring_grp_free after freeing all rings in a group. # As
4428  * a part of executing this command, the HWRM shall reset all associated ring
4429  * group resources.
4430  */
4431
4432 /* Input (24 bytes) */
4433 struct hwrm_ring_grp_free_input {
4434         /*
4435          * This value indicates what type of request this is. The format for the
4436          * rest of the command is determined by this field.
4437          */
4438         uint16_t req_type;
4439
4440         /*
4441          * This value indicates the what completion ring the request will be
4442          * optionally completed on. If the value is -1, then no CR completion
4443          * will be generated. Any other value must be a valid CR ring_id value
4444          * for this function.
4445          */
4446         uint16_t cmpl_ring;
4447
4448         /* This value indicates the command sequence number. */
4449         uint16_t seq_id;
4450
4451         /*
4452          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
4453          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
4454          */
4455         uint16_t target_id;
4456
4457         /*
4458          * This is the host address where the response will be written when the
4459          * request is complete. This area must be 16B aligned and must be
4460          * cleared to zero before the request is made.
4461          */
4462         uint64_t resp_addr;
4463
4464         /* This is the ring group ID value. */
4465         uint32_t ring_group_id;
4466
4467         uint32_t unused_0;
4468 } __attribute__((packed));
4469
4470 /* Output (16 bytes) */
4471 struct hwrm_ring_grp_free_output {
4472         /*
4473          * Pass/Fail or error type Note: receiver to verify the in parameters,
4474          * and fail the call with an error when appropriate
4475          */
4476         uint16_t error_code;
4477
4478         /* This field returns the type of original request. */
4479         uint16_t req_type;
4480
4481         /* This field provides original sequence number of the command. */
4482         uint16_t seq_id;
4483
4484         /*
4485          * This field is the length of the response in bytes. The last byte of
4486          * the response is a valid flag that will read as '1' when the command
4487          * has been completely written to memory.
4488          */
4489         uint16_t resp_len;
4490
4491         uint32_t unused_0;
4492         uint8_t unused_1;
4493         uint8_t unused_2;
4494         uint8_t unused_3;
4495
4496         /*
4497          * This field is used in Output records to indicate that the output is
4498          * completely written to RAM. This field should be read as '1' to
4499          * indicate that the output has been completely written. When writing a
4500          * command completion or response to an internal processor, the order of
4501          * writes has to be such that this field is written last.
4502          */
4503         uint8_t valid;
4504 } __attribute__((packed));
4505
4506 /* hwrm_stat_ctx_alloc */
4507 /*
4508  * Description: This command allocates and does basic preparation for a stat
4509  * context.
4510  */
4511
4512 /* Input (32 bytes) */
4513 struct hwrm_stat_ctx_alloc_input {
4514         /*
4515          * This value indicates what type of request this is. The format for the
4516          * rest of the command is determined by this field.
4517          */
4518         uint16_t req_type;
4519
4520         /*
4521          * This value indicates the what completion ring the request will be
4522          * optionally completed on. If the value is -1, then no CR completion
4523          * will be generated. Any other value must be a valid CR ring_id value
4524          * for this function.
4525          */
4526         uint16_t cmpl_ring;
4527
4528         /* This value indicates the command sequence number. */
4529         uint16_t seq_id;
4530
4531         /*
4532          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
4533          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
4534          */
4535         uint16_t target_id;
4536
4537         /*
4538          * This is the host address where the response will be written when the
4539          * request is complete. This area must be 16B aligned and must be
4540          * cleared to zero before the request is made.
4541          */
4542         uint64_t resp_addr;
4543
4544         /* This is the address for statistic block. */
4545         uint64_t stats_dma_addr;
4546
4547         /*
4548          * The statistic block update period in ms. e.g. 250ms, 500ms, 750ms,
4549          * 1000ms.
4550          */
4551         uint32_t update_period_ms;
4552
4553         uint32_t unused_0;
4554 } __attribute__((packed));
4555
4556 /* Output (16 bytes) */
4557 struct hwrm_stat_ctx_alloc_output {
4558         /*
4559          * Pass/Fail or error type Note: receiver to verify the in parameters,
4560          * and fail the call with an error when appropriate
4561          */
4562         uint16_t error_code;
4563
4564         /* This field returns the type of original request. */
4565         uint16_t req_type;
4566
4567         /* This field provides original sequence number of the command. */
4568         uint16_t seq_id;
4569
4570         /*
4571          * This field is the length of the response in bytes. The last byte of
4572          * the response is a valid flag that will read as '1' when the command
4573          * has been completely written to memory.
4574          */
4575         uint16_t resp_len;
4576
4577         /* This is the statistics context ID value. */
4578         uint32_t stat_ctx_id;
4579
4580         uint8_t unused_0;
4581         uint8_t unused_1;
4582         uint8_t unused_2;
4583
4584         /*
4585          * This field is used in Output records to indicate that the output is
4586          * completely written to RAM. This field should be read as '1' to
4587          * indicate that the output has been completely written. When writing a
4588          * command completion or response to an internal processor, the order of
4589          * writes has to be such that this field is written last.
4590          */
4591         uint8_t valid;
4592 } __attribute__((packed));
4593
4594 /* hwrm_stat_ctx_clr_stats */
4595 /* Description: This command clears statistics of a context. */
4596
4597 /* Input (24 bytes) */
4598 struct hwrm_stat_ctx_clr_stats_input {
4599         /*
4600          * This value indicates what type of request this is. The format for the
4601          * rest of the command is determined by this field.
4602          */
4603         uint16_t req_type;
4604
4605         /*
4606          * This value indicates the what completion ring the request will be
4607          * optionally completed on. If the value is -1, then no CR completion
4608          * will be generated. Any other value must be a valid CR ring_id value
4609          * for this function.
4610          */
4611         uint16_t cmpl_ring;
4612
4613         /* This value indicates the command sequence number. */
4614         uint16_t seq_id;
4615
4616         /*
4617          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
4618          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
4619          */
4620         uint16_t target_id;
4621
4622         /*
4623          * This is the host address where the response will be written when the
4624          * request is complete. This area must be 16B aligned and must be
4625          * cleared to zero before the request is made.
4626          */
4627         uint64_t resp_addr;
4628
4629         /* ID of the statistics context that is being queried. */
4630         uint32_t stat_ctx_id;
4631
4632         uint32_t unused_0;
4633 } __attribute__((packed));
4634
4635 /* Output (16 bytes) */
4636 struct hwrm_stat_ctx_clr_stats_output {
4637         /*
4638          * Pass/Fail or error type Note: receiver to verify the in parameters,
4639          * and fail the call with an error when appropriate
4640          */
4641         uint16_t error_code;
4642
4643         /* This field returns the type of original request. */
4644         uint16_t req_type;
4645
4646         /* This field provides original sequence number of the command. */
4647         uint16_t seq_id;
4648
4649         /*
4650          * This field is the length of the response in bytes. The last byte of
4651          * the response is a valid flag that will read as '1' when the command
4652          * has been completely written to memory.
4653          */
4654         uint16_t resp_len;
4655
4656         uint32_t unused_0;
4657         uint8_t unused_1;
4658         uint8_t unused_2;
4659         uint8_t unused_3;
4660
4661         /*
4662          * This field is used in Output records to indicate that the output is
4663          * completely written to RAM. This field should be read as '1' to
4664          * indicate that the output has been completely written. When writing a
4665          * command completion or response to an internal processor, the order of
4666          * writes has to be such that this field is written last.
4667          */
4668         uint8_t valid;
4669 } __attribute__((packed));
4670
4671 /* hwrm_stat_ctx_free */
4672 /* Description: This command is used to free a stat context. */
4673 /* Input (24 bytes) */
4674
4675 struct hwrm_stat_ctx_free_input {
4676         /*
4677          * This value indicates what type of request this is. The format for the
4678          * rest of the command is determined by this field.
4679          */
4680         uint16_t req_type;
4681
4682         /*
4683          * This value indicates the what completion ring the request will be
4684          * optionally completed on. If the value is -1, then no CR completion
4685          * will be generated. Any other value must be a valid CR ring_id value
4686          * for this function.
4687          */
4688         uint16_t cmpl_ring;
4689
4690         /* This value indicates the command sequence number. */
4691         uint16_t seq_id;
4692
4693         /*
4694          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
4695          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
4696          */
4697         uint16_t target_id;
4698
4699         /*
4700          * This is the host address where the response will be written when the
4701          * request is complete. This area must be 16B aligned and must be
4702          * cleared to zero before the request is made.
4703          */
4704         uint64_t resp_addr;
4705
4706         /* ID of the statistics context that is being queried. */
4707         uint32_t stat_ctx_id;
4708
4709         uint32_t unused_0;
4710 } __attribute__((packed));
4711
4712 /* Output (16 bytes) */
4713
4714 struct hwrm_stat_ctx_free_output {
4715         /*
4716          * Pass/Fail or error type Note: receiver to verify the in parameters,
4717          * and fail the call with an error when appropriate
4718          */
4719         uint16_t error_code;
4720
4721         /* This field returns the type of original request. */
4722         uint16_t req_type;
4723
4724         /* This field provides original sequence number of the command. */
4725         uint16_t seq_id;
4726
4727         /*
4728          * This field is the length of the response in bytes. The last byte of
4729          * the response is a valid flag that will read as '1' when the command
4730          * has been completely written to memory.
4731          */
4732         uint16_t resp_len;
4733
4734         /* This is the statistics context ID value. */
4735         uint32_t stat_ctx_id;
4736
4737         uint8_t unused_0;
4738         uint8_t unused_1;
4739         uint8_t unused_2;
4740
4741         /*
4742          * This field is used in Output records to indicate that the output is
4743          * completely written to RAM. This field should be read as '1' to
4744          * indicate that the output has been completely written. When writing a
4745          * command completion or response to an internal processor, the order of
4746          * writes has to be such that this field is written last.
4747          */
4748         uint8_t valid;
4749 } __attribute__((packed));
4750
4751 /* hwrm_vnic_alloc */
4752 /*
4753  * Description: This VNIC is a resource in the RX side of the chip that is used
4754  * to represent a virtual host "interface". # At the time of VNIC allocation or
4755  * configuration, the function can specify whether it wants the requested VNIC
4756  * to be the default VNIC for the function or not. # If a function requests
4757  * allocation of a VNIC for the first time and a VNIC is successfully allocated
4758  * by the HWRM, then the HWRM shall make the allocated VNIC as the default VNIC
4759  * for that function. # The default VNIC shall be used for the default action
4760  * for a partition or function. # For each VNIC allocated on a function, a
4761  * mapping on the RX side to map the allocated VNIC to source virtual interface
4762  * shall be performed by the HWRM. This should be hidden to the function driver
4763  * requesting the VNIC allocation. This enables broadcast/multicast replication
4764  * with source knockout. # If multicast replication with source knockout is
4765  * enabled, then the internal VNIC to SVIF mapping data structures shall be
4766  * programmed at the time of VNIC allocation.
4767  */
4768
4769 /* Input (24 bytes) */
4770 struct hwrm_vnic_alloc_input {
4771         /*
4772          * This value indicates what type of request this is. The format for the
4773          * rest of the command is determined by this field.
4774          */
4775         uint16_t req_type;
4776
4777         /*
4778          * This value indicates the what completion ring the request will be
4779          * optionally completed on. If the value is -1, then no CR completion
4780          * will be generated. Any other value must be a valid CR ring_id value
4781          * for this function.
4782          */
4783         uint16_t cmpl_ring;
4784
4785         /* This value indicates the command sequence number. */
4786         uint16_t seq_id;
4787
4788         /*
4789          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
4790          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
4791          */
4792         uint16_t target_id;
4793
4794         /*
4795          * This is the host address where the response will be written when the
4796          * request is complete. This area must be 16B aligned and must be
4797          * cleared to zero before the request is made.
4798          */
4799         uint64_t resp_addr;
4800
4801         /*
4802          * When this bit is '1', this VNIC is requested to be the default VNIC
4803          * for this function.
4804          */
4805         #define HWRM_VNIC_ALLOC_INPUT_FLAGS_DEFAULT                UINT32_C(0x1)
4806         uint32_t flags;
4807
4808         uint32_t unused_0;
4809 } __attribute__((packed));
4810
4811 /* Output (16 bytes) */
4812 struct hwrm_vnic_alloc_output {
4813         /*
4814          * Pass/Fail or error type Note: receiver to verify the in parameters,
4815          * and fail the call with an error when appropriate
4816          */
4817         uint16_t error_code;
4818
4819         /* This field returns the type of original request. */
4820         uint16_t req_type;
4821
4822         /* This field provides original sequence number of the command. */
4823         uint16_t seq_id;
4824
4825         /*
4826          * This field is the length of the response in bytes. The last byte of
4827          * the response is a valid flag that will read as '1' when the command
4828          * has been completely written to memory.
4829          */
4830         uint16_t resp_len;
4831
4832         /* Logical vnic ID */
4833         uint32_t vnic_id;
4834
4835         uint8_t unused_0;
4836         uint8_t unused_1;
4837         uint8_t unused_2;
4838
4839         /*
4840          * This field is used in Output records to indicate that the output is
4841          * completely written to RAM. This field should be read as '1' to
4842          * indicate that the output has been completely written. When writing a
4843          * command completion or response to an internal processor, the order of
4844          * writes has to be such that this field is written last.
4845          */
4846         uint8_t valid;
4847 } __attribute__((packed));
4848
4849 /* hwrm_vnic_cfg */
4850 /* Description: Configure the RX VNIC structure. */
4851
4852 /* Input (40 bytes) */
4853 struct hwrm_vnic_cfg_input {
4854         /*
4855          * This value indicates what type of request this is. The format for the
4856          * rest of the command is determined by this field.
4857          */
4858         uint16_t req_type;
4859
4860         /*
4861          * This value indicates the what completion ring the request will be
4862          * optionally completed on. If the value is -1, then no CR completion
4863          * will be generated. Any other value must be a valid CR ring_id value
4864          * for this function.
4865          */
4866         uint16_t cmpl_ring;
4867
4868         /* This value indicates the command sequence number. */
4869         uint16_t seq_id;
4870
4871         /*
4872          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
4873          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
4874          */
4875         uint16_t target_id;
4876
4877         /*
4878          * This is the host address where the response will be written when the
4879          * request is complete. This area must be 16B aligned and must be
4880          * cleared to zero before the request is made.
4881          */
4882         uint64_t resp_addr;
4883
4884         /*
4885          * When this bit is '1', the VNIC is requested to be the default VNIC
4886          * for the function.
4887          */
4888         #define HWRM_VNIC_CFG_INPUT_FLAGS_DEFAULT               UINT32_C(0x1)
4889         /*
4890          * When this bit is '1', the VNIC is being configured to strip VLAN in
4891          * the RX path. If set to '0', then VLAN stripping is disabled on this
4892          * VNIC.
4893          */
4894         #define HWRM_VNIC_CFG_INPUT_FLAGS_VLAN_STRIP_MODE       UINT32_C(0x2)
4895         /*
4896          * When this bit is '1', the VNIC is being configured to buffer receive
4897          * packets in the hardware until the host posts new receive buffers. If
4898          * set to '0', then bd_stall is being configured to be disabled on this
4899          * VNIC.
4900          */
4901         #define HWRM_VNIC_CFG_INPUT_FLAGS_BD_STALL_MODE         UINT32_C(0x4)
4902         /*
4903          * When this bit is '1', the VNIC is being configured to receive both
4904          * RoCE and non-RoCE traffic. If set to '0', then this VNIC is not
4905          * configured to be operating in dual VNIC mode.
4906          */
4907         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_DUAL_VNIC_MODE   UINT32_C(0x8)
4908         /*
4909          * When this flag is set to '1', the VNIC is requested to be configured
4910          * to receive only RoCE traffic. If this flag is set to '0', then this
4911          * flag shall be ignored by the HWRM. If roce_dual_vnic_mode flag is set
4912          * to '1', then the HWRM client shall not set this flag to '1'.
4913          */
4914         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_ONLY_VNIC_MODE   UINT32_C(0x10)
4915         uint32_t flags;
4916
4917         /* This bit must be '1' for the dflt_ring_grp field to be configured. */
4918         #define HWRM_VNIC_CFG_INPUT_ENABLES_DFLT_RING_GRP       UINT32_C(0x1)
4919         /* This bit must be '1' for the rss_rule field to be configured. */
4920         #define HWRM_VNIC_CFG_INPUT_ENABLES_RSS_RULE            UINT32_C(0x2)
4921         /* This bit must be '1' for the cos_rule field to be configured. */
4922         #define HWRM_VNIC_CFG_INPUT_ENABLES_COS_RULE            UINT32_C(0x4)
4923         /* This bit must be '1' for the lb_rule field to be configured. */
4924         #define HWRM_VNIC_CFG_INPUT_ENABLES_LB_RULE             UINT32_C(0x8)
4925         /* This bit must be '1' for the mru field to be configured. */
4926         #define HWRM_VNIC_CFG_INPUT_ENABLES_MRU                 UINT32_C(0x10)
4927         uint32_t enables;
4928
4929         /* Logical vnic ID */
4930         uint16_t vnic_id;
4931
4932         /*
4933          * Default Completion ring for the VNIC. This ring will be chosen if
4934          * packet does not match any RSS rules and if there is no COS rule.
4935          */
4936         uint16_t dflt_ring_grp;
4937
4938         /*
4939          * RSS ID for RSS rule/table structure. 0xFF... (All Fs) if there is no
4940          * RSS rule.
4941          */
4942         uint16_t rss_rule;
4943
4944         /*
4945          * RSS ID for COS rule/table structure. 0xFF... (All Fs) if there is no
4946          * COS rule.
4947          */
4948         uint16_t cos_rule;
4949
4950         /*
4951          * RSS ID for load balancing rule/table structure. 0xFF... (All Fs) if
4952          * there is no LB rule.
4953          */
4954         uint16_t lb_rule;
4955
4956         /*
4957          * The maximum receive unit of the vnic. Each vnic is associated with a
4958          * function. The vnic mru value overwrites the mru setting of the
4959          * associated function. The HWRM shall make sure that vnic mru does not
4960          * exceed the mru of the port the function is associated with.
4961          */
4962         uint16_t mru;
4963
4964         uint32_t unused_0;
4965 } __attribute__((packed));
4966
4967 /* Output (16 bytes) */
4968 struct hwrm_vnic_cfg_output {
4969         /*
4970          * Pass/Fail or error type Note: receiver to verify the in parameters,
4971          * and fail the call with an error when appropriate
4972          */
4973         uint16_t error_code;
4974
4975         /* This field returns the type of original request. */
4976         uint16_t req_type;
4977
4978         /* This field provides original sequence number of the command. */
4979         uint16_t seq_id;
4980
4981         /*
4982          * This field is the length of the response in bytes. The last byte of
4983          * the response is a valid flag that will read as '1' when the command
4984          * has been completely written to memory.
4985          */
4986         uint16_t resp_len;
4987
4988         uint32_t unused_0;
4989         uint8_t unused_1;
4990         uint8_t unused_2;
4991         uint8_t unused_3;
4992
4993         /*
4994          * This field is used in Output records to indicate that the output is
4995          * completely written to RAM. This field should be read as '1' to
4996          * indicate that the output has been completely written. When writing a
4997          * command completion or response to an internal processor, the order of
4998          * writes has to be such that this field is written last.
4999          */
5000         uint8_t valid;
5001 } __attribute__((packed));
5002
5003 /* hwrm_vnic_free */
5004 /*
5005  * Description: Free a VNIC resource. Idle any resources associated with the
5006  * VNIC as well as the VNIC. Reset and release all resources associated with the
5007  * VNIC.
5008  */
5009
5010 /* Input (24 bytes) */
5011 struct hwrm_vnic_free_input {
5012         /*
5013          * This value indicates what type of request this is. The format for the
5014          * rest of the command is determined by this field.
5015          */
5016         uint16_t req_type;
5017
5018         /*
5019          * This value indicates the what completion ring the request will be
5020          * optionally completed on. If the value is -1, then no CR completion
5021          * will be generated. Any other value must be a valid CR ring_id value
5022          * for this function.
5023          */
5024         uint16_t cmpl_ring;
5025
5026         /* This value indicates the command sequence number. */
5027         uint16_t seq_id;
5028
5029         /*
5030          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
5031          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
5032          */
5033         uint16_t target_id;
5034
5035         /*
5036          * This is the host address where the response will be written when the
5037          * request is complete. This area must be 16B aligned and must be
5038          * cleared to zero before the request is made.
5039          */
5040         uint64_t resp_addr;
5041
5042         /* Logical vnic ID */
5043         uint32_t vnic_id;
5044
5045         uint32_t unused_0;
5046 } __attribute__((packed));
5047
5048 /* Output (16 bytes) */
5049 struct hwrm_vnic_free_output {
5050         /*
5051          * Pass/Fail or error type Note: receiver to verify the in parameters,
5052          * and fail the call with an error when appropriate
5053          */
5054         uint16_t error_code;
5055
5056         /* This field returns the type of original request. */
5057         uint16_t req_type;
5058
5059         /* This field provides original sequence number of the command. */
5060         uint16_t seq_id;
5061
5062         /*
5063          * This field is the length of the response in bytes. The last byte of
5064          * the response is a valid flag that will read as '1' when the command
5065          * has been completely written to memory.
5066          */
5067         uint16_t resp_len;
5068
5069         uint32_t unused_0;
5070         uint8_t unused_1;
5071         uint8_t unused_2;
5072         uint8_t unused_3;
5073
5074         /*
5075          * This field is used in Output records to indicate that the output is
5076          * completely written to RAM. This field should be read as '1' to
5077          * indicate that the output has been completely written. When writing a
5078          * command completion or response to an internal processor, the order of
5079          * writes has to be such that this field is written last.
5080          */
5081         uint8_t valid;
5082 } __attribute__((packed));
5083
5084 /* hwrm_vnic_rss_cfg */
5085 /* Description: This function is used to enable RSS configuration. */
5086
5087 /* Input (48 bytes) */
5088 struct hwrm_vnic_rss_cfg_input {
5089         /*
5090          * This value indicates what type of request this is. The format for the
5091          * rest of the command is determined by this field.
5092          */
5093         uint16_t req_type;
5094
5095         /*
5096          * This value indicates the what completion ring the request will be
5097          * optionally completed on. If the value is -1, then no CR completion
5098          * will be generated. Any other value must be a valid CR ring_id value
5099          * for this function.
5100          */
5101         uint16_t cmpl_ring;
5102
5103         /* This value indicates the command sequence number. */
5104         uint16_t seq_id;
5105
5106         /*
5107          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
5108          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
5109          */
5110         uint16_t target_id;
5111
5112         /*
5113          * This is the host address where the response will be written when the
5114          * request is complete. This area must be 16B aligned and must be
5115          * cleared to zero before the request is made.
5116          */
5117         uint64_t resp_addr;
5118
5119         /*
5120          * When this bit is '1', the RSS hash shall be computed over source and
5121          * destination IPv4 addresses of IPv4 packets.
5122          */
5123         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4          UINT32_C(0x1)
5124         /*
5125          * When this bit is '1', the RSS hash shall be computed over
5126          * source/destination IPv4 addresses and source/destination ports of
5127          * TCP/IPv4 packets.
5128          */
5129         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV4      UINT32_C(0x2)
5130         /*
5131          * When this bit is '1', the RSS hash shall be computed over
5132          * source/destination IPv4 addresses and source/destination ports of
5133          * UDP/IPv4 packets.
5134          */
5135         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV4      UINT32_C(0x4)
5136         /*
5137          * When this bit is '1', the RSS hash shall be computed over source and
5138          * destination IPv4 addresses of IPv6 packets.
5139          */
5140         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV6          UINT32_C(0x8)
5141         /*
5142          * When this bit is '1', the RSS hash shall be computed over
5143          * source/destination IPv6 addresses and source/destination ports of
5144          * TCP/IPv6 packets.
5145          */
5146         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV6      UINT32_C(0x10)
5147         /*
5148          * When this bit is '1', the RSS hash shall be computed over
5149          * source/destination IPv6 addresses and source/destination ports of
5150          * UDP/IPv6 packets.
5151          */
5152         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV6      UINT32_C(0x20)
5153         uint32_t hash_type;
5154
5155         uint32_t unused_0;
5156
5157         /* This is the address for rss ring group table */
5158         uint64_t ring_grp_tbl_addr;
5159
5160         /* This is the address for rss hash key table */
5161         uint64_t hash_key_tbl_addr;
5162
5163         /* Index to the rss indirection table. */
5164         uint16_t rss_ctx_idx;
5165
5166         uint16_t unused_1[3];
5167 } __attribute__((packed));
5168
5169 /* Output (16 bytes) */
5170 struct hwrm_vnic_rss_cfg_output {
5171         /*
5172          * Pass/Fail or error type Note: receiver to verify the in parameters,
5173          * and fail the call with an error when appropriate
5174          */
5175         uint16_t error_code;
5176
5177         /* This field returns the type of original request. */
5178         uint16_t req_type;
5179
5180         /* This field provides original sequence number of the command. */
5181         uint16_t seq_id;
5182
5183         /*
5184          * This field is the length of the response in bytes. The last byte of
5185          * the response is a valid flag that will read as '1' when the command
5186          * has been completely written to memory.
5187          */
5188         uint16_t resp_len;
5189
5190         uint32_t unused_0;
5191         uint8_t unused_1;
5192         uint8_t unused_2;
5193         uint8_t unused_3;
5194
5195         /*
5196          * This field is used in Output records to indicate that the output is
5197          * completely written to RAM. This field should be read as '1' to
5198          * indicate that the output has been completely written. When writing a
5199          * command completion or response to an internal processor, the order of
5200          * writes has to be such that this field is written last.
5201          */
5202         uint8_t valid;
5203 } __attribute__((packed));
5204
5205 /* Input (16 bytes) */
5206 struct hwrm_vnic_rss_cos_lb_ctx_alloc_input {
5207         /*
5208          * This value indicates what type of request this is. The format for the
5209          * rest of the command is determined by this field.
5210          */
5211         uint16_t req_type;
5212
5213         /*
5214          * This value indicates the what completion ring the request will be
5215          * optionally completed on. If the value is -1, then no CR completion
5216          * will be generated. Any other value must be a valid CR ring_id value
5217          * for this function.
5218          */
5219         uint16_t cmpl_ring;
5220
5221         /* This value indicates the command sequence number. */
5222         uint16_t seq_id;
5223
5224         /*
5225          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
5226          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
5227          */
5228         uint16_t target_id;
5229
5230         /*
5231          * This is the host address where the response will be written when the
5232          * request is complete. This area must be 16B aligned and must be
5233          * cleared to zero before the request is made.
5234          */
5235         uint64_t resp_addr;
5236 } __attribute__((packed));
5237
5238 /* Output (16 bytes) */
5239
5240 struct hwrm_vnic_rss_cos_lb_ctx_alloc_output {
5241         /*
5242          * Pass/Fail or error type Note: receiver to verify the in parameters,
5243          * and fail the call with an error when appropriate
5244          */
5245         uint16_t error_code;
5246
5247         /* This field returns the type of original request. */
5248         uint16_t req_type;
5249
5250         /* This field provides original sequence number of the command. */
5251         uint16_t seq_id;
5252
5253         /*
5254          * This field is the length of the response in bytes. The last byte of
5255          * the response is a valid flag that will read as '1' when the command
5256          * has been completely written to memory.
5257          */
5258         uint16_t resp_len;
5259
5260         /* rss_cos_lb_ctx_id is 16 b */
5261         uint16_t rss_cos_lb_ctx_id;
5262
5263         uint8_t unused_0;
5264         uint8_t unused_1;
5265         uint8_t unused_2;
5266         uint8_t unused_3;
5267         uint8_t unused_4;
5268
5269         /*
5270          * This field is used in Output records to indicate that the output is
5271          * completely written to RAM. This field should be read as '1' to
5272          * indicate that the output has been completely written. When writing a
5273          * command completion or response to an internal processor, the order of
5274          * writes has to be such that this field is written last.
5275          */
5276         uint8_t valid;
5277 } __attribute__((packed));
5278
5279 /* hwrm_vnic_rss_cos_lb_ctx_free */
5280 /* Description: This function can be used to free COS/Load Balance context. */
5281 /* Input (24 bytes) */
5282
5283 struct hwrm_vnic_rss_cos_lb_ctx_free_input {
5284         /*
5285          * This value indicates what type of request this is. The format for the
5286          * rest of the command is determined by this field.
5287          */
5288         uint16_t req_type;
5289
5290         /*
5291          * This value indicates the what completion ring the request will be
5292          * optionally completed on. If the value is -1, then no CR completion
5293          * will be generated. Any other value must be a valid CR ring_id value
5294          * for this function.
5295          */
5296         uint16_t cmpl_ring;
5297
5298         /* This value indicates the command sequence number. */
5299         uint16_t seq_id;
5300
5301         /*
5302          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
5303          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
5304          */
5305         uint16_t target_id;
5306
5307         /*
5308          * This is the host address where the response will be written when the
5309          * request is complete. This area must be 16B aligned and must be
5310          * cleared to zero before the request is made.
5311          */
5312         uint64_t resp_addr;
5313
5314         /* rss_cos_lb_ctx_id is 16 b */
5315         uint16_t rss_cos_lb_ctx_id;
5316
5317         uint16_t unused_0[3];
5318 } __attribute__((packed));
5319
5320 /* Output (16 bytes) */
5321 struct hwrm_vnic_rss_cos_lb_ctx_free_output {
5322         /*
5323          * Pass/Fail or error type Note: receiver to verify the in parameters,
5324          * and fail the call with an error when appropriate
5325          */
5326         uint16_t error_code;
5327
5328         /* This field returns the type of original request. */
5329         uint16_t req_type;
5330
5331         /* This field provides original sequence number of the command. */
5332         uint16_t seq_id;
5333
5334         /*
5335          * This field is the length of the response in bytes. The last byte of
5336          * the response is a valid flag that will read as '1' when the command
5337          * has been completely written to memory.
5338          */
5339         uint16_t resp_len;
5340
5341         uint32_t unused_0;
5342         uint8_t unused_1;
5343         uint8_t unused_2;
5344         uint8_t unused_3;
5345
5346         /*
5347          * This field is used in Output records to indicate that the output is
5348          * completely written to RAM. This field should be read as '1' to
5349          * indicate that the output has been completely written. When writing a
5350          * command completion or response to an internal processor, the order of
5351          * writes has to be such that this field is written last.
5352          */
5353         uint8_t valid;
5354 } __attribute__((packed));
5355
5356 /* Output (32 bytes) */
5357 struct hwrm_queue_qportcfg_output {
5358         /*
5359          * Pass/Fail or error type Note: receiver to verify the in parameters,
5360          * and fail the call with an error when appropriate
5361          */
5362         uint16_t error_code;
5363
5364         /* This field returns the type of original request. */
5365         uint16_t req_type;
5366
5367         /* This field provides original sequence number of the command. */
5368         uint16_t seq_id;
5369
5370         /*
5371          * This field is the length of the response in bytes. The last byte of
5372          * the response is a valid flag that will read as '1' when the command
5373          * has been completely written to memory.
5374          */
5375         uint16_t resp_len;
5376
5377         /* The maximum number of queues that can be configured. */
5378         uint8_t max_configurable_queues;
5379
5380         /* The maximum number of lossless queues that can be configured. */
5381         uint8_t max_configurable_lossless_queues;
5382
5383         /*
5384          * 0 - Not allowed. Non-zero - Allowed. If this value is non-zero, then
5385          * the HWRM shall allow the host SW driver to configure queues using
5386          * hwrm_queue_cfg.
5387          */
5388         uint8_t queue_cfg_allowed;
5389
5390         /*
5391          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
5392          * the HWRM shall allow the host SW driver to configure queue buffers
5393          * using hwrm_queue_buffers_cfg.
5394          */
5395         uint8_t queue_buffers_cfg_allowed;
5396
5397         /*
5398          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
5399          * the HWRM shall allow the host SW driver to configure PFC using
5400          * hwrm_queue_pfcenable_cfg.
5401          */
5402         uint8_t queue_pfcenable_cfg_allowed;
5403
5404         /*
5405          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
5406          * the HWRM shall allow the host SW driver to configure Priority to CoS
5407          * mapping using hwrm_queue_pri2cos_cfg.
5408          */
5409         uint8_t queue_pri2cos_cfg_allowed;
5410
5411         /*
5412          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
5413          * the HWRM shall allow the host SW driver to configure CoS Bandwidth
5414          * configuration using hwrm_queue_cos2bw_cfg.
5415          */
5416         uint8_t queue_cos2bw_cfg_allowed;
5417
5418         /* ID of CoS Queue 0. FF - Invalid id */
5419         uint8_t queue_id0;
5420
5421         /* This value is applicable to CoS queues only. */
5422                 /* Lossy (best-effort) */
5423         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY \
5424                                                         (UINT32_C(0x0) << 0)
5425                 /* Lossless */
5426         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS \
5427                                                         (UINT32_C(0x1) << 0)
5428                 /*
5429                  * Set to 0xFF... (All Fs) if there is no service profile
5430                  * specified
5431                  */
5432         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_UNKNOWN \
5433                                                         (UINT32_C(0xff) << 0)
5434         uint8_t queue_id0_service_profile;
5435
5436         /* ID of CoS Queue 1. FF - Invalid id */
5437         uint8_t queue_id1;
5438         /* This value is applicable to CoS queues only. */
5439                 /* Lossy (best-effort) */
5440         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSY \
5441                                                         (UINT32_C(0x0) << 0)
5442                 /* Lossless */
5443         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSLESS \
5444                                                         (UINT32_C(0x1) << 0)
5445                 /*
5446                  * Set to 0xFF... (All Fs) if there is no service profile
5447                  * specified
5448                  */
5449         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_UNKNOWN \
5450                                                         (UINT32_C(0xff) << 0)
5451         uint8_t queue_id1_service_profile;
5452
5453         /* ID of CoS Queue 2. FF - Invalid id */
5454         uint8_t queue_id2;
5455         /* This value is applicable to CoS queues only. */
5456                 /* Lossy (best-effort) */
5457         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSY \
5458                                                         (UINT32_C(0x0) << 0)
5459                 /* Lossless */
5460         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSLESS \
5461                                                         (UINT32_C(0x1) << 0)
5462                 /*
5463                  * Set to 0xFF... (All Fs) if there is no service profile
5464                  * specified
5465                  */
5466         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_UNKNOWN \
5467                                                         (UINT32_C(0xff) << 0)
5468         uint8_t queue_id2_service_profile;
5469
5470         /* ID of CoS Queue 3. FF - Invalid id */
5471         uint8_t queue_id3;
5472
5473         /* This value is applicable to CoS queues only. */
5474                 /* Lossy (best-effort) */
5475         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSY \
5476                                                         (UINT32_C(0x0) << 0)
5477                 /* Lossless */
5478         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSLESS \
5479                                                         (UINT32_C(0x1) << 0)
5480                 /*
5481                  * Set to 0xFF... (All Fs) if there is no service profile
5482                  * specified
5483                  */
5484         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_UNKNOWN \
5485                                                         (UINT32_C(0xff) << 0)
5486         uint8_t queue_id3_service_profile;
5487
5488         /* ID of CoS Queue 4. FF - Invalid id */
5489         uint8_t queue_id4;
5490         /* This value is applicable to CoS queues only. */
5491                 /* Lossy (best-effort) */
5492         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSY \
5493                                                         (UINT32_C(0x0) << 0)
5494                 /* Lossless */
5495         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSLESS \
5496                                                         (UINT32_C(0x1) << 0)
5497                 /*
5498                  * Set to 0xFF... (All Fs) if there is no service profile
5499                  * specified
5500                  */
5501         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_UNKNOWN \
5502                                                         (UINT32_C(0xff) << 0)
5503         uint8_t queue_id4_service_profile;
5504
5505         /* ID of CoS Queue 5. FF - Invalid id */
5506         uint8_t queue_id5;
5507
5508         /* This value is applicable to CoS queues only. */
5509                 /* Lossy (best-effort) */
5510         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSY \
5511                                                         (UINT32_C(0x0) << 0)
5512                 /* Lossless */
5513         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSLESS \
5514                                                         (UINT32_C(0x1) << 0)
5515                 /*
5516                  * Set to 0xFF... (All Fs) if there is no service profile
5517                  * specified
5518                  */
5519         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_UNKNOWN \
5520                                                         (UINT32_C(0xff) << 0)
5521         uint8_t queue_id5_service_profile;
5522
5523         /* ID of CoS Queue 6. FF - Invalid id */
5524         uint8_t queue_id6_service_profile;
5525         /* This value is applicable to CoS queues only. */
5526                 /* Lossy (best-effort) */
5527         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSY \
5528                                                         (UINT32_C(0x0) << 0)
5529                 /* Lossless */
5530         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSLESS \
5531                                                         (UINT32_C(0x1) << 0)
5532                 /*
5533                  * Set to 0xFF... (All Fs) if there is no service profile
5534                  * specified
5535                  */
5536         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_UNKNOWN \
5537                                                         (UINT32_C(0xff) << 0)
5538         uint8_t queue_id6;
5539
5540         /* ID of CoS Queue 7. FF - Invalid id */
5541         uint8_t queue_id7;
5542
5543         /* This value is applicable to CoS queues only. */
5544                 /* Lossy (best-effort) */
5545         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSY \
5546                                                         (UINT32_C(0x0) << 0)
5547                 /* Lossless */
5548         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSLESS \
5549                                                         (UINT32_C(0x1) << 0)
5550                 /*
5551                  * Set to 0xFF... (All Fs) if there is no service profile
5552                  * specified
5553                  */
5554         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_UNKNOWN \
5555                                                         (UINT32_C(0xff) << 0)
5556         uint8_t queue_id7_service_profile;
5557
5558         /*
5559          * This field is used in Output records to indicate that the output is
5560          * completely written to RAM. This field should be read as '1' to
5561          * indicate that the output has been completely written. When writing a
5562          * command completion or response to an internal processor, the order of
5563          * writes has to be such that this field is written last.
5564          */
5565         uint8_t valid;
5566 } __attribute__((packed));
5567
5568 /* hwrm_func_drv_rgtr */
5569 /*
5570  * Description: This command is used by the function driver to register its
5571  * information with the HWRM. A function driver shall implement this command. A
5572  * function driver shall use this command during the driver initialization right
5573  * after the HWRM version discovery and default ring resources allocation.
5574  */
5575
5576 /* Input (80 bytes) */
5577 struct hwrm_func_drv_rgtr_input {
5578         /*
5579          * This value indicates what type of request this is. The format for the
5580          * rest of the command is determined by this field.
5581          */
5582         uint16_t req_type;
5583
5584         /*
5585          * This value indicates the what completion ring the request will be
5586          * optionally completed on. If the value is -1, then no CR completion
5587          * will be generated. Any other value must be a valid CR ring_id value
5588          * for this function.
5589          */
5590         uint16_t cmpl_ring;
5591
5592         /* This value indicates the command sequence number. */
5593         uint16_t seq_id;
5594
5595         /*
5596          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
5597          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
5598          */
5599         uint16_t target_id;
5600
5601         /*
5602          * This is the host address where the response will be written when the
5603          * request is complete. This area must be 16B aligned and must be
5604          * cleared to zero before the request is made.
5605          */
5606         uint64_t resp_addr;
5607
5608         /*
5609          * When this bit is '1', the function driver is requesting all requests
5610          * from its children VF drivers to be forwarded to itself. This flag can
5611          * only be set by the PF driver. If a VF driver sets this flag, it
5612          * should be ignored by the HWRM.
5613          */
5614         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_ALL_MODE        UINT32_C(0x1)
5615         /*
5616          * When this bit is '1', the function is requesting none of the requests
5617          * from its children VF drivers to be forwarded to itself. This flag can
5618          * only be set by the PF driver. If a VF driver sets this flag, it
5619          * should be ignored by the HWRM.
5620          */
5621         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE       UINT32_C(0x2)
5622         uint32_t flags;
5623
5624         /* This bit must be '1' for the os_type field to be configured. */
5625         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_OS_TYPE           UINT32_C(0x1)
5626         /* This bit must be '1' for the ver field to be configured. */
5627         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VER               UINT32_C(0x2)
5628         /* This bit must be '1' for the timestamp field to be configured. */
5629         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_TIMESTAMP         UINT32_C(0x4)
5630         /* This bit must be '1' for the vf_req_fwd field to be configured. */
5631         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VF_REQ_FWD        UINT32_C(0x8)
5632         /*
5633          * This bit must be '1' for the async_event_fwd field to be configured.
5634          */
5635         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_ASYNC_EVENT_FWD \
5636                                                                 UINT32_C(0x10)
5637         uint32_t enables;
5638
5639         /* This value indicates the type of OS. */
5640                 /* Unknown */
5641         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_UNKNOWN \
5642                                                         (UINT32_C(0x0) << 0)
5643                 /* Other OS not listed below. */
5644         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_OTHER \
5645                                                         (UINT32_C(0x1) << 0)
5646                 /* MSDOS OS. */
5647         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_MSDOS \
5648                                                         (UINT32_C(0xe) << 0)
5649                 /* Windows OS. */
5650         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WINDOWS \
5651                                                         (UINT32_C(0x12) << 0)
5652                 /* Solaris OS. */
5653         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_SOLARIS \
5654                                                         (UINT32_C(0x1d) << 0)
5655                 /* Linux OS. */
5656         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_LINUX \
5657                                                         (UINT32_C(0x24) << 0)
5658                 /* FreeBSD OS. */
5659         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_FREEBSD \
5660                                                         (UINT32_C(0x2a) << 0)
5661                 /* VMware ESXi OS. */
5662         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_ESXI \
5663                                                         (UINT32_C(0x68) << 0)
5664                 /* Microsoft Windows 8 64-bit OS. */
5665         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN864 \
5666                                                         (UINT32_C(0x73) << 0)
5667                 /* Microsoft Windows Server 2012 R2 OS. */
5668         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN2012R2 \
5669                                                         (UINT32_C(0x74) << 0)
5670         uint16_t os_type;
5671
5672         /* This is the major version of the driver. */
5673         uint8_t ver_maj;
5674
5675         /* This is the minor version of the driver. */
5676         uint8_t ver_min;
5677
5678         /* This is the update version of the driver. */
5679         uint8_t ver_upd;
5680
5681         uint8_t unused_0;
5682         uint16_t unused_1;
5683
5684         /*
5685          * This is a 32-bit timestamp provided by the driver for keep alive. The
5686          * timestamp is in multiples of 1ms.
5687          */
5688         uint32_t timestamp;
5689
5690         uint32_t unused_2;
5691
5692         /*
5693          * This is a 256-bit bit mask provided by the PF driver for letting the
5694          * HWRM know what commands issued by the VF driver to the HWRM should be
5695          * forwarded to the PF driver. Nth bit refers to the Nth req_type.
5696          * Setting Nth bit to 1 indicates that requests from the VF driver with
5697          * req_type equal to N shall be forwarded to the parent PF driver. This
5698          * field is not valid for the VF driver.
5699          */
5700         uint32_t vf_req_fwd[8];
5701
5702         /*
5703          * This is a 256-bit bit mask provided by the function driver (PF or VF
5704          * driver) to indicate the list of asynchronous event completions to be
5705          * forwarded. Nth bit refers to the Nth event_id. Setting Nth bit to 1
5706          * by the function driver shall result in the HWRM forwarding
5707          * asynchronous event completion with event_id equal to N. If all bits
5708          * are set to 0 (value of 0), then the HWRM shall not forward any
5709          * asynchronous event completion to this function driver.
5710          */
5711         uint32_t async_event_fwd[8];
5712 } __attribute__((packed));
5713
5714 /* Output (16 bytes) */
5715
5716 struct hwrm_func_drv_rgtr_output {
5717         /*
5718          * Pass/Fail or error type Note: receiver to verify the in parameters,
5719          * and fail the call with an error when appropriate
5720          */
5721         uint16_t error_code;
5722
5723         /* This field returns the type of original request. */
5724         uint16_t req_type;
5725
5726         /* This field provides original sequence number of the command. */
5727         uint16_t seq_id;
5728
5729         /*
5730          * This field is the length of the response in bytes. The last byte of
5731          * the response is a valid flag that will read as '1' when the command
5732          * has been completely written to memory.
5733          */
5734         uint16_t resp_len;
5735
5736         uint32_t unused_0;
5737         uint8_t unused_1;
5738         uint8_t unused_2;
5739         uint8_t unused_3;
5740
5741         /*
5742          * This field is used in Output records to indicate that the output is
5743          * completely written to RAM. This field should be read as '1' to
5744          * indicate that the output has been completely written. When writing a
5745          * command completion or response to an internal processor, the order of
5746          * writes has to be such that this field is written last.
5747          */
5748         uint8_t valid;
5749 } __attribute__((packed));
5750
5751 /* hwrm_func_drv_unrgtr */
5752 /*
5753  * Description: This command is used by the function driver to un register with
5754  * the HWRM. A function driver shall implement this command. A function driver
5755  * shall use this command during the driver unloading.
5756  */
5757 /* Input (24 bytes) */
5758
5759 struct hwrm_func_drv_unrgtr_input {
5760         /*
5761          * This value indicates what type of request this is. The format for the
5762          * rest of the command is determined by this field.
5763          */
5764         uint16_t req_type;
5765
5766         /*
5767          * This value indicates the what completion ring the request will be
5768          * optionally completed on. If the value is -1, then no CR completion
5769          * will be generated. Any other value must be a valid CR ring_id value
5770          * for this function.
5771          */
5772         uint16_t cmpl_ring;
5773
5774         /* This value indicates the command sequence number. */
5775         uint16_t seq_id;
5776
5777         /*
5778          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
5779          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
5780          */
5781         uint16_t target_id;
5782
5783         /*
5784          * This is the host address where the response will be written when the
5785          * request is complete. This area must be 16B aligned and must be
5786          * cleared to zero before the request is made.
5787          */
5788         uint64_t resp_addr;
5789
5790         /*
5791          * When this bit is '1', the function driver is notifying the HWRM to
5792          * prepare for the shutdown.
5793          */
5794         #define HWRM_FUNC_DRV_UNRGTR_INPUT_FLAGS_PREPARE_FOR_SHUTDOWN \
5795                                                         UINT32_C(0x1)
5796         uint32_t flags;
5797
5798         uint32_t unused_0;
5799 } __attribute__((packed));
5800
5801 /* Output (16 bytes) */
5802 struct hwrm_func_drv_unrgtr_output {
5803         /*
5804          * Pass/Fail or error type Note: receiver to verify the in parameters,
5805          * and fail the call with an error when appropriate
5806          */
5807         uint16_t error_code;
5808
5809         /* This field returns the type of original request. */
5810         uint16_t req_type;
5811
5812         /* This field provides original sequence number of the command. */
5813         uint16_t seq_id;
5814
5815         /*
5816          * This field is the length of the response in bytes. The last byte of
5817          * the response is a valid flag that will read as '1' when the command
5818          * has been completely written to memory.
5819          */
5820         uint16_t resp_len;
5821
5822         uint32_t unused_0;
5823         uint8_t unused_1;
5824         uint8_t unused_2;
5825         uint8_t unused_3;
5826
5827         /*
5828          * This field is used in Output records to indicate that the output is
5829          * completely written to RAM. This field should be read as '1' to
5830          * indicate that the output has been completely written. When writing a
5831          * command completion or response to an internal processor, the order of
5832          * writes has to be such that this field is written last.
5833          */
5834         uint8_t valid;
5835 } __attribute__((packed));
5836
5837 /* hwrm_func_qcfg */
5838 /*
5839  * Description: This command returns the current configuration of a function.
5840  * The input FID value is used to indicate what function is being queried. This
5841  * allows a physical function driver to query virtual functions that are
5842  * children of the physical function. The output FID value is needed to
5843  * configure Rings and MSI-X vectors so their DMA operations appear correctly on
5844  * the PCI bus.
5845  */
5846 /* Input (24 bytes) */
5847 struct hwrm_func_qcfg_input {
5848         /*
5849          * This value indicates what type of request this is. The format for the
5850          * rest of the command is determined by this field.
5851          */
5852         uint16_t req_type;
5853         /*
5854          * This value indicates the what completion ring the request will be
5855          * optionally completed on. If the value is -1, then no CR completion
5856          * will be generated. Any other value must be a valid CR ring_id value
5857          * for this function.
5858          */
5859         uint16_t cmpl_ring;
5860         /* This value indicates the command sequence number. */
5861         uint16_t seq_id;
5862         /*
5863          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
5864          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
5865          */
5866         uint16_t target_id;
5867         /*
5868          * This is the host address where the response will be written when the
5869          * request is complete. This area must be 16B aligned and must be
5870          * cleared to zero before the request is made.
5871          */
5872         uint64_t resp_addr;
5873         /*
5874          * Function ID of the function that is being queried. 0xFF... (All Fs)
5875          * if the query is for the requesting function.
5876          */
5877         uint16_t fid;
5878
5879         uint16_t unused_0[3];
5880 } __attribute__((packed));
5881
5882 /* Output (72 bytes) */
5883 struct hwrm_func_qcfg_output {
5884         /*
5885          * Pass/Fail or error type Note: receiver to verify the in parameters,
5886          * and fail the call with an error when appropriate
5887          */
5888         uint16_t error_code;
5889         /* This field returns the type of original request. */
5890         uint16_t req_type;
5891         /* This field provides original sequence number of the command. */
5892         uint16_t seq_id;
5893         /*
5894          * This field is the length of the response in bytes. The last byte of
5895          * the response is a valid flag that will read as '1' when the command
5896          * has been completely written to memory.
5897          */
5898         uint16_t resp_len;
5899         /*
5900          * FID value. This value is used to identify operations on the PCI bus
5901          * as belonging to a particular PCI function.
5902          */
5903         uint16_t fid;
5904         /*
5905          * Port ID of port that this function is associated with. 0xFF... (All
5906          * Fs) if this function is not associated with any port.
5907          */
5908         uint16_t port_id;
5909         /*
5910          * This value is the current VLAN setting for this function. The value
5911          * of 0 for this field indicates no priority tagging or VLAN is used.
5912          * This VLAN is in 802.1Q tag format.
5913         */
5914         uint16_t vlan;
5915
5916         uint8_t unused_0;
5917         uint8_t unused_1;
5918
5919         /*
5920          * This value is current MAC address configured for this function. A
5921          * value of 00-00-00-00-00-00 indicates no MAC address is currently
5922          * configured.
5923          */
5924         uint8_t mac_address[6];
5925
5926         /*
5927          * This value is current PCI ID of this function. If ARI is enabled,
5928          * then it is Bus Number (8b):Function Number(8b). Otherwise, it is Bus
5929          * Number (8b):Device Number (4b):Function Number(4b).
5930          */
5931         uint16_t pci_id;
5932         /* The number of RSS/COS contexts currently allocated to the function. */
5933         uint16_t alloc_rsscos_ctx;
5934         /*
5935          * The number of completion rings currently allocated to the function.
5936          * This does not include the rings allocated to any children functions
5937          * if any.
5938          */
5939         uint16_t alloc_cmpl_rings;
5940         /*
5941          * The number of transmit rings currently allocated to the function.
5942          * This does not include the rings allocated to any children functions
5943          * if any.
5944          */
5945         uint16_t alloc_tx_rings;
5946         /*
5947          * The number of receive rings currently allocated to the function. This
5948          * does not include the rings allocated to any children functions if
5949          * any.
5950          */
5951         uint16_t alloc_rx_rings;
5952         /* The allocated number of L2 contexts to the function. */
5953         uint16_t alloc_l2_ctx;
5954         /* The allocated number of vnics to the function. */
5955         uint16_t alloc_vnics;
5956         /*
5957          * The maximum transmission unit of the function. For rings allocated on
5958          * this function, this default value is used if ring MTU is not
5959          * specified.
5960          */
5961         uint16_t mtu;
5962         /*
5963          * The maximum receive unit of the function. For vnics allocated on this
5964          * function, this default value is used if vnic MRU is not specified.
5965          */
5966         uint16_t mru;
5967         /* The statistics context assigned to a function. */
5968         uint16_t stat_ctx_id;
5969         /*
5970          * The HWRM shall return Unknown value for this field when this command
5971          * is used to query VF's configuration.
5972          */
5973         /* Single physical function */
5974         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_SPF \
5975                                                         (UINT32_C(0x0) << 0)
5976         /* Multiple physical functions */
5977         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_MPFS \
5978                                                         (UINT32_C(0x1) << 0)
5979         /* Network Partitioning 1.0 */
5980         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_0 \
5981                                                         (UINT32_C(0x2) << 0)
5982         /* Network Partitioning 1.5 */
5983         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_5 \
5984                                                         (UINT32_C(0x3) << 0)
5985         /* Network Partitioning 2.0 */
5986         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR2_0 \
5987                                                         (UINT32_C(0x4) << 0)
5988         /* Unknown */
5989         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_UNKNOWN \
5990                                                         (UINT32_C(0xff) << 0)
5991         uint8_t port_partition_type;
5992
5993         uint8_t unused_2;
5994         /* The default VNIC ID assigned to a function that is being queried. */
5995         uint16_t dflt_vnic_id;
5996
5997         uint8_t unused_3;
5998         uint8_t unused_4;
5999         /*
6000          * Minimum BW allocated for this function in Mbps. The HWRM will
6001          * translate this value into byte counter and time interval used for the
6002          * scheduler inside the device. A value of 0 indicates the minimum
6003          * bandwidth is not configured.
6004          */
6005         uint32_t min_bw;
6006         /*
6007          * Maximum BW allocated for this function in Mbps. The HWRM will
6008          * translate this value into byte counter and time interval used for the
6009          * scheduler inside the device. A value of 0 indicates that the maximum
6010          * bandwidth is not configured.
6011          */
6012         uint32_t max_bw;
6013         /*
6014          * This value indicates the Edge virtual bridge mode for the domain that
6015          * this function belongs to.
6016          */
6017         /* No Edge Virtual Bridging (EVB) */
6018         #define HWRM_FUNC_QCFG_OUTPUT_EVB_MODE_NO_EVB   (UINT32_C(0x0) << 0)
6019         /* Virtual Ethernet Bridge (VEB) */
6020         #define HWRM_FUNC_QCFG_OUTPUT_EVB_MODE_VEB      (UINT32_C(0x1) << 0)
6021         /* Virtual Ethernet Port Aggregator (VEPA) */
6022         #define HWRM_FUNC_QCFG_OUTPUT_EVB_MODE_VEPA     (UINT32_C(0x2) << 0)
6023         uint8_t evb_mode;
6024
6025         uint8_t unused_5;
6026         uint16_t unused_6;
6027         /*
6028          * The number of allocated multicast filters for this function on the RX
6029          * side.
6030          */
6031         uint32_t alloc_mcast_filters;
6032         /* The number of allocated HW ring groups for this function. */
6033         uint32_t alloc_hw_ring_grps;
6034
6035         uint8_t unused_7;
6036         uint8_t unused_8;
6037         uint8_t unused_9;
6038         /*
6039          * This field is used in Output records to indicate that the output is
6040          * completely written to RAM. This field should be read as '1' to
6041          * indicate that the output has been completely written. When writing a
6042          * command completion or response to an internal processor, the order of
6043          * writes has to be such that this field is written last.
6044          */
6045         uint8_t valid;
6046 } __attribute__((packed));
6047 #endif