linux/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * QLogic qlcnic NIC Driver
 * Copyright (c) 2009-2013 QLogic Corporation
 */

#ifndef _QLCNIC_H_
#define _QLCNIC_H_

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/ioport.h>
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ip.h>
#include <linux/in.h>
#include <linux/tcp.h>
#include <linux/skbuff.h>
#include <linux/firmware.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/timer.h>
#include <linux/irq.h>
#include <linux/vmalloc.h>
#include <linux/io.h>
#include <asm/byteorder.h>
#include <linux/bitops.h>
#include <linux/if_vlan.h>

#include "qlcnic_hdr.h"
#include "qlcnic_hw.h"
#include "qlcnic_83xx_hw.h"
#include "qlcnic_dcb.h"

#define _QLCNIC_LINUX_MAJOR
#define _QLCNIC_LINUX_MINOR
#define _QLCNIC_LINUX_SUBVERSION
#define QLCNIC_LINUX_VERSIONID
#define QLCNIC_DRV_IDC_VER
#define QLCNIC_DRIVER_VERSION

#define QLCNIC_VERSION_CODE(a, b, c)
#define _major(v)
#define _minor(v)
#define _build(v)

/* version in image has weird encoding:
 *  7:0  - major
 * 15:8  - minor
 * 31:16 - build (little endian)
 */
#define QLCNIC_DECODE_VERSION(v)

#define QLCNIC_MIN_FW_VERSION
#define QLCNIC_NUM_FLASH_SECTORS
#define QLCNIC_FLASH_SECTOR_SIZE
#define QLCNIC_FLASH_TOTAL_SIZE

#define RCV_DESC_RINGSIZE(rds_ring)
#define RCV_BUFF_RINGSIZE(rds_ring)
#define STATUS_DESC_RINGSIZE(sds_ring)
#define TX_BUFF_RINGSIZE(tx_ring)
#define TX_DESC_RINGSIZE(tx_ring)

#define QLCNIC_P3P_A0
#define QLCNIC_P3P_C0

#define QLCNIC_IS_REVISION_P3P(REVISION)

#define FIRST_PAGE_GROUP_START
#define FIRST_PAGE_GROUP_END

#define P3P_MAX_MTU
#define P3P_MIN_MTU
#define QLCNIC_MAX_ETHERHDR

#define QLCNIC_P3P_RX_BUF_MAX_LEN
#define QLCNIC_P3P_RX_JUMBO_BUF_MAX_LEN
#define QLCNIC_CT_DEFAULT_RX_BUF_LEN
#define QLCNIC_LRO_BUFFER_EXTRA

/* Tx defines */
#define QLCNIC_MAX_FRAGS_PER_TX
#define MAX_TSO_HEADER_DESC
#define MGMT_CMD_DESC_RESV
#define TX_STOP_THRESH
#define QLCNIC_MAX_TX_TIMEOUTS

/* Driver will use 1 Tx ring in INT-x/MSI/SRIOV mode. */
#define QLCNIC_SINGLE_RING
#define QLCNIC_DEF_SDS_RINGS
#define QLCNIC_DEF_TX_RINGS
#define QLCNIC_MAX_VNIC_TX_RINGS
#define QLCNIC_MAX_VNIC_SDS_RINGS
#define QLCNIC_83XX_MINIMUM_VECTOR
#define QLCNIC_82XX_MINIMUM_VECTOR

enum qlcnic_queue_type {};

/* Operational mode for driver */
#define QLCNIC_VNIC_MODE
#define QLCNIC_DEFAULT_MODE

/* Virtual NIC function count */
#define QLC_DEFAULT_VNIC_COUNT
#define QLC_84XX_VNIC_COUNT

/*
 * Following are the states of the Phantom. Phantom will set them and
 * Host will read to check if the fields are correct.
 */
#define PHAN_INITIALIZE_FAILED
#define PHAN_INITIALIZE_COMPLETE

/* Host writes the following to notify that it has done the init-handshake */
#define PHAN_INITIALIZE_ACK
#define PHAN_PEG_RCV_INITIALIZED

#define NUM_RCV_DESC_RINGS

#define RCV_RING_NORMAL
#define RCV_RING_JUMBO

#define MIN_CMD_DESCRIPTORS
#define MIN_RCV_DESCRIPTORS
#define MIN_JUMBO_DESCRIPTORS

#define MAX_CMD_DESCRIPTORS
#define MAX_RCV_DESCRIPTORS_1G
#define MAX_RCV_DESCRIPTORS_10G
#define MAX_RCV_DESCRIPTORS_VF
#define MAX_JUMBO_RCV_DESCRIPTORS_1G
#define MAX_JUMBO_RCV_DESCRIPTORS_10G

#define DEFAULT_RCV_DESCRIPTORS_1G
#define DEFAULT_RCV_DESCRIPTORS_10G
#define DEFAULT_RCV_DESCRIPTORS_VF
#define MAX_RDS_RINGS

#define get_next_index(index, length)

/*
 * Following data structures describe the descriptors that will be used.
 * Added fileds of tcpHdrSize and ipHdrSize, The driver needs to do it only when
 * we are doing LSO (above the 1500 size packet) only.
 */
struct cmd_desc_type0 {} __attribute__ ((aligned));

/* Note: sizeof(rcv_desc) should always be a mutliple of 2 */
struct rcv_desc {} __packed;

struct status_desc {} __attribute__ ((aligned));

/* UNIFIED ROMIMAGE */
#define QLCNIC_UNI_FW_MIN_SIZE
#define QLCNIC_UNI_DIR_SECT_PRODUCT_TBL
#define QLCNIC_UNI_DIR_SECT_BOOTLD
#define QLCNIC_UNI_DIR_SECT_FW

