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