Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
lpfc_attr.c File Reference
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/aer.h>
#include <linux/gfp.h>
#include <linux/kernel.h>
#include <scsi/scsi.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_transport_fc.h>
#include <scsi/fc/fc_fs.h>
#include "lpfc_hw4.h"
#include "lpfc_hw.h"
#include "lpfc_sli.h"
#include "lpfc_sli4.h"
#include "lpfc_nl.h"
#include "lpfc_disc.h"
#include "lpfc_scsi.h"
#include "lpfc.h"
#include "lpfc_logmsg.h"
#include "lpfc_version.h"
#include "lpfc_compat.h"
#include "lpfc_crtn.h"
#include "lpfc_vport.h"

Go to the source code of this file.

Macros

#define LPFC_DEF_DEVLOSS_TMO   30
 
#define LPFC_MIN_DEVLOSS_TMO   1
 
#define LPFC_MAX_DEVLOSS_TMO   255
 
#define LPFC_REG_WRITE_KEY_SIZE   4
 
#define LPFC_REG_WRITE_KEY   "EMLX"
 
#define lpfc_param_show(attr)
 
#define lpfc_param_hex_show(attr)
 
#define lpfc_param_init(attr, default, minval, maxval)
 
#define lpfc_param_set(attr, default, minval, maxval)
 
#define lpfc_param_store(attr)
 
#define lpfc_vport_param_show(attr)
 
#define lpfc_vport_param_hex_show(attr)
 
#define lpfc_vport_param_init(attr, default, minval, maxval)
 
#define lpfc_vport_param_set(attr, default, minval, maxval)
 
#define lpfc_vport_param_store(attr)
 
#define LPFC_ATTR(name, defval, minval, maxval, desc)
 
#define LPFC_ATTR_R(name, defval, minval, maxval, desc)
 
#define LPFC_ATTR_RW(name, defval, minval, maxval, desc)
 
#define LPFC_ATTR_HEX_R(name, defval, minval, maxval, desc)
 
#define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc)
 
#define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc)
 
#define LPFC_VPORT_ATTR_R(name, defval, minval, maxval, desc)
 
#define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc)
 
#define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc)
 
#define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc)
 
#define LPFC_MAX_DATA_CTRL_LEN   1024
 
#define STAT_DATA_SIZE_PER_TARGET(NUM_BUCKETS)   ((NUM_BUCKETS) * 11 + 18)
 
#define MAX_STAT_DATA_SIZE_PER_TARGET   STAT_DATA_SIZE_PER_TARGET(LPFC_MAX_BUCKET_COUNT)
 
#define lpfc_rport_show_function(field, format_string, sz, cast)
 
#define lpfc_rport_rd_attr(field, format_string, sz)
 

Functions

int lpfc_selective_reset (struct lpfc_hba *phba)
 
