17a912f18ff05fa878966978a8cd0c0c051f9ade
[dpdk.git] / drivers / net / bnxt / hsi_struct_def_dpdk.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2001-2017 Broadcom Limited.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Broadcom Corporation nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef _HSI_STRUCT_DEF_DPDK_
35 #define _HSI_STRUCT_DEF_DPDK_
36 /* HSI and HWRM Specification 1.7.7 */
37 #define HWRM_VERSION_MAJOR      1
38 #define HWRM_VERSION_MINOR      7
39 #define HWRM_VERSION_UPDATE     7
40
41 #define HWRM_VERSION_STR        "1.7.7"
42 /*
43  * Following is the signature for HWRM message field that indicates not
44  * applicable   (All F's). Need to cast it the size of the field if needed.
45  */
46 #define HWRM_NA_SIGNATURE       ((uint32_t)(-1))
47 #define HWRM_MAX_REQ_LEN        (128)  /* hwrm_func_buf_rgtr */
48 #define HWRM_MAX_RESP_LEN       (248)  /* hwrm_selftest_qlist */
49 #define HW_HASH_INDEX_SIZE       0x80   /* 7 bit indirection table index. */
50 #define HW_HASH_KEY_SIZE        40
51 #define HWRM_RESP_VALID_KEY     1 /* valid key for HWRM response */
52 #define HWRM_ROCE_SP_HSI_VERSION_MAJOR  1
53 #define HWRM_ROCE_SP_HSI_VERSION_MINOR  7
54 #define HWRM_ROCE_SP_HSI_VERSION_UPDATE 4
55
56 /*
57  * Request types
58  */
59 #define HWRM_VER_GET                    (UINT32_C(0x0))
60 #define HWRM_FUNC_BUF_UNRGTR            (UINT32_C(0xe))
61 #define HWRM_FUNC_VF_CFG                (UINT32_C(0xf))
62     /* Reserved for future use */
63 #define RESERVED1                       (UINT32_C(0x10))
64 #define HWRM_FUNC_RESET                 (UINT32_C(0x11))
65 #define HWRM_FUNC_GETFID                (UINT32_C(0x12))
66 #define HWRM_FUNC_VF_ALLOC              (UINT32_C(0x13))
67 #define HWRM_FUNC_VF_FREE               (UINT32_C(0x14))
68 #define HWRM_FUNC_QCAPS                 (UINT32_C(0x15))
69 #define HWRM_FUNC_QCFG                  (UINT32_C(0x16))
70 #define HWRM_FUNC_CFG                   (UINT32_C(0x17))
71 #define HWRM_FUNC_QSTATS                (UINT32_C(0x18))
72 #define HWRM_FUNC_CLR_STATS             (UINT32_C(0x19))
73 #define HWRM_FUNC_DRV_UNRGTR            (UINT32_C(0x1a))
74 #define HWRM_FUNC_VF_RESC_FREE          (UINT32_C(0x1b))
75 #define HWRM_FUNC_VF_VNIC_IDS_QUERY     (UINT32_C(0x1c))
76 #define HWRM_FUNC_DRV_RGTR              (UINT32_C(0x1d))
77 #define HWRM_FUNC_DRV_QVER              (UINT32_C(0x1e))
78 #define HWRM_FUNC_BUF_RGTR              (UINT32_C(0x1f))
79 #define HWRM_PORT_PHY_CFG               (UINT32_C(0x20))
80 #define HWRM_PORT_MAC_CFG               (UINT32_C(0x21))
81 #define HWRM_PORT_QSTATS                (UINT32_C(0x23))
82 #define HWRM_PORT_LPBK_QSTATS           (UINT32_C(0x24))
83 #define HWRM_PORT_CLR_STATS             (UINT32_C(0x25))
84 #define HWRM_PORT_PHY_QCFG              (UINT32_C(0x27))
85 #define HWRM_PORT_MAC_QCFG              (UINT32_C(0x28))
86 #define HWRM_PORT_PHY_QCAPS             (UINT32_C(0x2a))
87 #define HWRM_PORT_LED_CFG               (UINT32_C(0x2d))
88 #define HWRM_PORT_LED_QCFG              (UINT32_C(0x2e))
89 #define HWRM_PORT_LED_QCAPS             (UINT32_C(0x2f))
90 #define HWRM_QUEUE_QPORTCFG             (UINT32_C(0x30))
91 #define HWRM_QUEUE_QCFG                 (UINT32_C(0x31))
92 #define HWRM_QUEUE_CFG                  (UINT32_C(0x32))
93 #define HWRM_FUNC_VLAN_CFG              (UINT32_C(0x33))
94 #define HWRM_FUNC_VLAN_QCFG             (UINT32_C(0x34))
95 #define HWRM_QUEUE_PFCENABLE_QCFG       (UINT32_C(0x35))
96 #define HWRM_QUEUE_PFCENABLE_CFG        (UINT32_C(0x36))
97 #define HWRM_QUEUE_PRI2COS_QCFG         (UINT32_C(0x37))
98 #define HWRM_QUEUE_PRI2COS_CFG          (UINT32_C(0x38))
99 #define HWRM_QUEUE_COS2BW_QCFG          (UINT32_C(0x39))
100 #define HWRM_QUEUE_COS2BW_CFG           (UINT32_C(0x3a))
101 #define HWRM_VNIC_ALLOC                 (UINT32_C(0x40))
102 #define HWRM_VNIC_ALLOC                 (UINT32_C(0x40))
103 #define HWRM_VNIC_FREE                  (UINT32_C(0x41))
104 #define HWRM_VNIC_CFG                   (UINT32_C(0x42))
105 #define HWRM_VNIC_QCFG                  (UINT32_C(0x43))
106 #define HWRM_VNIC_TPA_CFG               (UINT32_C(0x44))
107 #define HWRM_VNIC_RSS_CFG               (UINT32_C(0x46))
108 #define HWRM_VNIC_RSS_QCFG              (UINT32_C(0x47))
109 #define HWRM_VNIC_PLCMODES_CFG          (UINT32_C(0x48))
110 #define HWRM_VNIC_PLCMODES_QCFG         (UINT32_C(0x49))
111 #define HWRM_RING_ALLOC                 (UINT32_C(0x50))
112 #define HWRM_RING_FREE                  (UINT32_C(0x51))
113 #define HWRM_RING_CMPL_RING_CFG_AGGINT_PARAM    (UINT32_C(0x53))
114 #define HWRM_RING_RESET                 (UINT32_C(0x5e))
115 #define HWRM_RING_GRP_ALLOC             (UINT32_C(0x60))
116 #define HWRM_RING_GRP_ALLOC             (UINT32_C(0x60))
117 #define HWRM_RING_GRP_FREE              (UINT32_C(0x61))
118 #define HWRM_VNIC_RSS_COS_LB_CTX_ALLOC  (UINT32_C(0x70))
119 #define HWRM_VNIC_RSS_COS_LB_CTX_FREE   (UINT32_C(0x71))
120 #define HWRM_CFA_L2_FILTER_ALLOC        (UINT32_C(0x90))
121 #define HWRM_CFA_L2_FILTER_FREE         (UINT32_C(0x91))
122 #define HWRM_CFA_L2_FILTER_CFG          (UINT32_C(0x92))
123 #define HWRM_CFA_L2_SET_RX_MASK         (UINT32_C(0x93))
124     /* Reserved for future use */
125 #define RESERVED4                       (UINT32_C(0x94))
126 #define HWRM_CFA_TUNNEL_FILTER_ALLOC    (UINT32_C(0x95))
127 #define HWRM_CFA_TUNNEL_FILTER_FREE     (UINT32_C(0x96))
128 #define HWRM_CFA_NTUPLE_FILTER_ALLOC    (UINT32_C(0x99))
129 #define HWRM_CFA_NTUPLE_FILTER_FREE     (UINT32_C(0x9a))
130 #define HWRM_CFA_NTUPLE_FILTER_CFG      (UINT32_C(0x9b))
131 #define HWRM_TUNNEL_DST_PORT_QUERY      (UINT32_C(0xa0))
132 #define HWRM_TUNNEL_DST_PORT_ALLOC      (UINT32_C(0xa1))
133 #define HWRM_TUNNEL_DST_PORT_FREE       (UINT32_C(0xa2))
134 #define HWRM_STAT_CTX_ALLOC             (UINT32_C(0xb0))
135 #define HWRM_STAT_CTX_FREE              (UINT32_C(0xb1))
136 #define HWRM_STAT_CTX_QUERY             (UINT32_C(0xb2))
137 #define HWRM_STAT_CTX_CLR_STATS         (UINT32_C(0xb3))
138 #define HWRM_EXEC_FWD_RESP              (UINT32_C(0xd0))
139 #define HWRM_REJECT_FWD_RESP            (UINT32_C(0xd1))
140 #define HWRM_FWD_RESP                   (UINT32_C(0xd2))
141 #define HWRM_FWD_ASYNC_EVENT_CMPL       (UINT32_C(0xd3))
142 #define HWRM_TEMP_MONITOR_QUERY         (UINT32_C(0xe0))
143 #define HWRM_WOL_FILTER_ALLOC           (UINT32_C(0xf0))
144 #define HWRM_WOL_FILTER_FREE            (UINT32_C(0xf1))
145 #define HWRM_WOL_FILTER_QCFG            (UINT32_C(0xf2))
146 #define HWRM_WOL_REASON_QCFG            (UINT32_C(0xf3))
147 #define HWRM_DBG_DUMP                   (UINT32_C(0xff14))
148 #define HWRM_NVM_VALIDATE_OPTION        (UINT32_C(0xffef))
149 #define HWRM_NVM_FLUSH                  (UINT32_C(0xfff0))
150 #define HWRM_NVM_GET_VARIABLE           (UINT32_C(0xfff1))
151 #define HWRM_NVM_SET_VARIABLE           (UINT32_C(0xfff2))
152 #define HWRM_NVM_INSTALL_UPDATE         (UINT32_C(0xfff3))
153 #define HWRM_NVM_MODIFY                 (UINT32_C(0xfff4))
154 #define HWRM_NVM_VERIFY_UPDATE          (UINT32_C(0xfff5))
155 #define HWRM_NVM_GET_DEV_INFO           (UINT32_C(0xfff6))
156 #define HWRM_NVM_ERASE_DIR_ENTRY        (UINT32_C(0xfff7))
157 #define HWRM_NVM_MOD_DIR_ENTRY          (UINT32_C(0xfff8))
158 #define HWRM_NVM_FIND_DIR_ENTRY         (UINT32_C(0xfff9))
159 #define HWRM_NVM_GET_DIR_ENTRIES        (UINT32_C(0xfffa))
160 #define HWRM_NVM_GET_DIR_INFO           (UINT32_C(0xfffb))
161 #define HWRM_NVM_RAW_DUMP               (UINT32_C(0xfffc))
162 #define HWRM_NVM_READ                   (UINT32_C(0xfffd))
163 #define HWRM_NVM_WRITE                  (UINT32_C(0xfffe))
164 #define HWRM_NVM_RAW_WRITE_BLK          (UINT32_C(0xffff))
165
166 /*
167  * Note: The Host Software Interface (HSI) and Hardware Resource Manager (HWRM)
168  * specification describes the data structures used in Ethernet packet or RDMA
169  * message data transfers as well as an abstract interface for managing Ethernet
170  * NIC hardware resources.
171  */
172 /* Ethernet Data path Host Structures */
173 /*
174  * Description: The following three sections document the host structures used
175  * between device and software drivers for communicating Ethernet packets.
176  */
177 /* BD Ring Structures */
178 /*
179  * Description: This structure is used to inform the NIC of a location for and
180  * an aggregation buffer that will be used for packet data that is received. An
181  * aggregation buffer creates a different kind of completion operation for a
182  * packet where a variable number of BDs may be used to place the packet in the
183  * host. RX Rings that have aggregation buffers are known as aggregation rings
184  * and must contain only aggregation buffers.
185  */
186 /* Short TX BD  (16 bytes) */
187 struct tx_bd_short {
188         uint16_t flags_type;
189         /*
190          * All bits in this field must be valid on the first BD of a
191          * packet. Only the packet_end bit must be valid for the
192          * remaining BDs of a packet.
193          */
194         /* This value identifies the type of buffer descriptor. */
195         #define TX_BD_SHORT_TYPE_MASK   UINT32_C(0x3f)
196         #define TX_BD_SHORT_TYPE_SFT    0
197         /*
198          * Indicates that this BD is 16B long and is
199          * used for normal L2 packet transmission.
200          */
201         #define TX_BD_SHORT_TYPE_TX_BD_SHORT    UINT32_C(0x0)
202         /*
203          * If set to 1, the packet ends with the data in the buffer
204          * pointed to by this descriptor. This flag must be valid on
205          * every BD.
206          */
207         #define TX_BD_SHORT_FLAGS_PACKET_END    UINT32_C(0x40)
208         /*
209          * If set to 1, the device will not generate a completion for
210          * this transmit packet unless there is an error in it's
211          * processing. If this bit is set to 0, then the packet will be
212          * completed normally. This bit must be valid only on the first
213          * BD of a packet.
214          */
215         #define TX_BD_SHORT_FLAGS_NO_CMPL       UINT32_C(0x80)
216         /*
217          * This value indicates how many 16B BD locations are consumed
218          * in the ring by this packet. A value of 1 indicates that this
219          * BD is the only BD    (and that the it is a short BD). A value of
220          * 3 indicates either 3 short BDs or 1 long BD and one short BD
221          * in the packet. A value of 0 indicates that there are 32 BD
222          * locations in the packet      (the maximum). This field is valid
223          * only on the first BD of a packet.
224          */
225         #define TX_BD_SHORT_FLAGS_BD_CNT_MASK   UINT32_C(0x1f00)
226         #define TX_BD_SHORT_FLAGS_BD_CNT_SFT    8
227         /*
228          * This value is a hint for the length of the entire packet. It
229          * is used by the chip to optimize internal processing. The
230          * packet will be dropped if the hint is too short. This field
231          * is valid only on the first BD of a packet.
232          */
233         #define TX_BD_SHORT_FLAGS_LHINT_MASK    UINT32_C(0x6000)
234         #define TX_BD_SHORT_FLAGS_LHINT_SFT     13
235         /* indicates packet length < 512B */
236         #define TX_BD_SHORT_FLAGS_LHINT_LT512   (UINT32_C(0x0) << 13)
237         /* indicates 512 <= packet length < 1KB */
238         #define TX_BD_SHORT_FLAGS_LHINT_LT1K    (UINT32_C(0x1) << 13)
239         /* indicates 1KB <= packet length < 2KB */
240         #define TX_BD_SHORT_FLAGS_LHINT_LT2K    (UINT32_C(0x2) << 13)
241         /* indicates packet length >= 2KB */
242         #define TX_BD_SHORT_FLAGS_LHINT_GTE2K   (UINT32_C(0x3) << 13)
243         #define TX_BD_SHORT_FLAGS_LHINT_LAST \
244                 TX_BD_SHORT_FLAGS_LHINT_GTE2K
245         /*
246          * If set to 1, the device immediately updates the Send Consumer
247          * Index after the buffer associated with this descriptor has
248          * been transferred via DMA to NIC memory from host memory. An
249          * interrupt may or may not be generated according to the state
250          * of the interrupt avoidance mechanisms. If this bit is set to
251          * 0, then the Consumer Index is only updated as soon as one of
252          * the host interrupt coalescing conditions has been met. This
253          * bit must be valid on the first BD of a packet.
254          */
255         #define TX_BD_SHORT_FLAGS_COAL_NOW      UINT32_C(0x8000)
256         /*
257          * All bits in this field must be valid on the first BD of a
258          * packet. Only the packet_end bit must be valid for the
259          * remaining BDs of a packet.
260          */
261         #define TX_BD_SHORT_FLAGS_MASK  UINT32_C(0xffc0)
262         #define TX_BD_SHORT_FLAGS_SFT   6
263         uint16_t len;
264         /*
265          * This is the length of the host physical buffer this BD
266          * describes in bytes. This field must be valid on all BDs of a
267          * packet.
268          */
269         uint32_t opaque;
270         /*
271          * The opaque data field is pass through to the completion and
272          * can be used for any data that the driver wants to associate
273          * with the transmit BD. This field must be valid on the first
274          * BD of a packet.
275          */
276         uint64_t addr;
277         /*
278          * This is the host physical address for the portion of the
279          * packet described by this TX BD. This value must be valid on
280          * all BDs of a packet.
281          */
282 } __attribute__((packed));
283
284 /* Long TX BD   (32 bytes split to 2 16-byte struct) */
285 struct tx_bd_long {
286         uint16_t flags_type;
287         /*
288          * All bits in this field must be valid on the first BD of a
289          * packet. Only the packet_end bit must be valid for the
290          * remaining BDs of a packet.
291          */
292         /* This value identifies the type of buffer descriptor. */
293         #define TX_BD_LONG_TYPE_MASK    UINT32_C(0x3f)
294         #define TX_BD_LONG_TYPE_SFT     0
295         /*
296          * Indicates that this BD is 32B long and is
297          * used for normal L2 packet transmission.
298          */
299         #define TX_BD_LONG_TYPE_TX_BD_LONG      UINT32_C(0x10)
300         /*
301          * If set to 1, the packet ends with the data in the buffer
302          * pointed to by this descriptor. This flag must be valid on
303          * every BD.
304          */
305         #define TX_BD_LONG_FLAGS_PACKET_END     UINT32_C(0x40)
306         /*
307          * If set to 1, the device will not generate a completion for
308          * this transmit packet unless there is an error in it's
309          * processing. If this bit is set to 0, then the packet will be
310          * completed normally. This bit must be valid only on the first
311          * BD of a packet.
312          */
313         #define TX_BD_LONG_FLAGS_NO_CMPL        UINT32_C(0x80)
314         /*
315          * This value indicates how many 16B BD locations are consumed
316          * in the ring by this packet. A value of 1 indicates that this
317          * BD is the only BD    (and that the it is a short BD). A value of
318          * 3 indicates either 3 short BDs or 1 long BD and one short BD
319          * in the packet. A value of 0 indicates that there are 32 BD
320          * locations in the packet      (the maximum). This field is valid
321          * only on the first BD of a packet.
322          */
323         #define TX_BD_LONG_FLAGS_BD_CNT_MASK    UINT32_C(0x1f00)
324         #define TX_BD_LONG_FLAGS_BD_CNT_SFT     8
325         /*
326          * This value is a hint for the length of the entire packet. It
327          * is used by the chip to optimize internal processing. The
328          * packet will be dropped if the hint is too short. This field
329          * is valid only on the first BD of a packet.
330          */
331         #define TX_BD_LONG_FLAGS_LHINT_MASK     UINT32_C(0x6000)
332         #define TX_BD_LONG_FLAGS_LHINT_SFT      13
333         /* indicates packet length < 512B */
334         #define TX_BD_LONG_FLAGS_LHINT_LT512    (UINT32_C(0x0) << 13)
335         /* indicates 512 <= packet length < 1KB */
336         #define TX_BD_LONG_FLAGS_LHINT_LT1K     (UINT32_C(0x1) << 13)
337         /* indicates 1KB <= packet length < 2KB */
338         #define TX_BD_LONG_FLAGS_LHINT_LT2K     (UINT32_C(0x2) << 13)
339         /* indicates packet length >= 2KB */
340         #define TX_BD_LONG_FLAGS_LHINT_GTE2K    (UINT32_C(0x3) << 13)
341         #define TX_BD_LONG_FLAGS_LHINT_LAST \
342                 TX_BD_LONG_FLAGS_LHINT_GTE2K
343         /*
344          * If set to 1, the device immediately updates the Send Consumer
345          * Index after the buffer associated with this descriptor has
346          * been transferred via DMA to NIC memory from host memory. An
347          * interrupt may or may not be generated according to the state
348          * of the interrupt avoidance mechanisms. If this bit is set to
349          * 0, then the Consumer Index is only updated as soon as one of
350          * the host interrupt coalescing conditions has been met. This
351          * bit must be valid on the first BD of a packet.
352          */
353         #define TX_BD_LONG_FLAGS_COAL_NOW       UINT32_C(0x8000)
354         /*
355          * All bits in this field must be valid on the first BD of a
356          * packet. Only the packet_end bit must be valid for the
357          * remaining BDs of a packet.
358          */
359         #define TX_BD_LONG_FLAGS_MASK   UINT32_C(0xffc0)
360         #define TX_BD_LONG_FLAGS_SFT    6
361         uint16_t len;
362         /*
363          * This is the length of the host physical buffer this BD
364          * describes in bytes. This field must be valid on all BDs of a
365          * packet.
366          */
367         uint32_t opaque;
368         /*
369          * The opaque data field is pass through to the completion and
370          * can be used for any data that the driver wants to associate
371          * with the transmit BD. This field must be valid on the first
372          * BD of a packet.
373          */
374         uint64_t addr;
375         /*
376          * This is the host physical address for the portion of the
377          * packet described by this TX BD. This value must be valid on
378          * all BDs of a packet.
379          */
380 } __attribute__((packed));
381
382 /* last 16 bytes of Long TX BD */
383 struct tx_bd_long_hi {
384         uint16_t lflags;
385         /*
386          * All bits in this field must be valid on the first BD of a
387          * packet. Their value on other BDs of the packet will be
388          * ignored.
389          */
390         /*
391          * If set to 1, the controller replaces the TCP/UPD checksum
392          * fields of normal TCP/UPD checksum, or the inner TCP/UDP
393          * checksum field of the encapsulated TCP/UDP packets with the
394          * hardware calculated TCP/UDP checksum for the packet
395          * associated with this descriptor. The flag is ignored if the
396          * LSO flag is set. This bit must be valid on the first BD of a
397          * packet.
398          */
399         #define TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM        UINT32_C(0x1)
400         /*
401          * If set to 1, the controller replaces the IP checksum of the
402          * normal packets, or the inner IP checksum of the encapsulated
403          * packets with the hardware calculated IP checksum for the
404          * packet associated with this descriptor. This bit must be
405          * valid on the first BD of a packet.
406          */
407         #define TX_BD_LONG_LFLAGS_IP_CHKSUM     UINT32_C(0x2)
408         /*
409          * If set to 1, the controller will not append an Ethernet CRC
410          * to the end of the frame. This bit must be valid on the first
411          * BD of a packet. Packet must be 64B or longer when this flag
412          * is set. It is not useful to use this bit with any form of TX
413          * offload such as CSO or LSO. The intent is that the packet
414          * from the host already has a valid Ethernet CRC on the packet.
415          */
416         #define TX_BD_LONG_LFLAGS_NOCRC UINT32_C(0x4)
417         /*
418          * If set to 1, the device will record the time at which the
419          * packet was actually transmitted at the TX MAC. This bit must
420          * be valid on the first BD of a packet.
421          */
422         #define TX_BD_LONG_LFLAGS_STAMP UINT32_C(0x8)
423         /*
424          * If set to 1, The controller replaces the tunnel IP checksum
425          * field with hardware calculated IP checksum for the IP header
426          * of the packet associated with this descriptor. For outer UDP
427          * checksum, global outer UDP checksum TE_NIC register needs to
428          * be enabled. If the global outer UDP checksum TE_NIC register
429          * bit is set, outer UDP checksum will be calculated for the
430          * following cases: 1. Packets with tcp_udp_chksum flag set to
431          * offload checksum for inner packet AND the inner packet is
432          * TCP/UDP. If the inner packet is ICMP for example     (non-
433          * TCP/UDP), even if the tcp_udp_chksum is set, the outer UDP
434          * checksum will not be calculated. 2. Packets with lso flag set
435          * which implies inner TCP checksum calculation as part of LSO
436          * operation.
437          */
438         #define TX_BD_LONG_LFLAGS_T_IP_CHKSUM   UINT32_C(0x10)
439         /*
440          * If set to 1, the device will treat this packet with LSO(Large
441          * Send Offload) processing for both normal or encapsulated
442          * packets, which is a form of TCP segmentation. When this bit
443          * is 1, the hdr_size and mss fields must be valid. The driver
444          * doesn't need to set t_ip_chksum, ip_chksum, and
445          * tcp_udp_chksum flags since the controller will replace the
446          * appropriate checksum fields for segmented packets. When this
447          * bit is 1, the hdr_size and mss fields must be valid.
448          */
449         #define TX_BD_LONG_LFLAGS_LSO   UINT32_C(0x20)
450         /*
451          * If set to zero when LSO is '1', then the IPID will be treated
452          * as a 16b number and will be wrapped if it exceeds a value of
453          * 0xffff. If set to one when LSO is '1', then the IPID will be
454          * treated as a 15b number and will be wrapped if it exceeds a
455          * value 0f 0x7fff.
456          */
457         #define TX_BD_LONG_LFLAGS_IPID_FMT      UINT32_C(0x40)
458         /*
459          * If set to zero when LSO is '1', then the IPID of the tunnel
460          * IP header will not be modified during LSO operations. If set
461          * to one when LSO is '1', then the IPID of the tunnel IP header
462          * will be incremented for each subsequent segment of an LSO
463          * operation. The flag is ignored if the LSO packet is a normal
464          *      (non-tunneled) TCP packet.
465          */
466         #define TX_BD_LONG_LFLAGS_T_IPID        UINT32_C(0x80)
467         /*
468          * If set to '1', then the RoCE ICRC will be appended to the
469          * packet. Packet must be a valid RoCE format packet.
470          */
471         #define TX_BD_LONG_LFLAGS_ROCE_CRC      UINT32_C(0x100)
472         /*
473          * If set to '1', then the FCoE CRC will be appended to the
474          * packet. Packet must be a valid FCoE format packet.
475          */
476         #define TX_BD_LONG_LFLAGS_FCOE_CRC      UINT32_C(0x200)
477         uint16_t hdr_size;
478         /*
479          * When LSO is '1', this field must contain the offset of the
480          * TCP payload from the beginning of the packet in as 16b words.
481          * In case of encapsulated/tunneling packet, this field contains
482          * the offset of the inner TCP payload from beginning of the
483          * packet as 16-bit words. This value must be valid on the first
484          * BD of a packet.
485          */
486         #define TX_BD_LONG_HDR_SIZE_MASK        UINT32_C(0x1ff)
487         #define TX_BD_LONG_HDR_SIZE_SFT 0
488         uint32_t mss;
489         /*
490          * This is the MSS value that will be used to do the LSO
491          * processing. The value is the length in bytes of the TCP
492          * payload for each segment generated by the LSO operation. This
493          * value must be valid on the first BD of a packet.
494          */
495         #define TX_BD_LONG_MSS_MASK     UINT32_C(0x7fff)
496         #define TX_BD_LONG_MSS_SFT      0
497         uint16_t unused_2;
498         uint16_t cfa_action;
499         /*
500          * This value selects a CFA action to perform on the packet. Set
501          * this value to zero if no CFA action is desired. This value
502          * must be valid on the first BD of a packet.
503          */
504         uint32_t cfa_meta;
505         /*
506          * This value is action meta-data that defines CFA edit
507          * operations that are done in addition to any action editing.
508          */
509         /* When key=1, This is the VLAN tag VID value. */
510         #define TX_BD_LONG_CFA_META_VLAN_VID_MASK       UINT32_C(0xfff)
511         #define TX_BD_LONG_CFA_META_VLAN_VID_SFT        0
512         /* When key=1, This is the VLAN tag DE value. */
513         #define TX_BD_LONG_CFA_META_VLAN_DE     UINT32_C(0x1000)
514         /* When key=1, This is the VLAN tag PRI value. */
515         #define TX_BD_LONG_CFA_META_VLAN_PRI_MASK       UINT32_C(0xe000)
516         #define TX_BD_LONG_CFA_META_VLAN_PRI_SFT        13
517         /* When key=1, This is the VLAN tag TPID select value. */
518         #define TX_BD_LONG_CFA_META_VLAN_TPID_MASK      UINT32_C(0x70000)
519         #define TX_BD_LONG_CFA_META_VLAN_TPID_SFT       16
520         /* 0x88a8 */
521         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID88A8  (UINT32_C(0x0) << 16)
522         /* 0x8100 */
523         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100  (UINT32_C(0x1) << 16)
524         /* 0x9100 */
525         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9100  (UINT32_C(0x2) << 16)
526         /* 0x9200 */
527         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9200  (UINT32_C(0x3) << 16)
528         /* 0x9300 */
529         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9300  (UINT32_C(0x4) << 16)
530         /* Value programmed in CFA VLANTPID register. */
531         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPIDCFG   (UINT32_C(0x5) << 16)
532         #define TX_BD_LONG_CFA_META_VLAN_TPID_LAST \
533                 TX_BD_LONG_CFA_META_VLAN_TPID_TPIDCFG
534         /* When key=1, This is the VLAN tag TPID select value. */
535         #define TX_BD_LONG_CFA_META_VLAN_RESERVED_MASK  UINT32_C(0xff80000)
536         #define TX_BD_LONG_CFA_META_VLAN_RESERVED_SFT   19
537         /*
538          * This field identifies the type of edit to be performed on the
539          * packet. This value must be valid on the first BD of a packet.
540          */
541         #define TX_BD_LONG_CFA_META_KEY_MASK    UINT32_C(0xf0000000)
542         #define TX_BD_LONG_CFA_META_KEY_SFT     28
543         /* No editing */
544         #define TX_BD_LONG_CFA_META_KEY_NONE    (UINT32_C(0x0) << 28)
545         /*
546          * - meta[17:16] - TPID select value    (0 =
547          * 0x8100). - meta[15:12] - PRI/DE value. -
548          * meta[11:0] - VID value.
549          */
550         #define TX_BD_LONG_CFA_META_KEY_VLAN_TAG        (UINT32_C(0x1) << 28)
551         #define TX_BD_LONG_CFA_META_KEY_LAST \
552                 TX_BD_LONG_CFA_META_KEY_VLAN_TAG
553 } __attribute__((packed));
554
555 /* RX Producer Packet BD        (16 bytes) */
556 struct rx_prod_pkt_bd {
557         uint16_t flags_type;
558         /* This value identifies the type of buffer descriptor. */
559         #define RX_PROD_PKT_BD_TYPE_MASK        UINT32_C(0x3f)
560         #define RX_PROD_PKT_BD_TYPE_SFT 0
561         /*
562          * Indicates that this BD is 16B long and is an
563          * RX Producer  (ie. empty) buffer descriptor.
564          */
565         #define RX_PROD_PKT_BD_TYPE_RX_PROD_PKT UINT32_C(0x4)
566         /*
567          * If set to 1, the packet will be placed at the address plus
568          * 2B. The 2 Bytes of padding will be written as zero.
569          */
570         /*
571          * This is intended to be used when the host buffer is cache-
572          * line aligned to produce packets that are easy to parse in
573          * host memory while still allowing writes to be cache line
574          * aligned.
575          */
576         #define RX_PROD_PKT_BD_FLAGS_SOP_PAD    UINT32_C(0x40)
577         /*
578          * If set to 1, the packet write will be padded out to the
579          * nearest cache-line with zero value padding.
580          */
581         /*
582          * If receive buffers start/end on cache-line boundaries, this
583          * feature will ensure that all data writes on the PCI bus
584          * start/end on cache line boundaries.
585          */
586         #define RX_PROD_PKT_BD_FLAGS_EOP_PAD    UINT32_C(0x80)
587         /*
588          * This value is the number of additional buffers in the ring
589          * that describe the buffer space to be consumed for the this
590          * packet. If the value is zero, then the packet must fit within
591          * the space described by this BD. If this value is 1 or more,
592          * it indicates how many additional "buffer" BDs are in the ring
593          * immediately following this BD to be used for the same network
594          * packet. Even if the packet to be placed does not need all the
595          * additional buffers, they will be consumed anyway.
596          */
597         #define RX_PROD_PKT_BD_FLAGS_BUFFERS_MASK       UINT32_C(0x300)
598         #define RX_PROD_PKT_BD_FLAGS_BUFFERS_SFT        8
599         #define RX_PROD_PKT_BD_FLAGS_MASK       UINT32_C(0xffc0)
600         #define RX_PROD_PKT_BD_FLAGS_SFT        6
601         uint16_t len;
602         /*
603          * This is the length in Bytes of the host physical buffer where
604          * data for the packet may be placed in host memory.
605          */
606         /*
607          * While this is a Byte resolution value, it is often
608          * advantageous to ensure that the buffers provided end on a
609          * host cache line.
610          */
611         uint32_t opaque;
612         /*
613          * The opaque data field is pass through to the completion and
614          * can be used for any data that the driver wants to associate
615          * with this receive buffer set.
616          */
617         uint64_t addr;
618         /*
619          * This is the host physical address where data for the packet
620          * may by placed in host memory.
621          */
622         /*
623          * While this is a Byte resolution value, it is often
624          * advantageous to ensure that the buffers provide start on a
625          * host cache line.
626          */
627 } __attribute__((packed));
628
629 /* Completion Ring Structures */
630 /* Note: This structure is used by the HWRM to communicate HWRM Error. */
631 /* Base Completion Record       (16 bytes) */
632 struct cmpl_base {
633         uint16_t type;
634         /* unused is 10 b */
635         /*
636          * This field indicates the exact type of the completion. By
637          * convention, the LSB identifies the length of the record in
638          * 16B units. Even values indicate 16B records. Odd values
639          * indicate 32B records.
640          */
641         #define CMPL_BASE_TYPE_MASK     UINT32_C(0x3f)
642         #define CMPL_BASE_TYPE_SFT      0
643         /* TX L2 completion: Completion of TX packet. Length = 16B */
644         #define CMPL_BASE_TYPE_TX_L2    UINT32_C(0x0)
645         /*
646          * RX L2 completion: Completion of and L2 RX
647          * packet. Length = 32B
648          */
649         #define CMPL_BASE_TYPE_RX_L2    UINT32_C(0x11)
650         /*
651          * RX Aggregation Buffer completion : Completion
652          * of an L2 aggregation buffer in support of
653          * TPA, HDS, or Jumbo packet completion. Length
654          * = 16B
655          */
656         #define CMPL_BASE_TYPE_RX_AGG   UINT32_C(0x12)
657         /*
658          * RX L2 TPA Start Completion: Completion at the
659          * beginning of a TPA operation. Length = 32B
660          */
661         #define CMPL_BASE_TYPE_RX_TPA_START     UINT32_C(0x13)
662         /*
663          * RX L2 TPA End Completion: Completion at the
664          * end of a TPA operation. Length = 32B
665          */
666         #define CMPL_BASE_TYPE_RX_TPA_END       UINT32_C(0x15)
667         /*
668          * Statistics Ejection Completion: Completion of
669          * statistics data ejection buffer. Length = 16B
670          */
671         #define CMPL_BASE_TYPE_STAT_EJECT       UINT32_C(0x1a)
672         /* HWRM Command Completion: Completion of an HWRM command. */
673         #define CMPL_BASE_TYPE_HWRM_DONE        UINT32_C(0x20)
674         /* Forwarded HWRM Request */
675         #define CMPL_BASE_TYPE_HWRM_FWD_REQ     UINT32_C(0x22)
676         /* Forwarded HWRM Response */
677         #define CMPL_BASE_TYPE_HWRM_FWD_RESP    UINT32_C(0x24)
678         /* HWRM Asynchronous Event Information */
679         #define CMPL_BASE_TYPE_HWRM_ASYNC_EVENT UINT32_C(0x2e)
680         /* CQ Notification */
681         #define CMPL_BASE_TYPE_CQ_NOTIFICATION  UINT32_C(0x30)
682         /* SRQ Threshold Event */
683         #define CMPL_BASE_TYPE_SRQ_EVENT        UINT32_C(0x32)
684         /* DBQ Threshold Event */
685         #define CMPL_BASE_TYPE_DBQ_EVENT        UINT32_C(0x34)
686         /* QP Async Notification */
687         #define CMPL_BASE_TYPE_QP_EVENT UINT32_C(0x38)
688         /* Function Async Notification */
689         #define CMPL_BASE_TYPE_FUNC_EVENT       UINT32_C(0x3a)
690         /* unused is 10 b */
691         uint16_t info1;
692         /* info1 is 16 b */
693         uint32_t info2;
694         /* info2 is 32 b */
695         uint32_t info3_v;
696         /* info3 is 31 b */
697         /*
698          * This value is written by the NIC such that it will be
699          * different for each pass through the completion queue. The
700          * even passes will write 1. The odd passes will write 0.
701          */
702         #define CMPL_BASE_V     UINT32_C(0x1)
703         /* info3 is 31 b */
704         #define CMPL_BASE_INFO3_MASK    UINT32_C(0xfffffffe)
705         #define CMPL_BASE_INFO3_SFT     1
706         uint32_t info4;
707         /* info4 is 32 b */
708 } __attribute__((packed));
709
710 /* TX Completion Record (16 bytes) */
711 struct tx_cmpl {
712         uint16_t flags_type;
713         /*
714          * This field indicates the exact type of the completion. By
715          * convention, the LSB identifies the length of the record in
716          * 16B units. Even values indicate 16B records. Odd values
717          * indicate 32B records.
718          */
719         #define TX_CMPL_TYPE_MASK       UINT32_C(0x3f)
720         #define TX_CMPL_TYPE_SFT        0
721         /* TX L2 completion: Completion of TX packet. Length = 16B */
722         #define TX_CMPL_TYPE_TX_L2      UINT32_C(0x0)
723         /*
724          * When this bit is '1', it indicates a packet that has an error
725          * of some type. Type of error is indicated in error_flags.
726          */
727         #define TX_CMPL_FLAGS_ERROR     UINT32_C(0x40)
728         /*
729          * When this bit is '1', it indicates that the packet completed
730          * was transmitted using the push acceleration data provided by
731          * the driver. When this bit is '0', it indicates that the
732          * packet had not push acceleration data written or was executed
733          * as a normal packet even though push data was provided.
734          */
735         #define TX_CMPL_FLAGS_PUSH      UINT32_C(0x80)
736         #define TX_CMPL_FLAGS_MASK      UINT32_C(0xffc0)
737         #define TX_CMPL_FLAGS_SFT       6
738         uint16_t unused_0;
739         /* unused1 is 16 b */
740         uint32_t opaque;
741         /*
742          * This is a copy of the opaque field from the first TX BD of
743          * this transmitted packet.
744          */
745         uint16_t errors_v;
746         /*
747          * This value is written by the NIC such that it will be
748          * different for each pass through the completion queue. The
749          * even passes will write 1. The odd passes will write 0.
750          */
751         #define TX_CMPL_V       UINT32_C(0x1)
752         /*
753          * This error indicates that there was some sort of problem with
754          * the BDs for the packet.
755          */
756         #define TX_CMPL_ERRORS_BUFFER_ERROR_MASK        UINT32_C(0xe)
757         #define TX_CMPL_ERRORS_BUFFER_ERROR_SFT 1
758         /* No error */
759         #define TX_CMPL_ERRORS_BUFFER_ERROR_NO_ERROR    (UINT32_C(0x0) << 1)
760         /* Bad Format: BDs were not formatted correctly. */
761         #define TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT     (UINT32_C(0x2) << 1)
762         #define TX_CMPL_ERRORS_BUFFER_ERROR_LAST \
763                 TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT
764         /*
765          * When this bit is '1', it indicates that the length of the
766          * packet was zero. No packet was transmitted.
767          */
768         #define TX_CMPL_ERRORS_ZERO_LENGTH_PKT  UINT32_C(0x10)
769         /*
770          * When this bit is '1', it indicates that the packet was longer
771          * than the programmed limit in TDI. No packet was transmitted.
772          */
773         #define TX_CMPL_ERRORS_EXCESSIVE_BD_LENGTH      UINT32_C(0x20)
774         /*
775          * When this bit is '1', it indicates that one or more of the
776          * BDs associated with this packet generated a PCI error. This
777          * probably means the address was not valid.
778          */
779         #define TX_CMPL_ERRORS_DMA_ERROR        UINT32_C(0x40)
780         /*
781          * When this bit is '1', it indicates that the packet was longer
782          * than indicated by the hint. No packet was transmitted.
783          */
784         #define TX_CMPL_ERRORS_HINT_TOO_SHORT   UINT32_C(0x80)
785         /*
786          * When this bit is '1', it indicates that the packet was
787          * dropped due to Poison TLP error on one or more of the TLPs in
788          * the PXP completion.
789          */
790         #define TX_CMPL_ERRORS_POISON_TLP_ERROR UINT32_C(0x100)
791         #define TX_CMPL_ERRORS_MASK     UINT32_C(0xfffe)
792         #define TX_CMPL_ERRORS_SFT      1
793         uint16_t unused_1;
794         /* unused2 is 16 b */
795         uint32_t unused_2;
796         /* unused3 is 32 b */
797 } __attribute__((packed));
798
799 /* RX Packet Completion Record  (32 bytes split to 2 16-byte struct) */
800 struct rx_pkt_cmpl {
801         uint16_t flags_type;
802         /*
803          * This field indicates the exact type of the completion. By
804          * convention, the LSB identifies the length of the record in
805          * 16B units. Even values indicate 16B records. Odd values
806          * indicate 32B records.
807          */
808         #define RX_PKT_CMPL_TYPE_MASK   UINT32_C(0x3f)
809         #define RX_PKT_CMPL_TYPE_SFT    0
810         /*
811          * RX L2 completion: Completion of and L2 RX
812          * packet. Length = 32B
813          */
814         #define RX_PKT_CMPL_TYPE_RX_L2                  UINT32_C(0x11)
815         #define RX_PKT_CMPL_TYPE_RX_L2_TPA_START        UINT32_C(0x13)
816         #define RX_PKT_CMPL_TYPE_RX_L2_TPA_END          UINT32_C(0x15)
817         /*
818          * When this bit is '1', it indicates a packet that has an error
819          * of some type. Type of error is indicated in error_flags.
820          */
821         #define RX_PKT_CMPL_FLAGS_ERROR UINT32_C(0x40)
822         /* This field indicates how the packet was placed in the buffer. */
823         #define RX_PKT_CMPL_FLAGS_PLACEMENT_MASK        UINT32_C(0x380)
824         #define RX_PKT_CMPL_FLAGS_PLACEMENT_SFT 7
825         /* Normal: Packet was placed using normal algorithm. */
826         #define RX_PKT_CMPL_FLAGS_PLACEMENT_NORMAL      (UINT32_C(0x0) << 7)
827         /* Jumbo: Packet was placed using jumbo algorithm. */
828         #define RX_PKT_CMPL_FLAGS_PLACEMENT_JUMBO       (UINT32_C(0x1) << 7)
829         /*
830          * Header/Data Separation: Packet was placed
831          * using Header/Data separation algorithm. The
832          * separation location is indicated by the itype
833          * field.
834          */
835         #define RX_PKT_CMPL_FLAGS_PLACEMENT_HDS (UINT32_C(0x2) << 7)
836         #define RX_PKT_CMPL_FLAGS_PLACEMENT_LAST \
837                 RX_PKT_CMPL_FLAGS_PLACEMENT_HDS
838         /* This bit is '1' if the RSS field in this completion is valid. */
839         #define RX_PKT_CMPL_FLAGS_RSS_VALID     UINT32_C(0x400)
840         /* unused is 1 b */
841         #define RX_PKT_CMPL_FLAGS_UNUSED        UINT32_C(0x800)
842         /*
843          * This value indicates what the inner packet determined for the
844          * packet was.
845          */
846         #define RX_PKT_CMPL_FLAGS_ITYPE_MASK    UINT32_C(0xf000)
847         #define RX_PKT_CMPL_FLAGS_ITYPE_SFT     12
848         /* Not Known: Indicates that the packet type was not known. */
849         #define RX_PKT_CMPL_FLAGS_ITYPE_NOT_KNOWN       (UINT32_C(0x0) << 12)
850         /*
851          * IP Packet: Indicates that the packet was an
852          * IP packet, but further classification was not
853          * possible.
854          */
855         #define RX_PKT_CMPL_FLAGS_ITYPE_IP      (UINT32_C(0x1) << 12)
856         /*
857          * TCP Packet: Indicates that the packet was IP
858          * and TCP. This indicates that the
859          * payload_offset field is valid.
860          */
861         #define RX_PKT_CMPL_FLAGS_ITYPE_TCP     (UINT32_C(0x2) << 12)
862         /*
863          * UDP Packet: Indicates that the packet was IP
864          * and UDP. This indicates that the
865          * payload_offset field is valid.
866          */
867         #define RX_PKT_CMPL_FLAGS_ITYPE_UDP     (UINT32_C(0x3) << 12)
868         /*
869          * FCoE Packet: Indicates that the packet was
870          * recognized as a FCoE. This also indicates
871          * that the payload_offset field is valid.
872          */
873         #define RX_PKT_CMPL_FLAGS_ITYPE_FCOE    (UINT32_C(0x4) << 12)
874         /*
875          * RoCE Packet: Indicates that the packet was
876          * recognized as a RoCE. This also indicates
877          * that the payload_offset field is valid.
878          */
879         #define RX_PKT_CMPL_FLAGS_ITYPE_ROCE    (UINT32_C(0x5) << 12)
880         /*
881          * ICMP Packet: Indicates that the packet was
882          * recognized as ICMP. This indicates that the
883          * payload_offset field is valid.
884          */
885         #define RX_PKT_CMPL_FLAGS_ITYPE_ICMP    (UINT32_C(0x7) << 12)
886         /*
887          * PtP packet wo/timestamp: Indicates that the
888          * packet was recognized as a PtP packet.
889          */
890         #define RX_PKT_CMPL_FLAGS_ITYPE_PTP_WO_TIMESTAMP        (UINT32_C(0x8) << 12)
891         /*
892          * PtP packet w/timestamp: Indicates that the
893          * packet was recognized as a PtP packet and
894          * that a timestamp was taken for the packet.
895          */
896         #define RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP (UINT32_C(0x9) << 12)
897         #define RX_PKT_CMPL_FLAGS_ITYPE_LAST \
898                 RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP
899         #define RX_PKT_CMPL_FLAGS_MASK  UINT32_C(0xffc0)
900         #define RX_PKT_CMPL_FLAGS_SFT   6
901         uint16_t len;
902         /*
903          * This is the length of the data for the packet stored in the
904          * buffer(s) identified by the opaque value. This includes the
905          * packet BD and any associated buffer BDs. This does not
906          * include the the length of any data places in aggregation BDs.
907          */
908         uint32_t opaque;
909         /*
910          * This is a copy of the opaque field from the RX BD this
911          * completion corresponds to.
912          */
913         uint8_t agg_bufs_v1;
914         /* unused1 is 2 b */
915         /*
916          * This value is written by the NIC such that it will be
917          * different for each pass through the completion queue. The
918          * even passes will write 1. The odd passes will write 0.
919          */
920         #define RX_PKT_CMPL_V1  UINT32_C(0x1)
921         /*
922          * This value is the number of aggregation buffers that follow
923          * this entry in the completion ring that are a part of this
924          * packet. If the value is zero, then the packet is completely
925          * contained in the buffer space provided for the packet in the
926          * RX ring.
927          */
928         #define RX_PKT_CMPL_AGG_BUFS_MASK       UINT32_C(0x3e)
929         #define RX_PKT_CMPL_AGG_BUFS_SFT        1
930         /* unused1 is 2 b */
931         uint8_t rss_hash_type;
932         /*
933          * This is the RSS hash type for the packet. The value is packed
934          * {tuple_extrac_op[1:0],rss_profile_id[4:0],tuple_extrac_op[2]}
935          * . The value of tuple_extrac_op provides the information about
936          * what fields the hash was computed on. * 0: The RSS hash was
937          * computed over source IP address, destination IP address,
938          * source port, and destination port of inner IP and TCP or UDP
939          * headers. Note: For non-tunneled packets, the packet headers
940          * are considered inner packet headers for the RSS hash
941          * computation purpose. * 1: The RSS hash was computed over
942          * source IP address and destination IP address of inner IP
943          * header. Note: For non-tunneled packets, the packet headers
944          * are considered inner packet headers for the RSS hash
945          * computation purpose. * 2: The RSS hash was computed over
946          * source IP address, destination IP address, source port, and
947          * destination port of IP and TCP or UDP headers of outer tunnel
948          * headers. Note: For non-tunneled packets, this value is not
949          * applicable. * 3: The RSS hash was computed over source IP
950          * address and destination IP address of IP header of outer
951          * tunnel headers. Note: For non-tunneled packets, this value is
952          * not applicable. Note that 4-tuples values listed above are
953          * applicable for layer 4 protocols supported and enabled for
954          * RSS in the hardware, HWRM firmware, and drivers. For example,
955          * if RSS hash is supported and enabled for TCP traffic only,
956          * then the values of tuple_extract_op corresponding to 4-tuples
957          * are only valid for TCP traffic.
958          */
959         uint8_t payload_offset;
960         /*
961          * This value indicates the offset in bytes from the beginning
962          * of the packet where the inner payload starts. This value is
963          * valid for TCP, UDP, FCoE, and RoCE packets. A value of zero
964          * indicates that header is 256B into the packet.
965          */
966         uint8_t unused_1;
967         /* unused2 is 8 b */
968         uint32_t rss_hash;
969         /*
970          * This value is the RSS hash value calculated for the packet
971          * based on the mode bits and key value in the VNIC.
972          */
973 } __attribute__((packed));
974
975 /* last 16 bytes of RX Packet Completion Record */
976 struct rx_pkt_cmpl_hi {
977         uint32_t flags2;
978         /*
979          * This indicates that the ip checksum was calculated for the
980          * inner packet and that the ip_cs_error field indicates if
981          * there was an error.
982          */
983         #define RX_PKT_CMPL_FLAGS2_IP_CS_CALC   UINT32_C(0x1)
984         /*
985          * This indicates that the TCP, UDP or ICMP checksum was
986          * calculated for the inner packet and that the l4_cs_error
987          * field indicates if there was an error.
988          */
989         #define RX_PKT_CMPL_FLAGS2_L4_CS_CALC   UINT32_C(0x2)
990         /*
991          * This indicates that the ip checksum was calculated for the
992          * tunnel header and that the t_ip_cs_error field indicates if
993          * there was an error.
994          */
995         #define RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC UINT32_C(0x4)
996         /*
997          * This indicates that the UDP checksum was calculated for the
998          * tunnel packet and that the t_l4_cs_error field indicates if
999          * there was an error.
1000          */
1001         #define RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC UINT32_C(0x8)
1002         /* This value indicates what format the metadata field is. */
1003         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_MASK     UINT32_C(0xf0)
1004         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_SFT      4
1005         /* No metadata informtaion. Value is zero. */
1006         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_NONE     (UINT32_C(0x0) << 4)
1007         /*
1008          * The metadata field contains the VLAN tag and
1009          * TPID value. - metadata[11:0] contains the
1010          * vlan VID value. - metadata[12] contains the
1011          * vlan DE value. - metadata[15:13] contains the
1012          * vlan PRI value. - metadata[31:16] contains
1013          * the vlan TPID value.
1014          */
1015         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN     (UINT32_C(0x1) << 4)
1016         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_LAST \
1017                 RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN
1018         /*
1019          * This field indicates the IP type for the inner-most IP
1020          * header. A value of '0' indicates IPv4. A value of '1'
1021          * indicates IPv6. This value is only valid if itype indicates a
1022          * packet with an IP header.
1023          */
1024         #define RX_PKT_CMPL_FLAGS2_IP_TYPE      UINT32_C(0x100)
1025         uint32_t metadata;
1026         /*
1027          * This is data from the CFA block as indicated by the
1028          * meta_format field.
1029          */
1030         /* When meta_format=1, this value is the VLAN VID. */
1031         #define RX_PKT_CMPL_METADATA_VID_MASK   UINT32_C(0xfff)
1032         #define RX_PKT_CMPL_METADATA_VID_SFT    0
1033         /* When meta_format=1, this value is the VLAN DE. */
1034         #define RX_PKT_CMPL_METADATA_DE UINT32_C(0x1000)
1035         /* When meta_format=1, this value is the VLAN PRI. */
1036         #define RX_PKT_CMPL_METADATA_PRI_MASK   UINT32_C(0xe000)
1037         #define RX_PKT_CMPL_METADATA_PRI_SFT    13
1038         /* When meta_format=1, this value is the VLAN TPID. */
1039         #define RX_PKT_CMPL_METADATA_TPID_MASK  UINT32_C(0xffff0000)
1040         #define RX_PKT_CMPL_METADATA_TPID_SFT   16
1041         uint16_t errors_v2;
1042         /*
1043          * This value is written by the NIC such that it will be
1044          * different for each pass through the completion queue. The
1045          * even passes will write 1. The odd passes will write 0.
1046          */
1047         #define RX_PKT_CMPL_V2  UINT32_C(0x1)
1048         /*
1049          * This error indicates that there was some sort of problem with
1050          * the BDs for the packet that was found after part of the
1051          * packet was already placed. The packet should be treated as
1052          * invalid.
1053          */
1054         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_MASK    UINT32_C(0xe)
1055         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_SFT     1
1056         /* No buffer error */
1057         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_NO_BUFFER       (UINT32_C(0x0) << 1)
1058         /*
1059          * Did Not Fit: Packet did not fit into packet
1060          * buffer provided. For regular placement, this
1061          * means the packet did not fit in the buffer
1062          * provided. For HDS and jumbo placement, this
1063          * means that the packet could not be placed
1064          * into 7 physical buffers or less.
1065          */
1066         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_DID_NOT_FIT \
1067                 (UINT32_C(0x1) << 1)
1068         /*
1069          * Not On Chip: All BDs needed for the packet
1070          * were not on-chip when the packet arrived.
1071          */
1072         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_NOT_ON_CHIP \
1073                 (UINT32_C(0x2) << 1)
1074         /* Bad Format: BDs were not formatted correctly. */
1075         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT \
1076                 (UINT32_C(0x3) << 1)
1077         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_LAST \
1078                 RX_PKT_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT
1079         /* This indicates that there was an error in the IP header checksum. */
1080         #define RX_PKT_CMPL_ERRORS_IP_CS_ERROR  UINT32_C(0x10)
1081         /*
1082          * This indicates that there was an error in the TCP, UDP or
1083          * ICMP checksum.
1084          */
1085         #define RX_PKT_CMPL_ERRORS_L4_CS_ERROR  UINT32_C(0x20)
1086         /*
1087          * This indicates that there was an error in the tunnel IP
1088          * header checksum.
1089          */
1090         #define RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR        UINT32_C(0x40)
1091         /*
1092          * This indicates that there was an error in the tunnel UDP
1093          * checksum.
1094          */
1095         #define RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR        UINT32_C(0x80)
1096         /*
1097          * This indicates that there was a CRC error on either an FCoE
1098          * or RoCE packet. The itype indicates the packet type.
1099          */
1100         #define RX_PKT_CMPL_ERRORS_CRC_ERROR    UINT32_C(0x100)
1101         /*
1102          * This indicates that there was an error in the tunnel portion
1103          * of the packet when this field is non-zero.
1104          */
1105         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_MASK     UINT32_C(0xe00)
1106         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_SFT      9
1107         /*
1108          * No additional error occurred on the tunnel
1109          * portion of the packet of the packet does not
1110          * have a tunnel.
1111          */
1112         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_NO_ERROR (UINT32_C(0x0) << 9)
1113         /*
1114          * Indicates that IP header version does not
1115          * match expectation from L2 Ethertype for IPv4
1116          * and IPv6 in the tunnel header.
1117          */
1118         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_VERSION \
1119                 (UINT32_C(0x1) << 9)
1120         /*
1121          * Indicates that header length is out of range
1122          * in the tunnel header. Valid for IPv4.
1123          */
1124         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_HDR_LEN \
1125                 (UINT32_C(0x2) << 9)
1126         /*
1127          * Indicates that the physical packet is shorter
1128          * than that claimed by the PPPoE header length
1129          * for a tunnel PPPoE packet.
1130          */
1131         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_TUNNEL_TOTAL_ERROR \
1132                 (UINT32_C(0x3) << 9)
1133         /*
1134          * Indicates that physical packet is shorter
1135          * than that claimed by the tunnel l3 header
1136          * length. Valid for IPv4, or IPv6 tunnel packet
1137          * packets.
1138          */
1139         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_IP_TOTAL_ERROR \
1140                 (UINT32_C(0x4) << 9)
1141         /*
1142          * Indicates that the physical packet is shorter
1143          * than that claimed by the tunnel UDP header
1144          * length for a tunnel UDP packet that is not
1145          * fragmented.
1146          */
1147         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_UDP_TOTAL_ERROR \
1148                 (UINT32_C(0x5) << 9)
1149         /*
1150          * indicates that the IPv4 TTL or IPv6 hop limit
1151          * check have failed    (e.g. TTL = 0) in the
1152          * tunnel header. Valid for IPv4, and IPv6.
1153          */
1154         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL \
1155                 (UINT32_C(0x6) << 9)
1156         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_LAST \
1157                 RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL
1158         /*
1159          * This indicates that there was an error in the inner portion
1160          * of the packet when this field is non-zero.
1161          */
1162         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_MASK       UINT32_C(0xf000)
1163         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_SFT        12
1164         /*
1165          * No additional error occurred on the tunnel
1166          * portion of the packet of the packet does not
1167          * have a tunnel.
1168          */
1169         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_NO_ERROR   (UINT32_C(0x0) << 12)
1170         /*
1171          * Indicates that IP header version does not
1172          * match expectation from L2 Ethertype for IPv4
1173          * and IPv6 or that option other than VFT was
1174          * parsed on FCoE packet.
1175          */
1176         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_VERSION \
1177                 (UINT32_C(0x1) << 12)
1178         /*
1179          * indicates that header length is out of range.
1180          * Valid for IPv4 and RoCE
1181          */
1182         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_HDR_LEN \
1183                 (UINT32_C(0x2) << 12)
1184         /*
1185          * indicates that the IPv4 TTL or IPv6 hop limit
1186          * check have failed    (e.g. TTL = 0). Valid for
1187          * IPv4, and IPv6
1188          */
1189         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_TTL (UINT32_C(0x3) << 12)
1190         /*
1191          * Indicates that physical packet is shorter
1192          * than that claimed by the l3 header length.
1193          * Valid for IPv4, IPv6 packet or RoCE packets.
1194          */
1195         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_IP_TOTAL_ERROR \
1196                 (UINT32_C(0x4) << 12)
1197         /*
1198          * Indicates that the physical packet is shorter
1199          * than that claimed by the UDP header length
1200          * for a UDP packet that is not fragmented.
1201          */
1202         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_UDP_TOTAL_ERROR \
1203                 (UINT32_C(0x5) << 12)
1204         /*
1205          * Indicates that TCP header length > IP
1206          * payload. Valid for TCP packets only.
1207          */
1208         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN \
1209                 (UINT32_C(0x6) << 12)
1210         /* Indicates that TCP header length < 5. Valid for TCP. */
1211         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN_TOO_SMALL \
1212                 (UINT32_C(0x7) << 12)
1213         /*
1214          * Indicates that TCP option headers result in a
1215          * TCP header size that does not match data
1216          * offset in TCP header. Valid for TCP.
1217          */
1218         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN \
1219                 (UINT32_C(0x8) << 12)
1220         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_LAST \
1221                 RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN
1222         #define RX_PKT_CMPL_ERRORS_MASK UINT32_C(0xfffe)
1223         #define RX_PKT_CMPL_ERRORS_SFT  1
1224         uint16_t cfa_code;
1225         /*
1226          * This field identifies the CFA action rule that was used for
1227          * this packet.
1228          */
1229         uint32_t reorder;
1230         /*
1231          * This value holds the reordering sequence number for the
1232          * packet. If the reordering sequence is not valid, then this
1233          * value is zero. The reordering domain for the packet is in the
1234          * bottom 8 to 10b of the rss_hash value. The bottom 20b of this
1235          * value contain the ordering domain value for the packet.
1236          */
1237         #define RX_PKT_CMPL_REORDER_MASK        UINT32_C(0xffffff)
1238         #define RX_PKT_CMPL_REORDER_SFT 0
1239 } __attribute__((packed));
1240
1241 /* RX L2 TPA Start Completion Record (32 bytes split to 2 16-byte struct) */
1242 struct rx_tpa_start_cmpl {
1243         uint16_t flags_type;
1244         /*
1245          * This field indicates the exact type of the completion. By
1246          * convention, the LSB identifies the length of the record in
1247          * 16B units. Even values indicate 16B records. Odd values
1248          * indicate 32B records.
1249          */
1250         #define RX_TPA_START_CMPL_TYPE_MASK     UINT32_C(0x3f)
1251         #define RX_TPA_START_CMPL_TYPE_SFT      0
1252         /*
1253          * RX L2 TPA Start Completion: Completion at the
1254          * beginning of a TPA operation. Length = 32B
1255          */
1256         #define RX_TPA_START_CMPL_TYPE_RX_TPA_START     UINT32_C(0x13)
1257         /* This bit will always be '0' for TPA start completions. */
1258         #define RX_TPA_START_CMPL_FLAGS_ERROR   UINT32_C(0x40)
1259         /* This field indicates how the packet was placed in the buffer. */
1260         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_MASK  UINT32_C(0x380)
1261         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_SFT   7
1262         /*
1263          * Jumbo: TPA Packet was placed using jumbo
1264          * algorithm. This means that the first buffer
1265          * will be filled with data before moving to
1266          * aggregation buffers. Each aggregation buffer
1267          * will be filled before moving to the next
1268          * aggregation buffer.
1269          */
1270         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_JUMBO (UINT32_C(0x1) << 7)
1271         /*
1272          * Header/Data Separation: Packet was placed
1273          * using Header/Data separation algorithm. The
1274          * separation location is indicated by the itype
1275          * field.
1276          */
1277         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_HDS   (UINT32_C(0x2) << 7)
1278         /*
1279          * GRO/Jumbo: Packet will be placed using
1280          * GRO/Jumbo where the first packet is filled
1281          * with data. Subsequent packets will be placed
1282          * such that any one packet does not span two
1283          * aggregation buffers unless it starts at the
1284          * beginning of an aggregation buffer.
1285          */
1286         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_GRO_JUMBO \
1287                 (UINT32_C(0x5) << 7)
1288         /*
1289          * GRO/Header-Data Separation: Packet will be
1290          * placed using GRO/HDS where the header is in
1291          * the first packet. Payload of each packet will
1292          * be placed such that any one packet does not
1293          * span two aggregation buffers unless it starts
1294          * at the beginning of an aggregation buffer.
1295          */
1296         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_GRO_HDS (UINT32_C(0x6) << 7)
1297         #define RX_TPA_START_CMPL_FLAGS_PLACEMENT_LAST \
1298                 RX_TPA_START_CMPL_FLAGS_PLACEMENT_GRO_HDS
1299         /* This bit is '1' if the RSS field in this completion is valid. */
1300         #define RX_TPA_START_CMPL_FLAGS_RSS_VALID       UINT32_C(0x400)
1301         /* unused is 1 b */
1302         #define RX_TPA_START_CMPL_FLAGS_UNUSED  UINT32_C(0x800)
1303         /*
1304          * This value indicates what the inner packet determined for the
1305          * packet was.
1306          */
1307         #define RX_TPA_START_CMPL_FLAGS_ITYPE_MASK      UINT32_C(0xf000)
1308         #define RX_TPA_START_CMPL_FLAGS_ITYPE_SFT       12
1309         /* TCP Packet: Indicates that the packet was IP and TCP. */
1310         #define RX_TPA_START_CMPL_FLAGS_ITYPE_TCP       (UINT32_C(0x2) << 12)
1311         #define RX_TPA_START_CMPL_FLAGS_ITYPE_LAST \
1312                 RX_TPA_START_CMPL_FLAGS_ITYPE_TCP
1313         #define RX_TPA_START_CMPL_FLAGS_MASK    UINT32_C(0xffc0)
1314         #define RX_TPA_START_CMPL_FLAGS_SFT     6
1315         uint16_t len;
1316         /*
1317          * This value indicates the amount of packet data written to the
1318          * buffer the opaque field in this completion corresponds to.
1319          */
1320         uint32_t opaque;
1321         /*
1322          * This is a copy of the opaque field from the RX BD this
1323          * completion corresponds to.
1324          */
1325         uint8_t v1;
1326         /* unused1 is 7 b */
1327         /*
1328          * This value is written by the NIC such that it will be
1329          * different for each pass through the completion queue. The
1330          * even passes will write 1. The odd passes will write 0.
1331          */
1332         #define RX_TPA_START_CMPL_V1    UINT32_C(0x1)
1333         /* unused1 is 7 b */
1334         uint8_t rss_hash_type;
1335         /*
1336          * This is the RSS hash type for the packet. The value is packed
1337          * {tuple_extrac_op[1:0],rss_profile_id[4:0],tuple_extrac_op[2]}
1338          * . The value of tuple_extrac_op provides the information about
1339          * what fields the hash was computed on. * 0: The RSS hash was
1340          * computed over source IP address, destination IP address,
1341          * source port, and destination port of inner IP and TCP or UDP
1342          * headers. Note: For non-tunneled packets, the packet headers
1343          * are considered inner packet headers for the RSS hash
1344          * computation purpose. * 1: The RSS hash was computed over
1345          * source IP address and destination IP address of inner IP
1346          * header. Note: For non-tunneled packets, the packet headers
1347          * are considered inner packet headers for the RSS hash
1348          * computation purpose. * 2: The RSS hash was computed over
1349          * source IP address, destination IP address, source port, and
1350          * destination port of IP and TCP or UDP headers of outer tunnel
1351          * headers. Note: For non-tunneled packets, this value is not
1352          * applicable. * 3: The RSS hash was computed over source IP
1353          * address and destination IP address of IP header of outer
1354          * tunnel headers. Note: For non-tunneled packets, this value is
1355          * not applicable. Note that 4-tuples values listed above are
1356          * applicable for layer 4 protocols supported and enabled for
1357          * RSS in the hardware, HWRM firmware, and drivers. For example,
1358          * if RSS hash is supported and enabled for TCP traffic only,
1359          * then the values of tuple_extract_op corresponding to 4-tuples
1360          * are only valid for TCP traffic.
1361          */
1362         uint16_t agg_id;
1363         /*
1364          * This is the aggregation ID that the completion is associated
1365          * with. Use this number to correlate the TPA start completion
1366          * with the TPA end completion.
1367          */
1368         /* unused2 is 9 b */
1369         /*
1370          * This is the aggregation ID that the completion is associated
1371          * with. Use this number to correlate the TPA start completion
1372          * with the TPA end completion.
1373          */
1374         #define RX_TPA_START_CMPL_AGG_ID_MASK   UINT32_C(0xfe00)
1375         #define RX_TPA_START_CMPL_AGG_ID_SFT    9
1376         uint32_t rss_hash;
1377         /*
1378          * This value is the RSS hash value calculated for the packet
1379          * based on the mode bits and key value in the VNIC.
1380          */
1381 } __attribute__((packed));
1382
1383 /* last 16 bytes of RX L2 TPA Start Completion Record */
1384 struct rx_tpa_start_cmpl_hi {
1385         uint32_t flags2;
1386         /*
1387          * This indicates that the ip checksum was calculated for the
1388          * inner packet and that the sum passed for all segments
1389          * included in the aggregation.
1390          */
1391         #define RX_TPA_START_CMPL_FLAGS2_IP_CS_CALC     UINT32_C(0x1)
1392         /*
1393          * This indicates that the TCP, UDP or ICMP checksum was
1394          * calculated for the inner packet and that the sum passed for
1395          * all segments included in the aggregation.
1396          */
1397         #define RX_TPA_START_CMPL_FLAGS2_L4_CS_CALC     UINT32_C(0x2)
1398         /*
1399          * This indicates that the ip checksum was calculated for the
1400          * tunnel header and that the sum passed for all segments
1401          * included in the aggregation.
1402          */
1403         #define RX_TPA_START_CMPL_FLAGS2_T_IP_CS_CALC   UINT32_C(0x4)
1404         /*
1405          * This indicates that the UDP checksum was calculated for the
1406          * tunnel packet and that the sum passed for all segments
1407          * included in the aggregation.
1408          */
1409         #define RX_TPA_START_CMPL_FLAGS2_T_L4_CS_CALC   UINT32_C(0x8)
1410         /* This value indicates what format the metadata field is. */
1411         #define RX_TPA_START_CMPL_FLAGS2_META_FORMAT_MASK UINT32_C(0xf0)
1412         #define RX_TPA_START_CMPL_FLAGS2_META_FORMAT_SFT        4
1413         /* No metadata informtaion. Value is zero. */
1414         #define RX_TPA_START_CMPL_FLAGS2_META_FORMAT_NONE (UINT32_C(0x0) << 4)
1415         /*
1416          * The metadata field contains the VLAN tag and
1417          * TPID value. - metadata[11:0] contains the
1418          * vlan VID value. - metadata[12] contains the
1419          * vlan DE value. - metadata[15:13] contains the
1420          * vlan PRI value. - metadata[31:16] contains
1421          * the vlan TPID value.
1422          */
1423         #define RX_TPA_START_CMPL_FLAGS2_META_FORMAT_VLAN (UINT32_C(0x1) << 4)
1424         #define RX_TPA_START_CMPL_FLAGS2_META_FORMAT_LAST \
1425                 RX_TPA_START_CMPL_FLAGS2_META_FORMAT_VLAN
1426         /*
1427          * This field indicates the IP type for the inner-most IP
1428          * header. A value of '0' indicates IPv4. A value of '1'
1429          * indicates IPv6.
1430          */
1431         #define RX_TPA_START_CMPL_FLAGS2_IP_TYPE        UINT32_C(0x100)
1432         uint32_t metadata;
1433         /*
1434          * This is data from the CFA block as indicated by the
1435          * meta_format field.
1436          */
1437         /* When meta_format=1, this value is the VLAN VID. */
1438         #define RX_TPA_START_CMPL_METADATA_VID_MASK     UINT32_C(0xfff)
1439         #define RX_TPA_START_CMPL_METADATA_VID_SFT      0
1440         /* When meta_format=1, this value is the VLAN DE. */
1441         #define RX_TPA_START_CMPL_METADATA_DE   UINT32_C(0x1000)
1442         /* When meta_format=1, this value is the VLAN PRI. */
1443         #define RX_TPA_START_CMPL_METADATA_PRI_MASK UINT32_C(0xe000)
1444         #define RX_TPA_START_CMPL_METADATA_PRI_SFT      13
1445         /* When meta_format=1, this value is the VLAN TPID. */
1446         #define RX_TPA_START_CMPL_METADATA_TPID_MASK    UINT32_C(0xffff0000)
1447         #define RX_TPA_START_CMPL_METADATA_TPID_SFT     16
1448         uint16_t v2;
1449         /* unused4 is 15 b */
1450         /*
1451          * This value is written by the NIC such that it will be
1452          * different for each pass through the completion queue. The
1453          * even passes will write 1. The odd passes will write 0.
1454          */
1455         #define RX_TPA_START_CMPL_V2    UINT32_C(0x1)
1456         /* unused4 is 15 b */
1457         uint16_t cfa_code;
1458         /*
1459          * This field identifies the CFA action rule that was used for
1460          * this packet.
1461          */
1462         uint32_t inner_l4_size_inner_l3_offset_inner_l2_offset_outer_l3_offset;
1463         /*
1464          * This is the size in bytes of the inner most L4 header. This
1465          * can be subtracted from the payload_offset to determine the
1466          * start of the inner most L4 header.
1467          */
1468         /*
1469          * This is the offset from the beginning of the packet in bytes
1470          * for the outer L3 header. If there is no outer L3 header, then
1471          * this value is zero.
1472          */
1473         #define RX_TPA_START_CMPL_OUTER_L3_OFFSET_MASK  UINT32_C(0x1ff)
1474         #define RX_TPA_START_CMPL_OUTER_L3_OFFSET_SFT   0
1475         /*
1476          * This is the offset from the beginning of the packet in bytes
1477          * for the inner most L2 header.
1478          */
1479         #define RX_TPA_START_CMPL_INNER_L2_OFFSET_MASK  UINT32_C(0x3fe00)
1480         #define RX_TPA_START_CMPL_INNER_L2_OFFSET_SFT   9
1481         /*
1482          * This is the offset from the beginning of the packet in bytes
1483          * for the inner most L3 header.
1484          */
1485         #define RX_TPA_START_CMPL_INNER_L3_OFFSET_MASK  UINT32_C(0x7fc0000)
1486         #define RX_TPA_START_CMPL_INNER_L3_OFFSET_SFT   18
1487         /*
1488          * This is the size in bytes of the inner most L4 header. This
1489          * can be subtracted from the payload_offset to determine the
1490          * start of the inner most L4 header.
1491          */
1492         #define RX_TPA_START_CMPL_INNER_L4_SIZE_MASK    UINT32_C(0xf8000000)
1493         #define RX_TPA_START_CMPL_INNER_L4_SIZE_SFT     27
1494 } __attribute__((packed));
1495
1496 /* RX TPA End Completion Record (32 bytes split to 2 16-byte struct) */
1497 struct rx_tpa_end_cmpl {
1498         uint16_t flags_type;
1499         /*
1500          * This field indicates the exact type of the completion. By
1501          * convention, the LSB identifies the length of the record in
1502          * 16B units. Even values indicate 16B records. Odd values
1503          * indicate 32B records.
1504          */
1505         #define RX_TPA_END_CMPL_TYPE_MASK       UINT32_C(0x3f)
1506         #define RX_TPA_END_CMPL_TYPE_SFT        0
1507         /*
1508          * RX L2 TPA End Completion: Completion at the
1509          * end of a TPA operation. Length = 32B
1510          */
1511         #define RX_TPA_END_CMPL_TYPE_RX_TPA_END UINT32_C(0x15)
1512         /*
1513          * When this bit is '1', it indicates a packet that has an error
1514          * of some type. Type of error is indicated in error_flags.
1515          */
1516         #define RX_TPA_END_CMPL_FLAGS_ERROR     UINT32_C(0x40)
1517         /* This field indicates how the packet was placed in the buffer. */
1518         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_MASK    UINT32_C(0x380)
1519         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_SFT     7
1520         /*
1521          * Jumbo: TPA Packet was placed using jumbo
1522          * algorithm. This means that the first buffer
1523          * will be filled with data before moving to
1524          * aggregation buffers. Each aggregation buffer
1525          * will be filled before moving to the next
1526          * aggregation buffer.
1527          */
1528         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_JUMBO   (UINT32_C(0x1) << 7)
1529         /*
1530          * Header/Data Separation: Packet was placed
1531          * using Header/Data separation algorithm. The
1532          * separation location is indicated by the itype
1533          * field.
1534          */
1535         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_HDS     (UINT32_C(0x2) << 7)
1536         /*
1537          * GRO/Jumbo: Packet will be placed using
1538          * GRO/Jumbo where the first packet is filled
1539          * with data. Subsequent packets will be placed
1540          * such that any one packet does not span two
1541          * aggregation buffers unless it starts at the
1542          * beginning of an aggregation buffer.
1543          */
1544         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_GRO_JUMBO (UINT32_C(0x5) << 7)
1545         /*
1546          * GRO/Header-Data Separation: Packet will be
1547          * placed using GRO/HDS where the header is in
1548          * the first packet. Payload of each packet will
1549          * be placed such that any one packet does not
1550          * span two aggregation buffers unless it starts
1551          * at the beginning of an aggregation buffer.
1552          */
1553         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_GRO_HDS (UINT32_C(0x6) << 7)
1554         #define RX_TPA_END_CMPL_FLAGS_PLACEMENT_LAST \
1555                 RX_TPA_END_CMPL_FLAGS_PLACEMENT_GRO_HDS
1556         /* unused is 2 b */
1557         #define RX_TPA_END_CMPL_FLAGS_UNUSED_MASK       UINT32_C(0xc00)
1558         #define RX_TPA_END_CMPL_FLAGS_UNUSED_SFT        10
1559         /*
1560          * This value indicates what the inner packet determined for the
1561          * packet was. - 2 TCP Packet Indicates that the packet was IP
1562          * and TCP. This indicates that the ip_cs field is valid and
1563          * that the tcp_udp_cs field is valid and contains the TCP
1564          * checksum. This also indicates that the payload_offset field
1565          * is valid.
1566          */
1567         #define RX_TPA_END_CMPL_FLAGS_ITYPE_MASK        UINT32_C(0xf000)
1568         #define RX_TPA_END_CMPL_FLAGS_ITYPE_SFT 12
1569         #define RX_TPA_END_CMPL_FLAGS_MASK      UINT32_C(0xffc0)
1570         #define RX_TPA_END_CMPL_FLAGS_SFT       6
1571         uint16_t len;
1572         /*
1573          * This value is zero for TPA End completions. There is no data
1574          * in the buffer that corresponds to the opaque value in this
1575          * completion.
1576          */
1577         uint32_t opaque;
1578         /*
1579          * This is a copy of the opaque field from the RX BD this
1580          * completion corresponds to.
1581          */
1582         uint8_t agg_bufs_v1;
1583         /* unused1 is 1 b */
1584         /*
1585          * This value is written by the NIC such that it will be
1586          * different for each pass through the completion queue. The
1587          * even passes will write 1. The odd passes will write 0.
1588          */
1589         #define RX_TPA_END_CMPL_V1      UINT32_C(0x1)
1590         /*
1591          * This value is the number of aggregation buffers that follow
1592          * this entry in the completion ring that are a part of this
1593          * aggregation packet. If the value is zero, then the packet is
1594          * completely contained in the buffer space provided in the
1595          * aggregation start completion.
1596          */
1597         #define RX_TPA_END_CMPL_AGG_BUFS_MASK   UINT32_C(0x7e)
1598         #define RX_TPA_END_CMPL_AGG_BUFS_SFT    1
1599         /* unused1 is 1 b */
1600         uint8_t tpa_segs;
1601         /* This value is the number of segments in the TPA operation. */
1602         uint8_t payload_offset;
1603         /*
1604          * This value indicates the offset in bytes from the beginning
1605          * of the packet where the inner payload starts. This value is
1606          * valid for TCP, UDP, FCoE, and RoCE packets. A value of zero
1607          * indicates an offset of 256 bytes.
1608          */
1609         uint8_t agg_id;
1610         /*
1611          * This is the aggregation ID that the completion is associated
1612          * with. Use this number to correlate the TPA start completion
1613          * with the TPA end completion.
1614          */
1615         /* unused2 is 1 b */
1616         /*
1617          * This is the aggregation ID that the completion is associated
1618          * with. Use this number to correlate the TPA start completion
1619          * with the TPA end completion.
1620          */
1621         #define RX_TPA_END_CMPL_AGG_ID_MASK     UINT32_C(0xfe)
1622         #define RX_TPA_END_CMPL_AGG_ID_SFT      1
1623         uint32_t tsdelta;
1624         /*
1625          * For non-GRO packets, this value is the timestamp delta
1626          * between earliest and latest timestamp values for TPA packet.
1627          * If packets were not time stamped, then delta will be zero.
1628          * For GRO packets, this field is zero except for the following
1629          * sub-fields. - tsdelta[31] Timestamp present indication. When
1630          * '0', no Timestamp option is in the packet. When '1', then a
1631          * Timestamp option is present in the packet.
1632          */
1633 } __attribute__((packed));
1634
1635 /* last 16 bytes of RX TPA End Completion Record */
1636 struct rx_tpa_end_cmpl_hi {
1637         uint32_t tpa_dup_acks;
1638         /* unused3 is 28 b */
1639         /*
1640          * This value is the number of duplicate ACKs that have been
1641          * received as part of the TPA operation.
1642          */
1643         #define RX_TPA_END_CMPL_TPA_DUP_ACKS_MASK       UINT32_C(0xf)
1644         #define RX_TPA_END_CMPL_TPA_DUP_ACKS_SFT        0
1645         /* unused3 is 28 b */
1646         uint16_t tpa_seg_len;
1647         /*
1648          * This value is the valid when TPA completion is active. It
1649          * indicates the length of the longest segment of the TPA
1650          * operation for LRO mode and the length of the first segment in
1651          * GRO mode. This value may be used by GRO software to re-
1652          * construct the original packet stream from the TPA packet.
1653          * This is the length of all but the last segment for GRO. In
1654          * LRO mode this value may be used to indicate MSS size to the
1655          * stack.
1656          */
1657         uint16_t unused_3;
1658         /* unused4 is 16 b */
1659         uint16_t errors_v2;
1660         /*
1661          * This value is written by the NIC such that it will be
1662          * different for each pass through the completion queue. The
1663          * even passes will write 1. The odd passes will write 0.
1664          */
1665         #define RX_TPA_END_CMPL_V2      UINT32_C(0x1)
1666         /*
1667          * This error indicates that there was some sort of problem with
1668          * the BDs for the packet that was found after part of the
1669          * packet was already placed. The packet should be treated as
1670          * invalid.
1671          */
1672         #define RX_TPA_END_CMPL_ERRORS_BUFFER_ERROR_MASK        UINT32_C(0xe)
1673         #define RX_TPA_END_CMPL_ERRORS_BUFFER_ERROR_SFT 1
1674         /*
1675          * This error occurs when there is a fatal HW
1676          * problem in the chip only. It indicates that
1677          * there were not BDs on chip but that there was
1678          * adequate reservation. provided by the TPA
1679          * block.
1680          */
1681         #define RX_TPA_END_CMPL_ERRORS_BUFFER_ERROR_NOT_ON_CHIP \
1682                 (UINT32_C(0x2) << 1)
1683         /*
1684          * This error occurs when TPA block was not
1685          * configured to reserve adequate BDs for TPA
1686          * operations on this RX ring. All data for the
1687          * TPA operation was not placed. This error can
1688          * also be generated when the number of segments
1689          * is not programmed correctly in TPA and the 33
1690          * total aggregation buffers allowed for the TPA
1691          * operation has been exceeded.
1692          */
1693         #define RX_TPA_END_CMPL_ERRORS_BUFFER_ERROR_RSV_ERROR \
1694                 (UINT32_C(0x4) << 1)
1695         #define RX_TPA_END_CMPL_ERRORS_BUFFER_ERROR_LAST \
1696                 RX_TPA_END_CMPL_ERRORS_BUFFER_ERROR_RSV_ERROR
1697         #define RX_TPA_END_CMPL_ERRORS_MASK     UINT32_C(0xfffe)
1698         #define RX_TPA_END_CMPL_ERRORS_SFT      1
1699         uint16_t unused_4;
1700         /* unused5 is 16 b */
1701         uint32_t start_opaque;
1702         /*
1703          * This is the opaque value that was completed for the TPA start
1704          * completion that corresponds to this TPA end completion.
1705          */
1706 } __attribute__((packed));
1707
1708 /* HWRM Forwarded Request       (16 bytes) */
1709 struct hwrm_fwd_req_cmpl {
1710         uint16_t req_len_type;
1711         /* Length of forwarded request in bytes. */
1712         /*
1713          * This field indicates the exact type of the completion. By
1714          * convention, the LSB identifies the length of the record in
1715          * 16B units. Even values indicate 16B records. Odd values
1716          * indicate 32B records.
1717          */
1718         #define HWRM_FWD_INPUT_CMPL_TYPE_MASK   UINT32_C(0x3f)
1719         #define HWRM_FWD_INPUT_CMPL_TYPE_SFT    0
1720         /* Forwarded HWRM Request */
1721         #define HWRM_FWD_INPUT_CMPL_TYPE_HWRM_FWD_INPUT UINT32_C(0x22)
1722         /* Length of forwarded request in bytes. */
1723         #define HWRM_FWD_REQ_CMPL_REQ_LEN_MASK  UINT32_C(0xffc0)
1724         #define HWRM_FWD_REQ_CMPL_REQ_LEN_SFT   6
1725         uint16_t source_id;
1726         /*
1727          * Source ID of this request. Typically used in forwarding
1728          * requests and responses. 0x0 - 0xFFF8 - Used for function ids
1729          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF -
1730          * HWRM
1731          */
1732         uint32_t unused_0;
1733         /* unused1 is 32 b */
1734         uint32_t req_buf_addr_v[2];
1735         /* Address of forwarded request. */
1736         /*
1737          * This value is written by the NIC such that it will be
1738          * different for each pass through the completion queue. The
1739          * even passes will write 1. The odd passes will write 0.
1740          */
1741         #define HWRM_FWD_INPUT_CMPL_V   UINT32_C(0x1)
1742         /* Address of forwarded request. */
1743         #define HWRM_FWD_REQ_CMPL_REQ_BUF_ADDR_MASK     UINT32_C(0xfffffffe)
1744         #define HWRM_FWD_REQ_CMPL_REQ_BUF_ADDR_SFT      1
1745 } __attribute__((packed));
1746
1747 /* HWRM Asynchronous Event Completion Record    (16 bytes) */
1748 struct hwrm_async_event_cmpl {
1749         uint16_t type;
1750         /* unused1 is 10 b */
1751         /*
1752          * This field indicates the exact type of the completion. By
1753          * convention, the LSB identifies the length of the record in
1754          * 16B units. Even values indicate 16B records. Odd values
1755          * indicate 32B records.
1756          */
1757         #define HWRM_ASYNC_EVENT_CMPL_TYPE_MASK UINT32_C(0x3f)
1758         #define HWRM_ASYNC_EVENT_CMPL_TYPE_SFT  0
1759         /* HWRM Asynchronous Event Information */
1760         #define HWRM_ASYNC_EVENT_CMPL_TYPE_HWRM_ASYNC_EVENT     UINT32_C(0x2e)
1761         /* unused1 is 10 b */
1762         uint16_t event_id;
1763         /* Identifiers of events. */
1764         /* Link status changed */
1765         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE UINT32_C(0x0)
1766         /* Link MTU changed */
1767         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_MTU_CHANGE  UINT32_C(0x1)
1768         /* Link speed changed */
1769         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE UINT32_C(0x2)
1770         /* DCB Configuration changed */
1771         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DCB_CONFIG_CHANGE UINT32_C(0x3)
1772         /* Port connection not allowed */
1773         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED UINT32_C(0x4)
1774         /* Link speed configuration was not allowed */
1775         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_NOT_ALLOWED \
1776                 UINT32_C(0x5)
1777         /* Link speed configuration change */
1778         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE UINT32_C(0x6)
1779         /* Port PHY configuration change */
1780         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_PHY_CFG_CHANGE UINT32_C(0x7)
1781         /* Function driver unloaded */
1782         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_FUNC_DRVR_UNLOAD UINT32_C(0x10)
1783         /* Function driver loaded */
1784         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_FUNC_DRVR_LOAD   UINT32_C(0x11)
1785         /* Function FLR related processing has completed */
1786         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_FUNC_FLR_PROC_CMPLT UINT32_C(0x12)
1787         /* PF driver unloaded */
1788         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD   UINT32_C(0x20)
1789         /* PF driver loaded */
1790         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_LOAD     UINT32_C(0x21)
1791         /* VF Function Level Reset      (FLR) */
1792         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_FLR   UINT32_C(0x30)
1793         /* VF MAC Address Change */
1794         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_MAC_ADDR_CHANGE UINT32_C(0x31)
1795         /* PF-VF communication channel status change. */
1796         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_VF_COMM_STATUS_CHANGE \
1797                 UINT32_C(0x32)
1798         /* VF Configuration Change */
1799         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE    UINT32_C(0x33)
1800         /* HWRM Error */
1801         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_HWRM_ERROR       UINT32_C(0xff)
1802         uint32_t event_data2;
1803         /* Event specific data */
1804         uint8_t opaque_v;
1805         /* opaque is 7 b */
1806         /*
1807          * This value is written by the NIC such that it will be
1808          * different for each pass through the completion queue. The
1809          * even passes will write 1. The odd passes will write 0.
1810          */
1811         #define HWRM_ASYNC_EVENT_CMPL_V UINT32_C(0x1)
1812         /* opaque is 7 b */
1813         #define HWRM_ASYNC_EVENT_CMPL_OPAQUE_MASK       UINT32_C(0xfe)
1814         #define HWRM_ASYNC_EVENT_CMPL_OPAQUE_SFT        1
1815         uint8_t timestamp_lo;
1816         /* 8-lsb timestamp from POR     (100-msec resolution) */
1817         uint16_t timestamp_hi;
1818         /* 16-lsb timestamp from POR    (100-msec resolution) */
1819         uint32_t event_data1;
1820         /* Event specific data */
1821 } __attribute__((packed));
1822
1823 /* hwrm_ver_get */
1824 /*
1825  * Description: This function is called by a driver to determine the HWRM
1826  * interface version supported by the HWRM firmware, the version of HWRM
1827  * firmware implementation, the name of HWRM firmware, the versions of other
1828  * embedded firmwares, and the names of other embedded firmwares, etc. Any
1829  * interface or firmware version with major = 0, minor = 0, and update = 0 shall
1830  * be considered an invalid version.
1831  */
1832 /* Input        (24 bytes) */
1833 struct hwrm_ver_get_input {
1834         uint16_t req_type;
1835         /*
1836          * This value indicates what type of request this is. The format
1837          * for the rest of the command is determined by this field.
1838          */
1839         uint16_t cmpl_ring;
1840         /*
1841          * This value indicates the what completion ring the request
1842          * will be optionally completed on. If the value is -1, then no
1843          * CR completion will be generated. Any other value must be a
1844          * valid CR ring_id value for this function.
1845          */
1846         uint16_t seq_id;
1847         /* This value indicates the command sequence number. */
1848         uint16_t target_id;
1849         /*
1850          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
1851          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
1852          * - HWRM
1853          */
1854         uint64_t resp_addr;
1855         /*
1856          * This is the host address where the response will be written
1857          * when the request is complete. This area must be 16B aligned
1858          * and must be cleared to zero before the request is made.
1859          */
1860         uint8_t hwrm_intf_maj;
1861         /*
1862          * This field represents the major version of HWRM interface
1863          * specification supported by the driver HWRM implementation.
1864          * The interface major version is intended to change only when
1865          * non backward compatible changes are made to the HWRM
1866          * interface specification.
1867          */
1868         uint8_t hwrm_intf_min;
1869         /*
1870          * This field represents the minor version of HWRM interface
1871          * specification supported by the driver HWRM implementation. A
1872          * change in interface minor version is used to reflect
1873          * significant backward compatible modification to HWRM
1874          * interface specification. This can be due to addition or
1875          * removal of functionality. HWRM interface specifications with
1876          * the same major version but different minor versions are
1877          * compatible.
1878          */
1879         uint8_t hwrm_intf_upd;
1880         /*
1881          * This field represents the update version of HWRM interface
1882          * specification supported by the driver HWRM implementation.
1883          * The interface update version is used to reflect minor changes
1884          * or bug fixes to a released HWRM interface specification.
1885          */
1886         uint8_t unused_0[5];
1887 } __attribute__((packed));
1888
1889 /* Output       (128 bytes) */
1890 struct hwrm_ver_get_output {
1891         uint16_t error_code;
1892         /*
1893          * Pass/Fail or error type Note: receiver to verify the in
1894          * parameters, and fail the call with an error when appropriate
1895          */
1896         uint16_t req_type;
1897         /* This field returns the type of original request. */
1898         uint16_t seq_id;
1899         /* This field provides original sequence number of the command. */
1900         uint16_t resp_len;
1901         /*
1902          * This field is the length of the response in bytes. The last
1903          * byte of the response is a valid flag that will read as '1'
1904          * when the command has been completely written to memory.
1905          */
1906         uint8_t hwrm_intf_maj;
1907         /*
1908          * This field represents the major version of HWRM interface
1909          * specification supported by the HWRM implementation. The
1910          * interface major version is intended to change only when non
1911          * backward compatible changes are made to the HWRM interface
1912          * specification. A HWRM implementation that is compliant with
1913          * this specification shall provide value of 1 in this field.
1914          */
1915         uint8_t hwrm_intf_min;
1916         /*
1917          * This field represents the minor version of HWRM interface
1918          * specification supported by the HWRM implementation. A change
1919          * in interface minor version is used to reflect significant
1920          * backward compatible modification to HWRM interface
1921          * specification. This can be due to addition or removal of
1922          * functionality. HWRM interface specifications with the same
1923          * major version but different minor versions are compatible. A
1924          * HWRM implementation that is compliant with this specification
1925          * shall provide value of 2 in this field.
1926          */
1927         uint8_t hwrm_intf_upd;
1928         /*
1929          * This field represents the update version of HWRM interface
1930          * specification supported by the HWRM implementation. The
1931          * interface update version is used to reflect minor changes or
1932          * bug fixes to a released HWRM interface specification. A HWRM
1933          * implementation that is compliant with this specification
1934          * shall provide value of 2 in this field.
1935          */
1936         uint8_t hwrm_intf_rsvd;
1937         uint8_t hwrm_fw_maj;
1938         /*
1939          * This field represents the major version of HWRM firmware. A
1940          * change in firmware major version represents a major firmware
1941          * release.
1942          */
1943         uint8_t hwrm_fw_min;
1944         /*
1945          * This field represents the minor version of HWRM firmware. A
1946          * change in firmware minor version represents significant
1947          * firmware functionality changes.
1948          */
1949         uint8_t hwrm_fw_bld;
1950         /*
1951          * This field represents the build version of HWRM firmware. A
1952          * change in firmware build version represents bug fixes to a
1953          * released firmware.
1954          */
1955         uint8_t hwrm_fw_rsvd;
1956         /*
1957          * This field is a reserved field. This field can be used to
1958          * represent firmware branches or customer specific releases
1959          * tied to a specific   (major,minor,update) version of the HWRM
1960          * firmware.
1961          */
1962         uint8_t mgmt_fw_maj;
1963         /*
1964          * This field represents the major version of mgmt firmware. A
1965          * change in major version represents a major release.
1966          */
1967         uint8_t mgmt_fw_min;
1968         /*
1969          * This field represents the minor version of mgmt firmware. A
1970          * change in minor version represents significant functionality
1971          * changes.
1972          */
1973         uint8_t mgmt_fw_bld;
1974         /*
1975          * This field represents the build version of mgmt firmware. A
1976          * change in update version represents bug fixes.
1977          */
1978         uint8_t mgmt_fw_rsvd;
1979         /*
1980          * This field is a reserved field. This field can be used to
1981          * represent firmware branches or customer specific releases
1982          * tied to a specific   (major,minor,update) version
1983          */
1984         uint8_t netctrl_fw_maj;
1985         /*
1986          * This field represents the major version of network control
1987          * firmware. A change in major version represents a major
1988          * release.
1989          */
1990         uint8_t netctrl_fw_min;
1991         /*
1992          * This field represents the minor version of network control
1993          * firmware. A change in minor version represents significant
1994          * functionality changes.
1995          */
1996         uint8_t netctrl_fw_bld;
1997         /*
1998          * This field represents the build version of network control
1999          * firmware. A change in update version represents bug fixes.
2000          */
2001         uint8_t netctrl_fw_rsvd;
2002         /*
2003          * This field is a reserved field. This field can be used to
2004          * represent firmware branches or customer specific releases
2005          * tied to a specific   (major,minor,update) version
2006          */
2007         uint32_t dev_caps_cfg;
2008         /*
2009          * This field is used to indicate device's capabilities and
2010          * configurations.
2011          */
2012         /*
2013          * If set to 1, then secure firmware update behavior is
2014          * supported. If set to 0, then secure firmware update behavior
2015          * is not supported.
2016          */
2017         #define HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SECURE_FW_UPD_SUPPORTED  \
2018                 UINT32_C(0x1)
2019         /*
2020          * If set to 1, then firmware based DCBX agent is supported. If
2021          * set to 0, then firmware based DCBX agent capability is not
2022          * supported on this device.
2023          */
2024         #define HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_FW_DCBX_AGENT_SUPPORTED  \
2025                 UINT32_C(0x2)
2026         /*
2027          * If set to 1, then HWRM short command format is supported. If
2028          * set to 0, then HWRM short command format is not supported.
2029          */
2030         #define HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_SUPPORTED     \
2031                 UINT32_C(0x4)
2032         /*
2033          * If set to 1, then HWRM short command format is required. If
2034          * set to 0, then HWRM short command format is not required.
2035          */
2036         #define HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_INPUTUIRED   \
2037                 UINT32_C(0x8)
2038         uint8_t roce_fw_maj;
2039         /*
2040          * This field represents the major version of RoCE firmware. A
2041          * change in major version represents a major release.
2042          */
2043         uint8_t roce_fw_min;
2044         /*
2045          * This field represents the minor version of RoCE firmware. A
2046          * change in minor version represents significant functionality
2047          * changes.
2048          */
2049         uint8_t roce_fw_bld;
2050         /*
2051          * This field represents the build version of RoCE firmware. A
2052          * change in update version represents bug fixes.
2053          */
2054         uint8_t roce_fw_rsvd;
2055         /*
2056          * This field is a reserved field. This field can be used to
2057          * represent firmware branches or customer specific releases
2058          * tied to a specific   (major,minor,update) version
2059          */
2060         char hwrm_fw_name[16];
2061         /*
2062          * This field represents the name of HWRM FW    (ASCII chars with
2063          * NULL at the end).
2064          */
2065         char mgmt_fw_name[16];
2066         /*
2067          * This field represents the name of mgmt FW    (ASCII chars with
2068          * NULL at the end).
2069          */
2070         char netctrl_fw_name[16];
2071         /*
2072          * This field represents the name of network control firmware
2073          *      (ASCII chars with NULL at the end).
2074          */
2075         uint32_t reserved2[4];
2076         /*
2077          * This field is reserved for future use. The responder should
2078          * set it to 0. The requester should ignore this field.
2079          */
2080         char roce_fw_name[16];
2081         /*
2082          * This field represents the name of RoCE FW    (ASCII chars with
2083          * NULL at the end).
2084          */
2085         uint16_t chip_num;
2086         /* This field returns the chip number. */
2087         uint8_t chip_rev;
2088         /* This field returns the revision of chip. */
2089         uint8_t chip_metal;
2090         /* This field returns the chip metal number. */
2091         uint8_t chip_bond_id;
2092         /* This field returns the bond id of the chip. */
2093         uint8_t chip_platform_type;
2094         /*
2095          * This value indicates the type of platform used for chip
2096          * implementation.
2097          */
2098         /* ASIC */
2099         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_ASIC     UINT32_C(0x0)
2100         /* FPGA platform of the chip. */
2101         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_FPGA     UINT32_C(0x1)
2102         /* Palladium platform of the chip. */
2103         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_PALLADIUM UINT32_C(0x2)
2104         uint16_t max_req_win_len;
2105         /*
2106          * This field returns the maximum value of request window that
2107          * is supported by the HWRM. The request window is mapped into
2108          * device address space using MMIO.
2109          */
2110         uint16_t max_resp_len;
2111         /* This field returns the maximum value of response buffer in bytes. */
2112         uint16_t def_req_timeout;
2113         /*
2114          * This field returns the default request timeout value in
2115          * milliseconds.
2116          */
2117         uint8_t unused_0;
2118         uint8_t unused_1;
2119         uint8_t unused_2;
2120         uint8_t valid;
2121         /*
2122          * This field is used in Output records to indicate that the
2123          * output is completely written to RAM. This field should be
2124          * read as '1' to indicate that the output has been completely
2125          * written. When writing a command completion or response to an
2126          * internal processor, the order of writes has to be such that
2127          * this field is written last.
2128          */
2129 } __attribute__((packed));
2130
2131 /* hwrm_func_reset */
2132 /*
2133  * Description: This command resets a hardware function (PCIe function) and
2134  * frees any resources used by the function. This command shall be initiated by
2135  * the driver after an FLR has occurred to prepare the function for re-use. This
2136  * command may also be initiated by a driver prior to doing it's own
2137  * configuration. This command puts the function into the reset state. In the
2138  * reset state, global and port related features of the chip are not available.
2139  */
2140 /*
2141  * Note: This command will reset a function that has already been disabled or
2142  * idled. The command returns all the resources owned by the function so a new
2143  * driver may allocate and configure resources normally.
2144  */
2145 /* Input        (24 bytes) */
2146 struct hwrm_func_reset_input {
2147         uint16_t req_type;
2148         /*
2149          * This value indicates what type of request this is. The format
2150          * for the rest of the command is determined by this field.
2151          */
2152         uint16_t cmpl_ring;
2153         /*
2154          * This value indicates the what completion ring the request
2155          * will be optionally completed on. If the value is -1, then no
2156          * CR completion will be generated. Any other value must be a
2157          * valid CR ring_id value for this function.
2158          */
2159         uint16_t seq_id;
2160         /* This value indicates the command sequence number. */
2161         uint16_t target_id;
2162         /*
2163          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
2164          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
2165          * - HWRM
2166          */
2167         uint64_t resp_addr;
2168         /*
2169          * This is the host address where the response will be written
2170          * when the request is complete. This area must be 16B aligned
2171          * and must be cleared to zero before the request is made.
2172          */
2173         uint32_t enables;
2174         /* This bit must be '1' for the vf_id_valid field to be configured. */
2175         #define HWRM_FUNC_RESET_INPUT_ENABLES_VF_ID_VALID       UINT32_C(0x1)
2176         uint16_t vf_id;
2177         /*
2178          * The ID of the VF that this PF is trying to reset. Only the
2179          * parent PF shall be allowed to reset a child VF. A parent PF
2180          * driver shall use this field only when a specific child VF is
2181          * requested to be reset.
2182          */
2183         uint8_t func_reset_level;
2184         /* This value indicates the level of a function reset. */
2185         /*
2186          * Reset the caller function and its children
2187          * VFs  (if any). If no children functions exist,
2188          * then reset the caller function only.
2189          */
2190         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETALL UINT32_C(0x0)
2191         /* Reset the caller function only */
2192         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETME  UINT32_C(0x1)
2193         /*
2194          * Reset all children VFs of the caller function
2195          * driver if the caller is a PF driver. It is an
2196          * error to specify this level by a VF driver.
2197          * It is an error to specify this level by a PF
2198          * driver with no children VFs.
2199          */
2200         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETCHILDREN \
2201                 UINT32_C(0x2)
2202         /*
2203          * Reset a specific VF of the caller function
2204          * driver if the caller is the parent PF driver.
2205          * It is an error to specify this level by a VF
2206          * driver. It is an error to specify this level
2207          * by a PF driver that is not the parent of the
2208          * VF that is being requested to reset.
2209          */
2210         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETVF  UINT32_C(0x3)
2211         uint8_t unused_0;
2212 } __attribute__((packed));
2213
2214 /* Output       (16 bytes) */
2215 struct hwrm_func_reset_output {
2216         uint16_t error_code;
2217         /*
2218          * Pass/Fail or error type Note: receiver to verify the in
2219          * parameters, and fail the call with an error when appropriate
2220          */
2221         uint16_t req_type;
2222         /* This field returns the type of original request. */
2223         uint16_t seq_id;
2224         /* This field provides original sequence number of the command. */
2225         uint16_t resp_len;
2226         /*
2227          * This field is the length of the response in bytes. The last
2228          * byte of the response is a valid flag that will read as '1'
2229          * when the command has been completely written to memory.
2230          */
2231         uint32_t unused_0;
2232         uint8_t unused_1;
2233         uint8_t unused_2;
2234         uint8_t unused_3;
2235         uint8_t valid;
2236         /*
2237          * This field is used in Output records to indicate that the
2238          * output is completely written to RAM. This field should be
2239          * read as '1' to indicate that the output has been completely
2240          * written. When writing a command completion or response to an
2241          * internal processor, the order of writes has to be such that
2242          * this field is written last.
2243          */
2244 } __attribute__((packed));
2245
2246 /* hwrm_func_qcaps */
2247 /*
2248  * Description: This command returns capabilities of a function. The input FID
2249  * value is used to indicate what function is being queried. This allows a
2250  * physical function driver to query virtual functions that are children of the
2251  * physical function. The output FID value is needed to configure Rings and
2252  * MSI-X vectors so their DMA operations appear correctly on the PCI bus.
2253  */
2254 /* Input        (24 bytes) */
2255 struct hwrm_func_qcaps_input {
2256         uint16_t req_type;
2257         /*
2258          * This value indicates what type of request this is. The format
2259          * for the rest of the command is determined by this field.
2260          */
2261         uint16_t cmpl_ring;
2262         /*
2263          * This value indicates the what completion ring the request
2264          * will be optionally completed on. If the value is -1, then no
2265          * CR completion will be generated. Any other value must be a
2266          * valid CR ring_id value for this function.
2267          */
2268         uint16_t seq_id;
2269         /* This value indicates the command sequence number. */
2270         uint16_t target_id;
2271         /*
2272          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
2273          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
2274          * - HWRM
2275          */
2276         uint64_t resp_addr;
2277         /*
2278          * This is the host address where the response will be written
2279          * when the request is complete. This area must be 16B aligned
2280          * and must be cleared to zero before the request is made.
2281          */
2282         uint16_t fid;
2283         /*
2284          * Function ID of the function that is being queried. 0xFF...
2285          *      (All Fs) if the query is for the requesting function.
2286          */
2287         uint16_t unused_0[3];
2288 } __attribute__((packed));
2289
2290 /* Output       (80 bytes) */
2291 struct hwrm_func_qcaps_output {
2292         uint16_t error_code;
2293         /*
2294          * Pass/Fail or error type Note: receiver to verify the in
2295          * parameters, and fail the call with an error when appropriate
2296          */
2297         uint16_t req_type;
2298         /* This field returns the type of original request. */
2299         uint16_t seq_id;
2300         /* This field provides original sequence number of the command. */
2301         uint16_t resp_len;
2302         /*
2303          * This field is the length of the response in bytes. The last
2304          * byte of the response is a valid flag that will read as '1'
2305          * when the command has been completely written to memory.
2306          */
2307         uint16_t fid;
2308         /*
2309          * FID value. This value is used to identify operations on the
2310          * PCI bus as belonging to a particular PCI function.
2311          */
2312         uint16_t port_id;
2313         /*
2314          * Port ID of port that this function is associated with. Valid
2315          * only for the PF. 0xFF...     (All Fs) if this function is not
2316          * associated with any port. 0xFF...    (All Fs) if this function
2317          * is called from a VF.
2318          */
2319         uint32_t flags;
2320         /* If 1, then Push mode is supported on this function. */
2321         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PUSH_MODE_SUPPORTED UINT32_C(0x1)
2322         /*
2323          * If 1, then the global MSI-X auto-masking is enabled for the
2324          * device.
2325          */
2326         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_GLOBAL_MSIX_AUTOMASKING     \
2327                 UINT32_C(0x2)
2328         /*
2329          * If 1, then the Precision Time Protocol       (PTP) processing is
2330          * supported on this function. The HWRM should enable PTP on
2331          * only a single Physical Function      (PF) per port.
2332          */
2333         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED      UINT32_C(0x4)
2334         /*
2335          * If 1, then RDMA over Converged Ethernet      (RoCE) v1 is
2336          * supported on this function.
2337          */
2338         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ROCE_V1_SUPPORTED UINT32_C(0x8)
2339         /*
2340          * If 1, then RDMA over Converged Ethernet      (RoCE) v2 is
2341          * supported on this function.
2342          */
2343         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ROCE_V2_SUPPORTED UINT32_C(0x10)
2344         /*
2345          * If 1, then control and configuration of WoL magic packet are
2346          * supported on this function.
2347          */
2348         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_WOL_MAGICPKT_SUPPORTED     \
2349                 UINT32_C(0x20)
2350         /*
2351          * If 1, then control and configuration of bitmap pattern packet
2352          * are supported on this function.
2353          */
2354         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_WOL_BMP_SUPPORTED UINT32_C(0x40)
2355         /*
2356          * If set to 1, then the control and configuration of rate limit
2357          * of an allocated TX ring on the queried function is supported.
2358          */
2359         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_TX_RING_RL_SUPPORTED UINT32_C(0x80)
2360         /*
2361          * If 1, then control and configuration of minimum and maximum
2362          * bandwidths are supported on the queried function.
2363          */
2364         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_TX_BW_CFG_SUPPORTED UINT32_C(0x100)
2365         /*
2366          * If the query is for a VF, then this flag shall be ignored. If
2367          * this query is for a PF and this flag is set to 1, then the PF
2368          * has the capability to set the rate limits on the TX rings of
2369          * its children VFs. If this query is for a PF and this flag is
2370          * set to 0, then the PF does not have the capability to set the
2371          * rate limits on the TX rings of its children VFs.
2372          */
2373         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VF_TX_RING_RL_SUPPORTED     \
2374                 UINT32_C(0x200)
2375         /*
2376          * If the query is for a VF, then this flag shall be ignored. If
2377          * this query is for a PF and this flag is set to 1, then the PF
2378          * has the capability to set the minimum and/or maximum
2379          * bandwidths for its children VFs. If this query is for a PF
2380          * and this flag is set to 0, then the PF does not have the
2381          * capability to set the minimum or maximum bandwidths for its
2382          * children VFs.
2383          */
2384         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VF_BW_CFG_SUPPORTED UINT32_C(0x400)
2385         /*
2386          * Standard TX Ring mode is used for the allocation of TX ring
2387          * and underlying scheduling resources that allow bandwidth
2388          * reservation and limit settings on the queried function. If
2389          * set to 1, then standard TX ring mode is supported on the
2390          * queried function. If set to 0, then standard TX ring mode is
2391          * not available on the queried function.
2392          */
2393         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_STD_TX_RING_MODE_SUPPORTED   \
2394                 UINT32_C(0x800)
2395         uint8_t mac_address[6];
2396         /*
2397          * This value is current MAC address configured for this
2398          * function. A value of 00-00-00-00-00-00 indicates no MAC
2399          * address is currently configured.
2400          */
2401         uint16_t max_rsscos_ctx;
2402         /*
2403          * The maximum number of RSS/COS contexts that can be allocated
2404          * to the function.
2405          */
2406         uint16_t max_cmpl_rings;
2407         /*
2408          * The maximum number of completion rings that can be allocated
2409          * to the function.
2410          */
2411         uint16_t max_tx_rings;
2412         /*
2413          * The maximum number of transmit rings that can be allocated to
2414          * the function.
2415          */
2416         uint16_t max_rx_rings;
2417         /*
2418          * The maximum number of receive rings that can be allocated to
2419          * the function.
2420          */
2421         uint16_t max_l2_ctxs;
2422         /*
2423          * The maximum number of L2 contexts that can be allocated to
2424          * the function.
2425          */
2426         uint16_t max_vnics;
2427         /*
2428          * The maximum number of VNICs that can be allocated to the
2429          * function.
2430          */
2431         uint16_t first_vf_id;
2432         /*
2433          * The identifier for the first VF enabled on a PF. This is
2434          * valid only on the PF with SR-IOV enabled. 0xFF...    (All Fs) if
2435          * this command is called on a PF with SR-IOV disabled or on a
2436          * VF.
2437          */
2438         uint16_t max_vfs;
2439         /*
2440          * The maximum number of VFs that can be allocated to the
2441          * function. This is valid only on the PF with SR-IOV enabled.
2442          * 0xFF...      (All Fs) if this command is called on a PF with SR-
2443          * IOV disabled or on a VF.
2444          */
2445         uint16_t max_stat_ctx;
2446         /*
2447          * The maximum number of statistic contexts that can be
2448          * allocated to the function.
2449          */
2450         uint32_t max_encap_records;
2451         /*
2452          * The maximum number of Encapsulation records that can be
2453          * offloaded by this function.
2454          */
2455         uint32_t max_decap_records;
2456         /*
2457          * The maximum number of decapsulation records that can be
2458          * offloaded by this function.
2459          */
2460         uint32_t max_tx_em_flows;
2461         /*
2462          * The maximum number of Exact Match    (EM) flows that can be
2463          * offloaded by this function on the TX side.
2464          */
2465         uint32_t max_tx_wm_flows;
2466         /*
2467          * The maximum number of Wildcard Match (WM) flows that can be
2468          * offloaded by this function on the TX side.
2469          */
2470         uint32_t max_rx_em_flows;
2471         /*
2472          * The maximum number of Exact Match    (EM) flows that can be
2473          * offloaded by this function on the RX side.
2474          */
2475         uint32_t max_rx_wm_flows;
2476         /*
2477          * The maximum number of Wildcard Match (WM) flows that can be
2478          * offloaded by this function on the RX side.
2479          */
2480         uint32_t max_mcast_filters;
2481         /*
2482          * The maximum number of multicast filters that can be supported
2483          * by this function on the RX side.
2484          */
2485         uint32_t max_flow_id;
2486         /*
2487          * The maximum value of flow_id that can be supported in
2488          * completion records.
2489          */
2490         uint32_t max_hw_ring_grps;
2491         /*
2492          * The maximum number of HW ring groups that can be supported on
2493          * this function.
2494          */
2495         uint16_t max_sp_tx_rings;
2496         /*
2497          * The maximum number of strict priority transmit rings that can
2498          * be allocated to the function. This number indicates the
2499          * maximum number of TX rings that can be assigned strict
2500          * priorities out of the maximum number of TX rings that can be
2501          * allocated    (max_tx_rings) to the function.
2502          */
2503         uint8_t unused_0;
2504         uint8_t valid;
2505         /*
2506          * This field is used in Output records to indicate that the
2507          * output is completely written to RAM. This field should be
2508          * read as '1' to indicate that the output has been completely
2509          * written. When writing a command completion or response to an
2510          * internal processor, the order of writes has to be such that
2511          * this field is written last.
2512          */
2513 } __attribute__((packed));
2514
2515 /* hwrm_func_qcfg */
2516 /*
2517  * Description: This command returns the current configuration of a function.
2518  * The input FID value is used to indicate what function is being queried. This
2519  * allows a physical function driver to query virtual functions that are
2520  * children of the physical function. The output FID value is needed to
2521  * configure Rings and MSI-X vectors so their DMA operations appear correctly on
2522  * the PCI bus. This command should be called by every driver after
2523  * 'hwrm_func_cfg' to get the actual number of resources allocated by the HWRM.
2524  * The values returned by hwrm_func_qcfg are the values the driver shall use.
2525  * These values may be different than what was originally requested in the
2526  * 'hwrm_func_cfg' command.
2527  */
2528 /* Input        (24 bytes) */
2529 struct hwrm_func_qcfg_input {
2530         uint16_t req_type;
2531         /*
2532          * This value indicates what type of request this is. The format
2533          * for the rest of the command is determined by this field.
2534          */
2535         uint16_t cmpl_ring;
2536         /*
2537          * This value indicates the what completion ring the request
2538          * will be optionally completed on. If the value is -1, then no
2539          * CR completion will be generated. Any other value must be a
2540          * valid CR ring_id value for this function.
2541          */
2542         uint16_t seq_id;
2543         /* This value indicates the command sequence number. */
2544         uint16_t target_id;
2545         /*
2546          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
2547          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
2548          * - HWRM
2549          */
2550         uint64_t resp_addr;
2551         /*
2552          * This is the host address where the response will be written
2553          * when the request is complete. This area must be 16B aligned
2554          * and must be cleared to zero before the request is made.
2555          */
2556         uint16_t fid;
2557         /*
2558          * Function ID of the function that is being queried. 0xFF...
2559          *      (All Fs) if the query is for the requesting function.
2560          */
2561         uint16_t unused_0[3];
2562 } __attribute__((packed));
2563
2564 /* Output       (72 bytes) */
2565 struct hwrm_func_qcfg_output {
2566         uint16_t error_code;
2567         /*
2568          * Pass/Fail or error type Note: receiver to verify the in
2569          * parameters, and fail the call with an error when appropriate
2570          */
2571         uint16_t req_type;
2572         /* This field returns the type of original request. */
2573         uint16_t seq_id;
2574         /* This field provides original sequence number of the command. */
2575         uint16_t resp_len;
2576         /*
2577          * This field is the length of the response in bytes. The last
2578          * byte of the response is a valid flag that will read as '1'
2579          * when the command has been completely written to memory.
2580          */
2581         uint16_t fid;
2582         /*
2583          * FID value. This value is used to identify operations on the
2584          * PCI bus as belonging to a particular PCI function.
2585          */
2586         uint16_t port_id;
2587         /*
2588          * Port ID of port that this function is associated with.
2589          * 0xFF...      (All Fs) if this function is not associated with any
2590          * port.
2591          */
2592         uint16_t vlan;
2593         /*
2594          * This value is the current VLAN setting for this function. The
2595          * value of 0 for this field indicates no priority tagging or
2596          * VLAN is used. This field's format is same as 802.1Q Tag's Tag
2597          * Control Information  (TCI) format that includes both Priority
2598          * Code Point   (PCP) and VLAN Identifier       (VID).
2599          */
2600         uint16_t flags;
2601         /*
2602          * If 1, then magic packet based Out-Of-Box WoL is enabled on
2603          * the port associated with this function.
2604          */
2605         #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_OOB_WOL_MAGICPKT_ENABLED     \
2606                 UINT32_C(0x1)
2607         /*
2608          * If 1, then bitmap pattern based Out-Of-Box WoL packet is
2609          * enabled on the port associated with this function.
2610          */
2611         #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_OOB_WOL_BMP_ENABLED UINT32_C(0x2)
2612         /*
2613          * If set to 1, then FW based DCBX agent is enabled and running
2614          * on the port associated with this function. If set to 0, then
2615          * DCBX agent is not running in the firmware.
2616          */
2617         #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_FW_DCBX_AGENT_ENABLED \
2618                 UINT32_C(0x4)
2619         /*
2620          * Standard TX Ring mode is used for the allocation of TX ring
2621          * and underlying scheduling resources that allow bandwidth
2622          * reservation and limit settings on the queried function. If
2623          * set to 1, then standard TX ring mode is enabled on the
2624          * queried function. If set to 0, then the standard TX ring mode
2625          * is disabled on the queried function. In this extended TX ring
2626          * resource mode, the minimum and maximum bandwidth settings are
2627          * not supported to allow the allocation of TX rings to span
2628          * multiple scheduler nodes.
2629          */
2630         #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_STD_TX_RING_MODE_ENABLED     \
2631                 UINT32_C(0x8)
2632         /*
2633          * If set to 1 then FW based LLDP agent is enabled and running
2634          * on the port associated with this function. If set to 0 then
2635          * the LLDP agent is not running in the firmware.
2636          */
2637         #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_FW_LLDP_AGENT_ENABLED UINT32_C(0x10)
2638         /*
2639          * If set to 1, then multi-host mode is active for this
2640          * function. If set to 0, then multi-host mode is inactive for
2641          * this function or not applicable for this device.
2642          */
2643         #define HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_HOST          UINT32_C(0x20)
2644         uint8_t mac_address[6];
2645         /*
2646          * This value is current MAC address configured for this
2647          * function. A value of 00-00-00-00-00-00 indicates no MAC
2648          * address is currently configured.
2649          */
2650         uint16_t pci_id;
2651         /*
2652          * This value is current PCI ID of this function. If ARI is
2653          * enabled, then it is Bus Number       (8b):Function Number(8b).
2654          * Otherwise, it is Bus Number  (8b):Device Number      (4b):Function
2655          * Number(4b).
2656          */
2657         uint16_t alloc_rsscos_ctx;
2658         /*
2659          * The number of RSS/COS contexts currently allocated to the
2660          * function.
2661          */
2662         uint16_t alloc_cmpl_rings;
2663         /*
2664          * The number of completion rings currently allocated to the
2665          * function. This does not include the rings allocated to any
2666          * children functions if any.
2667          */
2668         uint16_t alloc_tx_rings;
2669         /*
2670          * The number of transmit rings currently allocated to the
2671          * function. This does not include the rings allocated to any
2672          * children functions if any.
2673          */
2674         uint16_t alloc_rx_rings;
2675         /*
2676          * The number of receive rings currently allocated to the
2677          * function. This does not include the rings allocated to any
2678          * children functions if any.
2679          */
2680         uint16_t alloc_l2_ctx;
2681         /* The allocated number of L2 contexts to the function. */
2682         uint16_t alloc_vnics;
2683         /* The allocated number of vnics to the function. */
2684         uint16_t mtu;
2685         /*
2686          * The maximum transmission unit of the function. For rings
2687          * allocated on this function, this default value is used if
2688          * ring MTU is not specified.
2689          */
2690         uint16_t mru;
2691         /*
2692          * The maximum receive unit of the function. For vnics allocated
2693          * on this function, this default value is used if vnic MRU is
2694          * not specified.
2695          */
2696         uint16_t stat_ctx_id;
2697         /* The statistics context assigned to a function. */
2698         uint8_t port_partition_type;
2699         /*
2700          * The HWRM shall return Unknown value for this field when this
2701          * command is used to query VF's configuration.
2702          */
2703         /* Single physical function */
2704         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_SPF   UINT32_C(0x0)
2705         /* Multiple physical functions */
2706         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_MPFS  UINT32_C(0x1)
2707         /* Network Partitioning 1.0 */
2708         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_0 UINT32_C(0x2)
2709         /* Network Partitioning 1.5 */
2710         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_5 UINT32_C(0x3)
2711         /* Network Partitioning 2.0 */
2712         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR2_0 UINT32_C(0x4)
2713         /* Unknown */
2714         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_UNKNOWN UINT32_C(0xff)
2715         uint8_t port_pf_cnt;
2716         /*
2717          * This field will indicate number of physical functions on this
2718          * port_partition. HWRM shall return unavail (i.e. value of 0)
2719          * for this field when this command is used to query VF's
2720          * configuration or from older firmware that doesn't support
2721          * this field.
2722          */
2723         /* number of PFs is not available */
2724         #define HWRM_FUNC_QCFG_OUTPUT_PORT_PF_CNT_UNAVAIL       UINT32_C(0x0)
2725         uint16_t dflt_vnic_id;
2726         /* The default VNIC ID assigned to a function that is being queried. */
2727         uint8_t unused_0;
2728         uint8_t unused_1;
2729         uint32_t min_bw;
2730         /*
2731          * Minimum BW allocated for this function. The HWRM will
2732          * translate this value into byte counter and time interval used
2733          * for the scheduler inside the device. A value of 0 indicates
2734          * the minimum bandwidth is not configured.
2735          */
2736         /* The bandwidth value. */
2737         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_MASK UINT32_C(0xfffffff)
2738         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_SFT       0
2739         /* The granularity of the value (bits or bytes). */
2740         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_SCALE      UINT32_C(0x10000000)
2741         /* Value is in bits. */
2742         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_SCALE_BITS (UINT32_C(0x0) << 28)
2743         /* Value is in bytes. */
2744         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_SCALE_BYTES \
2745                 (UINT32_C(0x1) << 28)
2746         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_SCALE_LAST \
2747                 FUNC_QCFG_OUTPUT_MIN_BW_SCALE_BYTES
2748         /* bw_value_unit is 3 b */
2749         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_MASK \
2750                 UINT32_C(0xe0000000)
2751         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_SFT  29
2752         /* Value is in Mb or MB (base 10). */
2753         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_MEGA \
2754                 (UINT32_C(0x0) << 29)
2755         /* Value is in Kb or KB (base 10). */
2756         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_KILO \
2757                 (UINT32_C(0x2) << 29)
2758         /* Value is in bits or bytes. */
2759         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_BASE \
2760                 (UINT32_C(0x4) << 29)
2761         /* Value is in Gb or GB (base 10). */
2762         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_GIGA \
2763                 (UINT32_C(0x6) << 29)
2764         /* Value is in 1/100th of a percentage of total bandwidth. */
2765         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_PERCENT1_100 \
2766                 (UINT32_C(0x1) << 29)
2767         /* Invalid unit */
2768         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_INVALID \
2769                 (UINT32_C(0x7) << 29)
2770         #define HWRM_FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_LAST \
2771                 FUNC_QCFG_OUTPUT_MIN_BW_BW_VALUE_UNIT_INVALID
2772         uint32_t max_bw;
2773         /*
2774          * Maximum BW allocated for this function. The HWRM will
2775          * translate this value into byte counter and time interval used
2776          * for the scheduler inside the device. A value of 0 indicates
2777          * that the maximum bandwidth is not configured.
2778          */
2779         /* The bandwidth value. */
2780         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_MASK UINT32_C(0xfffffff)
2781         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_SFT       0
2782         /* The granularity of the value (bits or bytes). */
2783         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_SCALE      UINT32_C(0x10000000)
2784         /* Value is in bits. */
2785         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_SCALE_BITS (UINT32_C(0x0) << 28)
2786         /* Value is in bytes. */
2787         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_SCALE_BYTES \
2788                 (UINT32_C(0x1) << 28)
2789         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_SCALE_LAST \
2790                 FUNC_QCFG_OUTPUT_MAX_BW_SCALE_BYTES
2791         /* bw_value_unit is 3 b */
2792         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_MASK \
2793                 UINT32_C(0xe0000000)
2794         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_SFT  29
2795         /* Value is in Mb or MB (base 10). */
2796         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_MEGA \
2797                 (UINT32_C(0x0) << 29)
2798         /* Value is in Kb or KB (base 10). */
2799         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_KILO \
2800                 (UINT32_C(0x2) << 29)
2801         /* Value is in bits or bytes. */
2802         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_BASE \
2803                 (UINT32_C(0x4) << 29)
2804         /* Value is in Gb or GB (base 10). */
2805         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_GIGA \
2806                 (UINT32_C(0x6) << 29)
2807         /* Value is in 1/100th of a percentage of total bandwidth. */
2808         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_PERCENT1_100 \
2809                 (UINT32_C(0x1) << 29)
2810         /* Invalid unit */
2811         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_INVALID \
2812                 (UINT32_C(0x7) << 29)
2813         #define HWRM_FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_LAST \
2814                 FUNC_QCFG_OUTPUT_MAX_BW_BW_VALUE_UNIT_INVALID
2815         uint8_t evb_mode;
2816         /*
2817          * This value indicates the Edge virtual bridge mode for the
2818          * domain that this function belongs to.
2819          */
2820         /* No Edge Virtual Bridging     (EVB) */
2821         #define HWRM_FUNC_QCFG_OUTPUT_EVB_MODE_NO_EVB   UINT32_C(0x0)
2822         /* Virtual Ethernet Bridge      (VEB) */
2823         #define HWRM_FUNC_QCFG_OUTPUT_EVB_MODE_VEB      UINT32_C(0x1)
2824         /* Virtual Ethernet Port Aggregator     (VEPA) */
2825         #define HWRM_FUNC_QCFG_OUTPUT_EVB_MODE_VEPA     UINT32_C(0x2)
2826         uint8_t unused_2;
2827         uint16_t alloc_vfs;
2828         /*
2829          * The number of VFs that are allocated to the function. This is
2830          * valid only on the PF with SR-IOV enabled. 0xFF...    (All Fs) if
2831          * this command is called on a PF with SR-IOV disabled or on a
2832          * VF.
2833          */
2834         uint32_t alloc_mcast_filters;
2835         /*
2836          * The number of allocated multicast filters for this function
2837          * on the RX side.
2838          */
2839         uint32_t alloc_hw_ring_grps;
2840         /* The number of allocated HW ring groups for this function. */
2841         uint16_t alloc_sp_tx_rings;
2842         /*
2843          * The number of strict priority transmit rings out of currently
2844          * allocated TX rings to the function   (alloc_tx_rings).
2845          */
2846         uint8_t unused_3;
2847         uint8_t valid;
2848         /*
2849          * This field is used in Output records to indicate that the
2850          * output is completely written to RAM. This field should be
2851          * read as '1' to indicate that the output has been completely
2852          * written. When writing a command completion or response to an
2853          * internal processor, the order of writes has to be such that
2854          * this field is written last.
2855          */
2856 } __attribute__((packed));
2857
2858 /* hwrm_func_vlan_qcfg */
2859 /*
2860  * Description: This command should be called by PF driver to get the current
2861  * C-TAG, S-TAG and correcponsing PCP and TPID values configured for the
2862  * function.
2863  */
2864 /* Input (24 bytes) */
2865 struct hwrm_func_vlan_qcfg_input {
2866         uint16_t req_type;
2867         /*
2868          * This value indicates what type of request this is. The format
2869          * for the rest of the command is determined by this field.
2870          */
2871         uint16_t cmpl_ring;
2872         /*
2873          * This value indicates the what completion ring the request
2874          * will be optionally completed on. If the value is -1, then no
2875          * CR completion will be generated. Any other value must be a
2876          * valid CR ring_id value for this function.
2877          */
2878         uint16_t seq_id;
2879         /* This value indicates the command sequence number. */
2880         uint16_t target_id;
2881         /*
2882          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
2883          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
2884          * - HWRM
2885          */
2886         uint64_t resp_addr;
2887         /*
2888          * This is the host address where the response will be written
2889          * when the request is complete. This area must be 16B aligned
2890          * and must be cleared to zero before the request is made.
2891          */
2892         uint16_t fid;
2893         /*
2894          * Function ID of the function that is being configured. If set
2895          * to 0xFF... (All Fs), then the configuration is for the
2896          * requesting function.
2897          */
2898         uint16_t unused_0[3];
2899 };
2900
2901 /* Output (40 bytes) */
2902 struct hwrm_func_vlan_qcfg_output {
2903         uint16_t error_code;
2904         /*
2905          * Pass/Fail or error type Note: receiver to verify the in
2906          * parameters, and fail the call with an error when appropriate
2907          */
2908         uint16_t req_type;
2909         /* This field returns the type of original request. */
2910         uint16_t seq_id;
2911         /* This field provides original sequence number of the command. */
2912         uint16_t resp_len;
2913         /*
2914          * This field is the length of the response in bytes. The last
2915          * byte of the response is a valid flag that will read as '1'
2916          * when the command has been completely written to memory.
2917          */
2918         uint32_t unused_0;
2919         uint8_t unused_1;
2920         uint8_t unused_2;
2921         uint8_t unused_3;
2922         uint8_t valid;
2923         /*
2924          * This field is used in Output records to indicate that the
2925          * output is completely written to RAM. This field should be
2926          * read as '1' to indicate that the output has been completely
2927          * written. When writing a command completion or response to an
2928          * internal processor, the order of writes has to be such that
2929          * this field is written last.
2930          */
2931         uint16_t stag_vid;
2932         /* S-TAG VLAN identifier configured for the function. */
2933         uint8_t stag_pcp;
2934         /* S-TAG PCP value configured for the function. */
2935         uint8_t unused_4;
2936         uint16_t stag_tpid;
2937         /*
2938          * S-TAG TPID value configured for the function. This field is
2939          * specified in network byte order.
2940          */
2941         uint16_t ctag_vid;
2942         /* C-TAG VLAN identifier configured for the function. */
2943         uint8_t ctag_pcp;
2944         /* C-TAG PCP value configured for the function. */
2945         uint8_t unused_5;
2946         uint16_t ctag_tpid;
2947         /*
2948          * C-TAG TPID value configured for the function. This field is
2949          * specified in network byte order.
2950          */
2951         uint32_t rsvd2;
2952         /* Future use. */
2953         uint32_t rsvd3;
2954         /* Future use. */
2955         uint32_t unused_6;
2956 };
2957
2958 /* hwrm_func_vlan_cfg */
2959 /*
2960  * Description: This command allows PF driver to configure C-TAG, S-TAG and
2961  * corresponding PCP and TPID values for a function.
2962  */
2963 /* Input (48 bytes) */
2964 struct hwrm_func_vlan_cfg_input {
2965         uint16_t req_type;
2966         /*
2967          * This value indicates what type of request this is. The format
2968          * for the rest of the command is determined by this field.
2969          */
2970         uint16_t cmpl_ring;
2971         /*
2972          * This value indicates the what completion ring the request
2973          * will be optionally completed on. If the value is -1, then no
2974          * CR completion will be generated. Any other value must be a
2975          * valid CR ring_id value for this function.
2976          */
2977         uint16_t seq_id;
2978         /* This value indicates the command sequence number. */
2979         uint16_t target_id;
2980         /*
2981          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
2982          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
2983          * - HWRM
2984          */
2985         uint64_t resp_addr;
2986         /*
2987          * This is the host address where the response will be written
2988          * when the request is complete. This area must be 16B aligned
2989          * and must be cleared to zero before the request is made.
2990          */
2991         uint16_t fid;
2992         /*
2993          * Function ID of the function that is being configured. If set
2994          * to 0xFF... (All Fs), then the configuration is for the
2995          * requesting function.
2996          */
2997         uint8_t unused_0;
2998         uint8_t unused_1;
2999         uint32_t enables;
3000         /* This bit must be '1' for the stag_vid field to be configured. */
3001         #define HWRM_FUNC_VLAN_CFG_INPUT_ENABLES_STAG_VID       UINT32_C(0x1)
3002         /* This bit must be '1' for the ctag_vid field to be configured. */
3003         #define HWRM_FUNC_VLAN_CFG_INPUT_ENABLES_CTAG_VID       UINT32_C(0x2)
3004         /* This bit must be '1' for the stag_pcp field to be configured. */
3005         #define HWRM_FUNC_VLAN_CFG_INPUT_ENABLES_STAG_PCP       UINT32_C(0x4)
3006         /* This bit must be '1' for the ctag_pcp field to be configured. */
3007         #define HWRM_FUNC_VLAN_CFG_INPUT_ENABLES_CTAG_PCP       UINT32_C(0x8)
3008         /* This bit must be '1' for the stag_tpid field to be configured. */
3009         #define HWRM_FUNC_VLAN_CFG_INPUT_ENABLES_STAG_TPID      UINT32_C(0x10)
3010         /* This bit must be '1' for the ctag_tpid field to be configured. */
3011         #define HWRM_FUNC_VLAN_CFG_INPUT_ENABLES_CTAG_TPID      UINT32_C(0x20)
3012         uint16_t stag_vid;
3013         /* S-TAG VLAN identifier configured for the function. */
3014         uint8_t stag_pcp;
3015         /* S-TAG PCP value configured for the function. */
3016         uint8_t unused_2;
3017         uint16_t stag_tpid;
3018         /*
3019          * S-TAG TPID value configured for the function. This field is
3020          * specified in network byte order.
3021          */
3022         uint16_t ctag_vid;
3023         /* C-TAG VLAN identifier configured for the function. */
3024         uint8_t ctag_pcp;
3025         /* C-TAG PCP value configured for the function. */
3026         uint8_t unused_3;
3027         uint16_t ctag_tpid;
3028         /*
3029          * C-TAG TPID value configured for the function. This field is
3030          * specified in network byte order.
3031          */
3032         uint32_t rsvd1;
3033         /* Future use. */
3034         uint32_t rsvd2;
3035         /* Future use. */
3036         uint32_t unused_4;
3037 };
3038
3039 /* Output (16 bytes) */
3040 struct hwrm_func_vlan_cfg_output {
3041         uint16_t error_code;
3042         /*
3043          * Pass/Fail or error type Note: receiver to verify the in
3044          * parameters, and fail the call with an error when appropriate
3045          */
3046         uint16_t req_type;
3047         /* This field returns the type of original request. */
3048         uint16_t seq_id;
3049         /* This field provides original sequence number of the command. */
3050         uint16_t resp_len;
3051         /*
3052          * This field is the length of the response in bytes. The last
3053          * byte of the response is a valid flag that will read as '1'
3054          * when the command has been completely written to memory.
3055          */
3056         uint32_t unused_0;
3057         uint8_t unused_1;
3058         uint8_t unused_2;
3059         uint8_t unused_3;
3060         uint8_t valid;
3061         /*
3062          * This field is used in Output records to indicate that the
3063          * output is completely written to RAM. This field should be
3064          * read as '1' to indicate that the output has been completely
3065          * written. When writing a command completion or response to an
3066          * internal processor, the order of writes has to be such that
3067          * this field is written last.
3068          */
3069 };
3070
3071 /* hwrm_func_cfg */
3072 /*
3073  * Description: This command allows configuration of a PF by the corresponding
3074  * PF driver. This command also allows configuration of a child VF by its parent
3075  * PF driver. The input FID value is used to indicate what function is being
3076  * configured. This allows a PF driver to configure the PF owned by itself or a
3077  * virtual function that is a child of the PF. This command allows to reserve
3078  * resources for a VF by its parent PF. To reverse the process, the command
3079  * should be called with all enables flags cleared for resources. This will free
3080  * allocated resources for the VF and return them to the resource pool. If this
3081  * command is requested by a VF driver to configure or reserve resources, then
3082  * the HWRM shall fail this command. If default MAC address and/or VLAN are
3083  * provided in this command, then the HWRM shall set up appropriate MAC/VLAN
3084  * filters for the function that is being configured. If source properties
3085  * checks are enabled and default MAC address and/or IP address are provided in
3086  * this command, then the HWRM shall set appropriate source property checks
3087  * based on provided MAC and/or IP addresses. The parent PF driver should not
3088  * set MTU/MRU for a VF using this command. This is to allow MTU/MRU setting by
3089  * the VF driver. If the MTU or MRU for a VF is set by the PF driver, then the
3090  * HWRM should ignore it. A function's MTU/MRU should be set prior to allocating
3091  * RX VNICs or TX rings. A PF driver calls hwrm_func_cfg to allocate resources
3092  * for itself or its children VFs. All function drivers shall call hwrm_func_cfg
3093  * to reserve resources. A request to hwrm_func_cfg may not be fully granted;
3094  * that is, a request for resources may be larger than what can be supported by
3095  * the device and the HWRM will allocate the best set of resources available,
3096  * but that may be less than requested. If all the amounts requested could not
3097  * be fulfilled, the HWRM shall allocate what it could and return a status code
3098  * of success. A function driver should call hwrm_func_qcfg immediately after
3099  * hwrm_func_cfg to determine what resources were assigned to the configured
3100  * function. A call by a PF driver to hwrm_func_cfg to allocate resources for
3101  * itself shall only allocate resources for the PF driver to use, not for its
3102  * children VFs. Likewise, a call to hwrm_func_qcfg shall return the resources
3103  * available for the PF driver to use, not what is available to its children
3104  * VFs.
3105  */
3106 /* Input        (88 bytes) */
3107 struct hwrm_func_cfg_input {
3108         uint16_t req_type;
3109         /*
3110          * This value indicates what type of request this is. The format
3111          * for the rest of the command is determined by this field.
3112          */
3113         uint16_t cmpl_ring;
3114         /*
3115          * This value indicates the what completion ring the request
3116          * will be optionally completed on. If the value is -1, then no
3117          * CR completion will be generated. Any other value must be a
3118          * valid CR ring_id value for this function.
3119          */
3120         uint16_t seq_id;
3121         /* This value indicates the command sequence number. */
3122         uint16_t target_id;
3123         /*
3124          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
3125          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
3126          * - HWRM
3127          */
3128         uint64_t resp_addr;
3129         /*
3130          * This is the host address where the response will be written
3131          * when the request is complete. This area must be 16B aligned
3132          * and must be cleared to zero before the request is made.
3133          */
3134         uint16_t fid;
3135         /*
3136          * Function ID of the function that is being configured. If set
3137          * to 0xFF...   (All Fs), then the the configuration is for the
3138          * requesting function.
3139          */
3140         uint8_t unused_0;
3141         uint8_t unused_1;
3142         uint32_t flags;
3143         /*
3144          * When this bit is '1', the function is disabled with source
3145          * MAC address check. This is an anti-spoofing check. If this
3146          * flag is set, then the function shall be configured to
3147          * disallow transmission of frames with the source MAC address
3148          * that is configured for this function.
3149          */
3150         #define HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE     \
3151                 UINT32_C(0x1)
3152         /*
3153          * When this bit is '1', the function is enabled with source MAC
3154          * address check. This is an anti-spoofing check. If this flag
3155          * is set, then the function shall be configured to allow
3156          * transmission of frames with the source MAC address that is
3157          * configured for this function.
3158          */
3159         #define HWRM_FUNC_CFG_INPUT_FLAGS_SRC_MAC_ADDR_CHECK_ENABLE     \
3160                 UINT32_C(0x2)
3161         /* reserved */
3162         #define HWRM_FUNC_CFG_INPUT_FLAGS_RSVD_MASK     UINT32_C(0x1fc)
3163         #define HWRM_FUNC_CFG_INPUT_FLAGS_RSVD_SFT      2
3164         /*
3165          * Standard TX Ring mode is used for the allocation of TX ring
3166          * and underlying scheduling resources that allow bandwidth
3167          * reservation and limit settings on the queried function. If
3168          * set to 1, then standard TX ring mode is requested to be
3169          * enabled on the function being configured.
3170          */
3171         #define HWRM_FUNC_CFG_INPUT_FLAGS_STD_TX_RING_MODE_ENABLE       \
3172                 UINT32_C(0x200)
3173         /*
3174          * Standard TX Ring mode is used for the allocation of TX ring
3175          * and underlying scheduling resources that allow bandwidth
3176          * reservation and limit settings on the queried function. If
3177          * set to 1, then the standard TX ring mode is requested to be
3178          * disabled on the function being configured. In this extended
3179          * TX ring resource mode, the minimum and maximum bandwidth
3180          * settings are not supported to allow the allocation of TX
3181          * rings to span multiple scheduler nodes.
3182          */
3183         #define HWRM_FUNC_CFG_INPUT_FLAGS_STD_TX_RING_MODE_DISABLE      \
3184                 UINT32_C(0x400)
3185         /*
3186          * If this bit is set, virtual mac address configured in this
3187          * command will be persistent over warm boot.
3188          */
3189         #define HWRM_FUNC_CFG_INPUT_FLAGS_VIRT_MAC_PERSIST      UINT32_C(0x800)
3190         uint32_t enables;
3191         /* This bit must be '1' for the mtu field to be configured. */
3192         #define HWRM_FUNC_CFG_INPUT_ENABLES_MTU UINT32_C(0x1)
3193         /* This bit must be '1' for the mru field to be configured. */
3194         #define HWRM_FUNC_CFG_INPUT_ENABLES_MRU UINT32_C(0x2)
3195         /*
3196          * This bit must be '1' for the num_rsscos_ctxs field to be
3197          * configured.
3198          */
3199         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_RSSCOS_CTXS     UINT32_C(0x4)
3200         /*
3201          * This bit must be '1' for the num_cmpl_rings field to be
3202          * configured.
3203          */
3204         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_CMPL_RINGS      UINT32_C(0x8)
3205         /* This bit must be '1' for the num_tx_rings field to be configured. */
3206         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_TX_RINGS        UINT32_C(0x10)
3207         /* This bit must be '1' for the num_rx_rings field to be configured. */
3208         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_RX_RINGS        UINT32_C(0x20)
3209         /* This bit must be '1' for the num_l2_ctxs field to be configured. */
3210         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_L2_CTXS UINT32_C(0x40)
3211         /* This bit must be '1' for the num_vnics field to be configured. */
3212         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_VNICS   UINT32_C(0x80)
3213         /*
3214          * This bit must be '1' for the num_stat_ctxs field to be
3215          * configured.
3216          */
3217         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_STAT_CTXS       UINT32_C(0x100)
3218         /*
3219          * This bit must be '1' for the dflt_mac_addr field to be
3220          * configured.
3221          */
3222         #define HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_MAC_ADDR       UINT32_C(0x200)
3223         /* This bit must be '1' for the dflt_vlan field to be configured. */
3224         #define HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_VLAN   UINT32_C(0x400)
3225         /* This bit must be '1' for the dflt_ip_addr field to be configured. */
3226         #define HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_IP_ADDR        UINT32_C(0x800)
3227         /* This bit must be '1' for the min_bw field to be configured. */
3228         #define HWRM_FUNC_CFG_INPUT_ENABLES_MIN_BW      UINT32_C(0x1000)
3229         /* This bit must be '1' for the max_bw field to be configured. */
3230         #define HWRM_FUNC_CFG_INPUT_ENABLES_MAX_BW      UINT32_C(0x2000)
3231         /*
3232          * This bit must be '1' for the async_event_cr field to be
3233          * configured.
3234          */
3235         #define HWRM_FUNC_CFG_INPUT_ENABLES_ASYNC_EVENT_CR      UINT32_C(0x4000)
3236         /*
3237          * This bit must be '1' for the vlan_antispoof_mode field to be
3238          * configured.
3239          */
3240         #define HWRM_FUNC_CFG_INPUT_ENABLES_VLAN_ANTISPOOF_MODE UINT32_C(0x8000)
3241         /*
3242          * This bit must be '1' for the allowed_vlan_pris field to be
3243          * configured.
3244          */
3245         #define HWRM_FUNC_CFG_INPUT_ENABLES_ALLOWED_VLAN_PRIS UINT32_C(0x10000)
3246         /* This bit must be '1' for the evb_mode field to be configured. */
3247         #define HWRM_FUNC_CFG_INPUT_ENABLES_EVB_MODE    UINT32_C(0x20000)
3248         /*
3249          * This bit must be '1' for the num_mcast_filters field to be
3250          * configured.
3251          */
3252         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_MCAST_FILTERS UINT32_C(0x40000)
3253         /*
3254          * This bit must be '1' for the num_hw_ring_grps field to be
3255          * configured.
3256          */
3257         #define HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS UINT32_C(0x80000)
3258         uint16_t mtu;
3259         /*
3260          * The maximum transmission unit of the function. The HWRM
3261          * should make sure that the mtu of the function does not exceed
3262          * the mtu of the physical port that this function is associated
3263          * with. In addition to configuring mtu per function, it is
3264          * possible to configure mtu per transmit ring. By default, the
3265          * mtu of each transmit ring associated with a function is equal
3266          * to the mtu of the function. The HWRM should make sure that
3267          * the mtu of each transmit ring that is assigned to a function
3268          * has a valid mtu.
3269          */
3270         uint16_t mru;
3271         /*
3272          * The maximum receive unit of the function. The HWRM should
3273          * make sure that the mru of the function does not exceed the
3274          * mru of the physical port that this function is associated
3275          * with. In addition to configuring mru per function, it is
3276          * possible to configure mru per vnic. By default, the mru of
3277          * each vnic associated with a function is equal to the mru of
3278          * the function. The HWRM should make sure that the mru of each
3279          * vnic that is assigned to a function has a valid mru.
3280          */
3281         uint16_t num_rsscos_ctxs;
3282         /* The number of RSS/COS contexts requested for the function. */
3283         uint16_t num_cmpl_rings;
3284         /*
3285          * The number of completion rings requested for the function.
3286          * This does not include the rings allocated to any children
3287          * functions if any.
3288          */
3289         uint16_t num_tx_rings;
3290         /*
3291          * The number of transmit rings requested for the function. This
3292          * does not include the rings allocated to any children
3293          * functions if any.
3294          */
3295         uint16_t num_rx_rings;
3296         /*
3297          * The number of receive rings requested for the function. This
3298          * does not include the rings allocated to any children
3299          * functions if any.
3300          */
3301         uint16_t num_l2_ctxs;
3302         /* The requested number of L2 contexts for the function. */
3303         uint16_t num_vnics;
3304         /* The requested number of vnics for the function. */
3305         uint16_t num_stat_ctxs;
3306         /* The requested number of statistic contexts for the function. */
3307         uint16_t num_hw_ring_grps;
3308         /*
3309          * The number of HW ring groups that should be reserved for this
3310          * function.
3311          */
3312         uint8_t dflt_mac_addr[6];
3313         /* The default MAC address for the function being configured. */
3314         uint16_t dflt_vlan;
3315         /*
3316          * The default VLAN for the function being configured. This
3317          * field's format is same as 802.1Q Tag's Tag Control
3318          * Information  (TCI) format that includes both Priority Code
3319          * Point        (PCP) and VLAN Identifier       (VID).
3320          */
3321         uint32_t dflt_ip_addr[4];
3322         /*
3323          * The default IP address for the function being configured.
3324          * This address is only used in enabling source property check.
3325          */
3326         uint32_t min_bw;
3327         /*
3328          * Minimum BW allocated for this function. The HWRM will
3329          * translate this value into byte counter and time interval used
3330          * for the scheduler inside the device.
3331          */
3332         /* The bandwidth value. */
3333         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_MASK UINT32_C(0xfffffff)
3334         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_SFT 0
3335         /* The granularity of the value (bits or bytes). */
3336         #define HWRM_FUNC_CFG_INPUT_MIN_BW_SCALE        UINT32_C(0x10000000)
3337         /* Value is in bits. */
3338         #define HWRM_FUNC_CFG_INPUT_MIN_BW_SCALE_BITS   (UINT32_C(0x0) << 28)
3339         /* Value is in bytes. */
3340         #define HWRM_FUNC_CFG_INPUT_MIN_BW_SCALE_BYTES  (UINT32_C(0x1) << 28)
3341         #define HWRM_FUNC_CFG_INPUT_MIN_BW_SCALE_LAST \
3342                 FUNC_CFG_INPUT_MIN_BW_SCALE_BYTES
3343         /* bw_value_unit is 3 b */
3344         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_MASK    \
3345                 UINT32_C(0xe0000000)
3346         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_SFT    29
3347         /* Value is in Mb or MB (base 10). */
3348         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_MEGA \
3349                 (UINT32_C(0x0) << 29)
3350         /* Value is in Kb or KB (base 10). */
3351         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_KILO \
3352                 (UINT32_C(0x2) << 29)
3353         /* Value is in bits or bytes. */
3354         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_BASE \
3355                 (UINT32_C(0x4) << 29)
3356         /* Value is in Gb or GB (base 10). */
3357         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_GIGA \
3358                 (UINT32_C(0x6) << 29)
3359         /* Value is in 1/100th of a percentage of total bandwidth. */
3360         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_PERCENT1_100 \
3361                 (UINT32_C(0x1) << 29)
3362         /* Invalid unit */
3363         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_INVALID \
3364                 (UINT32_C(0x7) << 29)
3365         #define HWRM_FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_LAST \
3366                 FUNC_CFG_INPUT_MIN_BW_BW_VALUE_UNIT_INVALID
3367         uint32_t max_bw;
3368         /*
3369          * Maximum BW allocated for this function. The HWRM will
3370          * translate this value into byte counter and time interval used
3371          * for the scheduler inside the device.
3372          */
3373         /* The bandwidth value. */
3374         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_MASK \
3375                 UINT32_C(0xfffffff)
3376         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_SFT 0
3377         /* The granularity of the value (bits or bytes). */
3378         #define HWRM_FUNC_CFG_INPUT_MAX_BW_SCALE        UINT32_C(0x10000000)
3379         /* Value is in bits. */
3380         #define HWRM_FUNC_CFG_INPUT_MAX_BW_SCALE_BITS   (UINT32_C(0x0) << 28)
3381         /* Value is in bytes. */
3382         #define HWRM_FUNC_CFG_INPUT_MAX_BW_SCALE_BYTES  (UINT32_C(0x1) << 28)
3383         #define HWRM_FUNC_CFG_INPUT_MAX_BW_SCALE_LAST \
3384                 FUNC_CFG_INPUT_MAX_BW_SCALE_BYTES
3385         /* bw_value_unit is 3 b */
3386         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_MASK    \
3387                 UINT32_C(0xe0000000)
3388         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_SFT    29
3389         /* Value is in Mb or MB (base 10). */
3390         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_MEGA   \
3391                 (UINT32_C(0x0) << 29)
3392         /* Value is in Kb or KB (base 10). */
3393         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_KILO   \
3394                 (UINT32_C(0x2) << 29)
3395         /* Value is in bits or bytes. */
3396         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_BASE \
3397                 (UINT32_C(0x4) << 29)
3398         /* Value is in Gb or GB (base 10). */
3399         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_GIGA \
3400                 (UINT32_C(0x6) << 29)
3401         /* Value is in 1/100th of a percentage of total bandwidth. */
3402         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_PERCENT1_100 \
3403                 (UINT32_C(0x1) << 29)
3404         /* Invalid unit */
3405         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_INVALID \
3406                 (UINT32_C(0x7) << 29)
3407         #define HWRM_FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_LAST \
3408                 FUNC_CFG_INPUT_MAX_BW_BW_VALUE_UNIT_INVALID
3409         uint16_t async_event_cr;
3410         /*
3411          * ID of the target completion ring for receiving asynchronous
3412          * event completions. If this field is not valid, then the HWRM
3413          * shall use the default completion ring of the function that is
3414          * being configured as the target completion ring for providing
3415          * any asynchronous event completions for that function. If this
3416          * field is valid, then the HWRM shall use the completion ring
3417          * identified by this ID as the target completion ring for
3418          * providing any asynchronous event completions for the function
3419          * that is being configured.
3420          */
3421         uint8_t vlan_antispoof_mode;
3422         /* VLAN Anti-spoofing mode. */
3423         /* No VLAN anti-spoofing checks are enabled */
3424         #define HWRM_FUNC_CFG_INPUT_VLAN_ANTISPOOF_MODE_NOCHECK UINT32_C(0x0)
3425         /* Validate VLAN against the configured VLAN(s) */
3426         #define HWRM_FUNC_CFG_INPUT_VLAN_ANTISPOOF_MODE_VALIDATE_VLAN \
3427                 UINT32_C(0x1)
3428         /* Insert VLAN if it does not exist, otherwise discard */
3429         #define HWRM_FUNC_CFG_INPUT_VLAN_ANTISPOOF_MODE_INSERT_IF_VLANDNE \
3430                 UINT32_C(0x2)
3431         /*
3432          * Insert VLAN if it does not exist, override
3433          * VLAN if it exists
3434          */
3435         #define \
3436         HWRM_FUNC_CFG_INPUT_VLAN_ANTISPOOF_MODE_INSERT_OR_OVERRIDE_VLAN \
3437                 UINT32_C(0x3)
3438         uint8_t allowed_vlan_pris;
3439         /*
3440          * This bit field defines VLAN PRIs that are allowed on this
3441          * function. If nth bit is set, then VLAN PRI n is allowed on
3442          * this function.
3443          */
3444         uint8_t evb_mode;
3445         /*
3446          * The HWRM shall allow a PF driver to change EVB mode for the
3447          * partition it belongs to. The HWRM shall not allow a VF driver
3448          * to change the EVB mode. The HWRM shall take into account the
3449          * switching of EVB mode from one to another and reconfigure
3450          * hardware resources as appropriately. The switching from VEB
3451          * to VEPA mode requires the disabling of the loopback traffic.
3452          * Additionally, source knock outs are handled differently in
3453          * VEB and VEPA modes.
3454          */
3455         /* No Edge Virtual Bridging     (EVB) */
3456         #define HWRM_FUNC_CFG_INPUT_EVB_MODE_NO_EVB     UINT32_C(0x0)
3457         /* Virtual Ethernet Bridge      (VEB) */
3458         #define HWRM_FUNC_CFG_INPUT_EVB_MODE_VEB        UINT32_C(0x1)
3459         /* Virtual Ethernet Port Aggregator     (VEPA) */
3460         #define HWRM_FUNC_CFG_INPUT_EVB_MODE_VEPA       UINT32_C(0x2)
3461         uint8_t unused_2;
3462         uint16_t num_mcast_filters;
3463         /*
3464          * The number of multicast filters that should be reserved for
3465          * this function on the RX side.
3466          */
3467 } __attribute__((packed));
3468
3469 /* Output       (16 bytes) */
3470 struct hwrm_func_cfg_output {
3471         uint16_t error_code;
3472         /*
3473          * Pass/Fail or error type Note: receiver to verify the in
3474          * parameters, and fail the call with an error when appropriate
3475          */
3476         uint16_t req_type;
3477         /* This field returns the type of original request. */
3478         uint16_t seq_id;
3479         /* This field provides original sequence number of the command. */
3480         uint16_t resp_len;
3481         /*
3482          * This field is the length of the response in bytes. The last
3483          * byte of the response is a valid flag that will read as '1'
3484          * when the command has been completely written to memory.
3485          */
3486         uint32_t unused_0;
3487         uint8_t unused_1;
3488         uint8_t unused_2;
3489         uint8_t unused_3;
3490         uint8_t valid;
3491         /*
3492          * This field is used in Output records to indicate that the
3493          * output is completely written to RAM. This field should be
3494          * read as '1' to indicate that the output has been completely
3495          * written. When writing a command completion or response to an
3496          * internal processor, the order of writes has to be such that
3497          * this field is written last.
3498          */
3499 } __attribute__((packed));
3500
3501 /* hwrm_func_qstats */
3502 /*
3503  * Description: This command returns statistics of a function. The input FID
3504  * value is used to indicate what function is being queried. This allows a
3505  * physical function driver to query virtual functions that are children of the
3506  * physical function. The HWRM shall return any unsupported counter with a value
3507  * of 0xFFFFFFFF for 32-bit counters and 0xFFFFFFFFFFFFFFFF for 64-bit counters.
3508  */
3509 /* Input        (24 bytes) */
3510 struct hwrm_func_qstats_input {
3511         uint16_t req_type;
3512         /*
3513          * This value indicates what type of request this is. The format
3514          * for the rest of the command is determined by this field.
3515          */
3516         uint16_t cmpl_ring;
3517         /*
3518          * This value indicates the what completion ring the request
3519          * will be optionally completed on. If the value is -1, then no
3520          * CR completion will be generated. Any other value must be a
3521          * valid CR ring_id value for this function.
3522          */
3523         uint16_t seq_id;
3524         /* This value indicates the command sequence number. */
3525         uint16_t target_id;
3526         /*
3527          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
3528          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
3529          * - HWRM
3530          */
3531         uint64_t resp_addr;
3532         /*
3533          * This is the host address where the response will be written
3534          * when the request is complete. This area must be 16B aligned
3535          * and must be cleared to zero before the request is made.
3536          */
3537         uint16_t fid;
3538         /*
3539          * Function ID of the function that is being queried. 0xFF...
3540          *      (All Fs) if the query is for the requesting function.
3541          */
3542         uint16_t unused_0[3];
3543 } __attribute__((packed));
3544
3545 /* Output       (176 bytes) */
3546 struct hwrm_func_qstats_output {
3547         uint16_t error_code;
3548         /*
3549          * Pass/Fail or error type Note: receiver to verify the in
3550          * parameters, and fail the call with an error when appropriate
3551          */
3552         uint16_t req_type;
3553         /* This field returns the type of original request. */
3554         uint16_t seq_id;
3555         /* This field provides original sequence number of the command. */
3556         uint16_t resp_len;
3557         /*
3558          * This field is the length of the response in bytes. The last
3559          * byte of the response is a valid flag that will read as '1'
3560          * when the command has been completely written to memory.
3561          */
3562         uint64_t tx_ucast_pkts;
3563         /* Number of transmitted unicast packets on the function. */
3564         uint64_t tx_mcast_pkts;
3565         /* Number of transmitted multicast packets on the function. */
3566         uint64_t tx_bcast_pkts;
3567         /* Number of transmitted broadcast packets on the function. */
3568         uint64_t tx_err_pkts;
3569         /*
3570          * Number of transmitted packets that were discarded due to
3571          * internal NIC resource problems. For transmit, this can only
3572          * happen if TMP is configured to allow dropping in HOL blocking
3573          * conditions, which is not a normal configuration.
3574          */
3575         uint64_t tx_drop_pkts;
3576         /*
3577          * Number of dropped packets on transmit path on the function.
3578          * These are packets that have been marked for drop by the TE
3579          * CFA block or are packets that exceeded the transmit MTU limit
3580          * for the function.
3581          */
3582         uint64_t tx_ucast_bytes;
3583         /* Number of transmitted bytes for unicast traffic on the function. */
3584         uint64_t tx_mcast_bytes;
3585         /*
3586          * Number of transmitted bytes for multicast traffic on the
3587          * function.
3588          */
3589         uint64_t tx_bcast_bytes;
3590         /*
3591          * Number of transmitted bytes for broadcast traffic on the
3592          * function.
3593          */
3594         uint64_t rx_ucast_pkts;
3595         /* Number of received unicast packets on the function. */
3596         uint64_t rx_mcast_pkts;
3597         /* Number of received multicast packets on the function. */
3598         uint64_t rx_bcast_pkts;
3599         /* Number of received broadcast packets on the function. */
3600         uint64_t rx_err_pkts;
3601         /*
3602          * Number of received packets that were discarded on the
3603          * function due to resource limitations. This can happen for 3
3604          * reasons. # The BD used for the packet has a bad format. #
3605          * There were no BDs available in the ring for the packet. #
3606          * There were no BDs available on-chip for the packet.
3607          */
3608         uint64_t rx_drop_pkts;
3609         /*
3610          * Number of dropped packets on received path on the function.
3611          * These are packets that have been marked for drop by the RE
3612          * CFA.
3613          */
3614         uint64_t rx_ucast_bytes;
3615         /* Number of received bytes for unicast traffic on the function. */
3616         uint64_t rx_mcast_bytes;
3617         /* Number of received bytes for multicast traffic on the function. */
3618         uint64_t rx_bcast_bytes;
3619         /* Number of received bytes for broadcast traffic on the function. */
3620         uint64_t rx_agg_pkts;
3621         /* Number of aggregated unicast packets on the function. */
3622         uint64_t rx_agg_bytes;
3623         /* Number of aggregated unicast bytes on the function. */
3624         uint64_t rx_agg_events;
3625         /* Number of aggregation events on the function. */
3626         uint64_t rx_agg_aborts;
3627         /* Number of aborted aggregations on the function. */
3628         uint32_t unused_0;
3629         uint8_t unused_1;
3630         uint8_t unused_2;
3631         uint8_t unused_3;
3632         uint8_t valid;
3633         /*
3634          * This field is used in Output records to indicate that the
3635          * output is completely written to RAM. This field should be
3636          * read as '1' to indicate that the output has been completely
3637          * written. When writing a command completion or response to an
3638          * internal processor, the order of writes has to be such that
3639          * this field is written last.
3640          */
3641 } __attribute__((packed));
3642
3643 /* hwrm_func_clr_stats */
3644 /*
3645  * Description: This command clears statistics of a function. The input FID
3646  * value is used to indicate what function's statistics is being cleared. This
3647  * allows a physical function driver to clear statistics of virtual functions
3648  * that are children of the physical function.
3649  */
3650 /* Input        (24 bytes) */
3651 struct hwrm_func_clr_stats_input {
3652         uint16_t req_type;
3653         /*
3654          * This value indicates what type of request this is. The format
3655          * for the rest of the command is determined by this field.
3656          */
3657         uint16_t cmpl_ring;
3658         /*
3659          * This value indicates the what completion ring the request
3660          * will be optionally completed on. If the value is -1, then no
3661          * CR completion will be generated. Any other value must be a
3662          * valid CR ring_id value for this function.
3663          */
3664         uint16_t seq_id;
3665         /* This value indicates the command sequence number. */
3666         uint16_t target_id;
3667         /*
3668          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
3669          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
3670          * - HWRM
3671          */
3672         uint64_t resp_addr;
3673         /*
3674          * This is the host address where the response will be written
3675          * when the request is complete. This area must be 16B aligned
3676          * and must be cleared to zero before the request is made.
3677          */
3678         uint16_t fid;
3679         /*
3680          * Function ID of the function. 0xFF... (All Fs) if the query is
3681          * for the requesting function.
3682          */
3683         uint16_t unused_0[3];
3684 } __attribute__((packed));
3685
3686 /* Output       (16 bytes) */
3687 struct hwrm_func_clr_stats_output {
3688         uint16_t error_code;
3689         /*
3690          * Pass/Fail or error type Note: receiver to verify the in
3691          * parameters, and fail the call with an error when appropriate
3692          */
3693         uint16_t req_type;
3694         /* This field returns the type of original request. */
3695         uint16_t seq_id;
3696         /* This field provides original sequence number of the command. */
3697         uint16_t resp_len;
3698         /*
3699          * This field is the length of the response in bytes. The last
3700          * byte of the response is a valid flag that will read as '1'
3701          * when the command has been completely written to memory.
3702          */
3703         uint32_t unused_0;
3704         uint8_t unused_1;
3705         uint8_t unused_2;
3706         uint8_t unused_3;
3707         uint8_t valid;
3708         /*
3709          * This field is used in Output records to indicate that the
3710          * output is completely written to RAM. This field should be
3711          * read as '1' to indicate that the output has been completely
3712          * written. When writing a command completion or response to an
3713          * internal processor, the order of writes has to be such that
3714          * this field is written last.
3715          */
3716 } __attribute__((packed));
3717
3718 /* hwrm_func_vf_vnic_ids_query */
3719 /* Description: This command is used to query vf vnic ids. */
3720 /* Input        (32 bytes) */
3721 struct hwrm_func_vf_vnic_ids_query_input {
3722         uint16_t req_type;
3723         /*
3724          * This value indicates what type of request this is. The format
3725          * for the rest of the command is determined by this field.
3726          */
3727         uint16_t cmpl_ring;
3728         /*
3729          * This value indicates the what completion ring the request
3730          * will be optionally completed on. If the value is -1, then no
3731          * CR completion will be generated. Any other value must be a
3732          * valid CR ring_id value for this function.
3733          */
3734         uint16_t seq_id;
3735         /* This value indicates the command sequence number. */
3736         uint16_t target_id;
3737         /*
3738          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
3739          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
3740          * - HWRM
3741          */
3742         uint64_t resp_addr;
3743         /*
3744          * This is the host address where the response will be written
3745          * when the request is complete. This area must be 16B aligned
3746          * and must be cleared to zero before the request is made.
3747          */
3748         uint16_t vf_id;
3749         /*
3750          * This value is used to identify a Virtual Function    (VF). The
3751          * scope of VF ID is local within a PF.
3752          */
3753         uint8_t unused_0;
3754         uint8_t unused_1;
3755         uint32_t max_vnic_id_cnt;
3756         /* Max number of vnic ids in vnic id table */
3757         uint64_t vnic_id_tbl_addr;
3758         /* This is the address for VF VNIC ID table */
3759 } __attribute__((packed));
3760
3761 /* Output       (16 bytes) */
3762 struct hwrm_func_vf_vnic_ids_query_output {
3763         uint16_t error_code;
3764         /*
3765          * Pass/Fail or error type Note: receiver to verify the in
3766          * parameters, and fail the call with an error when appropriate
3767          */
3768         uint16_t req_type;
3769         /* This field returns the type of original request. */
3770         uint16_t seq_id;
3771         /* This field provides original sequence number of the command. */
3772         uint16_t resp_len;
3773         /*
3774          * This field is the length of the response in bytes. The last
3775          * byte of the response is a valid flag that will read as '1'
3776          * when the command has been completely written to memory.
3777          */
3778         uint32_t vnic_id_cnt;
3779         /*
3780          * Actual number of vnic ids Each VNIC ID is written as a 32-bit
3781          * number.
3782          */
3783         uint8_t unused_0;
3784         uint8_t unused_1;
3785         uint8_t unused_2;
3786         uint8_t valid;
3787         /*
3788          * This field is used in Output records to indicate that the
3789          * output is completely written to RAM. This field should be
3790          * read as '1' to indicate that the output has been completely
3791          * written. When writing a command completion or response to an
3792          * internal processor, the order of writes has to be such that
3793          * this field is written last.
3794          */
3795 } __attribute__((packed));
3796
3797 /* hwrm_func_drv_rgtr */
3798 /*
3799  * Description: This command is used by the function driver to register its
3800  * information with the HWRM. A function driver shall implement this command. A
3801  * function driver shall use this command during the driver initialization right
3802  * after the HWRM version discovery and default ring resources allocation.
3803  */
3804 /* Input        (80 bytes) */
3805 struct hwrm_func_drv_rgtr_input {
3806         uint16_t req_type;
3807         /*
3808          * This value indicates what type of request this is. The format
3809          * for the rest of the command is determined by this field.
3810          */
3811         uint16_t cmpl_ring;
3812         /*
3813          * This value indicates the what completion ring the request
3814          * will be optionally completed on. If the value is -1, then no
3815          * CR completion will be generated. Any other value must be a
3816          * valid CR ring_id value for this function.
3817          */
3818         uint16_t seq_id;
3819         /* This value indicates the command sequence number. */
3820         uint16_t target_id;
3821         /*
3822          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
3823          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
3824          * - HWRM
3825          */
3826         uint64_t resp_addr;
3827         /*
3828          * This is the host address where the response will be written
3829          * when the request is complete. This area must be 16B aligned
3830          * and must be cleared to zero before the request is made.
3831          */
3832         uint32_t flags;
3833         /*
3834          * When this bit is '1', the function driver is requesting all
3835          * requests from its children VF drivers to be forwarded to
3836          * itself. This flag can only be set by the PF driver. If a VF
3837          * driver sets this flag, it should be ignored by the HWRM.
3838          */
3839         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_ALL_MODE     UINT32_C(0x1)
3840         /*
3841          * When this bit is '1', the function is requesting none of the
3842          * requests from its children VF drivers to be forwarded to
3843          * itself. This flag can only be set by the PF driver. If a VF
3844          * driver sets this flag, it should be ignored by the HWRM.
3845          */
3846         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE    UINT32_C(0x2)
3847         uint32_t enables;
3848         /* This bit must be '1' for the os_type field to be configured. */
3849         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_OS_TYPE        UINT32_C(0x1)
3850         /* This bit must be '1' for the ver field to be configured. */
3851         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VER    UINT32_C(0x2)
3852         /* This bit must be '1' for the timestamp field to be configured. */
3853         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_TIMESTAMP      UINT32_C(0x4)
3854         /* This bit must be '1' for the vf_req_fwd field to be configured. */
3855         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VF_INPUT_FWD   UINT32_C(0x8)
3856         /*
3857          * This bit must be '1' for the async_event_fwd field to be
3858          * configured.
3859          */
3860         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_ASYNC_EVENT_FWD UINT32_C(0x10)
3861         uint16_t os_type;
3862         /*
3863          * This value indicates the type of OS. The values are based on
3864          * CIM_OperatingSystem.mof file as published by the DMTF.
3865          */
3866         /* Unknown */
3867         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_UNKNOWN        UINT32_C(0x0)
3868         /* Other OS not listed below. */
3869         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_OTHER  UINT32_C(0x1)
3870         /* MSDOS OS. */
3871         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_MSDOS  UINT32_C(0xe)
3872         /* Windows OS. */
3873         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WINDOWS        UINT32_C(0x12)
3874         /* Solaris OS. */
3875         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_SOLARIS        UINT32_C(0x1d)
3876         /* Linux OS. */
3877         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_LINUX  UINT32_C(0x24)
3878         /* FreeBSD OS. */
3879         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_FREEBSD        UINT32_C(0x2a)
3880         /* VMware ESXi OS. */
3881         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_ESXI   UINT32_C(0x68)
3882         /* Microsoft Windows 8 64-bit OS. */
3883         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN864 UINT32_C(0x73)
3884         /* Microsoft Windows Server 2012 R2 OS. */
3885         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN2012R2      UINT32_C(0x74)
3886         uint8_t ver_maj;
3887         /* This is the major version of the driver. */
3888         uint8_t ver_min;
3889         /* This is the minor version of the driver. */
3890         uint8_t ver_upd;
3891         /* This is the update version of the driver. */
3892         uint8_t unused_0;
3893         uint16_t unused_1;
3894         uint32_t timestamp;
3895         /*
3896          * This is a 32-bit timestamp provided by the driver for keep
3897          * alive. The timestamp is in multiples of 1ms.
3898          */
3899         uint32_t unused_2;
3900         uint32_t vf_req_fwd[8];
3901         /*
3902          * This is a 256-bit bit mask provided by the PF driver for
3903          * letting the HWRM know what commands issued by the VF driver
3904          * to the HWRM should be forwarded to the PF driver. Nth bit
3905          * refers to the Nth req_type. Setting Nth bit to 1 indicates
3906          * that requests from the VF driver with req_type equal to N
3907          * shall be forwarded to the parent PF driver. This field is not
3908          * valid for the VF driver.
3909          */
3910         uint32_t async_event_fwd[8];
3911         /*
3912          * This is a 256-bit bit mask provided by the function driver
3913          *      (PF or VF driver) to indicate the list of asynchronous event
3914          * completions to be forwarded. Nth bit refers to the Nth
3915          * event_id. Setting Nth bit to 1 by the function driver shall
3916          * result in the HWRM forwarding asynchronous event completion
3917          * with event_id equal to N. If all bits are set to 0   (value of
3918          * 0), then the HWRM shall not forward any asynchronous event
3919          * completion to this function driver.
3920          */
3921 } __attribute__((packed));
3922
3923 /* Output       (16 bytes) */
3924 struct hwrm_func_drv_rgtr_output {
3925         uint16_t error_code;
3926         /*
3927          * Pass/Fail or error type Note: receiver to verify the in
3928          * parameters, and fail the call with an error when appropriate
3929          */
3930         uint16_t req_type;
3931         /* This field returns the type of original request. */
3932         uint16_t seq_id;
3933         /* This field provides original sequence number of the command. */
3934         uint16_t resp_len;
3935         /*
3936          * This field is the length of the response in bytes. The last
3937          * byte of the response is a valid flag that will read as '1'
3938          * when the command has been completely written to memory.
3939          */
3940         uint32_t unused_0;
3941         uint8_t unused_1;
3942         uint8_t unused_2;
3943         uint8_t unused_3;
3944         uint8_t valid;
3945         /*
3946          * This field is used in Output records to indicate that the
3947          * output is completely written to RAM. This field should be
3948          * read as '1' to indicate that the output has been completely
3949          * written. When writing a command completion or response to an
3950          * internal processor, the order of writes has to be such that
3951          * this field is written last.
3952          */
3953 } __attribute__((packed));
3954
3955 /* hwrm_func_drv_unrgtr */
3956 /*
3957  * Description: This command is used by the function driver to un register with
3958  * the HWRM. A function driver shall implement this command. A function driver
3959  * shall use this command during the driver unloading.
3960  */
3961 /* Input        (24 bytes) */
3962 struct hwrm_func_drv_unrgtr_input {
3963         uint16_t req_type;
3964         /*
3965          * This value indicates what type of request this is. The format
3966          * for the rest of the command is determined by this field.
3967          */
3968         uint16_t cmpl_ring;
3969         /*
3970          * This value indicates the what completion ring the request
3971          * will be optionally completed on. If the value is -1, then no
3972          * CR completion will be generated. Any other value must be a
3973          * valid CR ring_id value for this function.
3974          */
3975         uint16_t seq_id;
3976         /* This value indicates the command sequence number. */
3977         uint16_t target_id;
3978         /*
3979          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
3980          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
3981          * - HWRM
3982          */
3983         uint64_t resp_addr;
3984         /*
3985          * This is the host address where the response will be written
3986          * when the request is complete. This area must be 16B aligned
3987          * and must be cleared to zero before the request is made.
3988          */
3989         uint32_t flags;
3990         /*
3991          * When this bit is '1', the function driver is notifying the
3992          * HWRM to prepare for the shutdown.
3993          */
3994         #define HWRM_FUNC_DRV_UNRGTR_INPUT_FLAGS_PREPARE_FOR_SHUTDOWN   \
3995                 UINT32_C(0x1)
3996         uint32_t unused_0;
3997 } __attribute__((packed));
3998
3999 /* Output       (16 bytes) */
4000 struct hwrm_func_drv_unrgtr_output {
4001         uint16_t error_code;
4002         /*
4003          * Pass/Fail or error type Note: receiver to verify the in
4004          * parameters, and fail the call with an error when appropriate
4005          */
4006         uint16_t req_type;
4007         /* This field returns the type of original request. */
4008         uint16_t seq_id;
4009         /* This field provides original sequence number of the command. */
4010         uint16_t resp_len;
4011         /*
4012          * This field is the length of the response in bytes. The last
4013          * byte of the response is a valid flag that will read as '1'
4014          * when the command has been completely written to memory.
4015          */
4016         uint32_t unused_0;
4017         uint8_t unused_1;
4018         uint8_t unused_2;
4019         uint8_t unused_3;
4020         uint8_t valid;
4021         /*
4022          * This field is used in Output records to indicate that the
4023          * output is completely written to RAM. This field should be
4024          * read as '1' to indicate that the output has been completely
4025          * written. When writing a command completion or response to an
4026          * internal processor, the order of writes has to be such that
4027          * this field is written last.
4028          */
4029 } __attribute__((packed));
4030
4031 /* hwrm_func_buf_rgtr */
4032 /*
4033  * Description: This command is used by the PF driver to register buffers used
4034  * in the PF-VF communication with the HWRM. The PF driver uses this command to
4035  * register buffers for each PF-VF channel. A parent PF may issue this command
4036  * per child VF. If VF ID is not valid, then this command is used to register
4037  * buffers for all children VFs of the PF.
4038  */
4039 /* Input        (128 bytes) */
4040 struct hwrm_func_buf_rgtr_input {
4041         uint16_t req_type;
4042         /*
4043          * This value indicates what type of request this is. The format
4044          * for the rest of the command is determined by this field.
4045          */
4046         uint16_t cmpl_ring;
4047         /*
4048          * This value indicates the what completion ring the request
4049          * will be optionally completed on. If the value is -1, then no
4050          * CR completion will be generated. Any other value must be a
4051          * valid CR ring_id value for this function.
4052          */
4053         uint16_t seq_id;
4054         /* This value indicates the command sequence number. */
4055         uint16_t target_id;
4056         /*
4057          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
4058          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
4059          * - HWRM
4060          */
4061         uint64_t resp_addr;
4062         /*
4063          * This is the host address where the response will be written
4064          * when the request is complete. This area must be 16B aligned
4065          * and must be cleared to zero before the request is made.
4066          */
4067         uint32_t enables;
4068         /* This bit must be '1' for the vf_id field to be configured. */
4069         #define HWRM_FUNC_BUF_RGTR_INPUT_ENABLES_VF_ID  UINT32_C(0x1)
4070         /* This bit must be '1' for the err_buf_addr field to be configured. */
4071         #define HWRM_FUNC_BUF_RGTR_INPUT_ENABLES_ERR_BUF_ADDR   UINT32_C(0x2)
4072         uint16_t vf_id;
4073         /*
4074          * This value is used to identify a Virtual Function    (VF). The
4075          * scope of VF ID is local within a PF.
4076          */
4077         uint16_t req_buf_num_pages;
4078         /*
4079          * This field represents the number of pages used for request
4080          * buffer(s).
4081          */
4082         uint16_t req_buf_page_size;
4083         /* This field represents the page size used for request buffer(s). */
4084         /* 16 bytes */
4085         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_16B UINT32_C(0x4)
4086         /* 4 Kbytes */
4087         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_4K UINT32_C(0xc)
4088         /* 8 Kbytes */
4089         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_8K UINT32_C(0xd)
4090         /* 64 Kbytes */
4091         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_64K UINT32_C(0x10)
4092         /* 2 Mbytes */
4093         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_2M UINT32_C(0x15)
4094         /* 4 Mbytes */
4095         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_4M UINT32_C(0x16)
4096         /* 1 Gbytes */
4097         #define HWRM_FUNC_BUF_RGTR_INPUT_INPUT_BUF_PAGE_SIZE_1G UINT32_C(0x1e)
4098         uint16_t req_buf_len;
4099         /* The length of the request buffer per VF in bytes. */
4100         uint16_t resp_buf_len;
4101         /* The length of the response buffer in bytes. */
4102         uint8_t unused_0;
4103         uint8_t unused_1;
4104         uint64_t req_buf_page_addr[10];
4105         /* This field represents the page address of req buffer. */
4106         uint64_t error_buf_addr;
4107         /*
4108          * This field is used to receive the error reporting from the
4109          * chipset. Only applicable for PFs.
4110          */
4111         uint64_t resp_buf_addr;
4112         /* This field is used to receive the response forwarded by the HWRM. */
4113 } __attribute__((packed));
4114
4115 /* Output       (16 bytes) */
4116 struct hwrm_func_buf_rgtr_output {
4117         uint16_t error_code;
4118         /*
4119          * Pass/Fail or error type Note: receiver to verify the in
4120          * parameters, and fail the call with an error when appropriate
4121          */
4122         uint16_t req_type;
4123         /* This field returns the type of original request. */
4124         uint16_t seq_id;
4125         /* This field provides original sequence number of the command. */
4126         uint16_t resp_len;
4127         /*
4128          * This field is the length of the response in bytes. The last
4129          * byte of the response is a valid flag that will read as '1'
4130          * when the command has been completely written to memory.
4131          */
4132         uint32_t unused_0;
4133         uint8_t unused_1;
4134         uint8_t unused_2;
4135         uint8_t unused_3;
4136         uint8_t valid;
4137         /*
4138          * This field is used in Output records to indicate that the
4139          * output is completely written to RAM. This field should be
4140          * read as '1' to indicate that the output has been completely
4141          * written. When writing a command completion or response to an
4142          * internal processor, the order of writes has to be such that
4143          * this field is written last.
4144          */
4145 } __attribute__((packed));
4146
4147 /* hwrm_func_buf_unrgtr */
4148 /*
4149  * Description: This command is used by the PF driver to unregister buffers used
4150  * in the PF-VF communication with the HWRM. The PF driver uses this command to
4151  * unregister buffers for PF-VF communication. A parent PF may issue this
4152  * command to unregister buffers for communication between the PF and a specific
4153  * VF. If the VF ID is not valid, then this command is used to unregister
4154  * buffers used for communications with all children VFs of the PF.
4155  */
4156 /* Input        (24 bytes) */
4157 struct hwrm_func_buf_unrgtr_input {
4158         uint16_t req_type;
4159         /*
4160          * This value indicates what type of request this is. The format
4161          * for the rest of the command is determined by this field.
4162          */
4163         uint16_t cmpl_ring;
4164         /*
4165          * This value indicates the what completion ring the request
4166          * will be optionally completed on. If the value is -1, then no
4167          * CR completion will be generated. Any other value must be a
4168          * valid CR ring_id value for this function.
4169          */
4170         uint16_t seq_id;
4171         /* This value indicates the command sequence number. */
4172         uint16_t target_id;
4173         /*
4174          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
4175          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
4176          * - HWRM
4177          */
4178         uint64_t resp_addr;
4179         /*
4180          * This is the host address where the response will be written
4181          * when the request is complete. This area must be 16B aligned
4182          * and must be cleared to zero before the request is made.
4183          */
4184         uint32_t enables;
4185         /* This bit must be '1' for the vf_id field to be configured. */
4186         #define HWRM_FUNC_BUF_UNRGTR_INPUT_ENABLES_VF_ID        UINT32_C(0x1)
4187         uint16_t vf_id;
4188         /*
4189          * This value is used to identify a Virtual Function    (VF). The
4190          * scope of VF ID is local within a PF.
4191          */
4192         uint16_t unused_0;
4193 } __attribute__((packed));
4194
4195 /* Output       (16 bytes) */
4196 struct hwrm_func_buf_unrgtr_output {
4197         uint16_t error_code;
4198         /*
4199          * Pass/Fail or error type Note: receiver to verify the in
4200          * parameters, and fail the call with an error when appropriate
4201          */
4202         uint16_t req_type;
4203         /* This field returns the type of original request. */
4204         uint16_t seq_id;
4205         /* This field provides original sequence number of the command. */
4206         uint16_t resp_len;
4207         /*
4208          * This field is the length of the response in bytes. The last
4209          * byte of the response is a valid flag that will read as '1'
4210          * when the command has been completely written to memory.
4211          */
4212         uint32_t unused_0;
4213         uint8_t unused_1;
4214         uint8_t unused_2;
4215         uint8_t unused_3;
4216         uint8_t valid;
4217         /*
4218          * This field is used in Output records to indicate that the
4219          * output is completely written to RAM. This field should be
4220          * read as '1' to indicate that the output has been completely
4221          * written. When writing a command completion or response to an
4222          * internal processor, the order of writes has to be such that
4223          * this field is written last.
4224          */
4225 } __attribute__((packed));
4226
4227 /* hwrm_func_vf_cfg */
4228 /*
4229  * Description: This command allows configuration of a VF by its driver. If this
4230  * function is called by a PF driver, then the HWRM shall fail this command. If
4231  * guest VLAN and/or MAC address are provided in this command, then the HWRM
4232  * shall set up appropriate MAC/VLAN filters for the VF that is being
4233  * configured. A VF driver should set VF MTU/MRU using this command prior to
4234  * allocating RX VNICs or TX rings for the corresponding VF.
4235  */
4236 /* Input (32 bytes) */
4237
4238 struct hwrm_func_vf_cfg_input {
4239         uint16_t req_type;
4240         /*
4241          * This value indicates what type of request this is. The format for the
4242          * rest of the command is determined by this field.
4243          */
4244         uint16_t cmpl_ring;
4245         /*
4246          * This value indicates the what completion ring the request will be
4247          * optionally completed on. If the value is -1, then no CR completion
4248          * will be generated. Any other value must be a valid CR ring_id value
4249          * for this function.
4250          */
4251         uint16_t seq_id;
4252         /* This value indicates the command sequence number. */
4253         uint16_t target_id;
4254         /*
4255          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
4256          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
4257          */
4258         uint64_t resp_addr;
4259         /*
4260          * This is the host address where the response will be written when the
4261          * request is complete. This area must be 16B aligned and must be
4262          * cleared to zero before the request is made.
4263          */
4264         uint32_t enables;
4265         /* This bit must be '1' for the mtu field to be configured. */
4266         #define HWRM_FUNC_VF_CFG_INPUT_ENABLES_MTU                 UINT32_C(0x1)
4267         /* This bit must be '1' for the guest_vlan field to be configured. */
4268         #define HWRM_FUNC_VF_CFG_INPUT_ENABLES_GUEST_VLAN          UINT32_C(0x2)
4269         /*
4270          * This bit must be '1' for the async_event_cr field to be configured.
4271          */
4272         #define HWRM_FUNC_VF_CFG_INPUT_ENABLES_ASYNC_EVENT_CR      UINT32_C(0x4)
4273         /* This bit must be '1' for the dflt_mac_addr field to be configured. */
4274         #define HWRM_FUNC_VF_CFG_INPUT_ENABLES_DFLT_MAC_ADDR       UINT32_C(0x8)
4275         uint16_t mtu;
4276         /*
4277          * The maximum transmission unit requested on the function. The HWRM
4278          * should make sure that the mtu of the function does not exceed the mtu
4279          * of the physical port that this function is associated with. In
4280          * addition to requesting mtu per function, it is possible to configure
4281          * mtu per transmit ring. By default, the mtu of each transmit ring
4282          * associated with a function is equal to the mtu of the function. The
4283          * HWRM should make sure that the mtu of each transmit ring that is
4284          * assigned to a function has a valid mtu.
4285          */
4286         uint16_t guest_vlan;
4287         /*
4288          * The guest VLAN for the function being configured. This field's format
4289          * is same as 802.1Q Tag's Tag Control Information (TCI) format that
4290          * includes both Priority Code Point (PCP) and VLAN Identifier (VID).
4291          */
4292         uint16_t async_event_cr;
4293         /*
4294          * ID of the target completion ring for receiving asynchronous event
4295          * completions. If this field is not valid, then the HWRM shall use the
4296          * default completion ring of the function that is being configured as
4297          * the target completion ring for providing any asynchronous event
4298          * completions for that function. If this field is valid, then the HWRM
4299          * shall use the completion ring identified by this ID as the target
4300          * completion ring for providing any asynchronous event completions for
4301          * the function that is being configured.
4302          */
4303         uint8_t dflt_mac_addr[6];
4304         /*
4305          * This value is the current MAC address requested by the VF driver to
4306          * be configured on this VF. A value of 00-00-00-00-00-00 indicates no
4307          * MAC address configuration is requested by the VF driver. The parent
4308          * PF driver may reject or overwrite this MAC address.
4309          */
4310 } __attribute__((packed));
4311
4312 /* Output (16 bytes) */
4313
4314 struct hwrm_func_vf_cfg_output {
4315         uint16_t error_code;
4316         /*
4317          * Pass/Fail or error type Note: receiver to verify the in parameters,
4318          * and fail the call with an error when appropriate
4319          */
4320         uint16_t req_type;
4321         /* This field returns the type of original request. */
4322         uint16_t seq_id;
4323         /* This field provides original sequence number of the command. */
4324         uint16_t resp_len;
4325         /*
4326          * This field is the length of the response in bytes. The last
4327          * byte of the response is a valid flag that will read as '1'
4328          * when the command has been completely written to memory.
4329          */
4330         uint32_t unused_0;
4331         uint8_t unused_1;
4332         uint8_t unused_2;
4333         uint8_t unused_3;
4334         uint8_t valid;
4335         /*
4336          * This field is used in Output records to indicate that the output is
4337          * completely written to RAM. This field should be read as '1' to
4338          * indicate that the output has been completely written. When writing a
4339          * command completion or response to an internal processor, the order of
4340          * writes has to be such that this field is written last.
4341          */
4342 } __attribute__((packed));
4343
4344 /* hwrm_port_phy_cfg */
4345 /*
4346  * Description: This command configures the PHY device for the port. It allows
4347  * setting of the most generic settings for the PHY. The HWRM shall complete
4348  * this command as soon as PHY settings are configured. They may not be applied
4349  * when the command response is provided. A VF driver shall not be allowed to
4350  * configure PHY using this command. In a network partition mode, a PF driver
4351  * shall not be allowed to configure PHY using this command.
4352  */
4353 /* Input        (56 bytes) */
4354 struct hwrm_port_phy_cfg_input {
4355         uint16_t req_type;
4356         /*
4357          * This value indicates what type of request this is. The format
4358          * for the rest of the command is determined by this field.
4359          */
4360         uint16_t cmpl_ring;
4361         /*
4362          * This value indicates the what completion ring the request
4363          * will be optionally completed on. If the value is -1, then no
4364          * CR completion will be generated. Any other value must be a
4365          * valid CR ring_id value for this function.
4366          */
4367         uint16_t seq_id;
4368         /* This value indicates the command sequence number. */
4369         uint16_t target_id;
4370         /*
4371          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
4372          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
4373          * - HWRM
4374          */
4375         uint64_t resp_addr;
4376         /*
4377          * This is the host address where the response will be written
4378          * when the request is complete. This area must be 16B aligned
4379          * and must be cleared to zero before the request is made.
4380          */
4381         uint32_t flags;
4382         /*
4383          * When this bit is set to '1', the PHY for the port shall be
4384          * reset. # If this bit is set to 1, then the HWRM shall reset
4385          * the PHY after applying PHY configuration changes specified in
4386          * this command. # In order to guarantee that PHY configuration
4387          * changes specified in this command take effect, the HWRM
4388          * client should set this flag to 1. # If this bit is not set to
4389          * 1, then the HWRM may reset the PHY depending on the current
4390          * PHY configuration and settings specified in this command.
4391          */
4392         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY UINT32_C(0x1)
4393         /* deprecated bit. Do not use!!! */
4394         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_DEPRECATED        UINT32_C(0x2)
4395         /*
4396          * When this bit is set to '1', the link shall be forced to the
4397          * force_link_speed value. When this bit is set to '1', the HWRM
4398          * client should not enable any of the auto negotiation related
4399          * fields represented by auto_XXX fields in this command. When
4400          * this bit is set to '1' and the HWRM client has enabled a
4401          * auto_XXX field in this command, then the HWRM shall ignore
4402          * the enabled auto_XXX field. When this bit is set to zero, the
4403          * link shall be allowed to autoneg.
4404          */
4405         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE     UINT32_C(0x4)
4406         /*
4407          * When this bit is set to '1', the auto-negotiation process
4408          * shall be restarted on the link.
4409          */
4410         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG   UINT32_C(0x8)
4411         /*
4412          * When this bit is set to '1', Energy Efficient Ethernet       (EEE)
4413          * is requested to be enabled on this link. If EEE is not
4414          * supported on this port, then this flag shall be ignored by
4415          * the HWRM.
4416          */
4417         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_ENABLE        UINT32_C(0x10)
4418         /*
4419          * When this bit is set to '1', Energy Efficient Ethernet       (EEE)
4420          * is requested to be disabled on this link. If EEE is not
4421          * supported on this port, then this flag shall be ignored by
4422          * the HWRM.
4423          */
4424         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_DISABLE       UINT32_C(0x20)
4425         /*
4426          * When this bit is set to '1' and EEE is enabled on this link,
4427          * then TX LPI is requested to be enabled on the link. If EEE is
4428          * not supported on this port, then this flag shall be ignored
4429          * by the HWRM. If EEE is disabled on this port, then this flag
4430          * shall be ignored by the HWRM.
4431          */
4432         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_TX_LPI_ENABLE UINT32_C(0x40)
4433         /*
4434          * When this bit is set to '1' and EEE is enabled on this link,
4435          * then TX LPI is requested to be disabled on the link. If EEE
4436          * is not supported on this port, then this flag shall be
4437          * ignored by the HWRM. If EEE is disabled on this port, then
4438          * this flag shall be ignored by the HWRM.
4439          */
4440         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_TX_LPI_DISABLE UINT32_C(0x80)
4441         /*
4442          * When set to 1, then the HWRM shall enable FEC
4443          * autonegotitation on this port if supported. When set to 0,
4444          * then this flag shall be ignored. If FEC autonegotiation is
4445          * not supported, then the HWRM shall ignore this flag.
4446          */
4447         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FEC_AUTONEG_ENABLE UINT32_C(0x100)
4448         /*
4449          * When set to 1, then the HWRM shall disable FEC
4450          * autonegotiation on this port if supported. When set to 0,
4451          * then this flag shall be ignored. If FEC autonegotiation is
4452          * not supported, then the HWRM shall ignore this flag.
4453          */
4454         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FEC_AUTONEG_DISABLE       \
4455                 UINT32_C(0x200)
4456         /*
4457          * When set to 1, then the HWRM shall enable FEC CLAUSE 74      (Fire
4458          * Code) on this port if supported. When set to 0, then this
4459          * flag shall be ignored. If FEC CLAUSE 74 is not supported,
4460          * then the HWRM shall ignore this flag.
4461          */
4462         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FEC_CLAUSE74_ENABLE       \
4463                 UINT32_C(0x400)
4464         /*
4465          * When set to 1, then the HWRM shall disable FEC CLAUSE 74
4466          *      (Fire Code) on this port if supported. When set to 0, then
4467          * this flag shall be ignored. If FEC CLAUSE 74 is not
4468          * supported, then the HWRM shall ignore this flag.
4469          */
4470         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FEC_CLAUSE74_DISABLE      \
4471                 UINT32_C(0x800)
4472         /*
4473          * When set to 1, then the HWRM shall enable FEC CLAUSE 91      (Reed
4474          * Solomon) on this port if supported. When set to 0, then this
4475          * flag shall be ignored. If FEC CLAUSE 91 is not supported,
4476          * then the HWRM shall ignore this flag.
4477          */
4478         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FEC_CLAUSE91_ENABLE       \
4479                 UINT32_C(0x1000)
4480         /*
4481          * When set to 1, then the HWRM shall disable FEC CLAUSE 91
4482          *      (Reed Solomon) on this port if supported. When set to 0, then
4483          * this flag shall be ignored. If FEC CLAUSE 91 is not
4484          * supported, then the HWRM shall ignore this flag.
4485          */
4486         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FEC_CLAUSE91_DISABLE      \
4487                 UINT32_C(0x2000)
4488         /*
4489          * When this bit is set to '1', the link shall be forced to be
4490          * taken down. # When this bit is set to '1", all other command
4491          * input settings related to the link speed shall be ignored.
4492          * Once the link state is forced down, it can be explicitly
4493          * cleared from that state by setting this flag to '0'. # If
4494          * this flag is set to '0', then the link shall be cleared from
4495          * forced down state if the link is in forced down state. There
4496          * may be conditions    (e.g. out-of-band or sideband configuration
4497          * changes for the link) outside the scope of the HWRM
4498          * implementation that may clear forced down link state.
4499          */
4500         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE_LINK_DWN UINT32_C(0x4000)
4501         uint32_t enables;
4502         /* This bit must be '1' for the auto_mode field to be configured. */
4503         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE       UINT32_C(0x1)
4504         /* This bit must be '1' for the auto_duplex field to be configured. */
4505         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_DUPLEX     UINT32_C(0x2)
4506         /* This bit must be '1' for the auto_pause field to be configured. */
4507         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_PAUSE      UINT32_C(0x4)
4508         /*
4509          * This bit must be '1' for the auto_link_speed field to be
4510          * configured.
4511          */
4512         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED UINT32_C(0x8)
4513         /*
4514          * This bit must be '1' for the auto_link_speed_mask field to be
4515          * configured.
4516          */
4517         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK     \
4518                 UINT32_C(0x10)
4519         /* This bit must be '1' for the wirespeed field to be configured. */
4520         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_WIOUTPUTEED     UINT32_C(0x20)
4521         /* This bit must be '1' for the lpbk field to be configured. */
4522         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_LPBK    UINT32_C(0x40)
4523         /* This bit must be '1' for the preemphasis field to be configured. */
4524         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_PREEMPHASIS     UINT32_C(0x80)
4525         /* This bit must be '1' for the force_pause field to be configured. */
4526         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_FORCE_PAUSE     UINT32_C(0x100)
4527         /*
4528          * This bit must be '1' for the eee_link_speed_mask field to be
4529          * configured.
4530          */
4531         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_EEE_LINK_SPEED_MASK     \
4532                 UINT32_C(0x200)
4533         /* This bit must be '1' for the tx_lpi_timer field to be configured. */
4534         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_TX_LPI_TIMER    UINT32_C(0x400)
4535         uint16_t port_id;
4536         /* Port ID of port that is to be configured. */
4537         uint16_t force_link_speed;
4538         /*
4539          * This is the speed that will be used if the force bit is '1'.
4540          * If unsupported speed is selected, an error will be generated.
4541          */
4542         /* 100Mb link speed */
4543         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100MB  UINT32_C(0x1)
4544         /* 1Gb link speed */
4545         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_1GB    UINT32_C(0xa)
4546         /* 2Gb link speed */
4547         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2GB    UINT32_C(0x14)
4548         /* 2.5Gb link speed */
4549         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2_5GB  UINT32_C(0x19)
4550         /* 10Gb link speed */
4551         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10GB   UINT32_C(0x64)
4552         /* 20Mb link speed */
4553         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_20GB   UINT32_C(0xc8)
4554         /* 25Gb link speed */
4555         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_25GB   UINT32_C(0xfa)
4556         /* 40Gb link speed */
4557         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_40GB   UINT32_C(0x190)
4558         /* 50Gb link speed */
4559         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_50GB   UINT32_C(0x1f4)
4560         /* 100Gb link speed */
4561         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100GB  UINT32_C(0x3e8)
4562         /* 10Mb link speed */
4563         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10MB   UINT32_C(0xffff)
4564         uint8_t auto_mode;
4565         /*
4566          * This value is used to identify what autoneg mode is used when
4567          * the link speed is not being forced.
4568          */
4569         /*
4570          * Disable autoneg or autoneg disabled. No
4571          * speeds are selected.
4572          */
4573         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_NONE  UINT32_C(0x0)
4574         /* Select all possible speeds for autoneg mode. */
4575         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ALL_SPEEDS    UINT32_C(0x1)
4576         /*
4577          * Select only the auto_link_speed speed for
4578          * autoneg mode. This mode has been DEPRECATED.
4579          * An HWRM client should not use this mode.
4580          */
4581         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ONE_SPEED     UINT32_C(0x2)
4582         /*
4583          * Select the auto_link_speed or any speed below
4584          * that speed for autoneg. This mode has been
4585          * DEPRECATED. An HWRM client should not use
4586          * this mode.
4587          */
4588         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ONE_OR_BELOW  UINT32_C(0x3)
4589         /*
4590          * Select the speeds based on the corresponding
4591          * link speed mask value that is provided.
4592          */
4593         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK    UINT32_C(0x4)
4594         uint8_t auto_duplex;
4595         /*
4596          * This is the duplex setting that will be used if the
4597          * autoneg_mode is "one_speed" or "one_or_below".
4598          */
4599         /* Half Duplex will be requested. */
4600         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_HALF        UINT32_C(0x0)
4601         /* Full duplex will be requested. */
4602         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_FULL        UINT32_C(0x1)
4603         /* Both Half and Full dupex will be requested. */
4604         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_BOTH        UINT32_C(0x2)
4605         uint8_t auto_pause;
4606         /*
4607          * This value is used to configure the pause that will be used
4608          * for autonegotiation. Add text on the usage of auto_pause and
4609          * force_pause.
4610          */
4611         /*
4612          * When this bit is '1', Generation of tx pause messages has
4613          * been requested. Disabled otherwise.
4614          */
4615         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_TX   UINT32_C(0x1)
4616         /*
4617          * When this bit is '1', Reception of rx pause messages has been
4618          * requested. Disabled otherwise.
4619          */
4620         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_RX   UINT32_C(0x2)
4621         /*
4622          * When set to 1, the advertisement of pause is enabled. # When
4623          * the auto_mode is not set to none and this flag is set to 1,
4624          * then the auto_pause bits on this port are being advertised
4625          * and autoneg pause results are being interpreted. # When the
4626          * auto_mode is not set to none and this flag is set to 0, the
4627          * pause is forced as indicated in force_pause, and also
4628          * advertised as auto_pause bits, but the autoneg results are
4629          * not interpreted since the pause configuration is being
4630          * forced. # When the auto_mode is set to none and this flag is
4631          * set to 1, auto_pause bits should be ignored and should be set
4632          * to 0.
4633          */
4634         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_AUTONEG_PAUSE UINT32_C(0x4)
4635         uint8_t unused_0;
4636         uint16_t auto_link_speed;
4637         /*
4638          * This is the speed that will be used if the autoneg_mode is
4639          * "one_speed" or "one_or_below". If an unsupported speed is
4640          * selected, an error will be generated.
4641          */
4642         /* 100Mb link speed */
4643         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100MB   UINT32_C(0x1)
4644         /* 1Gb link speed */
4645         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_1GB     UINT32_C(0xa)
4646         /* 2Gb link speed */
4647         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2GB     UINT32_C(0x14)
4648         /* 2.5Gb link speed */
4649         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2_5GB   UINT32_C(0x19)
4650         /* 10Gb link speed */
4651         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_10GB    UINT32_C(0x64)
4652         /* 20Mb link speed */
4653         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_20GB    UINT32_C(0xc8)
4654         /* 25Gb link speed */
4655         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_25GB    UINT32_C(0xfa)
4656         /* 40Gb link speed */
4657         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_40GB    UINT32_C(0x190)
4658         /* 50Gb link speed */
4659         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_50GB    UINT32_C(0x1f4)
4660         /* 100Gb link speed */
4661         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100GB   UINT32_C(0x3e8)
4662         /* 10Mb link speed */
4663         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_10MB    UINT32_C(0xffff)
4664         uint16_t auto_link_speed_mask;
4665         /*
4666          * This is a mask of link speeds that will be used if
4667          * autoneg_mode is "mask". If unsupported speed is enabled an
4668          * error will be generated.
4669          */
4670         /* 100Mb link speed     (Half-duplex) */
4671         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MBHD     \
4672                 UINT32_C(0x1)
4673         /* 100Mb link speed     (Full-duplex) */
4674         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MB \
4675                 UINT32_C(0x2)
4676         /* 1Gb link speed       (Half-duplex) */
4677         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GBHD \
4678                 UINT32_C(0x4)
4679         /* 1Gb link speed       (Full-duplex) */
4680         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GB        \
4681                 UINT32_C(0x8)
4682         /* 2Gb link speed */
4683         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_2GB        \
4684                 UINT32_C(0x10)
4685         /* 2.5Gb link speed */
4686         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_2_5GB      \
4687                 UINT32_C(0x20)
4688         /* 10Gb link speed */
4689         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10GB UINT32_C(0x40)
4690         /* 20Gb link speed */
4691         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_20GB UINT32_C(0x80)
4692         /* 25Gb link speed */
4693         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_25GB       \
4694                 UINT32_C(0x100)
4695         /* 40Gb link speed */
4696         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_40GB       \
4697                 UINT32_C(0x200)
4698         /* 50Gb link speed */
4699         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_50GB       \
4700                 UINT32_C(0x400)
4701         /* 100Gb link speed */
4702         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100GB      \
4703                 UINT32_C(0x800)
4704         /* 10Mb link speed      (Half-duplex) */
4705         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10MBHD     \
4706                 UINT32_C(0x1000)
4707         /* 10Mb link speed      (Full-duplex) */
4708         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10MB       \
4709                 UINT32_C(0x2000)
4710         uint8_t wirespeed;
4711         /* This value controls the wirespeed feature. */
4712         /* Wirespeed feature is disabled. */
4713         #define HWRM_PORT_PHY_CFG_INPUT_WIOUTPUTEED_OFF UINT32_C(0x0)
4714         /* Wirespeed feature is enabled. */
4715         #define HWRM_PORT_PHY_CFG_INPUT_WIOUTPUTEED_ON  UINT32_C(0x1)
4716         uint8_t lpbk;
4717         /* This value controls the loopback setting for the PHY. */
4718         /* No loopback is selected. Normal operation. */
4719         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_NONE       UINT32_C(0x0)
4720         /*
4721          * The HW will be configured with local loopback
4722          * such that host data is sent back to the host
4723          * without modification.
4724          */
4725         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_LOCAL      UINT32_C(0x1)
4726         /*
4727          * The HW will be configured with remote
4728          * loopback such that port logic will send
4729          * packets back out the transmitter that are
4730          * received.
4731          */
4732         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_REMOTE     UINT32_C(0x2)
4733         uint8_t force_pause;
4734         /*
4735          * This value is used to configure the pause that will be used
4736          * for force mode.
4737          */
4738         /*
4739          * When this bit is '1', Generation of tx pause messages is
4740          * supported. Disabled otherwise.
4741          */
4742         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_TX  UINT32_C(0x1)
4743         /*
4744          * When this bit is '1', Reception of rx pause messages is
4745          * supported. Disabled otherwise.
4746          */
4747         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_RX  UINT32_C(0x2)
4748         uint8_t unused_1;
4749         uint32_t preemphasis;
4750         /*
4751          * This value controls the pre-emphasis to be used for the link.
4752          * Driver should not set this value     (use enable.preemphasis = 0)
4753          * unless driver is sure of setting. Normally HWRM FW will
4754          * determine proper pre-emphasis.
4755          */
4756         uint16_t eee_link_speed_mask;
4757         /*
4758          * Setting for link speed mask that is used to advertise speeds
4759          * during autonegotiation when EEE is enabled. This field is
4760          * valid only when EEE is enabled. The speeds specified in this
4761          * field shall be a subset of speeds specified in
4762          * auto_link_speed_mask. If EEE is enabled,then at least one
4763          * speed shall be provided in this mask.
4764          */
4765         /* Reserved */
4766         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD1 UINT32_C(0x1)
4767         /* 100Mb link speed     (Full-duplex) */
4768         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_100MB UINT32_C(0x2)
4769         /* Reserved */
4770         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD2 UINT32_C(0x4)
4771         /* 1Gb link speed       (Full-duplex) */
4772         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_1GB UINT32_C(0x8)
4773         /* Reserved */
4774         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD3 UINT32_C(0x10)
4775         /* Reserved */
4776         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD4 UINT32_C(0x20)
4777         /* 10Gb link speed */
4778         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_10GB UINT32_C(0x40)
4779         uint8_t unused_2;
4780         uint8_t unused_3;
4781         uint32_t tx_lpi_timer;
4782         uint32_t unused_4;
4783         /*
4784          * Reuested setting of TX LPI timer in microseconds. This field
4785          * is valid only when EEE is enabled and TX LPI is enabled.
4786          */
4787         #define HWRM_PORT_PHY_CFG_INPUT_TX_LPI_TIMER_MASK UINT32_C(0xffffff)
4788         #define HWRM_PORT_PHY_CFG_INPUT_TX_LPI_TIMER_SFT        0
4789 } __attribute__((packed));
4790
4791 /* Output       (16 bytes) */
4792 struct hwrm_port_phy_cfg_output {
4793         uint16_t error_code;
4794         /*
4795          * Pass/Fail or error type Note: receiver to verify the in
4796          * parameters, and fail the call with an error when appropriate
4797          */
4798         uint16_t req_type;
4799         /* This field returns the type of original request. */
4800         uint16_t seq_id;
4801         /* This field provides original sequence number of the command. */
4802         uint16_t resp_len;
4803         /*
4804          * This field is the length of the response in bytes. The last
4805          * byte of the response is a valid flag that will read as '1'
4806          * when the command has been completely written to memory.
4807          */
4808         uint32_t unused_0;
4809         uint8_t unused_1;
4810         uint8_t unused_2;
4811         uint8_t unused_3;
4812         uint8_t valid;
4813         /*
4814          * This field is used in Output records to indicate that the
4815          * output is completely written to RAM. This field should be
4816          * read as '1' to indicate that the output has been completely
4817          * written. When writing a command completion or response to an
4818          * internal processor, the order of writes has to be such that
4819          * this field is written last.
4820          */
4821 } __attribute__((packed));
4822
4823 /* hwrm_port_phy_qcfg */
4824 /* Description: This command queries the PHY configuration for the port. */
4825 /* Input        (24 bytes) */
4826 struct hwrm_port_phy_qcfg_input {
4827         uint16_t req_type;
4828         /*
4829          * This value indicates what type of request this is. The format
4830          * for the rest of the command is determined by this field.
4831          */
4832         uint16_t cmpl_ring;
4833         /*
4834          * This value indicates the what completion ring the request
4835          * will be optionally completed on. If the value is -1, then no
4836          * CR completion will be generated. Any other value must be a
4837          * valid CR ring_id value for this function.
4838          */
4839         uint16_t seq_id;
4840         /* This value indicates the command sequence number. */
4841         uint16_t target_id;
4842         /*
4843          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
4844          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
4845          * - HWRM
4846          */
4847         uint64_t resp_addr;
4848         /*
4849          * This is the host address where the response will be written
4850          * when the request is complete. This area must be 16B aligned
4851          * and must be cleared to zero before the request is made.
4852          */
4853         uint16_t port_id;
4854         /* Port ID of port that is to be queried. */
4855         uint16_t unused_0[3];
4856 } __attribute__((packed));
4857
4858 /* Output       (96 bytes) */
4859 struct hwrm_port_phy_qcfg_output {
4860         uint16_t error_code;
4861         /*
4862          * Pass/Fail or error type Note: receiver to verify the in
4863          * parameters, and fail the call with an error when appropriate
4864          */
4865         uint16_t req_type;
4866         /* This field returns the type of original request. */
4867         uint16_t seq_id;
4868         /* This field provides original sequence number of the command. */
4869         uint16_t resp_len;
4870         /*
4871          * This field is the length of the response in bytes. The last
4872          * byte of the response is a valid flag that will read as '1'
4873          * when the command has been completely written to memory.
4874          */
4875         uint8_t link;
4876         /* This value indicates the current link status. */
4877         /* There is no link or cable detected. */
4878         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_NO_LINK  UINT32_C(0x0)
4879         /* There is no link, but a cable has been detected. */
4880         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SIGNAL   UINT32_C(0x1)
4881         /* There is a link. */
4882         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK     UINT32_C(0x2)
4883         uint8_t unused_0;
4884         uint16_t link_speed;
4885         /* This value indicates the current link speed of the connection. */
4886         /* 100Mb link speed */
4887         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100MB      UINT32_C(0x1)
4888         /* 1Gb link speed */
4889         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_1GB        UINT32_C(0xa)
4890         /* 2Gb link speed */
4891         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_2GB        UINT32_C(0x14)
4892         /* 2.5Gb link speed */
4893         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_2_5GB      UINT32_C(0x19)
4894         /* 10Gb link speed */
4895         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_10GB       UINT32_C(0x64)
4896         /* 20Mb link speed */
4897         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_20GB       UINT32_C(0xc8)
4898         /* 25Gb link speed */
4899         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_25GB       UINT32_C(0xfa)
4900         /* 40Gb link speed */
4901         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_40GB       UINT32_C(0x190)
4902         /* 50Gb link speed */
4903         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_50GB       UINT32_C(0x1f4)
4904         /* 100Gb link speed */
4905         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100GB      UINT32_C(0x3e8)
4906         /* 10Mb link speed */
4907         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_10MB       UINT32_C(0xffff)
4908         uint8_t duplex;
4909         /* This value is indicates the duplex of the current connection. */
4910         /* Half Duplex connection. */
4911         #define HWRM_PORT_PHY_QCFG_OUTPUT_DUPLEX_HALF   UINT32_C(0x0)
4912         /* Full duplex connection. */
4913         #define HWRM_PORT_PHY_QCFG_OUTPUT_DUPLEX_FULL   UINT32_C(0x1)
4914         uint8_t pause;
4915         /*
4916          * This value is used to indicate the current pause
4917          * configuration. When autoneg is enabled, this value represents
4918          * the autoneg results of pause configuration.
4919          */
4920         /*
4921          * When this bit is '1', Generation of tx pause messages is
4922          * supported. Disabled otherwise.
4923          */
4924         #define HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX      UINT32_C(0x1)
4925         /*
4926          * When this bit is '1', Reception of rx pause messages is
4927          * supported. Disabled otherwise.
4928          */
4929         #define HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX      UINT32_C(0x2)
4930         uint16_t support_speeds;
4931         /*
4932          * The supported speeds for the port. This is a bit mask. For
4933          * each speed that is supported, the corrresponding bit will be
4934          * set to '1'.
4935          */
4936         /* 100Mb link speed     (Half-duplex) */
4937         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100MBHD UINT32_C(0x1)
4938         /* 100Mb link speed     (Full-duplex) */
4939         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100MB UINT32_C(0x2)
4940         /* 1Gb link speed       (Half-duplex) */
4941         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_1GBHD UINT32_C(0x4)
4942         /* 1Gb link speed       (Full-duplex) */
4943         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_1GB    UINT32_C(0x8)
4944         /* 2Gb link speed */
4945         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_2GB    UINT32_C(0x10)
4946         /* 2.5Gb link speed */
4947         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_2_5GB UINT32_C(0x20)
4948         /* 10Gb link speed */
4949         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10GB UINT32_C(0x40)
4950         /* 20Gb link speed */
4951         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_20GB UINT32_C(0x80)
4952         /* 25Gb link speed */
4953         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_25GB UINT32_C(0x100)
4954         /* 40Gb link speed */
4955         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_40GB UINT32_C(0x200)
4956         /* 50Gb link speed */
4957         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_50GB UINT32_C(0x400)
4958         /* 100Gb link speed */
4959         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100GB UINT32_C(0x800)
4960         /* 10Mb link speed      (Half-duplex) */
4961         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10MBHD UINT32_C(0x1000)
4962         /* 10Mb link speed      (Full-duplex) */
4963         #define HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10MB UINT32_C(0x2000)
4964         uint16_t force_link_speed;
4965         /*
4966          * Current setting of forced link speed. When the link speed is
4967          * not being forced, this value shall be set to 0.
4968          */
4969         /* 100Mb link speed */
4970         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_100MB UINT32_C(0x1)
4971         /* 1Gb link speed */
4972         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_1GB  UINT32_C(0xa)
4973         /* 2Gb link speed */
4974         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_2GB  UINT32_C(0x14)
4975         /* 2.5Gb link speed */
4976         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_2_5GB UINT32_C(0x19)
4977         /* 10Gb link speed */
4978         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_10GB UINT32_C(0x64)
4979         /* 20Mb link speed */
4980         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_20GB UINT32_C(0xc8)
4981         /* 25Gb link speed */
4982         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_25GB UINT32_C(0xfa)
4983         /* 40Gb link speed */
4984         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_40GB UINT32_C(0x190)
4985         /* 50Gb link speed */
4986         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_50GB UINT32_C(0x1f4)
4987         /* 100Gb link speed */
4988         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_100GB UINT32_C(0x3e8)
4989         /* 10Mb link speed */
4990         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_LINK_SPEED_10MB UINT32_C(0xffff)
4991         uint8_t auto_mode;
4992         /* Current setting of auto negotiation mode. */
4993         /*
4994          * Disable autoneg or autoneg disabled. No
4995          * speeds are selected.
4996          */
4997         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE        UINT32_C(0x0)
4998         /* Select all possible speeds for autoneg mode. */
4999         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_ALL_SPEEDS  UINT32_C(0x1)
5000         /*
5001          * Select only the auto_link_speed speed for
5002          * autoneg mode. This mode has been DEPRECATED.
5003          * An HWRM client should not use this mode.
5004          */
5005         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_ONE_SPEED   UINT32_C(0x2)
5006         /*
5007          * Select the auto_link_speed or any speed below
5008          * that speed for autoneg. This mode has been
5009          * DEPRECATED. An HWRM client should not use
5010          * this mode.
5011          */
5012         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_ONE_OR_BELOW UINT32_C(0x3)
5013         /*
5014          * Select the speeds based on the corresponding
5015          * link speed mask value that is provided.
5016          */
5017         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_SPEED_MASK  UINT32_C(0x4)
5018         uint8_t auto_pause;
5019         /*
5020          * Current setting of pause autonegotiation. Move autoneg_pause
5021          * flag here.
5022          */
5023         /*
5024          * When this bit is '1', Generation of tx pause messages has
5025          * been requested. Disabled otherwise.
5026          */
5027         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_TX UINT32_C(0x1)
5028         /*
5029          * When this bit is '1', Reception of rx pause messages has been
5030          * requested. Disabled otherwise.
5031          */
5032         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_RX UINT32_C(0x2)
5033         /*
5034          * When set to 1, the advertisement of pause is enabled. # When
5035          * the auto_mode is not set to none and this flag is set to 1,
5036          * then the auto_pause bits on this port are being advertised
5037          * and autoneg pause results are being interpreted. # When the
5038          * auto_mode is not set to none and this flag is set to 0, the
5039          * pause is forced as indicated in force_pause, and also
5040          * advertised as auto_pause bits, but the autoneg results are
5041          * not interpreted since the pause configuration is being
5042          * forced. # When the auto_mode is set to none and this flag is
5043          * set to 1, auto_pause bits should be ignored and should be set
5044          * to 0.
5045          */
5046         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_AUTONEG_PAUSE UINT32_C(0x4)
5047         uint16_t auto_link_speed;
5048         /*
5049          * Current setting for auto_link_speed. This field is only valid
5050          * when auto_mode is set to "one_speed" or "one_or_below".
5051          */
5052         /* 100Mb link speed */
5053         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_100MB UINT32_C(0x1)
5054         /* 1Gb link speed */
5055         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_1GB   UINT32_C(0xa)
5056         /* 2Gb link speed */
5057         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_2GB   UINT32_C(0x14)
5058         /* 2.5Gb link speed */
5059         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_2_5GB UINT32_C(0x19)
5060         /* 10Gb link speed */
5061         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_10GB  UINT32_C(0x64)
5062         /* 20Mb link speed */
5063         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_20GB  UINT32_C(0xc8)
5064         /* 25Gb link speed */
5065         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_25GB  UINT32_C(0xfa)
5066         /* 40Gb link speed */
5067         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_40GB  UINT32_C(0x190)
5068         /* 50Gb link speed */
5069         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_50GB  UINT32_C(0x1f4)
5070         /* 100Gb link speed */
5071         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_100GB UINT32_C(0x3e8)
5072         /* 10Mb link speed */
5073         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_10MB UINT32_C(0xffff)
5074         uint16_t auto_link_speed_mask;
5075         /*
5076          * Current setting for auto_link_speed_mask that is used to
5077          * advertise speeds during autonegotiation. This field is only
5078          * valid when auto_mode is set to "mask". The speeds specified
5079          * in this field shall be a subset of supported speeds on this
5080          * port.
5081          */
5082         /* 100Mb link speed     (Half-duplex) */
5083         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_100MBHD  \
5084                 UINT32_C(0x1)
5085         /* 100Mb link speed     (Full-duplex) */
5086         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_100MB     \
5087                 UINT32_C(0x2)
5088         /* 1Gb link speed       (Half-duplex) */
5089         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_1GBHD     \
5090                 UINT32_C(0x4)
5091         /* 1Gb link speed       (Full-duplex) */
5092         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_1GB UINT32_C(0x8)
5093         /* 2Gb link speed */
5094         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_2GB      \
5095                 UINT32_C(0x10)
5096         /* 2.5Gb link speed */
5097         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_2_5GB     \
5098                 UINT32_C(0x20)
5099         /* 10Gb link speed */
5100         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_10GB     \
5101                 UINT32_C(0x40)
5102         /* 20Gb link speed */
5103         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_20GB     \
5104                 UINT32_C(0x80)
5105         /* 25Gb link speed */
5106         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_25GB     \
5107                 UINT32_C(0x100)
5108         /* 40Gb link speed */
5109         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_40GB     \
5110                 UINT32_C(0x200)
5111         /* 50Gb link speed */
5112         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_50GB     \
5113                 UINT32_C(0x400)
5114         /* 100Gb link speed */
5115         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_100GB     \
5116                 UINT32_C(0x800)
5117         /* 10Mb link speed      (Half-duplex) */
5118         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_10MBHD   \
5119                 UINT32_C(0x1000)
5120         /* 10Mb link speed      (Full-duplex) */
5121         #define HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_LINK_SPEED_MASK_10MB     \
5122                 UINT32_C(0x2000)
5123         uint8_t wirespeed;
5124         /* Current setting for wirespeed. */
5125         /* Wirespeed feature is disabled. */
5126         #define HWRM_PORT_PHY_QCFG_OUTPUT_WIOUTPUTEED_OFF       UINT32_C(0x0)
5127         /* Wirespeed feature is enabled. */
5128         #define HWRM_PORT_PHY_QCFG_OUTPUT_WIOUTPUTEED_ON        UINT32_C(0x1)
5129         uint8_t lpbk;
5130         /* Current setting for loopback. */
5131         /* No loopback is selected. Normal operation. */
5132         #define HWRM_PORT_PHY_QCFG_OUTPUT_LPBK_NONE     UINT32_C(0x0)
5133         /*
5134          * The HW will be configured with local loopback
5135          * such that host data is sent back to the host
5136          * without modification.
5137          */
5138         #define HWRM_PORT_PHY_QCFG_OUTPUT_LPBK_LOCAL    UINT32_C(0x1)
5139         /*
5140          * The HW will be configured with remote
5141          * loopback such that port logic will send
5142          * packets back out the transmitter that are
5143          * received.
5144          */
5145         #define HWRM_PORT_PHY_QCFG_OUTPUT_LPBK_REMOTE   UINT32_C(0x2)
5146         uint8_t force_pause;
5147         /*
5148          * Current setting of forced pause. When the pause configuration
5149          * is not being forced, then this value shall be set to 0.
5150          */
5151         /*
5152          * When this bit is '1', Generation of tx pause messages is
5153          * supported. Disabled otherwise.
5154          */
5155         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_PAUSE_TX        UINT32_C(0x1)
5156         /*
5157          * When this bit is '1', Reception of rx pause messages is
5158          * supported. Disabled otherwise.
5159          */
5160         #define HWRM_PORT_PHY_QCFG_OUTPUT_FORCE_PAUSE_RX        UINT32_C(0x2)
5161         uint8_t module_status;
5162         /*
5163          * This value indicates the current status of the optics module
5164          * on this port.
5165          */
5166         /* Module is inserted and accepted */
5167         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_NONE    UINT32_C(0x0)
5168         /* Module is rejected and transmit side Laser is disabled. */
5169         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_DISABLETX UINT32_C(0x1)
5170         /* Module mismatch warning. */
5171         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_WARNINGMSG UINT32_C(0x2)
5172         /* Module is rejected and powered down. */
5173         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_PWRDOWN UINT32_C(0x3)
5174         /* Module is not inserted. */
5175         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_NOTINSERTED \
5176                 UINT32_C(0x4)
5177         /* Module status is not applicable. */
5178         #define HWRM_PORT_PHY_QCFG_OUTPUT_MODULE_STATUS_NOTAPPLICABLE \
5179                 UINT32_C(0xff)
5180         uint32_t preemphasis;
5181         /* Current setting for preemphasis. */
5182         uint8_t phy_maj;
5183         /* This field represents the major version of the PHY. */
5184         uint8_t phy_min;
5185         /* This field represents the minor version of the PHY. */
5186         uint8_t phy_bld;
5187         /* This field represents the build version of the PHY. */
5188         uint8_t phy_type;
5189         /* This value represents a PHY type. */
5190         /* Unknown */
5191         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_UNKNOWN      UINT32_C(0x0)
5192         /* BASE-CR */
5193         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASECR       UINT32_C(0x1)
5194         /* BASE-KR4     (Deprecated) */
5195         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR4      UINT32_C(0x2)
5196         /* BASE-LR */
5197         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASELR       UINT32_C(0x3)
5198         /* BASE-SR */
5199         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASESR       UINT32_C(0x4)
5200         /* BASE-KR2     (Deprecated) */
5201         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR2      UINT32_C(0x5)
5202         /* BASE-KX */
5203         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKX       UINT32_C(0x6)
5204         /* BASE-KR */
5205         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR       UINT32_C(0x7)
5206         /* BASE-T */
5207         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASET        UINT32_C(0x8)
5208         /* EEE capable BASE-T */
5209         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASETE       UINT32_C(0x9)
5210         /* SGMII connected external PHY */
5211         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_SGMIIEXTPHY  UINT32_C(0xa)
5212         /* 25G_BASECR_CA_L */
5213         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_25G_BASECR_CA_L UINT32_C(0xb)
5214         /* 25G_BASECR_CA_S */
5215         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_25G_BASECR_CA_S UINT32_C(0xc)
5216         /* 25G_BASECR_CA_N */
5217         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_25G_BASECR_CA_N UINT32_C(0xd)
5218         /* 25G_BASESR */
5219         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_25G_BASESR   UINT32_C(0xe)
5220         /* 100G_BASECR4 */
5221         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASECR4 UINT32_C(0xf)
5222         /* 100G_BASESR4 */
5223         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASESR4 UINT32_C(0x10)
5224         /* 100G_BASELR4 */
5225         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASELR4 UINT32_C(0x11)
5226         /* 100G_BASEER4 */
5227         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASEER4 UINT32_C(0x12)
5228         /* 100G_BASESR10 */
5229         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASESR10 UINT32_C(0x13)
5230         /* 40G_BASECR4 */
5231         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_BASECR4  UINT32_C(0x14)
5232         /* 40G_BASESR4 */
5233         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_BASESR4  UINT32_C(0x15)
5234         /* 40G_BASELR4 */
5235         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_BASELR4  UINT32_C(0x16)
5236         /* 40G_BASEER4 */
5237         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_BASEER4  UINT32_C(0x17)
5238         /* 40G_ACTIVE_CABLE */
5239         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_ACTIVE_CABLE \
5240                 UINT32_C(0x18)
5241         uint8_t media_type;
5242         /* This value represents a media type. */
5243         /* Unknown */
5244         #define HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_UNKNOWN    UINT32_C(0x0)
5245         /* Twisted Pair */
5246         #define HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_TP UINT32_C(0x1)
5247         /* Direct Attached Copper */
5248         #define HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_DAC        UINT32_C(0x2)
5249         /* Fiber */
5250         #define HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_FIBRE      UINT32_C(0x3)
5251         uint8_t xcvr_pkg_type;
5252         /* This value represents a transceiver type. */
5253         /* PHY and MAC are in the same package */
5254         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_PKG_TYPE_XCVR_INTERNAL \
5255                 UINT32_C(0x1)
5256         /* PHY and MAC are in different packages */
5257         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_PKG_TYPE_XCVR_EXTERNAL \
5258                 UINT32_C(0x2)
5259         uint8_t eee_config_phy_addr;
5260         /*
5261          * This field represents flags related to EEE configuration.
5262          * These EEE configuration flags are valid only when the
5263          * auto_mode is not set to none (in other words autonegotiation
5264          * is enabled).
5265          */
5266         /* This field represents PHY address. */
5267         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_ADDR_MASK UINT32_C(0x1f)
5268         #define HWRM_PORT_PHY_QCFG_OUTPUT_PHY_ADDR_SFT  0
5269         /*
5270          * When set to 1, Energy Efficient Ethernet     (EEE) mode is
5271          * enabled. Speeds for autoneg with EEE mode enabled are based
5272          * on eee_link_speed_mask.
5273          */
5274         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_EEE_ENABLED UINT32_C(0x20)
5275         /*
5276          * This flag is valid only when eee_enabled is set to 1. # If
5277          * eee_enabled is set to 0, then EEE mode is disabled and this
5278          * flag shall be ignored. # If eee_enabled is set to 1 and this
5279          * flag is set to 1, then Energy Efficient Ethernet     (EEE) mode
5280          * is enabled and in use. # If eee_enabled is set to 1 and this
5281          * flag is set to 0, then Energy Efficient Ethernet     (EEE) mode
5282          * is enabled but is currently not in use.
5283          */
5284         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_EEE_ACTIVE UINT32_C(0x40)
5285         /*
5286          * This flag is valid only when eee_enabled is set to 1. # If
5287          * eee_enabled is set to 0, then EEE mode is disabled and this
5288          * flag shall be ignored. # If eee_enabled is set to 1 and this
5289          * flag is set to 1, then Energy Efficient Ethernet     (EEE) mode
5290          * is enabled and TX LPI is enabled. # If eee_enabled is set to
5291          * 1 and this flag is set to 0, then Energy Efficient Ethernet
5292          *      (EEE) mode is enabled but TX LPI is disabled.
5293          */
5294         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_EEE_TX_LPI UINT32_C(0x80)
5295         /*
5296          * This field represents flags related to EEE configuration.
5297          * These EEE configuration flags are valid only when the
5298          * auto_mode is not set to none (in other words autonegotiation
5299          * is enabled).
5300          */
5301         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_MASK       UINT32_C(0xe0)
5302         #define HWRM_PORT_PHY_QCFG_OUTPUT_EEE_CONFIG_SFT        5
5303         uint8_t parallel_detect;
5304         /* Reserved field, set to 0 */
5305         /*
5306          * When set to 1, the parallel detection is used to determine
5307          * the speed of the link partner. Parallel detection is used
5308          * when a autonegotiation capable device is connected to a link
5309          * parter that is not capable of autonegotiation.
5310          */
5311         #define HWRM_PORT_PHY_QCFG_OUTPUT_PARALLEL_DETECT       UINT32_C(0x1)
5312         /* Reserved field, set to 0 */
5313         #define HWRM_PORT_PHY_QCFG_OUTPUT_RESERVED_MASK UINT32_C(0xfe)
5314         #define HWRM_PORT_PHY_QCFG_OUTPUT_RESERVED_SFT  1
5315         uint16_t link_partner_adv_speeds;
5316         /*
5317          * The advertised speeds for the port by the link partner. Each
5318          * advertised speed will be set to '1'.
5319          */
5320         /* 100Mb link speed     (Half-duplex) */
5321         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_100MBHD \
5322                 UINT32_C(0x1)
5323         /* 100Mb link speed     (Full-duplex) */
5324         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_100MB   \
5325                 UINT32_C(0x2)
5326         /* 1Gb link speed       (Half-duplex) */
5327         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_1GBHD   \
5328                 UINT32_C(0x4)
5329         /* 1Gb link speed       (Full-duplex) */
5330         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_1GB   \
5331                 UINT32_C(0x8)
5332         /* 2Gb link speed */
5333         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_2GB   \
5334                 UINT32_C(0x10)
5335         /* 2.5Gb link speed */
5336         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_2_5GB   \
5337                 UINT32_C(0x20)
5338         /* 10Gb link speed */
5339         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_10GB  \
5340                 UINT32_C(0x40)
5341         /* 20Gb link speed */
5342         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_20GB  \
5343                 UINT32_C(0x80)
5344         /* 25Gb link speed */
5345         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_25GB  \
5346                 UINT32_C(0x100)
5347         /* 40Gb link speed */
5348         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_40GB  \
5349                 UINT32_C(0x200)
5350         /* 50Gb link speed */
5351         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_50GB  \
5352                 UINT32_C(0x400)
5353         /* 100Gb link speed */
5354         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_100GB   \
5355                 UINT32_C(0x800)
5356         /* 10Mb link speed      (Half-duplex) */
5357         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_10MBHD  \
5358                 UINT32_C(0x1000)
5359         /* 10Mb link speed      (Full-duplex) */
5360         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_SPEEDS_10MB  \
5361                 UINT32_C(0x2000)
5362         uint8_t link_partner_adv_auto_mode;
5363         /*
5364          * The advertised autoneg for the port by the link partner. This
5365          * field is deprecated and should be set to 0.
5366          */
5367         /*
5368          * Disable autoneg or autoneg disabled. No
5369          * speeds are selected.
5370          */
5371         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_NONE \
5372                 UINT32_C(0x0)
5373         /* Select all possible speeds for autoneg mode. */
5374         #define \
5375         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_ALL_SPEEDS \
5376                 UINT32_C(0x1)
5377         /*
5378          * Select only the auto_link_speed speed for
5379          * autoneg mode. This mode has been DEPRECATED.
5380          * An HWRM client should not use this mode.
5381          */
5382         #define \
5383         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_ONE_SPEED \
5384                 UINT32_C(0x2)
5385         /*
5386          * Select the auto_link_speed or any speed below
5387          * that speed for autoneg. This mode has been
5388          * DEPRECATED. An HWRM client should not use
5389          * this mode.
5390          */
5391         #define \
5392         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_ONE_OR_BELOW \
5393                 UINT32_C(0x3)
5394         /*
5395          * Select the speeds based on the corresponding
5396          * link speed mask value that is provided.
5397          */
5398         #define \
5399         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_AUTO_MODE_SPEED_MASK \
5400                 UINT32_C(0x4)
5401         uint8_t link_partner_adv_pause;
5402         /* The advertised pause settings on the port by the link partner. */
5403         /*
5404          * When this bit is '1', Generation of tx pause messages is
5405          * supported. Disabled otherwise.
5406          */
5407         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_PAUSE_TX     \
5408                 UINT32_C(0x1)
5409         /*
5410          * When this bit is '1', Reception of rx pause messages is
5411          * supported. Disabled otherwise.
5412          */
5413         #define HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_PAUSE_RX     \
5414                 UINT32_C(0x2)
5415         uint16_t adv_eee_link_speed_mask;
5416         /*
5417          * Current setting for link speed mask that is used to advertise
5418          * speeds during autonegotiation when EEE is enabled. This field
5419          * is valid only when eee_enabled flags is set to 1. The speeds
5420          * specified in this field shall be a subset of speeds specified
5421          * in auto_link_speed_mask.
5422          */
5423         /* Reserved */
5424         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_RSVD1   \
5425                 UINT32_C(0x1)
5426         /* 100Mb link speed     (Full-duplex) */
5427         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_100MB   \
5428                 UINT32_C(0x2)
5429         /* Reserved */
5430         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_RSVD2   \
5431                 UINT32_C(0x4)
5432         /* 1Gb link speed       (Full-duplex) */
5433         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_1GB   \
5434                 UINT32_C(0x8)
5435         /* Reserved */
5436         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_RSVD3   \
5437                 UINT32_C(0x10)
5438         /* Reserved */
5439         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_RSVD4   \
5440                 UINT32_C(0x20)
5441         /* 10Gb link speed */
5442         #define HWRM_PORT_PHY_QCFG_OUTPUT_ADV_EEE_LINK_SPEED_MASK_10GB  \
5443                 UINT32_C(0x40)
5444         uint16_t link_partner_adv_eee_link_speed_mask;
5445         /*
5446          * Current setting for link speed mask that is advertised by the
5447          * link partner when EEE is enabled. This field is valid only
5448          * when eee_enabled flags is set to 1.
5449          */
5450         /* Reserved */
5451         #define \
5452         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_RSVD1 \
5453                 UINT32_C(0x1)
5454         /* 100Mb link speed     (Full-duplex) */
5455         #define \
5456         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_100MB \
5457                 UINT32_C(0x2)
5458         /* Reserved */
5459         #define \
5460         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_RSVD2 \
5461                 UINT32_C(0x4)
5462         /* 1Gb link speed       (Full-duplex) */
5463         #define \
5464         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_1GB \
5465                 UINT32_C(0x8)
5466         /* Reserved */
5467         #define \
5468         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_RSVD3 \
5469                 UINT32_C(0x10)
5470         /* Reserved */
5471         #define \
5472         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_RSVD4 \
5473                 UINT32_C(0x20)
5474         /* 10Gb link speed */
5475         #define \
5476         HWRM_PORT_PHY_QCFG_OUTPUT_LINK_PARTNER_ADV_EEE_LINK_SPEED_MASK_10GB \
5477                 UINT32_C(0x40)
5478         uint32_t xcvr_identifier_type_tx_lpi_timer;
5479         /* This value represents transceiver identifier type. */
5480         /*
5481          * Current setting of TX LPI timer in microseconds. This field
5482          * is valid only when_eee_enabled flag is set to 1 and
5483          * tx_lpi_enabled is set to 1.
5484          */
5485         #define HWRM_PORT_PHY_QCFG_OUTPUT_TX_LPI_TIMER_MASK UINT32_C(0xffffff)
5486         #define HWRM_PORT_PHY_QCFG_OUTPUT_TX_LPI_TIMER_SFT      0
5487         /* This value represents transceiver identifier type. */
5488         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_MASK     \
5489                 UINT32_C(0xff000000)
5490         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_SFT      24
5491         /* Unknown */
5492         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_UNKNOWN \
5493                 (UINT32_C(0x0) << 24)
5494         /* SFP/SFP+/SFP28 */
5495         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_SFP \
5496                 (UINT32_C(0x3) << 24)
5497         /* QSFP */
5498         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFP \
5499                 (UINT32_C(0xc) << 24)
5500         /* QSFP+ */
5501         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFPPLUS \
5502                 (UINT32_C(0xd) << 24)
5503         /* QSFP28 */
5504         #define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFP28 \
5505                 (UINT32_C(0x11) << 24)
5506         uint16_t fec_cfg;
5507         /*
5508          * This value represents the current configuration of Forward
5509          * Error Correction     (FEC) on the port.
5510          */
5511         /*
5512          * When set to 1, then FEC is not supported on this port. If
5513          * this flag is set to 1, then all other FEC configuration flags
5514          * shall be ignored. When set to 0, then FEC is supported as
5515          * indicated by other configuration flags. If no cable is
5516          * attached and the HWRM does not yet know the FEC capability,
5517          * then the HWRM shall set this flag to 1 when reporting FEC
5518          * capability.
5519          */
5520         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_NONE_SUPPORTED     \
5521                 UINT32_C(0x1)
5522         /*
5523          * When set to 1, then FEC autonegotiation is supported on this
5524          * port. When set to 0, then FEC autonegotiation is not
5525          * supported on this port.
5526          */
5527         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_AUTONEG_SUPPORTED   \
5528                 UINT32_C(0x2)
5529         /*
5530          * When set to 1, then FEC autonegotiation is enabled on this
5531          * port. When set to 0, then FEC autonegotiation is disabled if
5532          * supported. This flag should be ignored if FEC autonegotiation
5533          * is not supported on this port.
5534          */
5535         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_AUTONEG_ENABLED   \
5536                 UINT32_C(0x4)
5537         /*
5538          * When set to 1, then FEC CLAUSE 74    (Fire Code) is supported on
5539          * this port. When set to 0, then FEC CLAUSE 74 (Fire Code) is
5540          * not supported on this port.
5541          */
5542         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_CLAUSE74_SUPPORTED  \
5543                 UINT32_C(0x8)
5544         /*
5545          * When set to 1, then FEC CLAUSE 74    (Fire Code) is enabled on
5546          * this port. When set to 0, then FEC CLAUSE 74 (Fire Code) is
5547          * disabled if supported. This flag should be ignored if FEC
5548          * CLAUSE 74 is not supported on this port.
5549          */
5550         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_CLAUSE74_ENABLED  \
5551                 UINT32_C(0x10)
5552         /*
5553          * When set to 1, then FEC CLAUSE 91    (Reed Solomon) is supported
5554          * on this port. When set to 0, then FEC CLAUSE 91      (Reed
5555          * Solomon) is not supported on this port.
5556          */
5557         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_CLAUSE91_SUPPORTED  \
5558                 UINT32_C(0x20)
5559         /*
5560          * When set to 1, then FEC CLAUSE 91    (Reed Solomon) is enabled
5561          * on this port. When set to 0, then FEC CLAUSE 91      (Reed
5562          * Solomon) is disabled if supported. This flag should be
5563          * ignored if FEC CLAUSE 91 is not supported on this port.
5564          */
5565         #define HWRM_PORT_PHY_QCFG_OUTPUT_FEC_CFG_FEC_CLAUSE91_ENABLED  \
5566                 UINT32_C(0x40)
5567         uint8_t unused_1;
5568         uint8_t unused_2;
5569         char phy_vendor_name[16];
5570         /*
5571          * Up to 16 bytes of null padded ASCII string representing PHY
5572          * vendor. If the string is set to null, then the vendor name is
5573          * not available.
5574          */
5575         char phy_vendor_partnumber[16];
5576         /*
5577          * Up to 16 bytes of null padded ASCII string that identifies
5578          * vendor specific part number of the PHY. If the string is set
5579          * to null, then the vendor specific part number is not
5580          * available.
5581          */
5582         uint32_t unused_3;
5583         uint8_t unused_4;
5584         uint8_t unused_5;
5585         uint8_t unused_6;
5586         uint8_t valid;
5587         /*
5588          * This field is used in Output records to indicate that the
5589          * output is completely written to RAM. This field should be
5590          * read as '1' to indicate that the output has been completely
5591          * written. When writing a command completion or response to an
5592          * internal processor, the order of writes has to be such that
5593          * this field is written last.
5594          */
5595 } __attribute__((packed));
5596
5597 /* hwrm_port_qstats */
5598 /* Description: This function returns per port Ethernet statistics. */
5599 /* Input        (40 bytes) */
5600 struct hwrm_port_qstats_input {
5601         uint16_t req_type;
5602         /*
5603          * This value indicates what type of request this is. The format
5604          * for the rest of the command is determined by this field.
5605          */
5606         uint16_t cmpl_ring;
5607         /*
5608          * This value indicates the what completion ring the request
5609          * will be optionally completed on. If the value is -1, then no
5610          * CR completion will be generated. Any other value must be a
5611          * valid CR ring_id value for this function.
5612          */
5613         uint16_t seq_id;
5614         /* This value indicates the command sequence number. */
5615         uint16_t target_id;
5616         /*
5617          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
5618          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
5619          * - HWRM
5620          */
5621         uint64_t resp_addr;
5622         /*
5623          * This is the host address where the response will be written
5624          * when the request is complete. This area must be 16B aligned
5625          * and must be cleared to zero before the request is made.
5626          */
5627         uint16_t port_id;
5628         /* Port ID of port that is being queried. */
5629         uint8_t unused_0;
5630         uint8_t unused_1;
5631         uint8_t unused_2[3];
5632         uint8_t unused_3;
5633         uint64_t tx_stat_host_addr;
5634         /* This is the host address where Tx port statistics will be stored */
5635         uint64_t rx_stat_host_addr;
5636         /* This is the host address where Rx port statistics will be stored */
5637 } __attribute__((packed));
5638
5639 /* Output       (16 bytes) */
5640 struct hwrm_port_qstats_output {
5641         uint16_t error_code;
5642         /*
5643          * Pass/Fail or error type Note: receiver to verify the in
5644          * parameters, and fail the call with an error when appropriate
5645          */
5646         uint16_t req_type;
5647         /* This field returns the type of original request. */
5648         uint16_t seq_id;
5649         /* This field provides original sequence number of the command. */
5650         uint16_t resp_len;
5651         /*
5652          * This field is the length of the response in bytes. The last
5653          * byte of the response is a valid flag that will read as '1'
5654          * when the command has been completely written to memory.
5655          */
5656         uint16_t tx_stat_size;
5657         /* The size of TX port statistics block in bytes. */
5658         uint16_t rx_stat_size;
5659         /* The size of RX port statistics block in bytes. */
5660         uint8_t unused_0;
5661         uint8_t unused_1;
5662         uint8_t unused_2;
5663         uint8_t valid;
5664         /*
5665          * This field is used in Output records to indicate that the
5666          * output is completely written to RAM. This field should be
5667          * read as '1' to indicate that the output has been completely
5668          * written. When writing a command completion or response to an
5669          * internal processor, the order of writes has to be such that
5670          * this field is written last.
5671          */
5672 } __attribute__((packed));
5673
5674 /* hwrm_port_clr_stats */
5675 /*
5676  * Description: This function clears per port statistics. The HWRM shall not
5677  * allow a VF driver to clear port statistics. The HWRM shall not allow a PF
5678  * driver to clear port statistics in a partitioning mode. The HWRM may allow a
5679  * PF driver to clear port statistics in the non-partitioning mode.
5680  */
5681 /* Input        (24 bytes) */
5682 struct hwrm_port_clr_stats_input {
5683         uint16_t req_type;
5684         /*
5685          * This value indicates what type of request this is. The format
5686          * for the rest of the command is determined by this field.
5687          */
5688         uint16_t cmpl_ring;
5689         /*
5690          * This value indicates the what completion ring the request
5691          * will be optionally completed on. If the value is -1, then no
5692          * CR completion will be generated. Any other value must be a
5693          * valid CR ring_id value for this function.
5694          */
5695         uint16_t seq_id;
5696         /* This value indicates the command sequence number. */
5697         uint16_t target_id;
5698         /*
5699          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
5700          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
5701          * - HWRM
5702          */
5703         uint64_t resp_addr;
5704         /*
5705          * This is the host address where the response will be written
5706          * when the request is complete. This area must be 16B aligned
5707          * and must be cleared to zero before the request is made.
5708          */
5709         uint16_t port_id;
5710         /* Port ID of port that is being queried. */
5711         uint16_t unused_0[3];
5712 } __attribute__((packed));
5713
5714 /* Output       (16 bytes) */
5715 struct hwrm_port_clr_stats_output {
5716         uint16_t error_code;
5717         /*
5718          * Pass/Fail or error type Note: receiver to verify the in
5719          * parameters, and fail the call with an error when appropriate
5720          */
5721         uint16_t req_type;
5722         /* This field returns the type of original request. */
5723         uint16_t seq_id;
5724         /* This field provides original sequence number of the command. */
5725         uint16_t resp_len;
5726         /*
5727          * This field is the length of the response in bytes. The last
5728          * byte of the response is a valid flag that will read as '1'
5729          * when the command has been completely written to memory.
5730          */
5731         uint32_t unused_0;
5732         uint8_t unused_1;
5733         uint8_t unused_2;
5734         uint8_t unused_3;
5735         uint8_t valid;
5736         /*
5737          * This field is used in Output records to indicate that the
5738          * output is completely written to RAM. This field should be
5739          * read as '1' to indicate that the output has been completely
5740          * written. When writing a command completion or response to an
5741          * internal processor, the order of writes has to be such that
5742          * this field is written last.
5743          */
5744 } __attribute__((packed));
5745
5746 /* hwrm_port_led_cfg */
5747 /*
5748  * Description: This function is used to configure LEDs on a given port. Each
5749  * port has individual set of LEDs associated with it. These LEDs are used for
5750  * speed/link configuration as well as activity indicator configuration. Up to
5751  * three LEDs can be configured, one for activity and two for speeds.
5752  */
5753 /* Input        (64 bytes) */
5754 struct hwrm_port_led_cfg_input {
5755         uint16_t req_type;
5756         /*
5757          * This value indicates what type of request this is. The format
5758          * for the rest of the command is determined by this field.
5759          */
5760         uint16_t cmpl_ring;
5761         /*
5762          * This value indicates the what completion ring the request
5763          * will be optionally completed on. If the value is -1, then no
5764          * CR completion will be generated. Any other value must be a
5765          * valid CR ring_id value for this function.
5766          */
5767         uint16_t seq_id;
5768         /* This value indicates the command sequence number. */
5769         uint16_t target_id;
5770         /*
5771          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
5772          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
5773          * - HWRM
5774          */
5775         uint64_t resp_addr;
5776         /*
5777          * This is the host address where the response will be written
5778          * when the request is complete. This area must be 16B aligned
5779          * and must be cleared to zero before the request is made.
5780          */
5781         uint32_t enables;
5782         /* This bit must be '1' for the led0_id field to be configured. */
5783         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_ID UINT32_C(0x1)
5784         /* This bit must be '1' for the led0_state field to be configured. */
5785         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_STATE      UINT32_C(0x2)
5786         /* This bit must be '1' for the led0_color field to be configured. */
5787         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_COLOR      UINT32_C(0x4)
5788         /*
5789          * This bit must be '1' for the led0_blink_on field to be
5790          * configured.
5791          */
5792         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_BLINK_ON   UINT32_C(0x8)
5793         /*
5794          * This bit must be '1' for the led0_blink_off field to be
5795          * configured.
5796          */
5797         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_BLINK_OFF UINT32_C(0x10)
5798         /*
5799          * This bit must be '1' for the led0_group_id field to be
5800          * configured.
5801          */
5802         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_GROUP_ID UINT32_C(0x20)
5803         /* This bit must be '1' for the led1_id field to be configured. */
5804         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED1_ID UINT32_C(0x40)
5805         /* This bit must be '1' for the led1_state field to be configured. */
5806         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED1_STATE      UINT32_C(0x80)
5807         /* This bit must be '1' for the led1_color field to be configured. */
5808         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED1_COLOR      UINT32_C(0x100)
5809         /*
5810          * This bit must be '1' for the led1_blink_on field to be
5811          * configured.
5812          */
5813         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED1_BLINK_ON UINT32_C(0x200)
5814         /*
5815          * This bit must be '1' for the led1_blink_off field to be
5816          * configured.
5817          */
5818         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED1_BLINK_OFF UINT32_C(0x400)
5819         /*
5820          * This bit must be '1' for the led1_group_id field to be
5821          * configured.
5822          */
5823         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED1_GROUP_ID UINT32_C(0x800)
5824         /* This bit must be '1' for the led2_id field to be configured. */
5825         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED2_ID UINT32_C(0x1000)
5826         /* This bit must be '1' for the led2_state field to be configured. */
5827         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED2_STATE      UINT32_C(0x2000)
5828         /* This bit must be '1' for the led2_color field to be configured. */
5829         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED2_COLOR      UINT32_C(0x4000)
5830         /*
5831          * This bit must be '1' for the led2_blink_on field to be
5832          * configured.
5833          */
5834         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED2_BLINK_ON UINT32_C(0x8000)
5835         /*
5836          * This bit must be '1' for the led2_blink_off field to be
5837          * configured.
5838          */
5839         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED2_BLINK_OFF UINT32_C(0x10000)
5840         /*
5841          * This bit must be '1' for the led2_group_id field to be
5842          * configured.
5843          */
5844         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED2_GROUP_ID UINT32_C(0x20000)
5845         /* This bit must be '1' for the led3_id field to be configured. */
5846         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED3_ID UINT32_C(0x40000)
5847         /* This bit must be '1' for the led3_state field to be configured. */
5848         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED3_STATE  UINT32_C(0x80000)
5849         /* This bit must be '1' for the led3_color field to be configured. */
5850         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED3_COLOR  UINT32_C(0x100000)
5851         /*
5852          * This bit must be '1' for the led3_blink_on field to be
5853          * configured.
5854          */
5855         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED3_BLINK_ON UINT32_C(0x200000)
5856         /*
5857          * This bit must be '1' for the led3_blink_off field to be
5858          * configured.
5859          */
5860         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED3_BLINK_OFF  \
5861                 UINT32_C(0x400000)
5862         /*
5863          * This bit must be '1' for the led3_group_id field to be
5864          * configured.
5865          */
5866         #define HWRM_PORT_LED_CFG_INPUT_ENABLES_LED3_GROUP_ID UINT32_C(0x800000)
5867         uint16_t port_id;
5868         /* Port ID of port whose LEDs are configured. */
5869         uint8_t num_leds;
5870         /*
5871          * The number of LEDs that are being configured. Up to 4 LEDs
5872          * can be configured with this command.
5873          */
5874         uint8_t rsvd;
5875         /* Reserved field. */
5876         uint8_t led0_id;
5877         /* An identifier for the LED #0. */
5878         uint8_t led0_state;
5879         /* The requested state of the LED #0. */
5880         /* Default state of the LED */
5881         #define HWRM_PORT_LED_CFG_INPUT_LED0_STATE_DEFAULT      UINT32_C(0x0)
5882         /* Off */
5883         #define HWRM_PORT_LED_CFG_INPUT_LED0_STATE_OFF  UINT32_C(0x1)
5884         /* On */
5885         #define HWRM_PORT_LED_CFG_INPUT_LED0_STATE_ON   UINT32_C(0x2)
5886         /* Blink */
5887         #define HWRM_PORT_LED_CFG_INPUT_LED0_STATE_BLINK        UINT32_C(0x3)
5888         /* Blink Alternately */
5889         #define HWRM_PORT_LED_CFG_INPUT_LED0_STATE_BLINKALT     UINT32_C(0x4)
5890         uint8_t led0_color;
5891         /* The requested color of LED #0. */
5892         /* Default */
5893         #define HWRM_PORT_LED_CFG_INPUT_LED0_COLOR_DEFAULT      UINT32_C(0x0)
5894         /* Amber */
5895         #define HWRM_PORT_LED_CFG_INPUT_LED0_COLOR_AMBER        UINT32_C(0x1)
5896         /* Green */
5897         #define HWRM_PORT_LED_CFG_INPUT_LED0_COLOR_GREEN        UINT32_C(0x2)
5898         /* Green or Amber */
5899         #define HWRM_PORT_LED_CFG_INPUT_LED0_COLOR_GREENAMBER   UINT32_C(0x3)
5900         uint8_t unused_0;
5901         uint16_t led0_blink_on;
5902         /*
5903          * If the LED #0 state is "blink" or "blinkalt", then this field
5904          * represents the requested time in milliseconds to keep LED on
5905          * between cycles.
5906          */
5907         uint16_t led0_blink_off;
5908         /*
5909          * If the LED #0 state is "blink" or "blinkalt", then this field
5910          * represents the requested time in milliseconds to keep LED off
5911          * between cycles.
5912          */
5913         uint8_t led0_group_id;
5914         /*
5915          * An identifier for the group of LEDs that LED #0 belongs to.
5916          * If set to 0, then the LED #0 shall not be grouped and shall
5917          * be treated as an individual resource. For all other non-zero
5918          * values of this field, LED #0 shall be grouped together with
5919          * the LEDs with the same group ID value.
5920          */
5921         uint8_t rsvd0;
5922         /* Reserved field. */
5923         uint8_t led1_id;
5924         /* An identifier for the LED #1. */
5925         uint8_t led1_state;
5926         /* The requested state of the LED #1. */
5927         /* Default state of the LED */
5928         #define HWRM_PORT_LED_CFG_INPUT_LED1_STATE_DEFAULT      UINT32_C(0x0)
5929         /* Off */
5930         #define HWRM_PORT_LED_CFG_INPUT_LED1_STATE_OFF  UINT32_C(0x1)
5931         /* On */
5932         #define HWRM_PORT_LED_CFG_INPUT_LED1_STATE_ON   UINT32_C(0x2)
5933         /* Blink */
5934         #define HWRM_PORT_LED_CFG_INPUT_LED1_STATE_BLINK        UINT32_C(0x3)
5935         /* Blink Alternately */
5936         #define HWRM_PORT_LED_CFG_INPUT_LED1_STATE_BLINKALT     UINT32_C(0x4)
5937         uint8_t led1_color;
5938         /* The requested color of LED #1. */
5939         /* Default */
5940         #define HWRM_PORT_LED_CFG_INPUT_LED1_COLOR_DEFAULT      UINT32_C(0x0)
5941         /* Amber */
5942         #define HWRM_PORT_LED_CFG_INPUT_LED1_COLOR_AMBER        UINT32_C(0x1)
5943         /* Green */
5944         #define HWRM_PORT_LED_CFG_INPUT_LED1_COLOR_GREEN        UINT32_C(0x2)
5945         /* Green or Amber */
5946         #define HWRM_PORT_LED_CFG_INPUT_LED1_COLOR_GREENAMBER   UINT32_C(0x3)
5947         uint8_t unused_1;
5948         uint16_t led1_blink_on;
5949         /*
5950          * If the LED #1 state is "blink" or "blinkalt", then this field
5951          * represents the requested time in milliseconds to keep LED on
5952          * between cycles.
5953          */
5954         uint16_t led1_blink_off;
5955         /*
5956          * If the LED #1 state is "blink" or "blinkalt", then this field
5957          * represents the requested time in milliseconds to keep LED off
5958          * between cycles.
5959          */
5960         uint8_t led1_group_id;
5961         /*
5962          * An identifier for the group of LEDs that LED #1 belongs to.
5963          * If set to 0, then the LED #1 shall not be grouped and shall
5964          * be treated as an individual resource. For all other non-zero
5965          * values of this field, LED #1 shall be grouped together with
5966          * the LEDs with the same group ID value.
5967          */
5968         uint8_t rsvd1;
5969         /* Reserved field. */
5970         uint8_t led2_id;
5971         /* An identifier for the LED #2. */
5972         uint8_t led2_state;
5973         /* The requested state of the LED #2. */
5974         /* Default state of the LED */
5975         #define HWRM_PORT_LED_CFG_INPUT_LED2_STATE_DEFAULT      UINT32_C(0x0)
5976         /* Off */
5977         #define HWRM_PORT_LED_CFG_INPUT_LED2_STATE_OFF  UINT32_C(0x1)
5978         /* On */
5979         #define HWRM_PORT_LED_CFG_INPUT_LED2_STATE_ON   UINT32_C(0x2)
5980         /* Blink */
5981         #define HWRM_PORT_LED_CFG_INPUT_LED2_STATE_BLINK        UINT32_C(0x3)
5982         /* Blink Alternately */
5983         #define HWRM_PORT_LED_CFG_INPUT_LED2_STATE_BLINKALT     UINT32_C(0x4)
5984         uint8_t led2_color;
5985         /* The requested color of LED #2. */
5986         /* Default */
5987         #define HWRM_PORT_LED_CFG_INPUT_LED2_COLOR_DEFAULT      UINT32_C(0x0)
5988         /* Amber */
5989         #define HWRM_PORT_LED_CFG_INPUT_LED2_COLOR_AMBER        UINT32_C(0x1)
5990         /* Green */
5991         #define HWRM_PORT_LED_CFG_INPUT_LED2_COLOR_GREEN        UINT32_C(0x2)
5992         /* Green or Amber */
5993         #define HWRM_PORT_LED_CFG_INPUT_LED2_COLOR_GREENAMBER   UINT32_C(0x3)
5994         uint8_t unused_2;
5995         uint16_t led2_blink_on;
5996         /*
5997          * If the LED #2 state is "blink" or "blinkalt", then this field
5998          * represents the requested time in milliseconds to keep LED on
5999          * between cycles.
6000          */
6001         uint16_t led2_blink_off;
6002         /*
6003          * If the LED #2 state is "blink" or "blinkalt", then this field
6004          * represents the requested time in milliseconds to keep LED off
6005          * between cycles.
6006          */
6007         uint8_t led2_group_id;
6008         /*
6009          * An identifier for the group of LEDs that LED #2 belongs to.
6010          * If set to 0, then the LED #2 shall not be grouped and shall
6011          * be treated as an individual resource. For all other non-zero
6012          * values of this field, LED #2 shall be grouped together with
6013          * the LEDs with the same group ID value.
6014          */
6015         uint8_t rsvd2;
6016         /* Reserved field. */
6017         uint8_t led3_id;
6018         /* An identifier for the LED #3. */
6019         uint8_t led3_state;
6020         /* The requested state of the LED #3. */
6021         /* Default state of the LED */
6022         #define HWRM_PORT_LED_CFG_INPUT_LED3_STATE_DEFAULT      UINT32_C(0x0)
6023         /* Off */
6024         #define HWRM_PORT_LED_CFG_INPUT_LED3_STATE_OFF  UINT32_C(0x1)
6025         /* On */
6026         #define HWRM_PORT_LED_CFG_INPUT_LED3_STATE_ON   UINT32_C(0x2)
6027         /* Blink */
6028         #define HWRM_PORT_LED_CFG_INPUT_LED3_STATE_BLINK        UINT32_C(0x3)
6029         /* Blink Alternately */
6030         #define HWRM_PORT_LED_CFG_INPUT_LED3_STATE_BLINKALT     UINT32_C(0x4)
6031         uint8_t led3_color;
6032         /* The requested color of LED #3. */
6033         /* Default */
6034         #define HWRM_PORT_LED_CFG_INPUT_LED3_COLOR_DEFAULT      UINT32_C(0x0)
6035         /* Amber */
6036         #define HWRM_PORT_LED_CFG_INPUT_LED3_COLOR_AMBER        UINT32_C(0x1)
6037         /* Green */
6038         #define HWRM_PORT_LED_CFG_INPUT_LED3_COLOR_GREEN        UINT32_C(0x2)
6039         /* Green or Amber */
6040         #define HWRM_PORT_LED_CFG_INPUT_LED3_COLOR_GREENAMBER   UINT32_C(0x3)
6041         uint8_t unused_3;
6042         uint16_t led3_blink_on;
6043         /*
6044          * If the LED #3 state is "blink" or "blinkalt", then this field
6045          * represents the requested time in milliseconds to keep LED on
6046          * between cycles.
6047          */
6048         uint16_t led3_blink_off;
6049         /*
6050          * If the LED #3 state is "blink" or "blinkalt", then this field
6051          * represents the requested time in milliseconds to keep LED off
6052          * between cycles.
6053          */
6054         uint8_t led3_group_id;
6055         /*
6056          * An identifier for the group of LEDs that LED #3 belongs to.
6057          * If set to 0, then the LED #3 shall not be grouped and shall
6058          * be treated as an individual resource. For all other non-zero
6059          * values of this field, LED #3 shall be grouped together with
6060          * the LEDs with the same group ID value.
6061          */
6062         uint8_t rsvd3;
6063         /* Reserved field. */
6064 } __attribute__((packed));
6065
6066 /* Output       (16 bytes) */
6067 struct hwrm_port_led_cfg_output {
6068         uint16_t error_code;
6069         /*
6070          * Pass/Fail or error type Note: receiver to verify the in
6071          * parameters, and fail the call with an error when appropriate
6072          */
6073         uint16_t req_type;
6074         /* This field returns the type of original request. */
6075         uint16_t seq_id;
6076         /* This field provides original sequence number of the command. */
6077         uint16_t resp_len;
6078         /*
6079          * This field is the length of the response in bytes. The last
6080          * byte of the response is a valid flag that will read as '1'
6081          * when the command has been completely written to memory.
6082          */
6083         uint32_t unused_0;
6084         uint8_t unused_1;
6085         uint8_t unused_2;
6086         uint8_t unused_3;
6087         uint8_t valid;
6088         /*
6089          * This field is used in Output records to indicate that the
6090          * output is completely written to RAM. This field should be
6091          * read as '1' to indicate that the output has been completely
6092          * written. When writing a command completion or response to an
6093          * internal processor, the order of writes has to be such that
6094          * this field is written last.
6095          */
6096 } __attribute__((packed));
6097
6098 /* hwrm_port_led_qcfg */
6099 /*
6100  * Description: This function is used to query configuration of LEDs on a given
6101  * port. Each port has individual set of LEDs associated with it. These LEDs are
6102  * used for speed/link configuration as well as activity indicator
6103  * configuration. Up to three LEDs can be configured, one for activity and two
6104  * for speeds.
6105  */
6106 /* Input        (24 bytes) */
6107 struct hwrm_port_led_qcfg_input {
6108         uint16_t req_type;
6109         /*
6110          * This value indicates what type of request this is. The format
6111          * for the rest of the command is determined by this field.
6112          */
6113         uint16_t cmpl_ring;
6114         /*
6115          * This value indicates the what completion ring the request
6116          * will be optionally completed on. If the value is -1, then no
6117          * CR completion will be generated. Any other value must be a
6118          * valid CR ring_id value for this function.
6119          */
6120         uint16_t seq_id;
6121         /* This value indicates the command sequence number. */
6122         uint16_t target_id;
6123         /*
6124          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
6125          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
6126          * - HWRM
6127          */
6128         uint64_t resp_addr;
6129         /*
6130          * This is the host address where the response will be written
6131          * when the request is complete. This area must be 16B aligned
6132          * and must be cleared to zero before the request is made.
6133          */
6134         uint16_t port_id;
6135         /* Port ID of port whose LED configuration is being queried. */
6136         uint16_t unused_0[3];
6137 } __attribute__((packed));
6138
6139 /* Output       (56 bytes) */
6140 struct hwrm_port_led_qcfg_output {
6141         uint16_t error_code;
6142         /*
6143          * Pass/Fail or error type Note: receiver to verify the in
6144          * parameters, and fail the call with an error when appropriate
6145          */
6146         uint16_t req_type;
6147         /* This field returns the type of original request. */
6148         uint16_t seq_id;
6149         /* This field provides original sequence number of the command. */
6150         uint16_t resp_len;
6151         /*
6152          * This field is the length of the response in bytes. The last
6153          * byte of the response is a valid flag that will read as '1'
6154          * when the command has been completely written to memory.
6155          */
6156         uint8_t num_leds;
6157         /*
6158          * The number of LEDs that are configured on this port. Up to 4
6159          * LEDs can be returned in the response.
6160          */
6161         uint8_t led0_id;
6162         /* An identifier for the LED #0. */
6163         uint8_t led0_type;
6164         /* The type of LED #0. */
6165         /* Speed LED */
6166         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_TYPE_SPEED       UINT32_C(0x0)
6167         /* Activity LED */
6168         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_TYPE_ACTIVITY    UINT32_C(0x1)
6169         /* Invalid */
6170         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_TYPE_INVALID     UINT32_C(0xff)
6171         uint8_t led0_state;
6172         /* The current state of the LED #0. */
6173         /* Default state of the LED */
6174         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_STATE_DEFAULT    UINT32_C(0x0)
6175         /* Off */
6176         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_STATE_OFF        UINT32_C(0x1)
6177         /* On */
6178         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_STATE_ON UINT32_C(0x2)
6179         /* Blink */
6180         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_STATE_BLINK      UINT32_C(0x3)
6181         /* Blink Alternately */
6182         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_STATE_BLINKALT   UINT32_C(0x4)
6183         uint8_t led0_color;
6184         /* The color of LED #0. */
6185         /* Default */
6186         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_COLOR_DEFAULT    UINT32_C(0x0)
6187         /* Amber */
6188         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_COLOR_AMBER      UINT32_C(0x1)
6189         /* Green */
6190         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_COLOR_GREEN      UINT32_C(0x2)
6191         /* Green or Amber */
6192         #define HWRM_PORT_LED_QCFG_OUTPUT_LED0_COLOR_GREENAMBER UINT32_C(0x3)
6193         uint8_t unused_0;
6194         uint16_t led0_blink_on;
6195         /*
6196          * If the LED #0 state is "blink" or "blinkalt", then this field
6197          * represents the requested time in milliseconds to keep LED on
6198          * between cycles.
6199          */
6200         uint16_t led0_blink_off;
6201         /*
6202          * If the LED #0 state is "blink" or "blinkalt", then this field
6203          * represents the requested time in milliseconds to keep LED off
6204          * between cycles.
6205          */
6206         uint8_t led0_group_id;
6207         /*
6208          * An identifier for the group of LEDs that LED #0 belongs to.
6209          * If set to 0, then the LED #0 is not grouped. For all other
6210          * non-zero values of this field, LED #0 is grouped together
6211          * with the LEDs with the same group ID value.
6212          */
6213         uint8_t led1_id;
6214         /* An identifier for the LED #1. */
6215         uint8_t led1_type;
6216         /* The type of LED #1. */
6217         /* Speed LED */
6218         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_TYPE_SPEED       UINT32_C(0x0)
6219         /* Activity LED */
6220         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_TYPE_ACTIVITY    UINT32_C(0x1)
6221         /* Invalid */
6222         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_TYPE_INVALID     UINT32_C(0xff)
6223         uint8_t led1_state;
6224         /* The current state of the LED #1. */
6225         /* Default state of the LED */
6226         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_STATE_DEFAULT    UINT32_C(0x0)
6227         /* Off */
6228         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_STATE_OFF        UINT32_C(0x1)
6229         /* On */
6230         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_STATE_ON UINT32_C(0x2)
6231         /* Blink */
6232         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_STATE_BLINK      UINT32_C(0x3)
6233         /* Blink Alternately */
6234         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_STATE_BLINKALT   UINT32_C(0x4)
6235         uint8_t led1_color;
6236         /* The color of LED #1. */
6237         /* Default */
6238         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_COLOR_DEFAULT    UINT32_C(0x0)
6239         /* Amber */
6240         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_COLOR_AMBER      UINT32_C(0x1)
6241         /* Green */
6242         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_COLOR_GREEN      UINT32_C(0x2)
6243         /* Green or Amber */
6244         #define HWRM_PORT_LED_QCFG_OUTPUT_LED1_COLOR_GREENAMBER UINT32_C(0x3)
6245         uint8_t unused_1;
6246         uint16_t led1_blink_on;
6247         /*
6248          * If the LED #1 state is "blink" or "blinkalt", then this field
6249          * represents the requested time in milliseconds to keep LED on
6250          * between cycles.
6251          */
6252         uint16_t led1_blink_off;
6253         /*
6254          * If the LED #1 state is "blink" or "blinkalt", then this field
6255          * represents the requested time in milliseconds to keep LED off
6256          * between cycles.
6257          */
6258         uint8_t led1_group_id;
6259         /*
6260          * An identifier for the group of LEDs that LED #1 belongs to.
6261          * If set to 0, then the LED #1 is not grouped. For all other
6262          * non-zero values of this field, LED #1 is grouped together
6263          * with the LEDs with the same group ID value.
6264          */
6265         uint8_t led2_id;
6266         /* An identifier for the LED #2. */
6267         uint8_t led2_type;
6268         /* The type of LED #2. */
6269         /* Speed LED */
6270         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_TYPE_SPEED       UINT32_C(0x0)
6271         /* Activity LED */
6272         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_TYPE_ACTIVITY    UINT32_C(0x1)
6273         /* Invalid */
6274         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_TYPE_INVALID     UINT32_C(0xff)
6275         uint8_t led2_state;
6276         /* The current state of the LED #2. */
6277         /* Default state of the LED */
6278         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_STATE_DEFAULT    UINT32_C(0x0)
6279         /* Off */
6280         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_STATE_OFF        UINT32_C(0x1)
6281         /* On */
6282         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_STATE_ON UINT32_C(0x2)
6283         /* Blink */
6284         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_STATE_BLINK      UINT32_C(0x3)
6285         /* Blink Alternately */
6286         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_STATE_BLINKALT   UINT32_C(0x4)
6287         uint8_t led2_color;
6288         /* The color of LED #2. */
6289         /* Default */
6290         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_COLOR_DEFAULT    UINT32_C(0x0)
6291         /* Amber */
6292         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_COLOR_AMBER      UINT32_C(0x1)
6293         /* Green */
6294         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_COLOR_GREEN      UINT32_C(0x2)
6295         /* Green or Amber */
6296         #define HWRM_PORT_LED_QCFG_OUTPUT_LED2_COLOR_GREENAMBER UINT32_C(0x3)
6297         uint8_t unused_2;
6298         uint16_t led2_blink_on;
6299         /*
6300          * If the LED #2 state is "blink" or "blinkalt", then this field
6301          * represents the requested time in milliseconds to keep LED on
6302          * between cycles.
6303          */
6304         uint16_t led2_blink_off;
6305         /*
6306          * If the LED #2 state is "blink" or "blinkalt", then this field
6307          * represents the requested time in milliseconds to keep LED off
6308          * between cycles.
6309          */
6310         uint8_t led2_group_id;
6311         /*
6312          * An identifier for the group of LEDs that LED #2 belongs to.
6313          * If set to 0, then the LED #2 is not grouped. For all other
6314          * non-zero values of this field, LED #2 is grouped together
6315          * with the LEDs with the same group ID value.
6316          */
6317         uint8_t led3_id;
6318         /* An identifier for the LED #3. */
6319         uint8_t led3_type;
6320         /* The type of LED #3. */
6321         /* Speed LED */
6322         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_TYPE_SPEED       UINT32_C(0x0)
6323         /* Activity LED */
6324         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_TYPE_ACTIVITY    UINT32_C(0x1)
6325         /* Invalid */
6326         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_TYPE_INVALID     UINT32_C(0xff)
6327         uint8_t led3_state;
6328         /* The current state of the LED #3. */
6329         /* Default state of the LED */
6330         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_STATE_DEFAULT    UINT32_C(0x0)
6331         /* Off */
6332         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_STATE_OFF        UINT32_C(0x1)
6333         /* On */
6334         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_STATE_ON UINT32_C(0x2)
6335         /* Blink */
6336         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_STATE_BLINK      UINT32_C(0x3)
6337         /* Blink Alternately */
6338         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_STATE_BLINKALT   UINT32_C(0x4)
6339         uint8_t led3_color;
6340         /* The color of LED #3. */
6341         /* Default */
6342         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_COLOR_DEFAULT    UINT32_C(0x0)
6343         /* Amber */
6344         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_COLOR_AMBER      UINT32_C(0x1)
6345         /* Green */
6346         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_COLOR_GREEN      UINT32_C(0x2)
6347         /* Green or Amber */
6348         #define HWRM_PORT_LED_QCFG_OUTPUT_LED3_COLOR_GREENAMBER UINT32_C(0x3)
6349         uint8_t unused_3;
6350         uint16_t led3_blink_on;
6351         /*
6352          * If the LED #3 state is "blink" or "blinkalt", then this field
6353          * represents the requested time in milliseconds to keep LED on
6354          * between cycles.
6355          */
6356         uint16_t led3_blink_off;
6357         /*
6358          * If the LED #3 state is "blink" or "blinkalt", then this field
6359          * represents the requested time in milliseconds to keep LED off
6360          * between cycles.
6361          */
6362         uint8_t led3_group_id;
6363         /*
6364          * An identifier for the group of LEDs that LED #3 belongs to.
6365          * If set to 0, then the LED #3 is not grouped. For all other
6366          * non-zero values of this field, LED #3 is grouped together
6367          * with the LEDs with the same group ID value.
6368          */
6369         uint8_t unused_4;
6370         uint16_t unused_5;
6371         uint8_t unused_6;
6372         uint8_t unused_7;
6373         uint8_t unused_8;
6374         uint8_t valid;
6375         /*
6376          * This field is used in Output records to indicate that the
6377          * output is completely written to RAM. This field should be
6378          * read as '1' to indicate that the output has been completely
6379          * written. When writing a command completion or response to an
6380          * internal processor, the order of writes has to be such that
6381          * this field is written last.
6382          */
6383 } __attribute__((packed));
6384
6385 /* hwrm_port_led_qcaps */
6386 /*
6387  * Description: This function is used to query capabilities of LEDs on a given
6388  * port. Each port has individual set of LEDs associated with it. These LEDs are
6389  * used for speed/link configuration as well as activity indicator
6390  * configuration.
6391  */
6392 /* Input        (24 bytes) */
6393 struct hwrm_port_led_qcaps_input {
6394         uint16_t req_type;
6395         /*
6396          * This value indicates what type of request this is. The format
6397          * for the rest of the command is determined by this field.
6398          */
6399         uint16_t cmpl_ring;
6400         /*
6401          * This value indicates the what completion ring the request
6402          * will be optionally completed on. If the value is -1, then no
6403          * CR completion will be generated. Any other value must be a
6404          * valid CR ring_id value for this function.
6405          */
6406         uint16_t seq_id;
6407         /* This value indicates the command sequence number. */
6408         uint16_t target_id;
6409         /*
6410          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
6411          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
6412          * - HWRM
6413          */
6414         uint64_t resp_addr;
6415         /*
6416          * This is the host address where the response will be written
6417          * when the request is complete. This area must be 16B aligned
6418          * and must be cleared to zero before the request is made.
6419          */
6420         uint16_t port_id;
6421         /* Port ID of port whose LED configuration is being queried. */
6422         uint16_t unused_0[3];
6423 } __attribute__((packed));
6424
6425 /* Output       (48 bytes) */
6426 struct hwrm_port_led_qcaps_output {
6427         uint16_t error_code;
6428         /*
6429          * Pass/Fail or error type Note: receiver to verify the in
6430          * parameters, and fail the call with an error when appropriate
6431          */
6432         uint16_t req_type;
6433         /* This field returns the type of original request. */
6434         uint16_t seq_id;
6435         /* This field provides original sequence number of the command. */
6436         uint16_t resp_len;
6437         /*
6438          * This field is the length of the response in bytes. The last
6439          * byte of the response is a valid flag that will read as '1'
6440          * when the command has been completely written to memory.
6441          */
6442         uint8_t num_leds;
6443         /*
6444          * The number of LEDs that are configured on this port. Up to 4
6445          * LEDs can be returned in the response.
6446          */
6447         uint8_t unused_0[3];
6448         /* Reserved for future use. */
6449         uint8_t led0_id;
6450         /* An identifier for the LED #0. */
6451         uint8_t led0_type;
6452         /* The type of LED #0. */
6453         /* Speed LED */
6454         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_TYPE_SPEED      UINT32_C(0x0)
6455         /* Activity LED */
6456         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_TYPE_ACTIVITY   UINT32_C(0x1)
6457         /* Invalid */
6458         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_TYPE_INVALID    UINT32_C(0xff)
6459         uint8_t led0_group_id;
6460         /*
6461          * An identifier for the group of LEDs that LED #0 belongs to.
6462          * If set to 0, then the LED #0 cannot be grouped. For all other
6463          * non-zero values of this field, LED #0 is grouped together
6464          * with the LEDs with the same group ID value.
6465          */
6466         uint8_t unused_1;
6467         uint16_t led0_state_caps;
6468         /* The states supported by LED #0. */
6469         /*
6470          * If set to 1, this LED is enabled. If set to 0, this LED is
6471          * disabled.
6472          */
6473         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_STATE_CAPS_ENABLED UINT32_C(0x1)
6474         /*
6475          * If set to 1, off state is supported on this LED. If set to 0,
6476          * off state is not supported on this LED.
6477          */
6478         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_STATE_CAPS_OFF_SUPPORTED  \
6479                 UINT32_C(0x2)
6480         /*
6481          * If set to 1, on state is supported on this LED. If set to 0,
6482          * on state is not supported on this LED.
6483          */
6484         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_STATE_CAPS_ON_SUPPORTED   \
6485                 UINT32_C(0x4)
6486         /*
6487          * If set to 1, blink state is supported on this LED. If set to
6488          * 0, blink state is not supported on this LED.
6489          */
6490         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_STATE_CAPS_BLINK_SUPPORTED \
6491                 UINT32_C(0x8)
6492         /*
6493          * If set to 1, blink_alt state is supported on this LED. If set
6494          * to 0, blink_alt state is not supported on this LED.
6495          */
6496         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_STATE_CAPS_BLINK_ALT_SUPPORTED \
6497                 UINT32_C(0x10)
6498         uint16_t led0_color_caps;
6499         /* The colors supported by LED #0. */
6500         /* reserved */
6501         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_COLOR_CAPS_RSVD UINT32_C(0x1)
6502         /*
6503          * If set to 1, Amber color is supported on this LED. If set to
6504          * 0, Amber color is not supported on this LED.
6505          */
6506         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_COLOR_CAPS_AMBER_SUPPORTED \
6507                 UINT32_C(0x2)
6508         /*
6509          * If set to 1, Green color is supported on this LED. If set to
6510          * 0, Green color is not supported on this LED.
6511          */
6512         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED0_COLOR_CAPS_GREEN_SUPPORTED \
6513                 UINT32_C(0x4)
6514         uint8_t led1_id;
6515         /* An identifier for the LED #1. */
6516         uint8_t led1_type;
6517         /* The type of LED #1. */
6518         /* Speed LED */
6519         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_TYPE_SPEED      UINT32_C(0x0)
6520         /* Activity LED */
6521         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_TYPE_ACTIVITY   UINT32_C(0x1)
6522         /* Invalid */
6523         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_TYPE_INVALID    UINT32_C(0xff)
6524         uint8_t led1_group_id;
6525         /*
6526          * An identifier for the group of LEDs that LED #1 belongs to.
6527          * If set to 0, then the LED #0 cannot be grouped. For all other
6528          * non-zero values of this field, LED #0 is grouped together
6529          * with the LEDs with the same group ID value.
6530          */
6531         uint8_t unused_2;
6532         uint16_t led1_state_caps;
6533         /* The states supported by LED #1. */
6534         /*
6535          * If set to 1, this LED is enabled. If set to 0, this LED is
6536          * disabled.
6537          */
6538         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_STATE_CAPS_ENABLED UINT32_C(0x1)
6539         /*
6540          * If set to 1, off state is supported on this LED. If set to 0,
6541          * off state is not supported on this LED.
6542          */
6543         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_STATE_CAPS_OFF_SUPPORTED  \
6544                 UINT32_C(0x2)
6545         /*
6546          * If set to 1, on state is supported on this LED. If set to 0,
6547          * on state is not supported on this LED.
6548          */
6549         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_STATE_CAPS_ON_SUPPORTED   \
6550                 UINT32_C(0x4)
6551         /*
6552          * If set to 1, blink state is supported on this LED. If set to
6553          * 0, blink state is not supported on this LED.
6554          */
6555         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_STATE_CAPS_BLINK_SUPPORTED \
6556                 UINT32_C(0x8)
6557         /*
6558          * If set to 1, blink_alt state is supported on this LED. If set
6559          * to 0, blink_alt state is not supported on this LED.
6560          */
6561         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_STATE_CAPS_BLINK_ALT_SUPPORTED \
6562                 UINT32_C(0x10)
6563         uint16_t led1_color_caps;
6564         /* The colors supported by LED #1. */
6565         /* reserved */
6566         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_COLOR_CAPS_RSVD UINT32_C(0x1)
6567         /*
6568          * If set to 1, Amber color is supported on this LED. If set to
6569          * 0, Amber color is not supported on this LED.
6570          */
6571         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_COLOR_CAPS_AMBER_SUPPORTED \
6572                 UINT32_C(0x2)
6573         /*
6574          * If set to 1, Green color is supported on this LED. If set to
6575          * 0, Green color is not supported on this LED.
6576          */
6577         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED1_COLOR_CAPS_GREEN_SUPPORTED \
6578                 UINT32_C(0x4)
6579         uint8_t led2_id;
6580         /* An identifier for the LED #2. */
6581         uint8_t led2_type;
6582         /* The type of LED #2. */
6583         /* Speed LED */
6584         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_TYPE_SPEED      UINT32_C(0x0)
6585         /* Activity LED */
6586         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_TYPE_ACTIVITY   UINT32_C(0x1)
6587         /* Invalid */
6588         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_TYPE_INVALID    UINT32_C(0xff)
6589         uint8_t led2_group_id;
6590         /*
6591          * An identifier for the group of LEDs that LED #0 belongs to.
6592          * If set to 0, then the LED #0 cannot be grouped. For all other
6593          * non-zero values of this field, LED #0 is grouped together
6594          * with the LEDs with the same group ID value.
6595          */
6596         uint8_t unused_3;
6597         uint16_t led2_state_caps;
6598         /* The states supported by LED #2. */
6599         /*
6600          * If set to 1, this LED is enabled. If set to 0, this LED is
6601          * disabled.
6602          */
6603         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_STATE_CAPS_ENABLED UINT32_C(0x1)
6604         /*
6605          * If set to 1, off state is supported on this LED. If set to 0,
6606          * off state is not supported on this LED.
6607          */
6608         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_STATE_CAPS_OFF_SUPPORTED  \
6609                 UINT32_C(0x2)
6610         /*
6611          * If set to 1, on state is supported on this LED. If set to 0,
6612          * on state is not supported on this LED.
6613          */
6614         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_STATE_CAPS_ON_SUPPORTED   \
6615                 UINT32_C(0x4)
6616         /*
6617          * If set to 1, blink state is supported on this LED. If set to
6618          * 0, blink state is not supported on this LED.
6619          */
6620         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_STATE_CAPS_BLINK_SUPPORTED \
6621                 UINT32_C(0x8)
6622         /*
6623          * If set to 1, blink_alt state is supported on this LED. If set
6624          * to 0, blink_alt state is not supported on this LED.
6625          */
6626         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_STATE_CAPS_BLINK_ALT_SUPPORTED \
6627                 UINT32_C(0x10)
6628         uint16_t led2_color_caps;
6629         /* The colors supported by LED #2. */
6630         /* reserved */
6631         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_COLOR_CAPS_RSVD UINT32_C(0x1)
6632         /*
6633          * If set to 1, Amber color is supported on this LED. If set to
6634          * 0, Amber color is not supported on this LED.
6635          */
6636         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_COLOR_CAPS_AMBER_SUPPORTED \
6637                 UINT32_C(0x2)
6638         /*
6639          * If set to 1, Green color is supported on this LED. If set to
6640          * 0, Green color is not supported on this LED.
6641          */
6642         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED2_COLOR_CAPS_GREEN_SUPPORTED \
6643                 UINT32_C(0x4)
6644         uint8_t led3_id;
6645         /* An identifier for the LED #3. */
6646         uint8_t led3_type;
6647         /* The type of LED #3. */
6648         /* Speed LED */
6649         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_TYPE_SPEED      UINT32_C(0x0)
6650         /* Activity LED */
6651         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_TYPE_ACTIVITY   UINT32_C(0x1)
6652         /* Invalid */
6653         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_TYPE_INVALID    UINT32_C(0xff)
6654         uint8_t led3_group_id;
6655         /*
6656          * An identifier for the group of LEDs that LED #3 belongs to.
6657          * If set to 0, then the LED #0 cannot be grouped. For all other
6658          * non-zero values of this field, LED #0 is grouped together
6659          * with the LEDs with the same group ID value.
6660          */
6661         uint8_t unused_4;
6662         uint16_t led3_state_caps;
6663         /* The states supported by LED #3. */
6664         /*
6665          * If set to 1, this LED is enabled. If set to 0, this LED is
6666          * disabled.
6667          */
6668         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_STATE_CAPS_ENABLED UINT32_C(0x1)
6669         /*
6670          * If set to 1, off state is supported on this LED. If set to 0,
6671          * off state is not supported on this LED.
6672          */
6673         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_STATE_CAPS_OFF_SUPPORTED  \
6674                 UINT32_C(0x2)
6675         /*
6676          * If set to 1, on state is supported on this LED. If set to 0,
6677          * on state is not supported on this LED.
6678          */
6679         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_STATE_CAPS_ON_SUPPORTED   \
6680                 UINT32_C(0x4)
6681         /*
6682          * If set to 1, blink state is supported on this LED. If set to
6683          * 0, blink state is not supported on this LED.
6684          */
6685         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_STATE_CAPS_BLINK_SUPPORTED \
6686                 UINT32_C(0x8)
6687         /*
6688          * If set to 1, blink_alt state is supported on this LED. If set
6689          * to 0, blink_alt state is not supported on this LED.
6690          */
6691         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_STATE_CAPS_BLINK_ALT_SUPPORTED \
6692                 UINT32_C(0x10)
6693         uint16_t led3_color_caps;
6694         /* The colors supported by LED #3. */
6695         /* reserved */
6696         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_COLOR_CAPS_RSVD UINT32_C(0x1)
6697         /*
6698          * If set to 1, Amber color is supported on this LED. If set to
6699          * 0, Amber color is not supported on this LED.
6700          */
6701         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_COLOR_CAPS_AMBER_SUPPORTED \
6702                 UINT32_C(0x2)
6703         /*
6704          * If set to 1, Green color is supported on this LED. If set to
6705          * 0, Green color is not supported on this LED.
6706          */
6707         #define HWRM_PORT_LED_QCAPS_OUTPUT_LED3_COLOR_CAPS_GREEN_SUPPORTED \
6708                 UINT32_C(0x4)
6709         uint8_t unused_5;
6710         uint8_t unused_6;
6711         uint8_t unused_7;
6712         uint8_t valid;
6713         /*
6714          * This field is used in Output records to indicate that the
6715          * output is completely written to RAM. This field should be
6716          * read as '1' to indicate that the output has been completely
6717          * written. When writing a command completion or response to an
6718          * internal processor, the order of writes has to be such that
6719          * this field is written last.
6720          */
6721 } __attribute__((packed));
6722
6723 /* hwrm_queue_qportcfg */
6724 /*
6725  * Description: This function is called by a driver to query queue configuration
6726  * of a port. # The HWRM shall at least advertise one queue with lossy service
6727  * profile. # The driver shall use this command to query queue ids before
6728  * configuring or using any queues. # If a service profile is not set for a
6729  * queue, then the driver shall not use that queue without configuring a service
6730  * profile for it. # If the driver is not allowed to configure service profiles,
6731  * then the driver shall only use queues for which service profiles are pre-
6732  * configured.
6733  */
6734 /* Input        (24 bytes) */
6735 struct hwrm_queue_qportcfg_input {
6736         uint16_t req_type;
6737         /*
6738          * This value indicates what type of request this is. The format
6739          * for the rest of the command is determined by this field.
6740          */
6741         uint16_t cmpl_ring;
6742         /*
6743          * This value indicates the what completion ring the request
6744          * will be optionally completed on. If the value is -1, then no
6745          * CR completion will be generated. Any other value must be a
6746          * valid CR ring_id value for this function.
6747          */
6748         uint16_t seq_id;
6749         /* This value indicates the command sequence number. */
6750         uint16_t target_id;
6751         /*
6752          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
6753          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
6754          * - HWRM
6755          */
6756         uint64_t resp_addr;
6757         /*
6758          * This is the host address where the response will be written
6759          * when the request is complete. This area must be 16B aligned
6760          * and must be cleared to zero before the request is made.
6761          */
6762         uint32_t flags;
6763         /*
6764          * Enumeration denoting the RX, TX type of the resource. This
6765          * enumeration is used for resources that are similar for both
6766          * TX and RX paths of the chip.
6767          */
6768         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH    UINT32_C(0x1)
6769         /* tx path */
6770         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_TX UINT32_C(0x0)
6771         /* rx path */
6772         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX UINT32_C(0x1)
6773         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_LAST \
6774                 QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX
6775         uint16_t port_id;
6776         /*
6777          * Port ID of port for which the queue configuration is being
6778          * queried. This field is only required when sent by IPC.
6779          */
6780         uint16_t unused_0;
6781 } __attribute__((packed));
6782
6783 /* Output       (32 bytes) */
6784 struct hwrm_queue_qportcfg_output {
6785         uint16_t error_code;
6786         /*
6787          * Pass/Fail or error type Note: receiver to verify the in
6788          * parameters, and fail the call with an error when appropriate
6789          */
6790         uint16_t req_type;
6791         /* This field returns the type of original request. */
6792         uint16_t seq_id;
6793         /* This field provides original sequence number of the command. */
6794         uint16_t resp_len;
6795         /*
6796          * This field is the length of the response in bytes. The last
6797          * byte of the response is a valid flag that will read as '1'
6798          * when the command has been completely written to memory.
6799          */
6800         uint8_t max_configurable_queues;
6801         /*
6802          * The maximum number of queues that can be configured on this
6803          * port. Valid values range from 1 through 8.
6804          */
6805         uint8_t max_configurable_lossless_queues;
6806         /*
6807          * The maximum number of lossless queues that can be configured
6808          * on this port. Valid values range from 0 through 8.
6809          */
6810         uint8_t queue_cfg_allowed;
6811         /*
6812          * Bitmask indicating which queues can be configured by the
6813          * hwrm_queue_cfg command. Each bit represents a specific queue
6814          * where bit 0 represents queue 0 and bit 7 represents queue 7.
6815          * # A value of 0 indicates that the queue is not configurable
6816          * by the hwrm_queue_cfg command. # A value of 1 indicates that
6817          * the queue is configurable. # A hwrm_queue_cfg command shall
6818          * return error when trying to configure a queue not
6819          * configurable.
6820          */
6821         uint8_t queue_cfg_info;
6822         /* Information about queue configuration. */
6823         /*
6824          * If this flag is set to '1', then the queues are configured
6825          * asymmetrically on TX and RX sides. If this flag is set to
6826          * '0', then the queues are configured symmetrically on TX and
6827          * RX sides. For symmetric configuration, the queue
6828          * configuration including queue ids and service profiles on the
6829          * TX side is the same as the corresponding queue configuration
6830          * on the RX side.
6831          */
6832         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_CFG_INFO_ASYM_CFG UINT32_C(0x1)
6833         uint8_t queue_pfcenable_cfg_allowed;
6834         /*
6835          * Bitmask indicating which queues can be configured by the
6836          * hwrm_queue_pfcenable_cfg command. Each bit represents a
6837          * specific priority where bit 0 represents priority 0 and bit 7
6838          * represents priority 7. # A value of 0 indicates that the
6839          * priority is not configurable by the hwrm_queue_pfcenable_cfg
6840          * command. # A value of 1 indicates that the priority is
6841          * configurable. # A hwrm_queue_pfcenable_cfg command shall
6842          * return error when trying to configure a priority that is not
6843          * configurable.
6844          */
6845         uint8_t queue_pri2cos_cfg_allowed;
6846         /*
6847          * Bitmask indicating which queues can be configured by the
6848          * hwrm_queue_pri2cos_cfg command. Each bit represents a
6849          * specific queue where bit 0 represents queue 0 and bit 7
6850          * represents queue 7. # A value of 0 indicates that the queue
6851          * is not configurable by the hwrm_queue_pri2cos_cfg command. #
6852          * A value of 1 indicates that the queue is configurable. # A
6853          * hwrm_queue_pri2cos_cfg command shall return error when trying
6854          * to configure a queue that is not configurable.
6855          */
6856         uint8_t queue_cos2bw_cfg_allowed;
6857         /*
6858          * Bitmask indicating which queues can be configured by the
6859          * hwrm_queue_pri2cos_cfg command. Each bit represents a
6860          * specific queue where bit 0 represents queue 0 and bit 7
6861          * represents queue 7. # A value of 0 indicates that the queue
6862          * is not configurable by the hwrm_queue_pri2cos_cfg command. #
6863          * A value of 1 indicates that the queue is configurable. # A
6864          * hwrm_queue_pri2cos_cfg command shall return error when trying
6865          * to configure a queue not configurable.
6866          */
6867         uint8_t queue_id0;
6868         /*
6869          * ID of CoS Queue 0. FF - Invalid id # This ID can be used on
6870          * any subsequent call to an hwrm command that takes a queue id.
6871          * # IDs must always be queried by this command before any use
6872          * by the driver or software. # Any driver or software should
6873          * not make any assumptions about queue IDs. # A value of 0xff
6874          * indicates that the queue is not available. # Available queues
6875          * may not be in sequential order.
6876          */
6877         uint8_t queue_id0_service_profile;
6878         /* This value is applicable to CoS queues only. */
6879         /* Lossy        (best-effort) */
6880         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY \
6881                 UINT32_C(0x0)
6882         /* Lossless */
6883         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS \
6884                 UINT32_C(0x1)
6885         /*
6886          * Set to 0xFF...       (All Fs) if there is no
6887          * service profile specified
6888          */
6889         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_UNKNOWN \
6890                 UINT32_C(0xff)
6891         uint8_t queue_id1;
6892         /*
6893          * ID of CoS Queue 1. FF - Invalid id # This ID can be used on
6894          * any subsequent call to an hwrm command that takes a queue id.
6895          * # IDs must always be queried by this command before any use
6896          * by the driver or software. # Any driver or software should
6897          * not make any assumptions about queue IDs. # A value of 0xff
6898          * indicates that the queue is not available. # Available queues
6899          * may not be in sequential order.
6900          */
6901         uint8_t queue_id1_service_profile;
6902         /* This value is applicable to CoS queues only. */
6903         /* Lossy        (best-effort) */
6904         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSY \
6905                 UINT32_C(0x0)
6906         /* Lossless */
6907         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSLESS \
6908                 UINT32_C(0x1)
6909         /*
6910          * Set to 0xFF...       (All Fs) if there is no
6911          * service profile specified
6912          */
6913         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_UNKNOWN \
6914                 UINT32_C(0xff)
6915         uint8_t queue_id2;
6916         /*
6917          * ID of CoS Queue 2. FF - Invalid id # This ID can be used on
6918          * any subsequent call to an hwrm command that takes a queue id.
6919          * # IDs must always be queried by this command before any use
6920          * by the driver or software. # Any driver or software should
6921          * not make any assumptions about queue IDs. # A value of 0xff
6922          * indicates that the queue is not available. # Available queues
6923          * may not be in sequential order.
6924          */
6925         uint8_t queue_id2_service_profile;
6926         /* This value is applicable to CoS queues only. */
6927         /* Lossy        (best-effort) */
6928         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSY \
6929                 UINT32_C(0x0)
6930         /* Lossless */
6931         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSLESS \
6932                 UINT32_C(0x1)
6933         /*
6934          * Set to 0xFF...       (All Fs) if there is no
6935          * service profile specified
6936          */
6937         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_UNKNOWN \
6938                 UINT32_C(0xff)
6939         uint8_t queue_id3;
6940         /*
6941          * ID of CoS Queue 3. FF - Invalid id # This ID can be used on
6942          * any subsequent call to an hwrm command that takes a queue id.
6943          * # IDs must always be queried by this command before any use
6944          * by the driver or software. # Any driver or software should
6945          * not make any assumptions about queue IDs. # A value of 0xff
6946          * indicates that the queue is not available. # Available queues
6947          * may not be in sequential order.
6948          */
6949         uint8_t queue_id3_service_profile;
6950         /* This value is applicable to CoS queues only. */
6951         /* Lossy        (best-effort) */
6952         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSY \
6953                 UINT32_C(0x0)
6954         /* Lossless */
6955         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSLESS \
6956                 UINT32_C(0x1)
6957         /*
6958          * Set to 0xFF...       (All Fs) if there is no
6959          * service profile specified
6960          */
6961         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_UNKNOWN \
6962                 UINT32_C(0xff)
6963         uint8_t queue_id4;
6964         /*
6965          * ID of CoS Queue 4. FF - Invalid id # This ID can be used on
6966          * any subsequent call to an hwrm command that takes a queue id.
6967          * # IDs must always be queried by this command before any use
6968          * by the driver or software. # Any driver or software should
6969          * not make any assumptions about queue IDs. # A value of 0xff
6970          * indicates that the queue is not available. # Available queues
6971          * may not be in sequential order.
6972          */
6973         uint8_t queue_id4_service_profile;
6974         /* This value is applicable to CoS queues only. */
6975         /* Lossy        (best-effort) */
6976         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSY \
6977                 UINT32_C(0x0)
6978         /* Lossless */
6979         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSLESS \
6980                 UINT32_C(0x1)
6981         /*
6982          * Set to 0xFF...       (All Fs) if there is no
6983          * service profile specified
6984          */
6985         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_UNKNOWN \
6986                 UINT32_C(0xff)
6987         uint8_t queue_id5;
6988         /*
6989          * ID of CoS Queue 5. FF - Invalid id # This ID can be used on
6990          * any subsequent call to an hwrm command that takes a queue id.
6991          * # IDs must always be queried by this command before any use
6992          * by the driver or software. # Any driver or software should
6993          * not make any assumptions about queue IDs. # A value of 0xff
6994          * indicates that the queue is not available. # Available queues
6995          * may not be in sequential order.
6996          */
6997         uint8_t queue_id5_service_profile;
6998         /* This value is applicable to CoS queues only. */
6999         /* Lossy        (best-effort) */
7000         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSY \
7001                 UINT32_C(0x0)
7002         /* Lossless */
7003         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSLESS \
7004                 UINT32_C(0x1)
7005         /*
7006          * Set to 0xFF...       (All Fs) if there is no
7007          * service profile specified
7008          */
7009         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_UNKNOWN \
7010                 UINT32_C(0xff)
7011         uint8_t queue_id6;
7012         /*
7013          * ID of CoS Queue 6. FF - Invalid id # This ID can be used on
7014          * any subsequent call to an hwrm command that takes a queue id.
7015          * # IDs must always be queried by this command before any use
7016          * by the driver or software. # Any driver or software should
7017          * not make any assumptions about queue IDs. # A value of 0xff
7018          * indicates that the queue is not available. # Available queues
7019          * may not be in sequential order.
7020          */
7021         uint8_t queue_id6_service_profile;
7022         /* This value is applicable to CoS queues only. */
7023         /* Lossy        (best-effort) */
7024         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSY \
7025                 UINT32_C(0x0)
7026         /* Lossless */
7027         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSLESS \
7028                 UINT32_C(0x1)
7029         /*
7030          * Set to 0xFF...       (All Fs) if there is no
7031          * service profile specified
7032          */
7033         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_UNKNOWN \
7034                 UINT32_C(0xff)
7035         uint8_t queue_id7;
7036         /*
7037          * ID of CoS Queue 7. FF - Invalid id # This ID can be used on
7038          * any subsequent call to an hwrm command that takes a queue id.
7039          * # IDs must always be queried by this command before any use
7040          * by the driver or software. # Any driver or software should
7041          * not make any assumptions about queue IDs. # A value of 0xff
7042          * indicates that the queue is not available. # Available queues
7043          * may not be in sequential order.
7044          */
7045         uint8_t queue_id7_service_profile;
7046         /* This value is applicable to CoS queues only. */
7047         /* Lossy        (best-effort) */
7048         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSY \
7049                 UINT32_C(0x0)
7050         /* Lossless */
7051         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSLESS \
7052                 UINT32_C(0x1)
7053         /*
7054          * Set to 0xFF...       (All Fs) if there is no
7055          * service profile specified
7056          */
7057         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_UNKNOWN \
7058                 UINT32_C(0xff)
7059         uint8_t valid;
7060         /*
7061          * This field is used in Output records to indicate that the
7062          * output is completely written to RAM. This field should be
7063          * read as '1' to indicate that the output has been completely
7064          * written. When writing a command completion or response to an
7065          * internal processor, the order of writes has to be such that
7066          * this field is written last.
7067          */
7068 } __attribute__((packed));
7069
7070 /* hwrm_vnic_alloc */
7071 /*
7072  * Description: This VNIC is a resource in the RX side of the chip that is used
7073  * to represent a virtual host "interface". # At the time of VNIC allocation or
7074  * configuration, the function can specify whether it wants the requested VNIC
7075  * to be the default VNIC for the function or not. # If a function requests
7076  * allocation of a VNIC for the first time and a VNIC is successfully allocated
7077  * by the HWRM, then the HWRM shall make the allocated VNIC as the default VNIC
7078  * for that function. # The default VNIC shall be used for the default action
7079  * for a partition or function. # For each VNIC allocated on a function, a
7080  * mapping on the RX side to map the allocated VNIC to source virtual interface
7081  * shall be performed by the HWRM. This should be hidden to the function driver
7082  * requesting the VNIC allocation. This enables broadcast/multicast replication
7083  * with source knockout. # If multicast replication with source knockout is
7084  * enabled, then the internal VNIC to SVIF mapping data structures shall be
7085  * programmed at the time of VNIC allocation.
7086  */
7087 /* Input        (24 bytes) */
7088 struct hwrm_vnic_alloc_input {
7089         uint16_t req_type;
7090         /*
7091          * This value indicates what type of request this is. The format
7092          * for the rest of the command is determined by this field.
7093          */
7094         uint16_t cmpl_ring;
7095         /*
7096          * This value indicates the what completion ring the request
7097          * will be optionally completed on. If the value is -1, then no
7098          * CR completion will be generated. Any other value must be a
7099          * valid CR ring_id value for this function.
7100          */
7101         uint16_t seq_id;
7102         /* This value indicates the command sequence number. */
7103         uint16_t target_id;
7104         /*
7105          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7106          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7107          * - HWRM
7108          */
7109         uint64_t resp_addr;
7110         /*
7111          * This is the host address where the response will be written
7112          * when the request is complete. This area must be 16B aligned
7113          * and must be cleared to zero before the request is made.
7114          */
7115         uint32_t flags;
7116         /*
7117          * When this bit is '1', this VNIC is requested to be the
7118          * default VNIC for this function.
7119          */
7120         #define HWRM_VNIC_ALLOC_INPUT_FLAGS_DEFAULT     UINT32_C(0x1)
7121         uint32_t unused_0;
7122 } __attribute__((packed));
7123
7124 /* Output       (16 bytes) */
7125 struct hwrm_vnic_alloc_output {
7126         uint16_t error_code;
7127         /*
7128          * Pass/Fail or error type Note: receiver to verify the in
7129          * parameters, and fail the call with an error when appropriate
7130          */
7131         uint16_t req_type;
7132         /* This field returns the type of original request. */
7133         uint16_t seq_id;
7134         /* This field provides original sequence number of the command. */
7135         uint16_t resp_len;
7136         /*
7137          * This field is the length of the response in bytes. The last
7138          * byte of the response is a valid flag that will read as '1'
7139          * when the command has been completely written to memory.
7140          */
7141         uint32_t vnic_id;
7142         /* Logical vnic ID */
7143         uint8_t unused_0;
7144         uint8_t unused_1;
7145         uint8_t unused_2;
7146         uint8_t valid;
7147         /*
7148          * This field is used in Output records to indicate that the
7149          * output is completely written to RAM. This field should be
7150          * read as '1' to indicate that the output has been completely
7151          * written. When writing a command completion or response to an
7152          * internal processor, the order of writes has to be such that
7153          * this field is written last.
7154          */
7155 } __attribute__((packed));
7156
7157 /* hwrm_vnic_free */
7158 /*
7159  * Description: Free a VNIC resource. Idle any resources associated with the
7160  * VNIC as well as the VNIC. Reset and release all resources associated with the
7161  * VNIC.
7162  */
7163 /* Input        (24 bytes) */
7164 struct hwrm_vnic_free_input {
7165         uint16_t req_type;
7166         /*
7167          * This value indicates what type of request this is. The format
7168          * for the rest of the command is determined by this field.
7169          */
7170         uint16_t cmpl_ring;
7171         /*
7172          * This value indicates the what completion ring the request
7173          * will be optionally completed on. If the value is -1, then no
7174          * CR completion will be generated. Any other value must be a
7175          * valid CR ring_id value for this function.
7176          */
7177         uint16_t seq_id;
7178         /* This value indicates the command sequence number. */
7179         uint16_t target_id;
7180         /*
7181          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7182          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7183          * - HWRM
7184          */
7185         uint64_t resp_addr;
7186         /*
7187          * This is the host address where the response will be written
7188          * when the request is complete. This area must be 16B aligned
7189          * and must be cleared to zero before the request is made.
7190          */
7191         uint32_t vnic_id;
7192         /* Logical vnic ID */
7193         uint32_t unused_0;
7194 } __attribute__((packed));
7195
7196 /* Output       (16 bytes) */
7197 struct hwrm_vnic_free_output {
7198         uint16_t error_code;
7199         /*
7200          * Pass/Fail or error type Note: receiver to verify the in
7201          * parameters, and fail the call with an error when appropriate
7202          */
7203         uint16_t req_type;
7204         /* This field returns the type of original request. */
7205         uint16_t seq_id;
7206         /* This field provides original sequence number of the command. */
7207         uint16_t resp_len;
7208         /*
7209          * This field is the length of the response in bytes. The last
7210          * byte of the response is a valid flag that will read as '1'
7211          * when the command has been completely written to memory.
7212          */
7213         uint32_t unused_0;
7214         uint8_t unused_1;
7215         uint8_t unused_2;
7216         uint8_t unused_3;
7217         uint8_t valid;
7218         /*
7219          * This field is used in Output records to indicate that the
7220          * output is completely written to RAM. This field should be
7221          * read as '1' to indicate that the output has been completely
7222          * written. When writing a command completion or response to an
7223          * internal processor, the order of writes has to be such that
7224          * this field is written last.
7225          */
7226 } __attribute__((packed));
7227
7228 /* hwrm_vnic_cfg */
7229 /* Description: Configure the RX VNIC structure. */
7230 /* Input        (40 bytes) */
7231 struct hwrm_vnic_cfg_input {
7232         uint16_t req_type;
7233         /*
7234          * This value indicates what type of request this is. The format
7235          * for the rest of the command is determined by this field.
7236          */
7237         uint16_t cmpl_ring;
7238         /*
7239          * This value indicates the what completion ring the request
7240          * will be optionally completed on. If the value is -1, then no
7241          * CR completion will be generated. Any other value must be a
7242          * valid CR ring_id value for this function.
7243          */
7244         uint16_t seq_id;
7245         /* This value indicates the command sequence number. */
7246         uint16_t target_id;
7247         /*
7248          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7249          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7250          * - HWRM
7251          */
7252         uint64_t resp_addr;
7253         /*
7254          * This is the host address where the response will be written
7255          * when the request is complete. This area must be 16B aligned
7256          * and must be cleared to zero before the request is made.
7257          */
7258         uint32_t flags;
7259         /*
7260          * When this bit is '1', the VNIC is requested to be the default
7261          * VNIC for the function.
7262          */
7263         #define HWRM_VNIC_CFG_INPUT_FLAGS_DEFAULT       UINT32_C(0x1)
7264         /*
7265          * When this bit is '1', the VNIC is being configured to strip
7266          * VLAN in the RX path. If set to '0', then VLAN stripping is
7267          * disabled on this VNIC.
7268          */
7269         #define HWRM_VNIC_CFG_INPUT_FLAGS_VLAN_STRIP_MODE       UINT32_C(0x2)
7270         /*
7271          * When this bit is '1', the VNIC is being configured to buffer
7272          * receive packets in the hardware until the host posts new
7273          * receive buffers. If set to '0', then bd_stall is being
7274          * configured to be disabled on this VNIC.
7275          */
7276         #define HWRM_VNIC_CFG_INPUT_FLAGS_BD_STALL_MODE UINT32_C(0x4)
7277         /*
7278          * When this bit is '1', the VNIC is being configured to receive
7279          * both RoCE and non-RoCE traffic. If set to '0', then this VNIC
7280          * is not configured to be operating in dual VNIC mode.
7281          */
7282         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_DUAL_VNIC_MODE   UINT32_C(0x8)
7283         /*
7284          * When this flag is set to '1', the VNIC is requested to be
7285          * configured to receive only RoCE traffic. If this flag is set
7286          * to '0', then this flag shall be ignored by the HWRM. If
7287          * roce_dual_vnic_mode flag is set to '1', then the HWRM client
7288          * shall not set this flag to '1'.
7289          */
7290         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_ONLY_VNIC_MODE UINT32_C(0x10)
7291         /*
7292          * When a VNIC uses one destination ring group for certain
7293          * application  (e.g. Receive Flow Steering) where exact match is
7294          * used to direct packets to a VNIC with one destination ring
7295          * group only, there is no need to configure RSS indirection
7296          * table for that VNIC as only one destination ring group is
7297          * used. This flag is used to enable a mode where RSS is enabled
7298          * in the VNIC using a RSS context for computing RSS hash but
7299          * the RSS indirection table is not configured using
7300          * hwrm_vnic_rss_cfg. If this mode is enabled, then the driver
7301          * should not program RSS indirection table for the RSS context
7302          * that is used for computing RSS hash only.
7303          */
7304         #define HWRM_VNIC_CFG_INPUT_FLAGS_RSS_DFLT_CR_MODE      UINT32_C(0x20)
7305         uint32_t enables;
7306         /*
7307          * This bit must be '1' for the dflt_ring_grp field to be
7308          * configured.
7309          */
7310         #define HWRM_VNIC_CFG_INPUT_ENABLES_DFLT_RING_GRP       UINT32_C(0x1)
7311         /* This bit must be '1' for the rss_rule field to be configured. */
7312         #define HWRM_VNIC_CFG_INPUT_ENABLES_RSS_RULE    UINT32_C(0x2)
7313         /* This bit must be '1' for the cos_rule field to be configured. */
7314         #define HWRM_VNIC_CFG_INPUT_ENABLES_COS_RULE    UINT32_C(0x4)
7315         /* This bit must be '1' for the lb_rule field to be configured. */
7316         #define HWRM_VNIC_CFG_INPUT_ENABLES_LB_RULE     UINT32_C(0x8)
7317         /* This bit must be '1' for the mru field to be configured. */
7318         #define HWRM_VNIC_CFG_INPUT_ENABLES_MRU UINT32_C(0x10)
7319         uint16_t vnic_id;
7320         /* Logical vnic ID */
7321         uint16_t dflt_ring_grp;
7322         /*
7323          * Default Completion ring for the VNIC. This ring will be
7324          * chosen if packet does not match any RSS rules and if there is
7325          * no COS rule.
7326          */
7327         uint16_t rss_rule;
7328         /*
7329          * RSS ID for RSS rule/table structure. 0xFF... (All Fs) if
7330          * there is no RSS rule.
7331          */
7332         uint16_t cos_rule;
7333         /*
7334          * RSS ID for COS rule/table structure. 0xFF... (All Fs) if
7335          * there is no COS rule.
7336          */
7337         uint16_t lb_rule;
7338         /*
7339          * RSS ID for load balancing rule/table structure. 0xFF...      (All
7340          * Fs) if there is no LB rule.
7341          */
7342         uint16_t mru;
7343         /*
7344          * The maximum receive unit of the vnic. Each vnic is associated
7345          * with a function. The vnic mru value overwrites the mru
7346          * setting of the associated function. The HWRM shall make sure
7347          * that vnic mru does not exceed the mru of the port the
7348          * function is associated with.
7349          */
7350         uint32_t unused_0;
7351 } __attribute__((packed));
7352
7353 /* Output       (16 bytes) */
7354 struct hwrm_vnic_cfg_output {
7355         uint16_t error_code;
7356         /*
7357          * Pass/Fail or error type Note: receiver to verify the in
7358          * parameters, and fail the call with an error when appropriate
7359          */
7360         uint16_t req_type;
7361         /* This field returns the type of original request. */
7362         uint16_t seq_id;
7363         /* This field provides original sequence number of the command. */
7364         uint16_t resp_len;
7365         /*
7366          * This field is the length of the response in bytes. The last
7367          * byte of the response is a valid flag that will read as '1'
7368          * when the command has been completely written to memory.
7369          */
7370         uint32_t unused_0;
7371         uint8_t unused_1;
7372         uint8_t unused_2;
7373         uint8_t unused_3;
7374         uint8_t valid;
7375         /*
7376          * This field is used in Output records to indicate that the
7377          * output is completely written to RAM. This field should be
7378          * read as '1' to indicate that the output has been completely
7379          * written. When writing a command completion or response to an
7380          * internal processor, the order of writes has to be such that
7381          * this field is written last.
7382          */
7383 } __attribute__((packed));
7384
7385 /* hwrm_vnic_qcfg */
7386 /*
7387  * Description: Query the RX VNIC structure. This function can be used by a PF
7388  * driver to query its own VNIC resource or VNIC resource of its child VF. This
7389  * function can also be used by a VF driver to query its own VNIC resource.
7390  */
7391 /* Input        (32 bytes) */
7392 struct hwrm_vnic_qcfg_input {
7393         uint16_t req_type;
7394         /*
7395          * This value indicates what type of request this is. The format
7396          * for the rest of the command is determined by this field.
7397          */
7398         uint16_t cmpl_ring;
7399         /*
7400          * This value indicates the what completion ring the request
7401          * will be optionally completed on. If the value is -1, then no
7402          * CR completion will be generated. Any other value must be a
7403          * valid CR ring_id value for this function.
7404          */
7405         uint16_t seq_id;
7406         /* This value indicates the command sequence number. */
7407         uint16_t target_id;
7408         /*
7409          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7410          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7411          * - HWRM
7412          */
7413         uint64_t resp_addr;
7414         /*
7415          * This is the host address where the response will be written
7416          * when the request is complete. This area must be 16B aligned
7417          * and must be cleared to zero before the request is made.
7418          */
7419         uint32_t enables;
7420         /* This bit must be '1' for the vf_id_valid field to be configured. */
7421         #define HWRM_VNIC_QCFG_INPUT_ENABLES_VF_ID_VALID        UINT32_C(0x1)
7422         uint32_t vnic_id;
7423         /* Logical vnic ID */
7424         uint16_t vf_id;
7425         /* ID of Virtual Function whose VNIC resource is being queried. */
7426         uint16_t unused_0[3];
7427 } __attribute__((packed));
7428
7429 /* Output       (32 bytes) */
7430 struct hwrm_vnic_qcfg_output {
7431         uint16_t error_code;
7432         /*
7433          * Pass/Fail or error type Note: receiver to verify the in
7434          * parameters, and fail the call with an error when appropriate
7435          */
7436         uint16_t req_type;
7437         /* This field returns the type of original request. */
7438         uint16_t seq_id;
7439         /* This field provides original sequence number of the command. */
7440         uint16_t resp_len;
7441         /*
7442          * This field is the length of the response in bytes. The last
7443          * byte of the response is a valid flag that will read as '1'
7444          * when the command has been completely written to memory.
7445          */
7446         uint16_t dflt_ring_grp;
7447         /* Default Completion ring for the VNIC. */
7448         uint16_t rss_rule;
7449         /*
7450          * RSS ID for RSS rule/table structure. 0xFF... (All Fs) if
7451          * there is no RSS rule.
7452          */
7453         uint16_t cos_rule;
7454         /*
7455          * RSS ID for COS rule/table structure. 0xFF... (All Fs) if
7456          * there is no COS rule.
7457          */
7458         uint16_t lb_rule;
7459         /*
7460          * RSS ID for load balancing rule/table structure. 0xFF...      (All
7461          * Fs) if there is no LB rule.
7462          */
7463         uint16_t mru;
7464         /* The maximum receive unit of the vnic. */
7465         uint8_t unused_0;
7466         uint8_t unused_1;
7467         uint32_t flags;
7468         /*
7469          * When this bit is '1', the VNIC is the default VNIC for the
7470          * function.
7471          */
7472         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_DEFAULT     UINT32_C(0x1)
7473         /*
7474          * When this bit is '1', the VNIC is configured to strip VLAN in
7475          * the RX path. If set to '0', then VLAN stripping is disabled
7476          * on this VNIC.
7477          */
7478         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_VLAN_STRIP_MODE     UINT32_C(0x2)
7479         /*
7480          * When this bit is '1', the VNIC is configured to buffer
7481          * receive packets in the hardware until the host posts new
7482          * receive buffers. If set to '0', then bd_stall is disabled on
7483          * this VNIC.
7484          */
7485         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_BD_STALL_MODE       UINT32_C(0x4)
7486         /*
7487          * When this bit is '1', the VNIC is configured to receive both
7488          * RoCE and non-RoCE traffic. If set to '0', then this VNIC is
7489          * not configured to operate in dual VNIC mode.
7490          */
7491         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_ROCE_DUAL_VNIC_MODE UINT32_C(0x8)
7492         /*
7493          * When this flag is set to '1', the VNIC is configured to
7494          * receive only RoCE traffic. When this flag is set to '0', the
7495          * VNIC is not configured to receive only RoCE traffic. If
7496          * roce_dual_vnic_mode flag and this flag both are set to '1',
7497          * then it is an invalid configuration of the VNIC. The HWRM
7498          * should not allow that type of mis-configuration by HWRM
7499          * clients.
7500          */
7501         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_ROCE_ONLY_VNIC_MODE UINT32_C(0x10)
7502         /*
7503          * When a VNIC uses one destination ring group for certain
7504          * application  (e.g. Receive Flow Steering) where exact match is
7505          * used to direct packets to a VNIC with one destination ring
7506          * group only, there is no need to configure RSS indirection
7507          * table for that VNIC as only one destination ring group is
7508          * used. When this bit is set to '1', then the VNIC is enabled
7509          * in a mode where RSS is enabled in the VNIC using a RSS
7510          * context for computing RSS hash but the RSS indirection table
7511          * is not configured.
7512          */
7513         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_RSS_DFLT_CR_MODE    UINT32_C(0x20)
7514         uint32_t unused_2;
7515         uint8_t unused_3;
7516         uint8_t unused_4;
7517         uint8_t unused_5;
7518         uint8_t valid;
7519         /*
7520          * This field is used in Output records to indicate that the
7521          * output is completely written to RAM. This field should be
7522          * read as '1' to indicate that the output has been completely
7523          * written. When writing a command completion or response to an
7524          * internal processor, the order of writes has to be such that
7525          * this field is written last.
7526          */
7527 } __attribute__((packed));
7528
7529 /* hwrm_vnic_rss_cfg */
7530 /* Description: This function is used to enable RSS configuration. */
7531 /* Input        (48 bytes) */
7532 struct hwrm_vnic_rss_cfg_input {
7533         uint16_t req_type;
7534         /*
7535          * This value indicates what type of request this is. The format
7536          * for the rest of the command is determined by this field.
7537          */
7538         uint16_t cmpl_ring;
7539         /*
7540          * This value indicates the what completion ring the request
7541          * will be optionally completed on. If the value is -1, then no
7542          * CR completion will be generated. Any other value must be a
7543          * valid CR ring_id value for this function.
7544          */
7545         uint16_t seq_id;
7546         /* This value indicates the command sequence number. */
7547         uint16_t target_id;
7548         /*
7549          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7550          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7551          * - HWRM
7552          */
7553         uint64_t resp_addr;
7554         /*
7555          * This is the host address where the response will be written
7556          * when the request is complete. This area must be 16B aligned
7557          * and must be cleared to zero before the request is made.
7558          */
7559         uint32_t hash_type;
7560         /*
7561          * When this bit is '1', the RSS hash shall be computed over
7562          * source and destination IPv4 addresses of IPv4 packets.
7563          */
7564         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4  UINT32_C(0x1)
7565         /*
7566          * When this bit is '1', the RSS hash shall be computed over
7567          * source/destination IPv4 addresses and source/destination
7568          * ports of TCP/IPv4 packets.
7569          */
7570         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV4      UINT32_C(0x2)
7571         /*
7572          * When this bit is '1', the RSS hash shall be computed over
7573          * source/destination IPv4 addresses and source/destination
7574          * ports of UDP/IPv4 packets.
7575          */
7576         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV4      UINT32_C(0x4)
7577         /*
7578          * When this bit is '1', the RSS hash shall be computed over
7579          * source and destination IPv4 addresses of IPv6 packets.
7580          */
7581         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV6  UINT32_C(0x8)
7582         /*
7583          * When this bit is '1', the RSS hash shall be computed over
7584          * source/destination IPv6 addresses and source/destination
7585          * ports of TCP/IPv6 packets.
7586          */
7587         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV6      UINT32_C(0x10)
7588         /*
7589          * When this bit is '1', the RSS hash shall be computed over
7590          * source/destination IPv6 addresses and source/destination
7591          * ports of UDP/IPv6 packets.
7592          */
7593         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV6      UINT32_C(0x20)
7594         uint32_t unused_0;
7595         uint64_t ring_grp_tbl_addr;
7596         /* This is the address for rss ring group table */
7597         uint64_t hash_key_tbl_addr;
7598         /* This is the address for rss hash key table */
7599         uint16_t rss_ctx_idx;
7600         /* Index to the rss indirection table. */
7601         uint16_t unused_1[3];
7602 } __attribute__((packed));
7603
7604 /* Output       (16 bytes) */
7605 struct hwrm_vnic_rss_cfg_output {
7606         uint16_t error_code;
7607         /*
7608          * Pass/Fail or error type Note: receiver to verify the in
7609          * parameters, and fail the call with an error when appropriate
7610          */
7611         uint16_t req_type;
7612         /* This field returns the type of original request. */
7613         uint16_t seq_id;
7614         /* This field provides original sequence number of the command. */
7615         uint16_t resp_len;
7616         /*
7617          * This field is the length of the response in bytes. The last
7618          * byte of the response is a valid flag that will read as '1'
7619          * when the command has been completely written to memory.
7620          */
7621         uint32_t unused_0;
7622         uint8_t unused_1;
7623         uint8_t unused_2;
7624         uint8_t unused_3;
7625         uint8_t valid;
7626         /*
7627          * This field is used in Output records to indicate that the
7628          * output is completely written to RAM. This field should be
7629          * read as '1' to indicate that the output has been completely
7630          * written. When writing a command completion or response to an
7631          * internal processor, the order of writes has to be such that
7632          * this field is written last.
7633          */
7634 } __attribute__((packed));
7635
7636 /* hwrm_vnic_plcmodes_cfg */
7637 /*
7638  * Description: This function can be used to set placement mode configuration of
7639  * the VNIC.
7640  */
7641 /* Input (40 bytes) */
7642
7643 struct hwrm_vnic_plcmodes_cfg_input {
7644         uint16_t req_type;
7645         /*
7646          * This value indicates what type of request this is. The format for the
7647          * rest of the command is determined by this field.
7648          */
7649         uint16_t cmpl_ring;
7650         /*
7651          * This value indicates the what completion ring the request will be
7652          * optionally completed on. If the value is -1, then no CR completion
7653          * will be generated. Any other value must be a valid CR ring_id value
7654          * for this function.
7655          */
7656         uint16_t seq_id;
7657         /* This value indicates the command sequence number. */
7658         uint16_t target_id;
7659         /*
7660          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
7661          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
7662          */
7663         uint64_t resp_addr;
7664         /*
7665          * This is the host address where the response will be written when the
7666          * request is complete. This area must be 16B aligned and must be
7667          * cleared to zero before the request is made.
7668          */
7669         uint32_t flags;
7670         /*
7671          * When this bit is '1', the VNIC shall be configured to use regular
7672          * placement algorithm. By default, the regular placement algorithm
7673          * shall be enabled on the VNIC.
7674          */
7675         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_REGULAR_PLACEMENT \
7676                 UINT32_C(0x1)
7677         /*
7678          * When this bit is '1', the VNIC shall be configured use the jumbo
7679          * placement algorithm.
7680          */
7681         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_JUMBO_PLACEMENT \
7682                 UINT32_C(0x2)
7683         /*
7684          * When this bit is '1', the VNIC shall be configured to enable Header-
7685          * Data split for IPv4 packets according to the following rules: # If
7686          * the packet is identified as TCP/IPv4, then the packet is split at the
7687          * beginning of the TCP payload. # If the packet is identified as
7688          * UDP/IPv4, then the packet is split at the beginning of UDP payload. #
7689          * If the packet is identified as non-TCP and non-UDP IPv4 packet, then
7690          * the packet is split at the beginning of the upper layer protocol
7691          * header carried in the IPv4 packet.
7692          */
7693         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV4        UINT32_C(0x4)
7694         /*
7695          * When this bit is '1', the VNIC shall be configured to enable Header-
7696          * Data split for IPv6 packets according to the following rules: # If
7697          * the packet is identified as TCP/IPv6, then the packet is split at the
7698          * beginning of the TCP payload. # If the packet is identified as
7699          * UDP/IPv6, then the packet is split at the beginning of UDP payload. #
7700          * If the packet is identified as non-TCP and non-UDP IPv6 packet, then
7701          * the packet is split at the beginning of the upper layer protocol
7702          * header carried in the IPv6 packet.
7703          */
7704         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV6        UINT32_C(0x8)
7705         /*
7706          * When this bit is '1', the VNIC shall be configured to enable Header-
7707          * Data split for FCoE packets at the beginning of FC payload.
7708          */
7709         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_FCOE       UINT32_C(0x10)
7710         /*
7711          * When this bit is '1', the VNIC shall be configured to enable Header-
7712          * Data split for RoCE packets at the beginning of RoCE payload (after
7713          * BTH/GRH headers).
7714          */
7715         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_ROCE       UINT32_C(0x20)
7716         uint32_t enables;
7717         /*
7718          * This bit must be '1' for the jumbo_thresh_valid field to be
7719          * configured.
7720          */
7721         #define HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_JUMBO_THRESH_VALID \
7722                 UINT32_C(0x1)
7723         /*
7724          * This bit must be '1' for the hds_offset_valid field to be configured.
7725          */
7726         #define HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_HDS_OFFSET_VALID \
7727                 UINT32_C(0x2)
7728         /*
7729          * This bit must be '1' for the hds_threshold_valid field to be
7730          * configured.
7731          */
7732         #define HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_HDS_THRESHOLD_VALID \
7733                 UINT32_C(0x4)
7734         uint32_t vnic_id;
7735         /* Logical vnic ID */
7736         uint16_t jumbo_thresh;
7737         /*
7738          * When jumbo placement algorithm is enabled, this value is used to
7739          * determine the threshold for jumbo placement. Packets with length
7740          * larger than this value will be placed according to the jumbo
7741          * placement algorithm.
7742          */
7743         uint16_t hds_offset;
7744         /*
7745          * This value is used to determine the offset into packet buffer where
7746          * the split data (payload) will be placed according to one of of HDS
7747          * placement algorithm. The lengths of packet buffers provided for split
7748          * data shall be larger than this value.
7749          */
7750         uint16_t hds_threshold;
7751         /*
7752          * When one of the HDS placement algorithm is enabled, this value is
7753          * used to determine the threshold for HDS placement. Packets with
7754          * length larger than this value will be placed according to the HDS
7755          * placement algorithm. This value shall be in multiple of 4 bytes.
7756          */
7757         uint16_t unused_0[3];
7758 } __attribute__((packed));
7759
7760 /* Output (16 bytes) */
7761
7762 struct hwrm_vnic_plcmodes_cfg_output {
7763         uint16_t error_code;
7764         /*
7765          * Pass/Fail or error type Note: receiver to verify the in parameters,
7766          * and fail the call with an error when appropriate
7767          */
7768         uint16_t req_type;
7769         /* This field returns the type of original request. */
7770         uint16_t seq_id;
7771         /* This field provides original sequence number of the command. */
7772         uint16_t resp_len;
7773         /*
7774          * This field is the length of the response in bytes. The last byte of
7775          * the response is a valid flag that will read as '1' when the command
7776          * has been completely written to memory.
7777          */
7778         uint32_t unused_0;
7779         uint8_t unused_1;
7780         uint8_t unused_2;
7781         uint8_t unused_3;
7782         uint8_t valid;
7783         /*
7784          * This field is used in Output records to indicate that the output is
7785          * completely written to RAM. This field should be read as '1' to
7786          * indicate that the output has been completely written. When writing a
7787          * command completion or response to an internal processor, the order of
7788          * writes has to be such that this field is written last.
7789          */
7790 } __attribute__((packed));
7791
7792 /* hwrm_vnic_plcmodes_qcfg */
7793 /*
7794  * Description: This function can be used to query placement mode configuration
7795  * of the VNIC.
7796  */
7797 /* Input (24 bytes) */
7798
7799 struct hwrm_vnic_plcmodes_qcfg_input {
7800         uint16_t req_type;
7801         /*
7802          * This value indicates what type of request this is. The format for the
7803          * rest of the command is determined by this field.
7804          */
7805         uint16_t cmpl_ring;
7806         /*
7807          * This value indicates the what completion ring the request will be
7808          * optionally completed on. If the value is -1, then no CR completion
7809          * will be generated. Any other value must be a valid CR ring_id value
7810          * for this function.
7811          */
7812         uint16_t seq_id;
7813         /* This value indicates the command sequence number. */
7814         uint16_t target_id;
7815         /*
7816          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
7817          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
7818          */
7819         uint64_t resp_addr;
7820         /*
7821          * This is the host address where the response will be written when the
7822          * request is complete. This area must be 16B aligned and must be
7823          * cleared to zero before the request is made.
7824          */
7825         uint32_t vnic_id;
7826         /* Logical vnic ID */
7827         uint32_t unused_0;
7828 } __attribute__((packed));
7829
7830 /* Output (24 bytes) */
7831
7832 struct hwrm_vnic_plcmodes_qcfg_output {
7833         uint16_t error_code;
7834         /*
7835          * Pass/Fail or error type Note: receiver to verify the in parameters,
7836          * and fail the call with an error when appropriate
7837          */
7838         uint16_t req_type;
7839         /* This field returns the type of original request. */
7840         uint16_t seq_id;
7841         /* This field provides original sequence number of the command. */
7842         uint16_t resp_len;
7843         /*
7844          * This field is the length of the response in bytes. The last byte of
7845          * the response is a valid flag that will read as '1' when the command
7846          * has been completely written to memory.
7847          */
7848         uint32_t flags;
7849         /*
7850          * When this bit is '1', the VNIC is configured to use regular placement
7851          * algorithm.
7852          */
7853         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_REGULAR_PLACEMENT \
7854                 UINT32_C(0x1)
7855         /*
7856          * When this bit is '1', the VNIC is configured to use the jumbo
7857          * placement algorithm.
7858          */
7859         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_JUMBO_PLACEMENT \
7860                 UINT32_C(0x2)
7861         /*
7862          * When this bit is '1', the VNIC is configured to enable Header-Data
7863          * split for IPv4 packets.
7864          */
7865         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_IPV4      UINT32_C(0x4)
7866         /*
7867          * When this bit is '1', the VNIC is configured to enable Header-Data
7868          * split for IPv6 packets.
7869          */
7870         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_IPV6      UINT32_C(0x8)
7871         /*
7872          * When this bit is '1', the VNIC is configured to enable Header-Data
7873          * split for FCoE packets.
7874          */
7875         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_FCOE     UINT32_C(0x10)
7876         /*
7877          * When this bit is '1', the VNIC is configured to enable Header-Data
7878          * split for RoCE packets.
7879          */
7880         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_ROCE     UINT32_C(0x20)
7881         /*
7882          * When this bit is '1', the VNIC is configured to be the default VNIC
7883          * of the requesting function.
7884          */
7885         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_DFLT_VNIC    UINT32_C(0x40)
7886         uint16_t jumbo_thresh;
7887         /*
7888          * When jumbo placement algorithm is enabled, this value is used to
7889          * determine the threshold for jumbo placement. Packets with length
7890          * larger than this value will be placed according to the jumbo
7891          * placement algorithm.
7892          */
7893         uint16_t hds_offset;
7894         /*
7895          * This value is used to determine the offset into packet buffer where
7896          * the split data (payload) will be placed according to one of of HDS
7897          * placement algorithm. The lengths of packet buffers provided for split
7898          * data shall be larger than this value.
7899          */
7900         uint16_t hds_threshold;
7901         /*
7902          * When one of the HDS placement algorithm is enabled, this value is
7903          * used to determine the threshold for HDS placement. Packets with
7904          * length larger than this value will be placed according to the HDS
7905          * placement algorithm. This value shall be in multiple of 4 bytes.
7906          */
7907         uint8_t unused_0;
7908         uint8_t unused_1;
7909         uint8_t unused_2;
7910         uint8_t unused_3;
7911         uint8_t unused_4;
7912         uint8_t valid;
7913         /*
7914          * This field is used in Output records to indicate that the output is
7915          * completely written to RAM. This field should be read as '1' to
7916          * indicate that the output has been completely written. When writing a
7917          * command completion or response to an internal processor, the order of
7918          * writes has to be such that this field is written last.
7919          */
7920 } __attribute__((packed));
7921
7922 /* hwrm_vnic_rss_cos_lb_ctx_alloc */
7923 /* Description: This function is used to allocate COS/Load Balance context. */
7924 /* Input        (16 bytes) */
7925 struct hwrm_vnic_rss_cos_lb_ctx_alloc_input {
7926         uint16_t req_type;
7927         /*
7928          * This value indicates what type of request this is. The format
7929          * for the rest of the command is determined by this field.
7930          */
7931         uint16_t cmpl_ring;
7932         /*
7933          * This value indicates the what completion ring the request
7934          * will be optionally completed on. If the value is -1, then no
7935          * CR completion will be generated. Any other value must be a
7936          * valid CR ring_id value for this function.
7937          */
7938         uint16_t seq_id;
7939         /* This value indicates the command sequence number. */
7940         uint16_t target_id;
7941         /*
7942          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7943          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7944          * - HWRM
7945          */
7946         uint64_t resp_addr;
7947         /*
7948          * This is the host address where the response will be written
7949          * when the request is complete. This area must be 16B aligned
7950          * and must be cleared to zero before the request is made.
7951          */
7952 } __attribute__((packed));
7953
7954 /* Output       (16 bytes) */
7955 struct hwrm_vnic_rss_cos_lb_ctx_alloc_output {
7956         uint16_t error_code;
7957         /*
7958          * Pass/Fail or error type Note: receiver to verify the in
7959          * parameters, and fail the call with an error when appropriate
7960          */
7961         uint16_t req_type;
7962         /* This field returns the type of original request. */
7963         uint16_t seq_id;
7964         /* This field provides original sequence number of the command. */
7965         uint16_t resp_len;
7966         /*
7967          * This field is the length of the response in bytes. The last
7968          * byte of the response is a valid flag that will read as '1'
7969          * when the command has been completely written to memory.
7970          */
7971         uint16_t rss_cos_lb_ctx_id;
7972         /* rss_cos_lb_ctx_id is 16 b */
7973         uint8_t unused_0;
7974         uint8_t unused_1;
7975         uint8_t unused_2;
7976         uint8_t unused_3;
7977         uint8_t unused_4;
7978         uint8_t valid;
7979         /*
7980          * This field is used in Output records to indicate that the
7981          * output is completely written to RAM. This field should be
7982          * read as '1' to indicate that the output has been completely
7983          * written. When writing a command completion or response to an
7984          * internal processor, the order of writes has to be such that
7985          * this field is written last.
7986          */
7987 } __attribute__((packed));
7988
7989 /* hwrm_vnic_rss_cos_lb_ctx_free */
7990 /* Description: This function can be used to free COS/Load Balance context. */
7991 /* Input        (24 bytes) */
7992 struct hwrm_vnic_rss_cos_lb_ctx_free_input {
7993         uint16_t req_type;
7994         /*
7995          * This value indicates what type of request this is. The format
7996          * for the rest of the command is determined by this field.
7997          */
7998         uint16_t cmpl_ring;
7999         /*
8000          * This value indicates the what completion ring the request
8001          * will be optionally completed on. If the value is -1, then no
8002          * CR completion will be generated. Any other value must be a
8003          * valid CR ring_id value for this function.
8004          */
8005         uint16_t seq_id;
8006         /* This value indicates the command sequence number. */
8007         uint16_t target_id;
8008         /*
8009          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8010          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8011          * - HWRM
8012          */
8013         uint64_t resp_addr;
8014         /*
8015          * This is the host address where the response will be written
8016          * when the request is complete. This area must be 16B aligned
8017          * and must be cleared to zero before the request is made.
8018          */
8019         uint16_t rss_cos_lb_ctx_id;
8020         /* rss_cos_lb_ctx_id is 16 b */
8021         uint16_t unused_0[3];
8022 } __attribute__((packed));
8023
8024 /* Output       (16 bytes) */
8025 struct hwrm_vnic_rss_cos_lb_ctx_free_output {
8026         uint16_t error_code;
8027         /*
8028          * Pass/Fail or error type Note: receiver to verify the in
8029          * parameters, and fail the call with an error when appropriate
8030          */
8031         uint16_t req_type;
8032         /* This field returns the type of original request. */
8033         uint16_t seq_id;
8034         /* This field provides original sequence number of the command. */
8035         uint16_t resp_len;
8036         /*
8037          * This field is the length of the response in bytes. The last
8038          * byte of the response is a valid flag that will read as '1'
8039          * when the command has been completely written to memory.
8040          */
8041         uint32_t unused_0;
8042         uint8_t unused_1;
8043         uint8_t unused_2;
8044         uint8_t unused_3;
8045         uint8_t valid;
8046         /*
8047          * This field is used in Output records to indicate that the
8048          * output is completely written to RAM. This field should be
8049          * read as '1' to indicate that the output has been completely
8050          * written. When writing a command completion or response to an
8051          * internal processor, the order of writes has to be such that
8052          * this field is written last.
8053          */
8054 } __attribute__((packed));
8055
8056 /* hwrm_vnic_tpa_cfg */
8057 /* Description: This function is used to enable/configure TPA on the VNIC. */
8058 /* Input        (40 bytes) */
8059 struct hwrm_vnic_tpa_cfg_input {
8060         uint16_t req_type;
8061         /*
8062          * This value indicates what type of request this is. The format
8063          * for the rest of the command is determined by this field.
8064          */
8065         uint16_t cmpl_ring;
8066         /*
8067          * This value indicates the what completion ring the request
8068          * will be optionally completed on. If the value is -1, then no
8069          * CR completion will be generated. Any other value must be a
8070          * valid CR ring_id value for this function.
8071          */
8072         uint16_t seq_id;
8073         /* This value indicates the command sequence number. */
8074         uint16_t target_id;
8075         /*
8076          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8077          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8078          * - HWRM
8079          */
8080         uint64_t resp_addr;
8081         /*
8082          * This is the host address where the response will be written
8083          * when the request is complete. This area must be 16B aligned
8084          * and must be cleared to zero before the request is made.
8085          */
8086         uint32_t flags;
8087         /*
8088          * When this bit is '1', the VNIC shall be configured to perform
8089          * transparent packet aggregation       (TPA) of non-tunneled TCP
8090          * packets.
8091          */
8092         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_TPA       UINT32_C(0x1)
8093         /*
8094          * When this bit is '1', the VNIC shall be configured to perform
8095          * transparent packet aggregation       (TPA) of tunneled TCP packets.
8096          */
8097         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_ENCAP_TPA UINT32_C(0x2)
8098         /*
8099          * When this bit is '1', the VNIC shall be configured to perform
8100          * transparent packet aggregation       (TPA) according to Windows
8101          * Receive Segment Coalescing   (RSC) rules.
8102          */
8103         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_RSC_WND_UPDATE    UINT32_C(0x4)
8104         /*
8105          * When this bit is '1', the VNIC shall be configured to perform
8106          * transparent packet aggregation       (TPA) according to Linux
8107          * Generic Receive Offload      (GRO) rules.
8108          */
8109         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO       UINT32_C(0x8)
8110         /*
8111          * When this bit is '1', the VNIC shall be configured to perform
8112          * transparent packet aggregation       (TPA) for TCP packets with IP
8113          * ECN set to non-zero.
8114          */
8115         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_AGG_WITH_ECN      UINT32_C(0x10)
8116         /*
8117          * When this bit is '1', the VNIC shall be configured to perform
8118          * transparent packet aggregation       (TPA) for GRE tunneled TCP
8119          * packets only if all packets have the same GRE sequence.
8120          */
8121         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_AGG_WITH_SAME_GRE_SEQ     \
8122                 UINT32_C(0x20)
8123         /*
8124          * When this bit is '1' and the GRO mode is enabled, the VNIC
8125          * shall be configured to perform transparent packet aggregation
8126          *      (TPA) for TCP/IPv4 packets with consecutively increasing
8127          * IPIDs. In other words, the last packet that is being
8128          * aggregated to an already existing aggregation context shall
8129          * have IPID 1 more than the IPID of the last packet that was
8130          * aggregated in that aggregation context.
8131          */
8132         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO_IPID_CHECK    UINT32_C(0x40)
8133         /*
8134          * When this bit is '1' and the GRO mode is enabled, the VNIC
8135          * shall be configured to perform transparent packet aggregation
8136          *      (TPA) for TCP packets with the same TTL (IPv4) or Hop limit
8137          *      (IPv6) value.
8138          */
8139         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO_TTL_CHECK     UINT32_C(0x80)
8140         uint32_t enables;
8141         /* This bit must be '1' for the max_agg_segs field to be configured. */
8142         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGG_SEGS    UINT32_C(0x1)
8143         /* This bit must be '1' for the max_aggs field to be configured. */
8144         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGGS        UINT32_C(0x2)
8145         /*
8146          * This bit must be '1' for the max_agg_timer field to be
8147          * configured.
8148          */
8149         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGG_TIMER   UINT32_C(0x4)
8150         /* This bit must be '1' for the min_agg_len field to be configured. */
8151         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MIN_AGG_LEN     UINT32_C(0x8)
8152         uint16_t vnic_id;
8153         /* Logical vnic ID */
8154         uint16_t max_agg_segs;
8155         /*
8156          * This is the maximum number of TCP segments that can be
8157          * aggregated   (unit is Log2). Max value is 31.
8158          */
8159         /* 1 segment */
8160         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_1  UINT32_C(0x0)
8161         /* 2 segments */
8162         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_2  UINT32_C(0x1)
8163         /* 4 segments */
8164         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_4  UINT32_C(0x2)
8165         /* 8 segments */
8166         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_8  UINT32_C(0x3)
8167         /* Any segment size larger than this is not valid */
8168         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_MAX        UINT32_C(0x1f)
8169         uint16_t max_aggs;
8170         /*
8171          * This is the maximum number of aggregations this VNIC is
8172          * allowed      (unit is Log2). Max value is 7
8173          */
8174         /* 1 aggregation */
8175         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_1      UINT32_C(0x0)
8176         /* 2 aggregations */
8177         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_2      UINT32_C(0x1)
8178         /* 4 aggregations */
8179         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_4      UINT32_C(0x2)
8180         /* 8 aggregations */
8181         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_8      UINT32_C(0x3)
8182         /* 16 aggregations */
8183         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_16     UINT32_C(0x4)
8184         /* Any aggregation size larger than this is not valid */
8185         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_MAX    UINT32_C(0x7)
8186         uint8_t unused_0;
8187         uint8_t unused_1;
8188         uint32_t max_agg_timer;
8189         /*
8190          * This is the maximum amount of time allowed for an aggregation
8191          * context to complete after it was initiated.
8192          */
8193         uint32_t min_agg_len;
8194         /*
8195          * This is the minimum amount of payload length required to
8196          * start an aggregation context.
8197          */
8198 } __attribute__((packed));
8199
8200 /* Output       (16 bytes) */
8201 struct hwrm_vnic_tpa_cfg_output {
8202         uint16_t error_code;
8203         /*
8204          * Pass/Fail or error type Note: receiver to verify the in
8205          * parameters, and fail the call with an error when appropriate
8206          */
8207         uint16_t req_type;
8208         /* This field returns the type of original request. */
8209         uint16_t seq_id;
8210         /* This field provides original sequence number of the command. */
8211         uint16_t resp_len;
8212         /*
8213          * This field is the length of the response in bytes. The last
8214          * byte of the response is a valid flag that will read as '1'
8215          * when the command has been completely written to memory.
8216          */
8217         uint32_t unused_0;
8218         uint8_t unused_1;
8219         uint8_t unused_2;
8220         uint8_t unused_3;
8221         uint8_t valid;
8222         /*
8223          * This field is used in Output records to indicate that the
8224          * output is completely written to RAM. This field should be
8225          * read as '1' to indicate that the output has been completely
8226          * written. When writing a command completion or response to an
8227          * internal processor, the order of writes has to be such that
8228          * this field is written last.
8229          */
8230 } __attribute__((packed));
8231
8232 /* hwrm_ring_alloc */
8233 /*
8234  * Description: This command allocates and does basic preparation for a ring.
8235  */
8236 /* Input        (80 bytes) */
8237 struct hwrm_ring_alloc_input {
8238         uint16_t req_type;
8239         /*
8240          * This value indicates what type of request this is. The format
8241          * for the rest of the command is determined by this field.
8242          */
8243         uint16_t cmpl_ring;
8244         /*
8245          * This value indicates the what completion ring the request
8246          * will be optionally completed on. If the value is -1, then no
8247          * CR completion will be generated. Any other value must be a
8248          * valid CR ring_id value for this function.
8249          */
8250         uint16_t seq_id;
8251         /* This value indicates the command sequence number. */
8252         uint16_t target_id;
8253         /*
8254          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8255          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8256          * - HWRM
8257          */
8258         uint64_t resp_addr;
8259         /*
8260          * This is the host address where the response will be written
8261          * when the request is complete. This area must be 16B aligned
8262          * and must be cleared to zero before the request is made.
8263          */
8264         uint32_t enables;
8265         /* This bit must be '1' for the Reserved1 field to be configured. */
8266         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED1 UINT32_C(0x1)
8267         /* This bit must be '1' for the ring_arb_cfg field to be configured. */
8268         #define HWRM_RING_ALLOC_INPUT_ENABLES_RING_ARB_CFG      UINT32_C(0x2)
8269         /* This bit must be '1' for the Reserved3 field to be configured. */
8270         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED3 UINT32_C(0x4)
8271         /*
8272          * This bit must be '1' for the stat_ctx_id_valid field to be
8273          * configured.
8274          */
8275         #define HWRM_RING_ALLOC_INPUT_ENABLES_STAT_CTX_ID_VALID UINT32_C(0x8)
8276         /* This bit must be '1' for the Reserved4 field to be configured. */
8277         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED4 UINT32_C(0x10)
8278         /* This bit must be '1' for the max_bw_valid field to be configured. */
8279         #define HWRM_RING_ALLOC_INPUT_ENABLES_MAX_BW_VALID      UINT32_C(0x20)
8280         uint8_t ring_type;
8281         /* Ring Type. */
8282         /* L2 Completion Ring   (CR) */
8283         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL UINT32_C(0x0)
8284         /* TX Ring      (TR) */
8285         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_TX      UINT32_C(0x1)
8286         /* RX Ring      (RR) */
8287         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_RX      UINT32_C(0x2)
8288         /* RoCE Notification Completion Ring    (ROCE_CR) */
8289         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_ROCE_CMPL       UINT32_C(0x3)
8290         uint8_t unused_0;
8291         uint16_t unused_1;
8292         uint64_t page_tbl_addr;
8293         /* This value is a pointer to the page table for the Ring. */
8294         uint32_t fbo;
8295         /* First Byte Offset of the first entry in the first page. */
8296         uint8_t page_size;
8297         /*
8298          * Actual page size in 2^page_size. The supported range is
8299          * increments in powers of 2 from 16 bytes to 1GB. - 4 = 16 B
8300          * Page size is 16 B. - 12 = 4 KB Page size is 4 KB. - 13 = 8 KB
8301          * Page size is 8 KB. - 16 = 64 KB Page size is 64 KB. - 21 = 2
8302          * MB Page size is 2 MB. - 22 = 4 MB Page size is 4 MB. - 30 = 1
8303          * GB Page size is 1 GB.
8304          */
8305         uint8_t page_tbl_depth;
8306         /*
8307          * This value indicates the depth of page table. For this
8308          * version of the specification, value other than 0 or 1 shall
8309          * be considered as an invalid value. When the page_tbl_depth =
8310          * 0, then it is treated as a special case with the following.
8311          * 1. FBO and page size fields are not valid. 2. page_tbl_addr
8312          * is the physical address of the first element of the ring.
8313          */
8314         uint8_t unused_2;
8315         uint8_t unused_3;
8316         uint32_t length;
8317         /*
8318          * Number of 16B units in the ring. Minimum size for a ring is
8319          * 16 16B entries.
8320          */
8321         uint16_t logical_id;
8322         /*
8323          * Logical ring number for the ring to be allocated. This value
8324          * determines the position in the doorbell area where the update
8325          * to the ring will be made. For completion rings, this value is
8326          * also the MSI-X vector number for the function the completion
8327          * ring is associated with.
8328          */
8329         uint16_t cmpl_ring_id;
8330         /*
8331          * This field is used only when ring_type is a TX ring. This
8332          * value indicates what completion ring the TX ring is
8333          * associated with.
8334          */
8335         uint16_t queue_id;
8336         /*
8337          * This field is used only when ring_type is a TX ring. This
8338          * value indicates what CoS queue the TX ring is associated
8339          * with.
8340          */
8341         uint8_t unused_4;
8342         uint8_t unused_5;
8343         uint32_t reserved1;
8344         /* This field is reserved for the future use. It shall be set to 0. */
8345         uint16_t ring_arb_cfg;
8346         /*
8347          * This field is used only when ring_type is a TX ring. This
8348          * field is used to configure arbitration related parameters for
8349          * a TX ring.
8350          */
8351         /* Arbitration policy used for the ring. */
8352         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_MASK UINT32_C(0xf)
8353         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_SFT       0
8354         /*
8355          * Use strict priority for the TX ring. Priority
8356          * value is specified in arb_policy_param
8357          */
8358         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_SP \
8359                 (UINT32_C(0x1) << 0)
8360         /*
8361          * Use weighted fair queue arbitration for the
8362          * TX ring. Weight is specified in
8363          * arb_policy_param
8364          */
8365         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_WFQ \
8366                 (UINT32_C(0x2) << 0)
8367         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_LAST \
8368                 RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_WFQ
8369         /* Reserved field. */
8370         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_RSVD_MASK    UINT32_C(0xf0)
8371         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_RSVD_SFT     4
8372         /*
8373          * Arbitration policy specific parameter. # For strict priority
8374          * arbitration policy, this field represents a priority value.
8375          * If set to 0, then the priority is not specified and the HWRM
8376          * is allowed to select any priority for this TX ring. # For
8377          * weighted fair queue arbitration policy, this field represents
8378          * a weight value. If set to 0, then the weight is not specified
8379          * and the HWRM is allowed to select any weight for this TX
8380          * ring.
8381          */
8382         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_PARAM_MASK  \
8383                 UINT32_C(0xff00)
8384         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_PARAM_SFT 8
8385         uint8_t unused_6;
8386         uint8_t unused_7;
8387         uint32_t reserved3;
8388         /* This field is reserved for the future use. It shall be set to 0. */
8389         uint32_t stat_ctx_id;
8390         /*
8391          * This field is used only when ring_type is a TX ring. This
8392          * input indicates what statistics context this ring should be
8393          * associated with.
8394          */
8395         uint32_t reserved4;
8396         /* This field is reserved for the future use. It shall be set to 0. */
8397         uint32_t max_bw;
8398         /*
8399          * This field is used only when ring_type is a TX ring to
8400          * specify maximum BW allocated to the TX ring. The HWRM will
8401          * translate this value into byte counter and time interval used
8402          * for this ring inside the device.
8403          */
8404         /* The bandwidth value. */
8405         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_MASK UINT32_C(0xfffffff)
8406         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_SFT       0
8407         /* The granularity of the value (bits or bytes). */
8408         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE      UINT32_C(0x10000000)
8409         /* Value is in bits. */
8410         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE_BITS (UINT32_C(0x0) << 28)
8411         /* Value is in bytes. */
8412         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE_BYTES (UINT32_C(0x1) << 28)
8413         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE_LAST \
8414                 RING_ALLOC_INPUT_MAX_BW_SCALE_BYTES
8415         /* bw_value_unit is 3 b */
8416         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_MASK \
8417                 UINT32_C(0xe0000000)
8418         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_SFT  29
8419         /* Value is in Mb or MB (base 10). */
8420         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_MEGA \
8421                 (UINT32_C(0x0) << 29)
8422         /* Value is in Kb or KB (base 10). */
8423         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_KILO \
8424                 (UINT32_C(0x2) << 29)
8425         /* Value is in bits or bytes. */
8426         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_BASE \
8427                 (UINT32_C(0x4) << 29)
8428         /* Value is in Gb or GB (base 10). */
8429         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_GIGA \
8430                 (UINT32_C(0x6) << 29)
8431         /* Value is in 1/100th of a percentage of total bandwidth. */
8432         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_PERCENT1_100 \
8433                 (UINT32_C(0x1) << 29)
8434         /* Invalid unit */
8435         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_INVALID \
8436                 (UINT32_C(0x7) << 29)
8437         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_LAST \
8438                 RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_INVALID
8439         uint8_t int_mode;
8440         /*
8441          * This field is used only when ring_type is a Completion ring.
8442          * This value indicates what interrupt mode should be used on
8443          * this completion ring. Note: In the legacy interrupt mode, no
8444          * more than 16 completion rings are allowed.
8445          */
8446         /* Legacy INTA */
8447         #define HWRM_RING_ALLOC_INPUT_INT_MODE_LEGACY   UINT32_C(0x0)
8448         /* Reserved */
8449         #define HWRM_RING_ALLOC_INPUT_INT_MODE_RSVD     UINT32_C(0x1)
8450         /* MSI-X */
8451         #define HWRM_RING_ALLOC_INPUT_INT_MODE_MSIX     UINT32_C(0x2)
8452         /* No Interrupt - Polled mode */
8453         #define HWRM_RING_ALLOC_INPUT_INT_MODE_POLL     UINT32_C(0x3)
8454         uint8_t unused_8[3];
8455 } __attribute__((packed));
8456
8457 /* Output       (16 bytes) */
8458 struct hwrm_ring_alloc_output {
8459         uint16_t error_code;
8460         /*
8461          * Pass/Fail or error type Note: receiver to verify the in
8462          * parameters, and fail the call with an error when appropriate
8463          */
8464         uint16_t req_type;
8465         /* This field returns the type of original request. */
8466         uint16_t seq_id;
8467         /* This field provides original sequence number of the command. */
8468         uint16_t resp_len;
8469         /*
8470          * This field is the length of the response in bytes. The last
8471          * byte of the response is a valid flag that will read as '1'
8472          * when the command has been completely written to memory.
8473          */
8474         uint16_t ring_id;
8475         /*
8476          * Physical number of ring allocated. This value shall be unique
8477          * for a ring type.
8478          */
8479         uint16_t logical_ring_id;
8480         /* Logical number of ring allocated. */
8481         uint8_t unused_0;
8482         uint8_t unused_1;
8483         uint8_t unused_2;
8484         uint8_t valid;
8485         /*
8486          * This field is used in Output records to indicate that the
8487          * output is completely written to RAM. This field should be
8488          * read as '1' to indicate that the output has been completely
8489          * written. When writing a command completion or response to an
8490          * internal processor, the order of writes has to be such that
8491          * this field is written last.
8492          */
8493 } __attribute__((packed));
8494
8495 /* hwrm_ring_free */
8496 /*
8497  * Description: This command is used to free a ring and associated resources.
8498  * With QoS and DCBx agents, it is possible the traffic classes will be moved
8499  * from one CoS queue to another. When this occurs, the driver shall call
8500  * 'hwrm_ring_free' to free the allocated rings and then call 'hwrm_ring_alloc'
8501  * to re-allocate each ring and assign it to a new CoS queue. hwrm_ring_free
8502  * shall be called on a ring only after it has been idle for 500ms or more and
8503  * no frames have been posted to the ring during this time. All frames queued
8504  * for transmission shall be completed and at least 500ms time elapsed from the
8505  * last completion before calling this command.
8506  */
8507 /* Input        (24 bytes) */
8508 struct hwrm_ring_free_input {
8509         uint16_t req_type;
8510         /*
8511          * This value indicates what type of request this is. The format
8512          * for the rest of the command is determined by this field.
8513          */
8514         uint16_t cmpl_ring;
8515         /*
8516          * This value indicates the what completion ring the request
8517          * will be optionally completed on. If the value is -1, then no
8518          * CR completion will be generated. Any other value must be a
8519          * valid CR ring_id value for this function.
8520          */
8521         uint16_t seq_id;
8522         /* This value indicates the command sequence number. */
8523         uint16_t target_id;
8524         /*
8525          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8526          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8527          * - HWRM
8528          */
8529         uint64_t resp_addr;
8530         /*
8531          * This is the host address where the response will be written
8532          * when the request is complete. This area must be 16B aligned
8533          * and must be cleared to zero before the request is made.
8534          */
8535         uint8_t ring_type;
8536         /* Ring Type. */
8537         /* L2 Completion Ring   (CR) */
8538         #define HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL  UINT32_C(0x0)
8539         /* TX Ring      (TR) */
8540         #define HWRM_RING_FREE_INPUT_RING_TYPE_TX       UINT32_C(0x1)
8541         /* RX Ring      (RR) */
8542         #define HWRM_RING_FREE_INPUT_RING_TYPE_RX       UINT32_C(0x2)
8543         /* RoCE Notification Completion Ring    (ROCE_CR) */
8544         #define HWRM_RING_FREE_INPUT_RING_TYPE_ROCE_CMPL        UINT32_C(0x3)
8545         uint8_t unused_0;
8546         uint16_t ring_id;
8547         /* Physical number of ring allocated. */
8548         uint32_t unused_1;
8549 } __attribute__((packed));
8550
8551 /* Output       (16 bytes) */
8552 struct hwrm_ring_free_output {
8553         uint16_t error_code;
8554         /*
8555          * Pass/Fail or error type Note: receiver to verify the in
8556          * parameters, and fail the call with an error when appropriate
8557          */
8558         uint16_t req_type;
8559         /* This field returns the type of original request. */
8560         uint16_t seq_id;
8561         /* This field provides original sequence number of the command. */
8562         uint16_t resp_len;
8563         /*
8564          * This field is the length of the response in bytes. The last
8565          * byte of the response is a valid flag that will read as '1'
8566          * when the command has been completely written to memory.
8567          */
8568         uint32_t unused_0;
8569         uint8_t unused_1;
8570         uint8_t unused_2;
8571         uint8_t unused_3;
8572         uint8_t valid;
8573         /*
8574          * This field is used in Output records to indicate that the
8575          * output is completely written to RAM. This field should be
8576          * read as '1' to indicate that the output has been completely
8577          * written. When writing a command completion or response to an
8578          * internal processor, the order of writes has to be such that
8579          * this field is written last.
8580          */
8581 } __attribute__((packed));
8582
8583 /* hwrm_ring_grp_alloc */
8584 /*
8585  * Description: This API allocates and does basic preparation for a ring group.
8586  */
8587 /* Input        (24 bytes) */
8588 struct hwrm_ring_grp_alloc_input {
8589         uint16_t req_type;
8590         /*
8591          * This value indicates what type of request this is. The format
8592          * for the rest of the command is determined by this field.
8593          */
8594         uint16_t cmpl_ring;
8595         /*
8596          * This value indicates the what completion ring the request
8597          * will be optionally completed on. If the value is -1, then no
8598          * CR completion will be generated. Any other value must be a
8599          * valid CR ring_id value for this function.
8600          */
8601         uint16_t seq_id;
8602         /* This value indicates the command sequence number. */
8603         uint16_t target_id;
8604         /*
8605          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8606          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8607          * - HWRM
8608          */
8609         uint64_t resp_addr;
8610         /*
8611          * This is the host address where the response will be written
8612          * when the request is complete. This area must be 16B aligned
8613          * and must be cleared to zero before the request is made.
8614          */
8615         uint16_t cr;
8616         /* This value identifies the CR associated with the ring group. */
8617         uint16_t rr;
8618         /* This value identifies the main RR associated with the ring group. */
8619         uint16_t ar;
8620         /*
8621          * This value identifies the aggregation RR associated with the
8622          * ring group. If this value is 0xFF... (All Fs), then no
8623          * Aggregation ring will be set.
8624          */
8625         uint16_t sc;
8626         /*
8627          * This value identifies the statistics context associated with
8628          * the ring group.
8629          */
8630 } __attribute__((packed));
8631
8632 /* Output       (16 bytes) */
8633 struct hwrm_ring_grp_alloc_output {
8634         uint16_t error_code;
8635         /*
8636          * Pass/Fail or error type Note: receiver to verify the in
8637          * parameters, and fail the call with an error when appropriate
8638          */
8639         uint16_t req_type;
8640         /* This field returns the type of original request. */
8641         uint16_t seq_id;
8642         /* This field provides original sequence number of the command. */
8643         uint16_t resp_len;
8644         /*
8645          * This field is the length of the response in bytes. The last
8646          * byte of the response is a valid flag that will read as '1'
8647          * when the command has been completely written to memory.
8648          */
8649         uint32_t ring_group_id;
8650         /*
8651          * This is the ring group ID value. Use this value to program
8652          * the default ring group for the VNIC or as table entries in an
8653          * RSS/COS context.
8654          */
8655         uint8_t unused_0;
8656         uint8_t unused_1;
8657         uint8_t unused_2;
8658         uint8_t valid;
8659         /*
8660          * This field is used in Output records to indicate that the
8661          * output is completely written to RAM. This field should be
8662          * read as '1' to indicate that the output has been completely
8663          * written. When writing a command completion or response to an
8664          * internal processor, the order of writes has to be such that
8665          * this field is written last.
8666          */
8667 } __attribute__((packed));
8668
8669 /* hwrm_ring_grp_free */
8670 /*
8671  * Description: This API frees a ring group and associated resources. # If a
8672  * ring in the ring group is reset or free, then the associated rings in the
8673  * ring group shall also be reset/free using hwrm_ring_free. # A function driver
8674  * shall always use hwrm_ring_grp_free after freeing all rings in a group. # As
8675  * a part of executing this command, the HWRM shall reset all associated ring
8676  * group resources.
8677  */
8678 /* Input        (24 bytes) */
8679 struct hwrm_ring_grp_free_input {
8680         uint16_t req_type;
8681         /*
8682          * This value indicates what type of request this is. The format
8683          * for the rest of the command is determined by this field.
8684          */
8685         uint16_t cmpl_ring;
8686         /*
8687          * This value indicates the what completion ring the request
8688          * will be optionally completed on. If the value is -1, then no
8689          * CR completion will be generated. Any other value must be a
8690          * valid CR ring_id value for this function.
8691          */
8692         uint16_t seq_id;
8693         /* This value indicates the command sequence number. */
8694         uint16_t target_id;
8695         /*
8696          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8697          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8698          * - HWRM
8699          */
8700         uint64_t resp_addr;
8701         /*
8702          * This is the host address where the response will be written
8703          * when the request is complete. This area must be 16B aligned
8704          * and must be cleared to zero before the request is made.
8705          */
8706         uint32_t ring_group_id;
8707         /* This is the ring group ID value. */
8708         uint32_t unused_0;
8709 } __attribute__((packed));
8710
8711 /* Output       (16 bytes) */
8712 struct hwrm_ring_grp_free_output {
8713         uint16_t error_code;
8714         /*
8715          * Pass/Fail or error type Note: receiver to verify the in
8716          * parameters, and fail the call with an error when appropriate
8717          */
8718         uint16_t req_type;
8719         /* This field returns the type of original request. */
8720         uint16_t seq_id;
8721         /* This field provides original sequence number of the command. */
8722         uint16_t resp_len;
8723         /*
8724          * This field is the length of the response in bytes. The last
8725          * byte of the response is a valid flag that will read as '1'
8726          * when the command has been completely written to memory.
8727          */
8728         uint32_t unused_0;
8729         uint8_t unused_1;
8730         uint8_t unused_2;
8731         uint8_t unused_3;
8732         uint8_t valid;
8733         /*
8734          * This field is used in Output records to indicate that the
8735          * output is completely written to RAM. This field should be
8736          * read as '1' to indicate that the output has been completely
8737          * written. When writing a command completion or response to an
8738          * internal processor, the order of writes has to be such that
8739          * this field is written last.
8740          */
8741 } __attribute__((packed));
8742
8743 /* hwrm_cfa_l2_filter_alloc */
8744 /*
8745  * Description: An L2 filter is a filter resource that is used to identify a
8746  * vnic or ring for a packet based on layer 2 fields. Layer 2 fields for
8747  * encapsulated packets include both outer L2 header and/or inner l2 header of
8748  * encapsulated packet. The L2 filter resource covers the following OS specific
8749  * L2 filters. Linux/FreeBSD (per function): # Broadcast enable/disable # List
8750  * of individual multicast filters # All multicast enable/disable filter #
8751  * Unicast filters # Promiscuous mode VMware: # Broadcast enable/disable (per
8752  * physical function) # All multicast enable/disable    (per function) # Unicast
8753  * filters per ring or vnic # Promiscuous mode per PF Windows: # Broadcast
8754  * enable/disable (per physical function) # List of individual multicast filters
8755  * (Driver needs to advertise the maximum number of filters supported) # All
8756  * multicast enable/disable per physical function # Unicast filters per vnic #
8757  * Promiscuous mode per PF Implementation notes on the use of VNIC in this
8758  * command: # By default, these filters belong to default vnic for the function.
8759  * # Once these filters are set up, only destination VNIC can be modified. # If
8760  * the destination VNIC is not specified in this command, then the HWRM shall
8761  * only create an l2 context id. HWRM Implementation notes for multicast
8762  * filters: # The hwrm_filter_alloc command can be used to set up multicast
8763  * filters (perfect match or partial match). Each individual function driver can
8764  * set up multicast filters independently. # The HWRM needs to keep track of
8765  * multicast filters set up by function drivers and maintain multicast group
8766  * replication records to enable a subset of functions to receive traffic for a
8767  * specific multicast address. # When a specific multicast filter cannot be set,
8768  * the HWRM shall return an error. In this error case, the driver should fall
8769  * back to using one general filter     (rather than specific) for all multicast
8770  * traffic. # When the SR-IOV is enabled, the HWRM needs to additionally track
8771  * source knockout per multicast group record. Examples of setting unicast
8772  * filters: For a unicast MAC based filter, one can use a combination of the
8773  * fields and masks provided in this command to set up the filter. Below are
8774  * some examples: # MAC + no VLAN filter: This filter is used to identify
8775  * traffic that does not contain any VLAN tags and matches destination  (or
8776  * source) MAC address. This filter can be set up by setting only l2_addr field
8777  * to be a valid field. All other fields are not valid. The following value is
8778  * set for l2_addr. l2_addr = MAC # MAC + Any VLAN filter: This filter is used
8779  * to identify traffic that carries single VLAN tag and matches (destination or
8780  * source) MAC address. This filter can be set up by setting only l2_addr and
8781  * l2_ovlan_mask fields to be valid fields. All other fields are not valid. The
8782  * following values are set for those two valid fields. l2_addr = MAC,
8783  * l2_ovlan_mask = 0xFFFF # MAC + no VLAN or VLAN ID=0: This filter is used to
8784  * identify untagged traffic that does not contain any VLAN tags or a VLAN tag
8785  * with VLAN ID = 0 and matches destination (or source) MAC address. This filter
8786  * can be set up by setting only l2_addr and l2_ovlan fields to be valid fields.
8787  * All other fields are not valid. The following value are set for l2_addr and
8788  * l2_ovlan. l2_addr = MAC, l2_ovlan = 0x0 # MAC + no VLAN or any VLAN: This
8789  * filter is used to identify traffic that contains zero or 1 VLAN tag and
8790  * matches destination  (or source) MAC address. This filter can be set up by
8791  * setting only l2_addr, l2_ovlan, and l2_mask fields to be valid fields. All
8792  * other fields are not valid. The following value are set for l2_addr,
8793  * l2_ovlan, and l2_mask fields. l2_addr = MAC, l2_ovlan = 0x0, l2_ovlan_mask =
8794  * 0xFFFF # MAC + VLAN ID filter: This filter can be set up by setting only
8795  * l2_addr, l2_ovlan, and l2_ovlan_mask fields to be valid fields. All other
8796  * fields are not valid. The following values are set for those three valid
8797  * fields. l2_addr = MAC, l2_ovlan = VLAN ID, l2_ovlan_mask = 0xF000
8798  */
8799 /* Input        (96 bytes) */
8800 struct hwrm_cfa_l2_filter_alloc_input {
8801         uint16_t req_type;
8802         /*
8803          * This value indicates what type of request this is. The format
8804          * for the rest of the command is determined by this field.
8805          */
8806         uint16_t cmpl_ring;
8807         /*
8808          * This value indicates the what completion ring the request
8809          * will be optionally completed on. If the value is -1, then no
8810          * CR completion will be generated. Any other value must be a
8811          * valid CR ring_id value for this function.
8812          */
8813         uint16_t seq_id;
8814         /* This value indicates the command sequence number. */
8815         uint16_t target_id;
8816         /*
8817          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8818          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8819          * - HWRM
8820          */
8821         uint64_t resp_addr;
8822         /*
8823          * This is the host address where the response will be written
8824          * when the request is complete. This area must be 16B aligned
8825          * and must be cleared to zero before the request is made.
8826          */
8827         uint32_t flags;
8828         /*
8829          * Enumeration denoting the RX, TX type of the resource. This
8830          * enumeration is used for resources that are similar for both
8831          * TX and RX paths of the chip.
8832          */
8833         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH       UINT32_C(0x1)
8834         /* tx path */
8835         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_TX    \
8836                 (UINT32_C(0x0) << 0)
8837         /* rx path */
8838         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX    \
8839                 (UINT32_C(0x1) << 0)
8840         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_LAST \
8841                 CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX
8842         /*
8843          * Setting of this flag indicates the applicability to the
8844          * loopback path.
8845          */
8846         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_LOOPBACK   UINT32_C(0x2)
8847         /*
8848          * Setting of this flag indicates drop action. If this flag is
8849          * not set, then it should be considered accept action.
8850          */
8851         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_DROP       UINT32_C(0x4)
8852         /*
8853          * If this flag is set, all t_l2_* fields are invalid and they
8854          * should not be specified. If this flag is set, then l2_*
8855          * fields refer to fields of outermost L2 header.
8856          */
8857         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST UINT32_C(0x8)
8858         uint32_t enables;
8859         /* This bit must be '1' for the l2_addr field to be configured. */
8860         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR UINT32_C(0x1)
8861         /* This bit must be '1' for the l2_addr_mask field to be configured. */
8862         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK     \
8863                 UINT32_C(0x2)
8864         /* This bit must be '1' for the l2_ovlan field to be configured. */
8865         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN UINT32_C(0x4)
8866         /*
8867          * This bit must be '1' for the l2_ovlan_mask field to be
8868          * configured.
8869          */
8870         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN_MASK     \
8871                 UINT32_C(0x8)
8872         /* This bit must be '1' for the l2_ivlan field to be configured. */
8873         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN UINT32_C(0x10)
8874         /*
8875          * This bit must be '1' for the l2_ivlan_mask field to be
8876          * configured.
8877          */
8878         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN_MASK     \
8879                 UINT32_C(0x20)
8880         /* This bit must be '1' for the t_l2_addr field to be configured. */
8881         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR UINT32_C(0x40)
8882         /*
8883          * This bit must be '1' for the t_l2_addr_mask field to be
8884          * configured.
8885          */
8886         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR_MASK   \
8887                 UINT32_C(0x80)
8888         /* This bit must be '1' for the t_l2_ovlan field to be configured. */
8889         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN       \
8890                 UINT32_C(0x100)
8891         /*
8892          * This bit must be '1' for the t_l2_ovlan_mask field to be
8893          * configured.
8894          */
8895         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN_MASK  \
8896                 UINT32_C(0x200)
8897         /* This bit must be '1' for the t_l2_ivlan field to be configured. */
8898         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN       \
8899                 UINT32_C(0x400)
8900         /*
8901          * This bit must be '1' for the t_l2_ivlan_mask field to be
8902          * configured.
8903          */
8904         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN_MASK  \
8905                 UINT32_C(0x800)
8906         /* This bit must be '1' for the src_type field to be configured. */
8907         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_TYPE UINT32_C(0x1000)
8908         /* This bit must be '1' for the src_id field to be configured. */
8909         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_ID UINT32_C(0x2000)
8910         /* This bit must be '1' for the tunnel_type field to be configured. */
8911         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_TUNNEL_TYPE      \
8912                 UINT32_C(0x4000)
8913         /* This bit must be '1' for the dst_id field to be configured. */
8914         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_DST_ID UINT32_C(0x8000)
8915         /*
8916          * This bit must be '1' for the mirror_vnic_id field to be
8917          * configured.
8918          */
8919         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID   \
8920                 UINT32_C(0x10000)
8921         uint8_t l2_addr[6];
8922         /*
8923          * This value sets the match value for the L2 MAC address.
8924          * Destination MAC address for RX path. Source MAC address for
8925          * TX path.
8926          */
8927         uint8_t unused_0;
8928         uint8_t unused_1;
8929         uint8_t l2_addr_mask[6];
8930         /*
8931          * This value sets the mask value for the L2 address. A value of
8932          * 0 will mask the corresponding bit from compare.
8933          */
8934         uint16_t l2_ovlan;
8935         /* This value sets VLAN ID value for outer VLAN. */
8936         uint16_t l2_ovlan_mask;
8937         /*
8938          * This value sets the mask value for the ovlan id. A value of 0
8939          * will mask the corresponding bit from compare.
8940          */
8941         uint16_t l2_ivlan;
8942         /* This value sets VLAN ID value for inner VLAN. */
8943         uint16_t l2_ivlan_mask;
8944         /*
8945          * This value sets the mask value for the ivlan id. A value of 0
8946          * will mask the corresponding bit from compare.
8947          */
8948         uint8_t unused_2;
8949         uint8_t unused_3;
8950         uint8_t t_l2_addr[6];
8951         /*
8952          * This value sets the match value for the tunnel L2 MAC
8953          * address. Destination MAC address for RX path. Source MAC
8954          * address for TX path.
8955          */
8956         uint8_t unused_4;
8957         uint8_t unused_5;
8958         uint8_t t_l2_addr_mask[6];
8959         /*
8960          * This value sets the mask value for the tunnel L2 address. A
8961          * value of 0 will mask the corresponding bit from compare.
8962          */
8963         uint16_t t_l2_ovlan;
8964         /* This value sets VLAN ID value for tunnel outer VLAN. */
8965         uint16_t t_l2_ovlan_mask;
8966         /*
8967          * This value sets the mask value for the tunnel ovlan id. A
8968          * value of 0 will mask the corresponding bit from compare.
8969          */
8970         uint16_t t_l2_ivlan;
8971         /* This value sets VLAN ID value for tunnel inner VLAN. */
8972         uint16_t t_l2_ivlan_mask;
8973         /*
8974          * This value sets the mask value for the tunnel ivlan id. A
8975          * value of 0 will mask the corresponding bit from compare.
8976          */
8977         uint8_t src_type;
8978         /* This value identifies the type of source of the packet. */
8979         /* Network port */
8980         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_NPORT   UINT32_C(0x0)
8981         /* Physical function */
8982         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_PF      UINT32_C(0x1)
8983         /* Virtual function */
8984         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VF      UINT32_C(0x2)
8985         /* Virtual NIC of a function */
8986         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VNIC    UINT32_C(0x3)
8987         /* Embedded processor for CFA management */
8988         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_KONG    UINT32_C(0x4)
8989         /* Embedded processor for OOB management */
8990         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_APE     UINT32_C(0x5)
8991         /* Embedded processor for RoCE */
8992         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_BONO    UINT32_C(0x6)
8993         /* Embedded processor for network proxy functions */
8994         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_TANG    UINT32_C(0x7)
8995         uint8_t unused_6;
8996         uint32_t src_id;
8997         /*
8998          * This value is the id of the source. For a network port, it
8999          * represents port_id. For a physical function, it represents
9000          * fid. For a virtual function, it represents vf_id. For a vnic,
9001          * it represents vnic_id. For embedded processors, this id is
9002          * not valid. Notes: 1. The function ID is implied if it src_id
9003          * is not provided for a src_type that is either
9004          */
9005         uint8_t tunnel_type;
9006         /* Tunnel Type. */
9007         /* Non-tunnel */
9008         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NONTUNNEL \
9009                 UINT32_C(0x0)
9010         /* Virtual eXtensible Local Area Network        (VXLAN) */
9011         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_VXLAN \
9012                 UINT32_C(0x1)
9013         /*
9014          * Network Virtualization Generic Routing
9015          * Encapsulation        (NVGRE)
9016          */
9017         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NVGRE \
9018                 UINT32_C(0x2)
9019         /*
9020          * Generic Routing Encapsulation        (GRE) inside
9021          * Ethernet payload
9022          */
9023         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_L2GRE UINT32_C(0x3)
9024         /* IP in IP */
9025         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPIP UINT32_C(0x4)
9026         /* Generic Network Virtualization Encapsulation (Geneve) */
9027         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_GENEVE UINT32_C(0x5)
9028         /* Multi-Protocol Lable Switching       (MPLS) */
9029         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_MPLS UINT32_C(0x6)
9030         /* Stateless Transport Tunnel   (STT) */
9031         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_STT  UINT32_C(0x7)
9032         /*
9033          * Generic Routing Encapsulation        (GRE) inside IP
9034          * datagram payload
9035          */
9036         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPGRE UINT32_C(0x8)
9037         /* Any tunneled traffic */
9038         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_ANYTUNNEL \
9039                 UINT32_C(0xff)
9040         uint8_t unused_7;
9041         uint16_t dst_id;
9042         /*
9043          * If set, this value shall represent the Logical VNIC ID of the
9044          * destination VNIC for the RX path and network port id of the
9045          * destination port for the TX path.
9046          */
9047         uint16_t mirror_vnic_id;
9048         /* Logical VNIC ID of the VNIC where traffic is mirrored. */
9049         uint8_t pri_hint;
9050         /*
9051          * This hint is provided to help in placing the filter in the
9052          * filter table.
9053          */
9054         /* No preference */
9055         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_NO_PREFER \
9056                 UINT32_C(0x0)
9057         /* Above the given filter */
9058         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_ABOVE_FILTER \
9059                 UINT32_C(0x1)
9060         /* Below the given filter */
9061         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_BELOW_FILTER \
9062                 UINT32_C(0x2)
9063         /* As high as possible */
9064         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MAX     UINT32_C(0x3)
9065         /* As low as possible */
9066         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MIN     UINT32_C(0x4)
9067         uint8_t unused_8;
9068         uint32_t unused_9;
9069         uint64_t l2_filter_id_hint;
9070         /*
9071          * This is the ID of the filter that goes along with the
9072          * pri_hint. This field is valid only for the following values.
9073          * 1 - Above the given filter 2 - Below the given filter
9074          */
9075 } __attribute__((packed));
9076
9077 /* Output       (24 bytes) */
9078 struct hwrm_cfa_l2_filter_alloc_output {
9079         uint16_t error_code;
9080         /*
9081          * Pass/Fail or error type Note: receiver to verify the in
9082          * parameters, and fail the call with an error when appropriate
9083          */
9084         uint16_t req_type;
9085         /* This field returns the type of original request. */
9086         uint16_t seq_id;
9087         /* This field provides original sequence number of the command. */
9088         uint16_t resp_len;
9089         /*
9090          * This field is the length of the response in bytes. The last
9091          * byte of the response is a valid flag that will read as '1'
9092          * when the command has been completely written to memory.
9093          */
9094         uint64_t l2_filter_id;
9095         /*
9096          * This value identifies a set of CFA data structures used for
9097          * an L2 context.
9098          */
9099         uint32_t flow_id;
9100         /*
9101          * This is the ID of the flow associated with this filter. This
9102          * value shall be used to match and associate the flow
9103          * identifier returned in completion records. A value of
9104          * 0xFFFFFFFF shall indicate no flow id.
9105          */
9106         uint8_t unused_0;
9107         uint8_t unused_1;
9108         uint8_t unused_2;
9109         uint8_t valid;
9110         /*
9111          * This field is used in Output records to indicate that the
9112          * output is completely written to RAM. This field should be
9113          * read as '1' to indicate that the output has been completely
9114          * written. When writing a command completion or response to an
9115          * internal processor, the order of writes has to be such that
9116          * this field is written last.
9117          */
9118 } __attribute__((packed));
9119
9120 /* hwrm_cfa_l2_filter_free */
9121 /*
9122  * Description: Free a L2 filter. The HWRM shall free all associated filter
9123  * resources with the L2 filter.
9124  */
9125 /* Input        (24 bytes) */
9126 struct hwrm_cfa_l2_filter_free_input {
9127         uint16_t req_type;
9128         /*
9129          * This value indicates what type of request this is. The format
9130          * for the rest of the command is determined by this field.
9131          */
9132         uint16_t cmpl_ring;
9133         /*
9134          * This value indicates the what completion ring the request
9135          * will be optionally completed on. If the value is -1, then no
9136          * CR completion will be generated. Any other value must be a
9137          * valid CR ring_id value for this function.
9138          */
9139         uint16_t seq_id;
9140         /* This value indicates the command sequence number. */
9141         uint16_t target_id;
9142         /*
9143          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9144          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9145          * - HWRM
9146          */
9147         uint64_t resp_addr;
9148         /*
9149          * This is the host address where the response will be written
9150          * when the request is complete. This area must be 16B aligned
9151          * and must be cleared to zero before the request is made.
9152          */
9153         uint64_t l2_filter_id;
9154         /*
9155          * This value identifies a set of CFA data structures used for
9156          * an L2 context.
9157          */
9158 } __attribute__((packed));
9159
9160 /* Output       (16 bytes) */
9161 struct hwrm_cfa_l2_filter_free_output {
9162         uint16_t error_code;
9163         /*
9164          * Pass/Fail or error type Note: receiver to verify the in
9165          * parameters, and fail the call with an error when appropriate
9166          */
9167         uint16_t req_type;
9168         /* This field returns the type of original request. */
9169         uint16_t seq_id;
9170         /* This field provides original sequence number of the command. */
9171         uint16_t resp_len;
9172         /*
9173          * This field is the length of the response in bytes. The last
9174          * byte of the response is a valid flag that will read as '1'
9175          * when the command has been completely written to memory.
9176          */
9177         uint32_t unused_0;
9178         uint8_t unused_1;
9179         uint8_t unused_2;
9180         uint8_t unused_3;
9181         uint8_t valid;
9182         /*
9183          * This field is used in Output records to indicate that the
9184          * output is completely written to RAM. This field should be
9185          * read as '1' to indicate that the output has been completely
9186          * written. When writing a command completion or response to an
9187          * internal processor, the order of writes has to be such that
9188          * this field is written last.
9189          */
9190 } __attribute__((packed));
9191
9192 /* hwrm_cfa_l2_filter_cfg */
9193 /* Description: Change the configuration of an existing L2 filter */
9194 /* Input        (40 bytes) */
9195 struct hwrm_cfa_l2_filter_cfg_input {
9196         uint16_t req_type;
9197         /*
9198          * This value indicates what type of request this is. The format
9199          * for the rest of the command is determined by this field.
9200          */
9201         uint16_t cmpl_ring;
9202         /*
9203          * This value indicates the what completion ring the request
9204          * will be optionally completed on. If the value is -1, then no
9205          * CR completion will be generated. Any other value must be a
9206          * valid CR ring_id value for this function.
9207          */
9208         uint16_t seq_id;
9209         /* This value indicates the command sequence number. */
9210         uint16_t target_id;
9211         /*
9212          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9213          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9214          * - HWRM
9215          */
9216         uint64_t resp_addr;
9217         /*
9218          * This is the host address where the response will be written
9219          * when the request is complete. This area must be 16B aligned
9220          * and must be cleared to zero before the request is made.
9221          */
9222         uint32_t flags;
9223         /*
9224          * Enumeration denoting the RX, TX type of the resource. This
9225          * enumeration is used for resources that are similar for both
9226          * TX and RX paths of the chip.
9227          */
9228         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH UINT32_C(0x1)
9229         /* tx path */
9230         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_TX \
9231                 (UINT32_C(0x0) << 0)
9232         /* rx path */
9233         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_RX \
9234                 (UINT32_C(0x1) << 0)
9235         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_LAST \
9236                 CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_RX
9237         /*
9238          * Setting of this flag indicates drop action. If this flag is
9239          * not set, then it should be considered accept action.
9240          */
9241         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_DROP UINT32_C(0x2)
9242         uint32_t enables;
9243         /* This bit must be '1' for the dst_id field to be configured. */
9244         #define HWRM_CFA_L2_FILTER_CFG_INPUT_ENABLES_DST_ID     UINT32_C(0x1)
9245         /*
9246          * This bit must be '1' for the new_mirror_vnic_id field to be
9247          * configured.
9248          */
9249         #define HWRM_CFA_L2_FILTER_CFG_INPUT_ENABLES_NEW_MIRROR_VNIC_ID   \
9250                 UINT32_C(0x2)
9251         uint64_t l2_filter_id;
9252         /*
9253          * This value identifies a set of CFA data structures used for
9254          * an L2 context.
9255          */
9256         uint32_t dst_id;
9257         /*
9258          * If set, this value shall represent the Logical VNIC ID of the
9259          * destination VNIC for the RX path and network port id of the
9260          * destination port for the TX path.
9261          */
9262         uint32_t new_mirror_vnic_id;
9263         /* New Logical VNIC ID of the VNIC where traffic is mirrored. */
9264 } __attribute__((packed));
9265
9266 /* Output       (16 bytes) */
9267 struct hwrm_cfa_l2_filter_cfg_output {
9268         uint16_t error_code;
9269         /*
9270          * Pass/Fail or error type Note: receiver to verify the in
9271          * parameters, and fail the call with an error when appropriate
9272          */
9273         uint16_t req_type;
9274         /* This field returns the type of original request. */
9275         uint16_t seq_id;
9276         /* This field provides original sequence number of the command. */
9277         uint16_t resp_len;
9278         /*
9279          * This field is the length of the response in bytes. The last
9280          * byte of the response is a valid flag that will read as '1'
9281          * when the command has been completely written to memory.
9282          */
9283         uint32_t unused_0;
9284         uint8_t unused_1;
9285         uint8_t unused_2;
9286         uint8_t unused_3;
9287         uint8_t valid;
9288         /*
9289          * This field is used in Output records to indicate that the
9290          * output is completely written to RAM. This field should be
9291          * read as '1' to indicate that the output has been completely
9292          * written. When writing a command completion or response to an
9293          * internal processor, the order of writes has to be such that
9294          * this field is written last.
9295          */
9296 } __attribute__((packed));
9297
9298 /* hwrm_cfa_l2_set_rx_mask */
9299 /* Description: This command will set rx mask of the function. */
9300 /* Input        (56 bytes) */
9301 struct hwrm_cfa_l2_set_rx_mask_input {
9302         uint16_t req_type;
9303         /*
9304          * This value indicates what type of request this is. The format
9305          * for the rest of the command is determined by this field.
9306          */
9307         uint16_t cmpl_ring;
9308         /*
9309          * This value indicates the what completion ring the request
9310          * will be optionally completed on. If the value is -1, then no
9311          * CR completion will be generated. Any other value must be a
9312          * valid CR ring_id value for this function.
9313          */
9314         uint16_t seq_id;
9315         /* This value indicates the command sequence number. */
9316         uint16_t target_id;
9317         /*
9318          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9319          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9320          * - HWRM
9321          */
9322         uint64_t resp_addr;
9323         /*
9324          * This is the host address where the response will be written
9325          * when the request is complete. This area must be 16B aligned
9326          * and must be cleared to zero before the request is made.
9327          */
9328         uint32_t vnic_id;
9329         /* VNIC ID */
9330         uint32_t mask;
9331         /* Reserved for future use. */
9332         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_RESERVED     UINT32_C(0x1)
9333         /*
9334          * When this bit is '1', the function is requested to accept
9335          * multi-cast packets specified by the multicast addr table.
9336          */
9337         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST        UINT32_C(0x2)
9338         /*
9339          * When this bit is '1', the function is requested to accept all
9340          * multi-cast packets.
9341          */
9342         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST    UINT32_C(0x4)
9343         /*
9344          * When this bit is '1', the function is requested to accept
9345          * broadcast packets.
9346          */
9347         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST        UINT32_C(0x8)
9348         /*
9349          * When this bit is '1', the function is requested to be put in
9350          * the promiscuous mode. The HWRM should accept any function to
9351          * set up promiscuous mode. The HWRM shall follow the semantics
9352          * below for the promiscuous mode support. # When partitioning
9353          * is not enabled on a port     (i.e. single PF on the port), then
9354          * the PF shall be allowed to be in the promiscuous mode. When
9355          * the PF is in the promiscuous mode, then it shall receive all
9356          * host bound traffic on that port. # When partitioning is
9357          * enabled on a port    (i.e. multiple PFs per port) and a PF on
9358          * that port is in the promiscuous mode, then the PF receives
9359          * all traffic within that partition as identified by a unique
9360          * identifier for the PF        (e.g. S-Tag). If a unique outer VLAN
9361          * for the PF is specified, then the setting of promiscuous mode
9362          * on that PF shall result in the PF receiving all host bound
9363          * traffic with matching outer VLAN. # A VF shall can be set in
9364          * the promiscuous mode. In the promiscuous mode, the VF does
9365          * not receive any traffic unless a unique outer VLAN for the VF
9366          * is specified. If a unique outer VLAN for the VF is specified,
9367          * then the setting of promiscuous mode on that VF shall result
9368          * in the VF receiving all host bound traffic with the matching
9369          * outer VLAN. # The HWRM shall allow the setting of promiscuous
9370          * mode on a function independently from the promiscuous mode
9371          * settings on other functions.
9372          */
9373         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS UINT32_C(0x10)
9374         /*
9375          * If this flag is set, the corresponding RX filters shall be
9376          * set up to cover multicast/broadcast filters for the outermost
9377          * Layer 2 destination MAC address field.
9378          */
9379         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_OUTERMOST    UINT32_C(0x20)
9380         /*
9381          * If this flag is set, the corresponding RX filters shall be
9382          * set up to cover multicast/broadcast filters for the VLAN-
9383          * tagged packets that match the TPID and VID fields of VLAN
9384          * tags in the VLAN tag table specified in this command.
9385          */
9386         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLANONLY     UINT32_C(0x40)
9387         /*
9388          * If this flag is set, the corresponding RX filters shall be
9389          * set up to cover multicast/broadcast filters for non-VLAN
9390          * tagged packets and VLAN-tagged packets that match the TPID
9391          * and VID fields of VLAN tags in the VLAN tag table specified
9392          * in this command.
9393          */
9394         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN UINT32_C(0x80)
9395         /*
9396          * If this flag is set, the corresponding RX filters shall be
9397          * set up to cover multicast/broadcast filters for non-VLAN
9398          * tagged packets and VLAN-tagged packets matching any VLAN tag.
9399          * If this flag is set, then the HWRM shall ignore VLAN tags
9400          * specified in vlan_tag_tbl. If none of vlanonly, vlan_nonvlan,
9401          * and anyvlan_nonvlan flags is set, then the HWRM shall ignore
9402          * VLAN tags specified in vlan_tag_tbl. The HWRM client shall
9403          * set at most one flag out of vlanonly, vlan_nonvlan, and
9404          * anyvlan_nonvlan.
9405          */
9406         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN      \
9407                 UINT32_C(0x100)
9408         uint64_t mc_tbl_addr;
9409         /* This is the address for mcast address tbl. */
9410         uint32_t num_mc_entries;
9411         /*
9412          * This value indicates how many entries in mc_tbl are valid.
9413          * Each entry is 6 bytes.
9414          */
9415         uint32_t unused_0;
9416         uint64_t vlan_tag_tbl_addr;
9417         /*
9418          * This is the address for VLAN tag table. Each VLAN entry in
9419          * the table is 4 bytes of a VLAN tag including TPID, PCP, DEI,
9420          * and VID fields in network byte order.
9421          */
9422         uint32_t num_vlan_tags;
9423         /*
9424          * This value indicates how many entries in vlan_tag_tbl are
9425          * valid. Each entry is 4 bytes.
9426          */
9427         uint32_t unused_1;
9428 } __attribute__((packed));
9429
9430 /* Output       (16 bytes) */
9431 struct hwrm_cfa_l2_set_rx_mask_output {
9432         uint16_t error_code;
9433         /*
9434          * Pass/Fail or error type Note: receiver to verify the in
9435          * parameters, and fail the call with an error when appropriate
9436          */
9437         uint16_t req_type;
9438         /* This field returns the type of original request. */
9439         uint16_t seq_id;
9440         /* This field provides original sequence number of the command. */
9441         uint16_t resp_len;
9442         /*
9443          * This field is the length of the response in bytes. The last
9444          * byte of the response is a valid flag that will read as '1'
9445          * when the command has been completely written to memory.
9446          */
9447         uint32_t unused_0;
9448         uint8_t unused_1;
9449         uint8_t unused_2;
9450         uint8_t unused_3;
9451         uint8_t valid;
9452         /*
9453          * This field is used in Output records to indicate that the
9454          * output is completely written to RAM. This field should be
9455          * read as '1' to indicate that the output has been completely
9456          * written. When writing a command completion or response to an
9457          * internal processor, the order of writes has to be such that
9458          * this field is written last.
9459          */
9460 } __attribute__((packed));
9461
9462 /* hwrm_tunnel_dst_port_query */
9463 /*
9464  * Description: This function is called by a driver to query tunnel type
9465  * specific destination port configuration.
9466  */
9467 /* Input        (24 bytes) */
9468 struct hwrm_tunnel_dst_port_query_input {
9469         uint16_t req_type;
9470         /*
9471          * This value indicates what type of request this is. The format
9472          * for the rest of the command is determined by this field.
9473          */
9474         uint16_t cmpl_ring;
9475         /*
9476          * This value indicates the what completion ring the request
9477          * will be optionally completed on. If the value is -1, then no
9478          * CR completion will be generated. Any other value must be a
9479          * valid CR ring_id value for this function.
9480          */
9481         uint16_t seq_id;
9482         /* This value indicates the command sequence number. */
9483         uint16_t target_id;
9484         /*
9485          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9486          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9487          * - HWRM
9488          */
9489         uint64_t resp_addr;
9490         /*
9491          * This is the host address where the response will be written
9492          * when the request is complete. This area must be 16B aligned
9493          * and must be cleared to zero before the request is made.
9494          */
9495         uint8_t tunnel_type;
9496         /* Tunnel Type. */
9497         /* Virtual eXtensible Local Area Network        (VXLAN) */
9498         #define HWRM_TUNNEL_DST_PORT_QUERY_INPUT_TUNNEL_TYPE_VXLAN \
9499                 UINT32_C(0x1)
9500         /* Generic Network Virtualization Encapsulation (Geneve) */
9501         #define HWRM_TUNNEL_DST_PORT_QUERY_INPUT_TUNNEL_TYPE_GENEVE \
9502                 UINT32_C(0x5)
9503         uint8_t unused_0[7];
9504 } __attribute__((packed));
9505
9506 /* Output       (16 bytes) */
9507 struct hwrm_tunnel_dst_port_query_output {
9508         uint16_t error_code;
9509         /*
9510          * Pass/Fail or error type Note: receiver to verify the in
9511          * parameters, and fail the call with an error when appropriate
9512          */
9513         uint16_t req_type;
9514         /* This field returns the type of original request. */
9515         uint16_t seq_id;
9516         /* This field provides original sequence number of the command. */
9517         uint16_t resp_len;
9518         /*
9519          * This field is the length of the response in bytes. The last
9520          * byte of the response is a valid flag that will read as '1'
9521          * when the command has been completely written to memory.
9522          */
9523         uint16_t tunnel_dst_port_id;
9524         /*
9525          * This field represents the identifier of L4 destination port
9526          * used for the given tunnel type. This field is valid for
9527          * specific tunnel types that use layer 4       (e.g. UDP) transports
9528          * for tunneling.
9529          */
9530         uint16_t tunnel_dst_port_val;
9531         /*
9532          * This field represents the value of L4 destination port
9533          * identified by tunnel_dst_port_id. This field is valid for
9534          * specific tunnel types that use layer 4       (e.g. UDP) transports
9535          * for tunneling. This field is in network byte order. A value
9536          * of 0 means that the destination port is not configured.
9537          */
9538         uint8_t unused_0;
9539         uint8_t unused_1;
9540         uint8_t unused_2;
9541         uint8_t valid;
9542         /*
9543          * This field is used in Output records to indicate that the
9544          * output is completely written to RAM. This field should be
9545          * read as '1' to indicate that the output has been completely
9546          * written. When writing a command completion or response to an
9547          * internal processor, the order of writes has to be such that
9548          * this field is written last.
9549          */
9550 } __attribute__((packed));
9551
9552 /* hwrm_tunnel_dst_port_alloc */
9553 /*
9554  * Description: This function is called by a driver to allocate l4 destination
9555  * port for a specific tunnel type. The destination port value is provided in
9556  * the input. If the HWRM supports only one global destination port for a tunnel
9557  * type, then the HWRM shall keep track of its usage as described below. # The
9558  * first caller that allocates a destination port shall always succeed and the
9559  * HWRM shall save the destination port configuration for that tunnel type and
9560  * increment the usage count to 1. # Subsequent callers allocating the same
9561  * destination port for that tunnel type shall succeed and the HWRM shall
9562  * increment the usage count for that port for each subsequent caller that
9563  * succeeds. # Any subsequent caller trying to allocate a different destination
9564  * port for that tunnel type shall fail until the usage count for the original
9565  * destination port goes to zero. # A caller that frees a port will cause the
9566  * usage count for that port to decrement.
9567  */
9568 /* Input        (24 bytes) */
9569 struct hwrm_tunnel_dst_port_alloc_input {
9570         uint16_t req_type;
9571         /*
9572          * This value indicates what type of request this is. The format
9573          * for the rest of the command is determined by this field.
9574          */
9575         uint16_t cmpl_ring;
9576         /*
9577          * This value indicates the what completion ring the request
9578          * will be optionally completed on. If the value is -1, then no
9579          * CR completion will be generated. Any other value must be a
9580          * valid CR ring_id value for this function.
9581          */
9582         uint16_t seq_id;
9583         /* This value indicates the command sequence number. */
9584         uint16_t target_id;
9585         /*
9586          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9587          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9588          * - HWRM
9589          */
9590         uint64_t resp_addr;
9591         /*
9592          * This is the host address where the response will be written
9593          * when the request is complete. This area must be 16B aligned
9594          * and must be cleared to zero before the request is made.
9595          */
9596         uint8_t tunnel_type;
9597         /* Tunnel Type. */
9598         /* Virtual eXtensible Local Area Network        (VXLAN) */
9599         #define HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_VXLAN UINT32_C(0x1)
9600         /* Generic Network Virtualization Encapsulation (Geneve) */
9601         #define HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_GENEVE \
9602                 UINT32_C(0x5)
9603         uint8_t unused_0;
9604         uint16_t tunnel_dst_port_val;
9605         /*
9606          * This field represents the value of L4 destination port used
9607          * for the given tunnel type. This field is valid for specific
9608          * tunnel types that use layer 4        (e.g. UDP) transports for
9609          * tunneling. This field is in network byte order. A value of 0
9610          * shall fail the command.
9611          */
9612         uint32_t unused_1;
9613 } __attribute__((packed));
9614
9615 /* Output       (16 bytes) */
9616 struct hwrm_tunnel_dst_port_alloc_output {
9617         uint16_t error_code;
9618         /*
9619          * Pass/Fail or error type Note: receiver to verify the in
9620          * parameters, and fail the call with an error when appropriate
9621          */
9622         uint16_t req_type;
9623         /* This field returns the type of original request. */
9624         uint16_t seq_id;
9625         /* This field provides original sequence number of the command. */
9626         uint16_t resp_len;
9627         /*
9628          * This field is the length of the response in bytes. The last
9629          * byte of the response is a valid flag that will read as '1'
9630          * when the command has been completely written to memory.
9631          */
9632         uint16_t tunnel_dst_port_id;
9633         /*
9634          * Identifier of a tunnel L4 destination port value. Only
9635          * applies to tunnel types that has l4 destination port
9636          * parameters.
9637          */
9638         uint8_t unused_0;
9639         uint8_t unused_1;
9640         uint8_t unused_2;
9641         uint8_t unused_3;
9642         uint8_t unused_4;
9643         uint8_t valid;
9644         /*
9645          * This field is used in Output records to indicate that the
9646          * output is completely written to RAM. This field should be
9647          * read as '1' to indicate that the output has been completely
9648          * written. When writing a command completion or response to an
9649          * internal processor, the order of writes has to be such that
9650          * this field is written last.
9651          */
9652 } __attribute__((packed));
9653
9654 /* hwrm_tunnel_dst_port_free */
9655 /*
9656  * Description: This function is called by a driver to free l4 destination port
9657  * for a specific tunnel type.
9658  */
9659 /* Input        (24 bytes) */
9660 struct hwrm_tunnel_dst_port_free_input {
9661         uint16_t req_type;
9662         /*
9663          * This value indicates what type of request this is. The format
9664          * for the rest of the command is determined by this field.
9665          */
9666         uint16_t cmpl_ring;
9667         /*
9668          * This value indicates the what completion ring the request
9669          * will be optionally completed on. If the value is -1, then no
9670          * CR completion will be generated. Any other value must be a
9671          * valid CR ring_id value for this function.
9672          */
9673         uint16_t seq_id;
9674         /* This value indicates the command sequence number. */
9675         uint16_t target_id;
9676         /*
9677          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9678          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9679          * - HWRM
9680          */
9681         uint64_t resp_addr;
9682         /*
9683          * This is the host address where the response will be written
9684          * when the request is complete. This area must be 16B aligned
9685          * and must be cleared to zero before the request is made.
9686          */
9687         uint8_t tunnel_type;
9688         /* Tunnel Type. */
9689         /* Virtual eXtensible Local Area Network        (VXLAN) */
9690         #define HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_VXLAN UINT32_C(0x1)
9691         /* Generic Network Virtualization Encapsulation (Geneve) */
9692         #define HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_GENEVE UINT32_C(0x5)
9693         uint8_t unused_0;
9694         uint16_t tunnel_dst_port_id;
9695         /*
9696          * Identifier of a tunnel L4 destination port value. Only
9697          * applies to tunnel types that has l4 destination port
9698          * parameters.
9699          */
9700         uint32_t unused_1;
9701 } __attribute__((packed));
9702
9703 /* Output       (16 bytes) */
9704 struct hwrm_tunnel_dst_port_free_output {
9705         uint16_t error_code;
9706         /*
9707          * Pass/Fail or error type Note: receiver to verify the in
9708          * parameters, and fail the call with an error when appropriate
9709          */
9710         uint16_t req_type;
9711         /* This field returns the type of original request. */
9712         uint16_t seq_id;
9713         /* This field provides original sequence number of the command. */
9714         uint16_t resp_len;
9715         /*
9716          * This field is the length of the response in bytes. The last
9717          * byte of the response is a valid flag that will read as '1'
9718          * when the command has been completely written to memory.
9719          */
9720         uint32_t unused_0;
9721         uint8_t unused_1;
9722         uint8_t unused_2;
9723         uint8_t unused_3;
9724         uint8_t valid;
9725         /*
9726          * This field is used in Output records to indicate that the
9727          * output is completely written to RAM. This field should be
9728          * read as '1' to indicate that the output has been completely
9729          * written. When writing a command completion or response to an
9730          * internal processor, the order of writes has to be such that
9731          * this field is written last.
9732          */
9733 } __attribute__((packed));
9734
9735 /* hwrm_stat_ctx_alloc */
9736 /*
9737  * Description: This command allocates and does basic preparation for a stat
9738  * context.
9739  */
9740 /* Input        (32 bytes) */
9741 struct hwrm_stat_ctx_alloc_input {
9742         uint16_t req_type;
9743         /*
9744          * This value indicates what type of request this is. The format
9745          * for the rest of the command is determined by this field.
9746          */
9747         uint16_t cmpl_ring;
9748         /*
9749          * This value indicates the what completion ring the request
9750          * will be optionally completed on. If the value is -1, then no
9751          * CR completion will be generated. Any other value must be a
9752          * valid CR ring_id value for this function.
9753          */
9754         uint16_t seq_id;
9755         /* This value indicates the command sequence number. */
9756         uint16_t target_id;
9757         /*
9758          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9759          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9760          * - HWRM
9761          */
9762         uint64_t resp_addr;
9763         /*
9764          * This is the host address where the response will be written
9765          * when the request is complete. This area must be 16B aligned
9766          * and must be cleared to zero before the request is made.
9767          */
9768         uint64_t stats_dma_addr;
9769         /* This is the address for statistic block. */
9770         uint32_t update_period_ms;
9771         /*
9772          * The statistic block update period in ms. e.g. 250ms, 500ms,
9773          * 750ms, 1000ms. If update_period_ms is 0, then the stats
9774          * update shall be never done and the DMA address shall not be
9775          * used. In this case, the stat block can only be read by
9776          * hwrm_stat_ctx_query command.
9777          */
9778         uint8_t stat_ctx_flags;
9779         /*
9780          * This field is used to specify statistics context specific
9781          * configuration flags.
9782          */
9783         /*
9784          * When this bit is set to '1', the statistics context shall be
9785          * allocated for RoCE traffic only. In this case, traffic other
9786          * than offloaded RoCE traffic shall not be included in this
9787          * statistic context. When this bit is set to '0', the
9788          * statistics context shall be used for the network traffic
9789          * other than offloaded RoCE traffic.
9790          */
9791         #define HWRM_STAT_CTX_ALLOC_INPUT_STAT_CTX_FLAGS_ROCE   UINT32_C(0x1)
9792         uint8_t unused_0[3];
9793 } __attribute__((packed));
9794
9795 /* Output       (16 bytes) */
9796 struct hwrm_stat_ctx_alloc_output {
9797         uint16_t error_code;
9798         /*
9799          * Pass/Fail or error type Note: receiver to verify the in
9800          * parameters, and fail the call with an error when appropriate
9801          */
9802         uint16_t req_type;
9803         /* This field returns the type of original request. */
9804         uint16_t seq_id;
9805         /* This field provides original sequence number of the command. */
9806         uint16_t resp_len;
9807         /*
9808          * This field is the length of the response in bytes. The last
9809          * byte of the response is a valid flag that will read as '1'
9810          * when the command has been completely written to memory.
9811          */
9812         uint32_t stat_ctx_id;
9813         /* This is the statistics context ID value. */
9814         uint8_t unused_0;
9815         uint8_t unused_1;
9816         uint8_t unused_2;
9817         uint8_t valid;
9818         /*
9819          * This field is used in Output records to indicate that the
9820          * output is completely written to RAM. This field should be
9821          * read as '1' to indicate that the output has been completely
9822          * written. When writing a command completion or response to an
9823          * internal processor, the order of writes has to be such that
9824          * this field is written last.
9825          */
9826 } __attribute__((packed));
9827
9828 /* hwrm_stat_ctx_free */
9829 /* Description: This command is used to free a stat context. */
9830 /* Input        (24 bytes) */
9831 struct hwrm_stat_ctx_free_input {
9832         uint16_t req_type;
9833         /*
9834          * This value indicates what type of request this is. The format
9835          * for the rest of the command is determined by this field.
9836          */
9837         uint16_t cmpl_ring;
9838         /*
9839          * This value indicates the what completion ring the request
9840          * will be optionally completed on. If the value is -1, then no
9841          * CR completion will be generated. Any other value must be a
9842          * valid CR ring_id value for this function.
9843          */
9844         uint16_t seq_id;
9845         /* This value indicates the command sequence number. */
9846         uint16_t target_id;
9847         /*
9848          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9849          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9850          * - HWRM
9851          */
9852         uint64_t resp_addr;
9853         /*
9854          * This is the host address where the response will be written
9855          * when the request is complete. This area must be 16B aligned
9856          * and must be cleared to zero before the request is made.
9857          */
9858         uint32_t stat_ctx_id;
9859         /* ID of the statistics context that is being queried. */
9860         uint32_t unused_0;
9861 } __attribute__((packed));
9862
9863 /* Output       (16 bytes) */
9864 struct hwrm_stat_ctx_free_output {
9865         uint16_t error_code;
9866         /*
9867          * Pass/Fail or error type Note: receiver to verify the in
9868          * parameters, and fail the call with an error when appropriate
9869          */
9870         uint16_t req_type;
9871         /* This field returns the type of original request. */
9872         uint16_t seq_id;
9873         /* This field provides original sequence number of the command. */
9874         uint16_t resp_len;
9875         /*
9876          * This field is the length of the response in bytes. The last
9877          * byte of the response is a valid flag that will read as '1'
9878          * when the command has been completely written to memory.
9879          */
9880         uint32_t stat_ctx_id;
9881         /* This is the statistics context ID value. */
9882         uint8_t unused_0;
9883         uint8_t unused_1;
9884         uint8_t unused_2;
9885         uint8_t valid;
9886         /*
9887          * This field is used in Output records to indicate that the
9888          * output is completely written to RAM. This field should be
9889          * read as '1' to indicate that the output has been completely
9890          * written. When writing a command completion or response to an
9891          * internal processor, the order of writes has to be such that
9892          * this field is written last.
9893          */
9894 } __attribute__((packed));
9895
9896 /* hwrm_stat_ctx_clr_stats */
9897 /* Description: This command clears statistics of a context. */
9898 /* Input        (24 bytes) */
9899 struct hwrm_stat_ctx_clr_stats_input {
9900         uint16_t req_type;
9901         /*
9902          * This value indicates what type of request this is. The format
9903          * for the rest of the command is determined by this field.
9904          */
9905         uint16_t cmpl_ring;
9906         /*
9907          * This value indicates the what completion ring the request
9908          * will be optionally completed on. If the value is -1, then no
9909          * CR completion will be generated. Any other value must be a
9910          * valid CR ring_id value for this function.
9911          */
9912         uint16_t seq_id;
9913         /* This value indicates the command sequence number. */
9914         uint16_t target_id;
9915         /*
9916          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9917          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9918          * - HWRM
9919          */
9920         uint64_t resp_addr;
9921         /*
9922          * This is the host address where the response will be written
9923          * when the request is complete. This area must be 16B aligned
9924          * and must be cleared to zero before the request is made.
9925          */
9926         uint32_t stat_ctx_id;
9927         /* ID of the statistics context that is being queried. */
9928         uint32_t unused_0;
9929 } __attribute__((packed));
9930
9931 /* Output       (16 bytes) */
9932 struct hwrm_stat_ctx_clr_stats_output {
9933         uint16_t error_code;
9934         /*
9935          * Pass/Fail or error type Note: receiver to verify the in
9936          * parameters, and fail the call with an error when appropriate
9937          */
9938         uint16_t req_type;
9939         /* This field returns the type of original request. */
9940         uint16_t seq_id;
9941         /* This field provides original sequence number of the command. */
9942         uint16_t resp_len;
9943         /*
9944          * This field is the length of the response in bytes. The last
9945          * byte of the response is a valid flag that will read as '1'
9946          * when the command has been completely written to memory.
9947          */
9948         uint32_t unused_0;
9949         uint8_t unused_1;
9950         uint8_t unused_2;
9951         uint8_t unused_3;
9952         uint8_t valid;
9953         /*
9954          * This field is used in Output records to indicate that the
9955          * output is completely written to RAM. This field should be
9956          * read as '1' to indicate that the output has been completely
9957          * written. When writing a command completion or response to an
9958          * internal processor, the order of writes has to be such that
9959          * this field is written last.
9960          */
9961 } __attribute__((packed));
9962
9963 /* hwrm_stat_ctx_query */
9964 /* Description: This command returns statistics of a context. */
9965 /* Input (24 bytes) */
9966
9967 struct hwrm_stat_ctx_query_input {
9968         uint16_t req_type;
9969         /*
9970          * This value indicates what type of request this is. The format for the
9971          * rest of the command is determined by this field.
9972          */
9973         uint16_t cmpl_ring;
9974         /*
9975          * This value indicates the what completion ring the request will be
9976          * optionally completed on. If the value is -1, then no CR completion
9977          * will be generated. Any other value must be a valid CR ring_id value
9978          * for this function.
9979          */
9980         uint16_t seq_id;
9981         /* This value indicates the command sequence number. */
9982         uint16_t target_id;
9983         /*
9984          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
9985          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
9986          */
9987         uint64_t resp_addr;
9988         /*
9989          * This is the host address where the response will be written when the
9990          * request is complete. This area must be 16B aligned and must be
9991          * cleared to zero before the request is made.
9992          */
9993         uint32_t stat_ctx_id;
9994         /* ID of the statistics context that is being queried. */
9995         uint32_t unused_0;
9996 } __attribute__((packed));
9997
9998 /* Output (176 bytes) */
9999
10000 struct hwrm_stat_ctx_query_output {
10001         uint16_t error_code;
10002         /*
10003          * Pass/Fail or error type Note: receiver to verify the in parameters,
10004          * and fail the call with an error when appropriate
10005          */
10006         uint16_t req_type;
10007         /* This field returns the type of original request. */
10008         uint16_t seq_id;
10009         /* This field provides original sequence number of the command. */
10010         uint16_t resp_len;
10011         /*
10012          * This field is the length of the response in bytes. The last byte of
10013          * the response is a valid flag that will read as '1' when the command
10014          * has been completely written to memory.
10015          */
10016         uint64_t tx_ucast_pkts;
10017         /* Number of transmitted unicast packets */
10018         uint64_t tx_mcast_pkts;
10019         /* Number of transmitted multicast packets */
10020         uint64_t tx_bcast_pkts;
10021         /* Number of transmitted broadcast packets */
10022         uint64_t tx_err_pkts;
10023         /* Number of transmitted packets with error */
10024         uint64_t tx_drop_pkts;
10025         /* Number of dropped packets on transmit path */
10026         uint64_t tx_ucast_bytes;
10027         /* Number of transmitted bytes for unicast traffic */
10028         uint64_t tx_mcast_bytes;
10029         /* Number of transmitted bytes for multicast traffic */
10030         uint64_t tx_bcast_bytes;
10031         /* Number of transmitted bytes for broadcast traffic */
10032         uint64_t rx_ucast_pkts;
10033         /* Number of received unicast packets */
10034         uint64_t rx_mcast_pkts;
10035         /* Number of received multicast packets */
10036         uint64_t rx_bcast_pkts;
10037         /* Number of received broadcast packets */
10038         uint64_t rx_err_pkts;
10039         /* Number of received packets with error */
10040         uint64_t rx_drop_pkts;
10041         /* Number of dropped packets on received path */
10042         uint64_t rx_ucast_bytes;
10043         /* Number of received bytes for unicast traffic */
10044         uint64_t rx_mcast_bytes;
10045         /* Number of received bytes for multicast traffic */
10046         uint64_t rx_bcast_bytes;
10047         /* Number of received bytes for broadcast traffic */
10048         uint64_t rx_agg_pkts;
10049         /* Number of aggregated unicast packets */
10050         uint64_t rx_agg_bytes;
10051         /* Number of aggregated unicast bytes */
10052         uint64_t rx_agg_events;
10053         /* Number of aggregation events */
10054         uint64_t rx_agg_aborts;
10055         /* Number of aborted aggregations */
10056         uint32_t unused_0;
10057         uint8_t unused_1;
10058         uint8_t unused_2;
10059         uint8_t unused_3;
10060         uint8_t valid;
10061         /*
10062          * This field is used in Output records to indicate that the output is
10063          * completely written to RAM. This field should be read as '1' to
10064          * indicate that the output has been completely written. When writing a
10065          * command completion or response to an internal processor, the order of
10066          * writes has to be such that this field is written last.
10067          */
10068 } __attribute__((packed));
10069
10070 /* hwrm_exec_fwd_resp */
10071 /*
10072  * Description: This command is used to send an encapsulated request to the
10073  * HWRM. This command instructs the HWRM to execute the request and forward the
10074  * response of the encapsulated request to the location specified in the
10075  * original request that is encapsulated. The target id of this command shall be
10076  * set to 0xFFFF (HWRM). The response location in this command shall be used to
10077  * acknowledge the receipt of the encapsulated request and forwarding of the
10078  * response.
10079  */
10080 /* Input        (128 bytes) */
10081 struct hwrm_exec_fwd_resp_input {
10082         uint16_t req_type;
10083         /*
10084          * This value indicates what type of request this is. The format
10085          * for the rest of the command is determined by this field.
10086          */
10087         uint16_t cmpl_ring;
10088         /*
10089          * This value indicates the what completion ring the request
10090          * will be optionally completed on. If the value is -1, then no
10091          * CR completion will be generated. Any other value must be a
10092          * valid CR ring_id value for this function.
10093          */
10094         uint16_t seq_id;
10095         /* This value indicates the command sequence number. */
10096         uint16_t target_id;
10097         /*
10098          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10099          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10100          * - HWRM
10101          */
10102         uint64_t resp_addr;
10103         /*
10104          * This is the host address where the response will be written
10105          * when the request is complete. This area must be 16B aligned
10106          * and must be cleared to zero before the request is made.
10107          */
10108         uint32_t encap_request[26];
10109         /*
10110          * This is an encapsulated request. This request should be
10111          * executed by the HWRM and the response should be provided in
10112          * the response buffer inside the encapsulated request.
10113          */
10114         uint16_t encap_resp_target_id;
10115         /*
10116          * This value indicates the target id of the response to the
10117          * encapsulated request. 0x0 - 0xFFF8 - Used for function ids
10118          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF -
10119          * HWRM
10120          */
10121         uint16_t unused_0[3];
10122 } __attribute__((packed));
10123
10124 /* Output       (16 bytes) */
10125 struct hwrm_exec_fwd_resp_output {
10126         uint16_t error_code;
10127         /*
10128          * Pass/Fail or error type Note: receiver to verify the in
10129          * parameters, and fail the call with an error when appropriate
10130          */
10131         uint16_t req_type;
10132         /* This field returns the type of original request. */
10133         uint16_t seq_id;
10134         /* This field provides original sequence number of the command. */
10135         uint16_t resp_len;
10136         /*
10137          * This field is the length of the response in bytes. The last
10138          * byte of the response is a valid flag that will read as '1'
10139          * when the command has been completely written to memory.
10140          */
10141         uint32_t unused_0;
10142         uint8_t unused_1;
10143         uint8_t unused_2;
10144         uint8_t unused_3;
10145         uint8_t valid;
10146         /*
10147          * This field is used in Output records to indicate that the
10148          * output is completely written to RAM. This field should be
10149          * read as '1' to indicate that the output has been completely
10150          * written. When writing a command completion or response to an
10151          * internal processor, the order of writes has to be such that
10152          * this field is written last.
10153          */
10154 } __attribute__((packed));
10155
10156 /* hwrm_reject_fwd_resp */
10157 /*
10158  * Description: This command is used to send an encapsulated request to the
10159  * HWRM. This command instructs the HWRM to reject the request and forward the
10160  * error response of the encapsulated request to the location specified in the
10161  * original request that is encapsulated. The target id of this command shall be
10162  * set to 0xFFFF (HWRM). The response location in this command shall be used to
10163  * acknowledge the receipt of the encapsulated request and forwarding of the
10164  * response.
10165  */
10166 /* Input        (128 bytes) */
10167 struct hwrm_reject_fwd_resp_input {
10168         uint16_t req_type;
10169         /*
10170          * This value indicates what type of request this is. The format
10171          * for the rest of the command is determined by this field.
10172          */
10173         uint16_t cmpl_ring;
10174         /*
10175          * This value indicates the what completion ring the request
10176          * will be optionally completed on. If the value is -1, then no
10177          * CR completion will be generated. Any other value must be a
10178          * valid CR ring_id value for this function.
10179          */
10180         uint16_t seq_id;
10181         /* This value indicates the command sequence number. */
10182         uint16_t target_id;
10183         /*
10184          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10185          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10186          * - HWRM
10187          */
10188         uint64_t resp_addr;
10189         /*
10190          * This is the host address where the response will be written
10191          * when the request is complete. This area must be 16B aligned
10192          * and must be cleared to zero before the request is made.
10193          */
10194         uint32_t encap_request[26];
10195         /*
10196          * This is an encapsulated request. This request should be
10197          * rejected by the HWRM and the error response should be
10198          * provided in the response buffer inside the encapsulated
10199          * request.
10200          */
10201         uint16_t encap_resp_target_id;
10202         /*
10203          * This value indicates the target id of the response to the
10204          * encapsulated request. 0x0 - 0xFFF8 - Used for function ids
10205          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF -
10206          * HWRM
10207          */
10208         uint16_t unused_0[3];
10209 } __attribute__((packed));
10210
10211 /* Output       (16 bytes) */
10212 struct hwrm_reject_fwd_resp_output {
10213         uint16_t error_code;
10214         /*
10215          * Pass/Fail or error type Note: receiver to verify the in
10216          * parameters, and fail the call with an error when appropriate
10217          */
10218         uint16_t req_type;
10219         /* This field returns the type of original request. */
10220         uint16_t seq_id;
10221         /* This field provides original sequence number of the command. */
10222         uint16_t resp_len;
10223         /*
10224          * This field is the length of the response in bytes. The last
10225          * byte of the response is a valid flag that will read as '1'
10226          * when the command has been completely written to memory.
10227          */
10228         uint32_t unused_0;
10229         uint8_t unused_1;
10230         uint8_t unused_2;
10231         uint8_t unused_3;
10232         uint8_t valid;
10233         /*
10234          * This field is used in Output records to indicate that the
10235          * output is completely written to RAM. This field should be
10236          * read as '1' to indicate that the output has been completely
10237          * written. When writing a command completion or response to an
10238          * internal processor, the order of writes has to be such that
10239          * this field is written last.
10240          */
10241 } __attribute__((packed));
10242
10243 /* Hardware Resource Manager Specification */
10244 /* Description: This structure is used to specify port description. */
10245 /*
10246  * Note: The Hardware Resource Manager (HWRM) manages various hardware resources
10247  * inside the chip. The HWRM is implemented in firmware, and runs on embedded
10248  * processors inside the chip. This firmware service is vital part of the chip.
10249  * The chip can not be used by a driver or HWRM client without the HWRM.
10250  */
10251 /* Input        (16 bytes) */
10252 struct input {
10253         uint16_t req_type;
10254         /*
10255          * This value indicates what type of request this is. The format
10256          * for the rest of the command is determined by this field.
10257          */
10258         uint16_t cmpl_ring;
10259         /*
10260          * This value indicates the what completion ring the request
10261          * will be optionally completed on. If the value is -1, then no
10262          * CR completion will be generated. Any other value must be a
10263          * valid CR ring_id value for this function.
10264          */
10265         uint16_t seq_id;
10266         /* This value indicates the command sequence number. */
10267         uint16_t target_id;
10268         /*
10269          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
10270          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
10271          * - HWRM
10272          */
10273         uint64_t resp_addr;
10274         /*
10275          * This is the host address where the response will be written
10276          * when the request is complete. This area must be 16B aligned
10277          * and must be cleared to zero before the request is made.
10278          */
10279 } __attribute__((packed));
10280
10281 /* Output       (8 bytes) */
10282 struct output {
10283         uint16_t error_code;
10284         /*
10285          * Pass/Fail or error type Note: receiver to verify the in
10286          * parameters, and fail the call with an error when appropriate
10287          */
10288         uint16_t req_type;
10289         /* This field returns the type of original request. */
10290         uint16_t seq_id;
10291         /* This field provides original sequence number of the command. */
10292         uint16_t resp_len;
10293         /*
10294          * This field is the length of the response in bytes. The last
10295          * byte of the response is a valid flag that will read as '1'
10296          * when the command has been completely written to memory.
10297          */
10298 } __attribute__((packed));
10299
10300 #define HWRM_GET_HWRM_ERROR_CODE(arg) \
10301         { \
10302                 typeof(arg) x = (arg); \
10303         ((x) == 0xf ? "HWRM_ERROR" : \
10304         ((x) == 0xffff ? "CMD_NOT_SUPPORTED" : \
10305         ((x) == 0xfffe ? "UNKNOWN_ERR" : \
10306         ((x) == 0x4 ? "RESOURCE_ALLOC_ERROR" : \
10307         ((x) == 0x5 ? "INVALID_FLAGS" : \
10308         ((x) == 0x6 ? "INVALID_ENABLES" : \
10309         ((x) == 0x0 ? "SUCCESS" : \
10310         ((x) == 0x1 ? "FAIL" : \
10311         ((x) == 0x2 ? "INVALID_PARAMS" : \
10312         ((x) == 0x3 ? "RESOURCE_ACCESS_DENIED" : \
10313         "Unknown error_code")))))))))) \
10314         }
10315
10316 /* Return Codes (8 bytes) */
10317 struct ret_codes {
10318         uint16_t error_code;
10319         /* These are numbers assigned to return/error codes. */
10320         /* Request was successfully executed by the HWRM. */
10321         #define HWRM_ERR_CODE_SUCCESS   (UINT32_C(0x0))
10322         /* THe HWRM failed to execute the request. */
10323         #define HWRM_ERR_CODE_FAIL      (UINT32_C(0x1))
10324         /*
10325          * The request contains invalid argument(s) or
10326          * input parameters.
10327          */
10328         #define HWRM_ERR_CODE_INVALID_PARAMS    (UINT32_C(0x2))
10329         /*
10330          * The requester is not allowed to access the
10331          * requested resource. This error code shall be
10332          * provided in a response to a request to query
10333          * or modify an existing resource that is not
10334          * accessible by the requester.
10335          */
10336         #define HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED    (UINT32_C(0x3))
10337         /*
10338          * The HWRM is unable to allocate the requested
10339          * resource. This code only applies to requests
10340          * for HWRM resource allocations.
10341          */
10342         #define HWRM_ERR_CODE_RESOURCE_ALLOC_ERROR      (UINT32_C(0x4))
10343         /* Invalid combination of flags is specified in the request. */
10344         #define HWRM_ERR_CODE_INVALID_FLAGS     (UINT32_C(0x5))
10345         /*
10346          * Invalid combination of enables fields is
10347          * specified in the request.
10348          */
10349         #define HWRM_ERR_CODE_INVALID_ENABLES   (UINT32_C(0x6))
10350         /*
10351          * Generic HWRM execution error that represents
10352          * an internal error.
10353          */
10354         #define HWRM_ERR_CODE_HWRM_ERROR        (UINT32_C(0xf))
10355         /* Unknown error */
10356         #define HWRM_ERR_CODE_UNKNOWN_ERR       (UINT32_C(0xfffe))
10357         /* Unsupported or invalid command */
10358         #define HWRM_ERR_CODE_CMD_NOT_SUPPORTED (UINT32_C(0xffff))
10359         uint16_t unused_0[3];
10360 } __attribute__((packed));
10361
10362 /* Output       (16 bytes) */
10363 struct hwrm_err_output {
10364         uint16_t error_code;
10365         /*
10366          * Pass/Fail or error type Note: receiver to verify the in
10367          * parameters, and fail the call with an error when appropriate
10368          */
10369         uint16_t req_type;
10370         /* This field returns the type of original request. */
10371         uint16_t seq_id;
10372         /* This field provides original sequence number of the command. */
10373         uint16_t resp_len;
10374         /*
10375          * This field is the length of the response in bytes. The last
10376          * byte of the response is a valid flag that will read as '1'
10377          * when the command has been completely written to memory.
10378          */
10379         uint32_t opaque_0;
10380         /* debug info for this error response. */
10381         uint16_t opaque_1;
10382         /* debug info for this error response. */
10383         uint8_t cmd_err;
10384         /*
10385          * In the case of an error response, command specific error code
10386          * is returned in this field.
10387          */
10388         uint8_t valid;
10389         /*
10390          * This field is used in Output records to indicate that the
10391          * output is completely written to RAM. This field should be
10392          * read as '1' to indicate that the output has been completely
10393          * written. When writing a command completion or response to an
10394          * internal processor, the order of writes has to be such that
10395          * this field is written last.
10396          */
10397 } __attribute__((packed));
10398
10399 /* Port Tx Statistics Formats   (408 bytes) */
10400 struct tx_port_stats {
10401         uint64_t tx_64b_frames;
10402         /* Total Number of 64 Bytes frames transmitted */
10403         uint64_t tx_65b_127b_frames;
10404         /* Total Number of 65-127 Bytes frames transmitted */
10405         uint64_t tx_128b_255b_frames;
10406         /* Total Number of 128-255 Bytes frames transmitted */
10407         uint64_t tx_256b_511b_frames;
10408         /* Total Number of 256-511 Bytes frames transmitted */
10409         uint64_t tx_512b_1023b_frames;
10410         /* Total Number of 512-1023 Bytes frames transmitted */
10411         uint64_t tx_1024b_1518_frames;
10412         /* Total Number of 1024-1518 Bytes frames transmitted */
10413         uint64_t tx_good_vlan_frames;
10414         /*
10415          * Total Number of each good VLAN       (exludes FCS errors) frame
10416          * transmitted which is 1519 to 1522 bytes in length inclusive
10417          *      (excluding framing bits but including FCS bytes).
10418          */
10419         uint64_t tx_1519b_2047_frames;
10420         /* Total Number of 1519-2047 Bytes frames transmitted */
10421         uint64_t tx_2048b_4095b_frames;
10422         /* Total Number of 2048-4095 Bytes frames transmitted */
10423         uint64_t tx_4096b_9216b_frames;
10424         /* Total Number of 4096-9216 Bytes frames transmitted */
10425         uint64_t tx_9217b_16383b_frames;
10426         /* Total Number of 9217-16383 Bytes frames transmitted */
10427         uint64_t tx_good_frames;
10428         /* Total Number of good frames transmitted */
10429         uint64_t tx_total_frames;
10430         /* Total Number of frames transmitted */
10431         uint64_t tx_ucast_frames;
10432         /* Total number of unicast frames transmitted */
10433         uint64_t tx_mcast_frames;
10434         /* Total number of multicast frames transmitted */
10435         uint64_t tx_bcast_frames;
10436         /* Total number of broadcast frames transmitted */
10437         uint64_t tx_pause_frames;
10438         /* Total number of PAUSE control frames transmitted */
10439         uint64_t tx_pfc_frames;
10440         /* Total number of PFC/per-priority PAUSE control frames transmitted */
10441         uint64_t tx_jabber_frames;
10442         /* Total number of jabber frames transmitted */
10443         uint64_t tx_fcs_err_frames;
10444         /* Total number of frames transmitted with FCS error */
10445         uint64_t tx_control_frames;
10446         /* Total number of control frames transmitted */
10447         uint64_t tx_oversz_frames;
10448         /* Total number of over-sized frames transmitted */
10449         uint64_t tx_single_dfrl_frames;
10450         /* Total number of frames with single deferral */
10451         uint64_t tx_multi_dfrl_frames;
10452         /* Total number of frames with multiple deferrals */
10453         uint64_t tx_single_coll_frames;
10454         /* Total number of frames with single collision */
10455         uint64_t tx_multi_coll_frames;
10456         /* Total number of frames with multiple collisions */
10457         uint64_t tx_late_coll_frames;
10458         /* Total number of frames with late collisions */
10459         uint64_t tx_excessive_coll_frames;
10460         /* Total number of frames with excessive collisions */
10461         uint64_t tx_frag_frames;
10462         /* Total number of fragmented frames transmitted */
10463         uint64_t tx_err;
10464         /* Total number of transmit errors */
10465         uint64_t tx_tagged_frames;
10466         /* Total number of single VLAN tagged frames transmitted */
10467         uint64_t tx_dbl_tagged_frames;
10468         /* Total number of double VLAN tagged frames transmitted */
10469         uint64_t tx_runt_frames;
10470         /* Total number of runt frames transmitted */
10471         uint64_t tx_fifo_underruns;
10472         /* Total number of TX FIFO under runs */
10473         uint64_t tx_pfc_ena_frames_pri0;
10474         /*
10475          * Total number of PFC frames with PFC enabled bit for Pri 0
10476          * transmitted
10477          */
10478         uint64_t tx_pfc_ena_frames_pri1;
10479         /*
10480          * Total number of PFC frames with PFC enabled bit for Pri 1
10481          * transmitted
10482          */
10483         uint64_t tx_pfc_ena_frames_pri2;
10484         /*
10485          * Total number of PFC frames with PFC enabled bit for Pri 2
10486          * transmitted
10487          */
10488         uint64_t tx_pfc_ena_frames_pri3;
10489         /*
10490          * Total number of PFC frames with PFC enabled bit for Pri 3
10491          * transmitted
10492          */
10493         uint64_t tx_pfc_ena_frames_pri4;
10494         /*
10495          * Total number of PFC frames with PFC enabled bit for Pri 4
10496          * transmitted
10497          */
10498         uint64_t tx_pfc_ena_frames_pri5;
10499         /*
10500          * Total number of PFC frames with PFC enabled bit for Pri 5
10501          * transmitted
10502          */
10503         uint64_t tx_pfc_ena_frames_pri6;
10504         /*
10505          * Total number of PFC frames with PFC enabled bit for Pri 6
10506          * transmitted
10507          */
10508         uint64_t tx_pfc_ena_frames_pri7;
10509         /*
10510          * Total number of PFC frames with PFC enabled bit for Pri 7
10511          * transmitted
10512          */
10513         uint64_t tx_eee_lpi_events;
10514         /* Total number of EEE LPI Events on TX */
10515         uint64_t tx_eee_lpi_duration;
10516         /* EEE LPI Duration Counter on TX */
10517         uint64_t tx_llfc_logical_msgs;
10518         /*
10519          * Total number of Link Level Flow Control      (LLFC) messages
10520          * transmitted
10521          */
10522         uint64_t tx_hcfc_msgs;
10523         /* Total number of HCFC messages transmitted */
10524         uint64_t tx_total_collisions;
10525         /* Total number of TX collisions */
10526         uint64_t tx_bytes;
10527         /* Total number of transmitted bytes */
10528         uint64_t tx_xthol_frames;
10529         /* Total number of end-to-end HOL frames */
10530         uint64_t tx_stat_discard;
10531         /* Total Tx Drops per Port reported by STATS block */
10532         uint64_t tx_stat_error;
10533         /* Total Tx Error Drops per Port reported by STATS block */
10534 } __attribute__((packed));
10535
10536 /* Port Rx Statistics Formats   (528 bytes) */
10537 struct rx_port_stats {
10538         uint64_t rx_64b_frames;
10539         /* Total Number of 64 Bytes frames received */
10540         uint64_t rx_65b_127b_frames;
10541         /* Total Number of 65-127 Bytes frames received */
10542         uint64_t rx_128b_255b_frames;
10543         /* Total Number of 128-255 Bytes frames received */
10544         uint64_t rx_256b_511b_frames;
10545         /* Total Number of 256-511 Bytes frames received */
10546         uint64_t rx_512b_1023b_frames;
10547         /* Total Number of 512-1023 Bytes frames received */
10548         uint64_t rx_1024b_1518_frames;
10549         /* Total Number of 1024-1518 Bytes frames received */
10550         uint64_t rx_good_vlan_frames;
10551         /*
10552          * Total Number of each good VLAN       (exludes FCS errors) frame
10553          * received which is 1519 to 1522 bytes in length inclusive
10554          *      (excluding framing bits but including FCS bytes).
10555          */
10556         uint64_t rx_1519b_2047b_frames;
10557         /* Total Number of 1519-2047 Bytes frames received */
10558         uint64_t rx_2048b_4095b_frames;
10559         /* Total Number of 2048-4095 Bytes frames received */
10560         uint64_t rx_4096b_9216b_frames;
10561         /* Total Number of 4096-9216 Bytes frames received */
10562         uint64_t rx_9217b_16383b_frames;
10563         /* Total Number of 9217-16383 Bytes frames received */
10564         uint64_t rx_total_frames;
10565         /* Total number of frames received */
10566         uint64_t rx_ucast_frames;
10567         /* Total number of unicast frames received */
10568         uint64_t rx_mcast_frames;
10569         /* Total number of multicast frames received */
10570         uint64_t rx_bcast_frames;
10571         /* Total number of broadcast frames received */
10572         uint64_t rx_fcs_err_frames;
10573         /* Total number of received frames with FCS error */
10574         uint64_t rx_ctrl_frames;
10575         /* Total number of control frames received */
10576         uint64_t rx_pause_frames;
10577         /* Total number of PAUSE frames received */
10578         uint64_t rx_pfc_frames;
10579         /* Total number of PFC frames received */
10580         uint64_t rx_unsupported_opcode_frames;
10581         /* Total number of frames received with an unsupported opcode */
10582         uint64_t rx_unsupported_da_pausepfc_frames;
10583         /*
10584          * Total number of frames received with an unsupported DA for
10585          * pause and PFC
10586          */
10587         uint64_t rx_wrong_sa_frames;
10588         /* Total number of frames received with an unsupported SA */
10589         uint64_t rx_align_err_frames;
10590         /* Total number of received packets with alignment error */
10591         uint64_t rx_oor_len_frames;
10592         /* Total number of received frames with out-of-range length */
10593         uint64_t rx_code_err_frames;
10594         /* Total number of received frames with error termination */
10595         uint64_t rx_false_carrier_frames;
10596         /*
10597          * Total number of received frames with a false carrier is
10598          * detected during idle, as defined by RX_ER samples active and
10599          * RXD is 0xE. The event is reported along with the statistics
10600          * generated on the next received frame. Only one false carrier
10601          * condition can be detected and logged between frames. Carrier
10602          * event, valid for 10M/100M speed modes only.
10603          */
10604         uint64_t rx_ovrsz_frames;
10605         /* Total number of over-sized frames received */
10606         uint64_t rx_jbr_frames;
10607         /* Total number of jabber packets received */
10608         uint64_t rx_mtu_err_frames;
10609         /* Total number of received frames with MTU error */
10610         uint64_t rx_match_crc_frames;
10611         /* Total number of received frames with CRC match */
10612         uint64_t rx_promiscuous_frames;
10613         /* Total number of frames received promiscuously */
10614         uint64_t rx_tagged_frames;
10615         /* Total number of received frames with one or two VLAN tags */
10616         uint64_t rx_double_tagged_frames;
10617         /* Total number of received frames with two VLAN tags */
10618         uint64_t rx_trunc_frames;
10619         /* Total number of truncated frames received */
10620         uint64_t rx_good_frames;
10621         /* Total number of good frames  (without errors) received */
10622         uint64_t rx_pfc_xon2xoff_frames_pri0;
10623         /*
10624          * Total number of received PFC frames with transition from XON
10625          * to XOFF on Pri 0
10626          */
10627         uint64_t rx_pfc_xon2xoff_frames_pri1;
10628         /*
10629          * Total number of received PFC frames with transition from XON
10630          * to XOFF on Pri 1
10631          */
10632         uint64_t rx_pfc_xon2xoff_frames_pri2;
10633         /*
10634          * Total number of received PFC frames with transition from XON
10635          * to XOFF on Pri 2
10636          */
10637         uint64_t rx_pfc_xon2xoff_frames_pri3;
10638         /*
10639          * Total number of received PFC frames with transition from XON
10640          * to XOFF on Pri 3
10641          */
10642         uint64_t rx_pfc_xon2xoff_frames_pri4;
10643         /*
10644          * Total number of received PFC frames with transition from XON
10645          * to XOFF on Pri 4
10646          */
10647         uint64_t rx_pfc_xon2xoff_frames_pri5;
10648         /*
10649          * Total number of received PFC frames with transition from XON
10650          * to XOFF on Pri 5
10651          */
10652         uint64_t rx_pfc_xon2xoff_frames_pri6;
10653         /*
10654          * Total number of received PFC frames with transition from XON
10655          * to XOFF on Pri 6
10656          */
10657         uint64_t rx_pfc_xon2xoff_frames_pri7;
10658         /*
10659          * Total number of received PFC frames with transition from XON
10660          * to XOFF on Pri 7
10661          */
10662         uint64_t rx_pfc_ena_frames_pri0;
10663         /*
10664          * Total number of received PFC frames with PFC enabled bit for
10665          * Pri 0
10666          */
10667         uint64_t rx_pfc_ena_frames_pri1;
10668         /*
10669          * Total number of received PFC frames with PFC enabled bit for
10670          * Pri 1
10671          */
10672         uint64_t rx_pfc_ena_frames_pri2;
10673         /*
10674          * Total number of received PFC frames with PFC enabled bit for
10675          * Pri 2
10676          */
10677         uint64_t rx_pfc_ena_frames_pri3;
10678         /*
10679          * Total number of received PFC frames with PFC enabled bit for
10680          * Pri 3
10681          */
10682         uint64_t rx_pfc_ena_frames_pri4;
10683         /*
10684          * Total number of received PFC frames with PFC enabled bit for
10685          * Pri 4
10686          */
10687         uint64_t rx_pfc_ena_frames_pri5;
10688         /*
10689          * Total number of received PFC frames with PFC enabled bit for
10690          * Pri 5
10691          */
10692         uint64_t rx_pfc_ena_frames_pri6;
10693         /*
10694          * Total number of received PFC frames with PFC enabled bit for
10695          * Pri 6
10696          */
10697         uint64_t rx_pfc_ena_frames_pri7;
10698         /*
10699          * Total number of received PFC frames with PFC enabled bit for
10700          * Pri 7
10701          */
10702         uint64_t rx_sch_crc_err_frames;
10703         /* Total Number of frames received with SCH CRC error */
10704         uint64_t rx_undrsz_frames;
10705         /* Total Number of under-sized frames received */
10706         uint64_t rx_frag_frames;
10707         /* Total Number of fragmented frames received */
10708         uint64_t rx_eee_lpi_events;
10709         /* Total number of RX EEE LPI Events */
10710         uint64_t rx_eee_lpi_duration;
10711         /* EEE LPI Duration Counter on RX */
10712         uint64_t rx_llfc_physical_msgs;
10713         /*
10714          * Total number of physical type Link Level Flow Control        (LLFC)
10715          * messages received
10716          */
10717         uint64_t rx_llfc_logical_msgs;
10718         /*
10719          * Total number of logical type Link Level Flow Control (LLFC)
10720          * messages received
10721          */
10722         uint64_t rx_llfc_msgs_with_crc_err;
10723         /*
10724          * Total number of logical type Link Level Flow Control (LLFC)
10725          * messages received with CRC error
10726          */
10727         uint64_t rx_hcfc_msgs;
10728         /* Total number of HCFC messages received */
10729         uint64_t rx_hcfc_msgs_with_crc_err;
10730         /* Total number of HCFC messages received with CRC error */
10731         uint64_t rx_bytes;
10732         /* Total number of received bytes */
10733         uint64_t rx_runt_bytes;
10734         /* Total number of bytes received in runt frames */
10735         uint64_t rx_runt_frames;
10736         /* Total number of runt frames received */
10737         uint64_t rx_stat_discard;
10738         /* Total Rx Discards per Port reported by STATS block */
10739         uint64_t rx_stat_err;
10740         /* Total Rx Error Drops per Port reported by STATS block */
10741 } __attribute__((packed));
10742
10743 /* Periodic Statistics Context DMA to host      (160 bytes) */
10744 /*
10745  * per-context HW statistics -- chip view
10746  */
10747
10748 struct ctx_hw_stats64 {
10749         uint64_t rx_ucast_pkts;
10750         uint64_t rx_mcast_pkts;
10751         uint64_t rx_bcast_pkts;
10752         uint64_t rx_drop_pkts;
10753         uint64_t rx_discard_pkts;
10754         uint64_t rx_ucast_bytes;
10755         uint64_t rx_mcast_bytes;
10756         uint64_t rx_bcast_bytes;
10757
10758         uint64_t tx_ucast_pkts;
10759         uint64_t tx_mcast_pkts;
10760         uint64_t tx_bcast_pkts;
10761         uint64_t tx_drop_pkts;
10762         uint64_t tx_discard_pkts;
10763         uint64_t tx_ucast_bytes;
10764         uint64_t tx_mcast_bytes;
10765         uint64_t tx_bcast_bytes;
10766
10767         uint64_t tpa_pkts;
10768         uint64_t tpa_bytes;
10769         uint64_t tpa_events;
10770         uint64_t tpa_aborts;
10771 } __attribute__((packed));
10772
10773 #endif /* _HSI_STRUCT_DEF_DPDK_ */