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