linux/drivers/scsi/lpfc/lpfc.h

/*******************************************************************
 * This file is part of the Emulex Linux Device Driver for         *
 * Fibre Channel Host Bus Adapters.                                *
 * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term *
 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
 * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
 * EMULEX and SLI are trademarks of Emulex.                        *
 * www.broadcom.com                                                *
 * Portions Copyright (C) 2004-2005 Christoph Hellwig              *
 *                                                                 *
 * This program is free software; you can redistribute it and/or   *
 * modify it under the terms of version 2 of the GNU General       *
 * Public License as published by the Free Software Foundation.    *
 * This program is distributed in the hope that it will be useful. *
 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
 * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
 * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
 * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
 * more details, a copy of which can be found in the file COPYING  *
 * included with this package.                                     *
 *******************************************************************/

#include <scsi/scsi_host.h>
#include <linux/hashtable.h>
#include <linux/ktime.h>
#include <linux/workqueue.h>

#if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_SCSI_LPFC_DEBUG_FS)
#define CONFIG_SCSI_LPFC_DEBUG_FS
#endif

struct lpfc_sli2_slim;

#define ELX_MODEL_NAME_SIZE
#define ELX_FW_NAME_SIZE

#define LPFC_PCI_DEV_LP
#define LPFC_PCI_DEV_OC

#define LPFC_SLI_REV2
#define LPFC_SLI_REV3
#define LPFC_SLI_REV4

#define LPFC_MAX_TARGET
#define LPFC_MAX_DISC_THREADS
#define LPFC_MAX_NS_RETRY
#define LPFC_CMD_PER_LUN
#define LPFC_DEFAULT_SG_SEG_CNT

#define LPFC_DEFAULT_XPSGL_SIZE
#define LPFC_MAX_SG_TABLESIZE
#define LPFC_MIN_SG_SLI4_BUF_SZ
#define LPFC_MAX_BG_SLI4_SEG_CNT_DIF
#define LPFC_MAX_SG_SEG_CNT_DIF
#define LPFC_MAX_SG_SEG_CNT
#define LPFC_MIN_SG_SEG_CNT
#define LPFC_MAX_SGL_SEG_CNT
#define LPFC_MAX_BPL_SEG_CNT
#define LPFC_MAX_NVME_SEG_CNT

#define LPFC_MAX_SGE_SIZE
#define LPFC_IOCB_LIST_CNT
#define LPFC_Q_RAMP_UP_INTERVAL
#define LPFC_VNAME_LEN
#define LPFC_TGTQ_RAMPUP_PCENT
#define LPFC_MIN_TGT_QDEPTH
#define LPFC_MAX_TGT_QDEPTH

/*
 * Following time intervals are used of adjusting SCSI device
 * queue depths when there are driver resource error or Firmware
 * resource error.
 */
/* 1 Second */
#define QUEUE_RAMP_DOWN_INTERVAL

/* Number of exchanges reserved for discovery to complete */
#define LPFC_DISC_IOCB_BUFF_COUNT

#define LPFC_HB_MBOX_INTERVAL
#define LPFC_HB_MBOX_TIMEOUT

/* Error Attention event polling interval */
#define LPFC_ERATT_POLL_INTERVAL

/* Define macros for 64 bit support */
#define putPaddrLow(addr)
#define putPaddrHigh(addr)
#define getPaddr(high, low)
/* Provide maximum configuration definitions. */
#define LPFC_DRVR_TIMEOUT
#define FC_MAX_ADPTMSG

#define MAX_HBAEVT
#define MAX_HBAS_NO_RESET

/* Number of MSI-X vectors the driver uses */
#define LPFC_MSIX_VECTORS

/* lpfc wait event data ready flag */
#define LPFC_DATA_READY

/* queue dump line buffer size */
#define LPFC_LBUF_SZ

/* mailbox system shutdown options */
#define LPFC_MBX_NO_WAIT
#define LPFC_MBX_WAIT

#define LPFC_CFG_PARAM_MAGIC_NUM
#define LPFC_PORT_CFG_NAME

#define lpfc_rangecheck(val, min, max)

enum lpfc_polling_flags {};

struct perf_prof {};

/*
 * Provide for FC4 TYPE x28 - NVME.  The
 * bit mask for FCP and NVME is 0x8 identically
 * because they are 32 bit positions distance.
 */
#define LPFC_FC4_TYPE_BITMASK

/* Provide DMA memory definitions the driver uses per port instance. */
struct lpfc_dmabuf {};

struct lpfc_nvmet_ctxbuf {};

struct lpfc_dma_pool {};

struct hbq_dmabuf {};

struct rqb_dmabuf {};

/* Priority bit.  Set value to exceed low water mark in lpfc_mem. */
#define MEM_PRI


/****************************************************************************/
/*      Device VPD save area                                                */
/****************************************************************************/
lpfc_vpd_t;


/*
 * lpfc stat counters
 */
struct lpfc_stats {};

struct lpfc_hba;

/* Data structure to keep withheld FLOGI_ACC information */
struct lpfc_defer_flogi_acc {};

#define LPFC_VMID_TIMER

#define LPFC_MAX_VMID_SIZE

lpfc_vmid_io_tag;

#define JIFFIES_PER_HR

struct lpfc_vmid {};

#define lpfc_vmid_is_type_priority_tag(vport)

#define LPFC_VMID_HASH_SIZE
#define LPFC_VMID_HASH_MASK
#define LPFC_VMID_HASH_SHIFT

struct lpfc_vmid_context {};

struct lpfc_vmid_priority_range {};

struct lpfc_vmid_priority_info {};

#define QFPA_EVEN_ONLY
#define QFPA_ODD_ONLY
#define QFPA_EVEN_ODD

