Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions | Variables
scsi_transport_fc.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_fc.h>
#include <scsi/scsi_cmnd.h>
#include <linux/netlink.h>
#include <net/netlink.h>
#include <scsi/scsi_netlink_fc.h>
#include <scsi/scsi_bsg_fc.h>
#include "scsi_priv.h"
#include "scsi_transport_fc_internal.h"

Go to the source code of this file.

Macros

#define FC_DEVICE_ATTR(_prefix, _name, _mode, _show, _store)
 
#define fc_enum_name_search(title, table_type, table)
 
#define fc_enum_name_match(title, table_type, table)
 
#define FC_PORTTYPE_MAX_NAMELEN   50
 
#define get_fc_vport_type_name   get_fc_port_type_name
 
#define FC_HOST_EVENT_CODE_MAX_NAMELEN   30
 
#define FC_PORTSTATE_MAX_NAMELEN   20
 
#define FC_VPORTSTATE_MAX_NAMELEN   24
 
#define get_fc_vport_last_state_name   get_fc_vport_state_name
 
#define FC_BINDTYPE_MAX_NAMELEN   30
 
#define fc_bitfield_name_search(title, table)
 
#define FC_WELLKNOWN_PORTID_MASK   0xfffff0
 
#define FC_WELLKNOWN_ROLE_MASK   0x00000f
 
#define FC_FPORT_PORTID   0x00000e
 
#define FC_FABCTLR_PORTID   0x00000d
 
#define FC_DIRSRVR_PORTID   0x00000c
 
#define FC_TIMESRVR_PORTID   0x00000b
 
#define FC_MGMTSRVR_PORTID   0x00000a
 
#define FC_STARGET_NUM_ATTRS   3
 
#define FC_RPORT_NUM_ATTRS   10
 
#define FC_VPORT_NUM_ATTRS   9
 
#define FC_HOST_NUM_ATTRS   29
 
#define to_fc_internal(tmpl)   container_of(tmpl, struct fc_internal, t)
 
#define fc_rport_show_function(field, format_string, sz, cast)
 
#define fc_rport_store_function(field)
 
#define fc_rport_rd_attr(field, format_string, sz)
 
#define fc_rport_rd_attr_cast(field, format_string, sz, cast)
 
#define fc_rport_rw_attr(field, format_string, sz)
 
#define fc_private_rport_show_function(field, format_string, sz, cast)
 
#define fc_private_rport_rd_attr(field, format_string, sz)
 
#define fc_private_rport_rd_attr_cast(field, format_string, sz, cast)
 
#define fc_private_rport_rd_enum_attr(title, maxlen)
 
#define SETUP_RPORT_ATTRIBUTE_RD(field)
 
#define SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(field)
 
#define SETUP_RPORT_ATTRIBUTE_RW(field)
 
#define SETUP_PRIVATE_RPORT_ATTRIBUTE_RW(field)
 
#define fc_starget_show_function(field, format_string, sz, cast)
 
#define fc_starget_rd_attr(field, format_string, sz)
 
#define fc_starget_rd_attr_cast(field, format_string, sz, cast)
 
#define SETUP_STARGET_ATTRIBUTE_RD(field)
 
#define SETUP_STARGET_ATTRIBUTE_RW(field)
 
#define fc_vport_show_function(field, format_string, sz, cast)
 
#define fc_vport_store_function(field)
 
#define fc_vport_store_str_function(field, slen)
 
#define fc_vport_rd_attr(field, format_string, sz)
 
#define fc_vport_rd_attr_cast(field, format_string, sz, cast)
 
#define fc_vport_rw_attr(field, format_string, sz)
 
#define fc_private_vport_show_function(field, format_string, sz, cast)
 
#define fc_private_vport_store_u32_function(field)
 
#define fc_private_vport_rd_attr(field, format_string, sz)
 
#define fc_private_vport_rd_attr_cast(field, format_string, sz, cast)
 
#define fc_private_vport_rw_u32_attr(field, format_string, sz)
 
#define fc_private_vport_rd_enum_attr(title, maxlen)
 
#define SETUP_VPORT_ATTRIBUTE_RD(field)
 
#define SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(field)
 
#define SETUP_VPORT_ATTRIBUTE_WR(field)
 
#define SETUP_VPORT_ATTRIBUTE_RW(field)
 
#define SETUP_PRIVATE_VPORT_ATTRIBUTE_RW(field)
 
#define fc_host_show_function(field, format_string, sz, cast)
 
#define fc_host_store_function(field)
 
#define fc_host_store_str_function(field, slen)
 
#define fc_host_rd_attr(field, format_string, sz)
 
#define fc_host_rd_attr_cast(field, format_string, sz, cast)
 
#define fc_host_rw_attr(field, format_string, sz)
 
#define fc_host_rd_enum_attr(title, maxlen)
 
#define SETUP_HOST_ATTRIBUTE_RD(field)
 
#define SETUP_HOST_ATTRIBUTE_RD_NS(field)
 
#define SETUP_HOST_ATTRIBUTE_RW(field)
 
#define fc_private_host_show_function(field, format_string, sz, cast)
 
#define fc_private_host_rd_attr(field, format_string, sz)
 
#define fc_private_host_rd_attr_cast(field, format_string, sz, cast)
 
#define SETUP_PRIVATE_HOST_ATTRIBUTE_RD(field)
 
#define SETUP_PRIVATE_HOST_ATTRIBUTE_RW(field)
 
#define get_list_head_entry(pos, head, member)   pos = list_entry((head)->next, typeof(*pos), member)
 
#define fc_host_statistic(name)
 

Enumerations

enum  fc_dispatch_result { FC_DISPATCH_BREAK, FC_DISPATCH_LOCKED, FC_DISPATCH_UNLOCKED }
 

