Re: [PATCH] minimal SAS transport class
Jeff Garzik wrote: Luben Tuikov wrote: I never contended that userspace should be moved away from HCIL. Then, by implication, SAS and FC must continue to maintain HCIL-device maps. Yes, but not in the SAS/ FC/ iSCSI/ USB/ SBP-2/... low-level. HCIL does not exist there. HCIL is only a bonus for the interface to userspace. Therefore HCIL should be sticked to those devices by the core, somewhere close to the surface to userspace. The low-level should never care that arbitrary HCIL tuples should be added for some applications in userspace. Moreover... What I contend is that _internally_ SCSI Core start moving away from HCIL and towards SAM. ...the whole notion that low level provides hosts, channels etc. is often wrong. usb_storage and sbp2 always had to resort to a one target = one host implementation for several reasons. But there is no host, there is only a bunch of targets. [...] You will never be able to eliminate transport-specific code. That's the whole point of transport classes: encapsulate common transport code. Call it a transport library, rather than a class, if class gives people the shivers. Example: I have access to SAS+SATA host controllers from Adaptec and Company X. Both are largely software-based, directly controlling the PHY ports and manually performing all SAS+SATA discovery. Yes. And there would be transport classes which do not control hardware at all but rather push a high-level protocol (iSCSI, USB mass storage, SBP-2...) over another whole infrastructure which they share with many unrelated protocols. These SCSI transports are separated from hardware by several more layers of abstraction, at least two of those layers being in-kernel programming interfaces. -- Stefan Richter -=-=-=-= =--- ==-== http://arcgraph.de/sr/ - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libata: error processing + rw 6 byte fix
On Sat, Aug 27 2005, Douglas Gilbert wrote: Jeff Garzik wrote: Does the attached look OK to everybody? Jeff, Yes. And after an exchange with Jens, it would probably be safer to map transfer_length=0 for READ_10 and READ_16 (as well as WRITE_10 and WRITE_16) to a nop on the ATA side. Otherwise an ATA disk may attempt to transfer 2**16 sectors. [Only READ_6 and WRITE_6 have the quirky 0 means 256 definition, in the larger commands 0 means 0.] Yes, that part needs to be added as well. Jeff, the below looks good for the READ/WRITE_6 case. if (scsicmd[0] == READ_6 || scsicmd[0] == WRITE_6) { qc-nsect = tf-nsect = scsicmd[4]; + if (!qc-nsect) { + qc-nsect = 256; + if (lba48) + tf-hob_nsect = 1; + } + tf-lbal = scsicmd[3]; tf-lbam = scsicmd[2]; tf-lbah = scsicmd[1] 0x1f; /* mask out reserved bits */ -- Jens Axboe - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] minimal SAS transport class
Jeff Garzik wrote: An in-kernel C pointer, to a SCSI target device, is not sufficient in all cases to address a target. This plays out most often in userland interfaces such as ioctls. The C pointer is all the interface between core and low-level needs. All other means of addressing (IDs, labels, ... of which HCIL is only one kind) are only meaningful to userspace. The labels may be _generated_ at any level (low, core, high) depending on their context, but they are _used_ only in userspace-kernel interfaces. The core provides the map of devices-labels. -- Stefan Richter -=-=-=-= =--- ==-== http://arcgraph.de/sr/ - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libata: error processing + rw 6 byte fix
Here is the patch I just checked in. Jeff diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c @@ -630,11 +630,19 @@ static unsigned int ata_scsi_rw_xlat(str tf-lbah = scsicmd[3]; VPRINTK(ten-byte command\n); + if (qc-nsect == 0) /* we don't support length==0 cmds */ + return 1; return 0; } if (scsicmd[0] == READ_6 || scsicmd[0] == WRITE_6) { qc-nsect = tf-nsect = scsicmd[4]; + if (!qc-nsect) { + qc-nsect = 256; + if (lba48) + tf-hob_nsect = 1; + } + tf-lbal = scsicmd[3]; tf-lbam = scsicmd[2]; tf-lbah = scsicmd[1] 0x1f; /* mask out reserved bits */ @@ -674,6 +682,8 @@ static unsigned int ata_scsi_rw_xlat(str tf-lbah = scsicmd[7]; VPRINTK(sixteen-byte command\n); + if (qc-nsect == 0) /* we don't support length==0 cmds */ + return 1; return 0; }
Re: [PATCH] libata: error processing + rw 6 byte fix
On Sat, Aug 27 2005, Jeff Garzik wrote: Here is the patch I just checked in. Looks perfect. -- Jens Axboe - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/16] qla2xxx: Generalize WWN to u64 interger conversions.
On Fri, Aug 26, 2005 at 07:09:50PM -0700, Andrew Vasquez wrote: Generalize WWN to u64 interger conversions. On some platforms the hard-casting of the 8 byte node_name and port_name arrays to an u64 would cause unaligned-access warnings. Generalize the conversions with consistent shifting of WWN bytes. Signed-off-by: Andrew Vasquez [EMAIL PROTECTED] --- drivers/scsi/qla2xxx/qla_attr.c | 27 +-- 1 files changed, 17 insertions(+), 10 deletions(-) c7a5df1dc950e8a1cc04aa9a184619dfc78e5ed6 diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -345,6 +345,15 @@ struct class_device_attribute *qla2x00_h /* Host attributes. */ +static u64 +wwn_to_u64(uint8_t *wwn) +{ + return (u64)wwn[0] 56 | (u64)wwn[1] 48 | + (u64)wwn[2] 40 | (u64)wwn[3] 32 | + (u64)wwn[4] 24 | (u64)wwn[5] 16 | + (u64)wwn[6] 8 | (u64)wwn[7]; +} Shouldn't this go into the transport class? Could probably be an inline aswell. - To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] zfcp: add rports to enable scsi_add_device to work again
Hi, this patch fixes a severe problem with 2.6.13-rc7. Due to recent SCSI changes it is not possible to add any LUNs to the zfcp device driver anymore. With registration of remote ports this is fixed. Please integrate the patch in the 2.6.13 kernel or if it is already too late for this release then please integrate it in 2.6.13.1 Thanks a lot. Regards, Andreas Signed-off-by: Andreas Herrmann [EMAIL PROTECTED] diffstat: zfcp_aux.c | 29 +++-- zfcp_ccw.c | 10 ++ zfcp_def.h |2 +- zfcp_erp.c | 25 ++--- zfcp_ext.h |2 ++ zfcp_fsf.c |1 + zfcp_scsi.c | 25 - 7 files changed, 63 insertions(+), 31 deletions(-) diff -urN linux-2.6.13-rcx/drivers/s390/scsi/zfcp_aux.c linux-2.6.13-zfcpfctc/drivers/s390/scsi/zfcp_aux.c --- linux-2.6.13-rcx/drivers/s390/scsi/zfcp_aux.c 2005-08-25 10:53:15.0 +0200 +++ linux-2.6.13-zfcpfctc/drivers/s390/scsi/zfcp_aux.c 2005-08-27 13:05:17.0 +0200 @@ -1299,13 +1299,10 @@ zfcp_port_enqueue(struct zfcp_adapter *adapter, wwn_t wwpn, u32 status, u32 d_id) { - struct zfcp_port *port, *tmp_port; + struct zfcp_port *port; int check_wwpn; - scsi_id_t scsi_id; - int found; check_wwpn = !(status ZFCP_STATUS_PORT_NO_WWPN); - /* * check that there is no port with this WWPN already in list */ @@ -1368,7 +1365,7 @@ } else { snprintf(port-sysfs_device.bus_id, BUS_ID_SIZE, 0x%016llx, wwpn); - port-sysfs_device.parent = adapter-ccw_device-dev; + port-sysfs_device.parent = adapter-ccw_device-dev; } port-sysfs_device.release = zfcp_sysfs_port_release; dev_set_drvdata(port-sysfs_device, port); @@ -1388,24 +1385,8 @@ zfcp_port_get(port); - scsi_id = 1; - found = 0; write_lock_irq(zfcp_data.config_lock); - list_for_each_entry(tmp_port, adapter-port_list_head, list) { - if (atomic_test_mask(ZFCP_STATUS_PORT_NO_SCSI_ID, -tmp_port-status)) - continue; - if (tmp_port-scsi_id != scsi_id) { - found = 1; - break; - } - scsi_id++; - } - port-scsi_id = scsi_id; - if (found) - list_add_tail(port-list, tmp_port-list); - else - list_add_tail(port-list, adapter-port_list_head); + list_add_tail(port-list, adapter-port_list_head); atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, port-status); atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, port-status); if (d_id == ZFCP_DID_DIRECTORY_SERVICE) @@ -1422,11 +1403,15 @@ void zfcp_port_dequeue(struct zfcp_port *port) { + struct fc_port *rport; + zfcp_port_wait(port); write_lock_irq(zfcp_data.config_lock); list_del(port-list); port-adapter-ports--; write_unlock_irq(zfcp_data.config_lock); + if (port-rport) + fc_remote_port_delete(rport); zfcp_adapter_put(port-adapter); zfcp_sysfs_port_remove_files(port-sysfs_device, atomic_read(port-status)); diff -urN linux-2.6.13-rcx/drivers/s390/scsi/zfcp_ccw.c linux-2.6.13-zfcpfctc/drivers/s390/scsi/zfcp_ccw.c --- linux-2.6.13-rcx/drivers/s390/scsi/zfcp_ccw.c 2005-03-02 08:37:50.0 +0100 +++ linux-2.6.13-zfcpfctc/drivers/s390/scsi/zfcp_ccw.c 2005-08-27 13:28:35.0 +0200 @@ -202,9 +202,19 @@ zfcp_ccw_set_offline(struct ccw_device *ccw_device) { struct zfcp_adapter *adapter; + struct zfcp_port *port; + struct fc_port *rport; down(zfcp_data.config_sema); adapter = dev_get_drvdata(ccw_device-dev); + /* might be racy, but we cannot take config_lock due to the fact that + fc_remote_port_delete might sleep */ + list_for_each_entry(port, adapter-port_list_head, list) + if (port-rport) { + rport = port-rport; + port-rport = NULL; + fc_remote_port_delete(rport); + } zfcp_erp_adapter_shutdown(adapter, 0); zfcp_erp_wait(adapter); zfcp_adapter_scsi_unregister(adapter); diff -urN linux-2.6.13-rcx/drivers/s390/scsi/zfcp_def.h linux-2.6.13-zfcpfctc/drivers/s390/scsi/zfcp_def.h --- linux-2.6.13-rcx/drivers/s390/scsi/zfcp_def.h 2005-08-25 10:53:15.0 +0200 +++ linux-2.6.13-zfcpfctc/drivers/s390/scsi/zfcp_def.h 2005-08-26 19:00:18.0 +0200 @@ -906,6 +906,7 @@ */ struct zfcp_port { struct device sysfs_device; /* sysfs device */ + struct fc_rport*rport; /* rport of fc transport class */ struct list_head list; /* list of remote ports */ atomic_t
[PATCH] libata: scsi error handling
Jeff, Here is a follow on patch based on lk 2.6.13-rc7 plus the start_stop_unit patch and the rw_zero_length patch. It adds more general error processing, typically for problems (or an early finish) detected while a SCSI command is being processed prior to an ATA command being executed. Changelog: - add extern ata_scsi_set_sense() to build SCSI sense data and corresponding status - this allows removal of extern ata_scsi_badcmd() and static inline ata_bad_scsiop() and ata_bad_cdb() - change xlat functions in libata-scsi so they are responsible for SCSI status and sense data when they return 1. This allows GOOD status or a specialized error to be set. - set DRIVER_SENSE when SAM_STAT_CHECK_CONDITION is flagged in scsi_cmnd::result - yield an error for mode sense requests for saved values [sat-r05] - change recent rw_zero_length patch to do nothing (yield GOOD status) when transfer_length==0 for 10 and 16 byte READ and WRITE commands (SBC-2). Doug Gilbert --- linux/drivers/scsi/libata.h 2005-08-16 12:45:37.0 +1000 +++ linux/drivers/scsi/libata.h2613rc6xa 2005-08-17 23:01:08.0 +1000 @@ -69,21 +69,9 @@ unsigned int buflen); extern unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf, unsigned int buflen); -extern void ata_scsi_badcmd(struct scsi_cmnd *cmd, - void (*done)(struct scsi_cmnd *), - u8 asc, u8 ascq); +extern void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq); extern void ata_scsi_rbuf_fill(struct ata_scsi_args *args, unsigned int (*actor) (struct ata_scsi_args *args, u8 *rbuf, unsigned int buflen)); -static inline void ata_bad_scsiop(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) -{ - ata_scsi_badcmd(cmd, done, 0x20, 0x00); -} - -static inline void ata_bad_cdb(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) -{ - ata_scsi_badcmd(cmd, done, 0x24, 0x00); -} - #endif /* __LIBATA_H__ */ --- linux/drivers/scsi/libata-scsi.c 2005-08-28 10:44:31.0 +1000 +++ linux/drivers/scsi/libata-scsi.c2613rc7ssrw0_err 2005-08-28 13:24:29.0 +1000 @@ -37,6 +37,14 @@ static struct ata_device * ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev); +static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, + void (*done)(struct scsi_cmnd *)) +{ + ata_scsi_set_sense(cmd, ILLEGAL_REQUEST, 0x24, 0x0); + /* Invalid field in cbd */ + done(cmd); +} + /** * ata_std_bios_param - generic bios head/sector/cylinder calculator used by sd. @@ -171,7 +179,6 @@ { struct scsi_cmnd *cmd = qc-scsicmd; u8 err = 0; - unsigned char *sb = cmd-sense_buffer; /* Based on the 3ware driver translation table */ static unsigned char sense_table[][4] = { /* BBD|ECC|ID|MAR */ @@ -214,8 +221,6 @@ }; int i = 0; - cmd-result = SAM_STAT_CHECK_CONDITION; - /* * Is this an error we can process/parse */ @@ -270,11 +275,9 @@ /* Look for best matches first */ if((sense_table[i][0] err) == sense_table[i][0]) { - sb[0] = 0x70; - sb[2] = sense_table[i][1]; - sb[7] = 0x0a; - sb[12] = sense_table[i][2]; - sb[13] = sense_table[i][3]; + ata_scsi_set_sense(cmd, sense_table[i][1] /* sk */, + sense_table[i][2] /* asc */, + sense_table[i][3] /* ascq */ ); return; } i++; @@ -289,11 +292,9 @@ { if(stat_table[i][0] drv_stat) { - sb[0] = 0x70; - sb[2] = stat_table[i][1]; - sb[7] = 0x0a; - sb[12] = stat_table[i][2]; - sb[13] = stat_table[i][3]; + ata_scsi_set_sense(cmd, sense_table[i][1] /* sk */, + sense_table[i][2] /* asc */, + sense_table[i][3] /* ascq */ ); return; } i++; @@ -302,15 +303,12 @@ printk(KERN_ERR ata%u: called with no error (%02X)!\n, qc-ap-id, drv_stat); /* additional-sense-code[-qualifier] */ - sb[0] = 0x70; - sb[2] = MEDIUM_ERROR; - sb[7] = 0x0A; if (cmd-sc_data_direction == DMA_FROM_DEVICE) { - sb[12] = 0x11; /* unrecovered read error */ - sb[13] = 0x04; + ata_scsi_set_sense(cmd, MEDIUM_ERROR, 0x11, 0x4); + /* unrecovered read error */ } else { - sb[12] = 0x0C; /* write error - */ - sb[13] = 0x02; /* auto-reallocation failed */ + ata_scsi_set_sense(cmd, MEDIUM_ERROR, 0xc, 0x2); + /* write error - auto-reallocation failed */ } } @@ -419,9 +417,9 @@ ; /* ignore IMMED bit, violates sat-r05 */ } if (scsicmd[4] 0x2) - return 1; /* LOEJ bit set not supported */ + goto invalid_fld; /* LOEJ bit set not supported */ if (((scsicmd[4] 4) 0xf) != 0) - return 1; /* power conditions not supported */ + goto invalid_fld; /* power conditions not supported */ if (scsicmd[4] 0x1) { tf-nsect = 1; /* 1 sector, lba=0 */ tf-lbah = 0x0; @@ -442,6 +440,11 @@ */ return 0; + +invalid_fld: + ata_scsi_set_sense(qc-scsicmd, ILLEGAL_REQUEST, 0x24, 0x0); +/* Invalid field in cbd */ + return 1; } @@ -529,20 +532,20 @@ }