From 042ebd293b862c491e31aea17b540317a1b9af21 Mon Sep 17 00:00:00 2001 From: Jason Yan Date: Wed, 6 Sep 2017 17:15:04 +0800 Subject: scsi: libsas: kill useless ha_event and do some cleanup The ha_event now has only one event HAE_RESET, and this event does nothing. Kill it and do some cleanup. This is a preparation for enhance libsas hotplug feature in the next patches. Signed-off-by: Jason Yan Signed-off-by: John Garry Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig CC: Johannes Thumshirn CC: Ewan Milne CC: Christoph Hellwig CC: Tomas Henzl CC: Dan Williams Signed-off-by: Martin K. Petersen --- include/scsi/libsas.h | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'include') diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 6c0dc6155ee7..52b3e863bea8 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -60,11 +60,6 @@ enum sas_phy_type { * so when updating/adding events here, please also * update the other file too. */ -enum ha_event { - HAE_RESET = 0U, - HA_NUM_EVENTS = 1, -}; - enum port_event { PORTE_BYTES_DMAED = 0U, PORTE_BROADCAST_RCVD = 1, @@ -362,18 +357,6 @@ struct scsi_core { }; -struct sas_ha_event { - struct sas_work work; - struct sas_ha_struct *ha; -}; - -static inline struct sas_ha_event *to_sas_ha_event(struct work_struct *work) -{ - struct sas_ha_event *ev = container_of(work, typeof(*ev), work.work); - - return ev; -} - enum sas_ha_state { SAS_HA_REGISTERED, SAS_HA_DRAINING, @@ -383,9 +366,6 @@ enum sas_ha_state { struct sas_ha_struct { /* private: */ - struct sas_ha_event ha_events[HA_NUM_EVENTS]; - unsigned long pending; - struct list_head defer_q; /* work queued while draining */ struct mutex drain_mutex; unsigned long state; @@ -415,7 +395,6 @@ struct sas_ha_struct { * their siblings when forming wide ports */ /* LLDD calls these to notify the class of an event. */ - int (*notify_ha_event)(struct sas_ha_struct *, enum ha_event); int (*notify_port_event)(struct asd_sas_phy *, enum port_event); int (*notify_phy_event)(struct asd_sas_phy *, enum phy_event); -- cgit v1.2.3 From 0d78f969b10f27e0be34210d482a01e1ee92994c Mon Sep 17 00:00:00 2001 From: Jason Yan Date: Wed, 6 Sep 2017 17:15:05 +0800 Subject: scsi: libsas: remove the numbering for each event enum Numbering for each event enum makes no sense. Remove the numbering so that we don't have to calculate the number by hand every time. Signed-off-by: Jason Yan CC: John Garry CC: Johannes Thumshirn CC: Ewan Milne CC: Christoph Hellwig CC: Tomas Henzl Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen --- include/scsi/libsas.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 52b3e863bea8..4276f5b5686f 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -62,31 +62,31 @@ enum sas_phy_type { */ enum port_event { PORTE_BYTES_DMAED = 0U, - PORTE_BROADCAST_RCVD = 1, - PORTE_LINK_RESET_ERR = 2, - PORTE_TIMER_EVENT = 3, - PORTE_HARD_RESET = 4, - PORT_NUM_EVENTS = 5, + PORTE_BROADCAST_RCVD, + PORTE_LINK_RESET_ERR, + PORTE_TIMER_EVENT, + PORTE_HARD_RESET, + PORT_NUM_EVENTS, }; enum phy_event { PHYE_LOSS_OF_SIGNAL = 0U, - PHYE_OOB_DONE = 1, - PHYE_OOB_ERROR = 2, - PHYE_SPINUP_HOLD = 3, /* hot plug SATA, no COMWAKE sent */ - PHYE_RESUME_TIMEOUT = 4, - PHY_NUM_EVENTS = 5, + PHYE_OOB_DONE, + PHYE_OOB_ERROR, + PHYE_SPINUP_HOLD, /* hot plug SATA, no COMWAKE sent */ + PHYE_RESUME_TIMEOUT, + PHY_NUM_EVENTS, }; enum discover_event { DISCE_DISCOVER_DOMAIN = 0U, - DISCE_REVALIDATE_DOMAIN = 1, - DISCE_PORT_GONE = 2, - DISCE_PROBE = 3, - DISCE_SUSPEND = 4, - DISCE_RESUME = 5, - DISCE_DESTRUCT = 6, - DISC_NUM_EVENTS = 7, + DISCE_REVALIDATE_DOMAIN, + DISCE_PORT_GONE, + DISCE_PROBE, + DISCE_SUSPEND, + DISCE_RESUME, + DISCE_DESTRUCT, + DISC_NUM_EVENTS, }; /* ---------- Expander Devices ---------- */ -- cgit v1.2.3 From 8a11282aa1b7d618f29f531e9d992561f87cfd8a Mon Sep 17 00:00:00 2001 From: Jason Yan Date: Wed, 6 Sep 2017 17:15:06 +0800 Subject: scsi: libsas: remove unused port_gone_completion and DISCE_PORT_GONE No one uses the port_gone_completion in struct asd_sas_port and DISCE_PORT_GONE in enum disover_event, clean them out. Signed-off-by: Jason Yan CC: Johannes Thumshirn CC: Ewan Milne CC: Christoph Hellwig CC: Tomas Henzl CC: Dan Williams Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen --- include/scsi/libsas.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 4276f5b5686f..ab6e18f1c01f 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -81,7 +81,6 @@ enum phy_event { enum discover_event { DISCE_DISCOVER_DOMAIN = 0U, DISCE_REVALIDATE_DOMAIN, - DISCE_PORT_GONE, DISCE_PROBE, DISCE_SUSPEND, DISCE_RESUME, @@ -256,8 +255,6 @@ struct sas_discovery { /* The port struct is Class:RW, driver:RO */ struct asd_sas_port { /* private: */ - struct completion port_gone_completion; - struct sas_discovery disc; struct domain_device *port_dev; spinlock_t dev_list_lock; -- cgit v1.2.3 From aa8a84566282ac47bd861c3cc2538e1014228345 Mon Sep 17 00:00:00 2001 From: Damien Le Moal Date: Wed, 11 Oct 2017 05:54:21 +0900 Subject: scsi: sd_zbc: Move ZBC declarations to scsi_proto.h Move standard macro definitions for the zone types and zone conditions to scsi_proto.h together with the definitions related to the REPORT ZONES command. While at it, define all values in the enums to be clear. Also remove unnecessary includes in sd_zbc.c. No functional change is introduced by this patch. Signed-off-by: Damien Le Moal Reviewed-by: Bart Van Assche Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen --- include/scsi/scsi_proto.h | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/scsi/scsi_proto.h b/include/scsi/scsi_proto.h index 8c285d9a06d8..39130a9c05bf 100644 --- a/include/scsi/scsi_proto.h +++ b/include/scsi/scsi_proto.h @@ -301,19 +301,42 @@ struct scsi_lun { /* Reporting options for REPORT ZONES */ enum zbc_zone_reporting_options { - ZBC_ZONE_REPORTING_OPTION_ALL = 0, - ZBC_ZONE_REPORTING_OPTION_EMPTY, - ZBC_ZONE_REPORTING_OPTION_IMPLICIT_OPEN, - ZBC_ZONE_REPORTING_OPTION_EXPLICIT_OPEN, - ZBC_ZONE_REPORTING_OPTION_CLOSED, - ZBC_ZONE_REPORTING_OPTION_FULL, - ZBC_ZONE_REPORTING_OPTION_READONLY, - ZBC_ZONE_REPORTING_OPTION_OFFLINE, - ZBC_ZONE_REPORTING_OPTION_NEED_RESET_WP = 0x10, - ZBC_ZONE_REPORTING_OPTION_NON_SEQWRITE, - ZBC_ZONE_REPORTING_OPTION_NON_WP = 0x3f, + ZBC_ZONE_REPORTING_OPTION_ALL = 0x00, + ZBC_ZONE_REPORTING_OPTION_EMPTY = 0x01, + ZBC_ZONE_REPORTING_OPTION_IMPLICIT_OPEN = 0x02, + ZBC_ZONE_REPORTING_OPTION_EXPLICIT_OPEN = 0x03, + ZBC_ZONE_REPORTING_OPTION_CLOSED = 0x04, + ZBC_ZONE_REPORTING_OPTION_FULL = 0x05, + ZBC_ZONE_REPORTING_OPTION_READONLY = 0x06, + ZBC_ZONE_REPORTING_OPTION_OFFLINE = 0x07, + /* 0x08 to 0x0f are reserved */ + ZBC_ZONE_REPORTING_OPTION_NEED_RESET_WP = 0x10, + ZBC_ZONE_REPORTING_OPTION_NON_SEQWRITE = 0x11, + /* 0x12 to 0x3e are reserved */ + ZBC_ZONE_REPORTING_OPTION_NON_WP = 0x3f, }; #define ZBC_REPORT_ZONE_PARTIAL 0x80 +/* Zone types of REPORT ZONES zone descriptors */ +enum zbc_zone_type { + ZBC_ZONE_TYPE_CONV = 0x1, + ZBC_ZONE_TYPE_SEQWRITE_REQ = 0x2, + ZBC_ZONE_TYPE_SEQWRITE_PREF = 0x3, + /* 0x4 to 0xf are reserved */ +}; + +/* Zone conditions of REPORT ZONES zone descriptors */ +enum zbc_zone_cond { + ZBC_ZONE_COND_NO_WP = 0x0, + ZBC_ZONE_COND_EMPTY = 0x1, + ZBC_ZONE_COND_IMP_OPEN = 0x2, + ZBC_ZONE_COND_EXP_OPEN = 0x3, + ZBC_ZONE_COND_CLOSED = 0x4, + /* 0x5 to 0xc are reserved */ + ZBC_ZONE_COND_READONLY = 0xd, + ZBC_ZONE_COND_FULL = 0xe, + ZBC_ZONE_COND_OFFLINE = 0xf, +}; + #endif /* _SCSI_PROTO_H_ */ -- cgit v1.2.3 From f26aeada04938b99d6abbae9cd2de4ffa393e5d5 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Mon, 2 Oct 2017 16:26:35 +0200 Subject: scsi: scsi_devinfo: Reformat blacklist flags Reformat blacklist flags to make the values easier to read and to enhance error checking. Signed-off-by: Hannes Reinecke Reviewed-by: Bart van Assche Reviewed-by: Johannes Thumshirn Signed-off-by: Martin K. Petersen --- include/scsi/scsi_devinfo.h | 76 +++++++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 26 deletions(-) (limited to 'include') diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h index 9592570e092a..7a2329c026a4 100644 --- a/include/scsi/scsi_devinfo.h +++ b/include/scsi/scsi_devinfo.h @@ -3,31 +3,55 @@ /* * Flags for SCSI devices that need special treatment */ -#define BLIST_NOLUN 0x001 /* Only scan LUN 0 */ -#define BLIST_FORCELUN 0x002 /* Known to have LUNs, force scanning, - deprecated: Use max_luns=N */ -#define BLIST_BORKEN 0x004 /* Flag for broken handshaking */ -#define BLIST_KEY 0x008 /* unlock by special command */ -#define BLIST_SINGLELUN 0x010 /* Do not use LUNs in parallel */ -#define BLIST_NOTQ 0x020 /* Buggy Tagged Command Queuing */ -#define BLIST_SPARSELUN 0x040 /* Non consecutive LUN numbering */ -#define BLIST_MAX5LUN 0x080 /* Avoid LUNS >= 5 */ -#define BLIST_ISROM 0x100 /* Treat as (removable) CD-ROM */ -#define BLIST_LARGELUN 0x200 /* LUNs past 7 on a SCSI-2 device */ -#define BLIST_INQUIRY_36 0x400 /* override additional length field */ -#define BLIST_NOSTARTONADD 0x1000 /* do not do automatic start on add */ -#define BLIST_REPORTLUN2 0x20000 /* try REPORT_LUNS even for SCSI-2 devs - (if HBA supports more than 8 LUNs) */ -#define BLIST_NOREPORTLUN 0x40000 /* don't try REPORT_LUNS scan (SCSI-3 devs) */ -#define BLIST_NOT_LOCKABLE 0x80000 /* don't use PREVENT-ALLOW commands */ -#define BLIST_NO_ULD_ATTACH 0x100000 /* device is actually for RAID config */ -#define BLIST_SELECT_NO_ATN 0x200000 /* select without ATN */ -#define BLIST_RETRY_HWERROR 0x400000 /* retry HARDWARE_ERROR */ -#define BLIST_MAX_512 0x800000 /* maximum 512 sector cdb length */ -#define BLIST_NO_DIF 0x2000000 /* Disable T10 PI (DIF) */ -#define BLIST_SKIP_VPD_PAGES 0x4000000 /* Ignore SBC-3 VPD pages */ -#define BLIST_TRY_VPD_PAGES 0x10000000 /* Attempt to read VPD pages */ -#define BLIST_NO_RSOC 0x20000000 /* don't try to issue RSOC */ -#define BLIST_MAX_1024 0x40000000 /* maximum 1024 sector cdb length */ + +/* Only scan LUN 0 */ +#define BLIST_NOLUN ((__force __u32 __bitwise)(1 << 0)) +/* Known to have LUNs, force scanning. + * DEPRECATED: Use max_luns=N */ +#define BLIST_FORCELUN ((__force __u32 __bitwise)(1 << 1)) +/* Flag for broken handshaking */ +#define BLIST_BORKEN ((__force __u32 __bitwise)(1 << 2)) +/* unlock by special command */ +#define BLIST_KEY ((__force __u32 __bitwise)(1 << 3)) +/* Do not use LUNs in parallel */ +#define BLIST_SINGLELUN ((__force __u32 __bitwise)(1 << 4)) +/* Buggy Tagged Command Queuing */ +#define BLIST_NOTQ ((__force __u32 __bitwise)(1 << 5)) +/* Non consecutive LUN numbering */ +#define BLIST_SPARSELUN ((__force __u32 __bitwise)(1 << 6)) +/* Avoid LUNS >= 5 */ +#define BLIST_MAX5LUN ((__force __u32 __bitwise)(1 << 7)) +/* Treat as (removable) CD-ROM */ +#define BLIST_ISROM ((__force __u32 __bitwise)(1 << 8)) +/* LUNs past 7 on a SCSI-2 device */ +#define BLIST_LARGELUN ((__force __u32 __bitwise)(1 << 9)) +/* override additional length field */ +#define BLIST_INQUIRY_36 ((__force __u32 __bitwise)(1 << 10)) +/* do not do automatic start on add */ +#define BLIST_NOSTARTONADD ((__force __u32 __bitwise)(1 << 12)) +/* try REPORT_LUNS even for SCSI-2 devs (if HBA supports more than 8 LUNs) */ +#define BLIST_REPORTLUN2 ((__force __u32 __bitwise)(1 << 17)) +/* don't try REPORT_LUNS scan (SCSI-3 devs) */ +#define BLIST_NOREPORTLUN ((__force __u32 __bitwise)(1 << 18)) +/* don't use PREVENT-ALLOW commands */ +#define BLIST_NOT_LOCKABLE ((__force __u32 __bitwise)(1 << 19)) +/* device is actually for RAID config */ +#define BLIST_NO_ULD_ATTACH ((__force __u32 __bitwise)(1 << 20)) +/* select without ATN */ +#define BLIST_SELECT_NO_ATN ((__force __u32 __bitwise)(1 << 21)) +/* retry HARDWARE_ERROR */ +#define BLIST_RETRY_HWERROR ((__force __u32 __bitwise)(1 << 22)) +/* maximum 512 sector cdb length */ +#define BLIST_MAX_512 ((__force __u32 __bitwise)(1 << 23)) +/* Disable T10 PI (DIF) */ +#define BLIST_NO_DIF ((__force __u32 __bitwise)(1 << 25)) +/* Ignore SBC-3 VPD pages */ +#define BLIST_SKIP_VPD_PAGES ((__force __u32 __bitwise)(1 << 26)) +/* Attempt to read VPD pages */ +#define BLIST_TRY_VPD_PAGES ((__force __u32 __bitwise)(1 << 28)) +/* don't try to issue RSOC */ +#define BLIST_NO_RSOC ((__force __u32 __bitwise)(1 << 29)) +/* maximum 1024 sector cdb length */ +#define BLIST_MAX_1024 ((__force __u32 __bitwise)(1 << 30)) #endif -- cgit v1.2.3 From cf3431bba1df3b4f25b04900cb804d7e6e5eb6a9 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 17 Oct 2017 09:11:24 +0200 Subject: scsi: scsi_error: Handle power-on reset unit attention As per SAM there is a status precedence, with any sense code 29/XX taking second place just after an ACA ACTIVE status. Additionally, each target might prefer to not queue any unit attention conditions, but just report one. Due to the above, this will be that one with the highest precedence. This results in the sense code 29/XX effectively overwriting any other unit attention. Hence we should report the power-on reset to userland so that it can take appropriate action. Signed-off-by: Hannes Reinecke Signed-off-by: Martin K. Petersen --- include/scsi/scsi_device.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 82e93ee94708..d68985c366b0 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -64,9 +64,10 @@ enum scsi_device_event { SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED, /* 2A 01 UA reported */ SDEV_EVT_LUN_CHANGE_REPORTED, /* 3F 0E UA reported */ SDEV_EVT_ALUA_STATE_CHANGE_REPORTED, /* 2A 06 UA reported */ + SDEV_EVT_POWER_ON_RESET_OCCURRED, /* 29 00 UA reported */ SDEV_EVT_FIRST = SDEV_EVT_MEDIA_CHANGE, - SDEV_EVT_LAST = SDEV_EVT_ALUA_STATE_CHANGE_REPORTED, + SDEV_EVT_LAST = SDEV_EVT_POWER_ON_RESET_OCCURRED, SDEV_EVT_MAXBITS = SDEV_EVT_LAST + 1 }; -- cgit v1.2.3 From 335f83b9113421a65bfb19e0fa6a2b262ca86c26 Mon Sep 17 00:00:00 2001 From: James Smart Date: Fri, 3 Nov 2017 16:26:08 -0700 Subject: scsi: scsi_transport_fc: add 64GBIT and 128GBIT port speed definitions Add 64GBIT and 128GBIT port speed definitions. Upcoming hardware will reference these speeds. Signed-off-by: James Smart Signed-off-by: Martin K. Petersen --- include/scsi/scsi_transport_fc.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index e8644eea9fe5..8cf30215c177 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -139,6 +139,8 @@ enum fc_vport_state { #define FC_PORTSPEED_50GBIT 0x200 #define FC_PORTSPEED_100GBIT 0x400 #define FC_PORTSPEED_25GBIT 0x800 +#define FC_PORTSPEED_64BIT 0x1000 +#define FC_PORTSPEED_128BIT 0x2000 #define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */ /* -- cgit v1.2.3