int lpfc_sli4_pdev_status_reg_wait (struct lpfc_hba *phba)
 
 module_param (lpfc_poll, int, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_poll,"FCP ring polling mode control:"" 0 - none,"" 1 - poll with interrupts enabled"" 3 - poll and disable FCP ring interrupts")
 
 module_param (lpfc_sli_mode, int, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_sli_mode,"SLI mode selector:"" 0 - auto (SLI-3 if supported),"" 2 - select SLI-2 even on SLI-3 capable HBAs,"" 3 - select SLI-3")
 
 module_param (lpfc_enable_npiv, int, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_enable_npiv,"Enable NPIV functionality")
 
 lpfc_param_show (enable_npiv)
 
 lpfc_param_init (enable_npiv, 1, 0, 1)
 
 LPFC_ATTR_R (fcf_failover_policy, 1, 1, 2,"FCF Fast failover=1 Priority failover=2")
 
 module_param (lpfc_enable_rrq, int, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_enable_rrq,"Enable RRQ functionality")
 
 lpfc_param_show (enable_rrq)
 
 lpfc_param_init (enable_rrq, 0, 0, 1)
 
 LPFC_ATTR_R (suppress_link_up, LPFC_INITIALIZE_LINK, LPFC_INITIALIZE_LINK, LPFC_DELAY_INIT_LINK_INDEFINITELY,"Suppress Link Up at initialization")
 
 module_param (lpfc_iocb_cnt, int, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_iocb_cnt,"Number of IOCBs alloc for ELS, CT, and ABTS: 1k to 5k IOCBs")
 
 lpfc_param_show (iocb_cnt)
 
 lpfc_param_init (iocb_cnt, 2, 1, 5)
 
 module_param (lpfc_nodev_tmo, int, 0)
 
 MODULE_PARM_DESC (lpfc_nodev_tmo,"Seconds driver will hold I/O waiting ""for a device to come back")
 
 lpfc_vport_param_store (nodev_tmo)
 
 lpfc_vport_param_store (devloss_tmo)
 
 lpfc_vport_param_store (restrict_login)
 
 LPFC_VPORT_ATTR_R (scan_down, 1, 0, 1,"Start scanning for devices from highest ALPA to lowest")
 
 module_param (lpfc_topology, int, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_topology,"Select Fibre Channel topology")
 
 lpfc_param_show (lpfc_param_init(topology)
 
 module_param (lpfc_link_speed, int, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_link_speed,"Select link speed")
 
 lpfc_param_show (link_speed)
 
 module_param (lpfc_aer_support, int, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_aer_support,"Enable PCIe device AER support")
 
 lpfc_param_show (aer_support)
 
 module_param (lpfc_sriov_nr_virtfn, int, S_IRUGO|S_IWUSR)
 
 MODULE_PARM_DESC (lpfc_sriov_nr_virtfn,"Enable PCIe device SR-IOV virtual fn")
 
 lpfc_param_show (sriov_nr_virtfn)
 
 module_param (lpfc_fcp_imax, int, S_IRUGO|S_IWUSR)
 
 MODULE_PARM_DESC (lpfc_fcp_imax,"Set the maximum number of FCP interrupts per second per HBA")
 
 lpfc_param_show (fcp_imax)
 
 LPFC_VPORT_ATTR_R (fcp_class, 3, 2, 3,"Select Fibre Channel class of service for FCP sequences")
 
 LPFC_VPORT_ATTR_RW (use_adisc, 0, 0, 1,"Use ADISC on rediscovery to authenticate FCP devices")
 
 module_param (lpfc_max_scsicmpl_time, int, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_max_scsicmpl_time,"Use command completion time to control queue depth")
 
 lpfc_vport_param_show (max_scsicmpl_time)
 
 lpfc_vport_param_init (max_scsicmpl_time, 0, 0, 60000)
 
 lpfc_vport_param_store (max_scsicmpl_time)
 
 LPFC_ATTR_R (ack0, 0, 0, 1,"Enable ACK0 support")
 
 LPFC_ATTR_RW (fcp_io_sched, 0, 0, 1,"Determine scheduling algrithmn for ""issuing commands [0] - Round Robin, [1] - Current CPU")
 
 LPFC_ATTR_RW (cr_delay, 0, 0, 63,"A count of milliseconds after which an ""interrupt response is generated")
 
 LPFC_ATTR_RW (cr_count, 1, 1, 255,"A count of I/O completions after which an ""interrupt response is generated")
 
 LPFC_ATTR_R (multi_ring_support, 1, 1, 2,"Determines number of primary ""SLI rings to spread IOCB entries across")
 
 LPFC_ATTR_R (multi_ring_rctl, FC_RCTL_DD_UNSOL_DATA, 1, 255,"Identifies RCTL for additional ring configuration")
 
 LPFC_ATTR_R (multi_ring_type, FC_TYPE_IP, 1, 255,"Identifies TYPE for additional ring configuration")
 
 LPFC_VPORT_ATTR_RW (fdmi_on, 0, 0, 2,"Enable FDMI support")
 
 LPFC_VPORT_ATTR (discovery_threads, 32, 1, 64,"Maximum number of ELS commands ""during discovery")
 
 LPFC_VPORT_ATTR_R (max_luns, 255, 0, 65535,"Maximum allowed LUN")
 
 LPFC_ATTR_RW (poll_tmo, 10, 1, 255,"Milliseconds driver will wait between polling FCP ring")
 
 LPFC_ATTR_R (use_msi, 2, 0, 2,"Use Message Signaled Interrupts (1) or ""MSI-X (2), if possible")
 
 LPFC_ATTR_R (fcp_wq_count, LPFC_FCP_IO_CHAN_DEF, LPFC_FCP_IO_CHAN_MIN, LPFC_FCP_IO_CHAN_MAX,"Set the number of fast-path FCP work queues, if possible")
 
 LPFC_ATTR_R (fcp_eq_count, LPFC_FCP_IO_CHAN_DEF, LPFC_FCP_IO_CHAN_MIN, LPFC_FCP_IO_CHAN_MAX,"Set the number of fast-path FCP event queues, if possible")
 
 LPFC_ATTR_R (fcp_io_channel, LPFC_FCP_IO_CHAN_DEF, LPFC_FCP_IO_CHAN_MIN, LPFC_FCP_IO_CHAN_MAX,"Set the number of FCP I/O channels")
 
 LPFC_ATTR_R (enable_hba_reset, 1, 0, 1,"Enable HBA resets from the driver.")
 
 LPFC_ATTR_R (enable_hba_heartbeat, 0, 0, 1,"Enable HBA Heartbeat.")
 
 LPFC_ATTR_R (enable_bg, 0, 0, 1,"Enable BlockGuard Support")
 
 module_param (lpfc_fcp_look_ahead, uint, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_fcp_look_ahead,"Look ahead for completions")
 
 module_param (lpfc_prot_mask, uint, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_prot_mask,"host protection mask")
 
 module_param (lpfc_prot_guard, byte, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_prot_guard,"host protection guard type")
 
 module_param (lpfc_delay_discovery, int, S_IRUGO)
 
 MODULE_PARM_DESC (lpfc_delay_discovery,"Delay NPort discovery when Clean Address bit is cleared. ""Allowed values: 0,1.")
 
 LPFC_ATTR_R (sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT, LPFC_MAX_SG_SEG_CNT,"Max Scatter Gather Segment Count")
 
 LPFC_ATTR_R (prot_sg_seg_cnt, LPFC_DEFAULT_PROT_SG_SEG_CNT, LPFC_DEFAULT_PROT_SG_SEG_CNT, LPFC_MAX_PROT_SG_SEG_CNT,"Max Protection Scatter Gather Segment Count")
 
int lpfc_alloc_sysfs_attr (struct lpfc_vport *vport)
 
void lpfc_free_sysfs_attr (struct lpfc_vport *vport)
 
void lpfc_get_cfgparam (struct lpfc_hba *phba)
 
void lpfc_get_vport_cfgparam (struct lpfc_vport *vport)
 

Variables

int lpfc_sli_mode = 0
 
int lpfc_enable_npiv = 1
 
int lpfc_enable_rrq
 
int lpfc_iocb_cnt = 2
 
unsigned int lpfc_fcp_look_ahead = LPFC_LOOK_AHEAD_OFF
 
unsigned int lpfc_prot_mask
 
unsigned char lpfc_prot_guard = SHOST_DIX_GUARD_IP
 
int lpfc_delay_discovery
 
struct device_attributelpfc_hba_attrs []
 
struct device_attributelpfc_vport_attrs []
 
struct fc_function_template lpfc_transport_functions
 
struct fc_function_template lpfc_vport_transport_functions
 

Macro Definition Documentation

#define LPFC_ATTR (   name,
  defval,
  minval,
  maxval,
  desc 
)
Value:
static uint lpfc_##name = defval;\
module_param(lpfc_##name, uint, S_IRUGO);\
MODULE_PARM_DESC(lpfc_##name, desc);\
lpfc_param_init(name, defval, minval, maxval)

Definition at line 1912 of file lpfc_attr.c.

#define LPFC_ATTR_HEX_R (   name,
  defval,
  minval,
  maxval,
  desc 
)
Value:
static uint lpfc_##name = defval;\
module_param(lpfc_##name, uint, S_IRUGO);\
MODULE_PARM_DESC(lpfc_##name, desc);\
lpfc_param_hex_show(name)\
lpfc_param_init(name, defval, minval, maxval)\
static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)

Definition at line 1937 of file lpfc_attr.c.

#define LPFC_ATTR_HEX_RW (   name,
  defval,
  minval,
  maxval,
  desc 
)
Value:
static uint lpfc_##name = defval;\
module_param(lpfc_##name, uint, S_IRUGO);\
MODULE_PARM_DESC(lpfc_##name, desc);\
lpfc_param_hex_show(name)\
lpfc_param_init(name, defval, minval, maxval)\
lpfc_param_set(name, defval, minval, maxval)\
lpfc_param_store(name)\
static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
lpfc_##name##_show, lpfc_##name##_store)

Definition at line 1945 of file lpfc_attr.c.

#define LPFC_ATTR_R (   name,
  defval,
  minval,
  maxval,
  desc 
)
Value:
static uint lpfc_##name = defval;\
module_param(lpfc_##name, uint, S_IRUGO);\
MODULE_PARM_DESC(lpfc_##name, desc);\
lpfc_param_show(name)\
lpfc_param_init(name, defval, minval, maxval)\
static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)

Definition at line 1918 of file lpfc_attr.c.

#define LPFC_ATTR_RW (   name,
  defval,
  minval,
  maxval,
  desc 
)
Value:
static uint lpfc_##name = defval;\
module_param(lpfc_##name, uint, S_IRUGO);\
MODULE_PARM_DESC(lpfc_##name, desc);\
lpfc_param_show(name)\
lpfc_param_init(name, defval, minval, maxval)\
lpfc_param_set(name, defval, minval, maxval)\
lpfc_param_store(name)\
static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
lpfc_##name##_show, lpfc_##name##_store)

Definition at line 1926 of file lpfc_attr.c.

#define LPFC_DEF_DEVLOSS_TMO   30

Definition at line 52 of file lpfc_attr.c.

#define LPFC_MAX_DATA_CTRL_LEN   1024
#define LPFC_MAX_DEVLOSS_TMO   255

Definition at line 54 of file lpfc_attr.c.

#define LPFC_MIN_DEVLOSS_TMO   1

Definition at line 53 of file lpfc_attr.c.

#define lpfc_param_hex_show (   attr)
Value:
static ssize_t \
lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
struct lpfc_hba *phba = vport->phba;\
uint val = 0;\
val = phba->cfg_##attr;\
return snprintf(buf, PAGE_SIZE, "%#x\n",\
phba->cfg_##attr);\
}

lpfc_param_hex_show - Return a cfg attribute value in hex

Description: Macro that given an attr e.g. hba_queue_depth expands into a function with the name lpfc_hba_queue_depth_show

lpfc_#attr##_show: Return the hex value of an adapters cfg_xxx field. : class device that is converted into a Scsi_host. : device attribute, not used. : on return contains the attribute value in hexadecimal.

Returns: size of formatted string.

Definition at line 1631 of file lpfc_attr.c.

#define lpfc_param_init (   attr,
  default,
  minval,
  maxval 
)
Value:
static int \
lpfc_##attr##_init(struct lpfc_hba *phba, uint val) \
{ \
if (val >= minval && val <= maxval) {\
phba->cfg_##attr = val;\
return 0;\
}\
lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \
"0449 lpfc_"#attr" attribute cannot be set to %d, "\
"allowed range is ["#minval", "#maxval"]\n", val); \
phba->cfg_##attr = default;\
return -EINVAL;\
}

lpfc_param_init - Initializes a cfg attribute

Description: Macro that given an attr e.g. hba_queue_depth expands into a function with the name lpfc_hba_queue_depth_init. The macro also takes a default argument, a minimum and maximum argument.

lpfc_#attr##_init: Initializes an attribute. : pointer the the adapter structure. : integer attribute value.

Validates the min and max values then sets the adapter config field accordingly, or uses the default if out of range and prints an error message.

Returns: zero on success -EINVAL if default used

Definition at line 1664 of file lpfc_attr.c.

#define lpfc_param_set (   attr,
  default,
  minval,
  maxval 
)
Value:
static int \
lpfc_##attr##_set(struct lpfc_hba *phba, uint val) \
{ \
if (val >= minval && val <= maxval) {\
lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \
"3052 lpfc_" #attr " changed from %d to %d\n", \
phba->cfg_##attr, val); \
phba->cfg_##attr = val;\
return 0;\
}\
lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \
"0450 lpfc_"#attr" attribute cannot be set to %d, "\
"allowed range is ["#minval", "#maxval"]\n", val); \
return -EINVAL;\
}

lpfc_param_set - Set a cfg attribute value

Description: Macro that given an attr e.g. hba_queue_depth expands into a function with the name lpfc_hba_queue_depth_set

lpfc_#attr##_set: Sets an attribute value. : pointer the the adapter structure. : integer attribute value.

Description: Validates the min and max values then sets the adapter config field if in the valid range. prints error message and does not set the parameter if invalid.

Returns: zero on success -EINVAL if val is invalid

Definition at line 1699 of file lpfc_attr.c.

#define lpfc_param_show (   attr)
Value:
static ssize_t \
lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
struct lpfc_hba *phba = vport->phba;\
uint val = 0;\
val = phba->cfg_##attr;\
return snprintf(buf, PAGE_SIZE, "%d\n",\
phba->cfg_##attr);\
}

lpfc_param_show - Return a cfg attribute value in decimal

Description: Macro that given an attr e.g. hba_queue_depth expands into a function with the name lpfc_hba_queue_depth_show.

lpfc_#attr##_show: Return the decimal value of an adapters cfg_xxx field. : class device that is converted into a Scsi_host. : device attribute, not used. : on return contains the attribute value in decimal.

Returns: size of formatted string.

Definition at line 1603 of file lpfc_attr.c.

#define lpfc_param_store (   attr)
Value:
static ssize_t \
lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
struct lpfc_hba *phba = vport->phba;\
uint val = 0;\
if (!isdigit(buf[0]))\
return -EINVAL;\
if (sscanf(buf, "%i", &val) != 1)\
return -EINVAL;\
if (lpfc_##attr##_set(phba, val) == 0) \
return strlen(buf);\
else \
return -EINVAL;\
}

lpfc_param_store - Set a vport attribute value

Description: Macro that given an attr e.g. hba_queue_depth expands into a function with the name lpfc_hba_queue_depth_store.

lpfc_#attr##_store: Set an sttribute value. : class device that is converted into a Scsi_host. : device attribute, not used. : contains the attribute value in ascii. : not used.

Description: Convert the ascii text number to an integer, then use the lpfc_#attr##_set function to set the value.

Returns: -EINVAL if val is invalid or lpfc_#attr##_set() fails length of buffer upon success.

Definition at line 1737 of file lpfc_attr.c.

#define LPFC_REG_WRITE_KEY   "EMLX"

Definition at line 61 of file lpfc_attr.c.

#define LPFC_REG_WRITE_KEY_SIZE   4

Definition at line 60 of file lpfc_attr.c.

#define lpfc_rport_rd_attr (   field,
  format_string,
  sz 
)
Value:
lpfc_rport_show_function(field, format_string, sz, ) \
static FC_RPORT_ATTR(field, S_IRUGO, lpfc_show_rport_##field, NULL)

Definition at line 4849 of file lpfc_attr.c.

#define lpfc_rport_show_function (   field,
  format_string,
  sz,
  cast 
)
Value:
static ssize_t \
lpfc_show_rport_##field (struct device *dev, \
char *buf) \
{ \
struct lpfc_rport_data *rdata = rport->hostdata; \
return snprintf(buf, sz, format_string, \
(rdata->target) ? cast rdata->target->field : 0); \
}

