net/bnxt: convert to SPDX license tag
[dpdk.git] / drivers / net / bnxt / hsi_struct_def_dpdk.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2001-2018 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _HSI_STRUCT_DEF_DPDK_
7 #define _HSI_STRUCT_DEF_DPDK_
8 /* HSI and HWRM Specification 1.8.2 */
9 #define HWRM_VERSION_MAJOR      1
10 #define HWRM_VERSION_MINOR      8
11 #define HWRM_VERSION_UPDATE     2
12
13 #define HWRM_VERSION_RSVD       0 /* non-zero means beta version */
14
15 #define HWRM_VERSION_STR        "1.8.2.0"
16 /*
17  * Following is the signature for HWRM message field that indicates not
18  * applicable   (All F's). Need to cast it the size of the field if needed.
19  */
20 #define HWRM_NA_SIGNATURE       ((uint32_t)(-1))
21 #define HWRM_MAX_REQ_LEN        (128)  /* hwrm_func_buf_rgtr */
22 #define HWRM_MAX_RESP_LEN       (280)  /* hwrm_selftest_qlist */
23 #define HW_HASH_INDEX_SIZE       0x80   /* 7 bit indirection table index. */
24 #define HW_HASH_KEY_SIZE        40
25 #define HWRM_RESP_VALID_KEY     1 /* valid key for HWRM response */
26 #define HWRM_ROCE_SP_HSI_VERSION_MAJOR  1
27 #define HWRM_ROCE_SP_HSI_VERSION_MINOR  8
28 #define HWRM_ROCE_SP_HSI_VERSION_UPDATE 2
29
30 /*
31  * Request types
32  */
33 #define HWRM_VER_GET                    (UINT32_C(0x0))
34 #define HWRM_FUNC_BUF_UNRGTR            (UINT32_C(0xe))
35 #define HWRM_FUNC_VF_CFG                (UINT32_C(0xf))
36     /* Reserved for future use */
37 #define RESERVED1                       (UINT32_C(0x10))
38 #define HWRM_FUNC_RESET                 (UINT32_C(0x11))
39 #define HWRM_FUNC_GETFID                (UINT32_C(0x12))
40 #define HWRM_FUNC_VF_ALLOC              (UINT32_C(0x13))
41 #define HWRM_FUNC_VF_FREE               (UINT32_C(0x14))
42 #define HWRM_FUNC_QCAPS                 (UINT32_C(0x15))
43 #define HWRM_FUNC_QCFG                  (UINT32_C(0x16))
44 #define HWRM_FUNC_CFG                   (UINT32_C(0x17))
45 #define HWRM_FUNC_QSTATS                (UINT32_C(0x18))
46 #define HWRM_FUNC_CLR_STATS             (UINT32_C(0x19))
47 #define HWRM_FUNC_DRV_UNRGTR            (UINT32_C(0x1a))
48 #define HWRM_FUNC_VF_RESC_FREE          (UINT32_C(0x1b))
49 #define HWRM_FUNC_VF_VNIC_IDS_QUERY     (UINT32_C(0x1c))
50 #define HWRM_FUNC_DRV_RGTR              (UINT32_C(0x1d))
51 #define HWRM_FUNC_DRV_QVER              (UINT32_C(0x1e))
52 #define HWRM_FUNC_BUF_RGTR              (UINT32_C(0x1f))
53 #define HWRM_PORT_PHY_CFG               (UINT32_C(0x20))
54 #define HWRM_PORT_MAC_CFG               (UINT32_C(0x21))
55 #define HWRM_PORT_QSTATS                (UINT32_C(0x23))
56 #define HWRM_PORT_LPBK_QSTATS           (UINT32_C(0x24))
57 #define HWRM_PORT_CLR_STATS             (UINT32_C(0x25))
58 #define HWRM_PORT_PHY_QCFG              (UINT32_C(0x27))
59 #define HWRM_PORT_MAC_QCFG              (UINT32_C(0x28))
60 #define HWRM_PORT_MAC_PTP_QCFG          (UINT32_C(0x29))
61 #define HWRM_PORT_PHY_QCAPS             (UINT32_C(0x2a))
62 #define HWRM_PORT_LED_CFG               (UINT32_C(0x2d))
63 #define HWRM_PORT_LED_QCFG              (UINT32_C(0x2e))
64 #define HWRM_PORT_LED_QCAPS             (UINT32_C(0x2f))
65 #define HWRM_QUEUE_QPORTCFG             (UINT32_C(0x30))
66 #define HWRM_QUEUE_QCFG                 (UINT32_C(0x31))
67 #define HWRM_QUEUE_CFG                  (UINT32_C(0x32))
68 #define HWRM_FUNC_VLAN_CFG              (UINT32_C(0x33))
69 #define HWRM_FUNC_VLAN_QCFG             (UINT32_C(0x34))
70 #define HWRM_QUEUE_PFCENABLE_QCFG       (UINT32_C(0x35))
71 #define HWRM_QUEUE_PFCENABLE_CFG        (UINT32_C(0x36))
72 #define HWRM_QUEUE_PRI2COS_QCFG         (UINT32_C(0x37))
73 #define HWRM_QUEUE_PRI2COS_CFG          (UINT32_C(0x38))
74 #define HWRM_QUEUE_COS2BW_QCFG          (UINT32_C(0x39))
75 #define HWRM_QUEUE_COS2BW_CFG           (UINT32_C(0x3a))
76 #define HWRM_VNIC_ALLOC                 (UINT32_C(0x40))
77 #define HWRM_VNIC_ALLOC                 (UINT32_C(0x40))
78 #define HWRM_VNIC_FREE                  (UINT32_C(0x41))
79 #define HWRM_VNIC_CFG                   (UINT32_C(0x42))
80 #define HWRM_VNIC_QCFG                  (UINT32_C(0x43))
81 #define HWRM_VNIC_TPA_CFG               (UINT32_C(0x44))
82 #define HWRM_VNIC_RSS_CFG               (UINT32_C(0x46))
83 #define HWRM_VNIC_RSS_QCFG              (UINT32_C(0x47))
84 #define HWRM_VNIC_PLCMODES_CFG          (UINT32_C(0x48))
85 #define HWRM_VNIC_PLCMODES_QCFG         (UINT32_C(0x49))
86 #define HWRM_VNIC_QCAPS                 (UINT32_C(0x4a))
87 #define HWRM_RING_ALLOC                 (UINT32_C(0x50))
88 #define HWRM_RING_FREE                  (UINT32_C(0x51))
89 #define HWRM_RING_CMPL_RING_QAGGINT_PARAMS      (UINT32_C(0x52))
90 #define HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS   (UINT32_C(0x53))
91 #define HWRM_RING_RESET                 (UINT32_C(0x5e))
92 #define HWRM_RING_GRP_ALLOC             (UINT32_C(0x60))
93 #define HWRM_RING_GRP_FREE              (UINT32_C(0x61))
94 #define HWRM_VNIC_RSS_COS_LB_CTX_ALLOC  (UINT32_C(0x70))
95 #define HWRM_VNIC_RSS_COS_LB_CTX_FREE   (UINT32_C(0x71))
96 #define HWRM_CFA_L2_FILTER_ALLOC        (UINT32_C(0x90))
97 #define HWRM_CFA_L2_FILTER_FREE         (UINT32_C(0x91))
98 #define HWRM_CFA_L2_FILTER_CFG          (UINT32_C(0x92))
99 #define HWRM_CFA_L2_SET_RX_MASK         (UINT32_C(0x93))
100     /* Reserved for future use */
101 #define HWRM_CFA_VLAN_ANTISPOOF_CFG     (UINT32_C(0x94))
102 #define HWRM_CFA_TUNNEL_FILTER_ALLOC    (UINT32_C(0x95))
103 #define HWRM_CFA_TUNNEL_FILTER_FREE     (UINT32_C(0x96))
104 #define HWRM_CFA_NTUPLE_FILTER_ALLOC    (UINT32_C(0x99))
105 #define HWRM_CFA_NTUPLE_FILTER_FREE     (UINT32_C(0x9a))
106 #define HWRM_CFA_NTUPLE_FILTER_CFG      (UINT32_C(0x9b))
107 #define HWRM_CFA_EM_FLOW_ALLOC          (UINT32_C(0x9c))
108 #define HWRM_CFA_EM_FLOW_FREE           (UINT32_C(0x9d))
109 #define HWRM_CFA_EM_FLOW_CFG            (UINT32_C(0x9e))
110 #define HWRM_TUNNEL_DST_PORT_QUERY      (UINT32_C(0xa0))
111 #define HWRM_TUNNEL_DST_PORT_ALLOC      (UINT32_C(0xa1))
112 #define HWRM_TUNNEL_DST_PORT_FREE       (UINT32_C(0xa2))
113 #define HWRM_STAT_CTX_ALLOC             (UINT32_C(0xb0))
114 #define HWRM_STAT_CTX_FREE              (UINT32_C(0xb1))
115 #define HWRM_STAT_CTX_QUERY             (UINT32_C(0xb2))
116 #define HWRM_STAT_CTX_CLR_STATS         (UINT32_C(0xb3))
117 #define HWRM_FW_RESET                   (UINT32_C(0xc0))
118 #define HWRM_FW_QSTATUS                 (UINT32_C(0xc1))
119 #define HWRM_EXEC_FWD_RESP              (UINT32_C(0xd0))
120 #define HWRM_REJECT_FWD_RESP            (UINT32_C(0xd1))
121 #define HWRM_FWD_RESP                   (UINT32_C(0xd2))
122 #define HWRM_FWD_ASYNC_EVENT_CMPL       (UINT32_C(0xd3))
123 #define HWRM_TEMP_MONITOR_QUERY         (UINT32_C(0xe0))
124 #define HWRM_WOL_FILTER_ALLOC           (UINT32_C(0xf0))
125 #define HWRM_WOL_FILTER_FREE            (UINT32_C(0xf1))
126 #define HWRM_WOL_FILTER_QCFG            (UINT32_C(0xf2))
127 #define HWRM_WOL_REASON_QCFG            (UINT32_C(0xf3))
128 #define HWRM_DBG_DUMP                   (UINT32_C(0xff14))
129 #define HWRM_NVM_VALIDATE_OPTION        (UINT32_C(0xffef))
130 #define HWRM_NVM_FLUSH                  (UINT32_C(0xfff0))
131 #define HWRM_NVM_GET_VARIABLE           (UINT32_C(0xfff1))
132 #define HWRM_NVM_SET_VARIABLE           (UINT32_C(0xfff2))
133 #define HWRM_NVM_INSTALL_UPDATE         (UINT32_C(0xfff3))
134 #define HWRM_NVM_MODIFY                 (UINT32_C(0xfff4))
135 #define HWRM_NVM_VERIFY_UPDATE          (UINT32_C(0xfff5))
136 #define HWRM_NVM_GET_DEV_INFO           (UINT32_C(0xfff6))
137 #define HWRM_NVM_ERASE_DIR_ENTRY        (UINT32_C(0xfff7))
138 #define HWRM_NVM_MOD_DIR_ENTRY          (UINT32_C(0xfff8))
139 #define HWRM_NVM_FIND_DIR_ENTRY         (UINT32_C(0xfff9))
140 #define HWRM_NVM_GET_DIR_ENTRIES        (UINT32_C(0xfffa))
141 #define HWRM_NVM_GET_DIR_INFO           (UINT32_C(0xfffb))
142 #define HWRM_NVM_RAW_DUMP               (UINT32_C(0xfffc))
143 #define HWRM_NVM_READ                   (UINT32_C(0xfffd))
144 #define HWRM_NVM_WRITE                  (UINT32_C(0xfffe))
145 #define HWRM_NVM_RAW_WRITE_BLK          (UINT32_C(0xffff))
146
147 /*
148  * Note: The Host Software Interface (HSI) and Hardware Resource Manager (HWRM)
149  * specification describes the data structures used in Ethernet packet or RDMA
150  * message data transfers as well as an abstract interface for managing Ethernet
151  * NIC hardware resources.
152  */
153 /* Ethernet Data path Host Structures */
154 /*
155  * Description: The following three sections document the host structures used
156  * between device and software drivers for communicating Ethernet packets.
157  */
158 /* BD Ring Structures */
159 /*
160  * Description: This structure is used to inform the NIC of a location for and
161  * an aggregation buffer that will be used for packet data that is received. An
162  * aggregation buffer creates a different kind of completion operation for a
163  * packet where a variable number of BDs may be used to place the packet in the
164  * host. RX Rings that have aggregation buffers are known as aggregation rings
165  * and must contain only aggregation buffers.
166  */
167 /* Short TX BD  (16 bytes) */
168 struct tx_bd_short {
169         uint16_t flags_type;
170         /*
171          * All bits in this field must be valid on the first BD of a
172          * packet. Only the packet_end bit must be valid for the
173          * remaining BDs of a packet.
174          */
175         /* This value identifies the type of buffer descriptor. */
176         #define TX_BD_SHORT_TYPE_MASK   UINT32_C(0x3f)
177         #define TX_BD_SHORT_TYPE_SFT    0
178         /*
179          * Indicates that this BD is 16B long and is
180          * used for normal L2 packet transmission.
181          */
182         #define TX_BD_SHORT_TYPE_TX_BD_SHORT    UINT32_C(0x0)
183         /*
184          * If set to 1, the packet ends with the data in the buffer
185          * pointed to by this descriptor. This flag must be valid on
186          * every BD.
187          */
188         #define TX_BD_SHORT_FLAGS_PACKET_END    UINT32_C(0x40)
189         /*
190          * If set to 1, the device will not generate a completion for
191          * this transmit packet unless there is an error in it's
192          * processing. If this bit is set to 0, then the packet will be
193          * completed normally. This bit must be valid only on the first
194          * BD of a packet.
195          */
196         #define TX_BD_SHORT_FLAGS_NO_CMPL       UINT32_C(0x80)
197         /*
198          * This value indicates how many 16B BD locations are consumed
199          * in the ring by this packet. A value of 1 indicates that this
200          * BD is the only BD    (and that the it is a short BD). A value of
201          * 3 indicates either 3 short BDs or 1 long BD and one short BD
202          * in the packet. A value of 0 indicates that there are 32 BD
203          * locations in the packet      (the maximum). This field is valid
204          * only on the first BD of a packet.
205          */
206         #define TX_BD_SHORT_FLAGS_BD_CNT_MASK   UINT32_C(0x1f00)
207         #define TX_BD_SHORT_FLAGS_BD_CNT_SFT    8
208         /*
209          * This value is a hint for the length of the entire packet. It
210          * is used by the chip to optimize internal processing. The
211          * packet will be dropped if the hint is too short. This field
212          * is valid only on the first BD of a packet.
213          */
214         #define TX_BD_SHORT_FLAGS_LHINT_MASK    UINT32_C(0x6000)
215         #define TX_BD_SHORT_FLAGS_LHINT_SFT     13
216         /* indicates packet length < 512B */
217         #define TX_BD_SHORT_FLAGS_LHINT_LT512   (UINT32_C(0x0) << 13)
218         /* indicates 512 <= packet length < 1KB */
219         #define TX_BD_SHORT_FLAGS_LHINT_LT1K    (UINT32_C(0x1) << 13)
220         /* indicates 1KB <= packet length < 2KB */
221         #define TX_BD_SHORT_FLAGS_LHINT_LT2K    (UINT32_C(0x2) << 13)
222         /* indicates packet length >= 2KB */
223         #define TX_BD_SHORT_FLAGS_LHINT_GTE2K   (UINT32_C(0x3) << 13)
224         #define TX_BD_SHORT_FLAGS_LHINT_LAST \
225                 TX_BD_SHORT_FLAGS_LHINT_GTE2K
226         /*
227          * If set to 1, the device immediately updates the Send Consumer
228          * Index after the buffer associated with this descriptor has
229          * been transferred via DMA to NIC memory from host memory. An
230          * interrupt may or may not be generated according to the state
231          * of the interrupt avoidance mechanisms. If this bit is set to
232          * 0, then the Consumer Index is only updated as soon as one of
233          * the host interrupt coalescing conditions has been met. This
234          * bit must be valid on the first BD of a packet.
235          */
236         #define TX_BD_SHORT_FLAGS_COAL_NOW      UINT32_C(0x8000)
237         /*
238          * All bits in this field must be valid on the first BD of a
239          * packet. Only the packet_end bit must be valid for the
240          * remaining BDs of a packet.
241          */
242         #define TX_BD_SHORT_FLAGS_MASK  UINT32_C(0xffc0)
243         #define TX_BD_SHORT_FLAGS_SFT   6
244         uint16_t len;
245         /*
246          * This is the length of the host physical buffer this BD
247          * describes in bytes. This field must be valid on all BDs of a
248          * packet.
249          */
250         uint32_t opaque;
251         /*
252          * The opaque data field is pass through to the completion and
253          * can be used for any data that the driver wants to associate
254          * with the transmit BD. This field must be valid on the first
255          * BD of a packet.
256          */
257         uint64_t addr;
258         /*
259          * This is the host physical address for the portion of the
260          * packet described by this TX BD. This value must be valid on
261          * all BDs of a packet.
262          */
263 } __attribute__((packed));
264
265 /* Long TX BD   (32 bytes split to 2 16-byte struct) */
266 struct tx_bd_long {
267         uint16_t flags_type;
268         /*
269          * All bits in this field must be valid on the first BD of a
270          * packet. Only the packet_end bit must be valid for the
271          * remaining BDs of a packet.
272          */
273         /* This value identifies the type of buffer descriptor. */
274         #define TX_BD_LONG_TYPE_MASK    UINT32_C(0x3f)
275         #define TX_BD_LONG_TYPE_SFT     0
276         /*
277          * Indicates that this BD is 32B long and is
278          * used for normal L2 packet transmission.
279          */
280         #define TX_BD_LONG_TYPE_TX_BD_LONG      UINT32_C(0x10)
281         /*
282          * If set to 1, the packet ends with the data in the buffer
283          * pointed to by this descriptor. This flag must be valid on
284          * every BD.
285          */
286         #define TX_BD_LONG_FLAGS_PACKET_END     UINT32_C(0x40)
287         /*
288          * If set to 1, the device will not generate a completion for
289          * this transmit packet unless there is an error in it's
290          * processing. If this bit is set to 0, then the packet will be
291          * completed normally. This bit must be valid only on the first
292          * BD of a packet.
293          */
294         #define TX_BD_LONG_FLAGS_NO_CMPL        UINT32_C(0x80)
295         /*
296          * This value indicates how many 16B BD locations are consumed
297          * in the ring by this packet. A value of 1 indicates that this
298          * BD is the only BD    (and that the it is a short BD). A value of
299          * 3 indicates either 3 short BDs or 1 long BD and one short BD
300          * in the packet. A value of 0 indicates that there are 32 BD
301          * locations in the packet      (the maximum). This field is valid
302          * only on the first BD of a packet.
303          */
304         #define TX_BD_LONG_FLAGS_BD_CNT_MASK    UINT32_C(0x1f00)
305         #define TX_BD_LONG_FLAGS_BD_CNT_SFT     8
306         /*
307          * This value is a hint for the length of the entire packet. It
308          * is used by the chip to optimize internal processing. The
309          * packet will be dropped if the hint is too short. This field
310          * is valid only on the first BD of a packet.
311          */
312         #define TX_BD_LONG_FLAGS_LHINT_MASK     UINT32_C(0x6000)
313         #define TX_BD_LONG_FLAGS_LHINT_SFT      13
314         /* indicates packet length < 512B */
315         #define TX_BD_LONG_FLAGS_LHINT_LT512    (UINT32_C(0x0) << 13)
316         /* indicates 512 <= packet length < 1KB */
317         #define TX_BD_LONG_FLAGS_LHINT_LT1K     (UINT32_C(0x1) << 13)
318         /* indicates 1KB <= packet length < 2KB */
319         #define TX_BD_LONG_FLAGS_LHINT_LT2K     (UINT32_C(0x2) << 13)
320         /* indicates packet length >= 2KB */
321         #define TX_BD_LONG_FLAGS_LHINT_GTE2K    (UINT32_C(0x3) << 13)
322         #define TX_BD_LONG_FLAGS_LHINT_LAST \
323                 TX_BD_LONG_FLAGS_LHINT_GTE2K
324         /*
325          * If set to 1, the device immediately updates the Send Consumer
326          * Index after the buffer associated with this descriptor has
327          * been transferred via DMA to NIC memory from host memory. An
328          * interrupt may or may not be generated according to the state
329          * of the interrupt avoidance mechanisms. If this bit is set to
330          * 0, then the Consumer Index is only updated as soon as one of
331          * the host interrupt coalescing conditions has been met. This
332          * bit must be valid on the first BD of a packet.
333          */
334         #define TX_BD_LONG_FLAGS_COAL_NOW       UINT32_C(0x8000)
335         /*
336          * All bits in this field must be valid on the first BD of a
337          * packet. Only the packet_end bit must be valid for the
338          * remaining BDs of a packet.
339          */
340         #define TX_BD_LONG_FLAGS_MASK   UINT32_C(0xffc0)
341         #define TX_BD_LONG_FLAGS_SFT    6
342         uint16_t len;
343         /*
344          * This is the length of the host physical buffer this BD
345          * describes in bytes. This field must be valid on all BDs of a
346          * packet.
347          */
348         uint32_t opaque;
349         /*
350          * The opaque data field is pass through to the completion and
351          * can be used for any data that the driver wants to associate
352          * with the transmit BD. This field must be valid on the first
353          * BD of a packet.
354          */
355         uint64_t addr;
356         /*
357          * This is the host physical address for the portion of the
358          * packet described by this TX BD. This value must be valid on
359          * all BDs of a packet.
360          */
361 } __attribute__((packed));
362
363 /* last 16 bytes of Long TX BD */
364 struct tx_bd_long_hi {
365         uint16_t lflags;
366         /*
367          * All bits in this field must be valid on the first BD of a
368          * packet. Their value on other BDs of the packet will be
369          * ignored.
370          */
371         /*
372          * If set to 1, the controller replaces the TCP/UPD checksum
373          * fields of normal TCP/UPD checksum, or the inner TCP/UDP
374          * checksum field of the encapsulated TCP/UDP packets with the
375          * hardware calculated TCP/UDP checksum for the packet
376          * associated with this descriptor. The flag is ignored if the
377          * LSO flag is set. This bit must be valid on the first BD of a
378          * packet.
379          */
380         #define TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM        UINT32_C(0x1)
381         /*
382          * If set to 1, the controller replaces the IP checksum of the
383          * normal packets, or the inner IP checksum of the encapsulated
384          * packets with the hardware calculated IP checksum for the
385          * packet associated with this descriptor. This bit must be
386          * valid on the first BD of a packet.
387          */
388         #define TX_BD_LONG_LFLAGS_IP_CHKSUM     UINT32_C(0x2)
389         /*
390          * If set to 1, the controller will not append an Ethernet CRC
391          * to the end of the frame. This bit must be valid on the first
392          * BD of a packet. Packet must be 64B or longer when this flag
393          * is set. It is not useful to use this bit with any form of TX
394          * offload such as CSO or LSO. The intent is that the packet
395          * from the host already has a valid Ethernet CRC on the packet.
396          */
397         #define TX_BD_LONG_LFLAGS_NOCRC UINT32_C(0x4)
398         /*
399          * If set to 1, the device will record the time at which the
400          * packet was actually transmitted at the TX MAC. This bit must
401          * be valid on the first BD of a packet.
402          */
403         #define TX_BD_LONG_LFLAGS_STAMP UINT32_C(0x8)
404         /*
405          * If set to 1, The controller replaces the tunnel IP checksum
406          * field with hardware calculated IP checksum for the IP header
407          * of the packet associated with this descriptor. For outer UDP
408          * checksum, global outer UDP checksum TE_NIC register needs to
409          * be enabled. If the global outer UDP checksum TE_NIC register
410          * bit is set, outer UDP checksum will be calculated for the
411          * following cases: 1. Packets with tcp_udp_chksum flag set to
412          * offload checksum for inner packet AND the inner packet is
413          * TCP/UDP. If the inner packet is ICMP for example     (non-
414          * TCP/UDP), even if the tcp_udp_chksum is set, the outer UDP
415          * checksum will not be calculated. 2. Packets with lso flag set
416          * which implies inner TCP checksum calculation as part of LSO
417          * operation.
418          */
419         #define TX_BD_LONG_LFLAGS_T_IP_CHKSUM   UINT32_C(0x10)
420         /*
421          * If set to 1, the device will treat this packet with LSO(Large
422          * Send Offload) processing for both normal or encapsulated
423          * packets, which is a form of TCP segmentation. When this bit
424          * is 1, the hdr_size and mss fields must be valid. The driver
425          * doesn't need to set t_ip_chksum, ip_chksum, and
426          * tcp_udp_chksum flags since the controller will replace the
427          * appropriate checksum fields for segmented packets. When this
428          * bit is 1, the hdr_size and mss fields must be valid.
429          */
430         #define TX_BD_LONG_LFLAGS_LSO   UINT32_C(0x20)
431         /*
432          * If set to zero when LSO is '1', then the IPID will be treated
433          * as a 16b number and will be wrapped if it exceeds a value of
434          * 0xffff. If set to one when LSO is '1', then the IPID will be
435          * treated as a 15b number and will be wrapped if it exceeds a
436          * value 0f 0x7fff.
437          */
438         #define TX_BD_LONG_LFLAGS_IPID_FMT      UINT32_C(0x40)
439         /*
440          * If set to zero when LSO is '1', then the IPID of the tunnel
441          * IP header will not be modified during LSO operations. If set
442          * to one when LSO is '1', then the IPID of the tunnel IP header
443          * will be incremented for each subsequent segment of an LSO
444          * operation. The flag is ignored if the LSO packet is a normal
445          *      (non-tunneled) TCP packet.
446          */
447         #define TX_BD_LONG_LFLAGS_T_IPID        UINT32_C(0x80)
448         /*
449          * If set to '1', then the RoCE ICRC will be appended to the
450          * packet. Packet must be a valid RoCE format packet.
451          */
452         #define TX_BD_LONG_LFLAGS_ROCE_CRC      UINT32_C(0x100)
453         /*
454          * If set to '1', then the FCoE CRC will be appended to the
455          * packet. Packet must be a valid FCoE format packet.
456          */
457         #define TX_BD_LONG_LFLAGS_FCOE_CRC      UINT32_C(0x200)
458         uint16_t hdr_size;
459         /*
460          * When LSO is '1', this field must contain the offset of the
461          * TCP payload from the beginning of the packet in as 16b words.
462          * In case of encapsulated/tunneling packet, this field contains
463          * the offset of the inner TCP payload from beginning of the
464          * packet as 16-bit words. This value must be valid on the first
465          * BD of a packet.
466          */
467         #define TX_BD_LONG_HDR_SIZE_MASK        UINT32_C(0x1ff)
468         #define TX_BD_LONG_HDR_SIZE_SFT 0
469         uint32_t mss;
470         /*
471          * This is the MSS value that will be used to do the LSO
472          * processing. The value is the length in bytes of the TCP
473          * payload for each segment generated by the LSO operation. This
474          * value must be valid on the first BD of a packet.
475          */
476         #define TX_BD_LONG_MSS_MASK     UINT32_C(0x7fff)
477         #define TX_BD_LONG_MSS_SFT      0
478         uint16_t unused_2;
479         uint16_t cfa_action;
480         /*
481          * This value selects a CFA action to perform on the packet. Set
482          * this value to zero if no CFA action is desired. This value
483          * must be valid on the first BD of a packet.
484          */
485         uint32_t cfa_meta;
486         /*
487          * This value is action meta-data that defines CFA edit
488          * operations that are done in addition to any action editing.
489          */
490         /* When key=1, This is the VLAN tag VID value. */
491         #define TX_BD_LONG_CFA_META_VLAN_VID_MASK       UINT32_C(0xfff)
492         #define TX_BD_LONG_CFA_META_VLAN_VID_SFT        0
493         /* When key=1, This is the VLAN tag DE value. */
494         #define TX_BD_LONG_CFA_META_VLAN_DE     UINT32_C(0x1000)
495         /* When key=1, This is the VLAN tag PRI value. */
496         #define TX_BD_LONG_CFA_META_VLAN_PRI_MASK       UINT32_C(0xe000)
497         #define TX_BD_LONG_CFA_META_VLAN_PRI_SFT        13
498         /* When key=1, This is the VLAN tag TPID select value. */
499         #define TX_BD_LONG_CFA_META_VLAN_TPID_MASK      UINT32_C(0x70000)
500         #define TX_BD_LONG_CFA_META_VLAN_TPID_SFT       16
501         /* 0x88a8 */
502         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID88A8  (UINT32_C(0x0) << 16)
503         /* 0x8100 */
504         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100  (UINT32_C(0x1) << 16)
505         /* 0x9100 */
506         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9100  (UINT32_C(0x2) << 16)
507         /* 0x9200 */
508         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9200  (UINT32_C(0x3) << 16)
509         /* 0x9300 */
510         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9300  (UINT32_C(0x4) << 16)
511         /* Value programmed in CFA VLANTPID register. */
512         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPIDCFG   (UINT32_C(0x5) << 16)
513         #define TX_BD_LONG_CFA_META_VLAN_TPID_LAST \
514                 TX_BD_LONG_CFA_META_VLAN_TPID_TPIDCFG
515         /* When key=1, This is the VLAN tag TPID select value. */
516         #define TX_BD_LONG_CFA_META_VLAN_RESERVED_MASK  UINT32_C(0xff80000)
517         #define TX_BD_LONG_CFA_META_VLAN_RESERVED_SFT   19
518         /*
519          * This field identifies the type of edit to be performed on the
520          * packet. This value must be valid on the first BD of a packet.
521          */
522         #define TX_BD_LONG_CFA_META_KEY_MASK    UINT32_C(0xf0000000)
523         #define TX_BD_LONG_CFA_META_KEY_SFT     28
524         /* No editing */
525         #define TX_BD_LONG_CFA_META_KEY_NONE    (UINT32_C(0x0) << 28)
526         /*
527          * - meta[17:16] - TPID select value    (0 =
528          * 0x8100). - meta[15:12] - PRI/DE value. -
529          * meta[11:0] - VID value.
530          */
531         #define TX_BD_LONG_CFA_META_KEY_VLAN_TAG        (UINT32_C(0x1) << 28)
532         #define TX_BD_LONG_CFA_META_KEY_LAST \
533                 TX_BD_LONG_CFA_META_KEY_VLAN_TAG
534 } __attribute__((packed));
535
536 /* RX Producer Packet BD        (16 bytes) */
537 struct rx_prod_pkt_bd {
538         uint16_t flags_type;
539         /* This value identifies the type of buffer descriptor. */
540         #define RX_PROD_PKT_BD_TYPE_MASK        UINT32_C(0x3f)
541         #define RX_PROD_PKT_BD_TYPE_SFT 0
542         /*
543          * Indicates that this BD is 16B long and is an
544          * RX Producer  (ie. empty) buffer descriptor.
545          */
546         #define RX_PROD_PKT_BD_TYPE_RX_PROD_PKT UINT32_C(0x4)
547         /*
548          * If set to 1, the packet will be placed at the address plus
549          * 2B. The 2 Bytes of padding will be written as zero.
550          */
551         /*
552          * This is intended to be used when the host buffer is cache-
553          * line aligned to produce packets that are easy to parse in
554          * host memory while still allowing writes to be cache line
555          * aligned.
556          */
557         #define RX_PROD_PKT_BD_FLAGS_SOP_PAD    UINT32_C(0x40)
558         /*
559          * If set to 1, the packet write will be padded out to the
560          * nearest cache-line with zero value padding.
561          */
562         /*
563          * If receive buffers start/end on cache-line boundaries, this
564          * feature will ensure that all data writes on the PCI bus
565          * start/end on cache line boundaries.
566          */
567         #define RX_PROD_PKT_BD_FLAGS_EOP_PAD    UINT32_C(0x80)
568         /*
569          * This value is the number of additional buffers in the ring
570          * that describe the buffer space to be consumed for the this
571          * packet. If the value is zero, then the packet must fit within
572          * the space described by this BD. If this value is 1 or more,
573          * it indicates how many additional "buffer" BDs are in the ring
574          * immediately following this BD to be used for the same network
575          * packet. Even if the packet to be placed does not need all the
576          * additional buffers, they will be consumed anyway.
577          */
578         #define RX_PROD_PKT_BD_FLAGS_BUFFERS_MASK       UINT32_C(0x300)
579         #define RX_PROD_PKT_BD_FLAGS_BUFFERS_SFT        8
580         #define RX_PROD_PKT_BD_FLAGS_MASK       UINT32_C(0xffc0)
581         #define RX_PROD_PKT_BD_FLAGS_SFT        6
582         uint16_t len;
583         /*
584          * This is the length in Bytes of the host physical buffer where
585          * data for the packet may be placed in host memory.
586          */
587         /*
588          * While this is a Byte resolution value, it is often
589          * advantageous to ensure that the buffers provided end on a
590          * host cache line.
591          */
592         uint32_t opaque;
593         /*
594          * The opaque data field is pass through to the completion and
595          * can be used for any data that the driver wants to associate
596          * with this receive buffer set.
597          */
598         uint64_t addr;
599         /*
600          * This is the host physical address where data for the packet
601          * may by placed in host memory.
602          */
603         /*
604          * While this is a Byte resolution value, it is often
605          * advantageous to ensure that the buffers provide start on a
606          * host cache line.
607          */
608 } __attribute__((packed));
609
610 /* Completion Ring Structures */
611 /* Note: This structure is used by the HWRM to communicate HWRM Error. */
612 /* Base Completion Record       (16 bytes) */
613 struct cmpl_base {
614         uint16_t type;
615         /* unused is 10 b */
616         /*
617          * This field indicates the exact type of the completion. By
618          * convention, the LSB identifies the length of the record in
619          * 16B units. Even values indicate 16B records. Odd values
620          * indicate 32B records.
621          */
622         #define CMPL_BASE_TYPE_MASK     UINT32_C(0x3f)
623         #define CMPL_BASE_TYPE_SFT      0
624         /* TX L2 completion: Completion of TX packet. Length = 16B */
625         #define CMPL_BASE_TYPE_TX_L2    UINT32_C(0x0)
626         /*
627          * RX L2 completion: Completion of and L2 RX
628          * packet. Length = 32B
629          */
630         #define CMPL_BASE_TYPE_RX_L2    UINT32_C(0x11)
631         /*
632          * RX Aggregation Buffer completion : Completion
633          * of an L2 aggregation buffer in support of
634          * TPA, HDS, or Jumbo packet completion. Length
635          * = 16B
636          */
637         #define CMPL_BASE_TYPE_RX_AGG   UINT32_C(0x12)
638         /*
639          * RX L2 TPA Start Completion: Completion at the
640          * beginning of a TPA operation. Length = 32B
641          */
642         #define CMPL_BASE_TYPE_RX_TPA_START     UINT32_C(0x13)
643         /*
644          * RX L2 TPA End Completion: Completion at the
645          * end of a TPA operation. Length = 32B
646          */
647         #define CMPL_BASE_TYPE_RX_TPA_END       UINT32_C(0x15)
648         /*
649          * Statistics Ejection Completion: Completion of
650          * statistics data ejection buffer. Length = 16B
651          */
652         #define CMPL_BASE_TYPE_STAT_EJECT       UINT32_C(0x1a)
653         /* HWRM Command Completion: Completion of an HWRM command. */
654         #define CMPL_BASE_TYPE_HWRM_DONE        UINT32_C(0x20)
655         /* Forwarded HWRM Request */
656         #define CMPL_BASE_TYPE_HWRM_FWD_REQ     UINT32_C(0x22)
657         /* Forwarded HWRM Response */
658         #define CMPL_BASE_TYPE_HWRM_FWD_RESP    UINT32_C(0x24)
659         /* HWRM Asynchronous Event Information */
660         #define CMPL_BASE_TYPE_HWRM_ASYNC_EVENT UINT32_C(0x2e)
661         /* CQ Notification */
662         #define CMPL_BASE_TYPE_CQ_NOTIFICATION  UINT32_C(0x30)
663         /* SRQ Threshold Event */
664         #define CMPL_BASE_TYPE_SRQ_EVENT        UINT32_C(0x32)
665         /* DBQ Threshold Event */
666         #define CMPL_BASE_TYPE_DBQ_EVENT        UINT32_C(0x34)
667         /* QP Async Notification */
668         #define CMPL_BASE_TYPE_QP_EVENT UINT32_C(0x38)
669         /* Function Async Notification */
670         #define CMPL_BASE_TYPE_FUNC_EVENT       UINT32_C(0x3a)
671         /* unused is 10 b */
672         uint16_t info1;
673         /* info1 is 16 b */
674         uint32_t info2;
675         /* info2 is 32 b */
676         uint32_t info3_v;
677         /* info3 is 31 b */
678         /*
679          * This value is written by the NIC such that it will be
680          * different for each pass through the completion queue. The
681          * even passes will write 1. The odd passes will write 0.
682          */
683         #define CMPL_BASE_V     UINT32_C(0x1)
684         /* info3 is 31 b */
685         #define CMPL_BASE_INFO3_MASK    UINT32_C(0xfffffffe)
686         #define CMPL_BASE_INFO3_SFT     1
687         uint32_t info4;
688         /* info4 is 32 b */
689 } __attribute__((packed));
690
691 /* TX Completion Record (16 bytes) */
692 struct tx_cmpl {
693         uint16_t flags_type;
694         /*
695          * This field indicates the exact type of the completion. By
696          * convention, the LSB identifies the length of the record in
697          * 16B units. Even values indicate 16B records. Odd values
698          * indicate 32B records.
699          */
700         #define TX_CMPL_TYPE_MASK       UINT32_C(0x3f)
701         #define TX_CMPL_TYPE_SFT        0
702         /* TX L2 completion: Completion of TX packet. Length = 16B */
703         #define TX_CMPL_TYPE_TX_L2      UINT32_C(0x0)
704         /*
705          * When this bit is '1', it indicates a packet that has an error
706          * of some type. Type of error is indicated in error_flags.
707          */
708         #define TX_CMPL_FLAGS_ERROR     UINT32_C(0x40)
709         /*
710          * When this bit is '1', it indicates that the packet completed
711          * was transmitted using the push acceleration data provided by
712          * the driver. When this bit is '0', it indicates that the
713          * packet had not push acceleration data written or was executed
714          * as a normal packet even though push data was provided.
715          */
716         #define TX_CMPL_FLAGS_PUSH      UINT32_C(0x80)
717         #define TX_CMPL_FLAGS_MASK      UINT32_C(0xffc0)
718         #define TX_CMPL_FLAGS_SFT       6
719         uint16_t unused_0;
720         /* unused1 is 16 b */
721         uint32_t opaque;
722         /*
723          * This is a copy of the opaque field from the first TX BD of
724          * this transmitted packet.
725          */
726         uint16_t errors_v;
727         /*
728          * This value is written by the NIC such that it will be
729          * different for each pass through the completion queue. The
730          * even passes will write 1. The odd passes will write 0.
731          */
732         #define TX_CMPL_V       UINT32_C(0x1)
733         /*
734          * This error indicates that there was some sort of problem with
735          * the BDs for the packet.
736          */
737         #define TX_CMPL_ERRORS_BUFFER_ERROR_MASK        UINT32_C(0xe)
738         #define TX_CMPL_ERRORS_BUFFER_ERROR_SFT 1
739         /* No error */
740         #define TX_CMPL_ERRORS_BUFFER_ERROR_NO_ERROR    (UINT32_C(0x0) << 1)
741         /* Bad Format: BDs were not formatted correctly. */
742         #define TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT     (UINT32_C(0x2) << 1)
743         #define TX_CMPL_ERRORS_BUFFER_ERROR_LAST \
744                 TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT
745         /*
746          * When this bit is '1', it indicates that the length of the
747          * packet was zero. No packet was transmitted.
748          */
749         #define TX_CMPL_ERRORS_ZERO_LENGTH_PKT  UINT32_C(0x10)
750         /*
751          * When this bit is '1', it indicates that the packet was longer
752          * than the programmed limit in TDI. No packet was transmitted.
753          */
754         #define TX_CMPL_ERRORS_EXCESSIVE_BD_LENGTH      UINT32_C(0x20)
755         /*
756          * When this bit is '1', it indicates that one or more of the
757          * BDs associated with this packet generated a PCI error. This
758          * probably means the address was not valid.
759          */
760         #define TX_CMPL_ERRORS_DMA_ERROR        UINT32_C(0x40)
761         /*
762          * When this bit is '1', it indicates that the packet was longer
763          * than indicated by the hint. No packet was transmitted.
764          */
765         #define TX_CMPL_ERRORS_HINT_TOO_SHORT   UINT32_C(0x80)
766         /*
767          * When this bit is '1', it indicates that the packet was
768          * dropped due to Poison TLP error on one or more of the TLPs in
769          * the PXP completion.
770          */
771         #define TX_CMPL_ERRORS_POISON_TLP_ERROR UINT32_C(0x100)
772         #define TX_CMPL_ERRORS_MASK     UINT32_C(0xfffe)
773         #define TX_CMPL_ERRORS_SFT      1
774         uint16_t unused_1;
775         /* unused2 is 16 b */
776         uint32_t unused_2;
777         /* unused3 is 32 b */
778 } __attribute__((packed));
779
780 /* RX Packet Completion Record  (32 bytes split to 2 16-byte struct) */
781 struct rx_pkt_cmpl {
782         uint16_t flags_type;
783         /*
784          * This field indicates the exact type of the completion. By
785          * convention, the LSB identifies the length of the record in
786          * 16B units. Even values indicate 16B records. Odd values
787          * indicate 32B records.
788          */
789         #define RX_PKT_CMPL_TYPE_MASK   UINT32_C(0x3f)
790         #define RX_PKT_CMPL_TYPE_SFT    0
791         /*
792          * RX L2 completion: Completion of and L2 RX
793          * packet. Length = 32B
794          */
795         #define RX_PKT_CMPL_TYPE_RX_L2                  UINT32_C(0x11)
796         /*
797          * When this bit is '1', it indicates a packet that has an error
798          * of some type. Type of error is indicated in error_flags.
799          */
800         #define RX_PKT_CMPL_FLAGS_ERROR UINT32_C(0x40)
801         /* This field indicates how the packet was placed in the buffer. */
802         #define RX_PKT_CMPL_FLAGS_PLACEMENT_MASK        UINT32_C(0x380)
803         #define RX_PKT_CMPL_FLAGS_PLACEMENT_SFT 7
804         /* Normal: Packet was placed using normal algorithm. */
805         #define RX_PKT_CMPL_FLAGS_PLACEMENT_NORMAL      (UINT32_C(0x0) << 7)
806         /* Jumbo: Packet was placed using jumbo algorithm. */
807         #define RX_PKT_CMPL_FLAGS_PLACEMENT_JUMBO       (UINT32_C(0x1) << 7)
808         /*
809          * Header/Data Separation: Packet was placed
810          * using Header/Data separation algorithm. The
811          * separation location is indicated by the itype
812          * field.
813          */
814         #define RX_PKT_CMPL_FLAGS_PLACEMENT_HDS (UINT32_C(0x2) << 7)
815         #define RX_PKT_CMPL_FLAGS_PLACEMENT_LAST \
816                 RX_PKT_CMPL_FLAGS_PLACEMENT_HDS
817         /* This bit is '1' if the RSS field in this completion is valid. */
818         #define RX_PKT_CMPL_FLAGS_RSS_VALID     UINT32_C(0x400)
819         /* unused is 1 b */
820         #define RX_PKT_CMPL_FLAGS_UNUSED        UINT32_C(0x800)
821         /*
822          * This value indicates what the inner packet determined for the
823          * packet was.
824          */
825         #define RX_PKT_CMPL_FLAGS_ITYPE_MASK    UINT32_C(0xf000)
826         #define RX_PKT_CMPL_FLAGS_ITYPE_SFT     12
827         /* Not Known: Indicates that the packet type was not known. */
828         #define RX_PKT_CMPL_FLAGS_ITYPE_NOT_KNOWN       (UINT32_C(0x0) << 12)
829         /*
830          * IP Packet: Indicates that the packet was an
831          * IP packet, but further classification was not
832          * possible.
833          */
834         #define RX_PKT_CMPL_FLAGS_ITYPE_IP      (UINT32_C(0x1) << 12)
835         /*
836          * TCP Packet: Indicates that the packet was IP
837          * and TCP. This indicates that the
838          * payload_offset field is valid.
839          */
840         #define RX_PKT_CMPL_FLAGS_ITYPE_TCP     (UINT32_C(0x2) << 12)
841         /*
842          * UDP Packet: Indicates that the packet was IP
843          * and UDP. This indicates that the
844          * payload_offset field is valid.
845          */
846         #define RX_PKT_CMPL_FLAGS_ITYPE_UDP     (UINT32_C(0x3) << 12)
847         /*
848          * FCoE Packet: Indicates that the packet was
849          * recognized as a FCoE. This also indicates
850          * that the payload_offset field is valid.
851          */
852         #define RX_PKT_CMPL_FLAGS_ITYPE_FCOE    (UINT32_C(0x4) << 12)
853         /*
854          * RoCE Packet: Indicates that the packet was
855          * recognized as a RoCE. This also indicates
856          * that the payload_offset field is valid.
857          */
858         #define RX_PKT_CMPL_FLAGS_ITYPE_ROCE    (UINT32_C(0x5) << 12)
859         /*
860          * ICMP Packet: Indicates that the packet was
861          * recognized as ICMP. This indicates that the
862          * payload_offset field is valid.
863          */
864         #define RX_PKT_CMPL_FLAGS_ITYPE_ICMP    (UINT32_C(0x7) << 12)
865         /*
866          * PtP packet wo/timestamp: Indicates that the
867          * packet was recognized as a PtP packet.
868          */
869         #define RX_PKT_CMPL_FLAGS_ITYPE_PTP_WO_TIMESTAMP        (UINT32_C(0x8) << 12)
870         /*
871          * PtP packet w/timestamp: Indicates that the
872          * packet was recognized as a PtP packet and
873          * that a timestamp was taken for the packet.
874          */
875         #define RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP (UINT32_C(0x9) << 12)
876         #define RX_PKT_CMPL_FLAGS_ITYPE_LAST \
877                 RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP
878         #define RX_PKT_CMPL_FLAGS_MASK  UINT32_C(0xffc0)
879         #define RX_PKT_CMPL_FLAGS_SFT   6
880         uint16_t len;
881         /*
882          * This is the length of the data for the packet stored in the
883          * buffer(s) identified by the opaque value. This includes the
884          * packet BD and any associated buffer BDs. This does not
885          * include the length of any data places in aggregation BDs.
886          */
887         uint32_t opaque;
888         /*
889          * This is a copy of the opaque field from the RX BD this
890          * completion corresponds to.
891          */
892         uint8_t agg_bufs_v1;
893         /* unused1 is 2 b */
894         /*
895          * This value is written by the NIC such that it will be
896          * different for each pass through the completion queue. The
897          * even passes will write 1. The odd passes will write 0.
898          */
899         #define RX_PKT_CMPL_V1  UINT32_C(0x1)
900         /*
901          * This value is the number of aggregation buffers that follow
902          * this entry in the completion ring that are a part of this
903          * packet. If the value is zero, then the packet is completely
904          * contained in the buffer space provided for the packet in the
905          * RX ring.
906          */
907         #define RX_PKT_CMPL_AGG_BUFS_MASK       UINT32_C(0x3e)
908         #define RX_PKT_CMPL_AGG_BUFS_SFT        1
909         /* unused1 is 2 b */
910         uint8_t rss_hash_type;
911         /*
912          * This is the RSS hash type for the packet. The value is packed
913          * {tuple_extrac_op[1:0],rss_profile_id[4:0],tuple_extrac_op[2]}
914          * . The value of tuple_extrac_op provides the information about
915          * what fields the hash was computed on. * 0: The RSS hash was
916          * computed over source IP address, destination IP address,
917          * source port, and destination port of inner IP and TCP or UDP
918          * headers. Note: For non-tunneled packets, the packet headers
919          * are considered inner packet headers for the RSS hash
920          * computation purpose. * 1: The RSS hash was computed over
921          * source IP address and destination IP address of inner IP
922          * header. Note: For non-tunneled packets, the packet headers
923          * are considered inner packet headers for the RSS hash
924          * computation purpose. * 2: The RSS hash was computed over
925          * source IP address, destination IP address, source port, and
926          * destination port of IP and TCP or UDP headers of outer tunnel
927          * headers. Note: For non-tunneled packets, this value is not
928          * applicable. * 3: The RSS hash was computed over source IP
929          * address and destination IP address of IP header of outer
930          * tunnel headers. Note: For non-tunneled packets, this value is
931          * not applicable. Note that 4-tuples values listed above are
932          * applicable for layer 4 protocols supported and enabled for
933          * RSS in the hardware, HWRM firmware, and drivers. For example,
934          * if RSS hash is supported and enabled for TCP traffic only,
935          * then the values of tuple_extract_op corresponding to 4-tuples
936          * are only valid for TCP traffic.
937          */
938         uint8_t payload_offset;
939         /*
940          * This value indicates the offset in bytes from the beginning
941          * of the packet where the inner payload starts. This value is
942          * valid for TCP, UDP, FCoE, and RoCE packets. A value of zero
943          * indicates that header is 256B into the packet.
944          */
945         uint8_t unused_1;
946         /* unused2 is 8 b */
947         uint32_t rss_hash;
948         /*
949          * This value is the RSS hash value calculated for the packet
950          * based on the mode bits and key value in the VNIC.
951          */
952 } __attribute__((packed));
953
954 /* last 16 bytes of RX Packet Completion Record */
955 struct rx_pkt_cmpl_hi {
956         uint32_t flags2;
957         /*
958          * This indicates that the ip checksum was calculated for the
959          * inner packet and that the ip_cs_error field indicates if
960          * there was an error.
961          */
962         #define RX_PKT_CMPL_FLAGS2_IP_CS_CALC   UINT32_C(0x1)
963         /*
964          * This indicates that the TCP, UDP or ICMP checksum was
965          * calculated for the inner packet and that the l4_cs_error
966          * field indicates if there was an error.
967          */
968         #define RX_PKT_CMPL_FLAGS2_L4_CS_CALC   UINT32_C(0x2)
969         /*
970          * This indicates that the ip checksum was calculated for the
971          * tunnel header and that the t_ip_cs_error field indicates if
972          * there was an error.
973          */
974         #define RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC UINT32_C(0x4)
975         /*
976          * This indicates that the UDP checksum was calculated for the
977          * tunnel packet and that the t_l4_cs_error field indicates if
978          * there was an error.
979          */
980         #define RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC UINT32_C(0x8)
981         /* This value indicates what format the metadata field is. */
982         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_MASK     UINT32_C(0xf0)
983         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_SFT      4
984         /* No metadata informtaion. Value is zero. */
985         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_NONE     (UINT32_C(0x0) << 4)
986         /*
987          * The metadata field contains the VLAN tag and
988          * TPID value. - metadata[11:0] contains the
989          * vlan VID value. - metadata[12] contains the
990          * vlan DE value. - metadata[15:13] contains the
991          * vlan PRI value. - metadata[31:16] contains
992          * the vlan TPID value.
993          */
994         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN     (UINT32_C(0x1) << 4)
995         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_LAST \
996                 RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN
997         /*
998          * This field indicates the IP type for the inner-most IP
999          * header. A value of '0' indicates IPv4. A value of '1'
1000          * indicates IPv6. This value is only valid if itype indicates a
1001          * packet with an IP header.
1002          */
1003         #define RX_PKT_CMPL_FLAGS2_IP_TYPE      UINT32_C(0x100)
1004         uint32_t metadata;
1005         /*
1006          * This is data from the CFA block as indicated by the
1007          * meta_format field.
1008          */
1009         /* When meta_format=1, this value is the VLAN VID. */
1010         #define RX_PKT_CMPL_METADATA_VID_MASK   UINT32_C(0xfff)
1011         #define RX_PKT_CMPL_METADATA_VID_SFT    0
1012         /* When meta_format=1, this value is the VLAN DE. */
1013         #define RX_PKT_CMPL_METADATA_DE UINT32_C(0x1000)
1014         /* When meta_format=1, this value is the VLAN PRI. */
1015         #define RX_PKT_CMPL_METADATA_PRI_MASK   UINT32_C(0xe000)
1016         #define RX_PKT_CMPL_METADATA_PRI_SFT    13
1017         /* When meta_format=1, this value is the VLAN TPID. */
1018         #define RX_PKT_CMPL_METADATA_TPID_MASK  UINT32_C(0xffff0000)
1019         #define RX_PKT_CMPL_METADATA_TPID_SFT   16
1020         uint16_t errors_v2;
1021         /*
1022          * This value is written by the NIC such that it will be
1023          * different for each pass through the completion queue. The
1024          * even passes will write 1. The odd passes will write 0.
1025          */
1026         #define RX_PKT_CMPL_V2  UINT32_C(0x1)
1027         /*
1028          * This error indicates that there was some sort of problem with
1029          * the BDs for the packet that was found after part of the
1030          * packet was already placed. The packet should be treated as
1031          * invalid.
1032          */
1033         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_MASK    UINT32_C(0xe)
1034         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_SFT     1
1035         /* No buffer error */
1036         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_NO_BUFFER       (UINT32_C(0x0) << 1)
1037         /*
1038          * Did Not Fit: Packet did not fit into packet
1039          * buffer provided. For regular placement, this
1040          * means the packet did not fit in the buffer
1041          * provided. For HDS and jumbo placement, this
1042          * means that the packet could not be placed
1043          * into 7 physical buffers or less.
1044          */
1045         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_DID_NOT_FIT \
1046                 (UINT32_C(0x1) << 1)
1047         /*
1048          * Not On Chip: All BDs needed for the packet
1049          * were not on-chip when the packet arrived.
1050          */
1051         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_NOT_ON_CHIP \
1052                 (UINT32_C(0x2) << 1)
1053         /* Bad Format: BDs were not formatted correctly. */
1054         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT \
1055                 (UINT32_C(0x3) << 1)
1056         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_LAST \
1057                 RX_PKT_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT
1058         /* This indicates that there was an error in the IP header checksum. */
1059         #define RX_PKT_CMPL_ERRORS_IP_CS_ERROR  UINT32_C(0x10)
1060         /*
1061          * This indicates that there was an error in the TCP, UDP or
1062          * ICMP checksum.
1063          */
1064         #define RX_PKT_CMPL_ERRORS_L4_CS_ERROR  UINT32_C(0x20)
1065         /*
1066          * This indicates that there was an error in the tunnel IP
1067          * header checksum.
1068          */
1069         #define RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR        UINT32_C(0x40)
1070         /*
1071          * This indicates that there was an error in the tunnel UDP
1072          * checksum.
1073          */
1074         #define RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR        UINT32_C(0x80)
1075         /*
1076          * This indicates that there was a CRC error on either an FCoE
1077          * or RoCE packet. The itype indicates the packet type.
1078          */
1079         #define RX_PKT_CMPL_ERRORS_CRC_ERROR    UINT32_C(0x100)
1080         /*
1081          * This indicates that there was an error in the tunnel portion
1082          * of the packet when this field is non-zero.
1083          */
1084         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_MASK     UINT32_C(0xe00)
1085         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_SFT      9
1086         /*
1087          * No additional error occurred on the tunnel
1088          * portion of the packet of the packet does not
1089          * have a tunnel.
1090          */
1091         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_NO_ERROR (UINT32_C(0x0) << 9)
1092         /*
1093          * Indicates that IP header version does not
1094          * match expectation from L2 Ethertype for IPv4
1095          * and IPv6 in the tunnel header.
1096          */
1097         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_VERSION \
1098                 (UINT32_C(0x1) << 9)
1099         /*
1100          * Indicates that header length is out of range
1101          * in the tunnel header. Valid for IPv4.
1102          */
1103         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_HDR_LEN \
1104                 (UINT32_C(0x2) << 9)
1105         /*
1106          * Indicates that the physical packet is shorter
1107          * than that claimed by the PPPoE header length
1108          * for a tunnel PPPoE packet.
1109          */
1110         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_TUNNEL_TOTAL_ERROR \
1111                 (UINT32_C(0x3) << 9)
1112         /*
1113          * Indicates that physical packet is shorter
1114          * than that claimed by the tunnel l3 header
1115          * length. Valid for IPv4, or IPv6 tunnel packet
1116          * packets.
1117          */
1118         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_IP_TOTAL_ERROR \
1119                 (UINT32_C(0x4) << 9)
1120         /*
1121          * Indicates that the physical packet is shorter
1122          * than that claimed by the tunnel UDP header
1123          * length for a tunnel UDP packet that is not
1124          * fragmented.
1125          */
1126         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_UDP_TOTAL_ERROR \
1127                 (UINT32_C(0x5) << 9)
1128         /*
1129          * indicates that the IPv4 TTL or IPv6 hop limit
1130          * check have failed    (e.g. TTL = 0) in the
1131          * tunnel header. Valid for IPv4, and IPv6.
1132          */
1133         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL \
1134                 (UINT32_C(0x6) << 9)
1135         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_LAST \
1136                 RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL
1137         /*
1138          * This indicates that there was an error in the inner portion
1139          * of the packet when this field is non-zero.
1140          */
1141         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_MASK       UINT32_C(0xf000)
1142         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_SFT        12
1143         /*
1144          * No additional error occurred on the tunnel
1145          * portion of the packet of the packet does not
1146          * have a tunnel.
1147          */
1148         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_NO_ERROR   (UINT32_C(0x0) << 12)
1149         /*
1150          * Indicates that IP header version does not
1151          * match expectation from L2 Ethertype for IPv4
1152          * and IPv6 or that option other than VFT was
1153          * parsed on FCoE packet.
1154          */
1155         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_VERSION \
1156                 (UINT32_C(0x1) << 12)
1157         /*
1158          * indicates that header length is out of range.
1159          * Valid for IPv4 and RoCE
1160          */
1161         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_HDR_LEN \
1162                 (UINT32_C(0x2) << 12)
1163         /*
1164          * indicates that the IPv4 TTL or IPv6 hop limit
1165          * check have failed    (e.g. TTL = 0). Valid for
1166          * IPv4, and IPv6
1167          */
1168         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_TTL (UINT32_C(0x3) << 12)
1169         /*
1170          * Indicates that physical packet is shorter
1171          * than that claimed by the l3 header length.
1172          * Valid for IPv4, IPv6 packet or RoCE packets.
1173          */
1174         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_IP_TOTAL_ERROR \
1175                 (UINT32_C(0x4) << 12)
1176         /*
1177          * Indicates that the physical packet is shorter
1178          * than that claimed by the UDP header length
1179          * for a UDP packet that is not fragmented.
1180          */
1181         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_UDP_TOTAL_ERROR \
1182                 (UINT32_C(0x5) << 12)
1183         /*
1184          * Indicates that TCP header length > IP
1185          * payload. Valid for TCP packets only.
1186          */
1187         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN \
1188                 (UINT32_C(0x6) << 12)
1189         /* Indicates that TCP header length < 5. Valid for TCP. */
1190         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN_TOO_SMALL \
1191                 (UINT32_C(0x7) << 12)
1192         /*
1193          * Indicates that TCP option headers result in a
1194          * TCP header size that does not match data
1195          * offset in TCP header. Valid for TCP.
1196          */
1197         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN \
1198                 (UINT32_C(0x8) << 12)
1199         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_LAST \
1200                 RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN
1201         #define RX_PKT_CMPL_ERRORS_MASK UINT32_C(0xfffe)
1202         #define RX_PKT_CMPL_ERRORS_SFT  1
1203         uint16_t cfa_code;
1204         /*
1205          * This field identifies the CFA action rule that was used for
1206          * this packet.
1207          */
1208         uint32_t reorder;
1209         /*
1210          * This value holds the reordering sequence number for the
1211          * packet. If the reordering sequence is not valid, then this
1212          * value is zero. The reordering domain for the packet is in the
1213          * bottom 8 to 10b of the rss_hash value. The bottom 20b of this
1214          * value contain the ordering domain value for the packet.
1215          */
1216         #define RX_PKT_CMPL_REORDER_MASK        UINT32_C(0xffffff)
1217         #define RX_PKT_CMPL_REORDER_SFT 0
1218 } __attribute__((packed));
1219
1220 /* RX L2 TPA Start Completion Record (32 bytes split to 2 16-byte struct) */
1221 struct rx_tpa_start_cmpl {
1222         uint16_t flags_type;
1223         /*
1224          * This field indicates the exact type of the completion. By
1225          * convention, the LSB identifies the length of the record in
1226          * 16B units. Even values indicate 16B records. Odd values
1227          * indicate 32B records.
1228          */
1229         #define RX_TPA_START_CMPL_TYPE_MASK     UINT32_C(0x3f)
1230         #define RX_TPA_START_CMPL_TYPE_SFT      0
1231         /*
1232          * RX L2 TPA Start Completion: Completion at the
1233          * beginning of a TPA operation. Length = 32B
1234          */
1235         #define RX_TPA_START_CMPL_TYPE_RX_TPA_START     UINT32_C(0x13)
1236         /* This bit will always be '0' for TPA start completions. */
1237         #define RX_TPA_START_CMPL_FLAGS_ERROR   UINT32_C(0x40)
1238         /* This field indicates how the packet was placed in the buffer. */
1239         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_MASK  UINT32_C(0x380)
1240         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_SFT   7
1241         /*
1242          * Jumbo: TPA Packet was placed using jumbo
1243          * algorithm. This means that the first buffer
1244          * will be filled with data before moving to
1245          * aggregation buffers. Each aggregation buffer
1246          * will be filled before moving to the next
1247          * aggregation buffer.
1248          */
1249         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_JUMBO (UINT32_C(0x1) << 7)
1250         /*
1251          * Header/Data Separation: Packet was placed
1252          * using Header/Data separation algorithm. The
1253          * separation location is indicated by the itype
1254          * field.
1255          */
1256         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_HDS   (UINT32_C(0x2) << 7)
1257         /*
1258          * GRO/Jumbo: Packet will be placed using
1259          * GRO/Jumbo where the first packet is filled
1260          * with data. Subsequent packets will be placed
1261          * such that any one packet does not span two
1262          * aggregation buffers unless it starts at the
1263          * beginning of an aggregation buffer.
1264          */
1265         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_GRO_JUMBO \
1266                 (UINT32_C(0x5) << 7)
1267         /*
1268          * GRO/Header-Data Separation: Packet will be
1269          * placed using GRO/HDS where the header is in
1270          * the first packet. Payload of each packet will
1271          * be placed such that any one packet does not
1272          * span two aggregation buffers unless it starts
1273          * at the beginning of an aggregation buffer.
1274          */
1275         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_GRO_HDS (UINT32_C(0x6) << 7)
1276         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_LAST \
1277                 RX_TPA_START_CMPL_FLAGS_PLACEMENT_GRO_HDS
1278         /* This bit is '1' if the RSS field in this completion is valid. */
1279         #define RX_TPA_START_CMPL_FLAGS_RSS_VALID       UINT32_C(0x400)
1280         /* unused is 1 b */
1281         #define RX_TPA_START_CMPL_FLAGS_UNUSED  UINT32_C(0x800)
1282         /*
1283          * This value indicates what the inner packet determined for the
1284          * packet was.
1285          */
1286         #define RX_TPA_START_CMPL_FLAGS_ITYPE_MASK      UINT32_C(0xf000)
1287         #define RX_TPA_START_CMPL_FLAGS_ITYPE_SFT       12
1288         /* TCP Packet: Indicates that the packet was IP and TCP. */
1289         #define RX_TPA_START_CMPL_FLAGS_ITYPE_TCP       (UINT32_C(0x2) << 12)
1290         #define RX_TPA_START_CMPL_FLAGS_ITYPE_LAST \
1291                 RX_TPA_START_CMPL_FLAGS_ITYPE_TCP
1292         #define RX_TPA_START_CMPL_FLAGS_MASK    UINT32_C(0xffc0)
1293         #define RX_TPA_START_CMPL_FLAGS_SFT     6
1294         uint16_t len;
1295         /*
1296          * This value indicates the amount of packet data written to the
1297          * buffer the opaque field in this completion corresponds to.
1298          */
1299         uint32_t opaque;
1300         /*
1301          * This is a copy of the opaque field from the RX BD this
1302          * completion corresponds to.
1303          */
1304         uint8_t v1;
1305         /* unused1 is 7 b */
1306         /*
1307          * This value is written by the NIC such that it will be
1308          * different for each pass through the completion queue. The
1309          * even passes will write 1. The odd passes will write 0.
1310          */
1311         #define RX_TPA_START_CMPL_V1    UINT32_C(0x1)
1312         /* unused1 is 7 b */
1313         uint8_t rss_hash_type;
1314         /*
1315          * This is the RSS hash type for the packet. The value is packed
1316          * {tuple_extrac_op[1:0],rss_profile_id[4:0],tuple_extrac_op[2]}
1317          * . The value of tuple_extrac_op provides the information about
1318          * what fields the hash was computed on. * 0: The RSS hash was
1319          * computed over source IP address, destination IP address,
1320          * source port, and destination port of inner IP and TCP or UDP
1321          * headers. Note: For non-tunneled packets, the packet headers
1322          * are considered inner packet headers for the RSS hash
1323          * computation purpose. * 1: The RSS hash was computed over
1324          * source IP address and destination IP address of inner IP
1325          * header. Note: For non-tunneled packets, the packet headers
1326          * are considered inner packet headers for the RSS hash
1327          * computation purpose. * 2: The RSS hash was computed over
1328          * source IP address, destination IP address, source port, and
1329          * destination port of IP and TCP or UDP headers of outer tunnel
1330          * headers. Note: For non-tunneled packets, this value is not
1331          * applicable. * 3: The RSS hash was computed over source IP
1332          * address and destination IP address of IP header of outer
1333          * tunnel headers. Note: For non-tunneled packets, this value is
1334          * not applicable. Note that 4-tuples values listed above are
1335          * applicable for layer 4 protocols supported and enabled for
1336          * RSS in the hardware, HWRM firmware, and drivers. For example,
1337          * if RSS hash is supported and enabled for TCP traffic only,
1338          * then the values of tuple_extract_op corresponding to 4-tuples
1339          * are only valid for TCP traffic.
1340          */
1341         uint16_t agg_id;
1342         /*
1343          * This is the aggregation ID that the completion is associated
1344          * with. Use this number to correlate the TPA start completion
1345          * with the TPA end completion.
1346          */
1347         /* unused2 is 9 b */
1348         /*
1349          * This is the aggregation ID that the completion is associated
1350          * with. Use this number to correlate the TPA start completion
1351          * with the TPA end completion.
1352          */
1353         #define RX_TPA_START_CMPL_AGG_ID_MASK   UINT32_C(0xfe00)
1354         #define RX_TPA_START_CMPL_AGG_ID_SFT    9
1355         uint32_t rss_hash;
1356         /*
1357          * This value is the RSS hash value calculated for the packet
1358          * based on the mode bits and key value in the VNIC.
1359          */
1360 } __attribute__((packed));
1361
1362 /* last 16 bytes of RX L2 TPA Start Completion Record */
1363 struct rx_tpa_start_cmpl_hi {
1364         uint32_t flags2;
1365         /*
1366          * This indicates that the ip checksum was calculated for the
1367          * inner packet and that the sum passed for all segments
1368          * included in the aggregation.
1369          */
1370         #define RX_TPA_START_CMPL_FLAGS2_IP_CS_CALC     UINT32_C(0x1)
1371         /*
1372          * This indicates that the TCP, UDP or ICMP checksum was
1373          * calculated for the inner packet and that the sum passed for
1374          * all segments included in the aggregation.
1375          */
1376         #define RX_TPA_START_CMPL_FLAGS2_L4_CS_CALC     UINT32_C(0x2)
1377         /*
1378          * This indicates that the ip checksum was calculated for the
1379          * tunnel header and that the sum passed for all segments
1380          * included in the aggregation.
1381          */
1382         #define RX_TPA_START_CMPL_FLAGS2_T_IP_CS_CALC   UINT32_C(0x4)
1383         /*
1384          * This indicates that the UDP checksum was calculated for the
1385          * tunnel packet and that the sum passed for all segments
1386          * included in the aggregation.
1387          */
1388         #define RX_TPA_START_CMPL_FLAGS2_T_L4_CS_CALC   UINT32_C(0x8)
1389         /* This value indicates what format the metadata field is. */
1390         #define RX_TPA_START_CMPL_FLAGS2_META_FORMAT_MASK UINT32_C(0xf0)
1391         #define RX_TPA_START_CMPL_FLAGS2_META_FORMAT_SFT        4
1392         /* No metadata informtaion. Value is zero. */
1393         #define RX_TPA_START_CMPL_FLAGS2_META_FORMAT_NONE (UINT32_C(0x0) << 4)
1394         /*
1395          * The metadata field contains the VLAN tag and
1396          * TPID value. - metadata[11:0] contains the
1397          * vlan VID value. - metadata[12] contains the
1398          * vlan DE value. - metadata[15:13] contains the
1399          * vlan PRI value. - metadata[31:16] contains
1400          * the vlan TPID value.
1401          */
1402         #define RX_TPA_START_CMPL_FLAGS2_META_FORMAT_VLAN (UINT32_C(0x1) << 4)
1403         #define RX_TPA_START_CMPL_FLAGS2_META_FORMAT_LAST \
1404                 RX_TPA_START_CMPL_FLAGS2_META_FORMAT_VLAN
1405         /*
1406          * This field indicates the IP type for the inner-most IP
1407          * header. A value of '0' indicates IPv4. A value of '1'
1408          * indicates IPv6.
1409          */
1410         #define RX_TPA_START_CMPL_FLAGS2_IP_TYPE        UINT32_C(0x100)
1411         uint32_t metadata;
1412         /*
1413          * This is data from the CFA block as indicated by the
1414          * meta_format field.
1415          */
1416         /* When meta_format=1, this value is the VLAN VID. */
1417         #define RX_TPA_START_CMPL_METADATA_VID_MASK     UINT32_C(0xfff)
1418         #define RX_TPA_START_CMPL_METADATA_VID_SFT      0
1419         /* When meta_format=1, this value is the VLAN DE. */
1420         #define RX_TPA_START_CMPL_METADATA_DE   UINT32_C(0x1000)
1421         /* When meta_format=1, this value is the VLAN PRI. */
1422         #define RX_TPA_START_CMPL_METADATA_PRI_MASK UINT32_C(0xe000)
1423         #define RX_TPA_START_CMPL_METADATA_PRI_SFT      13
1424         /* When meta_format=1, this value is the VLAN TPID. */
1425         #define RX_TPA_START_CMPL_METADATA_TPID_MASK    UINT32_C(0xffff0000)
1426         #define RX_TPA_START_CMPL_METADATA_TPID_SFT     16
1427         uint16_t v2;
1428         /* unused4 is 15 b */
1429         /*
1430          * This value is written by the NIC such that it will be
1431          * different for each pass through the completion queue. The
1432          * even passes will write 1. The odd passes will write 0.
1433          */
1434         #define RX_TPA_START_CMPL_V2    UINT32_C(0x1)
1435         /* unused4 is 15 b */
1436         uint16_t cfa_code;
1437         /*
1438          * This field identifies the CFA action rule that was used for
1439          * this packet.
1440          */
1441         uint32_t inner_l4_size_inner_l3_offset_inner_l2_offset_outer_l3_offset;
1442         /*
1443          * This is the size in bytes of the inner most L4 header. This
1444          * can be subtracted from the payload_offset to determine the
1445          * start of the inner most L4 header.
1446          */
1447         /*
1448          * This is the offset from the beginning of the packet in bytes
1449          * for the outer L3 header. If there is no outer L3 header, then
1450          * this value is zero.
1451          */
1452         #define RX_TPA_START_CMPL_OUTER_L3_OFFSET_MASK  UINT32_C(0x1ff)
1453         #define RX_TPA_START_CMPL_OUTER_L3_OFFSET_SFT   0
1454         /*
1455          * This is the offset from the beginning of the packet in bytes
1456          * for the inner most L2 header.
1457          */
1458         #define RX_TPA_START_CMPL_INNER_L2_OFFSET_MASK  UINT32_C(0x3fe00)
1459         #define RX_TPA_START_CMPL_INNER_L2_OFFSET_SFT   9
1460         /*
1461          * This is the offset from the beginning of the packet in bytes
1462          * for the inner most L3 header.
1463          */
1464         #define RX_TPA_START_CMPL_INNER_L3_OFFSET_MASK  UINT32_C(0x7fc0000)
1465         #define RX_TPA_START_CMPL_INNER_L3_OFFSET_SFT   18
1466         /*
1467          * This is the size in bytes of the inner most L4 header. This
1468          * can be subtracted from the payload_offset to determine the
1469          * start of the inner most L4 header.
1470          */
1471         #define RX_TPA_START_CMPL_INNER_L4_SIZE_MASK    UINT32_C(0xf8000000)
1472         #define RX_TPA_START_CMPL_INNER_L4_SIZE_SFT     27
1473 } __attribute__((packed));
1474
1475 /* RX TPA End Completion Record (32 bytes split to 2 16-byte struct) */
1476 struct rx_tpa_end_cmpl {
1477         uint16_t flags_type;
1478         /*
1479          * This field indicates the exact type of the completion. By
1480          * convention, the LSB identifies the length of the record in
1481          * 16B units. Even values indicate 16B records. Odd values
1482          * indicate 32B records.
1483          */
1484         #define RX_TPA_END_CMPL_TYPE_MASK       UINT32_C(0x3f)
1485         #define RX_TPA_END_CMPL_TYPE_SFT        0
1486         /*
1487          * RX L2 TPA End Completion: Completion at the
1488          * end of a TPA operation. Length = 32B
1489          */
1490         #define RX_TPA_END_CMPL_TYPE_RX_TPA_END UINT32_C(0x15)
1491         /*
1492          * When this bit is '1', it indicates a packet that has an error
1493          * of some type. Type of error is indicated in error_flags.
1494          */
1495         #define RX_TPA_END_CMPL_FLAGS_ERROR     UINT32_C(0x40)
1496         /* This field indicates how the packet was placed in the buffer. */
1497         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_MASK    UINT32_C(0x380)
1498         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_SFT     7
1499         /*
1500          * Jumbo: TPA Packet was placed using jumbo
1501          * algorithm. This means that the first buffer
1502          * will be filled with data before moving to
1503          * aggregation buffers. Each aggregation buffer
1504          * will be filled before moving to the next
1505          * aggregation buffer.
1506          */
1507         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_JUMBO   (UINT32_C(0x1) << 7)
1508         /*
1509          * Header/Data Separation: Packet was placed
1510          * using Header/Data separation algorithm. The
1511          * separation location is indicated by the itype
1512          * field.
1513          */
1514         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_HDS     (UINT32_C(0x2) << 7)
1515         /*
1516          * GRO/Jumbo: Packet will be placed using
1517          * GRO/Jumbo where the first packet is filled
1518          * with data. Subsequent packets will be placed
1519          * such that any one packet does not span two
1520          * aggregation buffers unless it starts at the
1521          * beginning of an aggregation buffer.
1522          */
1523         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_GRO_JUMBO (UINT32_C(0x5) << 7)
1524         /*
1525          * GRO/Header-Data Separation: Packet will be
1526          * placed using GRO/HDS where the header is in
1527          * the first packet. Payload of each packet will
1528          * be placed such that any one packet does not
1529          * span two aggregation buffers unless it starts
1530          * at the beginning of an aggregation buffer.
1531          */
1532         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_GRO_HDS (UINT32_C(0x6) << 7)
1533         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_LAST \
1534                 RX_TPA_END_CMPL_FLAGS_PLACEMENT_GRO_HDS
1535         /* unused is 2 b */
1536         #define RX_TPA_END_CMPL_FLAGS_UNUSED_MASK       UINT32_C(0xc00)
1537         #define RX_TPA_END_CMPL_FLAGS_UNUSED_SFT        10
1538         /*
1539          * This value indicates what the inner packet determined for the
1540          * packet was. - 2 TCP Packet Indicates that the packet was IP
1541          * and TCP. This indicates that the ip_cs field is valid and
1542          * that the tcp_udp_cs field is valid and contains the TCP
1543          * checksum. This also indicates that the payload_offset field
1544          * is valid.
1545          */
1546         #define RX_TPA_END_CMPL_FLAGS_ITYPE_MASK        UINT32_C(0xf000)
1547         #define RX_TPA_END_CMPL_FLAGS_ITYPE_SFT 12
1548         #define RX_TPA_END_CMPL_FLAGS_MASK      UINT32_C(0xffc0)
1549         #define RX_TPA_END_CMPL_FLAGS_SFT       6
1550         uint16_t len;
1551         /*
1552          * This value is zero for TPA End completions. There is no data
1553          * in the buffer that corresponds to the opaque value in this
1554          * completion.
1555          */
1556         uint32_t opaque;
1557         /*
1558          * This is a copy of the opaque field from the RX BD this
1559          * completion corresponds to.
1560          */
1561         uint8_t agg_bufs_v1;
1562         /* unused1 is 1 b */
1563         /*
1564          * This value is written by the NIC such that it will be
1565          * different for each pass through the completion queue. The
1566          * even passes will write 1. The odd passes will write 0.
1567          */
1568         #define RX_TPA_END_CMPL_V1      UINT32_C(0x1)
1569         /*
1570          * This value is the number of aggregation buffers that follow
1571          * this entry in the completion ring that are a part of this
1572          * aggregation packet. If the value is zero, then the packet is
1573          * completely contained in the buffer space provided in the
1574          * aggregation start completion.
1575          */
1576         #define RX_TPA_END_CMPL_AGG_BUFS_MASK   UINT32_C(0x7e)
1577         #define RX_TPA_END_CMPL_AGG_BUFS_SFT    1
1578         /* unused1 is 1 b */
1579         uint8_t tpa_segs;
1580         /* This value is the number of segments in the TPA operation. */
1581         uint8_t payload_offset;
1582         /*
1583          * This value indicates the offset in bytes from the beginning
1584          * of the packet where the inner payload starts. This value is
1585          * valid for TCP, UDP, FCoE, and RoCE packets. A value of zero
1586          * indicates an offset of 256 bytes.
1587          */
1588         uint8_t agg_id;
1589         /*
1590          * This is the aggregation ID that the completion is associated
1591          * with. Use this number to correlate the TPA start completion
1592          * with the TPA end completion.
1593          */
1594         /* unused2 is 1 b */
1595         /*
1596          * This is the aggregation ID that the completion is associated
1597          * with. Use this number to correlate the TPA start completion
1598          * with the TPA end completion.
1599          */
1600         #define RX_TPA_END_CMPL_AGG_ID_MASK     UINT32_C(0xfe)
1601         #define RX_TPA_END_CMPL_AGG_ID_SFT      1
1602         uint32_t tsdelta;
1603         /*
1604          * For non-GRO packets, this value is the timestamp delta
1605          * between earliest and latest timestamp values for TPA packet.
1606          * If packets were not time stamped, then delta will be zero.
1607          * For GRO packets, this field is zero except for the following
1608          * sub-fields. - tsdelta[31] Timestamp present indication. When
1609          * '0', no Timestamp option is in the packet. When '1', then a
1610          * Timestamp option is present in the packet.
1611          */
1612 } __attribute__((packed));
1613
1614 /* last 16 bytes of RX TPA End Completion Record */
1615 struct rx_tpa_end_cmpl_hi {
1616         uint32_t tpa_dup_acks;
1617         /* unused3 is 28 b */
1618         /*
1619          * This value is the number of duplicate ACKs that have been
1620          * received as part of the TPA operation.
1621          */
1622         #define RX_TPA_END_CMPL_TPA_DUP_ACKS_MASK       UINT32_C(0xf)
1623         #define RX_TPA_END_CMPL_TPA_DUP_ACKS_SFT        0
1624         /* unused3 is 28 b */
1625         uint16_t tpa_seg_len;
1626         /*
1627          * This value is the valid when TPA completion is active. It
1628          * indicates the length of the longest segment of the TPA
1629          * operation for LRO mode and the length of the first segment in
1630          * GRO mode. This value may be used by GRO software to re-
1631          * construct the original packet stream from the TPA packet.
1632          * This is the length of all but the last segment for GRO. In
1633          * LRO mode this value may be used to indicate MSS size to the
1634          * stack.
1635          */
1636         uint16_t unused_3;
1637         /* unused4 is 16 b */
1638         uint16_t errors_v2;
1639         /*
1640          * This value is written by the NIC such that it will be
1641          * different for each pass through the completion queue. The
1642          * even passes will write 1. The odd passes will write 0.
1643          */
1644         #define RX_TPA_END_CMPL_V2      UINT32_C(0x1)
1645         /*
1646          * This error indicates that there was some sort of problem with
1647          * the BDs for the packet that was found after part of the
1648          * packet was already placed. The packet should be treated as
1649          * invalid.
1650          */
1651         #define RX_TPA_END_CMPL_ERRORS_BUFFER_ERROR_MASK        UINT32_C(0xe)
1652         #define RX_TPA_END_CMPL_ERRORS_BUFFER_ERROR_SFT 1
1653         /*
1654          * This error occurs when there is a fatal HW
1655          * problem in the chip only. It indicates that
1656          * there were not BDs on chip but that there was
1657          * adequate reservation. provided by the TPA
1658          * block.
1659          */
1660         #define RX_TPA_END_CMPL_ERRORS_BUFFER_ERROR_NOT_ON_CHIP \
1661                 (UINT32_C(0x2) << 1)
1662         /*
1663          * This error occurs when TPA block was not
1664          * configured to reserve adequate BDs for TPA
1665          * operations on this RX ring. All data for the
1666          * TPA operation was not placed. This error can
1667          * also be generated when the number of segments
1668          * is not programmed correctly in TPA and the 33
1669          * total aggregation buffers allowed for the TPA
1670          * operation has been exceeded.
1671          */
1672         #define RX_TPA_END_CMPL_ERRORS_BUFFER_ERROR_RSV_ERROR \
1673                 (UINT32_C(0x4) << 1)
1674         #define RX_TPA_END_CMPL_ERRORS_BUFFER_ERROR_LAST \
1675                 RX_TPA_END_CMPL_ERRORS_BUFFER_ERROR_RSV_ERROR
1676         #define RX_TPA_END_CMPL_ERRORS_MASK     UINT32_C(0xfffe)
1677         #define RX_TPA_END_CMPL_ERRORS_SFT      1
1678         uint16_t unused_4;
1679         /* unused5 is 16 b */
1680         uint32_t start_opaque;
1681         /*
1682          * This is the opaque value that was completed for the TPA start
1683          * completion that corresponds to this TPA end completion.
1684          */
1685 } __attribute__((packed));
1686
1687 /* HWRM Forwarded Request       (16 bytes) */
1688 struct hwrm_fwd_req_cmpl {
1689         uint16_t req_len_type;
1690         /* Length of forwarded request in bytes. */
1691         /*
1692          * This field indicates the exact type of the completion. By
1693          * convention, the LSB identifies the length of the record in
1694          * 16B units. Even values indicate 16B records. Odd values
1695          * indicate 32B records.
1696          */
1697         #define HWRM_FWD_INPUT_CMPL_TYPE_MASK   UINT32_C(0x3f)
1698         #define HWRM_FWD_INPUT_CMPL_TYPE_SFT    0
1699         /* Forwarded HWRM Request */
1700         #define HWRM_FWD_INPUT_CMPL_TYPE_HWRM_FWD_INPUT UINT32_C(0x22)
1701         /* Length of forwarded request in bytes. */
1702         #define HWRM_FWD_REQ_CMPL_REQ_LEN_MASK  UINT32_C(0xffc0)
1703         #define HWRM_FWD_REQ_CMPL_REQ_LEN_SFT   6
1704         uint16_t source_id;
1705         /*
1706          * Source ID of this request. Typically used in forwarding
1707          * requests and responses. 0x0 - 0xFFF8 - Used for function ids
1708          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF -
1709          * HWRM
1710          */
1711         uint32_t unused_0;
1712         /* unused1 is 32 b */
1713         uint32_t req_buf_addr_v[2];
1714         /* Address of forwarded request. */
1715         /*
1716          * This value is written by the NIC such that it will be
1717          * different for each pass through the completion queue. The
1718          * even passes will write 1. The odd passes will write 0.
1719          */
1720         #define HWRM_FWD_INPUT_CMPL_V   UINT32_C(0x1)
1721         /* Address of forwarded request. */
1722         #define HWRM_FWD_REQ_CMPL_REQ_BUF_ADDR_MASK     UINT32_C(0xfffffffe)
1723         #define HWRM_FWD_REQ_CMPL_REQ_BUF_ADDR_SFT      1
1724 } __attribute__((packed));
1725
1726 /* HWRM Asynchronous Event Completion Record    (16 bytes) */
1727 struct hwrm_async_event_cmpl {
1728         uint16_t type;
1729         /* unused1 is 10 b */
1730         /*
1731          * This field indicates the exact type of the completion. By
1732          * convention, the LSB identifies the length of the record in
1733          * 16B units. Even values indicate 16B records. Odd values
1734          * indicate 32B records.
1735          */
1736         #define HWRM_ASYNC_EVENT_CMPL_TYPE_MASK UINT32_C(0x3f)
1737         #define HWRM_ASYNC_EVENT_CMPL_TYPE_SFT  0
1738         /* HWRM Asynchronous Event Information */
1739         #define HWRM_ASYNC_EVENT_CMPL_TYPE_HWRM_ASYNC_EVENT     UINT32_C(0x2e)
1740         /* unused1 is 10 b */
1741         uint16_t event_id;
1742         /* Identifiers of events. */
1743         /* Link status changed */
1744         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE UINT32_C(0x0)
1745         /* Link MTU changed */
1746         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_MTU_CHANGE  UINT32_C(0x1)
1747         /* Link speed changed */
1748         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE UINT32_C(0x2)
1749         /* DCB Configuration changed */
1750         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DCB_CONFIG_CHANGE UINT32_C(0x3)
1751         /* Port connection not allowed */
1752         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED UINT32_C(0x4)
1753         /* Link speed configuration was not allowed */
1754         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_NOT_ALLOWED \
1755                 UINT32_C(0x5)
1756         /* Link speed configuration change */
1757         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE UINT32_C(0x6)
1758         /* Port PHY configuration change */
1759         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_PHY_CFG_CHANGE UINT32_C(0x7)
1760         /* Function driver unloaded */
1761         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_FUNC_DRVR_UNLOAD UINT32_C(0x10)
1762         /* Function driver loaded */
1763         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_FUNC_DRVR_LOAD   UINT32_C(0x11)
1764         /* Function FLR related processing has completed */
1765         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_FUNC_FLR_PROC_CMPLT UINT32_C(0x12)
1766         /* PF driver unloaded */
1767         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD   UINT32_C(0x20)
1768         /* PF driver loaded */
1769         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_LOAD     UINT32_C(0x21)
1770         /* VF Function Level Reset      (FLR) */
1771         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_FLR   UINT32_C(0x30)
1772         /* VF MAC Address Change */
1773         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_MAC_ADDR_CHANGE UINT32_C(0x31)
1774         /* PF-VF communication channel status change. */
1775         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_VF_COMM_STATUS_CHANGE \
1776                 UINT32_C(0x32)
1777         /* VF Configuration Change */
1778         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE    UINT32_C(0x33)
1779         /* LLFC/PFC Configuration Change */
1780         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LLFC_PFC_CHANGE UINT32_C(0x34)
1781         /* HWRM Error */
1782         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_HWRM_ERROR       UINT32_C(0xff)
1783         uint32_t event_data2;
1784         /* Event specific data */
1785         uint8_t opaque_v;
1786         /* opaque is 7 b */
1787         /*
1788          * This value is written by the NIC such that it will be
1789          * different for each pass through the completion queue. The
1790          * even passes will write 1. The odd passes will write 0.
1791          */
1792         #define HWRM_ASYNC_EVENT_CMPL_V UINT32_C(0x1)
1793         /* opaque is 7 b */
1794         #define HWRM_ASYNC_EVENT_CMPL_OPAQUE_MASK       UINT32_C(0xfe)
1795         #define HWRM_ASYNC_EVENT_CMPL_OPAQUE_SFT        1
1796         uint8_t timestamp_lo;
1797         /* 8-lsb timestamp from POR     (100-msec resolution) */
1798         uint16_t timestamp_hi;
1799         /* 16-lsb timestamp from POR    (100-msec resolution) */
1800         uint32_t event_data1;
1801         /* Event specific data */
1802 } __attribute__((packed));
1803
1804 /* hwrm_ver_get */
1805 /*
1806  * Description: This function is called by a driver to determine the HWRM
1807  * interface version supported by the HWRM firmware, the version of HWRM
1808  * firmware implementation, the name of HWRM firmware, the versions of other
1809  * embedded firmwares, and the names of other embedded firmwares, etc. Any
1810  * interface or firmware version with major = 0, minor = 0, and update = 0 shall
1811  * be considered an invalid version.
1812  */
1813 /* Input        (24 bytes) */
1814 struct hwrm_ver_get_input {
1815         uint16_t req_type;
1816         /*
1817          * This value indicates what type of request this is. The format
1818          * for the rest of the command is determined by this field.
1819          */
1820         uint16_t cmpl_ring;
1821         /*
1822          * This value indicates the what completion ring the request
1823          * will be optionally completed on. If the value is -1, then no
1824          * CR completion will be generated. Any other value must be a
1825          * valid CR ring_id value for this function.
1826          */
1827         uint16_t seq_id;
1828         /* This value indicates the command sequence number. */
1829         uint16_t target_id;
1830         /*
1831          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
1832          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
1833          * - HWRM
1834          */
1835         uint64_t resp_addr;
1836         /*
1837          * This is the host address where the response will be written
1838          * when the request is complete. This area must be 16B aligned
1839          * and must be cleared to zero before the request is made.
1840          */
1841         uint8_t hwrm_intf_maj;
1842         /*
1843          * This field represents the major version of HWRM interface
1844          * specification supported by the driver HWRM implementation.
1845          * The interface major version is intended to change only when
1846          * non backward compatible changes are made to the HWRM
1847          * interface specification.
1848          */
1849         uint8_t hwrm_intf_min;
1850         /*
1851          * This field represents the minor version of HWRM interface
1852          * specification supported by the driver HWRM implementation. A
1853          * change in interface minor version is used to reflect
1854          * significant backward compatible modification to HWRM
1855          * interface specification. This can be due to addition or
1856          * removal of functionality. HWRM interface specifications with
1857          * the same major version but different minor versions are
1858          * compatible.
1859          */
1860         uint8_t hwrm_intf_upd;
1861         /*
1862          * This field represents the update version of HWRM interface
1863          * specification supported by the driver HWRM implementation.
1864          * The interface update version is used to reflect minor changes
1865          * or bug fixes to a released HWRM interface specification.
1866          */
1867         uint8_t unused_0[5];
1868 } __attribute__((packed));
1869
1870 /* Output       (128 bytes) */
1871 struct hwrm_ver_get_output {
1872         uint16_t error_code;
1873         /*
1874          * Pass/Fail or error type Note: receiver to verify the in
1875          * parameters, and fail the call with an error when appropriate
1876          */
1877         uint16_t req_type;
1878         /* This field returns the type of original request. */
1879         uint16_t seq_id;
1880         /* This field provides original sequence number of the command. */
1881         uint16_t resp_len;
1882         /*
1883          * This field is the length of the response in bytes. The last
1884          * byte of the response is a valid flag that will read as '1'
1885          * when the command has been completely written to memory.
1886          */
1887         uint8_t hwrm_intf_maj;
1888         /*
1889          * This field represents the major version of HWRM interface
1890          * specification supported by the HWRM implementation. The
1891          * interface major version is intended to change only when non
1892          * backward compatible changes are made to the HWRM interface
1893          * specification. A HWRM implementation that is compliant with
1894          * this specification shall provide value of 1 in this field.
1895          */
1896         uint8_t hwrm_intf_min;
1897         /*
1898          * This field represents the minor version of HWRM interface
1899          * specification supported by the HWRM implementation. A change
1900          * in interface minor version is used to reflect significant
1901          * backward compatible modification to HWRM interface
1902          * specification. This can be due to addition or removal of
1903          * functionality. HWRM interface specifications with the same
1904          * major version but different minor versions are compatible. A
1905          * HWRM implementation that is compliant with this specification
1906          * shall provide value of 2 in this field.
1907          */
1908         uint8_t hwrm_intf_upd;
1909         /*
1910          * This field represents the update version of HWRM interface
1911          * specification supported by the HWRM implementation. The
1912          * interface update version is used to reflect minor changes or
1913          * bug fixes to a released HWRM interface specification. A HWRM
1914          * implementation that is compliant with this specification
1915          * shall provide value of 2 in this field.
1916          */
1917         uint8_t hwrm_intf_rsvd;
1918         uint8_t hwrm_fw_maj;
1919         /*
1920          * This field represents the major version of HWRM firmware. A
1921          * change in firmware major version represents a major firmware
1922          * release.
1923          */
1924         uint8_t hwrm_fw_min;
1925         /*
1926          * This field represents the minor version of HWRM firmware. A
1927          * change in firmware minor version represents significant
1928          * firmware functionality changes.
1929          */
1930         uint8_t hwrm_fw_bld;
1931         /*
1932          * This field represents the build version of HWRM firmware. A
1933          * change in firmware build version represents bug fixes to a
1934          * released firmware.
1935          */
1936         uint8_t hwrm_fw_rsvd;
1937         /*
1938          * This field is a reserved field. This field can be used to
1939          * represent firmware branches or customer specific releases
1940          * tied to a specific   (major,minor,update) version of the HWRM
1941          * firmware.
1942          */
1943         uint8_t mgmt_fw_maj;
1944         /*
1945          * This field represents the major version of mgmt firmware. A
1946          * change in major version represents a major release.
1947          */
1948         uint8_t mgmt_fw_min;
1949         /*
1950          * This field represents the minor version of mgmt firmware. A
1951          * change in minor version represents significant functionality
1952          * changes.
1953          */
1954         uint8_t mgmt_fw_bld;
1955         /*
1956          * This field represents the build version of mgmt firmware. A
1957          * change in update version represents bug fixes.
1958          */
1959         uint8_t mgmt_fw_rsvd;
1960         /*
1961          * This field is a reserved field. This field can be used to
1962          * represent firmware branches or customer specific releases
1963          * tied to a specific   (major,minor,update) version
1964          */
1965         uint8_t netctrl_fw_maj;
1966         /*
1967          * This field represents the major version of network control
1968          * firmware. A change in major version represents a major
1969          * release.
1970          */
1971         uint8_t netctrl_fw_min;
1972         /*
1973          * This field represents the minor version of network control
1974          * firmware. A change in minor version represents significant
1975          * functionality changes.
1976          */
1977         uint8_t netctrl_fw_bld;
1978         /*
1979          * This field represents the build version of network control
1980          * firmware. A change in update version represents bug fixes.
1981          */
1982         uint8_t netctrl_fw_rsvd;
1983         /*
1984          * This field is a reserved field. This field can be used to
1985          * represent firmware branches or customer specific releases
1986          * tied to a specific   (major,minor,update) version
1987          */
1988         uint32_t dev_caps_cfg;
1989         /*
1990          * This field is used to indicate device's capabilities and
1991          * configurations.
1992          */
1993         /*
1994          * If set to 1, then secure firmware update behavior is
1995          * supported. If set to 0, then secure firmware update behavior
1996          * is not supported.
1997          */
1998         #define HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SECURE_FW_UPD_SUPPORTED  \
1999                 UINT32_C(0x1)
2000         /*
2001          * If set to 1, then firmware based DCBX agent is supported. If
2002          * set to 0, then firmware based DCBX agent capability is not
2003          * supported on this device.
2004          */
2005         #define HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_FW_DCBX_AGENT_SUPPORTED  \
2006                 UINT32_C(0x2)
2007         /*
2008          * If set to 1, then HWRM short command format is supported. If
2009          * set to 0, then HWRM short command format is not supported.
2010          */
2011         #define HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_SUPPORTED     \
2012                 UINT32_C(0x4)
2013         /*
2014          * If set to 1, then HWRM short command format is required. If
2015          * set to 0, then HWRM short command format is not required.
2016          */
2017         #define HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_INPUTUIRED   \
2018                 UINT32_C(0x8)
2019         uint8_t roce_fw_maj;
2020         /*
2021          * This field represents the major version of RoCE firmware. A
2022          * change in major version represents a major release.
2023          */
2024         uint8_t roce_fw_min;
2025         /*
2026          * This field represents the minor version of RoCE firmware. A
2027          * change in minor version represents significant functionality
2028          * changes.
2029          */
2030         uint8_t roce_fw_bld;
2031         /*
2032          * This field represents the build version of RoCE firmware. A
2033          * change in update version represents bug fixes.
2034          */
2035         uint8_t roce_fw_rsvd;
2036         /*
2037          * This field is a reserved field. This field can be used to
2038          * represent firmware branches or customer specific releases
2039          * tied to a specific   (major,minor,update) version
2040          */
2041         char hwrm_fw_name[16];
2042         /*
2043          * This field represents the name of HWRM FW    (ASCII chars with
2044          * NULL at the end).
2045          */
2046         char mgmt_fw_name[16];
2047         /*
2048          * This field represents the name of mgmt FW    (ASCII chars with
2049          * NULL at the end).
2050          */
2051         char netctrl_fw_name[16];
2052         /*
2053          * This field represents the name of network control firmware
2054          *      (ASCII chars with NULL at the end).
2055          */
2056         uint32_t reserved2[4];
2057         /*
2058          * This field is reserved for future use. The responder should
2059          * set it to 0. The requester should ignore this field.
2060          */
2061         char roce_fw_name[16];
2062         /*
2063          * This field represents the name of RoCE FW    (ASCII chars with
2064          * NULL at the end).
2065          */
2066         uint16_t chip_num;
2067         /* This field returns the chip number. */
2068         uint8_t chip_rev;
2069         /* This field returns the revision of chip. */
2070         uint8_t chip_metal;
2071         /* This field returns the chip metal number. */
2072         uint8_t chip_bond_id;
2073         /* This field returns the bond id of the chip. */
2074         uint8_t chip_platform_type;
2075         /*
2076          * This value indicates the type of platform used for chip
2077          * implementation.
2078          */
2079         /* ASIC */
2080         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_ASIC     UINT32_C(0x0)
2081         /* FPGA platform of the chip. */
2082         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_FPGA     UINT32_C(0x1)
2083         /* Palladium platform of the chip. */
2084         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_PALLADIUM UINT32_C(0x2)
2085         uint16_t max_req_win_len;
2086         /*
2087          * This field returns the maximum value of request window that
2088          * is supported by the HWRM. The request window is mapped into
2089          * device address space using MMIO.
2090          */
2091         uint16_t max_resp_len;
2092         /* This field returns the maximum value of response buffer in bytes. */
2093         uint16_t def_req_timeout;
2094         /*
2095          * This field returns the default request timeout value in
2096          * milliseconds.
2097          */
2098         uint8_t init_pending;
2099         /*
2100          * This field will indicate if any subsystems is not fully
2101          * initialized.
2102          */
2103         /*
2104          * If set to 1, device is not ready. If set to 0, device is
2105          * ready to accept all HWRM commands.
2106          */
2107         #define HWRM_VER_GET_OUTPUT_INIT_PENDING_DEV_NOT_RDY UINT32_C(0x1)
2108         uint8_t unused_0;
2109         uint8_t unused_1;
2110         uint8_t valid;
2111         /*
2112          * This field is used in Output records to indicate that the
2113          * output is completely written to RAM. This field should be
2114          * read as '1' to indicate that the output has been completely
2115          * written. When writing a command completion or response to an
2116          * internal processor, the order of writes has to be such that
2117          * this field is written last.
2118          */
2119 } __attribute__((packed));
2120
2121 /* hwrm_func_reset */
2122 /*
2123  * Description: This command resets a hardware function (PCIe function) and
2124  * frees any resources used by the function. This command shall be initiated by
2125  * the driver after an FLR has occurred to prepare the function for re-use. This
2126  * command may also be initiated by a driver prior to doing it's own
2127  * configuration. This command puts the function into the reset state. In the
2128  * reset state, global and port related features of the chip are not available.
2129  */
2130 /*
2131  * Note: This command will reset a function that has already been disabled or
2132  * idled. The command returns all the resources owned by the function so a new
2133  * driver may allocate and configure resources normally.
2134  */
2135 /* Input        (24 bytes) */
2136 struct hwrm_func_reset_input {
2137         uint16_t req_type;
2138         /*
2139          * This value indicates what type of request this is. The format
2140          * for the rest of the command is determined by this field.
2141          */
2142         uint16_t cmpl_ring;
2143         /*
2144          * This value indicates the what completion ring the request
2145          * will be optionally completed on. If the value is -1, then no
2146          * CR completion will be generated. Any other value must be a
2147          * valid CR ring_id value for this function.
2148          */
2149         uint16_t seq_id;
2150         /* This value indicates the command sequence number. */
2151         uint16_t target_id;
2152         /*
2153          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
2154          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
2155          * - HWRM
2156          */
2157         uint64_t resp_addr;
2158         /*
2159          * This is the host address where the response will be written
2160          * when the request is complete. This area must be 16B aligned
2161          * and must be cleared to zero before the request is made.
2162          */
2163         uint32_t enables;
2164         /* This bit must be '1' for the vf_id_valid field to be configured. */
2165         #define HWRM_FUNC_RESET_INPUT_ENABLES_VF_ID_VALID       UINT32_C(0x1)
2166         uint16_t vf_id;
2167         /*
2168          * The ID of the VF that this PF is trying to reset. Only the
2169          * parent PF shall be allowed to reset a child VF. A parent PF
2170          * driver shall use this field only when a specific child VF is
2171          * requested to be reset.
2172          */
2173         uint8_t func_reset_level;
2174         /* This value indicates the level of a function reset. */
2175         /*
2176          * Reset the caller function and its children
2177          * VFs  (if any). If no children functions exist,
2178          * then reset the caller function only.
2179          */
2180         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETALL UINT32_C(0x0)
2181         /* Reset the caller function only */
2182         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETME  UINT32_C(0x1)
2183         /*
2184          * Reset all children VFs of the caller function
2185          * driver if the caller is a PF driver. It is an
2186          * error to specify this level by a VF driver.
2187          * It is an error to specify this level by a PF
2188          * driver with no children VFs.
2189          */
2190         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETCHILDREN \
2191                 UINT32_C(0x2)
2192         /*
2193          * Reset a specific VF of the caller function
2194          * driver if the caller is the parent PF driver.
2195          * It is an error to specify this level by a VF
2196          * driver. It is an error to specify this level
2197          * by a PF driver that is not the parent of the
2198          * VF that is being requested to reset.
2199          */
2200         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETVF  UINT32_C(0x3)
2201         uint8_t unused_0;
2202 } __attribute__((packed));
2203
2204 /* Output       (16 bytes) */
2205 struct hwrm_func_reset_output {
2206         uint16_t error_code;
2207         /*
2208          * Pass/Fail or error type Note: receiver to verify the in
2209          * parameters, and fail the call with an error when appropriate
2210          */
2211         uint16_t req_type;
2212         /* This field returns the type of original request. */
2213         uint16_t seq_id;
2214         /* This field provides original sequence number of the command. */
2215         uint16_t resp_len;
2216         /*
2217          * This field is the length of the response in bytes. The last
2218          * byte of the response is a valid flag that will read as '1'
2219          * when the command has been completely written to memory.
2220          */
2221         uint32_t unused_0;
2222         uint8_t unused_1;
2223         uint8_t unused_2;
2224         uint8_t unused_3;
2225         uint8_t valid;
2226         /*
2227          * This field is used in Output records to indicate that the
2228          * output is completely written to RAM. This field should be
2229          * read as '1' to indicate that the output has been completely
2230          * written. When writing a command completion or response to an
2231          * internal processor, the order of writes has to be such that
2232          * this field is written last.
2233          */
2234 } __attribute__((packed));
2235
2236 /* hwrm_func_vf_cfg */
2237 /*
2238  * Description: This command allows configuration of a VF by its driver. If this
2239  * function is called by a PF driver, then the HWRM shall fail this command. If
2240  * guest VLAN and/or MAC address are provided in this command, then the HWRM
2241  * shall set up appropriate MAC/VLAN filters for the VF that is being
2242  * configured. A VF driver should set VF MTU/MRU using this command prior to
2243  * allocating RX VNICs or TX rings for the corresponding VF.
2244  */
2245 /* Input (32 bytes) */
2246 struct hwrm_func_vf_cfg_input {
2247         uint16_t req_type;
2248         /*
2249          * This value indicates what type of request this is. The format for the
2250          * rest of the command is determined by this field.
2251          */
2252         uint16_t cmpl_ring;
2253         /*
2254          * This value indicates the what completion ring the request will be
2255          * optionally completed on. If the value is -1, then no CR completion
2256          * will be generated. Any other value must be a valid CR ring_id value
2257          * for this function.
2258          */
2259         uint16_t seq_id;
2260         /* This value indicates the command sequence number. */
2261         uint16_t target_id;
2262         /*
2263          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
2264          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
2265          */
2266         uint64_t resp_addr;
2267         /*
2268          * This is the host address where the response will be written when the
2269          * request is complete. This area must be 16B aligned and must be
2270          * cleared to zero before the request is made.
2271          */
2272         uint32_t enables;
2273         /* This bit must be '1' for the mtu field to be configured. */
2274         #define HWRM_FUNC_VF_CFG_INPUT_ENABLES_MTU                 UINT32_C(0x1)
2275         /* This bit must be '1' for the guest_vlan field to be configured. */
2276         #define HWRM_FUNC_VF_CFG_INPUT_ENABLES_GUEST_VLAN          UINT32_C(0x2)
2277         /*
2278          * This bit must be '1' for the async_event_cr field to be configured.
2279          */
2280         #define HWRM_FUNC_VF_CFG_INPUT_ENABLES_ASYNC_EVENT_CR      UINT32_C(0x4)
2281         /* This bit must be '1' for the dflt_mac_addr field to be configured. */
2282         #define HWRM_FUNC_VF_CFG_INPUT_ENABLES_DFLT_MAC_ADDR       UINT32_C(0x8)
2283         uint16_t mtu;
2284         /*
2285          * The maximum transmission unit requested on the function. The HWRM
2286          * should make sure that the mtu of the function does not exceed the mtu
2287          * of the physical port that this function is associated with. In
2288          * addition to requesting mtu per function, it is possible to configure
2289          * mtu per transmit ring. By default, the mtu of each transmit ring
2290          * associated with a function is equal to the mtu of the function. The
2291          * HWRM should make sure that the mtu of each transmit ring that is
2292          * assigned to a function has a valid mtu.
2293          */
2294         uint16_t guest_vlan;
2295         /*
2296          * The guest VLAN for the function being configured. This field's format
2297          * is same as 802.1Q Tag's Tag Control Information (TCI) format that
2298          * includes both Priority Code Point (PCP) and VLAN Identifier (VID).
2299          */
2300         uint16_t async_event_cr;
2301         /*
2302          * ID of the target completion ring for receiving asynchronous event
2303          * completions. If this field is not valid, then the HWRM shall use the
2304          * default completion ring of the function that is being configured as
2305          * the target completion ring for providing any asynchronous event
2306          * completions for that function. If this field is valid, then the HWRM
2307          * shall use the completion ring identified by this ID as the target
2308          * completion ring for providing any asynchronous event completions for
2309          * the function that is being configured.
2310          */
2311         uint8_t dflt_mac_addr[6];
2312         /*
2313          * This value is the current MAC address requested by the VF driver to
2314          * be configured on this VF. A value of 00-00-00-00-00-00 indicates no
2315          * MAC address configuration is requested by the VF driver. The parent
2316          * PF driver may reject or overwrite this MAC address.
2317          */
2318 } __attribute__((packed));
2319
2320 /* Output (16 bytes) */
2321
2322 struct hwrm_func_vf_cfg_output {
2323         uint16_t error_code;
2324         /*
2325          * Pass/Fail or error type Note: receiver to verify the in parameters,
2326          * and fail the call with an error when appropriate
2327          */
2328         uint16_t req_type;
2329         /* This field returns the type of original request. */
2330         uint16_t seq_id;
2331         /* This field provides original sequence number of the command. */
2332         uint16_t resp_len;
2333         /*
2334          * This field is the length of the response in bytes. The last
2335          * byte of the response is a valid flag that will read as '1'
2336          * when the command has been completely written to memory.
2337          */
2338         uint32_t unused_0;
2339         uint8_t unused_1;
2340         uint8_t unused_2;
2341         uint8_t unused_3;
2342         uint8_t valid;
2343         /*
2344          * This field is used in Output records to indicate that the output is
2345          * completely written to RAM. This field should be read as '1' to
2346          * indicate that the output has been completely written. When writing a
2347          * command completion or response to an internal processor, the order of
2348          * writes has to be such that this field is written last.
2349          */
2350 } __attribute__((packed));
2351
2352 /* hwrm_func_qcaps */
2353 /*
2354  * Description: This command returns capabilities of a function. The input FID
2355  * value is used to indicate what function is being queried. This allows a
2356  * physical function driver to query virtual functions that are children of the
2357  * physical function. The output FID value is needed to configure Rings and
2358  * MSI-X vectors so their DMA operations appear correctly on the PCI bus.
2359  */
2360 /* Input        (24 bytes) */
2361 struct hwrm_func_qcaps_input {
2362         uint16_t req_type;
2363         /*
2364          * This value indicates what type of request this is. The format
2365          * for the rest of the command is determined by this field.
2366          */
2367         uint16_t cmpl_ring;
2368         /*
2369          * This value indicates the what completion ring the request
2370          * will be optionally completed on. If the value is -1, then no
2371          * CR completion will be generated. Any other value must be a
2372          * valid CR ring_id value for this function.
2373          */
2374         uint16_t seq_id;
2375         /* This value indicates the command sequence number. */
2376         uint16_t target_id;
2377         /*
2378          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
2379          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
2380          * - HWRM
2381          */
2382         uint64_t resp_addr;
2383         /*
2384          * This is the host address where the response will be written
2385          * when the request is complete. This area must be 16B aligned
2386          * and must be cleared to zero before the request is made.
2387          */
2388         uint16_t fid;
2389         /*
2390          * Function ID of the function that is being queried. 0xFF...
2391          *      (All Fs) if the query is for the requesting function.
2392          */
2393         uint16_t unused_0[3];
2394 } __attribute__((packed));
2395
2396 /* Output       (80 bytes) */
2397 struct hwrm_func_qcaps_output {
2398         uint16_t error_code;
2399         /*
2400          * Pass/Fail or error type Note: receiver to verify the in
2401          * parameters, and fail the call with an error when appropriate
2402          */
2403         uint16_t req_type;
2404         /* This field returns the type of original request. */
2405         uint16_t seq_id;
2406         /* This field provides original sequence number of the command. */
2407         uint16_t resp_len;
2408         /*
2409          * This field is the length of the response in bytes. The last
2410          * byte of the response is a valid flag that will read as '1'
2411          * when the command has been completely written to memory.
2412          */
2413         uint16_t fid;
2414         /*
2415          * FID value. This value is used to identify operations on the
2416          * PCI bus as belonging to a particular PCI function.
2417          */
2418         uint16_t port_id;
2419         /*
2420          * Port ID of port that this function is associated with. Valid
2421          * only for the PF. 0xFF...     (All Fs) if this function is not
2422          * associated with any port. 0xFF...    (All Fs) if this function
2423          * is called from a VF.
2424          */
2425         uint32_t flags;
2426         /* If 1, then Push mode is supported on this function. */
2427         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PUSH_MODE_SUPPORTED UINT32_C(0x1)
2428         /*
2429          * If 1, then the global MSI-X auto-masking is enabled for the
2430          * device.
2431          */
2432         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_GLOBAL_MSIX_AUTOMASKING     \
2433                 UINT32_C(0x2)
2434         /*
2435          * If 1, then the Precision Time Protocol       (PTP) processing is
2436          * supported on this function. The HWRM should enable PTP on
2437          * only a single Physical Function      (PF) per port.
2438          */
2439         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED      UINT32_C(0x4)
2440         /*
2441          * If 1, then RDMA over Converged Ethernet      (RoCE) v1 is
2442          * supported on this function.
2443          */
2444         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ROCE_V1_SUPPORTED UINT32_C(0x8)
2445         /*
2446          * If 1, then RDMA over Converged Ethernet      (RoCE) v2 is
2447          * supported on this function.
2448          */
2449         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ROCE_V2_SUPPORTED UINT32_C(0x10)
2450         /*
2451          * If 1, then control and configuration of WoL magic packet are
2452          * supported on this function.
2453          */
2454         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_WOL_MAGICPKT_SUPPORTED     \
2455                 UINT32_C(0x20)
2456         /*
2457          * If 1, then control and configuration of bitmap pattern packet
2458          * are supported on this function.
2459          */
2460         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_WOL_BMP_SUPPORTED UINT32_C(0x40)
2461         /*
2462          * If set to 1, then the control and configuration of rate limit
2463          * of an allocated TX ring on the queried function is supported.
2464          */
2465         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_TX_RING_RL_SUPPORTED UINT32_C(0x80)
2466         /*
2467          * If 1, then control and configuration of minimum and maximum
2468          * bandwidths are supported on the queried function.
2469          */
2470         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_TX_BW_CFG_SUPPORTED UINT32_C(0x100)
2471         /*
2472          * If the query is for a VF, then this flag shall be ignored. If
2473          * this query is for a PF and this flag is set to 1, then the PF
2474          * has the capability to set the rate limits on the TX rings of
2475          * its children VFs. If this query is for a PF and this flag is
2476          * set to 0, then the PF does not have the capability to set the
2477          * rate limits on the TX rings of its children VFs.
2478          */
2479         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VF_TX_RING_RL_SUPPORTED     \
2480                 UINT32_C(0x200)
2481         /*
2482          * If the query is for a VF, then this flag shall be ignored. If
2483          * this query is for a PF and this flag is set to 1, then the PF
2484          * has the capability to set the minimum and/or maximum
2485          * bandwidths for its children VFs. If this query is for a PF
2486          * and this flag is set to 0, then the PF does not have the
2487          * capability to set the minimum or maximum bandwidths for its
2488          * children VFs.
2489          */
2490         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VF_BW_CFG_SUPPORTED UINT32_C(0x400)
2491         /*
2492          * Standard TX Ring mode is used for the allocation of TX ring
2493          * and underlying scheduling resources that allow bandwidth
2494          * reservation and limit settings on the queried function. If
2495          * set to 1, then standard TX ring mode is supported on the
2496          * queried function. If set to 0, then standard TX ring mode is
2497          * not available on the queried function.
2498          */
2499         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_STD_TX_RING_MODE_SUPPORTED   \
2500                 UINT32_C(0x800)
2501         uint8_t mac_address[6];
2502         /*
2503          * This value is current MAC address configured for this
2504          * function. A value of 00-00-00-00-00-00 indicates no MAC
2505          * address is currently configured.
2506          */
2507         uint16_t max_rsscos_ctx;
2508         /*
2509          * The maximum number of RSS/COS contexts that can be allocated
2510          * to the function.
2511          */
2512         uint16_t max_cmpl_rings;
2513         /*
2514          * The maximum number of completion rings that can be allocated
2515          * to the function.
2516          */
2517         uint16_t max_tx_rings;
2518         /*
2519          * The maximum number of transmit rings that can be allocated to
2520          * the function.
2521          */
2522         uint16_t max_rx_rings;
2523         /*
2524          * The maximum number of receive rings that can be allocated to
2525          * the function.
2526          */
2527         uint16_t max_l2_ctxs;
2528         /*
2529          * The maximum number of L2 contexts that can be allocated to
2530          * the function.
2531          */
2532         uint16_t max_vnics;
2533         /*
2534          * The maximum number of VNICs that can be allocated to the
2535          * function.
2536          */
2537         uint16_t first_vf_id;
2538         /*
2539          * The identifier for the first VF enabled on a PF. This is
2540          * valid only on the PF with SR-IOV enabled. 0xFF...    (All Fs) if
2541          * this command is called on a PF with SR-IOV disabled or on a
2542          * VF.
2543          */
2544         uint16_t max_vfs;
2545         /*
2546          * The maximum number of VFs that can be allocated to the
2547          * function. This is valid only on the PF with SR-IOV enabled.
2548          * 0xFF...      (All Fs) if this command is called on a PF with SR-
2549          * IOV disabled or on a VF.
2550          */
2551         uint16_t max_stat_ctx;
2552         /*
2553          * The maximum number of statistic contexts that can be
2554          * allocated to the function.
2555          */
2556         uint32_t max_encap_records;
2557         /*
2558          * The maximum number of Encapsulation records that can be
2559          * offloaded by this function.
2560          */
2561         uint32_t max_decap_records;
2562         /*
2563          * The maximum number of decapsulation records that can be
2564          * offloaded by this function.
2565          */
2566         uint32_t max_tx_em_flows;
2567         /*
2568          * The maximum number of Exact Match    (EM) flows that can be
2569          * offloaded by this function on the TX side.
2570          */
2571         uint32_t max_tx_wm_flows;
2572         /*
2573          * The maximum number of Wildcard Match (WM) flows that can be
2574          * offloaded by this function on the TX side.
2575          */
2576         uint32_t max_rx_em_flows;
2577         /*
2578          * The maximum number of Exact Match    (EM) flows that can be
2579          * offloaded by this function on the RX side.
2580          */
2581         uint32_t max_rx_wm_flows;
2582         /*
2583          * The maximum number of Wildcard Match (WM) flows that can be
2584          * offloaded by this function on the RX side.
2585          */
2586         uint32_t max_mcast_filters;
2587         /*
2588          * The maximum number of multicast filters that can be supported
2589          * by this function on the RX side.
2590          */
2591         uint32_t max_flow_id;
2592         /*
2593          * The maximum value of flow_id that can be supported in
2594          * completion records.
2595          */
2596         uint32_t max_hw_ring_grps;
2597         /*
2598          * The maximum number of HW ring groups that can be supported on
2599          * this function.
2600          */
2601         uint16_t max_sp_tx_rings;
2602         /*
2603          * The maximum number of strict priority transmit rings that can
2604          * be allocated to the function. This number indicates the
2605          * maximum number of TX rings that can be assigned strict
2606          * priorities out of the maximum number of TX rings that can be
2607          * allocated    (max_tx_rings) to the function.
2608          */
2609         uint8_t unused_0;
2610         uint8_t valid;
2611         /*
2612          * This field is used in Output records to indicate that the
2613          * output is completely written to RAM. This field should be
2614          * read as '1' to indicate that the output has been completely
2615          * written. When writing a command completion or response to an
2616          * internal processor, the order of writes has to be such that
2617          * this field is written last.
2618          */
2619 } __attribute__((packed));
2620
2621 /* hwrm_func_qcfg */
2622 /*
2623  * Description: This command returns the current configuration of a function.
2624  * The input FID value is used to indicate what function is being queried. This
2625  * allows a physical function driver to query virtual functions that are
2626  * children of the physical function. The output FID value is needed to
2627  * configure Rings and MSI-X vectors so their DMA operations appear correctly on
2628  * the PCI bus. This command should be called by every driver after
2629  * 'hwrm_func_cfg' to get the actual number of resources allocated by the HWRM.
2630  * The values returned by hwrm_func_qcfg are the values the driver shall use.
2631  * These values may be different than what was originally requested in the
2632  * 'hwrm_func_cfg' command.
2633  */
2634 /* Input        (24 bytes) */
2635 struct hwrm_func_qcfg_input {
2636         uint16_t req_type;
2637         /*
2638          * This value indicates what type of request this is. The format
2639          * for the rest of the command is determined by this field.
2640          */
2641         uint16_t cmpl_ring;
2642         /*
2643          * This value indicates the what completion ring the request
2644          * will be optionally completed on. If the value is -1, then no
2645          * CR completion will be generated. Any other value must be a
2646          * valid CR ring_id value for this function.
2647          */
2648         uint16_t seq_id;
2649         /* This value indicates the command sequence number. */
2650         uint16_t target_id;
2651         /*
2652          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
2653          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
2654          * - HWRM
2655          */
2656         uint64_t resp_addr;
2657         /*
2658          * This is the host address where the response will be written
2659          * when the request is complete. This area must be 16B aligned
2660          * and must be cleared to zero before the request is made.
2661          */
2662         uint16_t fid;
2663         /*
2664          * Function ID of the function that is being queried. 0xFF...
2665          *      (All Fs) if the query is for the requesting function.
2666          */
2667         uint16_t unused_0[3];
2668 } __attribute__((packed));
2669
2670 /* Output       (72 bytes) */
2671 struct hwrm_func_qcfg_output {
2672         uint16_t error_code;
2673         /*
2674          * Pass/Fail or error type Note: receiver to verify the in
2675          * parameters, and fail the call with an error when appropriate
2676          */
2677         uint16_t req_type;
2678         /* This field returns the type of original request. */
2679         uint16_t seq_id;
2680         /* This field provides original sequence number of the command. */
2681         uint16_t resp_len;
2682         /*
2683          * This field is the length of the response in bytes. The last
2684          * byte of the response is a valid flag that will read as '1'
2685          * when the command has been completely written to memory.
2686          */
2687         uint16_t fid;
2688         /*
2689          * FID value. This value is used to identify operations on the
2690          * PCI bus as belonging to a particular PCI function.
2691          */
2692         uint16_t port_id;
2693         /*
2694          * Port ID of port that this function is associated with.
2695          * 0xFF...      (All Fs) if this function is not associated with any
2696          * port.
2697          */
2698         uint16_t vlan;
2699         /*
2700          * This value is the current VLAN setting for this function. The
2701          * value of 0 for this field indicates no priority tagging or
2702          * VLAN is used. This field's format is same as 802.1Q Tag's Tag
2703          * Control Information  (TCI) format that includes both Priority
2704          * Code Point   (PCP) and VLAN Identifier       (VID).
2705          */
2706         uint16_t flags;
2707         /*
2708          * If 1, then magic packet based Out-Of-Box WoL is enabled on
2709          * the port associated with this function.
2710          */
2711         #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_OOB_WOL_MAGICPKT_ENABLED     \
2712                 UINT32_C(0x1)
2713         /*
2714          * If 1, then bitmap pattern based Out-Of-Box WoL packet is
2715          * enabled on the port associated with this function.
2716          */
2717         #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_OOB_WOL_BMP_ENABLED UINT32_C(0x2)
2718         /*
2719          * If set to 1, then FW based DCBX agent is enabled and running
2720          * on the port associated with this function. If set to 0, then
2721          * DCBX agent is not running in the firmware.
2722          */
2723         #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_FW_DCBX_AGENT_ENABLED \
2724                 UINT32_C(0x4)
2725         /*
2726          * Standard TX Ring mode is used for the allocation of TX ring
2727          * and underlying scheduling resources that allow bandwidth
2728          * reservation and limit settings on the queried function. If
2729          * set to 1, then standard TX ring mode is enabled on the
2730          * queried function. If set to 0, then the standard TX ring mode
2731          * is disabled on the queried function. In this extended TX ring
2732          * resource mode, the minimum and maximum bandwidth settings are
2733          * not supported to allow the allocation of TX rings to span
2734          * multiple scheduler nodes.
2735          */
2736         #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_STD_TX_RING_MODE_ENABLED     \
2737                 UINT32_C(0x8)
2738         /*
2739          * If set to 1 then FW based LLDP agent is enabled and running
2740          * on the port associated with this function. If set to 0 then
2741          * the LLDP agent is not running in the firmware.
2742          */
2743         #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_FW_LLDP_AGENT_ENABLED UINT32_C(0x10)
2744         /*
2745          * If set to 1, then multi-host mode is active for this
2746          * function. If set to 0, then multi-host mode is inactive for
2747          * this function or not applicable for this device.
2748          */
2749         #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_HOST          UINT32_C(0x20)
2750         uint8_t mac_address[6];
2751         /*
2752          * This value is current MAC address configured for this
2753          * function. A value of 00-00-00-00-00-00 indicates no MAC
2754          * address is currently configured.
2755          */
2756         uint16_t pci_id;
2757         /*
2758          * This value is current PCI ID of this function. If ARI is
2759          * enabled, then it is Bus Number       (8b):Function Number(8b).
2760          * Otherwise, it is Bus Number  (8b):Device Number      (4b):Function
2761          * Number(4b).
2762          */
2763         uint16_t alloc_rsscos_ctx;
2764         /*
2765          * The number of RSS/COS contexts currently allocated to the
2766          * function.
2767          */
2768         uint16_t alloc_cmpl_rings;
2769         /*
2770          * The number of completion rings currently allocated to the
2771          * function. This does not include the rings allocated to any
2772          * children functions if any.
2773          */
2774         uint16_t alloc_tx_rings;
2775         /*
2776          * The number of transmit rings currently allocated to the
2777          * function. This does not include the rings allocated to any
2778          * children functions if any.
2779          */
2780         uint16_t alloc_rx_rings;
2781         /*
2782          * The number of receive rings currently allocated to the
2783          * function. This does not include the rings allocated to any
2784          * children functions if any.
2785          */
2786         uint16_t alloc_l2_ctx;
2787         /* The allocated number of L2 contexts to the function. */
2788         uint16_t alloc_vnics;
2789         /* The allocated number of vnics to the function. */
2790         uint16_t mtu;
2791         /*
2792          * The maximum transmission unit of the function. For rings
2793          * allocated on this function, this default value is used if
2794          * ring MTU is not specified.
2795          */
2796         uint16_t mru;
2797         /*
2798          * The maximum receive unit of the function. For vnics allocated
2799          * on this function, this default value is used if vnic MRU is
2800          * not specified.
2801          */
2802         uint16_t stat_ctx_id;
2803         /* The statistics context assigned to a function. */
2804         uint8_t port_partition_type;
2805         /*
2806          * The HWRM shall return Unknown value for this field when this
2807          * command is used to query VF's configuration.
2808          */
2809         /* Single physical function */
2810         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_SPF   UINT32_C(0x0)
2811         /* Multiple physical functions */
2812         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_MPFS  UINT32_C(0x1)
2813         /* Network Partitioning 1.0 */
2814         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_0 UINT32_C(0x2)
2815         /* Network Partitioning 1.5 */
2816         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_5 UINT32_C(0x3)
2817         /* Network Partitioning 2.0 */
2818         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR2_0 UINT32_C(0x4)
2819         /* Unknown */
2820         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_UNKNOWN UINT32_C(0xff)
2821         uint8_t port_pf_cnt;
2822         /*
2823          * This field will indicate number of physical functions on this
2824          * port_partition. HWRM shall return unavail (i.e. value of 0)
2825          * for this field when this command is used to query VF's
2826          * configuration or from older firmware that doesn't support
2827          * this field.
2828          */
2829         /* number of PFs is not available */
2830         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PF_CNT_UNAVAIL       UINT32_C(0x0)
2831         uint16_t dflt_vnic_id;
2832         /* The default VNIC ID assigned to a function that is being queried. */
2833         uint16_t max_mtu_configured;
2834         /*
2835          * This value specifies the MAX MTU that can be configured by
2836          * host drivers. This 'max_mtu_configure' can be HW max MTU or
2837          * OEM applications specified value. Host drivers can't
2838          * configure the MTU greater than this value. Host drivers
2839          * should read this value prior to configuring the MTU. FW will
2840          * fail the host request with MTU greater than
2841          * 'max_mtu_configured'.
2842          */
2843         uint32_t min_bw;
2844         /*
2845          * Minimum BW allocated for this function. The HWRM will
2846          * translate this value into byte counter and time interval used
2847          * for the scheduler inside the device. A value of 0 indicates
2848          * the minimum bandwidth is not configured.
2849          */
2850         /* The bandwidth value. */
2851         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_MASK UINT32_C(0xfffffff)
2852         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_SFT       0
2853         /* The granularity of the value (bits or bytes). */
2854         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_SCALE      UINT32_C(0x10000000)
2855         /* Value is in bits. */
2856         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_SCALE_BITS (UINT32_C(0x0) << 28)
2857         /* Value is in bytes. */
2858         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_SCALE_BYTES \
2859                 (UINT32_C(0x1) << 28)
2860         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_SCALE_LAST \
2861                 FUNC_QCFG_OUTPUT_MIN_BW_SCALE_BYTES
2862         /* bw_value_unit is 3 b */
2863         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_MASK \
2864                 UINT32_C(0xe0000000)
2865         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_SFT  29
2866         /* Value is in Mb or MB (base 10). */
2867         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_MEGA \
2868                 (UINT32_C(0x0) << 29)
2869         /* Value is in Kb or KB (base 10). */
2870         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_KILO \
2871                 (UINT32_C(0x2) << 29)
2872         /* Value is in bits or bytes. */
2873         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_BASE \
2874                 (UINT32_C(0x4) << 29)
2875         /* Value is in Gb or GB (base 10). */
2876         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_GIGA \
2877                 (UINT32_C(0x6) << 29)
2878         /* Value is in 1/100th of a percentage of total bandwidth. */
2879         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_PERCENT1_100 \
2880                 (UINT32_C(0x1) << 29)
2881         /* Invalid unit */
2882         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_INVALID \
2883                 (UINT32_C(0x7) << 29)
2884         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_LAST \
2885                 FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_INVALID
2886         uint32_t max_bw;
2887         /*
2888          * Maximum BW allocated for this function. The HWRM will
2889          * translate this value into byte counter and time interval used
2890          * for the scheduler inside the device. A value of 0 indicates
2891          * that the maximum bandwidth is not configured.
2892          */
2893         /* The bandwidth value. */
2894         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_MASK UINT32_C(0xfffffff)
2895         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_SFT       0
2896         /* The granularity of the value (bits or bytes). */
2897         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_SCALE      UINT32_C(0x10000000)
2898         /* Value is in bits. */
2899         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_SCALE_BITS (UINT32_C(0x0) << 28)
2900         /* Value is in bytes. */
2901         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_SCALE_BYTES \
2902                 (UINT32_C(0x1) << 28)
2903         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_SCALE_LAST \
2904                 FUNC_QCFG_OUTPUT_MAX_BW_SCALE_BYTES
2905         /* bw_value_unit is 3 b */
2906         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_MASK \
2907                 UINT32_C(0xe0000000)
2908         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_SFT  29
2909         /* Value is in Mb or MB (base 10). */
2910         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_MEGA \
2911                 (UINT32_C(0x0) << 29)
2912         /* Value is in Kb or KB (base 10). */
2913         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_KILO \
2914                 (UINT32_C(0x2) << 29)
2915         /* Value is in bits or bytes. */
2916         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_BASE \
2917                 (UINT32_C(0x4) << 29)
2918         /* Value is in Gb or GB (base 10). */
2919         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_GIGA \
2920                 (UINT32_C(0x6) << 29)
2921         /* Value is in 1/100th of a percentage of total bandwidth. */
2922         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_PERCENT1_100 \
2923                 (UINT32_C(0x1) << 29)
2924         /* Invalid unit */
2925         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_INVALID \
2926                 (UINT32_C(0x7) << 29)
2927         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_LAST \
2928                 FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_INVALID
2929         uint8_t evb_mode;
2930         /*
2931          * This value indicates the Edge virtual bridge mode for the
2932          * domain that this function belongs to.
2933          */
2934         /* No Edge Virtual Bridging     (EVB) */
2935         #define HWRM_FUNC_QCFG_OUTPUT_EVB_MODE_NO_EVB   UINT32_C(0x0)
2936         /* Virtual Ethernet Bridge      (VEB) */
2937         #define HWRM_FUNC_QCFG_OUTPUT_EVB_MODE_VEB      UINT32_C(0x1)
2938         /* Virtual Ethernet Port Aggregator     (VEPA) */
2939         #define HWRM_FUNC_QCFG_OUTPUT_EVB_MODE_VEPA     UINT32_C(0x2)
2940         uint8_t unused_0;
2941         uint16_t alloc_vfs;
2942         /*
2943          * The number of VFs that are allocated to the function. This is
2944          * valid only on the PF with SR-IOV enabled. 0xFF...    (All Fs) if
2945          * this command is called on a PF with SR-IOV disabled or on a
2946          * VF.
2947          */
2948         uint32_t alloc_mcast_filters;
2949         /*
2950          * The number of allocated multicast filters for this function
2951          * on the RX side.
2952          */
2953         uint32_t alloc_hw_ring_grps;
2954         /* The number of allocated HW ring groups for this function. */
2955         uint16_t alloc_sp_tx_rings;
2956         /*
2957          * The number of strict priority transmit rings out of currently
2958          * allocated TX rings to the function   (alloc_tx_rings).
2959          */
2960         uint8_t unused_1;
2961         uint8_t valid;
2962         /*
2963          * This field is used in Output records to indicate that the
2964          * output is completely written to RAM. This field should be
2965          * read as '1' to indicate that the output has been completely
2966          * written. When writing a command completion or response to an
2967          * internal processor, the order of writes has to be such that
2968          * this field is written last.
2969          */
2970 } __attribute__((packed));
2971
2972 /* hwrm_func_vlan_qcfg */
2973 /*
2974  * Description: This command should be called by PF driver to get the current
2975  * C-TAG, S-TAG and correcponsing PCP and TPID values configured for the
2976  * function.
2977  */
2978 /* Input (24 bytes) */
2979 struct hwrm_func_vlan_qcfg_input {
2980         uint16_t req_type;
2981         /*
2982          * This value indicates what type of request this is. The format
2983          * for the rest of the command is determined by this field.
2984          */
2985         uint16_t cmpl_ring;
2986         /*
2987          * This value indicates the what completion ring the request
2988          * will be optionally completed on. If the value is -1, then no
2989          * CR completion will be generated. Any other value must be a
2990          * valid CR ring_id value for this function.
2991          */
2992         uint16_t seq_id;
2993         /* This value indicates the command sequence number. */
2994         uint16_t target_id;
2995         /*
2996          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
2997          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
2998          * - HWRM
2999          */
3000         uint64_t resp_addr;
3001         /*
3002          * This is the host address where the response will be written
3003          * when the request is complete. This area must be 16B aligned
3004          * and must be cleared to zero before the request is made.
3005          */
3006         uint16_t fid;
3007         /*
3008          * Function ID of the function that is being configured. If set
3009          * to 0xFF... (All Fs), then the configuration is for the
3010          * requesting function.
3011          */
3012         uint16_t unused_0[3];
3013 };
3014
3015 /* Output (40 bytes) */
3016 struct hwrm_func_vlan_qcfg_output {
3017         uint16_t error_code;
3018         /*
3019          * Pass/Fail or error type Note: receiver to verify the in
3020          * parameters, and fail the call with an error when appropriate
3021          */
3022         uint16_t req_type;
3023         /* This field returns the type of original request. */
3024         uint16_t seq_id;
3025         /* This field provides original sequence number of the command. */
3026         uint16_t resp_len;
3027         /*
3028          * This field is the length of the response in bytes. The last
3029          * byte of the response is a valid flag that will read as '1'
3030          * when the command has been completely written to memory.
3031          */
3032         uint32_t unused_0;
3033         uint8_t unused_1;
3034         uint8_t unused_2;
3035         uint8_t unused_3;
3036         uint8_t valid;
3037         /*
3038          * This field is used in Output records to indicate that the
3039          * output is completely written to RAM. This field should be
3040          * read as '1' to indicate that the output has been completely
3041          * written. When writing a command completion or response to an
3042          * internal processor, the order of writes has to be such that
3043          * this field is written last.
3044          */
3045         uint16_t stag_vid;
3046         /* S-TAG VLAN identifier configured for the function. */
3047         uint8_t stag_pcp;
3048         /* S-TAG PCP value configured for the function. */
3049         uint8_t unused_4;
3050         uint16_t stag_tpid;
3051         /*
3052          * S-TAG TPID value configured for the function. This field is
3053          * specified in network byte order.
3054          */
3055         uint16_t ctag_vid;
3056         /* C-TAG VLAN identifier configured for the function. */
3057         uint8_t ctag_pcp;
3058         /* C-TAG PCP value configured for the function. */
3059         uint8_t unused_5;
3060         uint16_t ctag_tpid;
3061         /*
3062          * C-TAG TPID value configured for the function. This field is
3063          * specified in network byte order.
3064          */
3065         uint32_t rsvd2;
3066         /* Future use. */
3067         uint32_t rsvd3;
3068         /* Future use. */
3069         uint32_t unused_6;
3070 };
3071
3072 /* hwrm_func_vlan_cfg */
3073 /*
3074  * Description: This command allows PF driver to configure C-TAG, S-TAG and
3075  * corresponding PCP and TPID values for a function.
3076  */
3077 /* Input (48 bytes) */
3078 struct hwrm_func_vlan_cfg_input {
3079         uint16_t req_type;
3080         /*
3081          * This value indicates what type of request this is. The format
3082          * for the rest of the command is determined by this field.
3083          */
3084         uint16_t cmpl_ring;
3085         /*
3086          * This value indicates the what completion ring the request
3087          * will be optionally completed on. If the value is -1, then no
3088          * CR completion will be generated. Any other value must be a
3089          * valid CR ring_id value for this function.
3090          */
3091         uint16_t seq_id;
3092         /* This value indicates the command sequence number. */
3093         uint16_t target_id;
3094         /*
3095          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
3096          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
3097          * - HWRM
3098          */
3099         uint64_t resp_addr;
3100         /*
3101          * This is the host address where the response will be written
3102          * when the request is complete. This area must be 16B aligned
3103          * and must be cleared to zero before the request is made.
3104          */
3105         uint16_t fid;
3106         /*
3107          * Function ID of the function that is being configured. If set
3108          * to 0xFF... (All Fs), then the configuration is for the
3109          * requesting function.
3110          */
3111         uint8_t unused_0;
3112         uint8_t unused_1;
3113         uint32_t enables;
3114         /* This bit must be '1' for the stag_vid field to be configured. */
3115         #define HWRM_FUNC_VLAN_CFG_INPUT_ENABLES_STAG_VID       UINT32_C(0x1)
3116         /* This bit must be '1' for the ctag_vid field to be configured. */
3117         #define HWRM_FUNC_VLAN_CFG_INPUT_ENABLES_CTAG_VID       UINT32_C(0x2)
3118         /* This bit must be '1' for the stag_pcp field to be configured. */
3119         #define HWRM_FUNC_VLAN_CFG_INPUT_ENABLES_STAG_PCP       UINT32_C(0x4)
3120         /* This bit must be '1' for the ctag_pcp field to be configured. */
3121         #define HWRM_FUNC_VLAN_CFG_INPUT_ENABLES_CTAG_PCP       UINT32_C(0x8)
3122         /* This bit must be '1' for the stag_tpid field to be configured. */
3123         #define HWRM_FUNC_VLAN_CFG_INPUT_ENABLES_STAG_TPID      UINT32_C(0x10)
3124         /* This bit must be '1' for the ctag_tpid field to be configured. */
3125         #define HWRM_FUNC_VLAN_CFG_INPUT_ENABLES_CTAG_TPID      UINT32_C(0x20)
3126         uint16_t stag_vid;
3127         /* S-TAG VLAN identifier configured for the function. */
3128         uint8_t stag_pcp;
3129         /* S-TAG PCP value configured for the function. */
3130         uint8_t unused_2;
3131         uint16_t stag_tpid;
3132         /*
3133          * S-TAG TPID value configured for the function. This field is
3134          * specified in network byte order.
3135          */
3136         uint16_t ctag_vid;
3137         /* C-TAG VLAN identifier configured for the function. */
3138         uint8_t ctag_pcp;
3139         /* C-TAG PCP value configured for the function. */
3140         uint8_t unused_3;
3141         uint16_t ctag_tpid;
3142         /*
3143          * C-TAG TPID value configured for the function. This field is
3144          * specified in network byte order.
3145          */
3146         uint32_t rsvd1;
3147         /* Future use. */
3148         uint32_t rsvd2;
3149         /* Future use. */
3150         uint32_t unused_4;
3151 };
3152
3153 /* Output (16 bytes) */
3154 struct hwrm_func_vlan_cfg_output {
3155         uint16_t error_code;
3156         /*
3157          * Pass/Fail or error type Note: receiver to verify the in
3158          * parameters, and fail the call with an error when appropriate
3159          */
3160         uint16_t req_type;
3161         /* This field returns the type of original request. */
3162         uint16_t seq_id;
3163         /* This field provides original sequence number of the command. */
3164         uint16_t resp_len;
3165         /*
3166          * This field is the length of the response in bytes. The last
3167          * byte of the response is a valid flag that will read as '1'
3168          * when the command has been completely written to memory.
3169          */
3170         uint32_t unused_0;
3171         uint8_t unused_1;
3172         uint8_t unused_2;
3173         uint8_t unused_3;
3174         uint8_t valid;
3175         /*
3176          * This field is used in Output records to indicate that the
3177          * output is completely written to RAM. This field should be
3178          * read as '1' to indicate that the output has been completely
3179          * written. When writing a command completion or response to an
3180          * internal processor, the order of writes has to be such that
3181          * this field is written last.
3182          */
3183 };
3184
3185 /* hwrm_func_cfg */
3186 /*
3187  * Description: This command allows configuration of a PF by the corresponding
3188  * PF driver. This command also allows configuration of a child VF by its parent
3189  * PF driver. The input FID value is used to indicate what function is being
3190  * configured. This allows a PF driver to configure the PF owned by itself or a
3191  * virtual function that is a child of the PF. This command allows to reserve
3192  * resources for a VF by its parent PF. To reverse the process, the command
3193  * should be called with all enables flags cleared for resources. This will free
3194  * allocated resources for the VF and return them to the resource pool. If this
3195  * command is requested by a VF driver to configure or reserve resources, then
3196  * the HWRM shall fail this command. If default MAC address and/or VLAN are
3197  * provided in this command, then the HWRM shall set up appropriate MAC/VLAN
3198  * filters for the function that is being configured. If source properties
3199  * checks are enabled and default MAC address and/or IP address are provided in
3200  * this command, then the HWRM shall set appropriate source property checks
3201  * based on provided MAC and/or IP addresses. The parent PF driver should not
3202  * set MTU/MRU for a VF using this command. This is to allow MTU/MRU setting by
3203  * the VF driver. If the MTU or MRU for a VF is set by the PF driver, then the
3204  * HWRM should ignore it. A function's MTU/MRU should be set prior to allocating
3205  * RX VNICs or TX rings. A PF driver calls hwrm_func_cfg to allocate resources
3206  * for itself or its children VFs. All function drivers shall call hwrm_func_cfg
3207  * to reserve resources. A request to hwrm_func_cfg may not be fully granted;
3208  * that is, a request for resources may be larger than what can be supported by
3209  * the device and the HWRM will allocate the best set of resources available,
3210  * but that may be less than requested. If all the amounts requested could not
3211  * be fulfilled, the HWRM shall allocate what it could and return a status code
3212  * of success. A function driver should call hwrm_func_qcfg immediately after
3213  * hwrm_func_cfg to determine what resources were assigned to the configured
3214  * function. A call by a PF driver to hwrm_func_cfg to allocate resources for
3215  * itself shall only allocate resources for the PF driver to use, not for its
3216  * children VFs. Likewise, a call to hwrm_func_qcfg shall return the resources
3217  * available for the PF driver to use, not what is available to its children
3218  * VFs.
3219  */
3220 /* Input        (88 bytes) */
3221 struct hwrm_func_cfg_input {
3222         uint16_t req_type;
3223         /*
3224          * This value indicates what type of request this is. The format
3225          * for the rest of the command is determined by this field.
3226          */
3227         uint16_t cmpl_ring;
3228         /*
3229          * This value indicates the what completion ring the request
3230          * will be optionally completed on. If the value is -1, then no
3231          * CR completion will be generated. Any other value must be a
3232          * valid CR ring_id value for this function.
3233          */
3234         uint16_t seq_id;
3235         /* This value indicates the command sequence number. */
3236         uint16_t target_id;
3237         /*
3238          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
3239          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
3240          * - HWRM
3241          */
3242         uint64_t resp_addr;
3243         /*
3244          * This is the host address where the response will be written
3245          * when the request is complete. This area must be 16B aligned
3246          * and must be cleared to zero before the request is made.
3247          */
3248         uint16_t fid;
3249         /*
3250          * Function ID of the function that is being configured. If set
3251          * to 0xFF...   (All Fs), then the configuration is for the
3252          * requesting function.
3253          */
3254         uint8_t unused_0;
3255         uint8_t unused_1;
3256         uint32_t flags;
3257         /*
3258          * When this bit is '1', the function is disabled with source
3259          * MAC address check. This is an anti-spoofing check. If this
3260          * flag is set, then the function shall be configured to
3261          * disallow transmission of frames with the source MAC address
3262          * that is configured for this function.
3263          */
3264         #define HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE     \
3265                 UINT32_C(0x1)
3266         /*
3267          * When this bit is '1', the function is enabled with source MAC
3268          * address check. This is an anti-spoofing check. If this flag
3269          * is set, then the function shall be configured to allow
3270          * transmission of frames with the source MAC address that is
3271          * configured for this function.
3272          */
3273         #define HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_ENABLE     \
3274                 UINT32_C(0x2)
3275         /* reserved */
3276         #define HWRM_FUNC_CFG_INPUT_FLAGS_RSVD_MASK     UINT32_C(0x1fc)
3277         #define HWRM_FUNC_CFG_INPUT_FLAGS_RSVD_SFT      2
3278         /*
3279          * Standard TX Ring mode is used for the allocation of TX ring
3280          * and underlying scheduling resources that allow bandwidth
3281          * reservation and limit settings on the queried function. If
3282          * set to 1, then standard TX ring mode is requested to be
3283          * enabled on the function being configured.
3284          */
3285         #define HWRM_FUNC_CFG_INPUT_FLAGS_STD_TX_RING_MODE_ENABLE       \
3286                 UINT32_C(0x200)
3287         /*
3288          * Standard TX Ring mode is used for the allocation of TX ring
3289          * and underlying scheduling resources that allow bandwidth
3290          * reservation and limit settings on the queried function. If
3291          * set to 1, then the standard TX ring mode is requested to be
3292          * disabled on the function being configured. In this extended
3293          * TX ring resource mode, the minimum and maximum bandwidth
3294          * settings are not supported to allow the allocation of TX
3295          * rings to span multiple scheduler nodes.
3296          */
3297         #define HWRM_FUNC_CFG_INPUT_FLAGS_STD_TX_RING_MODE_DISABLE      \
3298                 UINT32_C(0x400)
3299         /*
3300          * If this bit is set, virtual mac address configured in this
3301          * command will be persistent over warm boot.
3302          */
3303         #define HWRM_FUNC_CFG_INPUT_FLAGS_VIRT_MAC_PERSIST      UINT32_C(0x800)
3304         /*
3305          * This bit only applies to the VF. If this bit is set, the
3306          * statistic context counters will not be cleared when the
3307          * statistic context is freed or a function reset is called on
3308          * VF. This bit will be cleared when the PF is unloaded or a
3309          * function reset is called on the PF.
3310          */
3311         #define HWRM_FUNC_CFG_INPUT_FLAGS_NO_AUTOCLEAR_STATISTIC        \
3312                 UINT32_C(0x1000)
3313         /*
3314          * This bit requests that the firmware test to see if all the
3315          * assets requested in this command (i.e. number of TX rings)
3316          * are available. The firmware will return an error if the
3317          * requested assets are not available. The firwmare will NOT
3318          * reserve the assets if they are available.
3319          */
3320         #define HWRM_FUNC_CFG_INPUT_FLAGS_TX_ASSETS_TEST UINT32_C(0x2000)
3321         uint32_t enables;
3322         /* This bit must be '1' for the mtu field to be configured. */
3323         #define HWRM_FUNC_CFG_INPUT_ENABLES_MTU UINT32_C(0x1)
3324         /* This bit must be '1' for the mru field to be configured. */
3325         #define HWRM_FUNC_CFG_INPUT_ENABLES_MRU UINT32_C(0x2)
3326         /*
3327          * This bit must be '1' for the num_rsscos_ctxs field to be
3328          * configured.
3329          */
3330         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_RSSCOS_CTXS     UINT32_C(0x4)
3331         /*
3332          * This bit must be '1' for the num_cmpl_rings field to be
3333          * configured.
3334          */
3335         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_CMPL_RINGS      UINT32_C(0x8)
3336         /* This bit must be '1' for the num_tx_rings field to be configured. */
3337         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_TX_RINGS        UINT32_C(0x10)
3338         /* This bit must be '1' for the num_rx_rings field to be configured. */
3339         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_RX_RINGS        UINT32_C(0x20)
3340         /* This bit must be '1' for the num_l2_ctxs field to be configured. */
3341         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_L2_CTXS UINT32_C(0x40)
3342         /* This bit must be '1' for the num_vnics field to be configured. */
3343         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_VNICS   UINT32_C(0x80)
3344         /*
3345          * This bit must be '1' for the num_stat_ctxs field to be
3346          * configured.
3347          */
3348         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_STAT_CTXS       UINT32_C(0x100)
3349         /*
3350          * This bit must be '1' for the dflt_mac_addr field to be
3351          * configured.
3352          */
3353         #define HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_MAC_ADDR       UINT32_C(0x200)
3354         /* This bit must be '1' for the dflt_vlan field to be configured. */
3355         #define HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_VLAN   UINT32_C(0x400)
3356         /* This bit must be '1' for the dflt_ip_addr field to be configured. */
3357         #define HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_IP_ADDR        UINT32_C(0x800)
3358         /* This bit must be '1' for the min_bw field to be configured. */
3359         #define HWRM_FUNC_CFG_INPUT_ENABLES_MIN_BW      UINT32_C(0x1000)
3360         /* This bit must be '1' for the max_bw field to be configured. */
3361         #define HWRM_FUNC_CFG_INPUT_ENABLES_MAX_BW      UINT32_C(0x2000)
3362         /*
3363          * This bit must be '1' for the async_event_cr field to be
3364          * configured.
3365          */
3366         #define HWRM_FUNC_CFG_INPUT_ENABLES_ASYNC_EVENT_CR      UINT32_C(0x4000)
3367         /*
3368          * This bit must be '1' for the vlan_antispoof_mode field to be
3369          * configured.
3370          */
3371         #define HWRM_FUNC_CFG_INPUT_ENABLES_VLAN_ANTISPOOF_MODE UINT32_C(0x8000)
3372         /*
3373          * This bit must be '1' for the allowed_vlan_pris field to be
3374          * configured.
3375          */
3376         #define HWRM_FUNC_CFG_INPUT_ENABLES_ALLOWED_VLAN_PRIS UINT32_C(0x10000)
3377         /* This bit must be '1' for the evb_mode field to be configured. */
3378         #define HWRM_FUNC_CFG_INPUT_ENABLES_EVB_MODE    UINT32_C(0x20000)
3379         /*
3380          * This bit must be '1' for the num_mcast_filters field to be
3381          * configured.
3382          */
3383         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_MCAST_FILTERS UINT32_C(0x40000)
3384         /*
3385          * This bit must be '1' for the num_hw_ring_grps field to be
3386          * configured.
3387          */
3388         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS UINT32_C(0x80000)
3389         uint16_t mtu;
3390         /*
3391          * The maximum transmission unit of the function. The HWRM
3392          * should make sure that the mtu of the function does not exceed
3393          * the mtu of the physical port that this function is associated
3394          * with. In addition to configuring mtu per function, it is
3395          * possible to configure mtu per transmit ring. By default, the
3396          * mtu of each transmit ring associated with a function is equal
3397          * to the mtu of the function. The HWRM should make sure that
3398          * the mtu of each transmit ring that is assigned to a function
3399          * has a valid mtu.
3400          */
3401         uint16_t mru;
3402         /*
3403          * The maximum receive unit of the function. The HWRM should
3404          * make sure that the mru of the function does not exceed the
3405          * mru of the physical port that this function is associated
3406          * with. In addition to configuring mru per function, it is
3407          * possible to configure mru per vnic. By default, the mru of
3408          * each vnic associated with a function is equal to the mru of
3409          * the function. The HWRM should make sure that the mru of each
3410          * vnic that is assigned to a function has a valid mru.
3411          */
3412         uint16_t num_rsscos_ctxs;
3413         /* The number of RSS/COS contexts requested for the function. */
3414         uint16_t num_cmpl_rings;
3415         /*
3416          * The number of completion rings requested for the function.
3417          * This does not include the rings allocated to any children
3418          * functions if any.
3419          */
3420         uint16_t num_tx_rings;
3421         /*
3422          * The number of transmit rings requested for the function. This
3423          * does not include the rings allocated to any children
3424          * functions if any.
3425          */
3426         uint16_t num_rx_rings;
3427         /*
3428          * The number of receive rings requested for the function. This
3429          * does not include the rings allocated to any children
3430          * functions if any.
3431          */
3432         uint16_t num_l2_ctxs;
3433         /* The requested number of L2 contexts for the function. */
3434         uint16_t num_vnics;
3435         /* The requested number of vnics for the function. */
3436         uint16_t num_stat_ctxs;
3437         /* The requested number of statistic contexts for the function. */
3438         uint16_t num_hw_ring_grps;
3439         /*
3440          * The number of HW ring groups that should be reserved for this
3441          * function.
3442          */
3443         uint8_t dflt_mac_addr[6];
3444         /* The default MAC address for the function being configured. */
3445         uint16_t dflt_vlan;
3446         /*
3447          * The default VLAN for the function being configured. This
3448          * field's format is same as 802.1Q Tag's Tag Control
3449          * Information  (TCI) format that includes both Priority Code
3450          * Point        (PCP) and VLAN Identifier       (VID).
3451          */
3452         uint32_t dflt_ip_addr[4];
3453         /*
3454          * The default IP address for the function being configured.
3455          * This address is only used in enabling source property check.
3456          */
3457         uint32_t min_bw;
3458         /*
3459          * Minimum BW allocated for this function. The HWRM will
3460          * translate this value into byte counter and time interval used
3461          * for the scheduler inside the device.
3462          */
3463         /* The bandwidth value. */
3464         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_MASK UINT32_C(0xfffffff)
3465         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_SFT 0
3466         /* The granularity of the value (bits or bytes). */
3467         #define HWRM_FUNC_CFG_INPUT_MIN_BW_SCALE        UINT32_C(0x10000000)
3468         /* Value is in bits. */
3469         #define HWRM_FUNC_CFG_INPUT_MIN_BW_SCALE_BITS   (UINT32_C(0x0) << 28)
3470         /* Value is in bytes. */
3471         #define HWRM_FUNC_CFG_INPUT_MIN_BW_SCALE_BYTES  (UINT32_C(0x1) << 28)
3472         #define HWRM_FUNC_CFG_INPUT_MIN_BW_SCALE_LAST \
3473                 FUNC_CFG_INPUT_MIN_BW_SCALE_BYTES
3474         /* bw_value_unit is 3 b */
3475         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_MASK    \
3476                 UINT32_C(0xe0000000)
3477         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_SFT    29
3478         /* Value is in Mb or MB (base 10). */
3479         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_MEGA \
3480                 (UINT32_C(0x0) << 29)
3481         /* Value is in Kb or KB (base 10). */
3482         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_KILO \
3483                 (UINT32_C(0x2) << 29)
3484         /* Value is in bits or bytes. */
3485         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_BASE \
3486                 (UINT32_C(0x4) << 29)
3487         /* Value is in Gb or GB (base 10). */
3488         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_GIGA \
3489                 (UINT32_C(0x6) << 29)
3490         /* Value is in 1/100th of a percentage of total bandwidth. */
3491         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_PERCENT1_100 \
3492                 (UINT32_C(0x1) << 29)
3493         /* Invalid unit */
3494         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_INVALID \
3495                 (UINT32_C(0x7) << 29)
3496         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_LAST \
3497                 FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_INVALID
3498         uint32_t max_bw;
3499         /*
3500          * Maximum BW allocated for this function. The HWRM will
3501          * translate this value into byte counter and time interval used
3502          * for the scheduler inside the device.
3503          */
3504         /* The bandwidth value. */
3505         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_MASK \
3506                 UINT32_C(0xfffffff)
3507         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_SFT 0
3508         /* The granularity of the value (bits or bytes). */
3509         #define HWRM_FUNC_CFG_INPUT_MAX_BW_SCALE        UINT32_C(0x10000000)
3510         /* Value is in bits. */
3511         #define HWRM_FUNC_CFG_INPUT_MAX_BW_SCALE_BITS   (UINT32_C(0x0) << 28)
3512         /* Value is in bytes. */
3513         #define HWRM_FUNC_CFG_INPUT_MAX_BW_SCALE_BYTES  (UINT32_C(0x1) << 28)
3514         #define HWRM_FUNC_CFG_INPUT_MAX_BW_SCALE_LAST \
3515                 FUNC_CFG_INPUT_MAX_BW_SCALE_BYTES
3516         /* bw_value_unit is 3 b */
3517         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_MASK    \
3518                 UINT32_C(0xe0000000)
3519         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_SFT    29
3520         /* Value is in Mb or MB (base 10). */
3521         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_MEGA   \
3522                 (UINT32_C(0x0) << 29)
3523         /* Value is in Kb or KB (base 10). */
3524         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_KILO   \
3525                 (UINT32_C(0x2) << 29)
3526         /* Value is in bits or bytes. */
3527         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_BASE \
3528                 (UINT32_C(0x4) << 29)
3529         /* Value is in Gb or GB (base 10). */
3530         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_GIGA \
3531                 (UINT32_C(0x6) << 29)
3532         /* Value is in 1/100th of a percentage of total bandwidth. */
3533         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_PERCENT1_100 \
3534                 (UINT32_C(0x1) << 29)
3535         /* Invalid unit */
3536         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_INVALID \
3537                 (UINT32_C(0x7) << 29)
3538         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_LAST \
3539                 FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_INVALID
3540         uint16_t async_event_cr;
3541         /*
3542          * ID of the target completion ring for receiving asynchronous
3543          * event completions. If this field is not valid, then the HWRM
3544          * shall use the default completion ring of the function that is
3545          * being configured as the target completion ring for providing
3546          * any asynchronous event completions for that function. If this
3547          * field is valid, then the HWRM shall use the completion ring
3548          * identified by this ID as the target completion ring for
3549          * providing any asynchronous event completions for the function
3550          * that is being configured.
3551          */
3552         uint8_t vlan_antispoof_mode;
3553         /* VLAN Anti-spoofing mode. */
3554         /* No VLAN anti-spoofing checks are enabled */
3555         #define HWRM_FUNC_CFG_INPUT_VLAN_ANTISPOOF_MODE_NOCHECK UINT32_C(0x0)
3556         /* Validate VLAN against the configured VLAN(s) */
3557         #define HWRM_FUNC_CFG_INPUT_VLAN_ANTISPOOF_MODE_VALIDATE_VLAN \
3558                 UINT32_C(0x1)
3559         /* Insert VLAN if it does not exist, otherwise discard */
3560         #define HWRM_FUNC_CFG_INPUT_VLAN_ANTISPOOF_MODE_INSERT_IF_VLANDNE \
3561                 UINT32_C(0x2)
3562         /*
3563          * Insert VLAN if it does not exist, override
3564          * VLAN if it exists
3565          */
3566         #define \
3567         HWRM_FUNC_CFG_INPUT_VLAN_ANTISPOOF_MODE_INSERT_OR_OVERRIDE_VLAN \
3568                 UINT32_C(0x3)
3569         uint8_t allowed_vlan_pris;
3570         /*
3571          * This bit field defines VLAN PRIs that are allowed on this
3572          * function. If nth bit is set, then VLAN PRI n is allowed on
3573          * this function.
3574          */
3575         uint8_t evb_mode;
3576         /*
3577          * The HWRM shall allow a PF driver to change EVB mode for the
3578          * partition it belongs to. The HWRM shall not allow a VF driver
3579          * to change the EVB mode. The HWRM shall take into account the
3580          * switching of EVB mode from one to another and reconfigure
3581          * hardware resources as appropriately. The switching from VEB
3582          * to VEPA mode requires the disabling of the loopback traffic.
3583          * Additionally, source knock outs are handled differently in
3584          * VEB and VEPA modes.
3585          */
3586         /* No Edge Virtual Bridging     (EVB) */
3587         #define HWRM_FUNC_CFG_INPUT_EVB_MODE_NO_EVB     UINT32_C(0x0)
3588         /* Virtual Ethernet Bridge      (VEB) */
3589         #define HWRM_FUNC_CFG_INPUT_EVB_MODE_VEB        UINT32_C(0x1)
3590         /* Virtual Ethernet Port Aggregator     (VEPA) */
3591         #define HWRM_FUNC_CFG_INPUT_EVB_MODE_VEPA       UINT32_C(0x2)
3592         uint8_t unused_2;
3593         uint16_t num_mcast_filters;
3594         /*
3595          * The number of multicast filters that should be reserved for
3596          * this function on the RX side.
3597          */
3598 } __attribute__((packed));
3599
3600 /* Output       (16 bytes) */
3601 struct hwrm_func_cfg_output {
3602         uint16_t error_code;
3603         /*
3604          * Pass/Fail or error type Note: receiver to verify the in
3605          * parameters, and fail the call with an error when appropriate
3606          */
3607         uint16_t req_type;
3608         /* This field returns the type of original request. */
3609         uint16_t seq_id;
3610         /* This field provides original sequence number of the command. */
3611         uint16_t resp_len;
3612         /*
3613          * This field is the length of the response in bytes. The last
3614          * byte of the response is a valid flag that will read as '1'
3615          * when the command has been completely written to memory.
3616          */
3617         uint32_t unused_0;
3618         uint8_t unused_1;
3619         uint8_t unused_2;
3620         uint8_t unused_3;
3621         uint8_t valid;
3622         /*
3623          * This field is used in Output records to indicate that the
3624          * output is completely written to RAM. This field should be
3625          * read as '1' to indicate that the output has been completely
3626          * written. When writing a command completion or response to an
3627          * internal processor, the order of writes has to be such that
3628          * this field is written last.
3629          */
3630 } __attribute__((packed));
3631
3632 /* hwrm_func_qstats */
3633 /*
3634  * Description: This command returns statistics of a function. The input FID
3635  * value is used to indicate what function is being queried. This allows a
3636  * physical function driver to query virtual functions that are children of the
3637  * physical function. The HWRM shall return any unsupported counter with a value
3638  * of 0xFFFFFFFF for 32-bit counters and 0xFFFFFFFFFFFFFFFF for 64-bit counters.
3639  */
3640 /* Input        (24 bytes) */
3641 struct hwrm_func_qstats_input {
3642         uint16_t req_type;
3643         /*
3644          * This value indicates what type of request this is. The format
3645          * for the rest of the command is determined by this field.
3646          */
3647         uint16_t cmpl_ring;
3648         /*
3649          * This value indicates the what completion ring the request
3650          * will be optionally completed on. If the value is -1, then no
3651          * CR completion will be generated. Any other value must be a
3652          * valid CR ring_id value for this function.
3653          */
3654         uint16_t seq_id;
3655         /* This value indicates the command sequence number. */
3656         uint16_t target_id;
3657         /*
3658          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
3659          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
3660          * - HWRM
3661          */
3662         uint64_t resp_addr;
3663         /*
3664          * This is the host address where the response will be written
3665          * when the request is complete. This area must be 16B aligned
3666          * and must be cleared to zero before the request is made.
3667          */
3668         uint16_t fid;
3669         /*
3670          * Function ID of the function that is being queried. 0xFF...
3671          *      (All Fs) if the query is for the requesting function.
3672          */
3673         uint16_t unused_0[3];
3674 } __attribute__((packed));
3675
3676 /* Output       (176 bytes) */
3677 struct hwrm_func_qstats_output {
3678         uint16_t error_code;
3679         /*
3680          * Pass/Fail or error type Note: receiver to verify the in
3681          * parameters, and fail the call with an error when appropriate
3682          */
3683         uint16_t req_type;
3684         /* This field returns the type of original request. */
3685         uint16_t seq_id;
3686         /* This field provides original sequence number of the command. */
3687         uint16_t resp_len;
3688         /*
3689          * This field is the length of the response in bytes. The last
3690          * byte of the response is a valid flag that will read as '1'
3691          * when the command has been completely written to memory.
3692          */
3693         uint64_t tx_ucast_pkts;
3694         /* Number of transmitted unicast packets on the function. */
3695         uint64_t tx_mcast_pkts;
3696         /* Number of transmitted multicast packets on the function. */
3697         uint64_t tx_bcast_pkts;
3698         /* Number of transmitted broadcast packets on the function. */
3699         uint64_t tx_err_pkts;
3700         /*
3701          * Number of transmitted packets that were discarded due to
3702          * internal NIC resource problems. For transmit, this can only
3703          * happen if TMP is configured to allow dropping in HOL blocking
3704          * conditions, which is not a normal configuration.
3705          */
3706         uint64_t tx_drop_pkts;
3707         /*
3708          * Number of dropped packets on transmit path on the function.
3709          * These are packets that have been marked for drop by the TE
3710          * CFA block or are packets that exceeded the transmit MTU limit
3711          * for the function.
3712          */
3713         uint64_t tx_ucast_bytes;
3714         /* Number of transmitted bytes for unicast traffic on the function. */
3715         uint64_t tx_mcast_bytes;
3716         /*
3717          * Number of transmitted bytes for multicast traffic on the
3718          * function.
3719          */
3720         uint64_t tx_bcast_bytes;
3721         /*
3722          * Number of transmitted bytes for broadcast traffic on the
3723          * function.
3724          */
3725         uint64_t rx_ucast_pkts;
3726         /* Number of received unicast packets on the function. */
3727         uint64_t rx_mcast_pkts;
3728         /* Number of received multicast packets on the function. */
3729         uint64_t rx_bcast_pkts;
3730         /* Number of received broadcast packets on the function. */
3731         uint64_t rx_err_pkts;
3732         /*
3733          * Number of received packets that were discarded on the
3734          * function due to resource limitations. This can happen for 3
3735          * reasons. # The BD used for the packet has a bad format. #
3736          * There were no BDs available in the ring for the packet. #
3737          * There were no BDs available on-chip for the packet.
3738          */
3739         uint64_t rx_drop_pkts;
3740         /*
3741          * Number of dropped packets on received path on the function.
3742          * These are packets that have been marked for drop by the RE
3743          * CFA.
3744          */
3745         uint64_t rx_ucast_bytes;
3746         /* Number of received bytes for unicast traffic on the function. */
3747         uint64_t rx_mcast_bytes;
3748         /* Number of received bytes for multicast traffic on the function. */
3749         uint64_t rx_bcast_bytes;
3750         /* Number of received bytes for broadcast traffic on the function. */
3751         uint64_t rx_agg_pkts;
3752         /* Number of aggregated unicast packets on the function. */
3753         uint64_t rx_agg_bytes;
3754         /* Number of aggregated unicast bytes on the function. */
3755         uint64_t rx_agg_events;
3756         /* Number of aggregation events on the function. */
3757         uint64_t rx_agg_aborts;
3758         /* Number of aborted aggregations on the function. */
3759         uint32_t unused_0;
3760         uint8_t unused_1;
3761         uint8_t unused_2;
3762         uint8_t unused_3;
3763         uint8_t valid;
3764         /*
3765          * This field is used in Output records to indicate that the
3766          * output is completely written to RAM. This field should be
3767          * read as '1' to indicate that the output has been completely
3768          * written. When writing a command completion or response to an
3769          * internal processor, the order of writes has to be such that
3770          * this field is written last.
3771          */
3772 } __attribute__((packed));
3773
3774 /* hwrm_func_clr_stats */
3775 /*
3776  * Description: This command clears statistics of a function. The input FID
3777  * value is used to indicate what function's statistics is being cleared. This
3778  * allows a physical function driver to clear statistics of virtual functions
3779  * that are children of the physical function.
3780  */
3781 /* Input        (24 bytes) */
3782 struct hwrm_func_clr_stats_input {
3783         uint16_t req_type;
3784         /*
3785          * This value indicates what type of request this is. The format
3786          * for the rest of the command is determined by this field.
3787          */
3788         uint16_t cmpl_ring;
3789         /*
3790          * This value indicates the what completion ring the request
3791          * will be optionally completed on. If the value is -1, then no
3792          * CR completion will be generated. Any other value must be a
3793          * valid CR ring_id value for this function.
3794          */
3795         uint16_t seq_id;
3796         /* This value indicates the command sequence number. */
3797         uint16_t target_id;
3798         /*
3799          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
3800          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
3801          * - HWRM
3802          */
3803         uint64_t resp_addr;
3804         /*
3805          * This is the host address where the response will be written
3806          * when the request is complete. This area must be 16B aligned
3807          * and must be cleared to zero before the request is made.
3808          */
3809         uint16_t fid;
3810         /*
3811          * Function ID of the function. 0xFF... (All Fs) if the query is
3812          * for the requesting function.
3813          */
3814         uint16_t unused_0[3];
3815 } __attribute__((packed));
3816
3817 /* Output       (16 bytes) */
3818 struct hwrm_func_clr_stats_output {
3819         uint16_t error_code;
3820         /*
3821          * Pass/Fail or error type Note: receiver to verify the in
3822          * parameters, and fail the call with an error when appropriate
3823          */
3824         uint16_t req_type;
3825         /* This field returns the type of original request. */
3826         uint16_t seq_id;
3827         /* This field provides original sequence number of the command. */
3828         uint16_t resp_len;
3829         /*
3830          * This field is the length of the response in bytes. The last
3831          * byte of the response is a valid flag that will read as '1'
3832          * when the command has been completely written to memory.
3833          */
3834         uint32_t unused_0;
3835         uint8_t unused_1;
3836         uint8_t unused_2;
3837         uint8_t unused_3;
3838         uint8_t valid;
3839         /*
3840          * This field is used in Output records to indicate that the
3841          * output is completely written to RAM. This field should be
3842          * read as '1' to indicate that the output has been completely
3843          * written. When writing a command completion or response to an
3844          * internal processor, the order of writes has to be such that
3845          * this field is written last.
3846          */
3847 } __attribute__((packed));
3848
3849 /* hwrm_func_vf_vnic_ids_query */
3850 /* Description: This command is used to query vf vnic ids. */
3851 /* Input        (32 bytes) */
3852 struct hwrm_func_vf_vnic_ids_query_input {
3853         uint16_t req_type;
3854         /*
3855          * This value indicates what type of request this is. The format
3856          * for the rest of the command is determined by this field.
3857          */
3858         uint16_t cmpl_ring;
3859         /*
3860          * This value indicates the what completion ring the request
3861          * will be optionally completed on. If the value is -1, then no
3862          * CR completion will be generated. Any other value must be a
3863          * valid CR ring_id value for this function.
3864          */
3865         uint16_t seq_id;
3866         /* This value indicates the command sequence number. */
3867         uint16_t target_id;
3868         /*
3869          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
3870          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
3871          * - HWRM
3872          */
3873         uint64_t resp_addr;
3874         /*
3875          * This is the host address where the response will be written
3876          * when the request is complete. This area must be 16B aligned
3877          * and must be cleared to zero before the request is made.
3878          */
3879         uint16_t vf_id;
3880         /*
3881          * This value is used to identify a Virtual Function    (VF). The
3882          * scope of VF ID is local within a PF.
3883          */
3884         uint8_t unused_0;
3885         uint8_t unused_1;
3886         uint32_t max_vnic_id_cnt;
3887         /* Max number of vnic ids in vnic id table */
3888         uint64_t vnic_id_tbl_addr;
3889         /* This is the address for VF VNIC ID table */
3890 } __attribute__((packed));
3891
3892 /* Output       (16 bytes) */
3893 struct hwrm_func_vf_vnic_ids_query_output {
3894         uint16_t error_code;
3895         /*
3896          * Pass/Fail or error type Note: receiver to verify the in
3897          * parameters, and fail the call with an error when appropriate
3898          */
3899         uint16_t req_type;
3900         /* This field returns the type of original request. */
3901         uint16_t seq_id;
3902         /* This field provides original sequence number of the command. */
3903         uint16_t resp_len;
3904         /*
3905          * This field is the length of the response in bytes. The last
3906          * byte of the response is a valid flag that will read as '1'
3907          * when the command has been completely written to memory.
3908          */
3909         uint32_t vnic_id_cnt;
3910         /*
3911          * Actual number of vnic ids Each VNIC ID is written as a 32-bit
3912          * number.
3913          */
3914         uint8_t unused_0;
3915         uint8_t unused_1;
3916         uint8_t unused_2;
3917         uint8_t valid;
3918         /*
3919          * This field is used in Output records to indicate that the
3920          * output is completely written to RAM. This field should be
3921          * read as '1' to indicate that the output has been completely
3922          * written. When writing a command completion or response to an
3923          * internal processor, the order of writes has to be such that
3924          * this field is written last.
3925          */
3926 } __attribute__((packed));
3927
3928 /* hwrm_func_drv_rgtr */
3929 /*
3930  * Description: This command is used by the function driver to register its
3931  * information with the HWRM. A function driver shall implement this command. A
3932  * function driver shall use this command during the driver initialization right
3933  * after the HWRM version discovery and default ring resources allocation.
3934  */
3935 /* Input        (80 bytes) */
3936 struct hwrm_func_drv_rgtr_input {
3937         uint16_t req_type;
3938         /*
3939          * This value indicates what type of request this is. The format
3940          * for the rest of the command is determined by this field.
3941          */
3942         uint16_t cmpl_ring;
3943         /*
3944          * This value indicates the what completion ring the request
3945          * will be optionally completed on. If the value is -1, then no
3946          * CR completion will be generated. Any other value must be a
3947          * valid CR ring_id value for this function.
3948          */
3949         uint16_t seq_id;
3950         /* This value indicates the command sequence number. */
3951         uint16_t target_id;
3952         /*
3953          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
3954          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
3955          * - HWRM
3956          */
3957         uint64_t resp_addr;
3958         /*
3959          * This is the host address where the response will be written
3960          * when the request is complete. This area must be 16B aligned
3961          * and must be cleared to zero before the request is made.
3962          */
3963         uint32_t flags;
3964         /*
3965          * When this bit is '1', the function driver is requesting all
3966          * requests from its children VF drivers to be forwarded to
3967          * itself. This flag can only be set by the PF driver. If a VF
3968          * driver sets this flag, it should be ignored by the HWRM.
3969          */
3970         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_ALL_MODE     UINT32_C(0x1)
3971         /*
3972          * When this bit is '1', the function is requesting none of the
3973          * requests from its children VF drivers to be forwarded to
3974          * itself. This flag can only be set by the PF driver. If a VF
3975          * driver sets this flag, it should be ignored by the HWRM.
3976          */
3977         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE    UINT32_C(0x2)
3978         uint32_t enables;
3979         /* This bit must be '1' for the os_type field to be configured. */
3980         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_OS_TYPE        UINT32_C(0x1)
3981         /* This bit must be '1' for the ver field to be configured. */
3982         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VER    UINT32_C(0x2)
3983         /* This bit must be '1' for the timestamp field to be configured. */
3984         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_TIMESTAMP      UINT32_C(0x4)
3985         /* This bit must be '1' for the vf_req_fwd field to be configured. */
3986         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VF_INPUT_FWD   UINT32_C(0x8)
3987         /*
3988          * This bit must be '1' for the async_event_fwd field to be
3989          * configured.
3990          */
3991         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_ASYNC_EVENT_FWD UINT32_C(0x10)
3992         uint16_t os_type;
3993         /*
3994          * This value indicates the type of OS. The values are based on
3995          * CIM_OperatingSystem.mof file as published by the DMTF.
3996          */
3997         /* Unknown */
3998         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_UNKNOWN        UINT32_C(0x0)
3999         /* Other OS not listed below. */
4000         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_OTHER  UINT32_C(0x1)
4001         /* MSDOS OS. */
4002         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_MSDOS  UINT32_C(0xe)
4003         /* Windows OS. */
4004         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WINDOWS        UINT32_C(0x12)
4005         /* Solaris OS. */
4006         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_SOLARIS        UINT32_C(0x1d)
4007         /* Linux OS. */
4008         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_LINUX  UINT32_C(0x24)
4009         /* FreeBSD OS. */
4010         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_FREEBSD        UINT32_C(0x2a)
4011         /* VMware ESXi OS. */
4012         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_ESXI   UINT32_C(0x68)
4013         /* Microsoft Windows 8 64-bit OS. */
4014         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN864 UINT32_C(0x73)
4015         /* Microsoft Windows Server 2012 R2 OS. */
4016         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN2012R2      UINT32_C(0x74)
4017         uint8_t ver_maj;
4018         /* This is the major version of the driver. */
4019         uint8_t ver_min;
4020         /* This is the minor version of the driver. */
4021         uint8_t ver_upd;
4022         /* This is the update version of the driver. */
4023         uint8_t unused_0;
4024         uint16_t unused_1;
4025         uint32_t timestamp;
4026         /*
4027          * This is a 32-bit timestamp provided by the driver for keep
4028          * alive. The timestamp is in multiples of 1ms.
4029          */
4030         uint32_t unused_2;
4031         uint32_t vf_req_fwd[8];
4032         /*
4033          * This is a 256-bit bit mask provided by the PF driver for
4034          * letting the HWRM know what commands issued by the VF driver
4035          * to the HWRM should be forwarded to the PF driver. Nth bit
4036          * refers to the Nth req_type. Setting Nth bit to 1 indicates
4037          * that requests from the VF driver with req_type equal to N
4038          * shall be forwarded to the parent PF driver. This field is not
4039          * valid for the VF driver.
4040          */
4041         uint32_t async_event_fwd[8];
4042         /*
4043          * This is a 256-bit bit mask provided by the function driver
4044          *      (PF or VF driver) to indicate the list of asynchronous event
4045          * completions to be forwarded. Nth bit refers to the Nth
4046          * event_id. Setting Nth bit to 1 by the function driver shall
4047          * result in the HWRM forwarding asynchronous event completion
4048          * with event_id equal to N. If all bits are set to 0   (value of
4049          * 0), then the HWRM shall not forward any asynchronous event
4050          * completion to this function driver.
4051          */
4052 } __attribute__((packed));
4053
4054 /* Output       (16 bytes) */
4055 struct hwrm_func_drv_rgtr_output {
4056         uint16_t error_code;
4057         /*
4058          * Pass/Fail or error type Note: receiver to verify the in
4059          * parameters, and fail the call with an error when appropriate
4060          */
4061         uint16_t req_type;
4062         /* This field returns the type of original request. */
4063         uint16_t seq_id;
4064         /* This field provides original sequence number of the command. */
4065         uint16_t resp_len;
4066         /*
4067          * This field is the length of the response in bytes. The last
4068          * byte of the response is a valid flag that will read as '1'
4069          * when the command has been completely written to memory.
4070          */
4071         uint32_t unused_0;
4072         uint8_t unused_1;
4073         uint8_t unused_2;
4074         uint8_t unused_3;
4075         uint8_t valid;
4076         /*
4077          * This field is used in Output records to indicate that the
4078          * output is completely written to RAM. This field should be
4079          * read as '1' to indicate that the output has been completely
4080          * written. When writing a command completion or response to an
4081          * internal processor, the order of writes has to be such that
4082          * this field is written last.
4083          */
4084 } __attribute__((packed));
4085
4086 /* hwrm_func_drv_unrgtr */
4087 /*
4088  * Description: This command is used by the function driver to un register with
4089  * the HWRM. A function driver shall implement this command. A function driver
4090  * shall use this command during the driver unloading.
4091  */
4092 /* Input        (24 bytes) */
4093 struct hwrm_func_drv_unrgtr_input {
4094         uint16_t req_type;
4095         /*
4096          * This value indicates what type of request this is. The format
4097          * for the rest of the command is determined by this field.
4098          */
4099         uint16_t cmpl_ring;
4100         /*
4101          * This value indicates the what completion ring the request
4102          * will be optionally completed on. If the value is -1, then no
4103          * CR completion will be generated. Any other value must be a
4104          * valid CR ring_id value for this function.
4105          */
4106         uint16_t seq_id;
4107         /* This value indicates the command sequence number. */
4108         uint16_t target_id;
4109         /*
4110          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
4111          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
4112          * - HWRM
4113          */
4114         uint64_t resp_addr;
4115         /*
4116          * This is the host address where the response will be written
4117          * when the request is complete. This area must be 16B aligned
4118          * and must be cleared to zero before the request is made.
4119          */
4120         uint32_t flags;
4121         /*
4122          * When this bit is '1', the function driver is notifying the
4123          * HWRM to prepare for the shutdown.
4124          */
4125         #define HWRM_FUNC_DRV_UNRGTR_INPUT_FLAGS_PREPARE_FOR_SHUTDOWN   \
4126                 UINT32_C(0x1)
4127         uint32_t unused_0;
4128 } __attribute__((packed));
4129
4130 /* Output       (16 bytes) */
4131 struct hwrm_func_drv_unrgtr_output {
4132         uint16_t error_code;
4133         /*
4134          * Pass/Fail or error type Note: receiver to verify the in
4135          * parameters, and fail the call with an error when appropriate
4136          */
4137         uint16_t req_type;
4138         /* This field returns the type of original request. */
4139         uint16_t seq_id;
4140         /* This field provides original sequence number of the command. */
4141         uint16_t resp_len;
4142         /*
4143          * This field is the length of the response in bytes. The last
4144          * byte of the response is a valid flag that will read as '1'
4145          * when the command has been completely written to memory.
4146          */
4147         uint32_t unused_0;
4148         uint8_t unused_1;
4149         uint8_t unused_2;
4150         uint8_t unused_3;
4151         uint8_t valid;
4152         /*
4153          * This field is used in Output records to indicate that the
4154          * output is completely written to RAM. This field should be
4155          * read as '1' to indicate that the output has been completely
4156          * written. When writing a command completion or response to an
4157          * internal processor, the order of writes has to be such that
4158          * this field is written last.
4159          */
4160 } __attribute__((packed));
4161
4162 /* hwrm_func_buf_rgtr */
4163 /*
4164  * Description: This command is used by the PF driver to register buffers used
4165  * in the PF-VF communication with the HWRM. The PF driver uses this command to
4166  * register buffers for each PF-VF channel. A parent PF may issue this command
4167  * per child VF. If VF ID is not valid, then this command is used to register
4168  * buffers for all children VFs of the PF.
4169  */
4170 /* Input        (128 bytes) */
4171 struct hwrm_func_buf_rgtr_input {
4172         uint16_t req_type;
4173         /*
4174          * This value indicates what type of request this is. The format
4175          * for the rest of the command is determined by this field.
4176          */
4177         uint16_t cmpl_ring;
4178         /*
4179          * This value indicates the what completion ring the request
4180          * will be optionally completed on. If the value is -1, then no
4181          * CR completion will be generated. Any other value must be a
4182          * valid CR ring_id value for this function.
4183          */
4184         uint16_t seq_id;
4185         /* This value indicates the command sequence number. */
4186         uint16_t target_id;
4187         /*
4188          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
4189          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
4190          * - HWRM
4191          */
4192         uint64_t resp_addr;
4193         /*
4194          * This is the host address where the response will be written
4195          * when the request is complete. This area must be 16B aligned
4196          * and must be cleared to zero before the request is made.
4197          */
4198         uint32_t enables;
4199         /* This bit must be '1' for the vf_id field to be configured. */
4200         #define HWRM_FUNC_BUF_RGTR_INPUT_ENABLES_VF_ID  UINT32_C(0x1)
4201         /* This bit must be '1' for the err_buf_addr field to be configured. */
4202         #define HWRM_FUNC_BUF_RGTR_INPUT_ENABLES_ERR_BUF_ADDR   UINT32_C(0x2)
4203         uint16_t vf_id;
4204         /*
4205          * This value is used to identify a Virtual Function    (VF). The
4206          * scope of VF ID is local within a PF.
4207          */
4208         uint16_t req_buf_num_pages;
4209         /*
4210          * This field represents the number of pages used for request
4211          * buffer(s).
4212          */
4213         uint16_t req_buf_page_size;
4214         /* This field represents the page size used for request buffer(s). */
4215         /* 16 bytes */
4216         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_16B UINT32_C(0x4)
4217         /* 4 Kbytes */
4218         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_4K UINT32_C(0xc)
4219         /* 8 Kbytes */
4220         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_8K UINT32_C(0xd)
4221         /* 64 Kbytes */
4222         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_64K UINT32_C(0x10)
4223         /* 2 Mbytes */
4224         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_2M UINT32_C(0x15)
4225         /* 4 Mbytes */
4226         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_4M UINT32_C(0x16)
4227         /* 1 Gbytes */
4228         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_1G UINT32_C(0x1e)
4229         uint16_t req_buf_len;
4230         /* The length of the request buffer per VF in bytes. */
4231         uint16_t resp_buf_len;
4232         /* The length of the response buffer in bytes. */
4233         uint8_t unused_0;
4234         uint8_t unused_1;
4235         uint64_t req_buf_page_addr[10];
4236         /* This field represents the page address of req buffer. */
4237         uint64_t error_buf_addr;
4238         /*
4239          * This field is used to receive the error reporting from the
4240          * chipset. Only applicable for PFs.
4241          */
4242         uint64_t resp_buf_addr;
4243         /* This field is used to receive the response forwarded by the HWRM. */
4244 } __attribute__((packed));
4245
4246 /* Output       (16 bytes) */
4247 struct hwrm_func_buf_rgtr_output {
4248         uint16_t error_code;
4249         /*
4250          * Pass/Fail or error type Note: receiver to verify the in
4251          * parameters, and fail the call with an error when appropriate
4252          */
4253         uint16_t req_type;
4254         /* This field returns the type of original request. */
4255         uint16_t seq_id;
4256         /* This field provides original sequence number of the command. */
4257         uint16_t resp_len;
4258         /*
4259          * This field is the length of the response in bytes. The last
4260          * byte of the response is a valid flag that will read as '1'
4261          * when the command has been completely written to memory.
4262          */
4263         uint32_t unused_0;
4264         uint8_t unused_1;
4265         uint8_t unused_2;
4266         uint8_t unused_3;
4267         uint8_t valid;
4268         /*
4269          * This field is used in Output records to indicate that the
4270          * output is completely written to RAM. This field should be
4271          * read as '1' to indicate that the output has been completely
4272          * written. When writing a command completion or response to an
4273          * internal processor, the order of writes has to be such that
4274          * this field is written last.
4275          */
4276 } __attribute__((packed));
4277
4278 /* hwrm_func_buf_unrgtr */
4279 /*
4280  * Description: This command is used by the PF driver to unregister buffers used
4281  * in the PF-VF communication with the HWRM. The PF driver uses this command to
4282  * unregister buffers for PF-VF communication. A parent PF may issue this
4283  * command to unregister buffers for communication between the PF and a specific
4284  * VF. If the VF ID is not valid, then this command is used to unregister
4285  * buffers used for communications with all children VFs of the PF.
4286  */
4287 /* Input        (24 bytes) */
4288 struct hwrm_func_buf_unrgtr_input {
4289         uint16_t req_type;
4290         /*
4291          * This value indicates what type of request this is. The format
4292          * for the rest of the command is determined by this field.
4293          */
4294         uint16_t cmpl_ring;
4295         /*
4296          * This value indicates the what completion ring the request
4297          * will be optionally completed on. If the value is -1, then no
4298          * CR completion will be generated. Any other value must be a
4299          * valid CR ring_id value for this function.
4300          */
4301         uint16_t seq_id;
4302         /* This value indicates the command sequence number. */
4303         uint16_t target_id;
4304         /*
4305          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
4306          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
4307          * - HWRM
4308          */
4309         uint64_t resp_addr;
4310         /*
4311          * This is the host address where the response will be written
4312          * when the request is complete. This area must be 16B aligned
4313          * and must be cleared to zero before the request is made.
4314          */
4315         uint32_t enables;
4316         /* This bit must be '1' for the vf_id field to be configured. */
4317         #define HWRM_FUNC_BUF_UNRGTR_INPUT_ENABLES_VF_ID        UINT32_C(0x1)
4318         uint16_t vf_id;
4319         /*
4320          * This value is used to identify a Virtual Function    (VF). The
4321          * scope of VF ID is local within a PF.
4322          */
4323         uint16_t unused_0;
4324 } __attribute__((packed));
4325
4326 /* Output       (16 bytes) */
4327 struct hwrm_func_buf_unrgtr_output {
4328         uint16_t error_code;
4329         /*
4330          * Pass/Fail or error type Note: receiver to verify the in
4331          * parameters, and fail the call with an error when appropriate
4332          */
4333         uint16_t req_type;
4334         /* This field returns the type of original request. */
4335         uint16_t seq_id;
4336         /* This field provides original sequence number of the command. */
4337         uint16_t resp_len;
4338         /*
4339          * This field is the length of the response in bytes. The last
4340          * byte of the response is a valid flag that will read as '1'
4341          * when the command has been completely written to memory.
4342          */
4343         uint32_t unused_0;
4344         uint8_t unused_1;
4345         uint8_t unused_2;
4346         uint8_t unused_3;
4347         uint8_t valid;
4348         /*
4349          * This field is used in Output records to indicate that the
4350          * output is completely written to RAM. This field should be
4351          * read as '1' to indicate that the output has been completely
4352          * written. When writing a command completion or response to an
4353          * internal processor, the order of writes has to be such that
4354          * this field is written last.
4355          */
4356 } __attribute__((packed));
4357
4358 /* hwrm_port_phy_cfg */
4359 /*
4360  * Description: This command configures the PHY device for the port. It allows
4361  * setting of the most generic settings for the PHY. The HWRM shall complete
4362  * this command as soon as PHY settings are configured. They may not be applied
4363  * when the command response is provided. A VF driver shall not be allowed to
4364  * configure PHY using this command. In a network partition mode, a PF driver
4365  * shall not be allowed to configure PHY using this command.
4366  */
4367 /* Input        (56 bytes) */
4368 struct hwrm_port_phy_cfg_input {
4369         uint16_t req_type;
4370         /*
4371          * This value indicates what type of request this is. The format
4372          * for the rest of the command is determined by this field.
4373          */
4374         uint16_t cmpl_ring;
4375         /*
4376          * This value indicates the what completion ring the request
4377          * will be optionally completed on. If the value is -1, then no
4378          * CR completion will be generated. Any other value must be a
4379          * valid CR ring_id value for this function.
4380          */
4381         uint16_t seq_id;
4382         /* This value indicates the command sequence number. */
4383         uint16_t target_id;
4384         /*
4385          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
4386          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
4387          * - HWRM
4388          */
4389         uint64_t resp_addr;
4390         /*
4391          * This is the host address where the response will be written
4392          * when the request is complete. This area must be 16B aligned
4393          * and must be cleared to zero before the request is made.
4394          */
4395         uint32_t flags;
4396         /*
4397          * When this bit is set to '1', the PHY for the port shall be
4398          * reset. # If this bit is set to 1, then the HWRM shall reset
4399          * the PHY after applying PHY configuration changes specified in
4400          * this command. # In order to guarantee that PHY configuration
4401          * changes specified in this command take effect, the HWRM
4402          * client should set this flag to 1. # If this bit is not set to
4403          * 1, then the HWRM may reset the PHY depending on the current
4404          * PHY configuration and settings specified in this command.
4405          */
4406         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY UINT32_C(0x1)
4407         /* deprecated bit. Do not use!!! */
4408         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_DEPRECATED        UINT32_C(0x2)
4409         /*
4410          * When this bit is set to '1', the link shall be forced to the
4411          * force_link_speed value. When this bit is set to '1', the HWRM
4412          * client should not enable any of the auto negotiation related
4413          * fields represented by auto_XXX fields in this command. When
4414          * this bit is set to '1' and the HWRM client has enabled a
4415          * auto_XXX field in this command, then the HWRM shall ignore
4416          * the enabled auto_XXX field. When this bit is set to zero, the
4417          * link shall be allowed to autoneg.
4418          */
4419         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE     UINT32_C(0x4)
4420         /*
4421          * When this bit is set to '1', the auto-negotiation process
4422          * shall be restarted on the link.
4423          */
4424         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG   UINT32_C(0x8)
4425         /*
4426          * When this bit is set to '1', Energy Efficient Ethernet       (EEE)
4427          * is requested to be enabled on this link. If EEE is not
4428          * supported on this port, then this flag shall be ignored by
4429          * the HWRM.
4430          */
4431         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_ENABLE        UINT32_C(0x10)
4432         /*
4433          * When this bit is set to '1', Energy Efficient Ethernet       (EEE)
4434          * is requested to be disabled on this link. If EEE is not
4435          * supported on this port, then this flag shall be ignored by
4436          * the HWRM.
4437          */
4438         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_DISABLE       UINT32_C(0x20)
4439         /*
4440          * When this bit is set to '1' and EEE is enabled on this link,
4441          * then TX LPI is requested to be enabled on the link. If EEE is
4442          * not supported on this port, then this flag shall be ignored
4443          * by the HWRM. If EEE is disabled on this port, then this flag
4444          * shall be ignored by the HWRM.
4445          */
4446         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_TX_LPI_ENABLE UINT32_C(0x40)
4447         /*
4448          * When this bit is set to '1' and EEE is enabled on this link,
4449          * then TX LPI is requested to be disabled on the link. If EEE
4450          * is not supported on this port, then this flag shall be
4451          * ignored by the HWRM. If EEE is disabled on this port, then
4452          * this flag shall be ignored by the HWRM.
4453          */
4454         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_TX_LPI_DISABLE UINT32_C(0x80)
4455         /*
4456          * When set to 1, then the HWRM shall enable FEC
4457          * autonegotitation on this port if supported. When set to 0,
4458          * then this flag shall be ignored. If FEC autonegotiation is
4459          * not supported, then the HWRM shall ignore this flag.
4460          */
4461         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FEC_AUTONEG_ENABLE UINT32_C(0x100)
4462         /*
4463          * When set to 1, then the HWRM shall disable FEC
4464          * autonegotiation on this port if supported. When set to 0,
4465          * then this flag shall be ignored. If FEC autonegotiation is
4466          * not supported, then the HWRM shall ignore this flag.
4467          */
4468         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FEC_AUTONEG_DISABLE       \
4469                 UINT32_C(0x200)
4470         /*
4471          * When set to 1, then the HWRM shall enable FEC CLAUSE 74      (Fire
4472          * Code) on this port if supported. When set to 0, then this
4473          * flag shall be ignored. If FEC CLAUSE 74 is not supported,
4474          * then the HWRM shall ignore this flag.
4475          */
4476         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FEC_CLAUSE74_ENABLE       \
4477                 UINT32_C(0x400)
4478         /*
4479          * When set to 1, then the HWRM shall disable FEC CLAUSE 74
4480          *      (Fire Code) on this port if supported. When set to 0, then
4481          * this flag shall be ignored. If FEC CLAUSE 74 is not
4482          * supported, then the HWRM shall ignore this flag.
4483          */
4484         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FEC_CLAUSE74_DISABLE      \
4485                 UINT32_C(0x800)
4486         /*
4487          * When set to 1, then the HWRM shall enable FEC CLAUSE 91      (Reed
4488          * Solomon) on this port if supported. When set to 0, then this
4489          * flag shall be ignored. If FEC CLAUSE 91 is not supported,
4490          * then the HWRM shall ignore this flag.
4491          */
4492         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FEC_CLAUSE91_ENABLE       \
4493                 UINT32_C(0x1000)
4494         /*
4495          * When set to 1, then the HWRM shall disable FEC CLAUSE 91
4496          *      (Reed Solomon) on this port if supported. When set to 0, then
4497          * this flag shall be ignored. If FEC CLAUSE 91 is not
4498          * supported, then the HWRM shall ignore this flag.
4499          */
4500         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FEC_CLAUSE91_DISABLE      \
4501                 UINT32_C(0x2000)
4502         /*
4503          * When this bit is set to '1', the link shall be forced to be
4504          * taken down. # When this bit is set to '1", all other command
4505          * input settings related to the link speed shall be ignored.
4506          * Once the link state is forced down, it can be explicitly
4507          * cleared from that state by setting this flag to '0'. # If
4508          * this flag is set to '0', then the link shall be cleared from
4509          * forced down state if the link is in forced down state. There
4510          * may be conditions    (e.g. out-of-band or sideband configuration
4511          * changes for the link) outside the scope of the HWRM
4512          * implementation that may clear forced down link state.
4513          */
4514         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE_LINK_DWN UINT32_C(0x4000)
4515         uint32_t enables;
4516         /* This bit must be '1' for the auto_mode field to be configured. */
4517         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE       UINT32_C(0x1)
4518         /* This bit must be '1' for the auto_duplex field to be configured. */
4519         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_DUPLEX     UINT32_C(0x2)
4520         /* This bit must be '1' for the auto_pause field to be configured. */
4521         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_PAUSE      UINT32_C(0x4)
4522         /*
4523          * This bit must be '1' for the auto_link_speed field to be
4524          * configured.
4525          */
4526         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED UINT32_C(0x8)
4527         /*
4528          * This bit must be '1' for the auto_link_speed_mask field to be
4529          * configured.
4530          */
4531         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK     \
4532                 UINT32_C(0x10)
4533         /* This bit must be '1' for the wirespeed field to be configured. */
4534         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_WIOUTPUTEED     UINT32_C(0x20)
4535         /* This bit must be '1' for the lpbk field to be configured. */
4536         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_LPBK    UINT32_C(0x40)
4537         /* This bit must be '1' for the preemphasis field to be configured. */
4538         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_PREEMPHASIS     UINT32_C(0x80)
4539         /* This bit must be '1' for the force_pause field to be configured. */
4540         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_FORCE_PAUSE     UINT32_C(0x100)
4541         /*
4542          * This bit must be '1' for the eee_link_speed_mask field to be
4543          * configured.
4544          */
4545         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_EEE_LINK_SPEED_MASK     \
4546                 UINT32_C(0x200)
4547         /* This bit must be '1' for the tx_lpi_timer field to be configured. */
4548         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_TX_LPI_TIMER    UINT32_C(0x400)
4549         uint16_t port_id;
4550         /* Port ID of port that is to be configured. */
4551         uint16_t force_link_speed;
4552         /*
4553          * This is the speed that will be used if the force bit is '1'.
4554          * If unsupported speed is selected, an error will be generated.
4555          */
4556         /* 100Mb link speed */
4557         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100MB  UINT32_C(0x1)
4558         /* 1Gb link speed */
4559         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_1GB    UINT32_C(0xa)
4560         /* 2Gb link speed */
4561         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2GB    UINT32_C(0x14)
4562         /* 2.5Gb link speed */
4563         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2_5GB  UINT32_C(0x19)
4564         /* 10Gb link speed */
4565         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10GB   UINT32_C(0x64)
4566         /* 20Mb link speed */
4567         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_20GB   UINT32_C(0xc8)
4568         /* 25Gb link speed */
4569         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_25GB   UINT32_C(0xfa)
4570         /* 40Gb link speed */
4571         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_40GB   UINT32_C(0x190)
4572         /* 50Gb link speed */
4573         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_50GB   UINT32_C(0x1f4)
4574         /* 100Gb link speed */
4575         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100GB  UINT32_C(0x3e8)
4576         /* 10Mb link speed */
4577         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10MB   UINT32_C(0xffff)
4578         uint8_t auto_mode;
4579         /*
4580          * This value is used to identify what autoneg mode is used when
4581          * the link speed is not being forced.
4582          */
4583         /*
4584          * Disable autoneg or autoneg disabled. No
4585          * speeds are selected.
4586          */
4587         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_NONE  UINT32_C(0x0)
4588         /* Select all possible speeds for autoneg mode. */
4589         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ALL_SPEEDS    UINT32_C(0x1)
4590         /*
4591          * Select only the auto_link_speed speed for
4592          * autoneg mode. This mode has been DEPRECATED.
4593          * An HWRM client should not use this mode.
4594          */
4595         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ONE_SPEED     UINT32_C(0x2)
4596         /*
4597          * Select the auto_link_speed or any speed below
4598          * that speed for autoneg. This mode has been
4599          * DEPRECATED. An HWRM client should not use
4600          * this mode.
4601          */
4602         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ONE_OR_BELOW  UINT32_C(0x3)
4603         /*
4604          * Select the speeds based on the corresponding
4605          * link speed mask value that is provided.
4606          */
4607         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK    UINT32_C(0x4)
4608         uint8_t auto_duplex;
4609         /*
4610          * This is the duplex setting that will be used if the
4611          * autoneg_mode is "one_speed" or "one_or_below".
4612          */
4613         /* Half Duplex will be requested. */
4614         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_HALF        UINT32_C(0x0)
4615         /* Full duplex will be requested. */
4616         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_FULL        UINT32_C(0x1)
4617         /* Both Half and Full dupex will be requested. */
4618         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_BOTH        UINT32_C(0x2)
4619         uint8_t auto_pause;
4620         /*
4621          * This value is used to configure the pause that will be used
4622          * for autonegotiation. Add text on the usage of auto_pause and
4623          * force_pause.
4624          */
4625         /*
4626          * When this bit is '1', Generation of tx pause messages has
4627          * been requested. Disabled otherwise.
4628          */
4629         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_TX   UINT32_C(0x1)
4630         /*
4631          * When this bit is '1', Reception of rx pause messages has been
4632          * requested. Disabled otherwise.
4633          */
4634         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_RX   UINT32_C(0x2)
4635         /*
4636          * When set to 1, the advertisement of pause is enabled. # When
4637          * the auto_mode is not set to none and this flag is set to 1,
4638          * then the auto_pause bits on this port are being advertised
4639          * and autoneg pause results are being interpreted. # When the
4640          * auto_mode is not set to none and this flag is set to 0, the
4641          * pause is forced as indicated in force_pause, and also
4642          * advertised as auto_pause bits, but the autoneg results are
4643          * not interpreted since the pause configuration is being
4644          * forced. # When the auto_mode is set to none and this flag is
4645          * set to 1, auto_pause bits should be ignored and should be set
4646          * to 0.
4647          */
4648         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_AUTONEG_PAUSE UINT32_C(0x4)
4649         uint8_t unused_0;
4650         uint16_t auto_link_speed;
4651         /*
4652          * This is the speed that will be used if the autoneg_mode is
4653          * "one_speed" or "one_or_below". If an unsupported speed is
4654          * selected, an error will be generated.
4655          */
4656         /* 100Mb link speed */
4657         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100MB   UINT32_C(0x1)
4658         /* 1Gb link speed */
4659         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_1GB     UINT32_C(0xa)
4660         /* 2Gb link speed */
4661         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2GB     UINT32_C(0x14)
4662         /* 2.5Gb link speed */
4663         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2_5GB   UINT32_C(0x19)
4664         /* 10Gb link speed */
4665         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_10GB    UINT32_C(0x64)
4666         /* 20Mb link speed */
4667         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_20GB    UINT32_C(0xc8)
4668         /* 25Gb link speed */
4669         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_25GB    UINT32_C(0xfa)
4670         /* 40Gb link speed */
4671         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_40GB    UINT32_C(0x190)
4672         /* 50Gb link speed */
4673         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_50GB    UINT32_C(0x1f4)
4674         /* 100Gb link speed */
4675         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100GB   UINT32_C(0x3e8)
4676         /* 10Mb link speed */
4677         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_10MB    UINT32_C(0xffff)
4678         uint16_t auto_link_speed_mask;
4679         /*
4680          * This is a mask of link speeds that will be used if
4681          * autoneg_mode is "mask". If unsupported speed is enabled an
4682          * error will be generated.
4683          */
4684         /* 100Mb link speed     (Half-duplex) */
4685         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MBHD     \
4686                 UINT32_C(0x1)
4687         /* 100Mb link speed     (Full-duplex) */
4688         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MB \
4689                 UINT32_C(0x2)
4690         /* 1Gb link speed       (Half-duplex) */
4691         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GBHD \
4692                 UINT32_C(0x4)
4693         /* 1Gb link speed       (Full-duplex) */
4694         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GB        \
4695                 UINT32_C(0x8)
4696         /* 2Gb link speed */
4697         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_2GB        \
4698                 UINT32_C(0x10)
4699         /* 2.5Gb link speed */
4700         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_2_5GB      \
4701                 UINT32_C(0x20)
4702         /* 10Gb link speed */
4703         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10GB UINT32_C(0x40)
4704         /* 20Gb link speed */
4705         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_20GB UINT32_C(0x80)
4706         /* 25Gb link speed */
4707         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_25GB       \
4708                 UINT32_C(0x100)
4709         /* 40Gb link speed */
4710         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_40GB       \
4711                 UINT32_C(0x200)
4712         /* 50Gb link speed */
4713         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_50GB       \
4714                 UINT32_C(0x400)
4715         /* 100Gb link speed */
4716         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100GB      \
4717                 UINT32_C(0x800)
4718         /* 10Mb link speed      (Half-duplex) */
4719         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10MBHD     \
4720                 UINT32_C(0x1000)
4721         /* 10Mb link speed      (Full-duplex) */
4722         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10MB       \
4723                 UINT32_C(0x2000)
4724         uint8_t wirespeed;
4725         /* This value controls the wirespeed feature. */
4726         /* Wirespeed feature is disabled. */
4727         #define HWRM_PORT_PHY_CFG_INPUT_WIOUTPUTEED_OFF UINT32_C(0x0)
4728         /* Wirespeed feature is enabled. */
4729         #define HWRM_PORT_PHY_CFG_INPUT_WIOUTPUTEED_ON  UINT32_C(0x1)
4730         uint8_t lpbk;
4731         /* This value controls the loopback setting for the PHY. */
4732         /* No loopback is selected. Normal operation. */
4733         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_NONE       UINT32_C(0x0)
4734         /*
4735          * The HW will be configured with local loopback
4736          * such that host data is sent back to the host
4737          * without modification.
4738          */
4739         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_LOCAL      UINT32_C(0x1)
4740         /*
4741          * The HW will be configured with remote
4742          * loopback such that port logic will send
4743          * packets back out the transmitter that are
4744          * received.
4745          */
4746         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_REMOTE     UINT32_C(0x2)
4747         uint8_t force_pause;
4748         /*
4749          * This value is used to configure the pause that will be used
4750          * for force mode.
4751          */
4752         /*
4753          * When this bit is '1', Generation of tx pause messages is
4754          * supported. Disabled otherwise.
4755          */
4756         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_TX  UINT32_C(0x1)
4757         /*
4758          * When this bit is '1', Reception of rx pause messages is
4759          * supported. Disabled otherwise.
4760          */
4761         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_RX  UINT32_C(0x2)
4762         uint8_t unused_1;
4763         uint32_t preemphasis;
4764         /*
4765          * This value controls the pre-emphasis to be used for the link.
4766          * Driver should not set this value     (use enable.preemphasis = 0)
4767          * unless driver is sure of setting. Normally HWRM FW will
4768          * determine proper pre-emphasis.
4769          */
4770         uint16_t eee_link_speed_mask;
4771         /*
4772          * Setting for link speed mask that is used to advertise speeds
4773          * during autonegotiation when EEE is enabled. This field is
4774          * valid only when EEE is enabled. The speeds specified in this
4775          * field shall be a subset of speeds specified in
4776          * auto_link_speed_mask. If EEE is enabled,then at least one
4777          * speed shall be provided in this mask.
4778          */
4779         /* Reserved */
4780         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD1 UINT32_C(0x1)
4781         /* 100Mb link speed     (Full-duplex) */
4782         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_100MB UINT32_C(0x2)
4783         /* Reserved */
4784         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD2 UINT32_C(0x4)
4785         /* 1Gb link speed       (Full-duplex) */
4786         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_1GB UINT32_C(0x8)
4787         /* Reserved */
4788         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD3 UINT32_C(0x10)
4789         /* Reserved */
4790         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD4 UINT32_C(0x20)
4791         /* 10Gb link speed */
4792         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_10GB UINT32_C(0x40)
4793         uint8_t unused_2;
4794         uint8_t unused_3;
4795         uint32_t tx_lpi_timer;
4796         uint32_t unused_4;
4797         /*
4798          * Reuested setting of TX LPI timer in microseconds. This field
4799          * is valid only when EEE is enabled and TX LPI is enabled.
4800          */
4801         #define HWRM_PORT_PHY_CFG_INPUT_TX_LPI_TIMER_MASK UINT32_C(0xffffff)
4802         #define HWRM_PORT_PHY_CFG_INPUT_TX_LPI_TIMER_SFT        0
4803 } __attribute__((packed));
4804
4805 /* Output       (16 bytes) */
4806 struct hwrm_port_phy_cfg_output {
4807         uint16_t error_code;
4808         /*
4809          * Pass/Fail or error type Note: receiver to verify the in
4810          * parameters, and fail the call with an error when appropriate
4811          */
4812         uint16_t req_type;
4813         /* This field returns the type of original request. */
4814         uint16_t seq_id;
4815         /* This field provides original sequence number of the command. */
4816         uint16_t resp_len;
4817         /*
4818          * This field is the length of the response in bytes. The last
4819          * byte of the response is a valid flag that will read as '1'
4820          * when the command has been completely written to memory.
4821          */
4822         uint32_t unused_0;
4823         uint8_t unused_1;
4824         uint8_t unused_2;
4825         uint8_t unused_3;
4826         uint8_t valid;
4827         /*
4828          * This field is used in Output records to indicate that the
4829          * output is completely written to RAM. This field should be
4830          * read as '1' to indicate that the output has been completely
4831          * written. When writing a command completion or response to an
4832          * internal processor, the order of writes has to be such that
4833          * this field is written last.
4834          */
4835 } __attribute__((packed));
4836
4837 /* hwrm_port_phy_qcfg */
4838 /* Description: This command queries the PHY configuration for the port. */
4839 /* Input        (24 bytes) */
4840 struct hwrm_port_phy_qcfg_input {
4841         uint16_t req_type;
4842         /*
4843          * This value indicates what type of request this is. The format
4844          * for the rest of the command is determined by this field.
4845          */
4846         uint16_t cmpl_ring;
4847         /*
4848          * This value indicates the what completion ring the request
4849          * will be optionally completed on. If the value is -1, then no
4850          * CR completion will be generated. Any other value must be a
4851          * valid CR ring_id value for this function.
4852          */
4853         uint16_t seq_id;
4854         /* This value indicates the command sequence number. */
4855         uint16_t target_id;
4856         /*
4857          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
4858          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
4859          * - HWRM
4860          */
4861         uint64_t resp_addr;
4862         /*
4863          * This is the host address where the response will be written
4864          * when the request is complete. This area must be 16B aligned
4865          * and must be cleared to zero before the request is made.
4866          */
4867         uint16_t port_id;
4868         /* Port ID of port that is to be queried. */
4869         uint16_t unused_0[3];
4870 } __attribute__((packed));
4871
4872 /* Output       (96 bytes) */
4873 struct hwrm_port_phy_qcfg_output {
4874         uint16_t error_code;
4875         /*
4876          * Pass/Fail or error type Note: receiver to verify the in
4877          * parameters, and fail the call with an error when appropriate
4878          */
4879         uint16_t req_type;
4880         /* This field returns the type of original request. */
4881         uint16_t seq_id;
4882         /* This field provides original sequence number of the command. */
4883         uint16_t resp_len;
4884         /*
4885          * This field is the length of the response in bytes. The last
4886          * byte of the response is a valid flag that will read as '1'
4887          * when the command has been completely written to memory.
4888          */
4889         uint8_t link;
4890         /* This value indicates the current link status. */
4891         /* There is no link or cable detected. */
4892         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_NO_LINK  UINT32_C(0x0)
4893         /* There is no link, but a cable has been detected. */
4894         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SIGNAL   UINT32_C(0x1)
4895         /* There is a link. */
4896         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK     UINT32_C(0x2)
4897         uint8_t unused_0;
4898         uint16_t link_speed;
4899         /* This value indicates the current link speed of the connection. */
4900         /* 100Mb link speed */
4901         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100MB      UINT32_C(0x1)
4902         /* 1Gb link speed */
4903         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_1GB        UINT32_C(0xa)
4904         /* 2Gb link speed */
4905         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_2GB        UINT32_C(0x14)
4906         /* 2.5Gb link speed */
4907         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_2_5GB      UINT32_C(0x19)
4908         /* 10Gb link speed */
4909         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_10GB       UINT32_C(0x64)
4910         /* 20Mb link speed */
4911         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_20GB       UINT32_C(0xc8)
4912         /* 25Gb link speed */
4913         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_25GB       UINT32_C(0xfa)
4914         /* 40Gb link speed */
4915         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_40GB       UINT32_C(0x190)
4916         /* 50Gb link speed */
4917         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_50GB       UINT32_C(0x1f4)
4918         /* 100Gb link speed */
4919         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100GB      UINT32_C(0x3e8)
4920         /* 10Mb link speed */
4921         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_10MB       UINT32_C(0xffff)
4922         uint8_t duplex_cfg;
4923         /* This value is indicates the duplex of the current connection. */
4924         /* Half Duplex connection. */
4925         #define HWRM_PORT_PHY_QCFG_OUTPUT_DUPLEX_CFG_HALF UINT32_C(0x0)
4926         /* Full duplex connection. */
4927         #define HWRM_PORT_PHY_QCFG_OUTPUT_DUPLEX_CFG_FULL UINT32_C(0x1)
4928         uint8_t pause;
4929         /*
4930          * This value is used to indicate the current pause
4931          * configuration. When autoneg is enabled, this value represents
4932          * the autoneg results of pause configuration.
4933          */
4934         /*
4935          * When this bit is '1', Generation of tx pause messages is
4936          * supported. Disabled otherwise.
4937          */
4938         #define HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX      UINT32_C(0x1)
4939         /*
4940          * When this bit is '1', Reception of rx pause messages is
4941          * supported. Disabled otherwise.
4942          */
4943         #define HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX      UINT32_C(0x2)
4944         uint16_t support_speeds;
4945         /*
4946          * The supported speeds for the port. This is a bit mask. For
4947          * each speed that is supported, the corrresponding bit will be
4948          * set to '1'.
4949          */
4950         /* 100Mb link speed     (Half-duplex) */
4951         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100MBHD UINT32_C(0x1)
4952         /* 100Mb link speed     (Full-duplex) */
4953         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100MB UINT32_C(0x2)
4954         /* 1Gb link speed       (Half-duplex) */
4955         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_1GBHD UINT32_C(0x4)
4956         /* 1Gb link speed       (Full-duplex) */
4957         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_1GB    UINT32_C(0x8)
4958         /* 2Gb link speed */
4959         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_2GB    UINT32_C(0x10)
4960         /* 2.5Gb link speed */
4961         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_2_5GB UINT32_C(0x20)
4962         /* 10Gb link speed */
4963         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10GB UINT32_C(0x40)
4964         /* 20Gb link speed */
4965         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_20GB UINT32_C(0x80)
4966         /* 25Gb link speed */
4967         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_25GB UINT32_C(0x100)
4968         /* 40Gb link speed */
4969         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_40GB UINT32_C(0x200)
4970         /* 50Gb link speed */
4971         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_50GB UINT32_C(0x400)
4972         /* 100Gb link speed */
4973         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100GB UINT32_C(0x800)
4974         /* 10Mb link speed      (Half-duplex) */
4975         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10MBHD UINT32_C(0x1000)
4976         /* 10Mb link speed      (Full-duplex) */
4977         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10MB UINT32_C(0x2000)
4978         uint16_t force_link_speed;
4979         /*
4980          * Current setting of forced link speed. When the link speed is
4981          * not being forced, this value shall be set to 0.
4982          */
4983         /* 100Mb link speed */
4984         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_100MB UINT32_C(0x1)
4985         /* 1Gb link speed */
4986         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_1GB  UINT32_C(0xa)
4987         /* 2Gb link speed */
4988         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_2GB  UINT32_C(0x14)
4989         /* 2.5Gb link speed */
4990         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_2_5GB UINT32_C(0x19)
4991         /* 10Gb link speed */
4992         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_10GB UINT32_C(0x64)
4993         /* 20Mb link speed */
4994         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_20GB UINT32_C(0xc8)
4995         /* 25Gb link speed */
4996         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_25GB UINT32_C(0xfa)
4997         /* 40Gb link speed */
4998         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_40GB UINT32_C(0x190)
4999         /* 50Gb link speed */
5000         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_50GB UINT32_C(0x1f4)
5001         /* 100Gb link speed */
5002         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_100GB UINT32_C(0x3e8)
5003         /* 10Mb link speed */
5004         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_10MB UINT32_C(0xffff)
5005         uint8_t auto_mode;
5006         /* Current setting of auto negotiation mode. */
5007         /*
5008          * Disable autoneg or autoneg disabled. No
5009          * speeds are selected.
5010          */
5011         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE        UINT32_C(0x0)
5012         /* Select all possible speeds for autoneg mode. */
5013         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_ALL_SPEEDS  UINT32_C(0x1)
5014         /*
5015          * Select only the auto_link_speed speed for
5016          * autoneg mode. This mode has been DEPRECATED.
5017          * An HWRM client should not use this mode.
5018          */
5019         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_ONE_SPEED   UINT32_C(0x2)
5020         /*
5021          * Select the auto_link_speed or any speed below
5022          * that speed for autoneg. This mode has been
5023          * DEPRECATED. An HWRM client should not use
5024          * this mode.
5025          */
5026         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_ONE_OR_BELOW UINT32_C(0x3)
5027         /*
5028          * Select the speeds based on the corresponding
5029          * link speed mask value that is provided.
5030          */
5031         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_SPEED_MASK  UINT32_C(0x4)
5032         uint8_t auto_pause;
5033         /*
5034          * Current setting of pause autonegotiation. Move autoneg_pause
5035          * flag here.
5036          */
5037         /*
5038          * When this bit is '1', Generation of tx pause messages has
5039          * been requested. Disabled otherwise.
5040          */
5041         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_TX UINT32_C(0x1)
5042         /*
5043          * When this bit is '1', Reception of rx pause messages has been
5044          * requested. Disabled otherwise.
5045          */
5046         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_RX UINT32_C(0x2)
5047         /*
5048          * When set to 1, the advertisement of pause is enabled. # When
5049          * the auto_mode is not set to none and this flag is set to 1,
5050          * then the auto_pause bits on this port are being advertised
5051          * and autoneg pause results are being interpreted. # When the
5052          * auto_mode is not set to none and this flag is set to 0, the
5053          * pause is forced as indicated in force_pause, and also
5054          * advertised as auto_pause bits, but the autoneg results are
5055          * not interpreted since the pause configuration is being
5056          * forced. # When the auto_mode is set to none and this flag is
5057          * set to 1, auto_pause bits should be ignored and should be set
5058          * to 0.
5059          */
5060         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_AUTONEG_PAUSE UINT32_C(0x4)
5061         uint16_t auto_link_speed;
5062         /*
5063          * Current setting for auto_link_speed. This field is only valid
5064          * when auto_mode is set to "one_speed" or "one_or_below".
5065          */
5066         /* 100Mb link speed */
5067         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_100MB UINT32_C(0x1)
5068         /* 1Gb link speed */
5069         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_1GB   UINT32_C(0xa)
5070         /* 2Gb link speed */
5071         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_2GB   UINT32_C(0x14)
5072         /* 2.5Gb link speed */
5073         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_2_5GB UINT32_C(0x19)
5074         /* 10Gb link speed */
5075         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_10GB  UINT32_C(0x64)
5076         /* 20Mb link speed */
5077         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_20GB  UINT32_C(0xc8)
5078         /* 25Gb link speed */
5079         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_25GB  UINT32_C(0xfa)
5080         /* 40Gb link speed */
5081         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_40GB  UINT32_C(0x190)
5082         /* 50Gb link speed */
5083         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_50GB  UINT32_C(0x1f4)
5084         /* 100Gb link speed */
5085         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_100GB UINT32_C(0x3e8)
5086         /* 10Mb link speed */
5087         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_10MB UINT32_C(0xffff)
5088         uint16_t auto_link_speed_mask;
5089         /*
5090          * Current setting for auto_link_speed_mask that is used to
5091          * advertise speeds during autonegotiation. This field is only
5092          * valid when auto_mode is set to "mask". The speeds specified
5093          * in this field shall be a subset of supported speeds on this
5094          * port.
5095          */
5096         /* 100Mb link speed     (Half-duplex) */
5097         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_100MBHD  \
5098                 UINT32_C(0x1)
5099         /* 100Mb link speed     (Full-duplex) */
5100         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_100MB     \
5101                 UINT32_C(0x2)
5102         /* 1Gb link speed       (Half-duplex) */
5103         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_1GBHD     \
5104                 UINT32_C(0x4)
5105         /* 1Gb link speed       (Full-duplex) */
5106         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_1GB UINT32_C(0x8)
5107         /* 2Gb link speed */
5108         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_2GB      \
5109                 UINT32_C(0x10)
5110         /* 2.5Gb link speed */
5111         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_2_5GB     \
5112                 UINT32_C(0x20)
5113         /* 10Gb link speed */
5114         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_10GB     \
5115                 UINT32_C(0x40)
5116         /* 20Gb link speed */
5117         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_20GB     \
5118                 UINT32_C(0x80)
5119         /* 25Gb link speed */
5120         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_25GB     \
5121                 UINT32_C(0x100)
5122         /* 40Gb link speed */
5123         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_40GB     \
5124                 UINT32_C(0x200)
5125         /* 50Gb link speed */
5126         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_50GB     \
5127                 UINT32_C(0x400)
5128         /* 100Gb link speed */
5129         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_100GB     \
5130                 UINT32_C(0x800)
5131         /* 10Mb link speed      (Half-duplex) */
5132         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_10MBHD   \
5133                 UINT32_C(0x1000)
5134         /* 10Mb link speed      (Full-duplex) */
5135         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_10MB     \
5136                 UINT32_C(0x2000)
5137         uint8_t wirespeed;
5138         /* Current setting for wirespeed. */
5139         /* Wirespeed feature is disabled. */
5140         #define HWRM_PORT_PHY_QCFG_OUTPUT_WIOUTPUTEED_OFF       UINT32_C(0x0)
5141         /* Wirespeed feature is enabled. */
5142         #define HWRM_PORT_PHY_QCFG_OUTPUT_WIOUTPUTEED_ON        UINT32_C(0x1)
5143         uint8_t lpbk;
5144         /* Current setting for loopback. */
5145         /* No loopback is selected. Normal operation. */
5146         #define HWRM_PORT_PHY_QCFG_OUTPUT_LPBK_NONE     UINT32_C(0x0)
5147         /*
5148          * The HW will be configured with local loopback
5149          * such that host data is sent back to the host
5150          * without modification.
5151          */
5152         #define HWRM_PORT_PHY_QCFG_OUTPUT_LPBK_LOCAL    UINT32_C(0x1)
5153         /*
5154          * The HW will be configured with remote
5155          * loopback such that port logic will send
5156          * packets back out the transmitter that are
5157          * received.
5158          */
5159         #define HWRM_PORT_PHY_QCFG_OUTPUT_LPBK_REMOTE   UINT32_C(0x2)
5160         uint8_t force_pause;
5161         /*
5162          * Current setting of forced pause. When the pause configuration
5163          * is not being forced, then this value shall be set to 0.
5164          */
5165         /*
5166          * When this bit is '1', Generation of tx pause messages is
5167          * supported. Disabled otherwise.
5168          */
5169         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_PAUSE_TX        UINT32_C(0x1)
5170         /*
5171          * When this bit is '1', Reception of rx pause messages is
5172          * supported. Disabled otherwise.
5173          */
5174         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_PAUSE_RX        UINT32_C(0x2)
5175         uint8_t module_status;
5176         /*
5177          * This value indicates the current status of the optics module
5178          * on this port.
5179          */
5180         /* Module is inserted and accepted */
5181         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_NONE    UINT32_C(0x0)
5182         /* Module is rejected and transmit side Laser is disabled. */
5183         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_DISABLETX UINT32_C(0x1)
5184         /* Module mismatch warning. */
5185         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_WARNINGMSG UINT32_C(0x2)
5186         /* Module is rejected and powered down. */
5187         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_PWRDOWN UINT32_C(0x3)
5188         /* Module is not inserted. */
5189         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_NOTINSERTED \
5190                 UINT32_C(0x4)
5191         /* Module status is not applicable. */
5192         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_NOTAPPLICABLE \
5193                 UINT32_C(0xff)
5194         uint32_t preemphasis;
5195         /* Current setting for preemphasis. */
5196         uint8_t phy_maj;
5197         /* This field represents the major version of the PHY. */
5198         uint8_t phy_min;
5199         /* This field represents the minor version of the PHY. */
5200         uint8_t phy_bld;
5201         /* This field represents the build version of the PHY. */
5202         uint8_t phy_type;
5203         /* This value represents a PHY type. */
5204         /* Unknown */
5205         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_UNKNOWN      UINT32_C(0x0)
5206         /* BASE-CR */
5207         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASECR       UINT32_C(0x1)
5208         /* BASE-KR4     (Deprecated) */
5209         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR4      UINT32_C(0x2)
5210         /* BASE-LR */
5211         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASELR       UINT32_C(0x3)
5212         /* BASE-SR */
5213         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASESR       UINT32_C(0x4)
5214         /* BASE-KR2     (Deprecated) */
5215         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR2      UINT32_C(0x5)
5216         /* BASE-KX */
5217         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKX       UINT32_C(0x6)
5218         /* BASE-KR */
5219         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR       UINT32_C(0x7)
5220         /* BASE-T */
5221         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASET        UINT32_C(0x8)
5222         /* EEE capable BASE-T */
5223         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASETE       UINT32_C(0x9)
5224         /* SGMII connected external PHY */
5225         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_SGMIIEXTPHY  UINT32_C(0xa)
5226         /* 25G_BASECR_CA_L */
5227         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_25G_BASECR_CA_L UINT32_C(0xb)
5228         /* 25G_BASECR_CA_S */
5229         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_25G_BASECR_CA_S UINT32_C(0xc)
5230         /* 25G_BASECR_CA_N */
5231         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_25G_BASECR_CA_N UINT32_C(0xd)
5232         /* 25G_BASESR */
5233         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_25G_BASESR   UINT32_C(0xe)
5234         /* 100G_BASECR4 */
5235         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASECR4 UINT32_C(0xf)
5236         /* 100G_BASESR4 */
5237         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASESR4 UINT32_C(0x10)
5238         /* 100G_BASELR4 */
5239         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASELR4 UINT32_C(0x11)
5240         /* 100G_BASEER4 */
5241         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASEER4 UINT32_C(0x12)
5242         /* 100G_BASESR10 */
5243         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASESR10 UINT32_C(0x13)
5244         /* 40G_BASECR4 */
5245         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_BASECR4  UINT32_C(0x14)
5246         /* 40G_BASESR4 */
5247         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_BASESR4  UINT32_C(0x15)
5248         /* 40G_BASELR4 */
5249         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_BASELR4  UINT32_C(0x16)
5250         /* 40G_BASEER4 */
5251         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_BASEER4  UINT32_C(0x17)
5252         /* 40G_ACTIVE_CABLE */
5253         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_ACTIVE_CABLE \
5254                 UINT32_C(0x18)
5255         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_1G_BASET UINT32_C(0x19)
5256         /* 1G_baseSX */
5257         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_1G_BASESX UINT32_C(0x1a)
5258         /* 1G_baseCX */
5259         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_1G_BASECX UINT32_C(0x1b)
5260         uint8_t media_type;
5261         /* This value represents a media type. */
5262         /* Unknown */
5263         #define HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_UNKNOWN    UINT32_C(0x0)
5264         /* Twisted Pair */
5265         #define HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_TP UINT32_C(0x1)
5266         /* Direct Attached Copper */
5267         #define HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_DAC        UINT32_C(0x2)
5268         /* Fiber */
5269         #define HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_FIBRE      UINT32_C(0x3)
5270         uint8_t xcvr_pkg_type;
5271         /* This value represents a transceiver type. */
5272         /* PHY and MAC are in the same package */
5273         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_PKG_TYPE_XCVR_INTERNAL \
5274                 UINT32_C(0x1)
5275         /* PHY and MAC are in different packages */
5276         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_PKG_TYPE_XCVR_EXTERNAL \
5277                 UINT32_C(0x2)
5278         uint8_t eee_config_phy_addr;
5279         /*
5280          * This field represents flags related to EEE configuration.
5281          * These EEE configuration flags are valid only when the
5282          * auto_mode is not set to none (in other words autonegotiation
5283          * is enabled).
5284          */
5285         /* This field represents PHY address. */
5286         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_ADDR_MASK UINT32_C(0x1f)
5287         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_ADDR_SFT  0
5288         /*
5289          * When set to 1, Energy Efficient Ethernet     (EEE) mode is
5290          * enabled. Speeds for autoneg with EEE mode enabled are based
5291          * on eee_link_speed_mask.
5292          */
5293         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_EEE_ENABLED UINT32_C(0x20)
5294         /*
5295          * This flag is valid only when eee_enabled is set to 1. # If
5296          * eee_enabled is set to 0, then EEE mode is disabled and this
5297          * flag shall be ignored. # If eee_enabled is set to 1 and this
5298          * flag is set to 1, then Energy Efficient Ethernet     (EEE) mode
5299          * is enabled and in use. # If eee_enabled is set to 1 and this
5300          * flag is set to 0, then Energy Efficient Ethernet     (EEE) mode
5301          * is enabled but is currently not in use.
5302          */
5303         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_EEE_ACTIVE UINT32_C(0x40)
5304         /*
5305          * This flag is valid only when eee_enabled is set to 1. # If
5306          * eee_enabled is set to 0, then EEE mode is disabled and this
5307          * flag shall be ignored. # If eee_enabled is set to 1 and this
5308          * flag is set to 1, then Energy Efficient Ethernet     (EEE) mode
5309          * is enabled and TX LPI is enabled. # If eee_enabled is set to
5310          * 1 and this flag is set to 0, then Energy Efficient Ethernet
5311          *      (EEE) mode is enabled but TX LPI is disabled.
5312          */
5313         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_EEE_TX_LPI UINT32_C(0x80)
5314         /*
5315          * This field represents flags related to EEE configuration.
5316          * These EEE configuration flags are valid only when the
5317          * auto_mode is not set to none (in other words autonegotiation
5318          * is enabled).
5319          */
5320         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_MASK       UINT32_C(0xe0)
5321         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_SFT        5
5322         uint8_t parallel_detect;
5323         /* Reserved field, set to 0 */
5324         /*
5325          * When set to 1, the parallel detection is used to determine
5326          * the speed of the link partner. Parallel detection is used
5327          * when a autonegotiation capable device is connected to a link
5328          * parter that is not capable of autonegotiation.
5329          */
5330         #define HWRM_PORT_PHY_QCFG_OUTPUT_PARALLEL_DETECT       UINT32_C(0x1)
5331         /* Reserved field, set to 0 */
5332         #define HWRM_PORT_PHY_QCFG_OUTPUT_RESERVED_MASK UINT32_C(0xfe)
5333         #define HWRM_PORT_PHY_QCFG_OUTPUT_RESERVED_SFT  1
5334         uint16_t link_partner_adv_speeds;
5335         /*
5336          * The advertised speeds for the port by the link partner. Each
5337          * advertised speed will be set to '1'.
5338          */
5339         /* 100Mb link speed     (Half-duplex) */
5340         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_100MBHD \
5341                 UINT32_C(0x1)
5342         /* 100Mb link speed     (Full-duplex) */
5343         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_100MB   \
5344                 UINT32_C(0x2)
5345         /* 1Gb link speed       (Half-duplex) */
5346         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_1GBHD   \
5347                 UINT32_C(0x4)
5348         /* 1Gb link speed       (Full-duplex) */
5349         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_1GB   \
5350                 UINT32_C(0x8)
5351         /* 2Gb link speed */
5352         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_2GB   \
5353                 UINT32_C(0x10)
5354         /* 2.5Gb link speed */
5355         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_2_5GB   \
5356                 UINT32_C(0x20)
5357         /* 10Gb link speed */
5358         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_10GB  \
5359                 UINT32_C(0x40)
5360         /* 20Gb link speed */
5361         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_20GB  \
5362                 UINT32_C(0x80)
5363         /* 25Gb link speed */
5364         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_25GB  \
5365                 UINT32_C(0x100)
5366         /* 40Gb link speed */
5367         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_40GB  \
5368                 UINT32_C(0x200)
5369         /* 50Gb link speed */
5370         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_50GB  \
5371                 UINT32_C(0x400)
5372         /* 100Gb link speed */
5373         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_100GB   \
5374                 UINT32_C(0x800)
5375         /* 10Mb link speed      (Half-duplex) */
5376         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_10MBHD  \
5377                 UINT32_C(0x1000)
5378         /* 10Mb link speed      (Full-duplex) */
5379         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_10MB  \
5380                 UINT32_C(0x2000)
5381         uint8_t link_partner_adv_auto_mode;
5382         /*
5383          * The advertised autoneg for the port by the link partner. This
5384          * field is deprecated and should be set to 0.
5385          */
5386         /*
5387          * Disable autoneg or autoneg disabled. No
5388          * speeds are selected.
5389          */
5390         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_NONE \
5391                 UINT32_C(0x0)
5392         /* Select all possible speeds for autoneg mode. */
5393         #define \
5394         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_ALL_SPEEDS \
5395                 UINT32_C(0x1)
5396         /*
5397          * Select only the auto_link_speed speed for
5398          * autoneg mode. This mode has been DEPRECATED.
5399          * An HWRM client should not use this mode.
5400          */
5401         #define \
5402         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_ONE_SPEED \
5403                 UINT32_C(0x2)
5404         /*
5405          * Select the auto_link_speed or any speed below
5406          * that speed for autoneg. This mode has been
5407          * DEPRECATED. An HWRM client should not use
5408          * this mode.
5409          */
5410         #define \
5411         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_ONE_OR_BELOW \
5412                 UINT32_C(0x3)
5413         /*
5414          * Select the speeds based on the corresponding
5415          * link speed mask value that is provided.
5416          */
5417         #define \
5418         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_SPEED_MASK \
5419                 UINT32_C(0x4)
5420         uint8_t link_partner_adv_pause;
5421         /* The advertised pause settings on the port by the link partner. */
5422         /*
5423          * When this bit is '1', Generation of tx pause messages is
5424          * supported. Disabled otherwise.
5425          */
5426         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_PAUSE_TX     \
5427                 UINT32_C(0x1)
5428         /*
5429          * When this bit is '1', Reception of rx pause messages is
5430          * supported. Disabled otherwise.
5431          */
5432         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_PAUSE_RX     \
5433                 UINT32_C(0x2)
5434         uint16_t adv_eee_link_speed_mask;
5435         /*
5436          * Current setting for link speed mask that is used to advertise
5437          * speeds during autonegotiation when EEE is enabled. This field
5438          * is valid only when eee_enabled flags is set to 1. The speeds
5439          * specified in this field shall be a subset of speeds specified
5440          * in auto_link_speed_mask.
5441          */
5442         /* Reserved */
5443         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_RSVD1   \
5444                 UINT32_C(0x1)
5445         /* 100Mb link speed     (Full-duplex) */
5446         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_100MB   \
5447                 UINT32_C(0x2)
5448         /* Reserved */
5449         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_RSVD2   \
5450                 UINT32_C(0x4)
5451         /* 1Gb link speed       (Full-duplex) */
5452         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_1GB   \
5453                 UINT32_C(0x8)
5454         /* Reserved */
5455         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_RSVD3   \
5456                 UINT32_C(0x10)
5457         /* Reserved */
5458         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_RSVD4   \
5459                 UINT32_C(0x20)
5460         /* 10Gb link speed */
5461         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_10GB  \
5462                 UINT32_C(0x40)
5463         uint16_t link_partner_adv_eee_link_speed_mask;
5464         /*
5465          * Current setting for link speed mask that is advertised by the
5466          * link partner when EEE is enabled. This field is valid only
5467          * when eee_enabled flags is set to 1.
5468          */
5469         /* Reserved */
5470         #define \
5471         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_RSVD1 \
5472                 UINT32_C(0x1)
5473         /* 100Mb link speed     (Full-duplex) */
5474         #define \
5475         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_100MB \
5476                 UINT32_C(0x2)
5477         /* Reserved */
5478         #define \
5479         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_RSVD2 \
5480                 UINT32_C(0x4)
5481         /* 1Gb link speed       (Full-duplex) */
5482         #define \
5483         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_1GB \
5484                 UINT32_C(0x8)
5485         /* Reserved */
5486         #define \
5487         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_RSVD3 \
5488                 UINT32_C(0x10)
5489         /* Reserved */
5490         #define \
5491         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_RSVD4 \
5492                 UINT32_C(0x20)
5493         /* 10Gb link speed */
5494         #define \
5495         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_10GB \
5496                 UINT32_C(0x40)
5497         uint32_t xcvr_identifier_type_tx_lpi_timer;
5498         /* This value represents transceiver identifier type. */
5499         /*
5500          * Current setting of TX LPI timer in microseconds. This field
5501          * is valid only when_eee_enabled flag is set to 1 and
5502          * tx_lpi_enabled is set to 1.
5503          */
5504         #define HWRM_PORT_PHY_QCFG_OUTPUT_TX_LPI_TIMER_MASK UINT32_C(0xffffff)
5505         #define HWRM_PORT_PHY_QCFG_OUTPUT_TX_LPI_TIMER_SFT      0
5506         /* This value represents transceiver identifier type. */
5507         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_MASK     \
5508                 UINT32_C(0xff000000)
5509         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_SFT      24
5510         /* Unknown */
5511         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_UNKNOWN \
5512                 (UINT32_C(0x0) << 24)
5513         /* SFP/SFP+/SFP28 */
5514         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_SFP \
5515                 (UINT32_C(0x3) << 24)
5516         /* QSFP */
5517         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFP \
5518                 (UINT32_C(0xc) << 24)
5519         /* QSFP+ */
5520         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFPPLUS \
5521                 (UINT32_C(0xd) << 24)
5522         /* QSFP28 */
5523         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFP28 \
5524                 (UINT32_C(0x11) << 24)
5525         uint16_t fec_cfg;
5526         /*
5527          * This value represents the current configuration of Forward
5528          * Error Correction     (FEC) on the port.
5529          */
5530         /*
5531          * When set to 1, then FEC is not supported on this port. If
5532          * this flag is set to 1, then all other FEC configuration flags
5533          * shall be ignored. When set to 0, then FEC is supported as
5534          * indicated by other configuration flags. If no cable is
5535          * attached and the HWRM does not yet know the FEC capability,
5536          * then the HWRM shall set this flag to 1 when reporting FEC
5537          * capability.
5538          */
5539         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_NONE_SUPPORTED     \
5540                 UINT32_C(0x1)
5541         /*
5542          * When set to 1, then FEC autonegotiation is supported on this
5543          * port. When set to 0, then FEC autonegotiation is not
5544          * supported on this port.
5545          */
5546         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_AUTONEG_SUPPORTED   \
5547                 UINT32_C(0x2)
5548         /*
5549          * When set to 1, then FEC autonegotiation is enabled on this
5550          * port. When set to 0, then FEC autonegotiation is disabled if
5551          * supported. This flag should be ignored if FEC autonegotiation
5552          * is not supported on this port.
5553          */
5554         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_AUTONEG_ENABLED   \
5555                 UINT32_C(0x4)
5556         /*
5557          * When set to 1, then FEC CLAUSE 74    (Fire Code) is supported on
5558          * this port. When set to 0, then FEC CLAUSE 74 (Fire Code) is
5559          * not supported on this port.
5560          */
5561         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_CLAUSE74_SUPPORTED  \
5562                 UINT32_C(0x8)
5563         /*
5564          * When set to 1, then FEC CLAUSE 74    (Fire Code) is enabled on
5565          * this port. When set to 0, then FEC CLAUSE 74 (Fire Code) is
5566          * disabled if supported. This flag should be ignored if FEC
5567          * CLAUSE 74 is not supported on this port.
5568          */
5569         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_CLAUSE74_ENABLED  \
5570                 UINT32_C(0x10)
5571         /*
5572          * When set to 1, then FEC CLAUSE 91    (Reed Solomon) is supported
5573          * on this port. When set to 0, then FEC CLAUSE 91      (Reed
5574          * Solomon) is not supported on this port.
5575          */
5576         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_CLAUSE91_SUPPORTED  \
5577                 UINT32_C(0x20)
5578         /*
5579          * When set to 1, then FEC CLAUSE 91    (Reed Solomon) is enabled
5580          * on this port. When set to 0, then FEC CLAUSE 91      (Reed
5581          * Solomon) is disabled if supported. This flag should be
5582          * ignored if FEC CLAUSE 91 is not supported on this port.
5583          */
5584         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_CLAUSE91_ENABLED  \
5585                 UINT32_C(0x40)
5586         uint8_t duplex_state;
5587         /*
5588          * This value is indicates the duplex of the current connection
5589          * state.
5590          */
5591         /* Half Duplex connection. */
5592         #define HWRM_PORT_PHY_QCFG_OUTPUT_DUPLEX_STATE_HALF UINT32_C(0x0)
5593         /* Full duplex connection. */
5594         #define HWRM_PORT_PHY_QCFG_OUTPUT_DUPLEX_STATE_FULL UINT32_C(0x1)
5595         uint8_t unused_1;
5596         char phy_vendor_name[16];
5597         /*
5598          * Up to 16 bytes of null padded ASCII string representing PHY
5599          * vendor. If the string is set to null, then the vendor name is
5600          * not available.
5601          */
5602         char phy_vendor_partnumber[16];
5603         /*
5604          * Up to 16 bytes of null padded ASCII string that identifies
5605          * vendor specific part number of the PHY. If the string is set
5606          * to null, then the vendor specific part number is not
5607          * available.
5608          */
5609         uint32_t unused_2;
5610         uint8_t unused_3;
5611         uint8_t unused_4;
5612         uint8_t unused_5;
5613         uint8_t valid;
5614         /*
5615          * This field is used in Output records to indicate that the
5616          * output is completely written to RAM. This field should be
5617          * read as '1' to indicate that the output has been completely
5618          * written. When writing a command completion or response to an
5619          * internal processor, the order of writes has to be such that
5620          * this field is written last.
5621          */
5622 } __attribute__((packed));
5623
5624 /* hwrm_port_qstats */
5625 /* Description: This function returns per port Ethernet statistics. */
5626 /* Input        (40 bytes) */
5627 struct hwrm_port_qstats_input {
5628         uint16_t req_type;
5629         /*
5630          * This value indicates what type of request this is. The format
5631          * for the rest of the command is determined by this field.
5632          */
5633         uint16_t cmpl_ring;
5634         /*
5635          * This value indicates the what completion ring the request
5636          * will be optionally completed on. If the value is -1, then no
5637          * CR completion will be generated. Any other value must be a
5638          * valid CR ring_id value for this function.
5639          */
5640         uint16_t seq_id;
5641         /* This value indicates the command sequence number. */
5642         uint16_t target_id;
5643         /*
5644          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
5645          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
5646          * - HWRM
5647          */
5648         uint64_t resp_addr;
5649         /*
5650          * This is the host address where the response will be written
5651          * when the request is complete. This area must be 16B aligned
5652          * and must be cleared to zero before the request is made.
5653          */
5654         uint16_t port_id;
5655         /* Port ID of port that is being queried. */
5656         uint8_t unused_0;
5657         uint8_t unused_1;
5658         uint8_t unused_2[3];
5659         uint8_t unused_3;
5660         uint64_t tx_stat_host_addr;
5661         /* This is the host address where Tx port statistics will be stored */
5662         uint64_t rx_stat_host_addr;
5663         /* This is the host address where Rx port statistics will be stored */
5664 } __attribute__((packed));
5665
5666 /* Output       (16 bytes) */
5667 struct hwrm_port_qstats_output {
5668         uint16_t error_code;
5669         /*
5670          * Pass/Fail or error type Note: receiver to verify the in
5671          * parameters, and fail the call with an error when appropriate
5672          */
5673         uint16_t req_type;
5674         /* This field returns the type of original request. */
5675         uint16_t seq_id;
5676         /* This field provides original sequence number of the command. */
5677         uint16_t resp_len;
5678         /*
5679          * This field is the length of the response in bytes. The last
5680          * byte of the response is a valid flag that will read as '1'
5681          * when the command has been completely written to memory.
5682          */
5683         uint16_t tx_stat_size;
5684         /* The size of TX port statistics block in bytes. */
5685         uint16_t rx_stat_size;
5686         /* The size of RX port statistics block in bytes. */
5687         uint8_t unused_0;
5688         uint8_t unused_1;
5689         uint8_t unused_2;
5690         uint8_t valid;
5691         /*
5692          * This field is used in Output records to indicate that the
5693          * output is completely written to RAM. This field should be
5694          * read as '1' to indicate that the output has been completely
5695          * written. When writing a command completion or response to an
5696          * internal processor, the order of writes has to be such that
5697          * this field is written last.
5698          */
5699 } __attribute__((packed));
5700
5701 /* hwrm_port_clr_stats */
5702 /*
5703  * Description: This function clears per port statistics. The HWRM shall not
5704  * allow a VF driver to clear port statistics. The HWRM shall not allow a PF
5705  * driver to clear port statistics in a partitioning mode. The HWRM may allow a
5706  * PF driver to clear port statistics in the non-partitioning mode.
5707  */
5708 /* Input        (24 bytes) */
5709 struct hwrm_port_clr_stats_input {
5710         uint16_t req_type;
5711         /*
5712          * This value indicates what type of request this is. The format
5713          * for the rest of the command is determined by this field.
5714          */
5715         uint16_t cmpl_ring;
5716         /*
5717          * This value indicates the what completion ring the request
5718          * will be optionally completed on. If the value is -1, then no
5719          * CR completion will be generated. Any other value must be a
5720          * valid CR ring_id value for this function.
5721          */
5722         uint16_t seq_id;
5723         /* This value indicates the command sequence number. */
5724         uint16_t target_id;
5725         /*
5726          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
5727          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
5728          * - HWRM
5729          */
5730         uint64_t resp_addr;
5731         /*
5732          * This is the host address where the response will be written
5733          * when the request is complete. This area must be 16B aligned
5734          * and must be cleared to zero before the request is made.
5735          */
5736         uint16_t port_id;
5737         /* Port ID of port that is being queried. */
5738         uint16_t unused_0[3];
5739 } __attribute__((packed));
5740
5741 /* Output       (16 bytes) */
5742 struct hwrm_port_clr_stats_output {
5743         uint16_t error_code;
5744         /*
5745          * Pass/Fail or error type Note: receiver to verify the in
5746          * parameters, and fail the call with an error when appropriate
5747          */
5748         uint16_t req_type;
5749         /* This field returns the type of original request. */
5750         uint16_t seq_id;
5751         /* This field provides original sequence number of the command. */
5752         uint16_t resp_len;
5753         /*
5754          * This field is the length of the response in bytes. The last
5755          * byte of the response is a valid flag that will read as '1'
5756          * when the command has been completely written to memory.
5757          */
5758         uint32_t unused_0;
5759         uint8_t unused_1;
5760         uint8_t unused_2;
5761         uint8_t unused_3;
5762         uint8_t valid;
5763         /*
5764          * This field is used in Output records to indicate that the
5765          * output is completely written to RAM. This field should be
5766          * read as '1' to indicate that the output has been completely
5767          * written. When writing a command completion or response to an
5768          * internal processor, the order of writes has to be such that
5769          * this field is written last.
5770          */
5771 } __attribute__((packed));
5772
5773 /* hwrm_port_led_cfg */
5774 /*
5775  * Description: This function is used to configure LEDs on a given port. Each
5776  * port has individual set of LEDs associated with it. These LEDs are used for
5777  * speed/link configuration as well as activity indicator configuration. Up to
5778  * three LEDs can be configured, one for activity and two for speeds.
5779  */
5780 /* Input        (64 bytes) */
5781 struct hwrm_port_led_cfg_input {
5782         uint16_t req_type;
5783         /*
5784          * This value indicates what type of request this is. The format
5785          * for the rest of the command is determined by this field.
5786          */
5787         uint16_t cmpl_ring;
5788         /*
5789          * This value indicates the what completion ring the request
5790          * will be optionally completed on. If the value is -1, then no
5791          * CR completion will be generated. Any other value must be a
5792          * valid CR ring_id value for this function.
5793          */
5794         uint16_t seq_id;
5795         /* This value indicates the command sequence number. */
5796         uint16_t target_id;
5797         /*
5798          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
5799          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
5800          * - HWRM
5801          */
5802         uint64_t resp_addr;
5803         /*
5804          * This is the host address where the response will be written
5805          * when the request is complete. This area must be 16B aligned
5806          * and must be cleared to zero before the request is made.
5807          */
5808         uint32_t enables;
5809         /* This bit must be '1' for the led0_id field to be configured. */
5810         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_ID UINT32_C(0x1)
5811         /* This bit must be '1' for the led0_state field to be configured. */
5812         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_STATE      UINT32_C(0x2)
5813         /* This bit must be '1' for the led0_color field to be configured. */
5814         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_COLOR      UINT32_C(0x4)
5815         /*
5816          * This bit must be '1' for the led0_blink_on field to be
5817          * configured.
5818          */
5819         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_BLINK_ON   UINT32_C(0x8)
5820         /*
5821          * This bit must be '1' for the led0_blink_off field to be
5822          * configured.
5823          */
5824         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_BLINK_OFF UINT32_C(0x10)
5825         /*
5826          * This bit must be '1' for the led0_group_id field to be
5827          * configured.
5828          */
5829         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_GROUP_ID UINT32_C(0x20)
5830         /* This bit must be '1' for the led1_id field to be configured. */
5831         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED1_ID UINT32_C(0x40)
5832         /* This bit must be '1' for the led1_state field to be configured. */
5833         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED1_STATE      UINT32_C(0x80)
5834         /* This bit must be '1' for the led1_color field to be configured. */
5835         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED1_COLOR      UINT32_C(0x100)
5836         /*
5837          * This bit must be '1' for the led1_blink_on field to be
5838          * configured.
5839          */
5840         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED1_BLINK_ON UINT32_C(0x200)
5841         /*
5842          * This bit must be '1' for the led1_blink_off field to be
5843          * configured.
5844          */
5845         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED1_BLINK_OFF UINT32_C(0x400)
5846         /*
5847          * This bit must be '1' for the led1_group_id field to be
5848          * configured.
5849          */
5850         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED1_GROUP_ID UINT32_C(0x800)
5851         /* This bit must be '1' for the led2_id field to be configured. */
5852         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED2_ID UINT32_C(0x1000)
5853         /* This bit must be '1' for the led2_state field to be configured. */
5854         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED2_STATE      UINT32_C(0x2000)
5855         /* This bit must be '1' for the led2_color field to be configured. */
5856         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED2_COLOR      UINT32_C(0x4000)
5857         /*
5858          * This bit must be '1' for the led2_blink_on field to be
5859          * configured.
5860          */
5861         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED2_BLINK_ON UINT32_C(0x8000)
5862         /*
5863          * This bit must be '1' for the led2_blink_off field to be
5864          * configured.
5865          */
5866         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED2_BLINK_OFF UINT32_C(0x10000)
5867         /*
5868          * This bit must be '1' for the led2_group_id field to be
5869          * configured.
5870          */
5871         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED2_GROUP_ID UINT32_C(0x20000)
5872         /* This bit must be '1' for the led3_id field to be configured. */
5873         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED3_ID UINT32_C(0x40000)
5874         /* This bit must be '1' for the led3_state field to be configured. */
5875         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED3_STATE  UINT32_C(0x80000)
5876         /* This bit must be '1' for the led3_color field to be configured. */
5877         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED3_COLOR  UINT32_C(0x100000)
5878         /*
5879          * This bit must be '1' for the led3_blink_on field to be
5880          * configured.
5881          */
5882         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED3_BLINK_ON UINT32_C(0x200000)
5883         /*
5884          * This bit must be '1' for the led3_blink_off field to be
5885          * configured.
5886          */
5887         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED3_BLINK_OFF  \
5888                 UINT32_C(0x400000)
5889         /*
5890          * This bit must be '1' for the led3_group_id field to be
5891          * configured.
5892          */
5893         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED3_GROUP_ID UINT32_C(0x800000)
5894         uint16_t port_id;
5895         /* Port ID of port whose LEDs are configured. */
5896         uint8_t num_leds;
5897         /*
5898          * The number of LEDs that are being configured. Up to 4 LEDs
5899          * can be configured with this command.
5900          */
5901         uint8_t rsvd;
5902         /* Reserved field. */
5903         uint8_t led0_id;
5904         /* An identifier for the LED #0. */
5905         uint8_t led0_state;
5906         /* The requested state of the LED #0. */
5907         /* Default state of the LED */
5908         #define HWRM_PORT_LED_CFG_INPUT_LED0_STATE_DEFAULT      UINT32_C(0x0)
5909         /* Off */
5910         #define HWRM_PORT_LED_CFG_INPUT_LED0_STATE_OFF  UINT32_C(0x1)
5911         /* On */
5912         #define HWRM_PORT_LED_CFG_INPUT_LED0_STATE_ON   UINT32_C(0x2)
5913         /* Blink */
5914         #define HWRM_PORT_LED_CFG_INPUT_LED0_STATE_BLINK        UINT32_C(0x3)
5915         /* Blink Alternately */
5916         #define HWRM_PORT_LED_CFG_INPUT_LED0_STATE_BLINKALT     UINT32_C(0x4)
5917         uint8_t led0_color;
5918         /* The requested color of LED #0. */
5919         /* Default */
5920         #define HWRM_PORT_LED_CFG_INPUT_LED0_COLOR_DEFAULT      UINT32_C(0x0)
5921         /* Amber */
5922         #define HWRM_PORT_LED_CFG_INPUT_LED0_COLOR_AMBER        UINT32_C(0x1)
5923         /* Green */
5924         #define HWRM_PORT_LED_CFG_INPUT_LED0_COLOR_GREEN        UINT32_C(0x2)
5925         /* Green or Amber */
5926         #define HWRM_PORT_LED_CFG_INPUT_LED0_COLOR_GREENAMBER   UINT32_C(0x3)
5927         uint8_t unused_0;
5928         uint16_t led0_blink_on;
5929         /*
5930          * If the LED #0 state is "blink" or "blinkalt", then this field
5931          * represents the requested time in milliseconds to keep LED on
5932          * between cycles.
5933          */
5934         uint16_t led0_blink_off;
5935         /*
5936          * If the LED #0 state is "blink" or "blinkalt", then this field
5937          * represents the requested time in milliseconds to keep LED off
5938          * between cycles.
5939          */
5940         uint8_t led0_group_id;
5941         /*
5942          * An identifier for the group of LEDs that LED #0 belongs to.
5943          * If set to 0, then the LED #0 shall not be grouped and shall
5944          * be treated as an individual resource. For all other non-zero
5945          * values of this field, LED #0 shall be grouped together with
5946          * the LEDs with the same group ID value.
5947          */
5948         uint8_t rsvd0;
5949         /* Reserved field. */
5950         uint8_t led1_id;
5951         /* An identifier for the LED #1. */
5952         uint8_t led1_state;
5953         /* The requested state of the LED #1. */
5954         /* Default state of the LED */
5955         #define HWRM_PORT_LED_CFG_INPUT_LED1_STATE_DEFAULT      UINT32_C(0x0)
5956         /* Off */
5957         #define HWRM_PORT_LED_CFG_INPUT_LED1_STATE_OFF  UINT32_C(0x1)
5958         /* On */
5959         #define HWRM_PORT_LED_CFG_INPUT_LED1_STATE_ON   UINT32_C(0x2)
5960         /* Blink */
5961         #define HWRM_PORT_LED_CFG_INPUT_LED1_STATE_BLINK        UINT32_C(0x3)
5962         /* Blink Alternately */
5963         #define HWRM_PORT_LED_CFG_INPUT_LED1_STATE_BLINKALT     UINT32_C(0x4)
5964         uint8_t led1_color;
5965         /* The requested color of LED #1. */
5966         /* Default */
5967         #define HWRM_PORT_LED_CFG_INPUT_LED1_COLOR_DEFAULT      UINT32_C(0x0)
5968         /* Amber */
5969         #define HWRM_PORT_LED_CFG_INPUT_LED1_COLOR_AMBER        UINT32_C(0x1)
5970         /* Green */
5971         #define HWRM_PORT_LED_CFG_INPUT_LED1_COLOR_GREEN        UINT32_C(0x2)
5972         /* Green or Amber */
5973         #define HWRM_PORT_LED_CFG_INPUT_LED1_COLOR_GREENAMBER   UINT32_C(0x3)
5974         uint8_t unused_1;
5975         uint16_t led1_blink_on;
5976         /*
5977          * If the LED #1 state is "blink" or "blinkalt", then this field
5978          * represents the requested time in milliseconds to keep LED on
5979          * between cycles.
5980          */
5981         uint16_t led1_blink_off;
5982         /*
5983          * If the LED #1 state is "blink" or "blinkalt", then this field
5984          * represents the requested time in milliseconds to keep LED off
5985          * between cycles.
5986          */
5987         uint8_t led1_group_id;
5988         /*
5989          * An identifier for the group of LEDs that LED #1 belongs to.
5990          * If set to 0, then the LED #1 shall not be grouped and shall
5991          * be treated as an individual resource. For all other non-zero
5992          * values of this field, LED #1 shall be grouped together with
5993          * the LEDs with the same group ID value.
5994          */
5995         uint8_t rsvd1;
5996         /* Reserved field. */
5997         uint8_t led2_id;
5998         /* An identifier for the LED #2. */
5999         uint8_t led2_state;
6000         /* The requested state of the LED #2. */
6001         /* Default state of the LED */
6002         #define HWRM_PORT_LED_CFG_INPUT_LED2_STATE_DEFAULT      UINT32_C(0x0)
6003         /* Off */
6004         #define HWRM_PORT_LED_CFG_INPUT_LED2_STATE_OFF  UINT32_C(0x1)
6005         /* On */
6006         #define HWRM_PORT_LED_CFG_INPUT_LED2_STATE_ON   UINT32_C(0x2)
6007         /* Blink */
6008         #define HWRM_PORT_LED_CFG_INPUT_LED2_STATE_BLINK        UINT32_C(0x3)
6009         /* Blink Alternately */
6010         #define HWRM_PORT_LED_CFG_INPUT_LED2_STATE_BLINKALT     UINT32_C(0x4)
6011         uint8_t led2_color;
6012         /* The requested color of LED #2. */
6013         /* Default */
6014         #define HWRM_PORT_LED_CFG_INPUT_LED2_COLOR_DEFAULT      UINT32_C(0x0)
6015         /* Amber */
6016         #define HWRM_PORT_LED_CFG_INPUT_LED2_COLOR_AMBER        UINT32_C(0x1)
6017         /* Green */
6018         #define HWRM_PORT_LED_CFG_INPUT_LED2_COLOR_GREEN        UINT32_C(0x2)
6019         /* Green or Amber */
6020         #define HWRM_PORT_LED_CFG_INPUT_LED2_COLOR_GREENAMBER   UINT32_C(0x3)
6021         uint8_t unused_2;
6022         uint16_t led2_blink_on;
6023         /*
6024          * If the LED #2 state is "blink" or "blinkalt", then this field
6025          * represents the requested time in milliseconds to keep LED on
6026          * between cycles.
6027          */
6028         uint16_t led2_blink_off;
6029         /*
6030          * If the LED #2 state is "blink" or "blinkalt", then this field
6031          * represents the requested time in milliseconds to keep LED off
6032          * between cycles.
6033          */
6034         uint8_t led2_group_id;
6035         /*
6036          * An identifier for the group of LEDs that LED #2 belongs to.
6037          * If set to 0, then the LED #2 shall not be grouped and shall
6038          * be treated as an individual resource. For all other non-zero
6039          * values of this field, LED #2 shall be grouped together with
6040          * the LEDs with the same group ID value.
6041          */
6042         uint8_t rsvd2;
6043         /* Reserved field. */
6044         uint8_t led3_id;
6045         /* An identifier for the LED #3. */
6046         uint8_t led3_state;
6047         /* The requested state of the LED #3. */
6048         /* Default state of the LED */
6049         #define HWRM_PORT_LED_CFG_INPUT_LED3_STATE_DEFAULT      UINT32_C(0x0)
6050         /* Off */
6051         #define HWRM_PORT_LED_CFG_INPUT_LED3_STATE_OFF  UINT32_C(0x1)
6052         /* On */
6053         #define HWRM_PORT_LED_CFG_INPUT_LED3_STATE_ON   UINT32_C(0x2)
6054         /* Blink */
6055         #define HWRM_PORT_LED_CFG_INPUT_LED3_STATE_BLINK        UINT32_C(0x3)
6056         /* Blink Alternately */
6057         #define HWRM_PORT_LED_CFG_INPUT_LED3_STATE_BLINKALT     UINT32_C(0x4)
6058         uint8_t led3_color;
6059         /* The requested color of LED #3. */
6060         /* Default */
6061         #define HWRM_PORT_LED_CFG_INPUT_LED3_COLOR_DEFAULT      UINT32_C(0x0)
6062         /* Amber */
6063         #define HWRM_PORT_LED_CFG_INPUT_LED3_COLOR_AMBER        UINT32_C(0x1)
6064         /* Green */
6065         #define HWRM_PORT_LED_CFG_INPUT_LED3_COLOR_GREEN        UINT32_C(0x2)
6066         /* Green or Amber */
6067         #define HWRM_PORT_LED_CFG_INPUT_LED3_COLOR_GREENAMBER   UINT32_C(0x3)
6068         uint8_t unused_3;
6069         uint16_t led3_blink_on;
6070         /*
6071          * If the LED #3 state is "blink" or "blinkalt", then this field
6072          * represents the requested time in milliseconds to keep LED on
6073          * between cycles.
6074          */
6075         uint16_t led3_blink_off;
6076         /*
6077          * If the LED #3 state is "blink" or "blinkalt", then this field
6078          * represents the requested time in milliseconds to keep LED off
6079          * between cycles.
6080          */
6081         uint8_t led3_group_id;
6082         /*
6083          * An identifier for the group of LEDs that LED #3 belongs to.
6084          * If set to 0, then the LED #3 shall not be grouped and shall
6085          * be treated as an individual resource. For all other non-zero
6086          * values of this field, LED #3 shall be grouped together with
6087          * the LEDs with the same group ID value.
6088          */
6089         uint8_t rsvd3;
6090         /* Reserved field. */
6091 } __attribute__((packed));
6092
6093 /* Output       (16 bytes) */
6094 struct hwrm_port_led_cfg_output {
6095         uint16_t error_code;
6096         /*
6097          * Pass/Fail or error type Note: receiver to verify the in
6098          * parameters, and fail the call with an error when appropriate
6099          */
6100         uint16_t req_type;
6101         /* This field returns the type of original request. */
6102         uint16_t seq_id;
6103         /* This field provides original sequence number of the command. */
6104         uint16_t resp_len;
6105         /*
6106          * This field is the length of the response in bytes. The last
6107          * byte of the response is a valid flag that will read as '1'
6108          * when the command has been completely written to memory.
6109          */
6110         uint32_t unused_0;
6111         uint8_t unused_1;
6112         uint8_t unused_2;
6113         uint8_t unused_3;
6114         uint8_t valid;
6115         /*
6116          * This field is used in Output records to indicate that the
6117          * output is completely written to RAM. This field should be
6118          * read as '1' to indicate that the output has been completely
6119          * written. When writing a command completion or response to an
6120          * internal processor, the order of writes has to be such that
6121          * this field is written last.
6122          */
6123 } __attribute__((packed));
6124
6125 /* hwrm_port_led_qcfg */
6126 /*
6127  * Description: This function is used to query configuration of LEDs on a given
6128  * port. Each port has individual set of LEDs associated with it. These LEDs are
6129  * used for speed/link configuration as well as activity indicator
6130  * configuration. Up to three LEDs can be configured, one for activity and two
6131  * for speeds.
6132  */
6133 /* Input        (24 bytes) */
6134 struct hwrm_port_led_qcfg_input {
6135         uint16_t req_type;
6136         /*
6137          * This value indicates what type of request this is. The format
6138          * for the rest of the command is determined by this field.
6139          */
6140         uint16_t cmpl_ring;
6141         /*
6142          * This value indicates the what completion ring the request
6143          * will be optionally completed on. If the value is -1, then no
6144          * CR completion will be generated. Any other value must be a
6145          * valid CR ring_id value for this function.
6146          */
6147         uint16_t seq_id;
6148         /* This value indicates the command sequence number. */
6149         uint16_t target_id;
6150         /*
6151          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
6152          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
6153          * - HWRM
6154          */
6155         uint64_t resp_addr;
6156         /*
6157          * This is the host address where the response will be written
6158          * when the request is complete. This area must be 16B aligned
6159          * and must be cleared to zero before the request is made.
6160          */
6161         uint16_t port_id;
6162         /* Port ID of port whose LED configuration is being queried. */
6163         uint16_t unused_0[3];
6164 } __attribute__((packed));
6165
6166 /* Output       (56 bytes) */
6167 struct hwrm_port_led_qcfg_output {
6168         uint16_t error_code;
6169         /*
6170          * Pass/Fail or error type Note: receiver to verify the in
6171          * parameters, and fail the call with an error when appropriate
6172          */
6173         uint16_t req_type;
6174         /* This field returns the type of original request. */
6175         uint16_t seq_id;
6176         /* This field provides original sequence number of the command. */
6177         uint16_t resp_len;
6178         /*
6179          * This field is the length of the response in bytes. The last
6180          * byte of the response is a valid flag that will read as '1'
6181          * when the command has been completely written to memory.
6182          */
6183         uint8_t num_leds;
6184         /*
6185          * The number of LEDs that are configured on this port. Up to 4
6186          * LEDs can be returned in the response.
6187          */
6188         uint8_t led0_id;
6189         /* An identifier for the LED #0. */
6190         uint8_t led0_type;
6191         /* The type of LED #0. */
6192         /* Speed LED */
6193         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_TYPE_SPEED       UINT32_C(0x0)
6194         /* Activity LED */
6195         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_TYPE_ACTIVITY    UINT32_C(0x1)
6196         /* Invalid */
6197         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_TYPE_INVALID     UINT32_C(0xff)
6198         uint8_t led0_state;
6199         /* The current state of the LED #0. */
6200         /* Default state of the LED */
6201         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_STATE_DEFAULT    UINT32_C(0x0)
6202         /* Off */
6203         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_STATE_OFF        UINT32_C(0x1)
6204         /* On */
6205         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_STATE_ON UINT32_C(0x2)
6206         /* Blink */
6207         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_STATE_BLINK      UINT32_C(0x3)
6208         /* Blink Alternately */
6209         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_STATE_BLINKALT   UINT32_C(0x4)
6210         uint8_t led0_color;
6211         /* The color of LED #0. */
6212         /* Default */
6213         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_COLOR_DEFAULT    UINT32_C(0x0)
6214         /* Amber */
6215         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_COLOR_AMBER      UINT32_C(0x1)
6216         /* Green */
6217         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_COLOR_GREEN      UINT32_C(0x2)
6218         /* Green or Amber */
6219         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_COLOR_GREENAMBER UINT32_C(0x3)
6220         uint8_t unused_0;
6221         uint16_t led0_blink_on;
6222         /*
6223          * If the LED #0 state is "blink" or "blinkalt", then this field
6224          * represents the requested time in milliseconds to keep LED on
6225          * between cycles.
6226          */
6227         uint16_t led0_blink_off;
6228         /*
6229          * If the LED #0 state is "blink" or "blinkalt", then this field
6230          * represents the requested time in milliseconds to keep LED off
6231          * between cycles.
6232          */
6233         uint8_t led0_group_id;
6234         /*
6235          * An identifier for the group of LEDs that LED #0 belongs to.
6236          * If set to 0, then the LED #0 is not grouped. For all other
6237          * non-zero values of this field, LED #0 is grouped together
6238          * with the LEDs with the same group ID value.
6239          */
6240         uint8_t led1_id;
6241         /* An identifier for the LED #1. */
6242         uint8_t led1_type;
6243         /* The type of LED #1. */
6244         /* Speed LED */
6245         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_TYPE_SPEED       UINT32_C(0x0)
6246         /* Activity LED */
6247         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_TYPE_ACTIVITY    UINT32_C(0x1)
6248         /* Invalid */
6249         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_TYPE_INVALID     UINT32_C(0xff)
6250         uint8_t led1_state;
6251         /* The current state of the LED #1. */
6252         /* Default state of the LED */
6253         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_STATE_DEFAULT    UINT32_C(0x0)
6254         /* Off */
6255         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_STATE_OFF        UINT32_C(0x1)
6256         /* On */
6257         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_STATE_ON UINT32_C(0x2)
6258         /* Blink */
6259         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_STATE_BLINK      UINT32_C(0x3)
6260         /* Blink Alternately */
6261         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_STATE_BLINKALT   UINT32_C(0x4)
6262         uint8_t led1_color;
6263         /* The color of LED #1. */
6264         /* Default */
6265         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_COLOR_DEFAULT    UINT32_C(0x0)
6266         /* Amber */
6267         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_COLOR_AMBER      UINT32_C(0x1)
6268         /* Green */
6269         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_COLOR_GREEN      UINT32_C(0x2)
6270         /* Green or Amber */
6271         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_COLOR_GREENAMBER UINT32_C(0x3)
6272         uint8_t unused_1;
6273         uint16_t led1_blink_on;
6274         /*
6275          * If the LED #1 state is "blink" or "blinkalt", then this field
6276          * represents the requested time in milliseconds to keep LED on
6277          * between cycles.
6278          */
6279         uint16_t led1_blink_off;
6280         /*
6281          * If the LED #1 state is "blink" or "blinkalt", then this field
6282          * represents the requested time in milliseconds to keep LED off
6283          * between cycles.
6284          */
6285         uint8_t led1_group_id;
6286         /*
6287          * An identifier for the group of LEDs that LED #1 belongs to.
6288          * If set to 0, then the LED #1 is not grouped. For all other
6289          * non-zero values of this field, LED #1 is grouped together
6290          * with the LEDs with the same group ID value.
6291          */
6292         uint8_t led2_id;
6293         /* An identifier for the LED #2. */
6294         uint8_t led2_type;
6295         /* The type of LED #2. */
6296         /* Speed LED */
6297         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_TYPE_SPEED       UINT32_C(0x0)
6298         /* Activity LED */
6299         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_TYPE_ACTIVITY    UINT32_C(0x1)
6300         /* Invalid */
6301         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_TYPE_INVALID     UINT32_C(0xff)
6302         uint8_t led2_state;
6303         /* The current state of the LED #2. */
6304         /* Default state of the LED */
6305         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_STATE_DEFAULT    UINT32_C(0x0)
6306         /* Off */
6307         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_STATE_OFF        UINT32_C(0x1)
6308         /* On */
6309         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_STATE_ON UINT32_C(0x2)
6310         /* Blink */
6311         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_STATE_BLINK      UINT32_C(0x3)
6312         /* Blink Alternately */
6313         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_STATE_BLINKALT   UINT32_C(0x4)
6314         uint8_t led2_color;
6315         /* The color of LED #2. */
6316         /* Default */
6317         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_COLOR_DEFAULT    UINT32_C(0x0)
6318         /* Amber */
6319         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_COLOR_AMBER      UINT32_C(0x1)
6320         /* Green */
6321         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_COLOR_GREEN      UINT32_C(0x2)
6322         /* Green or Amber */
6323         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_COLOR_GREENAMBER UINT32_C(0x3)
6324         uint8_t unused_2;
6325         uint16_t led2_blink_on;
6326         /*
6327          * If the LED #2 state is "blink" or "blinkalt", then this field
6328          * represents the requested time in milliseconds to keep LED on
6329          * between cycles.
6330          */
6331         uint16_t led2_blink_off;
6332         /*
6333          * If the LED #2 state is "blink" or "blinkalt", then this field
6334          * represents the requested time in milliseconds to keep LED off
6335          * between cycles.
6336          */
6337         uint8_t led2_group_id;
6338         /*
6339          * An identifier for the group of LEDs that LED #2 belongs to.
6340          * If set to 0, then the LED #2 is not grouped. For all other
6341          * non-zero values of this field, LED #2 is grouped together
6342          * with the LEDs with the same group ID value.
6343          */
6344         uint8_t led3_id;
6345         /* An identifier for the LED #3. */
6346         uint8_t led3_type;
6347         /* The type of LED #3. */
6348         /* Speed LED */
6349         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_TYPE_SPEED       UINT32_C(0x0)
6350         /* Activity LED */
6351         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_TYPE_ACTIVITY    UINT32_C(0x1)
6352         /* Invalid */
6353         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_TYPE_INVALID     UINT32_C(0xff)
6354         uint8_t led3_state;
6355         /* The current state of the LED #3. */
6356         /* Default state of the LED */
6357         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_STATE_DEFAULT    UINT32_C(0x0)
6358         /* Off */
6359         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_STATE_OFF        UINT32_C(0x1)
6360         /* On */
6361         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_STATE_ON UINT32_C(0x2)
6362         /* Blink */
6363         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_STATE_BLINK      UINT32_C(0x3)
6364         /* Blink Alternately */
6365         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_STATE_BLINKALT   UINT32_C(0x4)
6366         uint8_t led3_color;
6367         /* The color of LED #3. */
6368         /* Default */
6369         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_COLOR_DEFAULT    UINT32_C(0x0)
6370         /* Amber */
6371         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_COLOR_AMBER      UINT32_C(0x1)
6372         /* Green */
6373         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_COLOR_GREEN      UINT32_C(0x2)
6374         /* Green or Amber */
6375         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_COLOR_GREENAMBER UINT32_C(0x3)
6376         uint8_t unused_3;
6377         uint16_t led3_blink_on;
6378         /*
6379          * If the LED #3 state is "blink" or "blinkalt", then this field
6380          * represents the requested time in milliseconds to keep LED on
6381          * between cycles.
6382          */
6383         uint16_t led3_blink_off;
6384         /*
6385          * If the LED #3 state is "blink" or "blinkalt", then this field
6386          * represents the requested time in milliseconds to keep LED off
6387          * between cycles.
6388          */
6389         uint8_t led3_group_id;
6390         /*
6391          * An identifier for the group of LEDs that LED #3 belongs to.
6392          * If set to 0, then the LED #3 is not grouped. For all other
6393          * non-zero values of this field, LED #3 is grouped together
6394          * with the LEDs with the same group ID value.
6395          */
6396         uint8_t unused_4;
6397         uint16_t unused_5;
6398         uint8_t unused_6;
6399         uint8_t unused_7;
6400         uint8_t unused_8;
6401         uint8_t valid;
6402         /*
6403          * This field is used in Output records to indicate that the
6404          * output is completely written to RAM. This field should be
6405          * read as '1' to indicate that the output has been completely
6406          * written. When writing a command completion or response to an
6407          * internal processor, the order of writes has to be such that
6408          * this field is written last.
6409          */
6410 } __attribute__((packed));
6411
6412 /* hwrm_port_led_qcaps */
6413 /*
6414  * Description: This function is used to query capabilities of LEDs on a given
6415  * port. Each port has individual set of LEDs associated with it. These LEDs are
6416  * used for speed/link configuration as well as activity indicator
6417  * configuration.
6418  */
6419 /* Input        (24 bytes) */
6420 struct hwrm_port_led_qcaps_input {
6421         uint16_t req_type;
6422         /*
6423          * This value indicates what type of request this is. The format
6424          * for the rest of the command is determined by this field.
6425          */
6426         uint16_t cmpl_ring;
6427         /*
6428          * This value indicates the what completion ring the request
6429          * will be optionally completed on. If the value is -1, then no
6430          * CR completion will be generated. Any other value must be a
6431          * valid CR ring_id value for this function.
6432          */
6433         uint16_t seq_id;
6434         /* This value indicates the command sequence number. */
6435         uint16_t target_id;
6436         /*
6437          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
6438          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
6439          * - HWRM
6440          */
6441         uint64_t resp_addr;
6442         /*
6443          * This is the host address where the response will be written
6444          * when the request is complete. This area must be 16B aligned
6445          * and must be cleared to zero before the request is made.
6446          */
6447         uint16_t port_id;
6448         /* Port ID of port whose LED configuration is being queried. */
6449         uint16_t unused_0[3];
6450 } __attribute__((packed));
6451
6452 /* Output       (48 bytes) */
6453 struct hwrm_port_led_qcaps_output {
6454         uint16_t error_code;
6455         /*
6456          * Pass/Fail or error type Note: receiver to verify the in
6457          * parameters, and fail the call with an error when appropriate
6458          */
6459         uint16_t req_type;
6460         /* This field returns the type of original request. */
6461         uint16_t seq_id;
6462         /* This field provides original sequence number of the command. */
6463         uint16_t resp_len;
6464         /*
6465          * This field is the length of the response in bytes. The last
6466          * byte of the response is a valid flag that will read as '1'
6467          * when the command has been completely written to memory.
6468          */
6469         uint8_t num_leds;
6470         /*
6471          * The number of LEDs that are configured on this port. Up to 4
6472          * LEDs can be returned in the response.
6473          */
6474         uint8_t unused_0[3];
6475         /* Reserved for future use. */
6476         uint8_t led0_id;
6477         /* An identifier for the LED #0. */
6478         uint8_t led0_type;
6479         /* The type of LED #0. */
6480         /* Speed LED */
6481         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_TYPE_SPEED      UINT32_C(0x0)
6482         /* Activity LED */
6483         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_TYPE_ACTIVITY   UINT32_C(0x1)
6484         /* Invalid */
6485         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_TYPE_INVALID    UINT32_C(0xff)
6486         uint8_t led0_group_id;
6487         /*
6488          * An identifier for the group of LEDs that LED #0 belongs to.
6489          * If set to 0, then the LED #0 cannot be grouped. For all other
6490          * non-zero values of this field, LED #0 is grouped together
6491          * with the LEDs with the same group ID value.
6492          */
6493         uint8_t unused_1;
6494         uint16_t led0_state_caps;
6495         /* The states supported by LED #0. */
6496         /*
6497          * If set to 1, this LED is enabled. If set to 0, this LED is
6498          * disabled.
6499          */
6500         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_STATE_CAPS_ENABLED UINT32_C(0x1)
6501         /*
6502          * If set to 1, off state is supported on this LED. If set to 0,
6503          * off state is not supported on this LED.
6504          */
6505         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_STATE_CAPS_OFF_SUPPORTED  \
6506                 UINT32_C(0x2)
6507         /*
6508          * If set to 1, on state is supported on this LED. If set to 0,
6509          * on state is not supported on this LED.
6510          */
6511         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_STATE_CAPS_ON_SUPPORTED   \
6512                 UINT32_C(0x4)
6513         /*
6514          * If set to 1, blink state is supported on this LED. If set to
6515          * 0, blink state is not supported on this LED.
6516          */
6517         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_STATE_CAPS_BLINK_SUPPORTED \
6518                 UINT32_C(0x8)
6519         /*
6520          * If set to 1, blink_alt state is supported on this LED. If set
6521          * to 0, blink_alt state is not supported on this LED.
6522          */
6523         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_STATE_CAPS_BLINK_ALT_SUPPORTED \
6524                 UINT32_C(0x10)
6525         uint16_t led0_color_caps;
6526         /* The colors supported by LED #0. */
6527         /* reserved */
6528         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_COLOR_CAPS_RSVD UINT32_C(0x1)
6529         /*
6530          * If set to 1, Amber color is supported on this LED. If set to
6531          * 0, Amber color is not supported on this LED.
6532          */
6533         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_COLOR_CAPS_AMBER_SUPPORTED \
6534                 UINT32_C(0x2)
6535         /*
6536          * If set to 1, Green color is supported on this LED. If set to
6537          * 0, Green color is not supported on this LED.
6538          */
6539         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_COLOR_CAPS_GREEN_SUPPORTED \
6540                 UINT32_C(0x4)
6541         uint8_t led1_id;
6542         /* An identifier for the LED #1. */
6543         uint8_t led1_type;
6544         /* The type of LED #1. */
6545         /* Speed LED */
6546         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_TYPE_SPEED      UINT32_C(0x0)
6547         /* Activity LED */
6548         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_TYPE_ACTIVITY   UINT32_C(0x1)
6549         /* Invalid */
6550         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_TYPE_INVALID    UINT32_C(0xff)
6551         uint8_t led1_group_id;
6552         /*
6553          * An identifier for the group of LEDs that LED #1 belongs to.
6554          * If set to 0, then the LED #0 cannot be grouped. For all other
6555          * non-zero values of this field, LED #0 is grouped together
6556          * with the LEDs with the same group ID value.
6557          */
6558         uint8_t unused_2;
6559         uint16_t led1_state_caps;
6560         /* The states supported by LED #1. */
6561         /*
6562          * If set to 1, this LED is enabled. If set to 0, this LED is
6563          * disabled.
6564          */
6565         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_STATE_CAPS_ENABLED UINT32_C(0x1)
6566         /*
6567          * If set to 1, off state is supported on this LED. If set to 0,
6568          * off state is not supported on this LED.
6569          */
6570         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_STATE_CAPS_OFF_SUPPORTED  \
6571                 UINT32_C(0x2)
6572         /*
6573          * If set to 1, on state is supported on this LED. If set to 0,
6574          * on state is not supported on this LED.
6575          */
6576         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_STATE_CAPS_ON_SUPPORTED   \
6577                 UINT32_C(0x4)
6578         /*
6579          * If set to 1, blink state is supported on this LED. If set to
6580          * 0, blink state is not supported on this LED.
6581          */
6582         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_STATE_CAPS_BLINK_SUPPORTED \
6583                 UINT32_C(0x8)
6584         /*
6585          * If set to 1, blink_alt state is supported on this LED. If set
6586          * to 0, blink_alt state is not supported on this LED.
6587          */
6588         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_STATE_CAPS_BLINK_ALT_SUPPORTED \
6589                 UINT32_C(0x10)
6590         uint16_t led1_color_caps;
6591         /* The colors supported by LED #1. */
6592         /* reserved */
6593         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_COLOR_CAPS_RSVD UINT32_C(0x1)
6594         /*
6595          * If set to 1, Amber color is supported on this LED. If set to
6596          * 0, Amber color is not supported on this LED.
6597          */
6598         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_COLOR_CAPS_AMBER_SUPPORTED \
6599                 UINT32_C(0x2)
6600         /*
6601          * If set to 1, Green color is supported on this LED. If set to
6602          * 0, Green color is not supported on this LED.
6603          */
6604         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_COLOR_CAPS_GREEN_SUPPORTED \
6605                 UINT32_C(0x4)
6606         uint8_t led2_id;
6607         /* An identifier for the LED #2. */
6608         uint8_t led2_type;
6609         /* The type of LED #2. */
6610         /* Speed LED */
6611         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_TYPE_SPEED      UINT32_C(0x0)
6612         /* Activity LED */
6613         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_TYPE_ACTIVITY   UINT32_C(0x1)
6614         /* Invalid */
6615         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_TYPE_INVALID    UINT32_C(0xff)
6616         uint8_t led2_group_id;
6617         /*
6618          * An identifier for the group of LEDs that LED #0 belongs to.
6619          * If set to 0, then the LED #0 cannot be grouped. For all other
6620          * non-zero values of this field, LED #0 is grouped together
6621          * with the LEDs with the same group ID value.
6622          */
6623         uint8_t unused_3;
6624         uint16_t led2_state_caps;
6625         /* The states supported by LED #2. */
6626         /*
6627          * If set to 1, this LED is enabled. If set to 0, this LED is
6628          * disabled.
6629          */
6630         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_STATE_CAPS_ENABLED UINT32_C(0x1)
6631         /*
6632          * If set to 1, off state is supported on this LED. If set to 0,
6633          * off state is not supported on this LED.
6634          */
6635         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_STATE_CAPS_OFF_SUPPORTED  \
6636                 UINT32_C(0x2)
6637         /*
6638          * If set to 1, on state is supported on this LED. If set to 0,
6639          * on state is not supported on this LED.
6640          */
6641         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_STATE_CAPS_ON_SUPPORTED   \
6642                 UINT32_C(0x4)
6643         /*
6644          * If set to 1, blink state is supported on this LED. If set to
6645          * 0, blink state is not supported on this LED.
6646          */
6647         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_STATE_CAPS_BLINK_SUPPORTED \
6648                 UINT32_C(0x8)
6649         /*
6650          * If set to 1, blink_alt state is supported on this LED. If set
6651          * to 0, blink_alt state is not supported on this LED.
6652          */
6653         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_STATE_CAPS_BLINK_ALT_SUPPORTED \
6654                 UINT32_C(0x10)
6655         uint16_t led2_color_caps;
6656         /* The colors supported by LED #2. */
6657         /* reserved */
6658         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_COLOR_CAPS_RSVD UINT32_C(0x1)
6659         /*
6660          * If set to 1, Amber color is supported on this LED. If set to
6661          * 0, Amber color is not supported on this LED.
6662          */
6663         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_COLOR_CAPS_AMBER_SUPPORTED \
6664                 UINT32_C(0x2)
6665         /*
6666          * If set to 1, Green color is supported on this LED. If set to
6667          * 0, Green color is not supported on this LED.
6668          */
6669         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_COLOR_CAPS_GREEN_SUPPORTED \
6670                 UINT32_C(0x4)
6671         uint8_t led3_id;
6672         /* An identifier for the LED #3. */
6673         uint8_t led3_type;
6674         /* The type of LED #3. */
6675         /* Speed LED */
6676         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_TYPE_SPEED      UINT32_C(0x0)
6677         /* Activity LED */
6678         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_TYPE_ACTIVITY   UINT32_C(0x1)
6679         /* Invalid */
6680         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_TYPE_INVALID    UINT32_C(0xff)
6681         uint8_t led3_group_id;
6682         /*
6683          * An identifier for the group of LEDs that LED #3 belongs to.
6684          * If set to 0, then the LED #0 cannot be grouped. For all other
6685          * non-zero values of this field, LED #0 is grouped together
6686          * with the LEDs with the same group ID value.
6687          */
6688         uint8_t unused_4;
6689         uint16_t led3_state_caps;
6690         /* The states supported by LED #3. */
6691         /*
6692          * If set to 1, this LED is enabled. If set to 0, this LED is
6693          * disabled.
6694          */
6695         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_STATE_CAPS_ENABLED UINT32_C(0x1)
6696         /*
6697          * If set to 1, off state is supported on this LED. If set to 0,
6698          * off state is not supported on this LED.
6699          */
6700         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_STATE_CAPS_OFF_SUPPORTED  \
6701                 UINT32_C(0x2)
6702         /*
6703          * If set to 1, on state is supported on this LED. If set to 0,
6704          * on state is not supported on this LED.
6705          */
6706         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_STATE_CAPS_ON_SUPPORTED   \
6707                 UINT32_C(0x4)
6708         /*
6709          * If set to 1, blink state is supported on this LED. If set to
6710          * 0, blink state is not supported on this LED.
6711          */
6712         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_STATE_CAPS_BLINK_SUPPORTED \
6713                 UINT32_C(0x8)
6714         /*
6715          * If set to 1, blink_alt state is supported on this LED. If set
6716          * to 0, blink_alt state is not supported on this LED.
6717          */
6718         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_STATE_CAPS_BLINK_ALT_SUPPORTED \
6719                 UINT32_C(0x10)
6720         uint16_t led3_color_caps;
6721         /* The colors supported by LED #3. */
6722         /* reserved */
6723         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_COLOR_CAPS_RSVD UINT32_C(0x1)
6724         /*
6725          * If set to 1, Amber color is supported on this LED. If set to
6726          * 0, Amber color is not supported on this LED.
6727          */
6728         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_COLOR_CAPS_AMBER_SUPPORTED \
6729                 UINT32_C(0x2)
6730         /*
6731          * If set to 1, Green color is supported on this LED. If set to
6732          * 0, Green color is not supported on this LED.
6733          */
6734         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_COLOR_CAPS_GREEN_SUPPORTED \
6735                 UINT32_C(0x4)
6736         uint8_t unused_5;
6737         uint8_t unused_6;
6738         uint8_t unused_7;
6739         uint8_t valid;
6740         /*
6741          * This field is used in Output records to indicate that the
6742          * output is completely written to RAM. This field should be
6743          * read as '1' to indicate that the output has been completely
6744          * written. When writing a command completion or response to an
6745          * internal processor, the order of writes has to be such that
6746          * this field is written last.
6747          */
6748 } __attribute__((packed));
6749
6750 /* hwrm_queue_qportcfg */
6751 /*
6752  * Description: This function is called by a driver to query queue configuration
6753  * of a port. # The HWRM shall at least advertise one queue with lossy service
6754  * profile. # The driver shall use this command to query queue ids before
6755  * configuring or using any queues. # If a service profile is not set for a
6756  * queue, then the driver shall not use that queue without configuring a service
6757  * profile for it. # If the driver is not allowed to configure service profiles,
6758  * then the driver shall only use queues for which service profiles are pre-
6759  * configured.
6760  */
6761 /* Input        (24 bytes) */
6762 struct hwrm_queue_qportcfg_input {
6763         uint16_t req_type;
6764         /*
6765          * This value indicates what type of request this is. The format
6766          * for the rest of the command is determined by this field.
6767          */
6768         uint16_t cmpl_ring;
6769         /*
6770          * This value indicates the what completion ring the request
6771          * will be optionally completed on. If the value is -1, then no
6772          * CR completion will be generated. Any other value must be a
6773          * valid CR ring_id value for this function.
6774          */
6775         uint16_t seq_id;
6776         /* This value indicates the command sequence number. */
6777         uint16_t target_id;
6778         /*
6779          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
6780          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
6781          * - HWRM
6782          */
6783         uint64_t resp_addr;
6784         /*
6785          * This is the host address where the response will be written
6786          * when the request is complete. This area must be 16B aligned
6787          * and must be cleared to zero before the request is made.
6788          */
6789         uint32_t flags;
6790         /*
6791          * Enumeration denoting the RX, TX type of the resource. This
6792          * enumeration is used for resources that are similar for both
6793          * TX and RX paths of the chip.
6794          */
6795         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH    UINT32_C(0x1)
6796         /* tx path */
6797         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_TX UINT32_C(0x0)
6798         /* rx path */
6799         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX UINT32_C(0x1)
6800         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_LAST \
6801                 QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX
6802         uint16_t port_id;
6803         /*
6804          * Port ID of port for which the queue configuration is being
6805          * queried. This field is only required when sent by IPC.
6806          */
6807         uint16_t unused_0;
6808 } __attribute__((packed));
6809
6810 /* Output       (32 bytes) */
6811 struct hwrm_queue_qportcfg_output {
6812         uint16_t error_code;
6813         /*
6814          * Pass/Fail or error type Note: receiver to verify the in
6815          * parameters, and fail the call with an error when appropriate
6816          */
6817         uint16_t req_type;
6818         /* This field returns the type of original request. */
6819         uint16_t seq_id;
6820         /* This field provides original sequence number of the command. */
6821         uint16_t resp_len;
6822         /*
6823          * This field is the length of the response in bytes. The last
6824          * byte of the response is a valid flag that will read as '1'
6825          * when the command has been completely written to memory.
6826          */
6827         uint8_t max_configurable_queues;
6828         /*
6829          * The maximum number of queues that can be configured on this
6830          * port. Valid values range from 1 through 8.
6831          */
6832         uint8_t max_configurable_lossless_queues;
6833         /*
6834          * The maximum number of lossless queues that can be configured
6835          * on this port. Valid values range from 0 through 8.
6836          */
6837         uint8_t queue_cfg_allowed;
6838         /*
6839          * Bitmask indicating which queues can be configured by the
6840          * hwrm_queue_cfg command. Each bit represents a specific queue
6841          * where bit 0 represents queue 0 and bit 7 represents queue 7.
6842          * # A value of 0 indicates that the queue is not configurable
6843          * by the hwrm_queue_cfg command. # A value of 1 indicates that
6844          * the queue is configurable. # A hwrm_queue_cfg command shall
6845          * return error when trying to configure a queue not
6846          * configurable.
6847          */
6848         uint8_t queue_cfg_info;
6849         /* Information about queue configuration. */
6850         /*
6851          * If this flag is set to '1', then the queues are configured
6852          * asymmetrically on TX and RX sides. If this flag is set to
6853          * '0', then the queues are configured symmetrically on TX and
6854          * RX sides. For symmetric configuration, the queue
6855          * configuration including queue ids and service profiles on the
6856          * TX side is the same as the corresponding queue configuration
6857          * on the RX side.
6858          */
6859         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_CFG_INFO_ASYM_CFG UINT32_C(0x1)
6860         uint8_t queue_pfcenable_cfg_allowed;
6861         /*
6862          * Bitmask indicating which queues can be configured by the
6863          * hwrm_queue_pfcenable_cfg command. Each bit represents a
6864          * specific priority where bit 0 represents priority 0 and bit 7
6865          * represents priority 7. # A value of 0 indicates that the
6866          * priority is not configurable by the hwrm_queue_pfcenable_cfg
6867          * command. # A value of 1 indicates that the priority is
6868          * configurable. # A hwrm_queue_pfcenable_cfg command shall
6869          * return error when trying to configure a priority that is not
6870          * configurable.
6871          */
6872         uint8_t queue_pri2cos_cfg_allowed;
6873         /*
6874          * Bitmask indicating which queues can be configured by the
6875          * hwrm_queue_pri2cos_cfg command. Each bit represents a
6876          * specific queue where bit 0 represents queue 0 and bit 7
6877          * represents queue 7. # A value of 0 indicates that the queue
6878          * is not configurable by the hwrm_queue_pri2cos_cfg command. #
6879          * A value of 1 indicates that the queue is configurable. # A
6880          * hwrm_queue_pri2cos_cfg command shall return error when trying
6881          * to configure a queue that is not configurable.
6882          */
6883         uint8_t queue_cos2bw_cfg_allowed;
6884         /*
6885          * Bitmask indicating which queues can be configured by the
6886          * hwrm_queue_pri2cos_cfg command. Each bit represents a
6887          * specific queue where bit 0 represents queue 0 and bit 7
6888          * represents queue 7. # A value of 0 indicates that the queue
6889          * is not configurable by the hwrm_queue_pri2cos_cfg command. #
6890          * A value of 1 indicates that the queue is configurable. # A
6891          * hwrm_queue_pri2cos_cfg command shall return error when trying
6892          * to configure a queue not configurable.
6893          */
6894         uint8_t queue_id0;
6895         /*
6896          * ID of CoS Queue 0. FF - Invalid id # This ID can be used on
6897          * any subsequent call to an hwrm command that takes a queue id.
6898          * # IDs must always be queried by this command before any use
6899          * by the driver or software. # Any driver or software should
6900          * not make any assumptions about queue IDs. # A value of 0xff
6901          * indicates that the queue is not available. # Available queues
6902          * may not be in sequential order.
6903          */
6904         uint8_t queue_id0_service_profile;
6905         /* This value is applicable to CoS queues only. */
6906         /* Lossy        (best-effort) */
6907         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY \
6908                 UINT32_C(0x0)
6909         /* Lossless */
6910         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS \
6911                 UINT32_C(0x1)
6912         /*
6913          * Set to 0xFF...       (All Fs) if there is no
6914          * service profile specified
6915          */
6916         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_UNKNOWN \
6917                 UINT32_C(0xff)
6918         uint8_t queue_id1;
6919         /*
6920          * ID of CoS Queue 1. FF - Invalid id # This ID can be used on
6921          * any subsequent call to an hwrm command that takes a queue id.
6922          * # IDs must always be queried by this command before any use
6923          * by the driver or software. # Any driver or software should
6924          * not make any assumptions about queue IDs. # A value of 0xff
6925          * indicates that the queue is not available. # Available queues
6926          * may not be in sequential order.
6927          */
6928         uint8_t queue_id1_service_profile;
6929         /* This value is applicable to CoS queues only. */
6930         /* Lossy        (best-effort) */
6931         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSY \
6932                 UINT32_C(0x0)
6933         /* Lossless */
6934         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSLESS \
6935                 UINT32_C(0x1)
6936         /*
6937          * Set to 0xFF...       (All Fs) if there is no
6938          * service profile specified
6939          */
6940         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_UNKNOWN \
6941                 UINT32_C(0xff)
6942         uint8_t queue_id2;
6943         /*
6944          * ID of CoS Queue 2. FF - Invalid id # This ID can be used on
6945          * any subsequent call to an hwrm command that takes a queue id.
6946          * # IDs must always be queried by this command before any use
6947          * by the driver or software. # Any driver or software should
6948          * not make any assumptions about queue IDs. # A value of 0xff
6949          * indicates that the queue is not available. # Available queues
6950          * may not be in sequential order.
6951          */
6952         uint8_t queue_id2_service_profile;
6953         /* This value is applicable to CoS queues only. */
6954         /* Lossy        (best-effort) */
6955         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSY \
6956                 UINT32_C(0x0)
6957         /* Lossless */
6958         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSLESS \
6959                 UINT32_C(0x1)
6960         /*
6961          * Set to 0xFF...       (All Fs) if there is no
6962          * service profile specified
6963          */
6964         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_UNKNOWN \
6965                 UINT32_C(0xff)
6966         uint8_t queue_id3;
6967         /*
6968          * ID of CoS Queue 3. FF - Invalid id # This ID can be used on
6969          * any subsequent call to an hwrm command that takes a queue id.
6970          * # IDs must always be queried by this command before any use
6971          * by the driver or software. # Any driver or software should
6972          * not make any assumptions about queue IDs. # A value of 0xff
6973          * indicates that the queue is not available. # Available queues
6974          * may not be in sequential order.
6975          */
6976         uint8_t queue_id3_service_profile;
6977         /* This value is applicable to CoS queues only. */
6978         /* Lossy        (best-effort) */
6979         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSY \
6980                 UINT32_C(0x0)
6981         /* Lossless */
6982         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSLESS \
6983                 UINT32_C(0x1)
6984         /*
6985          * Set to 0xFF...       (All Fs) if there is no
6986          * service profile specified
6987          */
6988         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_UNKNOWN \
6989                 UINT32_C(0xff)
6990         uint8_t queue_id4;
6991         /*
6992          * ID of CoS Queue 4. FF - Invalid id # This ID can be used on
6993          * any subsequent call to an hwrm command that takes a queue id.
6994          * # IDs must always be queried by this command before any use
6995          * by the driver or software. # Any driver or software should
6996          * not make any assumptions about queue IDs. # A value of 0xff
6997          * indicates that the queue is not available. # Available queues
6998          * may not be in sequential order.
6999          */
7000         uint8_t queue_id4_service_profile;
7001         /* This value is applicable to CoS queues only. */
7002         /* Lossy        (best-effort) */
7003         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSY \
7004                 UINT32_C(0x0)
7005         /* Lossless */
7006         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSLESS \
7007                 UINT32_C(0x1)
7008         /*
7009          * Set to 0xFF...       (All Fs) if there is no
7010          * service profile specified
7011          */
7012         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_UNKNOWN \
7013                 UINT32_C(0xff)
7014         uint8_t queue_id5;
7015         /*
7016          * ID of CoS Queue 5. FF - Invalid id # This ID can be used on
7017          * any subsequent call to an hwrm command that takes a queue id.
7018          * # IDs must always be queried by this command before any use
7019          * by the driver or software. # Any driver or software should
7020          * not make any assumptions about queue IDs. # A value of 0xff
7021          * indicates that the queue is not available. # Available queues
7022          * may not be in sequential order.
7023          */
7024         uint8_t queue_id5_service_profile;
7025         /* This value is applicable to CoS queues only. */
7026         /* Lossy        (best-effort) */
7027         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSY \
7028                 UINT32_C(0x0)
7029         /* Lossless */
7030         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSLESS \
7031                 UINT32_C(0x1)
7032         /*
7033          * Set to 0xFF...       (All Fs) if there is no
7034          * service profile specified
7035          */
7036         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_UNKNOWN \
7037                 UINT32_C(0xff)
7038         uint8_t queue_id6;
7039         /*
7040          * ID of CoS Queue 6. FF - Invalid id # This ID can be used on
7041          * any subsequent call to an hwrm command that takes a queue id.
7042          * # IDs must always be queried by this command before any use
7043          * by the driver or software. # Any driver or software should
7044          * not make any assumptions about queue IDs. # A value of 0xff
7045          * indicates that the queue is not available. # Available queues
7046          * may not be in sequential order.
7047          */
7048         uint8_t queue_id6_service_profile;
7049         /* This value is applicable to CoS queues only. */
7050         /* Lossy        (best-effort) */
7051         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSY \
7052                 UINT32_C(0x0)
7053         /* Lossless */
7054         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSLESS \
7055                 UINT32_C(0x1)
7056         /*
7057          * Set to 0xFF...       (All Fs) if there is no
7058          * service profile specified
7059          */
7060         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_UNKNOWN \
7061                 UINT32_C(0xff)
7062         uint8_t queue_id7;
7063         /*
7064          * ID of CoS Queue 7. FF - Invalid id # This ID can be used on
7065          * any subsequent call to an hwrm command that takes a queue id.
7066          * # IDs must always be queried by this command before any use
7067          * by the driver or software. # Any driver or software should
7068          * not make any assumptions about queue IDs. # A value of 0xff
7069          * indicates that the queue is not available. # Available queues
7070          * may not be in sequential order.
7071          */
7072         uint8_t queue_id7_service_profile;
7073         /* This value is applicable to CoS queues only. */
7074         /* Lossy        (best-effort) */
7075         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSY \
7076                 UINT32_C(0x0)
7077         /* Lossless */
7078         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSLESS \
7079                 UINT32_C(0x1)
7080         /*
7081          * Set to 0xFF...       (All Fs) if there is no
7082          * service profile specified
7083          */
7084         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_UNKNOWN \
7085                 UINT32_C(0xff)
7086         uint8_t valid;
7087         /*
7088          * This field is used in Output records to indicate that the
7089          * output is completely written to RAM. This field should be
7090          * read as '1' to indicate that the output has been completely
7091          * written. When writing a command completion or response to an
7092          * internal processor, the order of writes has to be such that
7093          * this field is written last.
7094          */
7095 } __attribute__((packed));
7096
7097 /*********************
7098  * hwrm_port_mac_cfg *
7099  *********************/
7100
7101
7102 /* hwrm_port_mac_cfg_input (size:320b/40B) */
7103 struct hwrm_port_mac_cfg_input {
7104         uint16_t        req_type;
7105         uint16_t        cmpl_ring;
7106         uint16_t        seq_id;
7107         uint16_t        target_id;
7108         uint64_t        resp_addr;
7109         uint32_t        flags;
7110         #define PORT_MAC_CFG_REQ_FLAGS_MATCH_LINK                    0x1UL
7111         #define PORT_MAC_CFG_REQ_FLAGS_VLAN_PRI2COS_ENABLE           0x2UL
7112         #define PORT_MAC_CFG_REQ_FLAGS_TUNNEL_PRI2COS_ENABLE         0x4UL
7113         #define PORT_MAC_CFG_REQ_FLAGS_IP_DSCP2COS_ENABLE            0x8UL
7114         #define PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_ENABLE      0x10UL
7115         #define PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE     0x20UL
7116         #define PORT_MAC_CFG_REQ_FLAGS_PTP_TX_TS_CAPTURE_ENABLE      0x40UL
7117         #define PORT_MAC_CFG_REQ_FLAGS_PTP_TX_TS_CAPTURE_DISABLE     0x80UL
7118         #define PORT_MAC_CFG_REQ_FLAGS_OOB_WOL_ENABLE                0x100UL
7119         #define PORT_MAC_CFG_REQ_FLAGS_OOB_WOL_DISABLE               0x200UL
7120         #define PORT_MAC_CFG_REQ_FLAGS_VLAN_PRI2COS_DISABLE          0x400UL
7121         #define PORT_MAC_CFG_REQ_FLAGS_TUNNEL_PRI2COS_DISABLE        0x800UL
7122         #define PORT_MAC_CFG_REQ_FLAGS_IP_DSCP2COS_DISABLE           0x1000UL
7123         uint32_t        enables;
7124         #define PORT_MAC_CFG_REQ_ENABLES_IPG                            0x1UL
7125         #define PORT_MAC_CFG_REQ_ENABLES_LPBK                           0x2UL
7126         #define PORT_MAC_CFG_REQ_ENABLES_VLAN_PRI2COS_MAP_PRI           0x4UL
7127         #define PORT_MAC_CFG_REQ_ENABLES_TUNNEL_PRI2COS_MAP_PRI         0x10UL
7128         #define PORT_MAC_CFG_REQ_ENABLES_DSCP2COS_MAP_PRI               0x20UL
7129         #define PORT_MAC_CFG_REQ_ENABLES_RX_TS_CAPTURE_PTP_MSG_TYPE     0x40UL
7130         #define PORT_MAC_CFG_REQ_ENABLES_TX_TS_CAPTURE_PTP_MSG_TYPE     0x80UL
7131         #define PORT_MAC_CFG_REQ_ENABLES_COS_FIELD_CFG                  0x100UL
7132         uint16_t        port_id;
7133         uint8_t         ipg;
7134         uint8_t         lpbk;
7135         #define PORT_MAC_CFG_REQ_LPBK_NONE   0x0UL
7136         #define PORT_MAC_CFG_REQ_LPBK_LOCAL  0x1UL
7137         #define PORT_MAC_CFG_REQ_LPBK_REMOTE 0x2UL
7138         #define PORT_MAC_CFG_REQ_LPBK_LAST  PORT_MAC_CFG_REQ_LPBK_REMOTE
7139         uint8_t         vlan_pri2cos_map_pri;
7140         uint8_t         reserved1;
7141         uint8_t         tunnel_pri2cos_map_pri;
7142         uint8_t         dscp2pri_map_pri;
7143         uint16_t        rx_ts_capture_ptp_msg_type;
7144         uint16_t        tx_ts_capture_ptp_msg_type;
7145         uint8_t         cos_field_cfg;
7146         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_RSVD1                     0x1UL
7147         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_MASK         0x6UL
7148         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_SFT          1
7149         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_INNERMOST \
7150                 (0x0UL << 1)
7151         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_OUTER \
7152                 (0x1UL << 1)
7153         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_OUTERMOST \
7154                 (0x2UL << 1)
7155         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_UNSPECIFIED \
7156                 (0x3UL << 1)
7157         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_LAST \
7158                 PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_UNSPECIFIED
7159         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_MASK       0x18UL
7160         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_SFT        3
7161         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_INNERMOST \
7162                 (0x0UL << 3)
7163         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_OUTER \
7164                 (0x1UL << 3)
7165         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_OUTERMOST \
7166                 (0x2UL << 3)
7167         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_UNSPECIFIED \
7168                 (0x3UL << 3)
7169         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_LAST \
7170                 PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_UNSPECIFIED
7171         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_DEFAULT_COS_MASK          0xe0UL
7172         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_DEFAULT_COS_SFT           5
7173         uint8_t         unused_0[3];
7174 };
7175
7176
7177 /* hwrm_port_mac_cfg_output (size:128b/16B) */
7178 struct hwrm_port_mac_cfg_output {
7179         uint16_t        error_code;
7180         uint16_t        req_type;
7181         uint16_t        seq_id;
7182         uint16_t        resp_len;
7183         uint16_t        mru;
7184         uint16_t        mtu;
7185         uint8_t         ipg;
7186         uint8_t         lpbk;
7187         #define PORT_MAC_CFG_RESP_LPBK_NONE   0x0UL
7188         #define PORT_MAC_CFG_RESP_LPBK_LOCAL  0x1UL
7189         #define PORT_MAC_CFG_RESP_LPBK_REMOTE 0x2UL
7190         #define PORT_MAC_CFG_RESP_LPBK_LAST  PORT_MAC_CFG_RESP_LPBK_REMOTE
7191         uint8_t         unused_0;
7192         uint8_t         valid;
7193 };
7194
7195
7196 /**********************
7197  * hwrm_port_mac_qcfg *
7198  **********************/
7199
7200
7201 /* hwrm_port_mac_qcfg_input (size:192b/24B) */
7202 struct hwrm_port_mac_qcfg_input {
7203         uint16_t        req_type;
7204         uint16_t        cmpl_ring;
7205         uint16_t        seq_id;
7206         uint16_t        target_id;
7207         uint64_t        resp_addr;
7208         uint16_t        port_id;
7209         uint8_t         unused_0[6];
7210 };
7211
7212
7213 /* hwrm_port_mac_qcfg_output (size:192b/24B) */
7214 struct hwrm_port_mac_qcfg_output {
7215         uint16_t        error_code;
7216         uint16_t        req_type;
7217         uint16_t        seq_id;
7218         uint16_t        resp_len;
7219         uint16_t        mru;
7220         uint16_t        mtu;
7221         uint8_t         ipg;
7222         uint8_t         lpbk;
7223         #define PORT_MAC_QCFG_RESP_LPBK_NONE   0x0UL
7224         #define PORT_MAC_QCFG_RESP_LPBK_LOCAL  0x1UL
7225         #define PORT_MAC_QCFG_RESP_LPBK_REMOTE 0x2UL
7226         #define PORT_MAC_QCFG_RESP_LPBK_LAST  PORT_MAC_QCFG_RESP_LPBK_REMOTE
7227         uint8_t         vlan_pri2cos_map_pri;
7228         uint8_t         flags;
7229         #define PORT_MAC_QCFG_RESP_FLAGS_VLAN_PRI2COS_ENABLE          0x1UL
7230         #define PORT_MAC_QCFG_RESP_FLAGS_TUNNEL_PRI2COS_ENABLE        0x2UL
7231         #define PORT_MAC_QCFG_RESP_FLAGS_IP_DSCP2COS_ENABLE           0x4UL
7232         #define PORT_MAC_QCFG_RESP_FLAGS_OOB_WOL_ENABLE               0x8UL
7233         #define PORT_MAC_QCFG_RESP_FLAGS_PTP_RX_TS_CAPTURE_ENABLE     0x10UL
7234         #define PORT_MAC_QCFG_RESP_FLAGS_PTP_TX_TS_CAPTURE_ENABLE     0x20UL
7235         uint8_t         tunnel_pri2cos_map_pri;
7236         uint8_t         dscp2pri_map_pri;
7237         uint16_t        rx_ts_capture_ptp_msg_type;
7238         uint16_t        tx_ts_capture_ptp_msg_type;
7239         uint8_t         cos_field_cfg;
7240         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_RSVD                      0x1UL
7241         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_MASK         0x6UL
7242         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_SFT          1
7243         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_INNERMOST \
7244                 (0x0UL << 1)
7245         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_OUTER \
7246                 (0x1UL << 1)
7247         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_OUTERMOST \
7248                 (0x2UL << 1)
7249         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_UNSPECIFIED \
7250                 (0x3UL << 1)
7251         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_LAST \
7252                 PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_UNSPECIFIED
7253         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_MASK    0x18UL
7254         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_SFT        3
7255         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_INNERMOST \
7256                 (0x0UL << 3)
7257         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_OUTER \
7258                 (0x1UL << 3)
7259         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_OUTERMOST \
7260                 (0x2UL << 3)
7261         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_UNSPECIFIED \
7262                 (0x3UL << 3)
7263         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_LAST \
7264                 PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_UNSPECIFIED
7265         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_DEFAULT_COS_MASK       0xe0UL
7266         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_DEFAULT_COS_SFT           5
7267         uint8_t         valid;
7268 };
7269
7270
7271 /**************************
7272  * hwrm_port_mac_ptp_qcfg *
7273  **************************/
7274
7275
7276 /* hwrm_port_mac_ptp_qcfg_input (size:192b/24B) */
7277 struct hwrm_port_mac_ptp_qcfg_input {
7278         uint16_t        req_type;
7279         uint16_t        cmpl_ring;
7280         uint16_t        seq_id;
7281         uint16_t        target_id;
7282         uint64_t        resp_addr;
7283         uint16_t        port_id;
7284         uint8_t         unused_0[6];
7285 };
7286
7287
7288 /* hwrm_port_mac_ptp_qcfg_output (size:640b/80B) */
7289 struct hwrm_port_mac_ptp_qcfg_output {
7290         uint16_t        error_code;
7291         uint16_t        req_type;
7292         uint16_t        seq_id;
7293         uint16_t        resp_len;
7294         uint8_t         flags;
7295         #define PORT_MAC_PTP_QCFG_RESP_FLAGS_DIRECT_ACCESS     0x1UL
7296         #define PORT_MAC_PTP_QCFG_RESP_FLAGS_HWRM_ACCESS       0x2UL
7297         uint8_t         unused_0[3];
7298         uint32_t        rx_ts_reg_off_lower;
7299         uint32_t        rx_ts_reg_off_upper;
7300         uint32_t        rx_ts_reg_off_seq_id;
7301         uint32_t        rx_ts_reg_off_src_id_0;
7302         uint32_t        rx_ts_reg_off_src_id_1;
7303         uint32_t        rx_ts_reg_off_src_id_2;
7304         uint32_t        rx_ts_reg_off_domain_id;
7305         uint32_t        rx_ts_reg_off_fifo;
7306         uint32_t        rx_ts_reg_off_fifo_adv;
7307         uint32_t        rx_ts_reg_off_granularity;
7308         uint32_t        tx_ts_reg_off_lower;
7309         uint32_t        tx_ts_reg_off_upper;
7310         uint32_t        tx_ts_reg_off_seq_id;
7311         uint32_t        tx_ts_reg_off_fifo;
7312         uint32_t        tx_ts_reg_off_granularity;
7313         uint8_t         unused_1[7];
7314         uint8_t         valid;
7315 };
7316
7317
7318 /* hwrm_vnic_alloc */
7319 /*
7320  * Description: This VNIC is a resource in the RX side of the chip that is used
7321  * to represent a virtual host "interface". # At the time of VNIC allocation or
7322  * configuration, the function can specify whether it wants the requested VNIC
7323  * to be the default VNIC for the function or not. # If a function requests
7324  * allocation of a VNIC for the first time and a VNIC is successfully allocated
7325  * by the HWRM, then the HWRM shall make the allocated VNIC as the default VNIC
7326  * for that function. # The default VNIC shall be used for the default action
7327  * for a partition or function. # For each VNIC allocated on a function, a
7328  * mapping on the RX side to map the allocated VNIC to source virtual interface
7329  * shall be performed by the HWRM. This should be hidden to the function driver
7330  * requesting the VNIC allocation. This enables broadcast/multicast replication
7331  * with source knockout. # If multicast replication with source knockout is
7332  * enabled, then the internal VNIC to SVIF mapping data structures shall be
7333  * programmed at the time of VNIC allocation.
7334  */
7335 /* Input        (24 bytes) */
7336 struct hwrm_vnic_alloc_input {
7337         uint16_t req_type;
7338         /*
7339          * This value indicates what type of request this is. The format
7340          * for the rest of the command is determined by this field.
7341          */
7342         uint16_t cmpl_ring;
7343         /*
7344          * This value indicates the what completion ring the request
7345          * will be optionally completed on. If the value is -1, then no
7346          * CR completion will be generated. Any other value must be a
7347          * valid CR ring_id value for this function.
7348          */
7349         uint16_t seq_id;
7350         /* This value indicates the command sequence number. */
7351         uint16_t target_id;
7352         /*
7353          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7354          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7355          * - HWRM
7356          */
7357         uint64_t resp_addr;
7358         /*
7359          * This is the host address where the response will be written
7360          * when the request is complete. This area must be 16B aligned
7361          * and must be cleared to zero before the request is made.
7362          */
7363         uint32_t flags;
7364         /*
7365          * When this bit is '1', this VNIC is requested to be the
7366          * default VNIC for this function.
7367          */
7368         #define HWRM_VNIC_ALLOC_INPUT_FLAGS_DEFAULT     UINT32_C(0x1)
7369         uint32_t unused_0;
7370 } __attribute__((packed));
7371
7372 /* Output       (16 bytes) */
7373 struct hwrm_vnic_alloc_output {
7374         uint16_t error_code;
7375         /*
7376          * Pass/Fail or error type Note: receiver to verify the in
7377          * parameters, and fail the call with an error when appropriate
7378          */
7379         uint16_t req_type;
7380         /* This field returns the type of original request. */
7381         uint16_t seq_id;
7382         /* This field provides original sequence number of the command. */
7383         uint16_t resp_len;
7384         /*
7385          * This field is the length of the response in bytes. The last
7386          * byte of the response is a valid flag that will read as '1'
7387          * when the command has been completely written to memory.
7388          */
7389         uint32_t vnic_id;
7390         /* Logical vnic ID */
7391         uint8_t unused_0;
7392         uint8_t unused_1;
7393         uint8_t unused_2;
7394         uint8_t valid;
7395         /*
7396          * This field is used in Output records to indicate that the
7397          * output is completely written to RAM. This field should be
7398          * read as '1' to indicate that the output has been completely
7399          * written. When writing a command completion or response to an
7400          * internal processor, the order of writes has to be such that
7401          * this field is written last.
7402          */
7403 } __attribute__((packed));
7404
7405 /* hwrm_vnic_free */
7406 /*
7407  * Description: Free a VNIC resource. Idle any resources associated with the
7408  * VNIC as well as the VNIC. Reset and release all resources associated with the
7409  * VNIC.
7410  */
7411 /* Input        (24 bytes) */
7412 struct hwrm_vnic_free_input {
7413         uint16_t req_type;
7414         /*
7415          * This value indicates what type of request this is. The format
7416          * for the rest of the command is determined by this field.
7417          */
7418         uint16_t cmpl_ring;
7419         /*
7420          * This value indicates the what completion ring the request
7421          * will be optionally completed on. If the value is -1, then no
7422          * CR completion will be generated. Any other value must be a
7423          * valid CR ring_id value for this function.
7424          */
7425         uint16_t seq_id;
7426         /* This value indicates the command sequence number. */
7427         uint16_t target_id;
7428         /*
7429          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7430          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7431          * - HWRM
7432          */
7433         uint64_t resp_addr;
7434         /*
7435          * This is the host address where the response will be written
7436          * when the request is complete. This area must be 16B aligned
7437          * and must be cleared to zero before the request is made.
7438          */
7439         uint32_t vnic_id;
7440         /* Logical vnic ID */
7441         uint32_t unused_0;
7442 } __attribute__((packed));
7443
7444 /* Output       (16 bytes) */
7445 struct hwrm_vnic_free_output {
7446         uint16_t error_code;
7447         /*
7448          * Pass/Fail or error type Note: receiver to verify the in
7449          * parameters, and fail the call with an error when appropriate
7450          */
7451         uint16_t req_type;
7452         /* This field returns the type of original request. */
7453         uint16_t seq_id;
7454         /* This field provides original sequence number of the command. */
7455         uint16_t resp_len;
7456         /*
7457          * This field is the length of the response in bytes. The last
7458          * byte of the response is a valid flag that will read as '1'
7459          * when the command has been completely written to memory.
7460          */
7461         uint32_t unused_0;
7462         uint8_t unused_1;
7463         uint8_t unused_2;
7464         uint8_t unused_3;
7465         uint8_t valid;
7466         /*
7467          * This field is used in Output records to indicate that the
7468          * output is completely written to RAM. This field should be
7469          * read as '1' to indicate that the output has been completely
7470          * written. When writing a command completion or response to an
7471          * internal processor, the order of writes has to be such that
7472          * this field is written last.
7473          */
7474 } __attribute__((packed));
7475
7476 /* hwrm_vnic_cfg */
7477 /* Description: Configure the RX VNIC structure. */
7478 /* Input        (40 bytes) */
7479 struct hwrm_vnic_cfg_input {
7480         uint16_t req_type;
7481         /*
7482          * This value indicates what type of request this is. The format
7483          * for the rest of the command is determined by this field.
7484          */
7485         uint16_t cmpl_ring;
7486         /*
7487          * This value indicates the what completion ring the request
7488          * will be optionally completed on. If the value is -1, then no
7489          * CR completion will be generated. Any other value must be a
7490          * valid CR ring_id value for this function.
7491          */
7492         uint16_t seq_id;
7493         /* This value indicates the command sequence number. */
7494         uint16_t target_id;
7495         /*
7496          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7497          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7498          * - HWRM
7499          */
7500         uint64_t resp_addr;
7501         /*
7502          * This is the host address where the response will be written
7503          * when the request is complete. This area must be 16B aligned
7504          * and must be cleared to zero before the request is made.
7505          */
7506         uint32_t flags;
7507         /*
7508          * When this bit is '1', the VNIC is requested to be the default
7509          * VNIC for the function.
7510          */
7511         #define HWRM_VNIC_CFG_INPUT_FLAGS_DEFAULT       UINT32_C(0x1)
7512         /*
7513          * When this bit is '1', the VNIC is being configured to strip
7514          * VLAN in the RX path. If set to '0', then VLAN stripping is
7515          * disabled on this VNIC.
7516          */
7517         #define HWRM_VNIC_CFG_INPUT_FLAGS_VLAN_STRIP_MODE       UINT32_C(0x2)
7518         /*
7519          * When this bit is '1', the VNIC is being configured to buffer
7520          * receive packets in the hardware until the host posts new
7521          * receive buffers. If set to '0', then bd_stall is being
7522          * configured to be disabled on this VNIC.
7523          */
7524         #define HWRM_VNIC_CFG_INPUT_FLAGS_BD_STALL_MODE UINT32_C(0x4)
7525         /*
7526          * When this bit is '1', the VNIC is being configured to receive
7527          * both RoCE and non-RoCE traffic. If set to '0', then this VNIC
7528          * is not configured to be operating in dual VNIC mode.
7529          */
7530         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_DUAL_VNIC_MODE   UINT32_C(0x8)
7531         /*
7532          * When this flag is set to '1', the VNIC is requested to be
7533          * configured to receive only RoCE traffic. If this flag is set
7534          * to '0', then this flag shall be ignored by the HWRM. If
7535          * roce_dual_vnic_mode flag is set to '1', then the HWRM client
7536          * shall not set this flag to '1'.
7537          */
7538         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_ONLY_VNIC_MODE UINT32_C(0x10)
7539         /*
7540          * When a VNIC uses one destination ring group for certain
7541          * application  (e.g. Receive Flow Steering) where exact match is
7542          * used to direct packets to a VNIC with one destination ring
7543          * group only, there is no need to configure RSS indirection
7544          * table for that VNIC as only one destination ring group is
7545          * used. This flag is used to enable a mode where RSS is enabled
7546          * in the VNIC using a RSS context for computing RSS hash but
7547          * the RSS indirection table is not configured using
7548          * hwrm_vnic_rss_cfg. If this mode is enabled, then the driver
7549          * should not program RSS indirection table for the RSS context
7550          * that is used for computing RSS hash only.
7551          */
7552         #define HWRM_VNIC_CFG_INPUT_FLAGS_RSS_DFLT_CR_MODE      UINT32_C(0x20)
7553         /*
7554          * When this bit is '1', the VNIC is being configured to receive
7555          * both RoCE and non-RoCE traffic, but forward only the RoCE
7556          * traffic further. Also, RoCE traffic can be mirrored to L2
7557          * driver.
7558          */
7559         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_MIRRORING_CAPABLE_VNIC_MODE \
7560         UINT32_C(0x40)
7561         uint32_t enables;
7562         /*
7563          * This bit must be '1' for the dflt_ring_grp field to be
7564          * configured.
7565          */
7566         #define HWRM_VNIC_CFG_INPUT_ENABLES_DFLT_RING_GRP       UINT32_C(0x1)
7567         /* This bit must be '1' for the rss_rule field to be configured. */
7568         #define HWRM_VNIC_CFG_INPUT_ENABLES_RSS_RULE    UINT32_C(0x2)
7569         /* This bit must be '1' for the cos_rule field to be configured. */
7570         #define HWRM_VNIC_CFG_INPUT_ENABLES_COS_RULE    UINT32_C(0x4)
7571         /* This bit must be '1' for the lb_rule field to be configured. */
7572         #define HWRM_VNIC_CFG_INPUT_ENABLES_LB_RULE     UINT32_C(0x8)
7573         /* This bit must be '1' for the mru field to be configured. */
7574         #define HWRM_VNIC_CFG_INPUT_ENABLES_MRU UINT32_C(0x10)
7575         uint16_t vnic_id;
7576         /* Logical vnic ID */
7577         uint16_t dflt_ring_grp;
7578         /*
7579          * Default Completion ring for the VNIC. This ring will be
7580          * chosen if packet does not match any RSS rules and if there is
7581          * no COS rule.
7582          */
7583         uint16_t rss_rule;
7584         /*
7585          * RSS ID for RSS rule/table structure. 0xFF... (All Fs) if
7586          * there is no RSS rule.
7587          */
7588         uint16_t cos_rule;
7589         /*
7590          * RSS ID for COS rule/table structure. 0xFF... (All Fs) if
7591          * there is no COS rule.
7592          */
7593         uint16_t lb_rule;
7594         /*
7595          * RSS ID for load balancing rule/table structure. 0xFF...      (All
7596          * Fs) if there is no LB rule.
7597          */
7598         uint16_t mru;
7599         /*
7600          * The maximum receive unit of the vnic. Each vnic is associated
7601          * with a function. The vnic mru value overwrites the mru
7602          * setting of the associated function. The HWRM shall make sure
7603          * that vnic mru does not exceed the mru of the port the
7604          * function is associated with.
7605          */
7606         uint32_t unused_0;
7607 } __attribute__((packed));
7608
7609 /* Output       (16 bytes) */
7610 struct hwrm_vnic_cfg_output {
7611         uint16_t error_code;
7612         /*
7613          * Pass/Fail or error type Note: receiver to verify the in
7614          * parameters, and fail the call with an error when appropriate
7615          */
7616         uint16_t req_type;
7617         /* This field returns the type of original request. */
7618         uint16_t seq_id;
7619         /* This field provides original sequence number of the command. */
7620         uint16_t resp_len;
7621         /*
7622          * This field is the length of the response in bytes. The last
7623          * byte of the response is a valid flag that will read as '1'
7624          * when the command has been completely written to memory.
7625          */
7626         uint32_t unused_0;
7627         uint8_t unused_1;
7628         uint8_t unused_2;
7629         uint8_t unused_3;
7630         uint8_t valid;
7631         /*
7632          * This field is used in Output records to indicate that the
7633          * output is completely written to RAM. This field should be
7634          * read as '1' to indicate that the output has been completely
7635          * written. When writing a command completion or response to an
7636          * internal processor, the order of writes has to be such that
7637          * this field is written last.
7638          */
7639 } __attribute__((packed));
7640
7641 /* hwrm_vnic_qcfg */
7642 /*
7643  * Description: Query the RX VNIC structure. This function can be used by a PF
7644  * driver to query its own VNIC resource or VNIC resource of its child VF. This
7645  * function can also be used by a VF driver to query its own VNIC resource.
7646  */
7647 /* Input        (32 bytes) */
7648 struct hwrm_vnic_qcfg_input {
7649         uint16_t req_type;
7650         /*
7651          * This value indicates what type of request this is. The format
7652          * for the rest of the command is determined by this field.
7653          */
7654         uint16_t cmpl_ring;
7655         /*
7656          * This value indicates the what completion ring the request
7657          * will be optionally completed on. If the value is -1, then no
7658          * CR completion will be generated. Any other value must be a
7659          * valid CR ring_id value for this function.
7660          */
7661         uint16_t seq_id;
7662         /* This value indicates the command sequence number. */
7663         uint16_t target_id;
7664         /*
7665          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7666          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7667          * - HWRM
7668          */
7669         uint64_t resp_addr;
7670         /*
7671          * This is the host address where the response will be written
7672          * when the request is complete. This area must be 16B aligned
7673          * and must be cleared to zero before the request is made.
7674          */
7675         uint32_t enables;
7676         /* This bit must be '1' for the vf_id_valid field to be configured. */
7677         #define HWRM_VNIC_QCFG_INPUT_ENABLES_VF_ID_VALID        UINT32_C(0x1)
7678         uint32_t vnic_id;
7679         /* Logical vnic ID */
7680         uint16_t vf_id;
7681         /* ID of Virtual Function whose VNIC resource is being queried. */
7682         uint16_t unused_0[3];
7683 } __attribute__((packed));
7684
7685 /* Output       (32 bytes) */
7686 struct hwrm_vnic_qcfg_output {
7687         uint16_t error_code;
7688         /*
7689          * Pass/Fail or error type Note: receiver to verify the in
7690          * parameters, and fail the call with an error when appropriate
7691          */
7692         uint16_t req_type;
7693         /* This field returns the type of original request. */
7694         uint16_t seq_id;
7695         /* This field provides original sequence number of the command. */
7696         uint16_t resp_len;
7697         /*
7698          * This field is the length of the response in bytes. The last
7699          * byte of the response is a valid flag that will read as '1'
7700          * when the command has been completely written to memory.
7701          */
7702         uint16_t dflt_ring_grp;
7703         /* Default Completion ring for the VNIC. */
7704         uint16_t rss_rule;
7705         /*
7706          * RSS ID for RSS rule/table structure. 0xFF... (All Fs) if
7707          * there is no RSS rule.
7708          */
7709         uint16_t cos_rule;
7710         /*
7711          * RSS ID for COS rule/table structure. 0xFF... (All Fs) if
7712          * there is no COS rule.
7713          */
7714         uint16_t lb_rule;
7715         /*
7716          * RSS ID for load balancing rule/table structure. 0xFF...      (All
7717          * Fs) if there is no LB rule.
7718          */
7719         uint16_t mru;
7720         /* The maximum receive unit of the vnic. */
7721         uint8_t unused_0;
7722         uint8_t unused_1;
7723         uint32_t flags;
7724         /*
7725          * When this bit is '1', the VNIC is the default VNIC for the
7726          * function.
7727          */
7728         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_DEFAULT     UINT32_C(0x1)
7729         /*
7730          * When this bit is '1', the VNIC is configured to strip VLAN in
7731          * the RX path. If set to '0', then VLAN stripping is disabled
7732          * on this VNIC.
7733          */
7734         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_VLAN_STRIP_MODE     UINT32_C(0x2)
7735         /*
7736          * When this bit is '1', the VNIC is configured to buffer
7737          * receive packets in the hardware until the host posts new
7738          * receive buffers. If set to '0', then bd_stall is disabled on
7739          * this VNIC.
7740          */
7741         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_BD_STALL_MODE       UINT32_C(0x4)
7742         /*
7743          * When this bit is '1', the VNIC is configured to receive both
7744          * RoCE and non-RoCE traffic. If set to '0', then this VNIC is
7745          * not configured to operate in dual VNIC mode.
7746          */
7747         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_ROCE_DUAL_VNIC_MODE UINT32_C(0x8)
7748         /*
7749          * When this flag is set to '1', the VNIC is configured to
7750          * receive only RoCE traffic. When this flag is set to '0', the
7751          * VNIC is not configured to receive only RoCE traffic. If
7752          * roce_dual_vnic_mode flag and this flag both are set to '1',
7753          * then it is an invalid configuration of the VNIC. The HWRM
7754          * should not allow that type of mis-configuration by HWRM
7755          * clients.
7756          */
7757         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_ROCE_ONLY_VNIC_MODE UINT32_C(0x10)
7758         /*
7759          * When a VNIC uses one destination ring group for certain
7760          * application  (e.g. Receive Flow Steering) where exact match is
7761          * used to direct packets to a VNIC with one destination ring
7762          * group only, there is no need to configure RSS indirection
7763          * table for that VNIC as only one destination ring group is
7764          * used. When this bit is set to '1', then the VNIC is enabled
7765          * in a mode where RSS is enabled in the VNIC using a RSS
7766          * context for computing RSS hash but the RSS indirection table
7767          * is not configured.
7768          */
7769         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_RSS_DFLT_CR_MODE    UINT32_C(0x20)
7770         /*
7771          * When this bit is '1', the VNIC is configured to receive both
7772          * RoCE and non-RoCE traffic, but forward only RoCE traffic
7773          * further. Also RoCE traffic can be mirrored to L2 driver.
7774          */
7775         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_ROCE_MIRRORING_CAPABLE_VNIC_MODE \
7776         UINT32_C(0x40)
7777         uint32_t unused_2;
7778         uint8_t unused_3;
7779         uint8_t unused_4;
7780         uint8_t unused_5;
7781         uint8_t valid;
7782         /*
7783          * This field is used in Output records to indicate that the
7784          * output is completely written to RAM. This field should be
7785          * read as '1' to indicate that the output has been completely
7786          * written. When writing a command completion or response to an
7787          * internal processor, the order of writes has to be such that
7788          * this field is written last.
7789          */
7790 } __attribute__((packed));
7791
7792
7793 /* hwrm_vnic_tpa_cfg */
7794 /* Description: This function is used to enable/configure TPA on the VNIC. */
7795 /* Input        (40 bytes) */
7796 struct hwrm_vnic_tpa_cfg_input {
7797         uint16_t req_type;
7798         /*
7799          * This value indicates what type of request this is. The format
7800          * for the rest of the command is determined by this field.
7801          */
7802         uint16_t cmpl_ring;
7803         /*
7804          * This value indicates the what completion ring the request
7805          * will be optionally completed on. If the value is -1, then no
7806          * CR completion will be generated. Any other value must be a
7807          * valid CR ring_id value for this function.
7808          */
7809         uint16_t seq_id;
7810         /* This value indicates the command sequence number. */
7811         uint16_t target_id;
7812         /*
7813          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7814          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7815          * - HWRM
7816          */
7817         uint64_t resp_addr;
7818         /*
7819          * This is the host address where the response will be written
7820          * when the request is complete. This area must be 16B aligned
7821          * and must be cleared to zero before the request is made.
7822          */
7823         uint32_t flags;
7824         /*
7825          * When this bit is '1', the VNIC shall be configured to perform
7826          * transparent packet aggregation       (TPA) of non-tunneled TCP
7827          * packets.
7828          */
7829         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_TPA       UINT32_C(0x1)
7830         /*
7831          * When this bit is '1', the VNIC shall be configured to perform
7832          * transparent packet aggregation       (TPA) of tunneled TCP packets.
7833          */
7834         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_ENCAP_TPA UINT32_C(0x2)
7835         /*
7836          * When this bit is '1', the VNIC shall be configured to perform
7837          * transparent packet aggregation       (TPA) according to Windows
7838          * Receive Segment Coalescing   (RSC) rules.
7839          */
7840         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_RSC_WND_UPDATE    UINT32_C(0x4)
7841         /*
7842          * When this bit is '1', the VNIC shall be configured to perform
7843          * transparent packet aggregation       (TPA) according to Linux
7844          * Generic Receive Offload      (GRO) rules.
7845          */
7846         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO       UINT32_C(0x8)
7847         /*
7848          * When this bit is '1', the VNIC shall be configured to perform
7849          * transparent packet aggregation       (TPA) for TCP packets with IP
7850          * ECN set to non-zero.
7851          */
7852         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_AGG_WITH_ECN      UINT32_C(0x10)
7853         /*
7854          * When this bit is '1', the VNIC shall be configured to perform
7855          * transparent packet aggregation       (TPA) for GRE tunneled TCP
7856          * packets only if all packets have the same GRE sequence.
7857          */
7858         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_AGG_WITH_SAME_GRE_SEQ     \
7859                 UINT32_C(0x20)
7860         /*
7861          * When this bit is '1' and the GRO mode is enabled, the VNIC
7862          * shall be configured to perform transparent packet aggregation
7863          *      (TPA) for TCP/IPv4 packets with consecutively increasing
7864          * IPIDs. In other words, the last packet that is being
7865          * aggregated to an already existing aggregation context shall
7866          * have IPID 1 more than the IPID of the last packet that was
7867          * aggregated in that aggregation context.
7868          */
7869         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO_IPID_CHECK    UINT32_C(0x40)
7870         /*
7871          * When this bit is '1' and the GRO mode is enabled, the VNIC
7872          * shall be configured to perform transparent packet aggregation
7873          *      (TPA) for TCP packets with the same TTL (IPv4) or Hop limit
7874          *      (IPv6) value.
7875          */
7876         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO_TTL_CHECK     UINT32_C(0x80)
7877         uint32_t enables;
7878         /* This bit must be '1' for the max_agg_segs field to be configured. */
7879         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGG_SEGS    UINT32_C(0x1)
7880         /* This bit must be '1' for the max_aggs field to be configured. */
7881         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGGS        UINT32_C(0x2)
7882         /*
7883          * This bit must be '1' for the max_agg_timer field to be
7884          * configured.
7885          */
7886         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGG_TIMER   UINT32_C(0x4)
7887         /* This bit must be '1' for the min_agg_len field to be configured. */
7888         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MIN_AGG_LEN     UINT32_C(0x8)
7889         uint16_t vnic_id;
7890         /* Logical vnic ID */
7891         uint16_t max_agg_segs;
7892         /*
7893          * This is the maximum number of TCP segments that can be
7894          * aggregated   (unit is Log2). Max value is 31.
7895          */
7896         /* 1 segment */
7897         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_1  UINT32_C(0x0)
7898         /* 2 segments */
7899         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_2  UINT32_C(0x1)
7900         /* 4 segments */
7901         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_4  UINT32_C(0x2)
7902         /* 8 segments */
7903         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_8  UINT32_C(0x3)
7904         /* Any segment size larger than this is not valid */
7905         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_MAX        UINT32_C(0x1f)
7906         uint16_t max_aggs;
7907         /*
7908          * This is the maximum number of aggregations this VNIC is
7909          * allowed      (unit is Log2). Max value is 7
7910          */
7911         /* 1 aggregation */
7912         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_1      UINT32_C(0x0)
7913         /* 2 aggregations */
7914         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_2      UINT32_C(0x1)
7915         /* 4 aggregations */
7916         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_4      UINT32_C(0x2)
7917         /* 8 aggregations */
7918         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_8      UINT32_C(0x3)
7919         /* 16 aggregations */
7920         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_16     UINT32_C(0x4)
7921         /* Any aggregation size larger than this is not valid */
7922         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_MAX    UINT32_C(0x7)
7923         uint8_t unused_0;
7924         uint8_t unused_1;
7925         uint32_t max_agg_timer;
7926         /*
7927          * This is the maximum amount of time allowed for an aggregation
7928          * context to complete after it was initiated.
7929          */
7930         uint32_t min_agg_len;
7931         /*
7932          * This is the minimum amount of payload length required to
7933          * start an aggregation context.
7934          */
7935 } __attribute__((packed));
7936
7937 /* Output       (16 bytes) */
7938 struct hwrm_vnic_tpa_cfg_output {
7939         uint16_t error_code;
7940         /*
7941          * Pass/Fail or error type Note: receiver to verify the in
7942          * parameters, and fail the call with an error when appropriate
7943          */
7944         uint16_t req_type;
7945         /* This field returns the type of original request. */
7946         uint16_t seq_id;
7947         /* This field provides original sequence number of the command. */
7948         uint16_t resp_len;
7949         /*
7950          * This field is the length of the response in bytes. The last
7951          * byte of the response is a valid flag that will read as '1'
7952          * when the command has been completely written to memory.
7953          */
7954         uint32_t unused_0;
7955         uint8_t unused_1;
7956         uint8_t unused_2;
7957         uint8_t unused_3;
7958         uint8_t valid;
7959         /*
7960          * This field is used in Output records to indicate that the
7961          * output is completely written to RAM. This field should be
7962          * read as '1' to indicate that the output has been completely
7963          * written. When writing a command completion or response to an
7964          * internal processor, the order of writes has to be such that
7965          * this field is written last.
7966          */
7967 } __attribute__((packed));
7968
7969 /* hwrm_vnic_rss_cfg */
7970 /* Description: This function is used to enable RSS configuration. */
7971 /* Input        (48 bytes) */
7972 struct hwrm_vnic_rss_cfg_input {
7973         uint16_t req_type;
7974         /*
7975          * This value indicates what type of request this is. The format
7976          * for the rest of the command is determined by this field.
7977          */
7978         uint16_t cmpl_ring;
7979         /*
7980          * This value indicates the what completion ring the request
7981          * will be optionally completed on. If the value is -1, then no
7982          * CR completion will be generated. Any other value must be a
7983          * valid CR ring_id value for this function.
7984          */
7985         uint16_t seq_id;
7986         /* This value indicates the command sequence number. */
7987         uint16_t target_id;
7988         /*
7989          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7990          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7991          * - HWRM
7992          */
7993         uint64_t resp_addr;
7994         /*
7995          * This is the host address where the response will be written
7996          * when the request is complete. This area must be 16B aligned
7997          * and must be cleared to zero before the request is made.
7998          */
7999         uint32_t hash_type;
8000         /*
8001          * When this bit is '1', the RSS hash shall be computed over
8002          * source and destination IPv4 addresses of IPv4 packets.
8003          */
8004         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4  UINT32_C(0x1)
8005         /*
8006          * When this bit is '1', the RSS hash shall be computed over
8007          * source/destination IPv4 addresses and source/destination
8008          * ports of TCP/IPv4 packets.
8009          */
8010         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV4      UINT32_C(0x2)
8011         /*
8012          * When this bit is '1', the RSS hash shall be computed over
8013          * source/destination IPv4 addresses and source/destination
8014          * ports of UDP/IPv4 packets.
8015          */
8016         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV4      UINT32_C(0x4)
8017         /*
8018          * When this bit is '1', the RSS hash shall be computed over
8019          * source and destination IPv4 addresses of IPv6 packets.
8020          */
8021         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV6  UINT32_C(0x8)
8022         /*
8023          * When this bit is '1', the RSS hash shall be computed over
8024          * source/destination IPv6 addresses and source/destination
8025          * ports of TCP/IPv6 packets.
8026          */
8027         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV6      UINT32_C(0x10)
8028         /*
8029          * When this bit is '1', the RSS hash shall be computed over
8030          * source/destination IPv6 addresses and source/destination
8031          * ports of UDP/IPv6 packets.
8032          */
8033         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV6      UINT32_C(0x20)
8034         uint32_t unused_0;
8035         uint64_t ring_grp_tbl_addr;
8036         /* This is the address for rss ring group table */
8037         uint64_t hash_key_tbl_addr;
8038         /* This is the address for rss hash key table */
8039         uint16_t rss_ctx_idx;
8040         /* Index to the rss indirection table. */
8041         uint16_t unused_1[3];
8042 } __attribute__((packed));
8043
8044 /* Output       (16 bytes) */
8045 struct hwrm_vnic_rss_cfg_output {
8046         uint16_t error_code;
8047         /*
8048          * Pass/Fail or error type Note: receiver to verify the in
8049          * parameters, and fail the call with an error when appropriate
8050          */
8051         uint16_t req_type;
8052         /* This field returns the type of original request. */
8053         uint16_t seq_id;
8054         /* This field provides original sequence number of the command. */
8055         uint16_t resp_len;
8056         /*
8057          * This field is the length of the response in bytes. The last
8058          * byte of the response is a valid flag that will read as '1'
8059          * when the command has been completely written to memory.
8060          */
8061         uint32_t unused_0;
8062         uint8_t unused_1;
8063         uint8_t unused_2;
8064         uint8_t unused_3;
8065         uint8_t valid;
8066         /*
8067          * This field is used in Output records to indicate that the
8068          * output is completely written to RAM. This field should be
8069          * read as '1' to indicate that the output has been completely
8070          * written. When writing a command completion or response to an
8071          * internal processor, the order of writes has to be such that
8072          * this field is written last.
8073          */
8074 } __attribute__((packed));
8075
8076 /* hwrm_vnic_plcmodes_cfg */
8077 /*
8078  * Description: This function can be used to set placement mode configuration of
8079  * the VNIC.
8080  */
8081 /* Input (40 bytes) */
8082 struct hwrm_vnic_plcmodes_cfg_input {
8083         uint16_t req_type;
8084         /*
8085          * This value indicates what type of request this is. The format for the
8086          * rest of the command is determined by this field.
8087          */
8088         uint16_t cmpl_ring;
8089         /*
8090          * This value indicates the what completion ring the request will be
8091          * optionally completed on. If the value is -1, then no CR completion
8092          * will be generated. Any other value must be a valid CR ring_id value
8093          * for this function.
8094          */
8095         uint16_t seq_id;
8096         /* This value indicates the command sequence number. */
8097         uint16_t target_id;
8098         /*
8099          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
8100          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
8101          */
8102         uint64_t resp_addr;
8103         /*
8104          * This is the host address where the response will be written when the
8105          * request is complete. This area must be 16B aligned and must be
8106          * cleared to zero before the request is made.
8107          */
8108         uint32_t flags;
8109         /*
8110          * When this bit is '1', the VNIC shall be configured to use regular
8111          * placement algorithm. By default, the regular placement algorithm
8112          * shall be enabled on the VNIC.
8113          */
8114         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_REGULAR_PLACEMENT \
8115                 UINT32_C(0x1)
8116         /*
8117          * When this bit is '1', the VNIC shall be configured use the jumbo
8118          * placement algorithm.
8119          */
8120         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_JUMBO_PLACEMENT \
8121                 UINT32_C(0x2)
8122         /*
8123          * When this bit is '1', the VNIC shall be configured to enable Header-
8124          * Data split for IPv4 packets according to the following rules: # If
8125          * the packet is identified as TCP/IPv4, then the packet is split at the
8126          * beginning of the TCP payload. # If the packet is identified as
8127          * UDP/IPv4, then the packet is split at the beginning of UDP payload. #
8128          * If the packet is identified as non-TCP and non-UDP IPv4 packet, then
8129          * the packet is split at the beginning of the upper layer protocol
8130          * header carried in the IPv4 packet.
8131          */
8132         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV4        UINT32_C(0x4)
8133         /*
8134          * When this bit is '1', the VNIC shall be configured to enable Header-
8135          * Data split for IPv6 packets according to the following rules: # If
8136          * the packet is identified as TCP/IPv6, then the packet is split at the
8137          * beginning of the TCP payload. # If the packet is identified as
8138          * UDP/IPv6, then the packet is split at the beginning of UDP payload. #
8139          * If the packet is identified as non-TCP and non-UDP IPv6 packet, then
8140          * the packet is split at the beginning of the upper layer protocol
8141          * header carried in the IPv6 packet.
8142          */
8143         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV6        UINT32_C(0x8)
8144         /*
8145          * When this bit is '1', the VNIC shall be configured to enable Header-
8146          * Data split for FCoE packets at the beginning of FC payload.
8147          */
8148         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_FCOE       UINT32_C(0x10)
8149         /*
8150          * When this bit is '1', the VNIC shall be configured to enable Header-
8151          * Data split for RoCE packets at the beginning of RoCE payload (after
8152          * BTH/GRH headers).
8153          */
8154         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_ROCE       UINT32_C(0x20)
8155         uint32_t enables;
8156         /*
8157          * This bit must be '1' for the jumbo_thresh_valid field to be
8158          * configured.
8159          */
8160         #define HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_JUMBO_THRESH_VALID \
8161                 UINT32_C(0x1)
8162         /*
8163          * This bit must be '1' for the hds_offset_valid field to be configured.
8164          */
8165         #define HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_HDS_OFFSET_VALID \
8166                 UINT32_C(0x2)
8167         /*
8168          * This bit must be '1' for the hds_threshold_valid field to be
8169          * configured.
8170          */
8171         #define HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_HDS_THRESHOLD_VALID \
8172                 UINT32_C(0x4)
8173         uint32_t vnic_id;
8174         /* Logical vnic ID */
8175         uint16_t jumbo_thresh;
8176         /*
8177          * When jumbo placement algorithm is enabled, this value is used to
8178          * determine the threshold for jumbo placement. Packets with length
8179          * larger than this value will be placed according to the jumbo
8180          * placement algorithm.
8181          */
8182         uint16_t hds_offset;
8183         /*
8184          * This value is used to determine the offset into packet buffer where
8185          * the split data (payload) will be placed according to one of of HDS
8186          * placement algorithm. The lengths of packet buffers provided for split
8187          * data shall be larger than this value.
8188          */
8189         uint16_t hds_threshold;
8190         /*
8191          * When one of the HDS placement algorithm is enabled, this value is
8192          * used to determine the threshold for HDS placement. Packets with
8193          * length larger than this value will be placed according to the HDS
8194          * placement algorithm. This value shall be in multiple of 4 bytes.
8195          */
8196         uint16_t unused_0[3];
8197 } __attribute__((packed));
8198
8199 /* Output (16 bytes) */
8200 struct hwrm_vnic_plcmodes_cfg_output {
8201         uint16_t error_code;
8202         /*
8203          * Pass/Fail or error type Note: receiver to verify the in parameters,
8204          * and fail the call with an error when appropriate
8205          */
8206         uint16_t req_type;
8207         /* This field returns the type of original request. */
8208         uint16_t seq_id;
8209         /* This field provides original sequence number of the command. */
8210         uint16_t resp_len;
8211         /*
8212          * This field is the length of the response in bytes. The last byte of
8213          * the response is a valid flag that will read as '1' when the command
8214          * has been completely written to memory.
8215          */
8216         uint32_t unused_0;
8217         uint8_t unused_1;
8218         uint8_t unused_2;
8219         uint8_t unused_3;
8220         uint8_t valid;
8221         /*
8222          * This field is used in Output records to indicate that the output is
8223          * completely written to RAM. This field should be read as '1' to
8224          * indicate that the output has been completely written. When writing a
8225          * command completion or response to an internal processor, the order of
8226          * writes has to be such that this field is written last.
8227          */
8228 } __attribute__((packed));
8229
8230 /* hwrm_vnic_plcmodes_qcfg */
8231 /*
8232  * Description: This function can be used to query placement mode configuration
8233  * of the VNIC.
8234  */
8235 /* Input (24 bytes) */
8236 struct hwrm_vnic_plcmodes_qcfg_input {
8237         uint16_t req_type;
8238         /*
8239          * This value indicates what type of request this is. The format for the
8240          * rest of the command is determined by this field.
8241          */
8242         uint16_t cmpl_ring;
8243         /*
8244          * This value indicates the what completion ring the request will be
8245          * optionally completed on. If the value is -1, then no CR completion
8246          * will be generated. Any other value must be a valid CR ring_id value
8247          * for this function.
8248          */
8249         uint16_t seq_id;
8250         /* This value indicates the command sequence number. */
8251         uint16_t target_id;
8252         /*
8253          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
8254          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
8255          */
8256         uint64_t resp_addr;
8257         /*
8258          * This is the host address where the response will be written when the
8259          * request is complete. This area must be 16B aligned and must be
8260          * cleared to zero before the request is made.
8261          */
8262         uint32_t vnic_id;
8263         /* Logical vnic ID */
8264         uint32_t unused_0;
8265 } __attribute__((packed));
8266
8267 /* Output (24 bytes) */
8268 struct hwrm_vnic_plcmodes_qcfg_output {
8269         uint16_t error_code;
8270         /*
8271          * Pass/Fail or error type Note: receiver to verify the in parameters,
8272          * and fail the call with an error when appropriate
8273          */
8274         uint16_t req_type;
8275         /* This field returns the type of original request. */
8276         uint16_t seq_id;
8277         /* This field provides original sequence number of the command. */
8278         uint16_t resp_len;
8279         /*
8280          * This field is the length of the response in bytes. The last byte of
8281          * the response is a valid flag that will read as '1' when the command
8282          * has been completely written to memory.
8283          */
8284         uint32_t flags;
8285         /*
8286          * When this bit is '1', the VNIC is configured to use regular placement
8287          * algorithm.
8288          */
8289         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_REGULAR_PLACEMENT \
8290                 UINT32_C(0x1)
8291         /*
8292          * When this bit is '1', the VNIC is configured to use the jumbo
8293          * placement algorithm.
8294          */
8295         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_JUMBO_PLACEMENT \
8296                 UINT32_C(0x2)
8297         /*
8298          * When this bit is '1', the VNIC is configured to enable Header-Data
8299          * split for IPv4 packets.
8300          */
8301         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_IPV4      UINT32_C(0x4)
8302         /*
8303          * When this bit is '1', the VNIC is configured to enable Header-Data
8304          * split for IPv6 packets.
8305          */
8306         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_IPV6      UINT32_C(0x8)
8307         /*
8308          * When this bit is '1', the VNIC is configured to enable Header-Data
8309          * split for FCoE packets.
8310          */
8311         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_FCOE     UINT32_C(0x10)
8312         /*
8313          * When this bit is '1', the VNIC is configured to enable Header-Data
8314          * split for RoCE packets.
8315          */
8316         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_ROCE     UINT32_C(0x20)
8317         /*
8318          * When this bit is '1', the VNIC is configured to be the default VNIC
8319          * of the requesting function.
8320          */
8321         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_DFLT_VNIC    UINT32_C(0x40)
8322         uint16_t jumbo_thresh;
8323         /*
8324          * When jumbo placement algorithm is enabled, this value is used to
8325          * determine the threshold for jumbo placement. Packets with length
8326          * larger than this value will be placed according to the jumbo
8327          * placement algorithm.
8328          */
8329         uint16_t hds_offset;
8330         /*
8331          * This value is used to determine the offset into packet buffer where
8332          * the split data (payload) will be placed according to one of of HDS
8333          * placement algorithm. The lengths of packet buffers provided for split
8334          * data shall be larger than this value.
8335          */
8336         uint16_t hds_threshold;
8337         /*
8338          * When one of the HDS placement algorithm is enabled, this value is
8339          * used to determine the threshold for HDS placement. Packets with
8340          * length larger than this value will be placed according to the HDS
8341          * placement algorithm. This value shall be in multiple of 4 bytes.
8342          */
8343         uint8_t unused_0;
8344         uint8_t unused_1;
8345         uint8_t unused_2;
8346         uint8_t unused_3;
8347         uint8_t unused_4;
8348         uint8_t valid;
8349         /*
8350          * This field is used in Output records to indicate that the output is
8351          * completely written to RAM. This field should be read as '1' to
8352          * indicate that the output has been completely written. When writing a
8353          * command completion or response to an internal processor, the order of
8354          * writes has to be such that this field is written last.
8355          */
8356 } __attribute__((packed));
8357
8358 /* hwrm_vnic_rss_cos_lb_ctx_alloc */
8359 /* Description: This function is used to allocate COS/Load Balance context. */
8360 /* Input        (16 bytes) */
8361 struct hwrm_vnic_rss_cos_lb_ctx_alloc_input {
8362         uint16_t req_type;
8363         /*
8364          * This value indicates what type of request this is. The format
8365          * for the rest of the command is determined by this field.
8366          */
8367         uint16_t cmpl_ring;
8368         /*
8369          * This value indicates the what completion ring the request
8370          * will be optionally completed on. If the value is -1, then no
8371          * CR completion will be generated. Any other value must be a
8372          * valid CR ring_id value for this function.
8373          */
8374         uint16_t seq_id;
8375         /* This value indicates the command sequence number. */
8376         uint16_t target_id;
8377         /*
8378          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8379          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8380          * - HWRM
8381          */
8382         uint64_t resp_addr;
8383         /*
8384          * This is the host address where the response will be written
8385          * when the request is complete. This area must be 16B aligned
8386          * and must be cleared to zero before the request is made.
8387          */
8388 } __attribute__((packed));
8389
8390 /* Output       (16 bytes) */
8391 struct hwrm_vnic_rss_cos_lb_ctx_alloc_output {
8392         uint16_t error_code;
8393         /*
8394          * Pass/Fail or error type Note: receiver to verify the in
8395          * parameters, and fail the call with an error when appropriate
8396          */
8397         uint16_t req_type;
8398         /* This field returns the type of original request. */
8399         uint16_t seq_id;
8400         /* This field provides original sequence number of the command. */
8401         uint16_t resp_len;
8402         /*
8403          * This field is the length of the response in bytes. The last
8404          * byte of the response is a valid flag that will read as '1'
8405          * when the command has been completely written to memory.
8406          */
8407         uint16_t rss_cos_lb_ctx_id;
8408         /* rss_cos_lb_ctx_id is 16 b */
8409         uint8_t unused_0;
8410         uint8_t unused_1;
8411         uint8_t unused_2;
8412         uint8_t unused_3;
8413         uint8_t unused_4;
8414         uint8_t valid;
8415         /*
8416          * This field is used in Output records to indicate that the
8417          * output is completely written to RAM. This field should be
8418          * read as '1' to indicate that the output has been completely
8419          * written. When writing a command completion or response to an
8420          * internal processor, the order of writes has to be such that
8421          * this field is written last.
8422          */
8423 } __attribute__((packed));
8424
8425 /* hwrm_vnic_rss_cos_lb_ctx_free */
8426 /* Description: This function can be used to free COS/Load Balance context. */
8427 /* Input        (24 bytes) */
8428 struct hwrm_vnic_rss_cos_lb_ctx_free_input {
8429         uint16_t req_type;
8430         /*
8431          * This value indicates what type of request this is. The format
8432          * for the rest of the command is determined by this field.
8433          */
8434         uint16_t cmpl_ring;
8435         /*
8436          * This value indicates the what completion ring the request
8437          * will be optionally completed on. If the value is -1, then no
8438          * CR completion will be generated. Any other value must be a
8439          * valid CR ring_id value for this function.
8440          */
8441         uint16_t seq_id;
8442         /* This value indicates the command sequence number. */
8443         uint16_t target_id;
8444         /*
8445          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8446          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8447          * - HWRM
8448          */
8449         uint64_t resp_addr;
8450         /*
8451          * This is the host address where the response will be written
8452          * when the request is complete. This area must be 16B aligned
8453          * and must be cleared to zero before the request is made.
8454          */
8455         uint16_t rss_cos_lb_ctx_id;
8456         /* rss_cos_lb_ctx_id is 16 b */
8457         uint16_t unused_0[3];
8458 } __attribute__((packed));
8459
8460 /* Output       (16 bytes) */
8461 struct hwrm_vnic_rss_cos_lb_ctx_free_output {
8462         uint16_t error_code;
8463         /*
8464          * Pass/Fail or error type Note: receiver to verify the in
8465          * parameters, and fail the call with an error when appropriate
8466          */
8467         uint16_t req_type;
8468         /* This field returns the type of original request. */
8469         uint16_t seq_id;
8470         /* This field provides original sequence number of the command. */
8471         uint16_t resp_len;
8472         /*
8473          * This field is the length of the response in bytes. The last
8474          * byte of the response is a valid flag that will read as '1'
8475          * when the command has been completely written to memory.
8476          */
8477         uint32_t unused_0;
8478         uint8_t unused_1;
8479         uint8_t unused_2;
8480         uint8_t unused_3;
8481         uint8_t valid;
8482         /*
8483          * This field is used in Output records to indicate that the
8484          * output is completely written to RAM. This field should be
8485          * read as '1' to indicate that the output has been completely
8486          * written. When writing a command completion or response to an
8487          * internal processor, the order of writes has to be such that
8488          * this field is written last.
8489          */
8490 } __attribute__((packed));
8491
8492 /* hwrm_ring_alloc */
8493 /*
8494  * Description: This command allocates and does basic preparation for a ring.
8495  */
8496 /* Input        (80 bytes) */
8497 struct hwrm_ring_alloc_input {
8498         uint16_t req_type;
8499         /*
8500          * This value indicates what type of request this is. The format
8501          * for the rest of the command is determined by this field.
8502          */
8503         uint16_t cmpl_ring;
8504         /*
8505          * This value indicates the what completion ring the request
8506          * will be optionally completed on. If the value is -1, then no
8507          * CR completion will be generated. Any other value must be a
8508          * valid CR ring_id value for this function.
8509          */
8510         uint16_t seq_id;
8511         /* This value indicates the command sequence number. */
8512         uint16_t target_id;
8513         /*
8514          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8515          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8516          * - HWRM
8517          */
8518         uint64_t resp_addr;
8519         /*
8520          * This is the host address where the response will be written
8521          * when the request is complete. This area must be 16B aligned
8522          * and must be cleared to zero before the request is made.
8523          */
8524         uint32_t enables;
8525         /* This bit must be '1' for the Reserved1 field to be configured. */
8526         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED1 UINT32_C(0x1)
8527         /* This bit must be '1' for the ring_arb_cfg field to be configured. */
8528         #define HWRM_RING_ALLOC_INPUT_ENABLES_RING_ARB_CFG      UINT32_C(0x2)
8529         /* This bit must be '1' for the Reserved3 field to be configured. */
8530         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED3 UINT32_C(0x4)
8531         /*
8532          * This bit must be '1' for the stat_ctx_id_valid field to be
8533          * configured.
8534          */
8535         #define HWRM_RING_ALLOC_INPUT_ENABLES_STAT_CTX_ID_VALID UINT32_C(0x8)
8536         /* This bit must be '1' for the Reserved4 field to be configured. */
8537         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED4 UINT32_C(0x10)
8538         /* This bit must be '1' for the max_bw_valid field to be configured. */
8539         #define HWRM_RING_ALLOC_INPUT_ENABLES_MAX_BW_VALID      UINT32_C(0x20)
8540         uint8_t ring_type;
8541         /* Ring Type. */
8542         /* L2 Completion Ring   (CR) */
8543         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL UINT32_C(0x0)
8544         /* TX Ring      (TR) */
8545         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_TX      UINT32_C(0x1)
8546         /* RX Ring      (RR) */
8547         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_RX      UINT32_C(0x2)
8548         /* RoCE Notification Completion Ring    (ROCE_CR) */
8549         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_ROCE_CMPL       UINT32_C(0x3)
8550         uint8_t unused_0;
8551         uint16_t unused_1;
8552         uint64_t page_tbl_addr;
8553         /* This value is a pointer to the page table for the Ring. */
8554         uint32_t fbo;
8555         /* First Byte Offset of the first entry in the first page. */
8556         uint8_t page_size;
8557         /*
8558          * Actual page size in 2^page_size. The supported range is
8559          * increments in powers of 2 from 16 bytes to 1GB. - 4 = 16 B
8560          * Page size is 16 B. - 12 = 4 KB Page size is 4 KB. - 13 = 8 KB
8561          * Page size is 8 KB. - 16 = 64 KB Page size is 64 KB. - 21 = 2
8562          * MB Page size is 2 MB. - 22 = 4 MB Page size is 4 MB. - 30 = 1
8563          * GB Page size is 1 GB.
8564          */
8565         uint8_t page_tbl_depth;
8566         /*
8567          * This value indicates the depth of page table. For this
8568          * version of the specification, value other than 0 or 1 shall
8569          * be considered as an invalid value. When the page_tbl_depth =
8570          * 0, then it is treated as a special case with the following.
8571          * 1. FBO and page size fields are not valid. 2. page_tbl_addr
8572          * is the physical address of the first element of the ring.
8573          */
8574         uint8_t unused_2;
8575         uint8_t unused_3;
8576         uint32_t length;
8577         /*
8578          * Number of 16B units in the ring. Minimum size for a ring is
8579          * 16 16B entries.
8580          */
8581         uint16_t logical_id;
8582         /*
8583          * Logical ring number for the ring to be allocated. This value
8584          * determines the position in the doorbell area where the update
8585          * to the ring will be made. For completion rings, this value is
8586          * also the MSI-X vector number for the function the completion
8587          * ring is associated with.
8588          */
8589         uint16_t cmpl_ring_id;
8590         /*
8591          * This field is used only when ring_type is a TX ring. This
8592          * value indicates what completion ring the TX ring is
8593          * associated with.
8594          */
8595         uint16_t queue_id;
8596         /*
8597          * This field is used only when ring_type is a TX ring. This
8598          * value indicates what CoS queue the TX ring is associated
8599          * with.
8600          */
8601         uint8_t unused_4;
8602         uint8_t unused_5;
8603         uint32_t reserved1;
8604         /* This field is reserved for the future use. It shall be set to 0. */
8605         uint16_t ring_arb_cfg;
8606         /*
8607          * This field is used only when ring_type is a TX ring. This
8608          * field is used to configure arbitration related parameters for
8609          * a TX ring.
8610          */
8611         /* Arbitration policy used for the ring. */
8612         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_MASK UINT32_C(0xf)
8613         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_SFT       0
8614         /*
8615          * Use strict priority for the TX ring. Priority
8616          * value is specified in arb_policy_param
8617          */
8618         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_SP \
8619                 (UINT32_C(0x1) << 0)
8620         /*
8621          * Use weighted fair queue arbitration for the
8622          * TX ring. Weight is specified in
8623          * arb_policy_param
8624          */
8625         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_WFQ \
8626                 (UINT32_C(0x2) << 0)
8627         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_LAST \
8628                 RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_WFQ
8629         /* Reserved field. */
8630         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_RSVD_MASK    UINT32_C(0xf0)
8631         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_RSVD_SFT     4
8632         /*
8633          * Arbitration policy specific parameter. # For strict priority
8634          * arbitration policy, this field represents a priority value.
8635          * If set to 0, then the priority is not specified and the HWRM
8636          * is allowed to select any priority for this TX ring. # For
8637          * weighted fair queue arbitration policy, this field represents
8638          * a weight value. If set to 0, then the weight is not specified
8639          * and the HWRM is allowed to select any weight for this TX
8640          * ring.
8641          */
8642         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_PARAM_MASK  \
8643                 UINT32_C(0xff00)
8644         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_PARAM_SFT 8
8645         uint8_t unused_6;
8646         uint8_t unused_7;
8647         uint32_t reserved3;
8648         /* This field is reserved for the future use. It shall be set to 0. */
8649         uint32_t stat_ctx_id;
8650         /*
8651          * This field is used only when ring_type is a TX ring. This
8652          * input indicates what statistics context this ring should be
8653          * associated with.
8654          */
8655         uint32_t reserved4;
8656         /* This field is reserved for the future use. It shall be set to 0. */
8657         uint32_t max_bw;
8658         /*
8659          * This field is used only when ring_type is a TX ring to
8660          * specify maximum BW allocated to the TX ring. The HWRM will
8661          * translate this value into byte counter and time interval used
8662          * for this ring inside the device.
8663          */
8664         /* The bandwidth value. */
8665         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_MASK UINT32_C(0xfffffff)
8666         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_SFT       0
8667         /* The granularity of the value (bits or bytes). */
8668         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE      UINT32_C(0x10000000)
8669         /* Value is in bits. */
8670         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE_BITS (UINT32_C(0x0) << 28)
8671         /* Value is in bytes. */
8672         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE_BYTES (UINT32_C(0x1) << 28)
8673         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE_LAST \
8674                 RING_ALLOC_INPUT_MAX_BW_SCALE_BYTES
8675         /* bw_value_unit is 3 b */
8676         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_MASK \
8677                 UINT32_C(0xe0000000)
8678         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_SFT  29
8679         /* Value is in Mb or MB (base 10). */
8680         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_MEGA \
8681                 (UINT32_C(0x0) << 29)
8682         /* Value is in Kb or KB (base 10). */
8683         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_KILO \
8684                 (UINT32_C(0x2) << 29)
8685         /* Value is in bits or bytes. */
8686         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_BASE \
8687                 (UINT32_C(0x4) << 29)
8688         /* Value is in Gb or GB (base 10). */
8689         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_GIGA \
8690                 (UINT32_C(0x6) << 29)
8691         /* Value is in 1/100th of a percentage of total bandwidth. */
8692         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_PERCENT1_100 \
8693                 (UINT32_C(0x1) << 29)
8694         /* Invalid unit */
8695         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_INVALID \
8696                 (UINT32_C(0x7) << 29)
8697         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_LAST \
8698                 RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_INVALID
8699         uint8_t int_mode;
8700         /*
8701          * This field is used only when ring_type is a Completion ring.
8702          * This value indicates what interrupt mode should be used on
8703          * this completion ring. Note: In the legacy interrupt mode, no
8704          * more than 16 completion rings are allowed.
8705          */
8706         /* Legacy INTA */
8707         #define HWRM_RING_ALLOC_INPUT_INT_MODE_LEGACY   UINT32_C(0x0)
8708         /* Reserved */
8709         #define HWRM_RING_ALLOC_INPUT_INT_MODE_RSVD     UINT32_C(0x1)
8710         /* MSI-X */
8711         #define HWRM_RING_ALLOC_INPUT_INT_MODE_MSIX     UINT32_C(0x2)
8712         /* No Interrupt - Polled mode */
8713         #define HWRM_RING_ALLOC_INPUT_INT_MODE_POLL     UINT32_C(0x3)
8714         uint8_t unused_8[3];
8715 } __attribute__((packed));
8716
8717 /* Output       (16 bytes) */
8718 struct hwrm_ring_alloc_output {
8719         uint16_t error_code;
8720         /*
8721          * Pass/Fail or error type Note: receiver to verify the in
8722          * parameters, and fail the call with an error when appropriate
8723          */
8724         uint16_t req_type;
8725         /* This field returns the type of original request. */
8726         uint16_t seq_id;
8727         /* This field provides original sequence number of the command. */
8728         uint16_t resp_len;
8729         /*
8730          * This field is the length of the response in bytes. The last
8731          * byte of the response is a valid flag that will read as '1'
8732          * when the command has been completely written to memory.
8733          */
8734         uint16_t ring_id;
8735         /*
8736          * Physical number of ring allocated. This value shall be unique
8737          * for a ring type.
8738          */
8739         uint16_t logical_ring_id;
8740         /* Logical number of ring allocated. */
8741         uint8_t unused_0;
8742         uint8_t unused_1;
8743         uint8_t unused_2;
8744         uint8_t valid;
8745         /*
8746          * This field is used in Output records to indicate that the
8747          * output is completely written to RAM. This field should be
8748          * read as '1' to indicate that the output has been completely
8749          * written. When writing a command completion or response to an
8750          * internal processor, the order of writes has to be such that
8751          * this field is written last.
8752          */
8753 } __attribute__((packed));
8754
8755 /* hwrm_ring_free */
8756 /*
8757  * Description: This command is used to free a ring and associated resources.
8758  * With QoS and DCBx agents, it is possible the traffic classes will be moved
8759  * from one CoS queue to another. When this occurs, the driver shall call
8760  * 'hwrm_ring_free' to free the allocated rings and then call 'hwrm_ring_alloc'
8761  * to re-allocate each ring and assign it to a new CoS queue. hwrm_ring_free
8762  * shall be called on a ring only after it has been idle for 500ms or more and
8763  * no frames have been posted to the ring during this time. All frames queued
8764  * for transmission shall be completed and at least 500ms time elapsed from the
8765  * last completion before calling this command.
8766  */
8767 /* Input        (24 bytes) */
8768 struct hwrm_ring_free_input {
8769         uint16_t req_type;
8770         /*
8771          * This value indicates what type of request this is. The format
8772          * for the rest of the command is determined by this field.
8773          */
8774         uint16_t cmpl_ring;
8775         /*
8776          * This value indicates the what completion ring the request
8777          * will be optionally completed on. If the value is -1, then no
8778          * CR completion will be generated. Any other value must be a
8779          * valid CR ring_id value for this function.
8780          */
8781         uint16_t seq_id;
8782         /* This value indicates the command sequence number. */
8783         uint16_t target_id;
8784         /*
8785          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8786          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8787          * - HWRM
8788          */
8789         uint64_t resp_addr;
8790         /*
8791          * This is the host address where the response will be written
8792          * when the request is complete. This area must be 16B aligned
8793          * and must be cleared to zero before the request is made.
8794          */
8795         uint8_t ring_type;
8796         /* Ring Type. */
8797         /* L2 Completion Ring   (CR) */
8798         #define HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL  UINT32_C(0x0)
8799         /* TX Ring      (TR) */
8800         #define HWRM_RING_FREE_INPUT_RING_TYPE_TX       UINT32_C(0x1)
8801         /* RX Ring      (RR) */
8802         #define HWRM_RING_FREE_INPUT_RING_TYPE_RX       UINT32_C(0x2)
8803         /* RoCE Notification Completion Ring    (ROCE_CR) */
8804         #define HWRM_RING_FREE_INPUT_RING_TYPE_ROCE_CMPL        UINT32_C(0x3)
8805         uint8_t unused_0;
8806         uint16_t ring_id;
8807         /* Physical number of ring allocated. */
8808         uint32_t unused_1;
8809 } __attribute__((packed));
8810
8811 /* Output       (16 bytes) */
8812 struct hwrm_ring_free_output {
8813         uint16_t error_code;
8814         /*
8815          * Pass/Fail or error type Note: receiver to verify the in
8816          * parameters, and fail the call with an error when appropriate
8817          */
8818         uint16_t req_type;
8819         /* This field returns the type of original request. */
8820         uint16_t seq_id;
8821         /* This field provides original sequence number of the command. */
8822         uint16_t resp_len;
8823         /*
8824          * This field is the length of the response in bytes. The last
8825          * byte of the response is a valid flag that will read as '1'
8826          * when the command has been completely written to memory.
8827          */
8828         uint32_t unused_0;
8829         uint8_t unused_1;
8830         uint8_t unused_2;
8831         uint8_t unused_3;
8832         uint8_t valid;
8833         /*
8834          * This field is used in Output records to indicate that the
8835          * output is completely written to RAM. This field should be
8836          * read as '1' to indicate that the output has been completely
8837          * written. When writing a command completion or response to an
8838          * internal processor, the order of writes has to be such that
8839          * this field is written last.
8840          */
8841 } __attribute__((packed));
8842
8843 /* hwrm_ring_grp_alloc */
8844 /*
8845  * Description: This API allocates and does basic preparation for a ring group.
8846  */
8847 /* Input        (24 bytes) */
8848 struct hwrm_ring_grp_alloc_input {
8849         uint16_t req_type;
8850         /*
8851          * This value indicates what type of request this is. The format
8852          * for the rest of the command is determined by this field.
8853          */
8854         uint16_t cmpl_ring;
8855         /*
8856          * This value indicates the what completion ring the request
8857          * will be optionally completed on. If the value is -1, then no
8858          * CR completion will be generated. Any other value must be a
8859          * valid CR ring_id value for this function.
8860          */
8861         uint16_t seq_id;
8862         /* This value indicates the command sequence number. */
8863         uint16_t target_id;
8864         /*
8865          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8866          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8867          * - HWRM
8868          */
8869         uint64_t resp_addr;
8870         /*
8871          * This is the host address where the response will be written
8872          * when the request is complete. This area must be 16B aligned
8873          * and must be cleared to zero before the request is made.
8874          */
8875         uint16_t cr;
8876         /* This value identifies the CR associated with the ring group. */
8877         uint16_t rr;
8878         /* This value identifies the main RR associated with the ring group. */
8879         uint16_t ar;
8880         /*
8881          * This value identifies the aggregation RR associated with the
8882          * ring group. If this value is 0xFF... (All Fs), then no
8883          * Aggregation ring will be set.
8884          */
8885         uint16_t sc;
8886         /*
8887          * This value identifies the statistics context associated with
8888          * the ring group.
8889          */
8890 } __attribute__((packed));
8891
8892 /* Output       (16 bytes) */
8893 struct hwrm_ring_grp_alloc_output {
8894         uint16_t error_code;
8895         /*
8896          * Pass/Fail or error type Note: receiver to verify the in
8897          * parameters, and fail the call with an error when appropriate
8898          */
8899         uint16_t req_type;
8900         /* This field returns the type of original request. */
8901         uint16_t seq_id;
8902         /* This field provides original sequence number of the command. */
8903         uint16_t resp_len;
8904         /*
8905          * This field is the length of the response in bytes. The last
8906          * byte of the response is a valid flag that will read as '1'
8907          * when the command has been completely written to memory.
8908          */
8909         uint32_t ring_group_id;
8910         /*
8911          * This is the ring group ID value. Use this value to program
8912          * the default ring group for the VNIC or as table entries in an
8913          * RSS/COS context.
8914          */
8915         uint8_t unused_0;
8916         uint8_t unused_1;
8917         uint8_t unused_2;
8918         uint8_t valid;
8919         /*
8920          * This field is used in Output records to indicate that the
8921          * output is completely written to RAM. This field should be
8922          * read as '1' to indicate that the output has been completely
8923          * written. When writing a command completion or response to an
8924          * internal processor, the order of writes has to be such that
8925          * this field is written last.
8926          */
8927 } __attribute__((packed));
8928
8929 /* hwrm_ring_grp_free */
8930 /*
8931  * Description: This API frees a ring group and associated resources. # If a
8932  * ring in the ring group is reset or free, then the associated rings in the
8933  * ring group shall also be reset/free using hwrm_ring_free. # A function driver
8934  * shall always use hwrm_ring_grp_free after freeing all rings in a group. # As
8935  * a part of executing this command, the HWRM shall reset all associated ring
8936  * group resources.
8937  */
8938 /* Input        (24 bytes) */
8939 struct hwrm_ring_grp_free_input {
8940         uint16_t req_type;
8941         /*
8942          * This value indicates what type of request this is. The format
8943          * for the rest of the command is determined by this field.
8944          */
8945         uint16_t cmpl_ring;
8946         /*
8947          * This value indicates the what completion ring the request
8948          * will be optionally completed on. If the value is -1, then no
8949          * CR completion will be generated. Any other value must be a
8950          * valid CR ring_id value for this function.
8951          */
8952         uint16_t seq_id;
8953         /* This value indicates the command sequence number. */
8954         uint16_t target_id;
8955         /*
8956          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8957          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8958          * - HWRM
8959          */
8960         uint64_t resp_addr;
8961         /*
8962          * This is the host address where the response will be written
8963          * when the request is complete. This area must be 16B aligned
8964          * and must be cleared to zero before the request is made.
8965          */
8966         uint32_t ring_group_id;
8967         /* This is the ring group ID value. */
8968         uint32_t unused_0;
8969 } __attribute__((packed));
8970
8971 /* Output       (16 bytes) */
8972 struct hwrm_ring_grp_free_output {
8973         uint16_t error_code;
8974         /*
8975          * Pass/Fail or error type Note: receiver to verify the in
8976          * parameters, and fail the call with an error when appropriate
8977          */
8978         uint16_t req_type;
8979         /* This field returns the type of original request. */
8980         uint16_t seq_id;
8981         /* This field provides original sequence number of the command. */
8982         uint16_t resp_len;
8983         /*
8984          * This field is the length of the response in bytes. The last
8985          * byte of the response is a valid flag that will read as '1'
8986          * when the command has been completely written to memory.
8987          */
8988         uint32_t unused_0;
8989         uint8_t unused_1;
8990         uint8_t unused_2;
8991         uint8_t unused_3;
8992         uint8_t valid;
8993         /*
8994          * This field is used in Output records to indicate that the
8995          * output is completely written to RAM. This field should be
8996          * read as '1' to indicate that the output has been completely
8997          * written. When writing a command completion or response to an
8998          * internal processor, the order of writes has to be such that
8999          * this field is written last.
9000          */
9001 } __attribute__((packed));
9002
9003 /* hwrm_cfa_l2_filter_alloc */
9004 /*
9005  * Description: An L2 filter is a filter resource that is used to identify a
9006  * vnic or ring for a packet based on layer 2 fields. Layer 2 fields for
9007  * encapsulated packets include both outer L2 header and/or inner l2 header of
9008  * encapsulated packet. The L2 filter resource covers the following OS specific
9009  * L2 filters. Linux/FreeBSD (per function): # Broadcast enable/disable # List
9010  * of individual multicast filters # All multicast enable/disable filter #
9011  * Unicast filters # Promiscuous mode VMware: # Broadcast enable/disable (per
9012  * physical function) # All multicast enable/disable    (per function) # Unicast
9013  * filters per ring or vnic # Promiscuous mode per PF Windows: # Broadcast
9014  * enable/disable (per physical function) # List of individual multicast filters
9015  * (Driver needs to advertise the maximum number of filters supported) # All
9016  * multicast enable/disable per physical function # Unicast filters per vnic #
9017  * Promiscuous mode per PF Implementation notes on the use of VNIC in this
9018  * command: # By default, these filters belong to default vnic for the function.
9019  * # Once these filters are set up, only destination VNIC can be modified. # If
9020  * the destination VNIC is not specified in this command, then the HWRM shall
9021  * only create an l2 context id. HWRM Implementation notes for multicast
9022  * filters: # The hwrm_filter_alloc command can be used to set up multicast
9023  * filters (perfect match or partial match). Each individual function driver can
9024  * set up multicast filters independently. # The HWRM needs to keep track of
9025  * multicast filters set up by function drivers and maintain multicast group
9026  * replication records to enable a subset of functions to receive traffic for a
9027  * specific multicast address. # When a specific multicast filter cannot be set,
9028  * the HWRM shall return an error. In this error case, the driver should fall
9029  * back to using one general filter     (rather than specific) for all multicast
9030  * traffic. # When the SR-IOV is enabled, the HWRM needs to additionally track
9031  * source knockout per multicast group record. Examples of setting unicast
9032  * filters: For a unicast MAC based filter, one can use a combination of the
9033  * fields and masks provided in this command to set up the filter. Below are
9034  * some examples: # MAC + no VLAN filter: This filter is used to identify
9035  * traffic that does not contain any VLAN tags and matches destination  (or
9036  * source) MAC address. This filter can be set up by setting only l2_addr field
9037  * to be a valid field. All other fields are not valid. The following value is
9038  * set for l2_addr. l2_addr = MAC # MAC + Any VLAN filter: This filter is used
9039  * to identify traffic that carries single VLAN tag and matches (destination or
9040  * source) MAC address. This filter can be set up by setting only l2_addr and
9041  * l2_ovlan_mask fields to be valid fields. All other fields are not valid. The
9042  * following values are set for those two valid fields. l2_addr = MAC,
9043  * l2_ovlan_mask = 0xFFFF # MAC + no VLAN or VLAN ID=0: This filter is used to
9044  * identify untagged traffic that does not contain any VLAN tags or a VLAN tag
9045  * with VLAN ID = 0 and matches destination (or source) MAC address. This filter
9046  * can be set up by setting only l2_addr and l2_ovlan fields to be valid fields.
9047  * All other fields are not valid. The following value are set for l2_addr and
9048  * l2_ovlan. l2_addr = MAC, l2_ovlan = 0x0 # MAC + no VLAN or any VLAN: This
9049  * filter is used to identify traffic that contains zero or 1 VLAN tag and
9050  * matches destination  (or source) MAC address. This filter can be set up by
9051  * setting only l2_addr, l2_ovlan, and l2_mask fields to be valid fields. All
9052  * other fields are not valid. The following value are set for l2_addr,
9053  * l2_ovlan, and l2_mask fields. l2_addr = MAC, l2_ovlan = 0x0, l2_ovlan_mask =
9054  * 0xFFFF # MAC + VLAN ID filter: This filter can be set up by setting only
9055  * l2_addr, l2_ovlan, and l2_ovlan_mask fields to be valid fields. All other
9056  * fields are not valid. The following values are set for those three valid
9057  * fields. l2_addr = MAC, l2_ovlan = VLAN ID, l2_ovlan_mask = 0xF000
9058  */
9059 /* Input        (96 bytes) */
9060 struct hwrm_cfa_l2_filter_alloc_input {
9061         uint16_t req_type;
9062         /*
9063          * This value indicates what type of request this is. The format
9064          * for the rest of the command is determined by this field.
9065          */
9066         uint16_t cmpl_ring;
9067         /*
9068          * This value indicates the what completion ring the request
9069          * will be optionally completed on. If the value is -1, then no
9070          * CR completion will be generated. Any other value must be a
9071          * valid CR ring_id value for this function.
9072          */
9073         uint16_t seq_id;
9074         /* This value indicates the command sequence number. */
9075         uint16_t target_id;
9076         /*
9077          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9078          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9079          * - HWRM
9080          */
9081         uint64_t resp_addr;
9082         /*
9083          * This is the host address where the response will be written
9084          * when the request is complete. This area must be 16B aligned
9085          * and must be cleared to zero before the request is made.
9086          */
9087         uint32_t flags;
9088         /*
9089          * Enumeration denoting the RX, TX type of the resource. This
9090          * enumeration is used for resources that are similar for both
9091          * TX and RX paths of the chip.
9092          */
9093         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH       UINT32_C(0x1)
9094         /* tx path */
9095         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_TX    \
9096                 (UINT32_C(0x0) << 0)
9097         /* rx path */
9098         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX    \
9099                 (UINT32_C(0x1) << 0)
9100         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_LAST \
9101                 CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX
9102         /*
9103          * Setting of this flag indicates the applicability to the
9104          * loopback path.
9105          */
9106         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_LOOPBACK   UINT32_C(0x2)
9107         /*
9108          * Setting of this flag indicates drop action. If this flag is
9109          * not set, then it should be considered accept action.
9110          */
9111         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_DROP       UINT32_C(0x4)
9112         /*
9113          * If this flag is set, all t_l2_* fields are invalid and they
9114          * should not be specified. If this flag is set, then l2_*
9115          * fields refer to fields of outermost L2 header.
9116          */
9117         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST UINT32_C(0x8)
9118         uint32_t enables;
9119         /* This bit must be '1' for the l2_addr field to be configured. */
9120         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR UINT32_C(0x1)
9121         /* This bit must be '1' for the l2_addr_mask field to be configured. */
9122         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK     \
9123                 UINT32_C(0x2)
9124         /* This bit must be '1' for the l2_ovlan field to be configured. */
9125         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN UINT32_C(0x4)
9126         /*
9127          * This bit must be '1' for the l2_ovlan_mask field to be
9128          * configured.
9129          */
9130         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN_MASK     \
9131                 UINT32_C(0x8)
9132         /* This bit must be '1' for the l2_ivlan field to be configured. */
9133         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN UINT32_C(0x10)
9134         /*
9135          * This bit must be '1' for the l2_ivlan_mask field to be
9136          * configured.
9137          */
9138         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN_MASK     \
9139                 UINT32_C(0x20)
9140         /* This bit must be '1' for the t_l2_addr field to be configured. */
9141         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR UINT32_C(0x40)
9142         /*
9143          * This bit must be '1' for the t_l2_addr_mask field to be
9144          * configured.
9145          */
9146         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR_MASK   \
9147                 UINT32_C(0x80)
9148         /* This bit must be '1' for the t_l2_ovlan field to be configured. */
9149         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN       \
9150                 UINT32_C(0x100)
9151         /*
9152          * This bit must be '1' for the t_l2_ovlan_mask field to be
9153          * configured.
9154          */
9155         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN_MASK  \
9156                 UINT32_C(0x200)
9157         /* This bit must be '1' for the t_l2_ivlan field to be configured. */
9158         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN       \
9159                 UINT32_C(0x400)
9160         /*
9161          * This bit must be '1' for the t_l2_ivlan_mask field to be
9162          * configured.
9163          */
9164         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN_MASK  \
9165                 UINT32_C(0x800)
9166         /* This bit must be '1' for the src_type field to be configured. */
9167         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_TYPE UINT32_C(0x1000)
9168         /* This bit must be '1' for the src_id field to be configured. */
9169         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_ID UINT32_C(0x2000)
9170         /* This bit must be '1' for the tunnel_type field to be configured. */
9171         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_TUNNEL_TYPE      \
9172                 UINT32_C(0x4000)
9173         /* This bit must be '1' for the dst_id field to be configured. */
9174         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_DST_ID UINT32_C(0x8000)
9175         /*
9176          * This bit must be '1' for the mirror_vnic_id field to be
9177          * configured.
9178          */
9179         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID   \
9180                 UINT32_C(0x10000)
9181         uint8_t l2_addr[6];
9182         /*
9183          * This value sets the match value for the L2 MAC address.
9184          * Destination MAC address for RX path. Source MAC address for
9185          * TX path.
9186          */
9187         uint8_t unused_0;
9188         uint8_t unused_1;
9189         uint8_t l2_addr_mask[6];
9190         /*
9191          * This value sets the mask value for the L2 address. A value of
9192          * 0 will mask the corresponding bit from compare.
9193          */
9194         uint16_t l2_ovlan;
9195         /* This value sets VLAN ID value for outer VLAN. */
9196         uint16_t l2_ovlan_mask;
9197         /*
9198          * This value sets the mask value for the ovlan id. A value of 0
9199          * will mask the corresponding bit from compare.
9200          */
9201         uint16_t l2_ivlan;
9202         /* This value sets VLAN ID value for inner VLAN. */
9203         uint16_t l2_ivlan_mask;
9204         /*
9205          * This value sets the mask value for the ivlan id. A value of 0
9206          * will mask the corresponding bit from compare.
9207          */
9208         uint8_t unused_2;
9209         uint8_t unused_3;
9210         uint8_t t_l2_addr[6];
9211         /*
9212          * This value sets the match value for the tunnel L2 MAC
9213          * address. Destination MAC address for RX path. Source MAC
9214          * address for TX path.
9215          */
9216         uint8_t unused_4;
9217         uint8_t unused_5;
9218         uint8_t t_l2_addr_mask[6];
9219         /*
9220          * This value sets the mask value for the tunnel L2 address. A
9221          * value of 0 will mask the corresponding bit from compare.
9222          */
9223         uint16_t t_l2_ovlan;
9224         /* This value sets VLAN ID value for tunnel outer VLAN. */
9225         uint16_t t_l2_ovlan_mask;
9226         /*
9227          * This value sets the mask value for the tunnel ovlan id. A
9228          * value of 0 will mask the corresponding bit from compare.
9229          */
9230         uint16_t t_l2_ivlan;
9231         /* This value sets VLAN ID value for tunnel inner VLAN. */
9232         uint16_t t_l2_ivlan_mask;
9233         /*
9234          * This value sets the mask value for the tunnel ivlan id. A
9235          * value of 0 will mask the corresponding bit from compare.
9236          */
9237         uint8_t src_type;
9238         /* This value identifies the type of source of the packet. */
9239         /* Network port */
9240         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_NPORT   UINT32_C(0x0)
9241         /* Physical function */
9242         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_PF      UINT32_C(0x1)
9243         /* Virtual function */
9244         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VF      UINT32_C(0x2)
9245         /* Virtual NIC of a function */
9246         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VNIC    UINT32_C(0x3)
9247         /* Embedded processor for CFA management */
9248         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_KONG    UINT32_C(0x4)
9249         /* Embedded processor for OOB management */
9250         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_APE     UINT32_C(0x5)
9251         /* Embedded processor for RoCE */
9252         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_BONO    UINT32_C(0x6)
9253         /* Embedded processor for network proxy functions */
9254         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_TANG    UINT32_C(0x7)
9255         uint8_t unused_6;
9256         uint32_t src_id;
9257         /*
9258          * This value is the id of the source. For a network port, it
9259          * represents port_id. For a physical function, it represents
9260          * fid. For a virtual function, it represents vf_id. For a vnic,
9261          * it represents vnic_id. For embedded processors, this id is
9262          * not valid. Notes: 1. The function ID is implied if it src_id
9263          * is not provided for a src_type that is either
9264          */
9265         uint8_t tunnel_type;
9266         /* Tunnel Type. */
9267         /* Non-tunnel */
9268         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NONTUNNEL \
9269                 UINT32_C(0x0)
9270         /* Virtual eXtensible Local Area Network        (VXLAN) */
9271         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_VXLAN \
9272                 UINT32_C(0x1)
9273         /*
9274          * Network Virtualization Generic Routing
9275          * Encapsulation        (NVGRE)
9276          */
9277         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NVGRE \
9278                 UINT32_C(0x2)
9279         /*
9280          * Generic Routing Encapsulation        (GRE) inside
9281          * Ethernet payload
9282          */
9283         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_L2GRE UINT32_C(0x3)
9284         /* IP in IP */
9285         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPIP UINT32_C(0x4)
9286         /* Generic Network Virtualization Encapsulation (Geneve) */
9287         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_GENEVE UINT32_C(0x5)
9288         /* Multi-Protocol Lable Switching       (MPLS) */
9289         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_MPLS UINT32_C(0x6)
9290         /* Stateless Transport Tunnel   (STT) */
9291         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_STT  UINT32_C(0x7)
9292         /*
9293          * Generic Routing Encapsulation        (GRE) inside IP
9294          * datagram payload
9295          */
9296         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPGRE UINT32_C(0x8)
9297         /*
9298          * IPV4 over virtual eXtensible Local Area
9299          * Network (IPV4oVXLAN)
9300          */
9301         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_VXLAN_V4 \
9302                 UINT32_C(0x9)
9303         /* Any tunneled traffic */
9304         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_ANYTUNNEL \
9305                 UINT32_C(0xff)
9306         uint8_t unused_7;
9307         uint16_t dst_id;
9308         /*
9309          * If set, this value shall represent the Logical VNIC ID of the
9310          * destination VNIC for the RX path and network port id of the
9311          * destination port for the TX path.
9312          */
9313         uint16_t mirror_vnic_id;
9314         /* Logical VNIC ID of the VNIC where traffic is mirrored. */
9315         uint8_t pri_hint;
9316         /*
9317          * This hint is provided to help in placing the filter in the
9318          * filter table.
9319          */
9320         /* No preference */
9321         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_NO_PREFER \
9322                 UINT32_C(0x0)
9323         /* Above the given filter */
9324         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_ABOVE_FILTER \
9325                 UINT32_C(0x1)
9326         /* Below the given filter */
9327         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_BELOW_FILTER \
9328                 UINT32_C(0x2)
9329         /* As high as possible */
9330         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MAX     UINT32_C(0x3)
9331         /* As low as possible */
9332         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MIN     UINT32_C(0x4)
9333         uint8_t unused_8;
9334         uint32_t unused_9;
9335         uint64_t l2_filter_id_hint;
9336         /*
9337          * This is the ID of the filter that goes along with the
9338          * pri_hint. This field is valid only for the following values.
9339          * 1 - Above the given filter 2 - Below the given filter
9340          */
9341 } __attribute__((packed));
9342
9343 /* Output       (24 bytes) */
9344 struct hwrm_cfa_l2_filter_alloc_output {
9345         uint16_t error_code;
9346         /*
9347          * Pass/Fail or error type Note: receiver to verify the in
9348          * parameters, and fail the call with an error when appropriate
9349          */
9350         uint16_t req_type;
9351         /* This field returns the type of original request. */
9352         uint16_t seq_id;
9353         /* This field provides original sequence number of the command. */
9354         uint16_t resp_len;
9355         /*
9356          * This field is the length of the response in bytes. The last
9357          * byte of the response is a valid flag that will read as '1'
9358          * when the command has been completely written to memory.
9359          */
9360         uint64_t l2_filter_id;
9361         /*
9362          * This value identifies a set of CFA data structures used for
9363          * an L2 context.
9364          */
9365         uint32_t flow_id;
9366         /*
9367          * This is the ID of the flow associated with this filter. This
9368          * value shall be used to match and associate the flow
9369          * identifier returned in completion records. A value of
9370          * 0xFFFFFFFF shall indicate no flow id.
9371          */
9372         uint8_t unused_0;
9373         uint8_t unused_1;
9374         uint8_t unused_2;
9375         uint8_t valid;
9376         /*
9377          * This field is used in Output records to indicate that the
9378          * output is completely written to RAM. This field should be
9379          * read as '1' to indicate that the output has been completely
9380          * written. When writing a command completion or response to an
9381          * internal processor, the order of writes has to be such that
9382          * this field is written last.
9383          */
9384 } __attribute__((packed));
9385
9386 /* hwrm_cfa_l2_filter_free */
9387 /*
9388  * Description: Free a L2 filter. The HWRM shall free all associated filter
9389  * resources with the L2 filter.
9390  */
9391 /* Input        (24 bytes) */
9392 struct hwrm_cfa_l2_filter_free_input {
9393         uint16_t req_type;
9394         /*
9395          * This value indicates what type of request this is. The format
9396          * for the rest of the command is determined by this field.
9397          */
9398         uint16_t cmpl_ring;
9399         /*
9400          * This value indicates the what completion ring the request
9401          * will be optionally completed on. If the value is -1, then no
9402          * CR completion will be generated. Any other value must be a
9403          * valid CR ring_id value for this function.
9404          */
9405         uint16_t seq_id;
9406         /* This value indicates the command sequence number. */
9407         uint16_t target_id;
9408         /*
9409          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9410          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9411          * - HWRM
9412          */
9413         uint64_t resp_addr;
9414         /*
9415          * This is the host address where the response will be written
9416          * when the request is complete. This area must be 16B aligned
9417          * and must be cleared to zero before the request is made.
9418          */
9419         uint64_t l2_filter_id;
9420         /*
9421          * This value identifies a set of CFA data structures used for
9422          * an L2 context.
9423          */
9424 } __attribute__((packed));
9425
9426 /* Output       (16 bytes) */
9427 struct hwrm_cfa_l2_filter_free_output {
9428         uint16_t error_code;
9429         /*
9430          * Pass/Fail or error type Note: receiver to verify the in
9431          * parameters, and fail the call with an error when appropriate
9432          */
9433         uint16_t req_type;
9434         /* This field returns the type of original request. */
9435         uint16_t seq_id;
9436         /* This field provides original sequence number of the command. */
9437         uint16_t resp_len;
9438         /*
9439          * This field is the length of the response in bytes. The last
9440          * byte of the response is a valid flag that will read as '1'
9441          * when the command has been completely written to memory.
9442          */
9443         uint32_t unused_0;
9444         uint8_t unused_1;
9445         uint8_t unused_2;
9446         uint8_t unused_3;
9447         uint8_t valid;
9448         /*
9449          * This field is used in Output records to indicate that the
9450          * output is completely written to RAM. This field should be
9451          * read as '1' to indicate that the output has been completely
9452          * written. When writing a command completion or response to an
9453          * internal processor, the order of writes has to be such that
9454          * this field is written last.
9455          */
9456 } __attribute__((packed));
9457
9458 /* hwrm_cfa_l2_filter_cfg */
9459 /* Description: Change the configuration of an existing L2 filter */
9460 /* Input        (40 bytes) */
9461 struct hwrm_cfa_l2_filter_cfg_input {
9462         uint16_t req_type;
9463         /*
9464          * This value indicates what type of request this is. The format
9465          * for the rest of the command is determined by this field.
9466          */
9467         uint16_t cmpl_ring;
9468         /*
9469          * This value indicates the what completion ring the request
9470          * will be optionally completed on. If the value is -1, then no
9471          * CR completion will be generated. Any other value must be a
9472          * valid CR ring_id value for this function.
9473          */
9474         uint16_t seq_id;
9475         /* This value indicates the command sequence number. */
9476         uint16_t target_id;
9477         /*
9478          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9479          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9480          * - HWRM
9481          */
9482         uint64_t resp_addr;
9483         /*
9484          * This is the host address where the response will be written
9485          * when the request is complete. This area must be 16B aligned
9486          * and must be cleared to zero before the request is made.
9487          */
9488         uint32_t flags;
9489         /*
9490          * Enumeration denoting the RX, TX type of the resource. This
9491          * enumeration is used for resources that are similar for both
9492          * TX and RX paths of the chip.
9493          */
9494         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH UINT32_C(0x1)
9495         /* tx path */
9496         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_TX \
9497                 (UINT32_C(0x0) << 0)
9498         /* rx path */
9499         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_RX \
9500                 (UINT32_C(0x1) << 0)
9501         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_LAST \
9502                 CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_RX
9503         /*
9504          * Setting of this flag indicates drop action. If this flag is
9505          * not set, then it should be considered accept action.
9506          */
9507         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_DROP UINT32_C(0x2)
9508         uint32_t enables;
9509         /* This bit must be '1' for the dst_id field to be configured. */
9510         #define HWRM_CFA_L2_FILTER_CFG_INPUT_ENABLES_DST_ID     UINT32_C(0x1)
9511         /*
9512          * This bit must be '1' for the new_mirror_vnic_id field to be
9513          * configured.
9514          */
9515         #define HWRM_CFA_L2_FILTER_CFG_INPUT_ENABLES_NEW_MIRROR_VNIC_ID   \
9516                 UINT32_C(0x2)
9517         uint64_t l2_filter_id;
9518         /*
9519          * This value identifies a set of CFA data structures used for
9520          * an L2 context.
9521          */
9522         uint32_t dst_id;
9523         /*
9524          * If set, this value shall represent the Logical VNIC ID of the
9525          * destination VNIC for the RX path and network port id of the
9526          * destination port for the TX path.
9527          */
9528         uint32_t new_mirror_vnic_id;
9529         /* New Logical VNIC ID of the VNIC where traffic is mirrored. */
9530 } __attribute__((packed));
9531
9532 /* Output       (16 bytes) */
9533 struct hwrm_cfa_l2_filter_cfg_output {
9534         uint16_t error_code;
9535         /*
9536          * Pass/Fail or error type Note: receiver to verify the in
9537          * parameters, and fail the call with an error when appropriate
9538          */
9539         uint16_t req_type;
9540         /* This field returns the type of original request. */
9541         uint16_t seq_id;
9542         /* This field provides original sequence number of the command. */
9543         uint16_t resp_len;
9544         /*
9545          * This field is the length of the response in bytes. The last
9546          * byte of the response is a valid flag that will read as '1'
9547          * when the command has been completely written to memory.
9548          */
9549         uint32_t unused_0;
9550         uint8_t unused_1;
9551         uint8_t unused_2;
9552         uint8_t unused_3;
9553         uint8_t valid;
9554         /*
9555          * This field is used in Output records to indicate that the
9556          * output is completely written to RAM. This field should be
9557          * read as '1' to indicate that the output has been completely
9558          * written. When writing a command completion or response to an
9559          * internal processor, the order of writes has to be such that
9560          * this field is written last.
9561          */
9562 } __attribute__((packed));
9563
9564 /* hwrm_cfa_l2_set_rx_mask */
9565 /* Description: This command will set rx mask of the function. */
9566 /* Input        (56 bytes) */
9567 struct hwrm_cfa_l2_set_rx_mask_input {
9568         uint16_t req_type;
9569         /*
9570          * This value indicates what type of request this is. The format
9571          * for the rest of the command is determined by this field.
9572          */
9573         uint16_t cmpl_ring;
9574         /*
9575          * This value indicates the what completion ring the request
9576          * will be optionally completed on. If the value is -1, then no
9577          * CR completion will be generated. Any other value must be a
9578          * valid CR ring_id value for this function.
9579          */
9580         uint16_t seq_id;
9581         /* This value indicates the command sequence number. */
9582         uint16_t target_id;
9583         /*
9584          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9585          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9586          * - HWRM
9587          */
9588         uint64_t resp_addr;
9589         /*
9590          * This is the host address where the response will be written
9591          * when the request is complete. This area must be 16B aligned
9592          * and must be cleared to zero before the request is made.
9593          */
9594         uint32_t vnic_id;
9595         /* VNIC ID */
9596         uint32_t mask;
9597         /* Reserved for future use. */
9598         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_RESERVED     UINT32_C(0x1)
9599         /*
9600          * When this bit is '1', the function is requested to accept
9601          * multi-cast packets specified by the multicast addr table.
9602          */
9603         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST        UINT32_C(0x2)
9604         /*
9605          * When this bit is '1', the function is requested to accept all
9606          * multi-cast packets.
9607          */
9608         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST    UINT32_C(0x4)
9609         /*
9610          * When this bit is '1', the function is requested to accept
9611          * broadcast packets.
9612          */
9613         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST        UINT32_C(0x8)
9614         /*
9615          * When this bit is '1', the function is requested to be put in
9616          * the promiscuous mode. The HWRM should accept any function to
9617          * set up promiscuous mode. The HWRM shall follow the semantics
9618          * below for the promiscuous mode support. # When partitioning
9619          * is not enabled on a port     (i.e. single PF on the port), then
9620          * the PF shall be allowed to be in the promiscuous mode. When
9621          * the PF is in the promiscuous mode, then it shall receive all
9622          * host bound traffic on that port. # When partitioning is
9623          * enabled on a port    (i.e. multiple PFs per port) and a PF on
9624          * that port is in the promiscuous mode, then the PF receives
9625          * all traffic within that partition as identified by a unique
9626          * identifier for the PF        (e.g. S-Tag). If a unique outer VLAN
9627          * for the PF is specified, then the setting of promiscuous mode
9628          * on that PF shall result in the PF receiving all host bound
9629          * traffic with matching outer VLAN. # A VF shall can be set in
9630          * the promiscuous mode. In the promiscuous mode, the VF does
9631          * not receive any traffic unless a unique outer VLAN for the VF
9632          * is specified. If a unique outer VLAN for the VF is specified,
9633          * then the setting of promiscuous mode on that VF shall result
9634          * in the VF receiving all host bound traffic with the matching
9635          * outer VLAN. # The HWRM shall allow the setting of promiscuous
9636          * mode on a function independently from the promiscuous mode
9637          * settings on other functions.
9638          */
9639         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS UINT32_C(0x10)
9640         /*
9641          * If this flag is set, the corresponding RX filters shall be
9642          * set up to cover multicast/broadcast filters for the outermost
9643          * Layer 2 destination MAC address field.
9644          */
9645         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_OUTERMOST    UINT32_C(0x20)
9646         /*
9647          * If this flag is set, the corresponding RX filters shall be
9648          * set up to cover multicast/broadcast filters for the VLAN-
9649          * tagged packets that match the TPID and VID fields of VLAN
9650          * tags in the VLAN tag table specified in this command.
9651          */
9652         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLANONLY     UINT32_C(0x40)
9653         /*
9654          * If this flag is set, the corresponding RX filters shall be
9655          * set up to cover multicast/broadcast filters for non-VLAN
9656          * tagged packets and VLAN-tagged packets that match the TPID
9657          * and VID fields of VLAN tags in the VLAN tag table specified
9658          * in this command.
9659          */
9660         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN UINT32_C(0x80)
9661         /*
9662          * If this flag is set, the corresponding RX filters shall be
9663          * set up to cover multicast/broadcast filters for non-VLAN
9664          * tagged packets and VLAN-tagged packets matching any VLAN tag.
9665          * If this flag is set, then the HWRM shall ignore VLAN tags
9666          * specified in vlan_tag_tbl. If none of vlanonly, vlan_nonvlan,
9667          * and anyvlan_nonvlan flags is set, then the HWRM shall ignore
9668          * VLAN tags specified in vlan_tag_tbl. The HWRM client shall
9669          * set at most one flag out of vlanonly, vlan_nonvlan, and
9670          * anyvlan_nonvlan.
9671          */
9672         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN      \
9673                 UINT32_C(0x100)
9674         uint64_t mc_tbl_addr;
9675         /* This is the address for mcast address tbl. */
9676         uint32_t num_mc_entries;
9677         /*
9678          * This value indicates how many entries in mc_tbl are valid.
9679          * Each entry is 6 bytes.
9680          */
9681         uint32_t unused_0;
9682         uint64_t vlan_tag_tbl_addr;
9683         /*
9684          * This is the address for VLAN tag table. Each VLAN entry in
9685          * the table is 4 bytes of a VLAN tag including TPID, PCP, DEI,
9686          * and VID fields in network byte order.
9687          */
9688         uint32_t num_vlan_tags;
9689         /*
9690          * This value indicates how many entries in vlan_tag_tbl are
9691          * valid. Each entry is 4 bytes.
9692          */
9693         uint32_t unused_1;
9694 } __attribute__((packed));
9695
9696 /* Output       (16 bytes) */
9697 struct hwrm_cfa_l2_set_rx_mask_output {
9698         uint16_t error_code;
9699         /*
9700          * Pass/Fail or error type Note: receiver to verify the in
9701          * parameters, and fail the call with an error when appropriate
9702          */
9703         uint16_t req_type;
9704         /* This field returns the type of original request. */
9705         uint16_t seq_id;
9706         /* This field provides original sequence number of the command. */
9707         uint16_t resp_len;
9708         /*
9709          * This field is the length of the response in bytes. The last
9710          * byte of the response is a valid flag that will read as '1'
9711          * when the command has been completely written to memory.
9712          */
9713         uint32_t unused_0;
9714         uint8_t unused_1;
9715         uint8_t unused_2;
9716         uint8_t unused_3;
9717         uint8_t valid;
9718         /*
9719          * This field is used in Output records to indicate that the
9720          * output is completely written to RAM. This field should be
9721          * read as '1' to indicate that the output has been completely
9722          * written. When writing a command completion or response to an
9723          * internal processor, the order of writes has to be such that
9724          * this field is written last.
9725          */
9726 } __attribute__((packed));
9727
9728 /* Command specific Error Codes (8 bytes) */
9729 struct hwrm_cfa_l2_set_rx_mask_cmd_err {
9730         uint8_t code;
9731         /*
9732          * command specific error codes that goes to the cmd_err field
9733          * in Common HWRM Error Response.
9734          */
9735         /* Unknown error */
9736         #define HWRM_CFA_L2_SET_RX_MASK_CMD_ERR_CODE_UNKNOWN UINT32_C(0x0)
9737         /*
9738          * Unable to complete operation due to conflict
9739          * with Ntuple Filter
9740          */
9741         #define \
9742         HWRM_CFA_L2_SET_RX_MASK_CMD_ERR_CODE_NTUPLE_FILTER_CONFLICT_ERR \
9743         UINT32_C(0x1)
9744         uint8_t unused_0[7];
9745 } __attribute__((packed));
9746
9747 /* hwrm_cfa_vlan_antispoof_cfg */
9748 /* Description: Configures vlan anti-spoof filters for VF. */
9749 /* Input (32 bytes) */
9750 struct hwrm_cfa_vlan_antispoof_cfg_input {
9751         uint16_t req_type;
9752         /*
9753          * This value indicates what type of request this is. The format for the
9754          * rest of the command is determined by this field.
9755          */
9756         uint16_t cmpl_ring;
9757         /*
9758          * This value indicates the what completion ring the request will be
9759          * optionally completed on. If the value is -1, then no CR completion
9760          * will be generated. Any other value must be a valid CR ring_id value
9761          * for this function.
9762          */
9763         uint16_t seq_id;
9764         /* This value indicates the command sequence number. */
9765         uint16_t target_id;
9766         /*
9767          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
9768          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
9769          */
9770         uint64_t resp_addr;
9771         /*
9772          * This is the host address where the response will be written when the
9773          * request is complete. This area must be 16B aligned and must be
9774          * cleared to zero before the request is made.
9775          */
9776         uint16_t fid;
9777         /*
9778          * Function ID of the function that is being configured. Only valid for
9779          * a VF FID configured by the PF.
9780          */
9781         uint8_t unused_0;
9782         uint8_t unused_1;
9783         uint32_t num_vlan_entries;
9784         /* Number of VLAN entries in the vlan_tag_mask_tbl. */
9785         uint64_t vlan_tag_mask_tbl_addr;
9786         /*
9787          * The vlan_tag_mask_tbl_addr is the DMA address of the VLAN antispoof
9788          * table. Each table entry contains the 16-bit TPID (0x8100 or 0x88a8
9789          * only), 16-bit VLAN ID, and a 16-bit mask, all in network order to
9790          * match hwrm_cfa_l2_set_rx_mask. For an individual VLAN entry, the mask
9791          * value should be 0xfff for the 12-bit VLAN ID.
9792          */
9793 };
9794
9795 /* Output (16 bytes) */
9796 struct hwrm_cfa_vlan_antispoof_cfg_output {
9797         uint16_t error_code;
9798         /*
9799          * Pass/Fail or error type Note: receiver to verify the in parameters,
9800          * and fail the call with an error when appropriate
9801          */
9802         uint16_t req_type;
9803         /* This field returns the type of original request. */
9804         uint16_t seq_id;
9805         /* This field provides original sequence number of the command. */
9806         uint16_t resp_len;
9807         /*
9808          * This field is the length of the response in bytes. The last byte of
9809          * the response is a valid flag that will read as '1' when the command
9810          * has been completely written to memory.
9811          */
9812         uint32_t unused_0;
9813         uint8_t unused_1;
9814         uint8_t unused_2;
9815         uint8_t unused_3;
9816         uint8_t valid;
9817         /*
9818          * This field is used in Output records to indicate that the output is
9819          * completely written to RAM. This field should be read as '1' to
9820          * indicate that the output has been completely written. When writing a
9821          * command completion or response to an internal processor, the order of
9822          * writes has to be such that this field is written last.
9823          */
9824 };
9825
9826 /* hwrm_cfa_ntuple_filter_alloc */
9827 /*
9828  * Description: This is a ntuple filter that uses fields from L4/L3 header and
9829  * optionally fields from L2. The ntuple filters apply to receive traffic only.
9830  * All L2/L3/L4 header fields are specified in network byte order. These filters
9831  * can be used for Receive Flow Steering (RFS). # For ethertype value, only
9832  * 0x0800 (IPv4) and 0x86dd (IPv6) shall be supported for ntuple filters. # If a
9833  * field specified in this command is not enabled as a valid field, then that
9834  * field shall not be used in matching packet header fields against this filter.
9835  */
9836 /* Input        (128 bytes) */
9837 struct hwrm_cfa_ntuple_filter_alloc_input {
9838         uint16_t req_type;
9839         /*
9840          * This value indicates what type of request this is. The format
9841          * for the rest of the command is determined by this field.
9842          */
9843         uint16_t cmpl_ring;
9844         /*
9845          * This value indicates the what completion ring the request
9846          * will be optionally completed on. If the value is -1, then no
9847          * CR completion will be generated. Any other value must be a
9848          * valid CR ring_id value for this function.
9849          */
9850         uint16_t seq_id;
9851         /* This value indicates the command sequence number. */
9852         uint16_t target_id;
9853         /*
9854          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9855          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9856          * - HWRM
9857          */
9858         uint64_t resp_addr;
9859         /*
9860          * This is the host address where the response will be written
9861          * when the request is complete. This area must be 16B aligned
9862          * and must be cleared to zero before the request is made.
9863          */
9864         uint32_t flags;
9865         /*
9866          * Setting of this flag indicates the applicability to the
9867          * loopback path.
9868          */
9869         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_LOOPBACK       \
9870                 UINT32_C(0x1)
9871         /*
9872          * Setting of this flag indicates drop action. If this flag is
9873          * not set, then it should be considered accept action.
9874          */
9875         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_DROP   UINT32_C(0x2)
9876         /*
9877          * Setting of this flag indicates that a meter is expected to be
9878          * attached to this flow. This hint can be used when choosing
9879          * the action record format required for the flow.
9880          */
9881         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_METER UINT32_C(0x4)
9882         uint32_t enables;
9883         /* This bit must be '1' for the l2_filter_id field to be configured. */
9884         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_L2_FILTER_ID   \
9885                 UINT32_C(0x1)
9886         /* This bit must be '1' for the ethertype field to be configured. */
9887         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_ETHERTYPE     \
9888                 UINT32_C(0x2)
9889         /* This bit must be '1' for the tunnel_type field to be configured. */
9890         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_TUNNEL_TYPE  \
9891                 UINT32_C(0x4)
9892         /* This bit must be '1' for the src_macaddr field to be configured. */
9893         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_MACADDR  \
9894                 UINT32_C(0x8)
9895         /* This bit must be '1' for the ipaddr_type field to be configured. */
9896         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_IPADDR_TYPE  \
9897                 UINT32_C(0x10)
9898         /* This bit must be '1' for the src_ipaddr field to be configured. */
9899         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_IPADDR   \
9900                 UINT32_C(0x20)
9901         /*
9902          * This bit must be '1' for the src_ipaddr_mask field to be
9903          * configured.
9904          */
9905         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_IPADDR_MASK \
9906                 UINT32_C(0x40)
9907         /* This bit must be '1' for the dst_ipaddr field to be configured. */
9908         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_IPADDR   \
9909                 UINT32_C(0x80)
9910         /*
9911          * This bit must be '1' for the dst_ipaddr_mask field to be
9912          * configured.
9913          */
9914         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_IPADDR_MASK \
9915                 UINT32_C(0x100)
9916         /* This bit must be '1' for the ip_protocol field to be configured. */
9917         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_IP_PROTOCOL  \
9918                 UINT32_C(0x200)
9919         /* This bit must be '1' for the src_port field to be configured. */
9920         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_PORT     \
9921                 UINT32_C(0x400)
9922         /*
9923          * This bit must be '1' for the src_port_mask field to be
9924          * configured.
9925          */
9926         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_PORT_MASK  \
9927                 UINT32_C(0x800)
9928         /* This bit must be '1' for the dst_port field to be configured. */
9929         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_PORT     \
9930                 UINT32_C(0x1000)
9931         /*
9932          * This bit must be '1' for the dst_port_mask field to be
9933          * configured.
9934          */
9935         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_PORT_MASK  \
9936                 UINT32_C(0x2000)
9937         /* This bit must be '1' for the pri_hint field to be configured. */
9938         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_PRI_HINT     \
9939                 UINT32_C(0x4000)
9940         /*
9941          * This bit must be '1' for the ntuple_filter_id field to be
9942          * configured.
9943          */
9944         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_NTUPLE_FILTER_ID \
9945                 UINT32_C(0x8000)
9946         /* This bit must be '1' for the dst_id field to be configured. */
9947         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_ID       \
9948                 UINT32_C(0x10000)
9949         /*
9950          * This bit must be '1' for the mirror_vnic_id field to be
9951          * configured.
9952          */
9953         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID \
9954                 UINT32_C(0x20000)
9955         /* This bit must be '1' for the dst_macaddr field to be configured. */
9956         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_MACADDR  \
9957                 UINT32_C(0x40000)
9958         uint64_t l2_filter_id;
9959         /*
9960          * This value identifies a set of CFA data structures used for
9961          * an L2 context.
9962          */
9963         uint8_t src_macaddr[6];
9964         /*
9965          * This value indicates the source MAC address in the Ethernet
9966          * header.
9967          */
9968         uint16_t ethertype;
9969         /* This value indicates the ethertype in the Ethernet header. */
9970         uint8_t ip_addr_type;
9971         /*
9972          * This value indicates the type of IP address. 4 - IPv4 6 -
9973          * IPv6 All others are invalid.
9974          */
9975         /* invalid */
9976         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_ADDR_TYPE_UNKNOWN \
9977                 UINT32_C(0x0)
9978         /* IPv4 */
9979         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_ADDR_TYPE_IPV4 \
9980                 UINT32_C(0x4)
9981         /* IPv6 */
9982         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_ADDR_TYPE_IPV6 \
9983                 UINT32_C(0x6)
9984         uint8_t ip_protocol;
9985         /*
9986          * The value of protocol filed in IP header. Applies to UDP and
9987          * TCP traffic. 6 - TCP 17 - UDP
9988          */
9989         /* invalid */
9990         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_PROTOCOL_UNKNOWN \
9991                 UINT32_C(0x0)
9992         /* TCP */
9993         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_PROTOCOL_TCP \
9994                 UINT32_C(0x6)
9995         /* UDP */
9996         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_PROTOCOL_UDP \
9997                 UINT32_C(0x11)
9998         uint16_t dst_id;
9999         /*
10000          * If set, this value shall represent the Logical VNIC ID of the
10001          * destination VNIC for the RX path and network port id of the
10002          * destination port for the TX path.
10003          */
10004         uint16_t mirror_vnic_id;
10005         /* Logical VNIC ID of the VNIC where traffic is mirrored. */
10006         uint8_t tunnel_type;
10007         /*
10008          * This value indicates the tunnel type for this filter. If this
10009          * field is not specified, then the filter shall apply to both
10010          * non-tunneled and tunneled packets. If this field conflicts
10011          * with the tunnel_type specified in the l2_filter_id, then the
10012          * HWRM shall return an error for this command.
10013          */
10014         /* Non-tunnel */
10015         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NONTUNNEL \
10016                 UINT32_C(0x0)
10017         /* Virtual eXtensible Local Area Network        (VXLAN) */
10018         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_VXLAN \
10019                 UINT32_C(0x1)
10020         /*
10021          * Network Virtualization Generic Routing
10022          * Encapsulation        (NVGRE)
10023          */
10024         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NVGRE \
10025                 UINT32_C(0x2)
10026         /*
10027          * Generic Routing Encapsulation        (GRE) inside
10028          * Ethernet payload
10029          */
10030         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_L2GRE \
10031                 UINT32_C(0x3)
10032         /* IP in IP */
10033         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPIP \
10034                 UINT32_C(0x4)
10035         /* Generic Network Virtualization Encapsulation (Geneve) */
10036         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_GENEVE \
10037                 UINT32_C(0x5)
10038         /* Multi-Protocol Lable Switching       (MPLS) */
10039         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_MPLS \
10040                 UINT32_C(0x6)
10041         /* Stateless Transport Tunnel   (STT) */
10042         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_STT UINT32_C(0x7)
10043         /*
10044          * Generic Routing Encapsulation        (GRE) inside IP
10045          * datagram payload
10046          */
10047         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPGRE \
10048                 UINT32_C(0x8)
10049         /* Any tunneled traffic */
10050         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_ANYTUNNEL \
10051                 UINT32_C(0xff)
10052         uint8_t pri_hint;
10053         /*
10054          * This hint is provided to help in placing the filter in the
10055          * filter table.
10056          */
10057         /* No preference */
10058         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_PRI_HINT_NO_PREFER \
10059                 UINT32_C(0x0)
10060         /* Above the given filter */
10061         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_PRI_HINT_ABOVE UINT32_C(0x1)
10062         /* Below the given filter */
10063         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_PRI_HINT_BELOW UINT32_C(0x2)
10064         /* As high as possible */
10065         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_PRI_HINT_HIGHEST \
10066                 UINT32_C(0x3)
10067         /* As low as possible */
10068         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_PRI_HINT_LOWEST UINT32_C(0x4)
10069         uint32_t src_ipaddr[4];
10070         /*
10071          * The value of source IP address to be used in filtering. For
10072          * IPv4, first four bytes represent the IP address.
10073          */
10074         uint32_t src_ipaddr_mask[4];
10075         /*
10076          * The value of source IP address mask to be used in filtering.
10077          * For IPv4, first four bytes represent the IP address mask.
10078          */
10079         uint32_t dst_ipaddr[4];
10080         /*
10081          * The value of destination IP address to be used in filtering.
10082          * For IPv4, first four bytes represent the IP address.
10083          */
10084         uint32_t dst_ipaddr_mask[4];
10085         /*
10086          * The value of destination IP address mask to be used in
10087          * filtering. For IPv4, first four bytes represent the IP
10088          * address mask.
10089          */
10090         uint16_t src_port;
10091         /*
10092          * The value of source port to be used in filtering. Applies to
10093          * UDP and TCP traffic.
10094          */
10095         uint16_t src_port_mask;
10096         /*
10097          * The value of source port mask to be used in filtering.
10098          * Applies to UDP and TCP traffic.
10099          */
10100         uint16_t dst_port;
10101         /*
10102          * The value of destination port to be used in filtering.
10103          * Applies to UDP and TCP traffic.
10104          */
10105         uint16_t dst_port_mask;
10106         /*
10107          * The value of destination port mask to be used in filtering.
10108          * Applies to UDP and TCP traffic.
10109          */
10110         uint64_t ntuple_filter_id_hint;
10111         /* This is the ID of the filter that goes along with the pri_hint. */
10112 } __attribute__((packed));
10113
10114 /* Output       (24 bytes) */
10115 struct hwrm_cfa_ntuple_filter_alloc_output {
10116         uint16_t error_code;
10117         /*
10118          * Pass/Fail or error type Note: receiver to verify the in
10119          * parameters, and fail the call with an error when appropriate
10120          */
10121         uint16_t req_type;
10122         /* This field returns the type of original request. */
10123         uint16_t seq_id;
10124         /* This field provides original sequence number of the command. */
10125         uint16_t resp_len;
10126         /*
10127          * This field is the length of the response in bytes. The last
10128          * byte of the response is a valid flag that will read as '1'
10129          * when the command has been completely written to memory.
10130          */
10131         uint64_t ntuple_filter_id;
10132         /* This value is an opaque id into CFA data structures. */
10133         uint32_t flow_id;
10134         /*
10135          * This is the ID of the flow associated with this filter. This
10136          * value shall be used to match and associate the flow
10137          * identifier returned in completion records. A value of
10138          * 0xFFFFFFFF shall indicate no flow id.
10139          */
10140         uint8_t unused_0;
10141         uint8_t unused_1;
10142         uint8_t unused_2;
10143         uint8_t valid;
10144         /*
10145          * This field is used in Output records to indicate that the
10146          * output is completely written to RAM. This field should be
10147          * read as '1' to indicate that the output has been completely
10148          * written. When writing a command completion or response to an
10149          * internal processor, the order of writes has to be such that
10150          * this field is written last.
10151          */
10152 } __attribute__((packed));
10153
10154 /* Command specific Error Codes (8 bytes) */
10155 struct hwrm_cfa_ntuple_filter_alloc_cmd_err {
10156         uint8_t code;
10157         /*
10158          * command specific error codes that goes to the cmd_err field
10159          * in Common HWRM Error Response.
10160          */
10161         /* Unknown error */
10162         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_CMD_ERR_CODE_UNKNOWN UINT32_C(0x0)
10163         /*
10164          * Unable to complete operation due to conflict
10165          * with Rx Mask VLAN
10166          */
10167         #define \
10168         HWRM_CFA_NTUPLE_FILTER_ALLOC_CMD_ERR_CODE_RX_MASK_VLAN_CONFLICT_ERR \
10169         UINT32_C(0x1)
10170         uint8_t unused_0[7];
10171 } __attribute__((packed));
10172
10173 /* hwrm_cfa_ntuple_filter_free */
10174 /* Description: Free an ntuple filter */
10175 /* Input        (24 bytes) */
10176 struct hwrm_cfa_ntuple_filter_free_input {
10177         uint16_t req_type;
10178         /*
10179          * This value indicates what type of request this is. The format
10180          * for the rest of the command is determined by this field.
10181          */
10182         uint16_t cmpl_ring;
10183         /*
10184          * This value indicates the what completion ring the request
10185          * will be optionally completed on. If the value is -1, then no
10186          * CR completion will be generated. Any other value must be a
10187          * valid CR ring_id value for this function.
10188          */
10189         uint16_t seq_id;
10190         /* This value indicates the command sequence number. */
10191         uint16_t target_id;
10192         /*
10193          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10194          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10195          * - HWRM
10196          */
10197         uint64_t resp_addr;
10198         /*
10199          * This is the host address where the response will be written
10200          * when the request is complete. This area must be 16B aligned
10201          * and must be cleared to zero before the request is made.
10202          */
10203         uint64_t ntuple_filter_id;
10204         /* This value is an opaque id into CFA data structures. */
10205 } __attribute__((packed));
10206
10207 /* Output       (16 bytes) */
10208 struct hwrm_cfa_ntuple_filter_free_output {
10209         uint16_t error_code;
10210         /*
10211          * Pass/Fail or error type Note: receiver to verify the in
10212          * parameters, and fail the call with an error when appropriate
10213          */
10214         uint16_t req_type;
10215         /* This field returns the type of original request. */
10216         uint16_t seq_id;
10217         /* This field provides original sequence number of the command. */
10218         uint16_t resp_len;
10219         /*
10220          * This field is the length of the response in bytes. The last
10221          * byte of the response is a valid flag that will read as '1'
10222          * when the command has been completely written to memory.
10223          */
10224         uint32_t unused_0;
10225         uint8_t unused_1;
10226         uint8_t unused_2;
10227         uint8_t unused_3;
10228         uint8_t valid;
10229         /*
10230          * This field is used in Output records to indicate that the
10231          * output is completely written to RAM. This field should be
10232          * read as '1' to indicate that the output has been completely
10233          * written. When writing a command completion or response to an
10234          * internal processor, the order of writes has to be such that
10235          * this field is written last.
10236          */
10237 } __attribute__((packed));
10238
10239 /* hwrm_cfa_ntuple_filter_cfg */
10240 /*
10241  * Description: Configure an ntuple filter with a new destination VNIC and/or
10242  * meter.
10243  */
10244 /* Input        (48 bytes) */
10245 struct hwrm_cfa_ntuple_filter_cfg_input {
10246         uint16_t req_type;
10247         /*
10248          * This value indicates what type of request this is. The format
10249          * for the rest of the command is determined by this field.
10250          */
10251         uint16_t cmpl_ring;
10252         /*
10253          * This value indicates the what completion ring the request
10254          * will be optionally completed on. If the value is -1, then no
10255          * CR completion will be generated. Any other value must be a
10256          * valid CR ring_id value for this function.
10257          */
10258         uint16_t seq_id;
10259         /* This value indicates the command sequence number. */
10260         uint16_t target_id;
10261         /*
10262          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10263          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10264          * - HWRM
10265          */
10266         uint64_t resp_addr;
10267         /*
10268          * This is the host address where the response will be written
10269          * when the request is complete. This area must be 16B aligned
10270          * and must be cleared to zero before the request is made.
10271          */
10272         uint32_t enables;
10273         /* This bit must be '1' for the new_dst_id field to be configured. */
10274         #define HWRM_CFA_NTUPLE_FILTER_CFG_INPUT_ENABLES_NEW_DST_ID     \
10275                 UINT32_C(0x1)
10276         /*
10277          * This bit must be '1' for the new_mirror_vnic_id field to be
10278          * configured.
10279          */
10280         #define HWRM_CFA_NTUPLE_FILTER_CFG_INPUT_ENABLES_NEW_MIRROR_VNIC_ID \
10281                 UINT32_C(0x2)
10282         /*
10283          * This bit must be '1' for the new_meter_instance_id field to
10284          * be configured.
10285          */
10286         #define HWRM_CFA_NTUPLE_FILTER_CFG_INPUT_ENABLES_NEW_METER_INSTANCE_ID \
10287                 UINT32_C(0x4)
10288         uint32_t unused_0;
10289         uint64_t ntuple_filter_id;
10290         /* This value is an opaque id into CFA data structures. */
10291         uint32_t new_dst_id;
10292         /*
10293          * If set, this value shall represent the new Logical VNIC ID of
10294          * the destination VNIC for the RX path and new network port id
10295          * of the destination port for the TX path.
10296          */
10297         uint32_t new_mirror_vnic_id;
10298         /* New Logical VNIC ID of the VNIC where traffic is mirrored. */
10299         uint16_t new_meter_instance_id;
10300         /*
10301          * New meter to attach to the flow. Specifying the invalid
10302          * instance ID is used to remove any existing meter from the
10303          * flow.
10304          */
10305         /*
10306          * A value of 0xfff is considered invalid and
10307          * implies the instance is not configured.
10308          */
10309         #define HWRM_CFA_NTUPLE_FILTER_CFG_INPUT_NEW_METER_INSTANCE_ID_INVALID \
10310                 UINT32_C(0xffff)
10311         uint16_t unused_1[3];
10312 } __attribute__((packed));
10313
10314 /* Output       (16 bytes) */
10315 struct hwrm_cfa_ntuple_filter_cfg_output {
10316         uint16_t error_code;
10317         /*
10318          * Pass/Fail or error type Note: receiver to verify the in
10319          * parameters, and fail the call with an error when appropriate
10320          */
10321         uint16_t req_type;
10322         /* This field returns the type of original request. */
10323         uint16_t seq_id;
10324         /* This field provides original sequence number of the command. */
10325         uint16_t resp_len;
10326         /*
10327          * This field is the length of the response in bytes. The last
10328          * byte of the response is a valid flag that will read as '1'
10329          * when the command has been completely written to memory.
10330          */
10331         uint32_t unused_0;
10332         uint8_t unused_1;
10333         uint8_t unused_2;
10334         uint8_t unused_3;
10335         uint8_t valid;
10336         /*
10337          * This field is used in Output records to indicate that the
10338          * output is completely written to RAM. This field should be
10339          * read as '1' to indicate that the output has been completely
10340          * written. When writing a command completion or response to an
10341          * internal processor, the order of writes has to be such that
10342          * this field is written last.
10343          */
10344 } __attribute__((packed));
10345
10346 /* hwrm_cfa_em_flow_alloc */
10347 /*
10348  * Description: This is a generic Exact Match   (EM) flow that uses fields from
10349  * L4/L3/L2 headers. The EM flows apply to transmit and receive traffic. All
10350  * L2/L3/L4 header fields are specified in network byte order. For each EM flow,
10351  * there is an associated set of actions specified. For tunneled packets, all
10352  * L2/L3/L4 fields specified are fields of inner headers unless otherwise
10353  * specified. # If a field specified in this command is not enabled as a valid
10354  * field, then that field shall not be used in matching packet header fields
10355  * against this EM flow entry.
10356  */
10357 /* Input        (112 bytes) */
10358 struct hwrm_cfa_em_flow_alloc_input {
10359         uint16_t req_type;
10360         /*
10361          * This value indicates what type of request this is. The format
10362          * for the rest of the command is determined by this field.
10363          */
10364         uint16_t cmpl_ring;
10365         /*
10366          * This value indicates the what completion ring the request
10367          * will be optionally completed on. If the value is -1, then no
10368          * CR completion will be generated. Any other value must be a
10369          * valid CR ring_id value for this function.
10370          */
10371         uint16_t seq_id;
10372         /* This value indicates the command sequence number. */
10373         uint16_t target_id;
10374         /*
10375          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10376          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10377          * - HWRM
10378          */
10379         uint64_t resp_addr;
10380         /*
10381          * This is the host address where the response will be written
10382          * when the request is complete. This area must be 16B aligned
10383          * and must be cleared to zero before the request is made.
10384          */
10385         uint32_t flags;
10386         /*
10387          * Enumeration denoting the RX, TX type of the resource. This
10388          * enumeration is used for resources that are similar for both
10389          * TX and RX paths of the chip.
10390          */
10391         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_PATH UINT32_C(0x1)
10392         /* tx path */
10393         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_PATH_TX      \
10394                 (UINT32_C(0x0) << 0)
10395         /* rx path */
10396         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_PATH_RX      \
10397                 (UINT32_C(0x1) << 0)
10398         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_PATH_LAST \
10399                 CFA_EM_FLOW_ALLOC_INPUT_FLAGS_PATH_RX
10400         /*
10401          * Setting of this flag indicates enabling of a byte counter for
10402          * a given flow.
10403          */
10404         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_BYTE_CTR     UINT32_C(0x2)
10405         /*
10406          * Setting of this flag indicates enabling of a packet counter
10407          * for a given flow.
10408          */
10409         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_PKT_CTR      UINT32_C(0x4)
10410         /*
10411          * Setting of this flag indicates de-capsulation action for the
10412          * given flow.
10413          */
10414         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_DECAP        UINT32_C(0x8)
10415         /*
10416          * Setting of this flag indicates encapsulation action for the
10417          * given flow.
10418          */
10419         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_ENCAP        UINT32_C(0x10)
10420         /*
10421          * Setting of this flag indicates drop action. If this flag is
10422          * not set, then it should be considered accept action.
10423          */
10424         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_DROP UINT32_C(0x20)
10425         /*
10426          * Setting of this flag indicates that a meter is expected to be
10427          * attached to this flow. This hint can be used when choosing
10428          * the action record format required for the flow.
10429          */
10430         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_METER        UINT32_C(0x40)
10431         uint32_t enables;
10432         /* This bit must be '1' for the l2_filter_id field to be configured. */
10433         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_L2_FILTER_ID UINT32_C(0x1)
10434         /* This bit must be '1' for the tunnel_type field to be configured. */
10435         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_TUNNEL_TYPE UINT32_C(0x2)
10436         /* This bit must be '1' for the tunnel_id field to be configured. */
10437         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_TUNNEL_ID UINT32_C(0x4)
10438         /* This bit must be '1' for the src_macaddr field to be configured. */
10439         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_SRC_MACADDR UINT32_C(0x8)
10440         /* This bit must be '1' for the dst_macaddr field to be configured. */
10441         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_DST_MACADDR UINT32_C(0x10)
10442         /* This bit must be '1' for the ovlan_vid field to be configured. */
10443         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_OVLAN_VID UINT32_C(0x20)
10444         /* This bit must be '1' for the ivlan_vid field to be configured. */
10445         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_IVLAN_VID UINT32_C(0x40)
10446         /* This bit must be '1' for the ethertype field to be configured. */
10447         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_ETHERTYPE UINT32_C(0x80)
10448         /* This bit must be '1' for the src_ipaddr field to be configured. */
10449         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_SRC_IPADDR UINT32_C(0x100)
10450         /* This bit must be '1' for the dst_ipaddr field to be configured. */
10451         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_DST_IPADDR UINT32_C(0x200)
10452         /* This bit must be '1' for the ipaddr_type field to be configured. */
10453         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_IPADDR_TYPE UINT32_C(0x400)
10454         /* This bit must be '1' for the ip_protocol field to be configured. */
10455         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_IP_PROTOCOL UINT32_C(0x800)
10456         /* This bit must be '1' for the src_port field to be configured. */
10457         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_SRC_PORT UINT32_C(0x1000)
10458         /* This bit must be '1' for the dst_port field to be configured. */
10459         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_DST_PORT UINT32_C(0x2000)
10460         /* This bit must be '1' for the dst_id field to be configured. */
10461         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_DST_ID     UINT32_C(0x4000)
10462         /*
10463          * This bit must be '1' for the mirror_vnic_id field to be
10464          * configured.
10465          */
10466         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID     \
10467                 UINT32_C(0x8000)
10468         /*
10469          * This bit must be '1' for the encap_record_id field to be
10470          * configured.
10471          */
10472         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_ENCAP_RECORD_ID     \
10473                 UINT32_C(0x10000)
10474         /*
10475          * This bit must be '1' for the meter_instance_id field to be
10476          * configured.
10477          */
10478         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_METER_INSTANCE_ID  \
10479                 UINT32_C(0x20000)
10480         uint64_t l2_filter_id;
10481         /*
10482          * This value identifies a set of CFA data structures used for
10483          * an L2 context.
10484          */
10485         uint8_t tunnel_type;
10486         /* Tunnel Type. */
10487         /* Non-tunnel */
10488         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_NONTUNNEL \
10489                 UINT32_C(0x0)
10490         /* Virtual eXtensible Local Area Network        (VXLAN) */
10491         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_VXLAN  UINT32_C(0x1)
10492         /*
10493          * Network Virtualization Generic Routing
10494          * Encapsulation        (NVGRE)
10495          */
10496         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_NVGRE  UINT32_C(0x2)
10497         /*
10498          * Generic Routing Encapsulation        (GRE) inside
10499          * Ethernet payload
10500          */
10501         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_L2GRE  UINT32_C(0x3)
10502         /* IP in IP */
10503         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_IPIP   UINT32_C(0x4)
10504         /* Generic Network Virtualization Encapsulation (Geneve) */
10505         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_GENEVE UINT32_C(0x5)
10506         /* Multi-Protocol Lable Switching       (MPLS) */
10507         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_MPLS   UINT32_C(0x6)
10508         /* Stateless Transport Tunnel   (STT) */
10509         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_STT    UINT32_C(0x7)
10510         /*
10511          * Generic Routing Encapsulation        (GRE) inside IP
10512          * datagram payload
10513          */
10514         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_IPGRE  UINT32_C(0x8)
10515         /*
10516          * IPV4 over virtual eXtensible Local Area
10517          * Network (IPV4oVXLAN)
10518          */
10519         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_VXLAN_V4 UINT32_C(0x9)
10520         /* Any tunneled traffic */
10521         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_ANYTUNNEL \
10522                 UINT32_C(0xff)
10523         uint8_t unused_0;
10524         uint16_t unused_1;
10525         uint32_t tunnel_id;
10526         /*
10527          * Tunnel identifier. Virtual Network Identifier        (VNI). Only
10528          * valid with tunnel_types VXLAN, NVGRE, and Geneve. Only lower
10529          * 24-bits of VNI field are used in setting up the filter.
10530          */
10531         uint8_t src_macaddr[6];
10532         /*
10533          * This value indicates the source MAC address in the Ethernet
10534          * header.
10535          */
10536         uint16_t meter_instance_id;
10537         /* The meter instance to attach to the flow. */
10538         /*
10539          * A value of 0xfff is considered invalid and
10540          * implies the instance is not configured.
10541          */
10542         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_METER_INSTANCE_ID_INVALID   \
10543                 UINT32_C(0xffff)
10544         uint8_t dst_macaddr[6];
10545         /*
10546          * This value indicates the destination MAC address in the
10547          * Ethernet header.
10548          */
10549         uint16_t ovlan_vid;
10550         /*
10551          * This value indicates the VLAN ID of the outer VLAN tag in the
10552          * Ethernet header.
10553          */
10554         uint16_t ivlan_vid;
10555         /*
10556          * This value indicates the VLAN ID of the inner VLAN tag in the
10557          * Ethernet header.
10558          */
10559         uint16_t ethertype;
10560         /* This value indicates the ethertype in the Ethernet header. */
10561         uint8_t ip_addr_type;
10562         /*
10563          * This value indicates the type of IP address. 4 - IPv4 6 -
10564          * IPv6 All others are invalid.
10565          */
10566         /* invalid */
10567         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_IP_ADDR_TYPE_UNKNOWN UINT32_C(0x0)
10568         /* IPv4 */
10569         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_IP_ADDR_TYPE_IPV4  UINT32_C(0x4)
10570         /* IPv6 */
10571         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_IP_ADDR_TYPE_IPV6  UINT32_C(0x6)
10572         uint8_t ip_protocol;
10573         /*
10574          * The value of protocol filed in IP header. Applies to UDP and
10575          * TCP traffic. 6 - TCP 17 - UDP
10576          */
10577         /* invalid */
10578         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_IP_PROTOCOL_UNKNOWN UINT32_C(0x0)
10579         /* TCP */
10580         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_IP_PROTOCOL_TCP UINT32_C(0x6)
10581         /* UDP */
10582         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_IP_PROTOCOL_UDP UINT32_C(0x11)
10583         uint8_t unused_2;
10584         uint8_t unused_3;
10585         uint32_t src_ipaddr[4];
10586         /*
10587          * The value of source IP address to be used in filtering. For
10588          * IPv4, first four bytes represent the IP address.
10589          */
10590         uint32_t dst_ipaddr[4];
10591         /*
10592          * big_endian = True The value of destination IP address to be
10593          * used in filtering. For IPv4, first four bytes represent the
10594          * IP address.
10595          */
10596         uint16_t src_port;
10597         /*
10598          * The value of source port to be used in filtering. Applies to
10599          * UDP and TCP traffic.
10600          */
10601         uint16_t dst_port;
10602         /*
10603          * The value of destination port to be used in filtering.
10604          * Applies to UDP and TCP traffic.
10605          */
10606         uint16_t dst_id;
10607         /*
10608          * If set, this value shall represent the Logical VNIC ID of the
10609          * destination VNIC for the RX path and network port id of the
10610          * destination port for the TX path.
10611          */
10612         uint16_t mirror_vnic_id;
10613         /* Logical VNIC ID of the VNIC where traffic is mirrored. */
10614         uint32_t encap_record_id;
10615         /* Logical ID of the encapsulation record. */
10616         uint32_t unused_4;
10617 } __attribute__((packed));
10618
10619 /* Output       (24 bytes) */
10620 struct hwrm_cfa_em_flow_alloc_output {
10621         uint16_t error_code;
10622         /*
10623          * Pass/Fail or error type Note: receiver to verify the in
10624          * parameters, and fail the call with an error when appropriate
10625          */
10626         uint16_t req_type;
10627         /* This field returns the type of original request. */
10628         uint16_t seq_id;
10629         /* This field provides original sequence number of the command. */
10630         uint16_t resp_len;
10631         /*
10632          * This field is the length of the response in bytes. The last
10633          * byte of the response is a valid flag that will read as '1'
10634          * when the command has been completely written to memory.
10635          */
10636         uint64_t em_filter_id;
10637         /* This value is an opaque id into CFA data structures. */
10638         uint32_t flow_id;
10639         /*
10640          * This is the ID of the flow associated with this filter. This
10641          * value shall be used to match and associate the flow
10642          * identifier returned in completion records. A value of
10643          * 0xFFFFFFFF shall indicate no flow id.
10644          */
10645         uint8_t unused_0;
10646         uint8_t unused_1;
10647         uint8_t unused_2;
10648         uint8_t valid;
10649         /*
10650          * This field is used in Output records to indicate that the
10651          * output is completely written to RAM. This field should be
10652          * read as '1' to indicate that the output has been completely
10653          * written. When writing a command completion or response to an
10654          * internal processor, the order of writes has to be such that
10655          * this field is written last.
10656          */
10657 } __attribute__((packed));
10658
10659 /* hwrm_cfa_em_flow_free */
10660 /* Description: Free an EM flow table entry */
10661 /* Input        (24 bytes) */
10662 struct hwrm_cfa_em_flow_free_input {
10663         uint16_t req_type;
10664         /*
10665          * This value indicates what type of request this is. The format
10666          * for the rest of the command is determined by this field.
10667          */
10668         uint16_t cmpl_ring;
10669         /*
10670          * This value indicates the what completion ring the request
10671          * will be optionally completed on. If the value is -1, then no
10672          * CR completion will be generated. Any other value must be a
10673          * valid CR ring_id value for this function.
10674          */
10675         uint16_t seq_id;
10676         /* This value indicates the command sequence number. */
10677         uint16_t target_id;
10678         /*
10679          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10680          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10681          * - HWRM
10682          */
10683         uint64_t resp_addr;
10684         /*
10685          * This is the host address where the response will be written
10686          * when the request is complete. This area must be 16B aligned
10687          * and must be cleared to zero before the request is made.
10688          */
10689         uint64_t em_filter_id;
10690         /* This value is an opaque id into CFA data structures. */
10691 } __attribute__((packed));
10692
10693 /* Output       (16 bytes) */
10694 struct hwrm_cfa_em_flow_free_output {
10695         uint16_t error_code;
10696         /*
10697          * Pass/Fail or error type Note: receiver to verify the in
10698          * parameters, and fail the call with an error when appropriate
10699          */
10700         uint16_t req_type;
10701         /* This field returns the type of original request. */
10702         uint16_t seq_id;
10703         /* This field provides original sequence number of the command. */
10704         uint16_t resp_len;
10705         /*
10706          * This field is the length of the response in bytes. The last
10707          * byte of the response is a valid flag that will read as '1'
10708          * when the command has been completely written to memory.
10709          */
10710         uint32_t unused_0;
10711         uint8_t unused_1;
10712         uint8_t unused_2;
10713         uint8_t unused_3;
10714         uint8_t valid;
10715         /*
10716          * This field is used in Output records to indicate that the
10717          * output is completely written to RAM. This field should be
10718          * read as '1' to indicate that the output has been completely
10719          * written. When writing a command completion or response to an
10720          * internal processor, the order of writes has to be such that
10721          * this field is written last.
10722          */
10723 } __attribute__((packed));
10724
10725 /* hwrm_cfa_em_flow_cfg */
10726 /*
10727  * Description: Configure an EM flow with a new destination VNIC and/or meter.
10728  */
10729 /* Input        (48 bytes) */
10730 struct hwrm_cfa_em_flow_cfg_input {
10731         uint16_t req_type;
10732         /*
10733          * This value indicates what type of request this is. The format
10734          * for the rest of the command is determined by this field.
10735          */
10736         uint16_t cmpl_ring;
10737         /*
10738          * This value indicates the what completion ring the request
10739          * will be optionally completed on. If the value is -1, then no
10740          * CR completion will be generated. Any other value must be a
10741          * valid CR ring_id value for this function.
10742          */
10743         uint16_t seq_id;
10744         /* This value indicates the command sequence number. */
10745         uint16_t target_id;
10746         /*
10747          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10748          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10749          * - HWRM
10750          */
10751         uint64_t resp_addr;
10752         /*
10753          * This is the host address where the response will be written
10754          * when the request is complete. This area must be 16B aligned
10755          * and must be cleared to zero before the request is made.
10756          */
10757         uint32_t enables;
10758         /* This bit must be '1' for the new_dst_id field to be configured. */
10759         #define HWRM_CFA_EM_FLOW_CFG_INPUT_ENABLES_NEW_DST_ID   UINT32_C(0x1)
10760         /*
10761          * This bit must be '1' for the new_mirror_vnic_id field to be
10762          * configured.
10763          */
10764         #define HWRM_CFA_EM_FLOW_CFG_INPUT_ENABLES_NEW_MIRROR_VNIC_ID   \
10765                 UINT32_C(0x2)
10766         /*
10767          * This bit must be '1' for the new_meter_instance_id field to
10768          * be configured.
10769          */
10770         #define HWRM_CFA_EM_FLOW_CFG_INPUT_ENABLES_NEW_METER_INSTANCE_ID  \
10771                 UINT32_C(0x4)
10772         uint32_t unused_0;
10773         uint64_t em_filter_id;
10774         /* This value is an opaque id into CFA data structures. */
10775         uint32_t new_dst_id;
10776         /*
10777          * If set, this value shall represent the new Logical VNIC ID of
10778          * the destination VNIC for the RX path and network port id of
10779          * the destination port for the TX path.
10780          */
10781         uint32_t new_mirror_vnic_id;
10782         /* New Logical VNIC ID of the VNIC where traffic is mirrored. */
10783         uint16_t new_meter_instance_id;
10784         /*
10785          * New meter to attach to the flow. Specifying the invalid
10786          * instance ID is used to remove any existing meter from the
10787          * flow.
10788          */
10789         /*
10790          * A value of 0xfff is considered invalid and
10791          * implies the instance is not configured.
10792          */
10793         #define HWRM_CFA_EM_FLOW_CFG_INPUT_NEW_METER_INSTANCE_ID_INVALID \
10794                 UINT32_C(0xffff)
10795         uint16_t unused_1[3];
10796 } __attribute__((packed));
10797
10798 /* Output       (16 bytes) */
10799 struct hwrm_cfa_em_flow_cfg_output {
10800         uint16_t error_code;
10801         /*
10802          * Pass/Fail or error type Note: receiver to verify the in
10803          * parameters, and fail the call with an error when appropriate
10804          */
10805         uint16_t req_type;
10806         /* This field returns the type of original request. */
10807         uint16_t seq_id;
10808         /* This field provides original sequence number of the command. */
10809         uint16_t resp_len;
10810         /*
10811          * This field is the length of the response in bytes. The last
10812          * byte of the response is a valid flag that will read as '1'
10813          * when the command has been completely written to memory.
10814          */
10815         uint32_t unused_0;
10816         uint8_t unused_1;
10817         uint8_t unused_2;
10818         uint8_t unused_3;
10819         uint8_t valid;
10820         /*
10821          * This field is used in Output records to indicate that the
10822          * output is completely written to RAM. This field should be
10823          * read as '1' to indicate that the output has been completely
10824          * written. When writing a command completion or response to an
10825          * internal processor, the order of writes has to be such that
10826          * this field is written last.
10827          */
10828 } __attribute__((packed));
10829
10830 /* hwrm_tunnel_dst_port_query */
10831 /*
10832  * Description: This function is called by a driver to query tunnel type
10833  * specific destination port configuration.
10834  */
10835 /* Input        (24 bytes) */
10836 struct hwrm_tunnel_dst_port_query_input {
10837         uint16_t req_type;
10838         /*
10839          * This value indicates what type of request this is. The format
10840          * for the rest of the command is determined by this field.
10841          */
10842         uint16_t cmpl_ring;
10843         /*
10844          * This value indicates the what completion ring the request
10845          * will be optionally completed on. If the value is -1, then no
10846          * CR completion will be generated. Any other value must be a
10847          * valid CR ring_id value for this function.
10848          */
10849         uint16_t seq_id;
10850         /* This value indicates the command sequence number. */
10851         uint16_t target_id;
10852         /*
10853          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10854          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10855          * - HWRM
10856          */
10857         uint64_t resp_addr;
10858         /*
10859          * This is the host address where the response will be written
10860          * when the request is complete. This area must be 16B aligned
10861          * and must be cleared to zero before the request is made.
10862          */
10863         uint8_t tunnel_type;
10864         /* Tunnel Type. */
10865         /* Virtual eXtensible Local Area Network        (VXLAN) */
10866         #define HWRM_TUNNEL_DST_PORT_QUERY_INPUT_TUNNEL_TYPE_VXLAN \
10867                 UINT32_C(0x1)
10868         /* Generic Network Virtualization Encapsulation (Geneve) */
10869         #define HWRM_TUNNEL_DST_PORT_QUERY_INPUT_TUNNEL_TYPE_GENEVE \
10870                 UINT32_C(0x5)
10871         /*
10872          * IPV4 over virtual eXtensible Local Area
10873          * Network (IPV4oVXLAN)
10874          */
10875         #define HWRM_TUNNEL_DST_PORT_QUERY_INPUT_TUNNEL_TYPE_VXLAN_V4 \
10876                 UINT32_C(0x9)
10877         uint8_t unused_0[7];
10878 } __attribute__((packed));
10879
10880 /* Output       (16 bytes) */
10881 struct hwrm_tunnel_dst_port_query_output {
10882         uint16_t error_code;
10883         /*
10884          * Pass/Fail or error type Note: receiver to verify the in
10885          * parameters, and fail the call with an error when appropriate
10886          */
10887         uint16_t req_type;
10888         /* This field returns the type of original request. */
10889         uint16_t seq_id;
10890         /* This field provides original sequence number of the command. */
10891         uint16_t resp_len;
10892         /*
10893          * This field is the length of the response in bytes. The last
10894          * byte of the response is a valid flag that will read as '1'
10895          * when the command has been completely written to memory.
10896          */
10897         uint16_t tunnel_dst_port_id;
10898         /*
10899          * This field represents the identifier of L4 destination port
10900          * used for the given tunnel type. This field is valid for
10901          * specific tunnel types that use layer 4       (e.g. UDP) transports
10902          * for tunneling.
10903          */
10904         uint16_t tunnel_dst_port_val;
10905         /*
10906          * This field represents the value of L4 destination port
10907          * identified by tunnel_dst_port_id. This field is valid for
10908          * specific tunnel types that use layer 4       (e.g. UDP) transports
10909          * for tunneling. This field is in network byte order. A value
10910          * of 0 means that the destination port is not configured.
10911          */
10912         uint8_t unused_0;
10913         uint8_t unused_1;
10914         uint8_t unused_2;
10915         uint8_t valid;
10916         /*
10917          * This field is used in Output records to indicate that the
10918          * output is completely written to RAM. This field should be
10919          * read as '1' to indicate that the output has been completely
10920          * written. When writing a command completion or response to an
10921          * internal processor, the order of writes has to be such that
10922          * this field is written last.
10923          */
10924 } __attribute__((packed));
10925
10926 /* hwrm_tunnel_dst_port_alloc */
10927 /*
10928  * Description: This function is called by a driver to allocate l4 destination
10929  * port for a specific tunnel type. The destination port value is provided in
10930  * the input. If the HWRM supports only one global destination port for a tunnel
10931  * type, then the HWRM shall keep track of its usage as described below. # The
10932  * first caller that allocates a destination port shall always succeed and the
10933  * HWRM shall save the destination port configuration for that tunnel type and
10934  * increment the usage count to 1. # Subsequent callers allocating the same
10935  * destination port for that tunnel type shall succeed and the HWRM shall
10936  * increment the usage count for that port for each subsequent caller that
10937  * succeeds. # Any subsequent caller trying to allocate a different destination
10938  * port for that tunnel type shall fail until the usage count for the original
10939  * destination port goes to zero. # A caller that frees a port will cause the
10940  * usage count for that port to decrement.
10941  */
10942 /* Input        (24 bytes) */
10943 struct hwrm_tunnel_dst_port_alloc_input {
10944         uint16_t req_type;
10945         /*
10946          * This value indicates what type of request this is. The format
10947          * for the rest of the command is determined by this field.
10948          */
10949         uint16_t cmpl_ring;
10950         /*
10951          * This value indicates the what completion ring the request
10952          * will be optionally completed on. If the value is -1, then no
10953          * CR completion will be generated. Any other value must be a
10954          * valid CR ring_id value for this function.
10955          */
10956         uint16_t seq_id;
10957         /* This value indicates the command sequence number. */
10958         uint16_t target_id;
10959         /*
10960          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10961          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10962          * - HWRM
10963          */
10964         uint64_t resp_addr;
10965         /*
10966          * This is the host address where the response will be written
10967          * when the request is complete. This area must be 16B aligned
10968          * and must be cleared to zero before the request is made.
10969          */
10970         uint8_t tunnel_type;
10971         /* Tunnel Type. */
10972         /* Virtual eXtensible Local Area Network        (VXLAN) */
10973         #define HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_VXLAN UINT32_C(0x1)
10974         /* Generic Network Virtualization Encapsulation (Geneve) */
10975         #define HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_GENEVE \
10976                 UINT32_C(0x5)
10977         /*
10978          * IPV4 over virtual eXtensible Local Area
10979          * Network (IPV4oVXLAN)
10980          */
10981         #define HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_VXLAN_V4 \
10982                 UINT32_C(0x9)
10983         uint8_t unused_0;
10984         uint16_t tunnel_dst_port_val;
10985         /*
10986          * This field represents the value of L4 destination port used
10987          * for the given tunnel type. This field is valid for specific
10988          * tunnel types that use layer 4        (e.g. UDP) transports for
10989          * tunneling. This field is in network byte order. A value of 0
10990          * shall fail the command.
10991          */
10992         uint32_t unused_1;
10993 } __attribute__((packed));
10994
10995 /* Output       (16 bytes) */
10996 struct hwrm_tunnel_dst_port_alloc_output {
10997         uint16_t error_code;
10998         /*
10999          * Pass/Fail or error type Note: receiver to verify the in
11000          * parameters, and fail the call with an error when appropriate
11001          */
11002         uint16_t req_type;
11003         /* This field returns the type of original request. */
11004         uint16_t seq_id;
11005         /* This field provides original sequence number of the command. */
11006         uint16_t resp_len;
11007         /*
11008          * This field is the length of the response in bytes. The last
11009          * byte of the response is a valid flag that will read as '1'
11010          * when the command has been completely written to memory.
11011          */
11012         uint16_t tunnel_dst_port_id;
11013         /*
11014          * Identifier of a tunnel L4 destination port value. Only
11015          * applies to tunnel types that has l4 destination port
11016          * parameters.
11017          */
11018         uint8_t unused_0;
11019         uint8_t unused_1;
11020         uint8_t unused_2;
11021         uint8_t unused_3;
11022         uint8_t unused_4;
11023         uint8_t valid;
11024         /*
11025          * This field is used in Output records to indicate that the
11026          * output is completely written to RAM. This field should be
11027          * read as '1' to indicate that the output has been completely
11028          * written. When writing a command completion or response to an
11029          * internal processor, the order of writes has to be such that
11030          * this field is written last.
11031          */
11032 } __attribute__((packed));
11033
11034 /* hwrm_tunnel_dst_port_free */
11035 /*
11036  * Description: This function is called by a driver to free l4 destination port
11037  * for a specific tunnel type.
11038  */
11039 /* Input        (24 bytes) */
11040 struct hwrm_tunnel_dst_port_free_input {
11041         uint16_t req_type;
11042         /*
11043          * This value indicates what type of request this is. The format
11044          * for the rest of the command is determined by this field.
11045          */
11046         uint16_t cmpl_ring;
11047         /*
11048          * This value indicates the what completion ring the request
11049          * will be optionally completed on. If the value is -1, then no
11050          * CR completion will be generated. Any other value must be a
11051          * valid CR ring_id value for this function.
11052          */
11053         uint16_t seq_id;
11054         /* This value indicates the command sequence number. */
11055         uint16_t target_id;
11056         /*
11057          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11058          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11059          * - HWRM
11060          */
11061         uint64_t resp_addr;
11062         /*
11063          * This is the host address where the response will be written
11064          * when the request is complete. This area must be 16B aligned
11065          * and must be cleared to zero before the request is made.
11066          */
11067         uint8_t tunnel_type;
11068         /* Tunnel Type. */
11069         /* Virtual eXtensible Local Area Network        (VXLAN) */
11070         #define HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_VXLAN UINT32_C(0x1)
11071         /* Generic Network Virtualization Encapsulation (Geneve) */
11072         #define HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_GENEVE UINT32_C(0x5)
11073         /*
11074          * IPV4 over virtual eXtensible Local Area
11075          * Network (IPV4oVXLAN)
11076          */
11077         #define HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_VXLAN_V4 \
11078                 UINT32_C(0x9)
11079         uint8_t unused_0;
11080         uint16_t tunnel_dst_port_id;
11081         /*
11082          * Identifier of a tunnel L4 destination port value. Only
11083          * applies to tunnel types that has l4 destination port
11084          * parameters.
11085          */
11086         uint32_t unused_1;
11087 } __attribute__((packed));
11088
11089 /* Output       (16 bytes) */
11090 struct hwrm_tunnel_dst_port_free_output {
11091         uint16_t error_code;
11092         /*
11093          * Pass/Fail or error type Note: receiver to verify the in
11094          * parameters, and fail the call with an error when appropriate
11095          */
11096         uint16_t req_type;
11097         /* This field returns the type of original request. */
11098         uint16_t seq_id;
11099         /* This field provides original sequence number of the command. */
11100         uint16_t resp_len;
11101         /*
11102          * This field is the length of the response in bytes. The last
11103          * byte of the response is a valid flag that will read as '1'
11104          * when the command has been completely written to memory.
11105          */
11106         uint32_t unused_0;
11107         uint8_t unused_1;
11108         uint8_t unused_2;
11109         uint8_t unused_3;
11110         uint8_t valid;
11111         /*
11112          * This field is used in Output records to indicate that the
11113          * output is completely written to RAM. This field should be
11114          * read as '1' to indicate that the output has been completely
11115          * written. When writing a command completion or response to an
11116          * internal processor, the order of writes has to be such that
11117          * this field is written last.
11118          */
11119 } __attribute__((packed));
11120
11121 /* hwrm_stat_ctx_alloc */
11122 /*
11123  * Description: This command allocates and does basic preparation for a stat
11124  * context.
11125  */
11126 /* Input        (32 bytes) */
11127 struct hwrm_stat_ctx_alloc_input {
11128         uint16_t req_type;
11129         /*
11130          * This value indicates what type of request this is. The format
11131          * for the rest of the command is determined by this field.
11132          */
11133         uint16_t cmpl_ring;
11134         /*
11135          * This value indicates the what completion ring the request
11136          * will be optionally completed on. If the value is -1, then no
11137          * CR completion will be generated. Any other value must be a
11138          * valid CR ring_id value for this function.
11139          */
11140         uint16_t seq_id;
11141         /* This value indicates the command sequence number. */
11142         uint16_t target_id;
11143         /*
11144          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11145          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11146          * - HWRM
11147          */
11148         uint64_t resp_addr;
11149         /*
11150          * This is the host address where the response will be written
11151          * when the request is complete. This area must be 16B aligned
11152          * and must be cleared to zero before the request is made.
11153          */
11154         uint64_t stats_dma_addr;
11155         /* This is the address for statistic block. */
11156         uint32_t update_period_ms;
11157         /*
11158          * The statistic block update period in ms. e.g. 250ms, 500ms,
11159          * 750ms, 1000ms. If update_period_ms is 0, then the stats
11160          * update shall be never done and the DMA address shall not be
11161          * used. In this case, the stat block can only be read by
11162          * hwrm_stat_ctx_query command.
11163          */
11164         uint8_t stat_ctx_flags;
11165         /*
11166          * This field is used to specify statistics context specific
11167          * configuration flags.
11168          */
11169         /*
11170          * When this bit is set to '1', the statistics context shall be
11171          * allocated for RoCE traffic only. In this case, traffic other
11172          * than offloaded RoCE traffic shall not be included in this
11173          * statistic context. When this bit is set to '0', the
11174          * statistics context shall be used for the network traffic
11175          * other than offloaded RoCE traffic.
11176          */
11177         #define HWRM_STAT_CTX_ALLOC_INPUT_STAT_CTX_FLAGS_ROCE   UINT32_C(0x1)
11178         uint8_t unused_0[3];
11179 } __attribute__((packed));
11180
11181 /* Output       (16 bytes) */
11182 struct hwrm_stat_ctx_alloc_output {
11183         uint16_t error_code;
11184         /*
11185          * Pass/Fail or error type Note: receiver to verify the in
11186          * parameters, and fail the call with an error when appropriate
11187          */
11188         uint16_t req_type;
11189         /* This field returns the type of original request. */
11190         uint16_t seq_id;
11191         /* This field provides original sequence number of the command. */
11192         uint16_t resp_len;
11193         /*
11194          * This field is the length of the response in bytes. The last
11195          * byte of the response is a valid flag that will read as '1'
11196          * when the command has been completely written to memory.
11197          */
11198         uint32_t stat_ctx_id;
11199         /* This is the statistics context ID value. */
11200         uint8_t unused_0;
11201         uint8_t unused_1;
11202         uint8_t unused_2;
11203         uint8_t valid;
11204         /*
11205          * This field is used in Output records to indicate that the
11206          * output is completely written to RAM. This field should be
11207          * read as '1' to indicate that the output has been completely
11208          * written. When writing a command completion or response to an
11209          * internal processor, the order of writes has to be such that
11210          * this field is written last.
11211          */
11212 } __attribute__((packed));
11213
11214 /* hwrm_stat_ctx_free */
11215 /* Description: This command is used to free a stat context. */
11216 /* Input        (24 bytes) */
11217 struct hwrm_stat_ctx_free_input {
11218         uint16_t req_type;
11219         /*
11220          * This value indicates what type of request this is. The format
11221          * for the rest of the command is determined by this field.
11222          */
11223         uint16_t cmpl_ring;
11224         /*
11225          * This value indicates the what completion ring the request
11226          * will be optionally completed on. If the value is -1, then no
11227          * CR completion will be generated. Any other value must be a
11228          * valid CR ring_id value for this function.
11229          */
11230         uint16_t seq_id;
11231         /* This value indicates the command sequence number. */
11232         uint16_t target_id;
11233         /*
11234          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11235          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11236          * - HWRM
11237          */
11238         uint64_t resp_addr;
11239         /*
11240          * This is the host address where the response will be written
11241          * when the request is complete. This area must be 16B aligned
11242          * and must be cleared to zero before the request is made.
11243          */
11244         uint32_t stat_ctx_id;
11245         /* ID of the statistics context that is being queried. */
11246         uint32_t unused_0;
11247 } __attribute__((packed));
11248
11249 /* Output       (16 bytes) */
11250 struct hwrm_stat_ctx_free_output {
11251         uint16_t error_code;
11252         /*
11253          * Pass/Fail or error type Note: receiver to verify the in
11254          * parameters, and fail the call with an error when appropriate
11255          */
11256         uint16_t req_type;
11257         /* This field returns the type of original request. */
11258         uint16_t seq_id;
11259         /* This field provides original sequence number of the command. */
11260         uint16_t resp_len;
11261         /*
11262          * This field is the length of the response in bytes. The last
11263          * byte of the response is a valid flag that will read as '1'
11264          * when the command has been completely written to memory.
11265          */
11266         uint32_t stat_ctx_id;
11267         /* This is the statistics context ID value. */
11268         uint8_t unused_0;
11269         uint8_t unused_1;
11270         uint8_t unused_2;
11271         uint8_t valid;
11272         /*
11273          * This field is used in Output records to indicate that the
11274          * output is completely written to RAM. This field should be
11275          * read as '1' to indicate that the output has been completely
11276          * written. When writing a command completion or response to an
11277          * internal processor, the order of writes has to be such that
11278          * this field is written last.
11279          */
11280 } __attribute__((packed));
11281
11282 /* hwrm_stat_ctx_query */
11283 /* Description: This command returns statistics of a context. */
11284 /* Input (24 bytes) */
11285 struct hwrm_stat_ctx_query_input {
11286         uint16_t req_type;
11287         /*
11288          * This value indicates what type of request this is. The format for the
11289          * rest of the command is determined by this field.
11290          */
11291         uint16_t cmpl_ring;
11292         /*
11293          * This value indicates the what completion ring the request will be
11294          * optionally completed on. If the value is -1, then no CR completion
11295          * will be generated. Any other value must be a valid CR ring_id value
11296          * for this function.
11297          */
11298         uint16_t seq_id;
11299         /* This value indicates the command sequence number. */
11300         uint16_t target_id;
11301         /*
11302          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
11303          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
11304          */
11305         uint64_t resp_addr;
11306         /*
11307          * This is the host address where the response will be written when the
11308          * request is complete. This area must be 16B aligned and must be
11309          * cleared to zero before the request is made.
11310          */
11311         uint32_t stat_ctx_id;
11312         /* ID of the statistics context that is being queried. */
11313         uint32_t unused_0;
11314 } __attribute__((packed));
11315
11316 /* Output (176 bytes) */
11317 struct hwrm_stat_ctx_query_output {
11318         uint16_t error_code;
11319         /*
11320          * Pass/Fail or error type Note: receiver to verify the in parameters,
11321          * and fail the call with an error when appropriate
11322          */
11323         uint16_t req_type;
11324         /* This field returns the type of original request. */
11325         uint16_t seq_id;
11326         /* This field provides original sequence number of the command. */
11327         uint16_t resp_len;
11328         /*
11329          * This field is the length of the response in bytes. The last byte of
11330          * the response is a valid flag that will read as '1' when the command
11331          * has been completely written to memory.
11332          */
11333         uint64_t tx_ucast_pkts;
11334         /* Number of transmitted unicast packets */
11335         uint64_t tx_mcast_pkts;
11336         /* Number of transmitted multicast packets */
11337         uint64_t tx_bcast_pkts;
11338         /* Number of transmitted broadcast packets */
11339         uint64_t tx_err_pkts;
11340         /* Number of transmitted packets with error */
11341         uint64_t tx_drop_pkts;
11342         /* Number of dropped packets on transmit path */
11343         uint64_t tx_ucast_bytes;
11344         /* Number of transmitted bytes for unicast traffic */
11345         uint64_t tx_mcast_bytes;
11346         /* Number of transmitted bytes for multicast traffic */
11347         uint64_t tx_bcast_bytes;
11348         /* Number of transmitted bytes for broadcast traffic */
11349         uint64_t rx_ucast_pkts;
11350         /* Number of received unicast packets */
11351         uint64_t rx_mcast_pkts;
11352         /* Number of received multicast packets */
11353         uint64_t rx_bcast_pkts;
11354         /* Number of received broadcast packets */
11355         uint64_t rx_err_pkts;
11356         /* Number of received packets with error */
11357         uint64_t rx_drop_pkts;
11358         /* Number of dropped packets on received path */
11359         uint64_t rx_ucast_bytes;
11360         /* Number of received bytes for unicast traffic */
11361         uint64_t rx_mcast_bytes;
11362         /* Number of received bytes for multicast traffic */
11363         uint64_t rx_bcast_bytes;
11364         /* Number of received bytes for broadcast traffic */
11365         uint64_t rx_agg_pkts;
11366         /* Number of aggregated unicast packets */
11367         uint64_t rx_agg_bytes;
11368         /* Number of aggregated unicast bytes */
11369         uint64_t rx_agg_events;
11370         /* Number of aggregation events */
11371         uint64_t rx_agg_aborts;
11372         /* Number of aborted aggregations */
11373         uint32_t unused_0;
11374         uint8_t unused_1;
11375         uint8_t unused_2;
11376         uint8_t unused_3;
11377         uint8_t valid;
11378         /*
11379          * This field is used in Output records to indicate that the output is
11380          * completely written to RAM. This field should be read as '1' to
11381          * indicate that the output has been completely written. When writing a
11382          * command completion or response to an internal processor, the order of
11383          * writes has to be such that this field is written last.
11384          */
11385 } __attribute__((packed));
11386
11387 /* hwrm_stat_ctx_clr_stats */
11388 /* Description: This command clears statistics of a context. */
11389 /* Input        (24 bytes) */
11390 struct hwrm_stat_ctx_clr_stats_input {
11391         uint16_t req_type;
11392         /*
11393          * This value indicates what type of request this is. The format
11394          * for the rest of the command is determined by this field.
11395          */
11396         uint16_t cmpl_ring;
11397         /*
11398          * This value indicates the what completion ring the request
11399          * will be optionally completed on. If the value is -1, then no
11400          * CR completion will be generated. Any other value must be a
11401          * valid CR ring_id value for this function.
11402          */
11403         uint16_t seq_id;
11404         /* This value indicates the command sequence number. */
11405         uint16_t target_id;
11406         /*
11407          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11408          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11409          * - HWRM
11410          */
11411         uint64_t resp_addr;
11412         /*
11413          * This is the host address where the response will be written
11414          * when the request is complete. This area must be 16B aligned
11415          * and must be cleared to zero before the request is made.
11416          */
11417         uint32_t stat_ctx_id;
11418         /* ID of the statistics context that is being queried. */
11419         uint32_t unused_0;
11420 } __attribute__((packed));
11421
11422 /* Output       (16 bytes) */
11423 struct hwrm_stat_ctx_clr_stats_output {
11424         uint16_t error_code;
11425         /*
11426          * Pass/Fail or error type Note: receiver to verify the in
11427          * parameters, and fail the call with an error when appropriate
11428          */
11429         uint16_t req_type;
11430         /* This field returns the type of original request. */
11431         uint16_t seq_id;
11432         /* This field provides original sequence number of the command. */
11433         uint16_t resp_len;
11434         /*
11435          * This field is the length of the response in bytes. The last
11436          * byte of the response is a valid flag that will read as '1'
11437          * when the command has been completely written to memory.
11438          */
11439         uint32_t unused_0;
11440         uint8_t unused_1;
11441         uint8_t unused_2;
11442         uint8_t unused_3;
11443         uint8_t valid;
11444         /*
11445          * This field is used in Output records to indicate that the
11446          * output is completely written to RAM. This field should be
11447          * read as '1' to indicate that the output has been completely
11448          * written. When writing a command completion or response to an
11449          * internal processor, the order of writes has to be such that
11450          * this field is written last.
11451          */
11452 } __attribute__((packed));
11453
11454 /* hwrm_exec_fwd_resp */
11455 /*
11456  * Description: This command is used to send an encapsulated request to the
11457  * HWRM. This command instructs the HWRM to execute the request and forward the
11458  * response of the encapsulated request to the location specified in the
11459  * original request that is encapsulated. The target id of this command shall be
11460  * set to 0xFFFF (HWRM). The response location in this command shall be used to
11461  * acknowledge the receipt of the encapsulated request and forwarding of the
11462  * response.
11463  */
11464 /* Input        (128 bytes) */
11465 struct hwrm_exec_fwd_resp_input {
11466         uint16_t req_type;
11467         /*
11468          * This value indicates what type of request this is. The format
11469          * for the rest of the command is determined by this field.
11470          */
11471         uint16_t cmpl_ring;
11472         /*
11473          * This value indicates the what completion ring the request
11474          * will be optionally completed on. If the value is -1, then no
11475          * CR completion will be generated. Any other value must be a
11476          * valid CR ring_id value for this function.
11477          */
11478         uint16_t seq_id;
11479         /* This value indicates the command sequence number. */
11480         uint16_t target_id;
11481         /*
11482          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11483          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11484          * - HWRM
11485          */
11486         uint64_t resp_addr;
11487         /*
11488          * This is the host address where the response will be written
11489          * when the request is complete. This area must be 16B aligned
11490          * and must be cleared to zero before the request is made.
11491          */
11492         uint32_t encap_request[26];
11493         /*
11494          * This is an encapsulated request. This request should be
11495          * executed by the HWRM and the response should be provided in
11496          * the response buffer inside the encapsulated request.
11497          */
11498         uint16_t encap_resp_target_id;
11499         /*
11500          * This value indicates the target id of the response to the
11501          * encapsulated request. 0x0 - 0xFFF8 - Used for function ids
11502          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF -
11503          * HWRM
11504          */
11505         uint16_t unused_0[3];
11506 } __attribute__((packed));
11507
11508 /* Output       (16 bytes) */
11509 struct hwrm_exec_fwd_resp_output {
11510         uint16_t error_code;
11511         /*
11512          * Pass/Fail or error type Note: receiver to verify the in
11513          * parameters, and fail the call with an error when appropriate
11514          */
11515         uint16_t req_type;
11516         /* This field returns the type of original request. */
11517         uint16_t seq_id;
11518         /* This field provides original sequence number of the command. */
11519         uint16_t resp_len;
11520         /*
11521          * This field is the length of the response in bytes. The last
11522          * byte of the response is a valid flag that will read as '1'
11523          * when the command has been completely written to memory.
11524          */
11525         uint32_t unused_0;
11526         uint8_t unused_1;
11527         uint8_t unused_2;
11528         uint8_t unused_3;
11529         uint8_t valid;
11530         /*
11531          * This field is used in Output records to indicate that the
11532          * output is completely written to RAM. This field should be
11533          * read as '1' to indicate that the output has been completely
11534          * written. When writing a command completion or response to an
11535          * internal processor, the order of writes has to be such that
11536          * this field is written last.
11537          */
11538 } __attribute__((packed));
11539
11540 /* hwrm_reject_fwd_resp */
11541 /*
11542  * Description: This command is used to send an encapsulated request to the
11543  * HWRM. This command instructs the HWRM to reject the request and forward the
11544  * error response of the encapsulated request to the location specified in the
11545  * original request that is encapsulated. The target id of this command shall be
11546  * set to 0xFFFF (HWRM). The response location in this command shall be used to
11547  * acknowledge the receipt of the encapsulated request and forwarding of the
11548  * response.
11549  */
11550 /* Input        (128 bytes) */
11551 struct hwrm_reject_fwd_resp_input {
11552         uint16_t req_type;
11553         /*
11554          * This value indicates what type of request this is. The format
11555          * for the rest of the command is determined by this field.
11556          */
11557         uint16_t cmpl_ring;
11558         /*
11559          * This value indicates the what completion ring the request
11560          * will be optionally completed on. If the value is -1, then no
11561          * CR completion will be generated. Any other value must be a
11562          * valid CR ring_id value for this function.
11563          */
11564         uint16_t seq_id;
11565         /* This value indicates the command sequence number. */
11566         uint16_t target_id;
11567         /*
11568          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11569          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11570          * - HWRM
11571          */
11572         uint64_t resp_addr;
11573         /*
11574          * This is the host address where the response will be written
11575          * when the request is complete. This area must be 16B aligned
11576          * and must be cleared to zero before the request is made.
11577          */
11578         uint32_t encap_request[26];
11579         /*
11580          * This is an encapsulated request. This request should be
11581          * rejected by the HWRM and the error response should be
11582          * provided in the response buffer inside the encapsulated
11583          * request.
11584          */
11585         uint16_t encap_resp_target_id;
11586         /*
11587          * This value indicates the target id of the response to the
11588          * encapsulated request. 0x0 - 0xFFF8 - Used for function ids
11589          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF -
11590          * HWRM
11591          */
11592         uint16_t unused_0[3];
11593 } __attribute__((packed));
11594
11595 /* Output       (16 bytes) */
11596 struct hwrm_reject_fwd_resp_output {
11597         uint16_t error_code;
11598         /*
11599          * Pass/Fail or error type Note: receiver to verify the in
11600          * parameters, and fail the call with an error when appropriate
11601          */
11602         uint16_t req_type;
11603         /* This field returns the type of original request. */
11604         uint16_t seq_id;
11605         /* This field provides original sequence number of the command. */
11606         uint16_t resp_len;
11607         /*
11608          * This field is the length of the response in bytes. The last
11609          * byte of the response is a valid flag that will read as '1'
11610          * when the command has been completely written to memory.
11611          */
11612         uint32_t unused_0;
11613         uint8_t unused_1;
11614         uint8_t unused_2;
11615         uint8_t unused_3;
11616         uint8_t valid;
11617         /*
11618          * This field is used in Output records to indicate that the
11619          * output is completely written to RAM. This field should be
11620          * read as '1' to indicate that the output has been completely
11621          * written. When writing a command completion or response to an
11622          * internal processor, the order of writes has to be such that
11623          * this field is written last.
11624          */
11625 } __attribute__((packed));
11626
11627 /* hwrm_nvm_get_dir_entries */
11628 /* Input (24 bytes) */
11629 struct hwrm_nvm_get_dir_entries_input {
11630         uint16_t req_type;
11631         uint16_t cmpl_ring;
11632         uint16_t seq_id;
11633         uint16_t target_id;
11634         uint64_t resp_addr;
11635         uint64_t host_dest_addr;
11636 } __attribute__((packed));
11637
11638 /* Output (16 bytes) */
11639 struct hwrm_nvm_get_dir_entries_output {
11640         uint16_t error_code;
11641         uint16_t req_type;
11642         uint16_t seq_id;
11643         uint16_t resp_len;
11644         uint32_t unused_0;
11645         uint8_t unused_1;
11646         uint8_t unused_2;
11647         uint8_t unused_3;
11648         uint8_t valid;
11649 } __attribute__((packed));
11650
11651
11652 /* hwrm_nvm_erase_dir_entry */
11653 /* Input (24 bytes) */
11654 struct hwrm_nvm_erase_dir_entry_input {
11655         uint16_t req_type;
11656         uint16_t cmpl_ring;
11657         uint16_t seq_id;
11658         uint16_t target_id;
11659         uint64_t resp_addr;
11660         uint16_t dir_idx;
11661         uint16_t unused_0[3];
11662 };
11663
11664 /* Output (16 bytes) */
11665 struct hwrm_nvm_erase_dir_entry_output {
11666         uint16_t error_code;
11667         uint16_t req_type;
11668         uint16_t seq_id;
11669         uint16_t resp_len;
11670         uint32_t unused_0;
11671         uint8_t unused_1;
11672         uint8_t unused_2;
11673         uint8_t unused_3;
11674         uint8_t valid;
11675 };
11676
11677 /* hwrm_nvm_get_dir_info */
11678 /* Input (16 bytes) */
11679 struct hwrm_nvm_get_dir_info_input {
11680         uint16_t req_type;
11681         uint16_t cmpl_ring;
11682         uint16_t seq_id;
11683         uint16_t target_id;
11684         uint64_t resp_addr;
11685 } __attribute__((packed));
11686
11687 /* Output (24 bytes) */
11688 struct hwrm_nvm_get_dir_info_output {
11689         uint16_t error_code;
11690         /*
11691          * Pass/Fail or error type Note: receiver to verify the in
11692          * parameters, and fail the call with an error when appropriate
11693          */
11694         uint16_t req_type;
11695         /* This field returns the type of original request. */
11696         uint16_t seq_id;
11697         /* This field provides original sequence number of the command. */
11698         uint16_t resp_len;
11699         /*
11700          * This field is the length of the response in bytes. The last
11701          * byte of the response is a valid flag that will read as '1'
11702          * when the command has been completely written to memory.
11703          */
11704         uint32_t entries;
11705         /* Number of directory entries in the directory. */
11706         uint32_t entry_length;
11707         /* Size of each directory entry, in bytes. */
11708         uint32_t unused_0;
11709         uint8_t unused_1;
11710         uint8_t unused_2;
11711         uint8_t unused_3;
11712         uint8_t valid;
11713         /*
11714          * This field is used in Output records to indicate that the
11715          * output is completely written to RAM. This field should be
11716          * read as '1' to indicate that the output has been completely
11717          * written. When writing a command completion or response to an
11718          * internal processor, the order of writes has to be such that
11719          * this field is written last.
11720          */
11721 } __attribute__((packed));
11722
11723 /* hwrm_nvm_write */
11724 /*
11725  * Note: Write to the allocated NVRAM of an item referenced by an existing
11726  * directory entry.
11727  */
11728 /* Input (48 bytes) */
11729 struct hwrm_nvm_write_input {
11730         uint16_t req_type;
11731         /*
11732          * This value indicates what type of request this is. The format
11733          * for the rest of the command is determined by this field.
11734          */
11735         uint16_t cmpl_ring;
11736         /*
11737          * This value indicates the what completion ring the request
11738          * will be optionally completed on. If the value is -1, then no
11739          * CR completion will be generated. Any other value must be a
11740          * valid CR ring_id value for this function.
11741          */
11742         uint16_t seq_id;
11743         /* This value indicates the command sequence number. */
11744         uint16_t target_id;
11745         /*
11746          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11747          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11748          * - HWRM
11749          */
11750         uint64_t resp_addr;
11751         /*
11752          * This is the host address where the response will be written
11753          * when the request is complete. This area must be 16B aligned
11754          * and must be cleared to zero before the request is made.
11755          */
11756         uint64_t host_src_addr;
11757         /* 64-bit Host Source Address. This is where the source data is. */
11758         uint16_t dir_type;
11759         /*
11760          * The Directory Entry Type (valid values are defined in the
11761          * bnxnvm_directory_type enum defined in the file
11762          * bnxnvm_defs.h).
11763          */
11764         uint16_t dir_ordinal;
11765         /*
11766          * Directory ordinal. The 0-based instance of the combined
11767          * Directory Entry Type and Extension.
11768          */
11769         uint16_t dir_ext;
11770         /*
11771          * The Directory Entry Extension flags (see BNX_DIR_EXT_* in the
11772          * file bnxnvm_defs.h).
11773          */
11774         uint16_t dir_attr;
11775         /*
11776          * Directory Entry Attribute flags (see BNX_DIR_ATTR_* in the
11777          * file bnxnvm_defs.h).
11778          */
11779         uint32_t dir_data_length;
11780         /*
11781          * Length of data to write, in bytes. May be less than or equal
11782          * to the allocated size for the directory entry. The data
11783          * length stored in the directory entry will be updated to
11784          * reflect this value once the write is complete.
11785          */
11786         uint16_t option;
11787         /* Option. */
11788         uint16_t flags;
11789         /*
11790          * When this bit is '1', the original active image will not be
11791          * removed. TBD: what purpose is this?
11792          */
11793         #define HWRM_NVM_WRITE_INPUT_FLAGS_KEEP_ORIG_ACTIVE_IMG UINT32_C(0x1)
11794         uint32_t dir_item_length;
11795         /*
11796          * The requested length of the allocated NVM for the item, in
11797          * bytes. This value may be greater than or equal to the
11798          * specified data length (dir_data_length). If this value is
11799          * less than the specified data length, it will be ignored. The
11800          * response will contain the actual allocated item length, which
11801          * may be greater than the requested item length. The purpose
11802          * for allocating more than the required number of bytes for an
11803          * item's data is to pre-allocate extra storage (padding) to
11804          * accommodate the potential future growth of an item (e.g.
11805          * upgraded firmware with a size increase, log growth, expanded
11806          * configuration data).
11807          */
11808         uint32_t unused_0;
11809 } __attribute__((packed));
11810
11811 /* Output (16 bytes) */
11812 struct hwrm_nvm_write_output {
11813         uint16_t error_code;
11814         /*
11815          * Pass/Fail or error type Note: receiver to verify the in
11816          * parameters, and fail the call with an error when appropriate
11817          */
11818         uint16_t req_type;
11819         /* This field returns the type of original request. */
11820         uint16_t seq_id;
11821         /* This field provides original sequence number of the command. */
11822         uint16_t resp_len;
11823         /*
11824          * This field is the length of the response in bytes. The last
11825          * byte of the response is a valid flag that will read as '1'
11826          * when the command has been completely written to memory.
11827          */
11828         uint32_t dir_item_length;
11829         /*
11830          * Length of the allocated NVM for the item, in bytes. The value
11831          * may be greater than or equal to the specified data length or
11832          * the requested item length. The actual item length used when
11833          * creating a new directory entry will be a multiple of an NVM
11834          * block size.
11835          */
11836         uint16_t dir_idx;
11837         /* The directory index of the created or modified item. */
11838         uint8_t unused_0;
11839         uint8_t valid;
11840         /*
11841          * This field is used in Output records to indicate that the
11842          * output is completely written to RAM. This field should be
11843          * read as '1' to indicate that the output has been completely
11844          * written. When writing a command completion or response to an
11845          * internal processor, the order of writes has to be such that
11846          * this field is written last.
11847          */
11848 } __attribute__((packed));
11849
11850 /* hwrm_nvm_read */
11851 /*
11852  * Note: Read the contents of an NVRAM item as referenced (indexed) by an
11853  * existing directory entry.
11854  */
11855 /* Input (40 bytes) */
11856 struct hwrm_nvm_read_input {
11857         uint16_t req_type;
11858         /*
11859          * This value indicates what type of request this is. The format
11860          * for the rest of the command is determined by this field.
11861          */
11862         uint16_t cmpl_ring;
11863         /*
11864          * This value indicates the what completion ring the request
11865          * will be optionally completed on. If the value is -1, then no
11866          * CR completion will be generated. Any other value must be a
11867          * valid CR ring_id value for this function.
11868          */
11869         uint16_t seq_id;
11870         /* This value indicates the command sequence number. */
11871         uint16_t target_id;
11872         /*
11873          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11874          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11875          * - HWRM
11876          */
11877         uint64_t resp_addr;
11878         /*
11879          * This is the host address where the response will be written
11880          * when the request is complete. This area must be 16B aligned
11881          * and must be cleared to zero before the request is made.
11882          */
11883         uint64_t host_dest_addr;
11884         /*
11885          * 64-bit Host Destination Address. This is the host address
11886          * where the data will be written to.
11887          */
11888         uint16_t dir_idx;
11889         /* The 0-based index of the directory entry. */
11890         uint8_t unused_0;
11891         uint8_t unused_1;
11892         uint32_t offset;
11893         /* The NVRAM byte-offset to read from. */
11894         uint32_t len;
11895         /* The length of the data to be read, in bytes. */
11896         uint32_t unused_2;
11897 } __attribute__((packed));
11898
11899 /* Output (16 bytes) */
11900 struct hwrm_nvm_read_output {
11901         uint16_t error_code;
11902         /*
11903          * Pass/Fail or error type Note: receiver to verify the in
11904          * parameters, and fail the call with an error when appropriate
11905          */
11906         uint16_t req_type;
11907         /* This field returns the type of original request. */
11908         uint16_t seq_id;
11909         /* This field provides original sequence number of the command. */
11910         uint16_t resp_len;
11911         /*
11912          * This field is the length of the response in bytes. The last
11913          * byte of the response is a valid flag that will read as '1'
11914          * when the command has been completely written to memory.
11915          */
11916         uint32_t unused_0;
11917         uint8_t unused_1;
11918         uint8_t unused_2;
11919         uint8_t unused_3;
11920         uint8_t valid;
11921         /*
11922          * This field is used in Output records to indicate that the
11923          * output is completely written to RAM. This field should be
11924          * read as '1' to indicate that the output has been completely
11925          * written. When writing a command completion or response to an
11926          * internal processor, the order of writes has to be such that
11927          * this field is written last.
11928          */
11929 } __attribute__((packed));
11930
11931 /* Hardware Resource Manager Specification */
11932 /* Description: This structure is used to specify port description. */
11933 /*
11934  * Note: The Hardware Resource Manager (HWRM) manages various hardware resources
11935  * inside the chip. The HWRM is implemented in firmware, and runs on embedded
11936  * processors inside the chip. This firmware service is vital part of the chip.
11937  * The chip can not be used by a driver or HWRM client without the HWRM.
11938  */
11939 /* Input        (16 bytes) */
11940 struct input {
11941         uint16_t req_type;
11942         /*
11943          * This value indicates what type of request this is. The format
11944          * for the rest of the command is determined by this field.
11945          */
11946         uint16_t cmpl_ring;
11947         /*
11948          * This value indicates the what completion ring the request
11949          * will be optionally completed on. If the value is -1, then no
11950          * CR completion will be generated. Any other value must be a
11951          * valid CR ring_id value for this function.
11952          */
11953         uint16_t seq_id;
11954         /* This value indicates the command sequence number. */
11955         uint16_t target_id;
11956         /*
11957          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11958          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11959          * - HWRM
11960          */
11961         uint64_t resp_addr;
11962         /*
11963          * This is the host address where the response will be written
11964          * when the request is complete. This area must be 16B aligned
11965          * and must be cleared to zero before the request is made.
11966          */
11967 } __attribute__((packed));
11968
11969 /* Output       (8 bytes) */
11970 struct output {
11971         uint16_t error_code;
11972         /*
11973          * Pass/Fail or error type Note: receiver to verify the in
11974          * parameters, and fail the call with an error when appropriate
11975          */
11976         uint16_t req_type;
11977         /* This field returns the type of original request. */
11978         uint16_t seq_id;
11979         /* This field provides original sequence number of the command. */
11980         uint16_t resp_len;
11981         /*
11982          * This field is the length of the response in bytes. The last
11983          * byte of the response is a valid flag that will read as '1'
11984          * when the command has been completely written to memory.
11985          */
11986 } __attribute__((packed));
11987
11988 /* Short Command Structure (16 bytes) */
11989 struct hwrm_short_input {
11990         uint16_t req_type;
11991         /*
11992          * This field indicates the type of request in the request
11993          * buffer. The format for the rest of the command (request) is
11994          * determined by this field.
11995          */
11996         uint16_t signature;
11997         /*
11998          * This field indicates a signature that is used to identify
11999          * short form of the command listed here. This field shall be
12000          * set to 17185 (0x4321).
12001          */
12002         /* Signature indicating this is a short form of HWRM command */
12003         #define HWRM_SHORT_REQ_SIGNATURE_SHORT_CMD UINT32_C(0x4321)
12004         uint16_t unused_0;
12005         /* Reserved for future use. */
12006         uint16_t size;
12007         /* This value indicates the length of the request. */
12008         uint64_t req_addr;
12009         /*
12010          * This is the host address where the request was written. This
12011          * area must be 16B aligned.
12012          */
12013 } __attribute__((packed));
12014
12015 #define HWRM_GET_HWRM_ERROR_CODE(arg) \
12016         { \
12017                 typeof(arg) x = (arg); \
12018         ((x) == 0xf ? "HWRM_ERROR" : \
12019         ((x) == 0xffff ? "CMD_NOT_SUPPORTED" : \
12020         ((x) == 0xfffe ? "UNKNOWN_ERR" : \
12021         ((x) == 0x4 ? "RESOURCE_ALLOC_ERROR" : \
12022         ((x) == 0x5 ? "INVALID_FLAGS" : \
12023         ((x) == 0x6 ? "INVALID_ENABLES" : \
12024         ((x) == 0x0 ? "SUCCESS" : \
12025         ((x) == 0x1 ? "FAIL" : \
12026         ((x) == 0x2 ? "INVALID_PARAMS" : \
12027         ((x) == 0x3 ? "RESOURCE_ACCESS_DENIED" : \
12028         "Unknown error_code")))))))))) \
12029         }
12030
12031 /* Return Codes (8 bytes) */
12032 struct ret_codes {
12033         uint16_t error_code;
12034         /* These are numbers assigned to return/error codes. */
12035         /* Request was successfully executed by the HWRM. */
12036         #define HWRM_ERR_CODE_SUCCESS   (UINT32_C(0x0))
12037         /* THe HWRM failed to execute the request. */
12038         #define HWRM_ERR_CODE_FAIL      (UINT32_C(0x1))
12039         /*
12040          * The request contains invalid argument(s) or
12041          * input parameters.
12042          */
12043         #define HWRM_ERR_CODE_INVALID_PARAMS    (UINT32_C(0x2))
12044         /*
12045          * The requester is not allowed to access the
12046          * requested resource. This error code shall be
12047          * provided in a response to a request to query
12048          * or modify an existing resource that is not
12049          * accessible by the requester.
12050          */
12051         #define HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED    (UINT32_C(0x3))
12052         /*
12053          * The HWRM is unable to allocate the requested
12054          * resource. This code only applies to requests
12055          * for HWRM resource allocations.
12056          */
12057         #define HWRM_ERR_CODE_RESOURCE_ALLOC_ERROR      (UINT32_C(0x4))
12058         /* Invalid combination of flags is specified in the request. */
12059         #define HWRM_ERR_CODE_INVALID_FLAGS     (UINT32_C(0x5))
12060         /*
12061          * Invalid combination of enables fields is
12062          * specified in the request.
12063          */
12064         #define HWRM_ERR_CODE_INVALID_ENABLES   (UINT32_C(0x6))
12065         /*
12066          * Generic HWRM execution error that represents
12067          * an internal error.
12068          */
12069         #define HWRM_ERR_CODE_HWRM_ERROR        (UINT32_C(0xf))
12070         /* Unknown error */
12071         #define HWRM_ERR_CODE_UNKNOWN_ERR       (UINT32_C(0xfffe))
12072         /* Unsupported or invalid command */
12073         #define HWRM_ERR_CODE_CMD_NOT_SUPPORTED (UINT32_C(0xffff))
12074         uint16_t unused_0[3];
12075 } __attribute__((packed));
12076
12077 /* Output       (16 bytes) */
12078 struct hwrm_err_output {
12079         uint16_t error_code;
12080         /*
12081          * Pass/Fail or error type Note: receiver to verify the in
12082          * parameters, and fail the call with an error when appropriate
12083          */
12084         uint16_t req_type;
12085         /* This field returns the type of original request. */
12086         uint16_t seq_id;
12087         /* This field provides original sequence number of the command. */
12088         uint16_t resp_len;
12089         /*
12090          * This field is the length of the response in bytes. The last
12091          * byte of the response is a valid flag that will read as '1'
12092          * when the command has been completely written to memory.
12093          */
12094         uint32_t opaque_0;
12095         /* debug info for this error response. */
12096         uint16_t opaque_1;
12097         /* debug info for this error response. */
12098         uint8_t cmd_err;
12099         /*
12100          * In the case of an error response, command specific error code
12101          * is returned in this field.
12102          */
12103         uint8_t valid;
12104         /*
12105          * This field is used in Output records to indicate that the
12106          * output is completely written to RAM. This field should be
12107          * read as '1' to indicate that the output has been completely
12108          * written. When writing a command completion or response to an
12109          * internal processor, the order of writes has to be such that
12110          * this field is written last.
12111          */
12112 } __attribute__((packed));
12113
12114 /* Port Tx Statistics Formats   (408 bytes) */
12115 struct tx_port_stats {
12116         uint64_t tx_64b_frames;
12117         /* Total Number of 64 Bytes frames transmitted */
12118         uint64_t tx_65b_127b_frames;
12119         /* Total Number of 65-127 Bytes frames transmitted */
12120         uint64_t tx_128b_255b_frames;
12121         /* Total Number of 128-255 Bytes frames transmitted */
12122         uint64_t tx_256b_511b_frames;
12123         /* Total Number of 256-511 Bytes frames transmitted */
12124         uint64_t tx_512b_1023b_frames;
12125         /* Total Number of 512-1023 Bytes frames transmitted */
12126         uint64_t tx_1024b_1518_frames;
12127         /* Total Number of 1024-1518 Bytes frames transmitted */
12128         uint64_t tx_good_vlan_frames;
12129         /*
12130          * Total Number of each good VLAN       (exludes FCS errors) frame
12131          * transmitted which is 1519 to 1522 bytes in length inclusive
12132          *      (excluding framing bits but including FCS bytes).
12133          */
12134         uint64_t tx_1519b_2047_frames;
12135         /* Total Number of 1519-2047 Bytes frames transmitted */
12136         uint64_t tx_2048b_4095b_frames;
12137         /* Total Number of 2048-4095 Bytes frames transmitted */
12138         uint64_t tx_4096b_9216b_frames;
12139         /* Total Number of 4096-9216 Bytes frames transmitted */
12140         uint64_t tx_9217b_16383b_frames;
12141         /* Total Number of 9217-16383 Bytes frames transmitted */
12142         uint64_t tx_good_frames;
12143         /* Total Number of good frames transmitted */
12144         uint64_t tx_total_frames;
12145         /* Total Number of frames transmitted */
12146         uint64_t tx_ucast_frames;
12147         /* Total number of unicast frames transmitted */
12148         uint64_t tx_mcast_frames;
12149         /* Total number of multicast frames transmitted */
12150         uint64_t tx_bcast_frames;
12151         /* Total number of broadcast frames transmitted */
12152         uint64_t tx_pause_frames;
12153         /* Total number of PAUSE control frames transmitted */
12154         uint64_t tx_pfc_frames;
12155         /* Total number of PFC/per-priority PAUSE control frames transmitted */
12156         uint64_t tx_jabber_frames;
12157         /* Total number of jabber frames transmitted */
12158         uint64_t tx_fcs_err_frames;
12159         /* Total number of frames transmitted with FCS error */
12160         uint64_t tx_control_frames;
12161         /* Total number of control frames transmitted */
12162         uint64_t tx_oversz_frames;
12163         /* Total number of over-sized frames transmitted */
12164         uint64_t tx_single_dfrl_frames;
12165         /* Total number of frames with single deferral */
12166         uint64_t tx_multi_dfrl_frames;
12167         /* Total number of frames with multiple deferrals */
12168         uint64_t tx_single_coll_frames;
12169         /* Total number of frames with single collision */
12170         uint64_t tx_multi_coll_frames;
12171         /* Total number of frames with multiple collisions */
12172         uint64_t tx_late_coll_frames;
12173         /* Total number of frames with late collisions */
12174         uint64_t tx_excessive_coll_frames;
12175         /* Total number of frames with excessive collisions */
12176         uint64_t tx_frag_frames;
12177         /* Total number of fragmented frames transmitted */
12178         uint64_t tx_err;
12179         /* Total number of transmit errors */
12180         uint64_t tx_tagged_frames;
12181         /* Total number of single VLAN tagged frames transmitted */
12182         uint64_t tx_dbl_tagged_frames;
12183         /* Total number of double VLAN tagged frames transmitted */
12184         uint64_t tx_runt_frames;
12185         /* Total number of runt frames transmitted */
12186         uint64_t tx_fifo_underruns;
12187         /* Total number of TX FIFO under runs */
12188         uint64_t tx_pfc_ena_frames_pri0;
12189         /*
12190          * Total number of PFC frames with PFC enabled bit for Pri 0
12191          * transmitted
12192          */
12193         uint64_t tx_pfc_ena_frames_pri1;
12194         /*
12195          * Total number of PFC frames with PFC enabled bit for Pri 1
12196          * transmitted
12197          */
12198         uint64_t tx_pfc_ena_frames_pri2;
12199         /*
12200          * Total number of PFC frames with PFC enabled bit for Pri 2
12201          * transmitted
12202          */
12203         uint64_t tx_pfc_ena_frames_pri3;
12204         /*
12205          * Total number of PFC frames with PFC enabled bit for Pri 3
12206          * transmitted
12207          */
12208         uint64_t tx_pfc_ena_frames_pri4;
12209         /*
12210          * Total number of PFC frames with PFC enabled bit for Pri 4
12211          * transmitted
12212          */
12213         uint64_t tx_pfc_ena_frames_pri5;
12214         /*
12215          * Total number of PFC frames with PFC enabled bit for Pri 5
12216          * transmitted
12217          */
12218         uint64_t tx_pfc_ena_frames_pri6;
12219         /*
12220          * Total number of PFC frames with PFC enabled bit for Pri 6
12221          * transmitted
12222          */
12223         uint64_t tx_pfc_ena_frames_pri7;
12224         /*
12225          * Total number of PFC frames with PFC enabled bit for Pri 7
12226          * transmitted
12227          */
12228         uint64_t tx_eee_lpi_events;
12229         /* Total number of EEE LPI Events on TX */
12230         uint64_t tx_eee_lpi_duration;
12231         /* EEE LPI Duration Counter on TX */
12232         uint64_t tx_llfc_logical_msgs;
12233         /*
12234          * Total number of Link Level Flow Control      (LLFC) messages
12235          * transmitted
12236          */
12237         uint64_t tx_hcfc_msgs;
12238         /* Total number of HCFC messages transmitted */
12239         uint64_t tx_total_collisions;
12240         /* Total number of TX collisions */
12241         uint64_t tx_bytes;
12242         /* Total number of transmitted bytes */
12243         uint64_t tx_xthol_frames;
12244         /* Total number of end-to-end HOL frames */
12245         uint64_t tx_stat_discard;
12246         /* Total Tx Drops per Port reported by STATS block */
12247         uint64_t tx_stat_error;
12248         /* Total Tx Error Drops per Port reported by STATS block */
12249 } __attribute__((packed));
12250
12251 /* Port Rx Statistics Formats   (528 bytes) */
12252 struct rx_port_stats {
12253         uint64_t rx_64b_frames;
12254         /* Total Number of 64 Bytes frames received */
12255         uint64_t rx_65b_127b_frames;
12256         /* Total Number of 65-127 Bytes frames received */
12257         uint64_t rx_128b_255b_frames;
12258         /* Total Number of 128-255 Bytes frames received */
12259         uint64_t rx_256b_511b_frames;
12260         /* Total Number of 256-511 Bytes frames received */
12261         uint64_t rx_512b_1023b_frames;
12262         /* Total Number of 512-1023 Bytes frames received */
12263         uint64_t rx_1024b_1518_frames;
12264         /* Total Number of 1024-1518 Bytes frames received */
12265         uint64_t rx_good_vlan_frames;
12266         /*
12267          * Total Number of each good VLAN       (exludes FCS errors) frame
12268          * received which is 1519 to 1522 bytes in length inclusive
12269          *      (excluding framing bits but including FCS bytes).
12270          */
12271         uint64_t rx_1519b_2047b_frames;
12272         /* Total Number of 1519-2047 Bytes frames received */
12273         uint64_t rx_2048b_4095b_frames;
12274         /* Total Number of 2048-4095 Bytes frames received */
12275         uint64_t rx_4096b_9216b_frames;
12276         /* Total Number of 4096-9216 Bytes frames received */
12277         uint64_t rx_9217b_16383b_frames;
12278         /* Total Number of 9217-16383 Bytes frames received */
12279         uint64_t rx_total_frames;
12280         /* Total number of frames received */
12281         uint64_t rx_ucast_frames;
12282         /* Total number of unicast frames received */
12283         uint64_t rx_mcast_frames;
12284         /* Total number of multicast frames received */
12285         uint64_t rx_bcast_frames;
12286         /* Total number of broadcast frames received */
12287         uint64_t rx_fcs_err_frames;
12288         /* Total number of received frames with FCS error */
12289         uint64_t rx_ctrl_frames;
12290         /* Total number of control frames received */
12291         uint64_t rx_pause_frames;
12292         /* Total number of PAUSE frames received */
12293         uint64_t rx_pfc_frames;
12294         /* Total number of PFC frames received */
12295         uint64_t rx_unsupported_opcode_frames;
12296         /* Total number of frames received with an unsupported opcode */
12297         uint64_t rx_unsupported_da_pausepfc_frames;
12298         /*
12299          * Total number of frames received with an unsupported DA for
12300          * pause and PFC
12301          */
12302         uint64_t rx_wrong_sa_frames;
12303         /* Total number of frames received with an unsupported SA */
12304         uint64_t rx_align_err_frames;
12305         /* Total number of received packets with alignment error */
12306         uint64_t rx_oor_len_frames;
12307         /* Total number of received frames with out-of-range length */
12308         uint64_t rx_code_err_frames;
12309         /* Total number of received frames with error termination */
12310         uint64_t rx_false_carrier_frames;
12311         /*
12312          * Total number of received frames with a false carrier is
12313          * detected during idle, as defined by RX_ER samples active and
12314          * RXD is 0xE. The event is reported along with the statistics
12315          * generated on the next received frame. Only one false carrier
12316          * condition can be detected and logged between frames. Carrier
12317          * event, valid for 10M/100M speed modes only.
12318          */
12319         uint64_t rx_ovrsz_frames;
12320         /* Total number of over-sized frames received */
12321         uint64_t rx_jbr_frames;
12322         /* Total number of jabber packets received */
12323         uint64_t rx_mtu_err_frames;
12324         /* Total number of received frames with MTU error */
12325         uint64_t rx_match_crc_frames;
12326         /* Total number of received frames with CRC match */
12327         uint64_t rx_promiscuous_frames;
12328         /* Total number of frames received promiscuously */
12329         uint64_t rx_tagged_frames;
12330         /* Total number of received frames with one or two VLAN tags */
12331         uint64_t rx_double_tagged_frames;
12332         /* Total number of received frames with two VLAN tags */
12333         uint64_t rx_trunc_frames;
12334         /* Total number of truncated frames received */
12335         uint64_t rx_good_frames;
12336         /* Total number of good frames  (without errors) received */
12337         uint64_t rx_pfc_xon2xoff_frames_pri0;
12338         /*
12339          * Total number of received PFC frames with transition from XON
12340          * to XOFF on Pri 0
12341          */
12342         uint64_t rx_pfc_xon2xoff_frames_pri1;
12343         /*
12344          * Total number of received PFC frames with transition from XON
12345          * to XOFF on Pri 1
12346          */
12347         uint64_t rx_pfc_xon2xoff_frames_pri2;
12348         /*
12349          * Total number of received PFC frames with transition from XON
12350          * to XOFF on Pri 2
12351          */
12352         uint64_t rx_pfc_xon2xoff_frames_pri3;
12353         /*
12354          * Total number of received PFC frames with transition from XON
12355          * to XOFF on Pri 3
12356          */
12357         uint64_t rx_pfc_xon2xoff_frames_pri4;
12358         /*
12359          * Total number of received PFC frames with transition from XON
12360          * to XOFF on Pri 4
12361          */
12362         uint64_t rx_pfc_xon2xoff_frames_pri5;
12363         /*
12364          * Total number of received PFC frames with transition from XON
12365          * to XOFF on Pri 5
12366          */
12367         uint64_t rx_pfc_xon2xoff_frames_pri6;
12368         /*
12369          * Total number of received PFC frames with transition from XON
12370          * to XOFF on Pri 6
12371          */
12372         uint64_t rx_pfc_xon2xoff_frames_pri7;
12373         /*
12374          * Total number of received PFC frames with transition from XON
12375          * to XOFF on Pri 7
12376          */
12377         uint64_t rx_pfc_ena_frames_pri0;
12378         /*
12379          * Total number of received PFC frames with PFC enabled bit for
12380          * Pri 0
12381          */
12382         uint64_t rx_pfc_ena_frames_pri1;
12383         /*
12384          * Total number of received PFC frames with PFC enabled bit for
12385          * Pri 1
12386          */
12387         uint64_t rx_pfc_ena_frames_pri2;
12388         /*
12389          * Total number of received PFC frames with PFC enabled bit for
12390          * Pri 2
12391          */
12392         uint64_t rx_pfc_ena_frames_pri3;
12393         /*
12394          * Total number of received PFC frames with PFC enabled bit for
12395          * Pri 3
12396          */
12397         uint64_t rx_pfc_ena_frames_pri4;
12398         /*
12399          * Total number of received PFC frames with PFC enabled bit for
12400          * Pri 4
12401          */
12402         uint64_t rx_pfc_ena_frames_pri5;
12403         /*
12404          * Total number of received PFC frames with PFC enabled bit for
12405          * Pri 5
12406          */
12407         uint64_t rx_pfc_ena_frames_pri6;
12408         /*
12409          * Total number of received PFC frames with PFC enabled bit for
12410          * Pri 6
12411          */
12412         uint64_t rx_pfc_ena_frames_pri7;
12413         /*
12414          * Total number of received PFC frames with PFC enabled bit for
12415          * Pri 7
12416          */
12417         uint64_t rx_sch_crc_err_frames;
12418         /* Total Number of frames received with SCH CRC error */
12419         uint64_t rx_undrsz_frames;
12420         /* Total Number of under-sized frames received */
12421         uint64_t rx_frag_frames;
12422         /* Total Number of fragmented frames received */
12423         uint64_t rx_eee_lpi_events;
12424         /* Total number of RX EEE LPI Events */
12425         uint64_t rx_eee_lpi_duration;
12426         /* EEE LPI Duration Counter on RX */
12427         uint64_t rx_llfc_physical_msgs;
12428         /*
12429          * Total number of physical type Link Level Flow Control        (LLFC)
12430          * messages received
12431          */
12432         uint64_t rx_llfc_logical_msgs;
12433         /*
12434          * Total number of logical type Link Level Flow Control (LLFC)
12435          * messages received
12436          */
12437         uint64_t rx_llfc_msgs_with_crc_err;
12438         /*
12439          * Total number of logical type Link Level Flow Control (LLFC)
12440          * messages received with CRC error
12441          */
12442         uint64_t rx_hcfc_msgs;
12443         /* Total number of HCFC messages received */
12444         uint64_t rx_hcfc_msgs_with_crc_err;
12445         /* Total number of HCFC messages received with CRC error */
12446         uint64_t rx_bytes;
12447         /* Total number of received bytes */
12448         uint64_t rx_runt_bytes;
12449         /* Total number of bytes received in runt frames */
12450         uint64_t rx_runt_frames;
12451         /* Total number of runt frames received */
12452         uint64_t rx_stat_discard;
12453         /* Total Rx Discards per Port reported by STATS block */
12454         uint64_t rx_stat_err;
12455         /* Total Rx Error Drops per Port reported by STATS block */
12456 } __attribute__((packed));
12457
12458 /* Periodic Statistics Context DMA to host      (160 bytes) */
12459 /*
12460  * per-context HW statistics -- chip view
12461  */
12462
12463 struct ctx_hw_stats64 {
12464         uint64_t rx_ucast_pkts;
12465         uint64_t rx_mcast_pkts;
12466         uint64_t rx_bcast_pkts;
12467         uint64_t rx_drop_pkts;
12468         uint64_t rx_discard_pkts;
12469         uint64_t rx_ucast_bytes;
12470         uint64_t rx_mcast_bytes;
12471         uint64_t rx_bcast_bytes;
12472
12473         uint64_t tx_ucast_pkts;
12474         uint64_t tx_mcast_pkts;
12475         uint64_t tx_bcast_pkts;
12476         uint64_t tx_drop_pkts;
12477         uint64_t tx_discard_pkts;
12478         uint64_t tx_ucast_bytes;
12479         uint64_t tx_mcast_bytes;
12480         uint64_t tx_bcast_bytes;
12481
12482         uint64_t tpa_pkts;
12483         uint64_t tpa_bytes;
12484         uint64_t tpa_events;
12485         uint64_t tpa_aborts;
12486 } __attribute__((packed));
12487
12488 #endif /* _HSI_STRUCT_DEF_DPDK_ */