/*Offsets */
#define QLCNIC_UNI_CHIP_REV_OFF
#define QLCNIC_UNI_FLAGS_OFF
#define QLCNIC_UNI_BIOS_VERSION_OFF
#define QLCNIC_UNI_BOOTLD_IDX_OFF
#define QLCNIC_UNI_FIRMWARE_IDX_OFF

struct uni_table_desc{};

struct uni_data_desc{};

/* Flash Defines and Structures */
#define QLCNIC_FLT_LOCATION
#define QLCNIC_FDT_LOCATION
#define QLCNIC_B0_FW_IMAGE_REGION
#define QLCNIC_C0_FW_IMAGE_REGION
#define QLCNIC_BOOTLD_REGION
struct qlcnic_flt_header {};

struct qlcnic_flt_entry {};

/* Flash Descriptor Table */
struct qlcnic_fdt {};
/* Magic number to let user know flash is programmed */
#define QLCNIC_BDINFO_MAGIC

#define QLCNIC_BRDTYPE_P3P_REF_QG
#define QLCNIC_BRDTYPE_P3P_HMEZ
#define QLCNIC_BRDTYPE_P3P_10G_CX4_LP
#define QLCNIC_BRDTYPE_P3P_4_GB
#define QLCNIC_BRDTYPE_P3P_IMEZ
#define QLCNIC_BRDTYPE_P3P_10G_SFP_PLUS
#define QLCNIC_BRDTYPE_P3P_10000_BASE_T
#define QLCNIC_BRDTYPE_P3P_XG_LOM
#define QLCNIC_BRDTYPE_P3P_4_GB_MM
#define QLCNIC_BRDTYPE_P3P_10G_SFP_CT
#define QLCNIC_BRDTYPE_P3P_10G_SFP_QT
#define QLCNIC_BRDTYPE_P3P_10G_CX4
#define QLCNIC_BRDTYPE_P3P_10G_XFP
#define QLCNIC_BRDTYPE_P3P_10G_TP

#define QLCNIC_MSIX_TABLE_OFFSET

/* Flash memory map */
#define QLCNIC_BRDCFG_START
#define QLCNIC_BOOTLD_START
#define QLCNIC_IMAGE_START
#define QLCNIC_USER_START

#define QLCNIC_FW_VERSION_OFFSET
#define QLCNIC_FW_SIZE_OFFSET
#define QLCNIC_FW_SERIAL_NUM_OFFSET
#define QLCNIC_BIOS_VERSION_OFFSET

#define QLCNIC_BRDTYPE_OFFSET
#define QLCNIC_FW_MAGIC_OFFSET

#define QLCNIC_FW_MIN_SIZE
#define QLCNIC_UNIFIED_ROMIMAGE
#define QLCNIC_FLASH_ROMIMAGE
#define QLCNIC_UNKNOWN_ROMIMAGE

#define QLCNIC_UNIFIED_ROMIMAGE_NAME
#define QLCNIC_FLASH_ROMIMAGE_NAME

extern char qlcnic_driver_name[];

extern int qlcnic_use_msi;
extern int qlcnic_use_msi_x;
extern int qlcnic_auto_fw_reset;
extern int qlcnic_load_fw_file;

/* Number of status descriptors to handle per interrupt */
#define MAX_STATUS_HANDLE

/*
 * qlcnic_skb_frag{} is to contain mapping info for each SG list. This
 * has to be freed when DMA is complete. This is part of qlcnic_tx_buffer{}.
 */
struct qlcnic_skb_frag {};

/*    Following defines are for the state of the buffers    */
#define QLCNIC_BUFFER_FREE
#define QLCNIC_BUFFER_BUSY

/*
 * There will be one qlcnic_buffer per skb packet.    These will be
 * used to save the dma info for pci_unmap_page()
 */
struct qlcnic_cmd_buffer {};

/* In rx_buffer, we do not need multiple fragments as is a single buffer */
struct qlcnic_rx_buffer {};

/* Board types */
#define QLCNIC_GBE
#define QLCNIC_XGBE

/*
 * Interrupt coalescing defaults. The defaults are for 1500 MTU. It is
 * adjusted based on configured MTU.
 */
#define QLCNIC_INTR_COAL_TYPE_RX
#define QLCNIC_INTR_COAL_TYPE_TX
#define QLCNIC_INTR_COAL_TYPE_RX_TX

#define QLCNIC_DEF_INTR_COALESCE_RX_TIME_US
#define QLCNIC_DEF_INTR_COALESCE_RX_PACKETS

#define QLCNIC_DEF_INTR_COALESCE_TX_TIME_US
#define QLCNIC_DEF_INTR_COALESCE_TX_PACKETS

#define QLCNIC_INTR_DEFAULT
#define QLCNIC_CONFIG_INTR_COALESCE
#define QLCNIC_DEV_INFO_SIZE

struct qlcnic_nic_intr_coalesce {};

struct qlcnic_83xx_dump_template_hdr {};

struct qlcnic_82xx_dump_template_hdr {};

#define QLC_PEX_DMA_READ_SIZE

struct qlcnic_fw_dump {};

/*
 * One hardware_context{} per adapter
 * contains interrupt info as well shared hardware info.
 */
struct qlcnic_hardware_context {};

struct qlcnic_adapter_stats {};

/*
 * Rcv Descriptor Context. One such per Rcv Descriptor. There may
 * be one Rcv Descriptor for normal packets, one for jumbo and may be others.
 */
struct qlcnic_host_rds_ring {} ____cacheline_internodealigned_in_smp;

struct qlcnic_host_sds_ring {} ____cacheline_internodealigned_in_smp;

struct qlcnic_tx_queue_stats {};

struct qlcnic_host_tx_ring {} ____cacheline_internodealigned_in_smp;

/*
 * Receive context. There is one such structure per instance of the
 * receive processing. Any state information that is relevant to
 * the receive, and is must be in this structure. The global data may be
 * present elsewhere.
 */