lpfc_rport_show_function - Return rport target information

Description: Macro that uses field to generate a function with the name lpfc_show_rport_

lpfc_show_rport_#field: returns the bytes formatted in buf : class converted to an fc_rport. : on return contains the target_field or zero.

Returns: size of formatted string.

Definition at line 4837 of file lpfc_attr.c.

#define LPFC_VPORT_ATTR (   name,
  defval,
  minval,
  maxval,
  desc 
)
Value:
static uint lpfc_##name = defval;\
module_param(lpfc_##name, uint, S_IRUGO);\
MODULE_PARM_DESC(lpfc_##name, desc);\
lpfc_vport_param_init(name, defval, minval, maxval)

Definition at line 1956 of file lpfc_attr.c.

#define LPFC_VPORT_ATTR_HEX_R (   name,
  defval,
  minval,
  maxval,
  desc 
)
Value:
static uint lpfc_##name = defval;\
module_param(lpfc_##name, uint, S_IRUGO);\
MODULE_PARM_DESC(lpfc_##name, desc);\
lpfc_vport_param_hex_show(name)\
lpfc_vport_param_init(name, defval, minval, maxval)\
static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)

Definition at line 1981 of file lpfc_attr.c.

#define LPFC_VPORT_ATTR_HEX_RW (   name,
  defval,
  minval,
  maxval,
  desc 
)
Value:
static uint lpfc_##name = defval;\
module_param(lpfc_##name, uint, S_IRUGO);\
MODULE_PARM_DESC(lpfc_##name, desc);\
lpfc_vport_param_hex_show(name)\
lpfc_vport_param_init(name, defval, minval, maxval)\
lpfc_vport_param_set(name, defval, minval, maxval)\
lpfc_vport_param_store(name)\
static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
lpfc_##name##_show, lpfc_##name##_store)

Definition at line 1989 of file lpfc_attr.c.

#define LPFC_VPORT_ATTR_R (   name,
  defval,
  minval,
  maxval,
  desc 
)
Value:
static uint lpfc_##name = defval;\
module_param(lpfc_##name, uint, S_IRUGO);\
MODULE_PARM_DESC(lpfc_##name, desc);\
lpfc_vport_param_show(name)\
lpfc_vport_param_init(name, defval, minval, maxval)\
static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)

Definition at line 1962 of file lpfc_attr.c.

#define LPFC_VPORT_ATTR_RW (   name,
  defval,
  minval,
  maxval,
  desc 
)
Value:
static uint lpfc_##name = defval;\
module_param(lpfc_##name, uint, S_IRUGO);\
MODULE_PARM_DESC(lpfc_##name, desc);\
lpfc_vport_param_show(name)\
lpfc_vport_param_init(name, defval, minval, maxval)\
lpfc_vport_param_set(name, defval, minval, maxval)\
lpfc_vport_param_store(name)\
static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
lpfc_##name##_show, lpfc_##name##_store)

Definition at line 1970 of file lpfc_attr.c.

#define lpfc_vport_param_hex_show (   attr)
Value:
static ssize_t \
lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
uint val = 0;\
val = vport->cfg_##attr;\
return snprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
}

lpfc_vport_param_hex_show - Return hex formatted attribute value

Description: Macro that given an attr e.g. hba_queue_depth expands into a function with the name lpfc_hba_queue_depth_show

lpfc_#attr##_show: prints the attribute value in hexadecimal. : class device that is converted into a Scsi_host. : device attribute, not used. : on return contains the attribute value in hexadecimal.

Returns: length of formatted string.

Definition at line 1797 of file lpfc_attr.c.

#define lpfc_vport_param_init (   attr,
  default,
  minval,
  maxval 
)
Value:
static int \
lpfc_##attr##_init(struct lpfc_vport *vport, uint val) \
{ \
if (val >= minval && val <= maxval) {\
vport->cfg_##attr = val;\
return 0;\
}\
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \
"0423 lpfc_"#attr" attribute cannot be set to %d, "\
"allowed range is ["#minval", "#maxval"]\n", val); \
vport->cfg_##attr = default;\
return -EINVAL;\
}

lpfc_vport_param_init - Initialize a vport cfg attribute

Description: Macro that given an attr e.g. hba_queue_depth expands into a function with the name lpfc_hba_queue_depth_init. The macro also takes a default argument, a minimum and maximum argument.

lpfc_#attr##_init: validates the min and max values then sets the adapter config field accordingly, or uses the default if out of range and prints an error message. : pointer the the adapter structure. : integer attribute value.

Returns: zero on success -EINVAL if default used

Definition at line 1827 of file lpfc_attr.c.

#define lpfc_vport_param_set (   attr,
  default,
  minval,
  maxval 
)
Value:
static int \
lpfc_##attr##_set(struct lpfc_vport *vport, uint val) \
{ \
if (val >= minval && val <= maxval) {\
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \
"3053 lpfc_" #attr " changed from %d to %d\n", \
vport->cfg_##attr, val); \
vport->cfg_##attr = val;\
return 0;\
}\
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \
"0424 lpfc_"#attr" attribute cannot be set to %d, "\
"allowed range is ["#minval", "#maxval"]\n", val); \
return -EINVAL;\
}

lpfc_vport_param_set - Set a vport cfg attribute

Description: Macro that given an attr e.g. hba_queue_depth expands into a function with the name lpfc_hba_queue_depth_set

lpfc_#attr##_set: validates the min and max values then sets the adapter config field if in the valid range. prints error message and does not set the parameter if invalid. : pointer the the adapter structure. : integer attribute value.

Returns: zero on success -EINVAL if val is invalid

Definition at line 1859 of file lpfc_attr.c.

#define lpfc_vport_param_show (   attr)
Value:
static ssize_t \
lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
uint val = 0;\
val = vport->cfg_##attr;\
return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
}

