net/bnxt: add initial Rx code
[dpdk.git] / drivers / net / bnxt / hsi_struct_def_dpdk.h
index bbec5bb..8b30787 100644 (file)
 #ifndef _HSI_STRUCT_DEF_EXTERNAL_H_
 #define _HSI_STRUCT_DEF_EXTERNAL_H_
 
+/*
+ * per-context HW statistics -- chip view
+ */
+
+struct ctx_hw_stats64 {
+       uint64_t rx_ucast_pkts;
+       uint64_t rx_mcast_pkts;
+       uint64_t rx_bcast_pkts;
+       uint64_t rx_drop_pkts;
+       uint64_t rx_err_pkts;
+       uint64_t rx_ucast_bytes;
+       uint64_t rx_mcast_bytes;
+       uint64_t rx_bcast_bytes;
+
+       uint64_t tx_ucast_pkts;
+       uint64_t tx_mcast_pkts;
+       uint64_t tx_bcast_pkts;
+       uint64_t tx_drop_pkts;
+       uint64_t tx_err_pkts;
+       uint64_t tx_ucast_bytes;
+       uint64_t tx_mcast_bytes;
+       uint64_t tx_bcast_bytes;
+
+       uint64_t tpa_pkts;
+       uint64_t tpa_bytes;
+       uint64_t tpa_events;
+       uint64_t tpa_aborts;
+} ctx_hw_stats64_t;
+
 /* HW Resource Manager Specification 1.2.0 */
 #define HWRM_VERSION_MAJOR     1
 #define HWRM_VERSION_MINOR     2
 #define HWRM_CFA_L2_FILTER_FREE                (UINT32_C(0x91))
 #define HWRM_CFA_L2_FILTER_CFG         (UINT32_C(0x92))
 #define HWRM_CFA_L2_SET_RX_MASK                (UINT32_C(0x93))
+#define HWRM_STAT_CTX_CLR_STATS                (UINT32_C(0xb3))
 #define HWRM_EXEC_FWD_RESP             (UINT32_C(0xd0))
 
 /* Return Codes */
 #define HWRM_ERR_CODE_INVALID_PARAMS                      (UINT32_C(0x2))
 #define HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED              (UINT32_C(0x3))
 
