scsi_transport_fc.h
来自「linux 内核源代码」· C头文件 代码 · 共 738 行 · 第 1/2 页
H
738 行
/* * FiberChannel transport specific attributes exported to sysfs. * * Copyright (c) 2003 Silicon Graphics, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * ======== * * Copyright (C) 2004-2007 James Smart, Emulex Corporation * Rewrite for host, target, device, and remote port attributes, * statistics, and service functions... * */#ifndef SCSI_TRANSPORT_FC_H#define SCSI_TRANSPORT_FC_H#include <linux/sched.h>#include <scsi/scsi.h>#include <scsi/scsi_netlink.h>struct scsi_transport_template;/* * FC Port definitions - Following FC HBAAPI guidelines * * Note: Not all binary values for the different fields match HBAAPI. * Instead, we use densely packed ordinal values or enums. * We get away with this as we never present the actual binary values * externally. For sysfs, we always present the string that describes * the value. Thus, an admin doesn't need a magic HBAAPI decoder ring * to understand the values. The HBAAPI user-space library is free to * convert the strings into the HBAAPI-specified binary values. * * Note: Not all HBAAPI-defined values are contained in the definitions * below. Those not appropriate to an fc_host (e.g. FCP initiator) have * been removed. *//* * fc_port_type: If you alter this, you also need to alter scsi_transport_fc.c * (for the ascii descriptions). */enum fc_port_type { FC_PORTTYPE_UNKNOWN, FC_PORTTYPE_OTHER, FC_PORTTYPE_NOTPRESENT, FC_PORTTYPE_NPORT, /* Attached to FPort */ FC_PORTTYPE_NLPORT, /* (Public) Loop w/ FLPort */ FC_PORTTYPE_LPORT, /* (Private) Loop w/o FLPort */ FC_PORTTYPE_PTP, /* Point to Point w/ another NPort */ FC_PORTTYPE_NPIV, /* VPORT based on NPIV */};/* * fc_port_state: If you alter this, you also need to alter scsi_transport_fc.c * (for the ascii descriptions). */enum fc_port_state { FC_PORTSTATE_UNKNOWN, FC_PORTSTATE_NOTPRESENT, FC_PORTSTATE_ONLINE, FC_PORTSTATE_OFFLINE, /* User has taken Port Offline */ FC_PORTSTATE_BLOCKED, FC_PORTSTATE_BYPASSED, FC_PORTSTATE_DIAGNOSTICS, FC_PORTSTATE_LINKDOWN, FC_PORTSTATE_ERROR, FC_PORTSTATE_LOOPBACK, FC_PORTSTATE_DELETED,};/* * fc_vport_state: If you alter this, you also need to alter * scsi_transport_fc.c (for the ascii descriptions). */enum fc_vport_state { FC_VPORT_UNKNOWN, FC_VPORT_ACTIVE, FC_VPORT_DISABLED, FC_VPORT_LINKDOWN, FC_VPORT_INITIALIZING, FC_VPORT_NO_FABRIC_SUPP, FC_VPORT_NO_FABRIC_RSCS, FC_VPORT_FABRIC_LOGOUT, FC_VPORT_FABRIC_REJ_WWN, FC_VPORT_FAILED,};/* * FC Classes of Service * Note: values are not enumerated, as they can be "or'd" together * for reporting (e.g. report supported_classes). If you alter this list, * you also need to alter scsi_transport_fc.c (for the ascii descriptions). */#define FC_COS_UNSPECIFIED 0#define FC_COS_CLASS1 2#define FC_COS_CLASS2 4#define FC_COS_CLASS3 8#define FC_COS_CLASS4 0x10#define FC_COS_CLASS6 0x40/* * FC Port Speeds * Note: values are not enumerated, as they can be "or'd" together * for reporting (e.g. report supported_speeds). If you alter this list, * you also need to alter scsi_transport_fc.c (for the ascii descriptions). */#define FC_PORTSPEED_UNKNOWN 0 /* Unknown - transceiver incapable of reporting */#define FC_PORTSPEED_1GBIT 1#define FC_PORTSPEED_2GBIT 2#define FC_PORTSPEED_4GBIT 4#define FC_PORTSPEED_10GBIT 8#define FC_PORTSPEED_8GBIT 0x10#define FC_PORTSPEED_16GBIT 0x20#define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established *//* * fc_tgtid_binding_type: If you alter this, you also need to alter * scsi_transport_fc.c (for the ascii descriptions). */enum fc_tgtid_binding_type { FC_TGTID_BIND_NONE, FC_TGTID_BIND_BY_WWPN, FC_TGTID_BIND_BY_WWNN, FC_TGTID_BIND_BY_ID,};/* * FC Port Roles * Note: values are not enumerated, as they can be "or'd" together * for reporting (e.g. report roles). If you alter this list, * you also need to alter scsi_transport_fc.c (for the ascii descriptions). */#define FC_PORT_ROLE_UNKNOWN 0x00#define FC_PORT_ROLE_FCP_TARGET 0x01#define FC_PORT_ROLE_FCP_INITIATOR 0x02#define FC_PORT_ROLE_IP_PORT 0x04/* The following are for compatibility */#define FC_RPORT_ROLE_UNKNOWN FC_PORT_ROLE_UNKNOWN#define FC_RPORT_ROLE_FCP_TARGET FC_PORT_ROLE_FCP_TARGET#define FC_RPORT_ROLE_FCP_INITIATOR FC_PORT_ROLE_FCP_INITIATOR#define FC_RPORT_ROLE_IP_PORT FC_PORT_ROLE_IP_PORT/* Macro for use in defining Virtual Port attributes */#define FC_VPORT_ATTR(_name,_mode,_show,_store) \struct class_device_attribute class_device_attr_vport_##_name = \ __ATTR(_name,_mode,_show,_store)/* * FC Virtual Port Attributes * * This structure exists for each FC port is a virtual FC port. Virtual * ports share the physical link with the Physical port. Each virtual * ports has a unique presense on the SAN, and may be instantiated via * NPIV, Virtual Fabrics, or via additional ALPAs. As the vport is a * unique presense, each vport has it's own view of the fabric, * authentication priviledge, and priorities. * * A virtual port may support 1 or more FC4 roles. Typically it is a * FCP Initiator. It could be a FCP Target, or exist sole for an IP over FC * roles. FC port attributes for the vport will be reported on any * fc_host class object allocated for an FCP Initiator. * * -- * * Fixed attributes are not expected to change. The driver is * expected to set these values after receiving the fc_vport structure * via the vport_create() call from the transport. * The transport fully manages all get functions w/o driver interaction. * * Dynamic attributes are expected to change. The driver participates * in all get/set operations via functions provided by the driver. * * Private attributes are transport-managed values. They are fully * managed by the transport w/o driver interaction. */#define FC_VPORT_SYMBOLIC_NAMELEN 64struct fc_vport { /* Fixed Attributes */ /* Dynamic Attributes */ /* Private (Transport-managed) Attributes */ enum fc_vport_state vport_state; enum fc_vport_state vport_last_state; u64 node_name; u64 port_name; u32 roles; u32 vport_id; /* Admin Identifier for the vport */ enum fc_port_type vport_type; char symbolic_name[FC_VPORT_SYMBOLIC_NAMELEN]; /* exported data */ void *dd_data; /* Used for driver-specific storage */ /* internal data */ struct Scsi_Host *shost; /* Physical Port Parent */ unsigned int channel; u32 number; u8 flags; struct list_head peers; struct device dev; struct work_struct vport_delete_work;} __attribute__((aligned(sizeof(unsigned long))));/* bit field values for struct fc_vport "flags" field: */#define FC_VPORT_CREATING 0x01#define FC_VPORT_DELETING 0x02#define FC_VPORT_DELETED 0x04#define FC_VPORT_DEL 0x06 /* Any DELETE state */#define dev_to_vport(d) \ container_of(d, struct fc_vport, dev)#define transport_class_to_vport(classdev) \ dev_to_vport(classdev->dev)#define vport_to_shost(v) \ (v->shost)#define vport_to_shost_channel(v) \ (v->channel)#define vport_to_parent(v) \ (v->dev.parent)/* Error return codes for vport_create() callback */#define VPCERR_UNSUPPORTED -ENOSYS /* no driver/adapter support */#define VPCERR_BAD_WWN -ENOTUNIQ /* driver validation of WWNs failed */#define VPCERR_NO_FABRIC_SUPP -EOPNOTSUPP /* Fabric connection is loop or the Fabric Port does not support NPIV *//* * fc_rport_identifiers: This set of data contains all elements * to uniquely identify a remote FC port. The driver uses this data * to report the existence of a remote FC port in the topology. Internally, * the transport uses this data for attributes and to manage consistent * target id bindings. */struct fc_rport_identifiers { u64 node_name; u64 port_name; u32 port_id; u32 roles;};/* Macro for use in defining Remote Port attributes */#define FC_RPORT_ATTR(_name,_mode,_show,_store) \struct class_device_attribute class_device_attr_rport_##_name = \ __ATTR(_name,_mode,_show,_store)/* * FC Remote Port Attributes * * This structure exists for each remote FC port that a LLDD notifies * the subsystem of. A remote FC port may or may not be a SCSI Target, * also be a SCSI initiator, IP endpoint, etc. As such, the remote * port is considered a separate entity, independent of "role" (such * as scsi target). * * -- * * Attributes are based on HBAAPI V2.0 definitions. Only those * attributes that are determinable by the local port (aka Host) * are contained. * * Fixed attributes are not expected to change. The driver is * expected to set these values after successfully calling * fc_remote_port_add(). The transport fully manages all get functions * w/o driver interaction. * * Dynamic attributes are expected to change. The driver participates * in all get/set operations via functions provided by the driver. * * Private attributes are transport-managed values. They are fully * managed by the transport w/o driver interaction. */struct fc_rport { /* aka fc_starget_attrs */ /* Fixed Attributes */ u32 maxframe_size; u32 supported_classes; /* Dynamic Attributes */ u32 dev_loss_tmo; /* Remote Port loss timeout in seconds. */ /* Private (Transport-managed) Attributes */ u64 node_name; u64 port_name; u32 port_id; u32 roles; enum fc_port_state port_state; /* Will only be ONLINE or UNKNOWN */ u32 scsi_target_id; u32 fast_io_fail_tmo; /* exported data */ void *dd_data; /* Used for driver-specific storage */ /* internal data */ unsigned int channel; u32 number; u8 flags; struct list_head peers; struct device dev; struct delayed_work dev_loss_work; struct work_struct scan_work; struct delayed_work fail_io_work; struct work_struct stgt_delete_work; struct work_struct rport_delete_work;} __attribute__((aligned(sizeof(unsigned long))));/* bit field values for struct fc_rport "flags" field: */#define FC_RPORT_DEVLOSS_PENDING 0x01#define FC_RPORT_SCAN_PENDING 0x02#define dev_to_rport(d) \ container_of(d, struct fc_rport, dev)#define transport_class_to_rport(classdev) \ dev_to_rport(classdev->dev)#define rport_to_shost(r) \ dev_to_shost(r->dev.parent)/* * FC SCSI Target Attributes * * The SCSI Target is considered an extention of a remote port (as * a remote port can be more than a SCSI Target). Within the scsi * subsystem, we leave the Target as a separate entity. Doing so * provides backward compatibility with prior FC transport api's, * and lets remote ports be handled entirely within the FC transport * and independently from the scsi subsystem. The drawback is that * some data will be duplicated. */struct fc_starget_attrs { /* aka fc_target_attrs */ /* Dynamic Attributes */ u64 node_name; u64 port_name; u32 port_id;};#define fc_starget_node_name(x) \ (((struct fc_starget_attrs *)&(x)->starget_data)->node_name)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?