diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-04-02 17:03:53 -0700 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-04-02 17:03:53 -0700 | 
| commit | 79f51b7b9c4719303f758ae8406c4e5997ed6aa3 (patch) | |
| tree | 33ca1c3ee11848e75d90f811038fcd149e69d258 /include/uapi | |
| parent | e109f506074152b7241bcbd3949a099e776cb802 (diff) | |
| parent | ff275db92c935858454b721f0d960fff421634d3 (diff) | |
| download | linux-79f51b7b9c4719303f758ae8406c4e5997ed6aa3.tar.bz2 | |
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley:
 "This series has a huge amount of churn because it pulls in Mauro's doc
  update changing all our txt files to rst ones.
  Excluding that, we have the usual driver updates (qla2xxx, ufs, lpfc,
  zfcp, ibmvfc, pm80xx, aacraid), a treewide update for scnprintf and
  some other minor updates.
  The major core change is Hannes moving functions out of the aacraid
  driver and into the core"
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (223 commits)
  scsi: aic7xxx: aic97xx: Remove FreeBSD-specific code
  scsi: ufs: Do not rely on prefetched data
  scsi: dc395x: remove dc395x_bios_param
  scsi: libiscsi: Fix error count for active session
  scsi: hpsa: correct race condition in offload enabled
  scsi: message: fusion: Replace zero-length array with flexible-array member
  scsi: qedi: Add PCI shutdown handler support
  scsi: qedi: Add MFW error recovery process
  scsi: ufs: Enable block layer runtime PM for well-known logical units
  scsi: ufs-qcom: Override devfreq parameters
  scsi: ufshcd: Let vendor override devfreq parameters
  scsi: ufshcd: Update the set frequency to devfreq
  scsi: ufs: Resume ufs host before accessing ufs device
  scsi: ufs-mediatek: customize the delay for enabling host
  scsi: ufs: make HCE polling more compact to improve initialization latency
  scsi: ufs: allow custom delay prior to host enabling
  scsi: ufs-mediatek: use common delay function
  scsi: ufs: introduce common and flexible delay function
  scsi: ufs: use an enum for host capabilities
  scsi: ufs: fix uninitialized tx_lanes in ufshcd_disable_tx_lcc()
  ...
