net/bnxt: configure RSS
[dpdk.git] / drivers / net / bnxt / hsi_struct_def_dpdk.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 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_EXTERNAL_H_
35 #define _HSI_STRUCT_DEF_EXTERNAL_H_
36
37 /*
38  * per-context HW statistics -- chip view
39  */
40
41 struct ctx_hw_stats64 {
42         uint64_t rx_ucast_pkts;
43         uint64_t rx_mcast_pkts;
44         uint64_t rx_bcast_pkts;
45         uint64_t rx_drop_pkts;
46         uint64_t rx_err_pkts;
47         uint64_t rx_ucast_bytes;
48         uint64_t rx_mcast_bytes;
49         uint64_t rx_bcast_bytes;
50
51         uint64_t tx_ucast_pkts;
52         uint64_t tx_mcast_pkts;
53         uint64_t tx_bcast_pkts;
54         uint64_t tx_drop_pkts;
55         uint64_t tx_err_pkts;
56         uint64_t tx_ucast_bytes;
57         uint64_t tx_mcast_bytes;
58         uint64_t tx_bcast_bytes;
59
60         uint64_t tpa_pkts;
61         uint64_t tpa_bytes;
62         uint64_t tpa_events;
63         uint64_t tpa_aborts;
64 } ctx_hw_stats64_t;
65
66 /* HW Resource Manager Specification 1.2.0 */
67 #define HWRM_VERSION_MAJOR      1
68 #define HWRM_VERSION_MINOR      2
69 #define HWRM_VERSION_UPDATE     0
70
71 /*
72  * Following is the signature for HWRM message field that indicates not
73  * applicable (All F's). Need to cast it the size of the field if needed.
74  */
75 #define HWRM_NA_SIGNATURE        ((uint32_t)(-1))
76 #define HWRM_MAX_REQ_LEN        (128)  /* hwrm_func_buf_rgtr */
77 #define HWRM_MAX_RESP_LEN       (176)  /* hwrm_func_qstats */
78 #define HW_HASH_INDEX_SIZE      0x80    /* 7 bit indirection table index. */
79 #define HW_HASH_KEY_SIZE        40
80 #define HWRM_RESP_VALID_KEY     1 /* valid key for HWRM response */
81
82 /*
83  * Request types
84  */
85 #define HWRM_VER_GET                    (UINT32_C(0x0))
86 #define HWRM_FUNC_RESET                 (UINT32_C(0x11))
87 #define HWRM_FUNC_QCAPS                 (UINT32_C(0x15))
88 #define HWRM_FUNC_DRV_UNRGTR            (UINT32_C(0x1a))
89 #define HWRM_FUNC_DRV_RGTR              (UINT32_C(0x1d))
90 #define HWRM_PORT_PHY_CFG               (UINT32_C(0x20))
91 #define HWRM_QUEUE_QPORTCFG             (UINT32_C(0x30))
92 #define HWRM_VNIC_ALLOC                 (UINT32_C(0x40))
93 #define HWRM_VNIC_FREE                  (UINT32_C(0x41))
94 #define HWRM_VNIC_CFG                   (UINT32_C(0x42))
95 #define HWRM_VNIC_RSS_CFG               (UINT32_C(0x46))
96 #define HWRM_VNIC_RSS_COS_LB_CTX_ALLOC  (UINT32_C(0x70))
97 #define HWRM_VNIC_RSS_COS_LB_CTX_FREE   (UINT32_C(0x71))
98 #define HWRM_CFA_L2_FILTER_ALLOC        (UINT32_C(0x90))
99 #define HWRM_CFA_L2_FILTER_FREE         (UINT32_C(0x91))
100 #define HWRM_CFA_L2_FILTER_CFG          (UINT32_C(0x92))
101 #define HWRM_CFA_L2_SET_RX_MASK         (UINT32_C(0x93))
102 #define HWRM_STAT_CTX_CLR_STATS         (UINT32_C(0xb3))
103 #define HWRM_EXEC_FWD_RESP              (UINT32_C(0xd0))
104
105 /* Return Codes */
106 #define HWRM_ERR_CODE_INVALID_PARAMS                      (UINT32_C(0x2))
107 #define HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED              (UINT32_C(0x3))
108
109 /* Short TX BD (16 bytes) */
110 struct tx_bd_short {
111         /*
112          * All bits in this field must be valid on the first BD of a packet.
113          * Only the packet_end bit must be valid for the remaining BDs of a
114          * packet.
115          */
116         /* This value identifies the type of buffer descriptor. */
117         #define TX_BD_SHORT_TYPE_MASK                   UINT32_C(0x3f)
118         #define TX_BD_SHORT_TYPE_SFT                    0
119                 /*
120                  * Indicates that this BD is 16B long and is used for normal L2
121                  * packet transmission.
122                  */
123         #define TX_BD_SHORT_TYPE_TX_BD_SHORT            (UINT32_C(0x0) << 0)
124         /*
125          * If set to 1, the packet ends with the data in the buffer pointed to
126          * by this descriptor. This flag must be valid on every BD.
127          */
128         #define TX_BD_SHORT_FLAGS_PACKET_END            UINT32_C(0x40)
129         /*
130          * If set to 1, the device will not generate a completion for this
131          * transmit packet unless there is an error in it's processing. If this
132          * bit is set to 0, then the packet will be completed normally. This bit
133          * must be valid only on the first BD of a packet.
134          */
135         #define TX_BD_SHORT_FLAGS_NO_CMPL               UINT32_C(0x80)
136         /*
137          * This value indicates how many 16B BD locations are consumed in the
138          * ring by this packet. A value of 1 indicates that this BD is the only
139          * BD (and that the it is a short BD). A value of 3 indicates either 3
140          * short BDs or 1 long BD and one short BD in the packet. A value of 0
141          * indicates that there are 32 BD locations in the packet (the maximum).
142          * This field is valid only on the first BD of a packet.
143          */
144         #define TX_BD_SHORT_FLAGS_BD_CNT_MASK           UINT32_C(0x1f00)
145         #define TX_BD_SHORT_FLAGS_BD_CNT_SFT            8
146         /*
147          * This value is a hint for the length of the entire packet. It is used
148          * by the chip to optimize internal processing. The packet will be
149          * dropped if the hint is too short. This field is valid only on the
150          * first BD of a packet.
151          */
152         #define TX_BD_SHORT_FLAGS_LHINT_MASK            UINT32_C(0x6000)
153         #define TX_BD_SHORT_FLAGS_LHINT_SFT             13
154                 /* indicates packet length < 512B */
155         #define TX_BD_SHORT_FLAGS_LHINT_LT512           (UINT32_C(0x0) << 13)
156                 /* indicates 512 <= packet length < 1KB */
157         #define TX_BD_SHORT_FLAGS_LHINT_LT1K            (UINT32_C(0x1) << 13)
158                 /* indicates 1KB <= packet length < 2KB */
159         #define TX_BD_SHORT_FLAGS_LHINT_LT2K            (UINT32_C(0x2) << 13)
160                 /* indicates packet length >= 2KB */
161         #define TX_BD_SHORT_FLAGS_LHINT_GTE2K           (UINT32_C(0x3) << 13)
162         #define TX_BD_SHORT_FLAGS_LHINT_LAST    TX_BD_SHORT_FLAGS_LHINT_GTE2K
163         /*
164          * If set to 1, the device immediately updates the Send Consumer Index
165          * after the buffer associated with this descriptor has been transferred
166          * via DMA to NIC memory from host memory. An interrupt may or may not
167          * be generated according to the state of the interrupt avoidance
168          * mechanisms. If this bit is set to 0, then the Consumer Index is only
169          * updated as soon as one of the host interrupt coalescing conditions
170          * has been met. This bit must be valid on the first BD of a packet.
171          */
172         #define TX_BD_SHORT_FLAGS_COAL_NOW              UINT32_C(0x8000)
173         /*
174          * All bits in this field must be valid on the first BD of a packet.
175          * Only the packet_end bit must be valid for the remaining BDs of a
176          * packet.
177          */
178         #define TX_BD_SHORT_FLAGS_MASK                  UINT32_C(0xffc0)
179         #define TX_BD_SHORT_FLAGS_SFT                   6
180         uint16_t flags_type;
181
182         /*
183          * This is the length of the host physical buffer this BD describes in
184          * bytes. This field must be valid on all BDs of a packet.
185          */
186         uint16_t len;
187         /*
188          * The opaque data field is pass through to the completion and can be
189          * used for any data that the driver wants to associate with the
190          * transmit BD. This field must be valid on the first BD of a packet.
191          */
192         uint32_t opaque;
193
194         /*
195          * This is the host physical address for the portion of the packet
196          * described by this TX BD. This value must be valid on all BDs of a
197          * packet.
198          */
199         uint64_t addr;
200 } __attribute__((packed));
201
202 /* Long TX BD (32 bytes split to 2 16-byte struct) */
203 struct tx_bd_long {
204         /*
205          * All bits in this field must be valid on the first BD of a packet.
206          * Only the packet_end bit must be valid for the remaining BDs of a
207          * packet.
208          */
209         /* This value identifies the type of buffer descriptor. */
210         #define TX_BD_LONG_TYPE_MASK                    UINT32_C(0x3f)
211         #define TX_BD_LONG_TYPE_SFT                     0
212                 /*
213                  * Indicates that this BD is 32B long and is used for normal L2
214                  * packet transmission.
215                  */
216         #define TX_BD_LONG_TYPE_TX_BD_LONG              (UINT32_C(0x10) << 0)
217         /*
218          * If set to 1, the packet ends with the data in the buffer pointed to
219          * by this descriptor. This flag must be valid on every BD.
220          */
221         #define TX_BD_LONG_FLAGS_PACKET_END             UINT32_C(0x40)
222         /*
223          * If set to 1, the device will not generate a completion for this
224          * transmit packet unless there is an error in it's processing. If this
225          * bit is set to 0, then the packet will be completed normally. This bit
226          * must be valid only on the first BD of a packet.
227          */
228         #define TX_BD_LONG_FLAGS_NO_CMPL                UINT32_C(0x80)
229         /*
230          * This value indicates how many 16B BD locations are consumed in the
231          * ring by this packet. A value of 1 indicates that this BD is the only
232          * BD (and that the it is a short BD). A value of 3 indicates either 3
233          * short BDs or 1 long BD and one short BD in the packet. A value of 0
234          * indicates that there are 32 BD locations in the packet (the maximum).
235          * This field is valid only on the first BD of a packet.
236          */
237         #define TX_BD_LONG_FLAGS_BD_CNT_MASK            UINT32_C(0x1f00)
238         #define TX_BD_LONG_FLAGS_BD_CNT_SFT             8
239         /*
240          * This value is a hint for the length of the entire packet. It is used
241          * by the chip to optimize internal processing. The packet will be
242          * dropped if the hint is too short. This field is valid only on the
243          * first BD of a packet.
244          */
245         #define TX_BD_LONG_FLAGS_LHINT_MASK             UINT32_C(0x6000)
246         #define TX_BD_LONG_FLAGS_LHINT_SFT              13
247                 /* indicates packet length < 512B */
248         #define TX_BD_LONG_FLAGS_LHINT_LT512            (UINT32_C(0x0) << 13)
249                 /* indicates 512 <= packet length < 1KB */
250         #define TX_BD_LONG_FLAGS_LHINT_LT1K             (UINT32_C(0x1) << 13)
251                 /* indicates 1KB <= packet length < 2KB */
252         #define TX_BD_LONG_FLAGS_LHINT_LT2K             (UINT32_C(0x2) << 13)
253                 /* indicates packet length >= 2KB */
254         #define TX_BD_LONG_FLAGS_LHINT_GTE2K            (UINT32_C(0x3) << 13)
255         #define TX_BD_LONG_FLAGS_LHINT_LAST     TX_BD_LONG_FLAGS_LHINT_GTE2K
256         /*
257          * If set to 1, the device immediately updates the Send Consumer Index
258          * after the buffer associated with this descriptor has been transferred
259          * via DMA to NIC memory from host memory. An interrupt may or may not
260          * be generated according to the state of the interrupt avoidance
261          * mechanisms. If this bit is set to 0, then the Consumer Index is only
262          * updated as soon as one of the host interrupt coalescing conditions
263          * has been met. This bit must be valid on the first BD of a packet.
264          */
265         #define TX_BD_LONG_FLAGS_COAL_NOW               UINT32_C(0x8000)
266         /*
267          * All bits in this field must be valid on the first BD of a packet.
268          * Only the packet_end bit must be valid for the remaining BDs of a
269          * packet.
270          */
271         #define TX_BD_LONG_FLAGS_MASK                   UINT32_C(0xffc0)
272         #define TX_BD_LONG_FLAGS_SFT                    6
273         uint16_t flags_type;
274
275         /*
276          * This is the length of the host physical buffer this BD describes in
277          * bytes. This field must be valid on all BDs of a packet.
278          */
279         uint16_t len;
280
281         /*
282          * The opaque data field is pass through to the completion and can be
283          * used for any data that the driver wants to associate with the
284          * transmit BD. This field must be valid on the first BD of a packet.
285          */
286         uint32_t opaque;
287
288         /*
289          * This is the host physical address for the portion of the packet
290          * described by this TX BD. This value must be valid on all BDs of a
291          * packet.
292          */
293         uint64_t addr;
294 } __attribute__((packed));
295
296 /* last 16 bytes of Long TX BD */
297
298 struct tx_bd_long_hi {
299         /*
300          * All bits in this field must be valid on the first BD of a packet.
301          * Their value on other BDs of the packet will be ignored.
302          */
303         /*
304          * If set to 1, the controller replaces the TCP/UPD checksum fields of
305          * normal TCP/UPD checksum, or the inner TCP/UDP checksum field of the
306          * encapsulated TCP/UDP packets with the hardware calculated TCP/UDP
307          * checksum for the packet associated with this descriptor. This bit
308          * must be valid on the first BD of a packet.
309          */
310         #define TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM        UINT32_C(0x1)
311         /*
312          * If set to 1, the controller replaces the IP checksum of the normal
313          * packets, or the inner IP checksum of the encapsulated packets with
314          * the hardware calculated IP checksum for the packet associated with
315          * this descriptor. This bit must be valid on the first BD of a packet.
316          */
317         #define TX_BD_LONG_LFLAGS_IP_CHKSUM             UINT32_C(0x2)
318         /*
319          * If set to 1, the controller will not append an Ethernet CRC to the
320          * end of the frame. This bit must be valid on the first BD of a packet.
321          * Packet must be 64B or longer when this flag is set. It is not useful
322          * to use this bit with any form of TX offload such as CSO or LSO. The
323          * intent is that the packet from the host already has a valid Ethernet
324          * CRC on the packet.
325          */
326         #define TX_BD_LONG_LFLAGS_NOCRC                 UINT32_C(0x4)
327         /*
328          * If set to 1, the device will record the time at which the packet was
329          * actually transmitted at the TX MAC. This bit must be valid on the
330          * first BD of a packet.
331          */
332         #define TX_BD_LONG_LFLAGS_STAMP                 UINT32_C(0x8)
333         /*
334          * If set to 1, The controller replaces the tunnel IP checksum field
335          * with hardware calculated IP checksum for the IP header of the packet
336          * associated with this descriptor. In case of VXLAN, the controller
337          * also replaces the outer header UDP checksum with hardware calculated
338          * UDP checksum for the packet associated with this descriptor.
339          */
340         #define TX_BD_LONG_LFLAGS_T_IP_CHKSUM           UINT32_C(0x10)
341         /*
342          * If set to 1, the device will treat this packet with LSO(Large Send
343          * Offload) processing for both normal or encapsulated packets, which is
344          * a form of TCP segmentation. When this bit is 1, the hdr_size and mss
345          * fields must be valid. The driver doesn't need to set t_ip_chksum,
346          * ip_chksum, and tcp_udp_chksum flags since the controller will replace
347          * the appropriate checksum fields for segmented packets. When this bit
348          * is 1, the hdr_size and mss fields must be valid.
349          */
350         #define TX_BD_LONG_LFLAGS_LSO                   UINT32_C(0x20)
351         /*
352          * If set to zero when LSO is '1', then the IPID will be treated as a
353          * 16b number and will be wrapped if it exceeds a value of 0xffff. If
354          * set to one when LSO is '1', then the IPID will be treated as a 15b
355          * number and will be wrapped if it exceeds a value 0f 0x7fff.
356          */
357         #define TX_BD_LONG_LFLAGS_IPID_FMT              UINT32_C(0x40)
358         /*
359          * If set to zero when LSO is '1', then the IPID of the tunnel IP header
360          * will not be modified during LSO operations. If set to one when LSO is
361          * '1', then the IPID of the tunnel IP header will be incremented for
362          * each subsequent segment of an LSO operation.
363          */
364         #define TX_BD_LONG_LFLAGS_T_IPID                UINT32_C(0x80)
365         /*
366          * If set to '1', then the RoCE ICRC will be appended to the packet.
367          * Packet must be a valid RoCE format packet.
368          */
369         #define TX_BD_LONG_LFLAGS_ROCE_CRC              UINT32_C(0x100)
370         /*
371          * If set to '1', then the FCoE CRC will be appended to the packet.
372          * Packet must be a valid FCoE format packet.
373          */
374         #define TX_BD_LONG_LFLAGS_FCOE_CRC              UINT32_C(0x200)
375         uint16_t lflags;
376
377         /*
378          * When LSO is '1', this field must contain the offset of the TCP
379          * payload from the beginning of the packet in as 16b words. In case of
380          * encapsulated/tunneling packet, this field contains the offset of the
381          * inner TCP payload from beginning of the packet as 16-bit words. This
382          * value must be valid on the first BD of a packet.
383          */
384         #define TX_BD_LONG_HDR_SIZE_MASK                UINT32_C(0x1ff)
385         #define TX_BD_LONG_HDR_SIZE_SFT                 0
386         uint16_t hdr_size;
387
388         /*
389          * This is the MSS value that will be used to do the LSO processing. The
390          * value is the length in bytes of the TCP payload for each segment
391          * generated by the LSO operation. This value must be valid on the first
392          * BD of a packet.
393          */
394         #define TX_BD_LONG_MSS_MASK                     UINT32_C(0x7fff)
395         #define TX_BD_LONG_MSS_SFT                      0
396         uint32_t mss;
397
398         uint16_t unused_2;
399
400         /*
401          * This value selects a CFA action to perform on the packet. Set this
402          * value to zero if no CFA action is desired. This value must be valid
403          * on the first BD of a packet.
404          */
405         uint16_t cfa_action;
406
407         /*
408          * This value is action meta-data that defines CFA edit operations that
409          * are done in addition to any action editing.
410          */
411         /* When key=1, This is the VLAN tag VID value. */
412         #define TX_BD_LONG_CFA_META_VLAN_VID_MASK       UINT32_C(0xfff)
413         #define TX_BD_LONG_CFA_META_VLAN_VID_SFT        0
414         /* When key=1, This is the VLAN tag DE value. */
415         #define TX_BD_LONG_CFA_META_VLAN_DE             UINT32_C(0x1000)
416         /* When key=1, This is the VLAN tag PRI value. */
417         #define TX_BD_LONG_CFA_META_VLAN_PRI_MASK       UINT32_C(0xe000)
418         #define TX_BD_LONG_CFA_META_VLAN_PRI_SFT        13
419         /* When key=1, This is the VLAN tag TPID select value. */
420         #define TX_BD_LONG_CFA_META_VLAN_TPID_MASK      UINT32_C(0x70000)
421         #define TX_BD_LONG_CFA_META_VLAN_TPID_SFT       16
422                 /* 0x88a8 */
423         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID88A8  (UINT32_C(0x0) << 16)
424                 /* 0x8100 */
425         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100  (UINT32_C(0x1) << 16)
426                 /* 0x9100 */
427         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9100  (UINT32_C(0x2) << 16)
428                 /* 0x9200 */
429         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9200  (UINT32_C(0x3) << 16)
430                 /* 0x9300 */
431         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9300  (UINT32_C(0x4) << 16)
432                 /* Value programmed in CFA VLANTPID register. */
433         #define TX_BD_LONG_CFA_META_VLAN_TPID_TPIDCFG   (UINT32_C(0x5) << 16)
434         #define TX_BD_LONG_CFA_META_VLAN_TPID_LAST \
435                                         TX_BD_LONG_CFA_META_VLAN_TPID_TPIDCFG
436         /* When key=1, This is the VLAN tag TPID select value. */
437         #define TX_BD_LONG_CFA_META_VLAN_RESERVED_MASK  UINT32_C(0xff80000)
438         #define TX_BD_LONG_CFA_META_VLAN_RESERVED_SFT   19
439         /*
440          * This field identifies the type of edit to be performed on the packet.
441          * This value must be valid on the first BD of a packet.
442          */
443         #define TX_BD_LONG_CFA_META_KEY_MASK            UINT32_C(0xf0000000)
444         #define TX_BD_LONG_CFA_META_KEY_SFT             28
445                 /* No editing */
446         #define TX_BD_LONG_CFA_META_KEY_NONE            (UINT32_C(0x0) << 28)
447                 /*
448                  * - meta[17:16] - TPID select value (0 = 0x8100). - meta[15:12]
449                  * - PRI/DE value. - meta[11:0] - VID value.
450                  */
451         #define TX_BD_LONG_CFA_META_KEY_VLAN_TAG        (UINT32_C(0x1) << 28)
452         #define TX_BD_LONG_CFA_META_KEY_LAST    TX_BD_LONG_CFA_META_KEY_VLAN_TAG
453         uint32_t cfa_meta;
454 } __attribute__((packed));
455
456 /* RX Producer Packet BD (16 bytes) */
457 struct rx_prod_pkt_bd {
458         /* This value identifies the type of buffer descriptor. */
459         #define RX_PROD_PKT_BD_TYPE_MASK                UINT32_C(0x3f)
460         #define RX_PROD_PKT_BD_TYPE_SFT                 0
461                 /*
462                  * Indicates that this BD is 16B long and is an RX Producer (ie.
463                  * empty) buffer descriptor.
464                  */
465         #define RX_PROD_PKT_BD_TYPE_RX_PROD_PKT         (UINT32_C(0x4) << 0)
466         /*
467          * If set to 1, the packet will be placed at the address plus 2B. The 2
468          * Bytes of padding will be written as zero.
469          */
470         /*
471          * This is intended to be used when the host buffer is cache-line
472          * aligned to produce packets that are easy to parse in host memory
473          * while still allowing writes to be cache line aligned.
474          */
475         #define RX_PROD_PKT_BD_FLAGS_SOP_PAD            UINT32_C(0x40)
476         /*
477          * If set to 1, the packet write will be padded out to the nearest
478          * cache-line with zero value padding.
479          */
480         /*
481          * If receive buffers start/end on cache-line boundaries, this feature
482          * will ensure that all data writes on the PCI bus start/end on cache
483          * line boundaries.
484          */
485         #define RX_PROD_PKT_BD_FLAGS_EOP_PAD            UINT32_C(0x80)
486         /*
487          * This value is the number of additional buffers in the ring that
488          * describe the buffer space to be consumed for the this packet. If the
489          * value is zero, then the packet must fit within the space described by
490          * this BD. If this value is 1 or more, it indicates how many additional
491          * "buffer" BDs are in the ring immediately following this BD to be used
492          * for the same network packet. Even if the packet to be placed does not
493          * need all the additional buffers, they will be consumed anyway.
494          */
495         #define RX_PROD_PKT_BD_FLAGS_BUFFERS_MASK       UINT32_C(0x300)
496         #define RX_PROD_PKT_BD_FLAGS_BUFFERS_SFT        8
497         #define RX_PROD_PKT_BD_FLAGS_MASK               UINT32_C(0xffc0)
498         #define RX_PROD_PKT_BD_FLAGS_SFT                6
499         uint16_t flags_type;
500
501         /*
502          * This is the length in Bytes of the host physical buffer where data
503          * for the packet may be placed in host memory.
504          */
505         /*
506          * While this is a Byte resolution value, it is often advantageous to
507          * ensure that the buffers provided end on a host cache line.
508          */
509         uint16_t len;
510
511         /*
512          * The opaque data field is pass through to the completion and can be
513          * used for any data that the driver wants to associate with this
514          * receive buffer set.
515          */
516         uint32_t opaque;
517
518         /*
519          * This is the host physical address where data for the packet may by
520          * placed in host memory.
521          */
522         /*
523          * While this is a Byte resolution value, it is often advantageous to
524          * ensure that the buffers provide start on a host cache line.
525          */
526         uint64_t addr;
527 } __attribute__((packed));
528
529 /* Completion Ring Structures */
530 /* Note: This structure is used by the HWRM to communicate HWRM Error. */
531 /* Base Completion Record (16 bytes) */
532 struct cmpl_base {
533         /* unused is 10 b */
534         /*
535          * This field indicates the exact type of the completion. By convention,
536          * the LSB identifies the length of the record in 16B units. Even values
537          * indicate 16B records. Odd values indicate 32B records.
538          */
539         #define CMPL_BASE_TYPE_MASK                     UINT32_C(0x3f)
540         #define CMPL_BASE_TYPE_SFT                      0
541                 /* TX L2 completion: Completion of TX packet. Length = 16B */
542         #define CMPL_BASE_TYPE_TX_L2                    (UINT32_C(0x0) << 0)
543                 /*
544                  * RX L2 completion: Completion of and L2 RX packet.
545                  * Length = 32B
546                 */
547         #define CMPL_BASE_TYPE_RX_L2                    (UINT32_C(0x11) << 0)
548                 /*
549                  * RX Aggregation Buffer completion : Completion of an L2
550                  * aggregation buffer in support of TPA, HDS, or Jumbo packet
551                  * completion. Length = 16B
552                  */
553         #define CMPL_BASE_TYPE_RX_AGG                   (UINT32_C(0x12) << 0)
554                 /*
555                  * RX L2 TPA Start Completion: Completion at the beginning of a
556                  * TPA operation. Length = 32B
557                  */
558         #define CMPL_BASE_TYPE_RX_TPA_START             (UINT32_C(0x13) << 0)
559                 /*
560                  * RX L2 TPA End Completion: Completion at the end of a TPA
561                  * operation. Length = 32B
562                  */
563         #define CMPL_BASE_TYPE_RX_TPA_END               (UINT32_C(0x15) << 0)
564                 /*
565                  * Statistics Ejection Completion: Completion of statistics data
566                  * ejection buffer. Length = 16B
567                  */
568         #define CMPL_BASE_TYPE_STAT_EJECT               (UINT32_C(0x1a) << 0)
569                 /* HWRM Command Completion: Completion of an HWRM command. */
570         #define CMPL_BASE_TYPE_HWRM_DONE                (UINT32_C(0x20) << 0)
571                 /* Forwarded HWRM Request */
572         #define CMPL_BASE_TYPE_HWRM_FWD_REQ             (UINT32_C(0x22) << 0)
573                 /* Forwarded HWRM Response */
574         #define CMPL_BASE_TYPE_HWRM_FWD_RESP            (UINT32_C(0x24) << 0)
575                 /* HWRM Asynchronous Event Information */
576         #define CMPL_BASE_TYPE_HWRM_ASYNC_EVENT         (UINT32_C(0x2e) << 0)
577                 /* CQ Notification */
578         #define CMPL_BASE_TYPE_CQ_NOTIFICATION          (UINT32_C(0x30) << 0)
579                 /* SRQ Threshold Event */
580         #define CMPL_BASE_TYPE_SRQ_EVENT                (UINT32_C(0x32) << 0)
581                 /* DBQ Threshold Event */
582         #define CMPL_BASE_TYPE_DBQ_EVENT                (UINT32_C(0x34) << 0)
583                 /* QP Async Notification */
584         #define CMPL_BASE_TYPE_QP_EVENT                 (UINT32_C(0x38) << 0)
585                 /* Function Async Notification */
586         #define CMPL_BASE_TYPE_FUNC_EVENT               (UINT32_C(0x3a) << 0)
587         uint16_t type;
588
589         uint16_t info1;
590         uint32_t info2;
591
592         /*
593          * This value is written by the NIC such that it will be different for
594          * each pass through the completion queue. The even passes will write 1.
595          * The odd passes will write 0.
596          */
597         #define CMPL_BASE_V                             UINT32_C(0x1)
598         /* info3 is 31 b */
599         #define CMPL_BASE_INFO3_MASK                    UINT32_C(0xfffffffe)
600         #define CMPL_BASE_INFO3_SFT                     1
601         uint32_t info3_v;
602
603         uint32_t info4;
604 } __attribute__((packed));
605
606 /* TX Completion Record (16 bytes) */
607 struct tx_cmpl {
608         /*
609          * This field indicates the exact type of the completion. By convention,
610          * the LSB identifies the length of the record in 16B units. Even values
611          * indicate 16B records. Odd values indicate 32B records.
612          */
613         #define TX_CMPL_TYPE_MASK                       UINT32_C(0x3f)
614         #define TX_CMPL_TYPE_SFT                        0
615                 /* TX L2 completion: Completion of TX packet. Length = 16B */
616         #define TX_CMPL_TYPE_TX_L2                      (UINT32_C(0x0) << 0)
617         /*
618          * When this bit is '1', it indicates a packet that has an error of some
619          * type. Type of error is indicated in error_flags.
620          */
621         #define TX_CMPL_FLAGS_ERROR                     UINT32_C(0x40)
622         /*
623          * When this bit is '1', it indicates that the packet completed was
624          * transmitted using the push acceleration data provided by the driver.
625          * When this bit is '0', it indicates that the packet had not push
626          * acceleration data written or was executed as a normal packet even
627          * though push data was provided.
628          */
629         #define TX_CMPL_FLAGS_PUSH                      UINT32_C(0x80)
630         #define TX_CMPL_FLAGS_MASK                      UINT32_C(0xffc0)
631         #define TX_CMPL_FLAGS_SFT                       6
632         uint16_t flags_type;
633
634         uint16_t unused_0;
635
636         /*
637          * This is a copy of the opaque field from the first TX BD of this
638          * transmitted packet.
639          */
640         uint32_t opaque;
641
642         /*
643          * This value is written by the NIC such that it will be different for
644          * each pass through the completion queue. The even passes will write 1.
645          * The odd passes will write 0.
646          */
647         #define TX_CMPL_V                               UINT32_C(0x1)
648         /*
649          * This error indicates that there was some sort of problem with the BDs
650          * for the packet.
651          */
652         #define TX_CMPL_ERRORS_BUFFER_ERROR_MASK        UINT32_C(0xe)
653         #define TX_CMPL_ERRORS_BUFFER_ERROR_SFT         1
654                 /* No error */
655         #define TX_CMPL_ERRORS_BUFFER_ERROR_NO_ERROR    (UINT32_C(0x0) << 1)
656                 /* Bad Format: BDs were not formatted correctly. */
657         #define TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT     (UINT32_C(0x2) << 1)
658         #define TX_CMPL_ERRORS_BUFFER_ERROR_LAST \
659                                         TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT
660         /*
661          * When this bit is '1', it indicates that the length of the packet was
662          * zero. No packet was transmitted.
663          */
664         #define TX_CMPL_ERRORS_ZERO_LENGTH_PKT          UINT32_C(0x10)
665         /*
666          * When this bit is '1', it indicates that the packet was longer than
667          * the programmed limit in TDI. No packet was transmitted.
668          */
669         #define TX_CMPL_ERRORS_EXCESSIVE_BD_LENGTH      UINT32_C(0x20)
670         /*
671          * When this bit is '1', it indicates that one or more of the BDs
672          * associated with this packet generated a PCI error. This probably
673          * means the address was not valid.
674          */
675         #define TX_CMPL_ERRORS_DMA_ERROR                UINT32_C(0x40)
676         /*
677          * When this bit is '1', it indicates that the packet was longer than
678          * indicated by the hint. No packet was transmitted.
679          */
680         #define TX_CMPL_ERRORS_HINT_TOO_SHORT           UINT32_C(0x80)
681         /*
682          * When this bit is '1', it indicates that the packet was dropped due to
683          * Poison TLP error on one or more of the TLPs in the PXP completion.
684          */
685         #define TX_CMPL_ERRORS_POISON_TLP_ERROR         UINT32_C(0x100)
686         #define TX_CMPL_ERRORS_MASK                     UINT32_C(0xfffe)
687         #define TX_CMPL_ERRORS_SFT                      1
688         uint16_t errors_v;
689
690         uint16_t unused_1;
691         uint32_t unused_2;
692 } __attribute__((packed)) tx_cmpl_t, *ptx_cmpl_t;
693
694 /* RX Packet Completion Record (32 bytes split to 2 16-byte struct) */
695 struct rx_pkt_cmpl {
696         /*
697          * This field indicates the exact type of the completion. By convention,
698          * the LSB identifies the length of the record in 16B units. Even values
699          * indicate 16B records. Odd values indicate 32B records.
700          */
701         #define RX_PKT_CMPL_TYPE_MASK                   UINT32_C(0x3f)
702         #define RX_PKT_CMPL_TYPE_SFT                    0
703                 /*
704                  * RX L2 completion: Completion of and L2 RX packet.
705                  * Length = 32B
706                  */
707         #define RX_PKT_CMPL_TYPE_RX_L2                  (UINT32_C(0x11) << 0)
708         /*
709          * When this bit is '1', it indicates a packet that has an error of some
710          * type. Type of error is indicated in error_flags.
711          */
712         #define RX_PKT_CMPL_FLAGS_ERROR                 UINT32_C(0x40)
713         /* This field indicates how the packet was placed in the buffer. */
714         #define RX_PKT_CMPL_FLAGS_PLACEMENT_MASK        UINT32_C(0x380)
715         #define RX_PKT_CMPL_FLAGS_PLACEMENT_SFT         7
716                 /* Normal: Packet was placed using normal algorithm. */
717         #define RX_PKT_CMPL_FLAGS_PLACEMENT_NORMAL      (UINT32_C(0x0) << 7)
718                 /* Jumbo: Packet was placed using jumbo algorithm. */
719         #define RX_PKT_CMPL_FLAGS_PLACEMENT_JUMBO       (UINT32_C(0x1) << 7)
720                 /*
721                  * Header/Data Separation: Packet was placed using Header/Data
722                  * separation algorithm. The separation location is indicated by
723                  * the itype field.
724                  */
725         #define RX_PKT_CMPL_FLAGS_PLACEMENT_HDS         (UINT32_C(0x2) << 7)
726         #define RX_PKT_CMPL_FLAGS_PLACEMENT_LAST \
727                                                 RX_PKT_CMPL_FLAGS_PLACEMENT_HDS
728         /* This bit is '1' if the RSS field in this completion is valid. */
729         #define RX_PKT_CMPL_FLAGS_RSS_VALID             UINT32_C(0x400)
730         /*
731          * This value indicates what the inner packet determined for the packet
732          * was.
733          */
734         #define RX_PKT_CMPL_FLAGS_ITYPE_MASK            UINT32_C(0xf000)
735         #define RX_PKT_CMPL_FLAGS_ITYPE_SFT             12
736                 /* Not Known: Indicates that the packet type was not known. */
737         #define RX_PKT_CMPL_FLAGS_ITYPE_NOT_KNOWN       (UINT32_C(0x0) << 12)
738                 /*
739                  * IP Packet: Indicates that the packet was an IP packet, but
740                  * further classification was not possible.
741                  */
742         #define RX_PKT_CMPL_FLAGS_ITYPE_IP              (UINT32_C(0x1) << 12)
743                 /*
744                  * TCP Packet: Indicates that the packet was IP and TCP. This
745                  * indicates that the payload_offset field is valid.
746                  */
747         #define RX_PKT_CMPL_FLAGS_ITYPE_TCP             (UINT32_C(0x2) << 12)
748                 /*
749                  * UDP Packet: Indicates that the packet was IP and UDP. This
750                  * indicates that the payload_offset field is valid.
751                  */
752         #define RX_PKT_CMPL_FLAGS_ITYPE_UDP             (UINT32_C(0x3) << 12)
753                 /*
754                  * FCoE Packet: Indicates that the packet was recognized as a
755                  * FCoE. This also indicates that the payload_offset field is
756                  * valid.
757                  */
758         #define RX_PKT_CMPL_FLAGS_ITYPE_FCOE            (UINT32_C(0x4) << 12)
759                 /*
760                  * RoCE Packet: Indicates that the packet was recognized as a
761                  * RoCE. This also indicates that the payload_offset field is
762                  * valid.
763                  */
764         #define RX_PKT_CMPL_FLAGS_ITYPE_ROCE            (UINT32_C(0x5) << 12)
765                 /*
766                  * ICMP Packet: Indicates that the packet was recognized as
767                  * ICMP. This indicates that the payload_offset field is valid.
768                  */
769         #define RX_PKT_CMPL_FLAGS_ITYPE_ICMP            (UINT32_C(0x7) << 12)
770                 /*
771                  * PtP packet wo/timestamp: Indicates that the packet was
772                  * recognized as a PtP packet.
773                  */
774         #define RX_PKT_CMPL_FLAGS_ITYPE_PTP_WO_TIMESTAMP \
775                                                         (UINT32_C(0x8) << 12)
776                 /*
777                  * PtP packet w/timestamp: Indicates that the packet was
778                  * recognized as a PtP packet and that a timestamp was taken for
779                  * the packet.
780                  */
781         #define RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP (UINT32_C(0x9) << 12)
782         #define RX_PKT_CMPL_FLAGS_ITYPE_LAST \
783                                         RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP
784         #define RX_PKT_CMPL_FLAGS_MASK                  UINT32_C(0xffc0)
785         #define RX_PKT_CMPL_FLAGS_SFT                   6
786         uint16_t flags_type;
787
788         /*
789          * This is the length of the data for the packet stored in the buffer(s)
790          * identified by the opaque value. This includes the packet BD and any
791          * associated buffer BDs. This does not include the the length of any
792          * data places in aggregation BDs.
793          */
794         uint16_t len;
795
796         /*
797          * This is a copy of the opaque field from the RX BD this completion
798          * corresponds to.
799          */
800         uint32_t opaque;
801
802         /*
803          * This value is written by the NIC such that it will be different for
804          * each pass through the completion queue. The even passes will write 1.
805          * The odd passes will write 0.
806          */
807         #define RX_PKT_CMPL_V1                          UINT32_C(0x1)
808         /*
809          * This value is the number of aggregation buffers that follow this
810          * entry in the completion ring that are a part of this packet. If the
811          * value is zero, then the packet is completely contained in the buffer
812          * space provided for the packet in the RX ring.
813          */
814         #define RX_PKT_CMPL_AGG_BUFS_MASK               UINT32_C(0x3e)
815         #define RX_PKT_CMPL_AGG_BUFS_SFT                1
816         uint8_t agg_bufs_v1;
817
818         /*
819          * This is the RSS hash type for the packet. The value is packed
820          * {tuple_extrac_op[1:0],rss_profile_id[4:0],tuple_extrac_op[2]}.
821          */
822         uint8_t rss_hash_type;
823
824         /*
825          * This value indicates the offset from the beginning of the packet
826          * where the inner payload starts. This value is valid for TCP, UDP,
827          * FCoE, and RoCE packets.
828          */
829         uint8_t payload_offset;
830
831         uint8_t unused_1;
832
833         /*
834          * This value is the RSS hash value calculated for the packet based on
835          * the mode bits and key value in the VNIC.
836          */
837         uint32_t rss_hash;
838 } __attribute__((packed));
839
840 /* last 16 bytes of RX Packet Completion Record */
841 struct rx_pkt_cmpl_hi {
842         /*
843          * This indicates that the ip checksum was calculated for the inner
844          * packet and that the ip_cs_error field indicates if there was an
845          * error.
846          */
847         #define RX_PKT_CMPL_FLAGS2_IP_CS_CALC           UINT32_C(0x1)
848         /*
849          * This indicates that the TCP, UDP or ICMP checksum was calculated for
850          * the inner packet and that the l4_cs_error field indicates if there
851          * was an error.
852          */
853         #define RX_PKT_CMPL_FLAGS2_L4_CS_CALC           UINT32_C(0x2)
854         /*
855          * This indicates that the ip checksum was calculated for the tunnel
856          * header and that the t_ip_cs_error field indicates if there was an
857          * error.
858          */
859         #define RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC         UINT32_C(0x4)
860         /*
861          * This indicates that the UDP checksum was calculated for the tunnel
862          * packet and that the t_l4_cs_error field indicates if there was an
863          * error.
864          */
865         #define RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC         UINT32_C(0x8)
866         /* This value indicates what format the metadata field is. */
867         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_MASK     UINT32_C(0xf0)
868         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_SFT      4
869                 /* No metadata informtaion. Value is zero. */
870         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_NONE     (UINT32_C(0x0) << 4)
871                 /*
872                  * The metadata field contains the VLAN tag and TPID value. -
873                  * metadata[11:0] contains the vlan VID value. - metadata[12]
874                  * contains the vlan DE value. - metadata[15:13] contains the
875                  * vlan PRI value. - metadata[31:16] contains the vlan TPID
876                  * value.
877                  */
878         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN     (UINT32_C(0x1) << 4)
879         #define RX_PKT_CMPL_FLAGS2_META_FORMAT_LAST \
880                                         RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN
881         /*
882          * This field indicates the IP type for the inner-most IP header. A
883          * value of '0' indicates IPv4. A value of '1' indicates IPv6. This
884          * value is only valid if itype indicates a packet with an IP header.
885          */
886         #define RX_PKT_CMPL_FLAGS2_IP_TYPE              UINT32_C(0x100)
887         uint32_t flags2;
888
889         /*
890          * This is data from the CFA block as indicated by the meta_format
891          * field.
892          */
893         /* When meta_format=1, this value is the VLAN VID. */
894         #define RX_PKT_CMPL_METADATA_VID_MASK           UINT32_C(0xfff)
895         #define RX_PKT_CMPL_METADATA_VID_SFT            0
896         /* When meta_format=1, this value is the VLAN DE. */
897         #define RX_PKT_CMPL_METADATA_DE                 UINT32_C(0x1000)
898         /* When meta_format=1, this value is the VLAN PRI. */
899         #define RX_PKT_CMPL_METADATA_PRI_MASK           UINT32_C(0xe000)
900         #define RX_PKT_CMPL_METADATA_PRI_SFT            13
901         /* When meta_format=1, this value is the VLAN TPID. */
902         #define RX_PKT_CMPL_METADATA_TPID_MASK          UINT32_C(0xffff0000)
903         #define RX_PKT_CMPL_METADATA_TPID_SFT           16
904         uint32_t metadata;
905
906         /*
907          * This value is written by the NIC such that it will be different for
908          * each pass through the completion queue. The even passes will write 1.
909          * The odd passes will write 0.
910          */
911         #define RX_PKT_CMPL_V2                          UINT32_C(0x1)
912         /*
913          * This error indicates that there was some sort of problem with the BDs
914          * for the packet that was found after part of the packet was already
915          * placed. The packet should be treated as invalid.
916          */
917         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_MASK    UINT32_C(0xe)
918         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_SFT     1
919                 /* No buffer error */
920         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_NO_BUFFER \
921                                                         (UINT32_C(0x0) << 1)
922                 /*
923                  * Did Not Fit: Packet did not fit into packet buffer provided.
924                  * For regular placement, this means the packet did not fit in
925                  * the buffer provided. For HDS and jumbo placement, this means
926                  * that the packet could not be placed into 7 physical buffers
927                  * or less.
928                  */
929         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_DID_NOT_FIT \
930                                                         (UINT32_C(0x1) << 1)
931                 /*
932                  * Not On Chip: All BDs needed for the packet were not on-chip
933                  * when the packet arrived.
934                  */
935         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_NOT_ON_CHIP \
936                                                         (UINT32_C(0x2) << 1)
937                 /* Bad Format: BDs were not formatted correctly. */
938         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT \
939                                                         (UINT32_C(0x3) << 1)
940         #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_LAST \
941                                 RX_PKT_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT
942         /* This indicates that there was an error in the IP header checksum. */
943         #define RX_PKT_CMPL_ERRORS_IP_CS_ERROR          UINT32_C(0x10)
944         /*
945          * This indicates that there was an error in the TCP, UDP or ICMP
946          * checksum.
947          */
948         #define RX_PKT_CMPL_ERRORS_L4_CS_ERROR          UINT32_C(0x20)
949         /*
950          * This indicates that there was an error in the tunnel IP header
951          * checksum.
952          */
953         #define RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR        UINT32_C(0x40)
954         /* This indicates that there was an error in the tunnel UDP checksum. */
955         #define RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR        UINT32_C(0x80)
956         /*
957          * This indicates that there was a CRC error on either an FCoE or RoCE
958          * packet. The itype indicates the packet type.
959          */
960         #define RX_PKT_CMPL_ERRORS_CRC_ERROR            UINT32_C(0x100)
961         /*
962          * This indicates that there was an error in the tunnel portion of the
963          * packet when this field is non-zero.
964          */
965         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_MASK     UINT32_C(0xe00)
966         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_SFT      9
967                 /*
968                  * No additional error occurred on the tunnel portion of the
969                  * packet of the packet does not have a tunnel.
970                  */
971         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_NO_ERROR (UINT32_C(0x0) << 9)
972                 /*
973                  * Indicates that IP header version does not match expectation
974                  * from L2 Ethertype for IPv4 and IPv6 in the tunnel header.
975                  */
976         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_VERSION \
977                                                         (UINT32_C(0x1) << 9)
978                 /*
979                  * Indicates that header length is out of range in the tunnel
980                  * header. Valid for IPv4.
981                  */
982         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_HDR_LEN \
983                                                         (UINT32_C(0x2) << 9)
984                 /*
985                  * Indicates that the physical packet is shorter than that
986                  * claimed by the PPPoE header length for a tunnel PPPoE packet.
987                  */
988         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_TUNNEL_TOTAL_ERROR \
989                                                         (UINT32_C(0x3) << 9)
990                 /*
991                  * Indicates that physical packet is shorter than that claimed
992                  * by the tunnel l3 header length. Valid for IPv4, or IPv6
993                  * tunnel packet packets.
994                  */
995         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_IP_TOTAL_ERROR \
996                                                         (UINT32_C(0x4) << 9)
997                 /*
998                  * Indicates that the physical packet is shorter than that
999                  * claimed by the tunnel UDP header length for a tunnel UDP
1000                  * packet that is not fragmented.
1001                  */
1002         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_UDP_TOTAL_ERROR \
1003                                                         (UINT32_C(0x5) << 9)
1004                 /*
1005                  * indicates that the IPv4 TTL or IPv6 hop limit check have
1006                  * failed (e.g. TTL = 0) in the tunnel header. Valid for IPv4,
1007                  * and IPv6.
1008                  */
1009         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL \
1010                                                         (UINT32_C(0x6) << 9)
1011         #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_LAST \
1012                                 RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL
1013         /*
1014          * This indicates that there was an error in the inner portion of the
1015          * packet when this field is non-zero.
1016          */
1017         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_MASK       UINT32_C(0xf000)
1018         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_SFT        12
1019                 /*
1020                  * No additional error occurred on the tunnel portion of the
1021                  * packet of the packet does not have a tunnel.
1022                  */
1023         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_NO_ERROR   (UINT32_C(0x0) << 12)
1024                 /*
1025                  * Indicates that IP header version does not match expectation
1026                  * from L2 Ethertype for IPv4 and IPv6 or that option other than
1027                  * VFT was parsed on FCoE packet.
1028                  */
1029         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_VERSION \
1030                                                         (UINT32_C(0x1) << 12)
1031                 /*
1032                  * indicates that header length is out of range. Valid for IPv4
1033                  * and RoCE
1034                  */
1035         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_HDR_LEN \
1036                                                         (UINT32_C(0x2) << 12)
1037                 /*
1038                  * indicates that the IPv4 TTL or IPv6 hop limit check have
1039                  * failed (e.g. TTL = 0). Valid for IPv4, and IPv6
1040                  */
1041         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_TTL (UINT32_C(0x3) << 12)
1042                 /*
1043                  * Indicates that physical packet is shorter than that claimed
1044                  * by the l3 header length. Valid for IPv4, IPv6 packet or RoCE
1045                  * packets.
1046                  */
1047         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_IP_TOTAL_ERROR \
1048                                                         (UINT32_C(0x4) << 12)
1049                 /*
1050                  * Indicates that the physical packet is shorter than that
1051                  * claimed by the UDP header length for a UDP packet that is not
1052                  * fragmented.
1053                  */
1054         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_UDP_TOTAL_ERROR \
1055                                                         (UINT32_C(0x5) << 12)
1056                 /*
1057                  * Indicates that TCP header length > IP payload. Valid for TCP
1058                  * packets only.
1059                  */
1060         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN \
1061                                                         (UINT32_C(0x6) << 12)
1062                 /* Indicates that TCP header length < 5. Valid for TCP. */
1063         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN_TOO_SMALL \
1064                                                         (UINT32_C(0x7) << 12)
1065                 /*
1066                  * Indicates that TCP option headers result in a TCP header size
1067                  * that does not match data offset in TCP header. Valid for TCP.
1068                  */
1069         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN \
1070                                                         (UINT32_C(0x8) << 12)
1071         #define RX_PKT_CMPL_ERRORS_PKT_ERROR_LAST \
1072                                 RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN
1073         #define RX_PKT_CMPL_ERRORS_MASK                 UINT32_C(0xfffe)
1074         #define RX_PKT_CMPL_ERRORS_SFT                  1
1075         uint16_t errors_v2;
1076
1077         /*
1078          * This field identifies the CFA action rule that was used for this
1079          * packet.
1080          */
1081         uint16_t cfa_code;
1082
1083         /*
1084          * This value holds the reordering sequence number for the packet. If
1085          * the reordering sequence is not valid, then this value is zero. The
1086          * reordering domain for the packet is in the bottom 8 to 10b of the
1087          * rss_hash value. The bottom 20b of this value contain the ordering
1088          * domain value for the packet.
1089          */
1090         #define RX_PKT_CMPL_REORDER_MASK                UINT32_C(0xffffff)
1091         #define RX_PKT_CMPL_REORDER_SFT                 0
1092         uint32_t reorder;
1093 } __attribute__((packed));
1094
1095 /* HWRM Forwarded Request (16 bytes) */
1096 struct hwrm_fwd_req_cmpl {
1097         /* Length of forwarded request in bytes. */
1098         /*
1099          * This field indicates the exact type of the completion. By convention,
1100          * the LSB identifies the length of the record in 16B units. Even values
1101          * indicate 16B records. Odd values indicate 32B records.
1102          */
1103         #define HWRM_FWD_REQ_CMPL_TYPE_MASK             UINT32_C(0x3f)
1104         #define HWRM_FWD_REQ_CMPL_TYPE_SFT              0
1105                 /* Forwarded HWRM Request */
1106         #define HWRM_FWD_REQ_CMPL_TYPE_HWRM_FWD_REQ     (UINT32_C(0x22) << 0)
1107         /* Length of forwarded request in bytes. */
1108         #define HWRM_FWD_REQ_CMPL_REQ_LEN_MASK          UINT32_C(0xffc0)
1109         #define HWRM_FWD_REQ_CMPL_REQ_LEN_SFT           6
1110         uint16_t req_len_type;
1111
1112         /*
1113          * Source ID of this request. Typically used in forwarding requests and
1114          * responses. 0x0 - 0xFFF8 - Used for function ids 0xFFF8 - 0xFFFE -
1115          * Reserved for internal processors 0xFFFF - HWRM
1116          */
1117         uint16_t source_id;
1118
1119         uint32_t unused_0;
1120
1121         /* Address of forwarded request. */
1122         /*
1123          * This value is written by the NIC such that it will be different for
1124          * each pass through the completion queue. The even passes will write 1.
1125          * The odd passes will write 0.
1126          */
1127         #define HWRM_FWD_REQ_CMPL_V                     UINT32_C(0x1)
1128         /* Address of forwarded request. */
1129         #define HWRM_FWD_REQ_CMPL_REQ_BUF_ADDR_MASK     UINT32_C(0xfffffffe)
1130         #define HWRM_FWD_REQ_CMPL_REQ_BUF_ADDR_SFT      1
1131         uint64_t req_buf_addr_v;
1132 } __attribute__((packed));
1133
1134 /* HWRM Asynchronous Event Completion Record (16 bytes) */
1135 struct hwrm_async_event_cmpl {
1136         /*
1137          * This field indicates the exact type of the completion. By convention,
1138          * the LSB identifies the length of the record in 16B units. Even values
1139          * indicate 16B records. Odd values indicate 32B records.
1140          */
1141         #define HWRM_ASYNC_EVENT_CMPL_TYPE_MASK         UINT32_C(0x3f)
1142         #define HWRM_ASYNC_EVENT_CMPL_TYPE_SFT          0
1143                 /* HWRM Asynchronous Event Information */
1144         #define HWRM_ASYNC_EVENT_CMPL_TYPE_HWRM_ASYNC_EVENT \
1145                                                         (UINT32_C(0x2e) << 0)
1146         uint16_t type;
1147
1148         /* Identifiers of events. */
1149                 /* Link status changed */
1150         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE \
1151                                                         (UINT32_C(0x0) << 0)
1152                 /* Link MTU changed */
1153         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_MTU_CHANGE \
1154                                                         (UINT32_C(0x1) << 0)
1155                 /* Link speed changed */
1156         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE \
1157                                                         (UINT32_C(0x2) << 0)
1158                 /* DCB Configuration changed */
1159         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DCB_CONFIG_CHANGE \
1160                                                         (UINT32_C(0x3) << 0)
1161                 /* Port connection not allowed */
1162         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED \
1163                                                         (UINT32_C(0x4) << 0)
1164                 /* Link speed configuration was not allowed */
1165         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_NOT_ALLOWED \
1166                                                         (UINT32_C(0x5) << 0)
1167                 /* Function driver unloaded */
1168         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_FUNC_DRVR_UNLOAD \
1169                                                         (UINT32_C(0x10) << 0)
1170                 /* Function driver loaded */
1171         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_FUNC_DRVR_LOAD \
1172                                                         (UINT32_C(0x11) << 0)
1173                 /* PF driver unloaded */
1174         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD \
1175                                                         (UINT32_C(0x20) << 0)
1176                 /* PF driver loaded */
1177         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_LOAD \
1178                                                         (UINT32_C(0x21) << 0)
1179                 /* VF Function Level Reset (FLR) */
1180         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_FLR   (UINT32_C(0x30) << 0)
1181                 /* VF MAC Address Change */
1182         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_MAC_ADDR_CHANGE \
1183                                                         (UINT32_C(0x31) << 0)
1184                 /* PF-VF communication channel status change. */
1185         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_VF_COMM_STATUS_CHANGE \
1186                                                         (UINT32_C(0x32) << 0)
1187                 /* HWRM Error */
1188         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_HWRM_ERROR \
1189                                                         (UINT32_C(0xff) << 0)
1190         uint16_t event_id;
1191
1192         /* Event specific data */
1193         uint32_t event_data2;
1194
1195         /* opaque is 7 b */
1196         /*
1197          * This value is written by the NIC such that it will be different for
1198          * each pass through the completion queue. The even passes will write 1.
1199          * The odd passes will write 0.
1200          */
1201         #define HWRM_ASYNC_EVENT_CMPL_V                         UINT32_C(0x1)
1202         /* opaque is 7 b */
1203         #define HWRM_ASYNC_EVENT_CMPL_OPAQUE_MASK               UINT32_C(0xfe)
1204         #define HWRM_ASYNC_EVENT_CMPL_OPAQUE_SFT                1
1205         uint8_t opaque_v;
1206
1207         /* 8-lsb timestamp from POR (100-msec resolution) */
1208         uint8_t timestamp_lo;
1209
1210         /* 16-lsb timestamp from POR (100-msec resolution) */
1211         uint16_t timestamp_hi;
1212
1213         /* Event specific data */
1214         uint32_t event_data1;
1215 } __attribute__((packed));
1216
1217 /*
1218  * Note: The Hardware Resource Manager (HWRM) manages various hardware resources
1219  * inside the chip. The HWRM is implemented in firmware, and runs on embedded
1220  * processors inside the chip. This firmware is vital part of the chip's
1221  * hardware. The chip can not be used by driver without it.
1222  */
1223
1224 /* Input (16 bytes) */
1225 struct input {
1226         /*
1227          * This value indicates what type of request this is. The format for the
1228          * rest of the command is determined by this field.
1229          */
1230         uint16_t req_type;
1231
1232         /*
1233          * This value indicates the what completion ring the request will be
1234          * optionally completed on. If the value is -1, then no CR completion
1235          * will be generated. Any other value must be a valid CR ring_id value
1236          * for this function.
1237          */
1238         uint16_t cmpl_ring;
1239
1240         /* This value indicates the command sequence number. */
1241         uint16_t seq_id;
1242
1243         /*
1244          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1245          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1246          */
1247         uint16_t target_id;
1248
1249         /*
1250          * This is the host address where the response will be written when the
1251          * request is complete. This area must be 16B aligned and must be
1252          * cleared to zero before the request is made.
1253          */
1254         uint64_t resp_addr;
1255 } __attribute__((packed));
1256
1257 /* Output (8 bytes) */
1258 struct output {
1259         /*
1260          * Pass/Fail or error type Note: receiver to verify the in parameters,
1261          * and fail the call with an error when appropriate
1262          */
1263         uint16_t error_code;
1264
1265         /* This field returns the type of original request. */
1266         uint16_t req_type;
1267
1268         /* This field provides original sequence number of the command. */
1269         uint16_t seq_id;
1270
1271         /*
1272          * This field is the length of the response in bytes. The last byte of
1273          * the response is a valid flag that will read as '1' when the command
1274          * has been completely written to memory.
1275          */
1276         uint16_t resp_len;
1277 } __attribute__((packed));
1278
1279 /* hwrm_cfa_l2_filter_alloc */
1280 /*
1281  * A filter is used to identify traffic that contains a matching set of
1282  * parameters like unicast or broadcast MAC address or a VLAN tag amongst
1283  * other things which then allows the ASIC to direct the  incoming traffic
1284  * to an appropriate VNIC or Rx ring.
1285  */
1286
1287 /* Input (96 bytes) */
1288 struct hwrm_cfa_l2_filter_alloc_input {
1289         /*
1290          * This value indicates what type of request this is. The format for the
1291          * rest of the command is determined by this field.
1292          */
1293         uint16_t req_type;
1294
1295         /*
1296          * This value indicates the what completion ring the request will be
1297          * optionally completed on. If the value is -1, then no CR completion
1298          * will be generated. Any other value must be a valid CR ring_id value
1299          * for this function.
1300          */
1301         uint16_t cmpl_ring;
1302
1303         /* This value indicates the command sequence number. */
1304         uint16_t seq_id;
1305
1306         /*
1307          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1308          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1309          */
1310         uint16_t target_id;
1311
1312         /*
1313          * This is the host address where the response will be written when the
1314          * request is complete. This area must be 16B aligned and must be
1315          * cleared to zero before the request is made.
1316          */
1317         uint64_t resp_addr;
1318
1319         /*
1320          * Enumeration denoting the RX, TX type of the resource. This
1321          * enumeration is used for resources that are similar for both TX and RX
1322          * paths of the chip.
1323          */
1324         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH \
1325                                                         UINT32_C(0x1)
1326                 /* tx path */
1327         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_TX \
1328                                                         (UINT32_C(0x0) << 0)
1329                 /* rx path */
1330         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX \
1331                                                         (UINT32_C(0x1) << 0)
1332         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_LAST \
1333                                 HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX
1334         /*
1335          * Setting of this flag indicates the applicability to the loopback
1336          * path.
1337          */
1338         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_LOOPBACK \
1339                                                         UINT32_C(0x2)
1340         /*
1341          * Setting of this flag indicates drop action. If this flag is not set,
1342          * then it should be considered accept action.
1343          */
1344         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_DROP \
1345                                                         UINT32_C(0x4)
1346         /*
1347          * If this flag is set, all t_l2_* fields are invalid and they should
1348          * not be specified. If this flag is set, then l2_* fields refer to
1349          * fields of outermost L2 header.
1350          */
1351         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST \
1352                                                         UINT32_C(0x8)
1353         uint32_t flags;
1354
1355         /* This bit must be '1' for the l2_addr field to be configured. */
1356         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR \
1357                                                         UINT32_C(0x1)
1358         /* This bit must be '1' for the l2_addr_mask field to be configured. */
1359         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK \
1360                                                         UINT32_C(0x2)
1361         /* This bit must be '1' for the l2_ovlan field to be configured. */
1362         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN \
1363                                                         UINT32_C(0x4)
1364         /* This bit must be '1' for the l2_ovlan_mask field to be configured. */
1365         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN_MASK \
1366                                                         UINT32_C(0x8)
1367         /* This bit must be '1' for the l2_ivlan field to be configured. */
1368         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN \
1369                                                         UINT32_C(0x10)
1370         /* This bit must be '1' for the l2_ivlan_mask field to be configured. */
1371         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN_MASK \
1372                                                         UINT32_C(0x20)
1373         /* This bit must be '1' for the t_l2_addr field to be configured. */
1374         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR \
1375                                                         UINT32_C(0x40)
1376         /*
1377          * This bit must be '1' for the t_l2_addr_mask field to be configured.
1378          */
1379         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR_MASK \
1380                                                         UINT32_C(0x80)
1381         /* This bit must be '1' for the t_l2_ovlan field to be configured. */
1382         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN \
1383                                                         UINT32_C(0x100)
1384         /*
1385          * This bit must be '1' for the t_l2_ovlan_mask field to be configured.
1386          */
1387         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN_MASK \
1388                                                         UINT32_C(0x200)
1389         /* This bit must be '1' for the t_l2_ivlan field to be configured. */
1390         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN \
1391                                                         UINT32_C(0x400)
1392         /*
1393          * This bit must be '1' for the t_l2_ivlan_mask field to be configured.
1394          */
1395         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN_MASK \
1396                                                         UINT32_C(0x800)
1397         /* This bit must be '1' for the src_type field to be configured. */
1398         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_TYPE \
1399                                                         UINT32_C(0x1000)
1400         /* This bit must be '1' for the src_id field to be configured. */
1401         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_ID \
1402                                                         UINT32_C(0x2000)
1403         /* This bit must be '1' for the tunnel_type field to be configured. */
1404         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_TUNNEL_TYPE \
1405                                                         UINT32_C(0x4000)
1406         /* This bit must be '1' for the dst_id field to be configured. */
1407         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_DST_ID \
1408                                                         UINT32_C(0x8000)
1409         /*
1410          * This bit must be '1' for the mirror_vnic_id field to be configured.
1411          */
1412         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID \
1413                                                         UINT32_C(0x10000)
1414         uint32_t enables;
1415
1416         /*
1417          * This value sets the match value for the L2 MAC address. Destination
1418          * MAC address for RX path. Source MAC address for TX path.
1419          */
1420         uint8_t l2_addr[6];
1421
1422         uint8_t unused_0;
1423         uint8_t unused_1;
1424
1425         /*
1426          * This value sets the mask value for the L2 address. A value of 0 will
1427          * mask the corresponding bit from compare.
1428          */
1429         uint8_t l2_addr_mask[6];
1430
1431         /* This value sets VLAN ID value for outer VLAN. */
1432         uint16_t l2_ovlan;
1433
1434         /*
1435          * This value sets the mask value for the ovlan id. A value of 0 will
1436          * mask the corresponding bit from compare.
1437          */
1438         uint16_t l2_ovlan_mask;
1439
1440         /* This value sets VLAN ID value for inner VLAN. */
1441         uint16_t l2_ivlan;
1442
1443         /*
1444          * This value sets the mask value for the ivlan id. A value of 0 will
1445          * mask the corresponding bit from compare.
1446          */
1447         uint16_t l2_ivlan_mask;
1448
1449         uint8_t unused_2;
1450         uint8_t unused_3;
1451
1452         /*
1453          * This value sets the match value for the tunnel L2 MAC address.
1454          * Destination MAC address for RX path. Source MAC address for TX path.
1455          */
1456         uint8_t t_l2_addr[6];
1457
1458         uint8_t unused_4;
1459         uint8_t unused_5;
1460
1461         /*
1462          * This value sets the mask value for the tunnel L2 address. A value of
1463          * 0 will mask the corresponding bit from compare.
1464          */
1465         uint8_t t_l2_addr_mask[6];
1466
1467         /* This value sets VLAN ID value for tunnel outer VLAN. */
1468         uint16_t t_l2_ovlan;
1469
1470         /*
1471          * This value sets the mask value for the tunnel ovlan id. A value of 0
1472          * will mask the corresponding bit from compare.
1473          */
1474         uint16_t t_l2_ovlan_mask;
1475
1476         /* This value sets VLAN ID value for tunnel inner VLAN. */
1477         uint16_t t_l2_ivlan;
1478
1479         /*
1480          * This value sets the mask value for the tunnel ivlan id. A value of 0
1481          * will mask the corresponding bit from compare.
1482          */
1483         uint16_t t_l2_ivlan_mask;
1484
1485         /* This value identifies the type of source of the packet. */
1486                 /* Network port */
1487         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_NPORT \
1488                                                         (UINT32_C(0x0) << 0)
1489                 /* Physical function */
1490         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_PF \
1491                                                         (UINT32_C(0x1) << 0)
1492                 /* Virtual function */
1493         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VF \
1494                                                         (UINT32_C(0x2) << 0)
1495                 /* Virtual NIC of a function */
1496         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VNIC \
1497                                                         (UINT32_C(0x3) << 0)
1498                 /* Embedded processor for CFA management */
1499         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_KONG \
1500                                                         (UINT32_C(0x4) << 0)
1501                 /* Embedded processor for OOB management */
1502         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_APE \
1503                                                         (UINT32_C(0x5) << 0)
1504                 /* Embedded processor for RoCE */
1505         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_BONO \
1506                                                         (UINT32_C(0x6) << 0)
1507                 /* Embedded processor for network proxy functions */
1508         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_TANG \
1509                                                         (UINT32_C(0x7) << 0)
1510         uint8_t src_type;
1511
1512         uint8_t unused_6;
1513         /*
1514          * This value is the id of the source. For a network port, it represents
1515          * port_id. For a physical function, it represents fid. For a virtual
1516          * function, it represents vf_id. For a vnic, it represents vnic_id. For
1517          * embedded processors, this id is not valid. Notes: 1. The function ID
1518          * is implied if it src_id is not provided for a src_type that is either
1519          */
1520         uint32_t src_id;
1521
1522         /* Tunnel Type. */
1523                 /* Non-tunnel */
1524         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NONTUNNEL \
1525                                                         (UINT32_C(0x0) << 0)
1526                 /* Virtual eXtensible Local Area Network (VXLAN) */
1527         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_VXLAN \
1528                                                         (UINT32_C(0x1) << 0)
1529                 /*
1530                  * Network Virtualization Generic Routing Encapsulation (NVGRE)
1531                  */
1532         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NVGRE \
1533                                                         (UINT32_C(0x2) << 0)
1534                 /*
1535                  * Generic Routing Encapsulation (GRE) inside Ethernet payload
1536                  */
1537         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_L2GRE \
1538                                                         (UINT32_C(0x3) << 0)
1539                 /* IP in IP */
1540         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPIP \
1541                                                         (UINT32_C(0x4) << 0)
1542                 /* Generic Network Virtualization Encapsulation (Geneve) */
1543         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_GENEVE \
1544                                                         (UINT32_C(0x5) << 0)
1545                 /* Multi-Protocol Lable Switching (MPLS) */
1546         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_MPLS \
1547                                                         (UINT32_C(0x6) << 0)
1548                 /* Stateless Transport Tunnel (STT) */
1549         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_STT \
1550                                                         (UINT32_C(0x7) << 0)
1551                 /*
1552                  * Generic Routing Encapsulation (GRE) inside IP datagram
1553                  * payload
1554                  */
1555         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPGRE \
1556                                                         (UINT32_C(0x8) << 0)
1557                 /* Any tunneled traffic */
1558         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_ANYTUNNEL \
1559                                                         (UINT32_C(0xff) << 0)
1560         uint8_t tunnel_type;
1561
1562         uint8_t unused_7;
1563
1564         /*
1565          * If set, this value shall represent the Logical VNIC ID of the
1566          * destination VNIC for the RX path and network port id of the
1567          * destination port for the TX path.
1568          */
1569         uint16_t dst_id;
1570
1571         /* Logical VNIC ID of the VNIC where traffic is mirrored. */
1572         uint16_t mirror_vnic_id;
1573
1574         /*
1575          * This hint is provided to help in placing the filter in the filter
1576          * table.
1577          */
1578                 /* No preference */
1579         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_NO_PREFER \
1580                                                         (UINT32_C(0x0) << 0)
1581                 /* Above the given filter */
1582         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_ABOVE_FILTER \
1583                                                         (UINT32_C(0x1) << 0)
1584                 /* Below the given filter */
1585         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_BELOW_FILTER \
1586                                                         (UINT32_C(0x2) << 0)
1587                 /* As high as possible */
1588         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MAX \
1589                                                         (UINT32_C(0x3) << 0)
1590                 /* As low as possible */
1591         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MIN \
1592                                                         (UINT32_C(0x4) << 0)
1593         uint8_t pri_hint;
1594
1595         uint8_t unused_8;
1596         uint32_t unused_9;
1597
1598         /*
1599          * This is the ID of the filter that goes along with the pri_hint. This
1600          * field is valid only for the following values. 1 - Above the given
1601          * filter 2 - Below the given filter
1602          */
1603         uint64_t l2_filter_id_hint;
1604 } __attribute__((packed));
1605
1606 /* Output (24 bytes) */
1607 struct hwrm_cfa_l2_filter_alloc_output {
1608         /*
1609          * Pass/Fail or error type Note: receiver to verify the in parameters,
1610          * and fail the call with an error when appropriate
1611          */
1612         uint16_t error_code;
1613
1614         /* This field returns the type of original request. */
1615         uint16_t req_type;
1616
1617         /* This field provides original sequence number of the command. */
1618         uint16_t seq_id;
1619
1620         /*
1621          * This field is the length of the response in bytes. The last byte of
1622          * the response is a valid flag that will read as '1' when the command
1623          * has been completely written to memory.
1624          */
1625         uint16_t resp_len;
1626
1627         /*
1628          * This value identifies a set of CFA data structures used for an L2
1629          * context.
1630          */
1631         uint64_t l2_filter_id;
1632
1633         /*
1634          * This is the ID of the flow associated with this filter. This value
1635          * shall be used to match and associate the flow identifier returned in
1636          * completion records. A value of 0xFFFFFFFF shall indicate no flow id.
1637          */
1638         uint32_t flow_id;
1639
1640         uint8_t unused_0;
1641         uint8_t unused_1;
1642         uint8_t unused_2;
1643
1644         /*
1645          * This field is used in Output records to indicate that the output is
1646          * completely written to RAM. This field should be read as '1' to
1647          * indicate that the output has been completely written. When writing a
1648          * command completion or response to an internal processor, the order of
1649          * writes has to be such that this field is written last.
1650          */
1651         uint8_t valid;
1652 } __attribute__((packed));
1653
1654 /* hwrm_cfa_l2_filter_free */
1655 /*
1656  * Description: Free a L2 filter. The HWRM shall free all associated filter
1657  * resources with the L2 filter.
1658  */
1659
1660 /* Input (24 bytes) */
1661 struct hwrm_cfa_l2_filter_free_input {
1662         /*
1663          * This value indicates what type of request this is. The format for the
1664          * rest of the command is determined by this field.
1665          */
1666         uint16_t req_type;
1667
1668         /*
1669          * This value indicates the what completion ring the request will be
1670          * optionally completed on. If the value is -1, then no CR completion
1671          * will be generated. Any other value must be a valid CR ring_id value
1672          * for this function.
1673          */
1674         uint16_t cmpl_ring;
1675
1676         /* This value indicates the command sequence number. */
1677         uint16_t seq_id;
1678
1679         /*
1680          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1681          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1682          */
1683         uint16_t target_id;
1684
1685         /*
1686          * This is the host address where the response will be written when the
1687          * request is complete. This area must be 16B aligned and must be
1688          * cleared to zero before the request is made.
1689          */
1690         uint64_t resp_addr;
1691
1692         /*
1693          * This value identifies a set of CFA data structures used for an L2
1694          * context.
1695          */
1696         uint64_t l2_filter_id;
1697 } __attribute__((packed));
1698
1699 /* Output (16 bytes) */
1700 struct hwrm_cfa_l2_filter_free_output {
1701         /*
1702          * Pass/Fail or error type Note: receiver to verify the in parameters,
1703          * and fail the call with an error when appropriate
1704          */
1705         uint16_t error_code;
1706
1707         /* This field returns the type of original request. */
1708         uint16_t req_type;
1709
1710         /* This field provides original sequence number of the command. */
1711         uint16_t seq_id;
1712
1713         /*
1714          * This field is the length of the response in bytes. The last byte of
1715          * the response is a valid flag that will read as '1' when the command
1716          * has been completely written to memory.
1717          */
1718         uint16_t resp_len;
1719
1720         uint32_t unused_0;
1721         uint8_t unused_1;
1722         uint8_t unused_2;
1723         uint8_t unused_3;
1724
1725         /*
1726          * This field is used in Output records to indicate that the output is
1727          * completely written to RAM. This field should be read as '1' to
1728          * indicate that the output has been completely written. When writing a
1729          * command completion or response to an internal processor, the order of
1730          * writes has to be such that this field is written last.
1731          */
1732         uint8_t valid;
1733 } __attribute__((packed));
1734
1735 /* hwrm_exec_fwd_resp */
1736 /*
1737  * Description: This command is used to send an encapsulated request to the
1738  * HWRM. This command instructs the HWRM to execute the request and forward the
1739  * response of the encapsulated request to the location specified in the
1740  * original request that is encapsulated. The target id of this command shall be
1741  * set to 0xFFFF (HWRM). The response location in this command shall be used to
1742  * acknowledge the receipt of the encapsulated request and forwarding of the
1743  * response.
1744  */
1745
1746 /* Input (128 bytes) */
1747 struct hwrm_exec_fwd_resp_input {
1748         /*
1749          * This value indicates what type of request this is. The format for the
1750          * rest of the command is determined by this field.
1751          */
1752         uint16_t req_type;
1753
1754         /*
1755          * This value indicates the what completion ring the request will be
1756          * optionally completed on. If the value is -1, then no CR completion
1757          * will be generated. Any other value must be a valid CR ring_id value
1758          * for this function.
1759          */
1760         uint16_t cmpl_ring;
1761
1762         /* This value indicates the command sequence number. */
1763         uint16_t seq_id;
1764
1765         /*
1766          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1767          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1768          */
1769         uint16_t target_id;
1770
1771         /*
1772          * This is the host address where the response will be written when the
1773          * request is complete. This area must be 16B aligned and must be
1774          * cleared to zero before the request is made.
1775          */
1776         uint64_t resp_addr;
1777
1778         /*
1779          * This is an encapsulated request. This request should be executed by
1780          * the HWRM and the response should be provided in the response buffer
1781          * inside the encapsulated request.
1782          */
1783         uint32_t encap_request[26];
1784
1785         /*
1786          * This value indicates the target id of the response to the
1787          * encapsulated request. 0x0 - 0xFFF8 - Used for function ids 0xFFF8 -
1788          * 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1789          */
1790         uint16_t encap_resp_target_id;
1791
1792         uint16_t unused_0[3];
1793 } __attribute__((packed));
1794
1795 /* Output (16 bytes) */
1796 struct hwrm_exec_fwd_resp_output {
1797         /*
1798          * Pass/Fail or error type Note: receiver to verify the in parameters,
1799          * and fail the call with an error when appropriate
1800          */
1801         uint16_t error_code;
1802
1803         /* This field returns the type of original request. */
1804         uint16_t req_type;
1805
1806         /* This field provides original sequence number of the command. */
1807         uint16_t seq_id;
1808
1809         /*
1810          * This field is the length of the response in bytes. The last byte of
1811          * the response is a valid flag that will read as '1' when the command
1812          * has been completely written to memory.
1813          */
1814         uint16_t resp_len;
1815
1816         uint32_t unused_0;
1817         uint8_t unused_1;
1818         uint8_t unused_2;
1819         uint8_t unused_3;
1820
1821         /*
1822          * This field is used in Output records to indicate that the output is
1823          * completely written to RAM. This field should be read as '1' to
1824          * indicate that the output has been completely written. When writing a
1825          * command completion or response to an internal processor, the order of
1826          * writes has to be such that this field is written last.
1827          */
1828         uint8_t valid;
1829 } __attribute__((packed));
1830
1831 /* hwrm_func_qcaps */
1832 /*
1833  * Description: This command returns capabilities of a function. The input FID
1834  * value is used to indicate what function is being queried. This allows a
1835  * physical function driver to query virtual functions that are children of the
1836  * physical function. The output FID value is needed to configure Rings and
1837  * MSI-X vectors so their DMA operations appear correctly on the PCI bus.
1838  */
1839
1840 /* Input (24 bytes) */
1841 struct hwrm_func_qcaps_input {
1842         /*
1843          * This value indicates what type of request this is. The format for the
1844          * rest of the command is determined by this field.
1845          */
1846         uint16_t req_type;
1847
1848         /*
1849          * This value indicates the what completion ring the request will be
1850          * optionally completed on. If the value is -1, then no CR completion
1851          * will be generated. Any other value must be a valid CR ring_id value
1852          * for this function.
1853          */
1854         uint16_t cmpl_ring;
1855
1856         /* This value indicates the command sequence number. */
1857         uint16_t seq_id;
1858
1859         /*
1860          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1861          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1862          */
1863         uint16_t target_id;
1864
1865         /*
1866          * This is the host address where the response will be written when the
1867          * request is complete. This area must be 16B aligned and must be
1868          * cleared to zero before the request is made.
1869          */
1870         uint64_t resp_addr;
1871
1872         /*
1873          * Function ID of the function that is being queried. 0xFF... (All Fs)
1874          * if the query is for the requesting function.
1875          */
1876         uint16_t fid;
1877
1878         uint16_t unused_0[3];
1879 } __attribute__((packed));
1880
1881 /* Output (80 bytes) */
1882 struct hwrm_func_qcaps_output {
1883         /*
1884          * Pass/Fail or error type Note: receiver to verify the in parameters,
1885          * and fail the call with an error when appropriate
1886          */
1887         uint16_t error_code;
1888
1889         /* This field returns the type of original request. */
1890         uint16_t req_type;
1891
1892         /* This field provides original sequence number of the command. */
1893         uint16_t seq_id;
1894
1895         /*
1896          * This field is the length of the response in bytes. The last byte of
1897          * the response is a valid flag that will read as '1' when the command
1898          * has been completely written to memory.
1899          */
1900         uint16_t resp_len;
1901
1902         /*
1903          * FID value. This value is used to identify operations on the PCI bus
1904          * as belonging to a particular PCI function.
1905          */
1906         uint16_t fid;
1907
1908         /*
1909          * Port ID of port that this function is associated with. Valid only for
1910          * the PF. 0xFF... (All Fs) if this function is not associated with any
1911          * port. 0xFF... (All Fs) if this function is called from a VF.
1912          */
1913         uint16_t port_id;
1914
1915         /* If 1, then Push mode is supported on this function. */
1916         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PUSH_MODE_SUPPORTED   UINT32_C(0x1)
1917         /*
1918          * If 1, then the global MSI-X auto-masking is enabled for the device.
1919          */
1920         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_GLOBAL_MSIX_AUTOMASKING \
1921                                                                 UINT32_C(0x2)
1922         /*
1923          * If 1, then the Precision Time Protocol (PTP) processing is supported
1924          * on this function. The HWRM should enable PTP on only a single
1925          * Physical Function (PF) per port.
1926          */
1927         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED         UINT32_C(0x4)
1928         uint32_t flags;
1929
1930         /*
1931          * This value is current MAC address configured for this function. A
1932          * value of 00-00-00-00-00-00 indicates no MAC address is currently
1933          * configured.
1934          */
1935         uint8_t perm_mac_address[6];
1936
1937         /*
1938          * The maximum number of RSS/COS contexts that can be allocated to the
1939          * function.
1940          */
1941         uint16_t max_rsscos_ctx;
1942
1943         /*
1944          * The maximum number of completion rings that can be allocated to the
1945          * function.
1946          */
1947         uint16_t max_cmpl_rings;
1948
1949         /*
1950          * The maximum number of transmit rings that can be allocated to the
1951          * function.
1952          */
1953         uint16_t max_tx_rings;
1954
1955         /*
1956          * The maximum number of receive rings that can be allocated to the
1957          * function.
1958          */
1959         uint16_t max_rx_rings;
1960
1961         /*
1962          * The maximum number of L2 contexts that can be allocated to the
1963          * function.
1964          */
1965         uint16_t max_l2_ctxs;
1966
1967         /* The maximum number of VNICs that can be allocated to the function. */
1968         uint16_t max_vnics;
1969
1970         /*
1971          * The identifier for the first VF enabled on a PF. This is valid only
1972          * on the PF with SR-IOV enabled. 0xFF... (All Fs) if this command is
1973          * called on a PF with SR-IOV disabled or on a VF.
1974          */
1975         uint16_t first_vf_id;
1976
1977         /*
1978          * The maximum number of VFs that can be allocated to the function. This
1979          * is valid only on the PF with SR-IOV enabled. 0xFF... (All Fs) if this
1980          * command is called on a PF with SR-IOV disabled or on a VF.
1981          */
1982         uint16_t max_vfs;
1983
1984         /*
1985          * The maximum number of statistic contexts that can be allocated to the
1986          * function.
1987          */
1988         uint16_t max_stat_ctx;
1989
1990         /*
1991          * The maximum number of Encapsulation records that can be offloaded by
1992          * this function.
1993          */
1994         uint32_t max_encap_records;
1995
1996         /*
1997          * The maximum number of decapsulation records that can be offloaded by
1998          * this function.
1999          */
2000         uint32_t max_decap_records;
2001
2002         /*
2003          * The maximum number of Exact Match (EM) flows that can be offloaded by
2004          * this function on the TX side.
2005          */
2006         uint32_t max_tx_em_flows;
2007
2008         /*
2009          * The maximum number of Wildcard Match (WM) flows that can be offloaded
2010          * by this function on the TX side.
2011          */
2012         uint32_t max_tx_wm_flows;
2013
2014         /*
2015          * The maximum number of Exact Match (EM) flows that can be offloaded by
2016          * this function on the RX side.
2017          */
2018         uint32_t max_rx_em_flows;
2019
2020         /*
2021          * The maximum number of Wildcard Match (WM) flows that can be offloaded
2022          * by this function on the RX side.
2023          */
2024         uint32_t max_rx_wm_flows;
2025
2026         /*
2027          * The maximum number of multicast filters that can be supported by this
2028          * function on the RX side.
2029          */
2030         uint32_t max_mcast_filters;
2031
2032         /*
2033          * The maximum value of flow_id that can be supported in completion
2034          * records.
2035          */
2036         uint32_t max_flow_id;
2037
2038         /*
2039          * The maximum number of HW ring groups that can be supported on this
2040          * function.
2041          */
2042         uint32_t max_hw_ring_grps;
2043
2044         uint8_t unused_0;
2045         uint8_t unused_1;
2046         uint8_t unused_2;
2047
2048         /*
2049          * This field is used in Output records to indicate that the output is
2050          * completely written to RAM. This field should be read as '1' to
2051          * indicate that the output has been completely written. When writing a
2052          * command completion or response to an internal processor, the order of
2053          * writes has to be such that this field is written last.
2054          */
2055         uint8_t valid;
2056 } __attribute__((packed));
2057
2058 /* hwrm_func_reset */
2059 /*
2060  * Description: This command resets a hardware function (PCIe function) and
2061  * frees any resources used by the function. This command shall be initiated by
2062  * the driver after an FLR has occurred to prepare the function for re-use. This
2063  * command may also be initiated by a driver prior to doing it's own
2064  * configuration. This command puts the function into the reset state. In the
2065  * reset state, global and port related features of the chip are not available.
2066  */
2067 /*
2068  * Note: This command will reset a function that has already been disabled or
2069  * idled. The command returns all the resources owned by the function so a new
2070  * driver may allocate and configure resources normally.
2071  */
2072
2073 /* Input (24 bytes) */
2074 struct hwrm_func_reset_input {
2075         /*
2076          * This value indicates what type of request this is. The format for the
2077          * rest of the command is determined by this field.
2078          */
2079         uint16_t req_type;
2080
2081         /*
2082          * This value indicates the what completion ring the request will be
2083          * optionally completed on. If the value is -1, then no CR completion
2084          * will be generated. Any other value must be a valid CR ring_id value
2085          * for this function.
2086          */
2087         uint16_t cmpl_ring;
2088
2089         /* This value indicates the command sequence number. */
2090         uint16_t seq_id;
2091
2092         /*
2093          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
2094          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
2095          */
2096         uint16_t target_id;
2097
2098         /*
2099          * This is the host address where the response will be written when the
2100          * request is complete. This area must be 16B aligned and must be
2101          * cleared to zero before the request is made.
2102          */
2103         uint64_t resp_addr;
2104
2105         /* This bit must be '1' for the vf_id_valid field to be configured. */
2106         #define HWRM_FUNC_RESET_INPUT_ENABLES_VF_ID_VALID \
2107                                                         UINT32_C(0x1)
2108         uint32_t enables;
2109
2110         /*
2111          * The ID of the VF that this PF is trying to reset. Only the parent PF
2112          * shall be allowed to reset a child VF. A parent PF driver shall use
2113          * this field only when a specific child VF is requested to be reset.
2114          */
2115         uint16_t vf_id;
2116
2117         /* This value indicates the level of a function reset. */
2118                 /*
2119                  * Reset the caller function and its children VFs (if any). If
2120                  * no children functions exist, then reset the caller function
2121                  * only.
2122                  */
2123         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETALL \
2124                                                         (UINT32_C(0x0) << 0)
2125                 /* Reset the caller function only */
2126         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETME \
2127                                                         (UINT32_C(0x1) << 0)
2128                 /*
2129                  * Reset all children VFs of the caller function driver if the
2130                  * caller is a PF driver. It is an error to specify this level
2131                  * by a VF driver. It is an error to specify this level by a PF
2132                  * driver with no children VFs.
2133                  */
2134         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETCHILDREN \
2135                                                         (UINT32_C(0x2) << 0)
2136                 /*
2137                  * Reset a specific VF of the caller function driver if the
2138                  * caller is the parent PF driver. It is an error to specify
2139                  * this level by a VF driver. It is an error to specify this
2140                  * level by a PF driver that is not the parent of the VF that is
2141                  * being requested to reset.
2142                  */
2143         #define HWRM_FUNC_RESET_INPUT_FUNC_RESET_LEVEL_RESETVF \
2144                                                         (UINT32_C(0x3) << 0)
2145         uint8_t func_reset_level;
2146
2147         uint8_t unused_0;
2148 } __attribute__((packed));
2149
2150 /* Output (16 bytes) */
2151 struct hwrm_func_reset_output {
2152         /*
2153          * Pass/Fail or error type Note: receiver to verify the in parameters,
2154          * and fail the call with an error when appropriate
2155          */
2156         uint16_t error_code;
2157
2158         /* This field returns the type of original request. */
2159         uint16_t req_type;
2160
2161         /* This field provides original sequence number of the command. */
2162         uint16_t seq_id;
2163
2164         /*
2165          * This field is the length of the response in bytes. The last byte of
2166          * the response is a valid flag that will read as '1' when the command
2167          * has been completely written to memory.
2168          */
2169         uint16_t resp_len;
2170
2171         uint32_t unused_0;
2172         uint8_t unused_1;
2173         uint8_t unused_2;
2174         uint8_t unused_3;
2175
2176         /*
2177          * This field is used in Output records to indicate that the output is
2178          * completely written to RAM. This field should be read as '1' to
2179          * indicate that the output has been completely written. When writing a
2180          * command completion or response to an internal processor, the order of
2181          * writes has to be such that this field is written last.
2182          */
2183         uint8_t valid;
2184 } __attribute__((packed));
2185
2186 /* hwrm_port_phy_cfg */
2187 /*
2188  * Description: This command configures the PHY device for the port. It allows
2189  * setting of the most generic settings for the PHY. The HWRM shall complete
2190  * this command as soon as PHY settings are configured. They may not be applied
2191  * when the command response is provided. A VF driver shall not be allowed to
2192  * configure PHY using this command. In a network partition mode, a PF driver
2193  * shall not be allowed to configure PHY using this command.
2194  */
2195
2196 /* Input (56 bytes) */
2197 struct hwrm_port_phy_cfg_input {
2198         /*
2199          * This value indicates what type of request this is. The format for the
2200          * rest of the command is determined by this field.
2201          */
2202         uint16_t req_type;
2203
2204         /*
2205          * This value indicates the what completion ring the request will be
2206          * optionally completed on. If the value is -1, then no CR completion
2207          * will be generated. Any other value must be a valid CR ring_id value
2208          * for this function.
2209          */
2210         uint16_t cmpl_ring;
2211
2212         /* This value indicates the command sequence number. */
2213         uint16_t seq_id;
2214
2215         /*
2216          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
2217          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
2218          */
2219         uint16_t target_id;
2220
2221         /*
2222          * This is the host address where the response will be written when the
2223          * request is complete. This area must be 16B aligned and must be
2224          * cleared to zero before the request is made.
2225          */
2226         uint64_t resp_addr;
2227
2228         /*
2229          * When this bit is set to '1', the PHY for the port shall be reset. #
2230          * If this bit is set to 1, then the HWRM shall reset the PHY after
2231          * applying PHY configuration changes specified in this command. # In
2232          * order to guarantee that PHY configuration changes specified in this
2233          * command take effect, the HWRM client should set this flag to 1. # If
2234          * this bit is not set to 1, then the HWRM may reset the PHY depending
2235          * on the current PHY configuration and settings specified in this
2236          * command.
2237          */
2238         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY            UINT32_C(0x1)
2239         /*
2240          * When this bit is set to '1', the link shall be forced to be taken
2241          * down. # When this bit is set to '1", all other command input settings
2242          * related to the link speed shall be ignored. Once the link state is
2243          * forced down, it can be explicitly cleared from that state by setting
2244          * this flag to '0'. # If this flag is set to '0', then the link shall
2245          * be cleared from forced down state if the link is in forced down
2246          * state. There may be conditions (e.g. out-of-band or sideband
2247          * configuration changes for the link) outside the scope of the HWRM
2248          * implementation that may clear forced down link state.
2249          */
2250         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE_LINK_DOWN      UINT32_C(0x2)
2251         /*
2252          * When this bit is set to '1', the link shall be forced to the
2253          * force_link_speed value. When this bit is set to '1', the HWRM client
2254          * should not enable any of the auto negotiation related fields
2255          * represented by auto_XXX fields in this command. When this bit is set
2256          * to '1' and the HWRM client has enabled a auto_XXX field in this
2257          * command, then the HWRM shall ignore the enabled auto_XXX field. When
2258          * this bit is set to zero, the link shall be allowed to autoneg.
2259          */
2260         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE                UINT32_C(0x4)
2261         /*
2262          * When this bit is set to '1', the auto-negotiation process shall be
2263          * restarted on the link.
2264          */
2265         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG      UINT32_C(0x8)
2266         /*
2267          * When this bit is set to '1', Energy Efficient Ethernet (EEE) is
2268          * requested to be enabled on this link. If EEE is not supported on this
2269          * port, then this flag shall be ignored by the HWRM.
2270          */
2271         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_ENABLE        UINT32_C(0x10)
2272         /*
2273          * When this bit is set to '1', Energy Efficient Ethernet (EEE) is
2274          * requested to be disabled on this link. If EEE is not supported on
2275          * this port, then this flag shall be ignored by the HWRM.
2276          */
2277         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_DISABLE       UINT32_C(0x20)
2278         /*
2279          * When this bit is set to '1' and EEE is enabled on this link, then TX
2280          * LPI is requested to be enabled on the link. If EEE is not supported
2281          * on this port, then this flag shall be ignored by the HWRM. If EEE is
2282          * disabled on this port, then this flag shall be ignored by the HWRM.
2283          */
2284         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_TX_LPI        UINT32_C(0x40)
2285         uint32_t flags;
2286
2287         /* This bit must be '1' for the auto_mode field to be configured. */
2288         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE          UINT32_C(0x1)
2289         /* This bit must be '1' for the auto_duplex field to be configured. */
2290         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_DUPLEX        UINT32_C(0x2)
2291         /* This bit must be '1' for the auto_pause field to be configured. */
2292         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_PAUSE         UINT32_C(0x4)
2293         /*
2294          * This bit must be '1' for the auto_link_speed field to be configured.
2295          */
2296         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED    UINT32_C(0x8)
2297         /*
2298          * This bit must be '1' for the auto_link_speed_mask field to be
2299          * configured.
2300          */
2301         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK \
2302                                                                 UINT32_C(0x10)
2303         /* This bit must be '1' for the wirespeed field to be configured. */
2304         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_WIRESPEED       UINT32_C(0x20)
2305         /* This bit must be '1' for the lpbk field to be configured. */
2306         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_LPBK            UINT32_C(0x40)
2307         /* This bit must be '1' for the preemphasis field to be configured. */
2308         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_PREEMPHASIS     UINT32_C(0x80)
2309         /* This bit must be '1' for the force_pause field to be configured. */
2310         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_FORCE_PAUSE     UINT32_C(0x100)
2311         /*
2312          * This bit must be '1' for the eee_link_speed_mask field to be
2313          * configured.
2314          */
2315         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_EEE_LINK_SPEED_MASK \
2316                                                                 UINT32_C(0x200)
2317         /* This bit must be '1' for the tx_lpi_timer field to be configured. */
2318         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_TX_LPI_TIMER    UINT32_C(0x400)
2319         uint32_t enables;
2320
2321         /* Port ID of port that is to be configured. */
2322         uint16_t port_id;
2323
2324         /*
2325          * This is the speed that will be used if the force bit is '1'. If
2326          * unsupported speed is selected, an error will be generated.
2327          */
2328                 /* 100Mb link speed */
2329         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100MB \
2330                                                         (UINT32_C(0x1) << 0)
2331                 /* 1Gb link speed */
2332         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_1GB \
2333                                                         (UINT32_C(0xa) << 0)
2334                 /* 2Gb link speed */
2335         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2GB \
2336                                                         (UINT32_C(0x14) << 0)
2337                 /* 2.5Gb link speed */
2338         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2_5GB \
2339                                                         (UINT32_C(0x19) << 0)
2340                 /* 10Gb link speed */
2341         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10GB \
2342                                                         (UINT32_C(0x64) << 0)
2343                 /* 20Mb link speed */
2344         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_20GB \
2345                                                         (UINT32_C(0xc8) << 0)
2346                 /* 25Gb link speed */
2347         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_25GB \
2348                                                         (UINT32_C(0xfa) << 0)
2349                 /* 40Gb link speed */
2350         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_40GB \
2351                                                         (UINT32_C(0x190) << 0)
2352                 /* 50Gb link speed */
2353         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_50GB \
2354                                                         (UINT32_C(0x1f4) << 0)
2355                 /* 100Gb link speed */
2356         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100GB \
2357                                                         (UINT32_C(0x3e8) << 0)
2358                 /* 10Mb link speed */
2359         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10MB \
2360                                                         (UINT32_C(0xffff) << 0)
2361         uint16_t force_link_speed;
2362
2363         /*
2364          * This value is used to identify what autoneg mode is used when the
2365          * link speed is not being forced.
2366          */
2367                 /*
2368                  * Disable autoneg or autoneg disabled. No speeds are selected.
2369                  */
2370         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_NONE  (UINT32_C(0x0) << 0)
2371                 /* Select all possible speeds for autoneg mode. */
2372         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ALL_SPEEDS \
2373                                                         (UINT32_C(0x1) << 0)
2374                 /*
2375                  * Select only the auto_link_speed speed for autoneg mode. This
2376                  * mode has been DEPRECATED. An HWRM client should not use this
2377                  * mode.
2378                  */
2379         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ONE_SPEED \
2380                                                         (UINT32_C(0x2) << 0)
2381                 /*
2382                  * Select the auto_link_speed or any speed below that speed for
2383                  * autoneg. This mode has been DEPRECATED. An HWRM client should
2384                  * not use this mode.
2385                  */
2386         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ONE_OR_BELOW \
2387                                                         (UINT32_C(0x3) << 0)
2388                 /*
2389                  * Select the speeds based on the corresponding link speed mask
2390                  * value that is provided.
2391                  */
2392         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK \
2393                                                         (UINT32_C(0x4) << 0)
2394         uint8_t auto_mode;
2395
2396         /*
2397          * This is the duplex setting that will be used if the autoneg_mode is
2398          * "one_speed" or "one_or_below".
2399          */
2400                 /* Half Duplex will be requested. */
2401         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_HALF \
2402                                                         (UINT32_C(0x0) << 0)
2403                 /* Full duplex will be requested. */
2404         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_FULL \
2405                                                         (UINT32_C(0x1) << 0)
2406                 /* Both Half and Full dupex will be requested. */
2407         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_BOTH \
2408                                                         (UINT32_C(0x2) << 0)
2409         uint8_t auto_duplex;
2410
2411         /*
2412          * This value is used to configure the pause that will be used for
2413          * autonegotiation. Add text on the usage of auto_pause and force_pause.
2414          */
2415         /*
2416          * When this bit is '1', Generation of tx pause messages has been
2417          * requested. Disabled otherwise.
2418          */
2419         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_TX              UINT32_C(0x1)
2420         /*
2421          * When this bit is '1', Reception of rx pause messages has been
2422          * requested. Disabled otherwise.
2423          */
2424         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_RX              UINT32_C(0x2)
2425         /*
2426          * When set to 1, the advertisement of pause is enabled. # When the
2427          * auto_mode is not set to none and this flag is set to 1, then the
2428          * auto_pause bits on this port are being advertised and autoneg pause
2429          * results are being interpreted. # When the auto_mode is not set to
2430          * none and this flag is set to 0, the pause is forced as indicated in
2431          * force_pause, and also advertised as auto_pause bits, but the autoneg
2432          * results are not interpreted since the pause configuration is being
2433          * forced. # When the auto_mode is set to none and this flag is set to
2434          * 1, auto_pause bits should be ignored and should be set to 0.
2435          */
2436         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_AUTONEG_PAUSE   UINT32_C(0x4)
2437         uint8_t auto_pause;
2438
2439         uint8_t unused_0;
2440
2441         /*
2442          * This is the speed that will be used if the autoneg_mode is
2443          * "one_speed" or "one_or_below". If an unsupported speed is selected,
2444          * an error will be generated.
2445          */
2446                 /* 100Mb link speed */
2447         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100MB \
2448                                                         (UINT32_C(0x1) << 0)
2449                 /* 1Gb link speed */
2450         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_1GB \
2451                                                         (UINT32_C(0xa) << 0)
2452                 /* 2Gb link speed */
2453         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2GB \
2454                                                         (UINT32_C(0x14) << 0)
2455                 /* 2.5Gb link speed */
2456         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2_5GB \
2457                                                         (UINT32_C(0x19) << 0)
2458                 /* 10Gb link speed */
2459         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_10GB \
2460                                                         (UINT32_C(0x64) << 0)
2461                 /* 20Mb link speed */
2462         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_20GB \
2463                                                         (UINT32_C(0xc8) << 0)
2464                 /* 25Gb link speed */
2465         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_25GB \
2466                                                         (UINT32_C(0xfa) << 0)
2467                 /* 40Gb link speed */
2468         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_40GB \
2469                                                         (UINT32_C(0x190) << 0)
2470                 /* 50Gb link speed */
2471         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_50GB \
2472                                                         (UINT32_C(0x1f4) << 0)
2473                 /* 100Gb link speed */
2474         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100GB \
2475                                                         (UINT32_C(0x3e8) << 0)
2476                 /* 10Mb link speed */
2477         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_10MB \
2478                                                         (UINT32_C(0xffff) << 0)
2479         uint16_t auto_link_speed;
2480
2481         /*
2482          * This is a mask of link speeds that will be used if autoneg_mode is
2483          * "mask". If unsupported speed is enabled an error will be generated.
2484          */
2485         /* 100Mb link speed (Half-duplex) */
2486         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MBHD \
2487                                                         UINT32_C(0x1)
2488         /* 100Mb link speed (Full-duplex) */
2489         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MB \
2490                                                         UINT32_C(0x2)
2491         /* 1Gb link speed (Half-duplex) */
2492         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GBHD \
2493                                                         UINT32_C(0x4)
2494         /* 1Gb link speed (Full-duplex) */
2495         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GB \
2496                                                         UINT32_C(0x8)
2497         /* 2Gb link speed */
2498         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_2GB \
2499                                                         UINT32_C(0x10)
2500         /* 2.5Gb link speed */
2501         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_2_5GB \
2502                                                         UINT32_C(0x20)
2503         /* 10Gb link speed */
2504         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10GB \
2505                                                         UINT32_C(0x40)
2506         /* 20Gb link speed */
2507         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_20GB \
2508                                                         UINT32_C(0x80)
2509         /* 25Gb link speed */
2510         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_25GB \
2511                                                         UINT32_C(0x100)
2512         /* 40Gb link speed */
2513         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_40GB \
2514                                                         UINT32_C(0x200)
2515         /* 50Gb link speed */
2516         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_50GB \
2517                                                         UINT32_C(0x400)
2518         /* 100Gb link speed */
2519         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100GB \
2520                                                         UINT32_C(0x800)
2521         /* 10Mb link speed (Half-duplex) */
2522         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10MBHD \
2523                                                         UINT32_C(0x1000)
2524         /* 10Mb link speed (Full-duplex) */
2525         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10MB \
2526                                                         UINT32_C(0x2000)
2527         uint16_t auto_link_speed_mask;
2528
2529         /* This value controls the wirespeed feature. */
2530                 /* Wirespeed feature is disabled. */
2531         #define HWRM_PORT_PHY_CFG_INPUT_WIRESPEED_OFF   (UINT32_C(0x0) << 0)
2532                 /* Wirespeed feature is enabled. */
2533         #define HWRM_PORT_PHY_CFG_INPUT_WIRESPEED_ON    (UINT32_C(0x1) << 0)
2534         uint8_t wirespeed;
2535
2536         /* This value controls the loopback setting for the PHY. */
2537                 /* No loopback is selected. Normal operation. */
2538         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_NONE       (UINT32_C(0x0) << 0)
2539                 /*
2540                  * The HW will be configured with local loopback such that host
2541                  * data is sent back to the host without modification.
2542                  */
2543         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_LOCAL      (UINT32_C(0x1) << 0)
2544                 /*
2545                  * The HW will be configured with remote loopback such that port
2546                  * logic will send packets back out the transmitter that are
2547                  * received.
2548                  */
2549         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_REMOTE     (UINT32_C(0x2) << 0)
2550         uint8_t lpbk;
2551
2552         /*
2553          * This value is used to configure the pause that will be used for force
2554          * mode.
2555          */
2556         /*
2557          * When this bit is '1', Generation of tx pause messages is supported.
2558          * Disabled otherwise.
2559          */
2560         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_TX             UINT32_C(0x1)
2561         /*
2562          * When this bit is '1', Reception of rx pause messages is supported.
2563          * Disabled otherwise.
2564          */
2565         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_RX             UINT32_C(0x2)
2566         uint8_t force_pause;
2567
2568         uint8_t unused_1;
2569
2570         /*
2571          * This value controls the pre-emphasis to be used for the link. Driver
2572          * should not set this value (use enable.preemphasis = 0) unless driver
2573          * is sure of setting. Normally HWRM FW will determine proper pre-
2574          * emphasis.
2575          */
2576         uint32_t preemphasis;
2577
2578         /*
2579          * Setting for link speed mask that is used to advertise speeds during
2580          * autonegotiation when EEE is enabled. This field is valid only when
2581          * EEE is enabled. The speeds specified in this field shall be a subset
2582          * of speeds specified in auto_link_speed_mask. If EEE is enabled,then
2583          * at least one speed shall be provided in this mask.
2584          */
2585         /* Reserved */
2586         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD1  UINT32_C(0x1)
2587         /* 100Mb link speed (Full-duplex) */
2588         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_100MB  UINT32_C(0x2)
2589         /* Reserved */
2590         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD2  UINT32_C(0x4)
2591         /* 1Gb link speed (Full-duplex) */
2592         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_1GB    UINT32_C(0x8)
2593         /* Reserved */
2594         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD3 \
2595                                                                 UINT32_C(0x10)
2596         /* Reserved */
2597         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD4 \
2598                                                                 UINT32_C(0x20)
2599         /* 10Gb link speed */
2600         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_10GB \
2601                                                                 UINT32_C(0x40)
2602         uint16_t eee_link_speed_mask;
2603
2604         uint8_t unused_2;
2605         uint8_t unused_3;
2606
2607         /*
2608          * Reuested setting of TX LPI timer in microseconds. This field is valid
2609          * only when EEE is enabled and TX LPI is enabled.
2610          */
2611         #define HWRM_PORT_PHY_CFG_INPUT_TX_LPI_TIMER_MASK \
2612                                                         UINT32_C(0xffffff)
2613         #define HWRM_PORT_PHY_CFG_INPUT_TX_LPI_TIMER_SFT           0
2614         uint32_t tx_lpi_timer;
2615
2616         uint32_t unused_4;
2617 } __attribute__((packed));
2618
2619 /* Output (16 bytes) */
2620 struct hwrm_port_phy_cfg_output {
2621         /*
2622          * Pass/Fail or error type Note: receiver to verify the in parameters,
2623          * and fail the call with an error when appropriate
2624          */
2625         uint16_t error_code;
2626
2627         /* This field returns the type of original request. */
2628         uint16_t req_type;
2629
2630         /* This field provides original sequence number of the command. */
2631         uint16_t seq_id;
2632
2633         /*
2634          * This field is the length of the response in bytes. The last byte of
2635          * the response is a valid flag that will read as '1' when the command
2636          * has been completely written to memory.
2637          */
2638         uint16_t resp_len;
2639
2640         uint32_t unused_0;
2641         uint8_t unused_1;
2642         uint8_t unused_2;
2643         uint8_t unused_3;
2644
2645         /*
2646          * This field is used in Output records to indicate that the output is
2647          * completely written to RAM. This field should be read as '1' to
2648          * indicate that the output has been completely written. When writing a
2649          * command completion or response to an internal processor, the order of
2650          * writes has to be such that this field is written last.
2651          */
2652         uint8_t valid;
2653 } __attribute__((packed));
2654
2655 /* hwrm_ver_get */
2656 /*
2657  * Description: This function is called by a driver to determine the HWRM
2658  * interface version supported by the HWRM firmware, the version of HWRM
2659  * firmware implementation, the name of HWRM firmware, the versions of other
2660  * embedded firmwares, and the names of other embedded firmwares, etc. Any
2661  * interface or firmware version with major = 0, minor = 0, and update = 0 shall
2662  * be considered an invalid version.
2663  */
2664
2665 /* Input (24 bytes) */
2666 struct hwrm_ver_get_input {
2667         /*
2668          * This value indicates what type of request this is. The format for the
2669          * rest of the command is determined by this field.
2670          */
2671         uint16_t req_type;
2672
2673         /*
2674          * This value indicates the what completion ring the request will be
2675          * optionally completed on. If the value is -1, then no CR completion
2676          * will be generated. Any other value must be a valid CR ring_id value
2677          * for this function.
2678          */
2679         uint16_t cmpl_ring;
2680
2681         /* This value indicates the command sequence number. */
2682         uint16_t seq_id;
2683
2684         /*
2685          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
2686          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
2687          */
2688         uint16_t target_id;
2689
2690         /*
2691          * This is the host address where the response will be written when the
2692          * request is complete. This area must be 16B aligned and must be
2693          * cleared to zero before the request is made.
2694          */
2695         uint64_t resp_addr;
2696
2697         /*
2698          * This field represents the major version of HWRM interface
2699          * specification supported by the driver HWRM implementation. The
2700          * interface major version is intended to change only when non backward
2701          * compatible changes are made to the HWRM interface specification.
2702          */
2703         uint8_t hwrm_intf_maj;
2704
2705         /*
2706          * This field represents the minor version of HWRM interface
2707          * specification supported by the driver HWRM implementation. A change
2708          * in interface minor version is used to reflect significant backward
2709          * compatible modification to HWRM interface specification. This can be
2710          * due to addition or removal of functionality. HWRM interface
2711          * specifications with the same major version but different minor
2712          * versions are compatible.
2713          */
2714         uint8_t hwrm_intf_min;
2715
2716         /*
2717          * This field represents the update version of HWRM interface
2718          * specification supported by the driver HWRM implementation. The
2719          * interface update version is used to reflect minor changes or bug
2720          * fixes to a released HWRM interface specification.
2721          */
2722         uint8_t hwrm_intf_upd;
2723
2724         uint8_t unused_0[5];
2725 } __attribute__((packed));
2726
2727 /* Output (128 bytes) */
2728 struct hwrm_ver_get_output {
2729         /*
2730          * Pass/Fail or error type Note: receiver to verify the in parameters,
2731          * and fail the call with an error when appropriate
2732          */
2733         uint16_t error_code;
2734
2735         /* This field returns the type of original request. */
2736         uint16_t req_type;
2737
2738         /* This field provides original sequence number of the command. */
2739         uint16_t seq_id;
2740
2741         /*
2742          * This field is the length of the response in bytes. The last byte of
2743          * the response is a valid flag that will read as '1' when the command
2744          * has been completely written to memory.
2745          */
2746         uint16_t resp_len;
2747
2748         /*
2749          * This field represents the major version of HWRM interface
2750          * specification supported by the HWRM implementation. The interface
2751          * major version is intended to change only when non backward compatible
2752          * changes are made to the HWRM interface specification. A HWRM
2753          * implementation that is compliant with this specification shall
2754          * provide value of 1 in this field.
2755          */
2756         uint8_t hwrm_intf_maj;
2757
2758         /*
2759          * This field represents the minor version of HWRM interface
2760          * specification supported by the HWRM implementation. A change in
2761          * interface minor version is used to reflect significant backward
2762          * compatible modification to HWRM interface specification. This can be
2763          * due to addition or removal of functionality. HWRM interface
2764          * specifications with the same major version but different minor
2765          * versions are compatible. A HWRM implementation that is compliant with
2766          * this specification shall provide value of 0 in this field.
2767          */
2768         uint8_t hwrm_intf_min;
2769
2770         /*
2771          * This field represents the update version of HWRM interface
2772          * specification supported by the HWRM implementation. The interface
2773          * update version is used to reflect minor changes or bug fixes to a
2774          * released HWRM interface specification. A HWRM implementation that is
2775          * compliant with this specification shall provide value of 1 in this
2776          * field.
2777          */
2778         uint8_t hwrm_intf_upd;
2779
2780         uint8_t hwrm_intf_rsvd;
2781
2782         /*
2783          * This field represents the major version of HWRM firmware. A change in
2784          * firmware major version represents a major firmware release.
2785          */
2786         uint8_t hwrm_fw_maj;
2787
2788         /*
2789          * This field represents the minor version of HWRM firmware. A change in
2790          * firmware minor version represents significant firmware functionality
2791          * changes.
2792          */
2793         uint8_t hwrm_fw_min;
2794
2795         /*
2796          * This field represents the build version of HWRM firmware. A change in
2797          * firmware build version represents bug fixes to a released firmware.
2798          */
2799         uint8_t hwrm_fw_bld;
2800
2801         /*
2802          * This field is a reserved field. This field can be used to represent
2803          * firmware branches or customer specific releases tied to a specific
2804          * (major,minor,update) version of the HWRM firmware.
2805          */
2806         uint8_t hwrm_fw_rsvd;
2807
2808         /*
2809          * This field represents the major version of mgmt firmware. A change in
2810          * major version represents a major release.
2811          */
2812         uint8_t mgmt_fw_maj;
2813
2814         /*
2815          * This field represents the minor version of mgmt firmware. A change in
2816          * minor version represents significant functionality changes.
2817          */
2818         uint8_t mgmt_fw_min;
2819
2820         /*
2821          * This field represents the build version of mgmt firmware. A change in
2822          * update version represents bug fixes.
2823          */
2824         uint8_t mgmt_fw_bld;
2825
2826         /*
2827          * This field is a reserved field. This field can be used to represent
2828          * firmware branches or customer specific releases tied to a specific
2829          * (major,minor,update) version
2830          */
2831         uint8_t mgmt_fw_rsvd;
2832
2833         /*
2834          * This field represents the major version of network control firmware.
2835          * A change in major version represents a major release.
2836          */
2837         uint8_t netctrl_fw_maj;
2838
2839         /*
2840          * This field represents the minor version of network control firmware.
2841          * A change in minor version represents significant functionality
2842          * changes.
2843          */
2844         uint8_t netctrl_fw_min;
2845
2846         /*
2847          * This field represents the build version of network control firmware.
2848          * A change in update version represents bug fixes.
2849          */
2850         uint8_t netctrl_fw_bld;
2851
2852         /*
2853          * This field is a reserved field. This field can be used to represent
2854          * firmware branches or customer specific releases tied to a specific
2855          * (major,minor,update) version
2856          */
2857         uint8_t netctrl_fw_rsvd;
2858
2859         /*
2860          * This field is reserved for future use. The responder should set it to
2861          * 0. The requester should ignore this field.
2862          */
2863         uint32_t reserved1;
2864
2865         /*
2866          * This field represents the major version of RoCE firmware. A change in
2867          * major version represents a major release.
2868          */
2869         uint8_t roce_fw_maj;
2870
2871         /*
2872          * This field represents the minor version of RoCE firmware. A change in
2873          * minor version represents significant functionality changes.
2874          */
2875         uint8_t roce_fw_min;
2876
2877         /*
2878          * This field represents the build version of RoCE firmware. A change in
2879          * update version represents bug fixes.
2880          */
2881         uint8_t roce_fw_bld;
2882
2883         /*
2884          * This field is a reserved field. This field can be used to represent
2885          * firmware branches or customer specific releases tied to a specific
2886          * (major,minor,update) version
2887          */
2888         uint8_t roce_fw_rsvd;
2889
2890         /*
2891          * This field represents the name of HWRM FW (ASCII chars without NULL
2892          * at the end).
2893          */
2894         char hwrm_fw_name[16];
2895
2896         /*
2897          * This field represents the name of mgmt FW (ASCII chars without NULL
2898          * at the end).
2899          */
2900         char mgmt_fw_name[16];
2901
2902         /*
2903          * This field represents the name of network control firmware (ASCII
2904          * chars without NULL at the end).
2905          */
2906         char netctrl_fw_name[16];
2907
2908         /*
2909          * This field is reserved for future use. The responder should set it to
2910          * 0. The requester should ignore this field.
2911          */
2912         uint32_t reserved2[4];
2913
2914         /*
2915          * This field represents the name of RoCE FW (ASCII chars without NULL
2916          * at the end).
2917          */
2918         char roce_fw_name[16];
2919
2920         /* This field returns the chip number. */
2921         uint16_t chip_num;
2922
2923         /* This field returns the revision of chip. */
2924         uint8_t chip_rev;
2925
2926         /* This field returns the chip metal number. */
2927         uint8_t chip_metal;
2928
2929         /* This field returns the bond id of the chip. */
2930         uint8_t chip_bond_id;
2931
2932         /*
2933          * This value indicates the type of platform used for chip
2934          * implementation.
2935          */
2936         /* ASIC */
2937         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_ASIC \
2938                                                         (UINT32_C(0x0) << 0)
2939         /* FPGA platform of the chip. */
2940         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_FPGA \
2941                                                         (UINT32_C(0x1) << 0)
2942         /* Palladium platform of the chip. */
2943         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_PALLADIUM \
2944                                                         (UINT32_C(0x2) << 0)
2945         uint8_t chip_platform_type;
2946
2947         /*
2948          * This field returns the maximum value of request window that is
2949          * supported by the HWRM. The request window is mapped into device
2950          * address space using MMIO.
2951          */
2952         uint16_t max_req_win_len;
2953
2954         /*
2955          * This field returns the maximum value of response buffer in bytes. If
2956          * a request specifies the response buffer length that is greater than
2957          * this value, then the HWRM should fail it. The value of this field
2958          * shall be 4KB or more.
2959          */
2960         uint16_t max_resp_len;
2961
2962         /*
2963          * This field returns the default request timeout value in milliseconds.
2964          */
2965         uint16_t def_req_timeout;
2966
2967         uint8_t unused_0;
2968         uint8_t unused_1;
2969         uint8_t unused_2;
2970
2971         /*
2972          * This field is used in Output records to indicate that the output is
2973          * completely written to RAM. This field should be read as '1' to
2974          * indicate that the output has been completely written. When writing a
2975          * command completion or response to an internal processor, the order of
2976          * writes has to be such that this field is written last.
2977          */
2978         uint8_t valid;
2979 } __attribute__((packed));
2980
2981 /* hwrm_queue_qportcfg */
2982 /*
2983  * Description: This function is called by a driver to query queue configuration
2984  * of a port. # The HWRM shall at least advertise one queue with lossy service
2985  * profile. # The driver shall use this command to query queue ids before
2986  * configuring or using any queues. # If a service profile is not set for a
2987  * queue, then the driver shall not use that queue without configuring a service
2988  * profile for it. # If the driver is not allowed to configure service profiles,
2989  * then the driver shall only use queues for which service profiles are pre-
2990  * configured.
2991  */
2992
2993 /* Input (24 bytes) */
2994 struct hwrm_queue_qportcfg_input {
2995         /*
2996          * This value indicates what type of request this is. The format for the
2997          * rest of the command is determined by this field.
2998          */
2999         uint16_t req_type;
3000
3001         /*
3002          * This value indicates the what completion ring the request will be
3003          * optionally completed on. If the value is -1, then no CR completion
3004          * will be generated. Any other value must be a valid CR ring_id value
3005          * for this function.
3006          */
3007         uint16_t cmpl_ring;
3008
3009         /* This value indicates the command sequence number. */
3010         uint16_t seq_id;
3011
3012         /*
3013          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
3014          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
3015          */
3016         uint16_t target_id;
3017
3018         /*
3019          * This is the host address where the response will be written when the
3020          * request is complete. This area must be 16B aligned and must be
3021          * cleared to zero before the request is made.
3022          */
3023         uint64_t resp_addr;
3024
3025         /*
3026          * Enumeration denoting the RX, TX type of the resource. This
3027          * enumeration is used for resources that are similar for both TX and RX
3028          * paths of the chip.
3029          */
3030         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH \
3031                                                         UINT32_C(0x1)
3032                 /* tx path */
3033         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_TX \
3034                                                         (UINT32_C(0x0) << 0)
3035                 /* rx path */
3036         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX \
3037                                                         (UINT32_C(0x1) << 0)
3038         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_LAST \
3039                                         HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX
3040         uint32_t flags;
3041
3042         /*
3043          * Port ID of port for which the queue configuration is being queried.
3044          * This field is only required when sent by IPC.
3045          */
3046         uint16_t port_id;
3047
3048         uint16_t unused_0;
3049 } __attribute__((packed));
3050
3051 /* hwrm_stat_ctx_clr_stats */
3052 /* Description: This command clears statistics of a context. */
3053
3054 /* Input (24 bytes) */
3055 struct hwrm_stat_ctx_clr_stats_input {
3056         /*
3057          * This value indicates what type of request this is. The format for the
3058          * rest of the command is determined by this field.
3059          */
3060         uint16_t req_type;
3061
3062         /*
3063          * This value indicates the what completion ring the request will be
3064          * optionally completed on. If the value is -1, then no CR completion
3065          * will be generated. Any other value must be a valid CR ring_id value
3066          * for this function.
3067          */
3068         uint16_t cmpl_ring;
3069
3070         /* This value indicates the command sequence number. */
3071         uint16_t seq_id;
3072
3073         /*
3074          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
3075          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
3076          */
3077         uint16_t target_id;
3078
3079         /*
3080          * This is the host address where the response will be written when the
3081          * request is complete. This area must be 16B aligned and must be
3082          * cleared to zero before the request is made.
3083          */
3084         uint64_t resp_addr;
3085
3086         /* ID of the statistics context that is being queried. */
3087         uint32_t stat_ctx_id;
3088
3089         uint32_t unused_0;
3090 } __attribute__((packed));
3091
3092 /* Output (16 bytes) */
3093 struct hwrm_stat_ctx_clr_stats_output {
3094         /*
3095          * Pass/Fail or error type Note: receiver to verify the in parameters,
3096          * and fail the call with an error when appropriate
3097          */
3098         uint16_t error_code;
3099
3100         /* This field returns the type of original request. */
3101         uint16_t req_type;
3102
3103         /* This field provides original sequence number of the command. */
3104         uint16_t seq_id;
3105
3106         /*
3107          * This field is the length of the response in bytes. The last byte of
3108          * the response is a valid flag that will read as '1' when the command
3109          * has been completely written to memory.
3110          */
3111         uint16_t resp_len;
3112
3113         uint32_t unused_0;
3114         uint8_t unused_1;
3115         uint8_t unused_2;
3116         uint8_t unused_3;
3117
3118         /*
3119          * This field is used in Output records to indicate that the output is
3120          * completely written to RAM. This field should be read as '1' to
3121          * indicate that the output has been completely written. When writing a
3122          * command completion or response to an internal processor, the order of
3123          * writes has to be such that this field is written last.
3124          */
3125         uint8_t valid;
3126 } __attribute__((packed));
3127
3128 /* hwrm_vnic_alloc */
3129 /*
3130  * Description: This VNIC is a resource in the RX side of the chip that is used
3131  * to represent a virtual host "interface". # At the time of VNIC allocation or
3132  * configuration, the function can specify whether it wants the requested VNIC
3133  * to be the default VNIC for the function or not. # If a function requests
3134  * allocation of a VNIC for the first time and a VNIC is successfully allocated
3135  * by the HWRM, then the HWRM shall make the allocated VNIC as the default VNIC
3136  * for that function. # The default VNIC shall be used for the default action
3137  * for a partition or function. # For each VNIC allocated on a function, a
3138  * mapping on the RX side to map the allocated VNIC to source virtual interface
3139  * shall be performed by the HWRM. This should be hidden to the function driver
3140  * requesting the VNIC allocation. This enables broadcast/multicast replication
3141  * with source knockout. # If multicast replication with source knockout is
3142  * enabled, then the internal VNIC to SVIF mapping data structures shall be
3143  * programmed at the time of VNIC allocation.
3144  */
3145
3146 /* Input (24 bytes) */
3147 struct hwrm_vnic_alloc_input {
3148         /*
3149          * This value indicates what type of request this is. The format for the
3150          * rest of the command is determined by this field.
3151          */
3152         uint16_t req_type;
3153
3154         /*
3155          * This value indicates the what completion ring the request will be
3156          * optionally completed on. If the value is -1, then no CR completion
3157          * will be generated. Any other value must be a valid CR ring_id value
3158          * for this function.
3159          */
3160         uint16_t cmpl_ring;
3161
3162         /* This value indicates the command sequence number. */
3163         uint16_t seq_id;
3164
3165         /*
3166          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
3167          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
3168          */
3169         uint16_t target_id;
3170
3171         /*
3172          * This is the host address where the response will be written when the
3173          * request is complete. This area must be 16B aligned and must be
3174          * cleared to zero before the request is made.
3175          */
3176         uint64_t resp_addr;
3177
3178         /*
3179          * When this bit is '1', this VNIC is requested to be the default VNIC
3180          * for this function.
3181          */
3182         #define HWRM_VNIC_ALLOC_INPUT_FLAGS_DEFAULT                UINT32_C(0x1)
3183         uint32_t flags;
3184
3185         uint32_t unused_0;
3186 } __attribute__((packed));
3187
3188 /* Output (16 bytes) */
3189 struct hwrm_vnic_alloc_output {
3190         /*
3191          * Pass/Fail or error type Note: receiver to verify the in parameters,
3192          * and fail the call with an error when appropriate
3193          */
3194         uint16_t error_code;
3195
3196         /* This field returns the type of original request. */
3197         uint16_t req_type;
3198
3199         /* This field provides original sequence number of the command. */
3200         uint16_t seq_id;
3201
3202         /*
3203          * This field is the length of the response in bytes. The last byte of
3204          * the response is a valid flag that will read as '1' when the command
3205          * has been completely written to memory.
3206          */
3207         uint16_t resp_len;
3208
3209         /* Logical vnic ID */
3210         uint32_t vnic_id;
3211
3212         uint8_t unused_0;
3213         uint8_t unused_1;
3214         uint8_t unused_2;
3215
3216         /*
3217          * This field is used in Output records to indicate that the output is
3218          * completely written to RAM. This field should be read as '1' to
3219          * indicate that the output has been completely written. When writing a
3220          * command completion or response to an internal processor, the order of
3221          * writes has to be such that this field is written last.
3222          */
3223         uint8_t valid;
3224 } __attribute__((packed));
3225
3226 /* hwrm_vnic_cfg */
3227 /* Description: Configure the RX VNIC structure. */
3228
3229 /* Input (40 bytes) */
3230 struct hwrm_vnic_cfg_input {
3231         /*
3232          * This value indicates what type of request this is. The format for the
3233          * rest of the command is determined by this field.
3234          */
3235         uint16_t req_type;
3236
3237         /*
3238          * This value indicates the what completion ring the request will be
3239          * optionally completed on. If the value is -1, then no CR completion
3240          * will be generated. Any other value must be a valid CR ring_id value
3241          * for this function.
3242          */
3243         uint16_t cmpl_ring;
3244
3245         /* This value indicates the command sequence number. */
3246         uint16_t seq_id;
3247
3248         /*
3249          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
3250          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
3251          */
3252         uint16_t target_id;
3253
3254         /*
3255          * This is the host address where the response will be written when the
3256          * request is complete. This area must be 16B aligned and must be
3257          * cleared to zero before the request is made.
3258          */
3259         uint64_t resp_addr;
3260
3261         /*
3262          * When this bit is '1', the VNIC is requested to be the default VNIC
3263          * for the function.
3264          */
3265         #define HWRM_VNIC_CFG_INPUT_FLAGS_DEFAULT               UINT32_C(0x1)
3266         /*
3267          * When this bit is '1', the VNIC is being configured to strip VLAN in
3268          * the RX path. If set to '0', then VLAN stripping is disabled on this
3269          * VNIC.
3270          */
3271         #define HWRM_VNIC_CFG_INPUT_FLAGS_VLAN_STRIP_MODE       UINT32_C(0x2)
3272         /*
3273          * When this bit is '1', the VNIC is being configured to buffer receive
3274          * packets in the hardware until the host posts new receive buffers. If
3275          * set to '0', then bd_stall is being configured to be disabled on this
3276          * VNIC.
3277          */
3278         #define HWRM_VNIC_CFG_INPUT_FLAGS_BD_STALL_MODE         UINT32_C(0x4)
3279         /*
3280          * When this bit is '1', the VNIC is being configured to receive both
3281          * RoCE and non-RoCE traffic. If set to '0', then this VNIC is not
3282          * configured to be operating in dual VNIC mode.
3283          */
3284         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_DUAL_VNIC_MODE   UINT32_C(0x8)
3285         /*
3286          * When this flag is set to '1', the VNIC is requested to be configured
3287          * to receive only RoCE traffic. If this flag is set to '0', then this
3288          * flag shall be ignored by the HWRM. If roce_dual_vnic_mode flag is set
3289          * to '1', then the HWRM client shall not set this flag to '1'.
3290          */
3291         #define HWRM_VNIC_CFG_INPUT_FLAGS_ROCE_ONLY_VNIC_MODE   UINT32_C(0x10)
3292         uint32_t flags;
3293
3294         /* This bit must be '1' for the dflt_ring_grp field to be configured. */
3295         #define HWRM_VNIC_CFG_INPUT_ENABLES_DFLT_RING_GRP       UINT32_C(0x1)
3296         /* This bit must be '1' for the rss_rule field to be configured. */
3297         #define HWRM_VNIC_CFG_INPUT_ENABLES_RSS_RULE            UINT32_C(0x2)
3298         /* This bit must be '1' for the cos_rule field to be configured. */
3299         #define HWRM_VNIC_CFG_INPUT_ENABLES_COS_RULE            UINT32_C(0x4)
3300         /* This bit must be '1' for the lb_rule field to be configured. */
3301         #define HWRM_VNIC_CFG_INPUT_ENABLES_LB_RULE             UINT32_C(0x8)
3302         /* This bit must be '1' for the mru field to be configured. */
3303         #define HWRM_VNIC_CFG_INPUT_ENABLES_MRU                 UINT32_C(0x10)
3304         uint32_t enables;
3305
3306         /* Logical vnic ID */
3307         uint16_t vnic_id;
3308
3309         /*
3310          * Default Completion ring for the VNIC. This ring will be chosen if
3311          * packet does not match any RSS rules and if there is no COS rule.
3312          */
3313         uint16_t dflt_ring_grp;
3314
3315         /*
3316          * RSS ID for RSS rule/table structure. 0xFF... (All Fs) if there is no
3317          * RSS rule.
3318          */
3319         uint16_t rss_rule;
3320
3321         /*
3322          * RSS ID for COS rule/table structure. 0xFF... (All Fs) if there is no
3323          * COS rule.
3324          */
3325         uint16_t cos_rule;
3326
3327         /*
3328          * RSS ID for load balancing rule/table structure. 0xFF... (All Fs) if
3329          * there is no LB rule.
3330          */
3331         uint16_t lb_rule;
3332
3333         /*
3334          * The maximum receive unit of the vnic. Each vnic is associated with a
3335          * function. The vnic mru value overwrites the mru setting of the
3336          * associated function. The HWRM shall make sure that vnic mru does not
3337          * exceed the mru of the port the function is associated with.
3338          */
3339         uint16_t mru;
3340
3341         uint32_t unused_0;
3342 } __attribute__((packed));
3343
3344 /* Output (16 bytes) */
3345 struct hwrm_vnic_cfg_output {
3346         /*
3347          * Pass/Fail or error type Note: receiver to verify the in parameters,
3348          * and fail the call with an error when appropriate
3349          */
3350         uint16_t error_code;
3351
3352         /* This field returns the type of original request. */
3353         uint16_t req_type;
3354
3355         /* This field provides original sequence number of the command. */
3356         uint16_t seq_id;
3357
3358         /*
3359          * This field is the length of the response in bytes. The last byte of
3360          * the response is a valid flag that will read as '1' when the command
3361          * has been completely written to memory.
3362          */
3363         uint16_t resp_len;
3364
3365         uint32_t unused_0;
3366         uint8_t unused_1;
3367         uint8_t unused_2;
3368         uint8_t unused_3;
3369
3370         /*
3371          * This field is used in Output records to indicate that the output is
3372          * completely written to RAM. This field should be read as '1' to
3373          * indicate that the output has been completely written. When writing a
3374          * command completion or response to an internal processor, the order of
3375          * writes has to be such that this field is written last.
3376          */
3377         uint8_t valid;
3378 } __attribute__((packed));
3379
3380 /* hwrm_vnic_free */
3381 /*
3382  * Description: Free a VNIC resource. Idle any resources associated with the
3383  * VNIC as well as the VNIC. Reset and release all resources associated with the
3384  * VNIC.
3385  */
3386
3387 /* Input (24 bytes) */
3388 struct hwrm_vnic_free_input {
3389         /*
3390          * This value indicates what type of request this is. The format for the
3391          * rest of the command is determined by this field.
3392          */
3393         uint16_t req_type;
3394
3395         /*
3396          * This value indicates the what completion ring the request will be
3397          * optionally completed on. If the value is -1, then no CR completion
3398          * will be generated. Any other value must be a valid CR ring_id value
3399          * for this function.
3400          */
3401         uint16_t cmpl_ring;
3402
3403         /* This value indicates the command sequence number. */
3404         uint16_t seq_id;
3405
3406         /*
3407          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
3408          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
3409          */
3410         uint16_t target_id;
3411
3412         /*
3413          * This is the host address where the response will be written when the
3414          * request is complete. This area must be 16B aligned and must be
3415          * cleared to zero before the request is made.
3416          */
3417         uint64_t resp_addr;
3418
3419         /* Logical vnic ID */
3420         uint32_t vnic_id;
3421
3422         uint32_t unused_0;
3423 } __attribute__((packed));
3424
3425 /* Output (16 bytes) */
3426 struct hwrm_vnic_free_output {
3427         /*
3428          * Pass/Fail or error type Note: receiver to verify the in parameters,
3429          * and fail the call with an error when appropriate
3430          */
3431         uint16_t error_code;
3432
3433         /* This field returns the type of original request. */
3434         uint16_t req_type;
3435
3436         /* This field provides original sequence number of the command. */
3437         uint16_t seq_id;
3438
3439         /*
3440          * This field is the length of the response in bytes. The last byte of
3441          * the response is a valid flag that will read as '1' when the command
3442          * has been completely written to memory.
3443          */
3444         uint16_t resp_len;
3445
3446         uint32_t unused_0;
3447         uint8_t unused_1;
3448         uint8_t unused_2;
3449         uint8_t unused_3;
3450
3451         /*
3452          * This field is used in Output records to indicate that the output is
3453          * completely written to RAM. This field should be read as '1' to
3454          * indicate that the output has been completely written. When writing a
3455          * command completion or response to an internal processor, the order of
3456          * writes has to be such that this field is written last.
3457          */
3458         uint8_t valid;
3459 } __attribute__((packed));
3460
3461 /* hwrm_vnic_rss_cfg */
3462 /* Description: This function is used to enable RSS configuration. */
3463
3464 /* Input (48 bytes) */
3465 struct hwrm_vnic_rss_cfg_input {
3466         /*
3467          * This value indicates what type of request this is. The format for the
3468          * rest of the command is determined by this field.
3469          */
3470         uint16_t req_type;
3471
3472         /*
3473          * This value indicates the what completion ring the request will be
3474          * optionally completed on. If the value is -1, then no CR completion
3475          * will be generated. Any other value must be a valid CR ring_id value
3476          * for this function.
3477          */
3478         uint16_t cmpl_ring;
3479
3480         /* This value indicates the command sequence number. */
3481         uint16_t seq_id;
3482
3483         /*
3484          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
3485          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
3486          */
3487         uint16_t target_id;
3488
3489         /*
3490          * This is the host address where the response will be written when the
3491          * request is complete. This area must be 16B aligned and must be
3492          * cleared to zero before the request is made.
3493          */
3494         uint64_t resp_addr;
3495
3496         /*
3497          * When this bit is '1', the RSS hash shall be computed over source and
3498          * destination IPv4 addresses of IPv4 packets.
3499          */
3500         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4          UINT32_C(0x1)
3501         /*
3502          * When this bit is '1', the RSS hash shall be computed over
3503          * source/destination IPv4 addresses and source/destination ports of
3504          * TCP/IPv4 packets.
3505          */
3506         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV4      UINT32_C(0x2)
3507         /*
3508          * When this bit is '1', the RSS hash shall be computed over
3509          * source/destination IPv4 addresses and source/destination ports of
3510          * UDP/IPv4 packets.
3511          */
3512         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV4      UINT32_C(0x4)
3513         /*
3514          * When this bit is '1', the RSS hash shall be computed over source and
3515          * destination IPv4 addresses of IPv6 packets.
3516          */
3517         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV6          UINT32_C(0x8)
3518         /*
3519          * When this bit is '1', the RSS hash shall be computed over
3520          * source/destination IPv6 addresses and source/destination ports of
3521          * TCP/IPv6 packets.
3522          */
3523         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV6      UINT32_C(0x10)
3524         /*
3525          * When this bit is '1', the RSS hash shall be computed over
3526          * source/destination IPv6 addresses and source/destination ports of
3527          * UDP/IPv6 packets.
3528          */
3529         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV6      UINT32_C(0x20)
3530         uint32_t hash_type;
3531
3532         uint32_t unused_0;
3533
3534         /* This is the address for rss ring group table */
3535         uint64_t ring_grp_tbl_addr;
3536
3537         /* This is the address for rss hash key table */
3538         uint64_t hash_key_tbl_addr;
3539
3540         /* Index to the rss indirection table. */
3541         uint16_t rss_ctx_idx;
3542
3543         uint16_t unused_1[3];
3544 } __attribute__((packed));
3545
3546 /* Output (16 bytes) */
3547 struct hwrm_vnic_rss_cfg_output {
3548         /*
3549          * Pass/Fail or error type Note: receiver to verify the in parameters,
3550          * and fail the call with an error when appropriate
3551          */
3552         uint16_t error_code;
3553
3554         /* This field returns the type of original request. */
3555         uint16_t req_type;
3556
3557         /* This field provides original sequence number of the command. */
3558         uint16_t seq_id;
3559
3560         /*
3561          * This field is the length of the response in bytes. The last byte of
3562          * the response is a valid flag that will read as '1' when the command
3563          * has been completely written to memory.
3564          */
3565         uint16_t resp_len;
3566
3567         uint32_t unused_0;
3568         uint8_t unused_1;
3569         uint8_t unused_2;
3570         uint8_t unused_3;
3571
3572         /*
3573          * This field is used in Output records to indicate that the output is
3574          * completely written to RAM. This field should be read as '1' to
3575          * indicate that the output has been completely written. When writing a
3576          * command completion or response to an internal processor, the order of
3577          * writes has to be such that this field is written last.
3578          */
3579         uint8_t valid;
3580 } __attribute__((packed));
3581
3582 /* Input (16 bytes) */
3583 struct hwrm_vnic_rss_cos_lb_ctx_alloc_input {
3584         /*
3585          * This value indicates what type of request this is. The format for the
3586          * rest of the command is determined by this field.
3587          */
3588         uint16_t req_type;
3589
3590         /*
3591          * This value indicates the what completion ring the request will be
3592          * optionally completed on. If the value is -1, then no CR completion
3593          * will be generated. Any other value must be a valid CR ring_id value
3594          * for this function.
3595          */
3596         uint16_t cmpl_ring;
3597
3598         /* This value indicates the command sequence number. */
3599         uint16_t seq_id;
3600
3601         /*
3602          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
3603          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
3604          */
3605         uint16_t target_id;
3606
3607         /*
3608          * This is the host address where the response will be written when the
3609          * request is complete. This area must be 16B aligned and must be
3610          * cleared to zero before the request is made.
3611          */
3612         uint64_t resp_addr;
3613 } __attribute__((packed));
3614
3615 /* Output (16 bytes) */
3616
3617 struct hwrm_vnic_rss_cos_lb_ctx_alloc_output {
3618         /*
3619          * Pass/Fail or error type Note: receiver to verify the in parameters,
3620          * and fail the call with an error when appropriate
3621          */
3622         uint16_t error_code;
3623
3624         /* This field returns the type of original request. */
3625         uint16_t req_type;
3626
3627         /* This field provides original sequence number of the command. */
3628         uint16_t seq_id;
3629
3630         /*
3631          * This field is the length of the response in bytes. The last byte of
3632          * the response is a valid flag that will read as '1' when the command
3633          * has been completely written to memory.
3634          */
3635         uint16_t resp_len;
3636
3637         /* rss_cos_lb_ctx_id is 16 b */
3638         uint16_t rss_cos_lb_ctx_id;
3639
3640         uint8_t unused_0;
3641         uint8_t unused_1;
3642         uint8_t unused_2;
3643         uint8_t unused_3;
3644         uint8_t unused_4;
3645
3646         /*
3647          * This field is used in Output records to indicate that the output is
3648          * completely written to RAM. This field should be read as '1' to
3649          * indicate that the output has been completely written. When writing a
3650          * command completion or response to an internal processor, the order of
3651          * writes has to be such that this field is written last.
3652          */
3653         uint8_t valid;
3654 } __attribute__((packed));
3655
3656 /* hwrm_vnic_rss_cos_lb_ctx_free */
3657 /* Description: This function can be used to free COS/Load Balance context. */
3658 /* Input (24 bytes) */
3659
3660 struct hwrm_vnic_rss_cos_lb_ctx_free_input {
3661         /*
3662          * This value indicates what type of request this is. The format for the
3663          * rest of the command is determined by this field.
3664          */
3665         uint16_t req_type;
3666
3667         /*
3668          * This value indicates the what completion ring the request will be
3669          * optionally completed on. If the value is -1, then no CR completion
3670          * will be generated. Any other value must be a valid CR ring_id value
3671          * for this function.
3672          */
3673         uint16_t cmpl_ring;
3674
3675         /* This value indicates the command sequence number. */
3676         uint16_t seq_id;
3677
3678         /*
3679          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
3680          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
3681          */
3682         uint16_t target_id;
3683
3684         /*
3685          * This is the host address where the response will be written when the
3686          * request is complete. This area must be 16B aligned and must be
3687          * cleared to zero before the request is made.
3688          */
3689         uint64_t resp_addr;
3690
3691         /* rss_cos_lb_ctx_id is 16 b */
3692         uint16_t rss_cos_lb_ctx_id;
3693
3694         uint16_t unused_0[3];
3695 } __attribute__((packed));
3696
3697 /* Output (16 bytes) */
3698 struct hwrm_vnic_rss_cos_lb_ctx_free_output {
3699         /*
3700          * Pass/Fail or error type Note: receiver to verify the in parameters,
3701          * and fail the call with an error when appropriate
3702          */
3703         uint16_t error_code;
3704
3705         /* This field returns the type of original request. */
3706         uint16_t req_type;
3707
3708         /* This field provides original sequence number of the command. */
3709         uint16_t seq_id;
3710
3711         /*
3712          * This field is the length of the response in bytes. The last byte of
3713          * the response is a valid flag that will read as '1' when the command
3714          * has been completely written to memory.
3715          */
3716         uint16_t resp_len;
3717
3718         uint32_t unused_0;
3719         uint8_t unused_1;
3720         uint8_t unused_2;
3721         uint8_t unused_3;
3722
3723         /*
3724          * This field is used in Output records to indicate that the output is
3725          * completely written to RAM. This field should be read as '1' to
3726          * indicate that the output has been completely written. When writing a
3727          * command completion or response to an internal processor, the order of
3728          * writes has to be such that this field is written last.
3729          */
3730         uint8_t valid;
3731 } __attribute__((packed));
3732
3733 /* Output (32 bytes) */
3734 struct hwrm_queue_qportcfg_output {
3735         /*
3736          * Pass/Fail or error type Note: receiver to verify the in parameters,
3737          * and fail the call with an error when appropriate
3738          */
3739         uint16_t error_code;
3740
3741         /* This field returns the type of original request. */
3742         uint16_t req_type;
3743
3744         /* This field provides original sequence number of the command. */
3745         uint16_t seq_id;
3746
3747         /*
3748          * This field is the length of the response in bytes. The last byte of
3749          * the response is a valid flag that will read as '1' when the command
3750          * has been completely written to memory.
3751          */
3752         uint16_t resp_len;
3753
3754         /* The maximum number of queues that can be configured. */
3755         uint8_t max_configurable_queues;
3756
3757         /* The maximum number of lossless queues that can be configured. */
3758         uint8_t max_configurable_lossless_queues;
3759
3760         /*
3761          * 0 - Not allowed. Non-zero - Allowed. If this value is non-zero, then
3762          * the HWRM shall allow the host SW driver to configure queues using
3763          * hwrm_queue_cfg.
3764          */
3765         uint8_t queue_cfg_allowed;
3766
3767         /*
3768          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
3769          * the HWRM shall allow the host SW driver to configure queue buffers
3770          * using hwrm_queue_buffers_cfg.
3771          */
3772         uint8_t queue_buffers_cfg_allowed;
3773
3774         /*
3775          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
3776          * the HWRM shall allow the host SW driver to configure PFC using
3777          * hwrm_queue_pfcenable_cfg.
3778          */
3779         uint8_t queue_pfcenable_cfg_allowed;
3780
3781         /*
3782          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
3783          * the HWRM shall allow the host SW driver to configure Priority to CoS
3784          * mapping using hwrm_queue_pri2cos_cfg.
3785          */
3786         uint8_t queue_pri2cos_cfg_allowed;
3787
3788         /*
3789          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
3790          * the HWRM shall allow the host SW driver to configure CoS Bandwidth
3791          * configuration using hwrm_queue_cos2bw_cfg.
3792          */
3793         uint8_t queue_cos2bw_cfg_allowed;
3794
3795         /* ID of CoS Queue 0. FF - Invalid id */
3796         uint8_t queue_id0;
3797
3798         /* This value is applicable to CoS queues only. */
3799                 /* Lossy (best-effort) */
3800         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY \
3801                                                         (UINT32_C(0x0) << 0)
3802                 /* Lossless */
3803         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS \
3804                                                         (UINT32_C(0x1) << 0)
3805                 /*
3806                  * Set to 0xFF... (All Fs) if there is no service profile
3807                  * specified
3808                  */
3809         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_UNKNOWN \
3810                                                         (UINT32_C(0xff) << 0)
3811         uint8_t queue_id0_service_profile;
3812
3813         /* ID of CoS Queue 1. FF - Invalid id */
3814         uint8_t queue_id1;
3815         /* This value is applicable to CoS queues only. */
3816                 /* Lossy (best-effort) */
3817         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSY \
3818                                                         (UINT32_C(0x0) << 0)
3819                 /* Lossless */
3820         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSLESS \
3821                                                         (UINT32_C(0x1) << 0)
3822                 /*
3823                  * Set to 0xFF... (All Fs) if there is no service profile
3824                  * specified
3825                  */
3826         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_UNKNOWN \
3827                                                         (UINT32_C(0xff) << 0)
3828         uint8_t queue_id1_service_profile;
3829
3830         /* ID of CoS Queue 2. FF - Invalid id */
3831         uint8_t queue_id2;
3832         /* This value is applicable to CoS queues only. */
3833                 /* Lossy (best-effort) */
3834         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSY \
3835                                                         (UINT32_C(0x0) << 0)
3836                 /* Lossless */
3837         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSLESS \
3838                                                         (UINT32_C(0x1) << 0)
3839                 /*
3840                  * Set to 0xFF... (All Fs) if there is no service profile
3841                  * specified
3842                  */
3843         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_UNKNOWN \
3844                                                         (UINT32_C(0xff) << 0)
3845         uint8_t queue_id2_service_profile;
3846
3847         /* ID of CoS Queue 3. FF - Invalid id */
3848         uint8_t queue_id3;
3849
3850         /* This value is applicable to CoS queues only. */
3851                 /* Lossy (best-effort) */
3852         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSY \
3853                                                         (UINT32_C(0x0) << 0)
3854                 /* Lossless */
3855         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSLESS \
3856                                                         (UINT32_C(0x1) << 0)
3857                 /*
3858                  * Set to 0xFF... (All Fs) if there is no service profile
3859                  * specified
3860                  */
3861         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_UNKNOWN \
3862                                                         (UINT32_C(0xff) << 0)
3863         uint8_t queue_id3_service_profile;
3864
3865         /* ID of CoS Queue 4. FF - Invalid id */
3866         uint8_t queue_id4;
3867         /* This value is applicable to CoS queues only. */
3868                 /* Lossy (best-effort) */
3869         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSY \
3870                                                         (UINT32_C(0x0) << 0)
3871                 /* Lossless */
3872         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSLESS \
3873                                                         (UINT32_C(0x1) << 0)
3874                 /*
3875                  * Set to 0xFF... (All Fs) if there is no service profile
3876                  * specified
3877                  */
3878         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_UNKNOWN \
3879                                                         (UINT32_C(0xff) << 0)
3880         uint8_t queue_id4_service_profile;
3881
3882         /* ID of CoS Queue 5. FF - Invalid id */
3883         uint8_t queue_id5;
3884
3885         /* This value is applicable to CoS queues only. */
3886                 /* Lossy (best-effort) */
3887         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSY \
3888                                                         (UINT32_C(0x0) << 0)
3889                 /* Lossless */
3890         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSLESS \
3891                                                         (UINT32_C(0x1) << 0)
3892                 /*
3893                  * Set to 0xFF... (All Fs) if there is no service profile
3894                  * specified
3895                  */
3896         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_UNKNOWN \
3897                                                         (UINT32_C(0xff) << 0)
3898         uint8_t queue_id5_service_profile;
3899
3900         /* ID of CoS Queue 6. FF - Invalid id */
3901         uint8_t queue_id6_service_profile;
3902         /* This value is applicable to CoS queues only. */
3903                 /* Lossy (best-effort) */
3904         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSY \
3905                                                         (UINT32_C(0x0) << 0)
3906                 /* Lossless */
3907         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSLESS \
3908                                                         (UINT32_C(0x1) << 0)
3909                 /*
3910                  * Set to 0xFF... (All Fs) if there is no service profile
3911                  * specified
3912                  */
3913         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_UNKNOWN \
3914                                                         (UINT32_C(0xff) << 0)
3915         uint8_t queue_id6;
3916
3917         /* ID of CoS Queue 7. FF - Invalid id */
3918         uint8_t queue_id7;
3919
3920         /* This value is applicable to CoS queues only. */
3921                 /* Lossy (best-effort) */
3922         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSY \
3923                                                         (UINT32_C(0x0) << 0)
3924                 /* Lossless */
3925         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSLESS \
3926                                                         (UINT32_C(0x1) << 0)
3927                 /*
3928                  * Set to 0xFF... (All Fs) if there is no service profile
3929                  * specified
3930                  */
3931         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_UNKNOWN \
3932                                                         (UINT32_C(0xff) << 0)
3933         uint8_t queue_id7_service_profile;
3934
3935         /*
3936          * This field is used in Output records to indicate that the output is
3937          * completely written to RAM. This field should be read as '1' to
3938          * indicate that the output has been completely written. When writing a
3939          * command completion or response to an internal processor, the order of
3940          * writes has to be such that this field is written last.
3941          */
3942         uint8_t valid;
3943 } __attribute__((packed));
3944
3945 /* hwrm_func_drv_rgtr */
3946 /*
3947  * Description: This command is used by the function driver to register its
3948  * information with the HWRM. A function driver shall implement this command. A
3949  * function driver shall use this command during the driver initialization right
3950  * after the HWRM version discovery and default ring resources allocation.
3951  */
3952
3953 /* Input (80 bytes) */
3954 struct hwrm_func_drv_rgtr_input {
3955         /*
3956          * This value indicates what type of request this is. The format for the
3957          * rest of the command is determined by this field.
3958          */
3959         uint16_t req_type;
3960
3961         /*
3962          * This value indicates the what completion ring the request will be
3963          * optionally completed on. If the value is -1, then no CR completion
3964          * will be generated. Any other value must be a valid CR ring_id value
3965          * for this function.
3966          */
3967         uint16_t cmpl_ring;
3968
3969         /* This value indicates the command sequence number. */
3970         uint16_t seq_id;
3971
3972         /*
3973          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
3974          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
3975          */
3976         uint16_t target_id;
3977
3978         /*
3979          * This is the host address where the response will be written when the
3980          * request is complete. This area must be 16B aligned and must be
3981          * cleared to zero before the request is made.
3982          */
3983         uint64_t resp_addr;
3984
3985         /*
3986          * When this bit is '1', the function driver is requesting all requests
3987          * from its children VF drivers to be forwarded to itself. This flag can
3988          * only be set by the PF driver. If a VF driver sets this flag, it
3989          * should be ignored by the HWRM.
3990          */
3991         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_ALL_MODE        UINT32_C(0x1)
3992         /*
3993          * When this bit is '1', the function is requesting none of the requests
3994          * from its children VF drivers to be forwarded to itself. This flag can
3995          * only be set by the PF driver. If a VF driver sets this flag, it
3996          * should be ignored by the HWRM.
3997          */
3998         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE       UINT32_C(0x2)
3999         uint32_t flags;
4000
4001         /* This bit must be '1' for the os_type field to be configured. */
4002         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_OS_TYPE           UINT32_C(0x1)
4003         /* This bit must be '1' for the ver field to be configured. */
4004         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VER               UINT32_C(0x2)
4005         /* This bit must be '1' for the timestamp field to be configured. */
4006         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_TIMESTAMP         UINT32_C(0x4)
4007         /* This bit must be '1' for the vf_req_fwd field to be configured. */
4008         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VF_REQ_FWD        UINT32_C(0x8)
4009         /*
4010          * This bit must be '1' for the async_event_fwd field to be configured.
4011          */
4012         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_ASYNC_EVENT_FWD \
4013                                                                 UINT32_C(0x10)
4014         uint32_t enables;
4015
4016         /* This value indicates the type of OS. */
4017                 /* Unknown */
4018         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_UNKNOWN \
4019                                                         (UINT32_C(0x0) << 0)
4020                 /* Other OS not listed below. */
4021         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_OTHER \
4022                                                         (UINT32_C(0x1) << 0)
4023                 /* MSDOS OS. */
4024         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_MSDOS \
4025                                                         (UINT32_C(0xe) << 0)
4026                 /* Windows OS. */
4027         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WINDOWS \
4028                                                         (UINT32_C(0x12) << 0)
4029                 /* Solaris OS. */
4030         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_SOLARIS \
4031                                                         (UINT32_C(0x1d) << 0)
4032                 /* Linux OS. */
4033         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_LINUX \
4034                                                         (UINT32_C(0x24) << 0)
4035                 /* FreeBSD OS. */
4036         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_FREEBSD \
4037                                                         (UINT32_C(0x2a) << 0)
4038                 /* VMware ESXi OS. */
4039         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_ESXI \
4040                                                         (UINT32_C(0x68) << 0)
4041                 /* Microsoft Windows 8 64-bit OS. */
4042         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN864 \
4043                                                         (UINT32_C(0x73) << 0)
4044                 /* Microsoft Windows Server 2012 R2 OS. */
4045         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN2012R2 \
4046                                                         (UINT32_C(0x74) << 0)
4047         uint16_t os_type;
4048
4049         /* This is the major version of the driver. */
4050         uint8_t ver_maj;
4051
4052         /* This is the minor version of the driver. */
4053         uint8_t ver_min;
4054
4055         /* This is the update version of the driver. */
4056         uint8_t ver_upd;
4057
4058         uint8_t unused_0;
4059         uint16_t unused_1;
4060
4061         /*
4062          * This is a 32-bit timestamp provided by the driver for keep alive. The
4063          * timestamp is in multiples of 1ms.
4064          */
4065         uint32_t timestamp;
4066
4067         uint32_t unused_2;
4068
4069         /*
4070          * This is a 256-bit bit mask provided by the PF driver for letting the
4071          * HWRM know what commands issued by the VF driver to the HWRM should be
4072          * forwarded to the PF driver. Nth bit refers to the Nth req_type.
4073          * Setting Nth bit to 1 indicates that requests from the VF driver with
4074          * req_type equal to N shall be forwarded to the parent PF driver. This
4075          * field is not valid for the VF driver.
4076          */
4077         uint32_t vf_req_fwd[8];
4078
4079         /*
4080          * This is a 256-bit bit mask provided by the function driver (PF or VF
4081          * driver) to indicate the list of asynchronous event completions to be
4082          * forwarded. Nth bit refers to the Nth event_id. Setting Nth bit to 1
4083          * by the function driver shall result in the HWRM forwarding
4084          * asynchronous event completion with event_id equal to N. If all bits
4085          * are set to 0 (value of 0), then the HWRM shall not forward any
4086          * asynchronous event completion to this function driver.
4087          */
4088         uint32_t async_event_fwd[8];
4089 } __attribute__((packed));
4090
4091 /* Output (16 bytes) */
4092
4093 struct hwrm_func_drv_rgtr_output {
4094         /*
4095          * Pass/Fail or error type Note: receiver to verify the in parameters,
4096          * and fail the call with an error when appropriate
4097          */
4098         uint16_t error_code;
4099
4100         /* This field returns the type of original request. */
4101         uint16_t req_type;
4102
4103         /* This field provides original sequence number of the command. */
4104         uint16_t seq_id;
4105
4106         /*
4107          * This field is the length of the response in bytes. The last byte of
4108          * the response is a valid flag that will read as '1' when the command
4109          * has been completely written to memory.
4110          */
4111         uint16_t resp_len;
4112
4113         uint32_t unused_0;
4114         uint8_t unused_1;
4115         uint8_t unused_2;
4116         uint8_t unused_3;
4117
4118         /*
4119          * This field is used in Output records to indicate that the output is
4120          * completely written to RAM. This field should be read as '1' to
4121          * indicate that the output has been completely written. When writing a
4122          * command completion or response to an internal processor, the order of
4123          * writes has to be such that this field is written last.
4124          */
4125         uint8_t valid;
4126 } __attribute__((packed));
4127
4128 /* hwrm_func_drv_unrgtr */
4129 /*
4130  * Description: This command is used by the function driver to un register with
4131  * the HWRM. A function driver shall implement this command. A function driver
4132  * shall use this command during the driver unloading.
4133  */
4134 /* Input (24 bytes) */
4135
4136 struct hwrm_func_drv_unrgtr_input {
4137         /*
4138          * This value indicates what type of request this is. The format for the
4139          * rest of the command is determined by this field.
4140          */
4141         uint16_t req_type;
4142
4143         /*
4144          * This value indicates the what completion ring the request will be
4145          * optionally completed on. If the value is -1, then no CR completion
4146          * will be generated. Any other value must be a valid CR ring_id value
4147          * for this function.
4148          */
4149         uint16_t cmpl_ring;
4150
4151         /* This value indicates the command sequence number. */
4152         uint16_t seq_id;
4153
4154         /*
4155          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
4156          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
4157          */
4158         uint16_t target_id;
4159
4160         /*
4161          * This is the host address where the response will be written when the
4162          * request is complete. This area must be 16B aligned and must be
4163          * cleared to zero before the request is made.
4164          */
4165         uint64_t resp_addr;
4166
4167         /*
4168          * When this bit is '1', the function driver is notifying the HWRM to
4169          * prepare for the shutdown.
4170          */
4171         #define HWRM_FUNC_DRV_UNRGTR_INPUT_FLAGS_PREPARE_FOR_SHUTDOWN \
4172                                                         UINT32_C(0x1)
4173         uint32_t flags;
4174
4175         uint32_t unused_0;
4176 } __attribute__((packed));
4177
4178 /* Output (16 bytes) */
4179 struct hwrm_func_drv_unrgtr_output {
4180         /*
4181          * Pass/Fail or error type Note: receiver to verify the in parameters,
4182          * and fail the call with an error when appropriate
4183          */
4184         uint16_t error_code;
4185
4186         /* This field returns the type of original request. */
4187         uint16_t req_type;
4188
4189         /* This field provides original sequence number of the command. */
4190         uint16_t seq_id;
4191
4192         /*
4193          * This field is the length of the response in bytes. The last byte of
4194          * the response is a valid flag that will read as '1' when the command
4195          * has been completely written to memory.
4196          */
4197         uint16_t resp_len;
4198
4199         uint32_t unused_0;
4200         uint8_t unused_1;
4201         uint8_t unused_2;
4202         uint8_t unused_3;
4203
4204         /*
4205          * This field is used in Output records to indicate that the output is
4206          * completely written to RAM. This field should be read as '1' to
4207          * indicate that the output has been completely written. When writing a
4208          * command completion or response to an internal processor, the order of
4209          * writes has to be such that this field is written last.
4210          */
4211         uint8_t valid;
4212 } __attribute__((packed));
4213
4214 #endif