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

/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
/* QLogic qed NIC Driver
 * Copyright (c) 2015-2017  QLogic Corporation
 * Copyright (c) 2019-2020 Marvell International Ltd.
 */

#ifndef _QED_H
#define _QED_H

#include <linux/types.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/workqueue.h>
#include <linux/zlib.h>
#include <linux/hashtable.h>
#include <linux/qed/qed_if.h>
#include "qed_debug.h"
#include "qed_hsi.h"
#include "qed_dbg_hsi.h"
#include "qed_mfw_hsi.h"

extern const struct qed_common_ops qed_common_ops_pass;

#define STORM_FW_VERSION

#define MAX_HWFNS_PER_DEVICE
#define NAME_SIZE
#define VER_SIZE

#define QED_WFQ_UNIT

#define QED_WID_SIZE
#define QED_MIN_WIDS
#define QED_PF_DEMS_SIZE

#define QED_LLH_DONT_CARE

/* cau states */
enum qed_coalescing_mode {};

enum qed_nvm_cmd {};

struct qed_eth_cb_ops;
struct qed_dev_info;
qed_mcp_protocol_stats;
enum qed_mcp_protocol_type;
enum qed_mfw_tlv_type;
qed_mfw_tlv_data;

/* helpers */
#define QED_MFW_GET_FIELD(name, field)

#define QED_MFW_SET_FIELD(name, field, value)

static inline u32 qed_db_addr(u32 cid, u32 DEMS)
{}

static inline u32 qed_db_addr_vf(u32 cid, u32 DEMS)
{}

#define ALIGNED_TYPE_SIZE(type_name, p_hwfn)

#define for_each_hwfn(cdev, i)

#define D_TRINE(val, cond1, cond2, true1, true2, def)

/* forward */
struct qed_ptt_pool;
struct qed_spq;
struct qed_sb_info;
struct qed_sb_attn_info;
struct qed_cxt_mngr;
struct qed_sb_sp_info;
struct qed_ll2_info;
struct qed_mcp_info;
struct qed_llh_info;

struct qed_rt_data {};

enum qed_tunn_mode {};

enum qed_tunn_clss {};

struct qed_tunn_update_type {};

struct qed_tunn_update_udp_port {};

struct qed_tunnel_info {};

struct qed_tunn_start_params {};

struct qed_tunn_update_params {};

/* The PCI personality is not quite synonymous to protocol ID:
 * 1. All personalities need CORE connections
 * 2. The Ethernet personality may support also the RoCE/iWARP protocol
 */
enum qed_pci_personality {};

/* All VFs are symmetric, all counters are PF + all VFs */
struct qed_qm_iids {};

/* HW / FW resources, output of features supported below, most information
 * is received from MFW.
 */
enum qed_resources {};

enum QED_FEATURE {};

enum qed_dev_cap {};

enum qed_wol_support {};

enum qed_db_rec_exec {};

struct qed_hw_info {};

/* maximun size of read/write commands (HW limit) */
#define DMAE_MAX_RW_SIZE

struct qed_dmae_info {};

struct qed_wfq_data {};

struct qed_qm_info {};

#define QED_OVERFLOW_BIT

struct qed_db_recovery_info {};

struct storm_stats {};

struct qed_storm_stats {};

struct qed_fw_data {};

enum qed_mf_mode_bit {};

enum qed_ufp_mode {};

enum qed_ufp_pri_type {};

struct qed_ufp_info {};

enum BAR_ID {};

struct qed_nvm_image_info {};

enum qed_hsi_def_type {};

struct qed_simd_fp_handler {};

enum qed_slowpath_wq_flag {};

struct qed_hwfn {};

struct pci_params {};

struct qed_int_param {};

struct qed_int_params {};

struct qed_dbg_feature {};

struct qed_dev {};

u32 qed_get_hsi_def_val(struct qed_dev *cdev, enum qed_hsi_def_type type);

#define NUM_OF_VFS(dev)
#define NUM_OF_L2_QUEUES(dev)
#define NUM_OF_PORTS(dev)
#define NUM_OF_SBS(dev)
#define NUM_OF_ENG_PFS(dev)
#define NUM_OF_VPORTS(dev)
#define NUM_OF_RSS_ENGINES(dev)
#define NUM_OF_QM_TX_QUEUES(dev)
#define NUM_OF_PXP_ILT_RECORDS(dev)
#define NUM_OF_RDMA_STATISTIC_COUNTERS(dev)
#define NUM_OF_QM_GLOBAL_RLS(dev)
#define NUM_OF_PBF_CMD_LINES(dev)
#define NUM_OF_BTB_BLOCKS(dev)

/**
 * qed_concrete_to_sw_fid(): Get the sw function id from
 *                           the concrete value.
 *
 * @cdev: Qed dev pointer.
 * @concrete_fid: Concrete fid.
 *
 * Return: inline u8.
 */