struct qlcnic_recv_context {};

/* HW context creation */

#define QLCNIC_OS_CRB_RETRY_COUNT

#define QLCNIC_CDRP_CMD_BIT

/*
 * All responses must have the QLCNIC_CDRP_CMD_BIT cleared
 * in the crb QLCNIC_CDRP_CRB_OFFSET.
 */
#define QLCNIC_CDRP_FORM_RSP(rsp)
#define QLCNIC_CDRP_IS_RSP(rsp)

#define QLCNIC_CDRP_RSP_OK
#define QLCNIC_CDRP_RSP_FAIL
#define QLCNIC_CDRP_RSP_TIMEOUT

/*
 * All commands must have the QLCNIC_CDRP_CMD_BIT set in
 * the crb QLCNIC_CDRP_CRB_OFFSET.
 */
#define QLCNIC_CDRP_FORM_CMD(cmd)

#define QLCNIC_RCODE_SUCCESS
#define QLCNIC_RCODE_INVALID_ARGS
#define QLCNIC_RCODE_NOT_SUPPORTED
#define QLCNIC_RCODE_NOT_PERMITTED
#define QLCNIC_RCODE_NOT_IMPL
#define QLCNIC_RCODE_INVALID
#define QLCNIC_RCODE_TIMEOUT
#define QLCNIC_DESTROY_CTX_RESET

/*
 * Capabilities Announced
 */
#define QLCNIC_CAP0_LEGACY_CONTEXT
#define QLCNIC_CAP0_LEGACY_MN
#define QLCNIC_CAP0_LSO
#define QLCNIC_CAP0_JUMBO_CONTIGUOUS
#define QLCNIC_CAP0_LRO_CONTIGUOUS
#define QLCNIC_CAP0_VALIDOFF
#define QLCNIC_CAP0_LRO_MSS
#define QLCNIC_CAP0_TX_MULTI

/*
 * Context state
 */
#define QLCNIC_HOST_CTX_STATE_FREED
#define QLCNIC_HOST_CTX_STATE_ACTIVE

/*
 * Rx context
 */

struct qlcnic_hostrq_sds_ring {} __packed;

struct qlcnic_hostrq_rds_ring {} __packed;

struct qlcnic_hostrq_rx_ctx {} __packed;

struct qlcnic_cardrsp_rds_ring{} __packed;

struct qlcnic_cardrsp_sds_ring {} __packed;

struct qlcnic_cardrsp_rx_ctx {} __packed;

#define SIZEOF_HOSTRQ_RX(HOSTRQ_RX, rds_rings, sds_rings)

#define SIZEOF_CARDRSP_RX(CARDRSP_RX, rds_rings, sds_rings)

/*
 * Tx context
 */

struct qlcnic_hostrq_cds_ring {} __packed;

struct qlcnic_hostrq_tx_ctx {} __packed;

struct qlcnic_cardrsp_cds_ring {} __packed;

struct qlcnic_cardrsp_tx_ctx {} __packed;

#define SIZEOF_HOSTRQ_TX(HOSTRQ_TX)
#define SIZEOF_CARDRSP_TX(CARDRSP_TX)

/* CRB */

#define QLCNIC_HOST_RDS_CRB_MODE_UNIQUE
#define QLCNIC_HOST_RDS_CRB_MODE_SHARED
#define QLCNIC_HOST_RDS_CRB_MODE_CUSTOM
#define QLCNIC_HOST_RDS_CRB_MODE_MAX

#define QLCNIC_HOST_INT_CRB_MODE_UNIQUE
#define QLCNIC_HOST_INT_CRB_MODE_SHARED
#define QLCNIC_HOST_INT_CRB_MODE_NORX
#define QLCNIC_HOST_INT_CRB_MODE_NOTX
#define QLCNIC_HOST_INT_CRB_MODE_NORXTX


/* MAC */

#define MC_COUNT_P3P

#define QLCNIC_MAC_NOOP
#define QLCNIC_MAC_ADD
#define QLCNIC_MAC_DEL
#define QLCNIC_MAC_VLAN_ADD
#define QLCNIC_MAC_VLAN_DEL

enum qlcnic_mac_type {};

struct qlcnic_mac_vlan_list {};

/* MAC Learn */
#define NO_MAC_LEARN
#define DRV_MAC_LEARN
#define FDB_MAC_LEARN

#define QLCNIC_HOST_REQUEST
#define QLCNIC_REQUEST

#define QLCNIC_MAC_EVENT

#define QLCNIC_IP_UP
#define QLCNIC_IP_DOWN

#define QLCNIC_ILB_MODE
#define QLCNIC_ELB_MODE
#define QLCNIC_LB_MODE_MASK

#define QLCNIC_LINKEVENT
#define QLCNIC_LB_RESPONSE
#define QLCNIC_IS_LB_CONFIGURED(VAL)

/*
 * Driver --> Firmware
 */
#define QLCNIC_H2C_OPCODE_CONFIG_RSS
#define QLCNIC_H2C_OPCODE_CONFIG_INTR_COALESCE
#define QLCNIC_H2C_OPCODE_CONFIG_LED
#define QLCNIC_H2C_OPCODE_LRO_REQUEST
#define QLCNIC_H2C_OPCODE_SET_MAC_RECEIVE_MODE
#define QLCNIC_H2C_OPCODE_CONFIG_IPADDR

#define QLCNIC_H2C_OPCODE_GET_LINKEVENT
#define QLCNIC_H2C_OPCODE_CONFIG_BRIDGING
#define QLCNIC_H2C_OPCODE_CONFIG_HW_LRO
#define QLCNIC_H2C_OPCODE_CONFIG_LOOPBACK

/*
 * Firmware --> Driver
 */