enum discovery_state {};

enum hba_state {};

enum lpfc_hba_flag {};

struct lpfc_trunk_link_state {};

struct lpfc_trunk_link  {};

/* Format of congestion module parameters */
struct lpfc_cgn_param {};

/* Max number of days of congestion data */
#define LPFC_MAX_CGN_DAYS

struct lpfc_cgn_ts {};

/* Format of congestion buffer info
 * This structure defines memory thats allocated and registered with
 * the HBA firmware. When adding or removing fields from this structure
 * the alignment must match the HBA firmware.
 */

struct lpfc_cgn_info {};

#define LPFC_CGN_INFO_SZ

struct lpfc_cgn_stat {};

struct lpfc_cgn_acqe_stat {};

enum lpfc_fc_flag {};

enum lpfc_load_flag {};

struct lpfc_vport {};

struct hbq_s {};

/* this matches the position in the lpfc_hbq_defs array */
#define LPFC_ELS_HBQ
#define LPFC_MAX_HBQS

enum hba_temp_state {};

enum intr_type_t {};

#define LPFC_CT_CTX_MAX
struct unsol_rcv_ct_ctx {};

#define LPFC_USER_LINK_SPEED_AUTO
#define LPFC_USER_LINK_SPEED_1G
#define LPFC_USER_LINK_SPEED_2G
#define LPFC_USER_LINK_SPEED_4G
#define LPFC_USER_LINK_SPEED_8G
#define LPFC_USER_LINK_SPEED_10G
#define LPFC_USER_LINK_SPEED_16G
#define LPFC_USER_LINK_SPEED_32G
#define LPFC_USER_LINK_SPEED_64G
#define LPFC_USER_LINK_SPEED_MAX

#define LPFC_LINK_SPEED_STRING

enum nemb_type {};

enum mbox_type {};

enum dma_type {};

enum sta_type {};

struct lpfc_mbox_ext_buf_ctx {};

struct lpfc_epd_pool {};

enum ras_state {};

struct lpfc_ras_fwlog {};

#define DBG_LOG_STR_SZ
#define DBG_LOG_SZ

struct dbg_log_ent {};

enum lpfc_irq_chann_mode {};

enum lpfc_hba_bit_flags {};

struct lpfc_hba {};

#define LPFC_MAX_RXMONITOR_ENTRY
#define LPFC_MAX_RXMONITOR_DUMP
struct rx_info_entry {};

struct lpfc_rx_info_monitor {};

static inline struct Scsi_Host *
lpfc_shost_from_vport(struct lpfc_vport *vport)
{}

static inline void
lpfc_set_loopback_flag(struct lpfc_hba *phba)
{}

static inline int
lpfc_is_link_up(struct lpfc_hba *phba)
{}

static inline void
lpfc_worker_wake_up(struct lpfc_hba *phba)
{}

static inline int
lpfc_readl(void __iomem *addr, uint32_t *data)
{}

static inline int
lpfc_sli_read_hs(struct lpfc_hba *phba)
{}

static inline struct lpfc_sli_ring *
lpfc_phba_elsring(struct lpfc_hba *phba)
{}

/**
 * lpfc_next_online_cpu - Finds next online CPU on cpumask
 * @mask: Pointer to phba's cpumask member.
 * @start: starting cpu index
 *
 * Note: If no valid cpu found, then nr_cpu_ids is returned.
 *
 **/
static inline unsigned int
lpfc_next_online_cpu(const struct cpumask *mask, unsigned int start)
{}
/**
 * lpfc_next_present_cpu - Finds next present CPU after n
 * @n: the cpu prior to search
 *
 * Note: If no next present cpu, then fallback to first present cpu.
 *
 **/
static inline unsigned int lpfc_next_present_cpu(int n)
{}

/**
 * lpfc_sli4_mod_hba_eq_delay - update EQ delay
 * @phba: Pointer to HBA context object.
 * @q: The Event Queue to update.
 * @delay: The delay value (in us) to be written.
 *
 **/
static inline void
lpfc_sli4_mod_hba_eq_delay(struct lpfc_hba *phba, struct lpfc_queue *eq,
			   u32 delay)
{}


/*
 * Macro that declares tables and a routine to perform enum type to
 * ascii string lookup.
 *
 * Defines a <key,value> table for an enum. Uses xxx_INIT defines for
 * the enum to populate the table.  Macro defines a routine (named
 * by caller) that will search all elements of the table for the key
 * and return the name string if found or "Unrecognized" if not found.
 */
#define DECLARE_ENUM2STR_LOOKUP(routine, enum_name, enum_init)

/**
 * lpfc_is_vmid_enabled - returns if VMID is enabled for either switch types
 * @phba: Pointer to HBA context object.
 *
 * Relationship between the enable, target support and if vmid tag is required
 * for the particular combination
 * ---------------------------------------------------
 * Switch    Enable Flag  Target Support  VMID Needed
 * ---------------------------------------------------
 * App Id     0              NA              N
 * App Id     1               0              N
 * App Id     1               1              Y
 * Pr Tag     0              NA              N
 * Pr Tag     1               0              N
 * Pr Tag     1               1              Y
 * Pr Tag     2               *              Y
 ---------------------------------------------------
 *
 **/
static inline int lpfc_is_vmid_enabled(struct lpfc_hba *phba)
{}

static inline
u8 get_job_ulpstatus(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{}

static inline
u32 get_job_word4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{}

static inline
u8 get_job_cmnd(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{}

static inline
u16 get_job_ulpcontext(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{}

static inline
u16 get_job_rcvoxid(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{}

static inline
u32 get_job_data_placed(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{}

static inline
u32 get_job_abtsiotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{}

static inline
u32 get_job_els_rsp64_did(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{}