Functions

 module_param_named (dev_loss_tmo, fc_dev_loss_tmo, uint, S_IRUGO|S_IWUSR)
 
 MODULE_PARM_DESC (dev_loss_tmo,"Maximum number of seconds that the FC transport should"" insulate the loss of a remote port. Once this value is"" exceeded, the scsi target is removed. Value should be"" between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT if"" fast_io_fail_tmo is not set.")
 
 fc_enum_name_search (port_type, fc_port_type, fc_port_type_names)
 
 fc_enum_name_search (host_event_code, fc_host_event_code, fc_host_event_code_names)
 
 fc_enum_name_search (port_state, fc_port_state, fc_port_state_names)
 
 fc_enum_name_search (vport_state, fc_vport_state, fc_vport_state_names)
 
 fc_enum_name_search (fc_enum_name_match(tgtid_bind_type, fc_enum_name_match(fc_tgtid_binding_type, fc_tgtid_binding_type_names)
 
 fc_bitfield_name_search (cos, fc_cos_names)
 
 fc_bitfield_name_search (port_speed, fc_port_speed_names)
 
 fc_bitfield_name_search (port_roles, fc_port_role_names)
 
u32 fc_get_event_number (void)
 
 EXPORT_SYMBOL (fc_get_event_number)
 
void fc_host_post_event (struct Scsi_Host *shost, u32 event_number, enum fc_host_event_code event_code, u32 event_data)
 
 EXPORT_SYMBOL (fc_host_post_event)
 
void fc_host_post_vendor_event (struct Scsi_Host *shost, u32 event_number, u32 data_len, char *data_buf, u64 vendor_id)
 
 EXPORT_SYMBOL (fc_host_post_vendor_event)
 
 fc_private_rport_rd_attr (maxframe_size,"%u bytes\n", 20)
 
 fc_rport_show_function (dev_loss_tmo,"%d\n", 20)
 
 fc_private_rport_rd_attr_cast (node_name,"0x%llx\n", 20, unsigned long long)
 
 fc_private_rport_rd_attr_cast (port_name,"0x%llx\n", 20, unsigned long long)
 
 fc_private_rport_rd_attr (port_id,"0x%06x\n", 20)
 
 fc_private_rport_rd_enum_attr (port_state, FC_PORTSTATE_MAX_NAMELEN)
 
 fc_private_rport_rd_attr (scsi_target_id,"%d\n", 20)
 
 fc_starget_rd_attr_cast (node_name,"0x%llx\n", 20, unsigned long long)
 
 fc_starget_rd_attr_cast (port_name,"0x%llx\n", 20, unsigned long long)
 
 fc_starget_rd_attr (port_id,"0x%06x\n", 20)
 
 fc_private_vport_rd_enum_attr (vport_state, FC_VPORTSTATE_MAX_NAMELEN)
 
 fc_private_vport_rd_enum_attr (vport_last_state, FC_VPORTSTATE_MAX_NAMELEN)
 
 fc_private_vport_rd_attr_cast (node_name,"0x%llx\n", 20, unsigned long long)
 
 fc_private_vport_rd_attr_cast (port_name,"0x%llx\n", 20, unsigned long long)
 
 fc_private_vport_rd_enum_attr (vport_type, FC_PORTTYPE_MAX_NAMELEN)
 
 fc_private_vport_show_function (symbolic_name,"%s\n", FC_VPORT_SYMBOLIC_NAMELEN+1,) fc_vport_store_str_function(symbolic_name
 
 fc_private_host_rd_attr_cast (node_name,"0x%llx\n", 20, unsigned long long)
 
 fc_private_host_rd_attr_cast (port_name,"0x%llx\n", 20, unsigned long long)
 
 fc_private_host_rd_attr_cast (permanent_port_name,"0x%llx\n", 20, unsigned long long)
 
 fc_private_host_rd_attr (maxframe_size,"%u bytes\n", 20)
 
 fc_private_host_rd_attr (max_npiv_vports,"%u\n", 20)
 
 fc_private_host_rd_attr (serial_number,"%s\n",(FC_SERIAL_NUMBER_SIZE+1))
 
 fc_private_host_rd_attr (manufacturer,"%s\n", FC_SERIAL_NUMBER_SIZE+1)
 
 fc_private_host_rd_attr (model,"%s\n", FC_SYMBOLIC_NAME_SIZE+1)
 
 fc_private_host_rd_attr (model_description,"%s\n", FC_SYMBOLIC_NAME_SIZE+1)
 
 fc_private_host_rd_attr (hardware_version,"%s\n", FC_VERSION_STRING_SIZE+1)
 
 fc_private_host_rd_attr (driver_version,"%s\n", FC_VERSION_STRING_SIZE+1)
 
 fc_private_host_rd_attr (firmware_version,"%s\n", FC_VERSION_STRING_SIZE+1)
 
 fc_private_host_rd_attr (optionrom_version,"%s\n", FC_VERSION_STRING_SIZE+1)
 
 fc_host_rd_attr (port_id,"0x%06x\n", 20)
 
 fc_host_rd_enum_attr (port_type, FC_PORTTYPE_MAX_NAMELEN)
 
 fc_host_rd_enum_attr (port_state, FC_PORTSTATE_MAX_NAMELEN)
 
 fc_host_rd_attr_cast (fabric_name,"0x%llx\n", 20, unsigned long long)
 
 fc_host_rd_attr (symbolic_name,"%s\n", FC_SYMBOLIC_NAME_SIZE+1)
 
 fc_private_host_show_function (system_hostname,"%s\n", FC_SYMBOLIC_NAME_SIZE+1,) fc_host_store_str_function(system_hostname
 
 fc_private_host_show_function (dev_loss_tmo,"%d\n", 20,)
 
 fc_private_host_rd_attr (npiv_vports_inuse,"%u\n", 20)
 
 fc_host_statistic (seconds_since_last_reset)
 
 fc_host_statistic (tx_frames)
 
 fc_host_statistic (tx_words)
 
 fc_host_statistic (rx_frames)
 
 fc_host_statistic (rx_words)
 
 fc_host_statistic (lip_count)
 
 fc_host_statistic (nos_count)
 
 fc_host_statistic (error_frames)
 
 fc_host_statistic (dumped_frames)
 
 fc_host_statistic (link_failure_count)
 
 fc_host_statistic (loss_of_sync_count)
 
 fc_host_statistic (loss_of_signal_count)
 
 fc_host_statistic (prim_seq_protocol_err_count)
 
 fc_host_statistic (invalid_tx_word_count)
 
 fc_host_statistic (invalid_crc_count)
 
 fc_host_statistic (fcp_input_requests)
 
 fc_host_statistic (fcp_output_requests)
 
 fc_host_statistic (fcp_control_requests)
 
 fc_host_statistic (fcp_input_megabytes)
 
 fc_host_statistic (fcp_output_megabytes)
 
 fc_host_statistic (fcp_packet_alloc_failures)
 
 fc_host_statistic (fcp_packet_aborts)
 
 fc_host_statistic (fcp_frame_alloc_failures)
 
 fc_host_statistic (fc_no_free_exch)
 
 fc_host_statistic (fc_no_free_exch_xid)
 
 fc_host_statistic (fc_xid_not_found)
 
 fc_host_statistic (fc_xid_busy)
 
 fc_host_statistic (fc_seq_not_found)
 
 fc_host_statistic (fc_non_bls_resp)
 
int scsi_is_fc_rport (const struct device *dev)
 
 EXPORT_SYMBOL (scsi_is_fc_rport)
 
int scsi_is_fc_vport (const struct device *dev)
 
 EXPORT_SYMBOL (scsi_is_fc_vport)
 
struct scsi_transport_templatefc_attach_transport (struct fc_function_template *ft)
 
 EXPORT_SYMBOL (fc_attach_transport)
 
void fc_release_transport (struct scsi_transport_template *t)
 
 EXPORT_SYMBOL (fc_release_transport)
 
void fc_remove_host (struct Scsi_Host *shost)
 
 EXPORT_SYMBOL (fc_remove_host)
 
struct fc_rportfc_remote_port_add (struct Scsi_Host *shost, int channel, struct fc_rport_identifiers *ids)
 
 EXPORT_SYMBOL (fc_remote_port_add)
 
void fc_remote_port_delete (struct fc_rport *rport)
 
 EXPORT_SYMBOL (fc_remote_port_delete)
 
void fc_remote_port_rolechg (struct fc_rport *rport, u32 roles)
 
 EXPORT_SYMBOL (fc_remote_port_rolechg)
 
int fc_block_scsi_eh (struct scsi_cmnd *cmnd)
 
 EXPORT_SYMBOL (fc_block_scsi_eh)
 
struct fc_vportfc_vport_create (struct Scsi_Host *shost, int channel, struct fc_vport_identifiers *ids)
 
 EXPORT_SYMBOL (fc_vport_create)
 
int fc_vport_terminate (struct fc_vport *vport)
 
 EXPORT_SYMBOL (fc_vport_terminate)
 
 MODULE_AUTHOR ("James Smart")
 
 MODULE_DESCRIPTION ("FC Transport Attributes")
 
 MODULE_LICENSE ("GPL")
 
 module_init (fc_transport_init)
 
 module_exit (fc_transport_exit)
 

Variables

 fc_host_event_code_names []
 
 fc_port_state_names []
 
 fc_vport_state_names []
 
 fc_tgtid_binding_type_names []
 
 fc_cos_names []
 
 fc_port_speed_names []
 

Macro Definition Documentation

#define FC_BINDTYPE_MAX_NAMELEN   30
#define fc_bitfield_name_search (   title,
  table 
)
Value:
static ssize_t \
get_fc_##title##_names(u32 table_key, char *buf) \
{ \
char *prefix = ""; \
ssize_t len = 0; \
int i; \
for (i = 0; i < ARRAY_SIZE(table); i++) { \
if (table[i].value & table_key) { \
len += sprintf(buf + len, "%s%s", \
prefix, table[i].name); \
prefix = ", "; \
} \
} \
len += sprintf(buf + len, "\n"); \
return len; \
}
#define FC_DEVICE_ATTR (   _prefix,
  _name,
  _mode,
  _show,
  _store 
)
Value:
struct device_attribute device_attr_##_prefix##_##_name = \
__ATTR(_name,_mode,_show,_store)

Definition at line 78 of file scsi_transport_fc.c.

#define FC_DIRSRVR_PORTID   0x00000c
#define fc_enum_name_match (   title,
  table_type,
  table 
)
Value:
static int get_fc_##title##_match(const char *table_key, \
enum table_type *value) \
{ \
int i; \
for (i = 0; i < ARRAY_SIZE(table); i++) { \
if (strncmp(table_key, table[i].name, \
table[i].matchlen) == 0) { \
*value = table[i].value; \
return 0; /* success */ \
} \
} \
return 1; /* failure */ \
}