#define QLCNIC_C2H_OPCODE_CONFIG_LOOPBACK
#define QLCNIC_C2H_OPCODE_GET_LINKEVENT_RESPONSE
#define QLCNIC_C2H_OPCODE_GET_DCB_AEN

#define VPORT_MISS_MODE_DROP
#define VPORT_MISS_MODE_ACCEPT_ALL
#define VPORT_MISS_MODE_ACCEPT_MULTI

#define QLCNIC_LRO_REQUEST_CLEANUP

/* Capabilites received */
#define QLCNIC_FW_CAPABILITY_TSO
#define QLCNIC_FW_CAPABILITY_BDG
#define QLCNIC_FW_CAPABILITY_FVLANTX
#define QLCNIC_FW_CAPABILITY_HW_LRO
#define QLCNIC_FW_CAPABILITY_2_MULTI_TX
#define QLCNIC_FW_CAPABILITY_MULTI_LOOPBACK
#define QLCNIC_FW_CAPABILITY_MORE_CAPS

#define QLCNIC_FW_CAPABILITY_2_LRO_MAX_TCP_SEG
#define QLCNIC_FW_CAP2_HW_LRO_IPV6
#define QLCNIC_FW_CAPABILITY_SET_DRV_VER
#define QLCNIC_FW_CAPABILITY_2_BEACON
#define QLCNIC_FW_CAPABILITY_2_PER_PORT_ESWITCH_CFG
#define QLCNIC_FW_CAPABILITY_2_EXT_ISCSI_DUMP

#define QLCNIC_83XX_FW_CAPAB_ENCAP_RX_OFFLOAD
#define QLCNIC_83XX_FW_CAPAB_ENCAP_TX_OFFLOAD
#define QLCNIC_83XX_FW_CAPAB_ENCAP_CKO_OFFLOAD

/* module types */
#define LINKEVENT_MODULE_NOT_PRESENT
#define LINKEVENT_MODULE_OPTICAL_UNKNOWN
#define LINKEVENT_MODULE_OPTICAL_SRLR
#define LINKEVENT_MODULE_OPTICAL_LRM
#define LINKEVENT_MODULE_OPTICAL_SFP_1G
#define LINKEVENT_MODULE_TWINAX_UNSUPPORTED_CABLE
#define LINKEVENT_MODULE_TWINAX_UNSUPPORTED_CABLELEN
#define LINKEVENT_MODULE_TWINAX

#define LINKSPEED_10GBPS
#define LINKSPEED_1GBPS
#define LINKSPEED_100MBPS
#define LINKSPEED_10MBPS

#define LINKSPEED_ENCODED_10MBPS
#define LINKSPEED_ENCODED_100MBPS
#define LINKSPEED_ENCODED_1GBPS

#define LINKEVENT_AUTONEG_DISABLED
#define LINKEVENT_AUTONEG_ENABLED

#define LINKEVENT_HALF_DUPLEX
#define LINKEVENT_FULL_DUPLEX

#define LINKEVENT_LINKSPEED_MBPS
#define LINKEVENT_LINKSPEED_ENCODED

/* firmware response header:
 *	63:58 - message type
 *	57:56 - owner
 *	55:53 - desc count
 *	52:48 - reserved
 *	47:40 - completion id
 *	39:32 - opcode
 *	31:16 - error code
 *	15:00 - reserved
 */
#define qlcnic_get_nic_msg_opcode(msg_hdr)

struct qlcnic_fw_msg {};

struct qlcnic_nic_req {} __packed;

struct qlcnic_mac_req {};

struct qlcnic_vlan_req {} __packed;

struct qlcnic_ipaddr {};

#define QLCNIC_MSI_ENABLED
#define QLCNIC_MSIX_ENABLED
#define QLCNIC_LRO_ENABLED
#define QLCNIC_LRO_DISABLED
#define QLCNIC_BRIDGE_ENABLED
#define QLCNIC_DIAG_ENABLED
#define QLCNIC_ESWITCH_ENABLED
#define QLCNIC_ADAPTER_INITIALIZED
#define QLCNIC_TAGGING_ENABLED
#define QLCNIC_MACSPOOF
#define QLCNIC_MAC_OVERRIDE_DISABLED
#define QLCNIC_PROMISC_DISABLED
#define QLCNIC_NEED_FLR
#define QLCNIC_FW_RESET_OWNER
#define QLCNIC_FW_HANG
#define QLCNIC_FW_LRO_MSS_CAP
#define QLCNIC_TX_INTR_SHARED
#define QLCNIC_APP_CHANGED_FLAGS
#define QLCNIC_HAS_PHYS_PORT_ID
#define QLCNIC_TSS_RSS

#define QLCNIC_VLAN_FILTERING

#define QLCNIC_IS_MSI_FAMILY(adapter)
#define QLCNIC_IS_TSO_CAPABLE(adapter)

#define QLCNIC_BEACON_EANBLE
#define QLCNIC_BEACON_DISABLE

#define QLCNIC_BEACON_ON
#define QLCNIC_BEACON_OFF

#define QLCNIC_MSIX_TBL_SPACE
#define QLCNIC_PCI_REG_MSIX_TBL
#define QLCNIC_MSIX_TBL_PGSIZE

#define QLCNIC_ADAPTER_UP_MAGIC

#define __QLCNIC_FW_ATTACHED
#define __QLCNIC_DEV_UP
#define __QLCNIC_RESETTING
#define __QLCNIC_START_FW
#define __QLCNIC_AER
#define __QLCNIC_DIAG_RES_ALLOC
#define __QLCNIC_LED_ENABLE
#define __QLCNIC_ELB_INPROGRESS
#define __QLCNIC_MULTI_TX_UNIQUE
#define __QLCNIC_SRIOV_ENABLE
#define __QLCNIC_SRIOV_CAPABLE
#define __QLCNIC_MBX_POLL_ENABLE
#define __QLCNIC_DIAG_MODE
#define __QLCNIC_MAINTENANCE_MODE