lpfc_vport_param_show - Return decimal formatted cfg attribute value

Description: Macro that given an attr e.g. hba_queue_depth expands into a function with the name lpfc_hba_queue_depth_show

lpfc_#attr##_show: prints the attribute value in decimal. : class device that is converted into a Scsi_host. : device attribute, not used. : on return contains the attribute value in decimal.

Returns: length of formatted string.

Definition at line 1770 of file lpfc_attr.c.

#define lpfc_vport_param_store (   attr)
Value:
static ssize_t \
lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
uint val = 0;\
if (!isdigit(buf[0]))\
return -EINVAL;\
if (sscanf(buf, "%i", &val) != 1)\
return -EINVAL;\
if (lpfc_##attr##_set(vport, val) == 0) \
return strlen(buf);\
else \
return -EINVAL;\
}

lpfc_vport_param_store - Set a vport attribute

Description: Macro that given an attr e.g. hba_queue_depth expands into a function with the name lpfc_hba_queue_depth_store

lpfc_#attr##_store: convert the ascii text number to an integer, then use the lpfc_#attr##_set function to set the value. : class device that is converted into a Scsi_host. : contains the attribute value in decimal. : not used.

Returns: -EINVAL if val is invalid or lpfc_#attr##_set() fails length of buffer upon success.