Definition at line 97 of file scsi_transport_fc.c.

#define fc_enum_name_search (   title,
  table_type,
  table 
)
Value:
static const char *get_fc_##title##_name(enum table_type table_key) \
{ \
int i; \
char *name = NULL; \
for (i = 0; i < ARRAY_SIZE(table); i++) { \
if (table[i].value == table_key) { \
name = table[i].name; \
break; \
} \
} \
return name; \
}

Definition at line 82 of file scsi_transport_fc.c.

#define FC_FABCTLR_PORTID   0x00000d
#define FC_FPORT_PORTID   0x00000e
#define FC_HOST_EVENT_CODE_MAX_NAMELEN   30
#define FC_HOST_NUM_ATTRS   29
#define fc_host_rd_attr (   field,
  format_string,
  sz 
)
Value:
fc_host_show_function(field, format_string, sz, ) \
show_fc_host_##field, NULL)

Definition at line 1388 of file scsi_transport_fc.c.

#define fc_host_rd_attr_cast (   field,
  format_string,
  sz,
  cast 
)
Value:
fc_host_show_function(field, format_string, sz, (cast)) \
show_fc_host_##field, NULL)

Definition at line 1393 of file scsi_transport_fc.c.

#define fc_host_rd_enum_attr (   title,
  maxlen 
)
Value:
static ssize_t \
show_fc_host_##title (struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct fc_internal *i = to_fc_internal(shost->transportt); \
const char *name; \
if (i->f->get_host_##title) \
i->f->get_host_##title(shost); \
name = get_fc_##title##_name(fc_host_##title(shost)); \
if (!name) \
return -EINVAL; \
return snprintf(buf, maxlen, "%s\n", name); \
} \
static FC_DEVICE_ATTR(host, title, S_IRUGO, show_fc_host_##title, NULL)

Definition at line 1405 of file scsi_transport_fc.c.

#define fc_host_rw_attr (   field,
  format_string,
  sz 
)
Value:
fc_host_show_function(field, format_string, sz, ) \
fc_host_store_function(field) \
show_fc_host_##field, \
store_fc_host_##field)

Definition at line 1398 of file scsi_transport_fc.c.

#define fc_host_show_function (   field,
  format_string,
  sz,
  cast 
)
Value:
static ssize_t \
show_fc_host_##field (struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct fc_internal *i = to_fc_internal(shost->transportt); \
if (i->f->get_host_##field) \
i->f->get_host_##field(shost); \
return snprintf(buf, sz, format_string, cast fc_host_##field(shost)); \
}

Definition at line 1338 of file scsi_transport_fc.c.

#define fc_host_statistic (   name)
Value:
static ssize_t show_fcstat_##name(struct device *cd, \
char *buf) \
{ \
return fc_stat_show(cd, buf, \
} \
static FC_DEVICE_ATTR(host, name, S_IRUGO, show_fcstat_##name, NULL)

Definition at line 1717 of file scsi_transport_fc.c.

#define fc_host_store_function (   field)
Value:
static ssize_t \
store_fc_host_##field(struct device *dev, \
const char *buf, size_t count) \
{ \
int val; \
struct fc_internal *i = to_fc_internal(shost->transportt); \
char *cp; \
\
val = simple_strtoul(buf, &cp, 0); \
if (*cp && (*cp != '\n')) \
return -EINVAL; \
i->f->set_host_##field(shost, val); \
return count; \
}

Definition at line 1350 of file scsi_transport_fc.c.

#define fc_host_store_str_function (   field,
  slen 
)
Value:
static ssize_t \
store_fc_host_##field(struct device *dev, \
const char *buf, size_t count) \
{ \
struct fc_internal *i = to_fc_internal(shost->transportt); \
unsigned int cnt=count; \
\
/* count may include a LF at end of string */ \
if (buf[cnt-1] == '\n') \
cnt--; \
if (cnt > ((slen) - 1)) \
return -EINVAL; \
memcpy(fc_host_##field(shost), buf, cnt); \
i->f->set_host_##field(shost); \
return count; \
}

Definition at line 1368 of file scsi_transport_fc.c.

#define FC_MGMTSRVR_PORTID   0x00000a
#define FC_PORTSTATE_MAX_NAMELEN   20
#define FC_PORTTYPE_MAX_NAMELEN   50
#define fc_private_host_rd_attr (   field,
  format_string,
  sz 
)
Value:
fc_private_host_show_function(field, format_string, sz, ) \
show_fc_host_##field, NULL)

Definition at line 1457 of file scsi_transport_fc.c.

#define fc_private_host_rd_attr_cast (   field,
  format_string,
  sz,
  cast 
)
Value:
fc_private_host_show_function(field, format_string, sz, (cast)) \
show_fc_host_##field, NULL)

Definition at line 1462 of file scsi_transport_fc.c.

#define fc_private_host_show_function (   field,
  format_string,
  sz,
  cast 
)
Value:
static ssize_t \
show_fc_host_##field (struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
return snprintf(buf, sz, format_string, cast fc_host_##field(shost)); \
}

Definition at line 1448 of file scsi_transport_fc.c.

#define fc_private_rport_rd_attr (   field,
  format_string,
  sz 
)
Value:
fc_private_rport_show_function(field, format_string, sz, ) \
show_fc_rport_##field, NULL)

Definition at line 764 of file scsi_transport_fc.c.

#define fc_private_rport_rd_attr_cast (   field,
  format_string,
  sz,
  cast 
)
Value:
fc_private_rport_show_function(field, format_string, sz, (cast)) \
show_fc_rport_##field, NULL)

Definition at line 769 of file scsi_transport_fc.c.

#define fc_private_rport_rd_enum_attr (   title,
  maxlen 
)
Value:
static ssize_t \
show_fc_rport_##title (struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
const char *name; \
name = get_fc_##title##_name(rport->title); \
if (!name) \
return -EINVAL; \
return snprintf(buf, maxlen, "%s\n", name); \
} \
static FC_DEVICE_ATTR(rport, title, S_IRUGO, \
show_fc_rport_##title, NULL)

Definition at line 775 of file scsi_transport_fc.c.

#define fc_private_rport_show_function (   field,
  format_string,
  sz,
  cast 
)
Value:
static ssize_t \
show_fc_rport_##field (struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
return snprintf(buf, sz, format_string, cast rport->field); \
}