#define QLCNIC_INTERRUPT_TEST
#define QLCNIC_LOOPBACK_TEST
#define QLCNIC_LED_TEST

#define QLCNIC_FILTER_AGE
#define QLCNIC_READD_AGE
#define QLCNIC_LB_MAX_FILTERS
#define QLCNIC_LB_BUCKET_SIZE
#define QLCNIC_ILB_MAX_RCV_LOOP

struct qlcnic_filter {};

struct qlcnic_filter_hash {};

/* Mailbox specific data structures */
struct qlcnic_mailbox {};

struct qlcnic_adapter {};

struct qlcnic_info_le {} __packed;

struct qlcnic_info {};

struct qlcnic_pci_info_le {} __packed;

struct qlcnic_pci_info {};

struct qlcnic_npar_info {};

struct qlcnic_eswitch {};


#define MAX_BW
#define MIN_BW
#define MAX_VLAN_ID
#define MIN_VLAN_ID
#define DEFAULT_MAC_LEARN

#define IS_VALID_VLAN(vlan)
#define IS_VALID_BW(bw)

struct qlcnic_pci_func_cfg {};

struct qlcnic_npar_func_cfg {};

struct qlcnic_pm_func_cfg {};

struct qlcnic_esw_func_cfg {};

#define QLCNIC_STATS_VERSION
#define QLCNIC_STATS_PORT
#define QLCNIC_STATS_ESWITCH
#define QLCNIC_QUERY_RX_COUNTER
#define QLCNIC_QUERY_TX_COUNTER
#define QLCNIC_STATS_NOT_AVAIL
#define QLCNIC_FILL_STATS(VAL1)
#define QLCNIC_MAC_STATS
#define QLCNIC_ESW_STATS

#define QLCNIC_ADD_ESW_STATS(VAL1, VAL2)

struct qlcnic_mac_statistics_le {} __packed;

struct qlcnic_mac_statistics {};

struct qlcnic_esw_stats_le {} __packed;

struct __qlcnic_esw_statistics {};

struct qlcnic_esw_statistics {};

#define QLCNIC_FORCE_FW_DUMP_KEY
#define QLCNIC_ENABLE_FW_DUMP
#define QLCNIC_DISABLE_FW_DUMP
#define QLCNIC_FORCE_FW_RESET
#define QLCNIC_SET_QUIESCENT
#define QLCNIC_RESET_QUIESCENT

struct _cdrp_cmd {};

struct qlcnic_cmd_args {};

int qlcnic_fw_cmd_get_minidump_temp(struct qlcnic_adapter *adapter);
int qlcnic_fw_cmd_set_port(struct qlcnic_adapter *adapter, u32 config);
int qlcnic_pci_mem_write_2M(struct qlcnic_adapter *, u64 off, u64 data);
int qlcnic_pci_mem_read_2M(struct qlcnic_adapter *, u64 off, u64 *data);

#define ADDR_IN_RANGE(addr, low, high)

#define QLCRD32(adapter, off, err)

#define QLCWR32(adapter, off, val)

int qlcnic_pcie_sem_lock(struct qlcnic_adapter *, int, u32);
void qlcnic_pcie_sem_unlock(struct qlcnic_adapter *, int);

#define qlcnic_rom_lock(a)
#define qlcnic_rom_unlock(a)
#define qlcnic_phy_lock(a)
#define qlcnic_phy_unlock(a)
#define qlcnic_sw_lock(a)
#define qlcnic_sw_unlock(a)
#define crb_win_lock(a)
#define crb_win_unlock(a)

#define __QLCNIC_MAX_LED_RATE
#define __QLCNIC_MAX_LED_STATE

#define MAX_CTL_CHECK

void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter);
void qlcnic_delete_lb_filters(struct qlcnic_adapter *adapter);
int qlcnic_dump_fw(struct qlcnic_adapter *);
int qlcnic_enable_fw_dump_state(struct qlcnic_adapter *);
bool qlcnic_check_fw_dump_state(struct qlcnic_adapter *);

/* Functions from qlcnic_init.c */
void qlcnic_schedule_work(struct qlcnic_adapter *, work_func_t, int);
int qlcnic_load_firmware(struct qlcnic_adapter *adapter);
int qlcnic_need_fw_reset(struct qlcnic_adapter *adapter);
void qlcnic_request_firmware(struct qlcnic_adapter *adapter);
void qlcnic_release_firmware(struct qlcnic_adapter *adapter);
int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter);
int qlcnic_setup_idc_param(struct qlcnic_adapter *adapter);
int qlcnic_check_flash_fw_ver(struct qlcnic_adapter *adapter);

int qlcnic_rom_fast_read(struct qlcnic_adapter *adapter, u32 addr, u32 *valp);
int qlcnic_rom_fast_read_words(struct qlcnic_adapter *adapter, int addr,
				u8 *bytes, size_t size);
int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter);
void qlcnic_free_sw_resources(struct qlcnic_adapter *adapter);

void __iomem *qlcnic_get_ioaddr(struct qlcnic_hardware_context *, u32);

int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter);
void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter);

int qlcnic_fw_create_ctx(struct qlcnic_adapter *adapter);
void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter);

void qlcnic_reset_rx_buffers_list(struct qlcnic_adapter *adapter);
void qlcnic_release_rx_buffers(struct qlcnic_adapter *adapter);
void qlcnic_release_tx_buffers(struct qlcnic_adapter *,
			       struct qlcnic_host_tx_ring *);

int qlcnic_check_fw_status(struct qlcnic_adapter *adapter);
void qlcnic_watchdog_task(struct work_struct *work);
void qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter,
		struct qlcnic_host_rds_ring *rds_ring, u8 ring_id);
