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