Definition at line 1893 of file lpfc_attr.c.

#define MAX_STAT_DATA_SIZE_PER_TARGET   STAT_DATA_SIZE_PER_TARGET(LPFC_MAX_BUCKET_COUNT)

Definition at line 3087 of file lpfc_attr.c.

#define STAT_DATA_SIZE_PER_TARGET (   NUM_BUCKETS)    ((NUM_BUCKETS) * 11 + 18)

Definition at line 3086 of file lpfc_attr.c.

Function Documentation

int lpfc_alloc_sysfs_attr ( struct lpfc_vport vport)

lpfc_alloc_sysfs_attr - Creates the ctlreg and mbox entries : address of lpfc vport structure.

Return codes: zero on success error return code from sysfs_create_bin_file()

Definition at line 4306 of file lpfc_attr.c.

LPFC_ATTR_R ( fcf_failover_policy  ,
,
,
 
)
LPFC_ATTR_R ( suppress_link_up  ,
LPFC_INITIALIZE_LINK  ,
LPFC_INITIALIZE_LINK  ,
LPFC_DELAY_INIT_LINK_INDEFINITELY  ,
"Suppress Link Up at initialization"   
)
LPFC_ATTR_R ( ack0  ,
,
,
,
"Enable ACK0 support  
)
LPFC_ATTR_R ( multi_ring_support  ,
,
,
,
"Determines number of primary ""SLI rings to spread IOCB entries across"   
)
LPFC_ATTR_R ( multi_ring_rctl  ,
FC_RCTL_DD_UNSOL_DATA  ,
,
255  ,
"Identifies RCTL for additional ring configuration"   
)
LPFC_ATTR_R ( multi_ring_type  ,
FC_TYPE_IP  ,
,
255  ,
"Identifies TYPE for additional ring configuration"   
)
LPFC_ATTR_R ( use_msi  ,
,
,
,
"Use Message Signaled Interrupts   1) or ""MSI-X (2,
if possible"   
)
LPFC_ATTR_R ( fcp_wq_count  ,
LPFC_FCP_IO_CHAN_DEF  ,
LPFC_FCP_IO_CHAN_MIN  ,
LPFC_FCP_IO_CHAN_MAX  ,
"Set the number of fast-path FCP work  queues,
if possible"   
)
LPFC_ATTR_R ( fcp_eq_count  ,
LPFC_FCP_IO_CHAN_DEF  ,
LPFC_FCP_IO_CHAN_MIN  ,
LPFC_FCP_IO_CHAN_MAX  ,
"Set the number of fast-path FCP event  queues,
if possible"   
)
LPFC_ATTR_R ( fcp_io_channel  ,
LPFC_FCP_IO_CHAN_DEF  ,
LPFC_FCP_IO_CHAN_MIN  ,
LPFC_FCP_IO_CHAN_MAX  ,
"Set the number of FCP I/O channels  
)
LPFC_ATTR_R ( enable_hba_reset  ,
,
,
,
"Enable HBA resets from the driver."   
)
LPFC_ATTR_R ( enable_hba_heartbeat  ,
,
,
,
"Enable HBA Heartbeat."   
)
LPFC_ATTR_R ( enable_bg  ,
,
,
,
"Enable BlockGuard Support"   
)
LPFC_ATTR_R ( sg_seg_cnt  ,
LPFC_DEFAULT_SG_SEG_CNT  ,
LPFC_DEFAULT_SG_SEG_CNT  ,
LPFC_MAX_SG_SEG_CNT  ,
"Max Scatter Gather Segment Count  
)
LPFC_ATTR_R ( prot_sg_seg_cnt  ,
LPFC_DEFAULT_PROT_SG_SEG_CNT  ,
LPFC_DEFAULT_PROT_SG_SEG_CNT  ,
LPFC_MAX_PROT_SG_SEG_CNT  ,
"Max Protection Scatter Gather Segment Count  
)
LPFC_ATTR_RW ( fcp_io_sched  ,
,
,
,
"Determine scheduling algrithmn for ""issuing commands - Round  Robin[0],
[1] -Current CPU  
)
LPFC_ATTR_RW ( cr_delay  ,
,
,
63  ,
"A count of milliseconds after which an ""interrupt response is generated"   
)
LPFC_ATTR_RW ( cr_count  ,
,
,
255  ,
"A count of I/O completions after which an ""interrupt response is generated"   
)
LPFC_ATTR_RW ( poll_tmo  ,
10  ,
,
255  ,
"Milliseconds driver will wait between polling FCP ring  
)
void lpfc_free_sysfs_attr ( struct lpfc_vport vport)