Diffstat (limited to 'include/uapi')
| -rw-r--r-- | include/uapi/scsi/fc/fc_els.h | 211 | ||||
| -rw-r--r-- | include/uapi/scsi/scsi_bsg_fc.h | 2 | 
2 files changed, 197 insertions, 16 deletions
| diff --git a/include/uapi/scsi/fc/fc_els.h b/include/uapi/scsi/fc/fc_els.h index 76f627f0d13b..66318c44acd7 100644 --- a/include/uapi/scsi/fc/fc_els.h +++ b/include/uapi/scsi/fc/fc_els.h @@ -9,6 +9,7 @@  #define	_FC_ELS_H_  #include <linux/types.h> +#include <asm/byteorder.h>  /*   * Fibre Channel Switch - Enhanced Link Services definitions. @@ -40,6 +41,7 @@ enum fc_els_cmd {  	ELS_REC =	0x13,	/* read exchange concise */  	ELS_SRR =	0x14,	/* sequence retransmission request */  	ELS_FPIN =	0x16,	/* Fabric Performance Impact Notification */ +	ELS_RDF =	0x19,	/* Register Diagnostic Functions */  	ELS_PRLI =	0x20,	/* process login */  	ELS_PRLO =	0x21,	/* process logout */  	ELS_SCN =	0x22,	/* state change notification */ @@ -108,6 +110,7 @@ enum fc_els_cmd {  	[ELS_REC] =	"REC",			\  	[ELS_SRR] =	"SRR",			\  	[ELS_FPIN] =	"FPIN",			\ +	[ELS_RDF] =	"RDF",			\  	[ELS_PRLI] =	"PRLI",			\  	[ELS_PRLO] =	"PRLO",			\  	[ELS_SCN] =	"SCN",			\ @@ -208,6 +211,99 @@ enum fc_els_rjt_explan {  };  /* + * Link Service TLV Descriptor Tag Values + */ +enum fc_ls_tlv_dtag { +	ELS_DTAG_LS_REQ_INFO =		0x00000001, +		/* Link Service Request Information Descriptor */ +	ELS_DTAG_LNK_INTEGRITY =	0x00020001, +		/* Link Integrity Notification Descriptor */ +	ELS_DTAG_DELIVERY =		0x00020002, +		/* Delivery Notification Descriptor */ +	ELS_DTAG_PEER_CONGEST =		0x00020003, +		/* Peer Congestion Notification Descriptor */ +	ELS_DTAG_CONGESTION =		0x00020004, +		/* Congestion Notification Descriptor */ +	ELS_DTAG_FPIN_REGISTER =	0x00030001, +		/* FPIN Registration Descriptor */ +}; + +/* + * Initializer useful for decoding table. + * Please keep this in sync with the above definitions. + */ +#define FC_LS_TLV_DTAG_INIT {					      \ +	{ ELS_DTAG_LS_REQ_INFO,		"Link Service Request Information" }, \ +	{ ELS_DTAG_LNK_INTEGRITY,	"Link Integrity Notification" },      \ +	{ ELS_DTAG_DELIVERY,		"Delivery Notification Present" },    \ +	{ ELS_DTAG_PEER_CONGEST,	"Peer Congestion Notification" },     \ +	{ ELS_DTAG_CONGESTION,		"Congestion Notification" },	      \ +	{ ELS_DTAG_FPIN_REGISTER,	"FPIN Registration" },		      \ +} + + +/* + * Generic Link Service TLV Descriptor format + * + * This structure, as it defines no payload, will also be referred to + * as the "tlv header" - which contains the tag and len fields. + */ +struct fc_tlv_desc { +	__be32		desc_tag;	/* Notification Descriptor Tag */ +	__be32		desc_len;	/* Length of Descriptor (in bytes). +					 * Size of descriptor excluding +					 * desc_tag and desc_len fields. +					 */ +	__u8		desc_value[0];  /* Descriptor Value */ +}; + +/* Descriptor tag and len fields are considered the mandatory header + * for a descriptor + */ +#define FC_TLV_DESC_HDR_SZ	sizeof(struct fc_tlv_desc) + +/* + * Macro, used when initializing payloads, to return the descriptor length. + * Length is size of descriptor minus the tag and len fields. + */ +#define FC_TLV_DESC_LENGTH_FROM_SZ(desc)	\ +		(sizeof(desc) - FC_TLV_DESC_HDR_SZ) + +/* Macro, used on received payloads, to return the descriptor length */ +#define FC_TLV_DESC_SZ_FROM_LENGTH(tlv)		\ +		(__be32_to_cpu((tlv)->desc_len) + FC_TLV_DESC_HDR_SZ) + +/* + * This helper is used to walk descriptors in a descriptor list. + * Given the address of the current descriptor, which minimally contains a + * tag and len field, calculate the address of the next descriptor based + * on the len field. + */ +static inline void *fc_tlv_next_desc(void *desc) +{ +	struct fc_tlv_desc *tlv = desc; + +	return (desc + FC_TLV_DESC_SZ_FROM_LENGTH(tlv)); +} + + +/* + * Link Service Request Information Descriptor + */ +struct fc_els_lsri_desc { +	__be32		desc_tag;	/* descriptor tag (0x0000 0001) */ +	__be32		desc_len;	/* Length of Descriptor (in bytes) (4). +					 * Size of descriptor excluding +					 * desc_tag and desc_len fields. +					 */ +	struct { +		__u8	cmd;		/* ELS cmd byte */ +		__u8	bytes[3];	/* bytes 1..3 */ +	} rqst_w0;			/* Request word 0 */ +}; + + +/*   * Common service parameters (N ports).   */  struct fc_els_csp { @@ -819,24 +915,61 @@ enum fc_els_clid_ic {  }; +enum fc_fpin_li_event_types { +	FPIN_LI_UNKNOWN =		0x0, +	FPIN_LI_LINK_FAILURE =		0x1, +	FPIN_LI_LOSS_OF_SYNC =		0x2, +	FPIN_LI_LOSS_OF_SIG =		0x3, +	FPIN_LI_PRIM_SEQ_ERR =		0x4, +	FPIN_LI_INVALID_TX_WD =		0x5, +	FPIN_LI_INVALID_CRC =		0x6, +	FPIN_LI_DEVICE_SPEC =		0xF, +}; +  /* - * Fabric Notification Descriptor Tag values + * Initializer useful for decoding table. + * Please keep this in sync with the above definitions.   */ -enum fc_fn_dtag { -	ELS_FN_DTAG_LNK_INTEGRITY =	0x00020001,	/* Link Integrity */ -	ELS_FN_DTAG_PEER_CONGEST =	0x00020003,	/* Peer Congestion */ -	ELS_FN_DTAG_CONGESTION =	0x00020004,	/* Congestion */ -}; +#define FC_FPIN_LI_EVT_TYPES_INIT {					\ +	{ FPIN_LI_UNKNOWN,		"Unknown" },			\ +	{ FPIN_LI_LINK_FAILURE,		"Link Failure" },		\ +	{ FPIN_LI_LOSS_OF_SYNC,		"Loss of Synchronization" },	\ +	{ FPIN_LI_LOSS_OF_SIG,		"Loss of Signal" },		\ +	{ FPIN_LI_PRIM_SEQ_ERR,		"Primitive Sequence Protocol Error" }, \ +	{ FPIN_LI_INVALID_TX_WD,	"Invalid Transmission Word" },	\ +	{ FPIN_LI_INVALID_CRC,		"Invalid CRC" },		\ +	{ FPIN_LI_DEVICE_SPEC,		"Device Specific" },		\ +} +  /* - * Fabric Notification Descriptor + * Link Integrity Notification Descriptor   */ -struct fc_fn_desc { -	__be32		fn_desc_tag;	/* Notification Descriptor Tag */ -	__be32		fn_desc_value_len; /* Length of Descriptor Value field -					    * (in bytes) -					    */ -	__u8		fn_desc_value[0];  /* Descriptor Value */ +struct fc_fn_li_desc { +	__be32		desc_tag;	/* Descriptor Tag (0x00020001) */ +	__be32		desc_len;	/* Length of Descriptor (in bytes). +					 * Size of descriptor excluding +					 * desc_tag and desc_len fields. +					 */ +	__be64		detecting_wwpn;	/* Port Name that detected event */ +	__be64		attached_wwpn;	/* Port Name of device attached to +					 * detecting Port Name +					 */ +	__be16		event_type;	/* see enum fc_fpin_li_event_types */ +	__be16		event_modifier;	/* Implementation specific value +					 * describing the event type +					 */ +	__be32		event_threshold;/* duration in ms of the link +					 * integrity detection cycle +					 */ +	__be32		event_count;	/* minimum number of event +					 * occurrences during the event +					 * threshold to caause the LI event +					 */ +	__be32		pname_count;	/* number of portname_list elements */ +	__be64		pname_list[0];	/* list of N_Port_Names accessible +					 * through the attached port +					 */  };  /* @@ -845,8 +978,56 @@ struct fc_fn_desc {  struct fc_els_fpin {  	__u8		fpin_cmd;	/* command (0x16) */  	__u8		fpin_zero[3];	/* specified as zero - part of cmd */ -	__be32		fpin_desc_cnt;	/* count of descriptors */ -	struct fc_fn_desc	fpin_desc[0];	/* Descriptor list */ +	__be32		desc_len;	/* Length of Descriptor List (in bytes). +					 * Size of ELS excluding fpin_cmd, +					 * fpin_zero and desc_len fields. +					 */ +	struct fc_tlv_desc	fpin_desc[0];	/* Descriptor list */ +}; + +/* Diagnostic Function Descriptor - FPIN Registration */ +struct fc_df_desc_fpin_reg { +	__be32		desc_tag;	/* FPIN Registration (0x00030001) */ +	__be32		desc_len;	/* Length of Descriptor (in bytes). +					 * Size of descriptor excluding +					 * desc_tag and desc_len fields. +					 */ +	__be32		count;		/* Number of desc_tags elements */ +	__be32		desc_tags[0];	/* Array of Descriptor Tags. +					 * Each tag indicates a function +					 * supported by the N_Port (request) +					 * or by the  N_Port and Fabric +					 * Controller (reply; may be a subset +					 * of the request). +					 * See ELS_FN_DTAG_xxx for tag values. +					 */  }; +/* + * ELS_RDF - Register Diagnostic Functions + */ +struct fc_els_rdf { +	__u8		fpin_cmd;	/* command (0x19) */ +	__u8		fpin_zero[3];	/* specified as zero - part of cmd */ +	__be32		desc_len;	/* Length of Descriptor List (in bytes). +					 * Size of ELS excluding fpin_cmd, +					 * fpin_zero and desc_len fields. +					 */ +	struct fc_tlv_desc	desc[0];	/* Descriptor list */ +}; + +/* + * ELS RDF LS_ACC Response. + */ +struct fc_els_rdf_resp { +	struct fc_els_ls_acc	acc_hdr; +	__be32			desc_list_len;	/* Length of response (in +						 * bytes). Excludes acc_hdr +						 * and desc_list_len fields. +						 */ +	struct fc_els_lsri_desc	lsri; +	struct fc_tlv_desc	desc[0];	/* Supported Descriptor list */ +}; + +  #endif /* _FC_ELS_H_ */ diff --git a/include/uapi/scsi/scsi_bsg_fc.h b/include/uapi/scsi/scsi_bsg_fc.h index 3ae65e93235c..7f5930801f72 100644 --- a/include/uapi/scsi/scsi_bsg_fc.h +++ b/include/uapi/scsi/scsi_bsg_fc.h @@ -209,7 +209,7 @@ struct fc_bsg_host_vendor {  	__u64 vendor_id;  	/* start of vendor command area */ -	__u32 vendor_cmd[0]; +	__u32 vendor_cmd[];  };  /* Response: |