Definition at line 755 of file scsi_transport_fc.c.

#define fc_private_vport_rd_attr (   field,
  format_string,
  sz 
)
Value:
fc_private_vport_show_function(field, format_string, sz, ) \
show_fc_vport_##field, NULL)

Definition at line 1169 of file scsi_transport_fc.c.

#define fc_private_vport_rd_attr_cast (   field,
  format_string,
  sz,
  cast 
)
Value:
fc_private_vport_show_function(field, format_string, sz, (cast)) \
show_fc_vport_##field, NULL)

Definition at line 1174 of file scsi_transport_fc.c.

#define fc_private_vport_rd_enum_attr (   title,
  maxlen 
)
Value:
static ssize_t \
show_fc_vport_##title (struct device *dev, \
char *buf) \
{ \
const char *name; \
name = get_fc_##title##_name(vport->title); \
if (!name) \
return -EINVAL; \
return snprintf(buf, maxlen, "%s\n", name); \
} \
static FC_DEVICE_ATTR(vport, title, S_IRUGO, \
show_fc_vport_##title, NULL)

Definition at line 1187 of file scsi_transport_fc.c.

#define fc_private_vport_rw_u32_attr (   field,
  format_string,
  sz 
)
Value:
fc_private_vport_show_function(field, format_string, sz, ) \
fc_private_vport_store_u32_function(field) \
show_fc_vport_##field, \
store_fc_vport_##field)

Definition at line 1179 of file scsi_transport_fc.c.

#define fc_private_vport_show_function (   field,
  format_string,
  sz,
  cast 
)
Value:
static ssize_t \
show_fc_vport_##field (struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
return snprintf(buf, sz, format_string, cast vport->field); \
}

Definition at line 1141 of file scsi_transport_fc.c.

#define fc_private_vport_store_u32_function (   field)
Value:
static ssize_t \
store_fc_vport_##field(struct device *dev, \
const char *buf, size_t count) \
{ \
char *cp; \
if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) \
return -EBUSY; \
val = simple_strtoul(buf, &cp, 0); \
if (*cp && (*cp != '\n')) \
return -EINVAL; \
vport->field = val; \
return count; \
}

Definition at line 1150 of file scsi_transport_fc.c.

#define FC_RPORT_NUM_ATTRS   10
#define fc_rport_rd_attr (   field,
  format_string,
  sz 
)
Value:
fc_rport_show_function(field, format_string, sz, ) \
show_fc_rport_##field, NULL)

Definition at line 737 of file scsi_transport_fc.c.

#define fc_rport_rd_attr_cast (   field,
  format_string,
  sz,
  cast 
)
Value:
fc_rport_show_function(field, format_string, sz, (cast)) \
show_fc_rport_##field, NULL)

Definition at line 742 of file scsi_transport_fc.c.

#define fc_rport_rw_attr (   field,
  format_string,
  sz 
)
Value:
fc_rport_show_function(field, format_string, sz, ) \
fc_rport_store_function(field) \
show_fc_rport_##field, \
store_fc_rport_##field)

Definition at line 747 of file scsi_transport_fc.c.

#define fc_rport_show_function (   field,
  format_string,
  sz,
  cast 
)
Value:
static ssize_t \
show_fc_rport_##field (struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct fc_internal *i = to_fc_internal(shost->transportt); \
if ((i->f->get_rport_##field) && \
!((rport->port_state == FC_PORTSTATE_BLOCKED) || \
(rport->port_state == FC_PORTSTATE_DELETED) || \
(rport->port_state == FC_PORTSTATE_NOTPRESENT))) \
i->f->get_rport_##field(rport); \
return snprintf(buf, sz, format_string, cast rport->field); \
}

Definition at line 699 of file scsi_transport_fc.c.

#define fc_rport_store_function (   field)
Value:
static ssize_t \
store_fc_rport_##field(struct device *dev, \
const char *buf, size_t count) \
{ \
int val; \
struct fc_internal *i = to_fc_internal(shost->transportt); \
char *cp; \
if ((rport->port_state == FC_PORTSTATE_BLOCKED) || \
(rport->port_state == FC_PORTSTATE_DELETED) || \
(rport->port_state == FC_PORTSTATE_NOTPRESENT)) \
return -EBUSY; \
val = simple_strtoul(buf, &cp, 0); \
if (*cp && (*cp != '\n')) \
return -EINVAL; \
i->f->set_rport_##field(rport, val); \
return count; \
}

Definition at line 715 of file scsi_transport_fc.c.

#define FC_STARGET_NUM_ATTRS   3
#define fc_starget_rd_attr (   field,
  format_string,
  sz 
)
Value:
fc_starget_show_function(field, format_string, sz, ) \
static FC_DEVICE_ATTR(starget, field, S_IRUGO, \
show_fc_starget_##field, NULL)

Definition at line 1031 of file scsi_transport_fc.c.

#define fc_starget_rd_attr_cast (   field,
  format_string,
  sz,
  cast 
)
Value:
fc_starget_show_function(field, format_string, sz, (cast)) \
static FC_DEVICE_ATTR(starget, field, S_IRUGO, \
show_fc_starget_##field, NULL)

Definition at line 1036 of file scsi_transport_fc.c.

#define fc_starget_show_function (   field,
  format_string,
  sz,
  cast 
)
Value:
static ssize_t \
show_fc_starget_##field (struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \
struct fc_internal *i = to_fc_internal(shost->transportt); \
if (rport) \
fc_starget_##field(starget) = rport->field; \
else if (i->f->get_starget_##field) \
i->f->get_starget_##field(starget); \
return snprintf(buf, sz, format_string, \
cast fc_starget_##field(starget)); \
}

Definition at line 1014 of file scsi_transport_fc.c.

#define FC_TIMESRVR_PORTID   0x00000b
#define FC_VPORT_NUM_ATTRS   9
#define fc_vport_rd_attr (   field,
  format_string,
  sz 
)
Value:
fc_vport_show_function(field, format_string, sz, ) \
show_fc_vport_##field, NULL)

Definition at line 1124 of file scsi_transport_fc.c.

#define fc_vport_rd_attr_cast (   field,
  format_string,
  sz,
  cast 
)
Value:
fc_vport_show_function(field, format_string, sz, (cast)) \
show_fc_vport_##field, NULL)

Definition at line 1129 of file scsi_transport_fc.c.

#define fc_vport_rw_attr (   field,
  format_string,
  sz 
)
Value:
fc_vport_show_function(field, format_string, sz, ) \
fc_vport_store_function(field) \
show_fc_vport_##field, \
store_fc_vport_##field)

Definition at line 1134 of file scsi_transport_fc.c.

#define fc_vport_show_function (   field,
  format_string,
  sz,
  cast 
)
Value:
static ssize_t \
show_fc_vport_##field (struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct fc_internal *i = to_fc_internal(shost->transportt); \
if ((i->f->get_vport_##field) && \
!(vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING))) \
i->f->get_vport_##field(vport); \
return snprintf(buf, sz, format_string, cast vport->field); \
}

Definition at line 1069 of file scsi_transport_fc.c.

