Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley: "This series consists of the usual driver updates (ufs, ibmvfc, megaraid_sas, lpfc, elx, mpi3mr, qedi, iscsi, storvsc, mpt3sas) with elx and mpi3mr being new drivers. The major core change is a rework to drop the status byte handling macros and the old bit shifted definitions and the rest of the updates are minor fixes" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (287 commits) scsi: aha1740: Avoid over-read of sense buffer scsi: arcmsr: Avoid over-read of sense buffer scsi: ips: Avoid over-read of sense buffer scsi: ufs: ufs-mediatek: Add missing of_node_put() in ufs_mtk_probe() scsi: elx: libefc: Fix IRQ restore in efc_domain_dispatch_frame() scsi: elx: libefc: Fix less than zero comparison of a unsigned int scsi: elx: efct: Fix pointer error checking in debugfs init scsi: elx: efct: Fix is_originator return code type scsi: elx: efct: Fix link error for _bad_cmpxchg scsi: elx: efct: Eliminate unnecessary boolean check in efct_hw_command_cancel() scsi: elx: efct: Do not use id uninitialized in efct_lio_setup_session() scsi: elx: efct: Fix error handling in efct_hw_init() scsi: elx: efct: Remove redundant initialization of variable lun scsi: elx: efct: Fix spelling mistake "Unexected" -> "Unexpected" scsi: lpfc: Fix build error in lpfc_scsi.c scsi: target: iscsi: Remove redundant continue statement scsi: qla4xxx: Remove redundant continue statement scsi: ppa: Switch to use module_parport_driver() scsi: imm: Switch to use module_parport_driver() scsi: mpt3sas: Fix error return value in _scsih_expander_add() ...
This commit is contained in:
@@ -24,6 +24,12 @@
|
||||
*/
|
||||
#define FC_FDMI_SUBTYPE 0x10 /* fs_ct_hdr.ct_fs_subtype */
|
||||
|
||||
/*
|
||||
* Management server FDMI specifications.
|
||||
*/
|
||||
#define FDMI_V1 1 /* FDMI version 1 specifications */
|
||||
#define FDMI_V2 2 /* FDMI version 2 specifications */
|
||||
|
||||
/*
|
||||
* Management server FDMI Requests.
|
||||
*/
|
||||
@@ -57,22 +63,36 @@ enum fc_fdmi_hba_attr_type {
|
||||
FC_FDMI_HBA_ATTR_FIRMWAREVERSION = 0x0009,
|
||||
FC_FDMI_HBA_ATTR_OSNAMEVERSION = 0x000A,
|
||||
FC_FDMI_HBA_ATTR_MAXCTPAYLOAD = 0x000B,
|
||||
FC_FDMI_HBA_ATTR_NODESYMBLNAME = 0x000C,
|
||||
FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO = 0x000D,
|
||||
FC_FDMI_HBA_ATTR_NUMBEROFPORTS = 0x000E,
|
||||
FC_FDMI_HBA_ATTR_FABRICNAME = 0x000F,
|
||||
FC_FDMI_HBA_ATTR_BIOSVERSION = 0x0010,
|
||||
FC_FDMI_HBA_ATTR_BIOSSTATE = 0x0011,
|
||||
FC_FDMI_HBA_ATTR_VENDORIDENTIFIER = 0x00E0,
|
||||
};
|
||||
|
||||
/*
|
||||
* HBA Attribute Length
|
||||
*/
|
||||
#define FC_FDMI_HBA_ATTR_NODENAME_LEN 8
|
||||
#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 80
|
||||
#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 80
|
||||
#define FC_FDMI_HBA_ATTR_MODEL_LEN 256
|
||||
#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256
|
||||
#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256
|
||||
#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 256
|
||||
#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 256
|
||||
#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 256
|
||||
#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 256
|
||||
#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64
|
||||
#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64
|
||||
#define FC_FDMI_HBA_ATTR_MODEL_LEN 64
|
||||
#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 64
|
||||
#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 64
|
||||
#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 64
|
||||
#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 64
|
||||
#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 64
|
||||
#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 128
|
||||
#define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN 4
|
||||
#define FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN 64
|
||||
#define FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN 4
|
||||
#define FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN 4
|
||||
#define FC_FDMI_HBA_ATTR_FABRICNAME_LEN 8
|
||||
#define FC_FDMI_HBA_ATTR_BIOSVERSION_LEN 64
|
||||
#define FC_FDMI_HBA_ATTR_BIOSSTATE_LEN 4
|
||||
#define FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN 8
|
||||
|
||||
/*
|
||||
* Port Attribute Type
|
||||
@@ -84,6 +104,16 @@ enum fc_fdmi_port_attr_type {
|
||||
FC_FDMI_PORT_ATTR_MAXFRAMESIZE = 0x0004,
|
||||
FC_FDMI_PORT_ATTR_OSDEVICENAME = 0x0005,
|
||||
FC_FDMI_PORT_ATTR_HOSTNAME = 0x0006,
|
||||
FC_FDMI_PORT_ATTR_NODENAME = 0x0007,
|
||||
FC_FDMI_PORT_ATTR_PORTNAME = 0x0008,
|
||||
FC_FDMI_PORT_ATTR_SYMBOLICNAME = 0x0009,
|
||||
FC_FDMI_PORT_ATTR_PORTTYPE = 0x000A,
|
||||
FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC = 0x000B,
|
||||
FC_FDMI_PORT_ATTR_FABRICNAME = 0x000C,
|
||||
FC_FDMI_PORT_ATTR_CURRENTFC4TYPE = 0x000D,
|
||||
FC_FDMI_PORT_ATTR_PORTSTATE = 0x101,
|
||||
FC_FDMI_PORT_ATTR_DISCOVEREDPORTS = 0x102,
|
||||
FC_FDMI_PORT_ATTR_PORTID = 0x103,
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -95,6 +125,17 @@ enum fc_fdmi_port_attr_type {
|
||||
#define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN 4
|
||||
#define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN 256
|
||||
#define FC_FDMI_PORT_ATTR_HOSTNAME_LEN 256
|
||||
#define FC_FDMI_PORT_ATTR_NODENAME_LEN 8
|
||||
#define FC_FDMI_PORT_ATTR_PORTNAME_LEN 8
|
||||
#define FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN 256
|
||||
#define FC_FDMI_PORT_ATTR_PORTTYPE_LEN 4
|
||||
#define FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN 4
|
||||
#define FC_FDMI_PORT_ATTR_FABRICNAME_LEN 8
|
||||
#define FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN 32
|
||||
#define FC_FDMI_PORT_ATTR_PORTSTATE_LEN 4
|
||||
#define FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN 4
|
||||
#define FC_FDMI_PORT_ATTR_PORTID_LEN 4
|
||||
|
||||
|
||||
/*
|
||||
* HBA Attribute ID
|
||||
|
||||
@@ -52,7 +52,7 @@ static inline int iscsi_sna_gte(u32 n1, u32 n2)
|
||||
}
|
||||
|
||||
/*
|
||||
* useful common(control and data pathes) macro
|
||||
* useful common(control and data paths) macro
|
||||
*/
|
||||
#define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2]))
|
||||
#define hton24(p, v) { \
|
||||
|
||||
@@ -399,7 +399,7 @@ struct fc_seq {
|
||||
* @sid: Source FCID
|
||||
* @did: Destination FCID
|
||||
* @esb_stat: ESB exchange status
|
||||
* @r_a_tov: Resouce allocation time out value (in msecs)
|
||||
* @r_a_tov: Resource allocation time out value (in msecs)
|
||||
* @seq_id: The next sequence ID to use
|
||||
* @encaps: encapsulation information for lower-level driver
|
||||
* @f_ctl: F_CTL flags for the sequence
|
||||
@@ -668,7 +668,7 @@ enum fc_lport_event {
|
||||
* @wwnn: World Wide Node Name
|
||||
* @service_params: Common service parameters
|
||||
* @e_d_tov: Error detection timeout value
|
||||
* @r_a_tov: Resouce allocation timeout value
|
||||
* @r_a_tov: Resource allocation timeout value
|
||||
* @rnid_gen: RNID information
|
||||
* @sg_supp: Indicates if scatter gather is supported
|
||||
* @seq_offload: Indicates if sequence offload is supported
|
||||
@@ -841,7 +841,7 @@ static inline void fc_lport_free_stats(struct fc_lport *lport)
|
||||
|
||||
/**
|
||||
* lport_priv() - Return the private data from a local port
|
||||
* @lport: The local port whose private data is to be retreived
|
||||
* @lport: The local port whose private data is to be retrieved
|
||||
*/
|
||||
static inline void *lport_priv(const struct fc_lport *lport)
|
||||
{
|
||||
|
||||
@@ -145,6 +145,13 @@ static inline void* iscsi_next_hdr(struct iscsi_task *task)
|
||||
return (void*)task->hdr + task->hdr_len;
|
||||
}
|
||||
|
||||
static inline bool iscsi_task_is_completed(struct iscsi_task *task)
|
||||
{
|
||||
return task->state == ISCSI_TASK_COMPLETED ||
|
||||
task->state == ISCSI_TASK_ABRT_TMF ||
|
||||
task->state == ISCSI_TASK_ABRT_SESS_RECOV;
|
||||
}
|
||||
|
||||
/* Connection's states */
|
||||
enum {
|
||||
ISCSI_CONN_INITIAL_STAGE,
|
||||
@@ -195,12 +202,6 @@ struct iscsi_conn {
|
||||
unsigned long suspend_tx; /* suspend Tx */
|
||||
unsigned long suspend_rx; /* suspend Rx */
|
||||
|
||||
/* abort */
|
||||
wait_queue_head_t ehwait; /* used in eh_abort() */
|
||||
struct iscsi_tm tmhdr;
|
||||
struct timer_list tmf_timer;
|
||||
int tmf_state; /* see TMF_INITIAL, etc.*/
|
||||
|
||||
/* negotiated params */
|
||||
unsigned max_recv_dlength; /* initiator_max_recv_dsl*/
|
||||
unsigned max_xmit_dlength; /* target_max_recv_dsl */
|
||||
@@ -270,6 +271,12 @@ struct iscsi_session {
|
||||
* and recv lock.
|
||||
*/
|
||||
struct mutex eh_mutex;
|
||||
/* abort */
|
||||
wait_queue_head_t ehwait; /* used in eh_abort() */
|
||||
struct iscsi_tm tmhdr;
|
||||
struct timer_list tmf_timer;
|
||||
int tmf_state; /* see TMF_INITIAL, etc.*/
|
||||
struct iscsi_task *running_aborted_task;
|
||||
|
||||
/* iSCSI session-wide sequencing */
|
||||
uint32_t cmdsn;
|
||||
@@ -424,6 +431,7 @@ extern int iscsi_conn_start(struct iscsi_cls_conn *);
|
||||
extern void iscsi_conn_stop(struct iscsi_cls_conn *, int);
|
||||
extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *,
|
||||
int);
|
||||
extern void iscsi_conn_unbind(struct iscsi_cls_conn *cls_conn, bool is_active);
|
||||
extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
|
||||
extern void iscsi_session_failure(struct iscsi_session *session,
|
||||
enum iscsi_err err);
|
||||
|
||||
@@ -474,10 +474,16 @@ enum service_response {
|
||||
};
|
||||
|
||||
enum exec_status {
|
||||
/* The SAM_STAT_.. codes fit in the lower 6 bits, alias some of
|
||||
* them here to silence 'case value not in enumerated type' warnings
|
||||
/*
|
||||
* Values 0..0x7f are used to return the SAM_STAT_* codes. To avoid
|
||||
* 'case value not in enumerated type' compiler warnings every value
|
||||
* returned through the exec_status enum needs an alias with the SAS_
|
||||
* prefix here.
|
||||
*/
|
||||
__SAM_STAT_CHECK_CONDITION = SAM_STAT_CHECK_CONDITION,
|
||||
SAS_SAM_STAT_GOOD = SAM_STAT_GOOD,
|
||||
SAS_SAM_STAT_BUSY = SAM_STAT_BUSY,
|
||||
SAS_SAM_STAT_TASK_ABORTED = SAM_STAT_TASK_ABORTED,
|
||||
SAS_SAM_STAT_CHECK_CONDITION = SAM_STAT_CHECK_CONDITION,
|
||||
|
||||
SAS_DEV_NO_RESPONSE = 0x80,
|
||||
SAS_DATA_UNDERRUN,
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <scsi/scsi_common.h>
|
||||
#include <scsi/scsi_proto.h>
|
||||
#include <scsi/scsi_status.h>
|
||||
|
||||
struct scsi_cmnd;
|
||||
|
||||
@@ -30,32 +31,6 @@ enum scsi_timeouts {
|
||||
*/
|
||||
#define SCAN_WILD_CARD ~0
|
||||
|
||||
/** scsi_status_is_good - check the status return.
|
||||
*
|
||||
* @status: the status passed up from the driver (including host and
|
||||
* driver components)
|
||||
*
|
||||
* This returns true for known good conditions that may be treated as
|
||||
* command completed normally
|
||||
*/
|
||||
static inline int scsi_status_is_good(int status)
|
||||
{
|
||||
/*
|
||||
* FIXME: bit0 is listed as reserved in SCSI-2, but is
|
||||
* significant in SCSI-3. For now, we follow the SCSI-2
|
||||
* behaviour and ignore reserved bits.
|
||||
*/
|
||||
status &= 0xfe;
|
||||
return ((status == SAM_STAT_GOOD) ||
|
||||
(status == SAM_STAT_CONDITION_MET) ||
|
||||
/* Next two "intermediate" statuses are obsolete in SAM-4 */
|
||||
(status == SAM_STAT_INTERMEDIATE) ||
|
||||
(status == SAM_STAT_INTERMEDIATE_CONDITION_MET) ||
|
||||
/* FIXME: this is obsolete in SAM-3 */
|
||||
(status == SAM_STAT_COMMAND_TERMINATED));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* standard mode-select header prepended to all mode-select commands
|
||||
*/
|
||||
@@ -88,94 +63,31 @@ static inline int scsi_is_wlun(u64 lun)
|
||||
return (lun & 0xff00) == SCSI_W_LUN_BASE;
|
||||
}
|
||||
|
||||
/**
|
||||
* scsi_status_is_check_condition - check the status return.
|
||||
*
|
||||
* @status: the status passed up from the driver (including host and
|
||||
* driver components)
|
||||
*
|
||||
* This returns true if the status code is SAM_STAT_CHECK_CONDITION.
|
||||
*/
|
||||
static inline int scsi_status_is_check_condition(int status)
|
||||
{
|
||||
if (status < 0)
|
||||
return false;
|
||||
status &= 0xfe;
|
||||
return status == SAM_STAT_CHECK_CONDITION;
|
||||
}
|
||||
|
||||
/*
|
||||
* MESSAGE CODES
|
||||
* Extended message codes.
|
||||
*/
|
||||
|
||||
#define COMMAND_COMPLETE 0x00
|
||||
#define EXTENDED_MESSAGE 0x01
|
||||
#define EXTENDED_MODIFY_DATA_POINTER 0x00
|
||||
#define EXTENDED_SDTR 0x01
|
||||
#define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */
|
||||
#define EXTENDED_WDTR 0x03
|
||||
#define EXTENDED_PPR 0x04
|
||||
#define EXTENDED_MODIFY_BIDI_DATA_PTR 0x05
|
||||
#define SAVE_POINTERS 0x02
|
||||
#define RESTORE_POINTERS 0x03
|
||||
#define DISCONNECT 0x04
|
||||
#define INITIATOR_ERROR 0x05
|
||||
#define ABORT_TASK_SET 0x06
|
||||
#define MESSAGE_REJECT 0x07
|
||||
#define NOP 0x08
|
||||
#define MSG_PARITY_ERROR 0x09
|
||||
#define LINKED_CMD_COMPLETE 0x0a
|
||||
#define LINKED_FLG_CMD_COMPLETE 0x0b
|
||||
#define TARGET_RESET 0x0c
|
||||
#define ABORT_TASK 0x0d
|
||||
#define CLEAR_TASK_SET 0x0e
|
||||
#define INITIATE_RECOVERY 0x0f /* SCSI-II only */
|
||||
#define RELEASE_RECOVERY 0x10 /* SCSI-II only */
|
||||
#define TERMINATE_IO_PROC 0x11 /* SCSI-II only */
|
||||
#define CLEAR_ACA 0x16
|
||||
#define LOGICAL_UNIT_RESET 0x17
|
||||
#define SIMPLE_QUEUE_TAG 0x20
|
||||
#define HEAD_OF_QUEUE_TAG 0x21
|
||||
#define ORDERED_QUEUE_TAG 0x22
|
||||
#define IGNORE_WIDE_RESIDUE 0x23
|
||||
#define ACA 0x24
|
||||
#define QAS_REQUEST 0x55
|
||||
|
||||
/* Old SCSI2 names, don't use in new code */
|
||||
#define BUS_DEVICE_RESET TARGET_RESET
|
||||
#define ABORT ABORT_TASK_SET
|
||||
|
||||
/*
|
||||
* Host byte codes
|
||||
*/
|
||||
|
||||
#define DID_OK 0x00 /* NO error */
|
||||
#define DID_NO_CONNECT 0x01 /* Couldn't connect before timeout period */
|
||||
#define DID_BUS_BUSY 0x02 /* BUS stayed busy through time out period */
|
||||
#define DID_TIME_OUT 0x03 /* TIMED OUT for other reason */
|
||||
#define DID_BAD_TARGET 0x04 /* BAD target. */
|
||||
#define DID_ABORT 0x05 /* Told to abort for some other reason */
|
||||
#define DID_PARITY 0x06 /* Parity error */
|
||||
#define DID_ERROR 0x07 /* Internal error */
|
||||
#define DID_RESET 0x08 /* Reset by somebody. */
|
||||
#define DID_BAD_INTR 0x09 /* Got an interrupt we weren't expecting. */
|
||||
#define DID_PASSTHROUGH 0x0a /* Force command past mid-layer */
|
||||
#define DID_SOFT_ERROR 0x0b /* The low level driver just wish a retry */
|
||||
#define DID_IMM_RETRY 0x0c /* Retry without decrementing retry count */
|
||||
#define DID_REQUEUE 0x0d /* Requeue command (no immediate retry) also
|
||||
* without decrementing the retry count */
|
||||
#define DID_TRANSPORT_DISRUPTED 0x0e /* Transport error disrupted execution
|
||||
* and the driver blocked the port to
|
||||
* recover the link. Transport class will
|
||||
* retry or fail IO */
|
||||
#define DID_TRANSPORT_FAILFAST 0x0f /* Transport class fastfailed the io */
|
||||
#define DID_TARGET_FAILURE 0x10 /* Permanent target failure, do not retry on
|
||||
* other paths */
|
||||
#define DID_NEXUS_FAILURE 0x11 /* Permanent nexus failure, retry on other
|
||||
* paths might yield different results */
|
||||
#define DID_ALLOC_FAILURE 0x12 /* Space allocation on the device failed */
|
||||
#define DID_MEDIUM_ERROR 0x13 /* Medium error */
|
||||
#define DID_TRANSPORT_MARGINAL 0x14 /* Transport marginal errors */
|
||||
#define DRIVER_OK 0x00 /* Driver status */
|
||||
|
||||
/*
|
||||
* These indicate the error that occurred, and what is available.
|
||||
*/
|
||||
|
||||
#define DRIVER_BUSY 0x01
|
||||
#define DRIVER_SOFT 0x02
|
||||
#define DRIVER_MEDIA 0x03
|
||||
#define DRIVER_ERROR 0x04
|
||||
|
||||
#define DRIVER_INVALID 0x05
|
||||
#define DRIVER_TIMEOUT 0x06
|
||||
#define DRIVER_HARD 0x07
|
||||
#define DRIVER_SENSE 0x08
|
||||
|
||||
/*
|
||||
* Internal return values.
|
||||
@@ -206,14 +118,10 @@ enum scsi_disposition {
|
||||
* These are set by:
|
||||
*
|
||||
* status byte = set from target device
|
||||
* msg_byte = return status from host adapter itself.
|
||||
* msg_byte (unused)
|
||||
* host_byte = set by low-level driver to indicate status.
|
||||
* driver_byte = set by mid-level.
|
||||
*/
|
||||
#define status_byte(result) (((result) >> 1) & 0x7f)
|
||||
#define msg_byte(result) (((result) >> 8) & 0xff)
|
||||
#define host_byte(result) (((result) >> 16) & 0xff)
|
||||
#define driver_byte(result) (((result) >> 24) & 0xff)
|
||||
|
||||
#define sense_class(sense) (((sense) >> 4) & 0x7)
|
||||
#define sense_error(sense) ((sense) & 0xf)
|
||||
@@ -277,4 +185,35 @@ enum scsi_disposition {
|
||||
/* Used to obtain the PCI location of a device */
|
||||
#define SCSI_IOCTL_GET_PCI 0x5387
|
||||
|
||||
/** scsi_status_is_good - check the status return.
|
||||
*
|
||||
* @status: the status passed up from the driver (including host and
|
||||
* driver components)
|
||||
*
|
||||
* This returns true for known good conditions that may be treated as
|
||||
* command completed normally
|
||||
*/
|
||||
static inline bool scsi_status_is_good(int status)
|
||||
{
|
||||
if (status < 0)
|
||||
return false;
|
||||
|
||||
if (host_byte(status) == DID_NO_CONNECT)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* FIXME: bit0 is listed as reserved in SCSI-2, but is
|
||||
* significant in SCSI-3. For now, we follow the SCSI-2
|
||||
* behaviour and ignore reserved bits.
|
||||
*/
|
||||
status &= 0xfe;
|
||||
return ((status == SAM_STAT_GOOD) ||
|
||||
(status == SAM_STAT_CONDITION_MET) ||
|
||||
/* Next two "intermediate" statuses are obsolete in SAM-4 */
|
||||
(status == SAM_STAT_INTERMEDIATE) ||
|
||||
(status == SAM_STAT_INTERMEDIATE_CONDITION_MET) ||
|
||||
/* FIXME: this is obsolete in SAM-3 */
|
||||
(status == SAM_STAT_COMMAND_TERMINATED));
|
||||
}
|
||||
|
||||
#endif /* _SCSI_SCSI_H */
|
||||
|
||||
@@ -84,7 +84,7 @@ struct iscsi_bsg_reply {
|
||||
*/
|
||||
uint32_t result;
|
||||
|
||||
/* If there was reply_payload, how much was recevied ? */
|
||||
/* If there was reply_payload, how much was received ? */
|
||||
uint32_t reply_payload_rcv_len;
|
||||
|
||||
union {
|
||||
|
||||
@@ -315,9 +315,9 @@ static inline void set_status_byte(struct scsi_cmnd *cmd, char status)
|
||||
cmd->result = (cmd->result & 0xffffff00) | status;
|
||||
}
|
||||
|
||||
static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
|
||||
static inline u8 get_status_byte(struct scsi_cmnd *cmd)
|
||||
{
|
||||
cmd->result = (cmd->result & 0xffff00ff) | (status << 8);
|
||||
return cmd->result & 0xff;
|
||||
}
|
||||
|
||||
static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
|
||||
@@ -325,9 +325,36 @@ static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
|
||||
cmd->result = (cmd->result & 0xff00ffff) | (status << 16);
|
||||
}
|
||||
|
||||
static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
|
||||
static inline u8 get_host_byte(struct scsi_cmnd *cmd)
|
||||
{
|
||||
cmd->result = (cmd->result & 0x00ffffff) | (status << 24);
|
||||
return (cmd->result >> 16) & 0xff;
|
||||
}
|
||||
|
||||
/**
|
||||
* scsi_msg_to_host_byte() - translate message byte
|
||||
*
|
||||
* Translate the SCSI parallel message byte to a matching
|
||||
* host byte setting. A message of COMMAND_COMPLETE indicates
|
||||
* a successful command execution, any other message indicate
|
||||
* an error. As the messages themselves only have a meaning
|
||||
* for the SCSI parallel protocol this function translates
|
||||
* them into a matching host byte value for SCSI EH.
|
||||
*/
|
||||
static inline void scsi_msg_to_host_byte(struct scsi_cmnd *cmd, u8 msg)
|
||||
{
|
||||
switch (msg) {
|
||||
case COMMAND_COMPLETE:
|
||||
break;
|
||||
case ABORT_TASK_SET:
|
||||
set_host_byte(cmd, DID_ABORT);
|
||||
break;
|
||||
case TARGET_RESET:
|
||||
set_host_byte(cmd, DID_RESET);
|
||||
break;
|
||||
default:
|
||||
set_host_byte(cmd, DID_ERROR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
|
||||
@@ -341,4 +368,7 @@ static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
|
||||
return xfer_len;
|
||||
}
|
||||
|
||||
extern void scsi_build_sense(struct scsi_cmnd *scmd, int desc,
|
||||
u8 key, u8 asc, u8 ascq);
|
||||
|
||||
#endif /* _SCSI_SCSI_CMND_H */
|
||||
|
||||
@@ -764,7 +764,7 @@ extern void scsi_host_put(struct Scsi_Host *t);
|
||||
extern struct Scsi_Host *scsi_host_lookup(unsigned short);
|
||||
extern const char *scsi_host_state_name(enum scsi_host_state);
|
||||
extern void scsi_host_complete_all_commands(struct Scsi_Host *shost,
|
||||
int status);
|
||||
enum scsi_host_status status);
|
||||
|
||||
static inline int __must_check scsi_add_host(struct Scsi_Host *host,
|
||||
struct device *dev)
|
||||
|
||||
@@ -190,39 +190,21 @@ struct scsi_varlen_cdb_hdr {
|
||||
* SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft
|
||||
* T10/1561-D Revision 4 Draft dated 7th November 2002.
|
||||
*/
|
||||
#define SAM_STAT_GOOD 0x00
|
||||
#define SAM_STAT_CHECK_CONDITION 0x02
|
||||
#define SAM_STAT_CONDITION_MET 0x04
|
||||
#define SAM_STAT_BUSY 0x08
|
||||
#define SAM_STAT_INTERMEDIATE 0x10
|
||||
#define SAM_STAT_INTERMEDIATE_CONDITION_MET 0x14
|
||||
#define SAM_STAT_RESERVATION_CONFLICT 0x18
|
||||
#define SAM_STAT_COMMAND_TERMINATED 0x22 /* obsolete in SAM-3 */
|
||||
#define SAM_STAT_TASK_SET_FULL 0x28
|
||||
#define SAM_STAT_ACA_ACTIVE 0x30
|
||||
#define SAM_STAT_TASK_ABORTED 0x40
|
||||
|
||||
/*
|
||||
* Status codes. These are deprecated as they are shifted 1 bit right
|
||||
* from those found in the SCSI standards. This causes confusion for
|
||||
* applications that are ported to several OSes. Prefer SAM Status codes
|
||||
* above.
|
||||
*/
|
||||
|
||||
#define GOOD 0x00
|
||||
#define CHECK_CONDITION 0x01
|
||||
#define CONDITION_GOOD 0x02
|
||||
#define BUSY 0x04
|
||||
#define INTERMEDIATE_GOOD 0x08
|
||||
#define INTERMEDIATE_C_GOOD 0x0a
|
||||
#define RESERVATION_CONFLICT 0x0c
|
||||
#define COMMAND_TERMINATED 0x11
|
||||
#define QUEUE_FULL 0x14
|
||||
#define ACA_ACTIVE 0x18
|
||||
#define TASK_ABORTED 0x20
|
||||
|
||||
#define STATUS_MASK 0xfe
|
||||
enum sam_status {
|
||||
SAM_STAT_GOOD = 0x00,
|
||||
SAM_STAT_CHECK_CONDITION = 0x02,
|
||||
SAM_STAT_CONDITION_MET = 0x04,
|
||||
SAM_STAT_BUSY = 0x08,
|
||||
SAM_STAT_INTERMEDIATE = 0x10,
|
||||
SAM_STAT_INTERMEDIATE_CONDITION_MET = 0x14,
|
||||
SAM_STAT_RESERVATION_CONFLICT = 0x18,
|
||||
SAM_STAT_COMMAND_TERMINATED = 0x22, /* obsolete in SAM-3 */
|
||||
SAM_STAT_TASK_SET_FULL = 0x28,
|
||||
SAM_STAT_ACA_ACTIVE = 0x30,
|
||||
SAM_STAT_TASK_ABORTED = 0x40,
|
||||
};
|
||||
|
||||
#define STATUS_MASK 0xfe
|
||||
/*
|
||||
* SENSE KEYS
|
||||
*/
|
||||
@@ -341,4 +323,16 @@ enum zbc_zone_cond {
|
||||
ZBC_ZONE_COND_OFFLINE = 0xf,
|
||||
};
|
||||
|
||||
/* Version descriptor values for INQUIRY */
|
||||
enum scsi_version_descriptor {
|
||||
SCSI_VERSION_DESCRIPTOR_FCP4 = 0x0a40,
|
||||
SCSI_VERSION_DESCRIPTOR_ISCSI = 0x0960,
|
||||
SCSI_VERSION_DESCRIPTOR_SAM5 = 0x00a0,
|
||||
SCSI_VERSION_DESCRIPTOR_SAS3 = 0x0c60,
|
||||
SCSI_VERSION_DESCRIPTOR_SBC3 = 0x04c0,
|
||||
SCSI_VERSION_DESCRIPTOR_SBP3 = 0x0980,
|
||||
SCSI_VERSION_DESCRIPTOR_SPC4 = 0x0460,
|
||||
SCSI_VERSION_DESCRIPTOR_SRP = 0x0940
|
||||
};
|
||||
|
||||
#endif /* _SCSI_PROTO_H_ */
|
||||
|
||||
74
include/scsi/scsi_status.h
Normal file
74
include/scsi/scsi_status.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
#ifndef _SCSI_SCSI_STATUS_H
|
||||
#define _SCSI_SCSI_STATUS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <scsi/scsi_proto.h>
|
||||
|
||||
/* Message codes. */
|
||||
enum scsi_msg_byte {
|
||||
COMMAND_COMPLETE = 0x00,
|
||||
EXTENDED_MESSAGE = 0x01,
|
||||
SAVE_POINTERS = 0x02,
|
||||
RESTORE_POINTERS = 0x03,
|
||||
DISCONNECT = 0x04,
|
||||
INITIATOR_ERROR = 0x05,
|
||||
ABORT_TASK_SET = 0x06,
|
||||
MESSAGE_REJECT = 0x07,
|
||||
NOP = 0x08,
|
||||
MSG_PARITY_ERROR = 0x09,
|
||||
LINKED_CMD_COMPLETE = 0x0a,
|
||||
LINKED_FLG_CMD_COMPLETE = 0x0b,
|
||||
TARGET_RESET = 0x0c,
|
||||
ABORT_TASK = 0x0d,
|
||||
CLEAR_TASK_SET = 0x0e,
|
||||
INITIATE_RECOVERY = 0x0f, /* SCSI-II only */
|
||||
RELEASE_RECOVERY = 0x10, /* SCSI-II only */
|
||||
TERMINATE_IO_PROC = 0x11, /* SCSI-II only */
|
||||
CLEAR_ACA = 0x16,
|
||||
LOGICAL_UNIT_RESET = 0x17,
|
||||
SIMPLE_QUEUE_TAG = 0x20,
|
||||
HEAD_OF_QUEUE_TAG = 0x21,
|
||||
ORDERED_QUEUE_TAG = 0x22,
|
||||
IGNORE_WIDE_RESIDUE = 0x23,
|
||||
ACA = 0x24,
|
||||
QAS_REQUEST = 0x55,
|
||||
|
||||
/* Old SCSI2 names, don't use in new code */
|
||||
BUS_DEVICE_RESET = TARGET_RESET,
|
||||
ABORT = ABORT_TASK_SET,
|
||||
};
|
||||
|
||||
/* Host byte codes. */
|
||||
enum scsi_host_status {
|
||||
DID_OK = 0x00, /* NO error */
|
||||
DID_NO_CONNECT = 0x01, /* Couldn't connect before timeout period */
|
||||
DID_BUS_BUSY = 0x02, /* BUS stayed busy through time out period */
|
||||
DID_TIME_OUT = 0x03, /* TIMED OUT for other reason */
|
||||
DID_BAD_TARGET = 0x04, /* BAD target. */
|
||||
DID_ABORT = 0x05, /* Told to abort for some other reason */
|
||||
DID_PARITY = 0x06, /* Parity error */
|
||||
DID_ERROR = 0x07, /* Internal error */
|
||||
DID_RESET = 0x08, /* Reset by somebody. */
|
||||
DID_BAD_INTR = 0x09, /* Got an interrupt we weren't expecting. */
|
||||
DID_PASSTHROUGH = 0x0a, /* Force command past mid-layer */
|
||||
DID_SOFT_ERROR = 0x0b, /* The low level driver just wish a retry */
|
||||
DID_IMM_RETRY = 0x0c, /* Retry without decrementing retry count */
|
||||
DID_REQUEUE = 0x0d, /* Requeue command (no immediate retry) also
|
||||
* without decrementing the retry count */
|
||||
DID_TRANSPORT_DISRUPTED = 0x0e, /* Transport error disrupted execution
|
||||
* and the driver blocked the port to
|
||||
* recover the link. Transport class will
|
||||
* retry or fail IO */
|
||||
DID_TRANSPORT_FAILFAST = 0x0f, /* Transport class fastfailed the io */
|
||||
DID_TARGET_FAILURE = 0x10, /* Permanent target failure, do not retry on
|
||||
* other paths */
|
||||
DID_NEXUS_FAILURE = 0x11, /* Permanent nexus failure, retry on other
|
||||
* paths might yield different results */
|
||||
DID_ALLOC_FAILURE = 0x12, /* Space allocation on the device failed */
|
||||
DID_MEDIUM_ERROR = 0x13, /* Medium error */
|
||||
DID_TRANSPORT_MARGINAL = 0x14, /* Transport marginal errors */
|
||||
};
|
||||
|
||||
#endif /* _SCSI_SCSI_STATUS_H */
|
||||
@@ -517,10 +517,11 @@ enum fc_host_event_code {
|
||||
* managed by the transport w/o driver interaction.
|
||||
*/
|
||||
|
||||
#define FC_VENDOR_IDENTIFIER 8
|
||||
#define FC_FC4_LIST_SIZE 32
|
||||
#define FC_SYMBOLIC_NAME_SIZE 256
|
||||
#define FC_VERSION_STRING_SIZE 64
|
||||
#define FC_SERIAL_NUMBER_SIZE 80
|
||||
#define FC_SERIAL_NUMBER_SIZE 64
|
||||
|
||||
struct fc_host_attrs {
|
||||
/* Fixed Attributes */
|
||||
@@ -532,6 +533,10 @@ struct fc_host_attrs {
|
||||
u32 supported_speeds;
|
||||
u32 maxframe_size;
|
||||
u16 max_npiv_vports;
|
||||
u32 max_ct_payload;
|
||||
u32 num_ports;
|
||||
u32 num_discovered_ports;
|
||||
u32 bootbios_state;
|
||||
char serial_number[FC_SERIAL_NUMBER_SIZE];
|
||||
char manufacturer[FC_SERIAL_NUMBER_SIZE];
|
||||
char model[FC_SYMBOLIC_NAME_SIZE];
|
||||
@@ -540,6 +545,9 @@ struct fc_host_attrs {
|
||||
char driver_version[FC_VERSION_STRING_SIZE];
|
||||
char firmware_version[FC_VERSION_STRING_SIZE];
|
||||
char optionrom_version[FC_VERSION_STRING_SIZE];
|
||||
char vendor_identifier[FC_VENDOR_IDENTIFIER];
|
||||
char bootbios_version[FC_SYMBOLIC_NAME_SIZE];
|
||||
|
||||
|
||||
/* Dynamic Attributes */
|
||||
u32 port_id;
|
||||
@@ -573,6 +581,9 @@ struct fc_host_attrs {
|
||||
|
||||
/* bsg support */
|
||||
struct request_queue *rqst_q;
|
||||
|
||||
/* FDMI support version*/
|
||||
u8 fdmi_version;
|
||||
};
|
||||
|
||||
#define shost_to_fc_host(x) \
|
||||
@@ -652,6 +663,18 @@ struct fc_host_attrs {
|
||||
(((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q)
|
||||
#define fc_host_dev_loss_tmo(x) \
|
||||
(((struct fc_host_attrs *)(x)->shost_data)->dev_loss_tmo)
|
||||
#define fc_host_max_ct_payload(x) \
|
||||
(((struct fc_host_attrs *)(x)->shost_data)->max_ct_payload)
|
||||
#define fc_host_vendor_identifier(x) \
|
||||
(((struct fc_host_attrs *)(x)->shost_data)->vendor_identifier)
|
||||
#define fc_host_num_discovered_ports(x) \
|
||||
(((struct fc_host_attrs *)(x)->shost_data)->num_discovered_ports)
|
||||
#define fc_host_num_ports(x) \
|
||||
(((struct fc_host_attrs *)(x)->shost_data)->num_ports)
|
||||
#define fc_host_bootbios_version(x) \
|
||||
(((struct fc_host_attrs *)(x)->shost_data)->bootbios_version)
|
||||
#define fc_host_bootbios_state(x) \
|
||||
(((struct fc_host_attrs *)(x)->shost_data)->bootbios_state)
|
||||
|
||||
/* The functions by which the transport class and the driver communicate */
|
||||
struct fc_function_template {
|
||||
|
||||
@@ -82,6 +82,7 @@ struct iscsi_transport {
|
||||
void (*destroy_session) (struct iscsi_cls_session *session);
|
||||
struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess,
|
||||
uint32_t cid);
|
||||
void (*unbind_conn) (struct iscsi_cls_conn *conn, bool is_active);
|
||||
int (*bind_conn) (struct iscsi_cls_session *session,
|
||||
struct iscsi_cls_conn *cls_conn,
|
||||
uint64_t transport_eph, int is_leading);
|
||||
@@ -196,15 +197,23 @@ enum iscsi_connection_state {
|
||||
ISCSI_CONN_BOUND,
|
||||
};
|
||||
|
||||
#define ISCSI_CLS_CONN_BIT_CLEANUP 1
|
||||
|
||||
struct iscsi_cls_conn {
|
||||
struct list_head conn_list; /* item in connlist */
|
||||
struct list_head conn_list_err; /* item in connlist_err */
|
||||
void *dd_data; /* LLD private data */
|
||||
struct iscsi_transport *transport;
|
||||
uint32_t cid; /* connection id */
|
||||
/*
|
||||
* This protects the conn startup and binding/unbinding of the ep to
|
||||
* the conn. Unbinding includes ep_disconnect and stop_conn.
|
||||
*/
|
||||
struct mutex ep_mutex;
|
||||
struct iscsi_endpoint *ep;
|
||||
|
||||
unsigned long flags;
|
||||
struct work_struct cleanup_work;
|
||||
|
||||
struct device dev; /* sysfs transport/container device */
|
||||
enum iscsi_connection_state state;
|
||||
};
|
||||
@@ -434,6 +443,8 @@ extern void iscsi_remove_session(struct iscsi_cls_session *session);
|
||||
extern void iscsi_free_session(struct iscsi_cls_session *session);
|
||||
extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess,
|
||||
int dd_size, uint32_t cid);
|
||||
extern void iscsi_put_conn(struct iscsi_cls_conn *conn);
|
||||
extern void iscsi_get_conn(struct iscsi_cls_conn *conn);
|
||||
extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn);
|
||||
extern void iscsi_unblock_session(struct iscsi_cls_session *session);
|
||||
extern void iscsi_block_session(struct iscsi_cls_session *session);
|
||||
@@ -441,6 +452,7 @@ extern int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time);
|
||||
extern struct iscsi_endpoint *iscsi_create_endpoint(int dd_size);
|
||||
extern void iscsi_destroy_endpoint(struct iscsi_endpoint *ep);
|
||||
extern struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle);
|
||||
extern void iscsi_put_endpoint(struct iscsi_endpoint *ep);
|
||||
extern int iscsi_block_scsi_eh(struct scsi_cmnd *cmd);
|
||||
extern struct iscsi_iface *iscsi_create_iface(struct Scsi_Host *shost,
|
||||
struct iscsi_transport *t,
|
||||
|
||||
@@ -131,6 +131,39 @@ struct compat_sg_io_hdr {
|
||||
#define SG_INFO_DIRECT_IO 0x2 /* direct IO requested and performed */
|
||||
#define SG_INFO_MIXED_IO 0x4 /* part direct, part indirect IO */
|
||||
|
||||
/*
|
||||
* Obsolete DRIVER_SENSE driver byte
|
||||
*
|
||||
* Originally the SCSI midlayer would set the DRIVER_SENSE driver byte when
|
||||
* a sense code was generated and a sense buffer was allocated.
|
||||
* However, as nowadays every scsi command has a sense code allocated this
|
||||
* distinction became moot as one could check the sense buffer directly.
|
||||
* Consequently this byte is not set anymore from the midlayer, but SG will
|
||||
* keep setting this byte to be compatible with previous releases.
|
||||
*/
|
||||
#define DRIVER_SENSE 0x08
|
||||
/* Obsolete driver_byte() declaration */
|
||||
#define driver_byte(result) (((result) >> 24) & 0xff)
|
||||
|
||||
/*
|
||||
* Original linux SCSI Status codes. They are shifted 1 bit right
|
||||
* from those found in the SCSI standards.
|
||||
*/
|
||||
|
||||
#define GOOD 0x00
|
||||
#define CHECK_CONDITION 0x01
|
||||
#define CONDITION_GOOD 0x02
|
||||
#define BUSY 0x04
|
||||
#define INTERMEDIATE_GOOD 0x08
|
||||
#define INTERMEDIATE_C_GOOD 0x0a
|
||||
#define RESERVATION_CONFLICT 0x0c
|
||||
#define COMMAND_TERMINATED 0x11
|
||||
#define QUEUE_FULL 0x14
|
||||
#define ACA_ACTIVE 0x18
|
||||
#define TASK_ABORTED 0x20
|
||||
|
||||
/* Obsolete status_byte() declaration */
|
||||
#define status_byte(result) (((result) >> 1) & 0x7f)
|
||||
|
||||
typedef struct sg_scsi_id { /* used by SG_GET_SCSI_ID ioctl() */
|
||||
int host_no; /* as in "scsi<n>" where 'n' is one of 0, 1, 2 etc */
|
||||
@@ -145,7 +178,7 @@ typedef struct sg_scsi_id { /* used by SG_GET_SCSI_ID ioctl() */
|
||||
|
||||
typedef struct sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */
|
||||
char req_state; /* 0 -> not used, 1 -> written, 2 -> ready to read */
|
||||
char orphan; /* 0 -> normal request, 1 -> from interruped SG_IO */
|
||||
char orphan; /* 0 -> normal request, 1 -> from interrupted SG_IO */
|
||||
char sg_io_owned; /* 0 -> complete with read(), 1 -> owned by SG_IO */
|
||||
char problem; /* 0 -> no problem detected, 1 -> error to report */
|
||||
int pack_id; /* pack_id associated with request */
|
||||
|
||||
Reference in New Issue
Block a user