Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 2021 Broadcom. All Rights Reserved. The term
0004  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
0005  */
0006 
0007 #if !defined(__EFCT_DRIVER_H__)
0008 #define __EFCT_DRIVER_H__
0009 
0010 /***************************************************************************
0011  * OS specific includes
0012  */
0013 #include <linux/module.h>
0014 #include <linux/debugfs.h>
0015 #include <linux/firmware.h>
0016 #include "../include/efc_common.h"
0017 #include "../libefc/efclib.h"
0018 #include "efct_hw.h"
0019 #include "efct_io.h"
0020 #include "efct_xport.h"
0021 
0022 #define EFCT_DRIVER_NAME            "efct"
0023 #define EFCT_DRIVER_VERSION         "1.0.0.0"
0024 
0025 /* EFCT_DEFAULT_FILTER-
0026  * MRQ filter to segregate the IO flow.
0027  */
0028 #define EFCT_DEFAULT_FILTER         "0x01ff22ff,0,0,0"
0029 
0030 /* EFCT_OS_MAX_ISR_TIME_MSEC -
0031  * maximum time driver code should spend in an interrupt
0032  * or kernel thread context without yielding
0033  */
0034 #define EFCT_OS_MAX_ISR_TIME_MSEC       1000
0035 
0036 #define EFCT_FC_MAX_SGL             64
0037 #define EFCT_FC_DIF_SEED            0
0038 
0039 /* Watermark */
0040 #define EFCT_WATERMARK_HIGH_PCT         90
0041 #define EFCT_WATERMARK_LOW_PCT          80
0042 #define EFCT_IO_WATERMARK_PER_INITIATOR     8
0043 
0044 #define EFCT_PCI_MAX_REGS           6
0045 #define MAX_PCI_INTERRUPTS          16
0046 
0047 struct efct_intr_context {
0048     struct efct     *efct;
0049     u32         index;
0050 };
0051 
0052 struct efct {
0053     struct pci_dev          *pci;
0054     void __iomem            *reg[EFCT_PCI_MAX_REGS];
0055 
0056     u32             n_msix_vec;
0057     bool                attached;
0058     bool                soft_wwn_enable;
0059     u8              efct_req_fw_upgrade;
0060     struct efct_intr_context    intr_context[MAX_PCI_INTERRUPTS];
0061     u32             numa_node;
0062 
0063     char                name[EFC_NAME_LENGTH];
0064     u32             instance_index;
0065     struct list_head        list_entry;
0066     struct efct_scsi_tgt        tgt_efct;
0067     struct efct_xport       *xport;
0068     struct efc          *efcport;
0069     struct Scsi_Host        *shost;
0070     int             logmask;
0071     u32             max_isr_time_msec;
0072 
0073     const char          *desc;
0074 
0075     const char          *model;
0076 
0077     struct efct_hw          hw;
0078 
0079     u32             rq_selection_policy;
0080     char                *filter_def;
0081     int             topology;
0082 
0083     /* Look up for target node */
0084     struct xarray           lookup;
0085 
0086     /*
0087      * Target IO timer value:
0088      * Zero: target command timeout disabled.
0089      * Non-zero: Timeout value, in seconds, for target commands
0090      */
0091     u32             target_io_timer_sec;
0092 
0093     int             speed;
0094     struct dentry           *sess_debugfs_dir;
0095 };
0096 
0097 #define FW_WRITE_BUFSIZE        (64 * 1024)
0098 
0099 struct efct_fw_write_result {
0100     struct completion done;
0101     int status;
0102     u32 actual_xfer;
0103     u32 change_status;
0104 };
0105 
0106 extern struct list_head         efct_devices;
0107 
0108 #endif /* __EFCT_DRIVER_H__ */