#define fc_vport_store_function (   field)
Value:
static ssize_t \
store_fc_vport_##field(struct device *dev, \
const char *buf, size_t count) \
{ \
int val; \
struct fc_internal *i = to_fc_internal(shost->transportt); \
char *cp; \
if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) \
return -EBUSY; \
val = simple_strtoul(buf, &cp, 0); \
if (*cp && (*cp != '\n')) \
return -EINVAL; \
i->f->set_vport_##field(vport, val); \
return count; \
}

Definition at line 1083 of file scsi_transport_fc.c.

#define fc_vport_store_str_function (   field,
  slen 
)
Value:
static ssize_t \
store_fc_vport_##field(struct device *dev, \
const char *buf, size_t count) \
{ \
struct fc_internal *i = to_fc_internal(shost->transportt); \
unsigned int cnt=count; \
\
/* count may include a LF at end of string */ \
if (buf[cnt-1] == '\n') \
cnt--; \
if (cnt > ((slen) - 1)) \
return -EINVAL; \
memcpy(vport->field, buf, cnt); \
i->f->set_vport_##field(vport); \
return count; \
}

Definition at line 1103 of file scsi_transport_fc.c.

#define FC_VPORTSTATE_MAX_NAMELEN   24
#define FC_WELLKNOWN_PORTID_MASK   0xfffff0
#define FC_WELLKNOWN_ROLE_MASK   0x00000f
#define get_fc_vport_last_state_name   get_fc_vport_state_name
#define get_fc_vport_type_name   get_fc_port_type_name
#define get_list_head_entry (   pos,
  head,
  member 
)    pos = list_entry((head)->next, typeof(*pos), member)

Definition at line 1603 of file scsi_transport_fc.c.