+/* Short TX BD (16 bytes) */
+struct tx_bd_short {
+       /*
+        * All bits in this field must be valid on the first BD of a packet.
+        * Only the packet_end bit must be valid for the remaining BDs of a
+        * packet.
+        */
+       /* This value identifies the type of buffer descriptor. */
+       #define TX_BD_SHORT_TYPE_MASK                   UINT32_C(0x3f)
+       #define TX_BD_SHORT_TYPE_SFT                    0
+               /*
+                * Indicates that this BD is 16B long and is used for normal L2
+                * packet transmission.
+                */
+       #define TX_BD_SHORT_TYPE_TX_BD_SHORT            (UINT32_C(0x0) << 0)
+       /*
+        * If set to 1, the packet ends with the data in the buffer pointed to
+        * by this descriptor. This flag must be valid on every BD.
+        */
+       #define TX_BD_SHORT_FLAGS_PACKET_END            UINT32_C(0x40)
+       /*
+        * If set to 1, the device will not generate a completion for this
+        * transmit packet unless there is an error in it's processing. If this
+        * bit is set to 0, then the packet will be completed normally. This bit
+        * must be valid only on the first BD of a packet.
+        */
+       #define TX_BD_SHORT_FLAGS_NO_CMPL               UINT32_C(0x80)
+       /*
+        * This value indicates how many 16B BD locations are consumed in the
+        * ring by this packet. A value of 1 indicates that this BD is the only
+        * BD (and that the it is a short BD). A value of 3 indicates either 3
+        * short BDs or 1 long BD and one short BD in the packet. A value of 0
+        * indicates that there are 32 BD locations in the packet (the maximum).
+        * This field is valid only on the first BD of a packet.
+        */
+       #define TX_BD_SHORT_FLAGS_BD_CNT_MASK           UINT32_C(0x1f00)
+       #define TX_BD_SHORT_FLAGS_BD_CNT_SFT            8
+       /*
+        * This value is a hint for the length of the entire packet. It is used
+        * by the chip to optimize internal processing. The packet will be
+        * dropped if the hint is too short. This field is valid only on the
+        * first BD of a packet.
+        */
+       #define TX_BD_SHORT_FLAGS_LHINT_MASK            UINT32_C(0x6000)
+       #define TX_BD_SHORT_FLAGS_LHINT_SFT             13
+               /* indicates packet length < 512B */
+       #define TX_BD_SHORT_FLAGS_LHINT_LT512           (UINT32_C(0x0) << 13)
+               /* indicates 512 <= packet length < 1KB */
+       #define TX_BD_SHORT_FLAGS_LHINT_LT1K            (UINT32_C(0x1) << 13)
+               /* indicates 1KB <= packet length < 2KB */
+       #define TX_BD_SHORT_FLAGS_LHINT_LT2K            (UINT32_C(0x2) << 13)
+               /* indicates packet length >= 2KB */
+       #define TX_BD_SHORT_FLAGS_LHINT_GTE2K           (UINT32_C(0x3) << 13)
+       #define TX_BD_SHORT_FLAGS_LHINT_LAST    TX_BD_SHORT_FLAGS_LHINT_GTE2K
+       /*
+        * If set to 1, the device immediately updates the Send Consumer Index
+        * after the buffer associated with this descriptor has been transferred
+        * via DMA to NIC memory from host memory. An interrupt may or may not
+        * be generated according to the state of the interrupt avoidance
+        * mechanisms. If this bit is set to 0, then the Consumer Index is only
+        * updated as soon as one of the host interrupt coalescing conditions
+        * has been met. This bit must be valid on the first BD of a packet.
+        */
+       #define TX_BD_SHORT_FLAGS_COAL_NOW              UINT32_C(0x8000)
+       /*
+        * All bits in this field must be valid on the first BD of a packet.
+        * Only the packet_end bit must be valid for the remaining BDs of a
+        * packet.
+        */
+       #define TX_BD_SHORT_FLAGS_MASK                  UINT32_C(0xffc0)
+       #define TX_BD_SHORT_FLAGS_SFT                   6
+       uint16_t flags_type;
+
+       /*
+        * This is the length of the host physical buffer this BD describes in
+        * bytes. This field must be valid on all BDs of a packet.
+        */
+       uint16_t len;
+       /*
+        * The opaque data field is pass through to the completion and can be
+        * used for any data that the driver wants to associate with the
+        * transmit BD. This field must be valid on the first BD of a packet.
+        */
+       uint32_t opaque;
+
+       /*
+        * This is the host physical address for the portion of the packet
+        * described by this TX BD. This value must be valid on all BDs of a
+        * packet.
+        */
+       uint64_t addr;
+} __attribute__((packed));
+
+/* Long TX BD (32 bytes split to 2 16-byte struct) */
+struct tx_bd_long {
+       /*
+        * All bits in this field must be valid on the first BD of a packet.
+        * Only the packet_end bit must be valid for the remaining BDs of a
+        * packet.
+        */
+       /* This value identifies the type of buffer descriptor. */
+       #define TX_BD_LONG_TYPE_MASK                    UINT32_C(0x3f)
+       #define TX_BD_LONG_TYPE_SFT                     0
+               /*
+                * Indicates that this BD is 32B long and is used for normal L2
+                * packet transmission.
+                */
+       #define TX_BD_LONG_TYPE_TX_BD_LONG              (UINT32_C(0x10) << 0)
+       /*
+        * If set to 1, the packet ends with the data in the buffer pointed to
+        * by this descriptor. This flag must be valid on every BD.
+        */
+       #define TX_BD_LONG_FLAGS_PACKET_END             UINT32_C(0x40)
+       /*
+        * If set to 1, the device will not generate a completion for this
+        * transmit packet unless there is an error in it's processing. If this
+        * bit is set to 0, then the packet will be completed normally. This bit
+        * must be valid only on the first BD of a packet.
+        */
+       #define TX_BD_LONG_FLAGS_NO_CMPL                UINT32_C(0x80)
+       /*
+        * This value indicates how many 16B BD locations are consumed in the
+        * ring by this packet. A value of 1 indicates that this BD is the only
+        * BD (and that the it is a short BD). A value of 3 indicates either 3
+        * short BDs or 1 long BD and one short BD in the packet. A value of 0
+        * indicates that there are 32 BD locations in the packet (the maximum).
+        * This field is valid only on the first BD of a packet.
+        */
+       #define TX_BD_LONG_FLAGS_BD_CNT_MASK            UINT32_C(0x1f00)
+       #define TX_BD_LONG_FLAGS_BD_CNT_SFT             8
+       /*
+        * This value is a hint for the length of the entire packet. It is used
+        * by the chip to optimize internal processing. The packet will be
+        * dropped if the hint is too short. This field is valid only on the
+        * first BD of a packet.
+        */
+       #define TX_BD_LONG_FLAGS_LHINT_MASK             UINT32_C(0x6000)
+       #define TX_BD_LONG_FLAGS_LHINT_SFT              13
+               /* indicates packet length < 512B */
+       #define TX_BD_LONG_FLAGS_LHINT_LT512            (UINT32_C(0x0) << 13)
+               /* indicates 512 <= packet length < 1KB */
+       #define TX_BD_LONG_FLAGS_LHINT_LT1K             (UINT32_C(0x1) << 13)
+               /* indicates 1KB <= packet length < 2KB */
+       #define TX_BD_LONG_FLAGS_LHINT_LT2K             (UINT32_C(0x2) << 13)
+               /* indicates packet length >= 2KB */
+       #define TX_BD_LONG_FLAGS_LHINT_GTE2K            (UINT32_C(0x3) << 13)
+       #define TX_BD_LONG_FLAGS_LHINT_LAST     TX_BD_LONG_FLAGS_LHINT_GTE2K
+       /*
+        * If set to 1, the device immediately updates the Send Consumer Index
+        * after the buffer associated with this descriptor has been transferred
+        * via DMA to NIC memory from host memory. An interrupt may or may not
+        * be generated according to the state of the interrupt avoidance
+        * mechanisms. If this bit is set to 0, then the Consumer Index is only
+        * updated as soon as one of the host interrupt coalescing conditions
+        * has been met. This bit must be valid on the first BD of a packet.
+        */
+       #define TX_BD_LONG_FLAGS_COAL_NOW               UINT32_C(0x8000)
+       /*
+        * All bits in this field must be valid on the first BD of a packet.
+        * Only the packet_end bit must be valid for the remaining BDs of a
+        * packet.
+        */
+       #define TX_BD_LONG_FLAGS_MASK                   UINT32_C(0xffc0)
+       #define TX_BD_LONG_FLAGS_SFT                    6
+       uint16_t flags_type;
+
+       /*
+        * This is the length of the host physical buffer this BD describes in
+        * bytes. This field must be valid on all BDs of a packet.
+        */
+       uint16_t len;
+
+       /*
+        * The opaque data field is pass through to the completion and can be
+        * used for any data that the driver wants to associate with the
+        * transmit BD. This field must be valid on the first BD of a packet.
+        */
+       uint32_t opaque;
+
+       /*
+        * This is the host physical address for the portion of the packet
+        * described by this TX BD. This value must be valid on all BDs of a
+        * packet.
+        */
+       uint64_t addr;
+} __attribute__((packed));
+
+/* last 16 bytes of Long TX BD */
+
+struct tx_bd_long_hi {
+       /*
+        * All bits in this field must be valid on the first BD of a packet.
+        * Their value on other BDs of the packet will be ignored.
+        */
+       /*
+        * If set to 1, the controller replaces the TCP/UPD checksum fields of
+        * normal TCP/UPD checksum, or the inner TCP/UDP checksum field of the
+        * encapsulated TCP/UDP packets with the hardware calculated TCP/UDP
+        * checksum for the packet associated with this descriptor. This bit
+        * must be valid on the first BD of a packet.
+        */
+       #define TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM        UINT32_C(0x1)
+       /*
+        * If set to 1, the controller replaces the IP checksum of the normal
+        * packets, or the inner IP checksum of the encapsulated packets with
+        * the hardware calculated IP checksum for the packet associated with
+        * this descriptor. This bit must be valid on the first BD of a packet.
+        */
+       #define TX_BD_LONG_LFLAGS_IP_CHKSUM             UINT32_C(0x2)
+       /*
+        * If set to 1, the controller will not append an Ethernet CRC to the
+        * end of the frame. This bit must be valid on the first BD of a packet.
+        * Packet must be 64B or longer when this flag is set. It is not useful
+        * to use this bit with any form of TX offload such as CSO or LSO. The
+        * intent is that the packet from the host already has a valid Ethernet
+        * CRC on the packet.
+        */
+       #define TX_BD_LONG_LFLAGS_NOCRC                 UINT32_C(0x4)
+       /*
+        * If set to 1, the device will record the time at which the packet was
+        * actually transmitted at the TX MAC. This bit must be valid on the
+        * first BD of a packet.
+        */
+       #define TX_BD_LONG_LFLAGS_STAMP                 UINT32_C(0x8)
+       /*
+        * If set to 1, The controller replaces the tunnel IP checksum field
+        * with hardware calculated IP checksum for the IP header of the packet
+        * associated with this descriptor. In case of VXLAN, the controller
+        * also replaces the outer header UDP checksum with hardware calculated
+        * UDP checksum for the packet associated with this descriptor.
+        */
+       #define TX_BD_LONG_LFLAGS_T_IP_CHKSUM           UINT32_C(0x10)
+       /*
+        * If set to 1, the device will treat this packet with LSO(Large Send
+        * Offload) processing for both normal or encapsulated packets, which is
+        * a form of TCP segmentation. When this bit is 1, the hdr_size and mss
+        * fields must be valid. The driver doesn't need to set t_ip_chksum,
+        * ip_chksum, and tcp_udp_chksum flags since the controller will replace
+        * the appropriate checksum fields for segmented packets. When this bit
+        * is 1, the hdr_size and mss fields must be valid.
+        */
+       #define TX_BD_LONG_LFLAGS_LSO                   UINT32_C(0x20)
+       /*
+        * If set to zero when LSO is '1', then the IPID will be treated as a
+        * 16b number and will be wrapped if it exceeds a value of 0xffff. If
+        * set to one when LSO is '1', then the IPID will be treated as a 15b
+        * number and will be wrapped if it exceeds a value 0f 0x7fff.
+        */
+       #define TX_BD_LONG_LFLAGS_IPID_FMT              UINT32_C(0x40)
+       /*
+        * If set to zero when LSO is '1', then the IPID of the tunnel IP header
+        * will not be modified during LSO operations. If set to one when LSO is
+        * '1', then the IPID of the tunnel IP header will be incremented for
+        * each subsequent segment of an LSO operation.
+        */
+       #define TX_BD_LONG_LFLAGS_T_IPID                UINT32_C(0x80)
+       /*
+        * If set to '1', then the RoCE ICRC will be appended to the packet.
+        * Packet must be a valid RoCE format packet.
+        */
+       #define TX_BD_LONG_LFLAGS_ROCE_CRC              UINT32_C(0x100)
+       /*
+        * If set to '1', then the FCoE CRC will be appended to the packet.
+        * Packet must be a valid FCoE format packet.
+        */
+       #define TX_BD_LONG_LFLAGS_FCOE_CRC              UINT32_C(0x200)
+       uint16_t lflags;
+
+       /*
+        * When LSO is '1', this field must contain the offset of the TCP
+        * payload from the beginning of the packet in as 16b words. In case of
+        * encapsulated/tunneling packet, this field contains the offset of the
+        * inner TCP payload from beginning of the packet as 16-bit words. This
+        * value must be valid on the first BD of a packet.
+        */
+       #define TX_BD_LONG_HDR_SIZE_MASK                UINT32_C(0x1ff)
+       #define TX_BD_LONG_HDR_SIZE_SFT                 0
+       uint16_t hdr_size;
+
+       /*
+        * This is the MSS value that will be used to do the LSO processing. The
+        * value is the length in bytes of the TCP payload for each segment
+        * generated by the LSO operation. This value must be valid on the first
+        * BD of a packet.
+        */
+       #define TX_BD_LONG_MSS_MASK                     UINT32_C(0x7fff)
+       #define TX_BD_LONG_MSS_SFT                      0
+       uint32_t mss;
+
+       uint16_t unused_2;
+
+       /*
+        * This value selects a CFA action to perform on the packet. Set this
+        * value to zero if no CFA action is desired. This value must be valid
+        * on the first BD of a packet.
+        */
+       uint16_t cfa_action;
+
+       /*
+        * This value is action meta-data that defines CFA edit operations that
+        * are done in addition to any action editing.
+        */
+       /* When key=1, This is the VLAN tag VID value. */
+       #define TX_BD_LONG_CFA_META_VLAN_VID_MASK       UINT32_C(0xfff)
+       #define TX_BD_LONG_CFA_META_VLAN_VID_SFT        0
+       /* When key=1, This is the VLAN tag DE value. */
+       #define TX_BD_LONG_CFA_META_VLAN_DE             UINT32_C(0x1000)
+       /* When key=1, This is the VLAN tag PRI value. */
+       #define TX_BD_LONG_CFA_META_VLAN_PRI_MASK       UINT32_C(0xe000)
+       #define TX_BD_LONG_CFA_META_VLAN_PRI_SFT        13
+       /* When key=1, This is the VLAN tag TPID select value. */
+       #define TX_BD_LONG_CFA_META_VLAN_TPID_MASK      UINT32_C(0x70000)
+       #define TX_BD_LONG_CFA_META_VLAN_TPID_SFT       16
+               /* 0x88a8 */
+       #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID88A8  (UINT32_C(0x0) << 16)
+               /* 0x8100 */
+       #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100  (UINT32_C(0x1) << 16)
+               /* 0x9100 */
+       #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9100  (UINT32_C(0x2) << 16)
+               /* 0x9200 */
+       #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9200  (UINT32_C(0x3) << 16)
+               /* 0x9300 */
+       #define TX_BD_LONG_CFA_META_VLAN_TPID_TPID9300  (UINT32_C(0x4) << 16)
+               /* Value programmed in CFA VLANTPID register. */
+       #define TX_BD_LONG_CFA_META_VLAN_TPID_TPIDCFG   (UINT32_C(0x5) << 16)
+       #define TX_BD_LONG_CFA_META_VLAN_TPID_LAST \
+                                       TX_BD_LONG_CFA_META_VLAN_TPID_TPIDCFG
+       /* When key=1, This is the VLAN tag TPID select value. */
+       #define TX_BD_LONG_CFA_META_VLAN_RESERVED_MASK  UINT32_C(0xff80000)
+       #define TX_BD_LONG_CFA_META_VLAN_RESERVED_SFT   19
+       /*
+        * This field identifies the type of edit to be performed on the packet.
+        * This value must be valid on the first BD of a packet.
+        */
+       #define TX_BD_LONG_CFA_META_KEY_MASK            UINT32_C(0xf0000000)
+       #define TX_BD_LONG_CFA_META_KEY_SFT             28
+               /* No editing */
+       #define TX_BD_LONG_CFA_META_KEY_NONE            (UINT32_C(0x0) << 28)
+               /*
+                * - meta[17:16] - TPID select value (0 = 0x8100). - meta[15:12]
+                * - PRI/DE value. - meta[11:0] - VID value.
+                */
+       #define TX_BD_LONG_CFA_META_KEY_VLAN_TAG        (UINT32_C(0x1) << 28)
+       #define TX_BD_LONG_CFA_META_KEY_LAST    TX_BD_LONG_CFA_META_KEY_VLAN_TAG
+       uint32_t cfa_meta;
+} __attribute__((packed));
+
+/* RX Producer Packet BD (16 bytes) */
+struct rx_prod_pkt_bd {
+       /* This value identifies the type of buffer descriptor. */
+       #define RX_PROD_PKT_BD_TYPE_MASK                UINT32_C(0x3f)
+       #define RX_PROD_PKT_BD_TYPE_SFT                 0
+               /*
+                * Indicates that this BD is 16B long and is an RX Producer (ie.
+                * empty) buffer descriptor.
+                */
+       #define RX_PROD_PKT_BD_TYPE_RX_PROD_PKT         (UINT32_C(0x4) << 0)
+       /*
+        * If set to 1, the packet will be placed at the address plus 2B. The 2
+        * Bytes of padding will be written as zero.
+        */
+       /*
+        * This is intended to be used when the host buffer is cache-line
+        * aligned to produce packets that are easy to parse in host memory
+        * while still allowing writes to be cache line aligned.
+        */
+       #define RX_PROD_PKT_BD_FLAGS_SOP_PAD            UINT32_C(0x40)
+       /*
+        * If set to 1, the packet write will be padded out to the nearest
+        * cache-line with zero value padding.
+        */
+       /*
+        * If receive buffers start/end on cache-line boundaries, this feature
+        * will ensure that all data writes on the PCI bus start/end on cache
+        * line boundaries.
+        */
+       #define RX_PROD_PKT_BD_FLAGS_EOP_PAD            UINT32_C(0x80)
+       /*
+        * This value is the number of additional buffers in the ring that
+        * describe the buffer space to be consumed for the this packet. If the
+        * value is zero, then the packet must fit within the space described by
+        * this BD. If this value is 1 or more, it indicates how many additional
+        * "buffer" BDs are in the ring immediately following this BD to be used
+        * for the same network packet. Even if the packet to be placed does not
+        * need all the additional buffers, they will be consumed anyway.
+        */
+       #define RX_PROD_PKT_BD_FLAGS_BUFFERS_MASK       UINT32_C(0x300)
+       #define RX_PROD_PKT_BD_FLAGS_BUFFERS_SFT        8
+       #define RX_PROD_PKT_BD_FLAGS_MASK               UINT32_C(0xffc0)
+       #define RX_PROD_PKT_BD_FLAGS_SFT                6
+       uint16_t flags_type;
+
+       /*
+        * This is the length in Bytes of the host physical buffer where data
+        * for the packet may be placed in host memory.
+        */
+       /*
+        * While this is a Byte resolution value, it is often advantageous to
+        * ensure that the buffers provided end on a host cache line.
+        */
+       uint16_t len;
+
+       /*
+        * The opaque data field is pass through to the completion and can be
+        * used for any data that the driver wants to associate with this
+        * receive buffer set.
+        */
+       uint32_t opaque;
+
+       /*
+        * This is the host physical address where data for the packet may by
+        * placed in host memory.
+        */
+       /*
+        * While this is a Byte resolution value, it is often advantageous to
+        * ensure that the buffers provide start on a host cache line.
+        */
+       uint64_t addr;
+} __attribute__((packed));
+
+/* Completion Ring Structures */
+/* Note: This structure is used by the HWRM to communicate HWRM Error. */
+/* Base Completion Record (16 bytes) */
+struct cmpl_base {
+       /* unused is 10 b */
+       /*
+        * This field indicates the exact type of the completion. By convention,
+        * the LSB identifies the length of the record in 16B units. Even values
+        * indicate 16B records. Odd values indicate 32B records.
+        */
+       #define CMPL_BASE_TYPE_MASK                     UINT32_C(0x3f)
+       #define CMPL_BASE_TYPE_SFT                      0
+               /* TX L2 completion: Completion of TX packet. Length = 16B */
+       #define CMPL_BASE_TYPE_TX_L2                    (UINT32_C(0x0) << 0)
+               /*
+                * RX L2 completion: Completion of and L2 RX packet.
+                * Length = 32B
+               */
+       #define CMPL_BASE_TYPE_RX_L2                    (UINT32_C(0x11) << 0)
+               /*
+                * RX Aggregation Buffer completion : Completion of an L2
+                * aggregation buffer in support of TPA, HDS, or Jumbo packet
+                * completion. Length = 16B
+                */
+       #define CMPL_BASE_TYPE_RX_AGG                   (UINT32_C(0x12) << 0)
+               /*
+                * RX L2 TPA Start Completion: Completion at the beginning of a
+                * TPA operation. Length = 32B
+                */
+       #define CMPL_BASE_TYPE_RX_TPA_START             (UINT32_C(0x13) << 0)
+               /*
+                * RX L2 TPA End Completion: Completion at the end of a TPA
+                * operation. Length = 32B
+                */
+       #define CMPL_BASE_TYPE_RX_TPA_END               (UINT32_C(0x15) << 0)
+               /*
+                * Statistics Ejection Completion: Completion of statistics data
+                * ejection buffer. Length = 16B
+                */
+       #define CMPL_BASE_TYPE_STAT_EJECT               (UINT32_C(0x1a) << 0)
+               /* HWRM Command Completion: Completion of an HWRM command. */
+       #define CMPL_BASE_TYPE_HWRM_DONE                (UINT32_C(0x20) << 0)
+               /* Forwarded HWRM Request */
+       #define CMPL_BASE_TYPE_HWRM_FWD_REQ             (UINT32_C(0x22) << 0)
+               /* Forwarded HWRM Response */
+       #define CMPL_BASE_TYPE_HWRM_FWD_RESP            (UINT32_C(0x24) << 0)
+               /* HWRM Asynchronous Event Information */
+       #define CMPL_BASE_TYPE_HWRM_ASYNC_EVENT         (UINT32_C(0x2e) << 0)
+               /* CQ Notification */
+       #define CMPL_BASE_TYPE_CQ_NOTIFICATION          (UINT32_C(0x30) << 0)
+               /* SRQ Threshold Event */
+       #define CMPL_BASE_TYPE_SRQ_EVENT                (UINT32_C(0x32) << 0)
+               /* DBQ Threshold Event */
+       #define CMPL_BASE_TYPE_DBQ_EVENT                (UINT32_C(0x34) << 0)
+               /* QP Async Notification */
+       #define CMPL_BASE_TYPE_QP_EVENT                 (UINT32_C(0x38) << 0)
+               /* Function Async Notification */
+       #define CMPL_BASE_TYPE_FUNC_EVENT               (UINT32_C(0x3a) << 0)
+       uint16_t type;
+
+       uint16_t info1;
+       uint32_t info2;
+
+       /*
+        * This value is written by the NIC such that it will be different for
+        * each pass through the completion queue. The even passes will write 1.
+        * The odd passes will write 0.
+        */
+       #define CMPL_BASE_V                             UINT32_C(0x1)
+       /* info3 is 31 b */
+       #define CMPL_BASE_INFO3_MASK                    UINT32_C(0xfffffffe)
+       #define CMPL_BASE_INFO3_SFT                     1
+       uint32_t info3_v;
+
+       uint32_t info4;
+} __attribute__((packed));
+
+/* TX Completion Record (16 bytes) */
+struct tx_cmpl {
+       /*
+        * This field indicates the exact type of the completion. By convention,
+        * the LSB identifies the length of the record in 16B units. Even values
+        * indicate 16B records. Odd values indicate 32B records.
+        */
+       #define TX_CMPL_TYPE_MASK                       UINT32_C(0x3f)
+       #define TX_CMPL_TYPE_SFT                        0
+               /* TX L2 completion: Completion of TX packet. Length = 16B */
+       #define TX_CMPL_TYPE_TX_L2                      (UINT32_C(0x0) << 0)
+       /*
+        * When this bit is '1', it indicates a packet that has an error of some
+        * type. Type of error is indicated in error_flags.
+        */
+       #define TX_CMPL_FLAGS_ERROR                     UINT32_C(0x40)
+       /*
+        * When this bit is '1', it indicates that the packet completed was
+        * transmitted using the push acceleration data provided by the driver.
+        * When this bit is '0', it indicates that the packet had not push
+        * acceleration data written or was executed as a normal packet even
+        * though push data was provided.
+        */
+       #define TX_CMPL_FLAGS_PUSH                      UINT32_C(0x80)
+       #define TX_CMPL_FLAGS_MASK                      UINT32_C(0xffc0)
+       #define TX_CMPL_FLAGS_SFT                       6
+       uint16_t flags_type;
+
+       uint16_t unused_0;
+
+       /*
+        * This is a copy of the opaque field from the first TX BD of this
+        * transmitted packet.
+        */
+       uint32_t opaque;
+
+       /*
+        * This value is written by the NIC such that it will be different for
+        * each pass through the completion queue. The even passes will write 1.
+        * The odd passes will write 0.
+        */
+       #define TX_CMPL_V                               UINT32_C(0x1)
+       /*
+        * This error indicates that there was some sort of problem with the BDs
+        * for the packet.
+        */
+       #define TX_CMPL_ERRORS_BUFFER_ERROR_MASK        UINT32_C(0xe)
+       #define TX_CMPL_ERRORS_BUFFER_ERROR_SFT         1
+               /* No error */
+       #define TX_CMPL_ERRORS_BUFFER_ERROR_NO_ERROR    (UINT32_C(0x0) << 1)
+               /* Bad Format: BDs were not formatted correctly. */
+       #define TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT     (UINT32_C(0x2) << 1)
+       #define TX_CMPL_ERRORS_BUFFER_ERROR_LAST \
+                                       TX_CMPL_ERRORS_BUFFER_ERROR_BAD_FMT
+       /*
+        * When this bit is '1', it indicates that the length of the packet was
+        * zero. No packet was transmitted.
+        */
+       #define TX_CMPL_ERRORS_ZERO_LENGTH_PKT          UINT32_C(0x10)
+       /*
+        * When this bit is '1', it indicates that the packet was longer than
+        * the programmed limit in TDI. No packet was transmitted.
+        */
+       #define TX_CMPL_ERRORS_EXCESSIVE_BD_LENGTH      UINT32_C(0x20)
+       /*
+        * When this bit is '1', it indicates that one or more of the BDs
+        * associated with this packet generated a PCI error. This probably
+        * means the address was not valid.
+        */
+       #define TX_CMPL_ERRORS_DMA_ERROR                UINT32_C(0x40)
+       /*
+        * When this bit is '1', it indicates that the packet was longer than
+        * indicated by the hint. No packet was transmitted.
+        */
+       #define TX_CMPL_ERRORS_HINT_TOO_SHORT           UINT32_C(0x80)
+       /*
+        * When this bit is '1', it indicates that the packet was dropped due to
+        * Poison TLP error on one or more of the TLPs in the PXP completion.
+        */
+       #define TX_CMPL_ERRORS_POISON_TLP_ERROR         UINT32_C(0x100)
+       #define TX_CMPL_ERRORS_MASK                     UINT32_C(0xfffe)
+       #define TX_CMPL_ERRORS_SFT                      1
+       uint16_t errors_v;
+
+       uint16_t unused_1;
+       uint32_t unused_2;
+} __attribute__((packed)) tx_cmpl_t, *ptx_cmpl_t;
+
+/* RX Packet Completion Record (32 bytes split to 2 16-byte struct) */
+struct rx_pkt_cmpl {
+       /*
+        * This field indicates the exact type of the completion. By convention,
+        * the LSB identifies the length of the record in 16B units. Even values
+        * indicate 16B records. Odd values indicate 32B records.
+        */
+       #define RX_PKT_CMPL_TYPE_MASK                   UINT32_C(0x3f)
+       #define RX_PKT_CMPL_TYPE_SFT                    0
+               /*
+                * RX L2 completion: Completion of and L2 RX packet.
+                * Length = 32B
+                */
+       #define RX_PKT_CMPL_TYPE_RX_L2                  (UINT32_C(0x11) << 0)
+       /*
+        * When this bit is '1', it indicates a packet that has an error of some
+        * type. Type of error is indicated in error_flags.
+        */
+       #define RX_PKT_CMPL_FLAGS_ERROR                 UINT32_C(0x40)
+       /* This field indicates how the packet was placed in the buffer. */
+       #define RX_PKT_CMPL_FLAGS_PLACEMENT_MASK        UINT32_C(0x380)
+       #define RX_PKT_CMPL_FLAGS_PLACEMENT_SFT         7
+               /* Normal: Packet was placed using normal algorithm. */
+       #define RX_PKT_CMPL_FLAGS_PLACEMENT_NORMAL      (UINT32_C(0x0) << 7)
+               /* Jumbo: Packet was placed using jumbo algorithm. */
+       #define RX_PKT_CMPL_FLAGS_PLACEMENT_JUMBO       (UINT32_C(0x1) << 7)
+               /*
+                * Header/Data Separation: Packet was placed using Header/Data
+                * separation algorithm. The separation location is indicated by
+                * the itype field.
+                */
+       #define RX_PKT_CMPL_FLAGS_PLACEMENT_HDS         (UINT32_C(0x2) << 7)
+       #define RX_PKT_CMPL_FLAGS_PLACEMENT_LAST \
+                                               RX_PKT_CMPL_FLAGS_PLACEMENT_HDS
+       /* This bit is '1' if the RSS field in this completion is valid. */
+       #define RX_PKT_CMPL_FLAGS_RSS_VALID             UINT32_C(0x400)
+       /*
+        * This value indicates what the inner packet determined for the packet
+        * was.
+        */
+       #define RX_PKT_CMPL_FLAGS_ITYPE_MASK            UINT32_C(0xf000)
+       #define RX_PKT_CMPL_FLAGS_ITYPE_SFT             12
+               /* Not Known: Indicates that the packet type was not known. */
+       #define RX_PKT_CMPL_FLAGS_ITYPE_NOT_KNOWN       (UINT32_C(0x0) << 12)
+               /*
+                * IP Packet: Indicates that the packet was an IP packet, but
+                * further classification was not possible.
+                */
+       #define RX_PKT_CMPL_FLAGS_ITYPE_IP              (UINT32_C(0x1) << 12)
+               /*
+                * TCP Packet: Indicates that the packet was IP and TCP. This
+                * indicates that the payload_offset field is valid.
+                */
+       #define RX_PKT_CMPL_FLAGS_ITYPE_TCP             (UINT32_C(0x2) << 12)
+               /*
+                * UDP Packet: Indicates that the packet was IP and UDP. This
+                * indicates that the payload_offset field is valid.
+                */
+       #define RX_PKT_CMPL_FLAGS_ITYPE_UDP             (UINT32_C(0x3) << 12)
+               /*
+                * FCoE Packet: Indicates that the packet was recognized as a
+                * FCoE. This also indicates that the payload_offset field is
+                * valid.
+                */
+       #define RX_PKT_CMPL_FLAGS_ITYPE_FCOE            (UINT32_C(0x4) << 12)
+               /*
+                * RoCE Packet: Indicates that the packet was recognized as a
+                * RoCE. This also indicates that the payload_offset field is
+                * valid.
+                */
+       #define RX_PKT_CMPL_FLAGS_ITYPE_ROCE            (UINT32_C(0x5) << 12)
+               /*
+                * ICMP Packet: Indicates that the packet was recognized as
+                * ICMP. This indicates that the payload_offset field is valid.
+                */
+       #define RX_PKT_CMPL_FLAGS_ITYPE_ICMP            (UINT32_C(0x7) << 12)
+               /*
+                * PtP packet wo/timestamp: Indicates that the packet was
+                * recognized as a PtP packet.
+                */
+       #define RX_PKT_CMPL_FLAGS_ITYPE_PTP_WO_TIMESTAMP \
+                                                       (UINT32_C(0x8) << 12)
+               /*
+                * PtP packet w/timestamp: Indicates that the packet was
+                * recognized as a PtP packet and that a timestamp was taken for
+                * the packet.
+                */
+       #define RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP (UINT32_C(0x9) << 12)
+       #define RX_PKT_CMPL_FLAGS_ITYPE_LAST \
+                                       RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP
+       #define RX_PKT_CMPL_FLAGS_MASK                  UINT32_C(0xffc0)
+       #define RX_PKT_CMPL_FLAGS_SFT                   6
+       uint16_t flags_type;
+
+       /*
+        * This is the length of the data for the packet stored in the buffer(s)
+        * identified by the opaque value. This includes the packet BD and any
+        * associated buffer BDs. This does not include the the length of any
+        * data places in aggregation BDs.
+        */
+       uint16_t len;
+
+       /*
+        * This is a copy of the opaque field from the RX BD this completion
+        * corresponds to.
+        */
+       uint32_t opaque;
+
+       /*
+        * This value is written by the NIC such that it will be different for
+        * each pass through the completion queue. The even passes will write 1.
+        * The odd passes will write 0.
+        */
+       #define RX_PKT_CMPL_V1                          UINT32_C(0x1)
+       /*
+        * This value is the number of aggregation buffers that follow this
+        * entry in the completion ring that are a part of this packet. If the
+        * value is zero, then the packet is completely contained in the buffer
+        * space provided for the packet in the RX ring.
+        */
+       #define RX_PKT_CMPL_AGG_BUFS_MASK               UINT32_C(0x3e)
+       #define RX_PKT_CMPL_AGG_BUFS_SFT                1
+       uint8_t agg_bufs_v1;
+
+       /*
+        * This is the RSS hash type for the packet. The value is packed
+        * {tuple_extrac_op[1:0],rss_profile_id[4:0],tuple_extrac_op[2]}.
+        */
+       uint8_t rss_hash_type;
+
+       /*
+        * This value indicates the offset from the beginning of the packet
+        * where the inner payload starts. This value is valid for TCP, UDP,
+        * FCoE, and RoCE packets.
+        */
+       uint8_t payload_offset;
+
+       uint8_t unused_1;
+
+       /*
+        * This value is the RSS hash value calculated for the packet based on
+        * the mode bits and key value in the VNIC.
+        */
+       uint32_t rss_hash;
+} __attribute__((packed));
+
+/* last 16 bytes of RX Packet Completion Record */
+struct rx_pkt_cmpl_hi {
+       /*
+        * This indicates that the ip checksum was calculated for the inner
+        * packet and that the ip_cs_error field indicates if there was an
+        * error.
+        */
+       #define RX_PKT_CMPL_FLAGS2_IP_CS_CALC           UINT32_C(0x1)
+       /*
+        * This indicates that the TCP, UDP or ICMP checksum was calculated for
+        * the inner packet and that the l4_cs_error field indicates if there
+        * was an error.
+        */
+       #define RX_PKT_CMPL_FLAGS2_L4_CS_CALC           UINT32_C(0x2)
+       /*
+        * This indicates that the ip checksum was calculated for the tunnel
+        * header and that the t_ip_cs_error field indicates if there was an
+        * error.
+        */
+       #define RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC         UINT32_C(0x4)
+       /*
+        * This indicates that the UDP checksum was calculated for the tunnel
+        * packet and that the t_l4_cs_error field indicates if there was an
+        * error.
+        */
+       #define RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC         UINT32_C(0x8)
+       /* This value indicates what format the metadata field is. */
+       #define RX_PKT_CMPL_FLAGS2_META_FORMAT_MASK     UINT32_C(0xf0)
+       #define RX_PKT_CMPL_FLAGS2_META_FORMAT_SFT      4
+               /* No metadata informtaion. Value is zero. */
+       #define RX_PKT_CMPL_FLAGS2_META_FORMAT_NONE     (UINT32_C(0x0) << 4)
+               /*
+                * The metadata field contains the VLAN tag and TPID value. -
+                * metadata[11:0] contains the vlan VID value. - metadata[12]
+                * contains the vlan DE value. - metadata[15:13] contains the
+                * vlan PRI value. - metadata[31:16] contains the vlan TPID
+                * value.
+                */
+       #define RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN     (UINT32_C(0x1) << 4)
+       #define RX_PKT_CMPL_FLAGS2_META_FORMAT_LAST \
+                                       RX_PKT_CMPL_FLAGS2_META_FORMAT_VLAN
+       /*
+        * This field indicates the IP type for the inner-most IP header. A
+        * value of '0' indicates IPv4. A value of '1' indicates IPv6. This
+        * value is only valid if itype indicates a packet with an IP header.
+        */
+       #define RX_PKT_CMPL_FLAGS2_IP_TYPE              UINT32_C(0x100)
+       uint32_t flags2;
+
+       /*
+        * This is data from the CFA block as indicated by the meta_format
+        * field.
+        */
+       /* When meta_format=1, this value is the VLAN VID. */
+       #define RX_PKT_CMPL_METADATA_VID_MASK           UINT32_C(0xfff)
+       #define RX_PKT_CMPL_METADATA_VID_SFT            0
+       /* When meta_format=1, this value is the VLAN DE. */
+       #define RX_PKT_CMPL_METADATA_DE                 UINT32_C(0x1000)
+       /* When meta_format=1, this value is the VLAN PRI. */
+       #define RX_PKT_CMPL_METADATA_PRI_MASK           UINT32_C(0xe000)
+       #define RX_PKT_CMPL_METADATA_PRI_SFT            13
+       /* When meta_format=1, this value is the VLAN TPID. */
+       #define RX_PKT_CMPL_METADATA_TPID_MASK          UINT32_C(0xffff0000)
+       #define RX_PKT_CMPL_METADATA_TPID_SFT           16
+       uint32_t metadata;
+
+       /*
+        * This value is written by the NIC such that it will be different for
+        * each pass through the completion queue. The even passes will write 1.
+        * The odd passes will write 0.
+        */
+       #define RX_PKT_CMPL_V2                          UINT32_C(0x1)
+       /*
+        * This error indicates that there was some sort of problem with the BDs
+        * for the packet that was found after part of the packet was already
+        * placed. The packet should be treated as invalid.
+        */
+       #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_MASK    UINT32_C(0xe)
+       #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_SFT     1
+               /* No buffer error */
+       #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_NO_BUFFER \
+                                                       (UINT32_C(0x0) << 1)
+               /*
+                * Did Not Fit: Packet did not fit into packet buffer provided.
+                * For regular placement, this means the packet did not fit in
+                * the buffer provided. For HDS and jumbo placement, this means
+                * that the packet could not be placed into 7 physical buffers
+                * or less.
+                */
+       #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_DID_NOT_FIT \
+                                                       (UINT32_C(0x1) << 1)
+               /*
+                * Not On Chip: All BDs needed for the packet were not on-chip
+                * when the packet arrived.
+                */
+       #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_NOT_ON_CHIP \
+                                                       (UINT32_C(0x2) << 1)
+               /* Bad Format: BDs were not formatted correctly. */
+       #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT \
+                                                       (UINT32_C(0x3) << 1)
+       #define RX_PKT_CMPL_ERRORS_BUFFER_ERROR_LAST \
+                               RX_PKT_CMPL_ERRORS_BUFFER_ERROR_BAD_FORMAT
+       /* This indicates that there was an error in the IP header checksum. */
+       #define RX_PKT_CMPL_ERRORS_IP_CS_ERROR          UINT32_C(0x10)
+       /*
+        * This indicates that there was an error in the TCP, UDP or ICMP
+        * checksum.
+        */
+       #define RX_PKT_CMPL_ERRORS_L4_CS_ERROR          UINT32_C(0x20)
+       /*
+        * This indicates that there was an error in the tunnel IP header
+        * checksum.
+        */
+       #define RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR        UINT32_C(0x40)
+       /* This indicates that there was an error in the tunnel UDP checksum. */
+       #define RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR        UINT32_C(0x80)
+       /*
+        * This indicates that there was a CRC error on either an FCoE or RoCE
+        * packet. The itype indicates the packet type.
+        */
+       #define RX_PKT_CMPL_ERRORS_CRC_ERROR            UINT32_C(0x100)
+       /*
+        * This indicates that there was an error in the tunnel portion of the
+        * packet when this field is non-zero.
+        */
+       #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_MASK     UINT32_C(0xe00)
+       #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_SFT      9
+               /*
+                * No additional error occurred on the tunnel portion of the
+                * packet of the packet does not have a tunnel.
+                */
+       #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_NO_ERROR (UINT32_C(0x0) << 9)
+               /*
+                * Indicates that IP header version does not match expectation
+                * from L2 Ethertype for IPv4 and IPv6 in the tunnel header.
+                */
+       #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_VERSION \
+                                                       (UINT32_C(0x1) << 9)
+               /*
+                * Indicates that header length is out of range in the tunnel
+                * header. Valid for IPv4.
+                */
+       #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_HDR_LEN \
+                                                       (UINT32_C(0x2) << 9)
+               /*
+                * Indicates that the physical packet is shorter than that
+                * claimed by the PPPoE header length for a tunnel PPPoE packet.
+                */
+       #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_TUNNEL_TOTAL_ERROR \
+                                                       (UINT32_C(0x3) << 9)
+               /*
+                * Indicates that physical packet is shorter than that claimed
+                * by the tunnel l3 header length. Valid for IPv4, or IPv6
+                * tunnel packet packets.
+                */
+       #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_IP_TOTAL_ERROR \
+                                                       (UINT32_C(0x4) << 9)
+               /*
+                * Indicates that the physical packet is shorter than that
+                * claimed by the tunnel UDP header length for a tunnel UDP
+                * packet that is not fragmented.
+                */
+       #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_UDP_TOTAL_ERROR \
+                                                       (UINT32_C(0x5) << 9)
+               /*
+                * indicates that the IPv4 TTL or IPv6 hop limit check have
+                * failed (e.g. TTL = 0) in the tunnel header. Valid for IPv4,
+                * and IPv6.
+                */
+       #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL \
+                                                       (UINT32_C(0x6) << 9)
+       #define RX_PKT_CMPL_ERRORS_T_PKT_ERROR_LAST \
+                               RX_PKT_CMPL_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL
+       /*
+        * This indicates that there was an error in the inner portion of the
+        * packet when this field is non-zero.
+        */
+       #define RX_PKT_CMPL_ERRORS_PKT_ERROR_MASK       UINT32_C(0xf000)
+       #define RX_PKT_CMPL_ERRORS_PKT_ERROR_SFT        12
+               /*
+                * No additional error occurred on the tunnel portion of the
+                * packet of the packet does not have a tunnel.
+                */
+       #define RX_PKT_CMPL_ERRORS_PKT_ERROR_NO_ERROR   (UINT32_C(0x0) << 12)
+               /*
+                * Indicates that IP header version does not match expectation
+                * from L2 Ethertype for IPv4 and IPv6 or that option other than
+                * VFT was parsed on FCoE packet.
+                */
+       #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_VERSION \
+                                                       (UINT32_C(0x1) << 12)
+               /*
+                * indicates that header length is out of range. Valid for IPv4
+                * and RoCE
+                */
+       #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_HDR_LEN \
+                                                       (UINT32_C(0x2) << 12)
+               /*
+                * indicates that the IPv4 TTL or IPv6 hop limit check have
+                * failed (e.g. TTL = 0). Valid for IPv4, and IPv6
+                */
+       #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L3_BAD_TTL (UINT32_C(0x3) << 12)
+               /*
+                * Indicates that physical packet is shorter than that claimed
+                * by the l3 header length. Valid for IPv4, IPv6 packet or RoCE
+                * packets.
+                */
+       #define RX_PKT_CMPL_ERRORS_PKT_ERROR_IP_TOTAL_ERROR \
+                                                       (UINT32_C(0x4) << 12)
+               /*
+                * Indicates that the physical packet is shorter than that
+                * claimed by the UDP header length for a UDP packet that is not
+                * fragmented.
+                */
+       #define RX_PKT_CMPL_ERRORS_PKT_ERROR_UDP_TOTAL_ERROR \
+                                                       (UINT32_C(0x5) << 12)
+               /*
+                * Indicates that TCP header length > IP payload. Valid for TCP
+                * packets only.
+                */
+       #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN \
+                                                       (UINT32_C(0x6) << 12)
+               /* Indicates that TCP header length < 5. Valid for TCP. */
+       #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN_TOO_SMALL \
+                                                       (UINT32_C(0x7) << 12)
+               /*
+                * Indicates that TCP option headers result in a TCP header size
+                * that does not match data offset in TCP header. Valid for TCP.
+                */
+       #define RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN \
+                                                       (UINT32_C(0x8) << 12)
+       #define RX_PKT_CMPL_ERRORS_PKT_ERROR_LAST \
+                               RX_PKT_CMPL_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN
+       #define RX_PKT_CMPL_ERRORS_MASK                 UINT32_C(0xfffe)
+       #define RX_PKT_CMPL_ERRORS_SFT                  1
+       uint16_t errors_v2;
+
+       /*
+        * This field identifies the CFA action rule that was used for this
+        * packet.
+        */
+       uint16_t cfa_code;
+
+       /*
+        * This value holds the reordering sequence number for the packet. If
+        * the reordering sequence is not valid, then this value is zero. The
+        * reordering domain for the packet is in the bottom 8 to 10b of the
+        * rss_hash value. The bottom 20b of this value contain the ordering
+        * domain value for the packet.
+        */
+       #define RX_PKT_CMPL_REORDER_MASK                UINT32_C(0xffffff)
+       #define RX_PKT_CMPL_REORDER_SFT                 0
+       uint32_t reorder;
+} __attribute__((packed));
+
 /* HWRM Forwarded Request (16 bytes) */
 struct hwrm_fwd_req_cmpl {
        /* Length of forwarded request in bytes. */
@@ -1897,6 +2913,83 @@ struct hwrm_queue_qportcfg_input {
        uint16_t unused_0;
 } __attribute__((packed));
 
+/* hwrm_stat_ctx_clr_stats */
+/* Description: This command clears statistics of a context. */
+
+/* Input (24 bytes) */
+struct hwrm_stat_ctx_clr_stats_input {
+       /*
+        * This value indicates what type of request this is. The format for the
+        * rest of the command is determined by this field.
+        */
+       uint16_t req_type;
+
+       /*
+        * This value indicates the what completion ring the request will be
+        * optionally completed on. If the value is -1, then no CR completion
+        * will be generated. Any other value must be a valid CR ring_id value
+        * for this function.
+        */
+       uint16_t cmpl_ring;
+
+       /* This value indicates the command sequence number. */
+       uint16_t seq_id;
+
+       /*
+        * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
+        * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
+        */
+       uint16_t target_id;
+
+       /*
+        * This is the host address where the response will be written when the
+        * request is complete. This area must be 16B aligned and must be
+        * cleared to zero before the request is made.
+        */
+       uint64_t resp_addr;
+
+       /* ID of the statistics context that is being queried. */
+       uint32_t stat_ctx_id;
+
+       uint32_t unused_0;
+} __attribute__((packed));
+
+/* Output (16 bytes) */
+struct hwrm_stat_ctx_clr_stats_output {
+       /*
+        * Pass/Fail or error type Note: receiver to verify the in parameters,
+        * and fail the call with an error when appropriate
+        */
+       uint16_t error_code;
+
+       /* This field returns the type of original request. */
+       uint16_t req_type;
+
+       /* This field provides original sequence number of the command. */
+       uint16_t seq_id;
+
+       /*
+        * This field is the length of the response in bytes. The last byte of
+        * the response is a valid flag that will read as '1' when the command
+        * has been completely written to memory.
+        */
+       uint16_t resp_len;
+
+       uint32_t unused_0;
+       uint8_t unused_1;
+       uint8_t unused_2;
+       uint8_t unused_3;
+
+       /*
+        * This field is used in Output records to indicate that the output is
+        * completely written to RAM. This field should be read as '1' to
+        * indicate that the output has been completely written. When writing a
+        * command completion or response to an internal processor, the order of
+        * writes has to be such that this field is written last.
+        */
+       uint8_t valid;
+} __attribute__((packed));
+
 /* hwrm_vnic_rss_cfg */
 /* Description: This function is used to enable RSS configuration. */