net/bnxt: support set MTU
[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_queue_qportcfg */
5747 /*
5748  * Description: This function is called by a driver to query queue configuration
5749  * of a port. # The HWRM shall at least advertise one queue with lossy service
5750  * profile. # The driver shall use this command to query queue ids before
5751  * configuring or using any queues. # If a service profile is not set for a
5752  * queue, then the driver shall not use that queue without configuring a service
5753  * profile for it. # If the driver is not allowed to configure service profiles,
5754  * then the driver shall only use queues for which service profiles are pre-
5755  * configured.
5756  */
5757 /* Input        (24 bytes) */
5758 struct hwrm_queue_qportcfg_input {
5759         uint16_t req_type;
5760         /*
5761          * This value indicates what type of request this is. The format
5762          * for the rest of the command is determined by this field.
5763          */
5764         uint16_t cmpl_ring;
5765         /*
5766          * This value indicates the what completion ring the request
5767          * will be optionally completed on. If the value is -1, then no
5768          * CR completion will be generated. Any other value must be a
5769          * valid CR ring_id value for this function.
5770          */
5771         uint16_t seq_id;
5772         /* This value indicates the command sequence number. */
5773         uint16_t target_id;
5774         /*
5775          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
5776          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
5777          * - HWRM
5778          */
5779         uint64_t resp_addr;
5780         /*
5781          * This is the host address where the response will be written
5782          * when the request is complete. This area must be 16B aligned
5783          * and must be cleared to zero before the request is made.
5784          */
5785         uint32_t flags;
5786         /*
5787          * Enumeration denoting the RX, TX type of the resource. This
5788          * enumeration is used for resources that are similar for both
5789          * TX and RX paths of the chip.
5790          */
5791         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH    UINT32_C(0x1)
5792         /* tx path */
5793         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_TX UINT32_C(0x0)
5794         /* rx path */
5795         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX UINT32_C(0x1)
5796         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_LAST \
5797                 QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX
5798         uint16_t port_id;
5799         /*
5800          * Port ID of port for which the queue configuration is being
5801          * queried. This field is only required when sent by IPC.
5802          */
5803         uint16_t unused_0;
5804 } __attribute__((packed));
5805
5806 /* Output       (32 bytes) */
5807 struct hwrm_queue_qportcfg_output {
5808         uint16_t error_code;
5809         /*
5810          * Pass/Fail or error type Note: receiver to verify the in
5811          * parameters, and fail the call with an error when appropriate
5812          */
5813         uint16_t req_type;
5814         /* This field returns the type of original request. */
5815         uint16_t seq_id;
5816         /* This field provides original sequence number of the command. */
5817         uint16_t resp_len;
5818         /*
5819          * This field is the length of the response in bytes. The last
5820          * byte of the response is a valid flag that will read as '1'
5821          * when the command has been completely written to memory.
5822          */
5823         uint8_t max_configurable_queues;
5824         /*
5825          * The maximum number of queues that can be configured on this
5826          * port. Valid values range from 1 through 8.
5827          */
5828         uint8_t max_configurable_lossless_queues;
5829         /*
5830          * The maximum number of lossless queues that can be configured
5831          * on this port. Valid values range from 0 through 8.
5832          */
5833         uint8_t queue_cfg_allowed;
5834         /*
5835          * Bitmask indicating which queues can be configured by the
5836          * hwrm_queue_cfg command. Each bit represents a specific queue
5837          * where bit 0 represents queue 0 and bit 7 represents queue 7.
5838          * # A value of 0 indicates that the queue is not configurable
5839          * by the hwrm_queue_cfg command. # A value of 1 indicates that
5840          * the queue is configurable. # A hwrm_queue_cfg command shall
5841          * return error when trying to configure a queue not
5842          * configurable.
5843          */
5844         uint8_t queue_cfg_info;
5845         /* Information about queue configuration. */
5846         /*
5847          * If this flag is set to '1', then the queues are configured
5848          * asymmetrically on TX and RX sides. If this flag is set to
5849          * '0', then the queues are configured symmetrically on TX and
5850          * RX sides. For symmetric configuration, the queue
5851          * configuration including queue ids and service profiles on the
5852          * TX side is the same as the corresponding queue configuration
5853          * on the RX side.
5854          */
5855         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_CFG_INFO_ASYM_CFG UINT32_C(0x1)
5856         uint8_t queue_pfcenable_cfg_allowed;
5857         /*
5858          * Bitmask indicating which queues can be configured by the
5859          * hwrm_queue_pfcenable_cfg command. Each bit represents a
5860          * specific priority where bit 0 represents priority 0 and bit 7
5861          * represents priority 7. # A value of 0 indicates that the
5862          * priority is not configurable by the hwrm_queue_pfcenable_cfg
5863          * command. # A value of 1 indicates that the priority is
5864          * configurable. # A hwrm_queue_pfcenable_cfg command shall
5865          * return error when trying to configure a priority that is not
5866          * configurable.
5867          */
5868         uint8_t queue_pri2cos_cfg_allowed;
5869         /*
5870          * Bitmask indicating which queues can be configured by the
5871          * hwrm_queue_pri2cos_cfg command. Each bit represents a
5872          * specific queue where bit 0 represents queue 0 and bit 7
5873          * represents queue 7. # A value of 0 indicates that the queue
5874          * is not configurable by the hwrm_queue_pri2cos_cfg command. #
5875          * A value of 1 indicates that the queue is configurable. # A
5876          * hwrm_queue_pri2cos_cfg command shall return error when trying
5877          * to configure a queue that is not configurable.
5878          */
5879         uint8_t queue_cos2bw_cfg_allowed;
5880         /*
5881          * Bitmask indicating which queues can be configured by the
5882          * hwrm_queue_pri2cos_cfg command. Each bit represents a
5883          * specific queue where bit 0 represents queue 0 and bit 7
5884          * represents queue 7. # A value of 0 indicates that the queue
5885          * is not configurable by the hwrm_queue_pri2cos_cfg command. #
5886          * A value of 1 indicates that the queue is configurable. # A
5887          * hwrm_queue_pri2cos_cfg command shall return error when trying
5888          * to configure a queue not configurable.
5889          */
5890         uint8_t queue_id0;
5891         /*
5892          * ID of CoS Queue 0. FF - Invalid id # This ID can be used on
5893          * any subsequent call to an hwrm command that takes a queue id.
5894          * # IDs must always be queried by this command before any use
5895          * by the driver or software. # Any driver or software should
5896          * not make any assumptions about queue IDs. # A value of 0xff
5897          * indicates that the queue is not available. # Available queues
5898          * may not be in sequential order.
5899          */
5900         uint8_t queue_id0_service_profile;
5901         /* This value is applicable to CoS queues only. */
5902         /* Lossy        (best-effort) */
5903         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY \
5904                 UINT32_C(0x0)
5905         /* Lossless */
5906         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS \
5907                 UINT32_C(0x1)
5908         /*
5909          * Set to 0xFF...       (All Fs) if there is no
5910          * service profile specified
5911          */
5912         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_UNKNOWN \
5913                 UINT32_C(0xff)
5914         uint8_t queue_id1;
5915         /*
5916          * ID of CoS Queue 1. FF - Invalid id # This ID can be used on
5917          * any subsequent call to an hwrm command that takes a queue id.
5918          * # IDs must always be queried by this command before any use
5919          * by the driver or software. # Any driver or software should
5920          * not make any assumptions about queue IDs. # A value of 0xff
5921          * indicates that the queue is not available. # Available queues
5922          * may not be in sequential order.
5923          */
5924         uint8_t queue_id1_service_profile;
5925         /* This value is applicable to CoS queues only. */
5926         /* Lossy        (best-effort) */
5927         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSY \
5928                 UINT32_C(0x0)
5929         /* Lossless */
5930         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSLESS \
5931                 UINT32_C(0x1)
5932         /*
5933          * Set to 0xFF...       (All Fs) if there is no
5934          * service profile specified
5935          */
5936         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_UNKNOWN \
5937                 UINT32_C(0xff)
5938         uint8_t queue_id2;
5939         /*
5940          * ID of CoS Queue 2. FF - Invalid id # This ID can be used on
5941          * any subsequent call to an hwrm command that takes a queue id.
5942          * # IDs must always be queried by this command before any use
5943          * by the driver or software. # Any driver or software should
5944          * not make any assumptions about queue IDs. # A value of 0xff
5945          * indicates that the queue is not available. # Available queues
5946          * may not be in sequential order.
5947          */
5948         uint8_t queue_id2_service_profile;
5949         /* This value is applicable to CoS queues only. */
5950         /* Lossy        (best-effort) */
5951         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSY \
5952                 UINT32_C(0x0)
5953         /* Lossless */
5954         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSLESS \
5955                 UINT32_C(0x1)
5956         /*
5957          * Set to 0xFF...       (All Fs) if there is no
5958          * service profile specified
5959          */
5960         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_UNKNOWN \
5961                 UINT32_C(0xff)
5962         uint8_t queue_id3;
5963         /*
5964          * ID of CoS Queue 3. FF - Invalid id # This ID can be used on
5965          * any subsequent call to an hwrm command that takes a queue id.
5966          * # IDs must always be queried by this command before any use
5967          * by the driver or software. # Any driver or software should
5968          * not make any assumptions about queue IDs. # A value of 0xff
5969          * indicates that the queue is not available. # Available queues
5970          * may not be in sequential order.
5971          */
5972         uint8_t queue_id3_service_profile;
5973         /* This value is applicable to CoS queues only. */
5974         /* Lossy        (best-effort) */
5975         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSY \
5976                 UINT32_C(0x0)
5977         /* Lossless */
5978         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSLESS \
5979                 UINT32_C(0x1)
5980         /*
5981          * Set to 0xFF...       (All Fs) if there is no
5982          * service profile specified
5983          */
5984         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_UNKNOWN \
5985                 UINT32_C(0xff)
5986         uint8_t queue_id4;
5987         /*
5988          * ID of CoS Queue 4. FF - Invalid id # This ID can be used on
5989          * any subsequent call to an hwrm command that takes a queue id.
5990          * # IDs must always be queried by this command before any use
5991          * by the driver or software. # Any driver or software should
5992          * not make any assumptions about queue IDs. # A value of 0xff
5993          * indicates that the queue is not available. # Available queues
5994          * may not be in sequential order.
5995          */
5996         uint8_t queue_id4_service_profile;
5997         /* This value is applicable to CoS queues only. */
5998         /* Lossy        (best-effort) */
5999         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSY \
6000                 UINT32_C(0x0)
6001         /* Lossless */
6002         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSLESS \
6003                 UINT32_C(0x1)
6004         /*
6005          * Set to 0xFF...       (All Fs) if there is no
6006          * service profile specified
6007          */
6008         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_UNKNOWN \
6009                 UINT32_C(0xff)
6010         uint8_t queue_id5;
6011         /*
6012          * ID of CoS Queue 5. FF - Invalid id # This ID can be used on
6013          * any subsequent call to an hwrm command that takes a queue id.
6014          * # IDs must always be queried by this command before any use
6015          * by the driver or software. # Any driver or software should
6016          * not make any assumptions about queue IDs. # A value of 0xff
6017          * indicates that the queue is not available. # Available queues
6018          * may not be in sequential order.
6019          */
6020         uint8_t queue_id5_service_profile;
6021         /* This value is applicable to CoS queues only. */
6022         /* Lossy        (best-effort) */
6023         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSY \
6024                 UINT32_C(0x0)
6025         /* Lossless */
6026         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSLESS \
6027                 UINT32_C(0x1)
6028         /*
6029          * Set to 0xFF...       (All Fs) if there is no
6030          * service profile specified
6031          */
6032         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_UNKNOWN \
6033                 UINT32_C(0xff)
6034         uint8_t queue_id6;
6035         /*
6036          * ID of CoS Queue 6. FF - Invalid id # This ID can be used on
6037          * any subsequent call to an hwrm command that takes a queue id.
6038          * # IDs must always be queried by this command before any use
6039          * by the driver or software. # Any driver or software should
6040          * not make any assumptions about queue IDs. # A value of 0xff
6041          * indicates that the queue is not available. # Available queues
6042          * may not be in sequential order.
6043          */
6044         uint8_t queue_id6_service_profile;
6045         /* This value is applicable to CoS queues only. */
6046         /* Lossy        (best-effort) */
6047         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSY \
6048                 UINT32_C(0x0)
6049         /* Lossless */
6050         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSLESS \
6051                 UINT32_C(0x1)
6052         /*
6053          * Set to 0xFF...       (All Fs) if there is no
6054          * service profile specified
6055          */
6056         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_UNKNOWN \
6057                 UINT32_C(0xff)
6058         uint8_t queue_id7;
6059         /*
6060          * ID of CoS Queue 7. FF - Invalid id # This ID can be used on
6061          * any subsequent call to an hwrm command that takes a queue id.
6062          * # IDs must always be queried by this command before any use
6063          * by the driver or software. # Any driver or software should
6064          * not make any assumptions about queue IDs. # A value of 0xff
6065          * indicates that the queue is not available. # Available queues
6066          * may not be in sequential order.
6067          */
6068         uint8_t queue_id7_service_profile;
6069         /* This value is applicable to CoS queues only. */
6070         /* Lossy        (best-effort) */
6071         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSY \
6072                 UINT32_C(0x0)
6073         /* Lossless */
6074         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSLESS \
6075                 UINT32_C(0x1)
6076         /*
6077          * Set to 0xFF...       (All Fs) if there is no
6078          * service profile specified
6079          */
6080         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_UNKNOWN \
6081                 UINT32_C(0xff)
6082         uint8_t valid;
6083         /*
6084          * This field is used in Output records to indicate that the
6085          * output is completely written to RAM. This field should be
6086          * read as '1' to indicate that the output has been completely
6087          * written. When writing a command completion or response to an
6088          * internal processor, the order of writes has to be such that
6089          * this field is written last.
6090          */
6091 } __attribute__((packed));
6092
6093 /* hwrm_vnic_alloc */
6094 /*
6095  * Description: This VNIC is a resource in the RX side of the chip that is used
6096  * to represent a virtual host "interface". # At the time of VNIC allocation or
6097  * configuration, the function can specify whether it wants the requested VNIC
6098  * to be the default VNIC for the function or not. # If a function requests
6099  * allocation of a VNIC for the first time and a VNIC is successfully allocated
6100  * by the HWRM, then the HWRM shall make the allocated VNIC as the default VNIC
6101  * for that function. # The default VNIC shall be used for the default action
6102  * for a partition or function. # For each VNIC allocated on a function, a
6103  * mapping on the RX side to map the allocated VNIC to source virtual interface
6104  * shall be performed by the HWRM. This should be hidden to the function driver
6105  * requesting the VNIC allocation. This enables broadcast/multicast replication
6106  * with source knockout. # If multicast replication with source knockout is
6107  * enabled, then the internal VNIC to SVIF mapping data structures shall be
6108  * programmed at the time of VNIC allocation.
6109  */
6110 /* Input        (24 bytes) */
6111 struct hwrm_vnic_alloc_input {
6112         uint16_t req_type;
6113         /*
6114          * This value indicates what type of request this is. The format
6115          * for the rest of the command is determined by this field.
6116          */
6117         uint16_t cmpl_ring;
6118         /*
6119          * This value indicates the what completion ring the request
6120          * will be optionally completed on. If the value is -1, then no
6121          * CR completion will be generated. Any other value must be a
6122          * valid CR ring_id value for this function.
6123          */
6124         uint16_t seq_id;
6125         /* This value indicates the command sequence number. */
6126         uint16_t target_id;
6127         /*
6128          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
6129          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
6130          * - HWRM
6131          */
6132         uint64_t resp_addr;
6133         /*
6134          * This is the host address where the response will be written
6135          * when the request is complete. This area must be 16B aligned
6136          * and must be cleared to zero before the request is made.
6137          */
6138         uint32_t flags;
6139         /*
6140          * When this bit is '1', this VNIC is requested to be the
6141          * default VNIC for this function.
6142          */
6143         #define HWRM_VNIC_ALLOC_INPUT_FLAGS_DEFAULT     UINT32_C(0x1)
6144         uint32_t unused_0;
6145 } __attribute__((packed));
6146
6147 /* Output       (16 bytes) */
6148 struct hwrm_vnic_alloc_output {
6149         uint16_t error_code;
6150         /*
6151          * Pass/Fail or error type Note: receiver to verify the in
6152          * parameters, and fail the call with an error when appropriate
6153          */
6154         uint16_t req_type;
6155         /* This field returns the type of original request. */
6156         uint16_t seq_id;
6157         /* This field provides original sequence number of the command. */
6158         uint16_t resp_len;
6159         /*
6160          * This field is the length of the response in bytes. The last
6161          * byte of the response is a valid flag that will read as '1'
6162          * when the command has been completely written to memory.
6163          */
6164         uint32_t vnic_id;
6165         /* Logical vnic ID */
6166         uint8_t unused_0;
6167         uint8_t unused_1;
6168         uint8_t unused_2;
6169         uint8_t valid;
6170         /*
6171          * This field is used in Output records to indicate that the
6172          * output is completely written to RAM. This field should be
6173          * read as '1' to indicate that the output has been completely
6174          * written. When writing a command completion or response to an
6175          * internal processor, the order of writes has to be such that
6176          * this field is written last.
6177          */
6178 } __attribute__((packed));
6179
6180 /* hwrm_vnic_free */
6181 /*
6182  * Description: Free a VNIC resource. Idle any resources associated with the
6183  * VNIC as well as the VNIC. Reset and release all resources associated with the
6184  * VNIC.
6185  */
6186 /* Input        (24 bytes) */
6187 struct hwrm_vnic_free_input {
6188         uint16_t req_type;
6189         /*
6190          * This value indicates what type of request this is. The format
6191          * for the rest of the command is determined by this field.
6192          */
6193         uint16_t cmpl_ring;
6194         /*
6195          * This value indicates the what completion ring the request
6196          * will be optionally completed on. If the value is -1, then no
6197          * CR completion will be generated. Any other value must be a
6198          * valid CR ring_id value for this function.
6199          */
6200         uint16_t seq_id;
6201         /* This value indicates the command sequence number. */
6202         uint16_t target_id;
6203         /*
6204          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
6205          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
6206          * - HWRM
6207          */
6208         uint64_t resp_addr;
6209         /*
6210          * This is the host address where the response will be written
6211          * when the request is complete. This area must be 16B aligned
6212          * and must be cleared to zero before the request is made.
6213          */
6214         uint32_t vnic_id;
6215         /* Logical vnic ID */
6216         uint32_t unused_0;
6217 } __attribute__((packed));
6218
6219 /* Output       (16 bytes) */
6220 struct hwrm_vnic_free_output {
6221         uint16_t error_code;
6222         /*
6223          * Pass/Fail or error type Note: receiver to verify the in
6224          * parameters, and fail the call with an error when appropriate
6225          */
6226         uint16_t req_type;
6227         /* This field returns the type of original request. */
6228         uint16_t seq_id;
6229         /* This field provides original sequence number of the command. */
6230         uint16_t resp_len;
6231         /*
6232          * This field is the length of the response in bytes. The last
6233          * byte of the response is a valid flag that will read as '1'
6234          * when the command has been completely written to memory.
6235          */
6236         uint32_t unused_0;
6237         uint8_t unused_1;
6238         uint8_t unused_2;
6239         uint8_t unused_3;
6240         uint8_t valid;
6241         /*
6242          * This field is used in Output records to indicate that the
6243          * output is completely written to RAM. This field should be
6244          * read as '1' to indicate that the output has been completely
6245          * written. When writing a command completion or response to an
6246          * internal processor, the order of writes has to be such that
6247          * this field is written last.
6248          */
6249 } __attribute__((packed));
6250
6251 /* hwrm_vnic_cfg */
6252 /* Description: Configure the RX VNIC structure. */
6253 /* Input        (40 bytes) */
6254 struct hwrm_vnic_cfg_input {
6255         uint16_t req_type;
6256         /*
6257          * This value indicates what type of request this is. The format
6258          * for the rest of the command is determined by this field.
6259          */
6260         uint16_t cmpl_ring;
6261         /*
6262          * This value indicates the what completion ring the request
6263          * will be optionally completed on. If the value is -1, then no
6264          * CR completion will be generated. Any other value must be a
6265          * valid CR ring_id value for this function.
6266          */
6267         uint16_t seq_id;
6268         /* This value indicates the command sequence number. */
6269         uint16_t target_id;
6270         /*
6271          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
6272          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
6273          * - HWRM
6274          */
6275         uint64_t resp_addr;
6276         /*
6277          * This is the host address where the response will be written
6278          * when the request is complete. This area must be 16B aligned
6279          * and must be cleared to zero before the request is made.
6280          */
6281         uint32_t flags;
6282         /*
6283          * When this bit is '1', the VNIC is requested to be the default
6284          * VNIC for the function.
6285          */
6286         #define HWRM_VNIC_CFG_INPUT_FLAGS_DEFAULT       UINT32_C(0x1)
6287         /*
6288          * When this bit is '1', the VNIC is being configured to strip
6289          * VLAN in the RX path. If set to '0', then VLAN stripping is
6290          * disabled on this VNIC.
6291          */
6292         #define HWRM_VNIC_CFG_INPUT_FLAGS_VLAN_STRIP_MODE       UINT32_C(0x2)
6293         /*
6294          * When this bit is '1', the VNIC is being configured to buffer
6295          * receive packets in the hardware until the host posts new
6296          * receive buffers. If set to '0', then bd_stall is being
6297          * configured to be disabled on this VNIC.
6298          */
6299         #define HWRM_VNIC_CFG_INPUT_FLAGS_BD_STALL_MODE UINT32_C(0x4)
6300         /*
6301          * When this bit is '1', the VNIC is being configured to receive
6302          * both RoCE and non-RoCE traffic. If set to '0', then this VNIC
6303          * is not configured to be operating in dual VNIC mode.
6304          */
6305         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_DUAL_VNIC_MODE   UINT32_C(0x8)
6306         /*
6307          * When this flag is set to '1', the VNIC is requested to be
6308          * configured to receive only RoCE traffic. If this flag is set
6309          * to '0', then this flag shall be ignored by the HWRM. If
6310          * roce_dual_vnic_mode flag is set to '1', then the HWRM client
6311          * shall not set this flag to '1'.
6312          */
6313         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_ONLY_VNIC_MODE UINT32_C(0x10)
6314         /*
6315          * When a VNIC uses one destination ring group for certain
6316          * application  (e.g. Receive Flow Steering) where exact match is
6317          * used to direct packets to a VNIC with one destination ring
6318          * group only, there is no need to configure RSS indirection
6319          * table for that VNIC as only one destination ring group is
6320          * used. This flag is used to enable a mode where RSS is enabled
6321          * in the VNIC using a RSS context for computing RSS hash but
6322          * the RSS indirection table is not configured using
6323          * hwrm_vnic_rss_cfg. If this mode is enabled, then the driver
6324          * should not program RSS indirection table for the RSS context
6325          * that is used for computing RSS hash only.
6326          */
6327         #define HWRM_VNIC_CFG_INPUT_FLAGS_RSS_DFLT_CR_MODE      UINT32_C(0x20)
6328         uint32_t enables;
6329         /*
6330          * This bit must be '1' for the dflt_ring_grp field to be
6331          * configured.
6332          */
6333         #define HWRM_VNIC_CFG_INPUT_ENABLES_DFLT_RING_GRP       UINT32_C(0x1)
6334         /* This bit must be '1' for the rss_rule field to be configured. */
6335         #define HWRM_VNIC_CFG_INPUT_ENABLES_RSS_RULE    UINT32_C(0x2)
6336         /* This bit must be '1' for the cos_rule field to be configured. */
6337         #define HWRM_VNIC_CFG_INPUT_ENABLES_COS_RULE    UINT32_C(0x4)
6338         /* This bit must be '1' for the lb_rule field to be configured. */
6339         #define HWRM_VNIC_CFG_INPUT_ENABLES_LB_RULE     UINT32_C(0x8)
6340         /* This bit must be '1' for the mru field to be configured. */
6341         #define HWRM_VNIC_CFG_INPUT_ENABLES_MRU UINT32_C(0x10)
6342         uint16_t vnic_id;
6343         /* Logical vnic ID */
6344         uint16_t dflt_ring_grp;
6345         /*
6346          * Default Completion ring for the VNIC. This ring will be
6347          * chosen if packet does not match any RSS rules and if there is
6348          * no COS rule.
6349          */
6350         uint16_t rss_rule;
6351         /*
6352          * RSS ID for RSS rule/table structure. 0xFF... (All Fs) if
6353          * there is no RSS rule.
6354          */
6355         uint16_t cos_rule;
6356         /*
6357          * RSS ID for COS rule/table structure. 0xFF... (All Fs) if
6358          * there is no COS rule.
6359          */
6360         uint16_t lb_rule;
6361         /*
6362          * RSS ID for load balancing rule/table structure. 0xFF...      (All
6363          * Fs) if there is no LB rule.
6364          */
6365         uint16_t mru;
6366         /*
6367          * The maximum receive unit of the vnic. Each vnic is associated
6368          * with a function. The vnic mru value overwrites the mru
6369          * setting of the associated function. The HWRM shall make sure
6370          * that vnic mru does not exceed the mru of the port the
6371          * function is associated with.
6372          */
6373         uint32_t unused_0;
6374 } __attribute__((packed));
6375
6376 /* Output       (16 bytes) */
6377 struct hwrm_vnic_cfg_output {
6378         uint16_t error_code;
6379         /*
6380          * Pass/Fail or error type Note: receiver to verify the in
6381          * parameters, and fail the call with an error when appropriate
6382          */
6383         uint16_t req_type;
6384         /* This field returns the type of original request. */
6385         uint16_t seq_id;
6386         /* This field provides original sequence number of the command. */
6387         uint16_t resp_len;
6388         /*
6389          * This field is the length of the response in bytes. The last
6390          * byte of the response is a valid flag that will read as '1'
6391          * when the command has been completely written to memory.
6392          */
6393         uint32_t unused_0;
6394         uint8_t unused_1;
6395         uint8_t unused_2;
6396         uint8_t unused_3;
6397         uint8_t valid;
6398         /*
6399          * This field is used in Output records to indicate that the
6400          * output is completely written to RAM. This field should be
6401          * read as '1' to indicate that the output has been completely
6402          * written. When writing a command completion or response to an
6403          * internal processor, the order of writes has to be such that
6404          * this field is written last.
6405          */
6406 } __attribute__((packed));
6407
6408 /* hwrm_vnic_qcfg */
6409 /*
6410  * Description: Query the RX VNIC structure. This function can be used by a PF
6411  * driver to query its own VNIC resource or VNIC resource of its child VF. This
6412  * function can also be used by a VF driver to query its own VNIC resource.
6413  */
6414 /* Input        (32 bytes) */
6415 struct hwrm_vnic_qcfg_input {
6416         uint16_t req_type;
6417         /*
6418          * This value indicates what type of request this is. The format
6419          * for the rest of the command is determined by this field.
6420          */
6421         uint16_t cmpl_ring;
6422         /*
6423          * This value indicates the what completion ring the request
6424          * will be optionally completed on. If the value is -1, then no
6425          * CR completion will be generated. Any other value must be a
6426          * valid CR ring_id value for this function.
6427          */
6428         uint16_t seq_id;
6429         /* This value indicates the command sequence number. */
6430         uint16_t target_id;
6431         /*
6432          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
6433          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
6434          * - HWRM
6435          */
6436         uint64_t resp_addr;
6437         /*
6438          * This is the host address where the response will be written
6439          * when the request is complete. This area must be 16B aligned
6440          * and must be cleared to zero before the request is made.
6441          */
6442         uint32_t enables;
6443         /* This bit must be '1' for the vf_id_valid field to be configured. */
6444         #define HWRM_VNIC_QCFG_INPUT_ENABLES_VF_ID_VALID        UINT32_C(0x1)
6445         uint32_t vnic_id;
6446         /* Logical vnic ID */
6447         uint16_t vf_id;
6448         /* ID of Virtual Function whose VNIC resource is being queried. */
6449         uint16_t unused_0[3];
6450 } __attribute__((packed));
6451
6452 /* Output       (32 bytes) */
6453 struct hwrm_vnic_qcfg_output {
6454         uint16_t error_code;
6455         /*
6456          * Pass/Fail or error type Note: receiver to verify the in
6457          * parameters, and fail the call with an error when appropriate
6458          */
6459         uint16_t req_type;
6460         /* This field returns the type of original request. */
6461         uint16_t seq_id;
6462         /* This field provides original sequence number of the command. */
6463         uint16_t resp_len;
6464         /*
6465          * This field is the length of the response in bytes. The last
6466          * byte of the response is a valid flag that will read as '1'
6467          * when the command has been completely written to memory.
6468          */
6469         uint16_t dflt_ring_grp;
6470         /* Default Completion ring for the VNIC. */
6471         uint16_t rss_rule;
6472         /*
6473          * RSS ID for RSS rule/table structure. 0xFF... (All Fs) if
6474          * there is no RSS rule.
6475          */
6476         uint16_t cos_rule;
6477         /*
6478          * RSS ID for COS rule/table structure. 0xFF... (All Fs) if
6479          * there is no COS rule.
6480          */
6481         uint16_t lb_rule;
6482         /*
6483          * RSS ID for load balancing rule/table structure. 0xFF...      (All
6484          * Fs) if there is no LB rule.
6485          */
6486         uint16_t mru;
6487         /* The maximum receive unit of the vnic. */
6488         uint8_t unused_0;
6489         uint8_t unused_1;
6490         uint32_t flags;
6491         /*
6492          * When this bit is '1', the VNIC is the default VNIC for the
6493          * function.
6494          */
6495         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_DEFAULT     UINT32_C(0x1)
6496         /*
6497          * When this bit is '1', the VNIC is configured to strip VLAN in
6498          * the RX path. If set to '0', then VLAN stripping is disabled
6499          * on this VNIC.
6500          */
6501         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_VLAN_STRIP_MODE     UINT32_C(0x2)
6502         /*
6503          * When this bit is '1', the VNIC is configured to buffer
6504          * receive packets in the hardware until the host posts new
6505          * receive buffers. If set to '0', then bd_stall is disabled on
6506          * this VNIC.
6507          */
6508         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_BD_STALL_MODE       UINT32_C(0x4)
6509         /*
6510          * When this bit is '1', the VNIC is configured to receive both
6511          * RoCE and non-RoCE traffic. If set to '0', then this VNIC is
6512          * not configured to operate in dual VNIC mode.
6513          */
6514         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_ROCE_DUAL_VNIC_MODE UINT32_C(0x8)
6515         /*
6516          * When this flag is set to '1', the VNIC is configured to
6517          * receive only RoCE traffic. When this flag is set to '0', the
6518          * VNIC is not configured to receive only RoCE traffic. If
6519          * roce_dual_vnic_mode flag and this flag both are set to '1',
6520          * then it is an invalid configuration of the VNIC. The HWRM
6521          * should not allow that type of mis-configuration by HWRM
6522          * clients.
6523          */
6524         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_ROCE_ONLY_VNIC_MODE UINT32_C(0x10)
6525         /*
6526          * When a VNIC uses one destination ring group for certain
6527          * application  (e.g. Receive Flow Steering) where exact match is
6528          * used to direct packets to a VNIC with one destination ring
6529          * group only, there is no need to configure RSS indirection
6530          * table for that VNIC as only one destination ring group is
6531          * used. When this bit is set to '1', then the VNIC is enabled
6532          * in a mode where RSS is enabled in the VNIC using a RSS
6533          * context for computing RSS hash but the RSS indirection table
6534          * is not configured.
6535          */
6536         #define HWRM_VNIC_QCFG_OUTPUT_FLAGS_RSS_DFLT_CR_MODE    UINT32_C(0x20)
6537         uint32_t unused_2;
6538         uint8_t unused_3;
6539         uint8_t unused_4;
6540         uint8_t unused_5;
6541         uint8_t valid;
6542         /*
6543          * This field is used in Output records to indicate that the
6544          * output is completely written to RAM. This field should be
6545          * read as '1' to indicate that the output has been completely
6546          * written. When writing a command completion or response to an
6547          * internal processor, the order of writes has to be such that
6548          * this field is written last.
6549          */
6550 } __attribute__((packed));
6551
6552 /* hwrm_vnic_rss_cfg */
6553 /* Description: This function is used to enable RSS configuration. */
6554 /* Input        (48 bytes) */
6555 struct hwrm_vnic_rss_cfg_input {
6556         uint16_t req_type;
6557         /*
6558          * This value indicates what type of request this is. The format
6559          * for the rest of the command is determined by this field.
6560          */
6561         uint16_t cmpl_ring;
6562         /*
6563          * This value indicates the what completion ring the request
6564          * will be optionally completed on. If the value is -1, then no
6565          * CR completion will be generated. Any other value must be a
6566          * valid CR ring_id value for this function.
6567          */
6568         uint16_t seq_id;
6569         /* This value indicates the command sequence number. */
6570         uint16_t target_id;
6571         /*
6572          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
6573          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
6574          * - HWRM
6575          */
6576         uint64_t resp_addr;
6577         /*
6578          * This is the host address where the response will be written
6579          * when the request is complete. This area must be 16B aligned
6580          * and must be cleared to zero before the request is made.
6581          */
6582         uint32_t hash_type;
6583         /*
6584          * When this bit is '1', the RSS hash shall be computed over
6585          * source and destination IPv4 addresses of IPv4 packets.
6586          */
6587         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4  UINT32_C(0x1)
6588         /*
6589          * When this bit is '1', the RSS hash shall be computed over
6590          * source/destination IPv4 addresses and source/destination
6591          * ports of TCP/IPv4 packets.
6592          */
6593         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV4      UINT32_C(0x2)
6594         /*
6595          * When this bit is '1', the RSS hash shall be computed over
6596          * source/destination IPv4 addresses and source/destination
6597          * ports of UDP/IPv4 packets.
6598          */
6599         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV4      UINT32_C(0x4)
6600         /*
6601          * When this bit is '1', the RSS hash shall be computed over
6602          * source and destination IPv4 addresses of IPv6 packets.
6603          */
6604         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV6  UINT32_C(0x8)
6605         /*
6606          * When this bit is '1', the RSS hash shall be computed over
6607          * source/destination IPv6 addresses and source/destination
6608          * ports of TCP/IPv6 packets.
6609          */
6610         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV6      UINT32_C(0x10)
6611         /*
6612          * When this bit is '1', the RSS hash shall be computed over
6613          * source/destination IPv6 addresses and source/destination
6614          * ports of UDP/IPv6 packets.
6615          */
6616         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV6      UINT32_C(0x20)
6617         uint32_t unused_0;
6618         uint64_t ring_grp_tbl_addr;
6619         /* This is the address for rss ring group table */
6620         uint64_t hash_key_tbl_addr;
6621         /* This is the address for rss hash key table */
6622         uint16_t rss_ctx_idx;
6623         /* Index to the rss indirection table. */
6624         uint16_t unused_1[3];
6625 } __attribute__((packed));
6626
6627 /* Output       (16 bytes) */
6628 struct hwrm_vnic_rss_cfg_output {
6629         uint16_t error_code;
6630         /*
6631          * Pass/Fail or error type Note: receiver to verify the in
6632          * parameters, and fail the call with an error when appropriate
6633          */
6634         uint16_t req_type;
6635         /* This field returns the type of original request. */
6636         uint16_t seq_id;
6637         /* This field provides original sequence number of the command. */
6638         uint16_t resp_len;
6639         /*
6640          * This field is the length of the response in bytes. The last
6641          * byte of the response is a valid flag that will read as '1'
6642          * when the command has been completely written to memory.
6643          */
6644         uint32_t unused_0;
6645         uint8_t unused_1;
6646         uint8_t unused_2;
6647         uint8_t unused_3;
6648         uint8_t valid;
6649         /*
6650          * This field is used in Output records to indicate that the
6651          * output is completely written to RAM. This field should be
6652          * read as '1' to indicate that the output has been completely
6653          * written. When writing a command completion or response to an
6654          * internal processor, the order of writes has to be such that
6655          * this field is written last.
6656          */
6657 } __attribute__((packed));
6658
6659 /* hwrm_vnic_plcmodes_cfg */
6660 /*
6661  * Description: This function can be used to set placement mode configuration of
6662  * the VNIC.
6663  */
6664 /* Input (40 bytes) */
6665
6666 struct hwrm_vnic_plcmodes_cfg_input {
6667         uint16_t req_type;
6668         /*
6669          * This value indicates what type of request this is. The format for the
6670          * rest of the command is determined by this field.
6671          */
6672         uint16_t cmpl_ring;
6673         /*
6674          * This value indicates the what completion ring the request will be
6675          * optionally completed on. If the value is -1, then no CR completion
6676          * will be generated. Any other value must be a valid CR ring_id value
6677          * for this function.
6678          */
6679         uint16_t seq_id;
6680         /* This value indicates the command sequence number. */
6681         uint16_t target_id;
6682         /*
6683          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
6684          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
6685          */
6686         uint64_t resp_addr;
6687         /*
6688          * This is the host address where the response will be written when the
6689          * request is complete. This area must be 16B aligned and must be
6690          * cleared to zero before the request is made.
6691          */
6692         uint32_t flags;
6693         /*
6694          * When this bit is '1', the VNIC shall be configured to use regular
6695          * placement algorithm. By default, the regular placement algorithm
6696          * shall be enabled on the VNIC.
6697          */
6698         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_REGULAR_PLACEMENT \
6699                 UINT32_C(0x1)
6700         /*
6701          * When this bit is '1', the VNIC shall be configured use the jumbo
6702          * placement algorithm.
6703          */
6704         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_JUMBO_PLACEMENT \
6705                 UINT32_C(0x2)
6706         /*
6707          * When this bit is '1', the VNIC shall be configured to enable Header-
6708          * Data split for IPv4 packets according to the following rules: # If
6709          * the packet is identified as TCP/IPv4, then the packet is split at the
6710          * beginning of the TCP payload. # If the packet is identified as
6711          * UDP/IPv4, then the packet is split at the beginning of UDP payload. #
6712          * If the packet is identified as non-TCP and non-UDP IPv4 packet, then
6713          * the packet is split at the beginning of the upper layer protocol
6714          * header carried in the IPv4 packet.
6715          */
6716         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV4        UINT32_C(0x4)
6717         /*
6718          * When this bit is '1', the VNIC shall be configured to enable Header-
6719          * Data split for IPv6 packets according to the following rules: # If
6720          * the packet is identified as TCP/IPv6, then the packet is split at the
6721          * beginning of the TCP payload. # If the packet is identified as
6722          * UDP/IPv6, then the packet is split at the beginning of UDP payload. #
6723          * If the packet is identified as non-TCP and non-UDP IPv6 packet, then
6724          * the packet is split at the beginning of the upper layer protocol
6725          * header carried in the IPv6 packet.
6726          */
6727         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_IPV6        UINT32_C(0x8)
6728         /*
6729          * When this bit is '1', the VNIC shall be configured to enable Header-
6730          * Data split for FCoE packets at the beginning of FC payload.
6731          */
6732         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_FCOE       UINT32_C(0x10)
6733         /*
6734          * When this bit is '1', the VNIC shall be configured to enable Header-
6735          * Data split for RoCE packets at the beginning of RoCE payload (after
6736          * BTH/GRH headers).
6737          */
6738         #define HWRM_VNIC_PLCMODES_CFG_INPUT_FLAGS_HDS_ROCE       UINT32_C(0x20)
6739         uint32_t enables;
6740         /*
6741          * This bit must be '1' for the jumbo_thresh_valid field to be
6742          * configured.
6743          */
6744         #define HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_JUMBO_THRESH_VALID \
6745                 UINT32_C(0x1)
6746         /*
6747          * This bit must be '1' for the hds_offset_valid field to be configured.
6748          */
6749         #define HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_HDS_OFFSET_VALID \
6750                 UINT32_C(0x2)
6751         /*
6752          * This bit must be '1' for the hds_threshold_valid field to be
6753          * configured.
6754          */
6755         #define HWRM_VNIC_PLCMODES_CFG_INPUT_ENABLES_HDS_THRESHOLD_VALID \
6756                 UINT32_C(0x4)
6757         uint32_t vnic_id;
6758         /* Logical vnic ID */
6759         uint16_t jumbo_thresh;
6760         /*
6761          * When jumbo placement algorithm is enabled, this value is used to
6762          * determine the threshold for jumbo placement. Packets with length
6763          * larger than this value will be placed according to the jumbo
6764          * placement algorithm.
6765          */
6766         uint16_t hds_offset;
6767         /*
6768          * This value is used to determine the offset into packet buffer where
6769          * the split data (payload) will be placed according to one of of HDS
6770          * placement algorithm. The lengths of packet buffers provided for split
6771          * data shall be larger than this value.
6772          */
6773         uint16_t hds_threshold;
6774         /*
6775          * When one of the HDS placement algorithm is enabled, this value is
6776          * used to determine the threshold for HDS placement. Packets with
6777          * length larger than this value will be placed according to the HDS
6778          * placement algorithm. This value shall be in multiple of 4 bytes.
6779          */
6780         uint16_t unused_0[3];
6781 } __attribute__((packed));
6782
6783 /* Output (16 bytes) */
6784
6785 struct hwrm_vnic_plcmodes_cfg_output {
6786         uint16_t error_code;
6787         /*
6788          * Pass/Fail or error type Note: receiver to verify the in parameters,
6789          * and fail the call with an error when appropriate
6790          */
6791         uint16_t req_type;
6792         /* This field returns the type of original request. */
6793         uint16_t seq_id;
6794         /* This field provides original sequence number of the command. */
6795         uint16_t resp_len;
6796         /*
6797          * This field is the length of the response in bytes. The last byte of
6798          * the response is a valid flag that will read as '1' when the command
6799          * has been completely written to memory.
6800          */
6801         uint32_t unused_0;
6802         uint8_t unused_1;
6803         uint8_t unused_2;
6804         uint8_t unused_3;
6805         uint8_t valid;
6806         /*
6807          * This field is used in Output records to indicate that the output is
6808          * completely written to RAM. This field should be read as '1' to
6809          * indicate that the output has been completely written. When writing a
6810          * command completion or response to an internal processor, the order of
6811          * writes has to be such that this field is written last.
6812          */
6813 } __attribute__((packed));
6814
6815 /* hwrm_vnic_plcmodes_qcfg */
6816 /*
6817  * Description: This function can be used to query placement mode configuration
6818  * of the VNIC.
6819  */
6820 /* Input (24 bytes) */
6821
6822 struct hwrm_vnic_plcmodes_qcfg_input {
6823         uint16_t req_type;
6824         /*
6825          * This value indicates what type of request this is. The format for the
6826          * rest of the command is determined by this field.
6827          */
6828         uint16_t cmpl_ring;
6829         /*
6830          * This value indicates the what completion ring the request will be
6831          * optionally completed on. If the value is -1, then no CR completion
6832          * will be generated. Any other value must be a valid CR ring_id value
6833          * for this function.
6834          */
6835         uint16_t seq_id;
6836         /* This value indicates the command sequence number. */
6837         uint16_t target_id;
6838         /*
6839          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
6840          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
6841          */
6842         uint64_t resp_addr;
6843         /*
6844          * This is the host address where the response will be written when the
6845          * request is complete. This area must be 16B aligned and must be
6846          * cleared to zero before the request is made.
6847          */
6848         uint32_t vnic_id;
6849         /* Logical vnic ID */
6850         uint32_t unused_0;
6851 } __attribute__((packed));
6852
6853 /* Output (24 bytes) */
6854
6855 struct hwrm_vnic_plcmodes_qcfg_output {
6856         uint16_t error_code;
6857         /*
6858          * Pass/Fail or error type Note: receiver to verify the in parameters,
6859          * and fail the call with an error when appropriate
6860          */
6861         uint16_t req_type;
6862         /* This field returns the type of original request. */
6863         uint16_t seq_id;
6864         /* This field provides original sequence number of the command. */
6865         uint16_t resp_len;
6866         /*
6867          * This field is the length of the response in bytes. The last byte of
6868          * the response is a valid flag that will read as '1' when the command
6869          * has been completely written to memory.
6870          */
6871         uint32_t flags;
6872         /*
6873          * When this bit is '1', the VNIC is configured to use regular placement
6874          * algorithm.
6875          */
6876         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_REGULAR_PLACEMENT \
6877                 UINT32_C(0x1)
6878         /*
6879          * When this bit is '1', the VNIC is configured to use the jumbo
6880          * placement algorithm.
6881          */
6882         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_JUMBO_PLACEMENT \
6883                 UINT32_C(0x2)
6884         /*
6885          * When this bit is '1', the VNIC is configured to enable Header-Data
6886          * split for IPv4 packets.
6887          */
6888         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_IPV4      UINT32_C(0x4)
6889         /*
6890          * When this bit is '1', the VNIC is configured to enable Header-Data
6891          * split for IPv6 packets.
6892          */
6893         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_IPV6      UINT32_C(0x8)
6894         /*
6895          * When this bit is '1', the VNIC is configured to enable Header-Data
6896          * split for FCoE packets.
6897          */
6898         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_FCOE     UINT32_C(0x10)
6899         /*
6900          * When this bit is '1', the VNIC is configured to enable Header-Data
6901          * split for RoCE packets.
6902          */
6903         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_HDS_ROCE     UINT32_C(0x20)
6904         /*
6905          * When this bit is '1', the VNIC is configured to be the default VNIC
6906          * of the requesting function.
6907          */
6908         #define HWRM_VNIC_PLCMODES_QCFG_OUTPUT_FLAGS_DFLT_VNIC    UINT32_C(0x40)
6909         uint16_t jumbo_thresh;
6910         /*
6911          * When jumbo placement algorithm is enabled, this value is used to
6912          * determine the threshold for jumbo placement. Packets with length
6913          * larger than this value will be placed according to the jumbo
6914          * placement algorithm.
6915          */
6916         uint16_t hds_offset;
6917         /*
6918          * This value is used to determine the offset into packet buffer where
6919          * the split data (payload) will be placed according to one of of HDS
6920          * placement algorithm. The lengths of packet buffers provided for split
6921          * data shall be larger than this value.
6922          */
6923         uint16_t hds_threshold;
6924         /*
6925          * When one of the HDS placement algorithm is enabled, this value is
6926          * used to determine the threshold for HDS placement. Packets with
6927          * length larger than this value will be placed according to the HDS
6928          * placement algorithm. This value shall be in multiple of 4 bytes.
6929          */
6930         uint8_t unused_0;
6931         uint8_t unused_1;
6932         uint8_t unused_2;
6933         uint8_t unused_3;
6934         uint8_t unused_4;
6935         uint8_t valid;
6936         /*
6937          * This field is used in Output records to indicate that the output is
6938          * completely written to RAM. This field should be read as '1' to
6939          * indicate that the output has been completely written. When writing a
6940          * command completion or response to an internal processor, the order of
6941          * writes has to be such that this field is written last.
6942          */
6943 } __attribute__((packed));
6944
6945 /* hwrm_vnic_rss_cos_lb_ctx_alloc */
6946 /* Description: This function is used to allocate COS/Load Balance context. */
6947 /* Input        (16 bytes) */
6948 struct hwrm_vnic_rss_cos_lb_ctx_alloc_input {
6949         uint16_t req_type;
6950         /*
6951          * This value indicates what type of request this is. The format
6952          * for the rest of the command is determined by this field.
6953          */
6954         uint16_t cmpl_ring;
6955         /*
6956          * This value indicates the what completion ring the request
6957          * will be optionally completed on. If the value is -1, then no
6958          * CR completion will be generated. Any other value must be a
6959          * valid CR ring_id value for this function.
6960          */
6961         uint16_t seq_id;
6962         /* This value indicates the command sequence number. */
6963         uint16_t target_id;
6964         /*
6965          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
6966          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
6967          * - HWRM
6968          */
6969         uint64_t resp_addr;
6970         /*
6971          * This is the host address where the response will be written
6972          * when the request is complete. This area must be 16B aligned
6973          * and must be cleared to zero before the request is made.
6974          */
6975 } __attribute__((packed));
6976
6977 /* Output       (16 bytes) */
6978 struct hwrm_vnic_rss_cos_lb_ctx_alloc_output {
6979         uint16_t error_code;
6980         /*
6981          * Pass/Fail or error type Note: receiver to verify the in
6982          * parameters, and fail the call with an error when appropriate
6983          */
6984         uint16_t req_type;
6985         /* This field returns the type of original request. */
6986         uint16_t seq_id;
6987         /* This field provides original sequence number of the command. */
6988         uint16_t resp_len;
6989         /*
6990          * This field is the length of the response in bytes. The last
6991          * byte of the response is a valid flag that will read as '1'
6992          * when the command has been completely written to memory.
6993          */
6994         uint16_t rss_cos_lb_ctx_id;
6995         /* rss_cos_lb_ctx_id is 16 b */
6996         uint8_t unused_0;
6997         uint8_t unused_1;
6998         uint8_t unused_2;
6999         uint8_t unused_3;
7000         uint8_t unused_4;
7001         uint8_t valid;
7002         /*
7003          * This field is used in Output records to indicate that the
7004          * output is completely written to RAM. This field should be
7005          * read as '1' to indicate that the output has been completely
7006          * written. When writing a command completion or response to an
7007          * internal processor, the order of writes has to be such that
7008          * this field is written last.
7009          */
7010 } __attribute__((packed));
7011
7012 /* hwrm_vnic_rss_cos_lb_ctx_free */
7013 /* Description: This function can be used to free COS/Load Balance context. */
7014 /* Input        (24 bytes) */
7015 struct hwrm_vnic_rss_cos_lb_ctx_free_input {
7016         uint16_t req_type;
7017         /*
7018          * This value indicates what type of request this is. The format
7019          * for the rest of the command is determined by this field.
7020          */
7021         uint16_t cmpl_ring;
7022         /*
7023          * This value indicates the what completion ring the request
7024          * will be optionally completed on. If the value is -1, then no
7025          * CR completion will be generated. Any other value must be a
7026          * valid CR ring_id value for this function.
7027          */
7028         uint16_t seq_id;
7029         /* This value indicates the command sequence number. */
7030         uint16_t target_id;
7031         /*
7032          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7033          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7034          * - HWRM
7035          */
7036         uint64_t resp_addr;
7037         /*
7038          * This is the host address where the response will be written
7039          * when the request is complete. This area must be 16B aligned
7040          * and must be cleared to zero before the request is made.
7041          */
7042         uint16_t rss_cos_lb_ctx_id;
7043         /* rss_cos_lb_ctx_id is 16 b */
7044         uint16_t unused_0[3];
7045 } __attribute__((packed));
7046
7047 /* Output       (16 bytes) */
7048 struct hwrm_vnic_rss_cos_lb_ctx_free_output {
7049         uint16_t error_code;
7050         /*
7051          * Pass/Fail or error type Note: receiver to verify the in
7052          * parameters, and fail the call with an error when appropriate
7053          */
7054         uint16_t req_type;
7055         /* This field returns the type of original request. */
7056         uint16_t seq_id;
7057         /* This field provides original sequence number of the command. */
7058         uint16_t resp_len;
7059         /*
7060          * This field is the length of the response in bytes. The last
7061          * byte of the response is a valid flag that will read as '1'
7062          * when the command has been completely written to memory.
7063          */
7064         uint32_t unused_0;
7065         uint8_t unused_1;
7066         uint8_t unused_2;
7067         uint8_t unused_3;
7068         uint8_t valid;
7069         /*
7070          * This field is used in Output records to indicate that the
7071          * output is completely written to RAM. This field should be
7072          * read as '1' to indicate that the output has been completely
7073          * written. When writing a command completion or response to an
7074          * internal processor, the order of writes has to be such that
7075          * this field is written last.
7076          */
7077 } __attribute__((packed));
7078
7079 /* hwrm_vnic_tpa_cfg */
7080 /* Description: This function is used to enable/configure TPA on the VNIC. */
7081 /* Input        (40 bytes) */
7082 struct hwrm_vnic_tpa_cfg_input {
7083         uint16_t req_type;
7084         /*
7085          * This value indicates what type of request this is. The format
7086          * for the rest of the command is determined by this field.
7087          */
7088         uint16_t cmpl_ring;
7089         /*
7090          * This value indicates the what completion ring the request
7091          * will be optionally completed on. If the value is -1, then no
7092          * CR completion will be generated. Any other value must be a
7093          * valid CR ring_id value for this function.
7094          */
7095         uint16_t seq_id;
7096         /* This value indicates the command sequence number. */
7097         uint16_t target_id;
7098         /*
7099          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7100          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7101          * - HWRM
7102          */
7103         uint64_t resp_addr;
7104         /*
7105          * This is the host address where the response will be written
7106          * when the request is complete. This area must be 16B aligned
7107          * and must be cleared to zero before the request is made.
7108          */
7109         uint32_t flags;
7110         /*
7111          * When this bit is '1', the VNIC shall be configured to perform
7112          * transparent packet aggregation       (TPA) of non-tunneled TCP
7113          * packets.
7114          */
7115         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_TPA       UINT32_C(0x1)
7116         /*
7117          * When this bit is '1', the VNIC shall be configured to perform
7118          * transparent packet aggregation       (TPA) of tunneled TCP packets.
7119          */
7120         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_ENCAP_TPA UINT32_C(0x2)
7121         /*
7122          * When this bit is '1', the VNIC shall be configured to perform
7123          * transparent packet aggregation       (TPA) according to Windows
7124          * Receive Segment Coalescing   (RSC) rules.
7125          */
7126         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_RSC_WND_UPDATE    UINT32_C(0x4)
7127         /*
7128          * When this bit is '1', the VNIC shall be configured to perform
7129          * transparent packet aggregation       (TPA) according to Linux
7130          * Generic Receive Offload      (GRO) rules.
7131          */
7132         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO       UINT32_C(0x8)
7133         /*
7134          * When this bit is '1', the VNIC shall be configured to perform
7135          * transparent packet aggregation       (TPA) for TCP packets with IP
7136          * ECN set to non-zero.
7137          */
7138         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_AGG_WITH_ECN      UINT32_C(0x10)
7139         /*
7140          * When this bit is '1', the VNIC shall be configured to perform
7141          * transparent packet aggregation       (TPA) for GRE tunneled TCP
7142          * packets only if all packets have the same GRE sequence.
7143          */
7144         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_AGG_WITH_SAME_GRE_SEQ     \
7145                 UINT32_C(0x20)
7146         /*
7147          * When this bit is '1' and the GRO mode is enabled, the VNIC
7148          * shall be configured to perform transparent packet aggregation
7149          *      (TPA) for TCP/IPv4 packets with consecutively increasing
7150          * IPIDs. In other words, the last packet that is being
7151          * aggregated to an already existing aggregation context shall
7152          * have IPID 1 more than the IPID of the last packet that was
7153          * aggregated in that aggregation context.
7154          */
7155         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO_IPID_CHECK    UINT32_C(0x40)
7156         /*
7157          * When this bit is '1' and the GRO mode is enabled, the VNIC
7158          * shall be configured to perform transparent packet aggregation
7159          *      (TPA) for TCP packets with the same TTL (IPv4) or Hop limit
7160          *      (IPv6) value.
7161          */
7162         #define HWRM_VNIC_TPA_CFG_INPUT_FLAGS_GRO_TTL_CHECK     UINT32_C(0x80)
7163         uint32_t enables;
7164         /* This bit must be '1' for the max_agg_segs field to be configured. */
7165         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGG_SEGS    UINT32_C(0x1)
7166         /* This bit must be '1' for the max_aggs field to be configured. */
7167         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGGS        UINT32_C(0x2)
7168         /*
7169          * This bit must be '1' for the max_agg_timer field to be
7170          * configured.
7171          */
7172         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MAX_AGG_TIMER   UINT32_C(0x4)
7173         /* This bit must be '1' for the min_agg_len field to be configured. */
7174         #define HWRM_VNIC_TPA_CFG_INPUT_ENABLES_MIN_AGG_LEN     UINT32_C(0x8)
7175         uint16_t vnic_id;
7176         /* Logical vnic ID */
7177         uint16_t max_agg_segs;
7178         /*
7179          * This is the maximum number of TCP segments that can be
7180          * aggregated   (unit is Log2). Max value is 31.
7181          */
7182         /* 1 segment */
7183         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_1  UINT32_C(0x0)
7184         /* 2 segments */
7185         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_2  UINT32_C(0x1)
7186         /* 4 segments */
7187         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_4  UINT32_C(0x2)
7188         /* 8 segments */
7189         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_8  UINT32_C(0x3)
7190         /* Any segment size larger than this is not valid */
7191         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGG_SEGS_MAX        UINT32_C(0x1f)
7192         uint16_t max_aggs;
7193         /*
7194          * This is the maximum number of aggregations this VNIC is
7195          * allowed      (unit is Log2). Max value is 7
7196          */
7197         /* 1 aggregation */
7198         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_1      UINT32_C(0x0)
7199         /* 2 aggregations */
7200         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_2      UINT32_C(0x1)
7201         /* 4 aggregations */
7202         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_4      UINT32_C(0x2)
7203         /* 8 aggregations */
7204         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_8      UINT32_C(0x3)
7205         /* 16 aggregations */
7206         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_16     UINT32_C(0x4)
7207         /* Any aggregation size larger than this is not valid */
7208         #define HWRM_VNIC_TPA_CFG_INPUT_MAX_AGGS_MAX    UINT32_C(0x7)
7209         uint8_t unused_0;
7210         uint8_t unused_1;
7211         uint32_t max_agg_timer;
7212         /*
7213          * This is the maximum amount of time allowed for an aggregation
7214          * context to complete after it was initiated.
7215          */
7216         uint32_t min_agg_len;
7217         /*
7218          * This is the minimum amount of payload length required to
7219          * start an aggregation context.
7220          */
7221 } __attribute__((packed));
7222
7223 /* Output       (16 bytes) */
7224 struct hwrm_vnic_tpa_cfg_output {
7225         uint16_t error_code;
7226         /*
7227          * Pass/Fail or error type Note: receiver to verify the in
7228          * parameters, and fail the call with an error when appropriate
7229          */
7230         uint16_t req_type;
7231         /* This field returns the type of original request. */
7232         uint16_t seq_id;
7233         /* This field provides original sequence number of the command. */
7234         uint16_t resp_len;
7235         /*
7236          * This field is the length of the response in bytes. The last
7237          * byte of the response is a valid flag that will read as '1'
7238          * when the command has been completely written to memory.
7239          */
7240         uint32_t unused_0;
7241         uint8_t unused_1;
7242         uint8_t unused_2;
7243         uint8_t unused_3;
7244         uint8_t valid;
7245         /*
7246          * This field is used in Output records to indicate that the
7247          * output is completely written to RAM. This field should be
7248          * read as '1' to indicate that the output has been completely
7249          * written. When writing a command completion or response to an
7250          * internal processor, the order of writes has to be such that
7251          * this field is written last.
7252          */
7253 } __attribute__((packed));
7254
7255 /* hwrm_ring_alloc */
7256 /*
7257  * Description: This command allocates and does basic preparation for a ring.
7258  */
7259 /* Input        (80 bytes) */
7260 struct hwrm_ring_alloc_input {
7261         uint16_t req_type;
7262         /*
7263          * This value indicates what type of request this is. The format
7264          * for the rest of the command is determined by this field.
7265          */
7266         uint16_t cmpl_ring;
7267         /*
7268          * This value indicates the what completion ring the request
7269          * will be optionally completed on. If the value is -1, then no
7270          * CR completion will be generated. Any other value must be a
7271          * valid CR ring_id value for this function.
7272          */
7273         uint16_t seq_id;
7274         /* This value indicates the command sequence number. */
7275         uint16_t target_id;
7276         /*
7277          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7278          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7279          * - HWRM
7280          */
7281         uint64_t resp_addr;
7282         /*
7283          * This is the host address where the response will be written
7284          * when the request is complete. This area must be 16B aligned
7285          * and must be cleared to zero before the request is made.
7286          */
7287         uint32_t enables;
7288         /* This bit must be '1' for the Reserved1 field to be configured. */
7289         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED1 UINT32_C(0x1)
7290         /* This bit must be '1' for the ring_arb_cfg field to be configured. */
7291         #define HWRM_RING_ALLOC_INPUT_ENABLES_RING_ARB_CFG      UINT32_C(0x2)
7292         /* This bit must be '1' for the Reserved3 field to be configured. */
7293         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED3 UINT32_C(0x4)
7294         /*
7295          * This bit must be '1' for the stat_ctx_id_valid field to be
7296          * configured.
7297          */
7298         #define HWRM_RING_ALLOC_INPUT_ENABLES_STAT_CTX_ID_VALID UINT32_C(0x8)
7299         /* This bit must be '1' for the Reserved4 field to be configured. */
7300         #define HWRM_RING_ALLOC_INPUT_ENABLES_RESERVED4 UINT32_C(0x10)
7301         /* This bit must be '1' for the max_bw_valid field to be configured. */
7302         #define HWRM_RING_ALLOC_INPUT_ENABLES_MAX_BW_VALID      UINT32_C(0x20)
7303         uint8_t ring_type;
7304         /* Ring Type. */
7305         /* L2 Completion Ring   (CR) */
7306         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL UINT32_C(0x0)
7307         /* TX Ring      (TR) */
7308         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_TX      UINT32_C(0x1)
7309         /* RX Ring      (RR) */
7310         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_RX      UINT32_C(0x2)
7311         /* RoCE Notification Completion Ring    (ROCE_CR) */
7312         #define HWRM_RING_ALLOC_INPUT_RING_TYPE_ROCE_CMPL       UINT32_C(0x3)
7313         uint8_t unused_0;
7314         uint16_t unused_1;
7315         uint64_t page_tbl_addr;
7316         /* This value is a pointer to the page table for the Ring. */
7317         uint32_t fbo;
7318         /* First Byte Offset of the first entry in the first page. */
7319         uint8_t page_size;
7320         /*
7321          * Actual page size in 2^page_size. The supported range is
7322          * increments in powers of 2 from 16 bytes to 1GB. - 4 = 16 B
7323          * Page size is 16 B. - 12 = 4 KB Page size is 4 KB. - 13 = 8 KB
7324          * Page size is 8 KB. - 16 = 64 KB Page size is 64 KB. - 21 = 2
7325          * MB Page size is 2 MB. - 22 = 4 MB Page size is 4 MB. - 30 = 1
7326          * GB Page size is 1 GB.
7327          */
7328         uint8_t page_tbl_depth;
7329         /*
7330          * This value indicates the depth of page table. For this
7331          * version of the specification, value other than 0 or 1 shall
7332          * be considered as an invalid value. When the page_tbl_depth =
7333          * 0, then it is treated as a special case with the following.
7334          * 1. FBO and page size fields are not valid. 2. page_tbl_addr
7335          * is the physical address of the first element of the ring.
7336          */
7337         uint8_t unused_2;
7338         uint8_t unused_3;
7339         uint32_t length;
7340         /*
7341          * Number of 16B units in the ring. Minimum size for a ring is
7342          * 16 16B entries.
7343          */
7344         uint16_t logical_id;
7345         /*
7346          * Logical ring number for the ring to be allocated. This value
7347          * determines the position in the doorbell area where the update
7348          * to the ring will be made. For completion rings, this value is
7349          * also the MSI-X vector number for the function the completion
7350          * ring is associated with.
7351          */
7352         uint16_t cmpl_ring_id;
7353         /*
7354          * This field is used only when ring_type is a TX ring. This
7355          * value indicates what completion ring the TX ring is
7356          * associated with.
7357          */
7358         uint16_t queue_id;
7359         /*
7360          * This field is used only when ring_type is a TX ring. This
7361          * value indicates what CoS queue the TX ring is associated
7362          * with.
7363          */
7364         uint8_t unused_4;
7365         uint8_t unused_5;
7366         uint32_t reserved1;
7367         /* This field is reserved for the future use. It shall be set to 0. */
7368         uint16_t ring_arb_cfg;
7369         /*
7370          * This field is used only when ring_type is a TX ring. This
7371          * field is used to configure arbitration related parameters for
7372          * a TX ring.
7373          */
7374         /* Arbitration policy used for the ring. */
7375         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_MASK UINT32_C(0xf)
7376         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_SFT       0
7377         /*
7378          * Use strict priority for the TX ring. Priority
7379          * value is specified in arb_policy_param
7380          */
7381         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_SP \
7382                 (UINT32_C(0x1) << 0)
7383         /*
7384          * Use weighted fair queue arbitration for the
7385          * TX ring. Weight is specified in
7386          * arb_policy_param
7387          */
7388         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_WFQ \
7389                 (UINT32_C(0x2) << 0)
7390         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_LAST \
7391                 RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_WFQ
7392         /* Reserved field. */
7393         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_RSVD_MASK    UINT32_C(0xf0)
7394         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_RSVD_SFT     4
7395         /*
7396          * Arbitration policy specific parameter. # For strict priority
7397          * arbitration policy, this field represents a priority value.
7398          * If set to 0, then the priority is not specified and the HWRM
7399          * is allowed to select any priority for this TX ring. # For
7400          * weighted fair queue arbitration policy, this field represents
7401          * a weight value. If set to 0, then the weight is not specified
7402          * and the HWRM is allowed to select any weight for this TX
7403          * ring.
7404          */
7405         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_PARAM_MASK  \
7406                 UINT32_C(0xff00)
7407         #define HWRM_RING_ALLOC_INPUT_RING_ARB_CFG_ARB_POLICY_PARAM_SFT 8
7408         uint8_t unused_6;
7409         uint8_t unused_7;
7410         uint32_t reserved3;
7411         /* This field is reserved for the future use. It shall be set to 0. */
7412         uint32_t stat_ctx_id;
7413         /*
7414          * This field is used only when ring_type is a TX ring. This
7415          * input indicates what statistics context this ring should be
7416          * associated with.
7417          */
7418         uint32_t reserved4;
7419         /* This field is reserved for the future use. It shall be set to 0. */
7420         uint32_t max_bw;
7421         /*
7422          * This field is used only when ring_type is a TX ring to
7423          * specify maximum BW allocated to the TX ring. The HWRM will
7424          * translate this value into byte counter and time interval used
7425          * for this ring inside the device.
7426          */
7427         /* The bandwidth value. */
7428         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_MASK UINT32_C(0xfffffff)
7429         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_SFT       0
7430         /* The granularity of the value (bits or bytes). */
7431         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE      UINT32_C(0x10000000)
7432         /* Value is in bits. */
7433         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE_BITS (UINT32_C(0x0) << 28)
7434         /* Value is in bytes. */
7435         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE_BYTES (UINT32_C(0x1) << 28)
7436         #define HWRM_RING_ALLOC_INPUT_MAX_BW_SCALE_LAST \
7437                 RING_ALLOC_INPUT_MAX_BW_SCALE_BYTES
7438         /* bw_value_unit is 3 b */
7439         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_MASK \
7440                 UINT32_C(0xe0000000)
7441         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_SFT  29
7442         /* Value is in Mb or MB (base 10). */
7443         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_MEGA \
7444                 (UINT32_C(0x0) << 29)
7445         /* Value is in Kb or KB (base 10). */
7446         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_KILO \
7447                 (UINT32_C(0x2) << 29)
7448         /* Value is in bits or bytes. */
7449         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_BASE \
7450                 (UINT32_C(0x4) << 29)
7451         /* Value is in Gb or GB (base 10). */
7452         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_GIGA \
7453                 (UINT32_C(0x6) << 29)
7454         /* Value is in 1/100th of a percentage of total bandwidth. */
7455         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_PERCENT1_100 \
7456                 (UINT32_C(0x1) << 29)
7457         /* Invalid unit */
7458         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_INVALID \
7459                 (UINT32_C(0x7) << 29)
7460         #define HWRM_RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_LAST \
7461                 RING_ALLOC_INPUT_MAX_BW_BW_VALUE_UNIT_INVALID
7462         uint8_t int_mode;
7463         /*
7464          * This field is used only when ring_type is a Completion ring.
7465          * This value indicates what interrupt mode should be used on
7466          * this completion ring. Note: In the legacy interrupt mode, no
7467          * more than 16 completion rings are allowed.
7468          */
7469         /* Legacy INTA */
7470         #define HWRM_RING_ALLOC_INPUT_INT_MODE_LEGACY   UINT32_C(0x0)
7471         /* Reserved */
7472         #define HWRM_RING_ALLOC_INPUT_INT_MODE_RSVD     UINT32_C(0x1)
7473         /* MSI-X */
7474         #define HWRM_RING_ALLOC_INPUT_INT_MODE_MSIX     UINT32_C(0x2)
7475         /* No Interrupt - Polled mode */
7476         #define HWRM_RING_ALLOC_INPUT_INT_MODE_POLL     UINT32_C(0x3)
7477         uint8_t unused_8[3];
7478 } __attribute__((packed));
7479
7480 /* Output       (16 bytes) */
7481 struct hwrm_ring_alloc_output {
7482         uint16_t error_code;
7483         /*
7484          * Pass/Fail or error type Note: receiver to verify the in
7485          * parameters, and fail the call with an error when appropriate
7486          */
7487         uint16_t req_type;
7488         /* This field returns the type of original request. */
7489         uint16_t seq_id;
7490         /* This field provides original sequence number of the command. */
7491         uint16_t resp_len;
7492         /*
7493          * This field is the length of the response in bytes. The last
7494          * byte of the response is a valid flag that will read as '1'
7495          * when the command has been completely written to memory.
7496          */
7497         uint16_t ring_id;
7498         /*
7499          * Physical number of ring allocated. This value shall be unique
7500          * for a ring type.
7501          */
7502         uint16_t logical_ring_id;
7503         /* Logical number of ring allocated. */
7504         uint8_t unused_0;
7505         uint8_t unused_1;
7506         uint8_t unused_2;
7507         uint8_t valid;
7508         /*
7509          * This field is used in Output records to indicate that the
7510          * output is completely written to RAM. This field should be
7511          * read as '1' to indicate that the output has been completely
7512          * written. When writing a command completion or response to an
7513          * internal processor, the order of writes has to be such that
7514          * this field is written last.
7515          */
7516 } __attribute__((packed));
7517
7518 /* hwrm_ring_free */
7519 /*
7520  * Description: This command is used to free a ring and associated resources.
7521  * With QoS and DCBx agents, it is possible the traffic classes will be moved
7522  * from one CoS queue to another. When this occurs, the driver shall call
7523  * 'hwrm_ring_free' to free the allocated rings and then call 'hwrm_ring_alloc'
7524  * to re-allocate each ring and assign it to a new CoS queue. hwrm_ring_free
7525  * shall be called on a ring only after it has been idle for 500ms or more and
7526  * no frames have been posted to the ring during this time. All frames queued
7527  * for transmission shall be completed and at least 500ms time elapsed from the
7528  * last completion before calling this command.
7529  */
7530 /* Input        (24 bytes) */
7531 struct hwrm_ring_free_input {
7532         uint16_t req_type;
7533         /*
7534          * This value indicates what type of request this is. The format
7535          * for the rest of the command is determined by this field.
7536          */
7537         uint16_t cmpl_ring;
7538         /*
7539          * This value indicates the what completion ring the request
7540          * will be optionally completed on. If the value is -1, then no
7541          * CR completion will be generated. Any other value must be a
7542          * valid CR ring_id value for this function.
7543          */
7544         uint16_t seq_id;
7545         /* This value indicates the command sequence number. */
7546         uint16_t target_id;
7547         /*
7548          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7549          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7550          * - HWRM
7551          */
7552         uint64_t resp_addr;
7553         /*
7554          * This is the host address where the response will be written
7555          * when the request is complete. This area must be 16B aligned
7556          * and must be cleared to zero before the request is made.
7557          */
7558         uint8_t ring_type;
7559         /* Ring Type. */
7560         /* L2 Completion Ring   (CR) */
7561         #define HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL  UINT32_C(0x0)
7562         /* TX Ring      (TR) */
7563         #define HWRM_RING_FREE_INPUT_RING_TYPE_TX       UINT32_C(0x1)
7564         /* RX Ring      (RR) */
7565         #define HWRM_RING_FREE_INPUT_RING_TYPE_RX       UINT32_C(0x2)
7566         /* RoCE Notification Completion Ring    (ROCE_CR) */
7567         #define HWRM_RING_FREE_INPUT_RING_TYPE_ROCE_CMPL        UINT32_C(0x3)
7568         uint8_t unused_0;
7569         uint16_t ring_id;
7570         /* Physical number of ring allocated. */
7571         uint32_t unused_1;
7572 } __attribute__((packed));
7573
7574 /* Output       (16 bytes) */
7575 struct hwrm_ring_free_output {
7576         uint16_t error_code;
7577         /*
7578          * Pass/Fail or error type Note: receiver to verify the in
7579          * parameters, and fail the call with an error when appropriate
7580          */
7581         uint16_t req_type;
7582         /* This field returns the type of original request. */
7583         uint16_t seq_id;
7584         /* This field provides original sequence number of the command. */
7585         uint16_t resp_len;
7586         /*
7587          * This field is the length of the response in bytes. The last
7588          * byte of the response is a valid flag that will read as '1'
7589          * when the command has been completely written to memory.
7590          */
7591         uint32_t unused_0;
7592         uint8_t unused_1;
7593         uint8_t unused_2;
7594         uint8_t unused_3;
7595         uint8_t valid;
7596         /*
7597          * This field is used in Output records to indicate that the
7598          * output is completely written to RAM. This field should be
7599          * read as '1' to indicate that the output has been completely
7600          * written. When writing a command completion or response to an
7601          * internal processor, the order of writes has to be such that
7602          * this field is written last.
7603          */
7604 } __attribute__((packed));
7605
7606 /* hwrm_ring_grp_alloc */
7607 /*
7608  * Description: This API allocates and does basic preparation for a ring group.
7609  */
7610 /* Input        (24 bytes) */
7611 struct hwrm_ring_grp_alloc_input {
7612         uint16_t req_type;
7613         /*
7614          * This value indicates what type of request this is. The format
7615          * for the rest of the command is determined by this field.
7616          */
7617         uint16_t cmpl_ring;
7618         /*
7619          * This value indicates the what completion ring the request
7620          * will be optionally completed on. If the value is -1, then no
7621          * CR completion will be generated. Any other value must be a
7622          * valid CR ring_id value for this function.
7623          */
7624         uint16_t seq_id;
7625         /* This value indicates the command sequence number. */
7626         uint16_t target_id;
7627         /*
7628          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7629          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7630          * - HWRM
7631          */
7632         uint64_t resp_addr;
7633         /*
7634          * This is the host address where the response will be written
7635          * when the request is complete. This area must be 16B aligned
7636          * and must be cleared to zero before the request is made.
7637          */
7638         uint16_t cr;
7639         /* This value identifies the CR associated with the ring group. */
7640         uint16_t rr;
7641         /* This value identifies the main RR associated with the ring group. */
7642         uint16_t ar;
7643         /*
7644          * This value identifies the aggregation RR associated with the
7645          * ring group. If this value is 0xFF... (All Fs), then no
7646          * Aggregation ring will be set.
7647          */
7648         uint16_t sc;
7649         /*
7650          * This value identifies the statistics context associated with
7651          * the ring group.
7652          */
7653 } __attribute__((packed));
7654
7655 /* Output       (16 bytes) */
7656 struct hwrm_ring_grp_alloc_output {
7657         uint16_t error_code;
7658         /*
7659          * Pass/Fail or error type Note: receiver to verify the in
7660          * parameters, and fail the call with an error when appropriate
7661          */
7662         uint16_t req_type;
7663         /* This field returns the type of original request. */
7664         uint16_t seq_id;
7665         /* This field provides original sequence number of the command. */
7666         uint16_t resp_len;
7667         /*
7668          * This field is the length of the response in bytes. The last
7669          * byte of the response is a valid flag that will read as '1'
7670          * when the command has been completely written to memory.
7671          */
7672         uint32_t ring_group_id;
7673         /*
7674          * This is the ring group ID value. Use this value to program
7675          * the default ring group for the VNIC or as table entries in an
7676          * RSS/COS context.
7677          */
7678         uint8_t unused_0;
7679         uint8_t unused_1;
7680         uint8_t unused_2;
7681         uint8_t valid;
7682         /*
7683          * This field is used in Output records to indicate that the
7684          * output is completely written to RAM. This field should be
7685          * read as '1' to indicate that the output has been completely
7686          * written. When writing a command completion or response to an
7687          * internal processor, the order of writes has to be such that
7688          * this field is written last.
7689          */
7690 } __attribute__((packed));
7691
7692 /* hwrm_ring_grp_free */
7693 /*
7694  * Description: This API frees a ring group and associated resources. # If a
7695  * ring in the ring group is reset or free, then the associated rings in the
7696  * ring group shall also be reset/free using hwrm_ring_free. # A function driver
7697  * shall always use hwrm_ring_grp_free after freeing all rings in a group. # As
7698  * a part of executing this command, the HWRM shall reset all associated ring
7699  * group resources.
7700  */
7701 /* Input        (24 bytes) */
7702 struct hwrm_ring_grp_free_input {
7703         uint16_t req_type;
7704         /*
7705          * This value indicates what type of request this is. The format
7706          * for the rest of the command is determined by this field.
7707          */
7708         uint16_t cmpl_ring;
7709         /*
7710          * This value indicates the what completion ring the request
7711          * will be optionally completed on. If the value is -1, then no
7712          * CR completion will be generated. Any other value must be a
7713          * valid CR ring_id value for this function.
7714          */
7715         uint16_t seq_id;
7716         /* This value indicates the command sequence number. */
7717         uint16_t target_id;
7718         /*
7719          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7720          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7721          * - HWRM
7722          */
7723         uint64_t resp_addr;
7724         /*
7725          * This is the host address where the response will be written
7726          * when the request is complete. This area must be 16B aligned
7727          * and must be cleared to zero before the request is made.
7728          */
7729         uint32_t ring_group_id;
7730         /* This is the ring group ID value. */
7731         uint32_t unused_0;
7732 } __attribute__((packed));
7733
7734 /* Output       (16 bytes) */
7735 struct hwrm_ring_grp_free_output {
7736         uint16_t error_code;
7737         /*
7738          * Pass/Fail or error type Note: receiver to verify the in
7739          * parameters, and fail the call with an error when appropriate
7740          */
7741         uint16_t req_type;
7742         /* This field returns the type of original request. */
7743         uint16_t seq_id;
7744         /* This field provides original sequence number of the command. */
7745         uint16_t resp_len;
7746         /*
7747          * This field is the length of the response in bytes. The last
7748          * byte of the response is a valid flag that will read as '1'
7749          * when the command has been completely written to memory.
7750          */
7751         uint32_t unused_0;
7752         uint8_t unused_1;
7753         uint8_t unused_2;
7754         uint8_t unused_3;
7755         uint8_t valid;
7756         /*
7757          * This field is used in Output records to indicate that the
7758          * output is completely written to RAM. This field should be
7759          * read as '1' to indicate that the output has been completely
7760          * written. When writing a command completion or response to an
7761          * internal processor, the order of writes has to be such that
7762          * this field is written last.
7763          */
7764 } __attribute__((packed));
7765
7766 /* hwrm_cfa_l2_filter_alloc */
7767 /*
7768  * Description: An L2 filter is a filter resource that is used to identify a
7769  * vnic or ring for a packet based on layer 2 fields. Layer 2 fields for
7770  * encapsulated packets include both outer L2 header and/or inner l2 header of
7771  * encapsulated packet. The L2 filter resource covers the following OS specific
7772  * L2 filters. Linux/FreeBSD (per function): # Broadcast enable/disable # List
7773  * of individual multicast filters # All multicast enable/disable filter #
7774  * Unicast filters # Promiscuous mode VMware: # Broadcast enable/disable (per
7775  * physical function) # All multicast enable/disable    (per function) # Unicast
7776  * filters per ring or vnic # Promiscuous mode per PF Windows: # Broadcast
7777  * enable/disable (per physical function) # List of individual multicast filters
7778  * (Driver needs to advertise the maximum number of filters supported) # All
7779  * multicast enable/disable per physical function # Unicast filters per vnic #
7780  * Promiscuous mode per PF Implementation notes on the use of VNIC in this
7781  * command: # By default, these filters belong to default vnic for the function.
7782  * # Once these filters are set up, only destination VNIC can be modified. # If
7783  * the destination VNIC is not specified in this command, then the HWRM shall
7784  * only create an l2 context id. HWRM Implementation notes for multicast
7785  * filters: # The hwrm_filter_alloc command can be used to set up multicast
7786  * filters (perfect match or partial match). Each individual function driver can
7787  * set up multicast filters independently. # The HWRM needs to keep track of
7788  * multicast filters set up by function drivers and maintain multicast group
7789  * replication records to enable a subset of functions to receive traffic for a
7790  * specific multicast address. # When a specific multicast filter cannot be set,
7791  * the HWRM shall return an error. In this error case, the driver should fall
7792  * back to using one general filter     (rather than specific) for all multicast
7793  * traffic. # When the SR-IOV is enabled, the HWRM needs to additionally track
7794  * source knockout per multicast group record. Examples of setting unicast
7795  * filters: For a unicast MAC based filter, one can use a combination of the
7796  * fields and masks provided in this command to set up the filter. Below are
7797  * some examples: # MAC + no VLAN filter: This filter is used to identify
7798  * traffic that does not contain any VLAN tags and matches destination  (or
7799  * source) MAC address. This filter can be set up by setting only l2_addr field
7800  * to be a valid field. All other fields are not valid. The following value is
7801  * set for l2_addr. l2_addr = MAC # MAC + Any VLAN filter: This filter is used
7802  * to identify traffic that carries single VLAN tag and matches (destination or
7803  * source) MAC address. This filter can be set up by setting only l2_addr and
7804  * l2_ovlan_mask fields to be valid fields. All other fields are not valid. The
7805  * following values are set for those two valid fields. l2_addr = MAC,
7806  * l2_ovlan_mask = 0xFFFF # MAC + no VLAN or VLAN ID=0: This filter is used to
7807  * identify untagged traffic that does not contain any VLAN tags or a VLAN tag
7808  * with VLAN ID = 0 and matches destination (or source) MAC address. This filter
7809  * can be set up by setting only l2_addr and l2_ovlan fields to be valid fields.
7810  * All other fields are not valid. The following value are set for l2_addr and
7811  * l2_ovlan. l2_addr = MAC, l2_ovlan = 0x0 # MAC + no VLAN or any VLAN: This
7812  * filter is used to identify traffic that contains zero or 1 VLAN tag and
7813  * matches destination  (or source) MAC address. This filter can be set up by
7814  * setting only l2_addr, l2_ovlan, and l2_mask fields to be valid fields. All
7815  * other fields are not valid. The following value are set for l2_addr,
7816  * l2_ovlan, and l2_mask fields. l2_addr = MAC, l2_ovlan = 0x0, l2_ovlan_mask =
7817  * 0xFFFF # MAC + VLAN ID filter: This filter can be set up by setting only
7818  * l2_addr, l2_ovlan, and l2_ovlan_mask fields to be valid fields. All other
7819  * fields are not valid. The following values are set for those three valid
7820  * fields. l2_addr = MAC, l2_ovlan = VLAN ID, l2_ovlan_mask = 0xF000
7821  */
7822 /* Input        (96 bytes) */
7823 struct hwrm_cfa_l2_filter_alloc_input {
7824         uint16_t req_type;
7825         /*
7826          * This value indicates what type of request this is. The format
7827          * for the rest of the command is determined by this field.
7828          */
7829         uint16_t cmpl_ring;
7830         /*
7831          * This value indicates the what completion ring the request
7832          * will be optionally completed on. If the value is -1, then no
7833          * CR completion will be generated. Any other value must be a
7834          * valid CR ring_id value for this function.
7835          */
7836         uint16_t seq_id;
7837         /* This value indicates the command sequence number. */
7838         uint16_t target_id;
7839         /*
7840          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
7841          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
7842          * - HWRM
7843          */
7844         uint64_t resp_addr;
7845         /*
7846          * This is the host address where the response will be written
7847          * when the request is complete. This area must be 16B aligned
7848          * and must be cleared to zero before the request is made.
7849          */
7850         uint32_t flags;
7851         /*
7852          * Enumeration denoting the RX, TX type of the resource. This
7853          * enumeration is used for resources that are similar for both
7854          * TX and RX paths of the chip.
7855          */
7856         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH       UINT32_C(0x1)
7857         /* tx path */
7858         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_TX    \
7859                 (UINT32_C(0x0) << 0)
7860         /* rx path */
7861         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX    \
7862                 (UINT32_C(0x1) << 0)
7863         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_LAST \
7864                 CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX
7865         /*
7866          * Setting of this flag indicates the applicability to the
7867          * loopback path.
7868          */
7869         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_LOOPBACK   UINT32_C(0x2)
7870         /*
7871          * Setting of this flag indicates drop action. If this flag is
7872          * not set, then it should be considered accept action.
7873          */
7874         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_DROP       UINT32_C(0x4)
7875         /*
7876          * If this flag is set, all t_l2_* fields are invalid and they
7877          * should not be specified. If this flag is set, then l2_*
7878          * fields refer to fields of outermost L2 header.
7879          */
7880         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST UINT32_C(0x8)
7881         uint32_t enables;
7882         /* This bit must be '1' for the l2_addr field to be configured. */
7883         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR UINT32_C(0x1)
7884         /* This bit must be '1' for the l2_addr_mask field to be configured. */
7885         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK     \
7886                 UINT32_C(0x2)
7887         /* This bit must be '1' for the l2_ovlan field to be configured. */
7888         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN UINT32_C(0x4)
7889         /*
7890          * This bit must be '1' for the l2_ovlan_mask field to be
7891          * configured.
7892          */
7893         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN_MASK     \
7894                 UINT32_C(0x8)
7895         /* This bit must be '1' for the l2_ivlan field to be configured. */
7896         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN UINT32_C(0x10)
7897         /*
7898          * This bit must be '1' for the l2_ivlan_mask field to be
7899          * configured.
7900          */
7901         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN_MASK     \
7902                 UINT32_C(0x20)
7903         /* This bit must be '1' for the t_l2_addr field to be configured. */
7904         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR UINT32_C(0x40)
7905         /*
7906          * This bit must be '1' for the t_l2_addr_mask field to be
7907          * configured.
7908          */
7909         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR_MASK   \
7910                 UINT32_C(0x80)
7911         /* This bit must be '1' for the t_l2_ovlan field to be configured. */
7912         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN       \
7913                 UINT32_C(0x100)
7914         /*
7915          * This bit must be '1' for the t_l2_ovlan_mask field to be
7916          * configured.
7917          */
7918         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN_MASK  \
7919                 UINT32_C(0x200)
7920         /* This bit must be '1' for the t_l2_ivlan field to be configured. */
7921         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN       \
7922                 UINT32_C(0x400)
7923         /*
7924          * This bit must be '1' for the t_l2_ivlan_mask field to be
7925          * configured.
7926          */
7927         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN_MASK  \
7928                 UINT32_C(0x800)
7929         /* This bit must be '1' for the src_type field to be configured. */
7930         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_TYPE UINT32_C(0x1000)
7931         /* This bit must be '1' for the src_id field to be configured. */
7932         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_ID UINT32_C(0x2000)
7933         /* This bit must be '1' for the tunnel_type field to be configured. */
7934         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_TUNNEL_TYPE      \
7935                 UINT32_C(0x4000)
7936         /* This bit must be '1' for the dst_id field to be configured. */
7937         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_DST_ID UINT32_C(0x8000)
7938         /*
7939          * This bit must be '1' for the mirror_vnic_id field to be
7940          * configured.
7941          */
7942         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID   \
7943                 UINT32_C(0x10000)
7944         uint8_t l2_addr[6];
7945         /*
7946          * This value sets the match value for the L2 MAC address.
7947          * Destination MAC address for RX path. Source MAC address for
7948          * TX path.
7949          */
7950         uint8_t unused_0;
7951         uint8_t unused_1;
7952         uint8_t l2_addr_mask[6];
7953         /*
7954          * This value sets the mask value for the L2 address. A value of
7955          * 0 will mask the corresponding bit from compare.
7956          */
7957         uint16_t l2_ovlan;
7958         /* This value sets VLAN ID value for outer VLAN. */
7959         uint16_t l2_ovlan_mask;
7960         /*
7961          * This value sets the mask value for the ovlan id. A value of 0
7962          * will mask the corresponding bit from compare.
7963          */
7964         uint16_t l2_ivlan;
7965         /* This value sets VLAN ID value for inner VLAN. */
7966         uint16_t l2_ivlan_mask;
7967         /*
7968          * This value sets the mask value for the ivlan id. A value of 0
7969          * will mask the corresponding bit from compare.
7970          */
7971         uint8_t unused_2;
7972         uint8_t unused_3;
7973         uint8_t t_l2_addr[6];
7974         /*
7975          * This value sets the match value for the tunnel L2 MAC
7976          * address. Destination MAC address for RX path. Source MAC
7977          * address for TX path.
7978          */
7979         uint8_t unused_4;
7980         uint8_t unused_5;
7981         uint8_t t_l2_addr_mask[6];
7982         /*
7983          * This value sets the mask value for the tunnel L2 address. A
7984          * value of 0 will mask the corresponding bit from compare.
7985          */
7986         uint16_t t_l2_ovlan;
7987         /* This value sets VLAN ID value for tunnel outer VLAN. */
7988         uint16_t t_l2_ovlan_mask;
7989         /*
7990          * This value sets the mask value for the tunnel ovlan id. A
7991          * value of 0 will mask the corresponding bit from compare.
7992          */
7993         uint16_t t_l2_ivlan;
7994         /* This value sets VLAN ID value for tunnel inner VLAN. */
7995         uint16_t t_l2_ivlan_mask;
7996         /*
7997          * This value sets the mask value for the tunnel ivlan id. A
7998          * value of 0 will mask the corresponding bit from compare.
7999          */
8000         uint8_t src_type;
8001         /* This value identifies the type of source of the packet. */
8002         /* Network port */
8003         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_NPORT   UINT32_C(0x0)
8004         /* Physical function */
8005         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_PF      UINT32_C(0x1)
8006         /* Virtual function */
8007         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VF      UINT32_C(0x2)
8008         /* Virtual NIC of a function */
8009         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VNIC    UINT32_C(0x3)
8010         /* Embedded processor for CFA management */
8011         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_KONG    UINT32_C(0x4)
8012         /* Embedded processor for OOB management */
8013         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_APE     UINT32_C(0x5)
8014         /* Embedded processor for RoCE */
8015         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_BONO    UINT32_C(0x6)
8016         /* Embedded processor for network proxy functions */
8017         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_TANG    UINT32_C(0x7)
8018         uint8_t unused_6;
8019         uint32_t src_id;
8020         /*
8021          * This value is the id of the source. For a network port, it
8022          * represents port_id. For a physical function, it represents
8023          * fid. For a virtual function, it represents vf_id. For a vnic,
8024          * it represents vnic_id. For embedded processors, this id is
8025          * not valid. Notes: 1. The function ID is implied if it src_id
8026          * is not provided for a src_type that is either
8027          */
8028         uint8_t tunnel_type;
8029         /* Tunnel Type. */
8030         /* Non-tunnel */
8031         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NONTUNNEL \
8032                 UINT32_C(0x0)
8033         /* Virtual eXtensible Local Area Network        (VXLAN) */
8034         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_VXLAN \
8035                 UINT32_C(0x1)
8036         /*
8037          * Network Virtualization Generic Routing
8038          * Encapsulation        (NVGRE)
8039          */
8040         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NVGRE \
8041                 UINT32_C(0x2)
8042         /*
8043          * Generic Routing Encapsulation        (GRE) inside
8044          * Ethernet payload
8045          */
8046         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_L2GRE UINT32_C(0x3)
8047         /* IP in IP */
8048         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPIP UINT32_C(0x4)
8049         /* Generic Network Virtualization Encapsulation (Geneve) */
8050         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_GENEVE UINT32_C(0x5)
8051         /* Multi-Protocol Lable Switching       (MPLS) */
8052         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_MPLS UINT32_C(0x6)
8053         /* Stateless Transport Tunnel   (STT) */
8054         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_STT  UINT32_C(0x7)
8055         /*
8056          * Generic Routing Encapsulation        (GRE) inside IP
8057          * datagram payload
8058          */
8059         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPGRE UINT32_C(0x8)
8060         /* Any tunneled traffic */
8061         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_ANYTUNNEL \
8062                 UINT32_C(0xff)
8063         uint8_t unused_7;
8064         uint16_t dst_id;
8065         /*
8066          * If set, this value shall represent the Logical VNIC ID of the
8067          * destination VNIC for the RX path and network port id of the
8068          * destination port for the TX path.
8069          */
8070         uint16_t mirror_vnic_id;
8071         /* Logical VNIC ID of the VNIC where traffic is mirrored. */
8072         uint8_t pri_hint;
8073         /*
8074          * This hint is provided to help in placing the filter in the
8075          * filter table.
8076          */
8077         /* No preference */
8078         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_NO_PREFER \
8079                 UINT32_C(0x0)
8080         /* Above the given filter */
8081         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_ABOVE_FILTER \
8082                 UINT32_C(0x1)
8083         /* Below the given filter */
8084         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_BELOW_FILTER \
8085                 UINT32_C(0x2)
8086         /* As high as possible */
8087         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MAX     UINT32_C(0x3)
8088         /* As low as possible */
8089         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MIN     UINT32_C(0x4)
8090         uint8_t unused_8;
8091         uint32_t unused_9;
8092         uint64_t l2_filter_id_hint;
8093         /*
8094          * This is the ID of the filter that goes along with the
8095          * pri_hint. This field is valid only for the following values.
8096          * 1 - Above the given filter 2 - Below the given filter
8097          */
8098 } __attribute__((packed));
8099
8100 /* Output       (24 bytes) */
8101 struct hwrm_cfa_l2_filter_alloc_output {
8102         uint16_t error_code;
8103         /*
8104          * Pass/Fail or error type Note: receiver to verify the in
8105          * parameters, and fail the call with an error when appropriate
8106          */
8107         uint16_t req_type;
8108         /* This field returns the type of original request. */
8109         uint16_t seq_id;
8110         /* This field provides original sequence number of the command. */
8111         uint16_t resp_len;
8112         /*
8113          * This field is the length of the response in bytes. The last
8114          * byte of the response is a valid flag that will read as '1'
8115          * when the command has been completely written to memory.
8116          */
8117         uint64_t l2_filter_id;
8118         /*
8119          * This value identifies a set of CFA data structures used for
8120          * an L2 context.
8121          */
8122         uint32_t flow_id;
8123         /*
8124          * This is the ID of the flow associated with this filter. This
8125          * value shall be used to match and associate the flow
8126          * identifier returned in completion records. A value of
8127          * 0xFFFFFFFF shall indicate no flow id.
8128          */
8129         uint8_t unused_0;
8130         uint8_t unused_1;
8131         uint8_t unused_2;
8132         uint8_t valid;
8133         /*
8134          * This field is used in Output records to indicate that the
8135          * output is completely written to RAM. This field should be
8136          * read as '1' to indicate that the output has been completely
8137          * written. When writing a command completion or response to an
8138          * internal processor, the order of writes has to be such that
8139          * this field is written last.
8140          */
8141 } __attribute__((packed));
8142
8143 /* hwrm_cfa_l2_filter_free */
8144 /*
8145  * Description: Free a L2 filter. The HWRM shall free all associated filter
8146  * resources with the L2 filter.
8147  */
8148 /* Input        (24 bytes) */
8149 struct hwrm_cfa_l2_filter_free_input {
8150         uint16_t req_type;
8151         /*
8152          * This value indicates what type of request this is. The format
8153          * for the rest of the command is determined by this field.
8154          */
8155         uint16_t cmpl_ring;
8156         /*
8157          * This value indicates the what completion ring the request
8158          * will be optionally completed on. If the value is -1, then no
8159          * CR completion will be generated. Any other value must be a
8160          * valid CR ring_id value for this function.
8161          */
8162         uint16_t seq_id;
8163         /* This value indicates the command sequence number. */
8164         uint16_t target_id;
8165         /*
8166          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8167          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8168          * - HWRM
8169          */
8170         uint64_t resp_addr;
8171         /*
8172          * This is the host address where the response will be written
8173          * when the request is complete. This area must be 16B aligned
8174          * and must be cleared to zero before the request is made.
8175          */
8176         uint64_t l2_filter_id;
8177         /*
8178          * This value identifies a set of CFA data structures used for
8179          * an L2 context.
8180          */
8181 } __attribute__((packed));
8182
8183 /* Output       (16 bytes) */
8184 struct hwrm_cfa_l2_filter_free_output {
8185         uint16_t error_code;
8186         /*
8187          * Pass/Fail or error type Note: receiver to verify the in
8188          * parameters, and fail the call with an error when appropriate
8189          */
8190         uint16_t req_type;
8191         /* This field returns the type of original request. */
8192         uint16_t seq_id;
8193         /* This field provides original sequence number of the command. */
8194         uint16_t resp_len;
8195         /*
8196          * This field is the length of the response in bytes. The last
8197          * byte of the response is a valid flag that will read as '1'
8198          * when the command has been completely written to memory.
8199          */
8200         uint32_t unused_0;
8201         uint8_t unused_1;
8202         uint8_t unused_2;
8203         uint8_t unused_3;
8204         uint8_t valid;
8205         /*
8206          * This field is used in Output records to indicate that the
8207          * output is completely written to RAM. This field should be
8208          * read as '1' to indicate that the output has been completely
8209          * written. When writing a command completion or response to an
8210          * internal processor, the order of writes has to be such that
8211          * this field is written last.
8212          */
8213 } __attribute__((packed));
8214
8215 /* hwrm_cfa_l2_filter_cfg */
8216 /* Description: Change the configuration of an existing L2 filter */
8217 /* Input        (40 bytes) */
8218 struct hwrm_cfa_l2_filter_cfg_input {
8219         uint16_t req_type;
8220         /*
8221          * This value indicates what type of request this is. The format
8222          * for the rest of the command is determined by this field.
8223          */
8224         uint16_t cmpl_ring;
8225         /*
8226          * This value indicates the what completion ring the request
8227          * will be optionally completed on. If the value is -1, then no
8228          * CR completion will be generated. Any other value must be a
8229          * valid CR ring_id value for this function.
8230          */
8231         uint16_t seq_id;
8232         /* This value indicates the command sequence number. */
8233         uint16_t target_id;
8234         /*
8235          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8236          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8237          * - HWRM
8238          */
8239         uint64_t resp_addr;
8240         /*
8241          * This is the host address where the response will be written
8242          * when the request is complete. This area must be 16B aligned
8243          * and must be cleared to zero before the request is made.
8244          */
8245         uint32_t flags;
8246         /*
8247          * Enumeration denoting the RX, TX type of the resource. This
8248          * enumeration is used for resources that are similar for both
8249          * TX and RX paths of the chip.
8250          */
8251         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH UINT32_C(0x1)
8252         /* tx path */
8253         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_TX \
8254                 (UINT32_C(0x0) << 0)
8255         /* rx path */
8256         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_RX \
8257                 (UINT32_C(0x1) << 0)
8258         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_LAST \
8259                 CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_RX
8260         /*
8261          * Setting of this flag indicates drop action. If this flag is
8262          * not set, then it should be considered accept action.
8263          */
8264         #define HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_DROP UINT32_C(0x2)
8265         uint32_t enables;
8266         /* This bit must be '1' for the dst_id field to be configured. */
8267         #define HWRM_CFA_L2_FILTER_CFG_INPUT_ENABLES_DST_ID     UINT32_C(0x1)
8268         /*
8269          * This bit must be '1' for the new_mirror_vnic_id field to be
8270          * configured.
8271          */
8272         #define HWRM_CFA_L2_FILTER_CFG_INPUT_ENABLES_NEW_MIRROR_VNIC_ID   \
8273                 UINT32_C(0x2)
8274         uint64_t l2_filter_id;
8275         /*
8276          * This value identifies a set of CFA data structures used for
8277          * an L2 context.
8278          */
8279         uint32_t dst_id;
8280         /*
8281          * If set, this value shall represent the Logical VNIC ID of the
8282          * destination VNIC for the RX path and network port id of the
8283          * destination port for the TX path.
8284          */
8285         uint32_t new_mirror_vnic_id;
8286         /* New Logical VNIC ID of the VNIC where traffic is mirrored. */
8287 } __attribute__((packed));
8288
8289 /* Output       (16 bytes) */
8290 struct hwrm_cfa_l2_filter_cfg_output {
8291         uint16_t error_code;
8292         /*
8293          * Pass/Fail or error type Note: receiver to verify the in
8294          * parameters, and fail the call with an error when appropriate
8295          */
8296         uint16_t req_type;
8297         /* This field returns the type of original request. */
8298         uint16_t seq_id;
8299         /* This field provides original sequence number of the command. */
8300         uint16_t resp_len;
8301         /*
8302          * This field is the length of the response in bytes. The last
8303          * byte of the response is a valid flag that will read as '1'
8304          * when the command has been completely written to memory.
8305          */
8306         uint32_t unused_0;
8307         uint8_t unused_1;
8308         uint8_t unused_2;
8309         uint8_t unused_3;
8310         uint8_t valid;
8311         /*
8312          * This field is used in Output records to indicate that the
8313          * output is completely written to RAM. This field should be
8314          * read as '1' to indicate that the output has been completely
8315          * written. When writing a command completion or response to an
8316          * internal processor, the order of writes has to be such that
8317          * this field is written last.
8318          */
8319 } __attribute__((packed));
8320
8321 /* hwrm_cfa_l2_set_rx_mask */
8322 /* Description: This command will set rx mask of the function. */
8323 /* Input        (56 bytes) */
8324 struct hwrm_cfa_l2_set_rx_mask_input {
8325         uint16_t req_type;
8326         /*
8327          * This value indicates what type of request this is. The format
8328          * for the rest of the command is determined by this field.
8329          */
8330         uint16_t cmpl_ring;
8331         /*
8332          * This value indicates the what completion ring the request
8333          * will be optionally completed on. If the value is -1, then no
8334          * CR completion will be generated. Any other value must be a
8335          * valid CR ring_id value for this function.
8336          */
8337         uint16_t seq_id;
8338         /* This value indicates the command sequence number. */
8339         uint16_t target_id;
8340         /*
8341          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8342          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8343          * - HWRM
8344          */
8345         uint64_t resp_addr;
8346         /*
8347          * This is the host address where the response will be written
8348          * when the request is complete. This area must be 16B aligned
8349          * and must be cleared to zero before the request is made.
8350          */
8351         uint32_t vnic_id;
8352         /* VNIC ID */
8353         uint32_t mask;
8354         /* Reserved for future use. */
8355         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_RESERVED     UINT32_C(0x1)
8356         /*
8357          * When this bit is '1', the function is requested to accept
8358          * multi-cast packets specified by the multicast addr table.
8359          */
8360         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST        UINT32_C(0x2)
8361         /*
8362          * When this bit is '1', the function is requested to accept all
8363          * multi-cast packets.
8364          */
8365         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST    UINT32_C(0x4)
8366         /*
8367          * When this bit is '1', the function is requested to accept
8368          * broadcast packets.
8369          */
8370         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_BCAST        UINT32_C(0x8)
8371         /*
8372          * When this bit is '1', the function is requested to be put in
8373          * the promiscuous mode. The HWRM should accept any function to
8374          * set up promiscuous mode. The HWRM shall follow the semantics
8375          * below for the promiscuous mode support. # When partitioning
8376          * is not enabled on a port     (i.e. single PF on the port), then
8377          * the PF shall be allowed to be in the promiscuous mode. When
8378          * the PF is in the promiscuous mode, then it shall receive all
8379          * host bound traffic on that port. # When partitioning is
8380          * enabled on a port    (i.e. multiple PFs per port) and a PF on
8381          * that port is in the promiscuous mode, then the PF receives
8382          * all traffic within that partition as identified by a unique
8383          * identifier for the PF        (e.g. S-Tag). If a unique outer VLAN
8384          * for the PF is specified, then the setting of promiscuous mode
8385          * on that PF shall result in the PF receiving all host bound
8386          * traffic with matching outer VLAN. # A VF shall can be set in
8387          * the promiscuous mode. In the promiscuous mode, the VF does
8388          * not receive any traffic unless a unique outer VLAN for the VF
8389          * is specified. If a unique outer VLAN for the VF is specified,
8390          * then the setting of promiscuous mode on that VF shall result
8391          * in the VF receiving all host bound traffic with the matching
8392          * outer VLAN. # The HWRM shall allow the setting of promiscuous
8393          * mode on a function independently from the promiscuous mode
8394          * settings on other functions.
8395          */
8396         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS UINT32_C(0x10)
8397         /*
8398          * If this flag is set, the corresponding RX filters shall be
8399          * set up to cover multicast/broadcast filters for the outermost
8400          * Layer 2 destination MAC address field.
8401          */
8402         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_OUTERMOST    UINT32_C(0x20)
8403         /*
8404          * If this flag is set, the corresponding RX filters shall be
8405          * set up to cover multicast/broadcast filters for the VLAN-
8406          * tagged packets that match the TPID and VID fields of VLAN
8407          * tags in the VLAN tag table specified in this command.
8408          */
8409         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLANONLY     UINT32_C(0x40)
8410         /*
8411          * If this flag is set, the corresponding RX filters shall be
8412          * set up to cover multicast/broadcast filters for non-VLAN
8413          * tagged packets and VLAN-tagged packets that match the TPID
8414          * and VID fields of VLAN tags in the VLAN tag table specified
8415          * in this command.
8416          */
8417         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN UINT32_C(0x80)
8418         /*
8419          * If this flag is set, the corresponding RX filters shall be
8420          * set up to cover multicast/broadcast filters for non-VLAN
8421          * tagged packets and VLAN-tagged packets matching any VLAN tag.
8422          * If this flag is set, then the HWRM shall ignore VLAN tags
8423          * specified in vlan_tag_tbl. If none of vlanonly, vlan_nonvlan,
8424          * and anyvlan_nonvlan flags is set, then the HWRM shall ignore
8425          * VLAN tags specified in vlan_tag_tbl. The HWRM client shall
8426          * set at most one flag out of vlanonly, vlan_nonvlan, and
8427          * anyvlan_nonvlan.
8428          */
8429         #define HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN      \
8430                 UINT32_C(0x100)
8431         uint64_t mc_tbl_addr;
8432         /* This is the address for mcast address tbl. */
8433         uint32_t num_mc_entries;
8434         /*
8435          * This value indicates how many entries in mc_tbl are valid.
8436          * Each entry is 6 bytes.
8437          */
8438         uint32_t unused_0;
8439         uint64_t vlan_tag_tbl_addr;
8440         /*
8441          * This is the address for VLAN tag table. Each VLAN entry in
8442          * the table is 4 bytes of a VLAN tag including TPID, PCP, DEI,
8443          * and VID fields in network byte order.
8444          */
8445         uint32_t num_vlan_tags;
8446         /*
8447          * This value indicates how many entries in vlan_tag_tbl are
8448          * valid. Each entry is 4 bytes.
8449          */
8450         uint32_t unused_1;
8451 } __attribute__((packed));
8452
8453 /* Output       (16 bytes) */
8454 struct hwrm_cfa_l2_set_rx_mask_output {
8455         uint16_t error_code;
8456         /*
8457          * Pass/Fail or error type Note: receiver to verify the in
8458          * parameters, and fail the call with an error when appropriate
8459          */
8460         uint16_t req_type;
8461         /* This field returns the type of original request. */
8462         uint16_t seq_id;
8463         /* This field provides original sequence number of the command. */
8464         uint16_t resp_len;
8465         /*
8466          * This field is the length of the response in bytes. The last
8467          * byte of the response is a valid flag that will read as '1'
8468          * when the command has been completely written to memory.
8469          */
8470         uint32_t unused_0;
8471         uint8_t unused_1;
8472         uint8_t unused_2;
8473         uint8_t unused_3;
8474         uint8_t valid;
8475         /*
8476          * This field is used in Output records to indicate that the
8477          * output is completely written to RAM. This field should be
8478          * read as '1' to indicate that the output has been completely
8479          * written. When writing a command completion or response to an
8480          * internal processor, the order of writes has to be such that
8481          * this field is written last.
8482          */
8483 } __attribute__((packed));
8484
8485 /* hwrm_tunnel_dst_port_query */
8486 /*
8487  * Description: This function is called by a driver to query tunnel type
8488  * specific destination port configuration.
8489  */
8490 /* Input        (24 bytes) */
8491 struct hwrm_tunnel_dst_port_query_input {
8492         uint16_t req_type;
8493         /*
8494          * This value indicates what type of request this is. The format
8495          * for the rest of the command is determined by this field.
8496          */
8497         uint16_t cmpl_ring;
8498         /*
8499          * This value indicates the what completion ring the request
8500          * will be optionally completed on. If the value is -1, then no
8501          * CR completion will be generated. Any other value must be a
8502          * valid CR ring_id value for this function.
8503          */
8504         uint16_t seq_id;
8505         /* This value indicates the command sequence number. */
8506         uint16_t target_id;
8507         /*
8508          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8509          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8510          * - HWRM
8511          */
8512         uint64_t resp_addr;
8513         /*
8514          * This is the host address where the response will be written
8515          * when the request is complete. This area must be 16B aligned
8516          * and must be cleared to zero before the request is made.
8517          */
8518         uint8_t tunnel_type;
8519         /* Tunnel Type. */
8520         /* Virtual eXtensible Local Area Network        (VXLAN) */
8521         #define HWRM_TUNNEL_DST_PORT_QUERY_INPUT_TUNNEL_TYPE_VXLAN \
8522                 UINT32_C(0x1)
8523         /* Generic Network Virtualization Encapsulation (Geneve) */
8524         #define HWRM_TUNNEL_DST_PORT_QUERY_INPUT_TUNNEL_TYPE_GENEVE \
8525                 UINT32_C(0x5)
8526         uint8_t unused_0[7];
8527 } __attribute__((packed));
8528
8529 /* Output       (16 bytes) */
8530 struct hwrm_tunnel_dst_port_query_output {
8531         uint16_t error_code;
8532         /*
8533          * Pass/Fail or error type Note: receiver to verify the in
8534          * parameters, and fail the call with an error when appropriate
8535          */
8536         uint16_t req_type;
8537         /* This field returns the type of original request. */
8538         uint16_t seq_id;
8539         /* This field provides original sequence number of the command. */
8540         uint16_t resp_len;
8541         /*
8542          * This field is the length of the response in bytes. The last
8543          * byte of the response is a valid flag that will read as '1'
8544          * when the command has been completely written to memory.
8545          */
8546         uint16_t tunnel_dst_port_id;
8547         /*
8548          * This field represents the identifier of L4 destination port
8549          * used for the given tunnel type. This field is valid for
8550          * specific tunnel types that use layer 4       (e.g. UDP) transports
8551          * for tunneling.
8552          */
8553         uint16_t tunnel_dst_port_val;
8554         /*
8555          * This field represents the value of L4 destination port
8556          * identified by tunnel_dst_port_id. This field is valid for
8557          * specific tunnel types that use layer 4       (e.g. UDP) transports
8558          * for tunneling. This field is in network byte order. A value
8559          * of 0 means that the destination port is not configured.
8560          */
8561         uint8_t unused_0;
8562         uint8_t unused_1;
8563         uint8_t unused_2;
8564         uint8_t valid;
8565         /*
8566          * This field is used in Output records to indicate that the
8567          * output is completely written to RAM. This field should be
8568          * read as '1' to indicate that the output has been completely
8569          * written. When writing a command completion or response to an
8570          * internal processor, the order of writes has to be such that
8571          * this field is written last.
8572          */
8573 } __attribute__((packed));
8574
8575 /* hwrm_tunnel_dst_port_alloc */
8576 /*
8577  * Description: This function is called by a driver to allocate l4 destination
8578  * port for a specific tunnel type. The destination port value is provided in
8579  * the input. If the HWRM supports only one global destination port for a tunnel
8580  * type, then the HWRM shall keep track of its usage as described below. # The
8581  * first caller that allocates a destination port shall always succeed and the
8582  * HWRM shall save the destination port configuration for that tunnel type and
8583  * increment the usage count to 1. # Subsequent callers allocating the same
8584  * destination port for that tunnel type shall succeed and the HWRM shall
8585  * increment the usage count for that port for each subsequent caller that
8586  * succeeds. # Any subsequent caller trying to allocate a different destination
8587  * port for that tunnel type shall fail until the usage count for the original
8588  * destination port goes to zero. # A caller that frees a port will cause the
8589  * usage count for that port to decrement.
8590  */
8591 /* Input        (24 bytes) */
8592 struct hwrm_tunnel_dst_port_alloc_input {
8593         uint16_t req_type;
8594         /*
8595          * This value indicates what type of request this is. The format
8596          * for the rest of the command is determined by this field.
8597          */
8598         uint16_t cmpl_ring;
8599         /*
8600          * This value indicates the what completion ring the request
8601          * will be optionally completed on. If the value is -1, then no
8602          * CR completion will be generated. Any other value must be a
8603          * valid CR ring_id value for this function.
8604          */
8605         uint16_t seq_id;
8606         /* This value indicates the command sequence number. */
8607         uint16_t target_id;
8608         /*
8609          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8610          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8611          * - HWRM
8612          */
8613         uint64_t resp_addr;
8614         /*
8615          * This is the host address where the response will be written
8616          * when the request is complete. This area must be 16B aligned
8617          * and must be cleared to zero before the request is made.
8618          */
8619         uint8_t tunnel_type;
8620         /* Tunnel Type. */
8621         /* Virtual eXtensible Local Area Network        (VXLAN) */
8622         #define HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_VXLAN UINT32_C(0x1)
8623         /* Generic Network Virtualization Encapsulation (Geneve) */
8624         #define HWRM_TUNNEL_DST_PORT_ALLOC_INPUT_TUNNEL_TYPE_GENEVE \
8625                 UINT32_C(0x5)
8626         uint8_t unused_0;
8627         uint16_t tunnel_dst_port_val;
8628         /*
8629          * This field represents the value of L4 destination port used
8630          * for the given tunnel type. This field is valid for specific
8631          * tunnel types that use layer 4        (e.g. UDP) transports for
8632          * tunneling. This field is in network byte order. A value of 0
8633          * shall fail the command.
8634          */
8635         uint32_t unused_1;
8636 } __attribute__((packed));
8637
8638 /* Output       (16 bytes) */
8639 struct hwrm_tunnel_dst_port_alloc_output {
8640         uint16_t error_code;
8641         /*
8642          * Pass/Fail or error type Note: receiver to verify the in
8643          * parameters, and fail the call with an error when appropriate
8644          */
8645         uint16_t req_type;
8646         /* This field returns the type of original request. */
8647         uint16_t seq_id;
8648         /* This field provides original sequence number of the command. */
8649         uint16_t resp_len;
8650         /*
8651          * This field is the length of the response in bytes. The last
8652          * byte of the response is a valid flag that will read as '1'
8653          * when the command has been completely written to memory.
8654          */
8655         uint16_t tunnel_dst_port_id;
8656         /*
8657          * Identifier of a tunnel L4 destination port value. Only
8658          * applies to tunnel types that has l4 destination port
8659          * parameters.
8660          */
8661         uint8_t unused_0;
8662         uint8_t unused_1;
8663         uint8_t unused_2;
8664         uint8_t unused_3;
8665         uint8_t unused_4;
8666         uint8_t valid;
8667         /*
8668          * This field is used in Output records to indicate that the
8669          * output is completely written to RAM. This field should be
8670          * read as '1' to indicate that the output has been completely
8671          * written. When writing a command completion or response to an
8672          * internal processor, the order of writes has to be such that
8673          * this field is written last.
8674          */
8675 } __attribute__((packed));
8676
8677 /* hwrm_tunnel_dst_port_free */
8678 /*
8679  * Description: This function is called by a driver to free l4 destination port
8680  * for a specific tunnel type.
8681  */
8682 /* Input        (24 bytes) */
8683 struct hwrm_tunnel_dst_port_free_input {
8684         uint16_t req_type;
8685         /*
8686          * This value indicates what type of request this is. The format
8687          * for the rest of the command is determined by this field.
8688          */
8689         uint16_t cmpl_ring;
8690         /*
8691          * This value indicates the what completion ring the request
8692          * will be optionally completed on. If the value is -1, then no
8693          * CR completion will be generated. Any other value must be a
8694          * valid CR ring_id value for this function.
8695          */
8696         uint16_t seq_id;
8697         /* This value indicates the command sequence number. */
8698         uint16_t target_id;
8699         /*
8700          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8701          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8702          * - HWRM
8703          */
8704         uint64_t resp_addr;
8705         /*
8706          * This is the host address where the response will be written
8707          * when the request is complete. This area must be 16B aligned
8708          * and must be cleared to zero before the request is made.
8709          */
8710         uint8_t tunnel_type;
8711         /* Tunnel Type. */
8712         /* Virtual eXtensible Local Area Network        (VXLAN) */
8713         #define HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_VXLAN UINT32_C(0x1)
8714         /* Generic Network Virtualization Encapsulation (Geneve) */
8715         #define HWRM_TUNNEL_DST_PORT_FREE_INPUT_TUNNEL_TYPE_GENEVE UINT32_C(0x5)
8716         uint8_t unused_0;
8717         uint16_t tunnel_dst_port_id;
8718         /*
8719          * Identifier of a tunnel L4 destination port value. Only
8720          * applies to tunnel types that has l4 destination port
8721          * parameters.
8722          */
8723         uint32_t unused_1;
8724 } __attribute__((packed));
8725
8726 /* Output       (16 bytes) */
8727 struct hwrm_tunnel_dst_port_free_output {
8728         uint16_t error_code;
8729         /*
8730          * Pass/Fail or error type Note: receiver to verify the in
8731          * parameters, and fail the call with an error when appropriate
8732          */
8733         uint16_t req_type;
8734         /* This field returns the type of original request. */
8735         uint16_t seq_id;
8736         /* This field provides original sequence number of the command. */
8737         uint16_t resp_len;
8738         /*
8739          * This field is the length of the response in bytes. The last
8740          * byte of the response is a valid flag that will read as '1'
8741          * when the command has been completely written to memory.
8742          */
8743         uint32_t unused_0;
8744         uint8_t unused_1;
8745         uint8_t unused_2;
8746         uint8_t unused_3;
8747         uint8_t valid;
8748         /*
8749          * This field is used in Output records to indicate that the
8750          * output is completely written to RAM. This field should be
8751          * read as '1' to indicate that the output has been completely
8752          * written. When writing a command completion or response to an
8753          * internal processor, the order of writes has to be such that
8754          * this field is written last.
8755          */
8756 } __attribute__((packed));
8757
8758 /* hwrm_stat_ctx_alloc */
8759 /*
8760  * Description: This command allocates and does basic preparation for a stat
8761  * context.
8762  */
8763 /* Input        (32 bytes) */
8764 struct hwrm_stat_ctx_alloc_input {
8765         uint16_t req_type;
8766         /*
8767          * This value indicates what type of request this is. The format
8768          * for the rest of the command is determined by this field.
8769          */
8770         uint16_t cmpl_ring;
8771         /*
8772          * This value indicates the what completion ring the request
8773          * will be optionally completed on. If the value is -1, then no
8774          * CR completion will be generated. Any other value must be a
8775          * valid CR ring_id value for this function.
8776          */
8777         uint16_t seq_id;
8778         /* This value indicates the command sequence number. */
8779         uint16_t target_id;
8780         /*
8781          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8782          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8783          * - HWRM
8784          */
8785         uint64_t resp_addr;
8786         /*
8787          * This is the host address where the response will be written
8788          * when the request is complete. This area must be 16B aligned
8789          * and must be cleared to zero before the request is made.
8790          */
8791         uint64_t stats_dma_addr;
8792         /* This is the address for statistic block. */
8793         uint32_t update_period_ms;
8794         /*
8795          * The statistic block update period in ms. e.g. 250ms, 500ms,
8796          * 750ms, 1000ms. If update_period_ms is 0, then the stats
8797          * update shall be never done and the DMA address shall not be
8798          * used. In this case, the stat block can only be read by
8799          * hwrm_stat_ctx_query command.
8800          */
8801         uint8_t stat_ctx_flags;
8802         /*
8803          * This field is used to specify statistics context specific
8804          * configuration flags.
8805          */
8806         /*
8807          * When this bit is set to '1', the statistics context shall be
8808          * allocated for RoCE traffic only. In this case, traffic other
8809          * than offloaded RoCE traffic shall not be included in this
8810          * statistic context. When this bit is set to '0', the
8811          * statistics context shall be used for the network traffic
8812          * other than offloaded RoCE traffic.
8813          */
8814         #define HWRM_STAT_CTX_ALLOC_INPUT_STAT_CTX_FLAGS_ROCE   UINT32_C(0x1)
8815         uint8_t unused_0[3];
8816 } __attribute__((packed));
8817
8818 /* Output       (16 bytes) */
8819 struct hwrm_stat_ctx_alloc_output {
8820         uint16_t error_code;
8821         /*
8822          * Pass/Fail or error type Note: receiver to verify the in
8823          * parameters, and fail the call with an error when appropriate
8824          */
8825         uint16_t req_type;
8826         /* This field returns the type of original request. */
8827         uint16_t seq_id;
8828         /* This field provides original sequence number of the command. */
8829         uint16_t resp_len;
8830         /*
8831          * This field is the length of the response in bytes. The last
8832          * byte of the response is a valid flag that will read as '1'
8833          * when the command has been completely written to memory.
8834          */
8835         uint32_t stat_ctx_id;
8836         /* This is the statistics context ID value. */
8837         uint8_t unused_0;
8838         uint8_t unused_1;
8839         uint8_t unused_2;
8840         uint8_t valid;
8841         /*
8842          * This field is used in Output records to indicate that the
8843          * output is completely written to RAM. This field should be
8844          * read as '1' to indicate that the output has been completely
8845          * written. When writing a command completion or response to an
8846          * internal processor, the order of writes has to be such that
8847          * this field is written last.
8848          */
8849 } __attribute__((packed));
8850
8851 /* hwrm_stat_ctx_free */
8852 /* Description: This command is used to free a stat context. */
8853 /* Input        (24 bytes) */
8854 struct hwrm_stat_ctx_free_input {
8855         uint16_t req_type;
8856         /*
8857          * This value indicates what type of request this is. The format
8858          * for the rest of the command is determined by this field.
8859          */
8860         uint16_t cmpl_ring;
8861         /*
8862          * This value indicates the what completion ring the request
8863          * will be optionally completed on. If the value is -1, then no
8864          * CR completion will be generated. Any other value must be a
8865          * valid CR ring_id value for this function.
8866          */
8867         uint16_t seq_id;
8868         /* This value indicates the command sequence number. */
8869         uint16_t target_id;
8870         /*
8871          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8872          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8873          * - HWRM
8874          */
8875         uint64_t resp_addr;
8876         /*
8877          * This is the host address where the response will be written
8878          * when the request is complete. This area must be 16B aligned
8879          * and must be cleared to zero before the request is made.
8880          */
8881         uint32_t stat_ctx_id;
8882         /* ID of the statistics context that is being queried. */
8883         uint32_t unused_0;
8884 } __attribute__((packed));
8885
8886 /* Output       (16 bytes) */
8887 struct hwrm_stat_ctx_free_output {
8888         uint16_t error_code;
8889         /*
8890          * Pass/Fail or error type Note: receiver to verify the in
8891          * parameters, and fail the call with an error when appropriate
8892          */
8893         uint16_t req_type;
8894         /* This field returns the type of original request. */
8895         uint16_t seq_id;
8896         /* This field provides original sequence number of the command. */
8897         uint16_t resp_len;
8898         /*
8899          * This field is the length of the response in bytes. The last
8900          * byte of the response is a valid flag that will read as '1'
8901          * when the command has been completely written to memory.
8902          */
8903         uint32_t stat_ctx_id;
8904         /* This is the statistics context ID value. */
8905         uint8_t unused_0;
8906         uint8_t unused_1;
8907         uint8_t unused_2;
8908         uint8_t valid;
8909         /*
8910          * This field is used in Output records to indicate that the
8911          * output is completely written to RAM. This field should be
8912          * read as '1' to indicate that the output has been completely
8913          * written. When writing a command completion or response to an
8914          * internal processor, the order of writes has to be such that
8915          * this field is written last.
8916          */
8917 } __attribute__((packed));
8918
8919 /* hwrm_stat_ctx_clr_stats */
8920 /* Description: This command clears statistics of a context. */
8921 /* Input        (24 bytes) */
8922 struct hwrm_stat_ctx_clr_stats_input {
8923         uint16_t req_type;
8924         /*
8925          * This value indicates what type of request this is. The format
8926          * for the rest of the command is determined by this field.
8927          */
8928         uint16_t cmpl_ring;
8929         /*
8930          * This value indicates the what completion ring the request
8931          * will be optionally completed on. If the value is -1, then no
8932          * CR completion will be generated. Any other value must be a
8933          * valid CR ring_id value for this function.
8934          */
8935         uint16_t seq_id;
8936         /* This value indicates the command sequence number. */
8937         uint16_t target_id;
8938         /*
8939          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
8940          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
8941          * - HWRM
8942          */
8943         uint64_t resp_addr;
8944         /*
8945          * This is the host address where the response will be written
8946          * when the request is complete. This area must be 16B aligned
8947          * and must be cleared to zero before the request is made.
8948          */
8949         uint32_t stat_ctx_id;
8950         /* ID of the statistics context that is being queried. */
8951         uint32_t unused_0;
8952 } __attribute__((packed));
8953
8954 /* Output       (16 bytes) */
8955 struct hwrm_stat_ctx_clr_stats_output {
8956         uint16_t error_code;
8957         /*
8958          * Pass/Fail or error type Note: receiver to verify the in
8959          * parameters, and fail the call with an error when appropriate
8960          */
8961         uint16_t req_type;
8962         /* This field returns the type of original request. */
8963         uint16_t seq_id;
8964         /* This field provides original sequence number of the command. */
8965         uint16_t resp_len;
8966         /*
8967          * This field is the length of the response in bytes. The last
8968          * byte of the response is a valid flag that will read as '1'
8969          * when the command has been completely written to memory.
8970          */
8971         uint32_t unused_0;
8972         uint8_t unused_1;
8973         uint8_t unused_2;
8974         uint8_t unused_3;
8975         uint8_t valid;
8976         /*
8977          * This field is used in Output records to indicate that the
8978          * output is completely written to RAM. This field should be
8979          * read as '1' to indicate that the output has been completely
8980          * written. When writing a command completion or response to an
8981          * internal processor, the order of writes has to be such that
8982          * this field is written last.
8983          */
8984 } __attribute__((packed));
8985
8986 /* hwrm_stat_ctx_query */
8987 /* Description: This command returns statistics of a context. */
8988 /* Input (24 bytes) */
8989
8990 struct hwrm_stat_ctx_query_input {
8991         uint16_t req_type;
8992         /*
8993          * This value indicates what type of request this is. The format for the
8994          * rest of the command is determined by this field.
8995          */
8996         uint16_t cmpl_ring;
8997         /*
8998          * This value indicates the what completion ring the request will be
8999          * optionally completed on. If the value is -1, then no CR completion
9000          * will be generated. Any other value must be a valid CR ring_id value
9001          * for this function.
9002          */
9003         uint16_t seq_id;
9004         /* This value indicates the command sequence number. */
9005         uint16_t target_id;
9006         /*
9007          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
9008          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
9009          */
9010         uint64_t resp_addr;
9011         /*
9012          * This is the host address where the response will be written when the
9013          * request is complete. This area must be 16B aligned and must be
9014          * cleared to zero before the request is made.
9015          */
9016         uint32_t stat_ctx_id;
9017         /* ID of the statistics context that is being queried. */
9018         uint32_t unused_0;
9019 } __attribute__((packed));
9020
9021 /* Output (176 bytes) */
9022
9023 struct hwrm_stat_ctx_query_output {
9024         uint16_t error_code;
9025         /*
9026          * Pass/Fail or error type Note: receiver to verify the in parameters,
9027          * and fail the call with an error when appropriate
9028          */
9029         uint16_t req_type;
9030         /* This field returns the type of original request. */
9031         uint16_t seq_id;
9032         /* This field provides original sequence number of the command. */
9033         uint16_t resp_len;
9034         /*
9035          * This field is the length of the response in bytes. The last byte of
9036          * the response is a valid flag that will read as '1' when the command
9037          * has been completely written to memory.
9038          */
9039         uint64_t tx_ucast_pkts;
9040         /* Number of transmitted unicast packets */
9041         uint64_t tx_mcast_pkts;
9042         /* Number of transmitted multicast packets */
9043         uint64_t tx_bcast_pkts;
9044         /* Number of transmitted broadcast packets */
9045         uint64_t tx_err_pkts;
9046         /* Number of transmitted packets with error */
9047         uint64_t tx_drop_pkts;
9048         /* Number of dropped packets on transmit path */
9049         uint64_t tx_ucast_bytes;
9050         /* Number of transmitted bytes for unicast traffic */
9051         uint64_t tx_mcast_bytes;
9052         /* Number of transmitted bytes for multicast traffic */
9053         uint64_t tx_bcast_bytes;
9054         /* Number of transmitted bytes for broadcast traffic */
9055         uint64_t rx_ucast_pkts;
9056         /* Number of received unicast packets */
9057         uint64_t rx_mcast_pkts;
9058         /* Number of received multicast packets */
9059         uint64_t rx_bcast_pkts;
9060         /* Number of received broadcast packets */
9061         uint64_t rx_err_pkts;
9062         /* Number of received packets with error */
9063         uint64_t rx_drop_pkts;
9064         /* Number of dropped packets on received path */
9065         uint64_t rx_ucast_bytes;
9066         /* Number of received bytes for unicast traffic */
9067         uint64_t rx_mcast_bytes;
9068         /* Number of received bytes for multicast traffic */
9069         uint64_t rx_bcast_bytes;
9070         /* Number of received bytes for broadcast traffic */
9071         uint64_t rx_agg_pkts;
9072         /* Number of aggregated unicast packets */
9073         uint64_t rx_agg_bytes;
9074         /* Number of aggregated unicast bytes */
9075         uint64_t rx_agg_events;
9076         /* Number of aggregation events */
9077         uint64_t rx_agg_aborts;
9078         /* Number of aborted aggregations */
9079         uint32_t unused_0;
9080         uint8_t unused_1;
9081         uint8_t unused_2;
9082         uint8_t unused_3;
9083         uint8_t valid;
9084         /*
9085          * This field is used in Output records to indicate that the output is
9086          * completely written to RAM. This field should be read as '1' to
9087          * indicate that the output has been completely written. When writing a
9088          * command completion or response to an internal processor, the order of
9089          * writes has to be such that this field is written last.
9090          */
9091 } __attribute__((packed));
9092
9093 /* hwrm_exec_fwd_resp */
9094 /*
9095  * Description: This command is used to send an encapsulated request to the
9096  * HWRM. This command instructs the HWRM to execute the request and forward the
9097  * response of the encapsulated request to the location specified in the
9098  * original request that is encapsulated. The target id of this command shall be
9099  * set to 0xFFFF (HWRM). The response location in this command shall be used to
9100  * acknowledge the receipt of the encapsulated request and forwarding of the
9101  * response.
9102  */
9103 /* Input        (128 bytes) */
9104 struct hwrm_exec_fwd_resp_input {
9105         uint16_t req_type;
9106         /*
9107          * This value indicates what type of request this is. The format
9108          * for the rest of the command is determined by this field.
9109          */
9110         uint16_t cmpl_ring;
9111         /*
9112          * This value indicates the what completion ring the request
9113          * will be optionally completed on. If the value is -1, then no
9114          * CR completion will be generated. Any other value must be a
9115          * valid CR ring_id value for this function.
9116          */
9117         uint16_t seq_id;
9118         /* This value indicates the command sequence number. */
9119         uint16_t target_id;
9120         /*
9121          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9122          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9123          * - HWRM
9124          */
9125         uint64_t resp_addr;
9126         /*
9127          * This is the host address where the response will be written
9128          * when the request is complete. This area must be 16B aligned
9129          * and must be cleared to zero before the request is made.
9130          */
9131         uint32_t encap_request[26];
9132         /*
9133          * This is an encapsulated request. This request should be
9134          * executed by the HWRM and the response should be provided in
9135          * the response buffer inside the encapsulated request.
9136          */
9137         uint16_t encap_resp_target_id;
9138         /*
9139          * This value indicates the target id of the response to the
9140          * encapsulated request. 0x0 - 0xFFF8 - Used for function ids
9141          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF -
9142          * HWRM
9143          */
9144         uint16_t unused_0[3];
9145 } __attribute__((packed));
9146
9147 /* Output       (16 bytes) */
9148 struct hwrm_exec_fwd_resp_output {
9149         uint16_t error_code;
9150         /*
9151          * Pass/Fail or error type Note: receiver to verify the in
9152          * parameters, and fail the call with an error when appropriate
9153          */
9154         uint16_t req_type;
9155         /* This field returns the type of original request. */
9156         uint16_t seq_id;
9157         /* This field provides original sequence number of the command. */
9158         uint16_t resp_len;
9159         /*
9160          * This field is the length of the response in bytes. The last
9161          * byte of the response is a valid flag that will read as '1'
9162          * when the command has been completely written to memory.
9163          */
9164         uint32_t unused_0;
9165         uint8_t unused_1;
9166         uint8_t unused_2;
9167         uint8_t unused_3;
9168         uint8_t valid;
9169         /*
9170          * This field is used in Output records to indicate that the
9171          * output is completely written to RAM. This field should be
9172          * read as '1' to indicate that the output has been completely
9173          * written. When writing a command completion or response to an
9174          * internal processor, the order of writes has to be such that
9175          * this field is written last.
9176          */
9177 } __attribute__((packed));
9178
9179 /* hwrm_reject_fwd_resp */
9180 /*
9181  * Description: This command is used to send an encapsulated request to the
9182  * HWRM. This command instructs the HWRM to reject the request and forward the
9183  * error response of the encapsulated request to the location specified in the
9184  * original request that is encapsulated. The target id of this command shall be
9185  * set to 0xFFFF (HWRM). The response location in this command shall be used to
9186  * acknowledge the receipt of the encapsulated request and forwarding of the
9187  * response.
9188  */
9189 /* Input        (128 bytes) */
9190 struct hwrm_reject_fwd_resp_input {
9191         uint16_t req_type;
9192         /*
9193          * This value indicates what type of request this is. The format
9194          * for the rest of the command is determined by this field.
9195          */
9196         uint16_t cmpl_ring;
9197         /*
9198          * This value indicates the what completion ring the request
9199          * will be optionally completed on. If the value is -1, then no
9200          * CR completion will be generated. Any other value must be a
9201          * valid CR ring_id value for this function.
9202          */
9203         uint16_t seq_id;
9204         /* This value indicates the command sequence number. */
9205         uint16_t target_id;
9206         /*
9207          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9208          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9209          * - HWRM
9210          */
9211         uint64_t resp_addr;
9212         /*
9213          * This is the host address where the response will be written
9214          * when the request is complete. This area must be 16B aligned
9215          * and must be cleared to zero before the request is made.
9216          */
9217         uint32_t encap_request[26];
9218         /*
9219          * This is an encapsulated request. This request should be
9220          * rejected by the HWRM and the error response should be
9221          * provided in the response buffer inside the encapsulated
9222          * request.
9223          */
9224         uint16_t encap_resp_target_id;
9225         /*
9226          * This value indicates the target id of the response to the
9227          * encapsulated request. 0x0 - 0xFFF8 - Used for function ids
9228          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF -
9229          * HWRM
9230          */
9231         uint16_t unused_0[3];
9232 } __attribute__((packed));
9233
9234 /* Output       (16 bytes) */
9235 struct hwrm_reject_fwd_resp_output {
9236         uint16_t error_code;
9237         /*
9238          * Pass/Fail or error type Note: receiver to verify the in
9239          * parameters, and fail the call with an error when appropriate
9240          */
9241         uint16_t req_type;
9242         /* This field returns the type of original request. */
9243         uint16_t seq_id;
9244         /* This field provides original sequence number of the command. */
9245         uint16_t resp_len;
9246         /*
9247          * This field is the length of the response in bytes. The last
9248          * byte of the response is a valid flag that will read as '1'
9249          * when the command has been completely written to memory.
9250          */
9251         uint32_t unused_0;
9252         uint8_t unused_1;
9253         uint8_t unused_2;
9254         uint8_t unused_3;
9255         uint8_t valid;
9256         /*
9257          * This field is used in Output records to indicate that the
9258          * output is completely written to RAM. This field should be
9259          * read as '1' to indicate that the output has been completely
9260          * written. When writing a command completion or response to an
9261          * internal processor, the order of writes has to be such that
9262          * this field is written last.
9263          */
9264 } __attribute__((packed));
9265
9266 /* Hardware Resource Manager Specification */
9267 /* Description: This structure is used to specify port description. */
9268 /*
9269  * Note: The Hardware Resource Manager (HWRM) manages various hardware resources
9270  * inside the chip. The HWRM is implemented in firmware, and runs on embedded
9271  * processors inside the chip. This firmware service is vital part of the chip.
9272  * The chip can not be used by a driver or HWRM client without the HWRM.
9273  */
9274 /* Input        (16 bytes) */
9275 struct input {
9276         uint16_t req_type;
9277         /*
9278          * This value indicates what type of request this is. The format
9279          * for the rest of the command is determined by this field.
9280          */
9281         uint16_t cmpl_ring;
9282         /*
9283          * This value indicates the what completion ring the request
9284          * will be optionally completed on. If the value is -1, then no
9285          * CR completion will be generated. Any other value must be a
9286          * valid CR ring_id value for this function.
9287          */
9288         uint16_t seq_id;
9289         /* This value indicates the command sequence number. */
9290         uint16_t target_id;
9291         /*
9292          * Target ID of this command. 0x0 - 0xFFF8 - Used for function
9293          * ids 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF
9294          * - HWRM
9295          */
9296         uint64_t resp_addr;
9297         /*
9298          * This is the host address where the response will be written
9299          * when the request is complete. This area must be 16B aligned
9300          * and must be cleared to zero before the request is made.
9301          */
9302 } __attribute__((packed));
9303
9304 /* Output       (8 bytes) */
9305 struct output {
9306         uint16_t error_code;
9307         /*
9308          * Pass/Fail or error type Note: receiver to verify the in
9309          * parameters, and fail the call with an error when appropriate
9310          */
9311         uint16_t req_type;
9312         /* This field returns the type of original request. */
9313         uint16_t seq_id;
9314         /* This field provides original sequence number of the command. */
9315         uint16_t resp_len;
9316         /*
9317          * This field is the length of the response in bytes. The last
9318          * byte of the response is a valid flag that will read as '1'
9319          * when the command has been completely written to memory.
9320          */
9321 } __attribute__((packed));
9322
9323 #define HWRM_GET_HWRM_ERROR_CODE(arg) \
9324         { \
9325                 typeof(arg) x = (arg); \
9326         ((x) == 0xf ? "HWRM_ERROR" : \
9327         ((x) == 0xffff ? "CMD_NOT_SUPPORTED" : \
9328         ((x) == 0xfffe ? "UNKNOWN_ERR" : \
9329         ((x) == 0x4 ? "RESOURCE_ALLOC_ERROR" : \
9330         ((x) == 0x5 ? "INVALID_FLAGS" : \
9331         ((x) == 0x6 ? "INVALID_ENABLES" : \
9332         ((x) == 0x0 ? "SUCCESS" : \
9333         ((x) == 0x1 ? "FAIL" : \
9334         ((x) == 0x2 ? "INVALID_PARAMS" : \
9335         ((x) == 0x3 ? "RESOURCE_ACCESS_DENIED" : \
9336         "Unknown error_code")))))))))) \
9337         }
9338
9339 /* Return Codes (8 bytes) */
9340 struct ret_codes {
9341         uint16_t error_code;
9342         /* These are numbers assigned to return/error codes. */
9343         /* Request was successfully executed by the HWRM. */
9344         #define HWRM_ERR_CODE_SUCCESS   (UINT32_C(0x0))
9345         /* THe HWRM failed to execute the request. */
9346         #define HWRM_ERR_CODE_FAIL      (UINT32_C(0x1))
9347         /*
9348          * The request contains invalid argument(s) or
9349          * input parameters.
9350          */
9351         #define HWRM_ERR_CODE_INVALID_PARAMS    (UINT32_C(0x2))
9352         /*
9353          * The requester is not allowed to access the
9354          * requested resource. This error code shall be
9355          * provided in a response to a request to query
9356          * or modify an existing resource that is not
9357          * accessible by the requester.
9358          */
9359         #define HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED    (UINT32_C(0x3))
9360         /*
9361          * The HWRM is unable to allocate the requested
9362          * resource. This code only applies to requests
9363          * for HWRM resource allocations.
9364          */
9365         #define HWRM_ERR_CODE_RESOURCE_ALLOC_ERROR      (UINT32_C(0x4))
9366         /* Invalid combination of flags is specified in the request. */
9367         #define HWRM_ERR_CODE_INVALID_FLAGS     (UINT32_C(0x5))
9368         /*
9369          * Invalid combination of enables fields is
9370          * specified in the request.
9371          */
9372         #define HWRM_ERR_CODE_INVALID_ENABLES   (UINT32_C(0x6))
9373         /*
9374          * Generic HWRM execution error that represents
9375          * an internal error.
9376          */
9377         #define HWRM_ERR_CODE_HWRM_ERROR        (UINT32_C(0xf))
9378         /* Unknown error */
9379         #define HWRM_ERR_CODE_UNKNOWN_ERR       (UINT32_C(0xfffe))
9380         /* Unsupported or invalid command */
9381         #define HWRM_ERR_CODE_CMD_NOT_SUPPORTED (UINT32_C(0xffff))
9382         uint16_t unused_0[3];
9383 } __attribute__((packed));
9384
9385 /* Output       (16 bytes) */
9386 struct hwrm_err_output {
9387         uint16_t error_code;
9388         /*
9389          * Pass/Fail or error type Note: receiver to verify the in
9390          * parameters, and fail the call with an error when appropriate
9391          */
9392         uint16_t req_type;
9393         /* This field returns the type of original request. */
9394         uint16_t seq_id;
9395         /* This field provides original sequence number of the command. */
9396         uint16_t resp_len;
9397         /*
9398          * This field is the length of the response in bytes. The last
9399          * byte of the response is a valid flag that will read as '1'
9400          * when the command has been completely written to memory.
9401          */
9402         uint32_t opaque_0;
9403         /* debug info for this error response. */
9404         uint16_t opaque_1;
9405         /* debug info for this error response. */
9406         uint8_t cmd_err;
9407         /*
9408          * In the case of an error response, command specific error code
9409          * is returned in this field.
9410          */
9411         uint8_t valid;
9412         /*
9413          * This field is used in Output records to indicate that the
9414          * output is completely written to RAM. This field should be
9415          * read as '1' to indicate that the output has been completely
9416          * written. When writing a command completion or response to an
9417          * internal processor, the order of writes has to be such that
9418          * this field is written last.
9419          */
9420 } __attribute__((packed));
9421
9422 /* Port Tx Statistics Formats   (408 bytes) */
9423 struct tx_port_stats {
9424         uint64_t tx_64b_frames;
9425         /* Total Number of 64 Bytes frames transmitted */
9426         uint64_t tx_65b_127b_frames;
9427         /* Total Number of 65-127 Bytes frames transmitted */
9428         uint64_t tx_128b_255b_frames;
9429         /* Total Number of 128-255 Bytes frames transmitted */
9430         uint64_t tx_256b_511b_frames;
9431         /* Total Number of 256-511 Bytes frames transmitted */
9432         uint64_t tx_512b_1023b_frames;
9433         /* Total Number of 512-1023 Bytes frames transmitted */
9434         uint64_t tx_1024b_1518_frames;
9435         /* Total Number of 1024-1518 Bytes frames transmitted */
9436         uint64_t tx_good_vlan_frames;
9437         /*
9438          * Total Number of each good VLAN       (exludes FCS errors) frame
9439          * transmitted which is 1519 to 1522 bytes in length inclusive
9440          *      (excluding framing bits but including FCS bytes).
9441          */
9442         uint64_t tx_1519b_2047_frames;
9443         /* Total Number of 1519-2047 Bytes frames transmitted */
9444         uint64_t tx_2048b_4095b_frames;
9445         /* Total Number of 2048-4095 Bytes frames transmitted */
9446         uint64_t tx_4096b_9216b_frames;
9447         /* Total Number of 4096-9216 Bytes frames transmitted */
9448         uint64_t tx_9217b_16383b_frames;
9449         /* Total Number of 9217-16383 Bytes frames transmitted */
9450         uint64_t tx_good_frames;
9451         /* Total Number of good frames transmitted */
9452         uint64_t tx_total_frames;
9453         /* Total Number of frames transmitted */
9454         uint64_t tx_ucast_frames;
9455         /* Total number of unicast frames transmitted */
9456         uint64_t tx_mcast_frames;
9457         /* Total number of multicast frames transmitted */
9458         uint64_t tx_bcast_frames;
9459         /* Total number of broadcast frames transmitted */
9460         uint64_t tx_pause_frames;
9461         /* Total number of PAUSE control frames transmitted */
9462         uint64_t tx_pfc_frames;
9463         /* Total number of PFC/per-priority PAUSE control frames transmitted */
9464         uint64_t tx_jabber_frames;
9465         /* Total number of jabber frames transmitted */
9466         uint64_t tx_fcs_err_frames;
9467         /* Total number of frames transmitted with FCS error */
9468         uint64_t tx_control_frames;
9469         /* Total number of control frames transmitted */
9470         uint64_t tx_oversz_frames;
9471         /* Total number of over-sized frames transmitted */
9472         uint64_t tx_single_dfrl_frames;
9473         /* Total number of frames with single deferral */
9474         uint64_t tx_multi_dfrl_frames;
9475         /* Total number of frames with multiple deferrals */
9476         uint64_t tx_single_coll_frames;
9477         /* Total number of frames with single collision */
9478         uint64_t tx_multi_coll_frames;
9479         /* Total number of frames with multiple collisions */
9480         uint64_t tx_late_coll_frames;
9481         /* Total number of frames with late collisions */
9482         uint64_t tx_excessive_coll_frames;
9483         /* Total number of frames with excessive collisions */
9484         uint64_t tx_frag_frames;
9485         /* Total number of fragmented frames transmitted */
9486         uint64_t tx_err;
9487         /* Total number of transmit errors */
9488         uint64_t tx_tagged_frames;
9489         /* Total number of single VLAN tagged frames transmitted */
9490         uint64_t tx_dbl_tagged_frames;
9491         /* Total number of double VLAN tagged frames transmitted */
9492         uint64_t tx_runt_frames;
9493         /* Total number of runt frames transmitted */
9494         uint64_t tx_fifo_underruns;
9495         /* Total number of TX FIFO under runs */
9496         uint64_t tx_pfc_ena_frames_pri0;
9497         /*
9498          * Total number of PFC frames with PFC enabled bit for Pri 0
9499          * transmitted
9500          */
9501         uint64_t tx_pfc_ena_frames_pri1;
9502         /*
9503          * Total number of PFC frames with PFC enabled bit for Pri 1
9504          * transmitted
9505          */
9506         uint64_t tx_pfc_ena_frames_pri2;
9507         /*
9508          * Total number of PFC frames with PFC enabled bit for Pri 2
9509          * transmitted
9510          */
9511         uint64_t tx_pfc_ena_frames_pri3;
9512         /*
9513          * Total number of PFC frames with PFC enabled bit for Pri 3
9514          * transmitted
9515          */
9516         uint64_t tx_pfc_ena_frames_pri4;
9517         /*
9518          * Total number of PFC frames with PFC enabled bit for Pri 4
9519          * transmitted
9520          */
9521         uint64_t tx_pfc_ena_frames_pri5;
9522         /*
9523          * Total number of PFC frames with PFC enabled bit for Pri 5
9524          * transmitted
9525          */
9526         uint64_t tx_pfc_ena_frames_pri6;
9527         /*
9528          * Total number of PFC frames with PFC enabled bit for Pri 6
9529          * transmitted
9530          */
9531         uint64_t tx_pfc_ena_frames_pri7;
9532         /*
9533          * Total number of PFC frames with PFC enabled bit for Pri 7
9534          * transmitted
9535          */
9536         uint64_t tx_eee_lpi_events;
9537         /* Total number of EEE LPI Events on TX */
9538         uint64_t tx_eee_lpi_duration;
9539         /* EEE LPI Duration Counter on TX */
9540         uint64_t tx_llfc_logical_msgs;
9541         /*
9542          * Total number of Link Level Flow Control      (LLFC) messages
9543          * transmitted
9544          */
9545         uint64_t tx_hcfc_msgs;
9546         /* Total number of HCFC messages transmitted */
9547         uint64_t tx_total_collisions;
9548         /* Total number of TX collisions */
9549         uint64_t tx_bytes;
9550         /* Total number of transmitted bytes */
9551         uint64_t tx_xthol_frames;
9552         /* Total number of end-to-end HOL frames */
9553         uint64_t tx_stat_discard;
9554         /* Total Tx Drops per Port reported by STATS block */
9555         uint64_t tx_stat_error;
9556         /* Total Tx Error Drops per Port reported by STATS block */
9557 } __attribute__((packed));
9558
9559 /* Port Rx Statistics Formats   (528 bytes) */
9560 struct rx_port_stats {
9561         uint64_t rx_64b_frames;
9562         /* Total Number of 64 Bytes frames received */
9563         uint64_t rx_65b_127b_frames;
9564         /* Total Number of 65-127 Bytes frames received */
9565         uint64_t rx_128b_255b_frames;
9566         /* Total Number of 128-255 Bytes frames received */
9567         uint64_t rx_256b_511b_frames;
9568         /* Total Number of 256-511 Bytes frames received */
9569         uint64_t rx_512b_1023b_frames;
9570         /* Total Number of 512-1023 Bytes frames received */
9571         uint64_t rx_1024b_1518_frames;
9572         /* Total Number of 1024-1518 Bytes frames received */
9573         uint64_t rx_good_vlan_frames;
9574         /*
9575          * Total Number of each good VLAN       (exludes FCS errors) frame
9576          * received which is 1519 to 1522 bytes in length inclusive
9577          *      (excluding framing bits but including FCS bytes).
9578          */
9579         uint64_t rx_1519b_2047b_frames;
9580         /* Total Number of 1519-2047 Bytes frames received */
9581         uint64_t rx_2048b_4095b_frames;
9582         /* Total Number of 2048-4095 Bytes frames received */
9583         uint64_t rx_4096b_9216b_frames;
9584         /* Total Number of 4096-9216 Bytes frames received */
9585         uint64_t rx_9217b_16383b_frames;
9586         /* Total Number of 9217-16383 Bytes frames received */
9587         uint64_t rx_total_frames;
9588         /* Total number of frames received */
9589         uint64_t rx_ucast_frames;
9590         /* Total number of unicast frames received */
9591         uint64_t rx_mcast_frames;
9592         /* Total number of multicast frames received */
9593         uint64_t rx_bcast_frames;
9594         /* Total number of broadcast frames received */
9595         uint64_t rx_fcs_err_frames;
9596         /* Total number of received frames with FCS error */
9597         uint64_t rx_ctrl_frames;
9598         /* Total number of control frames received */
9599         uint64_t rx_pause_frames;
9600         /* Total number of PAUSE frames received */
9601         uint64_t rx_pfc_frames;
9602         /* Total number of PFC frames received */
9603         uint64_t rx_unsupported_opcode_frames;
9604         /* Total number of frames received with an unsupported opcode */
9605         uint64_t rx_unsupported_da_pausepfc_frames;
9606         /*
9607          * Total number of frames received with an unsupported DA for
9608          * pause and PFC
9609          */
9610         uint64_t rx_wrong_sa_frames;
9611         /* Total number of frames received with an unsupported SA */
9612         uint64_t rx_align_err_frames;
9613         /* Total number of received packets with alignment error */
9614         uint64_t rx_oor_len_frames;
9615         /* Total number of received frames with out-of-range length */
9616         uint64_t rx_code_err_frames;
9617         /* Total number of received frames with error termination */
9618         uint64_t rx_false_carrier_frames;
9619         /*
9620          * Total number of received frames with a false carrier is
9621          * detected during idle, as defined by RX_ER samples active and
9622          * RXD is 0xE. The event is reported along with the statistics
9623          * generated on the next received frame. Only one false carrier
9624          * condition can be detected and logged between frames. Carrier
9625          * event, valid for 10M/100M speed modes only.
9626          */
9627         uint64_t rx_ovrsz_frames;
9628         /* Total number of over-sized frames received */
9629         uint64_t rx_jbr_frames;
9630         /* Total number of jabber packets received */
9631         uint64_t rx_mtu_err_frames;
9632         /* Total number of received frames with MTU error */
9633         uint64_t rx_match_crc_frames;
9634         /* Total number of received frames with CRC match */
9635         uint64_t rx_promiscuous_frames;
9636         /* Total number of frames received promiscuously */
9637         uint64_t rx_tagged_frames;
9638         /* Total number of received frames with one or two VLAN tags */
9639         uint64_t rx_double_tagged_frames;
9640         /* Total number of received frames with two VLAN tags */
9641         uint64_t rx_trunc_frames;
9642         /* Total number of truncated frames received */
9643         uint64_t rx_good_frames;
9644         /* Total number of good frames  (without errors) received */
9645         uint64_t rx_pfc_xon2xoff_frames_pri0;
9646         /*
9647          * Total number of received PFC frames with transition from XON
9648          * to XOFF on Pri 0
9649          */
9650         uint64_t rx_pfc_xon2xoff_frames_pri1;
9651         /*
9652          * Total number of received PFC frames with transition from XON
9653          * to XOFF on Pri 1
9654          */
9655         uint64_t rx_pfc_xon2xoff_frames_pri2;
9656         /*
9657          * Total number of received PFC frames with transition from XON
9658          * to XOFF on Pri 2
9659          */
9660         uint64_t rx_pfc_xon2xoff_frames_pri3;
9661         /*
9662          * Total number of received PFC frames with transition from XON
9663          * to XOFF on Pri 3
9664          */
9665         uint64_t rx_pfc_xon2xoff_frames_pri4;
9666         /*
9667          * Total number of received PFC frames with transition from XON
9668          * to XOFF on Pri 4
9669          */
9670         uint64_t rx_pfc_xon2xoff_frames_pri5;
9671         /*
9672          * Total number of received PFC frames with transition from XON
9673          * to XOFF on Pri 5
9674          */
9675         uint64_t rx_pfc_xon2xoff_frames_pri6;
9676         /*
9677          * Total number of received PFC frames with transition from XON
9678          * to XOFF on Pri 6
9679          */
9680         uint64_t rx_pfc_xon2xoff_frames_pri7;
9681         /*
9682          * Total number of received PFC frames with transition from XON
9683          * to XOFF on Pri 7
9684          */
9685         uint64_t rx_pfc_ena_frames_pri0;
9686         /*
9687          * Total number of received PFC frames with PFC enabled bit for
9688          * Pri 0
9689          */
9690         uint64_t rx_pfc_ena_frames_pri1;
9691         /*
9692          * Total number of received PFC frames with PFC enabled bit for
9693          * Pri 1
9694          */
9695         uint64_t rx_pfc_ena_frames_pri2;
9696         /*
9697          * Total number of received PFC frames with PFC enabled bit for
9698          * Pri 2
9699          */
9700         uint64_t rx_pfc_ena_frames_pri3;
9701         /*
9702          * Total number of received PFC frames with PFC enabled bit for
9703          * Pri 3
9704          */
9705         uint64_t rx_pfc_ena_frames_pri4;
9706         /*
9707          * Total number of received PFC frames with PFC enabled bit for
9708          * Pri 4
9709          */
9710         uint64_t rx_pfc_ena_frames_pri5;
9711         /*
9712          * Total number of received PFC frames with PFC enabled bit for
9713          * Pri 5
9714          */
9715         uint64_t rx_pfc_ena_frames_pri6;
9716         /*
9717          * Total number of received PFC frames with PFC enabled bit for
9718          * Pri 6
9719          */
9720         uint64_t rx_pfc_ena_frames_pri7;
9721         /*
9722          * Total number of received PFC frames with PFC enabled bit for
9723          * Pri 7
9724          */
9725         uint64_t rx_sch_crc_err_frames;
9726         /* Total Number of frames received with SCH CRC error */
9727         uint64_t rx_undrsz_frames;
9728         /* Total Number of under-sized frames received */
9729         uint64_t rx_frag_frames;
9730         /* Total Number of fragmented frames received */
9731         uint64_t rx_eee_lpi_events;
9732         /* Total number of RX EEE LPI Events */
9733         uint64_t rx_eee_lpi_duration;
9734         /* EEE LPI Duration Counter on RX */
9735         uint64_t rx_llfc_physical_msgs;
9736         /*
9737          * Total number of physical type Link Level Flow Control        (LLFC)
9738          * messages received
9739          */
9740         uint64_t rx_llfc_logical_msgs;
9741         /*
9742          * Total number of logical type Link Level Flow Control (LLFC)
9743          * messages received
9744          */
9745         uint64_t rx_llfc_msgs_with_crc_err;
9746         /*
9747          * Total number of logical type Link Level Flow Control (LLFC)
9748          * messages received with CRC error
9749          */
9750         uint64_t rx_hcfc_msgs;
9751         /* Total number of HCFC messages received */
9752         uint64_t rx_hcfc_msgs_with_crc_err;
9753         /* Total number of HCFC messages received with CRC error */
9754         uint64_t rx_bytes;
9755         /* Total number of received bytes */
9756         uint64_t rx_runt_bytes;
9757         /* Total number of bytes received in runt frames */
9758         uint64_t rx_runt_frames;
9759         /* Total number of runt frames received */
9760         uint64_t rx_stat_discard;
9761         /* Total Rx Discards per Port reported by STATS block */
9762         uint64_t rx_stat_err;
9763         /* Total Rx Error Drops per Port reported by STATS block */
9764 } __attribute__((packed));
9765
9766 /* Periodic Statistics Context DMA to host      (160 bytes) */
9767 /*
9768  * per-context HW statistics -- chip view
9769  */
9770
9771 struct ctx_hw_stats64 {
9772         uint64_t rx_ucast_pkts;
9773         uint64_t rx_mcast_pkts;
9774         uint64_t rx_bcast_pkts;
9775         uint64_t rx_drop_pkts;
9776         uint64_t rx_discard_pkts;
9777         uint64_t rx_ucast_bytes;
9778         uint64_t rx_mcast_bytes;
9779         uint64_t rx_bcast_bytes;
9780
9781         uint64_t tx_ucast_pkts;
9782         uint64_t tx_mcast_pkts;
9783         uint64_t tx_bcast_pkts;
9784         uint64_t tx_drop_pkts;
9785         uint64_t tx_discard_pkts;
9786         uint64_t tx_ucast_bytes;
9787         uint64_t tx_mcast_bytes;
9788         uint64_t tx_bcast_bytes;
9789
9790         uint64_t tpa_pkts;
9791         uint64_t tpa_bytes;
9792         uint64_t tpa_events;
9793         uint64_t tpa_aborts;
9794 } __attribute__((packed));
9795
9796 #endif /* _HSI_STRUCT_DEF_DPDK_ */