void qlcnic_set_multi(struct net_device *netdev);
void qlcnic_flush_mcast_mac(struct qlcnic_adapter *);
int qlcnic_nic_add_mac(struct qlcnic_adapter *, const u8 *, u16,
		       enum qlcnic_mac_type);
int qlcnic_nic_del_mac(struct qlcnic_adapter *, const u8 *);
void qlcnic_82xx_free_mac_list(struct qlcnic_adapter *adapter);
int qlcnic_82xx_read_phys_port_id(struct qlcnic_adapter *);

int qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu);
int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *, u32);
int qlcnic_change_mtu(struct net_device *netdev, int new_mtu);
netdev_features_t qlcnic_fix_features(struct net_device *netdev,
	netdev_features_t features);
int qlcnic_set_features(struct net_device *netdev, netdev_features_t features);
int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, u32 enable);
void qlcnic_update_cmd_producer(struct qlcnic_host_tx_ring *);

/* Functions from qlcnic_ethtool.c */
int qlcnic_check_loopback_buff(unsigned char *, u8 []);
int qlcnic_do_lb_test(struct qlcnic_adapter *, u8);

/* Functions from qlcnic_main.c */
int qlcnic_reset_context(struct qlcnic_adapter *);
void qlcnic_diag_free_res(struct net_device *netdev, int);
int qlcnic_diag_alloc_res(struct net_device *netdev, int);
netdev_tx_t qlcnic_xmit_frame(struct sk_buff *, struct net_device *);
void qlcnic_set_tx_ring_count(struct qlcnic_adapter *, u8);
void qlcnic_set_sds_ring_count(struct qlcnic_adapter *, u8);
int qlcnic_setup_rings(struct qlcnic_adapter *);
int qlcnic_validate_rings(struct qlcnic_adapter *, __u32, int);
void qlcnic_alloc_lb_filters_mem(struct qlcnic_adapter *adapter);
int qlcnic_enable_msix(struct qlcnic_adapter *, u32);
void qlcnic_set_drv_version(struct qlcnic_adapter *);

/*  eSwitch management functions */
int qlcnic_config_switch_port(struct qlcnic_adapter *,
				struct qlcnic_esw_func_cfg *);

int qlcnic_get_eswitch_port_config(struct qlcnic_adapter *,
				struct qlcnic_esw_func_cfg *);
int qlcnic_config_port_mirroring(struct qlcnic_adapter *, u8, u8, u8);
int qlcnic_get_port_stats(struct qlcnic_adapter *, const u8, const u8,
					struct __qlcnic_esw_statistics *);
int qlcnic_get_eswitch_stats(struct qlcnic_adapter *, const u8, u8,
					struct __qlcnic_esw_statistics *);
int qlcnic_clear_esw_stats(struct qlcnic_adapter *adapter, u8, u8, u8);
int qlcnic_get_mac_stats(struct qlcnic_adapter *, struct qlcnic_mac_statistics *);

void qlcnic_free_mbx_args(struct qlcnic_cmd_args *cmd);

int qlcnic_alloc_sds_rings(struct qlcnic_recv_context *, int);
void qlcnic_free_sds_rings(struct qlcnic_recv_context *);
void qlcnic_advert_link_change(struct qlcnic_adapter *, int);
void qlcnic_free_tx_rings(struct qlcnic_adapter *);
int qlcnic_alloc_tx_rings(struct qlcnic_adapter *, struct net_device *);
void qlcnic_dump_mbx(struct qlcnic_adapter *, struct qlcnic_cmd_args *);

void qlcnic_create_sysfs_entries(struct qlcnic_adapter *adapter);
void qlcnic_remove_sysfs_entries(struct qlcnic_adapter *adapter);
void qlcnic_82xx_add_sysfs(struct qlcnic_adapter *adapter);
void qlcnic_82xx_remove_sysfs(struct qlcnic_adapter *adapter);

int qlcnicvf_config_bridged_mode(struct qlcnic_adapter *, u32);
int qlcnicvf_config_led(struct qlcnic_adapter *, u32, u32);
void qlcnic_set_vlan_config(struct qlcnic_adapter *,
			    struct qlcnic_esw_func_cfg *);
void qlcnic_set_eswitch_port_features(struct qlcnic_adapter *,
				      struct qlcnic_esw_func_cfg *);
int qlcnic_setup_tss_rss_intr(struct qlcnic_adapter  *);
void qlcnic_down(struct qlcnic_adapter *, struct net_device *);
int qlcnic_up(struct qlcnic_adapter *, struct net_device *);
void __qlcnic_down(struct qlcnic_adapter *, struct net_device *);
void qlcnic_detach(struct qlcnic_adapter *);
void qlcnic_teardown_intr(struct qlcnic_adapter *);
int qlcnic_attach(struct qlcnic_adapter *);
int __qlcnic_up(struct qlcnic_adapter *, struct net_device *);
void qlcnic_restore_indev_addr(struct net_device *, unsigned long);

int qlcnic_check_temp(struct qlcnic_adapter *);
int qlcnic_init_pci_info(struct qlcnic_adapter *);
int qlcnic_set_default_offload_settings(struct qlcnic_adapter *);
int qlcnic_reset_npar_config(struct qlcnic_adapter *);
int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *);
int qlcnic_set_vxlan_port(struct qlcnic_adapter *adapter, u16 port);
int qlcnic_set_vxlan_parsing(struct qlcnic_adapter *adapter, u16 port);
int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter);
int qlcnic_read_mac_addr(struct qlcnic_adapter *);
int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *);
void qlcnic_set_netdev_features(struct qlcnic_adapter *,
				struct qlcnic_esw_func_cfg *);
