79705a7daa6c4e05f69e96a6889e64395ce566c0
[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 /* hwrm_queue_qportcfg_input (size:192b/24B) */
6763 struct hwrm_queue_qportcfg_input {
6764         /* The HWRM command request type. */
6765         uint16_t        req_type;
6766         /*
6767          * The completion ring to send the completion event on. This should
6768          * be the NQ ID returned from the `nq_alloc` HWRM command.
6769          */
6770         uint16_t        cmpl_ring;
6771         /*
6772          * The sequence ID is used by the driver for tracking multiple
6773          * commands. This ID is treated as opaque data by the firmware and
6774          * the value is returned in the `hwrm_resp_hdr` upon completion.
6775          */
6776         uint16_t        seq_id;
6777         /*
6778          * The target ID of the command:
6779          * * 0x0-0xFFF8 - The function ID
6780          * * 0xFFF8-0xFFFE - Reserved for internal processors
6781          * * 0xFFFF - HWRM
6782          */
6783         uint16_t        target_id;
6784         /*
6785          * A physical address pointer pointing to a host buffer that the
6786          * command's response data will be written. This can be either a host
6787          * physical address (HPA) or a guest physical address (GPA) and must
6788          * point to a physically contiguous block of memory.
6789          */
6790         uint64_t        resp_addr;
6791         uint32_t        flags;
6792         /*
6793          * Enumeration denoting the RX, TX type of the resource.
6794          * This enumeration is used for resources that are similar for both
6795          * TX and RX paths of the chip.
6796          */
6797         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH     UINT32_C(0x1)
6798         /* tx path */
6799         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_TX    UINT32_C(0x0)
6800         /* rx path */
6801         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX    UINT32_C(0x1)
6802         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_LAST \
6803                 HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX
6804         /*
6805          * Port ID of port for which the queue configuration is being
6806          * queried.  This field is only required when sent by IPC.
6807          */
6808         uint16_t        port_id;
6809         /*
6810          * Drivers will set this capability when it can use
6811          * queue_idx_service_profile to map the queues to application.
6812          */
6813         uint8_t drv_qmap_cap;
6814         /* disabled */
6815         #define HWRM_QUEUE_QPORTCFG_INPUT_DRV_QMAP_CAP_DISABLED UINT32_C(0x0)
6816         /* enabled */
6817         #define HWRM_QUEUE_QPORTCFG_INPUT_DRV_QMAP_CAP_ENABLED  UINT32_C(0x1)
6818         #define HWRM_QUEUE_QPORTCFG_INPUT_DRV_QMAP_CAP_LAST \
6819                 HWRM_QUEUE_QPORTCFG_INPUT_DRV_QMAP_CAP_ENABLED
6820         uint8_t unused_0;
6821 } __attribute__((packed));
6822
6823 /* Output       (32 bytes) */
6824 /* hwrm_queue_qportcfg_output (size:256b/32B) */
6825 struct hwrm_queue_qportcfg_output {
6826         /* The specific error status for the command. */
6827         uint16_t        error_code;
6828         /* The HWRM command request type. */
6829         uint16_t        req_type;
6830         /* The sequence ID from the original command. */
6831         uint16_t        seq_id;
6832         /* The length of the response data in number of bytes. */
6833         uint16_t        resp_len;
6834         /*
6835          * The maximum number of queues that can be configured on this
6836          * port.
6837          * Valid values range from 1 through 8.
6838          */
6839         uint8_t max_configurable_queues;
6840         /*
6841          * The maximum number of lossless queues that can be configured
6842          * on this port.
6843          * Valid values range from 0 through 8.
6844          */
6845         uint8_t max_configurable_lossless_queues;
6846         /*
6847          * Bitmask indicating which queues can be configured by the
6848          * hwrm_queue_cfg command.
6849          *
6850          * Each bit represents a specific queue where bit 0 represents
6851          * queue 0 and bit 7 represents queue 7.
6852          * # A value of 0 indicates that the queue is not configurable
6853          * by the hwrm_queue_cfg command.
6854          * # A value of 1 indicates that the queue is configurable.
6855          * # A hwrm_queue_cfg command shall return error when trying to
6856          * configure a queue not configurable.
6857          */
6858         uint8_t queue_cfg_allowed;
6859         /* Information about queue configuration. */
6860         uint8_t queue_cfg_info;
6861         /*
6862          * If this flag is set to '1', then the queues are
6863          * configured asymmetrically on TX and RX sides.
6864          * If this flag is set to '0', then the queues are
6865          * configured symmetrically on TX and RX sides. For
6866          * symmetric configuration, the queue configuration
6867          * including queue ids and service profiles on the
6868          * TX side is the same as the corresponding queue
6869          * configuration on the RX side.
6870          */
6871         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_CFG_INFO_ASYM_CFG \
6872                 UINT32_C(0x1)
6873         /*
6874          * Bitmask indicating which queues can be configured by the
6875          * hwrm_queue_pfcenable_cfg command.
6876          *
6877          * Each bit represents a specific priority where bit 0 represents
6878          * priority 0 and bit 7 represents priority 7.
6879          * # A value of 0 indicates that the priority is not configurable by
6880          * the hwrm_queue_pfcenable_cfg command.
6881          * # A value of 1 indicates that the priority is configurable.
6882          * # A hwrm_queue_pfcenable_cfg command shall return error when
6883          * trying to configure a priority that is not configurable.
6884          */
6885         uint8_t queue_pfcenable_cfg_allowed;
6886         /*
6887          * Bitmask indicating which queues can be configured by the
6888          * hwrm_queue_pri2cos_cfg command.
6889          *
6890          * Each bit represents a specific queue where bit 0 represents
6891          * queue 0 and bit 7 represents queue 7.
6892          * # A value of 0 indicates that the queue is not configurable
6893          * by the hwrm_queue_pri2cos_cfg command.
6894          * # A value of 1 indicates that the queue is configurable.
6895          * # A hwrm_queue_pri2cos_cfg command shall return error when
6896          * trying to configure a queue that is not configurable.
6897          */
6898         uint8_t queue_pri2cos_cfg_allowed;
6899         /*
6900          * Bitmask indicating which queues can be configured by the
6901          * hwrm_queue_pri2cos_cfg command.
6902          *
6903          * Each bit represents a specific queue where bit 0 represents
6904          * queue 0 and bit 7 represents queue 7.
6905          * # A value of 0 indicates that the queue is not configurable
6906          * by the hwrm_queue_pri2cos_cfg command.
6907          * # A value of 1 indicates that the queue is configurable.
6908          * # A hwrm_queue_pri2cos_cfg command shall return error when
6909          * trying to configure a queue not configurable.
6910          */
6911         uint8_t queue_cos2bw_cfg_allowed;
6912         /*
6913          * ID of CoS Queue 0.
6914          * FF - Invalid id
6915          *
6916          * # This ID can be used on any subsequent call to an hwrm command
6917          * that takes a queue id.
6918          * # IDs must always be queried by this command before any use
6919          * by the driver or software.
6920          * # Any driver or software should not make any assumptions about
6921          * queue IDs.
6922          * # A value of 0xff indicates that the queue is not available.
6923          * # Available queues may not be in sequential order.
6924          */
6925         uint8_t queue_id0;
6926         /* This value is applicable to CoS queues only. */
6927         uint8_t queue_id0_service_profile;
6928         /* Lossy (best-effort) */
6929         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY \
6930                 UINT32_C(0x0)
6931         /* Lossless (legacy) */
6932         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS \
6933                 UINT32_C(0x1)
6934         /* Lossless RoCE */
6935         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS_ROCE \
6936                 UINT32_C(0x1)
6937         /* Lossy RoCE CNP */
6938         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY_ROCE_CNP \
6939                 UINT32_C(0x2)
6940         /* Lossless NIC */
6941         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS_NIC \
6942                 UINT32_C(0x3)
6943         /* Set to 0xFF... (All Fs) if there is no service profile specified */
6944         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_UNKNOWN \
6945                 UINT32_C(0xff)
6946         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LAST \
6947                 HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_UNKNOWN
6948         /*
6949          * ID of CoS Queue 1.
6950          * FF - Invalid id
6951          *
6952          * # This ID can be used on any subsequent call to an hwrm command
6953          * that takes a queue id.
6954          * # IDs must always be queried by this command before any use
6955          * by the driver or software.
6956          * # Any driver or software should not make any assumptions about
6957          * queue IDs.
6958          * # A value of 0xff indicates that the queue is not available.
6959          * # Available queues may not be in sequential order.
6960          */
6961         uint8_t queue_id1;
6962         /* This value is applicable to CoS queues only. */
6963         uint8_t queue_id1_service_profile;
6964         /* Lossy (best-effort) */
6965         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSY \
6966                 UINT32_C(0x0)
6967         /* Lossless (legacy) */
6968         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSLESS \
6969                 UINT32_C(0x1)
6970         /* Lossless RoCE */
6971         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSLESS_ROCE \
6972                 UINT32_C(0x1)
6973         /* Lossy RoCE CNP */
6974         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSY_ROCE_CNP \
6975                 UINT32_C(0x2)
6976         /* Lossless NIC */
6977         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSLESS_NIC \
6978                 UINT32_C(0x3)
6979         /* Set to 0xFF... (All Fs) if there is no service profile specified */
6980         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_UNKNOWN \
6981                 UINT32_C(0xff)
6982         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LAST \
6983                 HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_UNKNOWN
6984         /*
6985          * ID of CoS Queue 2.
6986          * FF - Invalid id
6987          *
6988          * # This ID can be used on any subsequent call to an hwrm command
6989          * that takes a queue id.
6990          * # IDs must always be queried by this command before any use
6991          * by the driver or software.
6992          * # Any driver or software should not make any assumptions about
6993          * queue IDs.
6994          * # A value of 0xff indicates that the queue is not available.
6995          * # Available queues may not be in sequential order.
6996          */
6997         uint8_t queue_id2;
6998         /* This value is applicable to CoS queues only. */
6999         uint8_t queue_id2_service_profile;
7000         /* Lossy (best-effort) */
7001         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSY \
7002                 UINT32_C(0x0)
7003         /* Lossless (legacy) */
7004         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSLESS \
7005                 UINT32_C(0x1)
7006         /* Lossless RoCE */
7007         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSLESS_ROCE \
7008                 UINT32_C(0x1)
7009         /* Lossy RoCE CNP */
7010         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSY_ROCE_CNP \
7011                 UINT32_C(0x2)
7012         /* Lossless NIC */
7013         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSLESS_NIC \
7014                 UINT32_C(0x3)
7015         /* Set to 0xFF... (All Fs) if there is no service profile specified */
7016         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_UNKNOWN \
7017                 UINT32_C(0xff)
7018         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LAST \
7019                 HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_UNKNOWN
7020         /*
7021          * ID of CoS Queue 3.
7022          * FF - Invalid id
7023          *
7024          * # This ID can be used on any subsequent call to an hwrm command
7025          * that takes a queue id.
7026          * # IDs must always be queried by this command before any use
7027          * by the driver or software.
7028          * # Any driver or software should not make any assumptions about
7029          * queue IDs.
7030          * # A value of 0xff indicates that the queue is not available.
7031          * # Available queues may not be in sequential order.
7032          */
7033         uint8_t queue_id3;
7034         /* This value is applicable to CoS queues only. */
7035         uint8_t queue_id3_service_profile;
7036         /* Lossy (best-effort) */
7037         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSY \
7038                 UINT32_C(0x0)
7039         /* Lossless (legacy) */
7040         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSLESS \
7041                 UINT32_C(0x1)
7042         /* Lossless RoCE */
7043         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSLESS_ROCE \
7044                 UINT32_C(0x1)
7045         /* Lossy RoCE CNP */
7046         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSY_ROCE_CNP \
7047                 UINT32_C(0x2)
7048         /* Lossless NIC */
7049         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSLESS_NIC \
7050                 UINT32_C(0x3)
7051         /* Set to 0xFF... (All Fs) if there is no service profile specified */
7052         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_UNKNOWN \
7053                 UINT32_C(0xff)
7054         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LAST \
7055                 HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_UNKNOWN
7056         /*
7057          * ID of CoS Queue 4.
7058          * FF - Invalid id
7059          *
7060          * # This ID can be used on any subsequent call to an hwrm command
7061          * that takes a queue id.
7062          * # IDs must always be queried by this command before any use
7063          * by the driver or software.
7064          * # Any driver or software should not make any assumptions about
7065          * queue IDs.
7066          * # A value of 0xff indicates that the queue is not available.
7067          * # Available queues may not be in sequential order.
7068          */
7069         uint8_t queue_id4;
7070         /* This value is applicable to CoS queues only. */
7071         uint8_t queue_id4_service_profile;
7072         /* Lossy (best-effort) */
7073         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSY \
7074                 UINT32_C(0x0)
7075         /* Lossless (legacy) */
7076         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSLESS \
7077                 UINT32_C(0x1)
7078         /* Lossless RoCE */
7079         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSLESS_ROCE \
7080                 UINT32_C(0x1)
7081         /* Lossy RoCE CNP */
7082         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSY_ROCE_CNP \
7083                 UINT32_C(0x2)
7084         /* Lossless NIC */
7085         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSLESS_NIC \
7086                 UINT32_C(0x3)
7087         /* Set to 0xFF... (All Fs) if there is no service profile specified */
7088         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_UNKNOWN \
7089                 UINT32_C(0xff)
7090         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LAST \
7091                 HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_UNKNOWN
7092         /*
7093          * ID of CoS Queue 5.
7094          * FF - Invalid id
7095          *
7096          * # This ID can be used on any subsequent call to an hwrm command
7097          * that takes a queue id.
7098          * # IDs must always be queried by this command before any use
7099          * by the driver or software.
7100          * # Any driver or software should not make any assumptions about
7101          * queue IDs.
7102          * # A value of 0xff indicates that the queue is not available.
7103          * # Available queues may not be in sequential order.
7104          */
7105         uint8_t queue_id5;
7106         /* This value is applicable to CoS queues only. */
7107         uint8_t queue_id5_service_profile;
7108         /* Lossy (best-effort) */
7109         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSY \
7110                 UINT32_C(0x0)
7111         /* Lossless (legacy) */
7112         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSLESS \
7113                 UINT32_C(0x1)
7114         /* Lossless RoCE */
7115         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSLESS_ROCE \
7116                 UINT32_C(0x1)
7117         /* Lossy RoCE CNP */
7118         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSY_ROCE_CNP \
7119                 UINT32_C(0x2)
7120         /* Lossless NIC */
7121         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSLESS_NIC \
7122                 UINT32_C(0x3)
7123         /* Set to 0xFF... (All Fs) if there is no service profile specified */
7124         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_UNKNOWN \
7125                 UINT32_C(0xff)
7126         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LAST \
7127                 HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_UNKNOWN
7128         /*
7129          * ID of CoS Queue 6.
7130          * FF - Invalid id
7131          *
7132          * # This ID can be used on any subsequent call to an hwrm command
7133          * that takes a queue id.
7134          * # IDs must always be queried by this command before any use
7135          * by the driver or software.
7136          * # Any driver or software should not make any assumptions about
7137          * queue IDs.
7138          * # A value of 0xff indicates that the queue is not available.
7139          * # Available queues may not be in sequential order.
7140          */
7141         uint8_t queue_id6;
7142         /* This value is applicable to CoS queues only. */
7143         uint8_t queue_id6_service_profile;
7144         /* Lossy (best-effort) */
7145         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSY \
7146                 UINT32_C(0x0)
7147         /* Lossless (legacy) */
7148         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSLESS \
7149                 UINT32_C(0x1)
7150         /* Lossless RoCE */
7151         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSLESS_ROCE \
7152                 UINT32_C(0x1)
7153         /* Lossy RoCE CNP */
7154         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSY_ROCE_CNP \
7155                 UINT32_C(0x2)
7156         /* Lossless NIC */
7157         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSLESS_NIC \
7158                 UINT32_C(0x3)
7159         /* Set to 0xFF... (All Fs) if there is no service profile specified */
7160         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_UNKNOWN \
7161                 UINT32_C(0xff)
7162         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LAST \
7163                 HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_UNKNOWN
7164         /*
7165          * ID of CoS Queue 7.
7166          * FF - Invalid id
7167          *
7168          * # This ID can be used on any subsequent call to an hwrm command
7169          * that takes a queue id.
7170          * # IDs must always be queried by this command before any use
7171          * by the driver or software.
7172          * # Any driver or software should not make any assumptions about
7173          * queue IDs.
7174          * # A value of 0xff indicates that the queue is not available.
7175          * # Available queues may not be in sequential order.
7176          */
7177         uint8_t queue_id7;
7178         /* This value is applicable to CoS queues only. */
7179         uint8_t queue_id7_service_profile;
7180         /* Lossy (best-effort) */
7181         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSY \
7182                 UINT32_C(0x0)
7183         /* Lossless (legacy) */
7184         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSLESS \
7185                 UINT32_C(0x1)
7186         /* Lossless RoCE */
7187         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSLESS_ROCE \
7188                 UINT32_C(0x1)
7189         /* Lossy RoCE CNP */
7190         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSY_ROCE_CNP \
7191                 UINT32_C(0x2)
7192         /* Lossless NIC */
7193         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSLESS_NIC \
7194                 UINT32_C(0x3)
7195         /* Set to 0xFF... (All Fs) if there is no service profile specified */
7196         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_UNKNOWN \
7197                 UINT32_C(0xff)
7198         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LAST \
7199                 HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_UNKNOWN
7200         /*
7201          * This field is used in Output records to indicate that the output
7202          * is completely written to RAM.  This field should be read as '1'
7203          * to indicate that the output has been completely written.
7204          * When writing a command completion or response to an internal
7205          * processor,
7206          * the order of writes has to be such that this field is written last.
7207          */
7208         uint8_t valid;
7209 } __attribute__((packed));
7210
7211 /*********************
7212  * hwrm_port_mac_cfg *
7213  *********************/
7214
7215
7216 /* hwrm_port_mac_cfg_input (size:320b/40B) */
7217 struct hwrm_port_mac_cfg_input {
7218         uint16_t        req_type;
7219         uint16_t        cmpl_ring;
7220         uint16_t        seq_id;
7221         uint16_t        target_id;
7222         uint64_t        resp_addr;
7223         uint32_t        flags;
7224         #define PORT_MAC_CFG_REQ_FLAGS_MATCH_LINK                    0x1UL
7225         #define PORT_MAC_CFG_REQ_FLAGS_VLAN_PRI2COS_ENABLE           0x2UL
7226         #define PORT_MAC_CFG_REQ_FLAGS_TUNNEL_PRI2COS_ENABLE         0x4UL
7227         #define PORT_MAC_CFG_REQ_FLAGS_IP_DSCP2COS_ENABLE            0x8UL
7228         #define PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_ENABLE      0x10UL
7229         #define PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE     0x20UL
7230         #define PORT_MAC_CFG_REQ_FLAGS_PTP_TX_TS_CAPTURE_ENABLE      0x40UL
7231         #define PORT_MAC_CFG_REQ_FLAGS_PTP_TX_TS_CAPTURE_DISABLE     0x80UL
7232         #define PORT_MAC_CFG_REQ_FLAGS_OOB_WOL_ENABLE                0x100UL
7233         #define PORT_MAC_CFG_REQ_FLAGS_OOB_WOL_DISABLE               0x200UL
7234         #define PORT_MAC_CFG_REQ_FLAGS_VLAN_PRI2COS_DISABLE          0x400UL
7235         #define PORT_MAC_CFG_REQ_FLAGS_TUNNEL_PRI2COS_DISABLE        0x800UL
7236         #define PORT_MAC_CFG_REQ_FLAGS_IP_DSCP2COS_DISABLE           0x1000UL
7237         uint32_t        enables;
7238         #define PORT_MAC_CFG_REQ_ENABLES_IPG                            0x1UL
7239         #define PORT_MAC_CFG_REQ_ENABLES_LPBK                           0x2UL
7240         #define PORT_MAC_CFG_REQ_ENABLES_VLAN_PRI2COS_MAP_PRI           0x4UL
7241         #define PORT_MAC_CFG_REQ_ENABLES_TUNNEL_PRI2COS_MAP_PRI         0x10UL
7242         #define PORT_MAC_CFG_REQ_ENABLES_DSCP2COS_MAP_PRI               0x20UL
7243         #define PORT_MAC_CFG_REQ_ENABLES_RX_TS_CAPTURE_PTP_MSG_TYPE     0x40UL
7244         #define PORT_MAC_CFG_REQ_ENABLES_TX_TS_CAPTURE_PTP_MSG_TYPE     0x80UL
7245         #define PORT_MAC_CFG_REQ_ENABLES_COS_FIELD_CFG                  0x100UL
7246         uint16_t        port_id;
7247         uint8_t         ipg;
7248         uint8_t         lpbk;
7249         #define PORT_MAC_CFG_REQ_LPBK_NONE   0x0UL
7250         #define PORT_MAC_CFG_REQ_LPBK_LOCAL  0x1UL
7251         #define PORT_MAC_CFG_REQ_LPBK_REMOTE 0x2UL
7252         #define PORT_MAC_CFG_REQ_LPBK_LAST  PORT_MAC_CFG_REQ_LPBK_REMOTE
7253         uint8_t         vlan_pri2cos_map_pri;
7254         uint8_t         reserved1;
7255         uint8_t         tunnel_pri2cos_map_pri;
7256         uint8_t         dscp2pri_map_pri;
7257         uint16_t        rx_ts_capture_ptp_msg_type;
7258         uint16_t        tx_ts_capture_ptp_msg_type;
7259         uint8_t         cos_field_cfg;
7260         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_RSVD1                     0x1UL
7261         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_MASK         0x6UL
7262         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_SFT          1
7263         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_INNERMOST \
7264                 (0x0UL << 1)
7265         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_OUTER \
7266                 (0x1UL << 1)
7267         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_OUTERMOST \
7268                 (0x2UL << 1)
7269         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_UNSPECIFIED \
7270                 (0x3UL << 1)
7271         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_LAST \
7272                 PORT_MAC_CFG_REQ_COS_FIELD_CFG_VLAN_PRI_SEL_UNSPECIFIED
7273         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_MASK       0x18UL
7274         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_SFT        3
7275         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_INNERMOST \
7276                 (0x0UL << 3)
7277         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_OUTER \
7278                 (0x1UL << 3)
7279         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_OUTERMOST \
7280                 (0x2UL << 3)
7281         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_UNSPECIFIED \
7282                 (0x3UL << 3)
7283         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_LAST \
7284                 PORT_MAC_CFG_REQ_COS_FIELD_CFG_T_VLAN_PRI_SEL_UNSPECIFIED
7285         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_DEFAULT_COS_MASK          0xe0UL
7286         #define PORT_MAC_CFG_REQ_COS_FIELD_CFG_DEFAULT_COS_SFT           5
7287         uint8_t         unused_0[3];
7288 };
7289
7290
7291 /* hwrm_port_mac_cfg_output (size:128b/16B) */
7292 struct hwrm_port_mac_cfg_output {
7293         uint16_t        error_code;
7294         uint16_t        req_type;
7295         uint16_t        seq_id;
7296         uint16_t        resp_len;
7297         uint16_t        mru;
7298         uint16_t        mtu;
7299         uint8_t         ipg;
7300         uint8_t         lpbk;
7301         #define PORT_MAC_CFG_RESP_LPBK_NONE   0x0UL
7302         #define PORT_MAC_CFG_RESP_LPBK_LOCAL  0x1UL
7303         #define PORT_MAC_CFG_RESP_LPBK_REMOTE 0x2UL
7304         #define PORT_MAC_CFG_RESP_LPBK_LAST  PORT_MAC_CFG_RESP_LPBK_REMOTE
7305         uint8_t         unused_0;
7306         uint8_t         valid;
7307 };
7308
7309
7310 /**********************
7311  * hwrm_port_mac_qcfg *
7312  **********************/
7313
7314
7315 /* hwrm_port_mac_qcfg_input (size:192b/24B) */
7316 struct hwrm_port_mac_qcfg_input {
7317         uint16_t        req_type;
7318         uint16_t        cmpl_ring;
7319         uint16_t        seq_id;
7320         uint16_t        target_id;
7321         uint64_t        resp_addr;
7322         uint16_t        port_id;
7323         uint8_t         unused_0[6];
7324 };
7325
7326
7327 /* hwrm_port_mac_qcfg_output (size:192b/24B) */
7328 struct hwrm_port_mac_qcfg_output {
7329         uint16_t        error_code;
7330         uint16_t        req_type;
7331         uint16_t        seq_id;
7332         uint16_t        resp_len;
7333         uint16_t        mru;
7334         uint16_t        mtu;
7335         uint8_t         ipg;
7336         uint8_t         lpbk;
7337         #define PORT_MAC_QCFG_RESP_LPBK_NONE   0x0UL
7338         #define PORT_MAC_QCFG_RESP_LPBK_LOCAL  0x1UL
7339         #define PORT_MAC_QCFG_RESP_LPBK_REMOTE 0x2UL
7340         #define PORT_MAC_QCFG_RESP_LPBK_LAST  PORT_MAC_QCFG_RESP_LPBK_REMOTE
7341         uint8_t         vlan_pri2cos_map_pri;
7342         uint8_t         flags;
7343         #define PORT_MAC_QCFG_RESP_FLAGS_VLAN_PRI2COS_ENABLE          0x1UL
7344         #define PORT_MAC_QCFG_RESP_FLAGS_TUNNEL_PRI2COS_ENABLE        0x2UL
7345         #define PORT_MAC_QCFG_RESP_FLAGS_IP_DSCP2COS_ENABLE           0x4UL
7346         #define PORT_MAC_QCFG_RESP_FLAGS_OOB_WOL_ENABLE               0x8UL
7347         #define PORT_MAC_QCFG_RESP_FLAGS_PTP_RX_TS_CAPTURE_ENABLE     0x10UL
7348         #define PORT_MAC_QCFG_RESP_FLAGS_PTP_TX_TS_CAPTURE_ENABLE     0x20UL
7349         uint8_t         tunnel_pri2cos_map_pri;
7350         uint8_t         dscp2pri_map_pri;
7351         uint16_t        rx_ts_capture_ptp_msg_type;
7352         uint16_t        tx_ts_capture_ptp_msg_type;
7353         uint8_t         cos_field_cfg;
7354         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_RSVD                      0x1UL
7355         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_MASK         0x6UL
7356         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_SFT          1
7357         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_INNERMOST \
7358                 (0x0UL << 1)
7359         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_OUTER \
7360                 (0x1UL << 1)
7361         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_OUTERMOST \
7362                 (0x2UL << 1)
7363         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_UNSPECIFIED \
7364                 (0x3UL << 1)
7365         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_LAST \
7366                 PORT_MAC_QCFG_RESP_COS_FIELD_CFG_VLAN_PRI_SEL_UNSPECIFIED
7367         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_MASK    0x18UL
7368         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_SFT        3
7369         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_INNERMOST \
7370                 (0x0UL << 3)
7371         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_OUTER \
7372                 (0x1UL << 3)
7373         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_OUTERMOST \
7374                 (0x2UL << 3)
7375         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_UNSPECIFIED \
7376                 (0x3UL << 3)
7377         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_LAST \
7378                 PORT_MAC_QCFG_RESP_COS_FIELD_CFG_T_VLAN_PRI_SEL_UNSPECIFIED
7379         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_DEFAULT_COS_MASK       0xe0UL
7380         #define PORT_MAC_QCFG_RESP_COS_FIELD_CFG_DEFAULT_COS_SFT           5
7381         uint8_t         valid;
7382 };
7383
7384
7385 /**************************
7386  * hwrm_port_mac_ptp_qcfg *
7387  **************************/
7388
7389
7390 /* hwrm_port_mac_ptp_qcfg_input (size:192b/24B) */
7391 struct hwrm_port_mac_ptp_qcfg_input {
7392         uint16_t        req_type;
7393         uint16_t        cmpl_ring;
7394         uint16_t        seq_id;
7395         uint16_t        target_id;
7396         uint64_t        resp_addr;
7397         uint16_t        port_id;
7398         uint8_t         unused_0[6];
7399 };
7400
7401
7402 /* hwrm_port_mac_ptp_qcfg_output (size:640b/80B) */
7403 struct hwrm_port_mac_ptp_qcfg_output {
7404         uint16_t        error_code;
7405         uint16_t        req_type;
7406         uint16_t        seq_id;
7407         uint16_t        resp_len;
7408         uint8_t         flags;
7409         #define PORT_MAC_PTP_QCFG_RESP_FLAGS_DIRECT_ACCESS     0x1UL
7410         #define PORT_MAC_PTP_QCFG_RESP_FLAGS_HWRM_ACCESS       0x2UL
7411         uint8_t         unused_0[3];
7412         uint32_t        rx_ts_reg_off_lower;
7413         uint32_t        rx_ts_reg_off_upper;
7414         uint32_t        rx_ts_reg_off_seq_id;
7415         uint32_t        rx_ts_reg_off_src_id_0;
7416         uint32_t        rx_ts_reg_off_src_id_1;
7417         uint32_t        rx_ts_reg_off_src_id_2;
7418         uint32_t        rx_ts_reg_off_domain_id;
7419         uint32_t        rx_ts_reg_off_fifo;
7420         uint32_t        rx_ts_reg_off_fifo_adv;
7421         uint32_t        rx_ts_reg_off_granularity;
7422         uint32_t        tx_ts_reg_off_lower;
7423         uint32_t        tx_ts_reg_off_upper;
7424         uint32_t        tx_ts_reg_off_seq_id;
7425         uint32_t        tx_ts_reg_off_fifo;
7426         uint32_t        tx_ts_reg_off_granularity;
7427         uint8_t         unused_1[7];
7428         uint8_t         valid;
7429 };
7430
7431
7432 /* hwrm_vnic_alloc */
7433 /*
7434  * Description: This VNIC is a resource in the RX side of the chip that is used
7435  * to represent a virtual host "interface". # At the time of VNIC allocation or
7436  * configuration, the function can specify whether it wants the requested VNIC
7437  * to be the default VNIC for the function or not. # If a function requests
7438  * allocation of a VNIC for the first time and a VNIC is successfully allocated
7439  * by the HWRM, then the HWRM shall make the allocated VNIC as the default VNIC
7440  * for that function. # The default VNIC shall be used for the default action
7441  * for a partition or function. # For each VNIC allocated on a function, a
7442  * mapping on the RX side to map the allocated VNIC to source virtual interface
7443  * shall be performed by the HWRM. This should be hidden to the function driver
7444  * requesting the VNIC allocation. This enables broadcast/multicast replication
7445  * with source knockout. # If multicast replication with source knockout is
7446  * enabled, then the internal VNIC to SVIF mapping data structures shall be
7447  * programmed at the time of VNIC allocation.
7448  */
7449 /* Input        (24 bytes) */
7450 struct hwrm_vnic_alloc_input {
7451         uint16_t req_type;
7452         /*
7453          * This value indicates what type of request this is. The format
7454          * for the rest of the command is determined by this field.
7455          */
7456         uint16_t cmpl_ring;
7457         /*
7458          * This value indicates the what completion ring the request
7459          * will be optionally completed on. If the value is -1, then no
7460          * CR completion will be generated. Any other value must be a
7461          * valid CR ring_id value for this function.
7462          */
7463         uint16_t seq_id;
7464         /* This value indicates the command sequence number. */
7465         uint16_t target_id;
7466         /*
7467          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7468          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7469          * - HWRM
7470          */
7471         uint64_t resp_addr;
7472         /*
7473          * This is the host address where the response will be written
7474          * when the request is complete. This area must be 16B aligned
7475          * and must be cleared to zero before the request is made.
7476          */
7477         uint32_t flags;
7478         /*
7479          * When this bit is '1', this VNIC is requested to be the
7480          * default VNIC for this function.
7481          */
7482         #define HWRM_VNIC_ALLOC_INPUT_FLAGS_DEFAULT     UINT32_C(0x1)
7483         uint32_t unused_0;
7484 } __attribute__((packed));
7485
7486 /* Output       (16 bytes) */
7487 struct hwrm_vnic_alloc_output {
7488         uint16_t error_code;
7489         /*
7490          * Pass/Fail or error type Note: receiver to verify the in
7491          * parameters, and fail the call with an error when appropriate
7492          */
7493         uint16_t req_type;
7494         /* This field returns the type of original request. */
7495         uint16_t seq_id;
7496         /* This field provides original sequence number of the command. */
7497         uint16_t resp_len;
7498         /*
7499          * This field is the length of the response in bytes. The last
7500          * byte of the response is a valid flag that will read as '1'
7501          * when the command has been completely written to memory.
7502          */
7503         uint32_t vnic_id;
7504         /* Logical vnic ID */
7505         uint8_t unused_0;
7506         uint8_t unused_1;
7507         uint8_t unused_2;
7508         uint8_t valid;
7509         /*
7510          * This field is used in Output records to indicate that the
7511          * output is completely written to RAM. This field should be
7512          * read as '1' to indicate that the output has been completely
7513          * written. When writing a command completion or response to an
7514          * internal processor, the order of writes has to be such that
7515          * this field is written last.
7516          */
7517 } __attribute__((packed));
7518
7519 /* hwrm_vnic_free */
7520 /*
7521  * Description: Free a VNIC resource. Idle any resources associated with the
7522  * VNIC as well as the VNIC. Reset and release all resources associated with the
7523  * VNIC.
7524  */
7525 /* Input        (24 bytes) */
7526 struct hwrm_vnic_free_input {
7527         uint16_t req_type;
7528         /*
7529          * This value indicates what type of request this is. The format
7530          * for the rest of the command is determined by this field.
7531          */
7532         uint16_t cmpl_ring;
7533         /*
7534          * This value indicates the what completion ring the request
7535          * will be optionally completed on. If the value is -1, then no
7536          * CR completion will be generated. Any other value must be a
7537          * valid CR ring_id value for this function.
7538          */
7539         uint16_t seq_id;
7540         /* This value indicates the command sequence number. */
7541         uint16_t target_id;
7542         /*
7543          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7544          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7545          * - HWRM
7546          */
7547         uint64_t resp_addr;
7548         /*
7549          * This is the host address where the response will be written
7550          * when the request is complete. This area must be 16B aligned
7551          * and must be cleared to zero before the request is made.
7552          */
7553         uint32_t vnic_id;
7554         /* Logical vnic ID */
7555         uint32_t unused_0;
7556 } __attribute__((packed));
7557
7558 /* Output       (16 bytes) */
7559 struct hwrm_vnic_free_output {
7560         uint16_t error_code;
7561         /*
7562          * Pass/Fail or error type Note: receiver to verify the in
7563          * parameters, and fail the call with an error when appropriate
7564          */
7565         uint16_t req_type;
7566         /* This field returns the type of original request. */
7567         uint16_t seq_id;
7568         /* This field provides original sequence number of the command. */
7569         uint16_t resp_len;
7570         /*
7571          * This field is the length of the response in bytes. The last
7572          * byte of the response is a valid flag that will read as '1'
7573          * when the command has been completely written to memory.
7574          */
7575         uint32_t unused_0;
7576         uint8_t unused_1;
7577         uint8_t unused_2;
7578         uint8_t unused_3;
7579         uint8_t valid;
7580         /*
7581          * This field is used in Output records to indicate that the
7582          * output is completely written to RAM. This field should be
7583          * read as '1' to indicate that the output has been completely
7584          * written. When writing a command completion or response to an
7585          * internal processor, the order of writes has to be such that
7586          * this field is written last.
7587          */
7588 } __attribute__((packed));
7589
7590 /* hwrm_vnic_cfg */
7591 /* Description: Configure the RX VNIC structure. */
7592 /* Input        (40 bytes) */
7593 struct hwrm_vnic_cfg_input {
7594         uint16_t req_type;
7595         /*
7596          * This value indicates what type of request this is. The format
7597          * for the rest of the command is determined by this field.
7598          */
7599         uint16_t cmpl_ring;
7600         /*
7601          * This value indicates the what completion ring the request
7602          * will be optionally completed on. If the value is -1, then no
7603          * CR completion will be generated. Any other value must be a
7604          * valid CR ring_id value for this function.
7605          */
7606         uint16_t seq_id;
7607         /* This value indicates the command sequence number. */
7608         uint16_t target_id;
7609         /*
7610          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7611          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7612          * - HWRM
7613          */
7614         uint64_t resp_addr;
7615         /*
7616          * This is the host address where the response will be written
7617          * when the request is complete. This area must be 16B aligned
7618          * and must be cleared to zero before the request is made.
7619          */
7620         uint32_t flags;
7621         /*
7622          * When this bit is '1', the VNIC is requested to be the default
7623          * VNIC for the function.
7624          */
7625         #define HWRM_VNIC_CFG_INPUT_FLAGS_DEFAULT       UINT32_C(0x1)
7626         /*
7627          * When this bit is '1', the VNIC is being configured to strip
7628          * VLAN in the RX path. If set to '0', then VLAN stripping is
7629          * disabled on this VNIC.
7630          */
7631         #define HWRM_VNIC_CFG_INPUT_FLAGS_VLAN_STRIP_MODE       UINT32_C(0x2)
7632         /*
7633          * When this bit is '1', the VNIC is being configured to buffer
7634          * receive packets in the hardware until the host posts new
7635          * receive buffers. If set to '0', then bd_stall is being
7636          * configured to be disabled on this VNIC.
7637          */
7638         #define HWRM_VNIC_CFG_INPUT_FLAGS_BD_STALL_MODE UINT32_C(0x4)
7639         /*
7640          * When this bit is '1', the VNIC is being configured to receive
7641          * both RoCE and non-RoCE traffic. If set to '0', then this VNIC
7642          * is not configured to be operating in dual VNIC mode.
7643          */
7644         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_DUAL_VNIC_MODE   UINT32_C(0x8)
7645         /*
7646          * When this flag is set to '1', the VNIC is requested to be
7647          * configured to receive only RoCE traffic. If this flag is set
7648          * to '0', then this flag shall be ignored by the HWRM. If
7649          * roce_dual_vnic_mode flag is set to '1', then the HWRM client
7650          * shall not set this flag to '1'.
7651          */
7652         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_ONLY_VNIC_MODE UINT32_C(0x10)
7653         /*
7654          * When a VNIC uses one destination ring group for certain
7655          * application  (e.g. Receive Flow Steering) where exact match is
7656          * used to direct packets to a VNIC with one destination ring
7657          * group only, there is no need to configure RSS indirection
7658          * table for that VNIC as only one destination ring group is
7659          * used. This flag is used to enable a mode where RSS is enabled
7660          * in the VNIC using a RSS context for computing RSS hash but
7661          * the RSS indirection table is not configured using
7662          * hwrm_vnic_rss_cfg. If this mode is enabled, then the driver
7663          * should not program RSS indirection table for the RSS context
7664          * that is used for computing RSS hash only.
7665          */
7666         #define HWRM_VNIC_CFG_INPUT_FLAGS_RSS_DFLT_CR_MODE      UINT32_C(0x20)
7667         /*
7668          * When this bit is '1', the VNIC is being configured to receive
7669          * both RoCE and non-RoCE traffic, but forward only the RoCE
7670          * traffic further. Also, RoCE traffic can be mirrored to L2
7671          * driver.
7672          */
7673         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_MIRRORING_CAPABLE_VNIC_MODE \
7674         UINT32_C(0x40)
7675         uint32_t enables;
7676         /*
7677          * This bit must be '1' for the dflt_ring_grp field to be
7678          * configured.
7679          */
7680         #define HWRM_VNIC_CFG_INPUT_ENABLES_DFLT_RING_GRP       UINT32_C(0x1)
7681         /* This bit must be '1' for the rss_rule field to be configured. */
7682         #define HWRM_VNIC_CFG_INPUT_ENABLES_RSS_RULE    UINT32_C(0x2)
7683         /* This bit must be '1' for the cos_rule field to be configured. */
7684         #define HWRM_VNIC_CFG_INPUT_ENABLES_COS_RULE    UINT32_C(0x4)
7685         /* This bit must be '1' for the lb_rule field to be configured. */
7686         #define HWRM_VNIC_CFG_INPUT_ENABLES_LB_RULE     UINT32_C(0x8)
7687         /* This bit must be '1' for the mru field to be configured. */
7688         #define HWRM_VNIC_CFG_INPUT_ENABLES_MRU UINT32_C(0x10)
7689         uint16_t vnic_id;
7690         /* Logical vnic ID */
7691         uint16_t dflt_ring_grp;
7692         /*
7693          * Default Completion ring for the VNIC. This ring will be
7694          * chosen if packet does not match any RSS rules and if there is
7695          * no COS rule.
7696          */
7697         uint16_t rss_rule;
7698         /*
7699          * RSS ID for RSS rule/table structure. 0xFF... (All Fs) if
7700          * there is no RSS rule.
7701          */
7702         uint16_t cos_rule;
7703         /*
7704          * RSS ID for COS rule/table structure. 0xFF... (All Fs) if
7705          * there is no COS rule.
7706          */
7707         uint16_t lb_rule;
7708         /*
7709          * RSS ID for load balancing rule/table structure. 0xFF...      (All
7710          * Fs) if there is no LB rule.
7711          */
7712         uint16_t mru;
7713         /*
7714          * The maximum receive unit of the vnic. Each vnic is associated
7715          * with a function. The vnic mru value overwrites the mru
7716          * setting of the associated function. The HWRM shall make sure
7717          * that vnic mru does not exceed the mru of the port the
7718          * function is associated with.
7719          */
7720         uint32_t unused_0;
7721 } __attribute__((packed));
7722
7723 /* Output       (16 bytes) */
7724 struct hwrm_vnic_cfg_output {
7725         uint16_t error_code;
7726         /*
7727          * Pass/Fail or error type Note: receiver to verify the in
7728          * parameters, and fail the call with an error when appropriate
7729          */
7730         uint16_t req_type;
7731         /* This field returns the type of original request. */
7732         uint16_t seq_id;
7733         /* This field provides original sequence number of the command. */
7734         uint16_t resp_len;
7735         /*
7736          * This field is the length of the response in bytes. The last
7737          * byte of the response is a valid flag that will read as '1'
7738          * when the command has been completely written to memory.
7739          */
7740         uint32_t unused_0;
7741         uint8_t unused_1;
7742         uint8_t unused_2;
7743         uint8_t unused_3;
7744         uint8_t valid;
7745         /*
7746          * This field is used in Output records to indicate that the
7747          * output is completely written to RAM. This field should be
7748          * read as '1' to indicate that the output has been completely
7749          * written. When writing a command completion or response to an
7750          * internal processor, the order of writes has to be such that
7751          * this field is written last.
7752          */
7753 } __attribute__((packed));
7754
7755 /* hwrm_vnic_qcfg */
7756 /*
7757  * Description: Query the RX VNIC structure. This function can be used by a PF
7758  * driver to query its own VNIC resource or VNIC resource of its child VF. This
7759  * function can also be used by a VF driver to query its own VNIC resource.
7760  */
7761 /* Input        (32 bytes) */
7762 struct hwrm_vnic_qcfg_input {
7763         uint16_t req_type;
7764         /*
7765          * This value indicates what type of request this is. The format
7766          * for the rest of the command is determined by this field.
7767          */
7768         uint16_t cmpl_ring;
7769         /*
7770          * This value indicates the what completion ring the request
7771          * will be optionally completed on. If the value is -1, then no
7772          * CR completion will be generated. Any other value must be a
7773          * valid CR ring_id value for this function.
7774          */
7775         uint16_t seq_id;
7776         /* This value indicates the command sequence number. */
7777         uint16_t target_id;
7778         /*
7779          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7780          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7781          * - HWRM
7782          */
7783         uint64_t resp_addr;
7784         /*
7785          * This is the host address where the response will be written
7786          * when the request is complete. This area must be 16B aligned
7787          * and must be cleared to zero before the request is made.
7788          */
7789         uint32_t enables;
7790         /* This bit must be '1' for the vf_id_valid field to be configured. */
7791         #define HWRM_VNIC_QCFG_INPUT_ENABLES_VF_ID_VALID        UINT32_C(0x1)
7792         uint32_t vnic_id;
7793         /* Logical vnic ID */
7794         uint16_t vf_id;
7795         /* ID of Virtual Function whose VNIC resource is being queried. */
7796         uint16_t unused_0[3];
7797 } __attribute__((packed));
7798
7799 /* Output       (32 bytes) */
7800 struct hwrm_vnic_qcfg_output {
7801         uint16_t error_code;
7802         /*
7803          * Pass/Fail or error type Note: receiver to verify the in
7804          * parameters, and fail the call with an error when appropriate
7805          */
7806         uint16_t req_type;
7807         /* This field returns the type of original request. */
7808         uint16_t seq_id;
7809         /* This field provides original sequence number of the command. */
7810         uint16_t resp_len;
7811         /*
7812          * This field is the length of the response in bytes. The last
7813          * byte of the response is a valid flag that will read as '1'
7814          * when the command has been completely written to memory.
7815          */
7816         uint16_t dflt_ring_grp;
7817         /* Default Completion ring for the VNIC. */
7818         uint16_t rss_rule;
7819         /*
7820          * RSS ID for RSS rule/table structure. 0xFF... (All Fs) if
7821          * there is no RSS rule.
7822          */
7823         uint16_t cos_rule;
7824         /*
7825          * RSS ID for COS rule/table structure. 0xFF... (All Fs) if
7826          * there is no COS rule.
7827          */
7828         uint16_t lb_rule;
7829         /*
7830          * RSS ID for load balancing rule/table structure. 0xFF...      (All
7831          * Fs) if there is no LB rule.
7832          */
7833         uint16_t mru;
7834         /* The maximum receive unit of the vnic. */
7835         uint8_t unused_0;
7836         uint8_t unused_1;
7837         uint32_t flags;
7838         /*
7839          * When this bit is '1', the VNIC is the default VNIC for the
7840          * function.
7841          */
7842         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_DEFAULT     UINT32_C(0x1)
7843         /*
7844          * When this bit is '1', the VNIC is configured to strip VLAN in
7845          * the RX path. If set to '0', then VLAN stripping is disabled
7846          * on this VNIC.
7847          */
7848         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_VLAN_STRIP_MODE     UINT32_C(0x2)
7849         /*
7850          * When this bit is '1', the VNIC is configured to buffer
7851          * receive packets in the hardware until the host posts new
7852          * receive buffers. If set to '0', then bd_stall is disabled on
7853          * this VNIC.
7854          */
7855         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_BD_STALL_MODE       UINT32_C(0x4)
7856         /*
7857          * When this bit is '1', the VNIC is configured to receive both
7858          * RoCE and non-RoCE traffic. If set to '0', then this VNIC is
7859          * not configured to operate in dual VNIC mode.
7860          */
7861         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_ROCE_DUAL_VNIC_MODE UINT32_C(0x8)
7862         /*
7863          * When this flag is set to '1', the VNIC is configured to
7864          * receive only RoCE traffic. When this flag is set to '0', the
7865          * VNIC is not configured to receive only RoCE traffic. If
7866          * roce_dual_vnic_mode flag and this flag both are set to '1',
7867          * then it is an invalid configuration of the VNIC. The HWRM
7868          * should not allow that type of mis-configuration by HWRM
7869          * clients.
7870          */
7871         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_ROCE_ONLY_VNIC_MODE UINT32_C(0x10)
7872         /*
7873          * When a VNIC uses one destination ring group for certain
7874          * application  (e.g. Receive Flow Steering) where exact match is
7875          * used to direct packets to a VNIC with one destination ring
7876          * group only, there is no need to configure RSS indirection
7877          * table for that VNIC as only one destination ring group is
7878          * used. When this bit is set to '1', then the VNIC is enabled
7879          * in a mode where RSS is enabled in the VNIC using a RSS
7880          * context for computing RSS hash but the RSS indirection table
7881          * is not configured.
7882          */
7883         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_RSS_DFLT_CR_MODE    UINT32_C(0x20)
7884         /*
7885          * When this bit is '1', the VNIC is configured to receive both
7886          * RoCE and non-RoCE traffic, but forward only RoCE traffic
7887          * further. Also RoCE traffic can be mirrored to L2 driver.
7888          */
7889         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_ROCE_MIRRORING_CAPABLE_VNIC_MODE \
7890         UINT32_C(0x40)
7891         uint32_t unused_2;
7892         uint8_t unused_3;
7893         uint8_t unused_4;
7894         uint8_t unused_5;
7895         uint8_t valid;
7896         /*
7897          * This field is used in Output records to indicate that the
7898          * output is completely written to RAM. This field should be
7899          * read as '1' to indicate that the output has been completely
7900          * written. When writing a command completion or response to an
7901          * internal processor, the order of writes has to be such that
7902          * this field is written last.
7903          */
7904 } __attribute__((packed));
7905
7906
7907 /* hwrm_vnic_tpa_cfg */
7908 /* Description: This function is used to enable/configure TPA on the VNIC. */
7909 /* Input        (40 bytes) */
7910 struct hwrm_vnic_tpa_cfg_input {
7911         uint16_t req_type;
7912         /*
7913          * This value indicates what type of request this is. The format
7914          * for the rest of the command is determined by this field.
7915          */
7916         uint16_t cmpl_ring;
7917         /*
7918          * This value indicates the what completion ring the request
7919          * will be optionally completed on. If the value is -1, then no
7920          * CR completion will be generated. Any other value must be a
7921          * valid CR ring_id value for this function.
7922          */
7923         uint16_t seq_id;
7924         /* This value indicates the command sequence number. */
7925         uint16_t target_id;
7926         /*
7927          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7928          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7929          * - HWRM
7930          */
7931         uint64_t resp_addr;
7932         /*
7933          * This is the host address where the response will be written
7934          * when the request is complete. This area must be 16B aligned
7935          * and must be cleared to zero before the request is made.
7936          */
7937         uint32_t flags;
7938         /*
7939          * When this bit is '1', the VNIC shall be configured to perform
7940          * transparent packet aggregation       (TPA) of non-tunneled TCP
7941          * packets.
7942          */
7943         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_TPA       UINT32_C(0x1)
7944         /*
7945          * When this bit is '1', the VNIC shall be configured to perform
7946          * transparent packet aggregation       (TPA) of tunneled TCP packets.
7947          */
7948         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_ENCAP_TPA UINT32_C(0x2)
7949         /*
7950          * When this bit is '1', the VNIC shall be configured to perform
7951          * transparent packet aggregation       (TPA) according to Windows
7952          * Receive Segment Coalescing   (RSC) rules.
7953          */
7954         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_RSC_WND_UPDATE    UINT32_C(0x4)
7955         /*
7956          * When this bit is '1', the VNIC shall be configured to perform
7957          * transparent packet aggregation       (TPA) according to Linux
7958          * Generic Receive Offload      (GRO) rules.
7959          */
7960         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO       UINT32_C(0x8)
7961         /*
7962          * When this bit is '1', the VNIC shall be configured to perform
7963          * transparent packet aggregation       (TPA) for TCP packets with IP
7964          * ECN set to non-zero.
7965          */
7966         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_AGG_WITH_ECN      UINT32_C(0x10)
7967         /*
7968          * When this bit is '1', the VNIC shall be configured to perform
7969          * transparent packet aggregation       (TPA) for GRE tunneled TCP
7970          * packets only if all packets have the same GRE sequence.
7971          */
7972         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_AGG_WITH_SAME_GRE_SEQ     \
7973                 UINT32_C(0x20)
7974         /*
7975          * When this bit is '1' and the GRO mode is enabled, the VNIC
7976          * shall be configured to perform transparent packet aggregation
7977          *      (TPA) for TCP/IPv4 packets with consecutively increasing
7978          * IPIDs. In other words, the last packet that is being
7979          * aggregated to an already existing aggregation context shall
7980          * have IPID 1 more than the IPID of the last packet that was
7981          * aggregated in that aggregation context.
7982          */
7983         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO_IPID_CHECK    UINT32_C(0x40)
7984         /*
7985          * When this bit is '1' and the GRO mode is enabled, the VNIC
7986          * shall be configured to perform transparent packet aggregation
7987          *      (TPA) for TCP packets with the same TTL (IPv4) or Hop limit
7988          *      (IPv6) value.
7989          */
7990         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO_TTL_CHECK     UINT32_C(0x80)
7991         uint32_t enables;
7992         /* This bit must be '1' for the max_agg_segs field to be configured. */
7993         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGG_SEGS    UINT32_C(0x1)
7994         /* This bit must be '1' for the max_aggs field to be configured. */
7995         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGGS        UINT32_C(0x2)
7996         /*
7997          * This bit must be '1' for the max_agg_timer field to be
7998          * configured.
7999          */
8000         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGG_TIMER   UINT32_C(0x4)
8001         /* This bit must be '1' for the min_agg_len field to be configured. */
8002         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MIN_AGG_LEN     UINT32_C(0x8)
8003         uint16_t vnic_id;
8004         /* Logical vnic ID */
8005         uint16_t max_agg_segs;
8006         /*
8007          * This is the maximum number of TCP segments that can be
8008          * aggregated   (unit is Log2). Max value is 31.
8009          */
8010         /* 1 segment */
8011         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_1  UINT32_C(0x0)
8012         /* 2 segments */
8013         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_2  UINT32_C(0x1)
8014         /* 4 segments */
8015         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_4  UINT32_C(0x2)
8016         /* 8 segments */
8017         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_8  UINT32_C(0x3)
8018         /* Any segment size larger than this is not valid */
8019         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_MAX        UINT32_C(0x1f)
8020         uint16_t max_aggs;
8021         /*
8022          * This is the maximum number of aggregations this VNIC is
8023          * allowed      (unit is Log2). Max value is 7
8024          */
8025         /* 1 aggregation */
8026         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_1      UINT32_C(0x0)
8027         /* 2 aggregations */
8028         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_2      UINT32_C(0x1)
8029         /* 4 aggregations */
8030         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_4      UINT32_C(0x2)
8031         /* 8 aggregations */
8032         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_8      UINT32_C(0x3)
8033         /* 16 aggregations */
8034         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_16     UINT32_C(0x4)
8035         /* Any aggregation size larger than this is not valid */
8036         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_MAX    UINT32_C(0x7)
8037         uint8_t unused_0;
8038         uint8_t unused_1;
8039         uint32_t max_agg_timer;
8040         /*
8041          * This is the maximum amount of time allowed for an aggregation
8042          * context to complete after it was initiated.
8043          */
8044         uint32_t min_agg_len;
8045         /*
8046          * This is the minimum amount of payload length required to
8047          * start an aggregation context.
8048          */
8049 } __attribute__((packed));
8050
8051 /* Output       (16 bytes) */
8052 struct hwrm_vnic_tpa_cfg_output {
8053         uint16_t error_code;
8054         /*
8055          * Pass/Fail or error type Note: receiver to verify the in
8056          * parameters, and fail the call with an error when appropriate
8057          */
8058         uint16_t req_type;
8059         /* This field returns the type of original request. */
8060         uint16_t seq_id;
8061         /* This field provides original sequence number of the command. */
8062         uint16_t resp_len;
8063         /*
8064          * This field is the length of the response in bytes. The last
8065          * byte of the response is a valid flag that will read as '1'
8066          * when the command has been completely written to memory.
8067          */
8068         uint32_t unused_0;
8069         uint8_t unused_1;
8070         uint8_t unused_2;
8071         uint8_t unused_3;
8072         uint8_t valid;
8073         /*
8074          * This field is used in Output records to indicate that the
8075          * output is completely written to RAM. This field should be
8076          * read as '1' to indicate that the output has been completely
8077          * written. When writing a command completion or response to an
8078          * internal processor, the order of writes has to be such that
8079          * this field is written last.
8080          */
8081 } __attribute__((packed));
8082
8083 /* hwrm_vnic_rss_cfg */
8084 /* Description: This function is used to enable RSS configuration. */
8085 /* Input        (48 bytes) */
8086 struct hwrm_vnic_rss_cfg_input {
8087         uint16_t req_type;
8088         /*
8089          * This value indicates what type of request this is. The format
8090          * for the rest of the command is determined by this field.
8091          */
8092         uint16_t cmpl_ring;
8093         /*
8094          * This value indicates the what completion ring the request
8095          * will be optionally completed on. If the value is -1, then no
8096          * CR completion will be generated. Any other value must be a
8097          * valid CR ring_id value for this function.
8098          */
8099         uint16_t seq_id;
8100         /* This value indicates the command sequence number. */
8101         uint16_t target_id;
8102         /*
8103          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8104          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8105          * - HWRM
8106          */
8107         uint64_t resp_addr;
8108         /*
8109          * This is the host address where the response will be written
8110          * when the request is complete. This area must be 16B aligned
8111          * and must be cleared to zero before the request is made.
8112          */
8113         uint32_t hash_type;
8114         /*
8115          * When this bit is '1', the RSS hash shall be computed over
8116          * source and destination IPv4 addresses of IPv4 packets.
8117          */
8118         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4  UINT32_C(0x1)
8119         /*
8120          * When this bit is '1', the RSS hash shall be computed over
8121          * source/destination IPv4 addresses and source/destination
8122          * ports of TCP/IPv4 packets.
8123          */
8124         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV4      UINT32_C(0x2)
8125         /*
8126          * When this bit is '1', the RSS hash shall be computed over
8127          * source/destination IPv4 addresses and source/destination
8128          * ports of UDP/IPv4 packets.
8129          */
8130         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV4      UINT32_C(0x4)
8131         /*
8132          * When this bit is '1', the RSS hash shall be computed over
8133          * source and destination IPv4 addresses of IPv6 packets.
8134          */
8135         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV6  UINT32_C(0x8)
8136         /*
8137          * When this bit is '1', the RSS hash shall be computed over
8138          * source/destination IPv6 addresses and source/destination
8139          * ports of TCP/IPv6 packets.
8140          */
8141         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV6      UINT32_C(0x10)
8142         /*
8143          * When this bit is '1', the RSS hash shall be computed over
8144          * source/destination IPv6 addresses and source/destination
8145          * ports of UDP/IPv6 packets.
8146          */
8147         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV6      UINT32_C(0x20)
8148         uint32_t unused_0;
8149         uint64_t ring_grp_tbl_addr;
8150         /* This is the address for rss ring group table */
8151         uint64_t hash_key_tbl_addr;
8152         /* This is the address for rss hash key table */
8153         uint16_t rss_ctx_idx;
8154         /* Index to the rss indirection table. */
8155         uint16_t unused_1[3];
8156 } __attribute__((packed));
8157
8158 /* Output       (16 bytes) */
8159 struct hwrm_vnic_rss_cfg_output {
8160         uint16_t error_code;
8161         /*
8162          * Pass/Fail or error type Note: receiver to verify the in
8163          * parameters, and fail the call with an error when appropriate
8164          */
8165         uint16_t req_type;
8166         /* This field returns the type of original request. */
8167         uint16_t seq_id;
8168         /* This field provides original sequence number of the command. */
8169         uint16_t resp_len;
8170         /*
8171          * This field is the length of the response in bytes. The last
8172          * byte of the response is a valid flag that will read as '1'
8173          * when the command has been completely written to memory.
8174          */
8175         uint32_t unused_0;
8176         uint8_t unused_1;
8177         uint8_t unused_2;
8178         uint8_t unused_3;
8179         uint8_t valid;
8180         /*
8181          * This field is used in Output records to indicate that the
8182          * output is completely written to RAM. This field should be
8183          * read as '1' to indicate that the output has been completely
8184          * written. When writing a command completion or response to an
8185          * internal processor, the order of writes has to be such that
8186          * this field is written last.
8187          */
8188 } __attribute__((packed));
8189
8190 /* hwrm_vnic_plcmodes_cfg */
8191 /*
8192  * Description: This function can be used to set placement mode configuration of
8193  * the VNIC.
8194  */
8195 /* Input (40 bytes) */
8196 struct hwrm_vnic_plcmodes_cfg_input {
8197         uint16_t req_type;
8198         /*
8199          * This value indicates what type of request this is. The format for the
8200          * rest of the command is determined by this field.
8201          */
8202         uint16_t cmpl_ring;
8203         /*
8204          * This value indicates the what completion ring the request will be
8205          * optionally completed on. If the value is -1, then no CR completion
8206          * will be generated. Any other value must be a valid CR ring_id value
8207          * for this function.
8208          */
8209         uint16_t seq_id;
8210         /* This value indicates the command sequence number. */
8211         uint16_t target_id;
8212         /*
8213          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
8214          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
8215          */
8216         uint64_t resp_addr;
8217         /*
8218          * This is the host address where the response will be written when the
8219          * request is complete. This area must be 16B aligned and must be
8220          * cleared to zero before the request is made.
8221          */
8222         uint32_t flags;
8223         /*
8224          * When this bit is '1', the VNIC shall be configured to use regular
8225          * placement algorithm. By default, the regular placement algorithm
8226          * shall be enabled on the VNIC.
8227          */
8228         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_REGULAR_PLACEMENT \
8229                 UINT32_C(0x1)
8230         /*
8231          * When this bit is '1', the VNIC shall be configured use the jumbo
8232          * placement algorithm.
8233          */
8234         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_JUMBO_PLACEMENT \
8235                 UINT32_C(0x2)
8236         /*
8237          * When this bit is '1', the VNIC shall be configured to enable Header-
8238          * Data split for IPv4 packets according to the following rules: # If
8239          * the packet is identified as TCP/IPv4, then the packet is split at the
8240          * beginning of the TCP payload. # If the packet is identified as
8241          * UDP/IPv4, then the packet is split at the beginning of UDP payload. #
8242          * If the packet is identified as non-TCP and non-UDP IPv4 packet, then
8243          * the packet is split at the beginning of the upper layer protocol
8244          * header carried in the IPv4 packet.
8245          */
8246         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV4        UINT32_C(0x4)
8247         /*
8248          * When this bit is '1', the VNIC shall be configured to enable Header-
8249          * Data split for IPv6 packets according to the following rules: # If
8250          * the packet is identified as TCP/IPv6, then the packet is split at the
8251          * beginning of the TCP payload. # If the packet is identified as
8252          * UDP/IPv6, then the packet is split at the beginning of UDP payload. #
8253          * If the packet is identified as non-TCP and non-UDP IPv6 packet, then
8254          * the packet is split at the beginning of the upper layer protocol
8255          * header carried in the IPv6 packet.
8256          */
8257         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV6        UINT32_C(0x8)
8258         /*
8259          * When this bit is '1', the VNIC shall be configured to enable Header-
8260          * Data split for FCoE packets at the beginning of FC payload.
8261          */
8262         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_FCOE       UINT32_C(0x10)
8263         /*
8264          * When this bit is '1', the VNIC shall be configured to enable Header-
8265          * Data split for RoCE packets at the beginning of RoCE payload (after
8266          * BTH/GRH headers).
8267          */
8268         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_ROCE       UINT32_C(0x20)
8269         uint32_t enables;
8270         /*
8271          * This bit must be '1' for the jumbo_thresh_valid field to be
8272          * configured.
8273          */
8274         #define HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_JUMBO_THRESH_VALID \
8275                 UINT32_C(0x1)
8276         /*
8277          * This bit must be '1' for the hds_offset_valid field to be configured.
8278          */
8279         #define HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_HDS_OFFSET_VALID \
8280                 UINT32_C(0x2)
8281         /*
8282          * This bit must be '1' for the hds_threshold_valid field to be
8283          * configured.
8284          */
8285         #define HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_HDS_THRESHOLD_VALID \
8286                 UINT32_C(0x4)
8287         uint32_t vnic_id;
8288         /* Logical vnic ID */
8289         uint16_t jumbo_thresh;
8290         /*
8291          * When jumbo placement algorithm is enabled, this value is used to
8292          * determine the threshold for jumbo placement. Packets with length
8293          * larger than this value will be placed according to the jumbo
8294          * placement algorithm.
8295          */
8296         uint16_t hds_offset;
8297         /*
8298          * This value is used to determine the offset into packet buffer where
8299          * the split data (payload) will be placed according to one of of HDS
8300          * placement algorithm. The lengths of packet buffers provided for split
8301          * data shall be larger than this value.
8302          */
8303         uint16_t hds_threshold;
8304         /*
8305          * When one of the HDS placement algorithm is enabled, this value is
8306          * used to determine the threshold for HDS placement. Packets with
8307          * length larger than this value will be placed according to the HDS
8308          * placement algorithm. This value shall be in multiple of 4 bytes.
8309          */
8310         uint16_t unused_0[3];
8311 } __attribute__((packed));
8312
8313 /* Output (16 bytes) */
8314 struct hwrm_vnic_plcmodes_cfg_output {
8315         uint16_t error_code;
8316         /*
8317          * Pass/Fail or error type Note: receiver to verify the in parameters,
8318          * and fail the call with an error when appropriate
8319          */
8320         uint16_t req_type;
8321         /* This field returns the type of original request. */
8322         uint16_t seq_id;
8323         /* This field provides original sequence number of the command. */
8324         uint16_t resp_len;
8325         /*
8326          * This field is the length of the response in bytes. The last byte of
8327          * the response is a valid flag that will read as '1' when the command
8328          * has been completely written to memory.
8329          */
8330         uint32_t unused_0;
8331         uint8_t unused_1;
8332         uint8_t unused_2;
8333         uint8_t unused_3;
8334         uint8_t valid;
8335         /*
8336          * This field is used in Output records to indicate that the output is
8337          * completely written to RAM. This field should be read as '1' to
8338          * indicate that the output has been completely written. When writing a
8339          * command completion or response to an internal processor, the order of
8340          * writes has to be such that this field is written last.
8341          */
8342 } __attribute__((packed));
8343
8344 /* hwrm_vnic_plcmodes_qcfg */
8345 /*
8346  * Description: This function can be used to query placement mode configuration
8347  * of the VNIC.
8348  */
8349 /* Input (24 bytes) */
8350 struct hwrm_vnic_plcmodes_qcfg_input {
8351         uint16_t req_type;
8352         /*
8353          * This value indicates what type of request this is. The format for the
8354          * rest of the command is determined by this field.
8355          */
8356         uint16_t cmpl_ring;
8357         /*
8358          * This value indicates the what completion ring the request will be
8359          * optionally completed on. If the value is -1, then no CR completion
8360          * will be generated. Any other value must be a valid CR ring_id value
8361          * for this function.
8362          */
8363         uint16_t seq_id;
8364         /* This value indicates the command sequence number. */
8365         uint16_t target_id;
8366         /*
8367          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
8368          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
8369          */
8370         uint64_t resp_addr;
8371         /*
8372          * This is the host address where the response will be written when the
8373          * request is complete. This area must be 16B aligned and must be
8374          * cleared to zero before the request is made.
8375          */
8376         uint32_t vnic_id;
8377         /* Logical vnic ID */
8378         uint32_t unused_0;
8379 } __attribute__((packed));
8380
8381 /* Output (24 bytes) */
8382 struct hwrm_vnic_plcmodes_qcfg_output {
8383         uint16_t error_code;
8384         /*
8385          * Pass/Fail or error type Note: receiver to verify the in parameters,
8386          * and fail the call with an error when appropriate
8387          */
8388         uint16_t req_type;
8389         /* This field returns the type of original request. */
8390         uint16_t seq_id;
8391         /* This field provides original sequence number of the command. */
8392         uint16_t resp_len;
8393         /*
8394          * This field is the length of the response in bytes. The last byte of
8395          * the response is a valid flag that will read as '1' when the command
8396          * has been completely written to memory.
8397          */
8398         uint32_t flags;
8399         /*
8400          * When this bit is '1', the VNIC is configured to use regular placement
8401          * algorithm.
8402          */
8403         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_REGULAR_PLACEMENT \
8404                 UINT32_C(0x1)
8405         /*
8406          * When this bit is '1', the VNIC is configured to use the jumbo
8407          * placement algorithm.
8408          */
8409         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_JUMBO_PLACEMENT \
8410                 UINT32_C(0x2)
8411         /*
8412          * When this bit is '1', the VNIC is configured to enable Header-Data
8413          * split for IPv4 packets.
8414          */
8415         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_IPV4      UINT32_C(0x4)
8416         /*
8417          * When this bit is '1', the VNIC is configured to enable Header-Data
8418          * split for IPv6 packets.
8419          */
8420         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_IPV6      UINT32_C(0x8)
8421         /*
8422          * When this bit is '1', the VNIC is configured to enable Header-Data
8423          * split for FCoE packets.
8424          */
8425         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_FCOE     UINT32_C(0x10)
8426         /*
8427          * When this bit is '1', the VNIC is configured to enable Header-Data
8428          * split for RoCE packets.
8429          */
8430         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_ROCE     UINT32_C(0x20)
8431         /*
8432          * When this bit is '1', the VNIC is configured to be the default VNIC
8433          * of the requesting function.
8434          */
8435         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_DFLT_VNIC    UINT32_C(0x40)
8436         uint16_t jumbo_thresh;
8437         /*
8438          * When jumbo placement algorithm is enabled, this value is used to
8439          * determine the threshold for jumbo placement. Packets with length
8440          * larger than this value will be placed according to the jumbo
8441          * placement algorithm.
8442          */
8443         uint16_t hds_offset;
8444         /*
8445          * This value is used to determine the offset into packet buffer where
8446          * the split data (payload) will be placed according to one of of HDS
8447          * placement algorithm. The lengths of packet buffers provided for split
8448          * data shall be larger than this value.
8449          */
8450         uint16_t hds_threshold;
8451         /*
8452          * When one of the HDS placement algorithm is enabled, this value is
8453          * used to determine the threshold for HDS placement. Packets with
8454          * length larger than this value will be placed according to the HDS
8455          * placement algorithm. This value shall be in multiple of 4 bytes.
8456          */
8457         uint8_t unused_0;
8458         uint8_t unused_1;
8459         uint8_t unused_2;
8460         uint8_t unused_3;
8461         uint8_t unused_4;
8462         uint8_t valid;
8463         /*
8464          * This field is used in Output records to indicate that the output is
8465          * completely written to RAM. This field should be read as '1' to
8466          * indicate that the output has been completely written. When writing a
8467          * command completion or response to an internal processor, the order of
8468          * writes has to be such that this field is written last.
8469          */
8470 } __attribute__((packed));
8471
8472 /* hwrm_vnic_rss_cos_lb_ctx_alloc */
8473 /* Description: This function is used to allocate COS/Load Balance context. */
8474 /* Input        (16 bytes) */
8475 struct hwrm_vnic_rss_cos_lb_ctx_alloc_input {
8476         uint16_t req_type;
8477         /*
8478          * This value indicates what type of request this is. The format
8479          * for the rest of the command is determined by this field.
8480          */
8481         uint16_t cmpl_ring;
8482         /*
8483          * This value indicates the what completion ring the request
8484          * will be optionally completed on. If the value is -1, then no
8485          * CR completion will be generated. Any other value must be a
8486          * valid CR ring_id value for this function.
8487          */
8488         uint16_t seq_id;
8489         /* This value indicates the command sequence number. */
8490         uint16_t target_id;
8491         /*
8492          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8493          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8494          * - HWRM
8495          */
8496         uint64_t resp_addr;
8497         /*
8498          * This is the host address where the response will be written
8499          * when the request is complete. This area must be 16B aligned
8500          * and must be cleared to zero before the request is made.
8501          */
8502 } __attribute__((packed));
8503
8504 /* Output       (16 bytes) */
8505 struct hwrm_vnic_rss_cos_lb_ctx_alloc_output {
8506         uint16_t error_code;
8507         /*
8508          * Pass/Fail or error type Note: receiver to verify the in
8509          * parameters, and fail the call with an error when appropriate
8510          */
8511         uint16_t req_type;
8512         /* This field returns the type of original request. */
8513         uint16_t seq_id;
8514         /* This field provides original sequence number of the command. */
8515         uint16_t resp_len;
8516         /*
8517          * This field is the length of the response in bytes. The last
8518          * byte of the response is a valid flag that will read as '1'
8519          * when the command has been completely written to memory.
8520          */
8521         uint16_t rss_cos_lb_ctx_id;
8522         /* rss_cos_lb_ctx_id is 16 b */
8523         uint8_t unused_0;
8524         uint8_t unused_1;
8525         uint8_t unused_2;
8526         uint8_t unused_3;
8527         uint8_t unused_4;
8528         uint8_t valid;
8529         /*
8530          * This field is used in Output records to indicate that the
8531          * output is completely written to RAM. This field should be
8532          * read as '1' to indicate that the output has been completely
8533          * written. When writing a command completion or response to an
8534          * internal processor, the order of writes has to be such that
8535          * this field is written last.
8536          */
8537 } __attribute__((packed));
8538
8539 /* hwrm_vnic_rss_cos_lb_ctx_free */
8540 /* Description: This function can be used to free COS/Load Balance context. */
8541 /* Input        (24 bytes) */
8542 struct hwrm_vnic_rss_cos_lb_ctx_free_input {
8543         uint16_t req_type;
8544         /*
8545          * This value indicates what type of request this is. The format
8546          * for the rest of the command is determined by this field.
8547          */
8548         uint16_t cmpl_ring;
8549         /*
8550          * This value indicates the what completion ring the request
8551          * will be optionally completed on. If the value is -1, then no
8552          * CR completion will be generated. Any other value must be a
8553          * valid CR ring_id value for this function.
8554          */
8555         uint16_t seq_id;
8556         /* This value indicates the command sequence number. */
8557         uint16_t target_id;
8558         /*
8559          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8560          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8561          * - HWRM
8562          */
8563         uint64_t resp_addr;
8564         /*
8565          * This is the host address where the response will be written
8566          * when the request is complete. This area must be 16B aligned
8567          * and must be cleared to zero before the request is made.
8568          */
8569         uint16_t rss_cos_lb_ctx_id;
8570         /* rss_cos_lb_ctx_id is 16 b */
8571         uint16_t unused_0[3];
8572 } __attribute__((packed));
8573
8574 /* Output       (16 bytes) */
8575 struct hwrm_vnic_rss_cos_lb_ctx_free_output {
8576         uint16_t error_code;
8577         /*
8578          * Pass/Fail or error type Note: receiver to verify the in
8579          * parameters, and fail the call with an error when appropriate
8580          */
8581         uint16_t req_type;
8582         /* This field returns the type of original request. */
8583         uint16_t seq_id;
8584         /* This field provides original sequence number of the command. */
8585         uint16_t resp_len;
8586         /*
8587          * This field is the length of the response in bytes. The last
8588          * byte of the response is a valid flag that will read as '1'
8589          * when the command has been completely written to memory.
8590          */
8591         uint32_t unused_0;
8592         uint8_t unused_1;
8593         uint8_t unused_2;
8594         uint8_t unused_3;
8595         uint8_t valid;
8596         /*
8597          * This field is used in Output records to indicate that the
8598          * output is completely written to RAM. This field should be
8599          * read as '1' to indicate that the output has been completely
8600          * written. When writing a command completion or response to an
8601          * internal processor, the order of writes has to be such that
8602          * this field is written last.
8603          */
8604 } __attribute__((packed));
8605
8606 /* hwrm_ring_alloc */
8607 /*
8608  * Description: This command allocates and does basic preparation for a ring.
8609  */
8610 /* Input        (80 bytes) */
8611 struct hwrm_ring_alloc_input {
8612         uint16_t req_type;
8613         /*
8614          * This value indicates what type of request this is. The format
8615          * for the rest of the command is determined by this field.
8616          */
8617         uint16_t cmpl_ring;
8618         /*
8619          * This value indicates the what completion ring the request
8620          * will be optionally completed on. If the value is -1, then no
8621          * CR completion will be generated. Any other value must be a
8622          * valid CR ring_id value for this function.
8623          */
8624         uint16_t seq_id;
8625         /* This value indicates the command sequence number. */
8626         uint16_t target_id;
8627         /*
8628          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8629          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8630          * - HWRM
8631          */
8632         uint64_t resp_addr;
8633         /*
8634          * This is the host address where the response will be written
8635          * when the request is complete. This area must be 16B aligned
8636          * and must be cleared to zero before the request is made.
8637          */
8638         uint32_t enables;
8639         /* This bit must be '1' for the Reserved1 field to be configured. */
8640         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED1 UINT32_C(0x1)
8641         /* This bit must be '1' for the ring_arb_cfg field to be configured. */
8642         #define HWRM_RING_ALLOC_INPUT_ENABLES_RING_ARB_CFG      UINT32_C(0x2)
8643         /* This bit must be '1' for the Reserved3 field to be configured. */
8644         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED3 UINT32_C(0x4)
8645         /*
8646          * This bit must be '1' for the stat_ctx_id_valid field to be
8647          * configured.
8648          */
8649         #define HWRM_RING_ALLOC_INPUT_ENABLES_STAT_CTX_ID_VALID UINT32_C(0x8)
8650         /* This bit must be '1' for the Reserved4 field to be configured. */
8651         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED4 UINT32_C(0x10)
8652         /* This bit must be '1' for the max_bw_valid field to be configured. */
8653         #define HWRM_RING_ALLOC_INPUT_ENABLES_MAX_BW_VALID      UINT32_C(0x20)
8654         uint8_t ring_type;
8655         /* Ring Type. */
8656         /* L2 Completion Ring   (CR) */
8657         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL UINT32_C(0x0)
8658         /* TX Ring      (TR) */
8659         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_TX      UINT32_C(0x1)
8660         /* RX Ring      (RR) */
8661         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_RX      UINT32_C(0x2)
8662         /* RoCE Notification Completion Ring    (ROCE_CR) */
8663         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_ROCE_CMPL       UINT32_C(0x3)
8664         uint8_t unused_0;
8665         uint16_t unused_1;
8666         uint64_t page_tbl_addr;
8667         /* This value is a pointer to the page table for the Ring. */
8668         uint32_t fbo;
8669         /* First Byte Offset of the first entry in the first page. */
8670         uint8_t page_size;
8671         /*
8672          * Actual page size in 2^page_size. The supported range is
8673          * increments in powers of 2 from 16 bytes to 1GB. - 4 = 16 B
8674          * Page size is 16 B. - 12 = 4 KB Page size is 4 KB. - 13 = 8 KB
8675          * Page size is 8 KB. - 16 = 64 KB Page size is 64 KB. - 21 = 2
8676          * MB Page size is 2 MB. - 22 = 4 MB Page size is 4 MB. - 30 = 1
8677          * GB Page size is 1 GB.
8678          */
8679         uint8_t page_tbl_depth;
8680         /*
8681          * This value indicates the depth of page table. For this
8682          * version of the specification, value other than 0 or 1 shall
8683          * be considered as an invalid value. When the page_tbl_depth =
8684          * 0, then it is treated as a special case with the following.
8685          * 1. FBO and page size fields are not valid. 2. page_tbl_addr
8686          * is the physical address of the first element of the ring.
8687          */
8688         uint8_t unused_2;
8689         uint8_t unused_3;
8690         uint32_t length;
8691         /*
8692          * Number of 16B units in the ring. Minimum size for a ring is
8693          * 16 16B entries.
8694          */
8695         uint16_t logical_id;
8696         /*
8697          * Logical ring number for the ring to be allocated. This value
8698          * determines the position in the doorbell area where the update
8699          * to the ring will be made. For completion rings, this value is
8700          * also the MSI-X vector number for the function the completion
8701          * ring is associated with.
8702          */
8703         uint16_t cmpl_ring_id;
8704         /*
8705          * This field is used only when ring_type is a TX ring. This
8706          * value indicates what completion ring the TX ring is
8707          * associated with.
8708          */
8709         uint16_t queue_id;
8710         /*
8711          * This field is used only when ring_type is a TX ring. This
8712          * value indicates what CoS queue the TX ring is associated
8713          * with.
8714          */
8715         uint8_t unused_4;
8716         uint8_t unused_5;
8717         uint32_t reserved1;
8718         /* This field is reserved for the future use. It shall be set to 0. */
8719         uint16_t ring_arb_cfg;
8720         /*
8721          * This field is used only when ring_type is a TX ring. This
8722          * field is used to configure arbitration related parameters for
8723          * a TX ring.
8724          */
8725         /* Arbitration policy used for the ring. */
8726         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_MASK UINT32_C(0xf)
8727         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_SFT       0
8728         /*
8729          * Use strict priority for the TX ring. Priority
8730          * value is specified in arb_policy_param
8731          */
8732         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_SP \
8733                 (UINT32_C(0x1) << 0)
8734         /*
8735          * Use weighted fair queue arbitration for the
8736          * TX ring. Weight is specified in
8737          * arb_policy_param
8738          */
8739         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_WFQ \
8740                 (UINT32_C(0x2) << 0)
8741         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_LAST \
8742                 RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_WFQ
8743         /* Reserved field. */
8744         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_RSVD_MASK    UINT32_C(0xf0)
8745         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_RSVD_SFT     4
8746         /*
8747          * Arbitration policy specific parameter. # For strict priority
8748          * arbitration policy, this field represents a priority value.
8749          * If set to 0, then the priority is not specified and the HWRM
8750          * is allowed to select any priority for this TX ring. # For
8751          * weighted fair queue arbitration policy, this field represents
8752          * a weight value. If set to 0, then the weight is not specified
8753          * and the HWRM is allowed to select any weight for this TX
8754          * ring.
8755          */
8756         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_PARAM_MASK  \
8757                 UINT32_C(0xff00)
8758         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_PARAM_SFT 8
8759         uint8_t unused_6;
8760         uint8_t unused_7;
8761         uint32_t reserved3;
8762         /* This field is reserved for the future use. It shall be set to 0. */
8763         uint32_t stat_ctx_id;
8764         /*
8765          * This field is used only when ring_type is a TX ring. This
8766          * input indicates what statistics context this ring should be
8767          * associated with.
8768          */
8769         uint32_t reserved4;
8770         /* This field is reserved for the future use. It shall be set to 0. */
8771         uint32_t max_bw;
8772         /*
8773          * This field is used only when ring_type is a TX ring to
8774          * specify maximum BW allocated to the TX ring. The HWRM will
8775          * translate this value into byte counter and time interval used
8776          * for this ring inside the device.
8777          */
8778         /* The bandwidth value. */
8779         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_MASK UINT32_C(0xfffffff)
8780         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_SFT       0
8781         /* The granularity of the value (bits or bytes). */
8782         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE      UINT32_C(0x10000000)
8783         /* Value is in bits. */
8784         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE_BITS (UINT32_C(0x0) << 28)
8785         /* Value is in bytes. */
8786         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE_BYTES (UINT32_C(0x1) << 28)
8787         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE_LAST \
8788                 RING_ALLOC_INPUT_MAX_BW_SCALE_BYTES
8789         /* bw_value_unit is 3 b */
8790         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_MASK \
8791                 UINT32_C(0xe0000000)
8792         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_SFT  29
8793         /* Value is in Mb or MB (base 10). */
8794         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_MEGA \
8795                 (UINT32_C(0x0) << 29)
8796         /* Value is in Kb or KB (base 10). */
8797         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_KILO \
8798                 (UINT32_C(0x2) << 29)
8799         /* Value is in bits or bytes. */
8800         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_BASE \
8801                 (UINT32_C(0x4) << 29)
8802         /* Value is in Gb or GB (base 10). */
8803         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_GIGA \
8804                 (UINT32_C(0x6) << 29)
8805         /* Value is in 1/100th of a percentage of total bandwidth. */
8806         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_PERCENT1_100 \
8807                 (UINT32_C(0x1) << 29)
8808         /* Invalid unit */
8809         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_INVALID \
8810                 (UINT32_C(0x7) << 29)
8811         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_LAST \
8812                 RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_INVALID
8813         uint8_t int_mode;
8814         /*
8815          * This field is used only when ring_type is a Completion ring.
8816          * This value indicates what interrupt mode should be used on
8817          * this completion ring. Note: In the legacy interrupt mode, no
8818          * more than 16 completion rings are allowed.
8819          */
8820         /* Legacy INTA */
8821         #define HWRM_RING_ALLOC_INPUT_INT_MODE_LEGACY   UINT32_C(0x0)
8822         /* Reserved */
8823         #define HWRM_RING_ALLOC_INPUT_INT_MODE_RSVD     UINT32_C(0x1)
8824         /* MSI-X */
8825         #define HWRM_RING_ALLOC_INPUT_INT_MODE_MSIX     UINT32_C(0x2)
8826         /* No Interrupt - Polled mode */
8827         #define HWRM_RING_ALLOC_INPUT_INT_MODE_POLL     UINT32_C(0x3)
8828         uint8_t unused_8[3];
8829 } __attribute__((packed));
8830
8831 /* Output       (16 bytes) */
8832 struct hwrm_ring_alloc_output {
8833         uint16_t error_code;
8834         /*
8835          * Pass/Fail or error type Note: receiver to verify the in
8836          * parameters, and fail the call with an error when appropriate
8837          */
8838         uint16_t req_type;
8839         /* This field returns the type of original request. */
8840         uint16_t seq_id;
8841         /* This field provides original sequence number of the command. */
8842         uint16_t resp_len;
8843         /*
8844          * This field is the length of the response in bytes. The last
8845          * byte of the response is a valid flag that will read as '1'
8846          * when the command has been completely written to memory.
8847          */
8848         uint16_t ring_id;
8849         /*
8850          * Physical number of ring allocated. This value shall be unique
8851          * for a ring type.
8852          */
8853         uint16_t logical_ring_id;
8854         /* Logical number of ring allocated. */
8855         uint8_t unused_0;
8856         uint8_t unused_1;
8857         uint8_t unused_2;
8858         uint8_t valid;
8859         /*
8860          * This field is used in Output records to indicate that the
8861          * output is completely written to RAM. This field should be
8862          * read as '1' to indicate that the output has been completely
8863          * written. When writing a command completion or response to an
8864          * internal processor, the order of writes has to be such that
8865          * this field is written last.
8866          */
8867 } __attribute__((packed));
8868
8869 /* hwrm_ring_free */
8870 /*
8871  * Description: This command is used to free a ring and associated resources.
8872  * With QoS and DCBx agents, it is possible the traffic classes will be moved
8873  * from one CoS queue to another. When this occurs, the driver shall call
8874  * 'hwrm_ring_free' to free the allocated rings and then call 'hwrm_ring_alloc'
8875  * to re-allocate each ring and assign it to a new CoS queue. hwrm_ring_free
8876  * shall be called on a ring only after it has been idle for 500ms or more and
8877  * no frames have been posted to the ring during this time. All frames queued
8878  * for transmission shall be completed and at least 500ms time elapsed from the
8879  * last completion before calling this command.
8880  */
8881 /* Input        (24 bytes) */
8882 struct hwrm_ring_free_input {
8883         uint16_t req_type;
8884         /*
8885          * This value indicates what type of request this is. The format
8886          * for the rest of the command is determined by this field.
8887          */
8888         uint16_t cmpl_ring;
8889         /*
8890          * This value indicates the what completion ring the request
8891          * will be optionally completed on. If the value is -1, then no
8892          * CR completion will be generated. Any other value must be a
8893          * valid CR ring_id value for this function.
8894          */
8895         uint16_t seq_id;
8896         /* This value indicates the command sequence number. */
8897         uint16_t target_id;
8898         /*
8899          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8900          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8901          * - HWRM
8902          */
8903         uint64_t resp_addr;
8904         /*
8905          * This is the host address where the response will be written
8906          * when the request is complete. This area must be 16B aligned
8907          * and must be cleared to zero before the request is made.
8908          */
8909         uint8_t ring_type;
8910         /* Ring Type. */
8911         /* L2 Completion Ring   (CR) */
8912         #define HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL  UINT32_C(0x0)
8913         /* TX Ring      (TR) */
8914         #define HWRM_RING_FREE_INPUT_RING_TYPE_TX       UINT32_C(0x1)
8915         /* RX Ring      (RR) */
8916         #define HWRM_RING_FREE_INPUT_RING_TYPE_RX       UINT32_C(0x2)
8917         /* RoCE Notification Completion Ring    (ROCE_CR) */
8918         #define HWRM_RING_FREE_INPUT_RING_TYPE_ROCE_CMPL        UINT32_C(0x3)
8919         uint8_t unused_0;
8920         uint16_t ring_id;
8921         /* Physical number of ring allocated. */
8922         uint32_t unused_1;
8923 } __attribute__((packed));
8924
8925 /* Output       (16 bytes) */
8926 struct hwrm_ring_free_output {
8927         uint16_t error_code;
8928         /*
8929          * Pass/Fail or error type Note: receiver to verify the in
8930          * parameters, and fail the call with an error when appropriate
8931          */
8932         uint16_t req_type;
8933         /* This field returns the type of original request. */
8934         uint16_t seq_id;
8935         /* This field provides original sequence number of the command. */
8936         uint16_t resp_len;
8937         /*
8938          * This field is the length of the response in bytes. The last
8939          * byte of the response is a valid flag that will read as '1'
8940          * when the command has been completely written to memory.
8941          */
8942         uint32_t unused_0;
8943         uint8_t unused_1;
8944         uint8_t unused_2;
8945         uint8_t unused_3;
8946         uint8_t valid;
8947         /*
8948          * This field is used in Output records to indicate that the
8949          * output is completely written to RAM. This field should be
8950          * read as '1' to indicate that the output has been completely
8951          * written. When writing a command completion or response to an
8952          * internal processor, the order of writes has to be such that
8953          * this field is written last.
8954          */
8955 } __attribute__((packed));
8956
8957 /* hwrm_ring_grp_alloc */
8958 /*
8959  * Description: This API allocates and does basic preparation for a ring group.
8960  */
8961 /* Input        (24 bytes) */
8962 struct hwrm_ring_grp_alloc_input {
8963         uint16_t req_type;
8964         /*
8965          * This value indicates what type of request this is. The format
8966          * for the rest of the command is determined by this field.
8967          */
8968         uint16_t cmpl_ring;
8969         /*
8970          * This value indicates the what completion ring the request
8971          * will be optionally completed on. If the value is -1, then no
8972          * CR completion will be generated. Any other value must be a
8973          * valid CR ring_id value for this function.
8974          */
8975         uint16_t seq_id;
8976         /* This value indicates the command sequence number. */
8977         uint16_t target_id;
8978         /*
8979          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8980          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8981          * - HWRM
8982          */
8983         uint64_t resp_addr;
8984         /*
8985          * This is the host address where the response will be written
8986          * when the request is complete. This area must be 16B aligned
8987          * and must be cleared to zero before the request is made.
8988          */
8989         uint16_t cr;
8990         /* This value identifies the CR associated with the ring group. */
8991         uint16_t rr;
8992         /* This value identifies the main RR associated with the ring group. */
8993         uint16_t ar;
8994         /*
8995          * This value identifies the aggregation RR associated with the
8996          * ring group. If this value is 0xFF... (All Fs), then no
8997          * Aggregation ring will be set.
8998          */
8999         uint16_t sc;
9000         /*
9001          * This value identifies the statistics context associated with
9002          * the ring group.
9003          */
9004 } __attribute__((packed));
9005
9006 /* Output       (16 bytes) */
9007 struct hwrm_ring_grp_alloc_output {
9008         uint16_t error_code;
9009         /*
9010          * Pass/Fail or error type Note: receiver to verify the in
9011          * parameters, and fail the call with an error when appropriate
9012          */
9013         uint16_t req_type;
9014         /* This field returns the type of original request. */
9015         uint16_t seq_id;
9016         /* This field provides original sequence number of the command. */
9017         uint16_t resp_len;
9018         /*
9019          * This field is the length of the response in bytes. The last
9020          * byte of the response is a valid flag that will read as '1'
9021          * when the command has been completely written to memory.
9022          */
9023         uint32_t ring_group_id;
9024         /*
9025          * This is the ring group ID value. Use this value to program
9026          * the default ring group for the VNIC or as table entries in an
9027          * RSS/COS context.
9028          */
9029         uint8_t unused_0;
9030         uint8_t unused_1;
9031         uint8_t unused_2;
9032         uint8_t valid;
9033         /*
9034          * This field is used in Output records to indicate that the
9035          * output is completely written to RAM. This field should be
9036          * read as '1' to indicate that the output has been completely
9037          * written. When writing a command completion or response to an
9038          * internal processor, the order of writes has to be such that
9039          * this field is written last.
9040          */
9041 } __attribute__((packed));
9042
9043 /* hwrm_ring_grp_free */
9044 /*
9045  * Description: This API frees a ring group and associated resources. # If a
9046  * ring in the ring group is reset or free, then the associated rings in the
9047  * ring group shall also be reset/free using hwrm_ring_free. # A function driver
9048  * shall always use hwrm_ring_grp_free after freeing all rings in a group. # As
9049  * a part of executing this command, the HWRM shall reset all associated ring
9050  * group resources.
9051  */
9052 /* Input        (24 bytes) */
9053 struct hwrm_ring_grp_free_input {
9054         uint16_t req_type;
9055         /*
9056          * This value indicates what type of request this is. The format
9057          * for the rest of the command is determined by this field.
9058          */
9059         uint16_t cmpl_ring;
9060         /*
9061          * This value indicates the what completion ring the request
9062          * will be optionally completed on. If the value is -1, then no
9063          * CR completion will be generated. Any other value must be a
9064          * valid CR ring_id value for this function.
9065          */
9066         uint16_t seq_id;
9067         /* This value indicates the command sequence number. */
9068         uint16_t target_id;
9069         /*
9070          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9071          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9072          * - HWRM
9073          */
9074         uint64_t resp_addr;
9075         /*
9076          * This is the host address where the response will be written
9077          * when the request is complete. This area must be 16B aligned
9078          * and must be cleared to zero before the request is made.
9079          */
9080         uint32_t ring_group_id;
9081         /* This is the ring group ID value. */
9082         uint32_t unused_0;
9083 } __attribute__((packed));
9084
9085 /* Output       (16 bytes) */
9086 struct hwrm_ring_grp_free_output {
9087         uint16_t error_code;
9088         /*
9089          * Pass/Fail or error type Note: receiver to verify the in
9090          * parameters, and fail the call with an error when appropriate
9091          */
9092         uint16_t req_type;
9093         /* This field returns the type of original request. */
9094         uint16_t seq_id;
9095         /* This field provides original sequence number of the command. */
9096         uint16_t resp_len;
9097         /*
9098          * This field is the length of the response in bytes. The last
9099          * byte of the response is a valid flag that will read as '1'
9100          * when the command has been completely written to memory.
9101          */
9102         uint32_t unused_0;
9103         uint8_t unused_1;
9104         uint8_t unused_2;
9105         uint8_t unused_3;
9106         uint8_t valid;
9107         /*
9108          * This field is used in Output records to indicate that the
9109          * output is completely written to RAM. This field should be
9110          * read as '1' to indicate that the output has been completely
9111          * written. When writing a command completion or response to an
9112          * internal processor, the order of writes has to be such that
9113          * this field is written last.
9114          */
9115 } __attribute__((packed));
9116
9117 /* hwrm_cfa_l2_filter_alloc */
9118 /*
9119  * Description: An L2 filter is a filter resource that is used to identify a
9120  * vnic or ring for a packet based on layer 2 fields. Layer 2 fields for
9121  * encapsulated packets include both outer L2 header and/or inner l2 header of
9122  * encapsulated packet. The L2 filter resource covers the following OS specific
9123  * L2 filters. Linux/FreeBSD (per function): # Broadcast enable/disable # List
9124  * of individual multicast filters # All multicast enable/disable filter #
9125  * Unicast filters # Promiscuous mode VMware: # Broadcast enable/disable (per
9126  * physical function) # All multicast enable/disable    (per function) # Unicast
9127  * filters per ring or vnic # Promiscuous mode per PF Windows: # Broadcast
9128  * enable/disable (per physical function) # List of individual multicast filters
9129  * (Driver needs to advertise the maximum number of filters supported) # All
9130  * multicast enable/disable per physical function # Unicast filters per vnic #
9131  * Promiscuous mode per PF Implementation notes on the use of VNIC in this
9132  * command: # By default, these filters belong to default vnic for the function.
9133  * # Once these filters are set up, only destination VNIC can be modified. # If
9134  * the destination VNIC is not specified in this command, then the HWRM shall
9135  * only create an l2 context id. HWRM Implementation notes for multicast
9136  * filters: # The hwrm_filter_alloc command can be used to set up multicast
9137  * filters (perfect match or partial match). Each individual function driver can
9138  * set up multicast filters independently. # The HWRM needs to keep track of
9139  * multicast filters set up by function drivers and maintain multicast group
9140  * replication records to enable a subset of functions to receive traffic for a
9141  * specific multicast address. # When a specific multicast filter cannot be set,
9142  * the HWRM shall return an error. In this error case, the driver should fall
9143  * back to using one general filter     (rather than specific) for all multicast
9144  * traffic. # When the SR-IOV is enabled, the HWRM needs to additionally track
9145  * source knockout per multicast group record. Examples of setting unicast
9146  * filters: For a unicast MAC based filter, one can use a combination of the
9147  * fields and masks provided in this command to set up the filter. Below are
9148  * some examples: # MAC + no VLAN filter: This filter is used to identify
9149  * traffic that does not contain any VLAN tags and matches destination  (or
9150  * source) MAC address. This filter can be set up by setting only l2_addr field
9151  * to be a valid field. All other fields are not valid. The following value is
9152  * set for l2_addr. l2_addr = MAC # MAC + Any VLAN filter: This filter is used
9153  * to identify traffic that carries single VLAN tag and matches (destination or
9154  * source) MAC address. This filter can be set up by setting only l2_addr and
9155  * l2_ovlan_mask fields to be valid fields. All other fields are not valid. The
9156  * following values are set for those two valid fields. l2_addr = MAC,
9157  * l2_ovlan_mask = 0xFFFF # MAC + no VLAN or VLAN ID=0: This filter is used to
9158  * identify untagged traffic that does not contain any VLAN tags or a VLAN tag
9159  * with VLAN ID = 0 and matches destination (or source) MAC address. This filter
9160  * can be set up by setting only l2_addr and l2_ovlan fields to be valid fields.
9161  * All other fields are not valid. The following value are set for l2_addr and
9162  * l2_ovlan. l2_addr = MAC, l2_ovlan = 0x0 # MAC + no VLAN or any VLAN: This
9163  * filter is used to identify traffic that contains zero or 1 VLAN tag and
9164  * matches destination  (or source) MAC address. This filter can be set up by
9165  * setting only l2_addr, l2_ovlan, and l2_mask fields to be valid fields. All
9166  * other fields are not valid. The following value are set for l2_addr,
9167  * l2_ovlan, and l2_mask fields. l2_addr = MAC, l2_ovlan = 0x0, l2_ovlan_mask =
9168  * 0xFFFF # MAC + VLAN ID filter: This filter can be set up by setting only
9169  * l2_addr, l2_ovlan, and l2_ovlan_mask fields to be valid fields. All other
9170  * fields are not valid. The following values are set for those three valid
9171  * fields. l2_addr = MAC, l2_ovlan = VLAN ID, l2_ovlan_mask = 0xF000
9172  */
9173 /* Input        (96 bytes) */
9174 struct hwrm_cfa_l2_filter_alloc_input {
9175         uint16_t req_type;
9176         /*
9177          * This value indicates what type of request this is. The format
9178          * for the rest of the command is determined by this field.
9179          */
9180         uint16_t cmpl_ring;
9181         /*
9182          * This value indicates the what completion ring the request
9183          * will be optionally completed on. If the value is -1, then no
9184          * CR completion will be generated. Any other value must be a
9185          * valid CR ring_id value for this function.
9186          */
9187         uint16_t seq_id;
9188         /* This value indicates the command sequence number. */
9189         uint16_t target_id;
9190         /*
9191          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9192          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9193          * - HWRM
9194          */
9195         uint64_t resp_addr;
9196         /*
9197          * This is the host address where the response will be written
9198          * when the request is complete. This area must be 16B aligned
9199          * and must be cleared to zero before the request is made.
9200          */
9201         uint32_t flags;
9202         /*
9203          * Enumeration denoting the RX, TX type of the resource. This
9204          * enumeration is used for resources that are similar for both
9205          * TX and RX paths of the chip.
9206          */
9207         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH       UINT32_C(0x1)
9208         /* tx path */
9209         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_TX    \
9210                 (UINT32_C(0x0) << 0)
9211         /* rx path */
9212         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX    \
9213                 (UINT32_C(0x1) << 0)
9214         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_LAST \
9215                 CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX
9216         /*
9217          * Setting of this flag indicates the applicability to the
9218          * loopback path.
9219          */
9220         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_LOOPBACK   UINT32_C(0x2)
9221         /*
9222          * Setting of this flag indicates drop action. If this flag is
9223          * not set, then it should be considered accept action.
9224          */
9225         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_DROP       UINT32_C(0x4)
9226         /*
9227          * If this flag is set, all t_l2_* fields are invalid and they
9228          * should not be specified. If this flag is set, then l2_*
9229          * fields refer to fields of outermost L2 header.
9230          */
9231         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST UINT32_C(0x8)
9232         uint32_t enables;
9233         /* This bit must be '1' for the l2_addr field to be configured. */
9234         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR UINT32_C(0x1)
9235         /* This bit must be '1' for the l2_addr_mask field to be configured. */
9236         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK     \
9237                 UINT32_C(0x2)
9238         /* This bit must be '1' for the l2_ovlan field to be configured. */
9239         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN UINT32_C(0x4)
9240         /*
9241          * This bit must be '1' for the l2_ovlan_mask field to be
9242          * configured.
9243          */
9244         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN_MASK     \
9245                 UINT32_C(0x8)
9246         /* This bit must be '1' for the l2_ivlan field to be configured. */
9247         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN UINT32_C(0x10)
9248         /*
9249          * This bit must be '1' for the l2_ivlan_mask field to be
9250          * configured.
9251          */
9252         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN_MASK     \
9253                 UINT32_C(0x20)
9254         /* This bit must be '1' for the t_l2_addr field to be configured. */
9255         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR UINT32_C(0x40)
9256         /*
9257          * This bit must be '1' for the t_l2_addr_mask field to be
9258          * configured.
9259          */
9260         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR_MASK   \
9261                 UINT32_C(0x80)
9262         /* This bit must be '1' for the t_l2_ovlan field to be configured. */
9263         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN       \
9264                 UINT32_C(0x100)
9265         /*
9266          * This bit must be '1' for the t_l2_ovlan_mask field to be
9267          * configured.
9268          */
9269         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN_MASK  \
9270                 UINT32_C(0x200)
9271         /* This bit must be '1' for the t_l2_ivlan field to be configured. */
9272         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN       \
9273                 UINT32_C(0x400)
9274         /*
9275          * This bit must be '1' for the t_l2_ivlan_mask field to be
9276          * configured.
9277          */
9278         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN_MASK  \
9279                 UINT32_C(0x800)
9280         /* This bit must be '1' for the src_type field to be configured. */
9281         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_TYPE UINT32_C(0x1000)
9282         /* This bit must be '1' for the src_id field to be configured. */
9283         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_ID UINT32_C(0x2000)
9284         /* This bit must be '1' for the tunnel_type field to be configured. */
9285         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_TUNNEL_TYPE      \
9286                 UINT32_C(0x4000)
9287         /* This bit must be '1' for the dst_id field to be configured. */
9288         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_DST_ID UINT32_C(0x8000)
9289         /*
9290          * This bit must be '1' for the mirror_vnic_id field to be
9291          * configured.
9292          */
9293         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID   \
9294                 UINT32_C(0x10000)
9295         uint8_t l2_addr[6];
9296         /*
9297          * This value sets the match value for the L2 MAC address.
9298          * Destination MAC address for RX path. Source MAC address for
9299          * TX path.
9300          */
9301         uint8_t unused_0;
9302         uint8_t unused_1;
9303         uint8_t l2_addr_mask[6];
9304         /*
9305          * This value sets the mask value for the L2 address. A value of
9306          * 0 will mask the corresponding bit from compare.
9307          */
9308         uint16_t l2_ovlan;
9309         /* This value sets VLAN ID value for outer VLAN. */
9310         uint16_t l2_ovlan_mask;
9311         /*
9312          * This value sets the mask value for the ovlan id. A value of 0
9313          * will mask the corresponding bit from compare.
9314          */
9315         uint16_t l2_ivlan;
9316         /* This value sets VLAN ID value for inner VLAN. */
9317         uint16_t l2_ivlan_mask;
9318         /*
9319          * This value sets the mask value for the ivlan id. A value of 0
9320          * will mask the corresponding bit from compare.
9321          */
9322         uint8_t unused_2;
9323         uint8_t unused_3;
9324         uint8_t t_l2_addr[6];
9325         /*
9326          * This value sets the match value for the tunnel L2 MAC
9327          * address. Destination MAC address for RX path. Source MAC
9328          * address for TX path.
9329          */
9330         uint8_t unused_4;
9331         uint8_t unused_5;
9332         uint8_t t_l2_addr_mask[6];
9333         /*
9334          * This value sets the mask value for the tunnel L2 address. A
9335          * value of 0 will mask the corresponding bit from compare.
9336          */
9337         uint16_t t_l2_ovlan;
9338         /* This value sets VLAN ID value for tunnel outer VLAN. */
9339         uint16_t t_l2_ovlan_mask;
9340         /*
9341          * This value sets the mask value for the tunnel ovlan id. A
9342          * value of 0 will mask the corresponding bit from compare.
9343          */
9344         uint16_t t_l2_ivlan;
9345         /* This value sets VLAN ID value for tunnel inner VLAN. */
9346         uint16_t t_l2_ivlan_mask;
9347         /*
9348          * This value sets the mask value for the tunnel ivlan id. A
9349          * value of 0 will mask the corresponding bit from compare.
9350          */
9351         uint8_t src_type;
9352         /* This value identifies the type of source of the packet. */
9353         /* Network port */
9354         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_NPORT   UINT32_C(0x0)
9355         /* Physical function */
9356         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_PF      UINT32_C(0x1)
9357         /* Virtual function */
9358         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VF      UINT32_C(0x2)
9359         /* Virtual NIC of a function */
9360         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VNIC    UINT32_C(0x3)
9361         /* Embedded processor for CFA management */
9362         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_KONG    UINT32_C(0x4)
9363         /* Embedded processor for OOB management */
9364         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_APE     UINT32_C(0x5)
9365         /* Embedded processor for RoCE */
9366         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_BONO    UINT32_C(0x6)
9367         /* Embedded processor for network proxy functions */
9368         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_TANG    UINT32_C(0x7)
9369         uint8_t unused_6;
9370         uint32_t src_id;
9371         /*
9372          * This value is the id of the source. For a network port, it
9373          * represents port_id. For a physical function, it represents
9374          * fid. For a virtual function, it represents vf_id. For a vnic,
9375          * it represents vnic_id. For embedded processors, this id is
9376          * not valid. Notes: 1. The function ID is implied if it src_id
9377          * is not provided for a src_type that is either
9378          */
9379         uint8_t tunnel_type;
9380         /* Tunnel Type. */
9381         /* Non-tunnel */
9382         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NONTUNNEL \
9383                 UINT32_C(0x0)
9384         /* Virtual eXtensible Local Area Network        (VXLAN) */
9385         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_VXLAN \
9386                 UINT32_C(0x1)
9387         /*
9388          * Network Virtualization Generic Routing
9389          * Encapsulation        (NVGRE)
9390          */
9391         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NVGRE \
9392                 UINT32_C(0x2)
9393         /*
9394          * Generic Routing Encapsulation        (GRE) inside
9395          * Ethernet payload
9396          */
9397         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_L2GRE UINT32_C(0x3)
9398         /* IP in IP */
9399         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPIP UINT32_C(0x4)
9400         /* Generic Network Virtualization Encapsulation (Geneve) */
9401         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_GENEVE UINT32_C(0x5)
9402         /* Multi-Protocol Lable Switching       (MPLS) */
9403         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_MPLS UINT32_C(0x6)
9404         /* Stateless Transport Tunnel   (STT) */
9405         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_STT  UINT32_C(0x7)
9406         /*
9407          * Generic Routing Encapsulation        (GRE) inside IP
9408          * datagram payload
9409          */
9410         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPGRE UINT32_C(0x8)
9411         /*
9412          * IPV4 over virtual eXtensible Local Area
9413          * Network (IPV4oVXLAN)
9414          */
9415         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_VXLAN_V4 \
9416                 UINT32_C(0x9)
9417         /* Any tunneled traffic */
9418         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_ANYTUNNEL \
9419                 UINT32_C(0xff)
9420         uint8_t unused_7;
9421         uint16_t dst_id;
9422         /*
9423          * If set, this value shall represent the Logical VNIC ID of the
9424          * destination VNIC for the RX path and network port id of the
9425          * destination port for the TX path.
9426          */
9427         uint16_t mirror_vnic_id;
9428         /* Logical VNIC ID of the VNIC where traffic is mirrored. */
9429         uint8_t pri_hint;
9430         /*
9431          * This hint is provided to help in placing the filter in the
9432          * filter table.
9433          */
9434         /* No preference */
9435         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_NO_PREFER \
9436                 UINT32_C(0x0)
9437         /* Above the given filter */
9438         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_ABOVE_FILTER \
9439                 UINT32_C(0x1)
9440         /* Below the given filter */
9441         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_BELOW_FILTER \
9442                 UINT32_C(0x2)
9443         /* As high as possible */
9444         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MAX     UINT32_C(0x3)
9445         /* As low as possible */
9446         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MIN     UINT32_C(0x4)
9447         uint8_t unused_8;
9448         uint32_t unused_9;
9449         uint64_t l2_filter_id_hint;
9450         /*
9451          * This is the ID of the filter that goes along with the
9452          * pri_hint. This field is valid only for the following values.
9453          * 1 - Above the given filter 2 - Below the given filter
9454          */
9455 } __attribute__((packed));
9456
9457 /* Output       (24 bytes) */
9458 struct hwrm_cfa_l2_filter_alloc_output {
9459         uint16_t error_code;
9460         /*
9461          * Pass/Fail or error type Note: receiver to verify the in
9462          * parameters, and fail the call with an error when appropriate
9463          */
9464         uint16_t req_type;
9465         /* This field returns the type of original request. */
9466         uint16_t seq_id;
9467         /* This field provides original sequence number of the command. */
9468         uint16_t resp_len;
9469         /*
9470          * This field is the length of the response in bytes. The last
9471          * byte of the response is a valid flag that will read as '1'
9472          * when the command has been completely written to memory.
9473          */
9474         uint64_t l2_filter_id;
9475         /*
9476          * This value identifies a set of CFA data structures used for
9477          * an L2 context.
9478          */
9479         uint32_t flow_id;
9480         /*
9481          * This is the ID of the flow associated with this filter. This
9482          * value shall be used to match and associate the flow
9483          * identifier returned in completion records. A value of
9484          * 0xFFFFFFFF shall indicate no flow id.
9485          */
9486         uint8_t unused_0;
9487         uint8_t unused_1;
9488         uint8_t unused_2;
9489         uint8_t valid;
9490         /*
9491          * This field is used in Output records to indicate that the
9492          * output is completely written to RAM. This field should be
9493          * read as '1' to indicate that the output has been completely
9494          * written. When writing a command completion or response to an
9495          * internal processor, the order of writes has to be such that
9496          * this field is written last.
9497          */
9498 } __attribute__((packed));
9499
9500 /* hwrm_cfa_l2_filter_free */
9501 /*
9502  * Description: Free a L2 filter. The HWRM shall free all associated filter
9503  * resources with the L2 filter.
9504  */
9505 /* Input        (24 bytes) */
9506 struct hwrm_cfa_l2_filter_free_input {
9507         uint16_t req_type;
9508         /*
9509          * This value indicates what type of request this is. The format
9510          * for the rest of the command is determined by this field.
9511          */
9512         uint16_t cmpl_ring;
9513         /*
9514          * This value indicates the what completion ring the request
9515          * will be optionally completed on. If the value is -1, then no
9516          * CR completion will be generated. Any other value must be a
9517          * valid CR ring_id value for this function.
9518          */
9519         uint16_t seq_id;
9520         /* This value indicates the command sequence number. */
9521         uint16_t target_id;
9522         /*
9523          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9524          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9525          * - HWRM
9526          */
9527         uint64_t resp_addr;
9528         /*
9529          * This is the host address where the response will be written
9530          * when the request is complete. This area must be 16B aligned
9531          * and must be cleared to zero before the request is made.
9532          */
9533         uint64_t l2_filter_id;
9534         /*
9535          * This value identifies a set of CFA data structures used for
9536          * an L2 context.
9537          */
9538 } __attribute__((packed));
9539
9540 /* Output       (16 bytes) */
9541 struct hwrm_cfa_l2_filter_free_output {
9542         uint16_t error_code;
9543         /*
9544          * Pass/Fail or error type Note: receiver to verify the in
9545          * parameters, and fail the call with an error when appropriate
9546          */
9547         uint16_t req_type;
9548         /* This field returns the type of original request. */
9549         uint16_t seq_id;
9550         /* This field provides original sequence number of the command. */
9551         uint16_t resp_len;
9552         /*
9553          * This field is the length of the response in bytes. The last
9554          * byte of the response is a valid flag that will read as '1'
9555          * when the command has been completely written to memory.
9556          */
9557         uint32_t unused_0;
9558         uint8_t unused_1;
9559         uint8_t unused_2;
9560         uint8_t unused_3;
9561         uint8_t valid;
9562         /*
9563          * This field is used in Output records to indicate that the
9564          * output is completely written to RAM. This field should be
9565          * read as '1' to indicate that the output has been completely
9566          * written. When writing a command completion or response to an
9567          * internal processor, the order of writes has to be such that
9568          * this field is written last.
9569          */
9570 } __attribute__((packed));
9571
9572 /* hwrm_cfa_l2_filter_cfg */
9573 /* Description: Change the configuration of an existing L2 filter */
9574 /* Input        (40 bytes) */
9575 struct hwrm_cfa_l2_filter_cfg_input {
9576         uint16_t req_type;
9577         /*
9578          * This value indicates what type of request this is. The format
9579          * for the rest of the command is determined by this field.
9580          */
9581         uint16_t cmpl_ring;
9582         /*
9583          * This value indicates the what completion ring the request
9584          * will be optionally completed on. If the value is -1, then no
9585          * CR completion will be generated. Any other value must be a
9586          * valid CR ring_id value for this function.
9587          */
9588         uint16_t seq_id;
9589         /* This value indicates the command sequence number. */
9590         uint16_t target_id;
9591         /*
9592          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9593          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9594          * - HWRM
9595          */
9596         uint64_t resp_addr;
9597         /*
9598          * This is the host address where the response will be written
9599          * when the request is complete. This area must be 16B aligned
9600          * and must be cleared to zero before the request is made.
9601          */
9602         uint32_t flags;
9603         /*
9604          * Enumeration denoting the RX, TX type of the resource. This
9605          * enumeration is used for resources that are similar for both
9606          * TX and RX paths of the chip.
9607          */
9608         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH UINT32_C(0x1)
9609         /* tx path */
9610         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_TX \
9611                 (UINT32_C(0x0) << 0)
9612         /* rx path */
9613         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_RX \
9614                 (UINT32_C(0x1) << 0)
9615         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_LAST \
9616                 CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_RX
9617         /*
9618          * Setting of this flag indicates drop action. If this flag is
9619          * not set, then it should be considered accept action.
9620          */
9621         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_DROP UINT32_C(0x2)
9622         uint32_t enables;
9623         /* This bit must be '1' for the dst_id field to be configured. */
9624         #define HWRM_CFA_L2_FILTER_CFG_INPUT_ENABLES_DST_ID     UINT32_C(0x1)
9625         /*
9626          * This bit must be '1' for the new_mirror_vnic_id field to be
9627          * configured.
9628          */
9629         #define HWRM_CFA_L2_FILTER_CFG_INPUT_ENABLES_NEW_MIRROR_VNIC_ID   \
9630                 UINT32_C(0x2)
9631         uint64_t l2_filter_id;
9632         /*
9633          * This value identifies a set of CFA data structures used for
9634          * an L2 context.
9635          */
9636         uint32_t dst_id;
9637         /*
9638          * If set, this value shall represent the Logical VNIC ID of the
9639          * destination VNIC for the RX path and network port id of the
9640          * destination port for the TX path.
9641          */
9642         uint32_t new_mirror_vnic_id;
9643         /* New Logical VNIC ID of the VNIC where traffic is mirrored. */
9644 } __attribute__((packed));
9645
9646 /* Output       (16 bytes) */
9647 struct hwrm_cfa_l2_filter_cfg_output {
9648         uint16_t error_code;
9649         /*
9650          * Pass/Fail or error type Note: receiver to verify the in
9651          * parameters, and fail the call with an error when appropriate
9652          */
9653         uint16_t req_type;
9654         /* This field returns the type of original request. */
9655         uint16_t seq_id;
9656         /* This field provides original sequence number of the command. */
9657         uint16_t resp_len;
9658         /*
9659          * This field is the length of the response in bytes. The last
9660          * byte of the response is a valid flag that will read as '1'
9661          * when the command has been completely written to memory.
9662          */
9663         uint32_t unused_0;
9664         uint8_t unused_1;
9665         uint8_t unused_2;
9666         uint8_t unused_3;
9667         uint8_t valid;
9668         /*
9669          * This field is used in Output records to indicate that the
9670          * output is completely written to RAM. This field should be
9671          * read as '1' to indicate that the output has been completely
9672          * written. When writing a command completion or response to an
9673          * internal processor, the order of writes has to be such that
9674          * this field is written last.
9675          */
9676 } __attribute__((packed));
9677
9678 /* hwrm_cfa_l2_set_rx_mask */
9679 /* Description: This command will set rx mask of the function. */
9680 /* Input        (56 bytes) */
9681 struct hwrm_cfa_l2_set_rx_mask_input {
9682         uint16_t req_type;
9683         /*
9684          * This value indicates what type of request this is. The format
9685          * for the rest of the command is determined by this field.
9686          */
9687         uint16_t cmpl_ring;
9688         /*
9689          * This value indicates the what completion ring the request
9690          * will be optionally completed on. If the value is -1, then no
9691          * CR completion will be generated. Any other value must be a
9692          * valid CR ring_id value for this function.
9693          */
9694         uint16_t seq_id;
9695         /* This value indicates the command sequence number. */
9696         uint16_t target_id;
9697         /*
9698          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9699          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9700          * - HWRM
9701          */
9702         uint64_t resp_addr;
9703         /*
9704          * This is the host address where the response will be written
9705          * when the request is complete. This area must be 16B aligned
9706          * and must be cleared to zero before the request is made.
9707          */
9708         uint32_t vnic_id;
9709         /* VNIC ID */
9710         uint32_t mask;
9711         /* Reserved for future use. */
9712         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_RESERVED     UINT32_C(0x1)
9713         /*
9714          * When this bit is '1', the function is requested to accept
9715          * multi-cast packets specified by the multicast addr table.
9716          */
9717         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST        UINT32_C(0x2)
9718         /*
9719          * When this bit is '1', the function is requested to accept all
9720          * multi-cast packets.
9721          */
9722         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST    UINT32_C(0x4)
9723         /*
9724          * When this bit is '1', the function is requested to accept
9725          * broadcast packets.
9726          */
9727         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST        UINT32_C(0x8)
9728         /*
9729          * When this bit is '1', the function is requested to be put in
9730          * the promiscuous mode. The HWRM should accept any function to
9731          * set up promiscuous mode. The HWRM shall follow the semantics
9732          * below for the promiscuous mode support. # When partitioning
9733          * is not enabled on a port     (i.e. single PF on the port), then
9734          * the PF shall be allowed to be in the promiscuous mode. When
9735          * the PF is in the promiscuous mode, then it shall receive all
9736          * host bound traffic on that port. # When partitioning is
9737          * enabled on a port    (i.e. multiple PFs per port) and a PF on
9738          * that port is in the promiscuous mode, then the PF receives
9739          * all traffic within that partition as identified by a unique
9740          * identifier for the PF        (e.g. S-Tag). If a unique outer VLAN
9741          * for the PF is specified, then the setting of promiscuous mode
9742          * on that PF shall result in the PF receiving all host bound
9743          * traffic with matching outer VLAN. # A VF shall can be set in
9744          * the promiscuous mode. In the promiscuous mode, the VF does
9745          * not receive any traffic unless a unique outer VLAN for the VF
9746          * is specified. If a unique outer VLAN for the VF is specified,
9747          * then the setting of promiscuous mode on that VF shall result
9748          * in the VF receiving all host bound traffic with the matching
9749          * outer VLAN. # The HWRM shall allow the setting of promiscuous
9750          * mode on a function independently from the promiscuous mode
9751          * settings on other functions.
9752          */
9753         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS UINT32_C(0x10)
9754         /*
9755          * If this flag is set, the corresponding RX filters shall be
9756          * set up to cover multicast/broadcast filters for the outermost
9757          * Layer 2 destination MAC address field.
9758          */
9759         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_OUTERMOST    UINT32_C(0x20)
9760         /*
9761          * If this flag is set, the corresponding RX filters shall be
9762          * set up to cover multicast/broadcast filters for the VLAN-
9763          * tagged packets that match the TPID and VID fields of VLAN
9764          * tags in the VLAN tag table specified in this command.
9765          */
9766         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLANONLY     UINT32_C(0x40)
9767         /*
9768          * If this flag is set, the corresponding RX filters shall be
9769          * set up to cover multicast/broadcast filters for non-VLAN
9770          * tagged packets and VLAN-tagged packets that match the TPID
9771          * and VID fields of VLAN tags in the VLAN tag table specified
9772          * in this command.
9773          */
9774         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN UINT32_C(0x80)
9775         /*
9776          * If this flag is set, the corresponding RX filters shall be
9777          * set up to cover multicast/broadcast filters for non-VLAN
9778          * tagged packets and VLAN-tagged packets matching any VLAN tag.
9779          * If this flag is set, then the HWRM shall ignore VLAN tags
9780          * specified in vlan_tag_tbl. If none of vlanonly, vlan_nonvlan,
9781          * and anyvlan_nonvlan flags is set, then the HWRM shall ignore
9782          * VLAN tags specified in vlan_tag_tbl. The HWRM client shall
9783          * set at most one flag out of vlanonly, vlan_nonvlan, and
9784          * anyvlan_nonvlan.
9785          */
9786         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN      \
9787                 UINT32_C(0x100)
9788         uint64_t mc_tbl_addr;
9789         /* This is the address for mcast address tbl. */
9790         uint32_t num_mc_entries;
9791         /*
9792          * This value indicates how many entries in mc_tbl are valid.
9793          * Each entry is 6 bytes.
9794          */
9795         uint32_t unused_0;
9796         uint64_t vlan_tag_tbl_addr;
9797         /*
9798          * This is the address for VLAN tag table. Each VLAN entry in
9799          * the table is 4 bytes of a VLAN tag including TPID, PCP, DEI,
9800          * and VID fields in network byte order.
9801          */
9802         uint32_t num_vlan_tags;
9803         /*
9804          * This value indicates how many entries in vlan_tag_tbl are
9805          * valid. Each entry is 4 bytes.
9806          */
9807         uint32_t unused_1;
9808 } __attribute__((packed));
9809
9810 /* Output       (16 bytes) */
9811 struct hwrm_cfa_l2_set_rx_mask_output {
9812         uint16_t error_code;
9813         /*
9814          * Pass/Fail or error type Note: receiver to verify the in
9815          * parameters, and fail the call with an error when appropriate
9816          */
9817         uint16_t req_type;
9818         /* This field returns the type of original request. */
9819         uint16_t seq_id;
9820         /* This field provides original sequence number of the command. */
9821         uint16_t resp_len;
9822         /*
9823          * This field is the length of the response in bytes. The last
9824          * byte of the response is a valid flag that will read as '1'
9825          * when the command has been completely written to memory.
9826          */
9827         uint32_t unused_0;
9828         uint8_t unused_1;
9829         uint8_t unused_2;
9830         uint8_t unused_3;
9831         uint8_t valid;
9832         /*
9833          * This field is used in Output records to indicate that the
9834          * output is completely written to RAM. This field should be
9835          * read as '1' to indicate that the output has been completely
9836          * written. When writing a command completion or response to an
9837          * internal processor, the order of writes has to be such that
9838          * this field is written last.
9839          */
9840 } __attribute__((packed));
9841
9842 /* Command specific Error Codes (8 bytes) */
9843 struct hwrm_cfa_l2_set_rx_mask_cmd_err {
9844         uint8_t code;
9845         /*
9846          * command specific error codes that goes to the cmd_err field
9847          * in Common HWRM Error Response.
9848          */
9849         /* Unknown error */
9850         #define HWRM_CFA_L2_SET_RX_MASK_CMD_ERR_CODE_UNKNOWN UINT32_C(0x0)
9851         /*
9852          * Unable to complete operation due to conflict
9853          * with Ntuple Filter
9854          */
9855         #define \
9856         HWRM_CFA_L2_SET_RX_MASK_CMD_ERR_CODE_NTUPLE_FILTER_CONFLICT_ERR \
9857         UINT32_C(0x1)
9858         uint8_t unused_0[7];
9859 } __attribute__((packed));
9860
9861 /* hwrm_cfa_vlan_antispoof_cfg */
9862 /* Description: Configures vlan anti-spoof filters for VF. */
9863 /* Input (32 bytes) */
9864 struct hwrm_cfa_vlan_antispoof_cfg_input {
9865         uint16_t req_type;
9866         /*
9867          * This value indicates what type of request this is. The format for the
9868          * rest of the command is determined by this field.
9869          */
9870         uint16_t cmpl_ring;
9871         /*
9872          * This value indicates the what completion ring the request will be
9873          * optionally completed on. If the value is -1, then no CR completion
9874          * will be generated. Any other value must be a valid CR ring_id value
9875          * for this function.
9876          */
9877         uint16_t seq_id;
9878         /* This value indicates the command sequence number. */
9879         uint16_t target_id;
9880         /*
9881          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
9882          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
9883          */
9884         uint64_t resp_addr;
9885         /*
9886          * This is the host address where the response will be written when the
9887          * request is complete. This area must be 16B aligned and must be
9888          * cleared to zero before the request is made.
9889          */
9890         uint16_t fid;
9891         /*
9892          * Function ID of the function that is being configured. Only valid for
9893          * a VF FID configured by the PF.
9894          */
9895         uint8_t unused_0;
9896         uint8_t unused_1;
9897         uint32_t num_vlan_entries;
9898         /* Number of VLAN entries in the vlan_tag_mask_tbl. */
9899         uint64_t vlan_tag_mask_tbl_addr;
9900         /*
9901          * The vlan_tag_mask_tbl_addr is the DMA address of the VLAN antispoof
9902          * table. Each table entry contains the 16-bit TPID (0x8100 or 0x88a8
9903          * only), 16-bit VLAN ID, and a 16-bit mask, all in network order to
9904          * match hwrm_cfa_l2_set_rx_mask. For an individual VLAN entry, the mask
9905          * value should be 0xfff for the 12-bit VLAN ID.
9906          */
9907 };
9908
9909 /* Output (16 bytes) */
9910 struct hwrm_cfa_vlan_antispoof_cfg_output {
9911         uint16_t error_code;
9912         /*
9913          * Pass/Fail or error type Note: receiver to verify the in parameters,
9914          * and fail the call with an error when appropriate
9915          */
9916         uint16_t req_type;
9917         /* This field returns the type of original request. */
9918         uint16_t seq_id;
9919         /* This field provides original sequence number of the command. */
9920         uint16_t resp_len;
9921         /*
9922          * This field is the length of the response in bytes. The last byte of
9923          * the response is a valid flag that will read as '1' when the command
9924          * has been completely written to memory.
9925          */
9926         uint32_t unused_0;
9927         uint8_t unused_1;
9928         uint8_t unused_2;
9929         uint8_t unused_3;
9930         uint8_t valid;
9931         /*
9932          * This field is used in Output records to indicate that the output is
9933          * completely written to RAM. This field should be read as '1' to
9934          * indicate that the output has been completely written. When writing a
9935          * command completion or response to an internal processor, the order of
9936          * writes has to be such that this field is written last.
9937          */
9938 };
9939
9940 /* hwrm_cfa_ntuple_filter_alloc */
9941 /*
9942  * Description: This is a ntuple filter that uses fields from L4/L3 header and
9943  * optionally fields from L2. The ntuple filters apply to receive traffic only.
9944  * All L2/L3/L4 header fields are specified in network byte order. These filters
9945  * can be used for Receive Flow Steering (RFS). # For ethertype value, only
9946  * 0x0800 (IPv4) and 0x86dd (IPv6) shall be supported for ntuple filters. # If a
9947  * field specified in this command is not enabled as a valid field, then that
9948  * field shall not be used in matching packet header fields against this filter.
9949  */
9950 /* Input        (128 bytes) */
9951 struct hwrm_cfa_ntuple_filter_alloc_input {
9952         uint16_t req_type;
9953         /*
9954          * This value indicates what type of request this is. The format
9955          * for the rest of the command is determined by this field.
9956          */
9957         uint16_t cmpl_ring;
9958         /*
9959          * This value indicates the what completion ring the request
9960          * will be optionally completed on. If the value is -1, then no
9961          * CR completion will be generated. Any other value must be a
9962          * valid CR ring_id value for this function.
9963          */
9964         uint16_t seq_id;
9965         /* This value indicates the command sequence number. */
9966         uint16_t target_id;
9967         /*
9968          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9969          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9970          * - HWRM
9971          */
9972         uint64_t resp_addr;
9973         /*
9974          * This is the host address where the response will be written
9975          * when the request is complete. This area must be 16B aligned
9976          * and must be cleared to zero before the request is made.
9977          */
9978         uint32_t flags;
9979         /*
9980          * Setting of this flag indicates the applicability to the
9981          * loopback path.
9982          */
9983         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_LOOPBACK       \
9984                 UINT32_C(0x1)
9985         /*
9986          * Setting of this flag indicates drop action. If this flag is
9987          * not set, then it should be considered accept action.
9988          */
9989         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_DROP   UINT32_C(0x2)
9990         /*
9991          * Setting of this flag indicates that a meter is expected to be
9992          * attached to this flow. This hint can be used when choosing
9993          * the action record format required for the flow.
9994          */
9995         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_METER UINT32_C(0x4)
9996         uint32_t enables;
9997         /* This bit must be '1' for the l2_filter_id field to be configured. */
9998         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_L2_FILTER_ID   \
9999                 UINT32_C(0x1)
10000         /* This bit must be '1' for the ethertype field to be configured. */
10001         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_ETHERTYPE     \
10002                 UINT32_C(0x2)
10003         /* This bit must be '1' for the tunnel_type field to be configured. */
10004         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_TUNNEL_TYPE  \
10005                 UINT32_C(0x4)
10006         /* This bit must be '1' for the src_macaddr field to be configured. */
10007         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_MACADDR  \
10008                 UINT32_C(0x8)
10009         /* This bit must be '1' for the ipaddr_type field to be configured. */
10010         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_IPADDR_TYPE  \
10011                 UINT32_C(0x10)
10012         /* This bit must be '1' for the src_ipaddr field to be configured. */
10013         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_IPADDR   \
10014                 UINT32_C(0x20)
10015         /*
10016          * This bit must be '1' for the src_ipaddr_mask field to be
10017          * configured.
10018          */
10019         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_IPADDR_MASK \
10020                 UINT32_C(0x40)
10021         /* This bit must be '1' for the dst_ipaddr field to be configured. */
10022         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_IPADDR   \
10023                 UINT32_C(0x80)
10024         /*
10025          * This bit must be '1' for the dst_ipaddr_mask field to be
10026          * configured.
10027          */
10028         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_IPADDR_MASK \
10029                 UINT32_C(0x100)
10030         /* This bit must be '1' for the ip_protocol field to be configured. */
10031         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_IP_PROTOCOL  \
10032                 UINT32_C(0x200)
10033         /* This bit must be '1' for the src_port field to be configured. */
10034         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_PORT     \
10035                 UINT32_C(0x400)
10036         /*
10037          * This bit must be '1' for the src_port_mask field to be
10038          * configured.
10039          */
10040         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_PORT_MASK  \
10041                 UINT32_C(0x800)
10042         /* This bit must be '1' for the dst_port field to be configured. */
10043         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_PORT     \
10044                 UINT32_C(0x1000)
10045         /*
10046          * This bit must be '1' for the dst_port_mask field to be
10047          * configured.
10048          */
10049         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_PORT_MASK  \
10050                 UINT32_C(0x2000)
10051         /* This bit must be '1' for the pri_hint field to be configured. */
10052         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_PRI_HINT     \
10053                 UINT32_C(0x4000)
10054         /*
10055          * This bit must be '1' for the ntuple_filter_id field to be
10056          * configured.
10057          */
10058         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_NTUPLE_FILTER_ID \
10059                 UINT32_C(0x8000)
10060         /* This bit must be '1' for the dst_id field to be configured. */
10061         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_ID       \
10062                 UINT32_C(0x10000)
10063         /*
10064          * This bit must be '1' for the mirror_vnic_id field to be
10065          * configured.
10066          */
10067         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID \
10068                 UINT32_C(0x20000)
10069         /* This bit must be '1' for the dst_macaddr field to be configured. */
10070         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_MACADDR  \
10071                 UINT32_C(0x40000)
10072         uint64_t l2_filter_id;
10073         /*
10074          * This value identifies a set of CFA data structures used for
10075          * an L2 context.
10076          */
10077         uint8_t src_macaddr[6];
10078         /*
10079          * This value indicates the source MAC address in the Ethernet
10080          * header.
10081          */
10082         uint16_t ethertype;
10083         /* This value indicates the ethertype in the Ethernet header. */
10084         uint8_t ip_addr_type;
10085         /*
10086          * This value indicates the type of IP address. 4 - IPv4 6 -
10087          * IPv6 All others are invalid.
10088          */
10089         /* invalid */
10090         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_ADDR_TYPE_UNKNOWN \
10091                 UINT32_C(0x0)
10092         /* IPv4 */
10093         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_ADDR_TYPE_IPV4 \
10094                 UINT32_C(0x4)
10095         /* IPv6 */
10096         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_ADDR_TYPE_IPV6 \
10097                 UINT32_C(0x6)
10098         uint8_t ip_protocol;
10099         /*
10100          * The value of protocol filed in IP header. Applies to UDP and
10101          * TCP traffic. 6 - TCP 17 - UDP
10102          */
10103         /* invalid */
10104         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_PROTOCOL_UNKNOWN \
10105                 UINT32_C(0x0)
10106         /* TCP */
10107         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_PROTOCOL_TCP \
10108                 UINT32_C(0x6)
10109         /* UDP */
10110         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_IP_PROTOCOL_UDP \
10111                 UINT32_C(0x11)
10112         uint16_t dst_id;
10113         /*
10114          * If set, this value shall represent the Logical VNIC ID of the
10115          * destination VNIC for the RX path and network port id of the
10116          * destination port for the TX path.
10117          */
10118         uint16_t mirror_vnic_id;
10119         /* Logical VNIC ID of the VNIC where traffic is mirrored. */
10120         uint8_t tunnel_type;
10121         /*
10122          * This value indicates the tunnel type for this filter. If this
10123          * field is not specified, then the filter shall apply to both
10124          * non-tunneled and tunneled packets. If this field conflicts
10125          * with the tunnel_type specified in the l2_filter_id, then the
10126          * HWRM shall return an error for this command.
10127          */
10128         /* Non-tunnel */
10129         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NONTUNNEL \
10130                 UINT32_C(0x0)
10131         /* Virtual eXtensible Local Area Network        (VXLAN) */
10132         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_VXLAN \
10133                 UINT32_C(0x1)
10134         /*
10135          * Network Virtualization Generic Routing
10136          * Encapsulation        (NVGRE)
10137          */
10138         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NVGRE \
10139                 UINT32_C(0x2)
10140         /*
10141          * Generic Routing Encapsulation        (GRE) inside
10142          * Ethernet payload
10143          */
10144         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_L2GRE \
10145                 UINT32_C(0x3)
10146         /* IP in IP */
10147         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPIP \
10148                 UINT32_C(0x4)
10149         /* Generic Network Virtualization Encapsulation (Geneve) */
10150         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_GENEVE \
10151                 UINT32_C(0x5)
10152         /* Multi-Protocol Lable Switching       (MPLS) */
10153         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_MPLS \
10154                 UINT32_C(0x6)
10155         /* Stateless Transport Tunnel   (STT) */
10156         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_STT UINT32_C(0x7)
10157         /*
10158          * Generic Routing Encapsulation        (GRE) inside IP
10159          * datagram payload
10160          */
10161         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPGRE \
10162                 UINT32_C(0x8)
10163         /* Any tunneled traffic */
10164         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_TUNNEL_TYPE_ANYTUNNEL \
10165                 UINT32_C(0xff)
10166         uint8_t pri_hint;
10167         /*
10168          * This hint is provided to help in placing the filter in the
10169          * filter table.
10170          */
10171         /* No preference */
10172         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_PRI_HINT_NO_PREFER \
10173                 UINT32_C(0x0)
10174         /* Above the given filter */
10175         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_PRI_HINT_ABOVE UINT32_C(0x1)
10176         /* Below the given filter */
10177         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_PRI_HINT_BELOW UINT32_C(0x2)
10178         /* As high as possible */
10179         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_PRI_HINT_HIGHEST \
10180                 UINT32_C(0x3)
10181         /* As low as possible */
10182         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_PRI_HINT_LOWEST UINT32_C(0x4)
10183         uint32_t src_ipaddr[4];
10184         /*
10185          * The value of source IP address to be used in filtering. For
10186          * IPv4, first four bytes represent the IP address.
10187          */
10188         uint32_t src_ipaddr_mask[4];
10189         /*
10190          * The value of source IP address mask to be used in filtering.
10191          * For IPv4, first four bytes represent the IP address mask.
10192          */
10193         uint32_t dst_ipaddr[4];
10194         /*
10195          * The value of destination IP address to be used in filtering.
10196          * For IPv4, first four bytes represent the IP address.
10197          */
10198         uint32_t dst_ipaddr_mask[4];
10199         /*
10200          * The value of destination IP address mask to be used in
10201          * filtering. For IPv4, first four bytes represent the IP
10202          * address mask.
10203          */
10204         uint16_t src_port;
10205         /*
10206          * The value of source port to be used in filtering. Applies to
10207          * UDP and TCP traffic.
10208          */
10209         uint16_t src_port_mask;
10210         /*
10211          * The value of source port mask to be used in filtering.
10212          * Applies to UDP and TCP traffic.
10213          */
10214         uint16_t dst_port;
10215         /*
10216          * The value of destination port to be used in filtering.
10217          * Applies to UDP and TCP traffic.
10218          */
10219         uint16_t dst_port_mask;
10220         /*
10221          * The value of destination port mask to be used in filtering.
10222          * Applies to UDP and TCP traffic.
10223          */
10224         uint64_t ntuple_filter_id_hint;
10225         /* This is the ID of the filter that goes along with the pri_hint. */
10226 } __attribute__((packed));
10227
10228 /* Output       (24 bytes) */
10229 struct hwrm_cfa_ntuple_filter_alloc_output {
10230         uint16_t error_code;
10231         /*
10232          * Pass/Fail or error type Note: receiver to verify the in
10233          * parameters, and fail the call with an error when appropriate
10234          */
10235         uint16_t req_type;
10236         /* This field returns the type of original request. */
10237         uint16_t seq_id;
10238         /* This field provides original sequence number of the command. */
10239         uint16_t resp_len;
10240         /*
10241          * This field is the length of the response in bytes. The last
10242          * byte of the response is a valid flag that will read as '1'
10243          * when the command has been completely written to memory.
10244          */
10245         uint64_t ntuple_filter_id;
10246         /* This value is an opaque id into CFA data structures. */
10247         uint32_t flow_id;
10248         /*
10249          * This is the ID of the flow associated with this filter. This
10250          * value shall be used to match and associate the flow
10251          * identifier returned in completion records. A value of
10252          * 0xFFFFFFFF shall indicate no flow id.
10253          */
10254         uint8_t unused_0;
10255         uint8_t unused_1;
10256         uint8_t unused_2;
10257         uint8_t valid;
10258         /*
10259          * This field is used in Output records to indicate that the
10260          * output is completely written to RAM. This field should be
10261          * read as '1' to indicate that the output has been completely
10262          * written. When writing a command completion or response to an
10263          * internal processor, the order of writes has to be such that
10264          * this field is written last.
10265          */
10266 } __attribute__((packed));
10267
10268 /* Command specific Error Codes (8 bytes) */
10269 struct hwrm_cfa_ntuple_filter_alloc_cmd_err {
10270         uint8_t code;
10271         /*
10272          * command specific error codes that goes to the cmd_err field
10273          * in Common HWRM Error Response.
10274          */
10275         /* Unknown error */
10276         #define HWRM_CFA_NTUPLE_FILTER_ALLOC_CMD_ERR_CODE_UNKNOWN UINT32_C(0x0)
10277         /*
10278          * Unable to complete operation due to conflict
10279          * with Rx Mask VLAN
10280          */
10281         #define \
10282         HWRM_CFA_NTUPLE_FILTER_ALLOC_CMD_ERR_CODE_RX_MASK_VLAN_CONFLICT_ERR \
10283         UINT32_C(0x1)
10284         uint8_t unused_0[7];
10285 } __attribute__((packed));
10286
10287 /* hwrm_cfa_ntuple_filter_free */
10288 /* Description: Free an ntuple filter */
10289 /* Input        (24 bytes) */
10290 struct hwrm_cfa_ntuple_filter_free_input {
10291         uint16_t req_type;
10292         /*
10293          * This value indicates what type of request this is. The format
10294          * for the rest of the command is determined by this field.
10295          */
10296         uint16_t cmpl_ring;
10297         /*
10298          * This value indicates the what completion ring the request
10299          * will be optionally completed on. If the value is -1, then no
10300          * CR completion will be generated. Any other value must be a
10301          * valid CR ring_id value for this function.
10302          */
10303         uint16_t seq_id;
10304         /* This value indicates the command sequence number. */
10305         uint16_t target_id;
10306         /*
10307          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10308          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10309          * - HWRM
10310          */
10311         uint64_t resp_addr;
10312         /*
10313          * This is the host address where the response will be written
10314          * when the request is complete. This area must be 16B aligned
10315          * and must be cleared to zero before the request is made.
10316          */
10317         uint64_t ntuple_filter_id;
10318         /* This value is an opaque id into CFA data structures. */
10319 } __attribute__((packed));
10320
10321 /* Output       (16 bytes) */
10322 struct hwrm_cfa_ntuple_filter_free_output {
10323         uint16_t error_code;
10324         /*
10325          * Pass/Fail or error type Note: receiver to verify the in
10326          * parameters, and fail the call with an error when appropriate
10327          */
10328         uint16_t req_type;
10329         /* This field returns the type of original request. */
10330         uint16_t seq_id;
10331         /* This field provides original sequence number of the command. */
10332         uint16_t resp_len;
10333         /*
10334          * This field is the length of the response in bytes. The last
10335          * byte of the response is a valid flag that will read as '1'
10336          * when the command has been completely written to memory.
10337          */
10338         uint32_t unused_0;
10339         uint8_t unused_1;
10340         uint8_t unused_2;
10341         uint8_t unused_3;
10342         uint8_t valid;
10343         /*
10344          * This field is used in Output records to indicate that the
10345          * output is completely written to RAM. This field should be
10346          * read as '1' to indicate that the output has been completely
10347          * written. When writing a command completion or response to an
10348          * internal processor, the order of writes has to be such that
10349          * this field is written last.
10350          */
10351 } __attribute__((packed));
10352
10353 /* hwrm_cfa_ntuple_filter_cfg */
10354 /*
10355  * Description: Configure an ntuple filter with a new destination VNIC and/or
10356  * meter.
10357  */
10358 /* Input        (48 bytes) */
10359 struct hwrm_cfa_ntuple_filter_cfg_input {
10360         uint16_t req_type;
10361         /*
10362          * This value indicates what type of request this is. The format
10363          * for the rest of the command is determined by this field.
10364          */
10365         uint16_t cmpl_ring;
10366         /*
10367          * This value indicates the what completion ring the request
10368          * will be optionally completed on. If the value is -1, then no
10369          * CR completion will be generated. Any other value must be a
10370          * valid CR ring_id value for this function.
10371          */
10372         uint16_t seq_id;
10373         /* This value indicates the command sequence number. */
10374         uint16_t target_id;
10375         /*
10376          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10377          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10378          * - HWRM
10379          */
10380         uint64_t resp_addr;
10381         /*
10382          * This is the host address where the response will be written
10383          * when the request is complete. This area must be 16B aligned
10384          * and must be cleared to zero before the request is made.
10385          */
10386         uint32_t enables;
10387         /* This bit must be '1' for the new_dst_id field to be configured. */
10388         #define HWRM_CFA_NTUPLE_FILTER_CFG_INPUT_ENABLES_NEW_DST_ID     \
10389                 UINT32_C(0x1)
10390         /*
10391          * This bit must be '1' for the new_mirror_vnic_id field to be
10392          * configured.
10393          */
10394         #define HWRM_CFA_NTUPLE_FILTER_CFG_INPUT_ENABLES_NEW_MIRROR_VNIC_ID \
10395                 UINT32_C(0x2)
10396         /*
10397          * This bit must be '1' for the new_meter_instance_id field to
10398          * be configured.
10399          */
10400         #define HWRM_CFA_NTUPLE_FILTER_CFG_INPUT_ENABLES_NEW_METER_INSTANCE_ID \
10401                 UINT32_C(0x4)
10402         uint32_t unused_0;
10403         uint64_t ntuple_filter_id;
10404         /* This value is an opaque id into CFA data structures. */
10405         uint32_t new_dst_id;
10406         /*
10407          * If set, this value shall represent the new Logical VNIC ID of
10408          * the destination VNIC for the RX path and new network port id
10409          * of the destination port for the TX path.
10410          */
10411         uint32_t new_mirror_vnic_id;
10412         /* New Logical VNIC ID of the VNIC where traffic is mirrored. */
10413         uint16_t new_meter_instance_id;
10414         /*
10415          * New meter to attach to the flow. Specifying the invalid
10416          * instance ID is used to remove any existing meter from the
10417          * flow.
10418          */
10419         /*
10420          * A value of 0xfff is considered invalid and
10421          * implies the instance is not configured.
10422          */
10423         #define HWRM_CFA_NTUPLE_FILTER_CFG_INPUT_NEW_METER_INSTANCE_ID_INVALID \
10424                 UINT32_C(0xffff)
10425         uint16_t unused_1[3];
10426 } __attribute__((packed));
10427
10428 /* Output       (16 bytes) */
10429 struct hwrm_cfa_ntuple_filter_cfg_output {
10430         uint16_t error_code;
10431         /*
10432          * Pass/Fail or error type Note: receiver to verify the in
10433          * parameters, and fail the call with an error when appropriate
10434          */
10435         uint16_t req_type;
10436         /* This field returns the type of original request. */
10437         uint16_t seq_id;
10438         /* This field provides original sequence number of the command. */
10439         uint16_t resp_len;
10440         /*
10441          * This field is the length of the response in bytes. The last
10442          * byte of the response is a valid flag that will read as '1'
10443          * when the command has been completely written to memory.
10444          */
10445         uint32_t unused_0;
10446         uint8_t unused_1;
10447         uint8_t unused_2;
10448         uint8_t unused_3;
10449         uint8_t valid;
10450         /*
10451          * This field is used in Output records to indicate that the
10452          * output is completely written to RAM. This field should be
10453          * read as '1' to indicate that the output has been completely
10454          * written. When writing a command completion or response to an
10455          * internal processor, the order of writes has to be such that
10456          * this field is written last.
10457          */
10458 } __attribute__((packed));
10459
10460 /* hwrm_cfa_em_flow_alloc */
10461 /*
10462  * Description: This is a generic Exact Match   (EM) flow that uses fields from
10463  * L4/L3/L2 headers. The EM flows apply to transmit and receive traffic. All
10464  * L2/L3/L4 header fields are specified in network byte order. For each EM flow,
10465  * there is an associated set of actions specified. For tunneled packets, all
10466  * L2/L3/L4 fields specified are fields of inner headers unless otherwise
10467  * specified. # If a field specified in this command is not enabled as a valid
10468  * field, then that field shall not be used in matching packet header fields
10469  * against this EM flow entry.
10470  */
10471 /* Input        (112 bytes) */
10472 struct hwrm_cfa_em_flow_alloc_input {
10473         uint16_t req_type;
10474         /*
10475          * This value indicates what type of request this is. The format
10476          * for the rest of the command is determined by this field.
10477          */
10478         uint16_t cmpl_ring;
10479         /*
10480          * This value indicates the what completion ring the request
10481          * will be optionally completed on. If the value is -1, then no
10482          * CR completion will be generated. Any other value must be a
10483          * valid CR ring_id value for this function.
10484          */
10485         uint16_t seq_id;
10486         /* This value indicates the command sequence number. */
10487         uint16_t target_id;
10488         /*
10489          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10490          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10491          * - HWRM
10492          */
10493         uint64_t resp_addr;
10494         /*
10495          * This is the host address where the response will be written
10496          * when the request is complete. This area must be 16B aligned
10497          * and must be cleared to zero before the request is made.
10498          */
10499         uint32_t flags;
10500         /*
10501          * Enumeration denoting the RX, TX type of the resource. This
10502          * enumeration is used for resources that are similar for both
10503          * TX and RX paths of the chip.
10504          */
10505         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_PATH UINT32_C(0x1)
10506         /* tx path */
10507         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_PATH_TX      \
10508                 (UINT32_C(0x0) << 0)
10509         /* rx path */
10510         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_PATH_RX      \
10511                 (UINT32_C(0x1) << 0)
10512         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_PATH_LAST \
10513                 CFA_EM_FLOW_ALLOC_INPUT_FLAGS_PATH_RX
10514         /*
10515          * Setting of this flag indicates enabling of a byte counter for
10516          * a given flow.
10517          */
10518         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_BYTE_CTR     UINT32_C(0x2)
10519         /*
10520          * Setting of this flag indicates enabling of a packet counter
10521          * for a given flow.
10522          */
10523         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_PKT_CTR      UINT32_C(0x4)
10524         /*
10525          * Setting of this flag indicates de-capsulation action for the
10526          * given flow.
10527          */
10528         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_DECAP        UINT32_C(0x8)
10529         /*
10530          * Setting of this flag indicates encapsulation action for the
10531          * given flow.
10532          */
10533         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_ENCAP        UINT32_C(0x10)
10534         /*
10535          * Setting of this flag indicates drop action. If this flag is
10536          * not set, then it should be considered accept action.
10537          */
10538         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_DROP UINT32_C(0x20)
10539         /*
10540          * Setting of this flag indicates that a meter is expected to be
10541          * attached to this flow. This hint can be used when choosing
10542          * the action record format required for the flow.
10543          */
10544         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_FLAGS_METER        UINT32_C(0x40)
10545         uint32_t enables;
10546         /* This bit must be '1' for the l2_filter_id field to be configured. */
10547         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_L2_FILTER_ID UINT32_C(0x1)
10548         /* This bit must be '1' for the tunnel_type field to be configured. */
10549         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_TUNNEL_TYPE UINT32_C(0x2)
10550         /* This bit must be '1' for the tunnel_id field to be configured. */
10551         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_TUNNEL_ID UINT32_C(0x4)
10552         /* This bit must be '1' for the src_macaddr field to be configured. */
10553         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_SRC_MACADDR UINT32_C(0x8)
10554         /* This bit must be '1' for the dst_macaddr field to be configured. */
10555         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_DST_MACADDR UINT32_C(0x10)
10556         /* This bit must be '1' for the ovlan_vid field to be configured. */
10557         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_OVLAN_VID UINT32_C(0x20)
10558         /* This bit must be '1' for the ivlan_vid field to be configured. */
10559         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_IVLAN_VID UINT32_C(0x40)
10560         /* This bit must be '1' for the ethertype field to be configured. */
10561         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_ETHERTYPE UINT32_C(0x80)
10562         /* This bit must be '1' for the src_ipaddr field to be configured. */
10563         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_SRC_IPADDR UINT32_C(0x100)
10564         /* This bit must be '1' for the dst_ipaddr field to be configured. */
10565         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_DST_IPADDR UINT32_C(0x200)
10566         /* This bit must be '1' for the ipaddr_type field to be configured. */
10567         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_IPADDR_TYPE UINT32_C(0x400)
10568         /* This bit must be '1' for the ip_protocol field to be configured. */
10569         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_IP_PROTOCOL UINT32_C(0x800)
10570         /* This bit must be '1' for the src_port field to be configured. */
10571         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_SRC_PORT UINT32_C(0x1000)
10572         /* This bit must be '1' for the dst_port field to be configured. */
10573         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_DST_PORT UINT32_C(0x2000)
10574         /* This bit must be '1' for the dst_id field to be configured. */
10575         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_DST_ID     UINT32_C(0x4000)
10576         /*
10577          * This bit must be '1' for the mirror_vnic_id field to be
10578          * configured.
10579          */
10580         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID     \
10581                 UINT32_C(0x8000)
10582         /*
10583          * This bit must be '1' for the encap_record_id field to be
10584          * configured.
10585          */
10586         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_ENCAP_RECORD_ID     \
10587                 UINT32_C(0x10000)
10588         /*
10589          * This bit must be '1' for the meter_instance_id field to be
10590          * configured.
10591          */
10592         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_METER_INSTANCE_ID  \
10593                 UINT32_C(0x20000)
10594         uint64_t l2_filter_id;
10595         /*
10596          * This value identifies a set of CFA data structures used for
10597          * an L2 context.
10598          */
10599         uint8_t tunnel_type;
10600         /* Tunnel Type. */
10601         /* Non-tunnel */
10602         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_NONTUNNEL \
10603                 UINT32_C(0x0)
10604         /* Virtual eXtensible Local Area Network        (VXLAN) */
10605         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_VXLAN  UINT32_C(0x1)
10606         /*
10607          * Network Virtualization Generic Routing
10608          * Encapsulation        (NVGRE)
10609          */
10610         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_NVGRE  UINT32_C(0x2)
10611         /*
10612          * Generic Routing Encapsulation        (GRE) inside
10613          * Ethernet payload
10614          */
10615         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_L2GRE  UINT32_C(0x3)
10616         /* IP in IP */
10617         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_IPIP   UINT32_C(0x4)
10618         /* Generic Network Virtualization Encapsulation (Geneve) */
10619         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_GENEVE UINT32_C(0x5)
10620         /* Multi-Protocol Lable Switching       (MPLS) */
10621         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_MPLS   UINT32_C(0x6)
10622         /* Stateless Transport Tunnel   (STT) */
10623         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_STT    UINT32_C(0x7)
10624         /*
10625          * Generic Routing Encapsulation        (GRE) inside IP
10626          * datagram payload
10627          */
10628         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_IPGRE  UINT32_C(0x8)
10629         /*
10630          * IPV4 over virtual eXtensible Local Area
10631          * Network (IPV4oVXLAN)
10632          */
10633         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_VXLAN_V4 UINT32_C(0x9)
10634         /* Any tunneled traffic */
10635         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_TUNNEL_TYPE_ANYTUNNEL \
10636                 UINT32_C(0xff)
10637         uint8_t unused_0;
10638         uint16_t unused_1;
10639         uint32_t tunnel_id;
10640         /*
10641          * Tunnel identifier. Virtual Network Identifier        (VNI). Only
10642          * valid with tunnel_types VXLAN, NVGRE, and Geneve. Only lower
10643          * 24-bits of VNI field are used in setting up the filter.
10644          */
10645         uint8_t src_macaddr[6];
10646         /*
10647          * This value indicates the source MAC address in the Ethernet
10648          * header.
10649          */
10650         uint16_t meter_instance_id;
10651         /* The meter instance to attach to the flow. */
10652         /*
10653          * A value of 0xfff is considered invalid and
10654          * implies the instance is not configured.
10655          */
10656         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_METER_INSTANCE_ID_INVALID   \
10657                 UINT32_C(0xffff)
10658         uint8_t dst_macaddr[6];
10659         /*
10660          * This value indicates the destination MAC address in the
10661          * Ethernet header.
10662          */
10663         uint16_t ovlan_vid;
10664         /*
10665          * This value indicates the VLAN ID of the outer VLAN tag in the
10666          * Ethernet header.
10667          */
10668         uint16_t ivlan_vid;
10669         /*
10670          * This value indicates the VLAN ID of the inner VLAN tag in the
10671          * Ethernet header.
10672          */
10673         uint16_t ethertype;
10674         /* This value indicates the ethertype in the Ethernet header. */
10675         uint8_t ip_addr_type;
10676         /*
10677          * This value indicates the type of IP address. 4 - IPv4 6 -
10678          * IPv6 All others are invalid.
10679          */
10680         /* invalid */
10681         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_IP_ADDR_TYPE_UNKNOWN UINT32_C(0x0)
10682         /* IPv4 */
10683         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_IP_ADDR_TYPE_IPV4  UINT32_C(0x4)
10684         /* IPv6 */
10685         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_IP_ADDR_TYPE_IPV6  UINT32_C(0x6)
10686         uint8_t ip_protocol;
10687         /*
10688          * The value of protocol filed in IP header. Applies to UDP and
10689          * TCP traffic. 6 - TCP 17 - UDP
10690          */
10691         /* invalid */
10692         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_IP_PROTOCOL_UNKNOWN UINT32_C(0x0)
10693         /* TCP */
10694         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_IP_PROTOCOL_TCP UINT32_C(0x6)
10695         /* UDP */
10696         #define HWRM_CFA_EM_FLOW_ALLOC_INPUT_IP_PROTOCOL_UDP UINT32_C(0x11)
10697         uint8_t unused_2;
10698         uint8_t unused_3;
10699         uint32_t src_ipaddr[4];
10700         /*
10701          * The value of source IP address to be used in filtering. For
10702          * IPv4, first four bytes represent the IP address.
10703          */
10704         uint32_t dst_ipaddr[4];
10705         /*
10706          * big_endian = True The value of destination IP address to be
10707          * used in filtering. For IPv4, first four bytes represent the
10708          * IP address.
10709          */
10710         uint16_t src_port;
10711         /*
10712          * The value of source port to be used in filtering. Applies to
10713          * UDP and TCP traffic.
10714          */
10715         uint16_t dst_port;
10716         /*
10717          * The value of destination port to be used in filtering.
10718          * Applies to UDP and TCP traffic.
10719          */
10720         uint16_t dst_id;
10721         /*
10722          * If set, this value shall represent the Logical VNIC ID of the
10723          * destination VNIC for the RX path and network port id of the
10724          * destination port for the TX path.
10725          */
10726         uint16_t mirror_vnic_id;
10727         /* Logical VNIC ID of the VNIC where traffic is mirrored. */
10728         uint32_t encap_record_id;
10729         /* Logical ID of the encapsulation record. */
10730         uint32_t unused_4;
10731 } __attribute__((packed));
10732
10733 /* Output       (24 bytes) */
10734 struct hwrm_cfa_em_flow_alloc_output {
10735         uint16_t error_code;
10736         /*
10737          * Pass/Fail or error type Note: receiver to verify the in
10738          * parameters, and fail the call with an error when appropriate
10739          */
10740         uint16_t req_type;
10741         /* This field returns the type of original request. */
10742         uint16_t seq_id;
10743         /* This field provides original sequence number of the command. */
10744         uint16_t resp_len;
10745         /*
10746          * This field is the length of the response in bytes. The last
10747          * byte of the response is a valid flag that will read as '1'
10748          * when the command has been completely written to memory.
10749          */
10750         uint64_t em_filter_id;
10751         /* This value is an opaque id into CFA data structures. */
10752         uint32_t flow_id;
10753         /*
10754          * This is the ID of the flow associated with this filter. This
10755          * value shall be used to match and associate the flow
10756          * identifier returned in completion records. A value of
10757          * 0xFFFFFFFF shall indicate no flow id.
10758          */
10759         uint8_t unused_0;
10760         uint8_t unused_1;
10761         uint8_t unused_2;
10762         uint8_t valid;
10763         /*
10764          * This field is used in Output records to indicate that the
10765          * output is completely written to RAM. This field should be
10766          * read as '1' to indicate that the output has been completely
10767          * written. When writing a command completion or response to an
10768          * internal processor, the order of writes has to be such that
10769          * this field is written last.
10770          */
10771 } __attribute__((packed));
10772
10773 /* hwrm_cfa_em_flow_free */
10774 /* Description: Free an EM flow table entry */
10775 /* Input        (24 bytes) */
10776 struct hwrm_cfa_em_flow_free_input {
10777         uint16_t req_type;
10778         /*
10779          * This value indicates what type of request this is. The format
10780          * for the rest of the command is determined by this field.
10781          */
10782         uint16_t cmpl_ring;
10783         /*
10784          * This value indicates the what completion ring the request
10785          * will be optionally completed on. If the value is -1, then no
10786          * CR completion will be generated. Any other value must be a
10787          * valid CR ring_id value for this function.
10788          */
10789         uint16_t seq_id;
10790         /* This value indicates the command sequence number. */
10791         uint16_t target_id;
10792         /*
10793          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10794          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10795          * - HWRM
10796          */
10797         uint64_t resp_addr;
10798         /*
10799          * This is the host address where the response will be written
10800          * when the request is complete. This area must be 16B aligned
10801          * and must be cleared to zero before the request is made.
10802          */
10803         uint64_t em_filter_id;
10804         /* This value is an opaque id into CFA data structures. */
10805 } __attribute__((packed));
10806
10807 /* Output       (16 bytes) */
10808 struct hwrm_cfa_em_flow_free_output {
10809         uint16_t error_code;
10810         /*
10811          * Pass/Fail or error type Note: receiver to verify the in
10812          * parameters, and fail the call with an error when appropriate
10813          */
10814         uint16_t req_type;
10815         /* This field returns the type of original request. */
10816         uint16_t seq_id;
10817         /* This field provides original sequence number of the command. */
10818         uint16_t resp_len;
10819         /*
10820          * This field is the length of the response in bytes. The last
10821          * byte of the response is a valid flag that will read as '1'
10822          * when the command has been completely written to memory.
10823          */
10824         uint32_t unused_0;
10825         uint8_t unused_1;
10826         uint8_t unused_2;
10827         uint8_t unused_3;
10828         uint8_t valid;
10829         /*
10830          * This field is used in Output records to indicate that the
10831          * output is completely written to RAM. This field should be
10832          * read as '1' to indicate that the output has been completely
10833          * written. When writing a command completion or response to an
10834          * internal processor, the order of writes has to be such that
10835          * this field is written last.
10836          */
10837 } __attribute__((packed));
10838
10839 /* hwrm_cfa_em_flow_cfg */
10840 /*
10841  * Description: Configure an EM flow with a new destination VNIC and/or meter.
10842  */
10843 /* Input        (48 bytes) */
10844 struct hwrm_cfa_em_flow_cfg_input {
10845         uint16_t req_type;
10846         /*
10847          * This value indicates what type of request this is. The format
10848          * for the rest of the command is determined by this field.
10849          */
10850         uint16_t cmpl_ring;
10851         /*
10852          * This value indicates the what completion ring the request
10853          * will be optionally completed on. If the value is -1, then no
10854          * CR completion will be generated. Any other value must be a
10855          * valid CR ring_id value for this function.
10856          */
10857         uint16_t seq_id;
10858         /* This value indicates the command sequence number. */
10859         uint16_t target_id;
10860         /*
10861          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10862          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10863          * - HWRM
10864          */
10865         uint64_t resp_addr;
10866         /*
10867          * This is the host address where the response will be written
10868          * when the request is complete. This area must be 16B aligned
10869          * and must be cleared to zero before the request is made.
10870          */
10871         uint32_t enables;
10872         /* This bit must be '1' for the new_dst_id field to be configured. */
10873         #define HWRM_CFA_EM_FLOW_CFG_INPUT_ENABLES_NEW_DST_ID   UINT32_C(0x1)
10874         /*
10875          * This bit must be '1' for the new_mirror_vnic_id field to be
10876          * configured.
10877          */
10878         #define HWRM_CFA_EM_FLOW_CFG_INPUT_ENABLES_NEW_MIRROR_VNIC_ID   \
10879                 UINT32_C(0x2)
10880         /*
10881          * This bit must be '1' for the new_meter_instance_id field to
10882          * be configured.
10883          */
10884         #define HWRM_CFA_EM_FLOW_CFG_INPUT_ENABLES_NEW_METER_INSTANCE_ID  \
10885                 UINT32_C(0x4)
10886         uint32_t unused_0;
10887         uint64_t em_filter_id;
10888         /* This value is an opaque id into CFA data structures. */
10889         uint32_t new_dst_id;
10890         /*
10891          * If set, this value shall represent the new Logical VNIC ID of
10892          * the destination VNIC for the RX path and network port id of
10893          * the destination port for the TX path.
10894          */
10895         uint32_t new_mirror_vnic_id;
10896         /* New Logical VNIC ID of the VNIC where traffic is mirrored. */
10897         uint16_t new_meter_instance_id;
10898         /*
10899          * New meter to attach to the flow. Specifying the invalid
10900          * instance ID is used to remove any existing meter from the
10901          * flow.
10902          */
10903         /*
10904          * A value of 0xfff is considered invalid and
10905          * implies the instance is not configured.
10906          */
10907         #define HWRM_CFA_EM_FLOW_CFG_INPUT_NEW_METER_INSTANCE_ID_INVALID \
10908                 UINT32_C(0xffff)
10909         uint16_t unused_1[3];
10910 } __attribute__((packed));
10911
10912 /* Output       (16 bytes) */
10913 struct hwrm_cfa_em_flow_cfg_output {
10914         uint16_t error_code;
10915         /*
10916          * Pass/Fail or error type Note: receiver to verify the in
10917          * parameters, and fail the call with an error when appropriate
10918          */
10919         uint16_t req_type;
10920         /* This field returns the type of original request. */
10921         uint16_t seq_id;
10922         /* This field provides original sequence number of the command. */
10923         uint16_t resp_len;
10924         /*
10925          * This field is the length of the response in bytes. The last
10926          * byte of the response is a valid flag that will read as '1'
10927          * when the command has been completely written to memory.
10928          */
10929         uint32_t unused_0;
10930         uint8_t unused_1;
10931         uint8_t unused_2;
10932         uint8_t unused_3;
10933         uint8_t valid;
10934         /*
10935          * This field is used in Output records to indicate that the
10936          * output is completely written to RAM. This field should be
10937          * read as '1' to indicate that the output has been completely
10938          * written. When writing a command completion or response to an
10939          * internal processor, the order of writes has to be such that
10940          * this field is written last.
10941          */
10942 } __attribute__((packed));
10943
10944 /* hwrm_tunnel_dst_port_query */
10945 /*
10946  * Description: This function is called by a driver to query tunnel type
10947  * specific destination port configuration.
10948  */
10949 /* Input        (24 bytes) */
10950 struct hwrm_tunnel_dst_port_query_input {
10951         uint16_t req_type;
10952         /*
10953          * This value indicates what type of request this is. The format
10954          * for the rest of the command is determined by this field.
10955          */
10956         uint16_t cmpl_ring;
10957         /*
10958          * This value indicates the what completion ring the request
10959          * will be optionally completed on. If the value is -1, then no
10960          * CR completion will be generated. Any other value must be a
10961          * valid CR ring_id value for this function.
10962          */
10963         uint16_t seq_id;
10964         /* This value indicates the command sequence number. */
10965         uint16_t target_id;
10966         /*
10967          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10968          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10969          * - HWRM
10970          */
10971         uint64_t resp_addr;
10972         /*
10973          * This is the host address where the response will be written
10974          * when the request is complete. This area must be 16B aligned
10975          * and must be cleared to zero before the request is made.
10976          */
10977         uint8_t tunnel_type;
10978         /* Tunnel Type. */
10979         /* Virtual eXtensible Local Area Network        (VXLAN) */
10980         #define HWRM_TUNNEL_DST_PORT_QUERY_INPUT_TUNNEL_TYPE_VXLAN \
10981                 UINT32_C(0x1)
10982         /* Generic Network Virtualization Encapsulation (Geneve) */
10983         #define HWRM_TUNNEL_DST_PORT_QUERY_INPUT_TUNNEL_TYPE_GENEVE \
10984                 UINT32_C(0x5)
10985         /*
10986          * IPV4 over virtual eXtensible Local Area
10987          * Network (IPV4oVXLAN)
10988          */
10989         #define HWRM_TUNNEL_DST_PORT_QUERY_INPUT_TUNNEL_TYPE_VXLAN_V4 \
10990                 UINT32_C(0x9)
10991         uint8_t unused_0[7];
10992 } __attribute__((packed));
10993
10994 /* Output       (16 bytes) */
10995 struct hwrm_tunnel_dst_port_query_output {
10996         uint16_t error_code;
10997         /*
10998          * Pass/Fail or error type Note: receiver to verify the in
10999          * parameters, and fail the call with an error when appropriate
11000          */
11001         uint16_t req_type;
11002         /* This field returns the type of original request. */
11003         uint16_t seq_id;
11004         /* This field provides original sequence number of the command. */
11005         uint16_t resp_len;
11006         /*
11007          * This field is the length of the response in bytes. The last
11008          * byte of the response is a valid flag that will read as '1'
11009          * when the command has been completely written to memory.
11010          */
11011         uint16_t tunnel_dst_port_id;
11012         /*
11013          * This field represents the identifier of L4 destination port
11014          * used for the given tunnel type. This field is valid for
11015          * specific tunnel types that use layer 4       (e.g. UDP) transports
11016          * for tunneling.
11017          */
11018         uint16_t tunnel_dst_port_val;
11019         /*
11020          * This field represents the value of L4 destination port
11021          * identified by tunnel_dst_port_id. This field is valid for
11022          * specific tunnel types that use layer 4       (e.g. UDP) transports
11023          * for tunneling. This field is in network byte order. A value
11024          * of 0 means that the destination port is not configured.
11025          */
11026         uint8_t unused_0;
11027         uint8_t unused_1;
11028         uint8_t unused_2;
11029         uint8_t valid;
11030         /*
11031          * This field is used in Output records to indicate that the
11032          * output is completely written to RAM. This field should be
11033          * read as '1' to indicate that the output has been completely
11034          * written. When writing a command completion or response to an
11035          * internal processor, the order of writes has to be such that
11036          * this field is written last.
11037          */
11038 } __attribute__((packed));
11039
11040 /* hwrm_tunnel_dst_port_alloc */
11041 /*
11042  * Description: This function is called by a driver to allocate l4 destination
11043  * port for a specific tunnel type. The destination port value is provided in
11044  * the input. If the HWRM supports only one global destination port for a tunnel
11045  * type, then the HWRM shall keep track of its usage as described below. # The
11046  * first caller that allocates a destination port shall always succeed and the
11047  * HWRM shall save the destination port configuration for that tunnel type and
11048  * increment the usage count to 1. # Subsequent callers allocating the same
11049  * destination port for that tunnel type shall succeed and the HWRM shall
11050  * increment the usage count for that port for each subsequent caller that
11051  * succeeds. # Any subsequent caller trying to allocate a different destination
11052  * port for that tunnel type shall fail until the usage count for the original
11053  * destination port goes to zero. # A caller that frees a port will cause the
11054  * usage count for that port to decrement.
11055  */
11056 /* Input        (24 bytes) */
11057 struct hwrm_tunnel_dst_port_alloc_input {
11058         uint16_t req_type;
11059         /*
11060          * This value indicates what type of request this is. The format
11061          * for the rest of the command is determined by this field.
11062          */
11063         uint16_t cmpl_ring;
11064         /*
11065          * This value indicates the what completion ring the request
11066          * will be optionally completed on. If the value is -1, then no
11067          * CR completion will be generated. Any other value must be a
11068          * valid CR ring_id value for this function.
11069          */
11070         uint16_t seq_id;
11071         /* This value indicates the command sequence number. */
11072         uint16_t target_id;
11073         /*
11074          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11075          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11076          * - HWRM
11077          */
11078         uint64_t resp_addr;
11079         /*
11080          * This is the host address where the response will be written
11081          * when the request is complete. This area must be 16B aligned
11082          * and must be cleared to zero before the request is made.
11083          */
11084         uint8_t tunnel_type;
11085         /* Tunnel Type. */
11086         /* Virtual eXtensible Local Area Network        (VXLAN) */
11087         #define HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_VXLAN UINT32_C(0x1)
11088         /* Generic Network Virtualization Encapsulation (Geneve) */
11089         #define HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_GENEVE \
11090                 UINT32_C(0x5)
11091         /*
11092          * IPV4 over virtual eXtensible Local Area
11093          * Network (IPV4oVXLAN)
11094          */
11095         #define HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_VXLAN_V4 \
11096                 UINT32_C(0x9)
11097         uint8_t unused_0;
11098         uint16_t tunnel_dst_port_val;
11099         /*
11100          * This field represents the value of L4 destination port used
11101          * for the given tunnel type. This field is valid for specific
11102          * tunnel types that use layer 4        (e.g. UDP) transports for
11103          * tunneling. This field is in network byte order. A value of 0
11104          * shall fail the command.
11105          */
11106         uint32_t unused_1;
11107 } __attribute__((packed));
11108
11109 /* Output       (16 bytes) */
11110 struct hwrm_tunnel_dst_port_alloc_output {
11111         uint16_t error_code;
11112         /*
11113          * Pass/Fail or error type Note: receiver to verify the in
11114          * parameters, and fail the call with an error when appropriate
11115          */
11116         uint16_t req_type;
11117         /* This field returns the type of original request. */
11118         uint16_t seq_id;
11119         /* This field provides original sequence number of the command. */
11120         uint16_t resp_len;
11121         /*
11122          * This field is the length of the response in bytes. The last
11123          * byte of the response is a valid flag that will read as '1'
11124          * when the command has been completely written to memory.
11125          */
11126         uint16_t tunnel_dst_port_id;
11127         /*
11128          * Identifier of a tunnel L4 destination port value. Only
11129          * applies to tunnel types that has l4 destination port
11130          * parameters.
11131          */
11132         uint8_t unused_0;
11133         uint8_t unused_1;
11134         uint8_t unused_2;
11135         uint8_t unused_3;
11136         uint8_t unused_4;
11137         uint8_t valid;
11138         /*
11139          * This field is used in Output records to indicate that the
11140          * output is completely written to RAM. This field should be
11141          * read as '1' to indicate that the output has been completely
11142          * written. When writing a command completion or response to an
11143          * internal processor, the order of writes has to be such that
11144          * this field is written last.
11145          */
11146 } __attribute__((packed));
11147
11148 /* hwrm_tunnel_dst_port_free */
11149 /*
11150  * Description: This function is called by a driver to free l4 destination port
11151  * for a specific tunnel type.
11152  */
11153 /* Input        (24 bytes) */
11154 struct hwrm_tunnel_dst_port_free_input {
11155         uint16_t req_type;
11156         /*
11157          * This value indicates what type of request this is. The format
11158          * for the rest of the command is determined by this field.
11159          */
11160         uint16_t cmpl_ring;
11161         /*
11162          * This value indicates the what completion ring the request
11163          * will be optionally completed on. If the value is -1, then no
11164          * CR completion will be generated. Any other value must be a
11165          * valid CR ring_id value for this function.
11166          */
11167         uint16_t seq_id;
11168         /* This value indicates the command sequence number. */
11169         uint16_t target_id;
11170         /*
11171          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11172          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11173          * - HWRM
11174          */
11175         uint64_t resp_addr;
11176         /*
11177          * This is the host address where the response will be written
11178          * when the request is complete. This area must be 16B aligned
11179          * and must be cleared to zero before the request is made.
11180          */
11181         uint8_t tunnel_type;
11182         /* Tunnel Type. */
11183         /* Virtual eXtensible Local Area Network        (VXLAN) */
11184         #define HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_VXLAN UINT32_C(0x1)
11185         /* Generic Network Virtualization Encapsulation (Geneve) */
11186         #define HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_GENEVE UINT32_C(0x5)
11187         /*
11188          * IPV4 over virtual eXtensible Local Area
11189          * Network (IPV4oVXLAN)
11190          */
11191         #define HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_VXLAN_V4 \
11192                 UINT32_C(0x9)
11193         uint8_t unused_0;
11194         uint16_t tunnel_dst_port_id;
11195         /*
11196          * Identifier of a tunnel L4 destination port value. Only
11197          * applies to tunnel types that has l4 destination port
11198          * parameters.
11199          */
11200         uint32_t unused_1;
11201 } __attribute__((packed));
11202
11203 /* Output       (16 bytes) */
11204 struct hwrm_tunnel_dst_port_free_output {
11205         uint16_t error_code;
11206         /*
11207          * Pass/Fail or error type Note: receiver to verify the in
11208          * parameters, and fail the call with an error when appropriate
11209          */
11210         uint16_t req_type;
11211         /* This field returns the type of original request. */
11212         uint16_t seq_id;
11213         /* This field provides original sequence number of the command. */
11214         uint16_t resp_len;
11215         /*
11216          * This field is the length of the response in bytes. The last
11217          * byte of the response is a valid flag that will read as '1'
11218          * when the command has been completely written to memory.
11219          */
11220         uint32_t unused_0;
11221         uint8_t unused_1;
11222         uint8_t unused_2;
11223         uint8_t unused_3;
11224         uint8_t valid;
11225         /*
11226          * This field is used in Output records to indicate that the
11227          * output is completely written to RAM. This field should be
11228          * read as '1' to indicate that the output has been completely
11229          * written. When writing a command completion or response to an
11230          * internal processor, the order of writes has to be such that
11231          * this field is written last.
11232          */
11233 } __attribute__((packed));
11234
11235 /* hwrm_stat_ctx_alloc */
11236 /*
11237  * Description: This command allocates and does basic preparation for a stat
11238  * context.
11239  */
11240 /* Input        (32 bytes) */
11241 struct hwrm_stat_ctx_alloc_input {
11242         uint16_t req_type;
11243         /*
11244          * This value indicates what type of request this is. The format
11245          * for the rest of the command is determined by this field.
11246          */
11247         uint16_t cmpl_ring;
11248         /*
11249          * This value indicates the what completion ring the request
11250          * will be optionally completed on. If the value is -1, then no
11251          * CR completion will be generated. Any other value must be a
11252          * valid CR ring_id value for this function.
11253          */
11254         uint16_t seq_id;
11255         /* This value indicates the command sequence number. */
11256         uint16_t target_id;
11257         /*
11258          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11259          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11260          * - HWRM
11261          */
11262         uint64_t resp_addr;
11263         /*
11264          * This is the host address where the response will be written
11265          * when the request is complete. This area must be 16B aligned
11266          * and must be cleared to zero before the request is made.
11267          */
11268         uint64_t stats_dma_addr;
11269         /* This is the address for statistic block. */
11270         uint32_t update_period_ms;
11271         /*
11272          * The statistic block update period in ms. e.g. 250ms, 500ms,
11273          * 750ms, 1000ms. If update_period_ms is 0, then the stats
11274          * update shall be never done and the DMA address shall not be
11275          * used. In this case, the stat block can only be read by
11276          * hwrm_stat_ctx_query command.
11277          */
11278         uint8_t stat_ctx_flags;
11279         /*
11280          * This field is used to specify statistics context specific
11281          * configuration flags.
11282          */
11283         /*
11284          * When this bit is set to '1', the statistics context shall be
11285          * allocated for RoCE traffic only. In this case, traffic other
11286          * than offloaded RoCE traffic shall not be included in this
11287          * statistic context. When this bit is set to '0', the
11288          * statistics context shall be used for the network traffic
11289          * other than offloaded RoCE traffic.
11290          */
11291         #define HWRM_STAT_CTX_ALLOC_INPUT_STAT_CTX_FLAGS_ROCE   UINT32_C(0x1)
11292         uint8_t unused_0[3];
11293 } __attribute__((packed));
11294
11295 /* Output       (16 bytes) */
11296 struct hwrm_stat_ctx_alloc_output {
11297         uint16_t error_code;
11298         /*
11299          * Pass/Fail or error type Note: receiver to verify the in
11300          * parameters, and fail the call with an error when appropriate
11301          */
11302         uint16_t req_type;
11303         /* This field returns the type of original request. */
11304         uint16_t seq_id;
11305         /* This field provides original sequence number of the command. */
11306         uint16_t resp_len;
11307         /*
11308          * This field is the length of the response in bytes. The last
11309          * byte of the response is a valid flag that will read as '1'
11310          * when the command has been completely written to memory.
11311          */
11312         uint32_t stat_ctx_id;
11313         /* This is the statistics context ID value. */
11314         uint8_t unused_0;
11315         uint8_t unused_1;
11316         uint8_t unused_2;
11317         uint8_t valid;
11318         /*
11319          * This field is used in Output records to indicate that the
11320          * output is completely written to RAM. This field should be
11321          * read as '1' to indicate that the output has been completely
11322          * written. When writing a command completion or response to an
11323          * internal processor, the order of writes has to be such that
11324          * this field is written last.
11325          */
11326 } __attribute__((packed));
11327
11328 /* hwrm_stat_ctx_free */
11329 /* Description: This command is used to free a stat context. */
11330 /* Input        (24 bytes) */
11331 struct hwrm_stat_ctx_free_input {
11332         uint16_t req_type;
11333         /*
11334          * This value indicates what type of request this is. The format
11335          * for the rest of the command is determined by this field.
11336          */
11337         uint16_t cmpl_ring;
11338         /*
11339          * This value indicates the what completion ring the request
11340          * will be optionally completed on. If the value is -1, then no
11341          * CR completion will be generated. Any other value must be a
11342          * valid CR ring_id value for this function.
11343          */
11344         uint16_t seq_id;
11345         /* This value indicates the command sequence number. */
11346         uint16_t target_id;
11347         /*
11348          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11349          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11350          * - HWRM
11351          */
11352         uint64_t resp_addr;
11353         /*
11354          * This is the host address where the response will be written
11355          * when the request is complete. This area must be 16B aligned
11356          * and must be cleared to zero before the request is made.
11357          */
11358         uint32_t stat_ctx_id;
11359         /* ID of the statistics context that is being queried. */
11360         uint32_t unused_0;
11361 } __attribute__((packed));
11362
11363 /* Output       (16 bytes) */
11364 struct hwrm_stat_ctx_free_output {
11365         uint16_t error_code;
11366         /*
11367          * Pass/Fail or error type Note: receiver to verify the in
11368          * parameters, and fail the call with an error when appropriate
11369          */
11370         uint16_t req_type;
11371         /* This field returns the type of original request. */
11372         uint16_t seq_id;
11373         /* This field provides original sequence number of the command. */
11374         uint16_t resp_len;
11375         /*
11376          * This field is the length of the response in bytes. The last
11377          * byte of the response is a valid flag that will read as '1'
11378          * when the command has been completely written to memory.
11379          */
11380         uint32_t stat_ctx_id;
11381         /* This is the statistics context ID value. */
11382         uint8_t unused_0;
11383         uint8_t unused_1;
11384         uint8_t unused_2;
11385         uint8_t valid;
11386         /*
11387          * This field is used in Output records to indicate that the
11388          * output is completely written to RAM. This field should be
11389          * read as '1' to indicate that the output has been completely
11390          * written. When writing a command completion or response to an
11391          * internal processor, the order of writes has to be such that
11392          * this field is written last.
11393          */
11394 } __attribute__((packed));
11395
11396 /* hwrm_stat_ctx_query */
11397 /* Description: This command returns statistics of a context. */
11398 /* Input (24 bytes) */
11399 struct hwrm_stat_ctx_query_input {
11400         uint16_t req_type;
11401         /*
11402          * This value indicates what type of request this is. The format for the
11403          * rest of the command is determined by this field.
11404          */
11405         uint16_t cmpl_ring;
11406         /*
11407          * This value indicates the what completion ring the request will be
11408          * optionally completed on. If the value is -1, then no CR completion
11409          * will be generated. Any other value must be a valid CR ring_id value
11410          * for this function.
11411          */
11412         uint16_t seq_id;
11413         /* This value indicates the command sequence number. */
11414         uint16_t target_id;
11415         /*
11416          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
11417          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
11418          */
11419         uint64_t resp_addr;
11420         /*
11421          * This is the host address where the response will be written when the
11422          * request is complete. This area must be 16B aligned and must be
11423          * cleared to zero before the request is made.
11424          */
11425         uint32_t stat_ctx_id;
11426         /* ID of the statistics context that is being queried. */
11427         uint32_t unused_0;
11428 } __attribute__((packed));
11429
11430 /* Output (176 bytes) */
11431 struct hwrm_stat_ctx_query_output {
11432         uint16_t error_code;
11433         /*
11434          * Pass/Fail or error type Note: receiver to verify the in parameters,
11435          * and fail the call with an error when appropriate
11436          */
11437         uint16_t req_type;
11438         /* This field returns the type of original request. */
11439         uint16_t seq_id;
11440         /* This field provides original sequence number of the command. */
11441         uint16_t resp_len;
11442         /*
11443          * This field is the length of the response in bytes. The last byte of
11444          * the response is a valid flag that will read as '1' when the command
11445          * has been completely written to memory.
11446          */
11447         uint64_t tx_ucast_pkts;
11448         /* Number of transmitted unicast packets */
11449         uint64_t tx_mcast_pkts;
11450         /* Number of transmitted multicast packets */
11451         uint64_t tx_bcast_pkts;
11452         /* Number of transmitted broadcast packets */
11453         uint64_t tx_err_pkts;
11454         /* Number of transmitted packets with error */
11455         uint64_t tx_drop_pkts;
11456         /* Number of dropped packets on transmit path */
11457         uint64_t tx_ucast_bytes;
11458         /* Number of transmitted bytes for unicast traffic */
11459         uint64_t tx_mcast_bytes;
11460         /* Number of transmitted bytes for multicast traffic */
11461         uint64_t tx_bcast_bytes;
11462         /* Number of transmitted bytes for broadcast traffic */
11463         uint64_t rx_ucast_pkts;
11464         /* Number of received unicast packets */
11465         uint64_t rx_mcast_pkts;
11466         /* Number of received multicast packets */
11467         uint64_t rx_bcast_pkts;
11468         /* Number of received broadcast packets */
11469         uint64_t rx_err_pkts;
11470         /* Number of received packets with error */
11471         uint64_t rx_drop_pkts;
11472         /* Number of dropped packets on received path */
11473         uint64_t rx_ucast_bytes;
11474         /* Number of received bytes for unicast traffic */
11475         uint64_t rx_mcast_bytes;
11476         /* Number of received bytes for multicast traffic */
11477         uint64_t rx_bcast_bytes;
11478         /* Number of received bytes for broadcast traffic */
11479         uint64_t rx_agg_pkts;
11480         /* Number of aggregated unicast packets */
11481         uint64_t rx_agg_bytes;
11482         /* Number of aggregated unicast bytes */
11483         uint64_t rx_agg_events;
11484         /* Number of aggregation events */
11485         uint64_t rx_agg_aborts;
11486         /* Number of aborted aggregations */
11487         uint32_t unused_0;
11488         uint8_t unused_1;
11489         uint8_t unused_2;
11490         uint8_t unused_3;
11491         uint8_t valid;
11492         /*
11493          * This field is used in Output records to indicate that the output is
11494          * completely written to RAM. This field should be read as '1' to
11495          * indicate that the output has been completely written. When writing a
11496          * command completion or response to an internal processor, the order of
11497          * writes has to be such that this field is written last.
11498          */
11499 } __attribute__((packed));
11500
11501 /* hwrm_stat_ctx_clr_stats */
11502 /* Description: This command clears statistics of a context. */
11503 /* Input        (24 bytes) */
11504 struct hwrm_stat_ctx_clr_stats_input {
11505         uint16_t req_type;
11506         /*
11507          * This value indicates what type of request this is. The format
11508          * for the rest of the command is determined by this field.
11509          */
11510         uint16_t cmpl_ring;
11511         /*
11512          * This value indicates the what completion ring the request
11513          * will be optionally completed on. If the value is -1, then no
11514          * CR completion will be generated. Any other value must be a
11515          * valid CR ring_id value for this function.
11516          */
11517         uint16_t seq_id;
11518         /* This value indicates the command sequence number. */
11519         uint16_t target_id;
11520         /*
11521          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11522          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11523          * - HWRM
11524          */
11525         uint64_t resp_addr;
11526         /*
11527          * This is the host address where the response will be written
11528          * when the request is complete. This area must be 16B aligned
11529          * and must be cleared to zero before the request is made.
11530          */
11531         uint32_t stat_ctx_id;
11532         /* ID of the statistics context that is being queried. */
11533         uint32_t unused_0;
11534 } __attribute__((packed));
11535
11536 /* Output       (16 bytes) */
11537 struct hwrm_stat_ctx_clr_stats_output {
11538         uint16_t error_code;
11539         /*
11540          * Pass/Fail or error type Note: receiver to verify the in
11541          * parameters, and fail the call with an error when appropriate
11542          */
11543         uint16_t req_type;
11544         /* This field returns the type of original request. */
11545         uint16_t seq_id;
11546         /* This field provides original sequence number of the command. */
11547         uint16_t resp_len;
11548         /*
11549          * This field is the length of the response in bytes. The last
11550          * byte of the response is a valid flag that will read as '1'
11551          * when the command has been completely written to memory.
11552          */
11553         uint32_t unused_0;
11554         uint8_t unused_1;
11555         uint8_t unused_2;
11556         uint8_t unused_3;
11557         uint8_t valid;
11558         /*
11559          * This field is used in Output records to indicate that the
11560          * output is completely written to RAM. This field should be
11561          * read as '1' to indicate that the output has been completely
11562          * written. When writing a command completion or response to an
11563          * internal processor, the order of writes has to be such that
11564          * this field is written last.
11565          */
11566 } __attribute__((packed));
11567
11568 /* hwrm_exec_fwd_resp */
11569 /*
11570  * Description: This command is used to send an encapsulated request to the
11571  * HWRM. This command instructs the HWRM to execute the request and forward the
11572  * response of the encapsulated request to the location specified in the
11573  * original request that is encapsulated. The target id of this command shall be
11574  * set to 0xFFFF (HWRM). The response location in this command shall be used to
11575  * acknowledge the receipt of the encapsulated request and forwarding of the
11576  * response.
11577  */
11578 /* Input        (128 bytes) */
11579 struct hwrm_exec_fwd_resp_input {
11580         uint16_t req_type;
11581         /*
11582          * This value indicates what type of request this is. The format
11583          * for the rest of the command is determined by this field.
11584          */
11585         uint16_t cmpl_ring;
11586         /*
11587          * This value indicates the what completion ring the request
11588          * will be optionally completed on. If the value is -1, then no
11589          * CR completion will be generated. Any other value must be a
11590          * valid CR ring_id value for this function.
11591          */
11592         uint16_t seq_id;
11593         /* This value indicates the command sequence number. */
11594         uint16_t target_id;
11595         /*
11596          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11597          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11598          * - HWRM
11599          */
11600         uint64_t resp_addr;
11601         /*
11602          * This is the host address where the response will be written
11603          * when the request is complete. This area must be 16B aligned
11604          * and must be cleared to zero before the request is made.
11605          */
11606         uint32_t encap_request[26];
11607         /*
11608          * This is an encapsulated request. This request should be
11609          * executed by the HWRM and the response should be provided in
11610          * the response buffer inside the encapsulated request.
11611          */
11612         uint16_t encap_resp_target_id;
11613         /*
11614          * This value indicates the target id of the response to the
11615          * encapsulated request. 0x0 - 0xFFF8 - Used for function ids
11616          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF -
11617          * HWRM
11618          */
11619         uint16_t unused_0[3];
11620 } __attribute__((packed));
11621
11622 /* Output       (16 bytes) */
11623 struct hwrm_exec_fwd_resp_output {
11624         uint16_t error_code;
11625         /*
11626          * Pass/Fail or error type Note: receiver to verify the in
11627          * parameters, and fail the call with an error when appropriate
11628          */
11629         uint16_t req_type;
11630         /* This field returns the type of original request. */
11631         uint16_t seq_id;
11632         /* This field provides original sequence number of the command. */
11633         uint16_t resp_len;
11634         /*
11635          * This field is the length of the response in bytes. The last
11636          * byte of the response is a valid flag that will read as '1'
11637          * when the command has been completely written to memory.
11638          */
11639         uint32_t unused_0;
11640         uint8_t unused_1;
11641         uint8_t unused_2;
11642         uint8_t unused_3;
11643         uint8_t valid;
11644         /*
11645          * This field is used in Output records to indicate that the
11646          * output is completely written to RAM. This field should be
11647          * read as '1' to indicate that the output has been completely
11648          * written. When writing a command completion or response to an
11649          * internal processor, the order of writes has to be such that
11650          * this field is written last.
11651          */
11652 } __attribute__((packed));
11653
11654 /* hwrm_reject_fwd_resp */
11655 /*
11656  * Description: This command is used to send an encapsulated request to the
11657  * HWRM. This command instructs the HWRM to reject the request and forward the
11658  * error response of the encapsulated request to the location specified in the
11659  * original request that is encapsulated. The target id of this command shall be
11660  * set to 0xFFFF (HWRM). The response location in this command shall be used to
11661  * acknowledge the receipt of the encapsulated request and forwarding of the
11662  * response.
11663  */
11664 /* Input        (128 bytes) */
11665 struct hwrm_reject_fwd_resp_input {
11666         uint16_t req_type;
11667         /*
11668          * This value indicates what type of request this is. The format
11669          * for the rest of the command is determined by this field.
11670          */
11671         uint16_t cmpl_ring;
11672         /*
11673          * This value indicates the what completion ring the request
11674          * will be optionally completed on. If the value is -1, then no
11675          * CR completion will be generated. Any other value must be a
11676          * valid CR ring_id value for this function.
11677          */
11678         uint16_t seq_id;
11679         /* This value indicates the command sequence number. */
11680         uint16_t target_id;
11681         /*
11682          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11683          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11684          * - HWRM
11685          */
11686         uint64_t resp_addr;
11687         /*
11688          * This is the host address where the response will be written
11689          * when the request is complete. This area must be 16B aligned
11690          * and must be cleared to zero before the request is made.
11691          */
11692         uint32_t encap_request[26];
11693         /*
11694          * This is an encapsulated request. This request should be
11695          * rejected by the HWRM and the error response should be
11696          * provided in the response buffer inside the encapsulated
11697          * request.
11698          */
11699         uint16_t encap_resp_target_id;
11700         /*
11701          * This value indicates the target id of the response to the
11702          * encapsulated request. 0x0 - 0xFFF8 - Used for function ids
11703          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF -
11704          * HWRM
11705          */
11706         uint16_t unused_0[3];
11707 } __attribute__((packed));
11708
11709 /* Output       (16 bytes) */
11710 struct hwrm_reject_fwd_resp_output {
11711         uint16_t error_code;
11712         /*
11713          * Pass/Fail or error type Note: receiver to verify the in
11714          * parameters, and fail the call with an error when appropriate
11715          */
11716         uint16_t req_type;
11717         /* This field returns the type of original request. */
11718         uint16_t seq_id;
11719         /* This field provides original sequence number of the command. */
11720         uint16_t resp_len;
11721         /*
11722          * This field is the length of the response in bytes. The last
11723          * byte of the response is a valid flag that will read as '1'
11724          * when the command has been completely written to memory.
11725          */
11726         uint32_t unused_0;
11727         uint8_t unused_1;
11728         uint8_t unused_2;
11729         uint8_t unused_3;
11730         uint8_t valid;
11731         /*
11732          * This field is used in Output records to indicate that the
11733          * output is completely written to RAM. This field should be
11734          * read as '1' to indicate that the output has been completely
11735          * written. When writing a command completion or response to an
11736          * internal processor, the order of writes has to be such that
11737          * this field is written last.
11738          */
11739 } __attribute__((packed));
11740
11741 /* hwrm_nvm_get_dir_entries */
11742 /* Input (24 bytes) */
11743 struct hwrm_nvm_get_dir_entries_input {
11744         uint16_t req_type;
11745         uint16_t cmpl_ring;
11746         uint16_t seq_id;
11747         uint16_t target_id;
11748         uint64_t resp_addr;
11749         uint64_t host_dest_addr;
11750 } __attribute__((packed));
11751
11752 /* Output (16 bytes) */
11753 struct hwrm_nvm_get_dir_entries_output {
11754         uint16_t error_code;
11755         uint16_t req_type;
11756         uint16_t seq_id;
11757         uint16_t resp_len;
11758         uint32_t unused_0;
11759         uint8_t unused_1;
11760         uint8_t unused_2;
11761         uint8_t unused_3;
11762         uint8_t valid;
11763 } __attribute__((packed));
11764
11765
11766 /* hwrm_nvm_erase_dir_entry */
11767 /* Input (24 bytes) */
11768 struct hwrm_nvm_erase_dir_entry_input {
11769         uint16_t req_type;
11770         uint16_t cmpl_ring;
11771         uint16_t seq_id;
11772         uint16_t target_id;
11773         uint64_t resp_addr;
11774         uint16_t dir_idx;
11775         uint16_t unused_0[3];
11776 };
11777
11778 /* Output (16 bytes) */
11779 struct hwrm_nvm_erase_dir_entry_output {
11780         uint16_t error_code;
11781         uint16_t req_type;
11782         uint16_t seq_id;
11783         uint16_t resp_len;
11784         uint32_t unused_0;
11785         uint8_t unused_1;
11786         uint8_t unused_2;
11787         uint8_t unused_3;
11788         uint8_t valid;
11789 };
11790
11791 /* hwrm_nvm_get_dir_info */
11792 /* Input (16 bytes) */
11793 struct hwrm_nvm_get_dir_info_input {
11794         uint16_t req_type;
11795         uint16_t cmpl_ring;
11796         uint16_t seq_id;
11797         uint16_t target_id;
11798         uint64_t resp_addr;
11799 } __attribute__((packed));
11800
11801 /* Output (24 bytes) */
11802 struct hwrm_nvm_get_dir_info_output {
11803         uint16_t error_code;
11804         /*
11805          * Pass/Fail or error type Note: receiver to verify the in
11806          * parameters, and fail the call with an error when appropriate
11807          */
11808         uint16_t req_type;
11809         /* This field returns the type of original request. */
11810         uint16_t seq_id;
11811         /* This field provides original sequence number of the command. */
11812         uint16_t resp_len;
11813         /*
11814          * This field is the length of the response in bytes. The last
11815          * byte of the response is a valid flag that will read as '1'
11816          * when the command has been completely written to memory.
11817          */
11818         uint32_t entries;
11819         /* Number of directory entries in the directory. */
11820         uint32_t entry_length;
11821         /* Size of each directory entry, in bytes. */
11822         uint32_t unused_0;
11823         uint8_t unused_1;
11824         uint8_t unused_2;
11825         uint8_t unused_3;
11826         uint8_t valid;
11827         /*
11828          * This field is used in Output records to indicate that the
11829          * output is completely written to RAM. This field should be
11830          * read as '1' to indicate that the output has been completely
11831          * written. When writing a command completion or response to an
11832          * internal processor, the order of writes has to be such that
11833          * this field is written last.
11834          */
11835 } __attribute__((packed));
11836
11837 /* hwrm_nvm_write */
11838 /*
11839  * Note: Write to the allocated NVRAM of an item referenced by an existing
11840  * directory entry.
11841  */
11842 /* Input (48 bytes) */
11843 struct hwrm_nvm_write_input {
11844         uint16_t req_type;
11845         /*
11846          * This value indicates what type of request this is. The format
11847          * for the rest of the command is determined by this field.
11848          */
11849         uint16_t cmpl_ring;
11850         /*
11851          * This value indicates the what completion ring the request
11852          * will be optionally completed on. If the value is -1, then no
11853          * CR completion will be generated. Any other value must be a
11854          * valid CR ring_id value for this function.
11855          */
11856         uint16_t seq_id;
11857         /* This value indicates the command sequence number. */
11858         uint16_t target_id;
11859         /*
11860          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11861          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11862          * - HWRM
11863          */
11864         uint64_t resp_addr;
11865         /*
11866          * This is the host address where the response will be written
11867          * when the request is complete. This area must be 16B aligned
11868          * and must be cleared to zero before the request is made.
11869          */
11870         uint64_t host_src_addr;
11871         /* 64-bit Host Source Address. This is where the source data is. */
11872         uint16_t dir_type;
11873         /*
11874          * The Directory Entry Type (valid values are defined in the
11875          * bnxnvm_directory_type enum defined in the file
11876          * bnxnvm_defs.h).
11877          */
11878         uint16_t dir_ordinal;
11879         /*
11880          * Directory ordinal. The 0-based instance of the combined
11881          * Directory Entry Type and Extension.
11882          */
11883         uint16_t dir_ext;
11884         /*
11885          * The Directory Entry Extension flags (see BNX_DIR_EXT_* in the
11886          * file bnxnvm_defs.h).
11887          */
11888         uint16_t dir_attr;
11889         /*
11890          * Directory Entry Attribute flags (see BNX_DIR_ATTR_* in the
11891          * file bnxnvm_defs.h).
11892          */
11893         uint32_t dir_data_length;
11894         /*
11895          * Length of data to write, in bytes. May be less than or equal
11896          * to the allocated size for the directory entry. The data
11897          * length stored in the directory entry will be updated to
11898          * reflect this value once the write is complete.
11899          */
11900         uint16_t option;
11901         /* Option. */
11902         uint16_t flags;
11903         /*
11904          * When this bit is '1', the original active image will not be
11905          * removed. TBD: what purpose is this?
11906          */
11907         #define HWRM_NVM_WRITE_INPUT_FLAGS_KEEP_ORIG_ACTIVE_IMG UINT32_C(0x1)
11908         uint32_t dir_item_length;
11909         /*
11910          * The requested length of the allocated NVM for the item, in
11911          * bytes. This value may be greater than or equal to the
11912          * specified data length (dir_data_length). If this value is
11913          * less than the specified data length, it will be ignored. The
11914          * response will contain the actual allocated item length, which
11915          * may be greater than the requested item length. The purpose
11916          * for allocating more than the required number of bytes for an
11917          * item's data is to pre-allocate extra storage (padding) to
11918          * accommodate the potential future growth of an item (e.g.
11919          * upgraded firmware with a size increase, log growth, expanded
11920          * configuration data).
11921          */
11922         uint32_t unused_0;
11923 } __attribute__((packed));
11924
11925 /* Output (16 bytes) */
11926 struct hwrm_nvm_write_output {
11927         uint16_t error_code;
11928         /*
11929          * Pass/Fail or error type Note: receiver to verify the in
11930          * parameters, and fail the call with an error when appropriate
11931          */
11932         uint16_t req_type;
11933         /* This field returns the type of original request. */
11934         uint16_t seq_id;
11935         /* This field provides original sequence number of the command. */
11936         uint16_t resp_len;
11937         /*
11938          * This field is the length of the response in bytes. The last
11939          * byte of the response is a valid flag that will read as '1'
11940          * when the command has been completely written to memory.
11941          */
11942         uint32_t dir_item_length;
11943         /*
11944          * Length of the allocated NVM for the item, in bytes. The value
11945          * may be greater than or equal to the specified data length or
11946          * the requested item length. The actual item length used when
11947          * creating a new directory entry will be a multiple of an NVM
11948          * block size.
11949          */
11950         uint16_t dir_idx;
11951         /* The directory index of the created or modified item. */
11952         uint8_t unused_0;
11953         uint8_t valid;
11954         /*
11955          * This field is used in Output records to indicate that the
11956          * output is completely written to RAM. This field should be
11957          * read as '1' to indicate that the output has been completely
11958          * written. When writing a command completion or response to an
11959          * internal processor, the order of writes has to be such that
11960          * this field is written last.
11961          */
11962 } __attribute__((packed));
11963
11964 /* hwrm_nvm_read */
11965 /*
11966  * Note: Read the contents of an NVRAM item as referenced (indexed) by an
11967  * existing directory entry.
11968  */
11969 /* Input (40 bytes) */
11970 struct hwrm_nvm_read_input {
11971         uint16_t req_type;
11972         /*
11973          * This value indicates what type of request this is. The format
11974          * for the rest of the command is determined by this field.
11975          */
11976         uint16_t cmpl_ring;
11977         /*
11978          * This value indicates the what completion ring the request
11979          * will be optionally completed on. If the value is -1, then no
11980          * CR completion will be generated. Any other value must be a
11981          * valid CR ring_id value for this function.
11982          */
11983         uint16_t seq_id;
11984         /* This value indicates the command sequence number. */
11985         uint16_t target_id;
11986         /*
11987          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
11988          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
11989          * - HWRM
11990          */
11991         uint64_t resp_addr;
11992         /*
11993          * This is the host address where the response will be written
11994          * when the request is complete. This area must be 16B aligned
11995          * and must be cleared to zero before the request is made.
11996          */
11997         uint64_t host_dest_addr;
11998         /*
11999          * 64-bit Host Destination Address. This is the host address
12000          * where the data will be written to.
12001          */
12002         uint16_t dir_idx;
12003         /* The 0-based index of the directory entry. */
12004         uint8_t unused_0;
12005         uint8_t unused_1;
12006         uint32_t offset;
12007         /* The NVRAM byte-offset to read from. */
12008         uint32_t len;
12009         /* The length of the data to be read, in bytes. */
12010         uint32_t unused_2;
12011 } __attribute__((packed));
12012
12013 /* Output (16 bytes) */
12014 struct hwrm_nvm_read_output {
12015         uint16_t error_code;
12016         /*
12017          * Pass/Fail or error type Note: receiver to verify the in
12018          * parameters, and fail the call with an error when appropriate
12019          */
12020         uint16_t req_type;
12021         /* This field returns the type of original request. */
12022         uint16_t seq_id;
12023         /* This field provides original sequence number of the command. */
12024         uint16_t resp_len;
12025         /*
12026          * This field is the length of the response in bytes. The last
12027          * byte of the response is a valid flag that will read as '1'
12028          * when the command has been completely written to memory.
12029          */
12030         uint32_t unused_0;
12031         uint8_t unused_1;
12032         uint8_t unused_2;
12033         uint8_t unused_3;
12034         uint8_t valid;
12035         /*
12036          * This field is used in Output records to indicate that the
12037          * output is completely written to RAM. This field should be
12038          * read as '1' to indicate that the output has been completely
12039          * written. When writing a command completion or response to an
12040          * internal processor, the order of writes has to be such that
12041          * this field is written last.
12042          */
12043 } __attribute__((packed));
12044
12045 /* Hardware Resource Manager Specification */
12046 /* Description: This structure is used to specify port description. */
12047 /*
12048  * Note: The Hardware Resource Manager (HWRM) manages various hardware resources
12049  * inside the chip. The HWRM is implemented in firmware, and runs on embedded
12050  * processors inside the chip. This firmware service is vital part of the chip.
12051  * The chip can not be used by a driver or HWRM client without the HWRM.
12052  */
12053 /* Input        (16 bytes) */
12054 struct input {
12055         uint16_t req_type;
12056         /*
12057          * This value indicates what type of request this is. The format
12058          * for the rest of the command is determined by this field.
12059          */
12060         uint16_t cmpl_ring;
12061         /*
12062          * This value indicates the what completion ring the request
12063          * will be optionally completed on. If the value is -1, then no
12064          * CR completion will be generated. Any other value must be a
12065          * valid CR ring_id value for this function.
12066          */
12067         uint16_t seq_id;
12068         /* This value indicates the command sequence number. */
12069         uint16_t target_id;
12070         /*
12071          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
12072          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
12073          * - HWRM
12074          */
12075         uint64_t resp_addr;
12076         /*
12077          * This is the host address where the response will be written
12078          * when the request is complete. This area must be 16B aligned
12079          * and must be cleared to zero before the request is made.
12080          */
12081 } __attribute__((packed));
12082
12083 /* Output       (8 bytes) */
12084 struct output {
12085         uint16_t error_code;
12086         /*
12087          * Pass/Fail or error type Note: receiver to verify the in
12088          * parameters, and fail the call with an error when appropriate
12089          */
12090         uint16_t req_type;
12091         /* This field returns the type of original request. */
12092         uint16_t seq_id;
12093         /* This field provides original sequence number of the command. */
12094         uint16_t resp_len;
12095         /*
12096          * This field is the length of the response in bytes. The last
12097          * byte of the response is a valid flag that will read as '1'
12098          * when the command has been completely written to memory.
12099          */
12100 } __attribute__((packed));
12101
12102 /* Short Command Structure (16 bytes) */
12103 struct hwrm_short_input {
12104         uint16_t req_type;
12105         /*
12106          * This field indicates the type of request in the request
12107          * buffer. The format for the rest of the command (request) is
12108          * determined by this field.
12109          */
12110         uint16_t signature;
12111         /*
12112          * This field indicates a signature that is used to identify
12113          * short form of the command listed here. This field shall be
12114          * set to 17185 (0x4321).
12115          */
12116         /* Signature indicating this is a short form of HWRM command */
12117         #define HWRM_SHORT_REQ_SIGNATURE_SHORT_CMD UINT32_C(0x4321)
12118         uint16_t unused_0;
12119         /* Reserved for future use. */
12120         uint16_t size;
12121         /* This value indicates the length of the request. */
12122         uint64_t req_addr;
12123         /*
12124          * This is the host address where the request was written. This
12125          * area must be 16B aligned.
12126          */
12127 } __attribute__((packed));
12128
12129 #define HWRM_GET_HWRM_ERROR_CODE(arg) \
12130         { \
12131                 typeof(arg) x = (arg); \
12132         ((x) == 0xf ? "HWRM_ERROR" : \
12133         ((x) == 0xffff ? "CMD_NOT_SUPPORTED" : \
12134         ((x) == 0xfffe ? "UNKNOWN_ERR" : \
12135         ((x) == 0x4 ? "RESOURCE_ALLOC_ERROR" : \
12136         ((x) == 0x5 ? "INVALID_FLAGS" : \
12137         ((x) == 0x6 ? "INVALID_ENABLES" : \
12138         ((x) == 0x0 ? "SUCCESS" : \
12139         ((x) == 0x1 ? "FAIL" : \
12140         ((x) == 0x2 ? "INVALID_PARAMS" : \
12141         ((x) == 0x3 ? "RESOURCE_ACCESS_DENIED" : \
12142         "Unknown error_code")))))))))) \
12143         }
12144
12145 /* Return Codes (8 bytes) */
12146 struct ret_codes {
12147         uint16_t error_code;
12148         /* These are numbers assigned to return/error codes. */
12149         /* Request was successfully executed by the HWRM. */
12150         #define HWRM_ERR_CODE_SUCCESS   (UINT32_C(0x0))
12151         /* THe HWRM failed to execute the request. */
12152         #define HWRM_ERR_CODE_FAIL      (UINT32_C(0x1))
12153         /*
12154          * The request contains invalid argument(s) or
12155          * input parameters.
12156          */
12157         #define HWRM_ERR_CODE_INVALID_PARAMS    (UINT32_C(0x2))
12158         /*
12159          * The requester is not allowed to access the
12160          * requested resource. This error code shall be
12161          * provided in a response to a request to query
12162          * or modify an existing resource that is not
12163          * accessible by the requester.
12164          */
12165         #define HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED    (UINT32_C(0x3))
12166         /*
12167          * The HWRM is unable to allocate the requested
12168          * resource. This code only applies to requests
12169          * for HWRM resource allocations.
12170          */
12171         #define HWRM_ERR_CODE_RESOURCE_ALLOC_ERROR      (UINT32_C(0x4))
12172         /* Invalid combination of flags is specified in the request. */
12173         #define HWRM_ERR_CODE_INVALID_FLAGS     (UINT32_C(0x5))
12174         /*
12175          * Invalid combination of enables fields is
12176          * specified in the request.
12177          */
12178         #define HWRM_ERR_CODE_INVALID_ENABLES   (UINT32_C(0x6))
12179         /*
12180          * Generic HWRM execution error that represents
12181          * an internal error.
12182          */
12183         #define HWRM_ERR_CODE_HWRM_ERROR        (UINT32_C(0xf))
12184         /* Unknown error */
12185         #define HWRM_ERR_CODE_UNKNOWN_ERR       (UINT32_C(0xfffe))
12186         /* Unsupported or invalid command */
12187         #define HWRM_ERR_CODE_CMD_NOT_SUPPORTED (UINT32_C(0xffff))
12188         uint16_t unused_0[3];
12189 } __attribute__((packed));
12190
12191 /* Output       (16 bytes) */
12192 struct hwrm_err_output {
12193         uint16_t error_code;
12194         /*
12195          * Pass/Fail or error type Note: receiver to verify the in
12196          * parameters, and fail the call with an error when appropriate
12197          */
12198         uint16_t req_type;
12199         /* This field returns the type of original request. */
12200         uint16_t seq_id;
12201         /* This field provides original sequence number of the command. */
12202         uint16_t resp_len;
12203         /*
12204          * This field is the length of the response in bytes. The last
12205          * byte of the response is a valid flag that will read as '1'
12206          * when the command has been completely written to memory.
12207          */
12208         uint32_t opaque_0;
12209         /* debug info for this error response. */
12210         uint16_t opaque_1;
12211         /* debug info for this error response. */
12212         uint8_t cmd_err;
12213         /*
12214          * In the case of an error response, command specific error code
12215          * is returned in this field.
12216          */
12217         uint8_t valid;
12218         /*
12219          * This field is used in Output records to indicate that the
12220          * output is completely written to RAM. This field should be
12221          * read as '1' to indicate that the output has been completely
12222          * written. When writing a command completion or response to an
12223          * internal processor, the order of writes has to be such that
12224          * this field is written last.
12225          */
12226 } __attribute__((packed));
12227
12228 /* Port Tx Statistics Formats   (408 bytes) */
12229 struct tx_port_stats {
12230         uint64_t tx_64b_frames;
12231         /* Total Number of 64 Bytes frames transmitted */
12232         uint64_t tx_65b_127b_frames;
12233         /* Total Number of 65-127 Bytes frames transmitted */
12234         uint64_t tx_128b_255b_frames;
12235         /* Total Number of 128-255 Bytes frames transmitted */
12236         uint64_t tx_256b_511b_frames;
12237         /* Total Number of 256-511 Bytes frames transmitted */
12238         uint64_t tx_512b_1023b_frames;
12239         /* Total Number of 512-1023 Bytes frames transmitted */
12240         uint64_t tx_1024b_1518_frames;
12241         /* Total Number of 1024-1518 Bytes frames transmitted */
12242         uint64_t tx_good_vlan_frames;
12243         /*
12244          * Total Number of each good VLAN       (exludes FCS errors) frame
12245          * transmitted which is 1519 to 1522 bytes in length inclusive
12246          *      (excluding framing bits but including FCS bytes).
12247          */
12248         uint64_t tx_1519b_2047_frames;
12249         /* Total Number of 1519-2047 Bytes frames transmitted */
12250         uint64_t tx_2048b_4095b_frames;
12251         /* Total Number of 2048-4095 Bytes frames transmitted */
12252         uint64_t tx_4096b_9216b_frames;
12253         /* Total Number of 4096-9216 Bytes frames transmitted */
12254         uint64_t tx_9217b_16383b_frames;
12255         /* Total Number of 9217-16383 Bytes frames transmitted */
12256         uint64_t tx_good_frames;
12257         /* Total Number of good frames transmitted */
12258         uint64_t tx_total_frames;
12259         /* Total Number of frames transmitted */
12260         uint64_t tx_ucast_frames;
12261         /* Total number of unicast frames transmitted */
12262         uint64_t tx_mcast_frames;
12263         /* Total number of multicast frames transmitted */
12264         uint64_t tx_bcast_frames;
12265         /* Total number of broadcast frames transmitted */
12266         uint64_t tx_pause_frames;
12267         /* Total number of PAUSE control frames transmitted */
12268         uint64_t tx_pfc_frames;
12269         /* Total number of PFC/per-priority PAUSE control frames transmitted */
12270         uint64_t tx_jabber_frames;
12271         /* Total number of jabber frames transmitted */
12272         uint64_t tx_fcs_err_frames;
12273         /* Total number of frames transmitted with FCS error */
12274         uint64_t tx_control_frames;
12275         /* Total number of control frames transmitted */
12276         uint64_t tx_oversz_frames;
12277         /* Total number of over-sized frames transmitted */
12278         uint64_t tx_single_dfrl_frames;
12279         /* Total number of frames with single deferral */
12280         uint64_t tx_multi_dfrl_frames;
12281         /* Total number of frames with multiple deferrals */
12282         uint64_t tx_single_coll_frames;
12283         /* Total number of frames with single collision */
12284         uint64_t tx_multi_coll_frames;
12285         /* Total number of frames with multiple collisions */
12286         uint64_t tx_late_coll_frames;
12287         /* Total number of frames with late collisions */
12288         uint64_t tx_excessive_coll_frames;
12289         /* Total number of frames with excessive collisions */
12290         uint64_t tx_frag_frames;
12291         /* Total number of fragmented frames transmitted */
12292         uint64_t tx_err;
12293         /* Total number of transmit errors */
12294         uint64_t tx_tagged_frames;
12295         /* Total number of single VLAN tagged frames transmitted */
12296         uint64_t tx_dbl_tagged_frames;
12297         /* Total number of double VLAN tagged frames transmitted */
12298         uint64_t tx_runt_frames;
12299         /* Total number of runt frames transmitted */
12300         uint64_t tx_fifo_underruns;
12301         /* Total number of TX FIFO under runs */
12302         uint64_t tx_pfc_ena_frames_pri0;
12303         /*
12304          * Total number of PFC frames with PFC enabled bit for Pri 0
12305          * transmitted
12306          */
12307         uint64_t tx_pfc_ena_frames_pri1;
12308         /*
12309          * Total number of PFC frames with PFC enabled bit for Pri 1
12310          * transmitted
12311          */
12312         uint64_t tx_pfc_ena_frames_pri2;
12313         /*
12314          * Total number of PFC frames with PFC enabled bit for Pri 2
12315          * transmitted
12316          */
12317         uint64_t tx_pfc_ena_frames_pri3;
12318         /*
12319          * Total number of PFC frames with PFC enabled bit for Pri 3
12320          * transmitted
12321          */
12322         uint64_t tx_pfc_ena_frames_pri4;
12323         /*
12324          * Total number of PFC frames with PFC enabled bit for Pri 4
12325          * transmitted
12326          */
12327         uint64_t tx_pfc_ena_frames_pri5;
12328         /*
12329          * Total number of PFC frames with PFC enabled bit for Pri 5
12330          * transmitted
12331          */
12332         uint64_t tx_pfc_ena_frames_pri6;
12333         /*
12334          * Total number of PFC frames with PFC enabled bit for Pri 6
12335          * transmitted
12336          */
12337         uint64_t tx_pfc_ena_frames_pri7;
12338         /*
12339          * Total number of PFC frames with PFC enabled bit for Pri 7
12340          * transmitted
12341          */
12342         uint64_t tx_eee_lpi_events;
12343         /* Total number of EEE LPI Events on TX */
12344         uint64_t tx_eee_lpi_duration;
12345         /* EEE LPI Duration Counter on TX */
12346         uint64_t tx_llfc_logical_msgs;
12347         /*
12348          * Total number of Link Level Flow Control      (LLFC) messages
12349          * transmitted
12350          */
12351         uint64_t tx_hcfc_msgs;
12352         /* Total number of HCFC messages transmitted */
12353         uint64_t tx_total_collisions;
12354         /* Total number of TX collisions */
12355         uint64_t tx_bytes;
12356         /* Total number of transmitted bytes */
12357         uint64_t tx_xthol_frames;
12358         /* Total number of end-to-end HOL frames */
12359         uint64_t tx_stat_discard;
12360         /* Total Tx Drops per Port reported by STATS block */
12361         uint64_t tx_stat_error;
12362         /* Total Tx Error Drops per Port reported by STATS block */
12363 } __attribute__((packed));
12364
12365 /* Port Rx Statistics Formats   (528 bytes) */
12366 struct rx_port_stats {
12367         uint64_t rx_64b_frames;
12368         /* Total Number of 64 Bytes frames received */
12369         uint64_t rx_65b_127b_frames;
12370         /* Total Number of 65-127 Bytes frames received */
12371         uint64_t rx_128b_255b_frames;
12372         /* Total Number of 128-255 Bytes frames received */
12373         uint64_t rx_256b_511b_frames;
12374         /* Total Number of 256-511 Bytes frames received */
12375         uint64_t rx_512b_1023b_frames;
12376         /* Total Number of 512-1023 Bytes frames received */
12377         uint64_t rx_1024b_1518_frames;
12378         /* Total Number of 1024-1518 Bytes frames received */
12379         uint64_t rx_good_vlan_frames;
12380         /*
12381          * Total Number of each good VLAN       (exludes FCS errors) frame
12382          * received which is 1519 to 1522 bytes in length inclusive
12383          *      (excluding framing bits but including FCS bytes).
12384          */
12385         uint64_t rx_1519b_2047b_frames;
12386         /* Total Number of 1519-2047 Bytes frames received */
12387         uint64_t rx_2048b_4095b_frames;
12388         /* Total Number of 2048-4095 Bytes frames received */
12389         uint64_t rx_4096b_9216b_frames;
12390         /* Total Number of 4096-9216 Bytes frames received */
12391         uint64_t rx_9217b_16383b_frames;
12392         /* Total Number of 9217-16383 Bytes frames received */
12393         uint64_t rx_total_frames;
12394         /* Total number of frames received */
12395         uint64_t rx_ucast_frames;
12396         /* Total number of unicast frames received */
12397         uint64_t rx_mcast_frames;
12398         /* Total number of multicast frames received */
12399         uint64_t rx_bcast_frames;
12400         /* Total number of broadcast frames received */
12401         uint64_t rx_fcs_err_frames;
12402         /* Total number of received frames with FCS error */
12403         uint64_t rx_ctrl_frames;
12404         /* Total number of control frames received */
12405         uint64_t rx_pause_frames;
12406         /* Total number of PAUSE frames received */
12407         uint64_t rx_pfc_frames;
12408         /* Total number of PFC frames received */
12409         uint64_t rx_unsupported_opcode_frames;
12410         /* Total number of frames received with an unsupported opcode */
12411         uint64_t rx_unsupported_da_pausepfc_frames;
12412         /*
12413          * Total number of frames received with an unsupported DA for
12414          * pause and PFC
12415          */
12416         uint64_t rx_wrong_sa_frames;
12417         /* Total number of frames received with an unsupported SA */
12418         uint64_t rx_align_err_frames;
12419         /* Total number of received packets with alignment error */
12420         uint64_t rx_oor_len_frames;
12421         /* Total number of received frames with out-of-range length */
12422         uint64_t rx_code_err_frames;
12423         /* Total number of received frames with error termination */
12424         uint64_t rx_false_carrier_frames;
12425         /*
12426          * Total number of received frames with a false carrier is
12427          * detected during idle, as defined by RX_ER samples active and
12428          * RXD is 0xE. The event is reported along with the statistics
12429          * generated on the next received frame. Only one false carrier
12430          * condition can be detected and logged between frames. Carrier
12431          * event, valid for 10M/100M speed modes only.
12432          */
12433         uint64_t rx_ovrsz_frames;
12434         /* Total number of over-sized frames received */
12435         uint64_t rx_jbr_frames;
12436         /* Total number of jabber packets received */
12437         uint64_t rx_mtu_err_frames;
12438         /* Total number of received frames with MTU error */
12439         uint64_t rx_match_crc_frames;
12440         /* Total number of received frames with CRC match */
12441         uint64_t rx_promiscuous_frames;
12442         /* Total number of frames received promiscuously */
12443         uint64_t rx_tagged_frames;
12444         /* Total number of received frames with one or two VLAN tags */
12445         uint64_t rx_double_tagged_frames;
12446         /* Total number of received frames with two VLAN tags */
12447         uint64_t rx_trunc_frames;
12448         /* Total number of truncated frames received */
12449         uint64_t rx_good_frames;
12450         /* Total number of good frames  (without errors) received */
12451         uint64_t rx_pfc_xon2xoff_frames_pri0;
12452         /*
12453          * Total number of received PFC frames with transition from XON
12454          * to XOFF on Pri 0
12455          */
12456         uint64_t rx_pfc_xon2xoff_frames_pri1;
12457         /*
12458          * Total number of received PFC frames with transition from XON
12459          * to XOFF on Pri 1
12460          */
12461         uint64_t rx_pfc_xon2xoff_frames_pri2;
12462         /*
12463          * Total number of received PFC frames with transition from XON
12464          * to XOFF on Pri 2
12465          */
12466         uint64_t rx_pfc_xon2xoff_frames_pri3;
12467         /*
12468          * Total number of received PFC frames with transition from XON
12469          * to XOFF on Pri 3
12470          */
12471         uint64_t rx_pfc_xon2xoff_frames_pri4;
12472         /*
12473          * Total number of received PFC frames with transition from XON
12474          * to XOFF on Pri 4
12475          */
12476         uint64_t rx_pfc_xon2xoff_frames_pri5;
12477         /*
12478          * Total number of received PFC frames with transition from XON
12479          * to XOFF on Pri 5
12480          */
12481         uint64_t rx_pfc_xon2xoff_frames_pri6;
12482         /*
12483          * Total number of received PFC frames with transition from XON
12484          * to XOFF on Pri 6
12485          */
12486         uint64_t rx_pfc_xon2xoff_frames_pri7;
12487         /*
12488          * Total number of received PFC frames with transition from XON
12489          * to XOFF on Pri 7
12490          */
12491         uint64_t rx_pfc_ena_frames_pri0;
12492         /*
12493          * Total number of received PFC frames with PFC enabled bit for
12494          * Pri 0
12495          */
12496         uint64_t rx_pfc_ena_frames_pri1;
12497         /*
12498          * Total number of received PFC frames with PFC enabled bit for
12499          * Pri 1
12500          */
12501         uint64_t rx_pfc_ena_frames_pri2;
12502         /*
12503          * Total number of received PFC frames with PFC enabled bit for
12504          * Pri 2
12505          */
12506         uint64_t rx_pfc_ena_frames_pri3;
12507         /*
12508          * Total number of received PFC frames with PFC enabled bit for
12509          * Pri 3
12510          */
12511         uint64_t rx_pfc_ena_frames_pri4;
12512         /*
12513          * Total number of received PFC frames with PFC enabled bit for
12514          * Pri 4
12515          */
12516         uint64_t rx_pfc_ena_frames_pri5;
12517         /*
12518          * Total number of received PFC frames with PFC enabled bit for
12519          * Pri 5
12520          */
12521         uint64_t rx_pfc_ena_frames_pri6;
12522         /*
12523          * Total number of received PFC frames with PFC enabled bit for
12524          * Pri 6
12525          */
12526         uint64_t rx_pfc_ena_frames_pri7;
12527         /*
12528          * Total number of received PFC frames with PFC enabled bit for
12529          * Pri 7
12530          */
12531         uint64_t rx_sch_crc_err_frames;
12532         /* Total Number of frames received with SCH CRC error */
12533         uint64_t rx_undrsz_frames;
12534         /* Total Number of under-sized frames received */
12535         uint64_t rx_frag_frames;
12536         /* Total Number of fragmented frames received */
12537         uint64_t rx_eee_lpi_events;
12538         /* Total number of RX EEE LPI Events */
12539         uint64_t rx_eee_lpi_duration;
12540         /* EEE LPI Duration Counter on RX */
12541         uint64_t rx_llfc_physical_msgs;
12542         /*
12543          * Total number of physical type Link Level Flow Control        (LLFC)
12544          * messages received
12545          */
12546         uint64_t rx_llfc_logical_msgs;
12547         /*
12548          * Total number of logical type Link Level Flow Control (LLFC)
12549          * messages received
12550          */
12551         uint64_t rx_llfc_msgs_with_crc_err;
12552         /*
12553          * Total number of logical type Link Level Flow Control (LLFC)
12554          * messages received with CRC error
12555          */
12556         uint64_t rx_hcfc_msgs;
12557         /* Total number of HCFC messages received */
12558         uint64_t rx_hcfc_msgs_with_crc_err;
12559         /* Total number of HCFC messages received with CRC error */
12560         uint64_t rx_bytes;
12561         /* Total number of received bytes */
12562         uint64_t rx_runt_bytes;
12563         /* Total number of bytes received in runt frames */
12564         uint64_t rx_runt_frames;
12565         /* Total number of runt frames received */
12566         uint64_t rx_stat_discard;
12567         /* Total Rx Discards per Port reported by STATS block */
12568         uint64_t rx_stat_err;
12569         /* Total Rx Error Drops per Port reported by STATS block */
12570 } __attribute__((packed));
12571
12572 /* Periodic Statistics Context DMA to host      (160 bytes) */
12573 /*
12574  * per-context HW statistics -- chip view
12575  */
12576
12577 struct ctx_hw_stats64 {
12578         uint64_t rx_ucast_pkts;
12579         uint64_t rx_mcast_pkts;
12580         uint64_t rx_bcast_pkts;
12581         uint64_t rx_drop_pkts;
12582         uint64_t rx_discard_pkts;
12583         uint64_t rx_ucast_bytes;
12584         uint64_t rx_mcast_bytes;
12585         uint64_t rx_bcast_bytes;
12586
12587         uint64_t tx_ucast_pkts;
12588         uint64_t tx_mcast_pkts;
12589         uint64_t tx_bcast_pkts;
12590         uint64_t tx_drop_pkts;
12591         uint64_t tx_discard_pkts;
12592         uint64_t tx_ucast_bytes;
12593         uint64_t tx_mcast_bytes;
12594         uint64_t tx_bcast_bytes;
12595
12596         uint64_t tpa_pkts;
12597         uint64_t tpa_bytes;
12598         uint64_t tpa_events;
12599         uint64_t tpa_aborts;
12600 } __attribute__((packed));
12601
12602 #endif /* _HSI_STRUCT_DEF_DPDK_ */