lpfc_free_sysfs_attr - Removes the ctlreg and mbox entries : address of lpfc vport structure.

Definition at line 4343 of file lpfc_attr.c.

void lpfc_get_cfgparam ( struct lpfc_hba phba)

lpfc_get_cfgparam - Used during probe_one to init the adapter structure : lpfc_hba pointer.

Definition at line 5019 of file lpfc_attr.c.

void lpfc_get_vport_cfgparam ( struct lpfc_vport vport)

lpfc_get_vport_cfgparam - Used during port create, init the vport structure : lpfc_vport pointer.

Definition at line 5065 of file lpfc_attr.c.

lpfc_param_init ( enable_npiv  ,
,
,
 
)
lpfc_param_init ( enable_rrq  ,
,
,
 
)
lpfc_param_init ( iocb_cnt  ,
,
,
 
)
lpfc_param_show ( enable_npiv  )
lpfc_param_show ( enable_rrq  )
lpfc_param_show ( iocb_cnt  )
lpfc_param_show ( lpfc_param_init topology)

Definition at line 2814 of file lpfc_attr.c.

lpfc_param_show ( link_speed  )

Definition at line 3268 of file lpfc_attr.c.

lpfc_param_show ( aer_support  )

Definition at line 3403 of file lpfc_attr.c.