void qlcnic_sriov_vf_set_multi(struct net_device *);
int qlcnic_is_valid_nic_func(struct qlcnic_adapter *, u8);
int qlcnic_get_pci_func_type(struct qlcnic_adapter *, u16, u16 *, u16 *,
			     u16 *);

/*
 * QLOGIC Board information
 */

#define QLCNIC_MAX_BOARD_NAME_LEN
struct qlcnic_board_info {};

static inline u32 qlcnic_tx_avail(struct qlcnic_host_tx_ring *tx_ring)
{}

struct qlcnic_nic_template {};

struct qlcnic_mbx_ops {};

int qlcnic_83xx_init_mailbox_work(struct qlcnic_adapter *);
void qlcnic_83xx_detach_mailbox_work(struct qlcnic_adapter *);
void qlcnic_83xx_reinit_mbx_work(struct qlcnic_mailbox *mbx);
void qlcnic_83xx_free_mailbox(struct qlcnic_mailbox *mbx);
void qlcnic_update_stats(struct qlcnic_adapter *);

/* Adapter hardware abstraction */
struct qlcnic_hardware_ops {};

extern struct qlcnic_nic_template qlcnic_vf_ops;

static inline bool qlcnic_83xx_encap_tx_offload(struct qlcnic_adapter *adapter)
{}

static inline bool qlcnic_83xx_encap_rx_offload(struct qlcnic_adapter *adapter)
{}

static inline bool qlcnic_82xx_encap_tx_offload(struct qlcnic_adapter *adapter)
{}

static inline bool qlcnic_82xx_encap_rx_offload(struct qlcnic_adapter *adapter)
{}

static inline bool qlcnic_encap_rx_offload(struct qlcnic_adapter *adapter)
{}

static inline bool qlcnic_encap_tx_offload(struct qlcnic_adapter *adapter)
{}