static inline u8 qed_concrete_to_sw_fid(struct qed_dev *cdev,
					u32 concrete_fid)
{}

#define PKT_LB_TC

int qed_configure_vport_wfq(struct qed_dev *cdev, u16 vp_id, u32 rate);
void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev,
					 struct qed_ptt *p_ptt,
					 u32 min_pf_rate);

void qed_clean_wfq_db(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
void qed_set_fw_mac_addr(__le16 *fw_msb,
			 __le16 *fw_mid, __le16 *fw_lsb, u8 *mac);

#define QED_LEADING_HWFN(dev)
#define QED_IS_CMT(dev)
/* Macros for getting the engine-affinitized hwfn (FIR: fcoe,iscsi,roce) */
#define QED_FIR_AFFIN_HWFN(dev)
#define QED_IWARP_AFFIN_HWFN(dev)
#define QED_AFFIN_HWFN(dev)
#define QED_AFFIN_HWFN_IDX(dev)

/* Flags for indication of required queues */
#define PQ_FLAGS_RLS
#define PQ_FLAGS_MCOS
#define PQ_FLAGS_LB
#define PQ_FLAGS_OOO
#define PQ_FLAGS_ACK
#define PQ_FLAGS_OFLD
#define PQ_FLAGS_VFS
#define PQ_FLAGS_LLT
#define PQ_FLAGS_MTC

/* physical queue index for cm context initialization */
u16 qed_get_cm_pq_idx(struct qed_hwfn *p_hwfn, u32 pq_flags);
u16 qed_get_cm_pq_idx_mcos(struct qed_hwfn *p_hwfn, u8 tc);
u16 qed_get_cm_pq_idx_vf(struct qed_hwfn *p_hwfn, u16 vf);
u16 qed_get_cm_pq_idx_ofld_mtc(struct qed_hwfn *p_hwfn, u8 tc);
u16 qed_get_cm_pq_idx_llt_mtc(struct qed_hwfn *p_hwfn, u8 tc);

/* doorbell recovery mechanism */
void qed_db_recovery_dp(struct qed_hwfn *p_hwfn);
void qed_db_recovery_execute(struct qed_hwfn *p_hwfn);
bool qed_edpm_enabled(struct qed_hwfn *p_hwfn);

#define GET_GTT_REG_ADDR(__base, __offset, __idx)

#define GET_GTT_BDQ_REG_ADDR(__base, __offset, __idx, __bdq_idx)

/* Other Linux specific common definitions */
#define DP_NAME(cdev)

#define REG_ADDR(cdev, offset)

#define REG_RD(cdev, offset)
#define REG_WR(cdev, offset, val)
#define REG_WR16(cdev, offset, val)

#define DOORBELL(cdev, db_addr, val)

#define MFW_PORT(_p_hwfn)
int qed_device_num_ports(struct qed_dev *cdev);

/* Prototypes */
int qed_fill_dev_info(struct qed_dev *cdev,
		      struct qed_dev_info *dev_info);
void qed_link_update(struct qed_hwfn *hwfn, struct qed_ptt *ptt);
void qed_bw_update(struct qed_hwfn *hwfn, struct qed_ptt *ptt);
u32 qed_unzip_data(struct qed_hwfn *p_hwfn,
		   u32 input_len, u8 *input_buf,
		   u32 max_size, u8 *unzip_buf);
int qed_recovery_process(struct qed_dev *cdev);
void qed_schedule_recovery_handler(struct qed_hwfn *p_hwfn);
void qed_hw_error_occurred(struct qed_hwfn *p_hwfn,
			   enum qed_hw_err_type err_type);
void qed_get_protocol_stats(struct qed_dev *cdev,
			    enum qed_mcp_protocol_type type,
			    union qed_mcp_protocol_stats *stats);
int qed_slowpath_irq_req(struct qed_hwfn *hwfn);
void qed_slowpath_irq_sync(struct qed_hwfn *p_hwfn);
int qed_mfw_tlv_req(struct qed_hwfn *hwfn);

int qed_mfw_fill_tlv_data(struct qed_hwfn *hwfn,
			  enum qed_mfw_tlv_type type,
			  union qed_mfw_tlv_data *tlv_data);

void qed_hw_info_set_offload_tc(struct qed_hw_info *p_info, u8 tc);

void qed_periodic_db_rec_start(struct qed_hwfn *p_hwfn);

int qed_llh_add_src_tcp_port_filter(struct qed_dev *cdev, u16 src_port);
int qed_llh_add_dst_tcp_port_filter(struct qed_dev *cdev, u16 dest_port);
void qed_llh_remove_src_tcp_port_filter(struct qed_dev *cdev, u16 src_port);
void qed_llh_remove_dst_tcp_port_filter(struct qed_dev *cdev, u16 src_port);
void qed_llh_clear_all_filters(struct qed_dev *cdev);
unsigned long qed_get_epoch_time(void);
#endif /* _QED_H */