#define SETUP_HOST_ATTRIBUTE_RD (   field)
Value:
i->private_host_attrs[count] = device_attr_host_##field; \
i->private_host_attrs[count].attr.mode = S_IRUGO; \
i->private_host_attrs[count].store = NULL; \
i->host_attrs[count] = &i->private_host_attrs[count]; \
if (i->f->show_host_##field) \
count++

Definition at line 1422 of file scsi_transport_fc.c.

#define SETUP_HOST_ATTRIBUTE_RD_NS (   field)
Value:
i->private_host_attrs[count] = device_attr_host_##field; \
i->private_host_attrs[count].attr.mode = S_IRUGO; \
i->private_host_attrs[count].store = NULL; \
i->host_attrs[count] = &i->private_host_attrs[count]; \
count++

Definition at line 1430 of file scsi_transport_fc.c.

#define SETUP_HOST_ATTRIBUTE_RW (   field)
Value:
i->private_host_attrs[count] = device_attr_host_##field; \
if (!i->f->set_host_##field) { \
i->private_host_attrs[count].attr.mode = S_IRUGO; \
i->private_host_attrs[count].store = NULL; \
} \
i->host_attrs[count] = &i->private_host_attrs[count]; \
if (i->f->show_host_##field) \
count++

Definition at line 1437 of file scsi_transport_fc.c.

#define SETUP_PRIVATE_HOST_ATTRIBUTE_RD (   field)
Value:
i->private_host_attrs[count] = device_attr_host_##field; \
i->private_host_attrs[count].attr.mode = S_IRUGO; \
i->private_host_attrs[count].store = NULL; \
i->host_attrs[count] = &i->private_host_attrs[count]; \
count++

Definition at line 1467 of file scsi_transport_fc.c.

#define SETUP_PRIVATE_HOST_ATTRIBUTE_RW (   field)
Value:
{ \
i->private_host_attrs[count] = device_attr_host_##field; \
i->host_attrs[count] = &i->private_host_attrs[count]; \
count++; \
}

Definition at line 1474 of file scsi_transport_fc.c.

#define SETUP_PRIVATE_RPORT_ATTRIBUTE_RD (   field)
Value:
i->private_rport_attrs[count] = device_attr_rport_##field; \
i->private_rport_attrs[count].attr.mode = S_IRUGO; \
i->private_rport_attrs[count].store = NULL; \
i->rport_attrs[count] = &i->private_rport_attrs[count]; \
count++

Definition at line 799 of file scsi_transport_fc.c.

#define SETUP_PRIVATE_RPORT_ATTRIBUTE_RW (   field)
Value:
{ \
i->private_rport_attrs[count] = device_attr_rport_##field; \
i->rport_attrs[count] = &i->private_rport_attrs[count]; \
count++; \
}

Definition at line 816 of file scsi_transport_fc.c.

#define SETUP_PRIVATE_VPORT_ATTRIBUTE_RD (   field)
Value:
i->private_vport_attrs[count] = device_attr_vport_##field; \
i->private_vport_attrs[count].attr.mode = S_IRUGO; \
i->private_vport_attrs[count].store = NULL; \
i->vport_attrs[count] = &i->private_vport_attrs[count]; \
count++

Definition at line 1213 of file scsi_transport_fc.c.

#define SETUP_PRIVATE_VPORT_ATTRIBUTE_RW (   field)
Value:
{ \
i->private_vport_attrs[count] = device_attr_vport_##field; \
i->vport_attrs[count] = &i->private_vport_attrs[count]; \
count++; \
}

Definition at line 1237 of file scsi_transport_fc.c.

#define SETUP_RPORT_ATTRIBUTE_RD (   field)
Value:
i->private_rport_attrs[count] = device_attr_rport_##field; \
i->private_rport_attrs[count].attr.mode = S_IRUGO; \
i->private_rport_attrs[count].store = NULL; \
i->rport_attrs[count] = &i->private_rport_attrs[count]; \
if (i->f->show_rport_##field) \
count++

Definition at line 791 of file scsi_transport_fc.c.

#define SETUP_RPORT_ATTRIBUTE_RW (   field)
Value:
i->private_rport_attrs[count] = device_attr_rport_##field; \
if (!i->f->set_rport_##field) { \
i->private_rport_attrs[count].attr.mode = S_IRUGO; \
i->private_rport_attrs[count].store = NULL; \
} \
i->rport_attrs[count] = &i->private_rport_attrs[count]; \
if (i->f->show_rport_##field) \
count++

Definition at line 806 of file scsi_transport_fc.c.

#define SETUP_STARGET_ATTRIBUTE_RD (   field)
Value:
i->private_starget_attrs[count] = device_attr_starget_##field; \
i->private_starget_attrs[count].attr.mode = S_IRUGO; \
i->private_starget_attrs[count].store = NULL; \
i->starget_attrs[count] = &i->private_starget_attrs[count]; \
if (i->f->show_starget_##field) \
count++

Definition at line 1041 of file scsi_transport_fc.c.

#define SETUP_STARGET_ATTRIBUTE_RW (   field)
Value:
i->private_starget_attrs[count] = device_attr_starget_##field; \
if (!i->f->set_starget_##field) { \
i->private_starget_attrs[count].attr.mode = S_IRUGO; \
i->private_starget_attrs[count].store = NULL; \
} \
i->starget_attrs[count] = &i->private_starget_attrs[count]; \
if (i->f->show_starget_##field) \
count++

Definition at line 1049 of file scsi_transport_fc.c.

#define SETUP_VPORT_ATTRIBUTE_RD (   field)
Value:
i->private_vport_attrs[count] = device_attr_vport_##field; \
i->private_vport_attrs[count].attr.mode = S_IRUGO; \
i->private_vport_attrs[count].store = NULL; \
i->vport_attrs[count] = &i->private_vport_attrs[count]; \
if (i->f->get_##field) \
count++

Definition at line 1204 of file scsi_transport_fc.c.

#define SETUP_VPORT_ATTRIBUTE_RW (   field)
Value:
i->private_vport_attrs[count] = device_attr_vport_##field; \
if (!i->f->set_vport_##field) { \
i->private_vport_attrs[count].attr.mode = S_IRUGO; \
i->private_vport_attrs[count].store = NULL; \
} \
i->vport_attrs[count] = &i->private_vport_attrs[count]; \
count++

Definition at line 1227 of file scsi_transport_fc.c.

#define SETUP_VPORT_ATTRIBUTE_WR (   field)
Value:
i->private_vport_attrs[count] = device_attr_vport_##field; \
i->vport_attrs[count] = &i->private_vport_attrs[count]; \
if (i->f->field) \
count++

Definition at line 1220 of file scsi_transport_fc.c.

#define to_fc_internal (   tmpl)    container_of(tmpl, struct fc_internal, t)

Definition at line 348 of file scsi_transport_fc.c.

Enumeration Type Documentation

Enumerator:
FC_DISPATCH_BREAK 
FC_DISPATCH_LOCKED 
FC_DISPATCH_UNLOCKED 

Definition at line 3773 of file scsi_transport_fc.c.

Function Documentation

EXPORT_SYMBOL ( fc_get_event_number  )
EXPORT_SYMBOL ( fc_host_post_event  )
EXPORT_SYMBOL ( fc_host_post_vendor_event  )
EXPORT_SYMBOL ( scsi_is_fc_rport  )
EXPORT_SYMBOL ( scsi_is_fc_vport  )
EXPORT_SYMBOL ( fc_attach_transport  )
EXPORT_SYMBOL ( fc_release_transport  )
EXPORT_SYMBOL ( fc_remove_host  )
EXPORT_SYMBOL ( fc_remote_port_add  )
EXPORT_SYMBOL ( fc_remote_port_delete  )
EXPORT_SYMBOL ( fc_remote_port_rolechg  )
EXPORT_SYMBOL ( fc_block_scsi_eh  )
EXPORT_SYMBOL ( fc_vport_create  )
EXPORT_SYMBOL ( fc_vport_terminate  )
struct scsi_transport_template* fc_attach_transport ( struct fc_function_template ft)
read

Definition at line 2175 of file scsi_transport_fc.c.

fc_bitfield_name_search ( cos  ,
fc_cos_names   
)

Definition at line 251 of file scsi_transport_fc.c.

fc_bitfield_name_search ( port_speed  ,
fc_port_speed_names   
)

Definition at line 267 of file scsi_transport_fc.c.

fc_bitfield_name_search ( port_roles  ,
fc_port_role_names   
)

Definition at line 291 of file scsi_transport_fc.c.

int fc_block_scsi_eh ( struct scsi_cmnd cmnd)

fc_block_scsi_eh - Block SCSI eh thread for blocked fc_rport : SCSI command that scsi_eh is trying to recover

This routine can be called from a FC LLD scsi_eh callback. It blocks the scsi_eh thread until the fc_rport leaves the FC_PORTSTATE_BLOCKED, or the fast_io_fail_tmo fires. This is necessary to avoid the scsi_eh failing recovery actions for blocked rports which would lead to offlined SCSI devices.

Returns: 0 if the fc_rport left the state FC_PORTSTATE_BLOCKED. FAST_IO_FAIL if the fast_io_fail_tmo fired, this should be passed back to scsi_eh.

Definition at line 3312 of file scsi_transport_fc.c.

fc_enum_name_search ( port_type  ,
fc_port_type  ,
fc_port_type_names   
)

Definition at line 128 of file scsi_transport_fc.c.

fc_enum_name_search ( host_event_code  ,
fc_host_event_code  ,
fc_host_event_code_names   
)

Definition at line 153 of file scsi_transport_fc.c.

fc_enum_name_search ( port_state  ,
fc_port_state  ,
fc_port_state_names   
)

Definition at line 175 of file scsi_transport_fc.c.

fc_enum_name_search ( vport_state  ,
fc_vport_state  ,
fc_vport_state_names   
)

Definition at line 195 of file scsi_transport_fc.c.

fc_enum_name_search ( fc_enum_name_match tgtid_bind_type,
fc_enum_name_match fc_tgtid_binding_type,
fc_tgtid_binding_type_names   
)

Definition at line 213 of file scsi_transport_fc.c.

u32 fc_get_event_number ( void  )

fc_get_event_number - Obtain the next sequential FC event number

Notes: We could have inlined this, but it would have required fc_event_seq to be exposed. For now, live with the subroutine call. Atomic used to avoid lock/unlock...

Definition at line 512 of file scsi_transport_fc.c.

void fc_host_post_event ( struct Scsi_Host shost,
u32  event_number,
enum fc_host_event_code  event_code,
u32  event_data 
)

fc_host_post_event - called to post an even on an fc_host. : host the event occurred on : fc event number obtained from get_fc_event_number() : fc_host event being posted : 32bits of data for the event being posted

Notes: This routine assumes no locks are held on entry.

Definition at line 530 of file scsi_transport_fc.c.

void fc_host_post_vendor_event ( struct Scsi_Host shost,
u32  event_number,
u32  data_len,
char data_buf,
u64  vendor_id 
)

fc_host_post_vendor_event - called to post a vendor unique event on an fc_host : host the event occurred on : fc event number obtained from get_fc_event_number() : amount, in bytes, of vendor unique data : pointer to vendor unique data : Vendor id

Notes: This routine assumes no locks are held on entry.

Definition at line 601 of file scsi_transport_fc.c.

fc_host_rd_attr ( port_id  ,
"0x%06x\n"  ,
20   
)
fc_host_rd_attr ( symbolic_name  ,
"%s\n"  ,
FC_SYMBOLIC_NAME_SIZE 1 
)
fc_host_rd_attr_cast ( fabric_name  ,
"0x%llx\n"  ,
20  ,
unsigned long  long 
)
fc_host_rd_enum_attr ( port_type  ,
FC_PORTTYPE_MAX_NAMELEN   
)
fc_host_rd_enum_attr ( port_state  ,
FC_PORTSTATE_MAX_NAMELEN   
)
fc_host_statistic ( seconds_since_last_reset  )
fc_host_statistic ( tx_frames  )
fc_host_statistic ( tx_words  )
fc_host_statistic ( rx_frames  )
fc_host_statistic ( rx_words  )
fc_host_statistic ( lip_count  )
fc_host_statistic ( nos_count  )
fc_host_statistic ( error_frames  )
fc_host_statistic ( dumped_frames  )
fc_host_statistic ( link_failure_count  )
fc_host_statistic ( loss_of_sync_count  )
fc_host_statistic ( loss_of_signal_count  )
fc_host_statistic ( prim_seq_protocol_err_count  )
fc_host_statistic ( invalid_tx_word_count  )
fc_host_statistic ( invalid_crc_count  )
fc_host_statistic ( fcp_input_requests  )
fc_host_statistic ( fcp_output_requests  )
fc_host_statistic ( fcp_control_requests  )
fc_host_statistic ( fcp_input_megabytes  )
fc_host_statistic ( fcp_output_megabytes  )
fc_host_statistic ( fcp_packet_alloc_failures  )
fc_host_statistic ( fcp_packet_aborts  )
fc_host_statistic ( fcp_frame_alloc_failures  )
fc_host_statistic ( fc_no_free_exch  )
fc_host_statistic ( fc_no_free_exch_xid  )
fc_host_statistic ( fc_xid_not_found  )
fc_host_statistic ( fc_xid_busy  )
fc_host_statistic ( fc_seq_not_found  )
fc_host_statistic ( fc_non_bls_resp  )
fc_private_host_rd_attr ( maxframe_size  ,
"%u bytes\n ,
20   
)
fc_private_host_rd_attr ( max_npiv_vports  ,
"%u\n"  ,
20   
)
fc_private_host_rd_attr ( serial_number  ,
"%s\n"  ,
(FC_SERIAL_NUMBER_SIZE+1)   
)
fc_private_host_rd_attr ( manufacturer  ,
"%s\n"  ,
FC_SERIAL_NUMBER_SIZE 1 
)
fc_private_host_rd_attr ( model  ,
"%s\n"  ,
FC_SYMBOLIC_NAME_SIZE 1 
)
fc_private_host_rd_attr ( model_description  ,
"%s\n"  ,
FC_SYMBOLIC_NAME_SIZE 1 
)
fc_private_host_rd_attr ( hardware_version  ,
"%s\n"  ,
FC_VERSION_STRING_SIZE 1 
)
fc_private_host_rd_attr ( driver_version  ,
"%s\n"  ,
FC_VERSION_STRING_SIZE 1 
)
fc_private_host_rd_attr ( firmware_version  ,
"%s\n"  ,
FC_VERSION_STRING_SIZE 1 
)
fc_private_host_rd_attr ( optionrom_version  ,
"%s\n"  ,
FC_VERSION_STRING_SIZE 1 
)
fc_private_host_rd_attr ( npiv_vports_inuse  ,
"%u\n"  ,
20   
)
fc_private_host_rd_attr_cast ( node_name  ,
"0x%llx\n"  ,
20  ,
unsigned long  long 
)
fc_private_host_rd_attr_cast ( port_name  ,
"0x%llx\n"  ,
20  ,
unsigned long  long 
)
fc_private_host_rd_attr_cast ( permanent_port_name  ,
"0x%llx\n"  ,
20  ,
unsigned long  long 
)
fc_private_host_show_function ( system_hostname  ,
"%s\n"  ,
FC_SYMBOLIC_NAME_SIZE 1 
)
fc_private_host_show_function ( dev_loss_tmo  ,
"%d\n"  ,
20   
)
fc_private_rport_rd_attr ( maxframe_size  ,
"%u bytes\n ,
20   
)
fc_private_rport_rd_attr ( port_id  ,
"0x%06x\n"  ,
20   
)
fc_private_rport_rd_attr ( scsi_target_id  ,
"%d\n"  ,
20   
)
fc_private_rport_rd_attr_cast ( node_name  ,
"0x%llx\n"  ,
20  ,
unsigned long  long 
)
fc_private_rport_rd_attr_cast ( port_name  ,
"0x%llx\n"  ,
20  ,
unsigned long  long 
)
fc_private_rport_rd_enum_attr ( port_state  ,
FC_PORTSTATE_MAX_NAMELEN   
)
fc_private_vport_rd_attr_cast ( node_name  ,
"0x%llx\n"  ,
20  ,
unsigned long  long 
)
fc_private_vport_rd_attr_cast ( port_name  ,
"0x%llx\n"  ,
20  ,
unsigned long  long 
)
fc_private_vport_rd_enum_attr ( vport_state  ,
FC_VPORTSTATE_MAX_NAMELEN   
)
fc_private_vport_rd_enum_attr ( vport_last_state  ,
FC_VPORTSTATE_MAX_NAMELEN   
)
fc_private_vport_rd_enum_attr ( vport_type  ,
FC_PORTTYPE_MAX_NAMELEN   
)
fc_private_vport_show_function ( symbolic_name  ,
"%s\n"  ,
FC_VPORT_SYMBOLIC_NAMELEN 1 
)
void fc_release_transport ( struct scsi_transport_template t)

Definition at line 2322 of file scsi_transport_fc.c.

struct fc_rport* fc_remote_port_add ( struct Scsi_Host shost,
int  channel,
struct fc_rport_identifiers ids 
)
read

fc_remote_port_add - notify fc transport of the existence of a remote FC port. : scsi host the remote port is connected to. : Channel on shost port connected to. : The world wide names, fc address, and FC4 port roles for the remote port.

The LLDD calls this routine to notify the transport of the existence of a remote port. The LLDD provides the unique identifiers (wwpn,wwn) of the port, it's FC address (port_id), and the FC4 roles that are active for the port.

For ports that are FCP targets (aka scsi targets), the FC transport maintains consistent target id bindings on behalf of the LLDD. A consistent target id binding is an assignment of a target id to a remote port identifier, which persists while the scsi host is attached. The remote port can disappear, then later reappear, and it's target id assignment remains the same. This allows for shifts in FC addressing (if binding by wwpn or wwnn) with no apparent changes to the scsi subsystem which is based on scsi host number and target id values. Bindings are only valid during the attachment of the scsi host. If the host detaches, then later re-attaches, target id bindings may change.

This routine is responsible for returning a remote port structure. The routine will search the list of remote ports it maintains internally on behalf of consistent target id mappings. If found, the remote port structure will be reused. Otherwise, a new remote port structure will be allocated.

Whenever a remote port is allocated, a new fc_remote_port class device is created.

Should not be called from interrupt context.

Notes: This routine assumes no locks are held on entry.

Definition at line 2733 of file scsi_transport_fc.c.

void fc_remote_port_delete ( struct fc_rport rport)

fc_remote_port_delete - notifies the fc transport that a remote port is no longer in existence. : The remote port that no longer exists

The LLDD calls this routine to notify the transport that a remote port is no longer part of the topology. Note: Although a port may no longer be part of the topology, it may persist in the remote ports displayed by the fc_host. We do this under 2 conditions: 1) If the port was a scsi target, we delay its deletion by "blocking" it. This allows the port to temporarily disappear, then reappear without disrupting the SCSI device tree attached to it. During the "blocked" period the port will still exist. 2) If the port was a scsi target and disappears for longer than we expect, we'll delete the port and the tear down the SCSI device tree attached to it. However, we want to semi-persist the target id assigned to that port if it eventually does exist. The port structure will remain (although with minimal information) so that the target id bindings remails.

If the remote port is not an FCP Target, it will be fully torn down and deallocated, including the fc_remote_port class device.

If the remote port is an FCP Target, the port will be placed in a temporary blocked state. From the LLDD's perspective, the rport no longer exists. From the SCSI midlayer's perspective, the SCSI target exists, but all sdevs on it are blocked from further I/O. The following is then expected.

If the remote port does not return (signaled by a LLDD call to fc_remote_port_add()) within the dev_loss_tmo timeout, then the scsi target is removed - killing all outstanding i/o and removing the scsi devices attached ot it. The port structure will be marked Not Present and be partially cleared, leaving only enough information to recognize the remote port relative to the scsi target id binding if it later appears. The port will remain as long as there is a valid binding (e.g. until the user changes the binding type or unloads the scsi host with the binding).

If the remote port returns within the dev_loss_tmo value (and matches according to the target id binding type), the port structure will be reused. If it is no longer a SCSI target, the target will be torn down. If it continues to be a SCSI target, then the target will be unblocked (allowing i/o to be resumed), and a scan will be activated to ensure that all luns are detected.

Called from normal process context only - cannot be called from interrupt.

Notes: This routine assumes no locks are held on entry.

Definition at line 2974 of file scsi_transport_fc.c.

void fc_remote_port_rolechg ( struct fc_rport rport,
u32  roles 
)

fc_remote_port_rolechg - notifies the fc transport that the roles on a remote may have changed. : The remote port that changed. : New roles for this port.

Description: The LLDD calls this routine to notify the transport that the roles on a remote port may have changed. The largest effect of this is if a port now becomes a FCP Target, it must be allocated a scsi target id. If the port is no longer a FCP target, any scsi target id value assigned to it will persist in case the role changes back to include FCP Target. No changes in the scsi midlayer will be invoked if the role changes (in the expectation that the role will be resumed. If it doesn't normal error processing will take place).

Should not be called from interrupt context.

Notes: This routine assumes no locks are held on entry.

Definition at line 3052 of file scsi_transport_fc.c.

void fc_remove_host ( struct Scsi_Host shost)

fc_remove_host - called to terminate any fc_transport-related elements for a scsi host. : Which &Scsi_Host

This routine is expected to be called immediately preceding the a driver's call to scsi_remove_host().

WARNING: A driver utilizing the fc_transport, which fails to call this routine prior to scsi_remove_host(), will leave dangling objects in /sys/class/fc_remote_ports. Access to any of these objects can result in a system crash !!!

Notes: This routine assumes no locks are held on entry.

Definition at line 2438 of file scsi_transport_fc.c.

fc_rport_show_function ( dev_loss_tmo  ,
"%d\n"  ,
20   
)

Definition at line 891 of file scsi_transport_fc.c.

fc_starget_rd_attr ( port_id  ,
"0x%06x\n"  ,
20   
)
fc_starget_rd_attr_cast ( node_name  ,
"0x%llx\n"  ,
20  ,
unsigned long  long 
)
fc_starget_rd_attr_cast ( port_name  ,
"0x%llx\n"  ,
20  ,
unsigned long  long 
)
struct fc_vport* fc_vport_create ( struct Scsi_Host shost,
int  channel,
struct fc_vport_identifiers ids 
)
read

fc_vport_create - Admin App or LLDD requests creation of a vport : scsi host the virtual port is connected to. : channel on shost port connected to. : The world wide names, FC4 port roles, etc for the virtual port.

Notes: This routine assumes no locks are held on entry.

Definition at line 3474 of file scsi_transport_fc.c.

int fc_vport_terminate ( struct fc_vport vport)

fc_vport_terminate - Admin App or LLDD requests termination of a vport : fc_vport to be terminated

Calls the LLDD vport_delete() function, then deallocates and removes the vport from the shost and object tree.

Notes: This routine assumes no locks are held on entry.

Definition at line 3497 of file scsi_transport_fc.c.

MODULE_AUTHOR ( "James Smart"  )
MODULE_DESCRIPTION ( "FC Transport Attributes )
module_exit ( fc_transport_exit  )
module_init ( fc_transport_init  )
MODULE_LICENSE ( "GPL"  )
module_param_named ( dev_loss_tmo  ,
fc_dev_loss_tmo  ,
uint  ,
S_IRUGO S_IWUSR 
)
MODULE_PARM_DESC ( dev_loss_tmo  ,
"Maximum number of seconds that the FC transport should"" insulate the loss of a remote port. Once this value is""  exceeded,
the scsi target is removed.Value should be""between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT if""fast_io_fail_tmo is not set."   
)
int scsi_is_fc_rport ( const struct device dev)

Definition at line 1997 of file scsi_transport_fc.c.

int scsi_is_fc_vport ( const struct device dev)

Definition at line 2030 of file scsi_transport_fc.c.

Variable Documentation

fc_cos_names[]
Initial value:
= {
{ FC_COS_CLASS1, "Class 1" },
{ FC_COS_CLASS2, "Class 2" },
{ FC_COS_CLASS3, "Class 3" },
{ FC_COS_CLASS4, "Class 4" },
{ FC_COS_CLASS6, "Class 6" },
}

Definition at line 244 of file scsi_transport_fc.c.

fc_host_event_code_names[]
Initial value:
= {
{ FCH_EVT_LIP, "lip" },
{ FCH_EVT_LINKUP, "link_up" },
{ FCH_EVT_LINKDOWN, "link_down" },
{ FCH_EVT_LIPRESET, "lip_reset" },
{ FCH_EVT_RSCN, "rscn" },
{ FCH_EVT_ADAPTER_CHANGE, "adapter_chg" },
{ FCH_EVT_PORT_UNKNOWN, "port_unknown" },
{ FCH_EVT_PORT_ONLINE, "port_online" },
{ FCH_EVT_PORT_OFFLINE, "port_offline" },
{ FCH_EVT_PORT_FABRIC, "port_fabric" },
{ FCH_EVT_LINK_UNKNOWN, "link_unknown" },
{ FCH_EVT_VENDOR_UNIQUE, "vendor_unique" },
}

Definition at line 139 of file scsi_transport_fc.c.

fc_port_speed_names[]
Initial value:
= {
{ FC_PORTSPEED_1GBIT, "1 Gbit" },
{ FC_PORTSPEED_2GBIT, "2 Gbit" },
{ FC_PORTSPEED_4GBIT, "4 Gbit" },
{ FC_PORTSPEED_10GBIT, "10 Gbit" },
{ FC_PORTSPEED_8GBIT, "8 Gbit" },
{ FC_PORTSPEED_16GBIT, "16 Gbit" },
{ FC_PORTSPEED_NOT_NEGOTIATED, "Not Negotiated" },
}

Definition at line 258 of file scsi_transport_fc.c.

fc_port_state_names[]
Initial value:
= {
{ FC_PORTSTATE_UNKNOWN, "Unknown" },
{ FC_PORTSTATE_NOTPRESENT, "Not Present" },
{ FC_PORTSTATE_ONLINE, "Online" },
{ FC_PORTSTATE_OFFLINE, "Offline" },
{ FC_PORTSTATE_BLOCKED, "Blocked" },
{ FC_PORTSTATE_BYPASSED, "Bypassed" },
{ FC_PORTSTATE_DIAGNOSTICS, "Diagnostics" },
{ FC_PORTSTATE_LINKDOWN, "Linkdown" },
{ FC_PORTSTATE_ERROR, "Error" },
{ FC_PORTSTATE_LOOPBACK, "Loopback" },
{ FC_PORTSTATE_DELETED, "Deleted" },
}

Definition at line 162 of file scsi_transport_fc.c.

fc_tgtid_binding_type_names[]
Initial value:
= {
{ FC_TGTID_BIND_NONE, "none", 4 },
{ FC_TGTID_BIND_BY_WWPN, "wwpn (World Wide Port Name)", 4 },
{ FC_TGTID_BIND_BY_WWNN, "wwnn (World Wide Node Name)", 4 },
{ FC_TGTID_BIND_BY_ID, "port_id (FC Address)", 7 },
}

Definition at line 207 of file scsi_transport_fc.c.

fc_vport_state_names[]
Initial value:
= {
{ FC_VPORT_UNKNOWN, "Unknown" },
{ FC_VPORT_ACTIVE, "Active" },
{ FC_VPORT_DISABLED, "Disabled" },
{ FC_VPORT_LINKDOWN, "Linkdown" },
{ FC_VPORT_INITIALIZING, "Initializing" },
{ FC_VPORT_NO_FABRIC_SUPP, "No Fabric Support" },
{ FC_VPORT_NO_FABRIC_RSCS, "No Fabric Resources" },
{ FC_VPORT_FABRIC_LOGOUT, "Fabric Logout" },
{ FC_VPORT_FABRIC_REJ_WWN, "Fabric Rejected WWN" },
{ FC_VPORT_FAILED, "VPort Failed" },
}

Definition at line 183 of file scsi_transport_fc.c.

char* name

Definition at line 117 of file scsi_transport_fc.c.

u32 value

Definition at line 116 of file scsi_transport_fc.c.