lpfc_param_show ( sriov_nr_virtfn  )

Definition at line 3587 of file lpfc_attr.c.

lpfc_param_show ( fcp_imax  )

Definition at line 3680 of file lpfc_attr.c.

int lpfc_selective_reset ( struct lpfc_hba phba)

lpfc_selective_reset - Offline then onlines the port : lpfc_hba pointer.

Description: If the port is configured to allow a reset then the hba is brought offline then online.

Notes: Assumes any error from lpfc_do_offline() will be negative. Do not make this function static.

Returns: lpfc_do_offline() return code if not zero -EIO reset not configured or error posting the event zero for success

Definition at line 738 of file lpfc_attr.c.

int lpfc_sli4_pdev_status_reg_wait ( struct lpfc_hba phba)

lpfc_sli4_pdev_status_reg_wait - Wait for pdev status register for readyness : lpfc_hba pointer.

Description: SLI4 interface type-2 device to wait on the sliport status register for the readyness after performing a firmware reset.

Returns: zero for success, -EPERM when port does not have privilage to perform the reset, -EIO when port timeout from recovering from the reset.

Note: As the caller will interpret the return code by value, be careful in making change or addition to return codes.

Definition at line 825 of file lpfc_attr.c.

LPFC_VPORT_ATTR ( discovery_threads  ,
32  ,
,
64  ,
"Maximum number of ELS commands ""during discovery"   
)
LPFC_VPORT_ATTR_R ( scan_down  ,
,
,
,
"Start scanning for devices from highest ALPA to lowest"   
)
LPFC_VPORT_ATTR_R ( fcp_class  ,
,
,
,
"Select Fibre Channel class of service for FCP sequences"   
)
LPFC_VPORT_ATTR_R ( max_luns  ,
255  ,
,
65535  ,
"Maximum allowed LUN  
)
LPFC_VPORT_ATTR_RW ( use_adisc  ,
,
,
,
"Use ADISC on rediscovery to authenticate FCP devices  
)
LPFC_VPORT_ATTR_RW ( fdmi_on  ,
,
,
,
"Enable FDMI support  
)
lpfc_vport_param_init ( max_scsicmpl_time  ,
,
,
60000   
)
lpfc_vport_param_show ( max_scsicmpl_time  )
lpfc_vport_param_store ( nodev_tmo  )

Definition at line 2510 of file lpfc_attr.c.

lpfc_vport_param_store ( devloss_tmo  )

Definition at line 2561 of file lpfc_attr.c.