static inline int qlcnic_start_firmware(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_read_crb(struct qlcnic_adapter *adapter, char *buf,
				   loff_t offset, size_t size)
{}

static inline void qlcnic_write_crb(struct qlcnic_adapter *adapter, char *buf,
				    loff_t offset, size_t size)
{}

static inline int qlcnic_get_mac_address(struct qlcnic_adapter *adapter,
					 u8 *mac, u8 function)
{}

static inline int qlcnic_setup_intr(struct qlcnic_adapter *adapter)
{}

static inline int qlcnic_alloc_mbx_args(struct qlcnic_cmd_args *mbx,
					struct qlcnic_adapter *adapter, u32 arg)
{}

static inline int qlcnic_issue_cmd(struct qlcnic_adapter *adapter,
				   struct qlcnic_cmd_args *cmd)
{}

static inline void qlcnic_get_func_no(struct qlcnic_adapter *adapter)
{}

static inline int qlcnic_api_lock(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_api_unlock(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_add_sysfs(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_remove_sysfs(struct qlcnic_adapter *adapter)
{}

static inline void
qlcnic_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring)
{}

static inline int qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter)
{}

static inline int qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter,
					      struct qlcnic_host_tx_ring *ptr,
					      int ring)
{}

static inline void qlcnic_fw_cmd_del_rx_ctx(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_fw_cmd_del_tx_ctx(struct qlcnic_adapter *adapter,
					    struct qlcnic_host_tx_ring *ptr)
{}

static inline int qlcnic_linkevent_request(struct qlcnic_adapter *adapter,
					   int enable)
{}

static inline int qlcnic_get_nic_info(struct qlcnic_adapter *adapter,
				      struct qlcnic_info *info, u8 id)
{}

static inline int qlcnic_get_pci_info(struct qlcnic_adapter *adapter,
				      struct qlcnic_pci_info *info)
{}

static inline int qlcnic_set_nic_info(struct qlcnic_adapter *adapter,
				      struct qlcnic_info *info)
{}

static inline int qlcnic_sre_macaddr_change(struct qlcnic_adapter *adapter,
					    u8 *addr, u16 id, u8 cmd)
{}

static inline int qlcnic_napi_add(struct qlcnic_adapter *adapter,
				  struct net_device *netdev)
{}

static inline void qlcnic_napi_del(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_napi_enable(struct qlcnic_adapter *adapter)
{}

static inline int __qlcnic_shutdown(struct pci_dev *pdev)
{}

static inline int __qlcnic_resume(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_napi_disable(struct qlcnic_adapter *adapter)
{}

static inline int qlcnic_config_intr_coalesce(struct qlcnic_adapter *adapter,
					      struct ethtool_coalesce *ethcoal)
{}

static inline int qlcnic_config_rss(struct qlcnic_adapter *adapter, int enable)
{}

static inline int qlcnic_config_hw_lro(struct qlcnic_adapter *adapter,
				       int enable)
{}

static inline int qlcnic_set_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
{}

static inline int qlcnic_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
{}

static inline int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter,
					 u32 mode)
{}

static inline void qlcnic_change_filter(struct qlcnic_adapter *adapter,
					u64 *addr, u16 vlan,
					struct qlcnic_host_tx_ring *tx_ring)
{}

static inline int qlcnic_get_board_info(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_free_mac_list(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_set_mac_filter_count(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_get_beacon_state(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_read_phys_port_id(struct qlcnic_adapter *adapter)
{}

static inline u32 qlcnic_get_saved_state(struct qlcnic_adapter *adapter,
					 void *t_hdr, u32 index)
{}

static inline void qlcnic_set_saved_state(struct qlcnic_adapter *adapter,
					  void *t_hdr, u32 index, u32 value)
{}

static inline void qlcnic_cache_tmpl_hdr_values(struct qlcnic_adapter *adapter,
						struct qlcnic_fw_dump *fw_dump)
{}

static inline u32 qlcnic_get_cap_size(struct qlcnic_adapter *adapter,
				      void *tmpl_hdr, int index)
{}

static inline void qlcnic_set_sys_info(struct qlcnic_adapter *adapter,
				       void *tmpl_hdr, int idx, u32 value)
{}

static inline void qlcnic_store_cap_mask(struct qlcnic_adapter *adapter,
					 void *tmpl_hdr, u32 mask)
{}

static inline void qlcnic_dev_request_reset(struct qlcnic_adapter *adapter,
					    u32 key)
{}

static inline void qlcnic_cancel_idc_work(struct qlcnic_adapter *adapter)
{}

static inline irqreturn_t
qlcnic_clear_legacy_intr(struct qlcnic_adapter *adapter)
{}

static inline int qlcnic_config_led(struct qlcnic_adapter *adapter, u32 state,
				    u32 rate)
{}

static inline void qlcnic_config_ipaddr(struct qlcnic_adapter *adapter,
					__be32 ip, int cmd)
{}

static inline bool qlcnic_check_multi_tx(struct qlcnic_adapter *adapter)
{}

static inline void
qlcnic_82xx_enable_tx_intr(struct qlcnic_adapter *adapter,
			   struct qlcnic_host_tx_ring *tx_ring)
{}

static inline void
qlcnic_82xx_disable_tx_intr(struct qlcnic_adapter *adapter,
			    struct qlcnic_host_tx_ring *tx_ring)
{}

static inline void
qlcnic_83xx_enable_tx_intr(struct qlcnic_adapter *adapter,
			   struct qlcnic_host_tx_ring *tx_ring)
{}

static inline void
qlcnic_83xx_disable_tx_intr(struct qlcnic_adapter *adapter,
			    struct qlcnic_host_tx_ring *tx_ring)
{}

/* Enable MSI-x and INT-x interrupts */
static inline void
qlcnic_83xx_enable_sds_intr(struct qlcnic_adapter *adapter,
			    struct qlcnic_host_sds_ring *sds_ring)
{}

/* Disable MSI-x and INT-x interrupts */
static inline void
qlcnic_83xx_disable_sds_intr(struct qlcnic_adapter *adapter,
			     struct qlcnic_host_sds_ring *sds_ring)
{}

static inline void qlcnic_disable_multi_tx(struct qlcnic_adapter *adapter)
{}

/* When operating in a muti tx mode, driver needs to write 0x1
 * to src register, instead of 0x0 to disable receiving interrupt.
 */
static inline void
qlcnic_82xx_disable_sds_intr(struct qlcnic_adapter *adapter,
			     struct qlcnic_host_sds_ring *sds_ring)
{}

static inline void qlcnic_enable_sds_intr(struct qlcnic_adapter *adapter,
					  struct qlcnic_host_sds_ring *sds_ring)
{}

static inline void
qlcnic_disable_sds_intr(struct qlcnic_adapter *adapter,
			struct qlcnic_host_sds_ring *sds_ring)
{}

static inline void qlcnic_enable_tx_intr(struct qlcnic_adapter *adapter,
					 struct qlcnic_host_tx_ring *tx_ring)
{}

static inline void qlcnic_disable_tx_intr(struct qlcnic_adapter *adapter,
					  struct qlcnic_host_tx_ring *tx_ring)
{}

/* When operating in a muti tx mode, driver needs to write 0x0
 * to src register, instead of 0x1 to enable receiving interrupts.
 */
static inline void
qlcnic_82xx_enable_sds_intr(struct qlcnic_adapter *adapter,
			    struct qlcnic_host_sds_ring *sds_ring)
{}

static inline int qlcnic_get_diag_lock(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_release_diag_lock(struct qlcnic_adapter *adapter)
{}

static inline int qlcnic_check_diag_status(struct qlcnic_adapter *adapter)
{}

extern const struct ethtool_ops qlcnic_sriov_vf_ethtool_ops;
extern const struct ethtool_ops qlcnic_ethtool_ops;
extern const struct ethtool_ops qlcnic_ethtool_failed_ops;

#define QLCDB(adapter, lvl, _fmt, _args...)

#define PCI_DEVICE_ID_QLOGIC_QLE824X
#define PCI_DEVICE_ID_QLOGIC_QLE834X
#define PCI_DEVICE_ID_QLOGIC_VF_QLE834X
#define PCI_DEVICE_ID_QLOGIC_QLE8830
#define PCI_DEVICE_ID_QLOGIC_VF_QLE8C30
#define PCI_DEVICE_ID_QLOGIC_QLE844X
#define PCI_DEVICE_ID_QLOGIC_VF_QLE844X

static inline bool qlcnic_82xx_check(struct qlcnic_adapter *adapter)
{}

static inline bool qlcnic_84xx_check(struct qlcnic_adapter *adapter)
{}

static inline bool qlcnic_83xx_check(struct qlcnic_adapter *adapter)
{}

static inline bool qlcnic_sriov_pf_check(struct qlcnic_adapter *adapter)
{}

static inline bool qlcnic_sriov_vf_check(struct qlcnic_adapter *adapter)
{}

static inline bool qlcnic_83xx_pf_check(struct qlcnic_adapter *adapter)
{}

static inline bool qlcnic_83xx_vf_check(struct qlcnic_adapter *adapter)
{}

static inline bool qlcnic_sriov_check(struct qlcnic_adapter *adapter)
{}

static inline u32 qlcnic_get_vnic_func_count(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_swap32_buffer(u32 *buffer, int count)
{}

#ifdef CONFIG_QLCNIC_HWMON
void qlcnic_register_hwmon_dev(struct qlcnic_adapter *);
void qlcnic_unregister_hwmon_dev(struct qlcnic_adapter *);
#else
static inline void qlcnic_register_hwmon_dev(struct qlcnic_adapter *adapter)
{
	return;
}
static inline void qlcnic_unregister_hwmon_dev(struct qlcnic_adapter *adapter)
{
	return;
}
#endif
#endif				/* __QLCNIC_H_ */