lpfc_vport_param_store ( restrict_login  )
lpfc_vport_param_store ( max_scsicmpl_time  )
module_param ( lpfc_poll  ,
int  ,
S_IRUGO   
)
module_param ( lpfc_sli_mode  ,
int  ,
S_IRUGO   
)
module_param ( lpfc_enable_npiv  ,
int  ,
S_IRUGO   
)
module_param ( lpfc_enable_rrq  ,
int  ,
S_IRUGO   
)
module_param ( lpfc_iocb_cnt  ,
int  ,
S_IRUGO   
)
module_param ( lpfc_nodev_tmo  ,
int  ,
 
)
module_param ( lpfc_topology  ,
int  ,
S_IRUGO   
)
module_param ( lpfc_link_speed  ,
int  ,
S_IRUGO   
)
module_param ( lpfc_aer_support  ,
int  ,
S_IRUGO   
)
module_param ( lpfc_sriov_nr_virtfn  ,
int  ,
S_IRUGO S_IWUSR 
)
module_param ( lpfc_fcp_imax  ,
int  ,
S_IRUGO S_IWUSR 
)
module_param ( lpfc_max_scsicmpl_time  ,
int  ,
S_IRUGO   
)
module_param ( lpfc_fcp_look_ahead  ,
uint  ,
S_IRUGO   
)
module_param ( lpfc_prot_mask  ,
uint  ,
S_IRUGO   
)
module_param ( lpfc_prot_guard  ,
byte  ,
S_IRUGO   
)
module_param ( lpfc_delay_discovery  ,
int  ,
S_IRUGO   
)
MODULE_PARM_DESC ( lpfc_poll  ,
"FCP ring polling mode control:"" 0 -  none,
""1-poll with interrupts enabled""3-poll and disable FCP ring interrupts"   
)
MODULE_PARM_DESC ( lpfc_sli_mode  ,
"SLI mode selector:"" 0 - auto   SLI-3 if supported,
""2-select SLI-2 even on SLI-3 capable  HBAs,
""3-select SLI-3"   
)
MODULE_PARM_DESC ( lpfc_enable_npiv  ,
"Enable NPIV functionality"   
)
MODULE_PARM_DESC ( lpfc_enable_rrq  ,
"Enable RRQ functionality"   
)
MODULE_PARM_DESC ( lpfc_iocb_cnt  ,
"Number of IOCBs alloc for  ELS,
CT  ,
and ABTS:1k to 5k IOCBs"   
)
MODULE_PARM_DESC ( lpfc_nodev_tmo  ,
"Seconds driver will hold I/O waiting ""for a device to come back"   
)
MODULE_PARM_DESC ( lpfc_topology  ,
"Select Fibre Channel topology"   
)
MODULE_PARM_DESC ( lpfc_link_speed  ,
"Select link speed  
)
MODULE_PARM_DESC ( lpfc_aer_support  ,
"Enable PCIe device AER support  
)
MODULE_PARM_DESC ( lpfc_sriov_nr_virtfn  ,
"Enable PCIe device SR-IOV virtual fn  
)
MODULE_PARM_DESC ( lpfc_fcp_imax  ,
"Set the maximum number of FCP interrupts per second per HBA"   
)
MODULE_PARM_DESC ( lpfc_max_scsicmpl_time  ,
"Use command completion time to control queue depth  
)
MODULE_PARM_DESC ( lpfc_fcp_look_ahead  ,
"Look ahead for completions"   
)
MODULE_PARM_DESC ( lpfc_prot_mask  ,
"host protection mask  
)
MODULE_PARM_DESC ( lpfc_prot_guard  ,
"host protection guard type  
)
MODULE_PARM_DESC ( lpfc_delay_discovery  ,
"Delay NPort discovery when Clean Address bit is cleared. ""Allowed values:  0,
1."   
)

Variable Documentation

int lpfc_delay_discovery

Definition at line 3979 of file lpfc_attr.c.

int lpfc_enable_npiv = 1

Definition at line 2295 of file lpfc_attr.c.

int lpfc_enable_rrq

Definition at line 2305 of file lpfc_attr.c.

unsigned int lpfc_fcp_look_ahead = LPFC_LOOK_AHEAD_OFF

Definition at line 3926 of file lpfc_attr.c.

struct device_attribute* lpfc_hba_attrs[]

Definition at line 3998 of file lpfc_attr.c.

int lpfc_iocb_cnt = 2

Definition at line 2367 of file lpfc_attr.c.

unsigned char lpfc_prot_guard = SHOST_DIX_GUARD_IP

Definition at line 3961 of file lpfc_attr.c.

unsigned int lpfc_prot_mask
int lpfc_sli_mode = 0

Definition at line 2288 of file lpfc_attr.c.

struct fc_function_template lpfc_transport_functions

Definition at line 4886 of file lpfc_attr.c.

struct device_attribute* lpfc_vport_attrs[]
Initial value:
= {
&dev_attr_info,
&dev_attr_link_state,
&dev_attr_num_discovered_ports,
&dev_attr_lpfc_drvr_version,
&dev_attr_lpfc_log_verbose,
&dev_attr_lpfc_lun_queue_depth,
&dev_attr_lpfc_tgt_queue_depth,
&dev_attr_lpfc_nodev_tmo,
&dev_attr_lpfc_devloss_tmo,
&dev_attr_lpfc_hba_queue_depth,
&dev_attr_lpfc_peer_port_login,
&dev_attr_lpfc_restrict_login,
&dev_attr_lpfc_fcp_class,
&dev_attr_lpfc_use_adisc,
&dev_attr_lpfc_fdmi_on,
&dev_attr_lpfc_max_luns,
&dev_attr_nport_evt_cnt,
&dev_attr_npiv_info,
&dev_attr_lpfc_enable_da_id,
&dev_attr_lpfc_max_scsicmpl_time,
&dev_attr_lpfc_stat_data_ctrl,
&dev_attr_lpfc_static_vport,
&dev_attr_lpfc_fips_level,
&dev_attr_lpfc_fips_rev,
}

Definition at line 4085 of file lpfc_attr.c.

struct fc_function_template lpfc_vport_transport_functions

Definition at line 4953 of file lpfc_attr.c.