Remove the SCSI pointer from struct scsi_cmnd
Subsystems (39)
v2 cover Remove the SCSI pointer from struct scsi_cmnd
Hi Martin,
The size of struct scsi_cmnd matters for embedded devices. One of the largest members of that structure is the SCSI pointer. That structure is only relevant for SCSI-II drivers but not for modern SCSI drivers. Hence this patch series that removes the SCSI pointer from struct scsi_cmnd and moves it into driver-private command data.
Please consider this patch series for kernel v5.18.
Thanks,
Bart.
Changes compared to v1:
- Removed BUILD_BUG_ON(sizeof(...) > sizeof(struct scsi_pointer)) statements.
- Added two void casts in front of I/O statements as requested by Johannes.
- Improved source code formatting in the aha152x driver.
- Restored the DID_OK constant in a SCSI result expression.
- Updated Reviewed-by tags.
Bart Van Assche (44):
ips: Use true and false instead of TRUE and FALSE
nsp_cs: Use true and false instead of TRUE and FALSE
scsi: Remove drivers/scsi/scsi.h
NCR5380: Remove the NCR5380_CMD_SIZE macro
NCR5380: Move the SCSI pointer to private command data
scsi: arm: Rename arm/scsi.h into arm/arm_scsi.h
scsi: arm: Move the SCSI pointer to private command data 53c700: Stop clearing SCSI pointer fields
aacraid: Move the SCSI pointer to private command data
advansys: Move the SCSI pointer to private command data
aha1542: Remove a set-but-not-used array
aha152x: Move the SCSI pointer to private command data
bfa: Stop using the SCSI pointer
csio: Stop using the SCSI pointer
dc395x: Stop using the SCSI pointer
esp_scsi: Stop using the SCSI pointer
fdomain: Move the SCSI pointer to private command data
fnic: Fix a tracing statement
fnic: Stop using the SCSI pointer
hptiop: Stop using the SCSI pointer
imm: Move the SCSI pointer to private command data
iscsi: Stop using the SCSI pointer
initio: Stop using the SCSI pointer
libfc: Stop using the SCSI pointer
mac53c94: Fix a set-but-not-used compiler warning
mac53c94: Move the SCSI pointer to private command data
megaraid: Stop using the SCSI pointer
megasas: Stop using the SCSI pointer
mesh: Move the SCSI pointer to private command data
mvsas: Fix a set-but-not-used warning
mvumi: Stop using the SCSI pointer
nsp32: Stop using the SCSI pointer
nsp_cs: Move the SCSI pointer to private command data
sym53c500_cs: Move the SCSI pointer to private command data
ppa: Move the SCSI pointer to private command data
qla1280: Move the SCSI pointer to private command data
qla2xxx: Stop using the SCSI pointer
smartpqi: Stop using the SCSI pointer
sym53c8xx_2: Move the SCSI pointer to private command data
scsi: usb: Stop using the SCSI pointer
wd719x: Stop using the SCSI pointer
wdc33c93: Move the SCSI pointer to private command data
zalon: Stop using the SCSI pointer
scsi: core: Remove struct scsi_pointer from struct scsi_cmnd
drivers/infiniband/ulp/iser/iscsi_iser.c | 1 +
drivers/scsi/53c700.c | 2 -
drivers/scsi/NCR5380.c | 83 +++---
drivers/scsi/NCR5380.h | 8 +-
drivers/scsi/a2091.c | 25 +-
drivers/scsi/a3000.c | 25 +-
drivers/scsi/aacraid/aachba.c | 43 +--
drivers/scsi/aacraid/aacraid.h | 24 +-
drivers/scsi/aacraid/comminit.c | 2 +-
drivers/scsi/aacraid/linit.c | 21 +-
drivers/scsi/advansys.c | 22 +-
drivers/scsi/aha152x.c | 268 ++++++++++--------
drivers/scsi/aha1542.c | 3 +-
drivers/scsi/aha1740.c | 6 +-
drivers/scsi/arm/acornscsi.c | 28 +-
drivers/scsi/arm/{scsi.h => arm_scsi.h} | 37 ++-
drivers/scsi/arm/arxescsi.c | 6 +-
drivers/scsi/arm/cumana_1.c | 2 +-
drivers/scsi/arm/cumana_2.c | 8 +-
drivers/scsi/arm/eesox.c | 8 +-
drivers/scsi/arm/fas216.c | 36 ++-
drivers/scsi/arm/fas216.h | 1 +
drivers/scsi/arm/oak.c | 2 +-
drivers/scsi/arm/powertec.c | 8 +-
drivers/scsi/arm/queue.c | 6 +-
drivers/scsi/atari_scsi.c | 8 +-
drivers/scsi/be2iscsi/be_main.c | 3 +-
drivers/scsi/bfa/bfad_im.c | 27 +-
drivers/scsi/bfa/bfad_im.h | 16 ++
drivers/scsi/bnx2fc/bnx2fc.h | 10 +-
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 1 +
drivers/scsi/bnx2fc/bnx2fc_io.c | 20 +-
drivers/scsi/bnx2i/bnx2i_iscsi.c | 1 +
drivers/scsi/csiostor/csio_scsi.c | 20 +-
drivers/scsi/csiostor/csio_scsi.h | 10 +
drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 1 +
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1 +
drivers/scsi/dc395x.c | 3 -
drivers/scsi/dmx3191d.c | 2 +-
drivers/scsi/esp_scsi.c | 4 +-
drivers/scsi/esp_scsi.h | 3 +-
drivers/scsi/fcoe/fcoe.c | 1 +
drivers/scsi/fdomain.c | 70 +++--
drivers/scsi/fnic/fnic.h | 28 +-
drivers/scsi/fnic/fnic_main.c | 1 +
drivers/scsi/fnic/fnic_scsi.c | 289 ++++++++++----------
drivers/scsi/g_NCR5380.c | 7 +-
drivers/scsi/gvp11.c | 25 +-
drivers/scsi/hptiop.c | 1 +
drivers/scsi/hptiop.h | 4 +-
drivers/scsi/imm.c | 88 +++---
drivers/scsi/imm.h | 11 +
drivers/scsi/initio.c | 14 +-
drivers/scsi/initio.h | 9 +
drivers/scsi/ips.c | 50 ++--
drivers/scsi/iscsi_tcp.c | 1 +
drivers/scsi/libfc/fc_fcp.c | 26 +-
drivers/scsi/libiscsi.c | 22 +-
drivers/scsi/mac53c94.c | 27 +-
drivers/scsi/mac53c94.h | 11 +
drivers/scsi/mac_scsi.c | 8 +-
drivers/scsi/megaraid.c | 21 +-
drivers/scsi/megaraid.h | 15 +-
drivers/scsi/megaraid/megaraid_sas.h | 12 +
drivers/scsi/megaraid/megaraid_sas_base.c | 8 +-
drivers/scsi/megaraid/megaraid_sas_fusion.c | 15 +-
drivers/scsi/mesh.c | 20 +-
drivers/scsi/mesh.h | 11 +
drivers/scsi/mvme147.c | 16 +-
drivers/scsi/mvsas/mv_init.c | 7 +-
drivers/scsi/mvumi.c | 9 +-
drivers/scsi/mvumi.h | 9 +
drivers/scsi/ncr53c8xx.c | 22 +-
drivers/scsi/ncr53c8xx.h | 6 +
drivers/scsi/nsp32.c | 20 +-
drivers/scsi/nsp32.h | 9 +
drivers/scsi/pcmcia/aha152x_stub.c | 10 +-
drivers/scsi/pcmcia/nsp_cs.c | 252 +++++++++--------
drivers/scsi/pcmcia/nsp_cs.h | 8 +-
drivers/scsi/pcmcia/nsp_debug.c | 2 +-
drivers/scsi/pcmcia/qlogic_stub.c | 10 +-
drivers/scsi/pcmcia/sym53c500_cs.c | 53 ++--
drivers/scsi/ppa.c | 81 +++---
drivers/scsi/qedf/qedf.h | 11 +-
drivers/scsi/qedf/qedf_io.c | 16 +-
drivers/scsi/qedf/qedf_main.c | 3 +-
drivers/scsi/qedi/qedi_fw.c | 2 +-
drivers/scsi/qedi/qedi_iscsi.c | 1 +
drivers/scsi/qla1280.c | 21 +-
drivers/scsi/qla1280.h | 3 +-
drivers/scsi/qla2xxx/qla_def.h | 2 -
drivers/scsi/qla2xxx/qla_os.c | 13 +-
drivers/scsi/qla4xxx/ql4_def.h | 13 +-
drivers/scsi/qla4xxx/ql4_os.c | 13 +-
drivers/scsi/qlogicfas.c | 6 +-
drivers/scsi/qlogicfas408.c | 6 +-
drivers/scsi/scsi.h | 46 ----
drivers/scsi/sg.c | 8 +-
drivers/scsi/sgiwd93.c | 24 +-
drivers/scsi/smartpqi/smartpqi_init.c | 14 +-
drivers/scsi/sun3_scsi.c | 5 +-
drivers/scsi/sym53c8xx_2/sym_glue.c | 4 +-
drivers/scsi/wd33c93.c | 119 ++++----
drivers/scsi/wd33c93.h | 10 +
drivers/scsi/wd719x.c | 12 +-
drivers/scsi/wd719x.h | 1 +
drivers/scsi/zalon.c | 1 +
drivers/usb/image/microtek.c | 8 +-
drivers/usb/storage/debug.c | 1 -
drivers/usb/storage/uas.c | 43 ++-
include/scsi/libfc.h | 11 +
include/scsi/libiscsi.h | 12 +
include/scsi/scsi_cmnd.h | 14 +-
113 files changed, 1500 insertions(+), 1057 deletions(-)
rename drivers/scsi/arm/{scsi.h => arm_scsi.h} (75%)
delete mode 100644 drivers/scsi/scsi.hPATCH v2 1/44 ips: Use true and false instead of TRUE and FALSE
This patch prepares for removal of the drivers/scsi/scsi.h header file. That header file defines the 'TRUE' and 'FALSE' constants.
--- drivers/scsi/ips.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-)
drivers/scsi/ips.c +20 -22
@@ -655,13 +655,13 @@ ips_release(struct Scsi_Host *sh)printk (KERN_WARNING "(%s) release, invalid Scsi_Host pointer.\n" , ips_name);BUG (); -return (FALSE); +return false; } ha =IPS_HA (sh);if (!ha) -return (FALSE); +return false;/* flush the cache on the controller */ scb = &ha->scbs[ha->max_cmds -1 ];
@@ -700,7 +700,7 @@ ips_release(struct Scsi_Host *sh) ips_released_controllers++; -return (FALSE); +return false; }/****************************************************************************/
@@ -949,7 +949,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)scsi_done (scsi_cmd); } - ha->active = FALSE; + ha->active = false;return (FAILED ); }
@@ -978,7 +978,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)scsi_done (scsi_cmd); } - ha->active = FALSE; + ha->active = false;return (FAILED ); }
@@ -1291,7 +1291,7 @@ ips_intr_copperhead(ips_ha_t * ha)return 0 ; } -while (TRUE) { +while (true) { sp = &ha->sp; intrstatus = (*ha->func.isintr) (ha);
@@ -1355,7 +1355,7 @@ ips_intr_morpheus(ips_ha_t * ha)return 0 ; } -while (TRUE) { +while (true) { sp = &ha->sp; intrstatus = (*ha->func.isintr) (ha);
@@ -3090,8 +3090,8 @@ ipsintr_blocking(ips_ha_t * ha, ips_scb_t * scb)METHOD_TRACE ("ipsintr_blocking" ,2 );ips_freescb (ha, scb); -if ((ha->waitflag == TRUE) && (ha->cmd_in_progress == scb->cdb[0 ])) { - ha->waitflag = FALSE; +if (ha->waitflag && ha->cmd_in_progress == scb->cdb[0 ]) { + ha->waitflag = false;return ; }
@@ -3391,7 +3391,7 @@ ips_send_wait(ips_ha_t * ha, ips_scb_t * scb, int timeout, int intr)METHOD_TRACE ("ips_send_wait" ,1 );if (intr !=IPS_FFDC ) {/* Won't be Waiting if this is a Time Stamp */ - ha->waitflag = TRUE; + ha->waitflag = true; ha->cmd_in_progress = scb->cdb[0 ]; } scb->callback = ipsintr_blocking;
@@ -3468,10 +3468,8 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)if (scb->bus >0 ) {/* Controller commands can't be issued */ /* to real devices -- fail them */ -if ((ha->waitflag == TRUE) && - (ha->cmd_in_progress == scb->cdb[0 ])) { - ha->waitflag = FALSE; - } +if (ha->waitflag && ha->cmd_in_progress == scb->cdb[0 ]) + ha->waitflag = false;return (1 ); }
@@ -4619,7 +4617,7 @@ ips_poll_for_flush_complete(ips_ha_t * ha) {IPS_STATUS cstatus; -while (TRUE) { +while (true) { cstatus.value = (*ha->func.statupd) (ha);if (cstatus.value ==0xffffffff )/* If No Interrupt to process */
@@ -5542,26 +5540,26 @@ ips_wait(ips_ha_t * ha, int time, int intr)METHOD_TRACE ("ips_wait" ,1 ); ret =IPS_FAILURE ; - done = FALSE; + done = false; time *=IPS_ONE_SEC ;/* convert seconds */ while ((time >0 ) && (!done)) {if (intr ==IPS_INTR_ON ) { -if (ha->waitflag == FALSE) { +if (!ha->waitflag) { ret =IPS_SUCCESS ; - done = TRUE; + done = true;break ; } }else if (intr ==IPS_INTR_IORL ) { -if (ha->waitflag == FALSE) { +if (!ha->waitflag) {/* * controller generated an interrupt to * acknowledge completion of the command * and ips_intr() has serviced the interrupt. */ ret =IPS_SUCCESS ; - done = TRUE; + done = true;break ; }
@@ -5596,7 +5594,7 @@ ips_write_driver_status(ips_ha_t * ha, int intr) {METHOD_TRACE ("ips_write_driver_status" ,1 ); -if (!ips_readwrite_page5 (ha, FALSE, intr)) { +if (!ips_readwrite_page5 (ha, false, intr)) {IPS_PRINTK (KERN_WARNING , ha->pcidev,"unable to read NVRAM page 5.\n" );
@@ -5634,7 +5632,7 @@ ips_write_driver_status(ips_ha_t * ha, int intr) ha->nvram->versioning =0 ;/* Indicate the Driver Does Not Support Versioning */ /* now update the page */ -if (!ips_readwrite_page5 (ha, TRUE, intr)) { +if (!ips_readwrite_page5 (ha, true, intr)) {IPS_PRINTK (KERN_WARNING , ha->pcidev,"unable to write NVRAM page 5.\n" );
Re: [PATCH v2 01/44] ips: Use true and false instead of TRUE and FALSE
Quoted 5 lines · Bart Van Assche
This patch prepares for removal of the
drivers/scsi/scsi.hheader file. That header file defines the 'TRUE' and 'FALSE' constants.Reviewed-by Johannes Thumshirn<[email protected]>Signed-off-by Bart Van Assche<[email protected]>
Regardless of comment, below, feel free to add:
drivers/scsi/ips.c ips_release(struct Scsi_Host *sh)
Quoted 9 lines
--- drivers/scsi/ips.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-)drivers/scsi/ips.c +0
-0@@ -655,13 +655,13 @@ ips_release(struct Scsi_Host *sh)
This function and other places return an int, and not a bool, so that could be changed as well. Prob not worth the churn, though.
Quoted 21 lines
drivers/scsi/ips.c +3
-3printk (KERN_WARNING "(%s) release, invalid Scsi_Host pointer.\n" , ips_name);BUG (); -return (FALSE); +return false; } ha =IPS_HA (sh);if (!ha) -return (FALSE); +return false;/* flush the cache on the controller */ scb = &ha->scbs[ha->max_cmds -1 ];@@ -700,7 +700,7 @@ ips_release(struct Scsi_Host *sh) ips_released_controllers++; -return (FALSE); +return false;
Re: [PATCH v2 01/44] ips: Use true and false instead of TRUE and FALSE
Quoted 8 lines · John Garry
drivers/scsi/ips.c ips_release(struct Scsi_Host *sh)
Quoted 5 lines · Bart Van Assche
drivers/scsi/ips.c +0
-0@@ -655,13 +655,13 @@ ips_release(struct Scsi_Host *sh)This function and other places return an int, and not a bool, so that could be changed as well. Prob not worth the churn, though.
Because of this comment I took a closer look at the ips_release() function. It seems to me that that function only has one caller and that caller ignores the value returned by ips_release(). So how about changing the return type into 'void'?
Thanks,
Bart.
Re: [PATCH v2 01/44] ips: Use true and false instead of TRUE and FALSE
Quoted 9 lines · Bart Van Assche
Quoted 7 lines
drivers/scsi/ips.c ips_release(struct Scsi_Host *sh)
Quoted 5 lines
drivers/scsi/ips.c +0
-0@@ -655,13 +655,13 @@ ips_release(struct Scsi_Host *sh)This function and other places return an int, and not a bool, so that could be changed as well. Prob not worth the churn, though.
Because of this comment I took a closer look at the
ips_release()function. It seems to me that that function only has one caller and that caller ignores the value returned byips_release(). So how about changing the return type into 'void'?
You could do that. But then there are other places where FALSE is checked against at uint8_t - see ips_ha.waitflag, so by the same reason could be changed.
However, as I said, changes like this are prob not worth it...
thanks,
John
Re: [PATCH v2 01/44] ips: Use true and false instead of TRUE and FALSE
In reply to Bart Van AsscheQuoted 162 lines · Bart Van Assche
This patch prepares for removal of the
drivers/scsi/scsi.hheader file. That header file defines the 'TRUE' and 'FALSE' constants.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/ips.c| 42 ++++++++++++++++++++----------------------1 file changed, 20 insertions(+), 22 deletions(-)drivers/scsi/ips.c +19
-21@@ -655,13 +655,13 @@ ips_release(struct Scsi_Host *sh)printk (KERN_WARNING "(%s) release, invalid Scsi_Host pointer.\n" , ips_name);BUG (); -return (FALSE); +return false; } ha =IPS_HA (sh);if (!ha) -return (FALSE); +return false;/* flush the cache on the controller */ scb = &ha->scbs[ha->max_cmds -1 ];@@ -700,7 +700,7 @@ ips_release(struct Scsi_Host *sh) ips_released_controllers++; -return (FALSE); +return false; }/****************************************************************************/ @@ -949,7 +949,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)scsi_done (scsi_cmd); } - ha->active = FALSE; + ha->active = false;return (FAILED ); }@@ -978,7 +978,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)scsi_done (scsi_cmd); } - ha->active = FALSE; + ha->active = false;return (FAILED ); }@@ -1291,7 +1291,7 @@ ips_intr_copperhead(ips_ha_t * ha)return 0 ; } -while (TRUE) { +while (true) { sp = &ha->sp; intrstatus = (*ha->func.isintr) (ha);@@ -1355,7 +1355,7 @@ ips_intr_morpheus(ips_ha_t * ha)return 0 ; } -while (TRUE) { +while (true) { sp = &ha->sp; intrstatus = (*ha->func.isintr) (ha);@@ -3090,8 +3090,8 @@ ipsintr_blocking(ips_ha_t * ha, ips_scb_t * scb)METHOD_TRACE ("ipsintr_blocking" ,2 );ips_freescb (ha, scb); -if ((ha->waitflag == TRUE) && (ha->cmd_in_progress == scb->cdb[0 ])) { - ha->waitflag = FALSE; +if (ha->waitflag && ha->cmd_in_progress == scb->cdb[0 ]) { + ha->waitflag = false;return ; }@@ -3391,7 +3391,7 @@ ips_send_wait(ips_ha_t * ha, ips_scb_t * scb, int timeout, int intr)METHOD_TRACE ("ips_send_wait" ,1 );if (intr !=IPS_FFDC ) {/* Won't be Waiting if this is a Time Stamp */ - ha->waitflag = TRUE; + ha->waitflag = true; ha->cmd_in_progress = scb->cdb[0 ]; } scb->callback = ipsintr_blocking;@@ -3468,10 +3468,8 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)if (scb->bus >0 ) {/* Controller commands can't be issued */ /* to real devices -- fail them */ -if ((ha->waitflag == TRUE) && - (ha->cmd_in_progress == scb->cdb[0 ])) { - ha->waitflag = FALSE; - } +if (ha->waitflag && ha->cmd_in_progress == scb->cdb[0 ]) + ha->waitflag = false;return (1 ); }@@ -4619,7 +4617,7 @@ ips_poll_for_flush_complete(ips_ha_t * ha) {IPS_STATUS cstatus; -while (TRUE) { +while (true) { cstatus.value = (*ha->func.statupd) (ha);if (cstatus.value ==0xffffffff )/* If No Interrupt to process */ @@ -5542,26 +5540,26 @@ ips_wait(ips_ha_t * ha, int time, int intr)METHOD_TRACE ("ips_wait" ,1 ); ret =IPS_FAILURE ; - done = FALSE; + done = false; time *=IPS_ONE_SEC ;/* convert seconds */ while ((time >0 ) && (!done)) {if (intr ==IPS_INTR_ON ) { -if (ha->waitflag == FALSE) { +if (!ha->waitflag) { ret =IPS_SUCCESS ; - done = TRUE; + done = true;break ; } }else if (intr ==IPS_INTR_IORL ) { -if (ha->waitflag == FALSE) { +if (!ha->waitflag) {/* * controller generated an interrupt to * acknowledge completion of the command * and ips_intr() has serviced the interrupt. */ ret =IPS_SUCCESS ; - done = TRUE; + done = true;break ; }@@ -5596,7 +5594,7 @@ ips_write_driver_status(ips_ha_t * ha, int intr) {METHOD_TRACE ("ips_write_driver_status" ,1 ); -if (!ips_readwrite_page5 (ha, FALSE, intr)) { +if (!ips_readwrite_page5 (ha, false, intr)) {IPS_PRINTK (KERN_WARNING , ha->pcidev,"unable to read NVRAM page 5.\n" );
drivers/scsi/ips.c ips_write_driver_status(ips_ha_t * ha, int intr) · line 5638
Quoted 8 lines
drivers/scsi/ips.c +1
-1@@ -5634,7 +5632,7 @@ ips_write_driver_status(ips_ha_t * ha, int intr) ha->nvram->versioning =0 ;/* Indicate the Driver Does Not Support Versioning */ /* now update the page */ -if (!ips_readwrite_page5 (ha, TRUE, intr)) { +if (!ips_readwrite_page5 (ha, true, intr)) {IPS_PRINTK (KERN_WARNING , ha->pcidev,"unable to write NVRAM page 5.\n" );
--
Himanshu Madhani Oracle Linux Engineering
Re: [PATCH v2 01/44] ips: Use true and false instead of TRUE and FALSE
In reply to Bart Van AsscheQuoted 9 lines · Bart Van Assche
This patch prepares for removal of the
drivers/scsi/scsi.hheader file. That header file defines the 'TRUE' and 'FALSE' constants.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/ips.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
PATCH v2 2/44 nsp_cs: Use true and false instead of TRUE and FALSE
In reply to Bart Van AsscheAdditionally, change the return type of the functions that always return TRUE from 'int' into 'void'. This patch prepares for removal of the drivers/scsi/scsi.h header file. That header file defines the 'TRUE' and 'FALSE' constants.
--- drivers/scsi/pcmcia/nsp_cs.c | 43 +++++++++++++++--------------------- drivers/scsi/pcmcia/nsp_cs.h | 6 ++--- 2 files changed, 21 insertions(+), 28 deletions(-)
drivers/scsi/pcmcia/nsp_cs.c +18 -25
@@ -243,7 +243,7 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt) SCpnt->SCp.buffers_residual =0 ; } -if (nsphw_start_selection (SCpnt) == FALSE) { +if (!nsphw_start_selection (SCpnt)) {nsp_dbg (NSP_DEBUG_QUEUECOMMAND ,"selection fail" ); SCpnt->result =DID_BUS_BUSY <<16 ;nsp_scsi_done (SCpnt);
@@ -263,14 +263,14 @@ static DEF_SCSI_QCMD(nsp_queuecommand)/* * setup PIO FIFO transfer mode and enable/disable to data out */ -static void nsp_setup_fifo (nsp_hw_data *data,int enabled) +static void nsp_setup_fifo (nsp_hw_data *data,bool enabled) {unsigned int base = data->BaseAddress;unsigned char transfer_mode_reg;//nsp_dbg(NSP_DEBUG_DATA_IO, "enabled=%d", enabled); -if (enabled != FALSE) { +if (enabled) { transfer_mode_reg =TRANSFER_GO |BRAIND ; }else { transfer_mode_reg =0 ;
@@ -298,7 +298,7 @@ static void nsphw_init_sync(nsp_hw_data *data)/* * Initialize Ninja hardware */ -static int nsphw_init (nsp_hw_data *data) +static void nsphw_init (nsp_hw_data *data) {unsigned int base = data->BaseAddress;
@@ -348,15 +348,13 @@ static int nsphw_init(nsp_hw_data *data) SCSI_RESET_IRQ_EI );nsp_write (base,IRQCONTROL ,IRQCONTROL_ALLCLEAR ); -nsp_setup_fifo (data, FALSE); - -return TRUE; +nsp_setup_fifo (data, false); }/* * Start selection phase */ -static int nsphw_start_selection (struct scsi_cmnd *SCpnt) +static bool nsphw_start_selection (struct scsi_cmnd *SCpnt) {unsigned int host_id = SCpnt->device->host->this_id;unsigned int base = SCpnt->device->host->io_port;
@@ -370,7 +368,7 @@ static int nsphw_start_selection(struct scsi_cmnd *SCpnt) phase =nsp_index_read (base,SCSIBUSMON );if (phase !=BUSMON_BUS_FREE ) {//nsp_dbg(NSP_DEBUG_RESELECTION, "bus busy"); -return FALSE; +return false; }/* start arbitration */
@@ -390,7 +388,7 @@ static int nsphw_start_selection(struct scsi_cmnd *SCpnt)if (!(arbit &ARBIT_WIN )) {//nsp_dbg(NSP_DEBUG_RESELECTION, "arbit fail"); nsp_index_write (base,SETARBIT ,ARBIT_FLAG_CLEAR ); -return FALSE; +return false; }/* assert select line */
@@ -409,7 +407,7 @@ static int nsphw_start_selection(struct scsi_cmnd *SCpnt)nsp_start_timer (SCpnt,1000 /51 ); data->SelectionTimeOut =1 ; -return TRUE; +return true; }struct nsp_sync_table {
@@ -479,7 +477,7 @@ static int nsp_analyze_sdtr(struct scsi_cmnd *SCpnt) sync->SyncRegister =0 ; sync->AckWidth =0 ; -return FALSE; +return false; } sync->SyncRegister = (sync_table->chip_period << SYNCREG_PERIOD_SHIFT) |
@@ -488,7 +486,7 @@ static int nsp_analyze_sdtr(struct scsi_cmnd *SCpnt)nsp_dbg (NSP_DEBUG_SYNC ,"sync_reg=0x%x, ack_width=0x%x" , sync->SyncRegister, sync->AckWidth); -return TRUE; +return true; }
@@ -635,7 +633,7 @@ static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt)nsp_dbg (NSP_DEBUG_DATA_IO ,"use bypass quirk" ); SCpnt->SCp.phase =PH_DATA ;nsp_pio_read (SCpnt); -nsp_setup_fifo (data, FALSE); +nsp_setup_fifo (data, false);return 0 ; }
@@ -643,7 +641,7 @@ static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt)/* * accept reselection */ -static int nsp_reselected (struct scsi_cmnd *SCpnt) +static void nsp_reselected (struct scsi_cmnd *SCpnt) {unsigned int base = SCpnt->device->host->io_port;unsigned int host_id = SCpnt->device->host->this_id;
@@ -675,8 +673,6 @@ static int nsp_reselected(struct scsi_cmnd *SCpnt) bus_reg =nsp_index_read (base,SCSIBUSCTRL ) & ~(SCSI_BSY |SCSI_ATN );nsp_index_write (base,SCSIBUSCTRL , bus_reg);nsp_index_write (base,SCSIBUSCTRL , bus_reg |AUTODIRECTION |ACKENB ); - -return TRUE; }/*
@@ -931,7 +927,7 @@ static int nsp_nexus(struct scsi_cmnd *SCpnt) }/* setup pdma fifo */ -nsp_setup_fifo (data, TRUE); +nsp_setup_fifo (data, true);/* clear ack counter */ data->FifoCount =0 ;
@@ -1057,9 +1053,8 @@ static irqreturn_t nspintr(int irq, void *dev_id)if (irq_phase &RESELECT_IRQ ) {nsp_dbg (NSP_DEBUG_INTR ,"reselect" );nsp_write (base,IRQCONTROL ,IRQCONTROL_RESELECT_CLEAR ); -if (nsp_reselected (tmpSC) != FALSE) { -return IRQ_HANDLED ; - } +nsp_reselected (tmpSC); +return IRQ_HANDLED ; }if ((irq_phase & (PHASE_CHANGE_IRQ |LATCHED_BUS_FREE )) ==0 ) {
@@ -1215,7 +1210,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)//*sync_neg = SYNC_NOT_YET; data->MsgLen = i =0 ; - data->MsgBuffer[i] =IDENTIFY (TRUE, lun); i++; + data->MsgBuffer[i] =IDENTIFY (true, lun); i++;if (*sync_neg ==SYNC_NOT_YET ) { data->Sync[target].SyncPeriod =0 ;
@@ -1614,9 +1609,7 @@ static int nsp_cs_config(struct pcmcia_device *link)nsp_dbg (NSP_DEBUG_INIT ,"I/O[0x%x+0x%x] IRQ %d" , data->BaseAddress, data->NumAddress, data->IrqNumber); -if (nsphw_init (data) == FALSE) { - goto cs_failed; - } +nsphw_init (data); host =nsp_detect (&nsp_driver_template);
drivers/scsi/pcmcia/nsp_cs.h +3 -3
@@ -304,8 +304,8 @@ static int nsp_eh_host_reset (struct scsi_cmnd *SCpnt);static int nsp_bus_reset (nsp_hw_data *data);/* */ -static int nsphw_init (nsp_hw_data *data); -static int nsphw_start_selection (struct scsi_cmnd *SCpnt); +static void nsphw_init (nsp_hw_data *data); +static bool nsphw_start_selection (struct scsi_cmnd *SCpnt);static void nsp_start_timer (struct scsi_cmnd *SCpnt,int time);static int nsp_fifo_count (struct scsi_cmnd *SCpnt);static void nsp_pio_read (struct scsi_cmnd *SCpnt);
@@ -320,7 +320,7 @@ static int nsp_expect_signal (struct scsi_cmnd *SCpnt, unsigned char mask);static int nsp_xfer (struct scsi_cmnd *SCpnt,int phase);static int nsp_dataphase_bypass (struct scsi_cmnd *SCpnt); -static int nsp_reselected (struct scsi_cmnd *SCpnt); +static void nsp_reselected (struct scsi_cmnd *SCpnt);static struct Scsi_Host *nsp_detect (struct scsi_host_template *sht);/* Interrupt handler */
Re: [PATCH v2 02/44] nsp_cs: Use true and false instead of TRUE and FALSE
Quoted 202 lines · Bart Van Assche
Additionally, change the return type of the functions that always return TRUE from 'int' into 'void'. This patch prepares for removal of the
drivers/scsi/scsi.hheader file. That header file defines the 'TRUE' and 'FALSE' constants.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/pcmcia/nsp_cs.c| 43 +++++++++++++++---------------------drivers/scsi/pcmcia/nsp_cs.h| 6 ++---2 files changed, 21 insertions(+), 28 deletions(-)drivers/scsi/pcmcia/nsp_cs.c +18
-25@@ -243,7 +243,7 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt) SCpnt->SCp.buffers_residual =0 ; } -if (nsphw_start_selection (SCpnt) == FALSE) { +if (!nsphw_start_selection (SCpnt)) {nsp_dbg (NSP_DEBUG_QUEUECOMMAND ,"selection fail" ); SCpnt->result =DID_BUS_BUSY <<16 ;nsp_scsi_done (SCpnt);@@ -263,14 +263,14 @@ static DEF_SCSI_QCMD(nsp_queuecommand)/* * setup PIO FIFO transfer mode and enable/disable to data out */ -static void nsp_setup_fifo (nsp_hw_data *data,int enabled) +static void nsp_setup_fifo (nsp_hw_data *data,bool enabled) {unsigned int base = data->BaseAddress;unsigned char transfer_mode_reg;//nsp_dbg(NSP_DEBUG_DATA_IO, "enabled=%d", enabled); -if (enabled != FALSE) { +if (enabled) { transfer_mode_reg =TRANSFER_GO |BRAIND ; }else { transfer_mode_reg =0 ;@@ -298,7 +298,7 @@ static void nsphw_init_sync(nsp_hw_data *data)/* * Initialize Ninja hardware */ -static int nsphw_init (nsp_hw_data *data) +static void nsphw_init (nsp_hw_data *data) {unsigned int base = data->BaseAddress;@@ -348,15 +348,13 @@ static int nsphw_init(nsp_hw_data *data) SCSI_RESET_IRQ_EI );nsp_write (base,IRQCONTROL ,IRQCONTROL_ALLCLEAR ); -nsp_setup_fifo (data, FALSE); - -return TRUE; +nsp_setup_fifo (data, false); }/* * Start selection phase */ -static int nsphw_start_selection (struct scsi_cmnd *SCpnt) +static bool nsphw_start_selection (struct scsi_cmnd *SCpnt) {unsigned int host_id = SCpnt->device->host->this_id;unsigned int base = SCpnt->device->host->io_port;@@ -370,7 +368,7 @@ static int nsphw_start_selection(struct scsi_cmnd *SCpnt) phase =nsp_index_read (base,SCSIBUSMON );if (phase !=BUSMON_BUS_FREE ) {//nsp_dbg(NSP_DEBUG_RESELECTION, "bus busy"); -return FALSE; +return false; }/* start arbitration */ @@ -390,7 +388,7 @@ static int nsphw_start_selection(struct scsi_cmnd *SCpnt)if (!(arbit &ARBIT_WIN )) {//nsp_dbg(NSP_DEBUG_RESELECTION, "arbit fail"); nsp_index_write (base,SETARBIT ,ARBIT_FLAG_CLEAR ); -return FALSE; +return false; }/* assert select line */ @@ -409,7 +407,7 @@ static int nsphw_start_selection(struct scsi_cmnd *SCpnt)nsp_start_timer (SCpnt,1000 /51 ); data->SelectionTimeOut =1 ; -return TRUE; +return true; }struct nsp_sync_table {@@ -479,7 +477,7 @@ static int nsp_analyze_sdtr(struct scsi_cmnd *SCpnt) sync->SyncRegister =0 ; sync->AckWidth =0 ; -return FALSE; +return false; } sync->SyncRegister = (sync_table->chip_period << SYNCREG_PERIOD_SHIFT) |@@ -488,7 +486,7 @@ static int nsp_analyze_sdtr(struct scsi_cmnd *SCpnt)nsp_dbg (NSP_DEBUG_SYNC ,"sync_reg=0x%x, ack_width=0x%x" , sync->SyncRegister, sync->AckWidth); -return TRUE; +return true; }@@ -635,7 +633,7 @@ static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt)nsp_dbg (NSP_DEBUG_DATA_IO ,"use bypass quirk" ); SCpnt->SCp.phase =PH_DATA ;nsp_pio_read (SCpnt); -nsp_setup_fifo (data, FALSE); +nsp_setup_fifo (data, false);return 0 ; }@@ -643,7 +641,7 @@ static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt)/* * accept reselection */ -static int nsp_reselected (struct scsi_cmnd *SCpnt) +static void nsp_reselected (struct scsi_cmnd *SCpnt) {unsigned int base = SCpnt->device->host->io_port;unsigned int host_id = SCpnt->device->host->this_id;@@ -675,8 +673,6 @@ static int nsp_reselected(struct scsi_cmnd *SCpnt) bus_reg =nsp_index_read (base,SCSIBUSCTRL ) & ~(SCSI_BSY |SCSI_ATN );nsp_index_write (base,SCSIBUSCTRL , bus_reg);nsp_index_write (base,SCSIBUSCTRL , bus_reg |AUTODIRECTION |ACKENB ); - -return TRUE; }/* @@ -931,7 +927,7 @@ static int nsp_nexus(struct scsi_cmnd *SCpnt) }/* setup pdma fifo */ -nsp_setup_fifo (data, TRUE); +nsp_setup_fifo (data, true);/* clear ack counter */ data->FifoCount =0 ;@@ -1057,9 +1053,8 @@ static irqreturn_t nspintr(int irq, void *dev_id)if (irq_phase &RESELECT_IRQ ) {nsp_dbg (NSP_DEBUG_INTR ,"reselect" );nsp_write (base,IRQCONTROL ,IRQCONTROL_RESELECT_CLEAR ); -if (nsp_reselected (tmpSC) != FALSE) { -return IRQ_HANDLED ; - } +nsp_reselected (tmpSC); +return IRQ_HANDLED ; }if ((irq_phase & (PHASE_CHANGE_IRQ |LATCHED_BUS_FREE )) ==0 ) {@@ -1215,7 +1210,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)//*sync_neg = SYNC_NOT_YET; data->MsgLen = i =0 ; - data->MsgBuffer[i] =IDENTIFY (TRUE, lun); i++; + data->MsgBuffer[i] =IDENTIFY (true, lun); i++;if (*sync_neg ==SYNC_NOT_YET ) { data->Sync[target].SyncPeriod =0 ;@@ -1614,9 +1609,7 @@ static int nsp_cs_config(struct pcmcia_device *link)nsp_dbg (NSP_DEBUG_INIT ,"I/O[0x%x+0x%x] IRQ %d" , data->BaseAddress, data->NumAddress, data->IrqNumber); -if (nsphw_init (data) == FALSE) { - goto cs_failed; - } +nsphw_init (data); host =nsp_detect (&nsp_driver_template);drivers/scsi/pcmcia/nsp_cs.h +2
-2@@ -304,8 +304,8 @@ static int nsp_eh_host_reset (struct scsi_cmnd *SCpnt);static int nsp_bus_reset (nsp_hw_data *data);/* */ -static int nsphw_init (nsp_hw_data *data); -static int nsphw_start_selection (struct scsi_cmnd *SCpnt); +static void nsphw_init (nsp_hw_data *data); +static bool nsphw_start_selection (struct scsi_cmnd *SCpnt);static void nsp_start_timer (struct scsi_cmnd *SCpnt,int time);static int nsp_fifo_count (struct scsi_cmnd *SCpnt);static void nsp_pio_read (struct scsi_cmnd *SCpnt);
drivers/scsi/pcmcia/nsp_cs.h static int nsp_expect_signal (struct scsi_cmnd *SCpnt, · line 326
Quoted 8 lines
drivers/scsi/pcmcia/nsp_cs.h +1
-1@@ -320,7 +320,7 @@ static int nsp_expect_signal (struct scsi_cmnd *SCpnt, unsigned char mask);static int nsp_xfer (struct scsi_cmnd *SCpnt,int phase);static int nsp_dataphase_bypass (struct scsi_cmnd *SCpnt); -static int nsp_reselected (struct scsi_cmnd *SCpnt); +static void nsp_reselected (struct scsi_cmnd *SCpnt);static struct Scsi_Host *nsp_detect (struct scsi_host_template *sht);/* Interrupt handler */
--
Himanshu Madhani Oracle Linux Engineering
Re: [PATCH v2 02/44] nsp_cs: Use true and false instead of TRUE and FALSE
In reply to Bart Van AsscheQuoted 5 lines · Bart Van Assche
Additionally, change the return type of the functions that always return TRUE from 'int' into 'void'. This patch prepares for removal of the
drivers/scsi/scsi.hheader file. That header file defines the 'TRUE' and 'FALSE' constants.
Quoted 7 lines
Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/pcmcia/nsp_cs.c | 43 +++++++++++++++--------------------- drivers/scsi/pcmcia/nsp_cs.h | 6 ++--- 2 files changed, 21 insertions(+), 28 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 02/44] nsp_cs: Use true and false instead of TRUE and FALSE
In reply to Bart Van AsscheQuoted 7 lines · Bart Van Assche
Additionally, change the return type of the functions that always return TRUE from 'int' into 'void'. This patch prepares for removal of the
drivers/scsi/scsi.hheader file. That header file defines the 'TRUE' and 'FALSE' constants.Reviewed-by Johannes Thumshirn<[email protected]>Signed-off-by Bart Van Assche<[email protected]>
FWIW,
PATCH v2 3/44 scsi: Remove drivers/scsi/scsi.h
In reply to Bart Van AsscheThe following two header files have the same file name: include/scsi/scsi.h and drivers/scsi/scsi.h. This is confusing. Remove the latter since the following note was added in drivers/scsi/scsi.h in 2004:
"NOTE: this file only contains compatibility glue for old drivers. All these wrappers will be removed sooner or later. For new code please use the interfaces declared in the headers in include/scsi/"
--- drivers/scsi/a2091.c | 6 +++- drivers/scsi/a3000.c | 6 +++- drivers/scsi/aha152x.c | 9 ++++-- drivers/scsi/aha1740.c | 6 +++- drivers/scsi/arm/acornscsi.c | 6 +++- drivers/scsi/arm/arxescsi.c | 6 +++- drivers/scsi/arm/cumana_2.c | 6 +++- drivers/scsi/arm/eesox.c | 6 +++- drivers/scsi/arm/fas216.c | 6 +++- drivers/scsi/arm/powertec.c | 6 +++- drivers/scsi/arm/queue.c | 6 +++- drivers/scsi/gvp11.c | 6 +++- drivers/scsi/ips.c | 8 ++++-- drivers/scsi/megaraid.c | 8 ++++-- drivers/scsi/mvme147.c | 6 +++- drivers/scsi/pcmcia/aha152x_stub.c | 10 +++++-- drivers/scsi/pcmcia/nsp_cs.c | 5 ++-- drivers/scsi/pcmcia/qlogic_stub.c | 10 +++++-- drivers/scsi/qlogicfas.c | 6 +++- drivers/scsi/qlogicfas408.c | 6 +++- drivers/scsi/scsi.h | 46 ------------------------------ drivers/scsi/sg.c | 8 ++++-- drivers/scsi/sgiwd93.c | 6 +++- drivers/usb/image/microtek.c | 8 ++++-- drivers/usb/storage/debug.c | 1 - 25 files changed, 121 insertions(+), 82 deletions(-) delete mode 100644 drivers/scsi/scsi.h
drivers/scsi/a2091.c +5 -1
@@ -12,7 +12,11 @@#include <asm/amigaints.h> #include <asm/amigahw.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_tcq.h> #include "wd33c93.h" #include "a2091.h"
drivers/scsi/a3000.c +5 -1
@@ -13,7 +13,11 @@#include <asm/amigaints.h> #include <asm/amigahw.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_tcq.h> #include "wd33c93.h" #include "a3000.h"
drivers/scsi/aha152x.c +6 -3
@@ -243,13 +243,16 @@#include <linux/workqueue.h> #include <linux/list.h> #include <linux/slab.h> -#include <scsi/scsicam.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> #include <scsi/scsi_dbg.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include <scsi/scsi_transport_spi.h> -#include <scsi/scsi_eh.h> +#include <scsi/scsicam.h> #include "aha152x.h" static LIST_HEAD (aha152x_host_list);
drivers/scsi/aha1740.c +5 -1
@@ -55,8 +55,12 @@#include <asm/dma.h> #include <asm/io.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "aha1740.h" /* IF YOU ARE HAVING PROBLEMS WITH THIS DRIVER, AND WANT TO WATCH
drivers/scsi/arm/acornscsi.c +5 -1
@@ -126,9 +126,13 @@#include <asm/ecard.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> #include <scsi/scsi_dbg.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include <scsi/scsi_transport_spi.h> #include "acornscsi.h" #include "msgqueue.h"
drivers/scsi/arm/arxescsi.c +5 -1
@@ -35,8 +35,12 @@#include <asm/io.h> #include <asm/ecard.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "fas216.h" struct arxescsi_info {
drivers/scsi/arm/cumana_2.c +5 -1
@@ -29,8 +29,12 @@#include <asm/ecard.h> #include <asm/io.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "fas216.h" #include "scsi.h"
drivers/scsi/arm/eesox.c +5 -1
@@ -35,8 +35,12 @@#include <asm/dma.h> #include <asm/ecard.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "fas216.h" #include "scsi.h"
drivers/scsi/arm/fas216.c +5 -1
@@ -47,9 +47,13 @@#include <asm/irq.h> #include <asm/ecard.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> #include <scsi/scsi_dbg.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "fas216.h" #include "scsi.h"
drivers/scsi/arm/powertec.c +5 -1
@@ -20,8 +20,12 @@#include <asm/ecard.h> #include <asm/io.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "fas216.h" #include "scsi.h"
drivers/scsi/arm/queue.c +5 -1
@@ -20,7 +20,11 @@#include <linux/list.h> #include <linux/init.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_tcq.h> #define DEBUG
drivers/scsi/gvp11.c +5 -1
@@ -12,7 +12,11 @@#include <asm/amigaints.h> #include <asm/amigahw.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_tcq.h> #include "wd33c93.h" #include "gvp11.h"
drivers/scsi/ips.c +6 -2
@@ -180,9 +180,13 @@#include <linux/types.h> #include <linux/dma-mapping.h> -#include <scsi/sg.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> +#include <scsi/sg.h> #include "ips.h"
drivers/scsi/megaraid.c +6 -2
@@ -44,10 +44,14 @@#include <linux/dma-mapping.h> #include <linux/mutex.h> #include <linux/slab.h> -#include <scsi/scsicam.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> +#include <scsi/scsicam.h> #include "megaraid.h"
drivers/scsi/mvme147.c +5 -1
@@ -11,8 +11,12 @@#include <asm/mvme147hw.h> #include <asm/irq.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "wd33c93.h" #include "mvme147.h"
drivers/scsi/pcmcia/aha152x_stub.c +7 -3
@@ -40,13 +40,17 @@#include <linux/slab.h> #include <linux/string.h> #include <linux/ioport.h> -#include <scsi/scsi.h> #include <linux/major.h> #include <linux/blkdev.h> -#include <scsi/scsi_ioctl.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_ioctl.h> +#include <scsi/scsi_tcq.h> #include "aha152x.h" #include <pcmcia/cistpl.h>
drivers/scsi/pcmcia/nsp_cs.c +2 -3
@@ -41,10 +41,9 @@#include <asm/io.h> #include <asm/irq.h> -#include <../drivers/scsi/scsi.h> -#include <scsi/scsi_host.h> -#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_host.h> #include <scsi/scsi_ioctl.h> #include <pcmcia/cistpl.h>
drivers/scsi/pcmcia/qlogic_stub.c +7 -3
@@ -38,14 +38,18 @@#include <linux/string.h> #include <linux/ioport.h> #include <asm/io.h> -#include <scsi/scsi.h> #include <linux/major.h> #include <linux/blkdev.h> -#include <scsi/scsi_ioctl.h> #include <linux/interrupt.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_ioctl.h> +#include <scsi/scsi_tcq.h> #include "../qlogicfas408.h" #include <pcmcia/cistpl.h>
drivers/scsi/qlogicfas.c +5 -1
@@ -31,8 +31,12 @@#include <asm/irq.h> #include <asm/dma.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "qlogicfas408.h" /* Set the following to 2 to use normal interrupt (active high/totempole-
drivers/scsi/qlogicfas408.c +5 -1
@@ -55,8 +55,12 @@#include <asm/irq.h> #include <asm/dma.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "qlogicfas408.h" /*----------------------------------------------------------------*/
drivers/scsi/scsi.h deleted +0 -46
46 lines not on this page · raw message
drivers/scsi/sg.c +6 -2
@@ -49,11 +49,15 @@ static int sg_version_num = 30536; /* 2 digits for each component */#include <linux/uio.h> #include <linux/cred.h> /* for sg_check_file_access() */ -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> #include <scsi/scsi_dbg.h> -#include <scsi/scsi_host.h> +#include <scsi/scsi_device.h> #include <scsi/scsi_driver.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_host.h> #include <scsi/scsi_ioctl.h> +#include <scsi/scsi_tcq.h> #include <scsi/sg.h> #include "scsi_logging.h"
drivers/scsi/sgiwd93.c +5 -1
@@ -28,7 +28,11 @@#include <asm/sgi/ip22.h> #include <asm/sgi/wd.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_tcq.h> #include "wd33c93.h" struct ip22_hostdata {
drivers/usb/image/microtek.c +6 -2
@@ -130,11 +130,15 @@#include <linux/spinlock.h> #include <linux/usb.h> #include <linux/proc_fs.h> -#include <linux/atomic.h> #include <linux/blkdev.h> -#include "../../scsi/scsi.h" + +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "microtek.h"
drivers/usb/storage/debug.c +0 -1
@@ -36,7 +36,6 @@#include "usb.h" #include "debug.h" -#include "scsi.h" void usb_stor_show_command (const struct us_data *us,struct scsi_cmnd *srb)
Re: [PATCH v2 03/44] scsi: Remove drivers/scsi/scsi.h
Quoted 547 lines · Bart Van Assche
The following two header files have the same file name:
include/scsi/scsi.handdrivers/scsi/scsi.h. This is confusing. Remove the latter since the following note was added indrivers/scsi/scsi.hin 2004:"NOTE: this file only contains compatibility glue for old drivers. All these wrappers will be removed sooner or later. For new code please use the interfaces declared in the headers in
include/scsi/"Cc Christoph Hellwig <[email protected]>Cc Ming Lei <[email protected]>Cc Hannes Reinecke <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/a2091.c | 6 +++- drivers/scsi/a3000.c | 6 +++- drivers/scsi/aha152x.c | 9 ++++-- drivers/scsi/aha1740.c | 6 +++- drivers/scsi/arm/acornscsi.c | 6 +++- drivers/scsi/arm/arxescsi.c | 6 +++- drivers/scsi/arm/cumana_2.c | 6 +++- drivers/scsi/arm/eesox.c | 6 +++- drivers/scsi/arm/fas216.c | 6 +++- drivers/scsi/arm/powertec.c | 6 +++- drivers/scsi/arm/queue.c | 6 +++- drivers/scsi/gvp11.c | 6 +++- drivers/scsi/ips.c | 8 ++++-- drivers/scsi/megaraid.c | 8 ++++-- drivers/scsi/mvme147.c | 6 +++- drivers/scsi/pcmcia/aha152x_stub.c | 10 +++++-- drivers/scsi/pcmcia/nsp_cs.c | 5 ++-- drivers/scsi/pcmcia/qlogic_stub.c | 10 +++++-- drivers/scsi/qlogicfas.c | 6 +++- drivers/scsi/qlogicfas408.c | 6 +++- drivers/scsi/scsi.h | 46 ------------------------------ drivers/scsi/sg.c | 8 ++++-- drivers/scsi/sgiwd93.c | 6 +++- drivers/usb/image/microtek.c | 8 ++++-- drivers/usb/storage/debug.c | 1 - 25 files changed, 121 insertions(+), 82 deletions(-)delete mode 100644
drivers/scsi/scsi.hdrivers/scsi/a2091.c +5
-1@@ -12,7 +12,11 @@#include <asm/amigaints.h> #include <asm/amigahw.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_tcq.h> #include "wd33c93.h" #include "a2091.h" drivers/scsi/a3000.c +5
-1@@ -13,7 +13,11 @@#include <asm/amigaints.h> #include <asm/amigahw.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_tcq.h> #include "wd33c93.h" #include "a3000.h" drivers/scsi/aha152x.c +6
-3@@ -243,13 +243,16 @@#include <linux/workqueue.h> #include <linux/list.h> #include <linux/slab.h> -#include <scsi/scsicam.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> #include <scsi/scsi_dbg.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include <scsi/scsi_transport_spi.h> -#include <scsi/scsi_eh.h> +#include <scsi/scsicam.h> #include "aha152x.h" static LIST_HEAD (aha152x_host_list);drivers/scsi/aha1740.c +5
-1@@ -55,8 +55,12 @@#include <asm/dma.h> #include <asm/io.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "aha1740.h" /* IF YOU ARE HAVING PROBLEMS WITH THIS DRIVER, AND WANT TO WATCH drivers/scsi/arm/acornscsi.c +5
-1@@ -126,9 +126,13 @@#include <asm/ecard.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> #include <scsi/scsi_dbg.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include <scsi/scsi_transport_spi.h> #include "acornscsi.h" #include "msgqueue.h" drivers/scsi/arm/arxescsi.c +5
-1@@ -35,8 +35,12 @@#include <asm/io.h> #include <asm/ecard.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "fas216.h" struct arxescsi_info {drivers/scsi/arm/cumana_2.c +5
-1@@ -29,8 +29,12 @@#include <asm/ecard.h> #include <asm/io.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "fas216.h" #include "scsi.h" drivers/scsi/arm/eesox.c +5
-1@@ -35,8 +35,12 @@#include <asm/dma.h> #include <asm/ecard.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "fas216.h" #include "scsi.h" drivers/scsi/arm/fas216.c +5
-1@@ -47,9 +47,13 @@#include <asm/irq.h> #include <asm/ecard.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> #include <scsi/scsi_dbg.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "fas216.h" #include "scsi.h" drivers/scsi/arm/powertec.c +5
-1@@ -20,8 +20,12 @@#include <asm/ecard.h> #include <asm/io.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "fas216.h" #include "scsi.h" drivers/scsi/arm/queue.c +5
-1@@ -20,7 +20,11 @@#include <linux/list.h> #include <linux/init.h> -#include "../scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_tcq.h> #define DEBUG drivers/scsi/gvp11.c +5
-1@@ -12,7 +12,11 @@#include <asm/amigaints.h> #include <asm/amigahw.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_tcq.h> #include "wd33c93.h" #include "gvp11.h" drivers/scsi/ips.c +6
-2@@ -180,9 +180,13 @@#include <linux/types.h> #include <linux/dma-mapping.h> -#include <scsi/sg.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> +#include <scsi/sg.h> #include "ips.h" drivers/scsi/megaraid.c +6
-2@@ -44,10 +44,14 @@#include <linux/dma-mapping.h> #include <linux/mutex.h> #include <linux/slab.h> -#include <scsi/scsicam.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> +#include <scsi/scsicam.h> #include "megaraid.h" drivers/scsi/mvme147.c +5
-1@@ -11,8 +11,12 @@#include <asm/mvme147hw.h> #include <asm/irq.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "wd33c93.h" #include "mvme147.h" drivers/scsi/pcmcia/aha152x_stub.c +7
-3@@ -40,13 +40,17 @@#include <linux/slab.h> #include <linux/string.h> #include <linux/ioport.h> -#include <scsi/scsi.h> #include <linux/major.h> #include <linux/blkdev.h> -#include <scsi/scsi_ioctl.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_ioctl.h> +#include <scsi/scsi_tcq.h> #include "aha152x.h" #include <pcmcia/cistpl.h> drivers/scsi/pcmcia/nsp_cs.c +2
-3@@ -41,10 +41,9 @@#include <asm/io.h> #include <asm/irq.h> -#include <../drivers/scsi/scsi.h> -#include <scsi/scsi_host.h> -#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_host.h> #include <scsi/scsi_ioctl.h> #include <pcmcia/cistpl.h> drivers/scsi/pcmcia/qlogic_stub.c +7
-3@@ -38,14 +38,18 @@#include <linux/string.h> #include <linux/ioport.h> #include <asm/io.h> -#include <scsi/scsi.h> #include <linux/major.h> #include <linux/blkdev.h> -#include <scsi/scsi_ioctl.h> #include <linux/interrupt.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_ioctl.h> +#include <scsi/scsi_tcq.h> #include "../qlogicfas408.h" #include <pcmcia/cistpl.h> drivers/scsi/qlogicfas.c +5
-1@@ -31,8 +31,12 @@#include <asm/irq.h> #include <asm/dma.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "qlogicfas408.h" /* Set the following to 2 to use normal interrupt (active high/totempole- drivers/scsi/qlogicfas408.c +5
-1@@ -55,8 +55,12 @@#include <asm/irq.h> #include <asm/dma.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "qlogicfas408.h" /*----------------------------------------------------------------*/ drivers/scsi/scsi.h deleted +0
-46@@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* scsi.h Copyright (C) 1992 Drew Eckhardt -* Copyright (C) 1993, 1994, 1995, 1998, 1999 Eric Youngdale -* generic SCSI package header file by -* Initial versions: Drew Eckhardt -* Subsequent revisions: Eric Youngdale -* -* <[email protected]> -* -* Modified by Eric Youngdale [email protected] to -* add scatter-gather, multiple outstanding request, and other -* enhancements. -*/ -/* -* NOTE: this file only contains compatibility glue for old drivers. All -* these wrappers will be removed sooner or later. For new code please use -* the interfaces declared in the headers in include/scsi/ -*/ - -#ifndef _SCSI_H -#define _SCSI_H - -#include <scsi/scsi_cmnd.h> -#include <scsi/scsi_device.h> -#include <scsi/scsi_eh.h> -#include <scsi/scsi_tcq.h> -#include <scsi/scsi.h> - -/* -* Some defs, in case these are not defined elsewhere. -*/ -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - -struct Scsi_Host ; -struct scsi_cmnd ; -struct scsi_device ; -struct scsi_target ; -struct scatterlist ; - -#endif /* _SCSI_H */ drivers/scsi/sg.c +6
-2@@ -49,11 +49,15 @@ static int sg_version_num = 30536; /* 2 digits for each component */#include <linux/uio.h> #include <linux/cred.h> /* for sg_check_file_access() */ -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> #include <scsi/scsi_dbg.h> -#include <scsi/scsi_host.h> +#include <scsi/scsi_device.h> #include <scsi/scsi_driver.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_host.h> #include <scsi/scsi_ioctl.h> +#include <scsi/scsi_tcq.h> #include <scsi/sg.h> #include "scsi_logging.h" drivers/scsi/sgiwd93.c +5
-1@@ -28,7 +28,11 @@#include <asm/sgi/ip22.h> #include <asm/sgi/wd.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_tcq.h> #include "wd33c93.h" struct ip22_hostdata {drivers/usb/image/microtek.c +6
-2@@ -130,11 +130,15 @@#include <linux/spinlock.h> #include <linux/usb.h> #include <linux/proc_fs.h> -#include <linux/atomic.h> #include <linux/blkdev.h> -#include "../../scsi/scsi.h" + +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "microtek.h" drivers/usb/storage/debug.c +0
-0
drivers/usb/storage/debug.c line 41
Quoted 7 lines
drivers/usb/storage/debug.c +0
-1@@ -36,7 +36,6 @@#include "usb.h" #include "debug.h" -#include "scsi.h" void usb_stor_show_command (const struct us_data *us,struct scsi_cmnd *srb)
--
Himanshu Madhani Oracle Linux Engineering
Hannes Reinecke
maintainerRe: [PATCH v2 03/44] scsi: Remove drivers/scsi/scsi.h
In reply to Bart Van AsscheQuoted 42 lines · Bart Van Assche
The following two header files have the same file name:
include/scsi/scsi.handdrivers/scsi/scsi.h. This is confusing. Remove the latter since the following note was added indrivers/scsi/scsi.hin 2004:"NOTE: this file only contains compatibility glue for old drivers. All these wrappers will be removed sooner or later. For new code please use the interfaces declared in the headers in
include/scsi/"Cc Christoph Hellwig <[email protected]>Cc Ming Lei <[email protected]>Cc Hannes Reinecke <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/a2091.c | 6 +++- drivers/scsi/a3000.c | 6 +++- drivers/scsi/aha152x.c | 9 ++++-- drivers/scsi/aha1740.c | 6 +++- drivers/scsi/arm/acornscsi.c | 6 +++- drivers/scsi/arm/arxescsi.c | 6 +++- drivers/scsi/arm/cumana_2.c | 6 +++- drivers/scsi/arm/eesox.c | 6 +++- drivers/scsi/arm/fas216.c | 6 +++- drivers/scsi/arm/powertec.c | 6 +++- drivers/scsi/arm/queue.c | 6 +++- drivers/scsi/gvp11.c | 6 +++- drivers/scsi/ips.c | 8 ++++-- drivers/scsi/megaraid.c | 8 ++++-- drivers/scsi/mvme147.c | 6 +++- drivers/scsi/pcmcia/aha152x_stub.c | 10 +++++-- drivers/scsi/pcmcia/nsp_cs.c | 5 ++-- drivers/scsi/pcmcia/qlogic_stub.c | 10 +++++-- drivers/scsi/qlogicfas.c | 6 +++- drivers/scsi/qlogicfas408.c | 6 +++- drivers/scsi/scsi.h | 46 ------------------------------ drivers/scsi/sg.c | 8 ++++-- drivers/scsi/sgiwd93.c | 6 +++- drivers/usb/image/microtek.c | 8 ++++-- drivers/usb/storage/debug.c | 1 - 25 files changed, 121 insertions(+), 82 deletions(-)delete mode 100644
drivers/scsi/scsi.h
[ .. ]
Quoted 6 lines
drivers/scsi/pcmcia/aha152x_stub.c +0
-0@@ -40,13 +40,17 @@#include <linux/slab.h>
drivers/scsi/pcmcia/aha152x_stub.c line 47
Quoted 10 lines
drivers/scsi/pcmcia/aha152x_stub.c +2
-3#include <linux/string.h> #include <linux/ioport.h> -#include <scsi/scsi.h> #include <linux/major.h> #include <linux/blkdev.h> -#include <scsi/scsi_ioctl.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi.h>
Duplicate include line
Quoted 33 lines
drivers/scsi/pcmcia/aha152x_stub.c +5
-0+#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_ioctl.h> +#include <scsi/scsi_tcq.h> #include "aha152x.h" #include <pcmcia/cistpl.h> drivers/scsi/pcmcia/nsp_cs.c +2
-3@@ -41,10 +41,9 @@#include <asm/io.h> #include <asm/irq.h> -#include <../drivers/scsi/scsi.h> -#include <scsi/scsi_host.h> -#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_host.h> #include <scsi/scsi_ioctl.h> #include <pcmcia/cistpl.h> drivers/scsi/pcmcia/qlogic_stub.c +0
-0@@ -38,14 +38,18 @@#include <linux/string.h> #include <linux/ioport.h>
drivers/scsi/pcmcia/qlogic_stub.c line 46
Quoted 10 lines
drivers/scsi/pcmcia/qlogic_stub.c +2
-3#include <asm/io.h> -#include <scsi/scsi.h> #include <linux/major.h> #include <linux/blkdev.h> -#include <scsi/scsi_ioctl.h> #include <linux/interrupt.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi.h>
Same here.
Quoted 163 lines
drivers/scsi/pcmcia/qlogic_stub.c +5
-0+#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_ioctl.h> +#include <scsi/scsi_tcq.h> #include "../qlogicfas408.h" #include <pcmcia/cistpl.h> drivers/scsi/qlogicfas.c +5
-1@@ -31,8 +31,12 @@#include <asm/irq.h> #include <asm/dma.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "qlogicfas408.h" /* Set the following to 2 to use normal interrupt (active high/totempole- drivers/scsi/qlogicfas408.c +5
-1@@ -55,8 +55,12 @@#include <asm/irq.h> #include <asm/dma.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "qlogicfas408.h" /*----------------------------------------------------------------*/ drivers/scsi/scsi.h deleted +0
-46@@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* scsi.h Copyright (C) 1992 Drew Eckhardt -* Copyright (C) 1993, 1994, 1995, 1998, 1999 Eric Youngdale -* generic SCSI package header file by -* Initial versions: Drew Eckhardt -* Subsequent revisions: Eric Youngdale -* -* <[email protected]> -* -* Modified by Eric Youngdale [email protected] to -* add scatter-gather, multiple outstanding request, and other -* enhancements. -*/ -/* -* NOTE: this file only contains compatibility glue for old drivers. All -* these wrappers will be removed sooner or later. For new code please use -* the interfaces declared in the headers in include/scsi/ -*/ - -#ifndef _SCSI_H -#define _SCSI_H - -#include <scsi/scsi_cmnd.h> -#include <scsi/scsi_device.h> -#include <scsi/scsi_eh.h> -#include <scsi/scsi_tcq.h> -#include <scsi/scsi.h> - -/* -* Some defs, in case these are not defined elsewhere. -*/ -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - -struct Scsi_Host ; -struct scsi_cmnd ; -struct scsi_device ; -struct scsi_target ; -struct scatterlist ; - -#endif /* _SCSI_H */ drivers/scsi/sg.c +6
-2@@ -49,11 +49,15 @@ static int sg_version_num = 30536; /* 2 digits for each component */#include <linux/uio.h> #include <linux/cred.h> /* for sg_check_file_access() */ -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> #include <scsi/scsi_dbg.h> -#include <scsi/scsi_host.h> +#include <scsi/scsi_device.h> #include <scsi/scsi_driver.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_host.h> #include <scsi/scsi_ioctl.h> +#include <scsi/scsi_tcq.h> #include <scsi/sg.h> #include "scsi_logging.h" drivers/scsi/sgiwd93.c +5
-1@@ -28,7 +28,11 @@#include <asm/sgi/ip22.h> #include <asm/sgi/wd.h> -#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_tcq.h> #include "wd33c93.h" struct ip22_hostdata {drivers/usb/image/microtek.c +6
-2@@ -130,11 +130,15 @@#include <linux/spinlock.h> #include <linux/usb.h> #include <linux/proc_fs.h> -#include <linux/atomic.h> #include <linux/blkdev.h> -#include "../../scsi/scsi.h" + +#include <scsi/scsi.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_tcq.h> #include "microtek.h" drivers/usb/storage/debug.c +0
-0
drivers/usb/storage/debug.c line 41
Quoted 7 lines
drivers/usb/storage/debug.c +0
-1@@ -36,7 +36,6 @@#include "usb.h" #include "debug.h" -#include "scsi.h" void usb_stor_show_command (const struct us_data *us,struct scsi_cmnd *srb)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 03/44] scsi: Remove drivers/scsi/scsi.h
Quoted 6 lines · Hannes Reinecke
drivers/scsi/pcmcia/aha152x_stub.c line 47
Quoted 3 lines · Bart Van Assche
drivers/scsi/pcmcia/aha152x_stub.c +2
-1-#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi.h> Duplicate include line
I will fix this and also the other duplicate.
Thanks,
Bart.
Re: [PATCH v2 03/44] scsi: Remove drivers/scsi/scsi.h
In reply to Bart Van AsscheLooks good,
Re: [PATCH v2 03/44] scsi: Remove drivers/scsi/scsi.h
In reply to Bart Van Asschedrivers/scsi/pcmcia/aha152x_stub.c line 47
Quoted 3 lines · Bart Van Assche
drivers/scsi/pcmcia/aha152x_stub.c +2
-1-#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi.h>
<scsi/scsi.h> seems to be included twice
Quoted 17 lines
drivers/scsi/pcmcia/aha152x_stub.c +5
-0+#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_ioctl.h> +#include <scsi/scsi_tcq.h> #include "aha152x.h" #include <pcmcia/cistpl.h> drivers/scsi/pcmcia/nsp_cs.c +0
-0@@ -41,10 +41,9 @@#include <asm/io.h> #include <asm/irq.h>
...
drivers/scsi/pcmcia/nsp_cs.c
Quoted 4 lines
drivers/scsi/pcmcia/nsp_cs.c +2
-1-#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi.h>
And here
drivers/scsi/pcmcia/nsp_cs.c
Quoted 2 lines
drivers/scsi/pcmcia/nsp_cs.c +2
-0+#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h>
Thanks,
John
Re: [PATCH v2 03/44] scsi: Remove drivers/scsi/scsi.h
Quoted 6 lines · John Garry
drivers/scsi/pcmcia/aha152x_stub.c line 47
Quoted 3 lines · Bart Van Assche
drivers/scsi/pcmcia/aha152x_stub.c +2
-1-#include "scsi.h" +#include <scsi/scsi.h> +#include <scsi/scsi.h> <
scsi/scsi.h> seems to be included twice
Please ignore - I see Hannes already spotted this.
PATCH v2 4/44 NCR5380: Remove the NCR5380_CMD_SIZE macro
In reply to Bart Van AsscheThis makes it easier to find users of the NCR5380_cmd data structure with 'grep'.
--- drivers/scsi/NCR5380.h | 2 -- drivers/scsi/arm/cumana_1.c | 2 +- drivers/scsi/arm/oak.c | 2 +- drivers/scsi/atari_scsi.c | 2 +- drivers/scsi/dmx3191d.c | 2 +- drivers/scsi/g_NCR5380.c | 2 +- drivers/scsi/mac_scsi.c | 2 +- drivers/scsi/sun3_scsi.c | 2 +- 8 files changed, 7 insertions(+), 9 deletions(-)
drivers/scsi/NCR5380.h +0 -2
@@ -230,8 +230,6 @@ struct NCR5380_cmd {struct list_head list; }; -#define NCR5380_CMD_SIZE (sizeof(struct NCR5380_cmd)) -#define NCR5380_PIO_CHUNK_SIZE 256/* Time limit (ms) to poll registers when IRQs are disabled, e.g. during PDMA */
drivers/scsi/arm/cumana_1.c +1 -1
@@ -223,7 +223,7 @@ static struct scsi_host_template cumanascsi_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 2, .proc_name = "CumanaSCSI-1", - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), .max_sectors = 128, .dma_boundary = PAGE_SIZE - 1, };
drivers/scsi/arm/oak.c +1 -1
@@ -113,7 +113,7 @@ static struct scsi_host_template oakscsi_template = { .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, .proc_name = "oakscsi", - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), .max_sectors = 128, };
drivers/scsi/atari_scsi.c +1 -1
@@ -711,7 +711,7 @@ static struct scsi_host_template atari_scsi_template = { .this_id = 7, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), };static int __init atari_scsi_probe (struct platform_device *pdev)
drivers/scsi/dmx3191d.c +1 -1
@@ -52,7 +52,7 @@ static struct scsi_host_template dmx3191d_driver_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), }; static int dmx3191d_probe_one(struct pci_dev *pdev,
drivers/scsi/g_NCR5380.c +1 -1
@@ -702,7 +702,7 @@ static struct scsi_host_template driver_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), .max_sectors = 128, };
drivers/scsi/mac_scsi.c +1 -1
@@ -434,7 +434,7 @@ static struct scsi_host_template mac_scsi_template = { .sg_tablesize = 1, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), .max_sectors = 128, };
drivers/scsi/sun3_scsi.c +1 -1
@@ -505,7 +505,7 @@ static struct scsi_host_template sun3_scsi_template = { .sg_tablesize = 1, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), };static int __init sun3_scsi_probe (struct platform_device *pdev)
Re: [PATCH v2 04/44] NCR5380: Remove the NCR5380_CMD_SIZE macro
Quoted 120 lines · Bart Van Assche
This makes it easier to find users of the
NCR5380_cmddata structure with 'grep'.Cc Finn Thain <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Ondrej Zary <[email protected]>Cc Michael Schmitz <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/NCR5380.h | 2 -- drivers/scsi/arm/cumana_1.c | 2 +- drivers/scsi/arm/oak.c | 2 +- drivers/scsi/atari_scsi.c | 2 +- drivers/scsi/dmx3191d.c | 2 +- drivers/scsi/g_NCR5380.c | 2 +- drivers/scsi/mac_scsi.c | 2 +- drivers/scsi/sun3_scsi.c | 2 +- 8 files changed, 7 insertions(+), 9 deletions(-)drivers/scsi/NCR5380.h +0
-2@@ -230,8 +230,6 @@ struct NCR5380_cmd {struct list_head list; }; -#define NCR5380_CMD_SIZE (sizeof(struct NCR5380_cmd)) -#define NCR5380_PIO_CHUNK_SIZE 256/* Time limit (ms) to poll registers when IRQs are disabled, e.g. during PDMA */ drivers/scsi/arm/cumana_1.c +1
-1@@ -223,7 +223,7 @@ static struct scsi_host_template cumanascsi_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 2, .proc_name = "CumanaSCSI-1", - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), .max_sectors = 128, .dma_boundary = PAGE_SIZE - 1, };drivers/scsi/arm/oak.c +1
-1@@ -113,7 +113,7 @@ static struct scsi_host_template oakscsi_template = { .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, .proc_name = "oakscsi", - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), .max_sectors = 128, };drivers/scsi/atari_scsi.c +1
-1@@ -711,7 +711,7 @@ static struct scsi_host_template atari_scsi_template = { .this_id = 7, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), };static int __init atari_scsi_probe (struct platform_device *pdev)drivers/scsi/dmx3191d.c +1
-1@@ -52,7 +52,7 @@ static struct scsi_host_template dmx3191d_driver_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), }; static int dmx3191d_probe_one(struct pci_dev *pdev,drivers/scsi/g_NCR5380.c +1
-1@@ -702,7 +702,7 @@ static struct scsi_host_template driver_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), .max_sectors = 128, };drivers/scsi/mac_scsi.c +1
-1@@ -434,7 +434,7 @@ static struct scsi_host_template mac_scsi_template = { .sg_tablesize = 1, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), .max_sectors = 128, };drivers/scsi/sun3_scsi.c +0
-0
drivers/scsi/sun3_scsi.c static struct scsi_host_template sun3_scsi_template = { · line 511
Quoted 8 lines
drivers/scsi/sun3_scsi.c +1
-1@@ -505,7 +505,7 @@ static struct scsi_host_template sun3_scsi_template = { .sg_tablesize = 1, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), };static int __init sun3_scsi_probe (struct platform_device *pdev)
--
Himanshu Madhani Oracle Linux Engineering
Re: [PATCH v2 04/44] NCR5380: Remove the NCR5380_CMD_SIZE macro
In reply to Bart Van AsscheQuoted 125 lines · Bart Van Assche
This makes it easier to find users of the
NCR5380_cmddata structure with 'grep'.Cc Finn Thain <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Ondrej Zary <[email protected]>Cc Michael Schmitz <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/NCR5380.h | 2 -- drivers/scsi/arm/cumana_1.c | 2 +- drivers/scsi/arm/oak.c | 2 +- drivers/scsi/atari_scsi.c | 2 +- drivers/scsi/dmx3191d.c | 2 +- drivers/scsi/g_NCR5380.c | 2 +- drivers/scsi/mac_scsi.c | 2 +- drivers/scsi/sun3_scsi.c | 2 +- 8 files changed, 7 insertions(+), 9 deletions(-)drivers/scsi/NCR5380.h +0
-2@@ -230,8 +230,6 @@ struct NCR5380_cmd {struct list_head list; }; -#define NCR5380_CMD_SIZE (sizeof(struct NCR5380_cmd)) -#define NCR5380_PIO_CHUNK_SIZE 256/* Time limit (ms) to poll registers when IRQs are disabled, e.g. during PDMA */ drivers/scsi/arm/cumana_1.c +1
-1@@ -223,7 +223,7 @@ static struct scsi_host_template cumanascsi_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 2, .proc_name = "CumanaSCSI-1", - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), .max_sectors = 128, .dma_boundary = PAGE_SIZE - 1, };drivers/scsi/arm/oak.c +1
-1@@ -113,7 +113,7 @@ static struct scsi_host_template oakscsi_template = { .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, .proc_name = "oakscsi", - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), .max_sectors = 128, };drivers/scsi/atari_scsi.c +1
-1@@ -711,7 +711,7 @@ static struct scsi_host_template atari_scsi_template = { .this_id = 7, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), };static int __init atari_scsi_probe (struct platform_device *pdev)drivers/scsi/dmx3191d.c +1
-1@@ -52,7 +52,7 @@ static struct scsi_host_template dmx3191d_driver_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), }; static int dmx3191d_probe_one(struct pci_dev *pdev,drivers/scsi/g_NCR5380.c +1
-1@@ -702,7 +702,7 @@ static struct scsi_host_template driver_template = { .sg_tablesize = SG_ALL, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), .max_sectors = 128, };drivers/scsi/mac_scsi.c +1
-1@@ -434,7 +434,7 @@ static struct scsi_host_template mac_scsi_template = { .sg_tablesize = 1, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), .max_sectors = 128, };drivers/scsi/sun3_scsi.c +1
-1@@ -505,7 +505,7 @@ static struct scsi_host_template sun3_scsi_template = { .sg_tablesize = 1, .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, - .cmd_size = NCR5380_CMD_SIZE, + .cmd_size = sizeof(struct NCR5380_cmd), };static int __init sun3_scsi_probe (struct platform_device *pdev)
Re: [PATCH v2 04/44] NCR5380: Remove the NCR5380_CMD_SIZE macro
In reply to Bart Van AsscheQuoted 9 lines · Bart Van Assche
This makes it easier to find users of the
NCR5380_cmddata structure with 'grep'.Cc Finn Thain <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Ondrej Zary <[email protected]>Cc Michael Schmitz <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
Quoted 11 lines
--- drivers/scsi/NCR5380.h | 2 -- drivers/scsi/arm/cumana_1.c | 2 +- drivers/scsi/arm/oak.c | 2 +- drivers/scsi/atari_scsi.c | 2 +- drivers/scsi/dmx3191d.c | 2 +- drivers/scsi/g_NCR5380.c | 2 +- drivers/scsi/mac_scsi.c | 2 +- drivers/scsi/sun3_scsi.c | 2 +- 8 files changed, 7 insertions(+), 9 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
PATCH v2 5/44 NCR5380: Move the SCSI pointer to private command data
In reply to Bart Van AsscheMove the SCSI pointer into the NCR5380 private command data instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/NCR5380.c | 83 +++++++++++++++++++++++---------------- drivers/scsi/NCR5380.h | 8 ++++ drivers/scsi/atari_scsi.c | 6 ++- drivers/scsi/g_NCR5380.c | 5 ++- drivers/scsi/mac_scsi.c | 6 ++- drivers/scsi/sun3_scsi.c | 3 +- 6 files changed, 70 insertions(+), 41 deletions(-)
drivers/scsi/NCR5380.c +49 -34
@@ -145,40 +145,44 @@ static void bus_reset_cleanup(struct Scsi_Host *);static inline void initialize_SCp (struct scsi_cmnd *cmd) { +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +/* * Initialize the Scsi Pointer field so that all of the commands in the * various queues are valid. */ if (scsi_bufflen (cmd)) { - cmd->SCp.buffer =scsi_sglist (cmd); - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); - cmd->SCp.this_residual = cmd->SCp.buffer->length; + scsi_pointer->buffer =scsi_sglist (cmd); + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; }else { - cmd->SCp.buffer =NULL ; - cmd->SCp.ptr =NULL ; - cmd->SCp.this_residual =0 ; + scsi_pointer->buffer =NULL ; + scsi_pointer->ptr =NULL ; + scsi_pointer->this_residual =0 ; } - cmd->SCp.Status =0 ; - cmd->SCp.Message =0 ; + scsi_pointer->Status =0 ; + scsi_pointer->Message =0 ; }static inline void advance_sg_buffer (struct scsi_cmnd *cmd) { -struct scatterlist *s = cmd->SCp.buffer; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +struct scatterlist *s = scsi_pointer->buffer; -if (!cmd->SCp.this_residual && s && !sg_is_last (s)) { - cmd->SCp.buffer =sg_next (s); - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); - cmd->SCp.this_residual = cmd->SCp.buffer->length; +if (!scsi_pointer->this_residual && s && !sg_is_last (s)) { + scsi_pointer->buffer =sg_next (s); + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; } }static inline void set_resid_from_SCp (struct scsi_cmnd *cmd) { -int resid = cmd->SCp.this_residual; -struct scatterlist *s = cmd->SCp.buffer; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +int resid = scsi_pointer->this_residual; +struct scatterlist *s = scsi_pointer->buffer;if (s)while (!sg_is_last (s)) {
@@ -757,6 +761,7 @@ static void NCR5380_main(struct work_struct *work)static void NCR5380_dma_complete (struct Scsi_Host *instance) {struct NCR5380_hostdata *hostdata =shost_priv (instance); +struct scsi_pointer *scsi_pointer;int transferred;unsigned char **data;int *count;
@@ -764,7 +769,10 @@ static void NCR5380_dma_complete(struct Scsi_Host *instance)unsigned char p;if (hostdata->read_overruns) { - p = hostdata->connected->SCp.phase; +struct scsi_pointer *scsi_pointer = +NCR5380_scsi_pointer (hostdata->connected); + + p = scsi_pointer->phase;if (p &SR_IO ) {udelay (10 ); if ((NCR5380_read(BUS_AND_STATUS_REG) &
@@ -801,8 +809,9 @@ static void NCR5380_dma_complete(struct Scsi_Host *instance) transferred = hostdata->dma_len -NCR5380_dma_residual (hostdata); hostdata->dma_len =0 ; - data = (unsigned char **)&hostdata->connected->SCp.ptr; - count = &hostdata->connected->SCp.this_residual; + scsi_pointer =NCR5380_scsi_pointer (hostdata->connected); + data = (unsigned char **)&scsi_pointer->ptr; + count = &scsi_pointer->this_residual; *data += transferred; *count -= transferred;
@@ -1487,6 +1496,8 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char **data) {struct NCR5380_hostdata *hostdata =shost_priv (instance); +struct scsi_pointer *scsi_pointer = +NCR5380_scsi_pointer (hostdata->connected);int c = *count;unsigned char p = *phase;unsigned char *d = *data;
@@ -1498,7 +1509,7 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,return -1 ; } - hostdata->connected->SCp.phase = p; + scsi_pointer->phase = p;if (p &SR_IO ) {if (hostdata->read_overruns)
@@ -1691,6 +1702,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)while ((cmd = hostdata->connected)) {struct NCR5380_cmd *ncmd =scsi_cmd_priv (cmd); +struct scsi_pointer *scsi_pointer = &ncmd->scsi_pointer; tmp =NCR5380_read (STATUS_REG );/* We only have a valid SCSI phase when REQ is asserted */
@@ -1712,10 +1724,10 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)if (count >0 ) {if (cmd->sc_data_direction ==DMA_TO_DEVICE )sun3scsi_dma_send_setup (hostdata, - cmd->SCp.ptr, count); + scsi_pointer->ptr, count);else sun3scsi_dma_recv_setup (hostdata, - cmd->SCp.ptr, count); + scsi_pointer->ptr, count); sun3_dma_setup_done = cmd; }#ifdef SUN3_SCSI_VME
@@ -1758,8 +1770,8 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)advance_sg_buffer (cmd);dsprintk (NDEBUG_INFORMATION , instance,"this residual %d, sg ents %d\n" , - cmd->SCp.this_residual, -sg_nents (cmd->SCp.buffer)); + scsi_pointer->this_residual, +sg_nents (scsi_pointer->buffer));/* * The preferred transfer method is going to be
@@ -1778,7 +1790,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)if (transfersize >0 ) { len = transfersize;if (NCR5380_transfer_dma (instance, &phase, - &len, (unsigned char **)&cmd->SCp.ptr)) { + &len, (unsigned char **)&scsi_pointer->ptr)) {/* * If the watchdog timer fires, all future * accesses to this device will use the
@@ -1794,13 +1806,13 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)/* Transfer a small chunk so that the * irq mode lock is not held too long. */ - transfersize =min (cmd->SCp.this_residual, + transfersize =min (scsi_pointer->this_residual,NCR5380_PIO_CHUNK_SIZE ); len = transfersize;NCR5380_transfer_pio (instance, &phase, &len, - (unsigned char **)&cmd->SCp.ptr, + (unsigned char **)&scsi_pointer->ptr,0 ); - cmd->SCp.this_residual -= transfersize - len; + scsi_pointer->this_residual -= transfersize - len; }#ifdef CONFIG_SUN3 if (sun3_dma_setup_done == cmd)
@@ -1811,7 +1823,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) len =1 ; data = &tmp;NCR5380_transfer_pio (instance, &phase, &len, &data,0 ); - cmd->SCp.Message = tmp; + scsi_pointer->Message = tmp;switch (tmp) {case ABORT :
@@ -1828,15 +1840,15 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) hostdata->connected =NULL ; hostdata->busy[scmd_id (cmd)] &= ~(1 << cmd->device->lun); -set_status_byte (cmd, cmd->SCp.Status); +set_status_byte (cmd, scsi_pointer->Status);set_resid_from_SCp (cmd);if (cmd->cmnd[0 ] ==REQUEST_SENSE )complete_cmd (instance, cmd);else { -if (cmd->SCp.Status ==SAM_STAT_CHECK_CONDITION || - cmd->SCp.Status ==SAM_STAT_COMMAND_TERMINATED ) { +if (scsi_pointer->Status ==SAM_STAT_CHECK_CONDITION || + scsi_pointer->Status ==SAM_STAT_COMMAND_TERMINATED ) {dsprintk (NDEBUG_QUEUES , instance,"autosense: adding cmd %p to tail of autosense queue\n" , cmd); list_add_tail(&ncmd->list,
@@ -2000,7 +2012,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) len =1 ; data = &tmp;NCR5380_transfer_pio (instance, &phase, &len, &data,0 ); - cmd->SCp.Status = tmp; + scsi_pointer->Status = tmp;break ;default :shost_printk (KERN_ERR , instance,"unknown phase\n" );
@@ -2151,6 +2163,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)#ifdef CONFIG_SUN3 if (sun3_dma_setup_done != tmp) { +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (tmp);int count;advance_sg_buffer (tmp);
@@ -2160,10 +2173,12 @@ static void NCR5380_reselect(struct Scsi_Host *instance)if (count >0 ) {if (tmp->sc_data_direction ==DMA_TO_DEVICE )sun3scsi_dma_send_setup (hostdata, - tmp->SCp.ptr, count); + scsi_pointer->ptr, + count);else sun3scsi_dma_recv_setup (hostdata, - tmp->SCp.ptr, count); + scsi_pointer->ptr, + count); sun3_dma_setup_done = tmp; } }
drivers/scsi/NCR5380.h +8 -0
@@ -227,9 +227,17 @@ struct NCR5380_hostdata { };struct NCR5380_cmd { +struct scsi_pointer scsi_pointer;struct list_head list; }; +static inline struct scsi_pointer *NCR5380_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct NCR5380_cmd *ncmd =scsi_cmd_priv (cmd); + +return &ncmd->scsi_pointer; +} +#define NCR5380_PIO_CHUNK_SIZE 256/* Time limit (ms) to poll registers when IRQs are disabled, e.g. during PDMA */
drivers/scsi/atari_scsi.c +4 -2
@@ -538,7 +538,8 @@ static int falcon_classify_cmd(struct scsi_cmnd *cmd)static int atari_scsi_dma_xfer_len (struct NCR5380_hostdata *hostdata,struct scsi_cmnd *cmd) { -int wanted_len = cmd->SCp.this_residual; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +int wanted_len = scsi_pointer->this_residual;int possible_len, limit;if (wanted_len <DMA_MIN_SIZE )
@@ -610,7 +611,8 @@ static int atari_scsi_dma_xfer_len(struct NCR5380_hostdata *hostdata, }/* Last step: apply the hard limit on DMA transfers */ - limit = (atari_dma_buffer && !STRAM_ADDR (virt_to_phys (cmd->SCp.ptr))) ? + limit = (atari_dma_buffer && + !STRAM_ADDR (virt_to_phys (scsi_pointer->ptr))) ?STRAM_BUFFER_SIZE :255 *512 ;if (possible_len > limit) possible_len = limit;
drivers/scsi/g_NCR5380.c +3 -2
@@ -663,7 +663,8 @@ static inline int generic_NCR5380_psend(struct NCR5380_hostdata *hostdata,static int generic_NCR5380_dma_xfer_len (struct NCR5380_hostdata *hostdata,struct scsi_cmnd *cmd) { -int transfersize = cmd->SCp.this_residual; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +int transfersize = scsi_pointer->this_residual;if (hostdata->flags &FLAG_NO_PSEUDO_DMA )return 0 ;
@@ -675,7 +676,7 @@ static int generic_NCR5380_dma_xfer_len(struct NCR5380_hostdata *hostdata,/* Limit PDMA send to 512 B to avoid random corruption on DTC3181E */ if (hostdata->board ==BOARD_DTC3181E && cmd->sc_data_direction ==DMA_TO_DEVICE ) - transfersize =min (cmd->SCp.this_residual,512 ); + transfersize =min (scsi_pointer->this_residual,512 );return min (transfersize,DMA_MAX_SIZE ); }
drivers/scsi/mac_scsi.c +4 -2
@@ -404,11 +404,13 @@ static inline int macscsi_pwrite(struct NCR5380_hostdata *hostdata,static int macscsi_dma_xfer_len (struct NCR5380_hostdata *hostdata,struct scsi_cmnd *cmd) { +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +if (hostdata->flags &FLAG_NO_PSEUDO_DMA || - cmd->SCp.this_residual < setup_use_pdma) + scsi_pointer->this_residual < setup_use_pdma)return 0 ; -return cmd->SCp.this_residual; +return scsi_pointer->this_residual; }static int macscsi_dma_residual (struct NCR5380_hostdata *hostdata)
drivers/scsi/sun3_scsi.c +2 -1
@@ -334,7 +334,8 @@ static int sun3scsi_dma_residual(struct NCR5380_hostdata *hostdata)static int sun3scsi_dma_xfer_len (struct NCR5380_hostdata *hostdata,struct scsi_cmnd *cmd) { -int wanted_len = cmd->SCp.this_residual; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +int wanted_len = scsi_pointer->this_residual;if (wanted_len <DMA_MIN_SIZE ||blk_rq_is_passthrough (scsi_cmd_to_rq (cmd)))return 0 ;
Re: [PATCH v2 05/44] NCR5380: Move the SCSI pointer to private command data
Quoted 349 lines · Bart Van Assche
Move the SCSI pointer into the NCR5380 private command data instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Cc Finn Thain <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Ondrej Zary <[email protected]>Cc Michael Schmitz <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/NCR5380.c | 83 +++++++++++++++++++++++---------------- drivers/scsi/NCR5380.h | 8 ++++ drivers/scsi/atari_scsi.c | 6 ++- drivers/scsi/g_NCR5380.c | 5 ++- drivers/scsi/mac_scsi.c | 6 ++- drivers/scsi/sun3_scsi.c | 3 +- 6 files changed, 70 insertions(+), 41 deletions(-)drivers/scsi/NCR5380.c +49
-34@@ -145,40 +145,44 @@ static void bus_reset_cleanup(struct Scsi_Host *);static inline void initialize_SCp (struct scsi_cmnd *cmd) { +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +/* * Initialize the Scsi Pointer field so that all of the commands in the * various queues are valid. */ if (scsi_bufflen (cmd)) { - cmd->SCp.buffer =scsi_sglist (cmd); - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); - cmd->SCp.this_residual = cmd->SCp.buffer->length; + scsi_pointer->buffer =scsi_sglist (cmd); + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; }else { - cmd->SCp.buffer =NULL ; - cmd->SCp.ptr =NULL ; - cmd->SCp.this_residual =0 ; + scsi_pointer->buffer =NULL ; + scsi_pointer->ptr =NULL ; + scsi_pointer->this_residual =0 ; } - cmd->SCp.Status =0 ; - cmd->SCp.Message =0 ; + scsi_pointer->Status =0 ; + scsi_pointer->Message =0 ; }static inline void advance_sg_buffer (struct scsi_cmnd *cmd) { -struct scatterlist *s = cmd->SCp.buffer; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +struct scatterlist *s = scsi_pointer->buffer; -if (!cmd->SCp.this_residual && s && !sg_is_last (s)) { - cmd->SCp.buffer =sg_next (s); - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); - cmd->SCp.this_residual = cmd->SCp.buffer->length; +if (!scsi_pointer->this_residual && s && !sg_is_last (s)) { + scsi_pointer->buffer =sg_next (s); + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; } }static inline void set_resid_from_SCp (struct scsi_cmnd *cmd) { -int resid = cmd->SCp.this_residual; -struct scatterlist *s = cmd->SCp.buffer; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +int resid = scsi_pointer->this_residual; +struct scatterlist *s = scsi_pointer->buffer;if (s)while (!sg_is_last (s)) {@@ -757,6 +761,7 @@ static void NCR5380_main(struct work_struct *work)static void NCR5380_dma_complete (struct Scsi_Host *instance) {struct NCR5380_hostdata *hostdata =shost_priv (instance); +struct scsi_pointer *scsi_pointer;int transferred;unsigned char **data;int *count;@@ -764,7 +769,10 @@ static void NCR5380_dma_complete(struct Scsi_Host *instance)unsigned char p;if (hostdata->read_overruns) { - p = hostdata->connected->SCp.phase; +struct scsi_pointer *scsi_pointer = +NCR5380_scsi_pointer (hostdata->connected); + + p = scsi_pointer->phase;if (p &SR_IO ) {udelay (10 ); if ((NCR5380_read(BUS_AND_STATUS_REG) &@@ -801,8 +809,9 @@ static void NCR5380_dma_complete(struct Scsi_Host *instance) transferred = hostdata->dma_len -NCR5380_dma_residual (hostdata); hostdata->dma_len =0 ; - data = (unsigned char **)&hostdata->connected->SCp.ptr; - count = &hostdata->connected->SCp.this_residual; + scsi_pointer =NCR5380_scsi_pointer (hostdata->connected); + data = (unsigned char **)&scsi_pointer->ptr; + count = &scsi_pointer->this_residual; *data += transferred; *count -= transferred;@@ -1487,6 +1496,8 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char **data) {struct NCR5380_hostdata *hostdata =shost_priv (instance); +struct scsi_pointer *scsi_pointer = +NCR5380_scsi_pointer (hostdata->connected);int c = *count;unsigned char p = *phase;unsigned char *d = *data;@@ -1498,7 +1509,7 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,return -1 ; } - hostdata->connected->SCp.phase = p; + scsi_pointer->phase = p;if (p &SR_IO ) {if (hostdata->read_overruns)@@ -1691,6 +1702,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)while ((cmd = hostdata->connected)) {struct NCR5380_cmd *ncmd =scsi_cmd_priv (cmd); +struct scsi_pointer *scsi_pointer = &ncmd->scsi_pointer; tmp =NCR5380_read (STATUS_REG );/* We only have a valid SCSI phase when REQ is asserted */ @@ -1712,10 +1724,10 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)if (count >0 ) {if (cmd->sc_data_direction ==DMA_TO_DEVICE )sun3scsi_dma_send_setup (hostdata, - cmd->SCp.ptr, count); + scsi_pointer->ptr, count);else sun3scsi_dma_recv_setup (hostdata, - cmd->SCp.ptr, count); + scsi_pointer->ptr, count); sun3_dma_setup_done = cmd; }#ifdef SUN3_SCSI_VME @@ -1758,8 +1770,8 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)advance_sg_buffer (cmd);dsprintk (NDEBUG_INFORMATION , instance,"this residual %d, sg ents %d\n" , - cmd->SCp.this_residual, -sg_nents (cmd->SCp.buffer)); + scsi_pointer->this_residual, +sg_nents (scsi_pointer->buffer));/* * The preferred transfer method is going to be @@ -1778,7 +1790,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)if (transfersize >0 ) { len = transfersize;if (NCR5380_transfer_dma (instance, &phase, - &len, (unsigned char **)&cmd->SCp.ptr)) { + &len, (unsigned char **)&scsi_pointer->ptr)) {/* * If the watchdog timer fires, all future * accesses to this device will use the @@ -1794,13 +1806,13 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)/* Transfer a small chunk so that the * irq mode lock is not held too long. */ - transfersize =min (cmd->SCp.this_residual, + transfersize =min (scsi_pointer->this_residual,NCR5380_PIO_CHUNK_SIZE ); len = transfersize;NCR5380_transfer_pio (instance, &phase, &len, - (unsigned char **)&cmd->SCp.ptr, + (unsigned char **)&scsi_pointer->ptr,0 ); - cmd->SCp.this_residual -= transfersize - len; + scsi_pointer->this_residual -= transfersize - len; }#ifdef CONFIG_SUN3 if (sun3_dma_setup_done == cmd)@@ -1811,7 +1823,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) len =1 ; data = &tmp;NCR5380_transfer_pio (instance, &phase, &len, &data,0 ); - cmd->SCp.Message = tmp; + scsi_pointer->Message = tmp;switch (tmp) {case ABORT :@@ -1828,15 +1840,15 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) hostdata->connected =NULL ; hostdata->busy[scmd_id (cmd)] &= ~(1 << cmd->device->lun); -set_status_byte (cmd, cmd->SCp.Status); +set_status_byte (cmd, scsi_pointer->Status);set_resid_from_SCp (cmd);if (cmd->cmnd[0 ] ==REQUEST_SENSE )complete_cmd (instance, cmd);else { -if (cmd->SCp.Status ==SAM_STAT_CHECK_CONDITION || - cmd->SCp.Status ==SAM_STAT_COMMAND_TERMINATED ) { +if (scsi_pointer->Status ==SAM_STAT_CHECK_CONDITION || + scsi_pointer->Status ==SAM_STAT_COMMAND_TERMINATED ) {dsprintk (NDEBUG_QUEUES , instance,"autosense: adding cmd %p to tail of autosense queue\n" , cmd); list_add_tail(&ncmd->list,@@ -2000,7 +2012,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) len =1 ; data = &tmp;NCR5380_transfer_pio (instance, &phase, &len, &data,0 ); - cmd->SCp.Status = tmp; + scsi_pointer->Status = tmp;break ;default :shost_printk (KERN_ERR , instance,"unknown phase\n" );@@ -2151,6 +2163,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)#ifdef CONFIG_SUN3 if (sun3_dma_setup_done != tmp) { +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (tmp);int count;advance_sg_buffer (tmp);@@ -2160,10 +2173,12 @@ static void NCR5380_reselect(struct Scsi_Host *instance)if (count >0 ) {if (tmp->sc_data_direction ==DMA_TO_DEVICE )sun3scsi_dma_send_setup (hostdata, - tmp->SCp.ptr, count); + scsi_pointer->ptr, + count);else sun3scsi_dma_recv_setup (hostdata, - tmp->SCp.ptr, count); + scsi_pointer->ptr, + count); sun3_dma_setup_done = tmp; } }drivers/scsi/NCR5380.h +8
-0@@ -227,9 +227,17 @@ struct NCR5380_hostdata { };struct NCR5380_cmd { +struct scsi_pointer scsi_pointer;struct list_head list; }; +static inline struct scsi_pointer *NCR5380_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct NCR5380_cmd *ncmd =scsi_cmd_priv (cmd); + +return &ncmd->scsi_pointer; +} +#define NCR5380_PIO_CHUNK_SIZE 256/* Time limit (ms) to poll registers when IRQs are disabled, e.g. during PDMA */ drivers/scsi/atari_scsi.c +4
-2@@ -538,7 +538,8 @@ static int falcon_classify_cmd(struct scsi_cmnd *cmd)static int atari_scsi_dma_xfer_len (struct NCR5380_hostdata *hostdata,struct scsi_cmnd *cmd) { -int wanted_len = cmd->SCp.this_residual; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +int wanted_len = scsi_pointer->this_residual;int possible_len, limit;if (wanted_len <DMA_MIN_SIZE )@@ -610,7 +611,8 @@ static int atari_scsi_dma_xfer_len(struct NCR5380_hostdata *hostdata, }/* Last step: apply the hard limit on DMA transfers */ - limit = (atari_dma_buffer && !STRAM_ADDR (virt_to_phys (cmd->SCp.ptr))) ? + limit = (atari_dma_buffer && + !STRAM_ADDR (virt_to_phys (scsi_pointer->ptr))) ?STRAM_BUFFER_SIZE :255 *512 ;if (possible_len > limit) possible_len = limit;drivers/scsi/g_NCR5380.c +3
-2@@ -663,7 +663,8 @@ static inline int generic_NCR5380_psend(struct NCR5380_hostdata *hostdata,static int generic_NCR5380_dma_xfer_len (struct NCR5380_hostdata *hostdata,struct scsi_cmnd *cmd) { -int transfersize = cmd->SCp.this_residual; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +int transfersize = scsi_pointer->this_residual;if (hostdata->flags &FLAG_NO_PSEUDO_DMA )return 0 ;@@ -675,7 +676,7 @@ static int generic_NCR5380_dma_xfer_len(struct NCR5380_hostdata *hostdata,/* Limit PDMA send to 512 B to avoid random corruption on DTC3181E */ if (hostdata->board ==BOARD_DTC3181E && cmd->sc_data_direction ==DMA_TO_DEVICE ) - transfersize =min (cmd->SCp.this_residual,512 ); + transfersize =min (scsi_pointer->this_residual,512 );return min (transfersize,DMA_MAX_SIZE ); }drivers/scsi/mac_scsi.c +4
-2@@ -404,11 +404,13 @@ static inline int macscsi_pwrite(struct NCR5380_hostdata *hostdata,static int macscsi_dma_xfer_len (struct NCR5380_hostdata *hostdata,struct scsi_cmnd *cmd) { +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +if (hostdata->flags &FLAG_NO_PSEUDO_DMA || - cmd->SCp.this_residual < setup_use_pdma) + scsi_pointer->this_residual < setup_use_pdma)return 0 ; -return cmd->SCp.this_residual; +return scsi_pointer->this_residual; }static int macscsi_dma_residual (struct NCR5380_hostdata *hostdata)drivers/scsi/sun3_scsi.c +0
-0
drivers/scsi/sun3_scsi.c static int sun3scsi_dma_residual(struct NCR5380_hostdata *hostdata) · line 341
Quoted 9 lines
drivers/scsi/sun3_scsi.c +2
-1@@ -334,7 +334,8 @@ static int sun3scsi_dma_residual(struct NCR5380_hostdata *hostdata)static int sun3scsi_dma_xfer_len (struct NCR5380_hostdata *hostdata,struct scsi_cmnd *cmd) { -int wanted_len = cmd->SCp.this_residual; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +int wanted_len = scsi_pointer->this_residual;if (wanted_len <DMA_MIN_SIZE ||blk_rq_is_passthrough (scsi_cmd_to_rq (cmd)))return 0 ;
--
Himanshu Madhani Oracle Linux Engineering
Finn Thain
maintainerRe: [PATCH v2 05/44] NCR5380: Move the SCSI pointer to private command data
In reply to Bart Van AsscheHi Bart,
I see that v2 is the same as v1. Is the "v2" wrong, or the patch content wrong, or something else?
Regards,
Finn
Re: [PATCH v2 05/44] NCR5380: Move the SCSI pointer to private command data
Quoted 2 lines · Finn Thain
I see that v2 is the same as v1. Is the "v2" wrong, or the patch content wrong, or something else?
Hi Finn,
Does that question perhaps mean that you expected to see changes in this patch? The changes in v2 compared to v1 have been mentioned in the cover letter of this patch series (https://lore.kernel.org/linux-scsi/[email protected]/T/#m8f85b6b941ff84968a29f83585bac7fe8791f8a8).
Thanks,
Bart.
Hannes Reinecke
maintainerRe: [PATCH v2 05/44] NCR5380: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 134 lines · Bart Van Assche
Move the SCSI pointer into the NCR5380 private command data instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Cc Finn Thain <[email protected]>Cc Hannes Reinecke <[email protected]>Cc Ondrej Zary <[email protected]>Cc Michael Schmitz <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/NCR5380.c | 83 +++++++++++++++++++++++---------------- drivers/scsi/NCR5380.h | 8 ++++ drivers/scsi/atari_scsi.c | 6 ++- drivers/scsi/g_NCR5380.c | 5 ++- drivers/scsi/mac_scsi.c | 6 ++- drivers/scsi/sun3_scsi.c | 3 +- 6 files changed, 70 insertions(+), 41 deletions(-)drivers/scsi/NCR5380.c +30
-19@@ -145,40 +145,44 @@ static void bus_reset_cleanup(struct Scsi_Host *);static inline void initialize_SCp (struct scsi_cmnd *cmd) { +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +/* * Initialize the Scsi Pointer field so that all of the commands in the * various queues are valid. */ if (scsi_bufflen (cmd)) { - cmd->SCp.buffer =scsi_sglist (cmd); - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); - cmd->SCp.this_residual = cmd->SCp.buffer->length; + scsi_pointer->buffer =scsi_sglist (cmd); + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; }else { - cmd->SCp.buffer =NULL ; - cmd->SCp.ptr =NULL ; - cmd->SCp.this_residual =0 ; + scsi_pointer->buffer =NULL ; + scsi_pointer->ptr =NULL ; + scsi_pointer->this_residual =0 ; } - cmd->SCp.Status =0 ; - cmd->SCp.Message =0 ; + scsi_pointer->Status =0 ; + scsi_pointer->Message =0 ; }static inline void advance_sg_buffer (struct scsi_cmnd *cmd) { -struct scatterlist *s = cmd->SCp.buffer; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +struct scatterlist *s = scsi_pointer->buffer; -if (!cmd->SCp.this_residual && s && !sg_is_last (s)) { - cmd->SCp.buffer =sg_next (s); - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); - cmd->SCp.this_residual = cmd->SCp.buffer->length; +if (!scsi_pointer->this_residual && s && !sg_is_last (s)) { + scsi_pointer->buffer =sg_next (s); + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; } }static inline void set_resid_from_SCp (struct scsi_cmnd *cmd) { -int resid = cmd->SCp.this_residual; -struct scatterlist *s = cmd->SCp.buffer; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +int resid = scsi_pointer->this_residual; +struct scatterlist *s = scsi_pointer->buffer;if (s)while (!sg_is_last (s)) {@@ -757,6 +761,7 @@ static void NCR5380_main(struct work_struct *work)static void NCR5380_dma_complete (struct Scsi_Host *instance) {struct NCR5380_hostdata *hostdata =shost_priv (instance); +struct scsi_pointer *scsi_pointer;int transferred;unsigned char **data;int *count;@@ -764,7 +769,10 @@ static void NCR5380_dma_complete(struct Scsi_Host *instance)unsigned char p;if (hostdata->read_overruns) { - p = hostdata->connected->SCp.phase; +struct scsi_pointer *scsi_pointer = +NCR5380_scsi_pointer (hostdata->connected); + + p = scsi_pointer->phase;if (p &SR_IO ) {udelay (10 ); if ((NCR5380_read(BUS_AND_STATUS_REG) &@@ -801,8 +809,9 @@ static void NCR5380_dma_complete(struct Scsi_Host *instance) transferred = hostdata->dma_len -NCR5380_dma_residual (hostdata); hostdata->dma_len =0 ; - data = (unsigned char **)&hostdata->connected->SCp.ptr; - count = &hostdata->connected->SCp.this_residual; + scsi_pointer =NCR5380_scsi_pointer (hostdata->connected); + data = (unsigned char **)&scsi_pointer->ptr; + count = &scsi_pointer->this_residual; *data += transferred; *count -= transferred;@@ -1487,6 +1496,8 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char **data) {struct NCR5380_hostdata *hostdata =shost_priv (instance); +struct scsi_pointer *scsi_pointer = +NCR5380_scsi_pointer (hostdata->connected);int c = *count;unsigned char p = *phase;unsigned char *d = *data;@@ -1498,7 +1509,7 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,return -1 ; } - hostdata->connected->SCp.phase = p; + scsi_pointer->phase = p;if (p &SR_IO ) {if (hostdata->read_overruns)
drivers/scsi/NCR5380.c static void NCR5380_information_transfer(struct Scsi_Host *instance) · line 1708
Quoted 7 lines
drivers/scsi/NCR5380.c +1
-0@@ -1691,6 +1702,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)while ((cmd = hostdata->connected)) {struct NCR5380_cmd *ncmd =scsi_cmd_priv (cmd); +struct scsi_pointer *scsi_pointer = &ncmd->scsi_pointer; tmp =NCR5380_read (STATUS_REG );/* We only have a valid SCSI phase when REQ is asserted */
Why not using the macro you defined below?
Quoted 119 lines
drivers/scsi/NCR5380.c +18
-15@@ -1712,10 +1724,10 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)if (count >0 ) {if (cmd->sc_data_direction ==DMA_TO_DEVICE )sun3scsi_dma_send_setup (hostdata, - cmd->SCp.ptr, count); + scsi_pointer->ptr, count);else sun3scsi_dma_recv_setup (hostdata, - cmd->SCp.ptr, count); + scsi_pointer->ptr, count); sun3_dma_setup_done = cmd; }#ifdef SUN3_SCSI_VME @@ -1758,8 +1770,8 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)advance_sg_buffer (cmd);dsprintk (NDEBUG_INFORMATION , instance,"this residual %d, sg ents %d\n" , - cmd->SCp.this_residual, -sg_nents (cmd->SCp.buffer)); + scsi_pointer->this_residual, +sg_nents (scsi_pointer->buffer));/* * The preferred transfer method is going to be @@ -1778,7 +1790,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)if (transfersize >0 ) { len = transfersize;if (NCR5380_transfer_dma (instance, &phase, - &len, (unsigned char **)&cmd->SCp.ptr)) { + &len, (unsigned char **)&scsi_pointer->ptr)) {/* * If the watchdog timer fires, all future * accesses to this device will use the @@ -1794,13 +1806,13 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)/* Transfer a small chunk so that the * irq mode lock is not held too long. */ - transfersize =min (cmd->SCp.this_residual, + transfersize =min (scsi_pointer->this_residual,NCR5380_PIO_CHUNK_SIZE ); len = transfersize;NCR5380_transfer_pio (instance, &phase, &len, - (unsigned char **)&cmd->SCp.ptr, + (unsigned char **)&scsi_pointer->ptr,0 ); - cmd->SCp.this_residual -= transfersize - len; + scsi_pointer->this_residual -= transfersize - len; }#ifdef CONFIG_SUN3 if (sun3_dma_setup_done == cmd)@@ -1811,7 +1823,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) len =1 ; data = &tmp;NCR5380_transfer_pio (instance, &phase, &len, &data,0 ); - cmd->SCp.Message = tmp; + scsi_pointer->Message = tmp;switch (tmp) {case ABORT :@@ -1828,15 +1840,15 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) hostdata->connected =NULL ; hostdata->busy[scmd_id (cmd)] &= ~(1 << cmd->device->lun); -set_status_byte (cmd, cmd->SCp.Status); +set_status_byte (cmd, scsi_pointer->Status);set_resid_from_SCp (cmd);if (cmd->cmnd[0 ] ==REQUEST_SENSE )complete_cmd (instance, cmd);else { -if (cmd->SCp.Status ==SAM_STAT_CHECK_CONDITION || - cmd->SCp.Status ==SAM_STAT_COMMAND_TERMINATED ) { +if (scsi_pointer->Status ==SAM_STAT_CHECK_CONDITION || + scsi_pointer->Status ==SAM_STAT_COMMAND_TERMINATED ) {dsprintk (NDEBUG_QUEUES , instance,"autosense: adding cmd %p to tail of autosense queue\n" , cmd); list_add_tail(&ncmd->list,@@ -2000,7 +2012,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) len =1 ; data = &tmp;NCR5380_transfer_pio (instance, &phase, &len, &data,0 ); - cmd->SCp.Status = tmp; + scsi_pointer->Status = tmp;break ;default :shost_printk (KERN_ERR , instance,"unknown phase\n" );@@ -2151,6 +2163,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)#ifdef CONFIG_SUN3 if (sun3_dma_setup_done != tmp) { +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (tmp);int count;advance_sg_buffer (tmp);@@ -2160,10 +2173,12 @@ static void NCR5380_reselect(struct Scsi_Host *instance)if (count >0 ) {if (tmp->sc_data_direction ==DMA_TO_DEVICE )sun3scsi_dma_send_setup (hostdata, - tmp->SCp.ptr, count); + scsi_pointer->ptr, + count);else sun3scsi_dma_recv_setup (hostdata, - tmp->SCp.ptr, count); + scsi_pointer->ptr, + count); sun3_dma_setup_done = tmp; } }drivers/scsi/NCR5380.h +1
-0@@ -227,9 +227,17 @@ struct NCR5380_hostdata { };struct NCR5380_cmd { +struct scsi_pointer scsi_pointer;
drivers/scsi/NCR5380.h struct NCR5380_hostdata { · line 240
Quoted 10 lines
drivers/scsi/NCR5380.h +7
-0struct list_head list; }; +static inline struct scsi_pointer *NCR5380_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct NCR5380_cmd *ncmd =scsi_cmd_priv (cmd); + +return &ncmd->scsi_pointer; +} +
Seeing that it's open-coded at several places, maybe kill the macro entirely?
Quoted 75 lines
drivers/scsi/NCR5380.h +0
-0#define NCR5380_PIO_CHUNK_SIZE 256/* Time limit (ms) to poll registers when IRQs are disabled, e.g. during PDMA */ drivers/scsi/atari_scsi.c +4
-2@@ -538,7 +538,8 @@ static int falcon_classify_cmd(struct scsi_cmnd *cmd)static int atari_scsi_dma_xfer_len (struct NCR5380_hostdata *hostdata,struct scsi_cmnd *cmd) { -int wanted_len = cmd->SCp.this_residual; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +int wanted_len = scsi_pointer->this_residual;int possible_len, limit;if (wanted_len <DMA_MIN_SIZE )@@ -610,7 +611,8 @@ static int atari_scsi_dma_xfer_len(struct NCR5380_hostdata *hostdata, }/* Last step: apply the hard limit on DMA transfers */ - limit = (atari_dma_buffer && !STRAM_ADDR (virt_to_phys (cmd->SCp.ptr))) ? + limit = (atari_dma_buffer && + !STRAM_ADDR (virt_to_phys (scsi_pointer->ptr))) ?STRAM_BUFFER_SIZE :255 *512 ;if (possible_len > limit) possible_len = limit;drivers/scsi/g_NCR5380.c +3
-2@@ -663,7 +663,8 @@ static inline int generic_NCR5380_psend(struct NCR5380_hostdata *hostdata,static int generic_NCR5380_dma_xfer_len (struct NCR5380_hostdata *hostdata,struct scsi_cmnd *cmd) { -int transfersize = cmd->SCp.this_residual; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +int transfersize = scsi_pointer->this_residual;if (hostdata->flags &FLAG_NO_PSEUDO_DMA )return 0 ;@@ -675,7 +676,7 @@ static int generic_NCR5380_dma_xfer_len(struct NCR5380_hostdata *hostdata,/* Limit PDMA send to 512 B to avoid random corruption on DTC3181E */ if (hostdata->board ==BOARD_DTC3181E && cmd->sc_data_direction ==DMA_TO_DEVICE ) - transfersize =min (cmd->SCp.this_residual,512 ); + transfersize =min (scsi_pointer->this_residual,512 );return min (transfersize,DMA_MAX_SIZE ); }drivers/scsi/mac_scsi.c +4
-2@@ -404,11 +404,13 @@ static inline int macscsi_pwrite(struct NCR5380_hostdata *hostdata,static int macscsi_dma_xfer_len (struct NCR5380_hostdata *hostdata,struct scsi_cmnd *cmd) { +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +if (hostdata->flags &FLAG_NO_PSEUDO_DMA || - cmd->SCp.this_residual < setup_use_pdma) + scsi_pointer->this_residual < setup_use_pdma)return 0 ; -return cmd->SCp.this_residual; +return scsi_pointer->this_residual; }static int macscsi_dma_residual (struct NCR5380_hostdata *hostdata)drivers/scsi/sun3_scsi.c +0
-0
drivers/scsi/sun3_scsi.c static int sun3scsi_dma_residual(struct NCR5380_hostdata *hostdata) · line 341
Quoted 9 lines
drivers/scsi/sun3_scsi.c +2
-1@@ -334,7 +334,8 @@ static int sun3scsi_dma_residual(struct NCR5380_hostdata *hostdata)static int sun3scsi_dma_xfer_len (struct NCR5380_hostdata *hostdata,struct scsi_cmnd *cmd) { -int wanted_len = cmd->SCp.this_residual; +struct scsi_pointer *scsi_pointer =NCR5380_scsi_pointer (cmd); +int wanted_len = scsi_pointer->this_residual;if (wanted_len <DMA_MIN_SIZE ||blk_rq_is_passthrough (scsi_cmd_to_rq (cmd)))return 0 ;
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 05/44] NCR5380: Move the SCSI pointer to private command data
Quoted 11 lines · Hannes Reinecke
drivers/scsi/NCR5380.h struct NCR5380_hostdata { · line 240
Quoted 8 lines · Bart Van Assche
+static inline struct
scsi_pointer*NCR5380_scsi_pointer(structscsi_cmnd*cmd)drivers/scsi/NCR5380.h +6
-0+{ + struct NCR5380_cmd *ncmd = scsi_cmd_priv(cmd); + + return &ncmd->scsi_pointer; +} +Seeing that it's open-coded at several places, maybe kill the macro entirely?
macro -> function? Anyway, although that makes type checking less strict, I will do this.
Thanks,
Bart.
PATCH v2 6/44 scsi: arm: Rename arm/scsi.h into arm/arm_scsi.h
In reply to Bart Van AsscheThe new name makes the purpose of this header file more clear and also makes it easier to find this header file with grep.
---
drivers/scsi/arm/acornscsi.c | 2 +-
drivers/scsi/arm/{scsi.h => arm_scsi.h} | 4 +---
drivers/scsi/arm/cumana_2.c | 2 +-
drivers/scsi/arm/eesox.c | 2 +-
drivers/scsi/arm/fas216.c | 2 +-
drivers/scsi/arm/powertec.c | 2 +-
6 files changed, 6 insertions(+), 8 deletions(-)
rename drivers/scsi/arm/{scsi.h => arm_scsi.h} (97%)drivers/scsi/arm/acornscsi.c +1 -1
@@ -136,7 +136,7 @@#include <scsi/scsi_transport_spi.h> #include "acornscsi.h" #include "msgqueue.h" -#include "scsi.h" +#include "arm_scsi.h" #include <scsi/scsicam.h>
drivers/scsi/arm/arm_scsi.h renamed from drivers/scsi/arm/scsi.h +1 -3
@@ -1,10 +1,8 @@/* SPDX-License-Identifier: GPL-2.0-only */ /* -* linux/drivers/acorn/scsi/scsi.h -* * Copyright (C) 2002 Russell King * -* Commonly used scsi driver functions. +* Commonly used functions by the ARM SCSI-II drivers. */ #include <linux/scatterlist.h>
drivers/scsi/arm/cumana_2.c +1 -1
@@ -36,7 +36,7 @@#include <scsi/scsi_host.h> #include <scsi/scsi_tcq.h> #include "fas216.h" -#include "scsi.h" +#include "arm_scsi.h" #include <scsi/scsicam.h>
drivers/scsi/arm/eesox.c +1 -1
@@ -42,7 +42,7 @@#include <scsi/scsi_host.h> #include <scsi/scsi_tcq.h> #include "fas216.h" -#include "scsi.h" +#include "arm_scsi.h" #include <scsi/scsicam.h>
drivers/scsi/arm/fas216.c +1 -1
@@ -55,7 +55,7 @@#include <scsi/scsi_host.h> #include <scsi/scsi_tcq.h> #include "fas216.h" -#include "scsi.h" +#include "arm_scsi.h" /* NOTE: SCSI2 Synchronous transfers *require* DMA according to * the data sheet. This restriction is crazy, especially when
drivers/scsi/arm/powertec.c +1 -1
@@ -27,7 +27,7 @@#include <scsi/scsi_host.h> #include <scsi/scsi_tcq.h> #include "fas216.h" -#include "scsi.h" +#include "arm_scsi.h" #include <scsi/scsicam.h>
Re: [PATCH v2 06/44] scsi: arm: Rename arm/scsi.h into arm/arm_scsi.h
Quoted 96 lines · Bart Van Assche
The new name makes the purpose of this header file more clear and also makes it easier to find this header file with grep.
Cc Russell King <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/arm/acornscsi.c | 2 +- drivers/scsi/arm/{scsi.h => arm_scsi.h} | 4 +--- drivers/scsi/arm/cumana_2.c | 2 +- drivers/scsi/arm/eesox.c | 2 +- drivers/scsi/arm/fas216.c | 2 +- drivers/scsi/arm/powertec.c | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-)rename
drivers/scsi/arm/{scsi.h=>arm_scsi.h} (97%)drivers/scsi/arm/acornscsi.c +1
-1@@ -136,7 +136,7 @@#include <scsi/scsi_transport_spi.h> #include "acornscsi.h" #include "msgqueue.h" -#include "scsi.h" +#include "arm_scsi.h" #include <scsi/scsicam.h> drivers/scsi/arm/arm_scsi.h renamed from drivers/scsi/arm/scsi.h +1
-3@@ -1,10 +1,8 @@/* SPDX-License-Identifier: GPL-2.0-only */ /* -* linux/drivers/acorn/scsi/scsi.h -* * Copyright (C) 2002 Russell King * -* Commonly used scsi driver functions. +* Commonly used functions by the ARM SCSI-II drivers. */ #include <linux/scatterlist.h> drivers/scsi/arm/cumana_2.c +1
-1@@ -36,7 +36,7 @@#include <scsi/scsi_host.h> #include <scsi/scsi_tcq.h> #include "fas216.h" -#include "scsi.h" +#include "arm_scsi.h" #include <scsi/scsicam.h> drivers/scsi/arm/eesox.c +1
-1@@ -42,7 +42,7 @@#include <scsi/scsi_host.h> #include <scsi/scsi_tcq.h> #include "fas216.h" -#include "scsi.h" +#include "arm_scsi.h" #include <scsi/scsicam.h> drivers/scsi/arm/fas216.c +1
-1@@ -55,7 +55,7 @@#include <scsi/scsi_host.h> #include <scsi/scsi_tcq.h> #include "fas216.h" -#include "scsi.h" +#include "arm_scsi.h" /* NOTE: SCSI2 Synchronous transfers *require* DMA according to * the data sheet. This restriction is crazy, especially when drivers/scsi/arm/powertec.c +0
-0
drivers/scsi/arm/powertec.c line 33
Quoted 8 lines
drivers/scsi/arm/powertec.c +1
-1@@ -27,7 +27,7 @@#include <scsi/scsi_host.h> #include <scsi/scsi_tcq.h> #include "fas216.h" -#include "scsi.h" +#include "arm_scsi.h" #include <scsi/scsicam.h>
--
Himanshu Madhani Oracle Linux Engineering
Hannes Reinecke
maintainerRe: [PATCH v2 06/44] scsi: arm: Rename arm/scsi.h into arm/arm_scsi.h
In reply to Bart Van AsscheQuoted 14 lines · Bart Van Assche
The new name makes the purpose of this header file more clear and also makes it easier to find this header file with grep.
Cc Russell King <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/arm/acornscsi.c | 2 +- drivers/scsi/arm/{scsi.h => arm_scsi.h} | 4 +--- drivers/scsi/arm/cumana_2.c | 2 +- drivers/scsi/arm/eesox.c | 2 +- drivers/scsi/arm/fas216.c | 2 +- drivers/scsi/arm/powertec.c | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-)
Quoted 2 lines
rename
drivers/scsi/arm/{scsi.h=>arm_scsi.h} (97%)Reviewed-by Hannes Reinecke <[email protected]>
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
PATCH v2 7/44 scsi: arm: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/arm/acornscsi.c | 20 ++++++++++++-------- drivers/scsi/arm/arm_scsi.h | 33 +++++++++++++++++++++++---------- drivers/scsi/arm/fas216.c | 28 +++++++++++++++++----------- drivers/scsi/arm/fas216.h | 1 + 4 files changed, 53 insertions(+), 29 deletions(-)
drivers/scsi/arm/acornscsi.c +12 -8
@@ -729,7 +729,7 @@ intr_ret_t acornscsi_kick(AS_Host *host)*/ host->scsi.phase =PHASE_CONNECTING ; host->SCpnt = SCpnt; - host->scsi.SCp = SCpnt->SCp; + host->scsi.SCp = *arm_scsi_pointer (SCpnt); host->dma.xfer_setup =0 ; host->dma.xfer_required =0 ; host->dma.xfer_done =0 ;
@@ -1424,6 +1424,7 @@ unsigned char acornscsi_readmessagebyte(AS_Host *host)static void acornscsi_message (AS_Host *host) { +struct scsi_pointer *scsi_pointer;unsigned char message[16 ];unsigned int msgidx =0 , msglen =1 ;
@@ -1493,8 +1494,9 @@ void acornscsi_message(AS_Host *host)* the saved data pointer for the current I/O process. */ acornscsi_dma_cleanup (host); - host->SCpnt->SCp = host->scsi.SCp; - host->SCpnt->SCp.sent_command =0 ; + scsi_pointer =arm_scsi_pointer (host->SCpnt); + *scsi_pointer = host->scsi.SCp; + scsi_pointer->sent_command =0 ; host->scsi.phase =PHASE_MSGIN ;break ;
@@ -1509,7 +1511,7 @@ void acornscsi_message(AS_Host *host)* the present command and status areas.' */ acornscsi_dma_cleanup (host); - host->scsi.SCp = host->SCpnt->SCp; + host->scsi.SCp = *arm_scsi_pointer (host->SCpnt); host->scsi.phase =PHASE_MSGIN ;break ;
@@ -1809,7 +1811,7 @@ int acornscsi_reconnect_finish(AS_Host *host)/* * Restore data pointer from SAVED pointers. */ - host->scsi.SCp = host->SCpnt->SCp; + host->scsi.SCp = *arm_scsi_pointer (host->SCpnt);#if (DEBUG & (DEBUG_QUEUES |DEBUG_DISCON ))printk (", data pointers: [%p, %X]" , host->scsi.SCp.ptr, host->scsi.SCp.this_residual);
@@ -2408,6 +2410,7 @@ acornscsi_intr(int irq, void *dev_id)*/ static int acornscsi_queuecmd_lck (struct scsi_cmnd *SCpnt) { +struct scsi_pointer *scsi_pointer =arm_scsi_pointer (SCpnt);void (*done)(struct scsi_cmnd *) = scsi_done;AS_Host *host = (AS_Host *)SCpnt->device->host->hostdata;
@@ -2423,9 +2426,9 @@ static int acornscsi_queuecmd_lck(struct scsi_cmnd *SCpnt) SCpnt->host_scribble =NULL ; SCpnt->result =0 ; - SCpnt->SCp.phase = (int )acornscsi_datadirection (SCpnt->cmnd[0 ]); - SCpnt->SCp.sent_command =0 ; - SCpnt->SCp.scsi_xferred =0 ; + scsi_pointer->phase = (int )acornscsi_datadirection (SCpnt->cmnd[0 ]); + scsi_pointer->sent_command =0 ; + scsi_pointer->scsi_xferred =0 ;init_SCp (SCpnt);
@@ -2791,6 +2794,7 @@ static struct scsi_host_template acornscsi_template = { .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, .proc_name = "acornscsi", + .cmd_size = sizeof(struct arm_cmd_priv), };static int acornscsi_probe (struct expansion_card *ec,const struct ecard_id *id)
drivers/scsi/arm/arm_scsi.h +23 -10
@@ -9,6 +9,17 @@#define BELT_AND_BRACES +struct arm_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static inline struct scsi_pointer *arm_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct arm_cmd_priv *acmd =scsi_cmd_priv (cmd); + +return &acmd->scsi_pointer; +} +/* * The scatter-gather list handling. This contains all * the yucky stuff that needs to be fixed properly.
@@ -76,16 +87,18 @@ static inline void put_next_SCp_byte(struct scsi_pointer *SCp, unsigned char c)static inline void init_SCp (struct scsi_cmnd *SCpnt) { -memset (&SCpnt->SCp,0 ,sizeof (struct scsi_pointer )); +struct scsi_pointer *scsi_pointer =arm_scsi_pointer (SCpnt); + +memset (scsi_pointer,0 ,sizeof (struct scsi_pointer ));if (scsi_bufflen (SCpnt)) {unsigned long len =0 ; - SCpnt->SCp.buffer =scsi_sglist (SCpnt); - SCpnt->SCp.buffers_residual =scsi_sg_count (SCpnt) -1 ; - SCpnt->SCp.ptr =sg_virt (SCpnt->SCp.buffer); - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; - SCpnt->SCp.phase =scsi_bufflen (SCpnt); + scsi_pointer->buffer =scsi_sglist (SCpnt); + scsi_pointer->buffers_residual =scsi_sg_count (SCpnt) -1 ; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; + scsi_pointer->phase =scsi_bufflen (SCpnt);#ifdef BELT_AND_BRACES {/*
@@ -109,15 +122,15 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)* FIXME: Totaly naive fixup. We should abort * with error */ - SCpnt->SCp.phase = + scsi_pointer->phase = min_t(unsigned long, len, scsi_bufflen(SCpnt)); } }#endif }else { - SCpnt->SCp.ptr =NULL ; - SCpnt->SCp.this_residual =0 ; - SCpnt->SCp.phase =0 ; + scsi_pointer->ptr =NULL ; + scsi_pointer->this_residual =0 ; + scsi_pointer->phase =0 ; } }
drivers/scsi/arm/fas216.c +17 -11
@@ -761,7 +761,7 @@ static void fas216_transfer(FAS216_Info *info)fas216_log (info,LOG_ERROR ,"null buffer passed to " "fas216_starttransfer" );print_SCp (&info->scsi.SCp,"SCp: " ,"\n" ); -print_SCp (&info->SCpnt->SCp,"Cmnd SCp: " ,"\n" ); +print_SCp (arm_scsi_pointer (info->SCpnt),"Cmnd SCp: " ,"\n" );return ; }
@@ -1011,7 +1011,7 @@ fas216_reselected_intr(FAS216_Info *info)/* * Restore data pointer from SAVED data pointer */ - info->scsi.SCp = info->SCpnt->SCp; + info->scsi.SCp = *arm_scsi_pointer (info->SCpnt);fas216_log (info,LOG_CONNECT ,"data pointers: [%p, %X]" , info->scsi.SCp.ptr, info->scsi.SCp.this_residual);
@@ -1054,6 +1054,7 @@ fas216_reselected_intr(FAS216_Info *info)static void fas216_parse_message (FAS216_Info *info,unsigned char *message,int msglen) { +struct scsi_pointer *scsi_pointer;int i;switch (message[0 ]) {
@@ -1078,8 +1079,9 @@ static void fas216_parse_message(FAS216_Info *info, unsigned char *message, int* as required by the SCSI II standard. These always * point to the start of their respective areas. */ - info->SCpnt->SCp = info->scsi.SCp; - info->SCpnt->SCp.sent_command =0 ; + scsi_pointer =arm_scsi_pointer (info->SCpnt); + *scsi_pointer = info->scsi.SCp; + scsi_pointer->sent_command =0 ;fas216_log (info,LOG_CONNECT |LOG_MESSAGES |LOG_BUFFER ,"save data pointers: [%p, %X]" , info->scsi.SCp.ptr, info->scsi.SCp.this_residual);
@@ -1092,7 +1094,7 @@ static void fas216_parse_message(FAS216_Info *info, unsigned char *message, int/* * Restore current data pointer from SAVED data pointer */ - info->scsi.SCp = info->SCpnt->SCp; + info->scsi.SCp = *arm_scsi_pointer (info->SCpnt);fas216_log (info,LOG_CONNECT |LOG_MESSAGES |LOG_BUFFER ,"restore data pointers: [%p, 0x%x]" , info->scsi.SCp.ptr, info->scsi.SCp.this_residual);
@@ -1770,7 +1772,7 @@ static void fas216_start_command(FAS216_Info *info, struct scsi_cmnd *SCpnt)* claim host busy */ info->scsi.phase =PHASE_SELECTION ; - info->scsi.SCp = SCpnt->SCp; + info->scsi.SCp = *arm_scsi_pointer (SCpnt); info->SCpnt = SCpnt; info->dma.transfer_type = fasdma_none;
@@ -1849,7 +1851,7 @@ static void fas216_do_bus_device_reset(FAS216_Info *info,* claim host busy */ info->scsi.phase =PHASE_SELECTION ; - info->scsi.SCp = SCpnt->SCp; + info->scsi.SCp = *arm_scsi_pointer (SCpnt); info->SCpnt = SCpnt; info->dma.transfer_type = fasdma_none;
@@ -1999,11 +2001,13 @@ static void fas216_devicereset_done(FAS216_Info *info, struct scsi_cmnd *SCpnt,static void fas216_rq_sns_done (FAS216_Info *info,struct scsi_cmnd *SCpnt,unsigned int result) { +struct scsi_pointer *scsi_pointer =arm_scsi_pointer (SCpnt); +fas216_log_target (info,LOG_CONNECT , SCpnt->device->id,"request sense complete, result=0x%04x%02x%02x" , - result, SCpnt->SCp.Message, SCpnt->SCp.Status); + result, scsi_pointer->Message, scsi_pointer->Status); -if (result !=DID_OK || SCpnt->SCp.Status !=SAM_STAT_GOOD ) +if (result !=DID_OK || scsi_pointer->Status !=SAM_STAT_GOOD )/* * Something went wrong. Make sure that we don't * have valid data in the sense buffer that could
@@ -2033,6 +2037,8 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt,static void fas216_std_done (FAS216_Info *info,struct scsi_cmnd *SCpnt,unsigned int result) { +struct scsi_pointer *scsi_pointer =arm_scsi_pointer (SCpnt); + info->stats.fins +=1 ;set_host_byte (SCpnt, result);
@@ -2107,8 +2113,8 @@ fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result)fas216_log_target (info,LOG_CONNECT , SCpnt->device->id,"requesting sense" );init_SCp (SCpnt); - SCpnt->SCp.Message =0 ; - SCpnt->SCp.Status =0 ; + scsi_pointer->Message =0 ; + scsi_pointer->Status =0 ; SCpnt->host_scribble = (void *)fas216_rq_sns_done;/*
drivers/scsi/arm/fas216.h +1 -0
@@ -312,6 +312,7 @@ typedef struct {/* driver-private data per SCSI command. */ struct fas216_cmd_priv { +struct scsi_pointer scsi_pointer;/* must be the first member */ void (*scsi_done)(struct scsi_cmnd *cmd); };
Re: [PATCH v2 07/44] scsi: arm: Move the SCSI pointer to private command data
Quoted 4 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.
Quoted 9 lines
Cc Russell King <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/arm/acornscsi.c | 20 ++++++++++++-------- drivers/scsi/arm/arm_scsi.h | 33 +++++++++++++++++++++++---------- drivers/scsi/arm/fas216.c | 28 +++++++++++++++++----------- drivers/scsi/arm/fas216.h | 1 + 4 files changed, 53 insertions(+), 29 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 07/44] scsi: arm: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 274 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Cc Russell King <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/arm/acornscsi.c | 20 ++++++++++++-------- drivers/scsi/arm/arm_scsi.h | 33 +++++++++++++++++++++++---------- drivers/scsi/arm/fas216.c | 28 +++++++++++++++++----------- drivers/scsi/arm/fas216.h | 1 + 4 files changed, 53 insertions(+), 29 deletions(-)drivers/scsi/arm/acornscsi.c +1
-1@@ -729,7 +729,7 @@ intr_ret_t acornscsi_kick(AS_Host *host)*/ host->scsi.phase =PHASE_CONNECTING ; host->SCpnt = SCpnt; - host->scsi.SCp = SCpnt->SCp; + host->scsi.SCp = *arm_scsi_pointer (SCpnt); host->dma.xfer_setup =0 ; host->dma.xfer_required =0 ; host->dma.xfer_done =0 ;@@ -1424,6 +1424,7 @@ unsigned char acornscsi_readmessagebyte(AS_Host *host)static
voidacornscsi_message(AS_Host *host)
{drivers/scsi/arm/acornscsi.c +11
-7+struct scsi_pointer *scsi_pointer;unsigned char message[16 ];unsigned int msgidx =0 , msglen =1 ;@@ -1493,8 +1494,9 @@ void acornscsi_message(AS_Host *host)* the saved data pointer for the current I/O process. */ acornscsi_dma_cleanup (host); - host->SCpnt->SCp = host->scsi.SCp; - host->SCpnt->SCp.sent_command =0 ; + scsi_pointer =arm_scsi_pointer (host->SCpnt); + *scsi_pointer = host->scsi.SCp; + scsi_pointer->sent_command =0 ; host->scsi.phase =PHASE_MSGIN ;break ;@@ -1509,7 +1511,7 @@ void acornscsi_message(AS_Host *host)* the present command and status areas.' */ acornscsi_dma_cleanup (host); - host->scsi.SCp = host->SCpnt->SCp; + host->scsi.SCp = *arm_scsi_pointer (host->SCpnt); host->scsi.phase =PHASE_MSGIN ;break ;@@ -1809,7 +1811,7 @@ int acornscsi_reconnect_finish(AS_Host *host)/* * Restore data pointer from SAVED pointers. */ - host->scsi.SCp = host->SCpnt->SCp; + host->scsi.SCp = *arm_scsi_pointer (host->SCpnt);#if (DEBUG & (DEBUG_QUEUES |DEBUG_DISCON ))printk (", data pointers: [%p, %X]" , host->scsi.SCp.ptr, host->scsi.SCp.this_residual);@@ -2408,6 +2410,7 @@ acornscsi_intr(int irq, void *dev_id)*/ static int acornscsi_queuecmd_lck (struct scsi_cmnd *SCpnt) { +struct scsi_pointer *scsi_pointer =arm_scsi_pointer (SCpnt);void (*done)(struct scsi_cmnd *) = scsi_done;AS_Host *host = (AS_Host *)SCpnt->device->host->hostdata;@@ -2423,9 +2426,9 @@ static int acornscsi_queuecmd_lck(struct scsi_cmnd *SCpnt) SCpnt->host_scribble =NULL ; SCpnt->result =0 ; - SCpnt->SCp.phase = (int )acornscsi_datadirection (SCpnt->cmnd[0 ]); - SCpnt->SCp.sent_command =0 ; - SCpnt->SCp.scsi_xferred =0 ; + scsi_pointer->phase = (int )acornscsi_datadirection (SCpnt->cmnd[0 ]); + scsi_pointer->sent_command =0 ; + scsi_pointer->scsi_xferred =0 ;init_SCp (SCpnt);@@ -2791,6 +2794,7 @@ static struct scsi_host_template acornscsi_template = { .cmd_per_lun = 2, .dma_boundary = PAGE_SIZE - 1, .proc_name = "acornscsi", + .cmd_size = sizeof(struct arm_cmd_priv), };static int acornscsi_probe (struct expansion_card *ec,const struct ecard_id *id)drivers/scsi/arm/arm_scsi.h +23
-10@@ -9,6 +9,17 @@#define BELT_AND_BRACES +struct arm_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static inline struct scsi_pointer *arm_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct arm_cmd_priv *acmd =scsi_cmd_priv (cmd); + +return &acmd->scsi_pointer; +} +/* * The scatter-gather list handling. This contains all * the yucky stuff that needs to be fixed properly. @@ -76,16 +87,18 @@ static inline void put_next_SCp_byte(struct scsi_pointer *SCp, unsigned char c)static inline void init_SCp (struct scsi_cmnd *SCpnt) { -memset (&SCpnt->SCp,0 ,sizeof (struct scsi_pointer )); +struct scsi_pointer *scsi_pointer =arm_scsi_pointer (SCpnt); + +memset (scsi_pointer,0 ,sizeof (struct scsi_pointer ));if (scsi_bufflen (SCpnt)) {unsigned long len =0 ; - SCpnt->SCp.buffer =scsi_sglist (SCpnt); - SCpnt->SCp.buffers_residual =scsi_sg_count (SCpnt) -1 ; - SCpnt->SCp.ptr =sg_virt (SCpnt->SCp.buffer); - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; - SCpnt->SCp.phase =scsi_bufflen (SCpnt); + scsi_pointer->buffer =scsi_sglist (SCpnt); + scsi_pointer->buffers_residual =scsi_sg_count (SCpnt) -1 ; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; + scsi_pointer->phase =scsi_bufflen (SCpnt);#ifdef BELT_AND_BRACES {/* @@ -109,15 +122,15 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)* FIXME: Totaly naive fixup. We should abort * with error */ - SCpnt->SCp.phase = + scsi_pointer->phase = min_t(unsigned long, len, scsi_bufflen(SCpnt)); } }#endif }else { - SCpnt->SCp.ptr =NULL ; - SCpnt->SCp.this_residual =0 ; - SCpnt->SCp.phase =0 ; + scsi_pointer->ptr =NULL ; + scsi_pointer->this_residual =0 ; + scsi_pointer->phase =0 ; } }drivers/scsi/arm/fas216.c +13
-9@@ -761,7 +761,7 @@ static void fas216_transfer(FAS216_Info *info)fas216_log (info,LOG_ERROR ,"null buffer passed to " "fas216_starttransfer" );print_SCp (&info->scsi.SCp,"SCp: " ,"\n" ); -print_SCp (&info->SCpnt->SCp,"Cmnd SCp: " ,"\n" ); +print_SCp (arm_scsi_pointer (info->SCpnt),"Cmnd SCp: " ,"\n" );return ; }@@ -1011,7 +1011,7 @@ fas216_reselected_intr(FAS216_Info *info)/* * Restore data pointer from SAVED data pointer */ - info->scsi.SCp = info->SCpnt->SCp; + info->scsi.SCp = *arm_scsi_pointer (info->SCpnt);fas216_log (info,LOG_CONNECT ,"data pointers: [%p, %X]" , info->scsi.SCp.ptr, info->scsi.SCp.this_residual);@@ -1054,6 +1054,7 @@ fas216_reselected_intr(FAS216_Info *info)static void fas216_parse_message (FAS216_Info *info,unsigned char *message,int msglen) { +struct scsi_pointer *scsi_pointer;int i;switch (message[0 ]) {@@ -1078,8 +1079,9 @@ static void fas216_parse_message(FAS216_Info *info, unsigned char *message, int* as required by the SCSI II standard. These always * point to the start of their respective areas. */ - info->SCpnt->SCp = info->scsi.SCp; - info->SCpnt->SCp.sent_command =0 ; + scsi_pointer =arm_scsi_pointer (info->SCpnt); + *scsi_pointer = info->scsi.SCp; + scsi_pointer->sent_command =0 ;fas216_log (info,LOG_CONNECT |LOG_MESSAGES |LOG_BUFFER ,"save data pointers: [%p, %X]" , info->scsi.SCp.ptr, info->scsi.SCp.this_residual);@@ -1092,7 +1094,7 @@ static void fas216_parse_message(FAS216_Info *info, unsigned char *message, int/* * Restore current data pointer from SAVED data pointer */ - info->scsi.SCp = info->SCpnt->SCp; + info->scsi.SCp = *arm_scsi_pointer (info->SCpnt);fas216_log (info,LOG_CONNECT |LOG_MESSAGES |LOG_BUFFER ,"restore data pointers: [%p, 0x%x]" , info->scsi.SCp.ptr, info->scsi.SCp.this_residual);@@ -1770,7 +1772,7 @@ static void fas216_start_command(FAS216_Info *info, struct scsi_cmnd *SCpnt)* claim host busy */ info->scsi.phase =PHASE_SELECTION ; - info->scsi.SCp = SCpnt->SCp; + info->scsi.SCp = *arm_scsi_pointer (SCpnt); info->SCpnt = SCpnt; info->dma.transfer_type = fasdma_none;@@ -1849,7 +1851,7 @@ static void fas216_do_bus_device_reset(FAS216_Info *info,* claim host busy */ info->scsi.phase =PHASE_SELECTION ; - info->scsi.SCp = SCpnt->SCp; + info->scsi.SCp = *arm_scsi_pointer (SCpnt); info->SCpnt = SCpnt; info->dma.transfer_type = fasdma_none;@@ -1999,11 +2001,13 @@ static void fas216_devicereset_done(FAS216_Info *info, struct scsi_cmnd *SCpnt,static void fas216_rq_sns_done (FAS216_Info *info,struct scsi_cmnd *SCpnt,unsigned int result) { +struct scsi_pointer *scsi_pointer =arm_scsi_pointer (SCpnt); +fas216_log_target (info,LOG_CONNECT , SCpnt->device->id,"request sense complete, result=0x%04x%02x%02x" , - result, SCpnt->SCp.Message, SCpnt->SCp.Status); + result, scsi_pointer->Message, scsi_pointer->Status); -if (result !=DID_OK || SCpnt->SCp.Status !=SAM_STAT_GOOD ) +if (result !=DID_OK || scsi_pointer->Status !=SAM_STAT_GOOD )/* * Something went wrong. Make sure that we don't * have valid data in the sense buffer that could @@ -2033,6 +2037,8 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt,static void
fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result){drivers/scsi/arm/fas216.c +2
-0+struct scsi_pointer *scsi_pointer =arm_scsi_pointer (SCpnt); +info->stats.fins += 1; set_host_byte(SCpnt, result);drivers/scsi/arm/fas216.c +2
-2@@ -2107,8 +2113,8 @@ fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result)fas216_log_target (info,LOG_CONNECT , SCpnt->device->id,"requesting sense" );init_SCp (SCpnt); - SCpnt->SCp.Message =0 ; - SCpnt->SCp.Status =0 ; + scsi_pointer->Message =0 ; + scsi_pointer->Status =0 ; SCpnt->host_scribble = (void *)fas216_rq_sns_done;/* drivers/scsi/arm/fas216.h +0
-0
drivers/scsi/arm/fas216.h typedef struct { · line 318
Quoted 7 lines
drivers/scsi/arm/fas216.h +1
-0@@ -312,6 +312,7 @@ typedef struct {/* driver-private data per SCSI command. */ struct fas216_cmd_priv { +struct scsi_pointer scsi_pointer;/* must be the first member */ void (*scsi_done)(struct scsi_cmnd *cmd); };
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 8/44 53c700: Stop clearing SCSI pointer fields
In reply to Bart Van AsscheNone of the 53c700 drivers uses the SCSI pointer. Hence remove the code from 53c700.c that clears two SCSI pointer fields. The 53c700 drivers are:
$ git grep -nHE 'include.*53c700' drivers/scsi/53c700.c:132:#include "53c700.h" drivers/scsi/53c700.c:153:#include "53c700_d.h" drivers/scsi/a4000t.c:22:#include "53c700.h" drivers/scsi/bvme6000_scsi.c:23:#include "53c700.h" drivers/scsi/lasi700.c:43:#include "53c700.h" drivers/scsi/mvme16x_scsi.c:23:#include "53c700.h" drivers/scsi/sim710.c:29:#include "53c700.h" drivers/scsi/sni_53c710.c:38:#include "53c700.h" drivers/scsi/zorro7xx.c:25:#include "53c700.h"
--- drivers/scsi/53c700.c | 2 -- 1 file changed, 2 deletions(-)
drivers/scsi/53c700.c +0 -2
@@ -1791,8 +1791,6 @@ static int NCR_700_queuecommand_lck(struct scsi_cmnd *SCp) slot->cmnd = SCp; SCp->host_scribble = (unsigned char *)slot; - SCp->SCp.ptr =NULL ; - SCp->SCp.buffer =NULL ;#ifdef NCR_700_DEBUG printk ("53c700: scsi%d, command " , SCp->device->host->host_no);
Re: [PATCH v2 08/44] 53c700: Stop clearing SCSI pointer fields
Quoted 29 lines · Bart Van Assche
None of the 53c700 drivers uses the SCSI pointer. Hence remove the code from
53c700.cthat clears two SCSI pointer fields. The 53c700 drivers are:$ git grep -nHE 'include.*53c700' drivers/scsi/53c700.c:132:#include "53c700.h" drivers/scsi/53c700.c:153:#include "53c700_d.h" drivers/scsi/a4000t.c:22:#include "53c700.h" drivers/scsi/bvme6000_scsi.c:23:#include "53c700.h" drivers/scsi/lasi700.c:43:#include "53c700.h" drivers/scsi/mvme16x_scsi.c:23:#include "53c700.h" drivers/scsi/sim710.c:29:#include "53c700.h" drivers/scsi/sni_53c710.c:38:#include "53c700.h" drivers/scsi/zorro7xx.c:25:#include "53c700.h"Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/53c700.c| 2 --1 file changed, 2 deletions(-)drivers/scsi/53c700.c +0
-0
drivers/scsi/53c700.c static int NCR_700_queuecommand_lck(struct scsi_cmnd *SCp) · line 1796
Quoted 8 lines
drivers/scsi/53c700.c +0
-2@@ -1791,8 +1791,6 @@ static int NCR_700_queuecommand_lck(struct scsi_cmnd *SCp) slot->cmnd = SCp; SCp->host_scribble = (unsigned char *)slot; - SCp->SCp.ptr =NULL ; - SCp->SCp.buffer =NULL ;#ifdef NCR_700_DEBUG printk ("53c700: scsi%d, command " , SCp->device->host->host_no);
--
Himanshu Madhani Oracle Linux Engineering
Re: [PATCH v2 08/44] 53c700: Stop clearing SCSI pointer fields
In reply to Bart Van AsscheQuoted 25 lines · Bart Van Assche
None of the 53c700 drivers uses the SCSI pointer. Hence remove the code from
53c700.cthat clears two SCSI pointer fields. The 53c700 drivers are:$ git grep -nHE 'include.*53c700' drivers/scsi/53c700.c:132:#include "53c700.h" drivers/scsi/53c700.c:153:#include "53c700_d.h" drivers/scsi/a4000t.c:22:#include "53c700.h" drivers/scsi/bvme6000_scsi.c:23:#include "53c700.h" drivers/scsi/lasi700.c:43:#include "53c700.h" drivers/scsi/mvme16x_scsi.c:23:#include "53c700.h" drivers/scsi/sim710.c:29:#include "53c700.h" drivers/scsi/sni_53c710.c:38:#include "53c700.h" drivers/scsi/zorro7xx.c:25:#include "53c700.h"Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/53c700.c | 2 -- 1 file changed, 2 deletions(-)drivers/scsi/53c700.c +0
-0
drivers/scsi/53c700.c static int NCR_700_queuecommand_lck(struct scsi_cmnd *SCp) · line 1796
Quoted 8 lines
drivers/scsi/53c700.c +0
-2@@ -1791,8 +1791,6 @@ static int NCR_700_queuecommand_lck(struct scsi_cmnd *SCp) slot->cmnd = SCp; SCp->host_scribble = (unsigned char *)slot; - SCp->SCp.ptr =NULL ; - SCp->SCp.buffer =NULL ;#ifdef NCR_700_DEBUG printk ("53c700: scsi%d, command " , SCp->device->host->host_no);
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
PATCH v2 9/44 aacraid: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/aacraid/aachba.c | 43 ++++++++++++++++++--------------- drivers/scsi/aacraid/aacraid.h | 24 ++++++++++++++---- drivers/scsi/aacraid/comminit.c | 2 +- drivers/scsi/aacraid/linit.c | 21 ++++++++-------- 4 files changed, 54 insertions(+), 36 deletions(-)
drivers/scsi/aacraid/aachba.c +23 -20
@@ -338,7 +338,7 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd,aac_fib_complete (fibptr);return 0 ; } - scsicmd->SCp.phase =AAC_OWNER_MIDLEVEL ; +aac_priv (scsicmd)->owner =AAC_OWNER_MIDLEVEL ; device = scsicmd->device;if (unlikely (!device)) {dprintk ((KERN_WARNING "aac_valid_context: scsi device corrupt\n" ));
@@ -592,7 +592,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd)aac_fib_init (cmd_fibcontext); dinfo = (struct aac_get_name *)fib_data (cmd_fibcontext); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; dinfo->command =cpu_to_le32 (VM_ContainerConfig); dinfo->type =cpu_to_le32 (CT_READ_NAME );
@@ -634,14 +634,15 @@ static void _aac_probe_container2(void * context, struct fib * fibptr) {struct fsa_dev_info *fsa_dev_ptr;int (*callback)(struct scsi_cmnd *); -struct scsi_cmnd * scsicmd = (struct scsi_cmnd *)context; +struct scsi_cmnd *scsicmd = context; +struct aac_cmd_priv *cmd_priv =aac_priv (scsicmd);int i;if (!aac_valid_context (scsicmd, fibptr))return ; - scsicmd->SCp.Status =0 ; + cmd_priv->status =0 ; fsa_dev_ptr = fibptr->dev->fsa_dev;if (fsa_dev_ptr) {struct aac_mount * dresp = (struct aac_mount *)fib_data (fibptr);
@@ -679,12 +680,12 @@ static void _aac_probe_container2(void * context, struct fib * fibptr) }if ((fsa_dev_ptr->valid &1 ) ==0 ) fsa_dev_ptr->valid =0 ; - scsicmd->SCp.Status =le32_to_cpu (dresp->count); + cmd_priv->status =le32_to_cpu (dresp->count); }aac_fib_complete (fibptr);aac_fib_free (fibptr); - callback = (int (*)(struct scsi_cmnd *))(scsicmd->SCp.ptr); - scsicmd->SCp.ptr =NULL ; + callback = cmd_priv->callback; + cmd_priv->callback =NULL ; (*callback)(scsicmd);return ; }
@@ -722,7 +723,7 @@ static void _aac_probe_container1(void * context, struct fib * fibptr) dinfo->count =cpu_to_le32 (scmd_id (scsicmd)); dinfo->type =cpu_to_le32 (FT_FILESYS ); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; status = aac_fib_send(ContainerCommand, fibptr,
@@ -743,6 +744,7 @@ static void _aac_probe_container1(void * context, struct fib * fibptr)static int _aac_probe_container (struct scsi_cmnd * scsicmd,int (*callback)(struct scsi_cmnd *)) { +struct aac_cmd_priv *cmd_priv =aac_priv (scsicmd);struct fib * fibptr;int status = -ENOMEM ;
@@ -761,8 +763,8 @@ static int _aac_probe_container(struct scsi_cmnd * scsicmd, int (*callback)(stru dinfo->count =cpu_to_le32 (scmd_id (scsicmd)); dinfo->type =cpu_to_le32 (FT_FILESYS ); - scsicmd->SCp.ptr = (char *)callback; - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; + cmd_priv->callback = callback; + cmd_priv->owner =AAC_OWNER_FIRMWARE ; status = aac_fib_send(ContainerCommand, fibptr,
@@ -778,7 +780,7 @@ static int _aac_probe_container(struct scsi_cmnd * scsicmd, int (*callback)(strureturn 0 ;if (status <0 ) { - scsicmd->SCp.ptr =NULL ; + cmd_priv->callback =NULL ;aac_fib_complete (fibptr);aac_fib_free (fibptr); }
@@ -817,6 +819,7 @@ static void aac_probe_container_scsi_done(struct scsi_cmnd *scsi_cmnd)int aac_probe_container (struct aac_dev *dev,int cid) {struct scsi_cmnd *scsicmd =kzalloc (sizeof (*scsicmd),GFP_KERNEL ); +struct aac_cmd_priv *cmd_priv =aac_priv (scsicmd);struct scsi_device *scsidev =kzalloc (sizeof (*scsidev),GFP_KERNEL );int status;
@@ -835,7 +838,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)while (scsicmd->device == scsidev)schedule ();kfree (scsidev); - status = scsicmd->SCp.Status; + status = cmd_priv->status;kfree (scsicmd);return status; }
@@ -1128,7 +1131,7 @@ static int aac_get_container_serial(struct scsi_cmnd * scsicmd) dinfo->command =cpu_to_le32 (VM_ContainerConfig); dinfo->type =cpu_to_le32 (CT_CID_TO_32BITS_UID ); dinfo->cid =cpu_to_le32 (scmd_id (scsicmd)); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; status = aac_fib_send(ContainerCommand, cmd_fibcontext,
@@ -2486,7 +2489,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)* Alocate and initialize a Fib */ cmd_fibcontext =aac_fib_alloc_tag (dev, scsicmd); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; status =aac_adapter_read (cmd_fibcontext, scsicmd, lba, count);/*
@@ -2577,7 +2580,7 @@ static int aac_write(struct scsi_cmnd * scsicmd)* Allocate and initialize a Fib then setup a BlockWrite command */ cmd_fibcontext =aac_fib_alloc_tag (dev, scsicmd); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; status =aac_adapter_write (cmd_fibcontext, scsicmd, lba, count, fua);/*
@@ -2660,7 +2663,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd) synchronizecmd->cid =cpu_to_le32 (scmd_id (scsicmd)); synchronizecmd->count =cpu_to_le32 (sizeof (((struct aac_synchronize_reply *)NULL )->data)); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ;/* * Now send the Fib to the adapter
@@ -2736,7 +2739,7 @@ static int aac_start_stop(struct scsi_cmnd *scsicmd) pmcmd->cid =cpu_to_le32 (sdev_id (sdev)); pmcmd->parm = (scsicmd->cmnd[1 ] &1 ) ?cpu_to_le32 (CT_PM_UNIT_IMMEDIATE ) :0 ; - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ;/* * Now send the Fib to the adapter
@@ -3695,7 +3698,7 @@ void aac_hba_callback(void *context, struct fib *fibptr)aac_fib_complete (fibptr);if (fibptr->flags &FIB_CONTEXT_FLAG_NATIVE_HBA_TMF ) - scsicmd->SCp.sent_command =1 ; +aac_priv (scsicmd)->sent_command =1 ;else aac_scsi_done (scsicmd); }
@@ -3725,7 +3728,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)* Allocate and initialize a Fib then setup a BlockWrite command */ cmd_fibcontext =aac_fib_alloc_tag (dev, scsicmd); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; status =aac_adapter_scsi (cmd_fibcontext, scsicmd);/*
@@ -3769,7 +3772,7 @@ static int aac_send_hba_fib(struct scsi_cmnd *scsicmd)if (!cmd_fibcontext)return -1 ; - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; status =aac_adapter_hba (cmd_fibcontext, scsicmd);/*
drivers/scsi/aacraid/aacraid.h +19 -5
@@ -29,6 +29,7 @@#include <linux/completion.h> #include <linux/pci.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_cmnd.h> /*------------------------------------------------------------------------------ * D E F I N E S
@@ -2673,11 +2674,24 @@ static inline void aac_cancel_rescan_worker(struct aac_dev *dev)cancel_delayed_work_sync (&dev->src_reinit_aif_worker); } -/* SCp.phase values */ -#define AAC_OWNER_MIDLEVEL 0x101 -#define AAC_OWNER_LOWLEVEL 0x102 -#define AAC_OWNER_ERROR_HANDLER 0x103 -#define AAC_OWNER_FIRMWARE 0x106 +enum aac_cmd_owner { +AAC_OWNER_MIDLEVEL =0x101 , +AAC_OWNER_LOWLEVEL =0x102 , +AAC_OWNER_ERROR_HANDLER =0x103 , +AAC_OWNER_FIRMWARE =0x106 , +}; + +struct aac_cmd_priv { +int (*callback)(struct scsi_cmnd *); +int status; +enum aac_cmd_owner owner; +bool sent_command; +}; + +static inline struct aac_cmd_priv *aac_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +}void aac_safw_rescan_worker (struct work_struct *work);void aac_src_reinit_aif_worker (struct work_struct *work);
drivers/scsi/aacraid/comminit.c +1 -1
@@ -276,7 +276,7 @@ static bool wait_for_io_iter(struct scsi_cmnd *cmd, void *data, bool rsvd) {int *active = data; -if (cmd->SCp.phase ==AAC_OWNER_FIRMWARE ) +if (aac_priv (cmd)->owner ==AAC_OWNER_FIRMWARE ) *active = *active +1 ;return true; }
drivers/scsi/aacraid/linit.c +11 -10
@@ -241,10 +241,9 @@ static struct aac_driver_ident aac_drivers[] = {static int aac_queuecommand (struct Scsi_Host *shost,struct scsi_cmnd *cmd) { -int r =0 ; - cmd->SCp.phase =AAC_OWNER_LOWLEVEL ; - r = (aac_scsi_cmd (cmd) ?FAILED :0 ); -return r; +aac_priv (cmd)->owner =AAC_OWNER_LOWLEVEL ; + +return aac_scsi_cmd (cmd) ?FAILED :0 ; }/**
@@ -638,7 +637,7 @@ static bool fib_count_iter(struct scsi_cmnd *scmnd, void *data, bool reserved) {struct fib_count_data *fib_count = data; -switch (scmnd->SCp.phase) { +switch (aac_priv (scmnd)->owner) {case AAC_OWNER_FIRMWARE : fib_count->fwcnt++;break ;
@@ -680,6 +679,7 @@ static int get_num_of_incomplete_fibs(struct aac_dev *aac)static int aac_eh_abort (struct scsi_cmnd * cmd) { +struct aac_cmd_priv *cmd_priv =aac_priv (cmd);struct scsi_device * dev = cmd->device;struct Scsi_Host * host = dev->host;struct aac_dev * aac = (struct aac_dev *)host->hostdata;
@@ -732,7 +732,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) tmf->error_length =cpu_to_le32 (FW_ERROR_BUFFER_SIZE ); fib->hbacmd_size =sizeof (*tmf); - cmd->SCp.sent_command =0 ; + cmd_priv->sent_command =0 ; status = aac_hba_send(HBA_IU_TYPE_SCSI_TM_REQ, fib, (fib_callback) aac_hba_callback,
@@ -744,7 +744,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) }/* Wait up to 15 secs for completion */ for (count =0 ; count <15 ; ++count) { -if (cmd->SCp.sent_command) { +if (cmd_priv->sent_command) { ret =SUCCESS ;break ; }
@@ -784,7 +784,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) (fib->callback_data == cmd)) { fib->flags |=FIB_CONTEXT_FLAG_TIMED_OUT ; - cmd->SCp.phase = + cmd_priv->owner =AAC_OWNER_ERROR_HANDLER ; ret =SUCCESS ; }
@@ -811,7 +811,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) (command->device == cmd->device)) { fib->flags |=FIB_CONTEXT_FLAG_TIMED_OUT ; - command->SCp.phase = +aac_priv (command)->owner =AAC_OWNER_ERROR_HANDLER ;if (command == cmd) ret =SUCCESS ;
@@ -1058,7 +1058,7 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd)if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || info->devtype !=AAC_DEVTYPE_NATIVE_RAW ) { fib->flags |=FIB_CONTEXT_FLAG_EH_RESET ; - cmd->SCp.phase =AAC_OWNER_ERROR_HANDLER ; +aac_priv (cmd)->owner =AAC_OWNER_ERROR_HANDLER ; } } }
@@ -1507,6 +1507,7 @@ static struct scsi_host_template aac_driver_template = {#endif .emulated = 1, .no_write_same = 1, + .cmd_size = sizeof(struct aac_cmd_priv), };static void __aac_shutdown (struct aac_dev * aac)
Re: [PATCH v2 09/44] aacraid: Move the SCSI pointer to private command data
Quoted 4 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.
Quoted 8 lines
Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/aacraid/aachba.c | 43 ++++++++++++++++++--------------- drivers/scsi/aacraid/aacraid.h | 24 ++++++++++++++---- drivers/scsi/aacraid/comminit.c | 2 +- drivers/scsi/aacraid/linit.c | 21 ++++++++-------- 4 files changed, 54 insertions(+), 36 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 09/44] aacraid: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 334 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/aacraid/aachba.c | 43 ++++++++++++++++++--------------- drivers/scsi/aacraid/aacraid.h | 24 ++++++++++++++---- drivers/scsi/aacraid/comminit.c | 2 +- drivers/scsi/aacraid/linit.c | 21 ++++++++-------- 4 files changed, 54 insertions(+), 36 deletions(-)drivers/scsi/aacraid/aachba.c +23
-20@@ -338,7 +338,7 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd,aac_fib_complete (fibptr);return 0 ; } - scsicmd->SCp.phase =AAC_OWNER_MIDLEVEL ; +aac_priv (scsicmd)->owner =AAC_OWNER_MIDLEVEL ; device = scsicmd->device;if (unlikely (!device)) {dprintk ((KERN_WARNING "aac_valid_context: scsi device corrupt\n" ));@@ -592,7 +592,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd)aac_fib_init (cmd_fibcontext); dinfo = (struct aac_get_name *)fib_data (cmd_fibcontext); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; dinfo->command =cpu_to_le32 (VM_ContainerConfig); dinfo->type =cpu_to_le32 (CT_READ_NAME );@@ -634,14 +634,15 @@ static void _aac_probe_container2(void * context, struct fib * fibptr) {struct fsa_dev_info *fsa_dev_ptr;int (*callback)(struct scsi_cmnd *); -struct scsi_cmnd * scsicmd = (struct scsi_cmnd *)context; +struct scsi_cmnd *scsicmd = context; +struct aac_cmd_priv *cmd_priv =aac_priv (scsicmd);int i;if (!aac_valid_context (scsicmd, fibptr))return ; - scsicmd->SCp.Status =0 ; + cmd_priv->status =0 ; fsa_dev_ptr = fibptr->dev->fsa_dev;if (fsa_dev_ptr) {struct aac_mount * dresp = (struct aac_mount *)fib_data (fibptr);@@ -679,12 +680,12 @@ static void _aac_probe_container2(void * context, struct fib * fibptr) }if ((fsa_dev_ptr->valid &1 ) ==0 ) fsa_dev_ptr->valid =0 ; - scsicmd->SCp.Status =le32_to_cpu (dresp->count); + cmd_priv->status =le32_to_cpu (dresp->count); }aac_fib_complete (fibptr);aac_fib_free (fibptr); - callback = (int (*)(struct scsi_cmnd *))(scsicmd->SCp.ptr); - scsicmd->SCp.ptr =NULL ; + callback = cmd_priv->callback; + cmd_priv->callback =NULL ; (*callback)(scsicmd);return ; }@@ -722,7 +723,7 @@ static void _aac_probe_container1(void * context, struct fib * fibptr) dinfo->count =cpu_to_le32 (scmd_id (scsicmd)); dinfo->type =cpu_to_le32 (FT_FILESYS ); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; status = aac_fib_send(ContainerCommand, fibptr,@@ -743,6 +744,7 @@ static void _aac_probe_container1(void * context, struct fib * fibptr)static int _aac_probe_container (struct scsi_cmnd * scsicmd,int (*callback)(struct scsi_cmnd *)) { +struct aac_cmd_priv *cmd_priv =aac_priv (scsicmd);struct fib * fibptr;int status = -ENOMEM ;@@ -761,8 +763,8 @@ static int _aac_probe_container(struct scsi_cmnd * scsicmd, int (*callback)(stru dinfo->count =cpu_to_le32 (scmd_id (scsicmd)); dinfo->type =cpu_to_le32 (FT_FILESYS ); - scsicmd->SCp.ptr = (char *)callback; - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; + cmd_priv->callback = callback; + cmd_priv->owner =AAC_OWNER_FIRMWARE ; status = aac_fib_send(ContainerCommand, fibptr,@@ -778,7 +780,7 @@ static int _aac_probe_container(struct scsi_cmnd * scsicmd, int (*callback)(strureturn 0 ;if (status <0 ) { - scsicmd->SCp.ptr =NULL ; + cmd_priv->callback =NULL ;aac_fib_complete (fibptr);aac_fib_free (fibptr); }@@ -817,6 +819,7 @@ static void aac_probe_container_scsi_done(struct scsi_cmnd *scsi_cmnd)int aac_probe_container (struct aac_dev *dev,int cid) {struct scsi_cmnd *scsicmd =kzalloc (sizeof (*scsicmd),GFP_KERNEL ); +struct aac_cmd_priv *cmd_priv =aac_priv (scsicmd);struct scsi_device *scsidev =kzalloc (sizeof (*scsidev),GFP_KERNEL );int status;@@ -835,7 +838,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)while (scsicmd->device == scsidev)schedule ();kfree (scsidev); - status = scsicmd->SCp.Status; + status = cmd_priv->status;kfree (scsicmd);return status; }@@ -1128,7 +1131,7 @@ static int aac_get_container_serial(struct scsi_cmnd * scsicmd) dinfo->command =cpu_to_le32 (VM_ContainerConfig); dinfo->type =cpu_to_le32 (CT_CID_TO_32BITS_UID ); dinfo->cid =cpu_to_le32 (scmd_id (scsicmd)); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; status = aac_fib_send(ContainerCommand, cmd_fibcontext,@@ -2486,7 +2489,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)* Alocate and initialize a Fib */ cmd_fibcontext =aac_fib_alloc_tag (dev, scsicmd); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; status =aac_adapter_read (cmd_fibcontext, scsicmd, lba, count);/* @@ -2577,7 +2580,7 @@ static int aac_write(struct scsi_cmnd * scsicmd)* Allocate and initialize a Fib then setup a BlockWrite command */ cmd_fibcontext =aac_fib_alloc_tag (dev, scsicmd); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; status =aac_adapter_write (cmd_fibcontext, scsicmd, lba, count, fua);/* @@ -2660,7 +2663,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd) synchronizecmd->cid =cpu_to_le32 (scmd_id (scsicmd)); synchronizecmd->count =cpu_to_le32 (sizeof (((struct aac_synchronize_reply *)NULL )->data)); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ;/* * Now send the Fib to the adapter @@ -2736,7 +2739,7 @@ static int aac_start_stop(struct scsi_cmnd *scsicmd) pmcmd->cid =cpu_to_le32 (sdev_id (sdev)); pmcmd->parm = (scsicmd->cmnd[1 ] &1 ) ?cpu_to_le32 (CT_PM_UNIT_IMMEDIATE ) :0 ; - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ;/* * Now send the Fib to the adapter @@ -3695,7 +3698,7 @@ void aac_hba_callback(void *context, struct fib *fibptr)aac_fib_complete (fibptr);if (fibptr->flags &FIB_CONTEXT_FLAG_NATIVE_HBA_TMF ) - scsicmd->SCp.sent_command =1 ; +aac_priv (scsicmd)->sent_command =1 ;else aac_scsi_done (scsicmd); }@@ -3725,7 +3728,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)* Allocate and initialize a Fib then setup a BlockWrite command */ cmd_fibcontext =aac_fib_alloc_tag (dev, scsicmd); - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; status =aac_adapter_scsi (cmd_fibcontext, scsicmd);/* @@ -3769,7 +3772,7 @@ static int aac_send_hba_fib(struct scsi_cmnd *scsicmd)if (!cmd_fibcontext)return -1 ; - scsicmd->SCp.phase =AAC_OWNER_FIRMWARE ; +aac_priv (scsicmd)->owner =AAC_OWNER_FIRMWARE ; status =aac_adapter_hba (cmd_fibcontext, scsicmd);/* drivers/scsi/aacraid/aacraid.h +19
-5@@ -29,6 +29,7 @@#include <linux/completion.h> #include <linux/pci.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_cmnd.h> /*------------------------------------------------------------------------------ * D E F I N E S @@ -2673,11 +2674,24 @@ static inline void aac_cancel_rescan_worker(struct aac_dev *dev)cancel_delayed_work_sync (&dev->src_reinit_aif_worker); } -/* SCp.phase values */ -#define AAC_OWNER_MIDLEVEL 0x101 -#define AAC_OWNER_LOWLEVEL 0x102 -#define AAC_OWNER_ERROR_HANDLER 0x103 -#define AAC_OWNER_FIRMWARE 0x106 +enum aac_cmd_owner { +AAC_OWNER_MIDLEVEL =0x101 , +AAC_OWNER_LOWLEVEL =0x102 , +AAC_OWNER_ERROR_HANDLER =0x103 , +AAC_OWNER_FIRMWARE =0x106 , +}; + +struct aac_cmd_priv { +int (*callback)(struct scsi_cmnd *); +int status; +enum aac_cmd_owner owner; +bool sent_command; +}; + +static inline struct aac_cmd_priv *aac_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +}void aac_safw_rescan_worker (struct work_struct *work);void aac_src_reinit_aif_worker (struct work_struct *work);drivers/scsi/aacraid/comminit.c +1
-1@@ -276,7 +276,7 @@ static bool wait_for_io_iter(struct scsi_cmnd *cmd, void *data, bool rsvd) {int *active = data; -if (cmd->SCp.phase ==AAC_OWNER_FIRMWARE ) +if (aac_priv (cmd)->owner ==AAC_OWNER_FIRMWARE ) *active = *active +1 ;return true; }drivers/scsi/aacraid/linit.c +10
-10@@ -241,10 +241,9 @@ static struct aac_driver_ident aac_drivers[] = {static int aac_queuecommand (struct Scsi_Host *shost,struct scsi_cmnd *cmd) { -int r =0 ; - cmd->SCp.phase =AAC_OWNER_LOWLEVEL ; - r = (aac_scsi_cmd (cmd) ?FAILED :0 ); -return r; +aac_priv (cmd)->owner =AAC_OWNER_LOWLEVEL ; + +return aac_scsi_cmd (cmd) ?FAILED :0 ; }/** @@ -638,7 +637,7 @@ static bool fib_count_iter(struct scsi_cmnd *scmnd, void *data, bool reserved) {struct fib_count_data *fib_count = data; -switch (scmnd->SCp.phase) { +switch (aac_priv (scmnd)->owner) {case AAC_OWNER_FIRMWARE : fib_count->fwcnt++;break ;@@ -680,6 +679,7 @@ static int get_num_of_incomplete_fibs(struct aac_dev *aac)static int aac_eh_abort (struct scsi_cmnd * cmd) { +struct aac_cmd_priv *cmd_priv =aac_priv (cmd);struct scsi_device * dev = cmd->device;struct Scsi_Host * host = dev->host;struct aac_dev * aac = (struct aac_dev *)host->hostdata;@@ -732,7 +732,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) tmf->error_length =cpu_to_le32 (FW_ERROR_BUFFER_SIZE ); fib->hbacmd_size =sizeof (*tmf); - cmd->SCp.sent_command =0 ; + cmd_priv->sent_command =0 ; status = aac_hba_send(HBA_IU_TYPE_SCSI_TM_REQ, fib, (fib_callback) aac_hba_callback,@@ -744,7 +744,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) }/* Wait up to 15 secs for completion */ for (count =0 ; count <15 ; ++count) { -if (cmd->SCp.sent_command) { +if (cmd_priv->sent_command) { ret =SUCCESS ;break ; }@@ -784,7 +784,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) (fib->callback_data == cmd)) { fib->flags |=FIB_CONTEXT_FLAG_TIMED_OUT ; - cmd->SCp.phase = + cmd_priv->owner =AAC_OWNER_ERROR_HANDLER ; ret =SUCCESS ; }@@ -811,7 +811,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) (command->device == cmd->device)) { fib->flags |=FIB_CONTEXT_FLAG_TIMED_OUT ; - command->SCp.phase = +aac_priv (command)->owner =AAC_OWNER_ERROR_HANDLER ;if (command == cmd) ret =SUCCESS ;@@ -1058,7 +1058,7 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd)if (bus >=AAC_MAX_BUSES || cid >=AAC_MAX_TARGETS || info->devtype !=AAC_DEVTYPE_NATIVE_RAW ) { fib->flags |=FIB_CONTEXT_FLAG_EH_RESET ; - cmd->SCp.phase =AAC_OWNER_ERROR_HANDLER ; +aac_priv (cmd)->owner =AAC_OWNER_ERROR_HANDLER ; } } }
drivers/scsi/aacraid/linit.c static struct scsi_host_template aac_driver_template = { · line 1513
Quoted 7 lines
drivers/scsi/aacraid/linit.c +1
-0@@ -1507,6 +1507,7 @@ static struct scsi_host_template aac_driver_template = {#endif .emulated = 1, .no_write_same = 1, + .cmd_size = sizeof(struct aac_cmd_priv), };static void __aac_shutdown (struct aac_dev * aac)
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 10/44 advansys: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/advansys.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/scsi/advansys.c +16 -6
@@ -2277,6 +2277,15 @@ struct asc_board { dvc_var.adv_dvc_var)#define adv_dvc_to_pdev (adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev) +struct advansys_cmd { +dma_addr_t dma_handle; +}; + +static struct advansys_cmd *advansys_cmd (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +#ifdef ADVANSYS_DEBUG static int asc_dbglvl =3 ;
@@ -6681,7 +6690,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)ASC_STATS (boardp->shost, callback); -dma_unmap_single (boardp->dev, scp->SCp.dma_handle, +dma_unmap_single (boardp->dev,advansys_cmd (scp)->dma_handle,SCSI_SENSE_BUFFERSIZE ,DMA_FROM_DEVICE );/* * 'qdonep' contains the command's ending status.
@@ -7399,15 +7408,15 @@ static int advansys_slave_configure(struct scsi_device *sdev)static __le32 asc_get_sense_buffer_dma (struct scsi_cmnd *scp) {struct asc_board *board =shost_priv (scp->device->host); +struct advansys_cmd *acmd =advansys_cmd (scp); - scp->SCp.dma_handle =dma_map_single (board->dev, scp->sense_buffer, -SCSI_SENSE_BUFFERSIZE , -DMA_FROM_DEVICE ); -if (dma_mapping_error (board->dev, scp->SCp.dma_handle)) { + acmd->dma_handle =dma_map_single (board->dev, scp->sense_buffer, +SCSI_SENSE_BUFFERSIZE ,DMA_FROM_DEVICE ); +if (dma_mapping_error (board->dev, acmd->dma_handle)) {ASC_DBG (1 ,"failed to map sense buffer\n" );return 0 ; } -return cpu_to_le32 (scp->SCp.dma_handle); +return cpu_to_le32 (acmd->dma_handle); } static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
@@ -10604,6 +10613,7 @@ static struct scsi_host_template advansys_template = { .eh_host_reset_handler = advansys_reset, .bios_param = advansys_biosparam, .slave_configure = advansys_slave_configure, + .cmd_size = sizeof(struct advansys_cmd), };static int advansys_wide_init_chip (struct Scsi_Host *shost)
PATCH v2 11/44 aha1542: Remove a set-but-not-used array
In reply to Bart Van AsscheThis patch fixes the following W=1 warning:
drivers/scsi/aha1542.c:209:12: warning: variable ‘inquiry_result’ set but not used [-Wunused-but-set-variable]
209 | u8 inquiry_result[4];
--- drivers/scsi/aha1542.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/aha1542.c +1 -2
@@ -206,7 +206,6 @@ static int makecode(unsigned hosterr, unsigned scsierr)static int aha1542_test_port (struct Scsi_Host *sh) { -u8 inquiry_result[4 ];int i;/* Quick and dirty test for presence of the card. */
@@ -240,7 +239,7 @@ static int aha1542_test_port(struct Scsi_Host *sh)for (i =0 ; i <4 ; i++) {if (!wait_mask (STATUS (sh->io_port),DF ,DF ,0 ,0 ))return 0 ; - inquiry_result[i] =inb (DATA (sh->io_port)); + (void )inb (DATA (sh->io_port)); }/* Reading port should reset DF */
Re: [PATCH v2 11/44] aha1542: Remove a set-but-not-used array
Quoted 24 lines · Bart Van Assche
This patch fixes the following W=1 warning:
drivers/scsi/aha1542.c:209:12: warning: variable ‘inquiry_result’ set but not used [-Wunused-but-set-variable]
209 | u8 inquiry_result[4];Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/aha1542.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/scsi/aha1542.c +0
-1@@ -206,7 +206,6 @@ static int makecode(unsigned hosterr, unsigned scsierr)static int aha1542_test_port (struct Scsi_Host *sh) { -u8 inquiry_result[4 ];int i;/* Quick and dirty test for presence of the card. */
drivers/scsi/aha1542.c static int aha1542_test_port(struct Scsi_Host *sh) · line 245
Quoted 8 lines
drivers/scsi/aha1542.c +1
-1@@ -240,7 +239,7 @@ static int aha1542_test_port(struct Scsi_Host *sh)for (i =0 ; i <4 ; i++) {if (!wait_mask (STATUS (sh->io_port),DF ,DF ,0 ,0 ))return 0 ; - inquiry_result[i] =inb (DATA (sh->io_port)); + (void )inb (DATA (sh->io_port)); }/* Reading port should reset DF */
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 11/44] aha1542: Remove a set-but-not-used array
In reply to Bart Van AsscheQuoted 28 lines · Bart Van Assche
This patch fixes the following W=1 warning:
drivers/scsi/aha1542.c:209:12: warning: variable ‘inquiry_result’ set but not used [-Wunused-but-set-variable]
209 | u8 inquiry_result[4];Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/aha1542.c| 3 +--1 file changed, 1 insertion(+), 2 deletions(-)drivers/scsi/aha1542.c +0
-1@@ -206,7 +206,6 @@ static int makecode(unsigned hosterr, unsigned scsierr)static int aha1542_test_port (struct Scsi_Host *sh) { -u8 inquiry_result[4 ];int i;/* Quick and dirty test for presence of the card. */
drivers/scsi/aha1542.c static int aha1542_test_port(struct Scsi_Host *sh) · line 245
Quoted 8 lines
drivers/scsi/aha1542.c +1
-1@@ -240,7 +239,7 @@ static int aha1542_test_port(struct Scsi_Host *sh)for (i =0 ; i <4 ; i++) {if (!wait_mask (STATUS (sh->io_port),DF ,DF ,0 ,0 ))return 0 ; - inquiry_result[i] =inb (DATA (sh->io_port)); + (void )inb (DATA (sh->io_port)); }/* Reading port should reset DF */
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 12/44 aha152x: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/aha152x.c | 259 ++++++++++++++++++++++++----------------- 1 file changed, 155 insertions(+), 104 deletions(-)
drivers/scsi/aha152x.c +155 -104
@@ -316,6 +316,17 @@ enum { check_condition = 0x0800, /* requesting sense after CHECK CONDITION */ }; +struct aha152x_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *aha152x_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct aha152x_cmd_priv *acmd =scsi_cmd_priv (cmd); + +return &acmd->scsi_pointer; +} +MODULE_AUTHOR ("Jürgen Fischer" );MODULE_DESCRIPTION (AHA152X_REVID );MODULE_LICENSE ("GPL" );
@@ -879,14 +890,17 @@ void aha152x_release(struct Scsi_Host *shpnt)static int setup_expected_interrupts (struct Scsi_Host *shpnt) {if (CURRENT_SC ) { -CURRENT_SC ->SCp.phase |=1 <<16 ; +struct scsi_pointer *scsi_pointer = +aha152x_scsi_pointer (CURRENT_SC ); -if (CURRENT_SC ->SCp.phase & selecting) { + scsi_pointer->phase |=1 <<16 ; + +if (scsi_pointer->phase & selecting) {SETPORT (SSTAT1 ,SELTO );SETPORT (SIMODE0 ,ENSELDO | (DISCONNECTED_SC ?ENSELDI :0 ));SETPORT (SIMODE1 ,ENSELTIMO ); }else { -SETPORT (SIMODE0 , (CURRENT_SC ->SCp.phase & spiordy) ?ENSPIORDY :0 ); +SETPORT (SIMODE0 , (scsi_pointer->phase & spiordy) ?ENSPIORDY :0 );SETPORT (SIMODE1 ,ENPHASEMIS |ENSCSIRST |ENSCSIPERR |ENBUSFREE ); } }else if (STATE ==seldi) {
@@ -910,16 +924,17 @@ static int setup_expected_interrupts(struct Scsi_Host *shpnt)static int aha152x_internal_queue (struct scsi_cmnd *SCpnt,struct completion *complete,int phase) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (SCpnt);struct Scsi_Host *shpnt = SCpnt->device->host;unsigned long flags; - SCpnt->SCp.phase = not_issued | phase; - SCpnt->SCp.Status =0x1 ;/* Ilegal status by SCSI standard */ - SCpnt->SCp.Message =0 ; - SCpnt->SCp.have_data_in =0 ; - SCpnt->SCp.sent_command =0 ; + scsi_pointer->phase = not_issued | phase; + scsi_pointer->Status =0x1 ;/* Ilegal status by SCSI standard */ + scsi_pointer->Message =0 ; + scsi_pointer->have_data_in =0 ; + scsi_pointer->sent_command =0 ; -if (SCpnt->SCp.phase & (resetting|check_condition)) { +if (scsi_pointer->phase & (resetting | check_condition)) {if (!SCpnt->host_scribble ||SCSEM (SCpnt) ||SCNEXT (SCpnt)) {scmd_printk (KERN_ERR , SCpnt,"cannot reuse command\n" );return FAILED ;
@@ -942,15 +957,15 @@ static int aha152x_internal_queue(struct scsi_cmnd *SCpnt,SCp.phase : current state of the command */ if ((phase & resetting) || !scsi_sglist (SCpnt)) { - SCpnt->SCp.ptr =NULL ; - SCpnt->SCp.this_residual =0 ; + scsi_pointer->ptr =NULL ; + scsi_pointer->this_residual =0 ;scsi_set_resid (SCpnt,0 ); - SCpnt->SCp.buffer =NULL ; + scsi_pointer->buffer =NULL ; }else {scsi_set_resid (SCpnt,scsi_bufflen (SCpnt)); - SCpnt->SCp.buffer =scsi_sglist (SCpnt); - SCpnt->SCp.ptr =SG_ADDRESS (SCpnt->SCp.buffer); - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; + scsi_pointer->buffer =scsi_sglist (SCpnt); + scsi_pointer->ptr =SG_ADDRESS (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; }DO_LOCK (flags);
@@ -1000,7 +1015,7 @@ static void reset_done(struct scsi_cmnd *SCpnt)static void aha152x_scsi_done (struct scsi_cmnd *SCpnt) { -if (SCpnt->SCp.phase & resetting) +if (aha152x_scsi_pointer (SCpnt)->phase & resetting)reset_done (SCpnt);else scsi_done (SCpnt);
@@ -1086,7 +1101,7 @@ static int aha152x_device_reset(struct scsi_cmnd * SCpnt)DO_LOCK (flags); -if (SCpnt->SCp.phase & resetted) { +if (aha152x_scsi_pointer (SCpnt)->phase & resetted) {HOSTDATA (shpnt)->commands--;if (!HOSTDATA (shpnt)->commands)SETPORT (PORTA ,0 );
@@ -1380,28 +1395,31 @@ static void busfree_run(struct Scsi_Host *shpnt)SETPORT (SSTAT1 ,CLRBUSFREE );if (CURRENT_SC ) { +struct scsi_pointer *scsi_pointer = +aha152x_scsi_pointer (CURRENT_SC ); +#if defined(AHA152X_STAT ) action++;#endif -CURRENT_SC ->SCp.phase &= ~syncneg; + scsi_pointer->phase &= ~syncneg; -if (CURRENT_SC ->SCp.phase & completed) { +if (scsi_pointer->phase & completed) {/* target sent COMMAND COMPLETE */ -done (shpnt,CURRENT_SC ->SCp.Status,DID_OK ); +done (shpnt, scsi_pointer->Status,DID_OK ); - }else if (CURRENT_SC ->SCp.phase & aborted) { -done (shpnt,CURRENT_SC ->SCp.Status,DID_ABORT ); + }else if (scsi_pointer->phase & aborted) { +done (shpnt, scsi_pointer->Status,DID_ABORT ); - }else if (CURRENT_SC ->SCp.phase & resetted) { -done (shpnt,CURRENT_SC ->SCp.Status,DID_RESET ); + }else if (scsi_pointer->phase & resetted) { +done (shpnt, scsi_pointer->Status,DID_RESET ); - }else if (CURRENT_SC ->SCp.phase & disconnected) { + }else if (scsi_pointer->phase & disconnected) {/* target sent DISCONNECT */ #if defined(AHA152X_STAT )HOSTDATA (shpnt)->disconnections++;#endif append_SC (&DISCONNECTED_SC ,CURRENT_SC ); -CURRENT_SC ->SCp.phase |=1 <<16 ; + scsi_pointer->phase |=1 <<16 ;CURRENT_SC =NULL ; }else {
@@ -1420,23 +1438,24 @@ static void busfree_run(struct Scsi_Host *shpnt) action++;#endif -if (DONE_SC ->SCp.phase & check_condition) { +if (aha152x_scsi_pointer (DONE_SC )->phase & check_condition) {struct scsi_cmnd *cmd =HOSTDATA (shpnt)->done_SC;struct aha152x_scdata *sc =SCDATA (cmd);scsi_eh_restore_cmnd (cmd, &sc->ses); - cmd->SCp.Status =SAM_STAT_CHECK_CONDITION ; +aha152x_scsi_pointer (cmd)->Status =SAM_STAT_CHECK_CONDITION ;HOSTDATA (shpnt)->commands--;if (!HOSTDATA (shpnt)->commands)SETPORT (PORTA ,0 );/* turn led off */ - }else if (DONE_SC ->SCp.Status==SAM_STAT_CHECK_CONDITION ) { + }else if (aha152x_scsi_pointer (DONE_SC )->Status == +SAM_STAT_CHECK_CONDITION ) {#if defined(AHA152X_STAT )HOSTDATA (shpnt)->busfree_with_check_condition++;#endif -if (!(DONE_SC ->SCp.phase & not_issued)) { +if (!(aha152x_scsi_pointer (DONE_SC )->phase & not_issued)) {struct aha152x_scdata *sc;struct scsi_cmnd *ptr =DONE_SC ;DONE_SC =NULL ;
@@ -1461,7 +1480,7 @@ static void busfree_run(struct Scsi_Host *shpnt)if (!HOSTDATA (shpnt)->commands)SETPORT (PORTA ,0 );/* turn led off */ -if (!(ptr->SCp.phase & resetting)) { +if (!(aha152x_scsi_pointer (ptr)->phase & resetting)) {kfree (ptr->host_scribble); ptr->host_scribble=NULL ; }
@@ -1484,10 +1503,13 @@ static void busfree_run(struct Scsi_Host *shpnt)DO_UNLOCK (flags);if (CURRENT_SC ) { +struct scsi_pointer *scsi_pointer = +aha152x_scsi_pointer (CURRENT_SC ); +#if defined(AHA152X_STAT ) action++;#endif -CURRENT_SC ->SCp.phase |= selecting; + scsi_pointer->phase |= selecting;/* clear selection timeout */ SETPORT (SSTAT1 ,SELTO );
@@ -1515,11 +1537,13 @@ static void busfree_run(struct Scsi_Host *shpnt)*/ static void seldo_run (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); +SETPORT (SCSISIG ,0 );SETPORT (SSTAT1 ,CLRBUSFREE );SETPORT (SSTAT1 ,CLRPHASECHG ); -CURRENT_SC ->SCp.phase &= ~(selecting|not_issued); + scsi_pointer->phase &= ~(selecting | not_issued);SETPORT (SCSISEQ ,0 );
@@ -1534,12 +1558,12 @@ static void seldo_run(struct Scsi_Host *shpnt)ADDMSGO (IDENTIFY (RECONNECT ,CURRENT_SC ->device->lun)); -if (CURRENT_SC ->SCp.phase & aborting) { +if (scsi_pointer->phase & aborting) {ADDMSGO (ABORT ); - }else if (CURRENT_SC ->SCp.phase & resetting) { + }else if (scsi_pointer->phase & resetting) {ADDMSGO (BUS_DEVICE_RESET ); }else if (SYNCNEG ==0 &&SYNCHRONOUS ) { -CURRENT_SC ->SCp.phase |= syncneg; + scsi_pointer->phase |= syncneg;MSGOLEN +=spi_populate_sync_msg (&MSGO (MSGOLEN ),50 ,8 );SYNCNEG =1 ;/* negotiation in progress */ }
@@ -1554,15 +1578,17 @@ static void seldo_run(struct Scsi_Host *shpnt)*/ static void selto_run (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); +SETPORT (SCSISEQ ,0 );SETPORT (SSTAT1 ,CLRSELTIMO );if (!CURRENT_SC )return ; -CURRENT_SC ->SCp.phase &= ~selecting; + scsi_pointer->phase &= ~selecting; -if (CURRENT_SC ->SCp.phase & aborted) +if (scsi_pointer->phase & aborted)done (shpnt,SAM_STAT_GOOD ,DID_ABORT );else if (TESTLO (SSTAT0 ,SELINGO ))done (shpnt,SAM_STAT_GOOD ,DID_BUS_BUSY );
@@ -1590,7 +1616,10 @@ static void seldi_run(struct Scsi_Host *shpnt)SETPORT (SSTAT1 ,CLRPHASECHG );if (CURRENT_SC ) { -if (!(CURRENT_SC ->SCp.phase & not_issued)) +struct scsi_pointer *scsi_pointer = +aha152x_scsi_pointer (CURRENT_SC ); + +if (!(scsi_pointer->phase & not_issued))scmd_printk (KERN_ERR ,CURRENT_SC ,"command should not have been issued yet\n" );
@@ -1647,6 +1676,7 @@ static void seldi_run(struct Scsi_Host *shpnt)static void msgi_run (struct Scsi_Host *shpnt) {for (;;) { +struct scsi_pointer *scsi_pointer;int sstat1 =GETPORT (SSTAT1 );if (sstat1 & (PHASECHG |PHASEMIS |BUSFREE ) || !(sstat1 &REQINIT ))
@@ -1684,8 +1714,9 @@ static void msgi_run(struct Scsi_Host *shpnt)continue ; } -CURRENT_SC ->SCp.Message =MSGI (0 ); -CURRENT_SC ->SCp.phase &= ~disconnected; + scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); + scsi_pointer->Message =MSGI (0 ); + scsi_pointer->phase &= ~disconnected;MSGILEN =0 ;
@@ -1693,7 +1724,8 @@ static void msgi_run(struct Scsi_Host *shpnt)continue ; } -CURRENT_SC ->SCp.Message =MSGI (0 ); + scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); + scsi_pointer->Message =MSGI (0 );switch (MSGI (0 )) {case DISCONNECT :
@@ -1701,11 +1733,11 @@ static void msgi_run(struct Scsi_Host *shpnt)scmd_printk (KERN_WARNING ,CURRENT_SC ,"target was not allowed to disconnect\n" ); -CURRENT_SC ->SCp.phase |= disconnected; + scsi_pointer->phase |= disconnected;break ;case COMMAND_COMPLETE : -CURRENT_SC ->SCp.phase |= completed; + scsi_pointer->phase |= completed;break ;case MESSAGE_REJECT :
@@ -1835,8 +1867,11 @@ static void msgi_end(struct Scsi_Host *shpnt)*/ static void msgo_init (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); +if (MSGOLEN ==0 ) { -if ((CURRENT_SC ->SCp.phase & syncneg) &&SYNCNEG ==2 &&SYNCRATE ==0 ) { +if ((scsi_pointer->phase & syncneg) &&SYNCNEG ==2 && +SYNCRATE ==0 ) {ADDMSGO (IDENTIFY (RECONNECT ,CURRENT_SC ->device->lun)); }else { scmd_printk(KERN_INFO, CURRENT_SC,
@@ -1853,6 +1888,8 @@ static void msgo_init(struct Scsi_Host *shpnt)*/ static void msgo_run (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); +while (MSGO_I <MSGOLEN ) {if (TESTLO (SSTAT0 ,SPIORDY ))return ;
@@ -1864,13 +1901,13 @@ static void msgo_run(struct Scsi_Host *shpnt)if (MSGO (MSGO_I ) &IDENTIFY_BASE ) -CURRENT_SC ->SCp.phase |= identified; + scsi_pointer->phase |= identified;if (MSGO (MSGO_I )==ABORT ) -CURRENT_SC ->SCp.phase |= aborted; + scsi_pointer->phase |= aborted;if (MSGO (MSGO_I )==BUS_DEVICE_RESET ) -CURRENT_SC ->SCp.phase |= resetted; + scsi_pointer->phase |= resetted;SETPORT (SCSIDAT ,MSGO (MSGO_I ++)); }
@@ -1899,7 +1936,7 @@ static void msgo_end(struct Scsi_Host *shpnt)*/ static void cmd_init (struct Scsi_Host *shpnt) { -if (CURRENT_SC ->SCp.sent_command) { +if (aha152x_scsi_pointer (CURRENT_SC )->sent_command) {scmd_printk (KERN_ERR ,CURRENT_SC ,"command already sent\n" );done (shpnt,SAM_STAT_GOOD ,DID_ERROR );
@@ -1930,7 +1967,7 @@ static void cmd_end(struct Scsi_Host *shpnt)"command sent incompletely (%d/%d)\n" , CMD_I, CURRENT_SC->cmd_len); else - CURRENT_SC->SCp.sent_command++; + aha152x_scsi_pointer(CURRENT_SC)->sent_command++; }/*
@@ -1942,7 +1979,7 @@ static void status_run(struct Scsi_Host *shpnt)if (TESTLO (SSTAT0 ,SPIORDY ))return ; -CURRENT_SC ->SCp.Status =GETPORT (SCSIDAT ); +aha152x_scsi_pointer (CURRENT_SC )->Status =GETPORT (SCSIDAT ); }
@@ -1966,6 +2003,7 @@ static void datai_init(struct Scsi_Host *shpnt)static void datai_run (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer;unsigned long the_time;int fifodata, data_count;
@@ -2003,35 +2041,36 @@ static void datai_run(struct Scsi_Host *shpnt) fifodata =GETPORT (FIFOSTAT ); } -if (CURRENT_SC ->SCp.this_residual>0 ) { -while (fifodata>0 &&CURRENT_SC ->SCp.this_residual>0 ) { - data_count = fifodata >CURRENT_SC ->SCp.this_residual ? -CURRENT_SC ->SCp.this_residual : + scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); +if (scsi_pointer->this_residual >0 ) { +while (fifodata >0 && scsi_pointer->this_residual >0 ) { + data_count = fifodata > scsi_pointer->this_residual ? + scsi_pointer->this_residual : fifodata; fifodata -= data_count;if (data_count &1 ) {SETPORT (DMACNTRL0 ,ENDMA |_8BIT); - *CURRENT_SC ->SCp.ptr++ =GETPORT (DATAPORT ); -CURRENT_SC ->SCp.this_residual--; + *scsi_pointer->ptr++ =GETPORT (DATAPORT ); + scsi_pointer->this_residual--;DATA_LEN ++;SETPORT (DMACNTRL0 ,ENDMA ); }if (data_count >1 ) { data_count >>=1 ; -insw (DATAPORT ,CURRENT_SC ->SCp.ptr, data_count); -CURRENT_SC ->SCp.ptr +=2 * data_count; -CURRENT_SC ->SCp.this_residual -=2 * data_count; +insw (DATAPORT , scsi_pointer->ptr, data_count); + scsi_pointer->ptr +=2 * data_count; + scsi_pointer->this_residual -=2 * data_count;DATA_LEN +=2 * data_count; } -if (CURRENT_SC ->SCp.this_residual ==0 && - !sg_is_last (CURRENT_SC ->SCp.buffer)) { +if (scsi_pointer->this_residual ==0 && + !sg_is_last (scsi_pointer->buffer)) {/* advance to next buffer */ -CURRENT_SC ->SCp.buffer =sg_next (CURRENT_SC ->SCp.buffer); -CURRENT_SC ->SCp.ptr =SG_ADDRESS (CURRENT_SC ->SCp.buffer); -CURRENT_SC ->SCp.this_residual =CURRENT_SC ->SCp.buffer->length; + scsi_pointer->buffer =sg_next (scsi_pointer->buffer); + scsi_pointer->ptr =SG_ADDRESS (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; } } }else if (fifodata >0 ) {
@@ -2099,14 +2138,15 @@ static void datao_init(struct Scsi_Host *shpnt)static void datao_run (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC );unsigned long the_time;int data_count;/* until phase changes or all data sent */ -while (TESTLO (DMASTAT ,INTSTAT ) &&CURRENT_SC ->SCp.this_residual>0 ) { +while (TESTLO (DMASTAT ,INTSTAT ) && scsi_pointer->this_residual >0 ) { data_count =128 ; -if (data_count >CURRENT_SC ->SCp.this_residual) - data_count=CURRENT_SC ->SCp.this_residual; +if (data_count > scsi_pointer->this_residual) + data_count = scsi_pointer->this_residual;if (TESTLO (DMASTAT ,DFIFOEMP )) { scmd_printk(KERN_ERR, CURRENT_SC,
@@ -2117,26 +2157,26 @@ static void datao_run(struct Scsi_Host *shpnt)if (data_count &1 ) {SETPORT (DMACNTRL0 ,WRITE_READ |ENDMA |_8BIT); -SETPORT (DATAPORT , *CURRENT_SC ->SCp.ptr++); -CURRENT_SC ->SCp.this_residual--; +SETPORT (DATAPORT , *scsi_pointer->ptr++); + scsi_pointer->this_residual--;CMD_INC_RESID (CURRENT_SC ,-1 );SETPORT (DMACNTRL0 ,WRITE_READ |ENDMA ); }if (data_count >1 ) { data_count >>=1 ; -outsw (DATAPORT ,CURRENT_SC ->SCp.ptr, data_count); -CURRENT_SC ->SCp.ptr +=2 * data_count; -CURRENT_SC ->SCp.this_residual -=2 * data_count; +outsw (DATAPORT , scsi_pointer->ptr, data_count); + scsi_pointer->ptr +=2 * data_count; + scsi_pointer->this_residual -=2 * data_count;CMD_INC_RESID (CURRENT_SC ,-2 * data_count); } -if (CURRENT_SC ->SCp.this_residual ==0 && - !sg_is_last (CURRENT_SC ->SCp.buffer)) { +if (scsi_pointer->this_residual ==0 && + !sg_is_last (scsi_pointer->buffer)) {/* advance to next buffer */ -CURRENT_SC ->SCp.buffer =sg_next (CURRENT_SC ->SCp.buffer); -CURRENT_SC ->SCp.ptr =SG_ADDRESS (CURRENT_SC ->SCp.buffer); -CURRENT_SC ->SCp.this_residual =CURRENT_SC ->SCp.buffer->length; + scsi_pointer->buffer =sg_next (scsi_pointer->buffer); + scsi_pointer->ptr =SG_ADDRESS (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; } the_time=jiffies +100 *HZ ;
@@ -2152,6 +2192,8 @@ static void datao_run(struct Scsi_Host *shpnt)static void datao_end (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); +if (TESTLO (DMASTAT ,DFIFOEMP )) {u32 datao_cnt =GETSTCNT ();int datao_out =DATA_LEN -scsi_get_resid (CURRENT_SC );
@@ -2169,9 +2211,9 @@ static void datao_end(struct Scsi_Host *shpnt) sg =sg_next (sg); } -CURRENT_SC ->SCp.buffer = sg; -CURRENT_SC ->SCp.ptr =SG_ADDRESS (CURRENT_SC ->SCp.buffer) + done; -CURRENT_SC ->SCp.this_residual =CURRENT_SC ->SCp.buffer->length - + scsi_pointer->buffer = sg; + scsi_pointer->ptr =SG_ADDRESS (scsi_pointer->buffer) + done; + scsi_pointer->this_residual = scsi_pointer->buffer->length - done; }
@@ -2187,6 +2229,7 @@ static void datao_end(struct Scsi_Host *shpnt)*/ static int update_state (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC );int dataphase=0 ;unsigned int stat0 =GETPORT (SSTAT0 );unsigned int stat1 =GETPORT (SSTAT1 );
@@ -2200,7 +2243,8 @@ static int update_state(struct Scsi_Host *shpnt)SETPORT (SSTAT1 ,SCSIRSTI ); }else if (stat0 &SELDI &&PREVSTATE == busfree) {STATE =seldi; - }else if (stat0 &SELDO &&CURRENT_SC && (CURRENT_SC ->SCp.phase & selecting)) { + }else if (stat0 &SELDO &&CURRENT_SC && + (scsi_pointer->phase & selecting)) {STATE =seldo; }else if (stat1 &SELTO ) {STATE =selto;
@@ -2332,7 +2376,8 @@ static void is_complete(struct Scsi_Host *shpnt)SETPORT (SXFRCTL0 ,CH1 );SETPORT (DMACNTRL0 ,0 );if (CURRENT_SC ) -CURRENT_SC ->SCp.phase &= ~spiordy; +aha152x_scsi_pointer (CURRENT_SC )->phase &= + ~spiordy; }/*
@@ -2354,7 +2399,8 @@ static void is_complete(struct Scsi_Host *shpnt)SETPORT (DMACNTRL0 ,0 );SETPORT (SXFRCTL0 ,CH1 |SPIOEN );if (CURRENT_SC ) -CURRENT_SC ->SCp.phase |= spiordy; +aha152x_scsi_pointer (CURRENT_SC )->phase |= + spiordy; }/*
@@ -2444,21 +2490,23 @@ static void disp_enintr(struct Scsi_Host *shpnt)*/ static void show_command (struct scsi_cmnd *ptr) { +const int phase =aha152x_scsi_pointer (ptr)->phase; +scsi_print_command (ptr);scmd_printk (KERN_DEBUG , ptr,"request_bufflen=%d; resid=%d; " "phase |%s%s%s%s%s%s%s%s%s; next=0x%p" ,scsi_bufflen (ptr),scsi_get_resid (ptr), - (ptr->SCp.phase & not_issued) ?"not issued|" :"" , - (ptr->SCp.phase & selecting) ?"selecting|" :"" , - (ptr->SCp.phase & identified) ?"identified|" :"" , - (ptr->SCp.phase & disconnected) ?"disconnected|" :"" , - (ptr->SCp.phase & completed) ?"completed|" :"" , - (ptr->SCp.phase & spiordy) ?"spiordy|" :"" , - (ptr->SCp.phase & syncneg) ?"syncneg|" :"" , - (ptr->SCp.phase & aborted) ?"aborted|" :"" , - (ptr->SCp.phase & resetted) ?"resetted|" :"" , - (SCDATA (ptr)) ?SCNEXT (ptr) :NULL ); + phase & not_issued ?"not issued|" :"" , + phase & selecting ?"selecting|" :"" , + phase & identified ?"identified|" :"" , + phase & disconnected ?"disconnected|" :"" , + phase & completed ?"completed|" :"" , + phase & spiordy ?"spiordy|" :"" , + phase & syncneg ?"syncneg|" :"" , + phase & aborted ?"aborted|" :"" , + phase & resetted ?"resetted|" :"" , +SCDATA (ptr) ?SCNEXT (ptr) :NULL ); }/*
@@ -2490,6 +2538,8 @@ static void show_queues(struct Scsi_Host *shpnt)static void get_command (struct seq_file *m,struct scsi_cmnd * ptr) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (ptr); +const int phase = scsi_pointer->phase;int i; seq_printf(m, "%p: target=%d; lun=%d; cmnd=( ",
@@ -2499,24 +2549,24 @@ static void get_command(struct seq_file *m, struct scsi_cmnd * ptr)seq_printf (m,"0x%02x " , ptr->cmnd[i]);seq_printf (m,"); resid=%d; residual=%d; buffers=%d; phase |" , -scsi_get_resid (ptr), ptr->SCp.this_residual, -sg_nents (ptr->SCp.buffer) -1 ); +scsi_get_resid (ptr), scsi_pointer->this_residual, +sg_nents (scsi_pointer->buffer) -1 ); -if (ptr->SCp.phase & not_issued) +if (phase & not_issued)seq_puts (m,"not issued|" ); -if (ptr->SCp.phase & selecting) +if (phase & selecting)seq_puts (m,"selecting|" ); -if (ptr->SCp.phase & disconnected) +if (phase & disconnected)seq_puts (m,"disconnected|" ); -if (ptr->SCp.phase & aborted) +if (phase & aborted)seq_puts (m,"aborted|" ); -if (ptr->SCp.phase & identified) +if (phase & identified)seq_puts (m,"identified|" ); -if (ptr->SCp.phase & completed) +if (phase & completed)seq_puts (m,"completed|" ); -if (ptr->SCp.phase & spiordy) +if (phase & spiordy)seq_puts (m,"spiordy|" ); -if (ptr->SCp.phase & syncneg) +if (phase & syncneg)seq_puts (m,"syncneg|" );seq_printf (m,"; next=0x%p\n" ,SCNEXT (ptr)); }
@@ -2921,6 +2971,7 @@ static struct scsi_host_template aha152x_driver_template = { .sg_tablesize = SG_ALL, .dma_boundary = PAGE_SIZE - 1, .slave_alloc = aha152x_adjust_queue, + .cmd_size = sizeof(struct aha152x_cmd_priv), };#if !defined(AHA152X_PCMCIA )
Re: [PATCH v2 12/44] aha152x: Move the SCSI pointer to private command data
Quoted 10 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/aha152x.c | 259 ++++++++++++++++++++++++----------------- 1 file changed, 155 insertions(+), 104 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 12/44] aha152x: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 642 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/aha152x.c| 259 ++++++++++++++++++++++++-----------------1 file changed, 155 insertions(+), 104 deletions(-)drivers/scsi/aha152x.c +154
-104@@ -316,6 +316,17 @@ enum { check_condition = 0x0800, /* requesting sense after CHECK CONDITION */ }; +struct aha152x_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *aha152x_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct aha152x_cmd_priv *acmd =scsi_cmd_priv (cmd); + +return &acmd->scsi_pointer; +} +MODULE_AUTHOR ("Jürgen Fischer" );MODULE_DESCRIPTION (AHA152X_REVID );MODULE_LICENSE ("GPL" );@@ -879,14 +890,17 @@ void aha152x_release(struct Scsi_Host *shpnt)static int setup_expected_interrupts (struct Scsi_Host *shpnt) {if (CURRENT_SC ) { -CURRENT_SC ->SCp.phase |=1 <<16 ; +struct scsi_pointer *scsi_pointer = +aha152x_scsi_pointer (CURRENT_SC ); -if (CURRENT_SC ->SCp.phase & selecting) { + scsi_pointer->phase |=1 <<16 ; + +if (scsi_pointer->phase & selecting) {SETPORT (SSTAT1 ,SELTO );SETPORT (SIMODE0 ,ENSELDO | (DISCONNECTED_SC ?ENSELDI :0 ));SETPORT (SIMODE1 ,ENSELTIMO ); }else { -SETPORT (SIMODE0 , (CURRENT_SC ->SCp.phase & spiordy) ?ENSPIORDY :0 ); +SETPORT (SIMODE0 , (scsi_pointer->phase & spiordy) ?ENSPIORDY :0 );SETPORT (SIMODE1 ,ENPHASEMIS |ENSCSIRST |ENSCSIPERR |ENBUSFREE ); } }else if (STATE ==seldi) {@@ -910,16 +924,17 @@ static int setup_expected_interrupts(struct Scsi_Host *shpnt)static int aha152x_internal_queue (struct scsi_cmnd *SCpnt,struct completion *complete,int phase) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (SCpnt);struct Scsi_Host *shpnt = SCpnt->device->host;unsigned long flags; - SCpnt->SCp.phase = not_issued | phase; - SCpnt->SCp.Status =0x1 ;/* Ilegal status by SCSI standard */ - SCpnt->SCp.Message =0 ; - SCpnt->SCp.have_data_in =0 ; - SCpnt->SCp.sent_command =0 ; + scsi_pointer->phase = not_issued | phase; + scsi_pointer->Status =0x1 ;/* Ilegal status by SCSI standard */ + scsi_pointer->Message =0 ; + scsi_pointer->have_data_in =0 ; + scsi_pointer->sent_command =0 ; -if (SCpnt->SCp.phase & (resetting|check_condition)) { +if (scsi_pointer->phase & (resetting | check_condition)) {if (!SCpnt->host_scribble ||SCSEM (SCpnt) ||SCNEXT (SCpnt)) {scmd_printk (KERN_ERR , SCpnt,"cannot reuse command\n" );return FAILED ;@@ -942,15 +957,15 @@ static int aha152x_internal_queue(struct scsi_cmnd *SCpnt,SCp.phase : current state of the command */ if ((phase & resetting) || !scsi_sglist (SCpnt)) { - SCpnt->SCp.ptr =NULL ; - SCpnt->SCp.this_residual =0 ; + scsi_pointer->ptr =NULL ; + scsi_pointer->this_residual =0 ;scsi_set_resid (SCpnt,0 ); - SCpnt->SCp.buffer =NULL ; + scsi_pointer->buffer =NULL ; }else {scsi_set_resid (SCpnt,scsi_bufflen (SCpnt)); - SCpnt->SCp.buffer =scsi_sglist (SCpnt); - SCpnt->SCp.ptr =SG_ADDRESS (SCpnt->SCp.buffer); - SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; + scsi_pointer->buffer =scsi_sglist (SCpnt); + scsi_pointer->ptr =SG_ADDRESS (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; }DO_LOCK (flags);@@ -1000,7 +1015,7 @@ static void reset_done(struct scsi_cmnd *SCpnt)static void aha152x_scsi_done (struct scsi_cmnd *SCpnt) { -if (SCpnt->SCp.phase & resetting) +if (aha152x_scsi_pointer (SCpnt)->phase & resetting)reset_done (SCpnt);else scsi_done (SCpnt);@@ -1086,7 +1101,7 @@ static int aha152x_device_reset(struct scsi_cmnd * SCpnt)DO_LOCK (flags); -if (SCpnt->SCp.phase & resetted) { +if (aha152x_scsi_pointer (SCpnt)->phase & resetted) {HOSTDATA (shpnt)->commands--;if (!HOSTDATA (shpnt)->commands)SETPORT (PORTA ,0 );@@ -1380,28 +1395,31 @@ static void busfree_run(struct Scsi_Host *shpnt)SETPORT (SSTAT1 ,CLRBUSFREE );if (CURRENT_SC ) { +struct scsi_pointer *scsi_pointer = +aha152x_scsi_pointer (CURRENT_SC ); +#if defined(AHA152X_STAT ) action++;#endif -CURRENT_SC ->SCp.phase &= ~syncneg; + scsi_pointer->phase &= ~syncneg; -if (CURRENT_SC ->SCp.phase & completed) { +if (scsi_pointer->phase & completed) {/* target sent COMMAND COMPLETE */ -done (shpnt,CURRENT_SC ->SCp.Status,DID_OK ); +done (shpnt, scsi_pointer->Status,DID_OK ); - }else if (CURRENT_SC ->SCp.phase & aborted) { -done (shpnt,CURRENT_SC ->SCp.Status,DID_ABORT ); + }else if (scsi_pointer->phase & aborted) { +done (shpnt, scsi_pointer->Status,DID_ABORT ); - }else if (CURRENT_SC ->SCp.phase & resetted) { -done (shpnt,CURRENT_SC ->SCp.Status,DID_RESET ); + }else if (scsi_pointer->phase & resetted) { +done (shpnt, scsi_pointer->Status,DID_RESET ); - }else if (CURRENT_SC ->SCp.phase & disconnected) { + }else if (scsi_pointer->phase & disconnected) {/* target sent DISCONNECT */ #if defined(AHA152X_STAT )HOSTDATA (shpnt)->disconnections++;#endif append_SC (&DISCONNECTED_SC ,CURRENT_SC ); -CURRENT_SC ->SCp.phase |=1 <<16 ; + scsi_pointer->phase |=1 <<16 ;CURRENT_SC =NULL ; }else {@@ -1420,23 +1438,24 @@ static void busfree_run(struct Scsi_Host *shpnt) action++;#endif -if (DONE_SC ->SCp.phase & check_condition) { +if (aha152x_scsi_pointer (DONE_SC )->phase & check_condition) {struct scsi_cmnd *cmd =HOSTDATA (shpnt)->done_SC;struct aha152x_scdata *sc =SCDATA (cmd);scsi_eh_restore_cmnd (cmd, &sc->ses); - cmd->SCp.Status =SAM_STAT_CHECK_CONDITION ; +aha152x_scsi_pointer (cmd)->Status =SAM_STAT_CHECK_CONDITION ;HOSTDATA (shpnt)->commands--;if (!HOSTDATA (shpnt)->commands)SETPORT (PORTA ,0 );/* turn led off */ - }else if (DONE_SC ->SCp.Status==SAM_STAT_CHECK_CONDITION ) { + }else if (aha152x_scsi_pointer (DONE_SC )->Status == +SAM_STAT_CHECK_CONDITION ) {#if defined(AHA152X_STAT )HOSTDATA (shpnt)->busfree_with_check_condition++;#endif -if (!(DONE_SC ->SCp.phase & not_issued)) { +if (!(aha152x_scsi_pointer (DONE_SC )->phase & not_issued)) {struct aha152x_scdata *sc;struct scsi_cmnd *ptr =DONE_SC ;DONE_SC =NULL ;@@ -1461,7 +1480,7 @@ static void busfree_run(struct Scsi_Host *shpnt)if (!HOSTDATA (shpnt)->commands)SETPORT (PORTA ,0 );/* turn led off */ -if (!(ptr->SCp.phase & resetting)) { +if (!(aha152x_scsi_pointer (ptr)->phase & resetting)) {kfree (ptr->host_scribble); ptr->host_scribble=NULL ; }@@ -1484,10 +1503,13 @@ static void busfree_run(struct Scsi_Host *shpnt)DO_UNLOCK (flags);if (CURRENT_SC ) { +struct scsi_pointer *scsi_pointer = +aha152x_scsi_pointer (CURRENT_SC ); +#if defined(AHA152X_STAT ) action++;#endif -CURRENT_SC ->SCp.phase |= selecting; + scsi_pointer->phase |= selecting;/* clear selection timeout */ SETPORT (SSTAT1 ,SELTO );@@ -1515,11 +1537,13 @@ static void busfree_run(struct Scsi_Host *shpnt)*/ static void seldo_run (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); +SETPORT (SCSISIG ,0 );SETPORT (SSTAT1 ,CLRBUSFREE );SETPORT (SSTAT1 ,CLRPHASECHG ); -CURRENT_SC ->SCp.phase &= ~(selecting|not_issued); + scsi_pointer->phase &= ~(selecting | not_issued);SETPORT (SCSISEQ ,0 );@@ -1534,12 +1558,12 @@ static void seldo_run(struct Scsi_Host *shpnt)ADDMSGO (IDENTIFY (RECONNECT ,CURRENT_SC ->device->lun)); -if (CURRENT_SC ->SCp.phase & aborting) { +if (scsi_pointer->phase & aborting) {ADDMSGO (ABORT ); - }else if (CURRENT_SC ->SCp.phase & resetting) { + }else if (scsi_pointer->phase & resetting) {ADDMSGO (BUS_DEVICE_RESET ); }else if (SYNCNEG ==0 &&SYNCHRONOUS ) { -CURRENT_SC ->SCp.phase |= syncneg; + scsi_pointer->phase |= syncneg;MSGOLEN +=spi_populate_sync_msg (&MSGO (MSGOLEN ),50 ,8 );SYNCNEG =1 ;/* negotiation in progress */ }@@ -1554,15 +1578,17 @@ static void seldo_run(struct Scsi_Host *shpnt)*/ static void selto_run (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); +SETPORT (SCSISEQ ,0 );SETPORT (SSTAT1 ,CLRSELTIMO );if (!CURRENT_SC )return ; -CURRENT_SC ->SCp.phase &= ~selecting; + scsi_pointer->phase &= ~selecting; -if (CURRENT_SC ->SCp.phase & aborted) +if (scsi_pointer->phase & aborted)done (shpnt,SAM_STAT_GOOD ,DID_ABORT );else if (TESTLO (SSTAT0 ,SELINGO ))done (shpnt,SAM_STAT_GOOD ,DID_BUS_BUSY );@@ -1590,7 +1616,10 @@ static void seldi_run(struct Scsi_Host *shpnt)SETPORT (SSTAT1 ,CLRPHASECHG );if (CURRENT_SC ) { -if (!(CURRENT_SC ->SCp.phase & not_issued)) +struct scsi_pointer *scsi_pointer = +aha152x_scsi_pointer (CURRENT_SC ); + +if (!(scsi_pointer->phase & not_issued))scmd_printk (KERN_ERR ,CURRENT_SC ,"command should not have been issued yet\n" );@@ -1647,6 +1676,7 @@ static void seldi_run(struct Scsi_Host *shpnt)static void msgi_run (struct Scsi_Host *shpnt) {for (;;) { +struct scsi_pointer *scsi_pointer;int sstat1 =GETPORT (SSTAT1 );if (sstat1 & (PHASECHG |PHASEMIS |BUSFREE ) || !(sstat1 &REQINIT ))@@ -1684,8 +1714,9 @@ static void msgi_run(struct Scsi_Host *shpnt)continue ; } -CURRENT_SC ->SCp.Message =MSGI (0 ); -CURRENT_SC ->SCp.phase &= ~disconnected; + scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); + scsi_pointer->Message =MSGI (0 ); + scsi_pointer->phase &= ~disconnected;MSGILEN =0 ;@@ -1693,7 +1724,8 @@ static void msgi_run(struct Scsi_Host *shpnt)continue ; } -CURRENT_SC ->SCp.Message =MSGI (0 ); + scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); + scsi_pointer->Message =MSGI (0 );switch (MSGI (0 )) {case DISCONNECT :@@ -1701,11 +1733,11 @@ static void msgi_run(struct Scsi_Host *shpnt)scmd_printk (KERN_WARNING ,CURRENT_SC ,"target was not allowed to disconnect\n" ); -CURRENT_SC ->SCp.phase |= disconnected; + scsi_pointer->phase |= disconnected;break ;case COMMAND_COMPLETE : -CURRENT_SC ->SCp.phase |= completed; + scsi_pointer->phase |= completed;break ;case MESSAGE_REJECT :@@ -1835,8 +1867,11 @@ static void msgi_end(struct Scsi_Host *shpnt)*/ static void msgo_init (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); +if (MSGOLEN ==0 ) { -if ((CURRENT_SC ->SCp.phase & syncneg) &&SYNCNEG ==2 &&SYNCRATE ==0 ) { +if ((scsi_pointer->phase & syncneg) &&SYNCNEG ==2 && +SYNCRATE ==0 ) {ADDMSGO (IDENTIFY (RECONNECT ,CURRENT_SC ->device->lun)); }else { scmd_printk(KERN_INFO, CURRENT_SC,@@ -1853,6 +1888,8 @@ static void msgo_init(struct Scsi_Host *shpnt)*/ static void msgo_run (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); +while (MSGO_I <MSGOLEN ) {if (TESTLO (SSTAT0 ,SPIORDY ))return ;@@ -1864,13 +1901,13 @@ static void msgo_run(struct Scsi_Host *shpnt)if (MSGO (MSGO_I ) &IDENTIFY_BASE ) -CURRENT_SC ->SCp.phase |= identified; + scsi_pointer->phase |= identified;if (MSGO (MSGO_I )==ABORT ) -CURRENT_SC ->SCp.phase |= aborted; + scsi_pointer->phase |= aborted;if (MSGO (MSGO_I )==BUS_DEVICE_RESET ) -CURRENT_SC ->SCp.phase |= resetted; + scsi_pointer->phase |= resetted;SETPORT (SCSIDAT ,MSGO (MSGO_I ++)); }@@ -1899,7 +1936,7 @@ static void msgo_end(struct Scsi_Host *shpnt)*/ static void cmd_init (struct Scsi_Host *shpnt) { -if (CURRENT_SC ->SCp.sent_command) { +if (aha152x_scsi_pointer (CURRENT_SC )->sent_command) {scmd_printk (KERN_ERR ,CURRENT_SC ,"command already sent\n" );done (shpnt,SAM_STAT_GOOD ,DID_ERROR );@@ -1930,7 +1967,7 @@ static void cmd_end(struct Scsi_Host *shpnt)"command sent incompletely (%d/%d)\n" , CMD_I, CURRENT_SC->cmd_len); else - CURRENT_SC->SCp.sent_command++; + aha152x_scsi_pointer(CURRENT_SC)->sent_command++; }/* @@ -1942,7 +1979,7 @@ static void status_run(struct Scsi_Host *shpnt)if (TESTLO (SSTAT0 ,SPIORDY ))return ; -CURRENT_SC ->SCp.Status =GETPORT (SCSIDAT ); +aha152x_scsi_pointer (CURRENT_SC )->Status =GETPORT (SCSIDAT ); }@@ -1966,6 +2003,7 @@ static void datai_init(struct Scsi_Host *shpnt)static void datai_run (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer;unsigned long the_time;int fifodata, data_count;@@ -2003,35 +2041,36 @@ static void datai_run(struct Scsi_Host *shpnt) fifodata =GETPORT (FIFOSTAT ); } -if (CURRENT_SC ->SCp.this_residual>0 ) { -while (fifodata>0 &&CURRENT_SC ->SCp.this_residual>0 ) { - data_count = fifodata >CURRENT_SC ->SCp.this_residual ? -CURRENT_SC ->SCp.this_residual : + scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); +if (scsi_pointer->this_residual >0 ) { +while (fifodata >0 && scsi_pointer->this_residual >0 ) { + data_count = fifodata > scsi_pointer->this_residual ? + scsi_pointer->this_residual : fifodata; fifodata -= data_count;if (data_count &1 ) {SETPORT (DMACNTRL0 ,ENDMA |_8BIT); - *CURRENT_SC ->SCp.ptr++ =GETPORT (DATAPORT ); -CURRENT_SC ->SCp.this_residual--; + *scsi_pointer->ptr++ =GETPORT (DATAPORT ); + scsi_pointer->this_residual--;DATA_LEN ++;SETPORT (DMACNTRL0 ,ENDMA ); }if (data_count >1 ) { data_count >>=1 ; -insw (DATAPORT ,CURRENT_SC ->SCp.ptr, data_count); -CURRENT_SC ->SCp.ptr +=2 * data_count; -CURRENT_SC ->SCp.this_residual -=2 * data_count; +insw (DATAPORT , scsi_pointer->ptr, data_count); + scsi_pointer->ptr +=2 * data_count; + scsi_pointer->this_residual -=2 * data_count;DATA_LEN +=2 * data_count; } -if (CURRENT_SC ->SCp.this_residual ==0 && - !sg_is_last (CURRENT_SC ->SCp.buffer)) { +if (scsi_pointer->this_residual ==0 && + !sg_is_last (scsi_pointer->buffer)) {/* advance to next buffer */ -CURRENT_SC ->SCp.buffer =sg_next (CURRENT_SC ->SCp.buffer); -CURRENT_SC ->SCp.ptr =SG_ADDRESS (CURRENT_SC ->SCp.buffer); -CURRENT_SC ->SCp.this_residual =CURRENT_SC ->SCp.buffer->length; + scsi_pointer->buffer =sg_next (scsi_pointer->buffer); + scsi_pointer->ptr =SG_ADDRESS (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; } } }else if (fifodata >0 ) {@@ -2099,14 +2138,15 @@ static void datao_init(struct Scsi_Host *shpnt)static void datao_run (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC );unsigned long the_time;int data_count;/* until phase changes or all data sent */ -while (TESTLO (DMASTAT ,INTSTAT ) &&CURRENT_SC ->SCp.this_residual>0 ) { +while (TESTLO (DMASTAT ,INTSTAT ) && scsi_pointer->this_residual >0 ) { data_count =128 ; -if (data_count >CURRENT_SC ->SCp.this_residual) - data_count=CURRENT_SC ->SCp.this_residual; +if (data_count > scsi_pointer->this_residual) + data_count = scsi_pointer->this_residual;if (TESTLO (DMASTAT ,DFIFOEMP )) { scmd_printk(KERN_ERR, CURRENT_SC,@@ -2117,26 +2157,26 @@ static void datao_run(struct Scsi_Host *shpnt)if (data_count &1 ) {SETPORT (DMACNTRL0 ,WRITE_READ |ENDMA |_8BIT); -SETPORT (DATAPORT , *CURRENT_SC ->SCp.ptr++); -CURRENT_SC ->SCp.this_residual--; +SETPORT (DATAPORT , *scsi_pointer->ptr++); + scsi_pointer->this_residual--;CMD_INC_RESID (CURRENT_SC ,-1 );SETPORT (DMACNTRL0 ,WRITE_READ |ENDMA ); }if (data_count >1 ) { data_count >>=1 ; -outsw (DATAPORT ,CURRENT_SC ->SCp.ptr, data_count); -CURRENT_SC ->SCp.ptr +=2 * data_count; -CURRENT_SC ->SCp.this_residual -=2 * data_count; +outsw (DATAPORT , scsi_pointer->ptr, data_count); + scsi_pointer->ptr +=2 * data_count; + scsi_pointer->this_residual -=2 * data_count;CMD_INC_RESID (CURRENT_SC ,-2 * data_count); } -if (CURRENT_SC ->SCp.this_residual ==0 && - !sg_is_last (CURRENT_SC ->SCp.buffer)) { +if (scsi_pointer->this_residual ==0 && + !sg_is_last (scsi_pointer->buffer)) {/* advance to next buffer */ -CURRENT_SC ->SCp.buffer =sg_next (CURRENT_SC ->SCp.buffer); -CURRENT_SC ->SCp.ptr =SG_ADDRESS (CURRENT_SC ->SCp.buffer); -CURRENT_SC ->SCp.this_residual =CURRENT_SC ->SCp.buffer->length; + scsi_pointer->buffer =sg_next (scsi_pointer->buffer); + scsi_pointer->ptr =SG_ADDRESS (scsi_pointer->buffer); + scsi_pointer->this_residual = scsi_pointer->buffer->length; } the_time=jiffies +100 *HZ ;@@ -2152,6 +2192,8 @@ static void datao_run(struct Scsi_Host *shpnt)static void datao_end (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC ); +if (TESTLO (DMASTAT ,DFIFOEMP )) {u32 datao_cnt =GETSTCNT ();int datao_out =DATA_LEN -scsi_get_resid (CURRENT_SC );@@ -2169,9 +2211,9 @@ static void datao_end(struct Scsi_Host *shpnt) sg =sg_next (sg); } -CURRENT_SC ->SCp.buffer = sg; -CURRENT_SC ->SCp.ptr =SG_ADDRESS (CURRENT_SC ->SCp.buffer) + done; -CURRENT_SC ->SCp.this_residual =CURRENT_SC ->SCp.buffer->length - + scsi_pointer->buffer = sg; + scsi_pointer->ptr =SG_ADDRESS (scsi_pointer->buffer) + done; + scsi_pointer->this_residual = scsi_pointer->buffer->length - done; }@@ -2187,6 +2229,7 @@ static void datao_end(struct Scsi_Host *shpnt)*/ static int update_state (struct Scsi_Host *shpnt) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (CURRENT_SC );int dataphase=0 ;unsigned int stat0 =GETPORT (SSTAT0 );unsigned int stat1 =GETPORT (SSTAT1 );@@ -2200,7 +2243,8 @@ static int update_state(struct Scsi_Host *shpnt)SETPORT (SSTAT1 ,SCSIRSTI ); }else if (stat0 &SELDI &&PREVSTATE == busfree) {STATE =seldi; - }else if (stat0 &SELDO &&CURRENT_SC && (CURRENT_SC ->SCp.phase & selecting)) { + }else if (stat0 &SELDO &&CURRENT_SC && + (scsi_pointer->phase & selecting)) {STATE =seldo; }else if (stat1 &SELTO ) {STATE =selto;@@ -2332,7 +2376,8 @@ static void is_complete(struct Scsi_Host *shpnt)SETPORT (SXFRCTL0 ,CH1 );SETPORT (DMACNTRL0 ,0 );if (CURRENT_SC ) -CURRENT_SC ->SCp.phase &= ~spiordy; +aha152x_scsi_pointer (CURRENT_SC )->phase &= + ~spiordy; }/* @@ -2354,7 +2399,8 @@ static void is_complete(struct Scsi_Host *shpnt)SETPORT (DMACNTRL0 ,0 );SETPORT (SXFRCTL0 ,CH1 |SPIOEN );if (CURRENT_SC ) -CURRENT_SC ->SCp.phase |= spiordy; +aha152x_scsi_pointer (CURRENT_SC )->phase |= + spiordy; }/* @@ -2444,21 +2490,23 @@ static void disp_enintr(struct Scsi_Host *shpnt)*/ static void show_command (struct scsi_cmnd *ptr) { +const int phase =aha152x_scsi_pointer (ptr)->phase; +scsi_print_command (ptr);scmd_printk (KERN_DEBUG , ptr,"request_bufflen=%d; resid=%d; " "phase |%s%s%s%s%s%s%s%s%s; next=0x%p" ,scsi_bufflen (ptr),scsi_get_resid (ptr), - (ptr->SCp.phase & not_issued) ?"not issued|" :"" , - (ptr->SCp.phase & selecting) ?"selecting|" :"" , - (ptr->SCp.phase & identified) ?"identified|" :"" , - (ptr->SCp.phase & disconnected) ?"disconnected|" :"" , - (ptr->SCp.phase & completed) ?"completed|" :"" , - (ptr->SCp.phase & spiordy) ?"spiordy|" :"" , - (ptr->SCp.phase & syncneg) ?"syncneg|" :"" , - (ptr->SCp.phase & aborted) ?"aborted|" :"" , - (ptr->SCp.phase & resetted) ?"resetted|" :"" , - (SCDATA (ptr)) ?SCNEXT (ptr) :NULL ); + phase & not_issued ?"not issued|" :"" , + phase & selecting ?"selecting|" :"" , + phase & identified ?"identified|" :"" , + phase & disconnected ?"disconnected|" :"" , + phase & completed ?"completed|" :"" , + phase & spiordy ?"spiordy|" :"" , + phase & syncneg ?"syncneg|" :"" , + phase & aborted ?"aborted|" :"" , + phase & resetted ?"resetted|" :"" , +SCDATA (ptr) ?SCNEXT (ptr) :NULL ); }/* @@ -2490,6 +2538,8 @@ static void show_queues(struct Scsi_Host *shpnt)static void get_command (struct seq_file *m,struct scsi_cmnd * ptr) { +struct scsi_pointer *scsi_pointer =aha152x_scsi_pointer (ptr); +const int phase = scsi_pointer->phase;int i; seq_printf(m, "%p: target=%d; lun=%d; cmnd=( ",@@ -2499,24 +2549,24 @@ static void get_command(struct seq_file *m, struct scsi_cmnd * ptr)seq_printf (m,"0x%02x " , ptr->cmnd[i]);seq_printf (m,"); resid=%d; residual=%d; buffers=%d; phase |" , -scsi_get_resid (ptr), ptr->SCp.this_residual, -sg_nents (ptr->SCp.buffer) -1 ); +scsi_get_resid (ptr), scsi_pointer->this_residual, +sg_nents (scsi_pointer->buffer) -1 ); -if (ptr->SCp.phase & not_issued) +if (phase & not_issued)seq_puts (m,"not issued|" ); -if (ptr->SCp.phase & selecting) +if (phase & selecting)seq_puts (m,"selecting|" ); -if (ptr->SCp.phase & disconnected) +if (phase & disconnected)seq_puts (m,"disconnected|" ); -if (ptr->SCp.phase & aborted) +if (phase & aborted)seq_puts (m,"aborted|" ); -if (ptr->SCp.phase & identified) +if (phase & identified)seq_puts (m,"identified|" ); -if (ptr->SCp.phase & completed) +if (phase & completed)seq_puts (m,"completed|" ); -if (ptr->SCp.phase & spiordy) +if (phase & spiordy)seq_puts (m,"spiordy|" ); -if (ptr->SCp.phase & syncneg) +if (phase & syncneg)seq_puts (m,"syncneg|" );seq_printf (m,"; next=0x%p\n" ,SCNEXT (ptr)); }
drivers/scsi/aha152x.c static struct scsi_host_template aha152x_driver_template = { · line 2977
Quoted 7 lines
drivers/scsi/aha152x.c +1
-0@@ -2921,6 +2971,7 @@ static struct scsi_host_template aha152x_driver_template = { .sg_tablesize = SG_ALL, .dma_boundary = PAGE_SIZE - 1, .slave_alloc = aha152x_adjust_queue, + .cmd_size = sizeof(struct aha152x_cmd_priv), };#if !defined(AHA152X_PCMCIA )
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 13/44 bfa: Stop using the SCSI pointer
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/bfa/bfad_im.c | 27 ++++++++++++++------------- drivers/scsi/bfa/bfad_im.h | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 13 deletions(-)
drivers/scsi/bfa/bfad_im.c +14 -13
@@ -150,10 +150,10 @@ bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk,struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dtsk;wait_queue_head_t *wq; - cmnd->SCp.Status |= tsk_status <<1 ; -set_bit (IO_DONE_BIT , (unsigned long *)&cmnd->SCp.Status); - wq = (wait_queue_head_t *) cmnd->SCp.ptr; - cmnd->SCp.ptr =NULL ; +bfad_priv (cmnd)->status |= tsk_status <<1 ; +set_bit (IO_DONE_BIT , &bfad_priv (cmnd)->status); + wq =bfad_priv (cmnd)->wq; +bfad_priv (cmnd)->wq =NULL ;if (wq)wake_up (wq);
@@ -259,7 +259,7 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd,* happens. */ cmnd->host_scribble =NULL ; - cmnd->SCp.Status =0 ; +bfad_priv (cmnd)->status =0 ; bfa_itnim =bfa_fcs_itnim_get_halitn (&itnim->fcs_itnim);/* * bfa_itnim can be NULL if the port gets disconnected and the bfa
@@ -326,8 +326,8 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)* if happens. */ cmnd->host_scribble =NULL ; - cmnd->SCp.ptr = (char *)&wq; - cmnd->SCp.Status =0 ; +bfad_priv (cmnd)->wq = &wq; +bfad_priv (cmnd)->status =0 ; bfa_itnim =bfa_fcs_itnim_get_halitn (&itnim->fcs_itnim);/* * bfa_itnim can be NULL if the port gets disconnected and the bfa
@@ -347,10 +347,9 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) FCP_TM_LUN_RESET, BFAD_LUN_RESET_TMO);spin_unlock_irqrestore (&bfad->bfad_lock, flags); -wait_event (wq,test_bit (IO_DONE_BIT , - (unsigned long *)&cmnd->SCp.Status)); +wait_event (wq,test_bit (IO_DONE_BIT , &bfad_priv (cmnd)->status)); - task_status = cmnd->SCp.Status >>1 ; + task_status =bfad_priv (cmnd)->status >>1 ;if (task_status !=BFI_TSKIM_STS_OK ) {BFA_LOG (KERN_ERR , bfad, bfa_log_level,"LUN reset failure, status: %d\n" , task_status);
@@ -381,16 +380,16 @@ bfad_im_reset_target_handler(struct scsi_cmnd *cmnd)spin_lock_irqsave (&bfad->bfad_lock, flags); itnim =bfad_get_itnim (im_port, starget->id);if (itnim) { - cmnd->SCp.ptr = (char *)&wq; +bfad_priv (cmnd)->wq = &wq; rc =bfad_im_target_reset_send (bfad, cmnd, itnim);if (rc ==BFA_STATUS_OK ) {/* wait target reset to complete */ spin_unlock_irqrestore (&bfad->bfad_lock, flags);wait_event (wq,test_bit (IO_DONE_BIT , - (unsigned long *)&cmnd->SCp.Status)); + &bfad_priv (cmnd)->status));spin_lock_irqsave (&bfad->bfad_lock, flags); - task_status = cmnd->SCp.Status >>1 ; + task_status =bfad_priv (cmnd)->status >>1 ;if (task_status !=BFI_TSKIM_STS_OK )BFA_LOG (KERN_ERR , bfad, bfa_log_level, "target reset failure,"
@@ -797,6 +796,7 @@ struct scsi_host_template bfad_im_scsi_host_template = { .name = BFAD_DRIVER_NAME, .info = bfad_im_info, .queuecommand = bfad_im_queuecommand, + .cmd_size = sizeof(struct bfad_cmd_priv), .eh_timed_out = fc_eh_timed_out, .eh_abort_handler = bfad_im_abort_handler, .eh_device_reset_handler = bfad_im_reset_lun_handler,
@@ -819,6 +819,7 @@ struct scsi_host_template bfad_im_vport_template = { .name = BFAD_DRIVER_NAME, .info = bfad_im_info, .queuecommand = bfad_im_queuecommand, + .cmd_size = sizeof(struct bfad_cmd_priv), .eh_timed_out = fc_eh_timed_out, .eh_abort_handler = bfad_im_abort_handler, .eh_device_reset_handler = bfad_im_reset_lun_handler,
drivers/scsi/bfa/bfad_im.h +16 -0
@@ -43,6 +43,22 @@ u32 bfad_im_supported_speeds(struct bfa_s *bfa);*/ #define IO_DONE_BIT 0 +/** +* struct bfad_cmd_priv - private data per SCSI command. +* @status: Lowest bit represents IO_DONE. The next seven bits hold a value of +* type enum bfi_tskim_status. +* @wq: Wait queue used to wait for completion of an operation. +*/ +struct bfad_cmd_priv { +unsigned long status; +wait_queue_head_t *wq; +}; + +static inline struct bfad_cmd_priv *bfad_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +struct bfad_itnim_data_s {struct bfad_itnim_s *itnim; };
Hannes Reinecke
maintainerRe: [PATCH v2 13/44] bfa: Stop using the SCSI pointer
Quoted 115 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/bfa/bfad_im.c | 27 ++++++++++++++------------- drivers/scsi/bfa/bfad_im.h | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 13 deletions(-)drivers/scsi/bfa/bfad_im.c +14
-13@@ -150,10 +150,10 @@ bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk,struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dtsk;wait_queue_head_t *wq; - cmnd->SCp.Status |= tsk_status <<1 ; -set_bit (IO_DONE_BIT , (unsigned long *)&cmnd->SCp.Status); - wq = (wait_queue_head_t *) cmnd->SCp.ptr; - cmnd->SCp.ptr =NULL ; +bfad_priv (cmnd)->status |= tsk_status <<1 ; +set_bit (IO_DONE_BIT , &bfad_priv (cmnd)->status); + wq =bfad_priv (cmnd)->wq; +bfad_priv (cmnd)->wq =NULL ;if (wq)wake_up (wq);@@ -259,7 +259,7 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd,* happens. */ cmnd->host_scribble =NULL ; - cmnd->SCp.Status =0 ; +bfad_priv (cmnd)->status =0 ; bfa_itnim =bfa_fcs_itnim_get_halitn (&itnim->fcs_itnim);/* * bfa_itnim can be NULL if the port gets disconnected and the bfa @@ -326,8 +326,8 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)* if happens. */ cmnd->host_scribble =NULL ; - cmnd->SCp.ptr = (char *)&wq; - cmnd->SCp.Status =0 ; +bfad_priv (cmnd)->wq = &wq; +bfad_priv (cmnd)->status =0 ; bfa_itnim =bfa_fcs_itnim_get_halitn (&itnim->fcs_itnim);/* * bfa_itnim can be NULL if the port gets disconnected and the bfa @@ -347,10 +347,9 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) FCP_TM_LUN_RESET, BFAD_LUN_RESET_TMO);spin_unlock_irqrestore (&bfad->bfad_lock, flags); -wait_event (wq,test_bit (IO_DONE_BIT , - (unsigned long *)&cmnd->SCp.Status)); +wait_event (wq,test_bit (IO_DONE_BIT , &bfad_priv (cmnd)->status)); - task_status = cmnd->SCp.Status >>1 ; + task_status =bfad_priv (cmnd)->status >>1 ;if (task_status !=BFI_TSKIM_STS_OK ) {BFA_LOG (KERN_ERR , bfad, bfa_log_level,"LUN reset failure, status: %d\n" , task_status);@@ -381,16 +380,16 @@ bfad_im_reset_target_handler(struct scsi_cmnd *cmnd)spin_lock_irqsave (&bfad->bfad_lock, flags); itnim =bfad_get_itnim (im_port, starget->id);if (itnim) { - cmnd->SCp.ptr = (char *)&wq; +bfad_priv (cmnd)->wq = &wq; rc =bfad_im_target_reset_send (bfad, cmnd, itnim);if (rc ==BFA_STATUS_OK ) {/* wait target reset to complete */ spin_unlock_irqrestore (&bfad->bfad_lock, flags);wait_event (wq,test_bit (IO_DONE_BIT , - (unsigned long *)&cmnd->SCp.Status)); + &bfad_priv (cmnd)->status));spin_lock_irqsave (&bfad->bfad_lock, flags); - task_status = cmnd->SCp.Status >>1 ; + task_status =bfad_priv (cmnd)->status >>1 ;if (task_status !=BFI_TSKIM_STS_OK )BFA_LOG (KERN_ERR , bfad, bfa_log_level, "target reset failure,"@@ -797,6 +796,7 @@ struct scsi_host_template bfad_im_scsi_host_template = { .name = BFAD_DRIVER_NAME, .info = bfad_im_info, .queuecommand = bfad_im_queuecommand, + .cmd_size = sizeof(struct bfad_cmd_priv), .eh_timed_out = fc_eh_timed_out, .eh_abort_handler = bfad_im_abort_handler, .eh_device_reset_handler = bfad_im_reset_lun_handler,@@ -819,6 +819,7 @@ struct scsi_host_template bfad_im_vport_template = { .name = BFAD_DRIVER_NAME, .info = bfad_im_info, .queuecommand = bfad_im_queuecommand, + .cmd_size = sizeof(struct bfad_cmd_priv), .eh_timed_out = fc_eh_timed_out, .eh_abort_handler = bfad_im_abort_handler, .eh_device_reset_handler = bfad_im_reset_lun_handler,drivers/scsi/bfa/bfad_im.h +9
-0@@ -43,6 +43,22 @@ u32 bfad_im_supported_speeds(struct bfa_s *bfa);*/ #define IO_DONE_BIT 0 +/** +* struct bfad_cmd_priv - private data per SCSI command. +* @status: Lowest bit represents IO_DONE. The next seven bits hold a value of +* type enum bfi_tskim_status. +* @wq: Wait queue used to wait for completion of an operation. +*/ +struct bfad_cmd_priv { +unsigned long status; +wait_queue_head_t *wq;
drivers/scsi/bfa/bfad_im.h u32 bfad_im_supported_speeds(struct bfa_s *bfa); · line 64
Quoted 10 lines
drivers/scsi/bfa/bfad_im.h +7
-0+}; + +static inline struct bfad_cmd_priv *bfad_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +struct bfad_itnim_data_s {struct bfad_itnim_s *itnim; };
When moving SCSI pointer usage into the command payload, have you considered dropping the use of the 'host_scribble' pointer, too? As we already allocated a command payload it should be easy to increase it by another pointer, and move the 'host_scribble' stuff in there. Hmm?
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 13/44] bfa: Stop using the SCSI pointer
Quoted 3 lines · Hannes Reinecke
When moving SCSI pointer usage into the command payload, have you considered dropping the use of the '
host_scribble' pointer, too? As we already allocated a command payload it should be easy to increase it by another pointer, and move the 'host_scribble' stuff in there. Hmm?
I agree that the 'host_scribble' pointer is no longer essential since the introduction of the .cmd_size field in the host template and also that the host_scribble pointer can be moved into private command data. I have not done that in this patch series because I think this patch series is already bigger than it should.
Thanks,
Bart.
Re: [PATCH v2 13/44] bfa: Stop using the SCSI pointer
Quoted 7 lines · Bart Van Assche
Quoted 3 lines · Hannes Reinecke
When moving SCSI pointer usage into the command payload, have you considered dropping the use of the '
host_scribble' pointer, too? As we already allocated a command payload it should be easy to increase it by another pointer, and move the 'host_scribble' stuff in there. Hmm?I agree that the '
host_scribble' pointer is no longer essential since the introduction of the .cmd_size field in the host template and also that thehost_scribblepointer can be moved into private command data. I have not done that in this patch series because I think this patch series is already bigger than it should.
Yeah, all right.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 13/44] bfa: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 119 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/bfa/bfad_im.c| 27 ++++++++++++++-------------drivers/scsi/bfa/bfad_im.h| 16 ++++++++++++++++2 files changed, 30 insertions(+), 13 deletions(-)drivers/scsi/bfa/bfad_im.c +14
-13@@ -150,10 +150,10 @@ bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk,struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dtsk;wait_queue_head_t *wq; - cmnd->SCp.Status |= tsk_status <<1 ; -set_bit (IO_DONE_BIT , (unsigned long *)&cmnd->SCp.Status); - wq = (wait_queue_head_t *) cmnd->SCp.ptr; - cmnd->SCp.ptr =NULL ; +bfad_priv (cmnd)->status |= tsk_status <<1 ; +set_bit (IO_DONE_BIT , &bfad_priv (cmnd)->status); + wq =bfad_priv (cmnd)->wq; +bfad_priv (cmnd)->wq =NULL ;if (wq)wake_up (wq);@@ -259,7 +259,7 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd,* happens. */ cmnd->host_scribble =NULL ; - cmnd->SCp.Status =0 ; +bfad_priv (cmnd)->status =0 ; bfa_itnim =bfa_fcs_itnim_get_halitn (&itnim->fcs_itnim);/* * bfa_itnim can be NULL if the port gets disconnected and the bfa @@ -326,8 +326,8 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd)* if happens. */ cmnd->host_scribble =NULL ; - cmnd->SCp.ptr = (char *)&wq; - cmnd->SCp.Status =0 ; +bfad_priv (cmnd)->wq = &wq; +bfad_priv (cmnd)->status =0 ; bfa_itnim =bfa_fcs_itnim_get_halitn (&itnim->fcs_itnim);/* * bfa_itnim can be NULL if the port gets disconnected and the bfa @@ -347,10 +347,9 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) FCP_TM_LUN_RESET, BFAD_LUN_RESET_TMO);spin_unlock_irqrestore (&bfad->bfad_lock, flags); -wait_event (wq,test_bit (IO_DONE_BIT , - (unsigned long *)&cmnd->SCp.Status)); +wait_event (wq,test_bit (IO_DONE_BIT , &bfad_priv (cmnd)->status)); - task_status = cmnd->SCp.Status >>1 ; + task_status =bfad_priv (cmnd)->status >>1 ;if (task_status !=BFI_TSKIM_STS_OK ) {BFA_LOG (KERN_ERR , bfad, bfa_log_level,"LUN reset failure, status: %d\n" , task_status);@@ -381,16 +380,16 @@ bfad_im_reset_target_handler(struct scsi_cmnd *cmnd)spin_lock_irqsave (&bfad->bfad_lock, flags); itnim =bfad_get_itnim (im_port, starget->id);if (itnim) { - cmnd->SCp.ptr = (char *)&wq; +bfad_priv (cmnd)->wq = &wq; rc =bfad_im_target_reset_send (bfad, cmnd, itnim);if (rc ==BFA_STATUS_OK ) {/* wait target reset to complete */ spin_unlock_irqrestore (&bfad->bfad_lock, flags);wait_event (wq,test_bit (IO_DONE_BIT , - (unsigned long *)&cmnd->SCp.Status)); + &bfad_priv (cmnd)->status));spin_lock_irqsave (&bfad->bfad_lock, flags); - task_status = cmnd->SCp.Status >>1 ; + task_status =bfad_priv (cmnd)->status >>1 ;if (task_status !=BFI_TSKIM_STS_OK )BFA_LOG (KERN_ERR , bfad, bfa_log_level, "target reset failure,"@@ -797,6 +796,7 @@ struct scsi_host_template bfad_im_scsi_host_template = { .name = BFAD_DRIVER_NAME, .info = bfad_im_info, .queuecommand = bfad_im_queuecommand, + .cmd_size = sizeof(struct bfad_cmd_priv), .eh_timed_out = fc_eh_timed_out, .eh_abort_handler = bfad_im_abort_handler, .eh_device_reset_handler = bfad_im_reset_lun_handler,@@ -819,6 +819,7 @@ struct scsi_host_template bfad_im_vport_template = { .name = BFAD_DRIVER_NAME, .info = bfad_im_info, .queuecommand = bfad_im_queuecommand, + .cmd_size = sizeof(struct bfad_cmd_priv), .eh_timed_out = fc_eh_timed_out, .eh_abort_handler = bfad_im_abort_handler, .eh_device_reset_handler = bfad_im_reset_lun_handler,drivers/scsi/bfa/bfad_im.h +9
-0@@ -43,6 +43,22 @@ u32 bfad_im_supported_speeds(struct bfa_s *bfa);*/ #define IO_DONE_BIT 0 +/** +* struct bfad_cmd_priv - private data per SCSI command. +* @status: Lowest bit represents IO_DONE. The next seven bits hold a value of +* type enum bfi_tskim_status. +* @wq: Wait queue used to wait for completion of an operation. +*/ +struct bfad_cmd_priv { +unsigned long status; +wait_queue_head_t *wq;
drivers/scsi/bfa/bfad_im.h u32 bfad_im_supported_speeds(struct bfa_s *bfa); · line 64
Quoted 10 lines
drivers/scsi/bfa/bfad_im.h +7
-0+}; + +static inline struct bfad_cmd_priv *bfad_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +struct bfad_itnim_data_s {struct bfad_itnim_s *itnim; };
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 14/44 csio: Stop using the SCSI pointer
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/csiostor/csio_scsi.c | 20 +++++++++++--------- drivers/scsi/csiostor/csio_scsi.h | 10 ++++++++++ 2 files changed, 21 insertions(+), 9 deletions(-)
drivers/scsi/csiostor/csio_scsi.c +11 -9
@@ -166,7 +166,7 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr)struct scsi_cmnd *scmnd =csio_scsi_cmnd (req);/* Check for Task Management */ -if (likely (scmnd->SCp.Message ==0 )) { +if (likely (csio_priv (scmnd)->fc_tm_flags ==0 )) {int_to_scsilun (scmnd->device->lun, &fcp_cmnd->fc_lun); fcp_cmnd->fc_tm_flags =0 ; fcp_cmnd->fc_cmdref =0 ;
@@ -185,7 +185,7 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr) }else {memset (fcp_cmnd,0 ,sizeof (*fcp_cmnd));int_to_scsilun (scmnd->device->lun, &fcp_cmnd->fc_lun); - fcp_cmnd->fc_tm_flags = (uint8_t )scmnd->SCp.Message; + fcp_cmnd->fc_tm_flags =csio_priv (scmnd)->fc_tm_flags; } }
@@ -1855,7 +1855,7 @@ csio_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmnd)/* Needed during abort */ cmnd->host_scribble = (unsigned char *)ioreq; - cmnd->SCp.Message =0 ; +csio_priv (cmnd)->fc_tm_flags =0 ;/* Kick off SCSI IO SM on the ioreq */ spin_lock_irqsave (&hw->lock, flags);
@@ -2026,7 +2026,7 @@ csio_tm_cbfn(struct csio_hw *hw, struct csio_ioreq *req) req, req->wr_status);/* Cache FW return status */ - cmnd->SCp.Status = req->wr_status; +csio_priv (cmnd)->wr_status = req->wr_status;/* Special handling based on FCP response */
@@ -2049,7 +2049,7 @@ csio_tm_cbfn(struct csio_hw *hw, struct csio_ioreq *req)/* Modify return status if flags indicate success */ if (flags &FCP_RSP_LEN_VAL )if (rsp_info->rsp_code ==FCP_TMF_CMPL ) - cmnd->SCp.Status =FW_SUCCESS ; +csio_priv (cmnd)->wr_status =FW_SUCCESS ;csio_dbg (hw,"TM FCP rsp code: %d\n" , rsp_info->rsp_code); }
@@ -2125,9 +2125,9 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)csio_scsi_cmnd (ioreq) = cmnd; cmnd->host_scribble = (unsigned char *)ioreq; - cmnd->SCp.Status =0 ; +csio_priv (cmnd)->wr_status =0 ; - cmnd->SCp.Message =FCP_TMF_LUN_RESET ; +csio_priv (cmnd)->fc_tm_flags =FCP_TMF_LUN_RESET ; ioreq->tmo =CSIO_SCSI_LUNRST_TMO_MS /1000 ;/*
@@ -2178,9 +2178,10 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd) }/* LUN reset returned, check cached status */ -if (cmnd->SCp.Status !=FW_SUCCESS ) { +if (csio_priv (cmnd)->wr_status !=FW_SUCCESS ) {csio_err (hw,"LUN reset failed (%d:%llu), status: %d\n" , - cmnd->device->id, cmnd->device->lun, cmnd->SCp.Status); + cmnd->device->id, cmnd->device->lun, +csio_priv (cmnd)->wr_status); goto fail; }
@@ -2271,6 +2272,7 @@ struct scsi_host_template csio_fcoe_shost_template = { .name = CSIO_DRV_DESC, .proc_name = KBUILD_MODNAME, .queuecommand = csio_queuecommand, + .cmd_size = sizeof(struct csio_cmd_priv), .eh_timed_out = fc_eh_timed_out, .eh_abort_handler = csio_eh_abort_handler, .eh_device_reset_handler = csio_eh_lun_reset_handler,
drivers/scsi/csiostor/csio_scsi.h +10 -0
@@ -188,6 +188,16 @@ struct csio_scsi_level_data {uint64_t oslun; }; +struct csio_cmd_priv { +uint8_t fc_tm_flags;/* task management flags */ +uint16_t wr_status; +}; + +static inline struct csio_cmd_priv *csio_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +static inline struct csio_ioreq *csio_get_scsi_ioreq (struct csio_scsim *scm) {
Hannes Reinecke
maintainerRe: [PATCH v2 14/44] csio: Stop using the SCSI pointer
Quoted 104 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/csiostor/csio_scsi.c | 20 +++++++++++--------- drivers/scsi/csiostor/csio_scsi.h | 10 ++++++++++ 2 files changed, 21 insertions(+), 9 deletions(-)drivers/scsi/csiostor/csio_scsi.c +11
-9@@ -166,7 +166,7 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr)struct scsi_cmnd *scmnd =csio_scsi_cmnd (req);/* Check for Task Management */ -if (likely (scmnd->SCp.Message ==0 )) { +if (likely (csio_priv (scmnd)->fc_tm_flags ==0 )) {int_to_scsilun (scmnd->device->lun, &fcp_cmnd->fc_lun); fcp_cmnd->fc_tm_flags =0 ; fcp_cmnd->fc_cmdref =0 ;@@ -185,7 +185,7 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr) }else {memset (fcp_cmnd,0 ,sizeof (*fcp_cmnd));int_to_scsilun (scmnd->device->lun, &fcp_cmnd->fc_lun); - fcp_cmnd->fc_tm_flags = (uint8_t )scmnd->SCp.Message; + fcp_cmnd->fc_tm_flags =csio_priv (scmnd)->fc_tm_flags; } }@@ -1855,7 +1855,7 @@ csio_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmnd)/* Needed during abort */ cmnd->host_scribble = (unsigned char *)ioreq; - cmnd->SCp.Message =0 ; +csio_priv (cmnd)->fc_tm_flags =0 ;/* Kick off SCSI IO SM on the ioreq */ spin_lock_irqsave (&hw->lock, flags);@@ -2026,7 +2026,7 @@ csio_tm_cbfn(struct csio_hw *hw, struct csio_ioreq *req) req, req->wr_status);/* Cache FW return status */ - cmnd->SCp.Status = req->wr_status; +csio_priv (cmnd)->wr_status = req->wr_status;/* Special handling based on FCP response */ @@ -2049,7 +2049,7 @@ csio_tm_cbfn(struct csio_hw *hw, struct csio_ioreq *req)/* Modify return status if flags indicate success */ if (flags &FCP_RSP_LEN_VAL )if (rsp_info->rsp_code ==FCP_TMF_CMPL ) - cmnd->SCp.Status =FW_SUCCESS ; +csio_priv (cmnd)->wr_status =FW_SUCCESS ;csio_dbg (hw,"TM FCP rsp code: %d\n" , rsp_info->rsp_code); }@@ -2125,9 +2125,9 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)csio_scsi_cmnd (ioreq) = cmnd; cmnd->host_scribble = (unsigned char *)ioreq; - cmnd->SCp.Status =0 ; +csio_priv (cmnd)->wr_status =0 ; - cmnd->SCp.Message =FCP_TMF_LUN_RESET ; +csio_priv (cmnd)->fc_tm_flags =FCP_TMF_LUN_RESET ; ioreq->tmo =CSIO_SCSI_LUNRST_TMO_MS /1000 ;/* @@ -2178,9 +2178,10 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd) }/* LUN reset returned, check cached status */ -if (cmnd->SCp.Status !=FW_SUCCESS ) { +if (csio_priv (cmnd)->wr_status !=FW_SUCCESS ) {csio_err (hw,"LUN reset failed (%d:%llu), status: %d\n" , - cmnd->device->id, cmnd->device->lun, cmnd->SCp.Status); + cmnd->device->id, cmnd->device->lun, +csio_priv (cmnd)->wr_status); goto fail; }@@ -2271,6 +2272,7 @@ struct scsi_host_template csio_fcoe_shost_template = { .name = CSIO_DRV_DESC, .proc_name = KBUILD_MODNAME, .queuecommand = csio_queuecommand, + .cmd_size = sizeof(struct csio_cmd_priv), .eh_timed_out = fc_eh_timed_out, .eh_abort_handler = csio_eh_abort_handler, .eh_device_reset_handler = csio_eh_lun_reset_handler,drivers/scsi/csiostor/csio_scsi.h +3
-0@@ -188,6 +188,16 @@ struct csio_scsi_level_data {uint64_t oslun; }; +struct csio_cmd_priv { +uint8_t fc_tm_flags;/* task management flags */ +uint16_t wr_status;
drivers/scsi/csiostor/csio_scsi.h struct csio_scsi_level_data { · line 203
Quoted 10 lines
drivers/scsi/csiostor/csio_scsi.h +7
-0+}; + +static inline struct csio_cmd_priv *csio_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +static inline struct csio_ioreq *csio_get_scsi_ioreq (struct csio_scsim *scm) {
Similar comments to the bfa driver: if you allocate a command payload it would make sense to move the 'host_scribble' contents in there, too.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 14/44] csio: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 115 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/csiostor/csio_scsi.c| 20 +++++++++++---------drivers/scsi/csiostor/csio_scsi.h| 10 ++++++++++2 files changed, 21 insertions(+), 9 deletions(-)drivers/scsi/csiostor/csio_scsi.c +11
-9@@ -166,7 +166,7 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr)struct scsi_cmnd *scmnd =csio_scsi_cmnd (req);/* Check for Task Management */ -if (likely (scmnd->SCp.Message ==0 )) { +if (likely (csio_priv (scmnd)->fc_tm_flags ==0 )) {int_to_scsilun (scmnd->device->lun, &fcp_cmnd->fc_lun); fcp_cmnd->fc_tm_flags =0 ; fcp_cmnd->fc_cmdref =0 ;@@ -185,7 +185,7 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr) }else {memset (fcp_cmnd,0 ,sizeof (*fcp_cmnd));int_to_scsilun (scmnd->device->lun, &fcp_cmnd->fc_lun); - fcp_cmnd->fc_tm_flags = (uint8_t )scmnd->SCp.Message; + fcp_cmnd->fc_tm_flags =csio_priv (scmnd)->fc_tm_flags; } }@@ -1855,7 +1855,7 @@ csio_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmnd)/* Needed during abort */ cmnd->host_scribble = (unsigned char *)ioreq; - cmnd->SCp.Message =0 ; +csio_priv (cmnd)->fc_tm_flags =0 ;/* Kick off SCSI IO SM on the ioreq */ spin_lock_irqsave (&hw->lock, flags);@@ -2026,7 +2026,7 @@ csio_tm_cbfn(struct csio_hw *hw, struct csio_ioreq *req) req, req->wr_status);/* Cache FW return status */ - cmnd->SCp.Status = req->wr_status; +csio_priv (cmnd)->wr_status = req->wr_status;/* Special handling based on FCP response */ @@ -2049,7 +2049,7 @@ csio_tm_cbfn(struct csio_hw *hw, struct csio_ioreq *req)/* Modify return status if flags indicate success */ if (flags &FCP_RSP_LEN_VAL )if (rsp_info->rsp_code ==FCP_TMF_CMPL ) - cmnd->SCp.Status =FW_SUCCESS ; +csio_priv (cmnd)->wr_status =FW_SUCCESS ;csio_dbg (hw,"TM FCP rsp code: %d\n" , rsp_info->rsp_code); }@@ -2125,9 +2125,9 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)csio_scsi_cmnd (ioreq) = cmnd; cmnd->host_scribble = (unsigned char *)ioreq; - cmnd->SCp.Status =0 ; +csio_priv (cmnd)->wr_status =0 ; - cmnd->SCp.Message =FCP_TMF_LUN_RESET ; +csio_priv (cmnd)->fc_tm_flags =FCP_TMF_LUN_RESET ; ioreq->tmo =CSIO_SCSI_LUNRST_TMO_MS /1000 ;/* @@ -2178,9 +2178,10 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd) }/* LUN reset returned, check cached status */ -if (cmnd->SCp.Status !=FW_SUCCESS ) { +if (csio_priv (cmnd)->wr_status !=FW_SUCCESS ) {csio_err (hw,"LUN reset failed (%d:%llu), status: %d\n" , - cmnd->device->id, cmnd->device->lun, cmnd->SCp.Status); + cmnd->device->id, cmnd->device->lun, +csio_priv (cmnd)->wr_status); goto fail; }@@ -2271,6 +2272,7 @@ struct scsi_host_template csio_fcoe_shost_template = { .name = CSIO_DRV_DESC, .proc_name = KBUILD_MODNAME, .queuecommand = csio_queuecommand, + .cmd_size = sizeof(struct csio_cmd_priv), .eh_timed_out = fc_eh_timed_out, .eh_abort_handler = csio_eh_abort_handler, .eh_device_reset_handler = csio_eh_lun_reset_handler,drivers/scsi/csiostor/csio_scsi.h +10
-0@@ -188,6 +188,16 @@ struct csio_scsi_level_data {uint64_t oslun; }; +struct csio_cmd_priv { +uint8_t fc_tm_flags;/* task management flags */ +uint16_t wr_status; +}; + +static inline struct csio_cmd_priv *csio_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +
Quoted 3 lines
static inline struct
csio_ioreq*csio_get_scsi_ioreq(struct csio_scsim *scm)
{
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 15/44 dc395x: Stop using the SCSI pointer
In reply to Bart Van AsscheRemove the code that sets SCSI pointer members since there is no code in this driver that reads these members.
--- drivers/scsi/dc395x.c | 3 --- 1 file changed, 3 deletions(-)
drivers/scsi/dc395x.c +0 -3
@@ -3314,9 +3314,6 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,/* Here is the info for Doug Gilbert's sg3 ... */ scsi_set_resid (cmd, srb->total_xfer_length); -/* This may be interpreted by sb. or not ... */ - cmd->SCp.this_residual = srb->total_xfer_length; - cmd->SCp.buffers_residual =0 ;if (debug_enabled (DBG_KG )) {if (srb->total_xfer_length) dprintkdbg(DBG_KG, "srb_done: (0x%p) <%02i-%i> "
Re: [PATCH v2 15/44] dc395x: Stop using the SCSI pointer
Quoted 15 lines · Bart Van Assche
Remove the code that sets SCSI pointer members since there is no code in this driver that reads these members.
Cc Oliver Neukum <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/dc395x.c | 3 --- 1 file changed, 3 deletions(-)drivers/scsi/dc395x.c +0
-0
drivers/scsi/dc395x.c static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · line 3319
Quoted 9 lines
drivers/scsi/dc395x.c +0
-3@@ -3314,9 +3314,6 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,/* Here is the info for Doug Gilbert's sg3 ... */ scsi_set_resid (cmd, srb->total_xfer_length); -/* This may be interpreted by sb. or not ... */ - cmd->SCp.this_residual = srb->total_xfer_length; - cmd->SCp.buffers_residual =0 ;if (debug_enabled (DBG_KG )) {if (srb->total_xfer_length) dprintkdbg(DBG_KG, "srb_done: (0x%p) <%02i-%i> "
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 15/44] dc395x: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 19 lines · Bart Van Assche
Remove the code that sets SCSI pointer members since there is no code in this driver that reads these members.
Cc Oliver Neukum <[email protected]>Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/dc395x.c| 3 ---1 file changed, 3 deletions(-)drivers/scsi/dc395x.c +0
-0
drivers/scsi/dc395x.c static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, · line 3319
Quoted 9 lines
drivers/scsi/dc395x.c +0
-3@@ -3314,9 +3314,6 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,/* Here is the info for Doug Gilbert's sg3 ... */ scsi_set_resid (cmd, srb->total_xfer_length); -/* This may be interpreted by sb. or not ... */ - cmd->SCp.this_residual = srb->total_xfer_length; - cmd->SCp.buffers_residual =0 ;if (debug_enabled (DBG_KG )) {if (srb->total_xfer_length) dprintkdbg(DBG_KG, "srb_done: (0x%p) <%02i-%i> "
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 16/44 esp_scsi: Stop using the SCSI pointer
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/esp_scsi.c | 4 +--- drivers/scsi/esp_scsi.h | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/esp_scsi.c +1 -3
@@ -2678,6 +2678,7 @@ struct scsi_host_template scsi_esp_template = { .sg_tablesize = SG_ALL, .max_sectors = 0xffff, .skip_settle_delay = 1, + .cmd_size = sizeof(struct esp_cmd_priv), };EXPORT_SYMBOL (scsi_esp_template);
@@ -2739,9 +2740,6 @@ static struct spi_function_template esp_transport_ops = {static int __init esp_init (void ) { -BUILD_BUG_ON (sizeof (struct scsi_pointer ) < -sizeof (struct esp_cmd_priv )); - esp_transport_template =spi_attach_transport (&esp_transport_ops);if (!esp_transport_template)return -ENODEV ;
drivers/scsi/esp_scsi.h +2 -1
@@ -262,7 +262,8 @@ struct esp_cmd_priv {struct scatterlist *cur_sg;int tot_residue; }; -#define ESP_CMD_PRIV (CMD ) ((struct esp_cmd_priv *)(&(CMD)->SCp)) + +#define ESP_CMD_PRIV (cmd) ((struct esp_cmd_priv *)scsi_cmd_priv(cmd))/* NOTE: this enum is ordered based on chip features! */ enum esp_rev {
Re: [PATCH v2 16/44] esp_scsi: Stop using the SCSI pointer
Quoted 38 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/esp_scsi.c | 4 +--- drivers/scsi/esp_scsi.h | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-)drivers/scsi/esp_scsi.c +1
-3@@ -2678,6 +2678,7 @@ struct scsi_host_template scsi_esp_template = { .sg_tablesize = SG_ALL, .max_sectors = 0xffff, .skip_settle_delay = 1, + .cmd_size = sizeof(struct esp_cmd_priv), };EXPORT_SYMBOL (scsi_esp_template);@@ -2739,9 +2740,6 @@ static struct spi_function_template esp_transport_ops = {static int __init esp_init (void ) { -BUILD_BUG_ON (sizeof (struct scsi_pointer ) < -sizeof (struct esp_cmd_priv )); - esp_transport_template =spi_attach_transport (&esp_transport_ops);if (!esp_transport_template)return -ENODEV ;drivers/scsi/esp_scsi.h +0
-0
drivers/scsi/esp_scsi.h struct esp_cmd_priv { · line 269
Quoted 9 lines
drivers/scsi/esp_scsi.h +2
-1@@ -262,7 +262,8 @@ struct esp_cmd_priv {struct scatterlist *cur_sg;int tot_residue; }; -#define ESP_CMD_PRIV (CMD ) ((struct esp_cmd_priv *)(&(CMD)->SCp)) + +#define ESP_CMD_PRIV (cmd) ((struct esp_cmd_priv *)scsi_cmd_priv(cmd))/* NOTE: this enum is ordered based on chip features! */ enum esp_rev {
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 16/44] esp_scsi: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 42 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/esp_scsi.c| 4 +---drivers/scsi/esp_scsi.h| 3 ++-2 files changed, 3 insertions(+), 4 deletions(-)drivers/scsi/esp_scsi.c +1
-3@@ -2678,6 +2678,7 @@ struct scsi_host_template scsi_esp_template = { .sg_tablesize = SG_ALL, .max_sectors = 0xffff, .skip_settle_delay = 1, + .cmd_size = sizeof(struct esp_cmd_priv), };EXPORT_SYMBOL (scsi_esp_template);@@ -2739,9 +2740,6 @@ static struct spi_function_template esp_transport_ops = {static int __init esp_init (void ) { -BUILD_BUG_ON (sizeof (struct scsi_pointer ) < -sizeof (struct esp_cmd_priv )); - esp_transport_template =spi_attach_transport (&esp_transport_ops);if (!esp_transport_template)return -ENODEV ;drivers/scsi/esp_scsi.h +0
-0
drivers/scsi/esp_scsi.h struct esp_cmd_priv { · line 269
Quoted 9 lines
drivers/scsi/esp_scsi.h +2
-1@@ -262,7 +262,8 @@ struct esp_cmd_priv {struct scatterlist *cur_sg;int tot_residue; }; -#define ESP_CMD_PRIV (CMD ) ((struct esp_cmd_priv *)(&(CMD)->SCp)) + +#define ESP_CMD_PRIV (cmd) ((struct esp_cmd_priv *)scsi_cmd_priv(cmd))/* NOTE: this enum is ordered based on chip features! */ enum esp_rev {
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 17/44 fdomain: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/fdomain.c | 70 +++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 28 deletions(-)
drivers/scsi/fdomain.c +42 -28
@@ -115,6 +115,17 @@ struct fdomain {struct work_struct work; }; +struct fdomain_priv { +struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *fdomain_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct fdomain_priv *fcmd =scsi_cmd_priv (cmd); + +return &fcmd->scsi_pointer; +} +static inline void fdomain_make_bus_idle (struct fdomain *fd) {outb (0 , fd->base +REG_BCTL );
@@ -263,20 +274,21 @@ static void fdomain_work(struct work_struct *work) struct Scsi_Host *sh = container_of((void *)fd, struct Scsi_Host, hostdata);struct scsi_cmnd *cmd = fd->cur_cmd; +struct scsi_pointer *scsi_pointer =fdomain_scsi_pointer (cmd);unsigned long flags;int status;int done =0 ;spin_lock_irqsave (sh->host_lock, flags); -if (cmd->SCp.phase & in_arbitration) { +if (scsi_pointer->phase & in_arbitration) { status =inb (fd->base +REG_ASTAT );if (!(status &ASTAT_ARB )) {set_host_byte (cmd,DID_BUS_BUSY );fdomain_finish_cmd (fd); goto out; } - cmd->SCp.phase = in_selection; + scsi_pointer->phase = in_selection;outb (ICTL_SEL |FIFO_COUNT , fd->base +REG_ICTL );outb (BCTL_BUSEN |BCTL_SEL , fd->base +REG_BCTL );
@@ -285,7 +297,7 @@ static void fdomain_work(struct work_struct *work)/* Stop arbitration and enable parity */ outb (ACTL_IRQEN |PARITY_MASK , fd->base +REG_ACTL ); goto out; - }else if (cmd->SCp.phase & in_selection) { + }else if (scsi_pointer->phase & in_selection) { status =inb (fd->base +REG_BSTAT );if (!(status &BSTAT_BSY )) {/* Try again, for slow devices */
@@ -297,75 +309,75 @@ static void fdomain_work(struct work_struct *work)/* Stop arbitration and enable parity */ outb (ACTL_IRQEN |PARITY_MASK , fd->base +REG_ACTL ); } - cmd->SCp.phase = in_other; + scsi_pointer->phase = in_other;outb (ICTL_FIFO |ICTL_REQ |FIFO_COUNT , fd->base +REG_ICTL );outb (BCTL_BUSEN , fd->base +REG_BCTL ); goto out; } -/* cur_cmd->SCp.phase == in_other: this is the body of the routine */ +/* fdomain_scsi_pointer(cur_cmd)->phase == in_other: this is the body of the routine */ status =inb (fd->base +REG_BSTAT );if (status &BSTAT_REQ ) {switch (status & (BSTAT_MSG |BSTAT_CMD |BSTAT_IO )) {case BSTAT_CMD :/* COMMAND OUT */ -outb (cmd->cmnd[cmd->SCp.sent_command++], +outb (cmd->cmnd[scsi_pointer->sent_command++], fd->base +REG_SCSI_DATA );break ;case 0 :/* DATA OUT -- tmc18c50/tmc18c30 only */ -if (fd->chip != tmc1800 && !cmd->SCp.have_data_in) { - cmd->SCp.have_data_in =-1 ; +if (fd->chip != tmc1800 && !scsi_pointer->have_data_in) { + scsi_pointer->have_data_in =-1 ;outb (ACTL_IRQEN |ACTL_FIFOWR |ACTL_FIFOEN |PARITY_MASK , fd->base +REG_ACTL ); }break ;case BSTAT_IO :/* DATA IN -- tmc18c50/tmc18c30 only */ -if (fd->chip != tmc1800 && !cmd->SCp.have_data_in) { - cmd->SCp.have_data_in =1 ; +if (fd->chip != tmc1800 && !scsi_pointer->have_data_in) { + scsi_pointer->have_data_in =1 ;outb (ACTL_IRQEN |ACTL_FIFOEN |PARITY_MASK , fd->base +REG_ACTL ); }break ;case BSTAT_CMD |BSTAT_IO :/* STATUS IN */ - cmd->SCp.Status =inb (fd->base +REG_SCSI_DATA ); + scsi_pointer->Status =inb (fd->base +REG_SCSI_DATA );break ;case BSTAT_MSG |BSTAT_CMD :/* MESSAGE OUT */ outb (MESSAGE_REJECT , fd->base +REG_SCSI_DATA );break ;case BSTAT_MSG |BSTAT_CMD |BSTAT_IO :/* MESSAGE IN */ - cmd->SCp.Message =inb (fd->base +REG_SCSI_DATA ); -if (cmd->SCp.Message ==COMMAND_COMPLETE ) + scsi_pointer->Message =inb (fd->base +REG_SCSI_DATA ); +if (scsi_pointer->Message ==COMMAND_COMPLETE ) ++done;break ; } } -if (fd->chip == tmc1800 && !cmd->SCp.have_data_in && - cmd->SCp.sent_command >= cmd->cmd_len) { +if (fd->chip == tmc1800 && !scsi_pointer->have_data_in && + scsi_pointer->sent_command >= cmd->cmd_len) {if (cmd->sc_data_direction ==DMA_TO_DEVICE ) { - cmd->SCp.have_data_in =-1 ; + scsi_pointer->have_data_in =-1 ;outb (ACTL_IRQEN |ACTL_FIFOWR |ACTL_FIFOEN |PARITY_MASK , fd->base +REG_ACTL ); }else { - cmd->SCp.have_data_in =1 ; + scsi_pointer->have_data_in =1 ;outb (ACTL_IRQEN |ACTL_FIFOEN |PARITY_MASK , fd->base +REG_ACTL ); } } -if (cmd->SCp.have_data_in ==-1 )/* DATA OUT */ +if (scsi_pointer->have_data_in ==-1 )/* DATA OUT */ fdomain_write_data (cmd); -if (cmd->SCp.have_data_in ==1 )/* DATA IN */ +if (scsi_pointer->have_data_in ==1 )/* DATA IN */ fdomain_read_data (cmd);if (done) { -set_status_byte (cmd, cmd->SCp.Status); +set_status_byte (cmd, scsi_pointer->Status);set_host_byte (cmd,DID_OK ); -scsi_msg_to_host_byte (cmd, cmd->SCp.Message); +scsi_msg_to_host_byte (cmd, scsi_pointer->Message);fdomain_finish_cmd (fd); }else { -if (cmd->SCp.phase & disconnect) { +if (scsi_pointer->phase & disconnect) {outb (ICTL_FIFO |ICTL_SEL |ICTL_REQ |FIFO_COUNT , fd->base +REG_ICTL );outb (0 , fd->base +REG_BCTL );
@@ -398,14 +410,15 @@ static irqreturn_t fdomain_irq(int irq, void *dev_id)static int fdomain_queue (struct Scsi_Host *sh,struct scsi_cmnd *cmd) { +struct scsi_pointer *scsi_pointer =fdomain_scsi_pointer (cmd);struct fdomain *fd =shost_priv (cmd->device->host);unsigned long flags; - cmd->SCp.Status =0 ; - cmd->SCp.Message =0 ; - cmd->SCp.have_data_in =0 ; - cmd->SCp.sent_command =0 ; - cmd->SCp.phase = in_arbitration; + scsi_pointer->Status =0 ; + scsi_pointer->Message =0 ; + scsi_pointer->have_data_in =0 ; + scsi_pointer->sent_command =0 ; + scsi_pointer->phase = in_arbitration;scsi_set_resid (cmd,scsi_bufflen (cmd));spin_lock_irqsave (sh->host_lock, flags);
@@ -440,7 +453,7 @@ static int fdomain_abort(struct scsi_cmnd *cmd)spin_lock_irqsave (sh->host_lock, flags);fdomain_make_bus_idle (fd); - fd->cur_cmd->SCp.phase |= aborted; +fdomain_scsi_pointer (fd->cur_cmd)->phase |= aborted;/* Aborts are not done well. . . */ set_host_byte (fd->cur_cmd,DID_ABORT );
@@ -501,6 +514,7 @@ static struct scsi_host_template fdomain_template = { .this_id = 7, .sg_tablesize = 64, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct fdomain_priv), }; struct Scsi_Host *fdomain_create(int base, int irq, int this_id,
Re: [PATCH v2 17/44] fdomain: Move the SCSI pointer to private command data
Quoted 195 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/fdomain.c| 70 +++++++++++++++++++++++++-----------------1 file changed, 42 insertions(+), 28 deletions(-)drivers/scsi/fdomain.c +41
-28@@ -115,6 +115,17 @@ struct fdomain {struct work_struct work; }; +struct fdomain_priv { +struct scsi_pointer scsi_pointer; +}; + +static struct scsi_pointer *fdomain_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct fdomain_priv *fcmd =scsi_cmd_priv (cmd); + +return &fcmd->scsi_pointer; +} +static inline void fdomain_make_bus_idle (struct fdomain *fd) {outb (0 , fd->base +REG_BCTL );@@ -263,20 +274,21 @@ static void fdomain_work(struct work_struct *work) struct Scsi_Host *sh = container_of((void *)fd, struct Scsi_Host, hostdata);struct scsi_cmnd *cmd = fd->cur_cmd; +struct scsi_pointer *scsi_pointer =fdomain_scsi_pointer (cmd);unsigned long flags;int status;int done =0 ;spin_lock_irqsave (sh->host_lock, flags); -if (cmd->SCp.phase & in_arbitration) { +if (scsi_pointer->phase & in_arbitration) { status =inb (fd->base +REG_ASTAT );if (!(status &ASTAT_ARB )) {set_host_byte (cmd,DID_BUS_BUSY );fdomain_finish_cmd (fd); goto out; } - cmd->SCp.phase = in_selection; + scsi_pointer->phase = in_selection;outb (ICTL_SEL |FIFO_COUNT , fd->base +REG_ICTL );outb (BCTL_BUSEN |BCTL_SEL , fd->base +REG_BCTL );@@ -285,7 +297,7 @@ static void fdomain_work(struct work_struct *work)/* Stop arbitration and enable parity */ outb (ACTL_IRQEN |PARITY_MASK , fd->base +REG_ACTL ); goto out; - }else if (cmd->SCp.phase & in_selection) { + }else if (scsi_pointer->phase & in_selection) { status =inb (fd->base +REG_BSTAT );if (!(status &BSTAT_BSY )) {/* Try again, for slow devices */ @@ -297,75 +309,75 @@ static void fdomain_work(struct work_struct *work)/* Stop arbitration and enable parity */ outb (ACTL_IRQEN |PARITY_MASK , fd->base +REG_ACTL ); } - cmd->SCp.phase = in_other; + scsi_pointer->phase = in_other;outb (ICTL_FIFO |ICTL_REQ |FIFO_COUNT , fd->base +REG_ICTL );outb (BCTL_BUSEN , fd->base +REG_BCTL ); goto out; } -/* cur_cmd->SCp.phase == in_other: this is the body of the routine */ +/* fdomain_scsi_pointer(cur_cmd)->phase == in_other: this is the body of the routine */ status =inb (fd->base +REG_BSTAT );if (status &BSTAT_REQ ) {switch (status & (BSTAT_MSG |BSTAT_CMD |BSTAT_IO )) {case BSTAT_CMD :/* COMMAND OUT */ -outb (cmd->cmnd[cmd->SCp.sent_command++], +outb (cmd->cmnd[scsi_pointer->sent_command++], fd->base +REG_SCSI_DATA );break ;case 0 :/* DATA OUT -- tmc18c50/tmc18c30 only */ -if (fd->chip != tmc1800 && !cmd->SCp.have_data_in) { - cmd->SCp.have_data_in =-1 ; +if (fd->chip != tmc1800 && !scsi_pointer->have_data_in) { + scsi_pointer->have_data_in =-1 ;outb (ACTL_IRQEN |ACTL_FIFOWR |ACTL_FIFOEN |PARITY_MASK , fd->base +REG_ACTL ); }break ;case BSTAT_IO :/* DATA IN -- tmc18c50/tmc18c30 only */ -if (fd->chip != tmc1800 && !cmd->SCp.have_data_in) { - cmd->SCp.have_data_in =1 ; +if (fd->chip != tmc1800 && !scsi_pointer->have_data_in) { + scsi_pointer->have_data_in =1 ;outb (ACTL_IRQEN |ACTL_FIFOEN |PARITY_MASK , fd->base +REG_ACTL ); }break ;case BSTAT_CMD |BSTAT_IO :/* STATUS IN */ - cmd->SCp.Status =inb (fd->base +REG_SCSI_DATA ); + scsi_pointer->Status =inb (fd->base +REG_SCSI_DATA );break ;case BSTAT_MSG |BSTAT_CMD :/* MESSAGE OUT */ outb (MESSAGE_REJECT , fd->base +REG_SCSI_DATA );break ;case BSTAT_MSG |BSTAT_CMD |BSTAT_IO :/* MESSAGE IN */ - cmd->SCp.Message =inb (fd->base +REG_SCSI_DATA ); -if (cmd->SCp.Message ==COMMAND_COMPLETE ) + scsi_pointer->Message =inb (fd->base +REG_SCSI_DATA ); +if (scsi_pointer->Message ==COMMAND_COMPLETE ) ++done;break ; } } -if (fd->chip == tmc1800 && !cmd->SCp.have_data_in && - cmd->SCp.sent_command >= cmd->cmd_len) { +if (fd->chip == tmc1800 && !scsi_pointer->have_data_in && + scsi_pointer->sent_command >= cmd->cmd_len) {if (cmd->sc_data_direction ==DMA_TO_DEVICE ) { - cmd->SCp.have_data_in =-1 ; + scsi_pointer->have_data_in =-1 ;outb (ACTL_IRQEN |ACTL_FIFOWR |ACTL_FIFOEN |PARITY_MASK , fd->base +REG_ACTL ); }else { - cmd->SCp.have_data_in =1 ; + scsi_pointer->have_data_in =1 ;outb (ACTL_IRQEN |ACTL_FIFOEN |PARITY_MASK , fd->base +REG_ACTL ); } } -if (cmd->SCp.have_data_in ==-1 )/* DATA OUT */ +if (scsi_pointer->have_data_in ==-1 )/* DATA OUT */ fdomain_write_data (cmd); -if (cmd->SCp.have_data_in ==1 )/* DATA IN */ +if (scsi_pointer->have_data_in ==1 )/* DATA IN */ fdomain_read_data (cmd);if (done) { -set_status_byte (cmd, cmd->SCp.Status); +set_status_byte (cmd, scsi_pointer->Status);set_host_byte (cmd,DID_OK ); -scsi_msg_to_host_byte (cmd, cmd->SCp.Message); +scsi_msg_to_host_byte (cmd, scsi_pointer->Message);fdomain_finish_cmd (fd); }else { -if (cmd->SCp.phase & disconnect) { +if (scsi_pointer->phase & disconnect) {outb (ICTL_FIFO |ICTL_SEL |ICTL_REQ |FIFO_COUNT , fd->base +REG_ICTL );outb (0 , fd->base +REG_BCTL );@@ -398,14 +410,15 @@ static irqreturn_t fdomain_irq(int irq, void *dev_id)static int fdomain_queue (struct Scsi_Host *sh,struct scsi_cmnd *cmd) { +struct scsi_pointer *scsi_pointer =fdomain_scsi_pointer (cmd);struct fdomain *fd =shost_priv (cmd->device->host);unsigned long flags; - cmd->SCp.Status =0 ; - cmd->SCp.Message =0 ; - cmd->SCp.have_data_in =0 ; - cmd->SCp.sent_command =0 ; - cmd->SCp.phase = in_arbitration; + scsi_pointer->Status =0 ; + scsi_pointer->Message =0 ; + scsi_pointer->have_data_in =0 ; + scsi_pointer->sent_command =0 ; + scsi_pointer->phase = in_arbitration;scsi_set_resid (cmd,scsi_bufflen (cmd));spin_lock_irqsave (sh->host_lock, flags);@@ -440,7 +453,7 @@ static int fdomain_abort(struct scsi_cmnd *cmd)spin_lock_irqsave (sh->host_lock, flags);fdomain_make_bus_idle (fd); - fd->cur_cmd->SCp.phase |= aborted; +fdomain_scsi_pointer (fd->cur_cmd)->phase |= aborted;/* Aborts are not done well. . . */ set_host_byte (fd->cur_cmd,DID_ABORT );
drivers/scsi/fdomain.c static struct scsi_host_template fdomain_template = { · line 520
Quoted 7 lines
drivers/scsi/fdomain.c +1
-0@@ -501,6 +514,7 @@ static struct scsi_host_template fdomain_template = { .this_id = 7, .sg_tablesize = 64, .dma_boundary = PAGE_SIZE - 1, + .cmd_size = sizeof(struct fdomain_priv), }; struct Scsi_Host *fdomain_create(int base, int irq, int this_id,
--
Himanshu Madhani Oracle Linux Engineering
Re: [PATCH v2 17/44] fdomain: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 10 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/fdomain.c | 70 +++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 28 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
PATCH v2 18/44 fnic: Fix a tracing statement
In reply to Bart Van AsscheReport both the command flags and command state instead of only the command state.
--- drivers/scsi/fnic/fnic_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/fnic/fnic_scsi.c +1 -1
@@ -604,7 +604,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)FNIC_TRACE (fnic_queuecommand, sc->device->host->host_no, tag, sc, io_req, sg_count, cmd_trace, - (((u64 )CMD_FLAGS (sc) >>32 ) |CMD_STATE (sc))); + (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc)));/* if only we issued IO, will we have the io lock */ if (io_lock_acquired)
Re: [PATCH v2 18/44] fnic: Fix a tracing statement
Quoted 15 lines · Bart Van Assche
Report both the command flags and command state instead of only the command state.
Cc Hiral Patel <[email protected]>Fixes 4d7007b49d52 ("[SCSI] fnic: Fnic Trace Utility")Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/fnic/fnic_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/fnic/fnic_scsi.c +0
-0
drivers/scsi/fnic/fnic_scsi.c static int fnic_queuecommand_lck(struct scsi_cmnd *sc) · line 610
Quoted 8 lines
drivers/scsi/fnic/fnic_scsi.c +1
-1@@ -604,7 +604,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)FNIC_TRACE (fnic_queuecommand, sc->device->host->host_no, tag, sc, io_req, sg_count, cmd_trace, - (((u64 )CMD_FLAGS (sc) >>32 ) |CMD_STATE (sc))); + (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc)));/* if only we issued IO, will we have the io lock */ if (io_lock_acquired)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 18/44] fnic: Fix a tracing statement
In reply to Bart Van AsscheQuoted 19 lines · Bart Van Assche
Report both the command flags and command state instead of only the command state.
Cc Hiral Patel <[email protected]>Fixes 4d7007b49d52 ("[SCSI] fnic: Fnic Trace Utility")Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/fnic/fnic_scsi.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/fnic/fnic_scsi.c +0
-0
drivers/scsi/fnic/fnic_scsi.c static int fnic_queuecommand_lck(struct scsi_cmnd *sc) · line 610
Quoted 8 lines
drivers/scsi/fnic/fnic_scsi.c +1
-1@@ -604,7 +604,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)FNIC_TRACE (fnic_queuecommand, sc->device->host->host_no, tag, sc, io_req, sg_count, cmd_trace, - (((u64 )CMD_FLAGS (sc) >>32 ) |CMD_STATE (sc))); + (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc)));/* if only we issued IO, will we have the io lock */ if (io_lock_acquired)
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 19/44 fnic: Stop using the SCSI pointer
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/fnic/fnic.h | 27 +++- drivers/scsi/fnic/fnic_main.c | 1 + drivers/scsi/fnic/fnic_scsi.c | 289 +++++++++++++++++----------------- 3 files changed, 163 insertions(+), 154 deletions(-)
drivers/scsi/fnic/fnic.h +20 -7
@@ -89,15 +89,28 @@#define FNIC_DEV_RST_ABTS_PENDING BIT(21)/* -* Usage of the scsi_cmnd scratchpad. +* fnic private data per SCSI command. * These fields are locked by the hashed io_req_lock. */ -#define CMD_SP (Cmnd) ((Cmnd)->SCp.ptr) -#define CMD_STATE (Cmnd) ((Cmnd)->SCp.phase) -#define CMD_ABTS_STATUS (Cmnd) ((Cmnd)->SCp.Message) -#define CMD_LR_STATUS (Cmnd) ((Cmnd)->SCp.have_data_in) -#define CMD_TAG (Cmnd) ((Cmnd)->SCp.sent_command) -#define CMD_FLAGS (Cmnd) ((Cmnd)->SCp.Status) +struct fnic_cmd_priv { +struct fnic_io_req *io_req; +enum fnic_ioreq_state state; +u32 flags; +u16 abts_status; +u16 lr_status; +}; + +static inline struct fnic_cmd_priv *fnic_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} + +static inline u64 fnic_flags_and_state (struct scsi_cmnd *cmd) +{ +struct fnic_cmd_priv *fcmd =fnic_priv (cmd); + +return ((u64 )fcmd->flags <<32 ) | fcmd->state; +}#define FCPIO_INVALID_CODE 0x100/* hdr_status value unused by firmware */
drivers/scsi/fnic/fnic_main.c +1 -0
@@ -124,6 +124,7 @@ static struct scsi_host_template fnic_host_template = { .max_sectors = 0xffff, .shost_groups = fnic_host_groups, .track_queue_depth = 1, + .cmd_size = sizeof(struct fnic_cmd_priv), }; static void
drivers/scsi/fnic/fnic_scsi.c +142 -147
825 lines not on this page · raw message
Hannes Reinecke
maintainerRe: [PATCH v2 19/44] fnic: Stop using the SCSI pointer
Quoted 69 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/fnic/fnic.h | 27 +++- drivers/scsi/fnic/fnic_main.c | 1 + drivers/scsi/fnic/fnic_scsi.c | 289 +++++++++++++++++----------------- 3 files changed, 163 insertions(+), 154 deletions(-)drivers/scsi/fnic/fnic.h +20
-7@@ -89,15 +89,28 @@#define FNIC_DEV_RST_ABTS_PENDING BIT(21)/* -* Usage of the scsi_cmnd scratchpad. +* fnic private data per SCSI command. * These fields are locked by the hashed io_req_lock. */ -#define CMD_SP (Cmnd) ((Cmnd)->SCp.ptr) -#define CMD_STATE (Cmnd) ((Cmnd)->SCp.phase) -#define CMD_ABTS_STATUS (Cmnd) ((Cmnd)->SCp.Message) -#define CMD_LR_STATUS (Cmnd) ((Cmnd)->SCp.have_data_in) -#define CMD_TAG (Cmnd) ((Cmnd)->SCp.sent_command) -#define CMD_FLAGS (Cmnd) ((Cmnd)->SCp.Status) +struct fnic_cmd_priv { +struct fnic_io_req *io_req; +enum fnic_ioreq_state state; +u32 flags; +u16 abts_status; +u16 lr_status; +}; + +static inline struct fnic_cmd_priv *fnic_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} + +static inline u64 fnic_flags_and_state (struct scsi_cmnd *cmd) +{ +struct fnic_cmd_priv *fcmd =fnic_priv (cmd); + +return ((u64 )fcmd->flags <<32 ) | fcmd->state; +}#define FCPIO_INVALID_CODE 0x100/* hdr_status value unused by firmware */ drivers/scsi/fnic/fnic_main.c +1
-0@@ -124,6 +124,7 @@ static struct scsi_host_template fnic_host_template = { .max_sectors = 0xffff, .shost_groups = fnic_host_groups, .track_queue_depth = 1, + .cmd_size = sizeof(struct fnic_cmd_priv), }; static voiddrivers/scsi/fnic/fnic_scsi.c +0
-0
drivers/scsi/fnic/fnic_scsi.c static int fnic_queuecommand_lck(struct scsi_cmnd *sc) · line 502
Quoted 8 lines
drivers/scsi/fnic/fnic_scsi.c +2
-2@@ -497,8 +497,8 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)* caller disabling them. */ spin_unlock (lp->host->host_lock); -CMD_STATE (sc) =FNIC_IOREQ_NOT_INITED ; -CMD_FLAGS (sc) =FNIC_NO_FLAGS ; +fnic_priv (sc)->state =FNIC_IOREQ_NOT_INITED ; +fnic_priv (sc)->flags =FNIC_NO_FLAGS ;
Why not keep the macros?
Would be less churn with the driver, no?
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 19/44] fnic: Stop using the SCSI pointer
Quoted 69 lines · Hannes Reinecke
Quoted 68 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/fnic/fnic.h | 27 +++-drivers/scsi/fnic/fnic_main.c| 1 +drivers/scsi/fnic/fnic_scsi.c| 289 +++++++++++++++++-----------------3 files changed, 163 insertions(+), 154 deletions(-)drivers/scsi/fnic/fnic.h +20
-7@@ -89,15 +89,28 @@ #define FNIC_DEV_RST_ABTS_PENDING BIT(21) /* -* Usage of the scsi_cmnd scratchpad. +* fnic private data per SCSI command. * These fields are locked by the hashed io_req_lock. */ -#define CMD_SP (Cmnd) ((Cmnd)->SCp.ptr) -#define CMD_STATE (Cmnd) ((Cmnd)->SCp.phase) -#define CMD_ABTS_STATUS (Cmnd) ((Cmnd)->SCp.Message) -#define CMD_LR_STATUS (Cmnd) ((Cmnd)->SCp.have_data_in) -#define CMD_TAG (Cmnd) ((Cmnd)->SCp.sent_command) -#define CMD_FLAGS (Cmnd) ((Cmnd)->SCp.Status) +struct fnic_cmd_priv { + struct fnic_io_req *io_req; + enum fnic_ioreq_state state; + u32 flags; + u16 abts_status; + u16 lr_status; +}; + +static inline struct fnic_cmd_priv *fnic_priv (struct scsi_cmnd *cmd) +{ + return scsi_cmd_priv(cmd); +} + +static inline u64 fnic_flags_and_state (struct scsi_cmnd *cmd) +{ + struct fnic_cmd_priv *fcmd = fnic_priv(cmd); + + return ((u64)fcmd->flags << 32) | fcmd->state; +} #define FCPIO_INVALID_CODE 0x100 /* hdr_status value unused by firmware */drivers/scsi/fnic/fnic_main.c +1
-0@@ -124,6 +124,7 @@ static struct scsi_host_template fnic_host_template = { .max_sectors = 0xffff, .shost_groups = fnic_host_groups, .track_queue_depth = 1, + .cmd_size = sizeof(struct fnic_cmd_priv), };static void
drivers/scsi/fnic/fnic_scsi.c +0
-0@@ -497,8 +497,8 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc) * caller disabling them.
Quoted 8 lines
drivers/scsi/fnic/fnic_scsi.c static int fnic_queuecommand_lck(struct scsi_cmnd *sc) · line 501
Quoted 6 lines
drivers/scsi/fnic/fnic_scsi.c +2
-2*/ spin_unlock(lp->host->host_lock); - CMD_STATE(sc) = FNIC_IOREQ_NOT_INITED; - CMD_FLAGS(sc) = FNIC_NO_FLAGS; + fnic_priv(sc)->state = FNIC_IOREQ_NOT_INITED; + fnic_priv(sc)->flags = FNIC_NO_FLAGS;Why not keep the macros?
Would be less churn with the driver, no?
Keeping the macros would indeed make this patch smaller. My opinion is that the CMD_STATE() and CMD_FLAGS() macro definitions are too short to keep them and that expanding these macros makes the driver code easier to read.
Thanks,
Bart.
Re: [PATCH v2 19/44] fnic: Stop using the SCSI pointer
Quoted 79 lines · Bart Van Assche
Quoted 69 lines · Hannes Reinecke
Quoted 68 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/fnic/fnic.h | 27 +++-drivers/scsi/fnic/fnic_main.c| 1 +drivers/scsi/fnic/fnic_scsi.c| 289 +++++++++++++++++-----------------3 files changed, 163 insertions(+), 154 deletions(-)drivers/scsi/fnic/fnic.h +20
-7@@ -89,15 +89,28 @@ #define FNIC_DEV_RST_ABTS_PENDING BIT(21) /* -* Usage of the scsi_cmnd scratchpad. +* fnic private data per SCSI command. * These fields are locked by the hashed io_req_lock. */ -#define CMD_SP (Cmnd) ((Cmnd)->SCp.ptr) -#define CMD_STATE (Cmnd) ((Cmnd)->SCp.phase) -#define CMD_ABTS_STATUS (Cmnd) ((Cmnd)->SCp.Message) -#define CMD_LR_STATUS (Cmnd) ((Cmnd)->SCp.have_data_in) -#define CMD_TAG (Cmnd) ((Cmnd)->SCp.sent_command) -#define CMD_FLAGS (Cmnd) ((Cmnd)->SCp.Status) +struct fnic_cmd_priv { + struct fnic_io_req *io_req; + enum fnic_ioreq_state state; + u32 flags; + u16 abts_status; + u16 lr_status; +}; + +static inline struct fnic_cmd_priv *fnic_priv (struct scsi_cmnd *cmd) +{ + return scsi_cmd_priv(cmd); +} + +static inline u64 fnic_flags_and_state (struct scsi_cmnd *cmd) +{ + struct fnic_cmd_priv *fcmd = fnic_priv(cmd); + + return ((u64)fcmd->flags << 32) | fcmd->state; +} #define FCPIO_INVALID_CODE 0x100 /* hdr_status value unused by firmware */drivers/scsi/fnic/fnic_main.c +1
-0@@ -124,6 +124,7 @@ static struct scsi_host_template fnic_host_template = { .max_sectors = 0xffff, .shost_groups = fnic_host_groups, .track_queue_depth = 1, + .cmd_size = sizeof(struct fnic_cmd_priv), };static void
drivers/scsi/fnic/fnic_scsi.c +0
-0@@ -497,8 +497,8 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc) * caller disabling them.Quoted 8 lines
drivers/scsi/fnic/fnic_scsi.c static int fnic_queuecommand_lck(struct scsi_cmnd *sc) · line 501
Quoted 6 lines
drivers/scsi/fnic/fnic_scsi.c +2
-2*/ spin_unlock(lp->host->host_lock); - CMD_STATE(sc) = FNIC_IOREQ_NOT_INITED; - CMD_FLAGS(sc) = FNIC_NO_FLAGS; + fnic_priv(sc)->state = FNIC_IOREQ_NOT_INITED; + fnic_priv(sc)->flags = FNIC_NO_FLAGS;Why not keep the macros?
Would be less churn with the driver, no?
Quoted 2 lines
Keeping the macros would indeed make this patch smaller. My opinion is that the
CMD_STATE()andCMD_FLAGS()macro definitions are too short to keep them and that expanding these macros makes the driver code easier to read.
Fair enough.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 19/44] fnic: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 950 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/fnic/fnic.h | 27 +++- drivers/scsi/fnic/fnic_main.c | 1 + drivers/scsi/fnic/fnic_scsi.c | 289 +++++++++++++++++----------------- 3 files changed, 163 insertions(+), 154 deletions(-)drivers/scsi/fnic/fnic.h +20
-7@@ -89,15 +89,28 @@#define FNIC_DEV_RST_ABTS_PENDING BIT(21)/* -* Usage of the scsi_cmnd scratchpad. +* fnic private data per SCSI command. * These fields are locked by the hashed io_req_lock. */ -#define CMD_SP (Cmnd) ((Cmnd)->SCp.ptr) -#define CMD_STATE (Cmnd) ((Cmnd)->SCp.phase) -#define CMD_ABTS_STATUS (Cmnd) ((Cmnd)->SCp.Message) -#define CMD_LR_STATUS (Cmnd) ((Cmnd)->SCp.have_data_in) -#define CMD_TAG (Cmnd) ((Cmnd)->SCp.sent_command) -#define CMD_FLAGS (Cmnd) ((Cmnd)->SCp.Status) +struct fnic_cmd_priv { +struct fnic_io_req *io_req; +enum fnic_ioreq_state state; +u32 flags; +u16 abts_status; +u16 lr_status; +}; + +static inline struct fnic_cmd_priv *fnic_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} + +static inline u64 fnic_flags_and_state (struct scsi_cmnd *cmd) +{ +struct fnic_cmd_priv *fcmd =fnic_priv (cmd); + +return ((u64 )fcmd->flags <<32 ) | fcmd->state; +}#define FCPIO_INVALID_CODE 0x100/* hdr_status value unused by firmware */ drivers/scsi/fnic/fnic_main.c +1
-0@@ -124,6 +124,7 @@ static struct scsi_host_template fnic_host_template = { .max_sectors = 0xffff, .shost_groups = fnic_host_groups, .track_queue_depth = 1, + .cmd_size = sizeof(struct fnic_cmd_priv), };static void
drivers/scsi/fnic/fnic_scsi.c +11
-12@@ -497,8 +497,8 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)* caller disabling them. */ spin_unlock (lp->host->host_lock); -CMD_STATE (sc) =FNIC_IOREQ_NOT_INITED ; -CMD_FLAGS (sc) =FNIC_NO_FLAGS ; +fnic_priv (sc)->state =FNIC_IOREQ_NOT_INITED ; +fnic_priv (sc)->flags =FNIC_NO_FLAGS ;/* Get a new io_req for this SCSI IO */ io_req =mempool_alloc (fnic->io_req_pool,GFP_ATOMIC );@@ -513,7 +513,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc) sg_count =scsi_dma_map (sc);if (sg_count <0 ) {FNIC_TRACE (fnic_queuecommand, sc->device->host->host_no, - tag, sc,0 , sc->cmnd[0 ], sg_count,CMD_STATE (sc)); + tag, sc,0 , sc->cmnd[0 ], sg_count,fnic_priv (sc)->state);mempool_free (io_req, fnic->io_req_pool); goto out; }@@ -558,9 +558,9 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc) io_lock_acquired =1 ; io_req->port_id = rport->port_id; io_req->start_time = jiffies; -CMD_STATE (sc) =FNIC_IOREQ_CMD_PENDING ; -CMD_SP (sc) = (char *)io_req; -CMD_FLAGS (sc) |=FNIC_IO_INITIALIZED ; +fnic_priv (sc)->state =FNIC_IOREQ_CMD_PENDING ; +fnic_priv (sc)->io_req = io_req; +fnic_priv (sc)->flags |=FNIC_IO_INITIALIZED ;/* create copy wq desc and enqueue it */ wq = &fnic->wq_copy[0 ];@@ -571,11 +571,10 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)* refetch the pointer under the lock. */ FNIC_TRACE (fnic_queuecommand, sc->device->host->host_no, - tag, sc,0 ,0 ,0 , - (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc))); - io_req = (struct fnic_io_req *)CMD_SP (sc); -CMD_SP (sc) =NULL ; -CMD_STATE (sc) =FNIC_IOREQ_CMD_COMPLETE ; + tag, sc,0 ,0 ,0 ,fnic_flags_and_state (sc)); + io_req =fnic_priv (sc)->io_req; +fnic_priv (sc)->io_req =NULL ; +fnic_priv (sc)->state =FNIC_IOREQ_CMD_COMPLETE ;spin_unlock_irqrestore (io_lock, flags);if (io_req) {fnic_release_ioreq_buf (fnic, io_req, sc);@@ -594,7 +593,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc) atomic64_read(&fnic_stats->io_stats.active_ios));/* REVISIT: Use per IO lock in the final code */ -CMD_FLAGS (sc) |=FNIC_IO_ISSUED ; +fnic_priv (sc)->flags |=FNIC_IO_ISSUED ; }out:
cmd_trace = ((u64)sc->cmnd[0] << 56 | (u64)sc->cmnd[7] << 40 |drivers/scsi/fnic/fnic_scsi.c +126
-130@@ -603,8 +602,8 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc) sc->cmnd[5]);FNIC_TRACE (fnic_queuecommand, sc->device->host->host_no, - tag, sc, io_req, sg_count, cmd_trace, - (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc))); + tag, sc, io_req, sg_count, cmd_trace, +fnic_flags_and_state (sc));/* if only we issued IO, will we have the io lock */ if (io_lock_acquired)@@ -867,11 +866,11 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic, io_lock =fnic_io_lock_hash (fnic, sc);spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;WARN_ON_ONCE (!io_req);if (!io_req) {atomic64_inc (&fnic_stats->io_stats.ioreq_null); -CMD_FLAGS (sc) |=FNIC_IO_REQ_NULL ; +fnic_priv (sc)->flags |=FNIC_IO_REQ_NULL ;spin_unlock_irqrestore (io_lock, flags);shost_printk (KERN_ERR , fnic->lport->host, "icmnd_cmpl io_req is null - "@@ -888,17 +887,17 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,* if SCSI-ML has already issued abort on this command, * set completion of the IO. The abts path will clean it up */ -if (CMD_STATE (sc) ==FNIC_IOREQ_ABTS_PENDING ) { +if (fnic_priv (sc)->state ==FNIC_IOREQ_ABTS_PENDING ) {/* * set the FNIC_IO_DONE so that this doesn't get * flagged as 'out of order' if it was not aborted */ -CMD_FLAGS (sc) |=FNIC_IO_DONE ; -CMD_FLAGS (sc) |=FNIC_IO_ABTS_PENDING ; +fnic_priv (sc)->flags |=FNIC_IO_DONE ; +fnic_priv (sc)->flags |=FNIC_IO_ABTS_PENDING ;spin_unlock_irqrestore (io_lock, flags);if (FCPIO_ABORTED == hdr_status) -CMD_FLAGS (sc) |=FNIC_IO_ABORTED ; +fnic_priv (sc)->flags |=FNIC_IO_ABORTED ;FNIC_SCSI_DBG (KERN_INFO , fnic->lport->host, "icmnd_cmpl abts pending "@@ -912,7 +911,7 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic, }/* Mark the IO as complete */ -CMD_STATE (sc) =FNIC_IOREQ_CMD_COMPLETE ; +fnic_priv (sc)->state =FNIC_IOREQ_CMD_COMPLETE ; icmnd_cmpl = &desc->u.icmnd_cmpl;@@ -983,8 +982,8 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic, }/* Break link with the SCSI command */ -CMD_SP (sc) =NULL ; -CMD_FLAGS (sc) |=FNIC_IO_DONE ; +fnic_priv (sc)->io_req =NULL ; +fnic_priv (sc)->flags |=FNIC_IO_DONE ;spin_unlock_irqrestore (io_lock, flags);@@ -1009,8 +1008,7 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic, ((u64 )icmnd_cmpl->_resvd0[1 ] <<56 | (u64 )icmnd_cmpl->_resvd0[0 ] <<48 |jiffies_to_msecs (jiffies - start_time)), - desc, cmd_trace, - (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc))); + desc, cmd_trace, fnic_flags_and_state(sc));if (sc->sc_data_direction ==DMA_FROM_DEVICE ) { fnic->lport->host_stats.fcp_input_requests++;@@ -1095,12 +1093,12 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, } io_lock =fnic_io_lock_hash (fnic, sc);spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;WARN_ON_ONCE (!io_req);if (!io_req) {atomic64_inc (&fnic_stats->io_stats.ioreq_null);spin_unlock_irqrestore (io_lock, flags); -CMD_FLAGS (sc) |=FNIC_IO_ABT_TERM_REQ_NULL ; +fnic_priv (sc)->flags |=FNIC_IO_ABT_TERM_REQ_NULL ; shost_printk(KERN_ERR, fnic->lport->host, "itmf_cmpl io_req is null - " "hdr status = %s tag = 0x%x sc 0x%p\n",@@ -1115,9 +1113,9 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"dev reset abts cmpl recd. id %x status %s\n" , id,fnic_fcpio_status_to_str (hdr_status)); -CMD_STATE (sc) =FNIC_IOREQ_ABTS_COMPLETE ; -CMD_ABTS_STATUS (sc) = hdr_status; -CMD_FLAGS (sc) |=FNIC_DEV_RST_DONE ; +fnic_priv (sc)->state =FNIC_IOREQ_ABTS_COMPLETE ; +fnic_priv (sc)->abts_status = hdr_status; +fnic_priv (sc)->flags |=FNIC_DEV_RST_DONE ;if (io_req->abts_done)complete (io_req->abts_done);spin_unlock_irqrestore (io_lock, flags);@@ -1127,7 +1125,7 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,case FCPIO_SUCCESS :break ;case FCPIO_TIMEOUT : -if (CMD_FLAGS (sc) &FNIC_IO_ABTS_ISSUED ) +if (fnic_priv (sc)->flags &FNIC_IO_ABTS_ISSUED )atomic64_inc (&abts_stats->abort_fw_timeouts);else atomic64_inc(@@ -1139,34 +1137,34 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, (int)(id & FNIC_TAG_MASK));break ;case FCPIO_IO_NOT_FOUND : -if (CMD_FLAGS (sc) &FNIC_IO_ABTS_ISSUED ) +if (fnic_priv (sc)->flags &FNIC_IO_ABTS_ISSUED )atomic64_inc (&abts_stats->abort_io_not_found);else atomic64_inc ( &term_stats->terminate_io_not_found);break ;default : -if (CMD_FLAGS (sc) &FNIC_IO_ABTS_ISSUED ) +if (fnic_priv (sc)->flags &FNIC_IO_ABTS_ISSUED )atomic64_inc (&abts_stats->abort_failures);else atomic64_inc ( &term_stats->terminate_failures);break ; } -if (CMD_STATE (sc) !=FNIC_IOREQ_ABTS_PENDING ) { +if (fnic_priv (sc)->state !=FNIC_IOREQ_ABTS_PENDING ) {/* This is a late completion. Ignore it */ spin_unlock_irqrestore (io_lock, flags);return ; } -CMD_FLAGS (sc) |=FNIC_IO_ABT_TERM_DONE ; -CMD_ABTS_STATUS (sc) = hdr_status; +fnic_priv (sc)->flags |=FNIC_IO_ABT_TERM_DONE ; +fnic_priv (sc)->abts_status = hdr_status;/* If the status is IO not found consider it as success */ if (hdr_status ==FCPIO_IO_NOT_FOUND ) -CMD_ABTS_STATUS (sc) =FCPIO_SUCCESS ; +fnic_priv (sc)->abts_status =FCPIO_SUCCESS ; -if (!(CMD_FLAGS (sc) & (FNIC_IO_ABORTED |FNIC_IO_DONE ))) +if (!(fnic_priv (sc)->flags & (FNIC_IO_ABORTED |FNIC_IO_DONE )))atomic64_inc (&misc_stats->no_icmnd_itmf_cmpls); FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,@@ -1185,7 +1183,7 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, }else {FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"abts cmpl, completing IO\n" ); -CMD_SP (sc) =NULL ; +fnic_priv (sc)->io_req =NULL ; sc->result = (DID_ERROR <<16 );spin_unlock_irqrestore (io_lock, flags);@@ -1202,8 +1200,7 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, (u64 )sc->cmnd[2 ] <<24 | (u64 )sc->cmnd[3 ] <<16 | (u64)sc->cmnd[4] << 8 | sc->cmnd[5]), - (((u64 )CMD_FLAGS (sc) <<32 ) | - CMD_STATE(sc))); + fnic_flags_and_state(sc));scsi_done (sc);atomic64_dec (&fnic_stats->io_stats.active_ios);if (atomic64_read (&fnic->io_cmpl_skip))@@ -1213,15 +1210,14 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, } }else if (id &FNIC_TAG_DEV_RST ) {/* Completion of device reset */ -CMD_LR_STATUS (sc) = hdr_status; -if (CMD_STATE (sc) ==FNIC_IOREQ_ABTS_PENDING ) { +fnic_priv (sc)->lr_status = hdr_status; +if (fnic_priv (sc)->state ==FNIC_IOREQ_ABTS_PENDING ) {spin_unlock_irqrestore (io_lock, flags); -CMD_FLAGS (sc) |=FNIC_DEV_RST_ABTS_PENDING ; +fnic_priv (sc)->flags |=FNIC_DEV_RST_ABTS_PENDING ;FNIC_TRACE (fnic_fcpio_itmf_cmpl_handler, sc->device->host->host_no, id, sc,jiffies_to_msecs (jiffies - start_time), - desc,0 , - (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc))); + desc,0 ,fnic_flags_and_state (sc)); FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "Terminate pending " "dev reset cmpl recd. id %d status %s\n",@@ -1229,14 +1225,13 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, fnic_fcpio_status_to_str(hdr_status));return ; } -if (CMD_FLAGS (sc) &FNIC_DEV_RST_TIMED_OUT ) { +if (fnic_priv (sc)->flags &FNIC_DEV_RST_TIMED_OUT ) {/* Need to wait for terminate completion */ spin_unlock_irqrestore (io_lock, flags);FNIC_TRACE (fnic_fcpio_itmf_cmpl_handler, sc->device->host->host_no, id, sc,jiffies_to_msecs (jiffies - start_time), - desc,0 , - (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc))); + desc,0 ,fnic_flags_and_state (sc)); FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "dev reset cmpl recd after time out. " "id %d status %s\n",@@ -1244,8 +1239,8 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, fnic_fcpio_status_to_str(hdr_status));return ; } -CMD_STATE (sc) =FNIC_IOREQ_CMD_COMPLETE ; -CMD_FLAGS (sc) |=FNIC_DEV_RST_DONE ; +fnic_priv (sc)->state =FNIC_IOREQ_CMD_COMPLETE ; +fnic_priv (sc)->flags |=FNIC_DEV_RST_DONE ; FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "dev reset cmpl recd. id %d status %s\n", (int)(id & FNIC_TAG_MASK),@@ -1257,7 +1252,7 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, }else {shost_printk (KERN_ERR , fnic->lport->host,"Unexpected itmf io state %s tag %x\n" , -fnic_ioreq_state_to_str (CMD_STATE (sc)), id); +fnic_ioreq_state_to_str (fnic_priv (sc)->state), id);spin_unlock_irqrestore (io_lock, flags); }@@ -1370,21 +1365,21 @@ static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data, io_lock =fnic_io_lock_tag (fnic, tag);spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); -if ((CMD_FLAGS (sc) &FNIC_DEVICE_RESET ) && - !(CMD_FLAGS (sc) &FNIC_DEV_RST_DONE )) { + io_req =fnic_priv (sc)->io_req; +if ((fnic_priv (sc)->flags &FNIC_DEVICE_RESET ) && + !(fnic_priv (sc)->flags &FNIC_DEV_RST_DONE )) {/* * We will be here only when FW completes reset * without sending completions for outstanding ios. */ -CMD_FLAGS (sc) |=FNIC_DEV_RST_DONE ; +fnic_priv (sc)->flags |=FNIC_DEV_RST_DONE ;if (io_req && io_req->dr_done)complete (io_req->dr_done);else if (io_req && io_req->abts_done)complete (io_req->abts_done);spin_unlock_irqrestore (io_lock, flags);return true; - }else if (CMD_FLAGS (sc) &FNIC_DEVICE_RESET ) { + }else if (fnic_priv (sc)->flags &FNIC_DEVICE_RESET ) {spin_unlock_irqrestore (io_lock, flags);return true; }@@ -1393,7 +1388,7 @@ static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data, goto cleanup_scsi_cmd; } -CMD_SP (sc) =NULL ; +fnic_priv (sc)->io_req =NULL ;spin_unlock_irqrestore (io_lock, flags);@@ -1417,7 +1412,7 @@ static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data,atomic64_inc (&fnic_stats->io_stats.io_completions);/* Complete the command to SCSI */ -if (!(CMD_FLAGS (sc) &FNIC_IO_ISSUED )) +if (!(fnic_priv (sc)->flags &FNIC_IO_ISSUED ))shost_printk (KERN_ERR , fnic->lport->host,"Calling done for IO not issued to fw: tag:0x%x sc:0x%p\n" , tag, sc);@@ -1429,7 +1424,7 @@ static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data, (u64 )sc->cmnd[2 ] <<24 | (u64 )sc->cmnd[3 ] <<16 | (u64)sc->cmnd[4] << 8 | sc->cmnd[5]), - (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc))); + fnic_flags_and_state(sc));scsi_done (sc);@@ -1468,7 +1463,7 @@ void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,spin_lock_irqsave (io_lock, flags);/* Get the IO context which this desc refers to */ - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;/* fnic interrupts are turned off by now */ @@ -1477,7 +1472,7 @@ void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq, goto wq_copy_cleanup_scsi_cmd; } -CMD_SP (sc) =NULL ; +fnic_priv (sc)->io_req =NULL ;spin_unlock_irqrestore (io_lock, flags);@@ -1496,7 +1491,7 @@ void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,0 , ((u64 )sc->cmnd[0 ] <<32 | (u64 )sc->cmnd[2 ] <<24 | (u64 )sc->cmnd[3 ] <<16 | (u64 )sc->cmnd[4 ] <<8 | sc->cmnd[5 ]), - (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc))); + fnic_flags_and_state(sc));scsi_done (sc); }@@ -1571,15 +1566,15 @@ static bool fnic_rport_abort_io_iter(struct scsi_cmnd *sc, void *data, io_lock =fnic_io_lock_tag (fnic, abt_tag);spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;if (!io_req || io_req->port_id != iter_data->port_id) {spin_unlock_irqrestore (io_lock, flags);return true; } -if ((CMD_FLAGS (sc) &FNIC_DEVICE_RESET ) && - (!(CMD_FLAGS (sc) &FNIC_DEV_RST_ISSUED ))) { +if ((fnic_priv (sc)->flags &FNIC_DEVICE_RESET ) && + !(fnic_priv (sc)->flags &FNIC_DEV_RST_ISSUED )) {FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"fnic_rport_exch_reset dev rst not pending sc 0x%p\n" , sc);@@ -1591,7 +1586,7 @@ static bool fnic_rport_abort_io_iter(struct scsi_cmnd *sc, void *data,* Found IO that is still pending with firmware and * belongs to rport that went away */ -if (CMD_STATE (sc) ==FNIC_IOREQ_ABTS_PENDING ) { +if (fnic_priv (sc)->state ==FNIC_IOREQ_ABTS_PENDING ) {spin_unlock_irqrestore (io_lock, flags);return true; }@@ -1599,20 +1594,20 @@ static bool fnic_rport_abort_io_iter(struct scsi_cmnd *sc, void *data,shost_printk (KERN_ERR , fnic->lport->host,"fnic_rport_exch_reset: io_req->abts_done is set " "state is %s\n" , -fnic_ioreq_state_to_str (CMD_STATE (sc))); +fnic_ioreq_state_to_str (fnic_priv (sc)->state)); } -if (!(CMD_FLAGS (sc) &FNIC_IO_ISSUED )) { +if (!(fnic_priv (sc)->flags &FNIC_IO_ISSUED )) {shost_printk (KERN_ERR , fnic->lport->host,"rport_exch_reset " "IO not yet issued %p tag 0x%x flags " "%x state %d\n" , - sc, abt_tag,CMD_FLAGS (sc),CMD_STATE (sc)); + sc, abt_tag,fnic_priv (sc)->flags,fnic_priv (sc)->state); } - old_ioreq_state =CMD_STATE (sc); -CMD_STATE (sc) =FNIC_IOREQ_ABTS_PENDING ; -CMD_ABTS_STATUS (sc) =FCPIO_INVALID_CODE ; -if (CMD_FLAGS (sc) &FNIC_DEVICE_RESET ) { + old_ioreq_state =fnic_priv (sc)->state; +fnic_priv (sc)->state =FNIC_IOREQ_ABTS_PENDING ; +fnic_priv (sc)->abts_status =FCPIO_INVALID_CODE ; +if (fnic_priv (sc)->flags &FNIC_DEVICE_RESET ) {atomic64_inc (&reset_stats->device_reset_terminates); abt_tag |=FNIC_TAG_DEV_RST ; }@@ -1638,15 +1633,15 @@ static bool fnic_rport_abort_io_iter(struct scsi_cmnd *sc, void *data,* lun reset */ spin_lock_irqsave (io_lock, flags); -if (CMD_STATE (sc) ==FNIC_IOREQ_ABTS_PENDING ) -CMD_STATE (sc) = old_ioreq_state; +if (fnic_priv (sc)->state ==FNIC_IOREQ_ABTS_PENDING ) +fnic_priv (sc)->state = old_ioreq_state;spin_unlock_irqrestore (io_lock, flags); }else {spin_lock_irqsave (io_lock, flags); -if (CMD_FLAGS (sc) &FNIC_DEVICE_RESET ) -CMD_FLAGS (sc) |=FNIC_DEV_RST_TERM_ISSUED ; +if (fnic_priv (sc)->flags &FNIC_DEVICE_RESET ) +fnic_priv (sc)->flags |=FNIC_DEV_RST_TERM_ISSUED ;else -CMD_FLAGS (sc) |=FNIC_IO_INTERNAL_TERM_ISSUED ; +fnic_priv (sc)->flags |=FNIC_IO_INTERNAL_TERM_ISSUED ;spin_unlock_irqrestore (io_lock, flags);atomic64_inc (&term_stats->terminates); iter_data->term_cnt++;@@ -1754,9 +1749,9 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"Abort Cmd called FCID 0x%x, LUN 0x%llx TAG %x flags %x\n" , - rport->port_id, sc->device->lun, tag,CMD_FLAGS (sc)); + rport->port_id, sc->device->lun, tag,fnic_priv (sc)->flags); -CMD_FLAGS (sc) =FNIC_NO_FLAGS ; +fnic_priv (sc)->flags =FNIC_NO_FLAGS ;if (lp->state !=LPORT_ST_READY || !(lp->link_up)) { ret =FAILED ;@@ -1773,11 +1768,11 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)* happened, the completion wont actually complete the command * and it will be considered as an aborted command * -* The CMD_SP will not be cleared except while holding io_req_lock. +* .io_req will not be cleared except while holding io_req_lock. */ io_lock =fnic_io_lock_hash (fnic, sc);spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;if (!io_req) {spin_unlock_irqrestore (io_lock, flags); goto fnic_abort_cmd_end;@@ -1785,7 +1780,7 @@ int fnic_abort_cmd(struct scsi_cmnd *sc) io_req->abts_done = &tm_done; -if (CMD_STATE (sc) ==FNIC_IOREQ_ABTS_PENDING ) { +if (fnic_priv (sc)->state ==FNIC_IOREQ_ABTS_PENDING ) {spin_unlock_irqrestore (io_lock, flags); goto wait_pending; }@@ -1814,9 +1809,9 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)* the completion wont be done till mid-layer, since abort * has already started. */ - old_ioreq_state =CMD_STATE (sc); -CMD_STATE (sc) =FNIC_IOREQ_ABTS_PENDING ; -CMD_ABTS_STATUS (sc) =FCPIO_INVALID_CODE ; + old_ioreq_state =fnic_priv (sc)->state; +fnic_priv (sc)->state =FNIC_IOREQ_ABTS_PENDING ; +fnic_priv (sc)->abts_status =FCPIO_INVALID_CODE ;spin_unlock_irqrestore (io_lock, flags);@@ -1838,9 +1833,9 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)if (fnic_queue_abort_io_req (fnic, tag, task_req, fc_lun.scsi_lun, io_req)) {spin_lock_irqsave (io_lock, flags); -if (CMD_STATE (sc) ==FNIC_IOREQ_ABTS_PENDING ) -CMD_STATE (sc) = old_ioreq_state; - io_req = (struct fnic_io_req *)CMD_SP (sc); +if (fnic_priv (sc)->state ==FNIC_IOREQ_ABTS_PENDING ) +fnic_priv (sc)->state = old_ioreq_state; + io_req =fnic_priv (sc)->io_req;if (io_req) io_req->abts_done =NULL ;spin_unlock_irqrestore (io_lock, flags);@@ -1848,10 +1843,10 @@ int fnic_abort_cmd(struct scsi_cmnd *sc) goto fnic_abort_cmd_end; }if (task_req ==FCPIO_ITMF_ABT_TASK ) { -CMD_FLAGS (sc) |=FNIC_IO_ABTS_ISSUED ; +fnic_priv (sc)->flags |=FNIC_IO_ABTS_ISSUED ;atomic64_inc (&fnic_stats->abts_stats.aborts); }else { -CMD_FLAGS (sc) |=FNIC_IO_TERM_ISSUED ; +fnic_priv (sc)->flags |=FNIC_IO_TERM_ISSUED ;atomic64_inc (&fnic_stats->term_stats.terminates); }@@ -1869,32 +1864,32 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)/* Check the abort status */ spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;if (!io_req) {atomic64_inc (&fnic_stats->io_stats.ioreq_null);spin_unlock_irqrestore (io_lock, flags); -CMD_FLAGS (sc) |=FNIC_IO_ABT_TERM_REQ_NULL ; +fnic_priv (sc)->flags |=FNIC_IO_ABT_TERM_REQ_NULL ; ret =FAILED ; goto fnic_abort_cmd_end; } io_req->abts_done =NULL ;/* fw did not complete abort, timed out */ -if (CMD_ABTS_STATUS (sc) ==FCPIO_INVALID_CODE ) { +if (fnic_priv (sc)->abts_status ==FCPIO_INVALID_CODE ) {spin_unlock_irqrestore (io_lock, flags);if (task_req ==FCPIO_ITMF_ABT_TASK ) {atomic64_inc (&abts_stats->abort_drv_timeouts); }else {atomic64_inc (&term_stats->terminate_drv_timeouts); } -CMD_FLAGS (sc) |=FNIC_IO_ABT_TERM_TIMED_OUT ; +fnic_priv (sc)->flags |=FNIC_IO_ABT_TERM_TIMED_OUT ; ret =FAILED ; goto fnic_abort_cmd_end; }/* IO out of order */ -if (!(CMD_FLAGS (sc) & (FNIC_IO_ABORTED |FNIC_IO_DONE ))) { +if (!(fnic_priv (sc)->flags & (FNIC_IO_ABORTED |FNIC_IO_DONE ))) {spin_unlock_irqrestore (io_lock, flags);FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"Issuing Host reset due to out of order IO\n" );@@ -1903,7 +1898,7 @@ int fnic_abort_cmd(struct scsi_cmnd *sc) goto fnic_abort_cmd_end; } -CMD_STATE (sc) =FNIC_IOREQ_ABTS_COMPLETE ; +fnic_priv (sc)->state =FNIC_IOREQ_ABTS_COMPLETE ; start_time = io_req->start_time;/* @@ -1911,9 +1906,9 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)* free the io_req if successful. If abort fails, * Device reset will clean the I/O. */ -if (CMD_ABTS_STATUS (sc) ==FCPIO_SUCCESS ) -CMD_SP (sc) =NULL ; -else { +if (fnic_priv (sc)->abts_status ==FCPIO_SUCCESS ) { +fnic_priv (sc)->io_req =NULL ; + }else { ret =FAILED ;spin_unlock_irqrestore (io_lock, flags); goto fnic_abort_cmd_end;@@ -1939,7 +1934,7 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)0 , ((u64 )sc->cmnd[0 ] <<32 | (u64 )sc->cmnd[2 ] <<24 | (u64 )sc->cmnd[3 ] <<16 | (u64 )sc->cmnd[4 ] <<8 | sc->cmnd[5 ]), - (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc))); + fnic_flags_and_state(sc)); FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "Returning from abort cmd type %x %s\n", task_req,@@ -2030,7 +2025,7 @@ static bool fnic_pending_aborts_iter(struct scsi_cmnd *sc, io_lock =fnic_io_lock_tag (fnic, abt_tag);spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;if (!io_req) {spin_unlock_irqrestore (io_lock, flags);return true;@@ -2042,14 +2037,14 @@ static bool fnic_pending_aborts_iter(struct scsi_cmnd *sc,*/ FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"Found IO in %s on lun\n" , -fnic_ioreq_state_to_str (CMD_STATE (sc))); +fnic_ioreq_state_to_str (fnic_priv (sc)->state)); -if (CMD_STATE (sc) ==FNIC_IOREQ_ABTS_PENDING ) { +if (fnic_priv (sc)->state ==FNIC_IOREQ_ABTS_PENDING ) {spin_unlock_irqrestore (io_lock, flags);return true; } -if ((CMD_FLAGS (sc) &FNIC_DEVICE_RESET ) && - (!(CMD_FLAGS (sc) &FNIC_DEV_RST_ISSUED ))) { +if ((fnic_priv (sc)->flags &FNIC_DEVICE_RESET ) && + (!(fnic_priv (sc)->flags &FNIC_DEV_RST_ISSUED ))) {FNIC_SCSI_DBG (KERN_INFO , fnic->lport->host,"%s dev rst not pending sc 0x%p\n" , __func__, sc);@@ -2060,8 +2055,8 @@ static bool fnic_pending_aborts_iter(struct scsi_cmnd *sc,if (io_req->abts_done)shost_printk (KERN_ERR , fnic->lport->host,"%s: io_req->abts_done is set state is %s\n" , - __func__,fnic_ioreq_state_to_str (CMD_STATE (sc))); - old_ioreq_state =CMD_STATE (sc); + __func__,fnic_ioreq_state_to_str (fnic_priv (sc)->state)); + old_ioreq_state =fnic_priv (sc)->state;/* * Any pending IO issued prior to reset is expected to be * in abts pending state, if not we need to set @@ -2069,17 +2064,17 @@ static bool fnic_pending_aborts_iter(struct scsi_cmnd *sc,* When IO is completed, the IO will be handed over and * handled in this function. */ -CMD_STATE (sc) =FNIC_IOREQ_ABTS_PENDING ; +fnic_priv (sc)->state =FNIC_IOREQ_ABTS_PENDING ;BUG_ON (io_req->abts_done); -if (CMD_FLAGS (sc) &FNIC_DEVICE_RESET ) { +if (fnic_priv (sc)->flags &FNIC_DEVICE_RESET ) { abt_tag |=FNIC_TAG_DEV_RST ;FNIC_SCSI_DBG (KERN_INFO , fnic->lport->host,"%s: dev rst sc 0x%p\n" , __func__, sc); } -CMD_ABTS_STATUS (sc) =FCPIO_INVALID_CODE ; +fnic_priv (sc)->abts_status =FCPIO_INVALID_CODE ; io_req->abts_done = &tm_done;spin_unlock_irqrestore (io_lock, flags);@@ -2090,48 +2085,48 @@ static bool fnic_pending_aborts_iter(struct scsi_cmnd *sc, FCPIO_ITMF_ABT_TASK_TERM, fc_lun.scsi_lun, io_req)) {spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;if (io_req) io_req->abts_done =NULL ; -if (CMD_STATE (sc) ==FNIC_IOREQ_ABTS_PENDING ) -CMD_STATE (sc) = old_ioreq_state; +if (fnic_priv (sc)->state ==FNIC_IOREQ_ABTS_PENDING ) +fnic_priv (sc)->state = old_ioreq_state;spin_unlock_irqrestore (io_lock, flags); iter_data->ret =FAILED ;return false; } else {spin_lock_irqsave (io_lock ,flags ); -if (CMD_FLAGS (sc) &FNIC_DEVICE_RESET ) -CMD_FLAGS (sc) |=FNIC_DEV_RST_TERM_ISSUED ; +if (fnic_priv (sc)->flags &FNIC_DEVICE_RESET ) +fnic_priv (sc)->flags |=FNIC_DEV_RST_TERM_ISSUED ;spin_unlock_irqrestore (io_lock, flags); } -CMD_FLAGS (sc) |=FNIC_IO_INTERNAL_TERM_ISSUED ; +fnic_priv (sc)->flags |=FNIC_IO_INTERNAL_TERM_ISSUED ;wait_for_completion_timeout (&tm_done,msecs_to_jiffies (fnic->config.ed_tov));/* Recheck cmd state to check if it is now aborted */ spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;if (!io_req) {spin_unlock_irqrestore (io_lock, flags); -CMD_FLAGS (sc) |=FNIC_IO_ABT_TERM_REQ_NULL ; +fnic_priv (sc)->flags |=FNIC_IO_ABT_TERM_REQ_NULL ;return true; } io_req->abts_done =NULL ;/* if abort is still pending with fw, fail */ -if (CMD_ABTS_STATUS (sc) ==FCPIO_INVALID_CODE ) { +if (fnic_priv (sc)->abts_status ==FCPIO_INVALID_CODE ) {spin_unlock_irqrestore (io_lock, flags); -CMD_FLAGS (sc) |=FNIC_IO_ABT_TERM_DONE ; +fnic_priv (sc)->flags |=FNIC_IO_ABT_TERM_DONE ; iter_data->ret =FAILED ;return false; } -CMD_STATE (sc) =FNIC_IOREQ_ABTS_COMPLETE ; +fnic_priv (sc)->state =FNIC_IOREQ_ABTS_COMPLETE ;/* original sc used for lr is handled by dev reset code */ if (sc != iter_data->lr_sc) -CMD_SP (sc) =NULL ; +fnic_priv (sc)->io_req =NULL ;spin_unlock_irqrestore (io_lock, flags);/* original sc used for lr is handled by dev reset code */ @@ -2272,7 +2267,7 @@ int fnic_device_reset(struct scsi_cmnd *sc) goto fnic_device_reset_end; } -CMD_FLAGS (sc) =FNIC_DEVICE_RESET ; +fnic_priv (sc)->flags =FNIC_DEVICE_RESET ;/* Allocate tag if not present */ if (unlikely (tag <0 )) {@@ -2288,7 +2283,7 @@ int fnic_device_reset(struct scsi_cmnd *sc) } io_lock =fnic_io_lock_hash (fnic, sc);spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;/* * If there is a io_req attached to this command, then use it, @@ -2302,11 +2297,11 @@ int fnic_device_reset(struct scsi_cmnd *sc) }memset (io_req,0 ,sizeof (*io_req)); io_req->port_id = rport->port_id; -CMD_SP (sc) = (char *)io_req; +fnic_priv (sc)->io_req = io_req; } io_req->dr_done = &tm_done; -CMD_STATE (sc) =FNIC_IOREQ_CMD_PENDING ; -CMD_LR_STATUS (sc) =FCPIO_INVALID_CODE ; +fnic_priv (sc)->state =FNIC_IOREQ_CMD_PENDING ; +fnic_priv (sc)->lr_status =FCPIO_INVALID_CODE ;spin_unlock_irqrestore (io_lock, flags);FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"TAG %x\n" , tag);@@ -2317,13 +2312,13 @@ int fnic_device_reset(struct scsi_cmnd *sc)*/ if (fnic_queue_dr_io_req (fnic, sc, io_req)) {spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;if (io_req) io_req->dr_done =NULL ; goto fnic_device_reset_clean; }spin_lock_irqsave (io_lock, flags); -CMD_FLAGS (sc) |=FNIC_DEV_RST_ISSUED ; +fnic_priv (sc)->flags |=FNIC_DEV_RST_ISSUED ;spin_unlock_irqrestore (io_lock, flags);/* @@ -2334,7 +2329,7 @@ int fnic_device_reset(struct scsi_cmnd *sc) msecs_to_jiffies(FNIC_LUN_RESET_TIMEOUT));spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;if (!io_req) {spin_unlock_irqrestore (io_lock, flags); FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,@@ -2343,7 +2338,7 @@ int fnic_device_reset(struct scsi_cmnd *sc) } io_req->dr_done =NULL ; - status =CMD_LR_STATUS (sc); + status =fnic_priv (sc)->lr_status;/* * If lun reset not completed, bail out with failed. io_req @@ -2353,7 +2348,7 @@ int fnic_device_reset(struct scsi_cmnd *sc)atomic64_inc (&reset_stats->device_reset_timeouts);FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"Device reset timed out\n" ); -CMD_FLAGS (sc) |=FNIC_DEV_RST_TIMED_OUT ; +fnic_priv (sc)->flags |=FNIC_DEV_RST_TIMED_OUT ;spin_unlock_irqrestore (io_lock, flags);int_to_scsilun (sc->device->lun, &fc_lun);/* @@ -2362,7 +2357,7 @@ int fnic_device_reset(struct scsi_cmnd *sc)*/ while (1 ) {spin_lock_irqsave (io_lock, flags); -if (CMD_FLAGS (sc) &FNIC_DEV_RST_TERM_ISSUED ) { +if (fnic_priv (sc)->flags &FNIC_DEV_RST_TERM_ISSUED ) {spin_unlock_irqrestore (io_lock, flags);break ; }@@ -2375,8 +2370,8 @@ int fnic_device_reset(struct scsi_cmnd *sc) msecs_to_jiffies(FNIC_ABT_TERM_DELAY_TIMEOUT)); }else {spin_lock_irqsave (io_lock, flags); -CMD_FLAGS (sc) |=FNIC_DEV_RST_TERM_ISSUED ; -CMD_STATE (sc) =FNIC_IOREQ_ABTS_PENDING ; +fnic_priv (sc)->flags |=FNIC_DEV_RST_TERM_ISSUED ; +fnic_priv (sc)->state =FNIC_IOREQ_ABTS_PENDING ; io_req->abts_done = &tm_done;spin_unlock_irqrestore (io_lock, flags); FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,@@ -2387,13 +2382,13 @@ int fnic_device_reset(struct scsi_cmnd *sc) }while (1 ) {spin_lock_irqsave (io_lock, flags); -if (!(CMD_FLAGS (sc) &FNIC_DEV_RST_DONE )) { +if (!(fnic_priv (sc)->flags &FNIC_DEV_RST_DONE )) {spin_unlock_irqrestore (io_lock, flags);wait_for_completion_timeout (&tm_done,msecs_to_jiffies (FNIC_LUN_RESET_TIMEOUT ));break ; }else { - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req; io_req->abts_done =NULL ; goto fnic_device_reset_clean; }@@ -2408,7 +2403,7 @@ int fnic_device_reset(struct scsi_cmnd *sc)FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"Device reset completed - failed\n" ); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req; goto fnic_device_reset_clean; }@@ -2421,7 +2416,7 @@ int fnic_device_reset(struct scsi_cmnd *sc)*/ if (fnic_clean_pending_aborts (fnic, sc, new_sc)) {spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;FNIC_SCSI_DBG (KERN_DEBUG , fnic->lport->host,"Device reset failed" " since could not abort all IOs\n" );@@ -2430,14 +2425,14 @@ int fnic_device_reset(struct scsi_cmnd *sc)/* Clean lun reset command */ spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;if (io_req)/* Completed, and successful */ ret =SUCCESS ;
fnic_device_reset_clean:if (io_req)drivers/scsi/fnic/fnic_scsi.c +1
-1-CMD_SP (sc) =NULL ; +fnic_priv (sc)->io_req =NULL ;spin_unlock_irqrestore(io_lock, flags);drivers/scsi/fnic/fnic_scsi.c +2
-2@@ -2453,7 +2448,7 @@ int fnic_device_reset(struct scsi_cmnd *sc)0 , ((u64 )sc->cmnd[0 ] <<32 | (u64 )sc->cmnd[2 ] <<24 | (u64 )sc->cmnd[3 ] <<16 | (u64 )sc->cmnd[4 ] <<8 | sc->cmnd[5 ]), - (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc))); + fnic_flags_and_state(sc));/* free tag if it is allocated */ if (unlikely (tag_gen_flag))@@ -2698,7 +2693,7 @@ static bool fnic_abts_pending_iter(struct scsi_cmnd *sc, void *data, io_lock =fnic_io_lock_hash (fnic, sc);spin_lock_irqsave (io_lock, flags); - io_req = (struct fnic_io_req *)CMD_SP (sc); + io_req =fnic_priv (sc)->io_req;if (!io_req) {spin_unlock_irqrestore (io_lock, flags);return true;
drivers/scsi/fnic/fnic_scsi.c static bool fnic_abts_pending_iter(struct scsi_cmnd *sc, void *data, · line 2712
Quoted 10 lines
drivers/scsi/fnic/fnic_scsi.c +2
-2@@ -2710,8 +2705,8 @@ static bool fnic_abts_pending_iter(struct scsi_cmnd *sc, void *data,*/ FNIC_SCSI_DBG (KERN_INFO , fnic->lport->host,"Found IO in %s on lun\n" , -fnic_ioreq_state_to_str (CMD_STATE (sc))); - cmd_state =CMD_STATE (sc); +fnic_ioreq_state_to_str (fnic_priv (sc)->state)); + cmd_state =fnic_priv (sc)->state;spin_unlock_irqrestore (io_lock, flags);if (cmd_state ==FNIC_IOREQ_ABTS_PENDING ) iter_data->ret =1 ;
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 20/44 hptiop: Stop using the SCSI pointer
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/hptiop.c | 1 + drivers/scsi/hptiop.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/hptiop.c +1 -0
@@ -1174,6 +1174,7 @@ static struct scsi_host_template driver_template = { .slave_configure = hptiop_slave_config, .this_id = -1, .change_queue_depth = hptiop_adjust_disk_queue_depth, + .cmd_size = sizeof(struct hpt_cmd_priv), };static int hptiop_internal_memalloc_itl (struct hptiop_hba *hba)
drivers/scsi/hptiop.h +2 -2
@@ -251,13 +251,13 @@ struct hptiop_request {int index; }; -struct hpt_scsi_pointer { +struct hpt_cmd_priv {int mapped;int sgcnt;dma_addr_t dma_handle; }; -#define HPT_SCP (scp) ((struct hpt_scsi_pointer *)&(scp)->SCp) +#define HPT_SCP (scp) ((struct hpt_cmd_priv *)scsi_cmd_priv(scp))enum hptiop_family {UNKNOWN_BASED_IOP ,
Hannes Reinecke
maintainerRe: [PATCH v2 20/44] hptiop: Stop using the SCSI pointer
Quoted 28 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/hptiop.c | 1 + drivers/scsi/hptiop.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)drivers/scsi/hptiop.c +1
-0@@ -1174,6 +1174,7 @@ static struct scsi_host_template driver_template = { .slave_configure = hptiop_slave_config, .this_id = -1, .change_queue_depth = hptiop_adjust_disk_queue_depth, + .cmd_size = sizeof(struct hpt_cmd_priv), };static int hptiop_internal_memalloc_itl (struct hptiop_hba *hba)drivers/scsi/hptiop.h +0
-0
drivers/scsi/hptiop.h struct hptiop_request { · line 254
Quoted 5 lines
drivers/scsi/hptiop.h +1
-1@@ -251,13 +251,13 @@ struct hptiop_request {int index; }; -struct hpt_scsi_pointer { +struct hpt_cmd_priv {
Why not keep the name? You have been using 'struct scsi_pointer' with all the other drivers ...
drivers/scsi/hptiop.h struct hptiop_request { · line 263
Quoted 10 lines
drivers/scsi/hptiop.h +1
-1int mapped;int sgcnt;dma_addr_t dma_handle; }; -#define HPT_SCP (scp) ((struct hpt_scsi_pointer *)&(scp)->SCp) +#define HPT_SCP (scp) ((struct hpt_cmd_priv *)scsi_cmd_priv(scp))enum hptiop_family {UNKNOWN_BASED_IOP ,
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 20/44] hptiop: Stop using the SCSI pointer
Quoted 5 lines · Hannes Reinecke
drivers/scsi/hptiop.h struct hptiop_request { · line 254
Quoted 2 lines · Bart Van Assche
drivers/scsi/hptiop.h +1
-1-struct hpt_scsi_pointer { +struct hpt_cmd_priv {Why not keep the name? You have been using 'struct
scsi_pointer' with all the other drivers ...
I assume that "SCSI pointer" refers to a section in the SCSI II specification with the same title. The hptiop private data is not related to the SCSI II "SCSI pointer" section. Hence the renaming of this data structure.
Thanks,
Bart.
Re: [PATCH v2 20/44] hptiop: Stop using the SCSI pointer
Quoted 9 lines · Bart Van Assche
Quoted 5 lines · Hannes Reinecke
drivers/scsi/hptiop.h struct hptiop_request { · line 254
Quoted 2 lines · Bart Van Assche
drivers/scsi/hptiop.h +1
-1-struct hpt_scsi_pointer { +struct hpt_cmd_priv {Why not keep the name? You have been using 'struct
scsi_pointer' with all the other drivers ...I assume that "SCSI pointer" refers to a section in the SCSI II specification with the same title. The hptiop private data is not related to the SCSI II "SCSI pointer" section. Hence the renaming of this data structure.
Ah, right. Misread the patch.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 20/44] hptiop: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 37 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/hptiop.c| 1 +drivers/scsi/hptiop.h| 4 ++--2 files changed, 3 insertions(+), 2 deletions(-)drivers/scsi/hptiop.c +1
-0@@ -1174,6 +1174,7 @@ static struct scsi_host_template driver_template = { .slave_configure = hptiop_slave_config, .this_id = -1, .change_queue_depth = hptiop_adjust_disk_queue_depth, + .cmd_size = sizeof(struct hpt_cmd_priv), };static int hptiop_internal_memalloc_itl (struct hptiop_hba *hba)drivers/scsi/hptiop.h +1
-1@@ -251,13 +251,13 @@ struct hptiop_request {int index; }; -struct hpt_scsi_pointer { +struct hpt_cmd_priv {
drivers/scsi/hptiop.h struct hptiop_request { · line 263
Quoted 10 lines
drivers/scsi/hptiop.h +1
-1int mapped;int sgcnt;dma_addr_t dma_handle; }; -#define HPT_SCP (scp) ((struct hpt_scsi_pointer *)&(scp)->SCp) +#define HPT_SCP (scp) ((struct hpt_cmd_priv *)scsi_cmd_priv(scp))enum hptiop_family {UNKNOWN_BASED_IOP ,
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 21/44 imm: Move the SCSI pointer to private command data
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/imm.c | 88 ++++++++++++++++++++++++---------------------- drivers/scsi/imm.h | 11 ++++++ 2 files changed, 56 insertions(+), 43 deletions(-)
drivers/scsi/imm.c +45 -43
@@ -66,7 +66,7 @@ static void got_it(imm_struct *dev) { dev->base = dev->dev->port->base;if (dev->cur_cmd) - dev->cur_cmd->SCp.phase =1 ; +imm_scsi_pointer (dev->cur_cmd)->phase =1 ;else wake_up (dev->waiting); }
@@ -618,13 +618,14 @@ static inline int imm_send_command(struct scsi_cmnd *cmd)* The driver appears to remain stable if we speed up the parallel port * i/o in this function, but not elsewhere. */ -static int imm_completion (struct scsi_cmnd *cmd) +static int imm_completion (struct scsi_cmnd *const cmd) {/* Return codes: * -1 Error * 0 Told to schedule * 1 Finished data transfer */ +struct scsi_pointer *scsi_pointer =imm_scsi_pointer (cmd);imm_struct *dev =imm_dev (cmd->device->host);unsigned short ppb = dev->base;unsigned long start_jiffies = jiffies;
@@ -660,44 +661,43 @@ static int imm_completion(struct scsi_cmnd *cmd)* a) Drive status is screwy (!ready && !present) * b) Drive is requesting/sending more data than expected */ -if (((r &0x88 ) !=0x88 ) || (cmd->SCp.this_residual <=0 )) { +if ((r &0x88 ) !=0x88 || scsi_pointer->this_residual <=0 ) {imm_fail (dev,DID_ERROR );return -1 ;/* ERROR_RETURN */ }/* determine if we should use burst I/O */ if (dev->rd ==0 ) { - fast = (bulk - && (cmd->SCp.this_residual >= -IMM_BURST_SIZE )) ?IMM_BURST_SIZE :2 ; - status =imm_out (dev, cmd->SCp.ptr, fast); + fast = bulk && scsi_pointer->this_residual >= +IMM_BURST_SIZE ?IMM_BURST_SIZE :2 ; + status =imm_out (dev, scsi_pointer->ptr, fast); }else { - fast = (bulk - && (cmd->SCp.this_residual >= -IMM_BURST_SIZE )) ?IMM_BURST_SIZE :1 ; - status =imm_in (dev, cmd->SCp.ptr, fast); + fast = bulk && scsi_pointer->this_residual >= +IMM_BURST_SIZE ?IMM_BURST_SIZE :1 ; + status =imm_in (dev, scsi_pointer->ptr, fast); } - cmd->SCp.ptr += fast; - cmd->SCp.this_residual -= fast; + scsi_pointer->ptr += fast; + scsi_pointer->this_residual -= fast;if (!status) {imm_fail (dev,DID_BUS_BUSY );return -1 ;/* ERROR_RETURN */ } -if (cmd->SCp.buffer && !cmd->SCp.this_residual) { +if (scsi_pointer->buffer && !scsi_pointer->this_residual) {/* if scatter/gather, advance to the next segment */ -if (cmd->SCp.buffers_residual--) { - cmd->SCp.buffer =sg_next (cmd->SCp.buffer); - cmd->SCp.this_residual = - cmd->SCp.buffer->length; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); +if (scsi_pointer->buffers_residual--) { + scsi_pointer->buffer = +sg_next (scsi_pointer->buffer); + scsi_pointer->this_residual = + scsi_pointer->buffer->length; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer);/* * Make sure that we transfer even number of bytes * otherwise it makes imm_byte_out() messy. */ -if (cmd->SCp.this_residual &0x01 ) - cmd->SCp.this_residual++; +if (scsi_pointer->this_residual &0x01 ) + scsi_pointer->this_residual++; } }/* Now check to see if the drive is ready to comunicate */
@@ -762,7 +762,7 @@ static void imm_interrupt(struct work_struct *work) }#endif -if (cmd->SCp.phase >1 ) +if (imm_scsi_pointer (cmd)->phase >1 )imm_disconnect (dev);imm_pb_dismiss (dev);
@@ -774,8 +774,9 @@ static void imm_interrupt(struct work_struct *work)return ; } -static int imm_engine (imm_struct *dev,struct scsi_cmnd *cmd) +static int imm_engine (imm_struct *dev,struct scsi_cmnd *const cmd) { +struct scsi_pointer *scsi_pointer =imm_scsi_pointer (cmd);unsigned short ppb = dev->base;unsigned char l =0 , h =0 ;int retv, x;
@@ -786,7 +787,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)if (dev->failed)return 0 ; -switch (cmd->SCp.phase) { +switch (scsi_pointer->phase) {case 0 :/* Phase 0 - Waiting for parport */ if (time_after (jiffies, dev->jstart +HZ )) {/*
@@ -800,7 +801,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)case 1 :/* Phase 1 - Connected */ imm_connect (dev,CONNECT_EPP_MAYBE ); - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 2 :/* Phase 2 - We are now talking to the scsi bus */
@@ -808,7 +809,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)imm_fail (dev,DID_NO_CONNECT );return 0 ; } - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 3 :/* Phase 3 - Ready to accept a command */
@@ -818,23 +819,23 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)if (!imm_send_command (cmd))return 0 ; - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 4 :/* Phase 4 - Setup scatter/gather buffers */ if (scsi_bufflen (cmd)) { - cmd->SCp.buffer =scsi_sglist (cmd); - cmd->SCp.this_residual = cmd->SCp.buffer->length; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); + scsi_pointer->buffer =scsi_sglist (cmd); + scsi_pointer->this_residual = scsi_pointer->buffer->length; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); }else { - cmd->SCp.buffer =NULL ; - cmd->SCp.this_residual =0 ; - cmd->SCp.ptr =NULL ; + scsi_pointer->buffer =NULL ; + scsi_pointer->this_residual =0 ; + scsi_pointer->ptr =NULL ; } - cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; - cmd->SCp.phase++; -if (cmd->SCp.this_residual &0x01 ) - cmd->SCp.this_residual++; + scsi_pointer->buffers_residual =scsi_sg_count (cmd) -1 ; + scsi_pointer->phase++; +if (scsi_pointer->this_residual &0x01 ) + scsi_pointer->this_residual++; fallthrough;case 5 :/* Phase 5 - Pre-Data transfer stage */
@@ -851,7 +852,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)if ((dev->dp) && (dev->rd))if (imm_negotiate (dev))return 0 ; - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 6 :/* Phase 6 - Data transfer stage */
@@ -867,7 +868,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)if (retv ==0 )return 1 ; } - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 7 :/* Phase 7 - Post data transfer stage */
@@ -879,7 +880,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)w_ctr (ppb,0x4 ); } } - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 8 :/* Phase 8 - Read status/message */
@@ -922,7 +923,7 @@ static int imm_queuecommand_lck(struct scsi_cmnd *cmd) dev->jstart = jiffies; dev->cur_cmd = cmd; cmd->result =DID_ERROR <<16 ;/* default return code */ - cmd->SCp.phase =0 ;/* bus free */ +imm_scsi_pointer (cmd)->phase =0 ;/* bus free */ schedule_delayed_work (&dev->imm_tq,0 );
@@ -961,7 +962,7 @@ static int imm_abort(struct scsi_cmnd *cmd)* have tied the SCSI_MESSAGE line high in the interface */ -switch (cmd->SCp.phase) { +switch (imm_scsi_pointer (cmd)->phase) {case 0 :/* Do not have access to parport */ case 1 :/* Have not connected to interface */ dev->cur_cmd =NULL ;/* Forget the problem */
@@ -987,7 +988,7 @@ static int imm_reset(struct scsi_cmnd *cmd) {imm_struct *dev =imm_dev (cmd->device->host); -if (cmd->SCp.phase) +if (imm_scsi_pointer (cmd)->phase)imm_disconnect (dev); dev->cur_cmd =NULL ;/* Forget the problem */
@@ -1109,6 +1110,7 @@ static struct scsi_host_template imm_template = { .sg_tablesize = SG_ALL, .can_queue = 1, .slave_alloc = imm_adjust_queue, + .cmd_size = sizeof(struct imm_cmd_priv), };/***************************************************************************
drivers/scsi/imm.h +11 -0
@@ -139,6 +139,17 @@ static char *IMM_MODE_STRING[] =#define w_ctr (x,y) outb(y, (x)+2)#endif +struct imm_cmd_priv { +struct scsi_pointer scsi_pointer; +}; + +static inline struct scsi_pointer *imm_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct imm_cmd_priv *icmd =scsi_cmd_priv (cmd); + +return &icmd->scsi_pointer; +} +static int imm_engine (imm_struct *,struct scsi_cmnd *);#endif /* _IMM_H */
Hannes Reinecke
maintainerRe: [PATCH v2 21/44] imm: Move the SCSI pointer to private command data
Quoted 251 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer. This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/imm.c | 88 ++++++++++++++++++++++++---------------------- drivers/scsi/imm.h | 11 ++++++ 2 files changed, 56 insertions(+), 43 deletions(-)drivers/scsi/imm.c +45
-43@@ -66,7 +66,7 @@ static void got_it(imm_struct *dev) { dev->base = dev->dev->port->base;if (dev->cur_cmd) - dev->cur_cmd->SCp.phase =1 ; +imm_scsi_pointer (dev->cur_cmd)->phase =1 ;else wake_up (dev->waiting); }@@ -618,13 +618,14 @@ static inline int imm_send_command(struct scsi_cmnd *cmd)* The driver appears to remain stable if we speed up the parallel port * i/o in this function, but not elsewhere. */ -static int imm_completion (struct scsi_cmnd *cmd) +static int imm_completion (struct scsi_cmnd *const cmd) {/* Return codes: * -1 Error * 0 Told to schedule * 1 Finished data transfer */ +struct scsi_pointer *scsi_pointer =imm_scsi_pointer (cmd);imm_struct *dev =imm_dev (cmd->device->host);unsigned short ppb = dev->base;unsigned long start_jiffies = jiffies;@@ -660,44 +661,43 @@ static int imm_completion(struct scsi_cmnd *cmd)* a) Drive status is screwy (!ready && !present) * b) Drive is requesting/sending more data than expected */ -if (((r &0x88 ) !=0x88 ) || (cmd->SCp.this_residual <=0 )) { +if ((r &0x88 ) !=0x88 || scsi_pointer->this_residual <=0 ) {imm_fail (dev,DID_ERROR );return -1 ;/* ERROR_RETURN */ }/* determine if we should use burst I/O */ if (dev->rd ==0 ) { - fast = (bulk - && (cmd->SCp.this_residual >= -IMM_BURST_SIZE )) ?IMM_BURST_SIZE :2 ; - status =imm_out (dev, cmd->SCp.ptr, fast); + fast = bulk && scsi_pointer->this_residual >= +IMM_BURST_SIZE ?IMM_BURST_SIZE :2 ; + status =imm_out (dev, scsi_pointer->ptr, fast); }else { - fast = (bulk - && (cmd->SCp.this_residual >= -IMM_BURST_SIZE )) ?IMM_BURST_SIZE :1 ; - status =imm_in (dev, cmd->SCp.ptr, fast); + fast = bulk && scsi_pointer->this_residual >= +IMM_BURST_SIZE ?IMM_BURST_SIZE :1 ; + status =imm_in (dev, scsi_pointer->ptr, fast); } - cmd->SCp.ptr += fast; - cmd->SCp.this_residual -= fast; + scsi_pointer->ptr += fast; + scsi_pointer->this_residual -= fast;if (!status) {imm_fail (dev,DID_BUS_BUSY );return -1 ;/* ERROR_RETURN */ } -if (cmd->SCp.buffer && !cmd->SCp.this_residual) { +if (scsi_pointer->buffer && !scsi_pointer->this_residual) {/* if scatter/gather, advance to the next segment */ -if (cmd->SCp.buffers_residual--) { - cmd->SCp.buffer =sg_next (cmd->SCp.buffer); - cmd->SCp.this_residual = - cmd->SCp.buffer->length; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); +if (scsi_pointer->buffers_residual--) { + scsi_pointer->buffer = +sg_next (scsi_pointer->buffer); + scsi_pointer->this_residual = + scsi_pointer->buffer->length; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer);/* * Make sure that we transfer even number of bytes * otherwise it makes imm_byte_out() messy. */ -if (cmd->SCp.this_residual &0x01 ) - cmd->SCp.this_residual++; +if (scsi_pointer->this_residual &0x01 ) + scsi_pointer->this_residual++; } }/* Now check to see if the drive is ready to comunicate */ @@ -762,7 +762,7 @@ static void imm_interrupt(struct work_struct *work) }#endif -if (cmd->SCp.phase >1 ) +if (imm_scsi_pointer (cmd)->phase >1 )imm_disconnect (dev);imm_pb_dismiss (dev);@@ -774,8 +774,9 @@ static void imm_interrupt(struct work_struct *work)return ; } -static int imm_engine (imm_struct *dev,struct scsi_cmnd *cmd) +static int imm_engine (imm_struct *dev,struct scsi_cmnd *const cmd) { +struct scsi_pointer *scsi_pointer =imm_scsi_pointer (cmd);unsigned short ppb = dev->base;unsigned char l =0 , h =0 ;int retv, x;@@ -786,7 +787,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)if (dev->failed)return 0 ; -switch (cmd->SCp.phase) { +switch (scsi_pointer->phase) {case 0 :/* Phase 0 - Waiting for parport */ if (time_after (jiffies, dev->jstart +HZ )) {/* @@ -800,7 +801,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)case 1 :/* Phase 1 - Connected */ imm_connect (dev,CONNECT_EPP_MAYBE ); - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 2 :/* Phase 2 - We are now talking to the scsi bus */ @@ -808,7 +809,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)imm_fail (dev,DID_NO_CONNECT );return 0 ; } - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 3 :/* Phase 3 - Ready to accept a command */ @@ -818,23 +819,23 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)if (!imm_send_command (cmd))return 0 ; - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 4 :/* Phase 4 - Setup scatter/gather buffers */ if (scsi_bufflen (cmd)) { - cmd->SCp.buffer =scsi_sglist (cmd); - cmd->SCp.this_residual = cmd->SCp.buffer->length; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); + scsi_pointer->buffer =scsi_sglist (cmd); + scsi_pointer->this_residual = scsi_pointer->buffer->length; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); }else { - cmd->SCp.buffer =NULL ; - cmd->SCp.this_residual =0 ; - cmd->SCp.ptr =NULL ; + scsi_pointer->buffer =NULL ; + scsi_pointer->this_residual =0 ; + scsi_pointer->ptr =NULL ; } - cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; - cmd->SCp.phase++; -if (cmd->SCp.this_residual &0x01 ) - cmd->SCp.this_residual++; + scsi_pointer->buffers_residual =scsi_sg_count (cmd) -1 ; + scsi_pointer->phase++; +if (scsi_pointer->this_residual &0x01 ) + scsi_pointer->this_residual++; fallthrough;case 5 :/* Phase 5 - Pre-Data transfer stage */ @@ -851,7 +852,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)if ((dev->dp) && (dev->rd))if (imm_negotiate (dev))return 0 ; - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 6 :/* Phase 6 - Data transfer stage */ @@ -867,7 +868,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)if (retv ==0 )return 1 ; } - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 7 :/* Phase 7 - Post data transfer stage */ @@ -879,7 +880,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)w_ctr (ppb,0x4 ); } } - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 8 :/* Phase 8 - Read status/message */ @@ -922,7 +923,7 @@ static int imm_queuecommand_lck(struct scsi_cmnd *cmd) dev->jstart = jiffies; dev->cur_cmd = cmd; cmd->result =DID_ERROR <<16 ;/* default return code */ - cmd->SCp.phase =0 ;/* bus free */ +imm_scsi_pointer (cmd)->phase =0 ;/* bus free */ schedule_delayed_work (&dev->imm_tq,0 );@@ -961,7 +962,7 @@ static int imm_abort(struct scsi_cmnd *cmd)* have tied the SCSI_MESSAGE line high in the interface */ -switch (cmd->SCp.phase) { +switch (imm_scsi_pointer (cmd)->phase) {case 0 :/* Do not have access to parport */ case 1 :/* Have not connected to interface */ dev->cur_cmd =NULL ;/* Forget the problem */ @@ -987,7 +988,7 @@ static int imm_reset(struct scsi_cmnd *cmd) {imm_struct *dev =imm_dev (cmd->device->host); -if (cmd->SCp.phase) +if (imm_scsi_pointer (cmd)->phase)imm_disconnect (dev); dev->cur_cmd =NULL ;/* Forget the problem */ @@ -1109,6 +1110,7 @@ static struct scsi_host_template imm_template = { .sg_tablesize = SG_ALL, .can_queue = 1, .slave_alloc = imm_adjust_queue, + .cmd_size = sizeof(struct imm_cmd_priv), };/*************************************************************************** drivers/scsi/imm.h +0
-0
drivers/scsi/imm.h static char *IMM_MODE_STRING[] = · line 145
Quoted 7 lines
drivers/scsi/imm.h +4
-0@@ -139,6 +139,17 @@ static char *IMM_MODE_STRING[] =#define w_ctr (x,y) outb(y, (x)+2)#endif +struct imm_cmd_priv { +struct scsi_pointer scsi_pointer; +}; +
Why the indirection?
You can use 'struct scsi_pointer' directly as payload, no?
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 21/44] imm: Move the SCSI pointer to private command data
Quoted 7 lines · Hannes Reinecke
drivers/scsi/imm.h static char *IMM_MODE_STRING[] = · line 145
Quoted 4 lines · Bart Van Assche
drivers/scsi/imm.h +4
-0+struct imm_cmd_priv { + struct scsi_pointer scsi_pointer; +}; +Why the indirection?
You can use 'structscsi_pointer' directly as payload, no?
The indirection makes it easy to add more private command data in the future. However, I don't have a strong opinion about this. I can remove the indirection if you prefer this?
Thanks,
Bart.
Hannes Reinecke
maintainerRe: [PATCH v2 21/44] imm: Move the SCSI pointer to private command data
Quoted 11 lines · Bart Van Assche
Quoted 7 lines · Hannes Reinecke
drivers/scsi/imm.h static char *IMM_MODE_STRING[] = · line 145
Quoted 4 lines · Bart Van Assche
drivers/scsi/imm.h +4
-0+struct imm_cmd_priv { + struct scsi_pointer scsi_pointer; +}; +Why the indirection?
You can use 'structscsi_pointer' directly as payload, no?The indirection makes it easy to add more private command data in the future. However, I don't have a strong opinion about this. I can remove the indirection if you prefer this?
That argument would be true for drivers under active development, but these are ancient drivers which are in maintenance mode (at best).
I'd be surprised if we need to add more stuff to command payload.
Except the host_scribble bit; in the future we might be wanting to remove it in favour of the command payload, too.
But imm is not one of them, so we should be using 'struct scsi_pointer' as the command payload directly.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 21/44] imm: Move the SCSI pointer to private command data
Quoted 13 lines · Hannes Reinecke
Quoted 11 lines · Bart Van Assche
Quoted 7 lines · Hannes Reinecke
drivers/scsi/imm.h static char *IMM_MODE_STRING[] = · line 145
Quoted 4 lines · Bart Van Assche
drivers/scsi/imm.h +4
-0+struct imm_cmd_priv { + struct scsi_pointer scsi_pointer; +}; +Why the indirection?
You can use 'structscsi_pointer' directly as payload, no?The indirection makes it easy to add more private command data in the future. However, I don't have a strong opinion about this. I can remove the indirection if you prefer this?
Quoted 8 lines
That argument would be true for drivers under active development, but these are ancient drivers which are in maintenance mode (at best).
I'd be surprised if we need to add more stuff to command payload.
Except the
host_scribblebit; in the future we might be wanting to remove it in favour of the command payload, too.But imm is not one of them, so we should be using 'struct
scsi_pointer' as the command payload directly.
I will use struct scsi_pointer directly in drivers that do not use host_scribble.
Thanks,
Bart.
Re: [PATCH v2 21/44] imm: Move the SCSI pointer to private command data
In reply to Bart Van AsscheQuoted 262 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer. This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/imm.c| 88 ++++++++++++++++++++++++----------------------drivers/scsi/imm.h| 11 ++++++2 files changed, 56 insertions(+), 43 deletions(-)drivers/scsi/imm.c +45
-43@@ -66,7 +66,7 @@ static void got_it(imm_struct *dev) { dev->base = dev->dev->port->base;if (dev->cur_cmd) - dev->cur_cmd->SCp.phase =1 ; +imm_scsi_pointer (dev->cur_cmd)->phase =1 ;else wake_up (dev->waiting); }@@ -618,13 +618,14 @@ static inline int imm_send_command(struct scsi_cmnd *cmd)* The driver appears to remain stable if we speed up the parallel port * i/o in this function, but not elsewhere. */ -static int imm_completion (struct scsi_cmnd *cmd) +static int imm_completion (struct scsi_cmnd *const cmd) {/* Return codes: * -1 Error * 0 Told to schedule * 1 Finished data transfer */ +struct scsi_pointer *scsi_pointer =imm_scsi_pointer (cmd);imm_struct *dev =imm_dev (cmd->device->host);unsigned short ppb = dev->base;unsigned long start_jiffies = jiffies;@@ -660,44 +661,43 @@ static int imm_completion(struct scsi_cmnd *cmd)* a) Drive status is screwy (!ready && !present) * b) Drive is requesting/sending more data than expected */ -if (((r &0x88 ) !=0x88 ) || (cmd->SCp.this_residual <=0 )) { +if ((r &0x88 ) !=0x88 || scsi_pointer->this_residual <=0 ) {imm_fail (dev,DID_ERROR );return -1 ;/* ERROR_RETURN */ }/* determine if we should use burst I/O */ if (dev->rd ==0 ) { - fast = (bulk - && (cmd->SCp.this_residual >= -IMM_BURST_SIZE )) ?IMM_BURST_SIZE :2 ; - status =imm_out (dev, cmd->SCp.ptr, fast); + fast = bulk && scsi_pointer->this_residual >= +IMM_BURST_SIZE ?IMM_BURST_SIZE :2 ; + status =imm_out (dev, scsi_pointer->ptr, fast); }else { - fast = (bulk - && (cmd->SCp.this_residual >= -IMM_BURST_SIZE )) ?IMM_BURST_SIZE :1 ; - status =imm_in (dev, cmd->SCp.ptr, fast); + fast = bulk && scsi_pointer->this_residual >= +IMM_BURST_SIZE ?IMM_BURST_SIZE :1 ; + status =imm_in (dev, scsi_pointer->ptr, fast); } - cmd->SCp.ptr += fast; - cmd->SCp.this_residual -= fast; + scsi_pointer->ptr += fast; + scsi_pointer->this_residual -= fast;if (!status) {imm_fail (dev,DID_BUS_BUSY );return -1 ;/* ERROR_RETURN */ } -if (cmd->SCp.buffer && !cmd->SCp.this_residual) { +if (scsi_pointer->buffer && !scsi_pointer->this_residual) {/* if scatter/gather, advance to the next segment */ -if (cmd->SCp.buffers_residual--) { - cmd->SCp.buffer =sg_next (cmd->SCp.buffer); - cmd->SCp.this_residual = - cmd->SCp.buffer->length; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); +if (scsi_pointer->buffers_residual--) { + scsi_pointer->buffer = +sg_next (scsi_pointer->buffer); + scsi_pointer->this_residual = + scsi_pointer->buffer->length; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer);/* * Make sure that we transfer even number of bytes * otherwise it makes imm_byte_out() messy. */ -if (cmd->SCp.this_residual &0x01 ) - cmd->SCp.this_residual++; +if (scsi_pointer->this_residual &0x01 ) + scsi_pointer->this_residual++; } }/* Now check to see if the drive is ready to comunicate */ @@ -762,7 +762,7 @@ static void imm_interrupt(struct work_struct *work) }#endif -if (cmd->SCp.phase >1 ) +if (imm_scsi_pointer (cmd)->phase >1 )imm_disconnect (dev);imm_pb_dismiss (dev);@@ -774,8 +774,9 @@ static void imm_interrupt(struct work_struct *work)return ; } -static int imm_engine (imm_struct *dev,struct scsi_cmnd *cmd) +static int imm_engine (imm_struct *dev,struct scsi_cmnd *const cmd) { +struct scsi_pointer *scsi_pointer =imm_scsi_pointer (cmd);unsigned short ppb = dev->base;unsigned char l =0 , h =0 ;int retv, x;@@ -786,7 +787,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)if (dev->failed)return 0 ; -switch (cmd->SCp.phase) { +switch (scsi_pointer->phase) {case 0 :/* Phase 0 - Waiting for parport */ if (time_after (jiffies, dev->jstart +HZ )) {/* @@ -800,7 +801,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)case 1 :/* Phase 1 - Connected */ imm_connect (dev,CONNECT_EPP_MAYBE ); - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 2 :/* Phase 2 - We are now talking to the scsi bus */ @@ -808,7 +809,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)imm_fail (dev,DID_NO_CONNECT );return 0 ; } - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 3 :/* Phase 3 - Ready to accept a command */ @@ -818,23 +819,23 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)if (!imm_send_command (cmd))return 0 ; - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 4 :/* Phase 4 - Setup scatter/gather buffers */ if (scsi_bufflen (cmd)) { - cmd->SCp.buffer =scsi_sglist (cmd); - cmd->SCp.this_residual = cmd->SCp.buffer->length; - cmd->SCp.ptr =sg_virt (cmd->SCp.buffer); + scsi_pointer->buffer =scsi_sglist (cmd); + scsi_pointer->this_residual = scsi_pointer->buffer->length; + scsi_pointer->ptr =sg_virt (scsi_pointer->buffer); }else { - cmd->SCp.buffer =NULL ; - cmd->SCp.this_residual =0 ; - cmd->SCp.ptr =NULL ; + scsi_pointer->buffer =NULL ; + scsi_pointer->this_residual =0 ; + scsi_pointer->ptr =NULL ; } - cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; - cmd->SCp.phase++; -if (cmd->SCp.this_residual &0x01 ) - cmd->SCp.this_residual++; + scsi_pointer->buffers_residual =scsi_sg_count (cmd) -1 ; + scsi_pointer->phase++; +if (scsi_pointer->this_residual &0x01 ) + scsi_pointer->this_residual++; fallthrough;case 5 :/* Phase 5 - Pre-Data transfer stage */ @@ -851,7 +852,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)if ((dev->dp) && (dev->rd))if (imm_negotiate (dev))return 0 ; - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 6 :/* Phase 6 - Data transfer stage */ @@ -867,7 +868,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)if (retv ==0 )return 1 ; } - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 7 :/* Phase 7 - Post data transfer stage */ @@ -879,7 +880,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)w_ctr (ppb,0x4 ); } } - cmd->SCp.phase++; + scsi_pointer->phase++; fallthrough;case 8 :/* Phase 8 - Read status/message */ @@ -922,7 +923,7 @@ static int imm_queuecommand_lck(struct scsi_cmnd *cmd) dev->jstart = jiffies; dev->cur_cmd = cmd; cmd->result =DID_ERROR <<16 ;/* default return code */ - cmd->SCp.phase =0 ;/* bus free */ +imm_scsi_pointer (cmd)->phase =0 ;/* bus free */ schedule_delayed_work (&dev->imm_tq,0 );@@ -961,7 +962,7 @@ static int imm_abort(struct scsi_cmnd *cmd)* have tied the SCSI_MESSAGE line high in the interface */ -switch (cmd->SCp.phase) { +switch (imm_scsi_pointer (cmd)->phase) {case 0 :/* Do not have access to parport */ case 1 :/* Have not connected to interface */ dev->cur_cmd =NULL ;/* Forget the problem */ @@ -987,7 +988,7 @@ static int imm_reset(struct scsi_cmnd *cmd) {imm_struct *dev =imm_dev (cmd->device->host); -if (cmd->SCp.phase) +if (imm_scsi_pointer (cmd)->phase)imm_disconnect (dev); dev->cur_cmd =NULL ;/* Forget the problem */ @@ -1109,6 +1110,7 @@ static struct scsi_host_template imm_template = { .sg_tablesize = SG_ALL, .can_queue = 1, .slave_alloc = imm_adjust_queue, + .cmd_size = sizeof(struct imm_cmd_priv), };/*************************************************************************** drivers/scsi/imm.h +4
-0@@ -139,6 +139,17 @@ static char *IMM_MODE_STRING[] =#define w_ctr (x,y) outb(y, (x)+2)#endif +struct imm_cmd_priv { +struct scsi_pointer scsi_pointer; +}; +
drivers/scsi/imm.h static char *IMM_MODE_STRING[] = · line 155
Quoted 10 lines
drivers/scsi/imm.h +7
-0+static inline struct scsi_pointer *imm_scsi_pointer (struct scsi_cmnd *cmd) +{ +struct imm_cmd_priv *icmd =scsi_cmd_priv (cmd); + +return &icmd->scsi_pointer; +} +static int imm_engine (imm_struct *,struct scsi_cmnd *);#endif /* _IMM_H */
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 22/44 iscsi: Stop using the SCSI pointer
In reply to Bart Van AsscheInstead of storing the iSCSI task pointer and the session age in the SCSI pointer, use command-private variables. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
The list of iSCSI drivers has been obtained as follows:
$ git grep -lw iscsi_host_alloc drivers/infiniband/ulp/iser/iscsi_iser.c drivers/scsi/be2iscsi/be_main.c drivers/scsi/bnx2i/bnx2i_iscsi.c drivers/scsi/cxgbi/libcxgbi.c drivers/scsi/iscsi_tcp.c drivers/scsi/libiscsi.c drivers/scsi/qedi/qedi_main.c drivers/scsi/qla4xxx/ql4_os.c include/scsi/libiscsi.h
Note: it is not clear to me how the qla4xxx driver can work without this patch since it uses the scsi_cmnd::SCp.ptr member for two different purposes:
- The qla4xxx driver uses this member to store a struct srb pointer.
- libiscsi uses this member to store a struct iscsi_task pointer.
--- drivers/infiniband/ulp/iser/iscsi_iser.c | 1 + drivers/scsi/be2iscsi/be_main.c | 3 ++- drivers/scsi/bnx2i/bnx2i_iscsi.c | 1 + drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 1 + drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1 + drivers/scsi/iscsi_tcp.c | 1 + drivers/scsi/libiscsi.c | 22 ++++++++++++---------- drivers/scsi/qedi/qedi_fw.c | 2 +- drivers/scsi/qedi/qedi_iscsi.c | 1 + drivers/scsi/qla4xxx/ql4_def.h | 13 ++++++++++--- drivers/scsi/qla4xxx/ql4_os.c | 13 +++++++------ include/scsi/libiscsi.h | 12 ++++++++++++ 12 files changed, 50 insertions(+), 21 deletions(-)
drivers/infiniband/ulp/iser/iscsi_iser.c +1 -0
@@ -971,6 +971,7 @@ static struct scsi_host_template iscsi_iser_sht = { .proc_name = "iscsi_iser", .this_id = -1, .track_queue_depth = 1, + .cmd_size = sizeof(struct iscsi_cmd), };static struct iscsi_transport iscsi_iser_transport = {
drivers/scsi/be2iscsi/be_main.c +2 -1
@@ -218,7 +218,7 @@ static char const *cqe_desc[] = {static int beiscsi_eh_abort (struct scsi_cmnd *sc) { -struct iscsi_task *abrt_task = (struct iscsi_task *)sc->SCp.ptr; +struct iscsi_task *abrt_task =iscsi_cmd (sc)->task;struct iscsi_cls_session *cls_session;struct beiscsi_io_task *abrt_io_task;struct beiscsi_conn *beiscsi_conn;
@@ -403,6 +403,7 @@ static struct scsi_host_template beiscsi_sht = { .cmd_per_lun = BEISCSI_CMD_PER_LUN, .vendor_id = SCSI_NL_VID_TYPE_PCI | BE_VENDOR_ID, .track_queue_depth = 1, + .cmd_size = sizeof(struct iscsi_cmd), };static struct scsi_transport_template *beiscsi_scsi_transport;
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -0
@@ -2268,6 +2268,7 @@ static struct scsi_host_template bnx2i_host_template = { .sg_tablesize = ISCSI_MAX_BDS_PER_CMD, .shost_groups = bnx2i_dev_groups, .track_queue_depth = 1, + .cmd_size = sizeof(struct iscsi_cmd), };struct iscsi_transport bnx2i_iscsi_transport = {
drivers/scsi/cxgbi/cxgb3i/cxgb3i.c +1 -0
@@ -98,6 +98,7 @@ static struct scsi_host_template cxgb3i_host_template = { .dma_boundary = PAGE_SIZE - 1, .this_id = -1, .track_queue_depth = 1, + .cmd_size = sizeof(struct iscsi_cmd), };static struct iscsi_transport cxgb3i_iscsi_transport = {
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +1 -0
@@ -116,6 +116,7 @@ static struct scsi_host_template cxgb4i_host_template = { .dma_boundary = PAGE_SIZE - 1, .this_id = -1, .track_queue_depth = 1, + .cmd_size = sizeof(struct iscsi_cmd), };static struct iscsi_transport cxgb4i_iscsi_transport = {
drivers/scsi/iscsi_tcp.c +1 -0
@@ -1007,6 +1007,7 @@ static struct scsi_host_template iscsi_sw_tcp_sht = { .proc_name = "iscsi_tcp", .this_id = -1, .track_queue_depth = 1, + .cmd_size = sizeof(struct iscsi_cmd), };static struct iscsi_transport iscsi_sw_tcp_transport = {
drivers/scsi/libiscsi.c +12 -10
@@ -462,7 +462,7 @@ static void iscsi_free_task(struct iscsi_task *task)if (sc) {/* SCSI eh reuses commands to verify us */ - sc->SCp.ptr =NULL ; +iscsi_cmd (sc)->task =NULL ;/* * queue command may call this to free the task, so * it will decide how to return sc to scsi-ml.
@@ -1344,10 +1344,10 @@ struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *conn, itt_t itt)if (!task || !task->sc)return NULL ; -if (task->sc->SCp.phase != conn->session->age) { +if (iscsi_cmd (task->sc)->age != conn->session->age) {iscsi_session_printk (KERN_ERR , conn->session,"task's session age %d, expected %d\n" , - task->sc->SCp.phase, conn->session->age); +iscsi_cmd (task->sc)->age, conn->session->age);return NULL ; }
@@ -1645,8 +1645,8 @@ static inline struct iscsi_task *iscsi_alloc_task(struct iscsi_conn *conn, (void *) &task, sizeof(void *)))return NULL ; - sc->SCp.phase = conn->session->age; - sc->SCp.ptr = (char *) task; +iscsi_cmd (sc)->age = conn->session->age; +iscsi_cmd (sc)->task = task;refcount_set (&task->refcount,1 ); task->state =ISCSI_TASK_PENDING ;
@@ -1683,7 +1683,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)struct iscsi_task *task =NULL ; sc->result =0 ; - sc->SCp.ptr =NULL ; +iscsi_cmd (sc)->task =NULL ; ihost =shost_priv (host);
@@ -1997,7 +1997,7 @@ enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc)spin_lock_bh (&session->frwd_lock);spin_lock (&session->back_lock); - task = (struct iscsi_task *)sc->SCp.ptr; + task =iscsi_cmd (sc)->task;if (!task) {/* * Raced with completion. Blk layer has taken ownership
@@ -2260,7 +2260,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)* if session was ISCSI_STATE_IN_RECOVERY then we may not have * got the command. */ -if (!sc->SCp.ptr) { +if (!iscsi_cmd (sc)->task) {ISCSI_DBG_EH (session,"sc never reached iscsi layer or " "it completed.\n" );spin_unlock_bh (&session->frwd_lock);
@@ -2273,7 +2273,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)* then let the host reset code handle this */ if (!session->leadconn || session->state !=ISCSI_STATE_LOGGED_IN || - sc->SCp.phase != session->age) { +iscsi_cmd (sc)->age != session->age) {spin_unlock_bh (&session->frwd_lock);mutex_unlock (&session->eh_mutex); ISCSI_DBG_EH(session, "failing abort due to dropped "
@@ -2282,7 +2282,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) }spin_lock (&session->back_lock); - task = (struct iscsi_task *)sc->SCp.ptr; + task =iscsi_cmd (sc)->task;if (!task || !task->sc) {/* task completed before time out */ ISCSI_DBG_EH (session,"sc completed while abort in progress\n" );
@@ -2792,6 +2792,8 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,struct Scsi_Host *shost;struct iscsi_host *ihost; +WARN_ON_ONCE (sht->cmd_size <sizeof (struct iscsi_cmd )); + shost =scsi_host_alloc (sht,sizeof (struct iscsi_host ) + dd_data_size);if (!shost)return NULL ;
drivers/scsi/qedi/qedi_fw.c +1 -1
@@ -603,7 +603,7 @@ static void qedi_scsi_completion(struct qedi_ctx *qedi, goto error; } -if (!sc_cmd->SCp.ptr) { +if (!iscsi_cmd (sc_cmd)->task) {QEDI_WARN (&qedi->dbg_ctx,"SCp.ptr is NULL, returned in another context.\n" ); goto error;
drivers/scsi/qedi/qedi_iscsi.c +1 -0
@@ -59,6 +59,7 @@ struct scsi_host_template qedi_host_template = { .dma_boundary = QEDI_HW_DMA_BOUNDARY, .cmd_per_lun = 128, .shost_groups = qedi_shost_groups, + .cmd_size = sizeof(struct iscsi_cmd), }; static void qedi_conn_free_login_resources(struct qedi_ctx *qedi,
drivers/scsi/qla4xxx/ql4_def.h +10 -3
@@ -216,11 +216,18 @@#define IDC_COMP_TOV 5#define LINK_UP_COMP_TOV 30 -#define CMD_SP (Cmnd) ((Cmnd)->SCp.ptr) +struct qla4xxx_cmd_priv { +struct iscsi_cmd iscsi_data;/* must be the first member */ +struct srb *srb; +}; + +static inline struct qla4xxx_cmd_priv *qla4xxx_cmd_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +}/* -* SCSI Request Block structure (srb) that is placed -* on cmd->SCp location of every I/O [We have 22 bytes available] +* SCSI Request Block structure (srb) that is associated with each scsi_cmnd. */ struct srb {struct list_head list;/* (8) */
drivers/scsi/qla4xxx/ql4_os.c +7 -6
@@ -226,6 +226,7 @@ static struct scsi_host_template qla4xxx_driver_template = { .name = DRIVER_NAME, .proc_name = DRIVER_NAME, .queuecommand = qla4xxx_queuecommand, + .cmd_size = sizeof(struct qla4xxx_cmd_priv), .eh_abort_handler = qla4xxx_eh_abort, .eh_device_reset_handler = qla4xxx_eh_device_reset,
@@ -4054,7 +4055,7 @@ static struct srb* qla4xxx_get_new_srb(struct scsi_qla_host *ha, srb->ddb = ddb_entry; srb->cmd = cmd; srb->flags =0 ; -CMD_SP (cmd) = (void *)srb; +qla4xxx_cmd_priv (cmd)->srb = srb;return srb; }
@@ -4067,7 +4068,7 @@ static void qla4xxx_srb_free_dma(struct scsi_qla_host *ha, struct srb *srb)scsi_dma_unmap (cmd); srb->flags &= ~SRB_DMA_VALID ; } -CMD_SP (cmd) =NULL ; +qla4xxx_cmd_priv (cmd)->srb =NULL ; }void qla4xxx_srb_compl (struct kref *ref)
@@ -4640,7 +4641,7 @@ static int qla4xxx_cmd_wait(struct scsi_qla_host *ha)* the scsi/block layer is going to prevent * the tag from being released. */ -if (cmd !=NULL &&CMD_SP (cmd)) +if (cmd !=NULL &&qla4xxx_cmd_priv (cmd)->srb)break ; }spin_unlock_irqrestore (&ha->hardware_lock, flags);
@@ -9079,7 +9080,7 @@ struct srb *qla4xxx_del_from_active_array(struct scsi_qla_host *ha,if (!cmd)return srb; - srb = (struct srb *)CMD_SP (cmd); + srb =qla4xxx_cmd_priv (cmd)->srb;if (!srb)return srb;
@@ -9121,7 +9122,7 @@ static int qla4xxx_eh_wait_on_command(struct scsi_qla_host *ha, do { /* Checking to see if its returned to OS */ - rp = (struct srb *) CMD_SP(cmd); + rp = qla4xxx_cmd_priv(cmd)->srb; if (rp == NULL) { done++; break;
@@ -9215,7 +9216,7 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd) }spin_lock_irqsave (&ha->hardware_lock, flags); - srb = (struct srb *)CMD_SP (cmd); + srb =qla4xxx_cmd_priv (cmd)->srb;if (!srb) {spin_unlock_irqrestore (&ha->hardware_lock, flags); ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%llu: Specified command has already completed.\n",
include/scsi/libiscsi.h +12 -0
@@ -19,6 +19,7 @@#include <linux/refcount.h> #include <scsi/iscsi_proto.h> #include <scsi/iscsi_if.h> +#include <scsi/scsi_cmnd.h> #include <scsi/scsi_transport_iscsi.h> struct scsi_transport_template ;
@@ -152,6 +153,17 @@ static inline bool iscsi_task_is_completed(struct iscsi_task *task) task->state ==ISCSI_TASK_ABRT_SESS_RECOV ; } +/* Private data associated with struct scsi_cmnd. */ +struct iscsi_cmd { +struct iscsi_task *task; +int age; +}; + +static inline struct iscsi_cmd *iscsi_cmd (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +/* Connection's states */ enum {ISCSI_CONN_INITIAL_STAGE ,
Re: [PATCH v2 22/44] iscsi: Stop using the SCSI pointer
Quoted 30 lines · Bart Van Assche
Instead of storing the iSCSI task pointer and the session age in the SCSI pointer, use command-private variables. This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.The list of iSCSI drivers has been obtained as follows:
$ git grep -lw iscsi_host_alloc drivers/infiniband/ulp/iser/iscsi_iser.c drivers/scsi/be2iscsi/be_main.c drivers/scsi/bnx2i/bnx2i_iscsi.c drivers/scsi/cxgbi/libcxgbi.c drivers/scsi/iscsi_tcp.c drivers/scsi/libiscsi.c drivers/scsi/qedi/qedi_main.c drivers/scsi/qla4xxx/ql4_os.c include/scsi/libiscsi.hNote: it is not clear to me how the qla4xxx driver can work without this patch since it uses the
scsi_cmnd::SCp.ptrmember for two different purposes:
- The qla4xxx driver uses this member to store a struct srb pointer.
- libiscsi uses this member to store a structiscsi_taskpointer.Cc Lee Duncan <[email protected]>Cc Chris Leech <[email protected]>Cc Sagi Grimberg <[email protected]>Cc Nilesh Javali <[email protected]>Cc Manish Rangankar <[email protected]>Cc Karen Xie <[email protected]>Cc Ketan Mukadam <[email protected]>Signed-off-by Bart Van Assche <[email protected]>
Quoted 15 lines
--- drivers/infiniband/ulp/iser/iscsi_iser.c | 1 + drivers/scsi/be2iscsi/be_main.c | 3 ++- drivers/scsi/bnx2i/bnx2i_iscsi.c | 1 + drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 1 + drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1 + drivers/scsi/iscsi_tcp.c | 1 + drivers/scsi/libiscsi.c | 22 ++++++++++++---------- drivers/scsi/qedi/qedi_fw.c | 2 +- drivers/scsi/qedi/qedi_iscsi.c | 1 + drivers/scsi/qla4xxx/ql4_def.h | 13 ++++++++++--- drivers/scsi/qla4xxx/ql4_os.c | 13 +++++++------ include/scsi/libiscsi.h | 12 ++++++++++++ 12 files changed, 50 insertions(+), 21 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 22/44] iscsi: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 358 lines · Bart Van Assche
Instead of storing the iSCSI task pointer and the session age in the SCSI pointer, use command-private variables. This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.The list of iSCSI drivers has been obtained as follows:
$ git grep -lw iscsi_host_alloc drivers/infiniband/ulp/iser/iscsi_iser.c drivers/scsi/be2iscsi/be_main.c drivers/scsi/bnx2i/bnx2i_iscsi.c drivers/scsi/cxgbi/libcxgbi.c drivers/scsi/iscsi_tcp.c drivers/scsi/libiscsi.c drivers/scsi/qedi/qedi_main.c drivers/scsi/qla4xxx/ql4_os.c include/scsi/libiscsi.hNote: it is not clear to me how the qla4xxx driver can work without this patch since it uses the
scsi_cmnd::SCp.ptrmember for two different purposes:
- The qla4xxx driver uses this member to store a struct srb pointer.
- libiscsi uses this member to store a structiscsi_taskpointer.Cc Lee Duncan <[email protected]>Cc Chris Leech <[email protected]>Cc Sagi Grimberg <[email protected]>Cc Nilesh Javali <[email protected]>Cc Manish Rangankar <[email protected]>Cc Karen Xie <[email protected]>Cc Ketan Mukadam <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/infiniband/ulp/iser/iscsi_iser.c | 1 + drivers/scsi/be2iscsi/be_main.c | 3 ++- drivers/scsi/bnx2i/bnx2i_iscsi.c | 1 + drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 1 + drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1 + drivers/scsi/iscsi_tcp.c | 1 + drivers/scsi/libiscsi.c | 22 ++++++++++++---------- drivers/scsi/qedi/qedi_fw.c | 2 +- drivers/scsi/qedi/qedi_iscsi.c | 1 + drivers/scsi/qla4xxx/ql4_def.h | 13 ++++++++++--- drivers/scsi/qla4xxx/ql4_os.c | 13 +++++++------ include/scsi/libiscsi.h | 12 ++++++++++++ 12 files changed, 50 insertions(+), 21 deletions(-)drivers/infiniband/ulp/iser/iscsi_iser.c +1
-0@@ -971,6 +971,7 @@ static struct scsi_host_template iscsi_iser_sht = { .proc_name = "iscsi_iser", .this_id = -1, .track_queue_depth = 1, + .cmd_size = sizeof(struct iscsi_cmd), };static struct iscsi_transport iscsi_iser_transport = {drivers/scsi/be2iscsi/be_main.c +2
-1@@ -218,7 +218,7 @@ static char const *cqe_desc[] = {static int beiscsi_eh_abort (struct scsi_cmnd *sc) { -struct iscsi_task *abrt_task = (struct iscsi_task *)sc->SCp.ptr; +struct iscsi_task *abrt_task =iscsi_cmd (sc)->task;struct iscsi_cls_session *cls_session;struct beiscsi_io_task *abrt_io_task;struct beiscsi_conn *beiscsi_conn;@@ -403,6 +403,7 @@ static struct scsi_host_template beiscsi_sht = { .cmd_per_lun = BEISCSI_CMD_PER_LUN, .vendor_id = SCSI_NL_VID_TYPE_PCI | BE_VENDOR_ID, .track_queue_depth = 1, + .cmd_size = sizeof(struct iscsi_cmd), };static struct scsi_transport_template *beiscsi_scsi_transport;drivers/scsi/bnx2i/bnx2i_iscsi.c +1
-0@@ -2268,6 +2268,7 @@ static struct scsi_host_template bnx2i_host_template = { .sg_tablesize = ISCSI_MAX_BDS_PER_CMD, .shost_groups = bnx2i_dev_groups, .track_queue_depth = 1, + .cmd_size = sizeof(struct iscsi_cmd), };struct iscsi_transport bnx2i_iscsi_transport = {drivers/scsi/cxgbi/cxgb3i/cxgb3i.c +1
-0@@ -98,6 +98,7 @@ static struct scsi_host_template cxgb3i_host_template = { .dma_boundary = PAGE_SIZE - 1, .this_id = -1, .track_queue_depth = 1, + .cmd_size = sizeof(struct iscsi_cmd), };static struct iscsi_transport cxgb3i_iscsi_transport = {drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +1
-0@@ -116,6 +116,7 @@ static struct scsi_host_template cxgb4i_host_template = { .dma_boundary = PAGE_SIZE - 1, .this_id = -1, .track_queue_depth = 1, + .cmd_size = sizeof(struct iscsi_cmd), };static struct iscsi_transport cxgb4i_iscsi_transport = {drivers/scsi/iscsi_tcp.c +1
-0@@ -1007,6 +1007,7 @@ static struct scsi_host_template iscsi_sw_tcp_sht = { .proc_name = "iscsi_tcp", .this_id = -1, .track_queue_depth = 1, + .cmd_size = sizeof(struct iscsi_cmd), };static struct iscsi_transport iscsi_sw_tcp_transport = {drivers/scsi/libiscsi.c +12
-10@@ -462,7 +462,7 @@ static void iscsi_free_task(struct iscsi_task *task)if (sc) {/* SCSI eh reuses commands to verify us */ - sc->SCp.ptr =NULL ; +iscsi_cmd (sc)->task =NULL ;/* * queue command may call this to free the task, so * it will decide how to return sc to scsi-ml. @@ -1344,10 +1344,10 @@ struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *conn, itt_t itt)if (!task || !task->sc)return NULL ; -if (task->sc->SCp.phase != conn->session->age) { +if (iscsi_cmd (task->sc)->age != conn->session->age) {iscsi_session_printk (KERN_ERR , conn->session,"task's session age %d, expected %d\n" , - task->sc->SCp.phase, conn->session->age); +iscsi_cmd (task->sc)->age, conn->session->age);return NULL ; }@@ -1645,8 +1645,8 @@ static inline struct iscsi_task *iscsi_alloc_task(struct iscsi_conn *conn, (void *) &task, sizeof(void *)))return NULL ; - sc->SCp.phase = conn->session->age; - sc->SCp.ptr = (char *) task; +iscsi_cmd (sc)->age = conn->session->age; +iscsi_cmd (sc)->task = task;refcount_set (&task->refcount,1 ); task->state =ISCSI_TASK_PENDING ;@@ -1683,7 +1683,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)struct iscsi_task *task =NULL ; sc->result =0 ; - sc->SCp.ptr =NULL ; +iscsi_cmd (sc)->task =NULL ; ihost =shost_priv (host);@@ -1997,7 +1997,7 @@ enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc)spin_lock_bh (&session->frwd_lock);spin_lock (&session->back_lock); - task = (struct iscsi_task *)sc->SCp.ptr; + task =iscsi_cmd (sc)->task;if (!task) {/* * Raced with completion. Blk layer has taken ownership @@ -2260,7 +2260,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)* if session was ISCSI_STATE_IN_RECOVERY then we may not have * got the command. */ -if (!sc->SCp.ptr) { +if (!iscsi_cmd (sc)->task) {ISCSI_DBG_EH (session,"sc never reached iscsi layer or " "it completed.\n" );spin_unlock_bh (&session->frwd_lock);@@ -2273,7 +2273,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)* then let the host reset code handle this */ if (!session->leadconn || session->state !=ISCSI_STATE_LOGGED_IN || - sc->SCp.phase != session->age) { +iscsi_cmd (sc)->age != session->age) {spin_unlock_bh (&session->frwd_lock);mutex_unlock (&session->eh_mutex); ISCSI_DBG_EH(session, "failing abort due to dropped "@@ -2282,7 +2282,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) }spin_lock (&session->back_lock); - task = (struct iscsi_task *)sc->SCp.ptr; + task =iscsi_cmd (sc)->task;if (!task || !task->sc) {/* task completed before time out */ ISCSI_DBG_EH (session,"sc completed while abort in progress\n" );@@ -2792,6 +2792,8 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,struct Scsi_Host *shost;struct iscsi_host *ihost; +WARN_ON_ONCE (sht->cmd_size <sizeof (struct iscsi_cmd )); + shost =scsi_host_alloc (sht,sizeof (struct iscsi_host ) + dd_data_size);if (!shost)return NULL ;drivers/scsi/qedi/qedi_fw.c +1
-1@@ -603,7 +603,7 @@ static void qedi_scsi_completion(struct qedi_ctx *qedi, goto error; } -if (!sc_cmd->SCp.ptr) { +if (!iscsi_cmd (sc_cmd)->task) {QEDI_WARN (&qedi->dbg_ctx,"SCp.ptr is NULL, returned in another context.\n" ); goto error;drivers/scsi/qedi/qedi_iscsi.c +1
-0@@ -59,6 +59,7 @@ struct scsi_host_template qedi_host_template = { .dma_boundary = QEDI_HW_DMA_BOUNDARY, .cmd_per_lun = 128, .shost_groups = qedi_shost_groups, + .cmd_size = sizeof(struct iscsi_cmd), }; static void qedi_conn_free_login_resources(struct qedi_ctx *qedi,drivers/scsi/qla4xxx/ql4_def.h +10
-3@@ -216,11 +216,18 @@#define IDC_COMP_TOV 5#define LINK_UP_COMP_TOV 30 -#define CMD_SP (Cmnd) ((Cmnd)->SCp.ptr) +struct qla4xxx_cmd_priv { +struct iscsi_cmd iscsi_data;/* must be the first member */ +struct srb *srb; +}; + +static inline struct qla4xxx_cmd_priv *qla4xxx_cmd_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +}/* -* SCSI Request Block structure (srb) that is placed -* on cmd->SCp location of every I/O [We have 22 bytes available] +* SCSI Request Block structure (srb) that is associated with each scsi_cmnd. */ struct srb {struct list_head list;/* (8) */ drivers/scsi/qla4xxx/ql4_os.c +7
-6@@ -226,6 +226,7 @@ static struct scsi_host_template qla4xxx_driver_template = { .name = DRIVER_NAME, .proc_name = DRIVER_NAME, .queuecommand = qla4xxx_queuecommand, + .cmd_size = sizeof(struct qla4xxx_cmd_priv), .eh_abort_handler = qla4xxx_eh_abort, .eh_device_reset_handler = qla4xxx_eh_device_reset,@@ -4054,7 +4055,7 @@ static struct srb* qla4xxx_get_new_srb(struct scsi_qla_host *ha, srb->ddb = ddb_entry; srb->cmd = cmd; srb->flags =0 ; -CMD_SP (cmd) = (void *)srb; +qla4xxx_cmd_priv (cmd)->srb = srb;return srb; }@@ -4067,7 +4068,7 @@ static void qla4xxx_srb_free_dma(struct scsi_qla_host *ha, struct srb *srb)scsi_dma_unmap (cmd); srb->flags &= ~SRB_DMA_VALID ; } -CMD_SP (cmd) =NULL ; +qla4xxx_cmd_priv (cmd)->srb =NULL ; }void qla4xxx_srb_compl (struct kref *ref)@@ -4640,7 +4641,7 @@ static int qla4xxx_cmd_wait(struct scsi_qla_host *ha)* the scsi/block layer is going to prevent * the tag from being released. */ -if (cmd !=NULL &&CMD_SP (cmd)) +if (cmd !=NULL &&qla4xxx_cmd_priv (cmd)->srb)break ; }spin_unlock_irqrestore (&ha->hardware_lock, flags);@@ -9079,7 +9080,7 @@ struct srb *qla4xxx_del_from_active_array(struct scsi_qla_host *ha,if (!cmd)return srb; - srb = (struct srb *)CMD_SP (cmd); + srb =qla4xxx_cmd_priv (cmd)->srb;if (!srb)return srb;@@ -9121,7 +9122,7 @@ static int qla4xxx_eh_wait_on_command(struct scsi_qla_host *ha, do { /* Checking to see if its returned to OS */ - rp = (struct srb *) CMD_SP(cmd); + rp = qla4xxx_cmd_priv(cmd)->srb; if (rp == NULL) { done++; break;@@ -9215,7 +9216,7 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd) }spin_lock_irqsave (&ha->hardware_lock, flags); - srb = (struct srb *)CMD_SP (cmd); + srb =qla4xxx_cmd_priv (cmd)->srb;if (!srb) {spin_unlock_irqrestore (&ha->hardware_lock, flags); ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%llu: Specified command has already completed.\n",include/scsi/libiscsi.h +5
-0@@ -19,6 +19,7 @@#include <linux/refcount.h> #include <scsi/iscsi_proto.h> #include <scsi/iscsi_if.h> +#include <scsi/scsi_cmnd.h> #include <scsi/scsi_transport_iscsi.h> struct scsi_transport_template ;@@ -152,6 +153,17 @@ static inline bool iscsi_task_is_completed(struct iscsi_task *task) task->state ==ISCSI_TASK_ABRT_SESS_RECOV ; } +/* Private data associated with struct scsi_cmnd. */ +struct iscsi_cmd { +struct iscsi_task *task; +int age;
include/scsi/libiscsi.h static inline bool iscsi_task_is_completed(struct iscsi_task *task) · line 169
Quoted 10 lines
include/scsi/libiscsi.h +7
-0+}; + +static inline struct iscsi_cmd *iscsi_cmd (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +/* Connection's states */ enum {ISCSI_CONN_INITIAL_STAGE ,
--
Himanshu Madhani Oracle Linux Engineering
Re: [PATCH v2 22/44] iscsi: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 45 lines · Bart Van Assche
Instead of storing the iSCSI task pointer and the session age in the SCSI pointer, use command-private variables. This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.The list of iSCSI drivers has been obtained as follows:
$ git grep -lw iscsi_host_alloc drivers/infiniband/ulp/iser/iscsi_iser.c drivers/scsi/be2iscsi/be_main.c drivers/scsi/bnx2i/bnx2i_iscsi.c drivers/scsi/cxgbi/libcxgbi.c drivers/scsi/iscsi_tcp.c drivers/scsi/libiscsi.c drivers/scsi/qedi/qedi_main.c drivers/scsi/qla4xxx/ql4_os.c include/scsi/libiscsi.hNote: it is not clear to me how the qla4xxx driver can work without this patch since it uses the
scsi_cmnd::SCp.ptrmember for two different purposes:
- The qla4xxx driver uses this member to store a struct srb pointer.
- libiscsi uses this member to store a structiscsi_taskpointer.Cc Lee Duncan <[email protected]>Cc Chris Leech <[email protected]>Cc Sagi Grimberg <[email protected]>Cc Nilesh Javali <[email protected]>Cc Manish Rangankar <[email protected]>Cc Karen Xie <[email protected]>Cc Ketan Mukadam <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/infiniband/ulp/iser/iscsi_iser.c | 1 + drivers/scsi/be2iscsi/be_main.c | 3 ++- drivers/scsi/bnx2i/bnx2i_iscsi.c | 1 + drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 1 + drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1 + drivers/scsi/iscsi_tcp.c | 1 + drivers/scsi/libiscsi.c | 22 ++++++++++++---------- drivers/scsi/qedi/qedi_fw.c | 2 +- drivers/scsi/qedi/qedi_iscsi.c | 1 + drivers/scsi/qla4xxx/ql4_def.h | 13 ++++++++++--- drivers/scsi/qla4xxx/ql4_os.c | 13 +++++++------ include/scsi/libiscsi.h | 12 ++++++++++++ 12 files changed, 50 insertions(+), 21 deletions(-)
Quoted 1 line
...
Mike Christie
maintainerRe: [PATCH v2 22/44] iscsi: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 16 lines · Bart Van Assche
Instead of storing the iSCSI task pointer and the session age in the SCSI pointer, use command-private variables. This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.The list of iSCSI drivers has been obtained as follows:
$ git grep -lw iscsi_host_alloc drivers/infiniband/ulp/iser/iscsi_iser.c drivers/scsi/be2iscsi/be_main.c drivers/scsi/bnx2i/bnx2i_iscsi.c drivers/scsi/cxgbi/libcxgbi.c drivers/scsi/iscsi_tcp.c drivers/scsi/libiscsi.c drivers/scsi/qedi/qedi_main.c drivers/scsi/qla4xxx/ql4_os.c include/scsi/libiscsi.h
Quoted 3 lines
Note: it is not clear to me how the qla4xxx driver can work without this patch since it uses the
scsi_cmnd::SCp.ptrmember for two different purposes:
qla4xxx doesn't use libiscsi for scsi_cmd based IO. It has it's own queuecommand, completion path and error handlers, because it offloads the entire scsi cmd operation.
It only uses libiscsi for iscsi passthrough IO which doesn't use the scsi_cmnd.
Quoted 7 lines
static void qedi_conn_free_login_resources(struct
qedi_ctx*qedi,drivers/scsi/qla4xxx/ql4_def.h +0
-0
drivers/scsi/qla4xxx/ql4_def.h line 222
Quoted 8 lines
drivers/scsi/qla4xxx/ql4_def.h +4
-1@@ -216,11 +216,18 @@#define IDC_COMP_TOV 5#define LINK_UP_COMP_TOV 30 -#define CMD_SP (Cmnd) ((Cmnd)->SCp.ptr) +struct qla4xxx_cmd_priv { +struct iscsi_cmd iscsi_data;/* must be the first member */ +struct srb *srb; +};
So you don't need the iscsi_cmd above.
Chris Leech
maintainerRe: [PATCH v2 22/44] iscsi: Stop using the SCSI pointer
Quoted 39 lines · Mike Christie
Quoted 16 lines · Bart Van Assche
Instead of storing the iSCSI task pointer and the session age in the SCSI pointer, use command-private variables. This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.The list of iSCSI drivers has been obtained as follows:
$ git grep -lw iscsi_host_alloc drivers/infiniband/ulp/iser/iscsi_iser.c drivers/scsi/be2iscsi/be_main.c drivers/scsi/bnx2i/bnx2i_iscsi.c drivers/scsi/cxgbi/libcxgbi.c drivers/scsi/iscsi_tcp.c drivers/scsi/libiscsi.c drivers/scsi/qedi/qedi_main.c drivers/scsi/qla4xxx/ql4_os.c include/scsi/libiscsi.hQuoted 3 lines
Note: it is not clear to me how the qla4xxx driver can work without this patch since it uses the
scsi_cmnd::SCp.ptrmember for two different purposes:qla4xxx doesn't use libiscsi for
scsi_cmdbased IO. It has it's own queuecommand, completion path and error handlers, because it offloads the entire scsi cmd operation.It only uses libiscsi for iscsi passthrough IO which doesn't use the
scsi_cmnd.Quoted 10 lines
static void qedi_conn_free_login_resources(struct
qedi_ctx*qedi,drivers/scsi/qla4xxx/ql4_def.h +0
-0@@ -216,11 +216,18 @@#define IDC_COMP_TOV 5#define LINK_UP_COMP_TOV 30
Quoted 8 lines
drivers/scsi/qla4xxx/ql4_def.h line 222
Quoted 5 lines
drivers/scsi/qla4xxx/ql4_def.h +4
-1-#define CMD_SP (Cmnd) ((Cmnd)->SCp.ptr) +struct qla4xxx_cmd_priv { +struct iscsi_cmd iscsi_data;/* must be the first member */ +struct srb *srb; +};So you don't need the
iscsi_cmdabove.
Mike's of course right about qla4xxx, but it still calls iscsi_host_alloc so only accounting for the srb pointer in cmd_size is going to trigger the WARN_ON_ONCE Bart added.
- Chris Leech
Re: [PATCH v2 22/44] iscsi: Stop using the SCSI pointer
In reply to Mike ChristieQuoted 18 lines · Mike Christie
Quoted 1 line · Bart Van Assche
[ ... ]
qla4xxx doesn't use libiscsi for
scsi_cmdbased IO. It has it's own queuecommand, completion path and error handlers, because it offloads the entire scsi cmd operation.It only uses libiscsi for iscsi passthrough IO which doesn't use the
scsi_cmnd.Quoted 9 lines
static void qedi_conn_free_login_resources(struct
qedi_ctx*qedi,drivers/scsi/qla4xxx/ql4_def.h +0
-0@@ -216,11 +216,18 @@#define IDC_COMP_TOV 5#define LINK_UP_COMP_TOV 30
Quoted 7 lines
drivers/scsi/qla4xxx/ql4_def.h line 222
Quoted 5 lines
drivers/scsi/qla4xxx/ql4_def.h +4
-1-#define CMD_SP (Cmnd) ((Cmnd)->SCp.ptr) +struct qla4xxx_cmd_priv { +struct iscsi_cmd iscsi_data;/* must be the first member */ +struct srb *srb; +};So you don't need the
iscsi_cmdabove.
Thanks for the feedback Mike. However, leaving out struct iscsi_cmd from the above data structure is something I'm nervous about because if there would be any code in the qla4xxx driver that calls a libiscsi function that writes into struct iscsi_cmd then that would trigger data corruption.
Bart.
Chris Leech
maintainerRe: [PATCH v2 22/44] iscsi: Stop using the SCSI pointer
In reply to Bart Van Asschedrivers/scsi/qedi/qedi_iscsi.c
Quoted 17 lines · Bart Van Assche
Instead of storing the iSCSI task pointer and the session age in the SCSI pointer, use command-private variables. This patch prepares for removal of the SCSI pointer from struct
scsi_cmnd.drivers/scsi/qedi/qedi_fw.c +1
-1@@ -603,7 +603,7 @@ static void qedi_scsi_completion(struct qedi_ctx *qedi, goto error; } -if (!sc_cmd->SCp.ptr) { +if (!iscsi_cmd (sc_cmd)->task) {QEDI_WARN (&qedi->dbg_ctx,"SCp.ptr is NULL, returned in another context.\n" ); goto error;drivers/scsi/qedi/qedi_iscsi.c +0
-0
Minor nit, but this warning should probably be changed as well.
- Chris Leech
Re: [PATCH v2 22/44] iscsi: Stop using the SCSI pointer
Quoted 7 lines · Chris Leech
Quoted 6 lines · Bart Van Assche
drivers/scsi/qedi/qedi_fw.c +0
-0@@ -603,7 +603,7 @@ static void qedi_scsi_completion(struct qedi_ctx *qedi, goto error; }
Quoted 9 lines
drivers/scsi/qedi/qedi_iscsi.c
Quoted 7 lines
drivers/scsi/qedi/qedi_fw.c +1
-1-if (!sc_cmd->SCp.ptr) { +if (!iscsi_cmd (sc_cmd)->task) {QEDI_WARN (&qedi->dbg_ctx,"SCp.ptr is NULL, returned in another context.\n" ); goto error;drivers/scsi/qedi/qedi_iscsi.c +0
-0Minor nit, but this warning should probably be changed as well.
Thanks, I will fix the reference to SCp.ptr.
Bart.
PATCH v2 23/44 initio: Stop using the SCSI pointer
In reply to Bart Van AsscheSet .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
--- drivers/scsi/initio.c | 14 ++++++++------ drivers/scsi/initio.h | 9 +++++++++ 2 files changed, 17 insertions(+), 6 deletions(-)
drivers/scsi/initio.c +8 -6
@@ -2553,7 +2553,7 @@ static void initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * c SENSE_SIZE, DMA_FROM_DEVICE); cblk->senseptr = (u32 )dma_addr; cblk->senselen =SENSE_SIZE ; - cmnd->SCp.ptr = (char *)(unsigned long )dma_addr; +initio_priv (cmnd)->sense_dma_addr = dma_addr; cblk->cdblen = cmnd->cmd_len;/* Clear the returned status */
@@ -2577,7 +2577,7 @@ static void initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * csizeof (struct sg_entry ) *TOTAL_SG_ENTRY , DMA_BIDIRECTIONAL); cblk->bufptr = (u32 )dma_addr; - cmnd->SCp.dma_handle = dma_addr; +initio_priv (cmnd)->sglist_dma_addr = dma_addr; cblk->sglen = nseg;
@@ -2704,16 +2704,17 @@ static int i91u_biosparam(struct scsi_device *sdev, struct block_device *dev,static void i91u_unmap_scb (struct pci_dev *pci_dev,struct scsi_cmnd *cmnd) {/* auto sense buffer */ -if (cmnd->SCp.ptr) { +if (initio_priv (cmnd)->sense_dma_addr) {dma_unmap_single (&pci_dev->dev, - (dma_addr_t)((unsigned long )cmnd->SCp.ptr), +initio_priv (cmnd)->sense_dma_addr,SENSE_SIZE ,DMA_FROM_DEVICE ); - cmnd->SCp.ptr =NULL ; +initio_priv (cmnd)->sense_dma_addr =0 ; }/* request buffer */ if (scsi_sg_count (cmnd)) { -dma_unmap_single (&pci_dev->dev, cmnd->SCp.dma_handle, +dma_unmap_single (&pci_dev->dev, +initio_priv (cmnd)->sglist_dma_addr,sizeof (struct sg_entry ) *TOTAL_SG_ENTRY ,DMA_BIDIRECTIONAL );
@@ -2796,6 +2797,7 @@ static struct scsi_host_template initio_template = { .can_queue = MAX_TARGETS * i91u_MAXQUEUE, .this_id = 1, .sg_tablesize = SG_ALL, + .cmd_size = sizeof(struct initio_cmd_priv), }; static int initio_probe_one(struct pci_dev *pdev,
drivers/scsi/initio.h +9 -0
@@ -640,3 +640,12 @@ typedef struct _NVRAM {#define SCSI_RESET_HOST_RESET 0x200#define SCSI_RESET_ACTION 0xff +struct initio_cmd_priv { +dma_addr_t sense_dma_addr; +dma_addr_t sglist_dma_addr; +}; + +static inline struct initio_cmd_priv *initio_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +}
Re: [PATCH v2 23/44] initio: Stop using the SCSI pointer
Quoted 11 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/initio.c | 14 ++++++++------ drivers/scsi/initio.h | 9 +++++++++ 2 files changed, 17 insertions(+), 6 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 23/44] initio: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 74 lines · Bart Van Assche
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct
scsi_cmnd. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.Reviewed-by Johannes Thumshirn <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/initio.c| 14 ++++++++------drivers/scsi/initio.h| 9 +++++++++2 files changed, 17 insertions(+), 6 deletions(-)drivers/scsi/initio.c +8
-6@@ -2553,7 +2553,7 @@ static void initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * c SENSE_SIZE, DMA_FROM_DEVICE); cblk->senseptr = (u32 )dma_addr; cblk->senselen =SENSE_SIZE ; - cmnd->SCp.ptr = (char *)(unsigned long )dma_addr; +initio_priv (cmnd)->sense_dma_addr = dma_addr; cblk->cdblen = cmnd->cmd_len;/* Clear the returned status */ @@ -2577,7 +2577,7 @@ static void initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * csizeof (struct sg_entry ) *TOTAL_SG_ENTRY , DMA_BIDIRECTIONAL); cblk->bufptr = (u32 )dma_addr; - cmnd->SCp.dma_handle = dma_addr; +initio_priv (cmnd)->sglist_dma_addr = dma_addr; cblk->sglen = nseg;@@ -2704,16 +2704,17 @@ static int i91u_biosparam(struct scsi_device *sdev, struct block_device *dev,static void i91u_unmap_scb (struct pci_dev *pci_dev,struct scsi_cmnd *cmnd) {/* auto sense buffer */ -if (cmnd->SCp.ptr) { +if (initio_priv (cmnd)->sense_dma_addr) {dma_unmap_single (&pci_dev->dev, - (dma_addr_t)((unsigned long )cmnd->SCp.ptr), +initio_priv (cmnd)->sense_dma_addr,SENSE_SIZE ,DMA_FROM_DEVICE ); - cmnd->SCp.ptr =NULL ; +initio_priv (cmnd)->sense_dma_addr =0 ; }/* request buffer */ if (scsi_sg_count (cmnd)) { -dma_unmap_single (&pci_dev->dev, cmnd->SCp.dma_handle, +dma_unmap_single (&pci_dev->dev, +initio_priv (cmnd)->sglist_dma_addr,sizeof (struct sg_entry ) *TOTAL_SG_ENTRY ,DMA_BIDIRECTIONAL );@@ -2796,6 +2797,7 @@ static struct scsi_host_template initio_template = { .can_queue = MAX_TARGETS * i91u_MAXQUEUE, .this_id = 1, .sg_tablesize = SG_ALL, + .cmd_size = sizeof(struct initio_cmd_priv), }; static int initio_probe_one(struct pci_dev *pdev,drivers/scsi/initio.h +0
-0@@ -640,3 +640,12 @@ typedef struct _NVRAM {#define SCSI_RESET_HOST_RESET 0x200#define SCSI_RESET_ACTION 0xff
drivers/scsi/initio.h typedef struct _NVRAM { · line 651
Quoted 10 lines
drivers/scsi/initio.h +9
-0+struct initio_cmd_priv { +dma_addr_t sense_dma_addr; +dma_addr_t sglist_dma_addr; +}; + +static inline struct initio_cmd_priv *initio_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +}
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 24/44 libfc: Stop using the SCSI pointer
In reply to Bart Van AsscheMove the fc_fcp_pkt pointer, the residual length and the SCSI status into the new data structure libfc_cmd_priv. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.
The libfc users have been identified as follows:
$ git grep -lw 'libfc_host_alloc' | grep -v /libfc drivers/scsi/bnx2fc/bnx2fc_fcoe.c drivers/scsi/fcoe/fcoe.c drivers/scsi/fnic/fnic_main.c drivers/scsi/qedf/qedf_main.c
--- drivers/scsi/bnx2fc/bnx2fc.h | 10 ++++++++-- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 1 + drivers/scsi/bnx2fc/bnx2fc_io.c | 20 ++++++++++---------- drivers/scsi/fcoe/fcoe.c | 1 + drivers/scsi/fnic/fnic.h | 1 + drivers/scsi/libfc/fc_fcp.c | 26 +++++++++++--------------- drivers/scsi/qedf/qedf.h | 11 ++++++++++- drivers/scsi/qedf/qedf_io.c | 16 ++++++++-------- drivers/scsi/qedf/qedf_main.c | 3 ++- include/scsi/libfc.h | 11 +++++++++++ 10 files changed, 63 insertions(+), 37 deletions(-)
drivers/scsi/bnx2fc/bnx2fc.h +8 -2
@@ -137,8 +137,6 @@#define BNX2FC_FW_TIMEOUT (3 * HZ)#define PORT_MAX 2 -#define CMD_SCSI_STATUS (Cmnd) ((Cmnd)->SCp.Status) -/* FC FCP Status */ #define FC_GOOD 0
@@ -493,7 +491,15 @@ struct bnx2fc_unsol_els {struct work_struct unsol_els_work; }; +struct bnx2fc_priv { +struct libfc_cmd_priv libfc_data;/* must be the first member */ +struct bnx2fc_cmd *io_req; +}; +static inline struct bnx2fc_priv *bnx2fc_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +}struct bnx2fc_cmd *bnx2fc_cmd_alloc (struct bnx2fc_rport *tgt);struct bnx2fc_cmd *bnx2fc_elstm_alloc (struct bnx2fc_rport *tgt,int type);
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +1 -0
@@ -2975,6 +2975,7 @@ static struct scsi_host_template bnx2fc_shost_template = { .track_queue_depth = 1, .slave_configure = bnx2fc_slave_configure, .shost_groups = bnx2fc_host_groups, + .cmd_size = sizeof(struct bnx2fc_priv), };static struct libfc_function_template bnx2fc_libfc_fcn_templ = {
drivers/scsi/bnx2fc/bnx2fc_io.c +10 -10
@@ -204,7 +204,7 @@ static void bnx2fc_scsi_done(struct bnx2fc_cmd *io_req, int err_code) sc_cmd,host_byte (sc_cmd->result), sc_cmd->retries, sc_cmd->allowed);scsi_set_resid (sc_cmd,scsi_bufflen (sc_cmd)); - sc_cmd->SCp.ptr =NULL ; +bnx2fc_priv (sc_cmd)->io_req =NULL ;scsi_done (sc_cmd); }
@@ -765,7 +765,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) task = &(task_page[index]);bnx2fc_init_mp_task (io_req, task); - sc_cmd->SCp.ptr = (char *)io_req; +bnx2fc_priv (sc_cmd)->io_req = io_req;/* Obtain free SQ entry */ spin_lock_bh (&tgt->tgt_lock);
@@ -1147,7 +1147,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)BNX2FC_TGT_DBG (tgt,"Entered bnx2fc_eh_abort\n" );spin_lock_bh (&tgt->tgt_lock); - io_req = (struct bnx2fc_cmd *)sc_cmd->SCp.ptr; + io_req =bnx2fc_priv (sc_cmd)->io_req;if (!io_req) {/* Command might have just completed */ printk(KERN_ERR PFX "eh_abort: io_req is NULL\n");
@@ -1572,7 +1572,7 @@ void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req, printk(KERN_ERR PFX "tmf's fc_hdr r_ctl = 0x%x\n", fc_hdr->fh_r_ctl); } -if (!sc_cmd->SCp.ptr) { +if (!bnx2fc_priv (sc_cmd)->io_req) { printk(KERN_ERR PFX "tm_compl: SCp.ptr is NULL\n");return ; }
@@ -1609,7 +1609,7 @@ void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req,return ; } - sc_cmd->SCp.ptr =NULL ; +bnx2fc_priv (sc_cmd)->io_req =NULL ;scsi_done (sc_cmd);kref_put (&io_req->refcount, bnx2fc_cmd_release);
@@ -1773,8 +1773,8 @@ static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req, io_req->fcp_resid = fcp_rsp->fcp_resid; io_req->scsi_comp_flags = rsp_flags; -CMD_SCSI_STATUS (sc_cmd) = io_req->cdb_status = - fcp_rsp->scsi_status_code; +bnx2fc_priv (sc_cmd)->libfc_data.status = io_req->cdb_status = + fcp_rsp->scsi_status_code;/* Fetch fcp_rsp_info and fcp_sns_info if available */ if (num_rq) {
@@ -1946,7 +1946,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,/* parse fcp_rsp and obtain sense data from RQ if available */ bnx2fc_parse_fcp_rsp (io_req, fcp_rsp, num_rq, rq_data); -if (!sc_cmd->SCp.ptr) { +if (!bnx2fc_priv (sc_cmd)->io_req) { printk(KERN_ERR PFX "SCp.ptr is NULL\n");return ; }
@@ -2018,7 +2018,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, io_req->fcp_status);break ; } - sc_cmd->SCp.ptr =NULL ; +bnx2fc_priv (sc_cmd)->io_req =NULL ;scsi_done (sc_cmd);kref_put (&io_req->refcount, bnx2fc_cmd_release); }
@@ -2044,7 +2044,7 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, io_req->port = port; io_req->tgt = tgt; io_req->data_xfer_len =scsi_bufflen (sc_cmd); - sc_cmd->SCp.ptr = (char *)io_req; +bnx2fc_priv (sc_cmd)->io_req = io_req; stats =per_cpu_ptr (lport->stats,get_cpu ());if (sc_cmd->sc_data_direction ==DMA_FROM_DEVICE ) {
drivers/scsi/fcoe/fcoe.c +1 -0
@@ -277,6 +277,7 @@ static struct scsi_host_template fcoe_shost_template = { .sg_tablesize = SG_ALL, .max_sectors = 0xffff, .track_queue_depth = 1, + .cmd_size = sizeof(struct libfc_cmd_priv), };/**
drivers/scsi/fnic/fnic.h +1 -0
@@ -93,6 +93,7 @@* These fields are locked by the hashed io_req_lock. */ struct fnic_cmd_priv { +struct libfc_cmd_priv libfc_data;/* must be the first member */ struct fnic_io_req *io_req;enum fnic_ioreq_state state;u32 flags;
drivers/scsi/libfc/fc_fcp.c +11 -15
@@ -45,14 +45,10 @@ static struct kmem_cache *scsi_pkt_cachep;#define FC_SRB_READ (1 << 1)#define FC_SRB_WRITE (1 << 0) -/* -* The SCp.ptr should be tested and set under the scsi_pkt_queue lock -*/ -#define CMD_SP (Cmnd) ((struct fc_fcp_pkt *)(Cmnd)->SCp.ptr) -#define CMD_ENTRY_STATUS (Cmnd) ((Cmnd)->SCp.have_data_in) -#define CMD_COMPL_STATUS (Cmnd) ((Cmnd)->SCp.this_residual) -#define CMD_SCSI_STATUS (Cmnd) ((Cmnd)->SCp.Status) -#define CMD_RESID_LEN (Cmnd) ((Cmnd)->SCp.buffers_residual) +static struct libfc_cmd_priv *libfc_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +}/** * struct fc_fcp_internal - FCP layer internal data
@@ -1137,7 +1133,7 @@ static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp)unsigned long flags;int rc; - fsp->cmd->SCp.ptr = (char *)fsp; +libfc_priv (fsp->cmd)->fsp = fsp; fsp->cdb_cmd.fc_dl =htonl (fsp->data_len); fsp->cdb_cmd.fc_flags = fsp->req_flags & ~FCP_CFL_LEN_MASK ;
@@ -1150,7 +1146,7 @@ static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp) rc = lport->tt.fcp_cmd_send (lport, fsp, fc_fcp_recv);if (unlikely (rc)) {spin_lock_irqsave (&si->scsi_queue_lock, flags); - fsp->cmd->SCp.ptr =NULL ; +libfc_priv (fsp->cmd)->fsp =NULL ;list_del (&fsp->list);spin_unlock_irqrestore (&si->scsi_queue_lock, flags); }
@@ -1983,7 +1979,7 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)fc_fcp_can_queue_ramp_up (lport); sc_cmd = fsp->cmd; -CMD_SCSI_STATUS (sc_cmd) = fsp->cdb_status; +libfc_priv (sc_cmd)->status = fsp->cdb_status;switch (fsp->status_code) {case FC_COMPLETE :if (fsp->cdb_status ==0 ) {
@@ -1992,7 +1988,7 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)*/ sc_cmd->result =DID_OK <<16 ;if (fsp->scsi_resid) -CMD_RESID_LEN (sc_cmd) = fsp->scsi_resid; +libfc_priv (sc_cmd)->resid_len = fsp->scsi_resid; }else {/* * transport level I/O was ok but scsi
@@ -2025,7 +2021,7 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)*/ FC_FCP_DBG (fsp,"Returning DID_ERROR to scsi-ml " "due to FC_DATA_UNDRUN (scsi)\n" ); -CMD_RESID_LEN (sc_cmd) = fsp->scsi_resid; +libfc_priv (sc_cmd)->resid_len = fsp->scsi_resid; sc_cmd->result = (DID_ERROR <<16 ) | fsp->cdb_status; }break ;
@@ -2085,7 +2081,7 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)spin_lock_irqsave (&si->scsi_queue_lock, flags);list_del (&fsp->list); - sc_cmd->SCp.ptr =NULL ; +libfc_priv (sc_cmd)->fsp =NULL ;spin_unlock_irqrestore (&si->scsi_queue_lock, flags);scsi_done (sc_cmd);
@@ -2121,7 +2117,7 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd) si =fc_get_scsi_internal (lport);spin_lock_irqsave (&si->scsi_queue_lock, flags); - fsp =CMD_SP (sc_cmd); + fsp =libfc_priv (sc_cmd)->fsp;if (!fsp) {/* command completed while scsi eh was setting up */ spin_unlock_irqrestore (&si->scsi_queue_lock, flags);
drivers/scsi/qedf/qedf.h +10 -1
@@ -91,7 +91,6 @@ enum qedf_ioreq_event {#define FC_GOOD 0#define FCOE_FCP_RSP_FLAGS_FCP_RESID_OVER (0x1<<2)#define FCOE_FCP_RSP_FLAGS_FCP_RESID_UNDER (0x1<<3) -#define CMD_SCSI_STATUS (Cmnd) ((Cmnd)->SCp.Status)#define FCOE_FCP_RSP_FLAGS_FCP_RSP_LEN_VALID (0x1<<0)#define FCOE_FCP_RSP_FLAGS_FCP_SNS_LEN_VALID (0x1<<1)struct qedf_ioreq {
@@ -189,6 +188,16 @@ struct qedf_ioreq {unsigned int alloc; }; +struct qedf_cmd_priv { +struct libfc_cmd_priv libfc_data;/* must be the first member */ +struct qedf_ioreq *io_req; +}; + +static inline struct qedf_cmd_priv *qedf_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +extern struct workqueue_struct *qedf_io_wq;struct qedf_rport {
drivers/scsi/qedf/qedf_io.c +8 -8
@@ -857,7 +857,7 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req)/* Initialize rest of io_req fileds */ io_req->data_xfer_len =scsi_bufflen (sc_cmd); - sc_cmd->SCp.ptr = (char *)io_req; +qedf_priv (sc_cmd)->io_req = io_req; io_req->sge_type =QEDF_IOREQ_FAST_SGE ;/* Assume fast SGL by default */ /* Record which cpu this request is associated with */
@@ -1065,7 +1065,7 @@ static void qedf_parse_fcp_rsp(struct qedf_ioreq *io_req, io_req->fcp_resid = fcp_rsp->fcp_resid; io_req->scsi_comp_flags = rsp_flags; -CMD_SCSI_STATUS (sc_cmd) = io_req->cdb_status = +qedf_priv (sc_cmd)->libfc_data.status = io_req->cdb_status = fcp_rsp->scsi_status_code; if (rsp_flags &
@@ -1150,7 +1150,7 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,return ; } -if (!sc_cmd->SCp.ptr) { +if (!qedf_priv (sc_cmd)->io_req) {QEDF_WARN (&(qedf->dbg_ctx),"SCp.ptr is NULL, returned in " "another context.\n" );return ;
@@ -1312,7 +1312,7 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,clear_bit (QEDF_CMD_OUTSTANDING , &io_req->flags); io_req->sc_cmd =NULL ; - sc_cmd->SCp.ptr =NULL ; +qedf_priv (sc_cmd)->io_req =NULL ;scsi_done (sc_cmd);kref_put (&io_req->refcount, qedf_release_cmd); }
@@ -1354,7 +1354,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, goto bad_scsi_ptr; } -if (!sc_cmd->SCp.ptr) { +if (!qedf_priv (sc_cmd)->io_req) {QEDF_WARN (&(qedf->dbg_ctx),"SCp.ptr is NULL, returned in " "another context.\n" );return ;
@@ -1409,7 +1409,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,qedf_trace_io (io_req->fcport, io_req,QEDF_IO_TRACE_RSP ); io_req->sc_cmd =NULL ; - sc_cmd->SCp.ptr =NULL ; +qedf_priv (sc_cmd)->io_req =NULL ;scsi_done (sc_cmd);kref_put (&io_req->refcount, qedf_release_cmd);return ;
@@ -2433,8 +2433,8 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) (tm_flags ==FCP_TMF_TGT_RESET ) ?"TARGET RESET" : "LUN RESET"); -if (sc_cmd->SCp.ptr) { - io_req = (struct qedf_ioreq *)sc_cmd->SCp.ptr; +if (qedf_priv (sc_cmd)->io_req) { + io_req =qedf_priv (sc_cmd)->io_req; ref_cnt =kref_read (&io_req->refcount); QEDF_ERR(NULL, "orig io_req = %p xid = 0x%x ref_cnt = %d.\n",
drivers/scsi/qedf/qedf_main.c +2 -1
@@ -740,7 +740,7 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd) } - io_req = (struct qedf_ioreq *)sc_cmd->SCp.ptr; + io_req =qedf_priv (sc_cmd)->io_req;if (!io_req) { QEDF_ERR(&qedf->dbg_ctx, "sc_cmd not queued with lld, sc_cmd=%p op=0x%02x, port_id=%06x\n",
@@ -996,6 +996,7 @@ static struct scsi_host_template qedf_host_template = { .sg_tablesize = QEDF_MAX_BDS_PER_CMD, .can_queue = FCOE_PARAMS_NUM_TASKS, .change_queue_depth = scsi_change_queue_depth, + .cmd_size = sizeof(struct qedf_cmd_priv), };static int qedf_get_paged_crc_eof (struct sk_buff *skb,int tlen)
include/scsi/libfc.h +11 -0
@@ -351,6 +351,15 @@ struct fc_fcp_pkt {struct completion tm_done; }____cacheline_aligned_in_smp ; +/* +* @fsp should be tested and set under the scsi_pkt_queue lock +*/ +struct libfc_cmd_priv { +struct fc_fcp_pkt *fsp; +u32 resid_len; +u8 status; +}; +/* * Structure and function definitions for managing Fibre Channel Exchanges * and Sequences
@@ -862,6 +871,8 @@ libfc_host_alloc(struct scsi_host_template *sht, int priv_size)struct fc_lport *lport;struct Scsi_Host *shost; +WARN_ON_ONCE (sht->cmd_size <sizeof (struct libfc_cmd_priv )); + shost =scsi_host_alloc (sht,sizeof (*lport) + priv_size);if (!shost)return NULL ;
Hannes Reinecke
maintainerRe: [PATCH v2 24/44] libfc: Stop using the SCSI pointer
Quoted 43 lines · Bart Van Assche
Move the
fc_fcp_pktpointer, the residual length and the SCSI status into the new data structurelibfc_cmd_priv. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.The libfc users have been identified as follows:
$ git grep -lw 'libfc_host_alloc' | grep -v /libfc drivers/scsi/bnx2fc/bnx2fc_fcoe.c drivers/scsi/fcoe/fcoe.c drivers/scsi/fnic/fnic_main.c drivers/scsi/qedf/qedf_main.cCc Hannes Reinecke <[email protected]>Cc Saurav Kashyap <[email protected]>Cc Javed Hasan <[email protected]>Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/bnx2fc/bnx2fc.h | 10 ++++++++-- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 1 + drivers/scsi/bnx2fc/bnx2fc_io.c | 20 ++++++++++---------- drivers/scsi/fcoe/fcoe.c | 1 + drivers/scsi/fnic/fnic.h | 1 + drivers/scsi/libfc/fc_fcp.c | 26 +++++++++++--------------- drivers/scsi/qedf/qedf.h | 11 ++++++++++- drivers/scsi/qedf/qedf_io.c | 16 ++++++++-------- drivers/scsi/qedf/qedf_main.c | 3 ++- include/scsi/libfc.h | 11 +++++++++++ 10 files changed, 63 insertions(+), 37 deletions(-)drivers/scsi/bnx2fc/bnx2fc.h +0
-2@@ -137,8 +137,6 @@#define BNX2FC_FW_TIMEOUT (3 * HZ)#define PORT_MAX 2 -#define CMD_SCSI_STATUS (Cmnd) ((Cmnd)->SCp.Status) -/* FC FCP Status */ #define FC_GOOD 0
drivers/scsi/bnx2fc/bnx2fc.h struct bnx2fc_unsol_els { · line 498
Quoted 8 lines
drivers/scsi/bnx2fc/bnx2fc.h +4
-0@@ -493,7 +491,15 @@ struct bnx2fc_unsol_els {struct work_struct unsol_els_work; }; +struct bnx2fc_priv { +struct libfc_cmd_priv libfc_data;/* must be the first member */ +struct bnx2fc_cmd *io_req; +};
I am not sure this is correct.
Both, libfc and the fcoe drivers do use SCp.ptr, but from what I can see each in different ways. So I'm not sure that we need to stack the private data; we never did that previously. Some more careful audit is required to separate out the usage here.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 24/44] libfc: Stop using the SCSI pointer
Quoted 10 lines · Hannes Reinecke
drivers/scsi/bnx2fc/bnx2fc.h struct bnx2fc_unsol_els { · line 497
Quoted 4 lines · Bart Van Assche
drivers/scsi/bnx2fc/bnx2fc.h +4
-0+struct bnx2fc_priv { + struct libfc_cmd_priv libfc_data; /* must be the first member */ + struct bnx2fc_cmd *io_req; +};I am not sure this is correct.
Both, libfc and the fcoe drivers do use SCp.ptr, but from what I can see each in different ways. So I'm not sure that we need to stack the private data; we never did that previously. Some more careful audit is required to separate out the usage here.
My understanding is that the bnx2fc driver works as follows:
- libfc and libfcoe are used for the slow path. These libraries use the 'fsp' member of struct libfc_cmd_priv (formerly CMD_SP(scsi_cmd)).
- bnx2fc_priv.io_req is only used for the fast path (hardware offloading).
I think it is safe to use different pointer members for the slow path and the fast path. Although this change is not essential, this allows to remove several pointer type casts from the bnx2fc driver.
Thanks,
Bart.
Re: [PATCH v2 24/44] libfc: Stop using the SCSI pointer
In reply to Bart Van AsscheQuoted 411 lines · Bart Van Assche
Move the
fc_fcp_pktpointer, the residual length and the SCSI status into the new data structurelibfc_cmd_priv. This patch prepares for removal of the SCSI pointer from structscsi_cmnd.The libfc users have been identified as follows:
$ git grep -lw 'libfc_host_alloc' | grep -v /libfc drivers/scsi/bnx2fc/bnx2fc_fcoe.c drivers/scsi/fcoe/fcoe.c drivers/scsi/fnic/fnic_main.c drivers/scsi/qedf/qedf_main.cCc Hannes Reinecke <[email protected]>Cc Saurav Kashyap <[email protected]>Cc Javed Hasan <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/scsi/bnx2fc/bnx2fc.h | 10 ++++++++-- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 1 + drivers/scsi/bnx2fc/bnx2fc_io.c | 20 ++++++++++---------- drivers/scsi/fcoe/fcoe.c | 1 + drivers/scsi/fnic/fnic.h | 1 + drivers/scsi/libfc/fc_fcp.c | 26 +++++++++++--------------- drivers/scsi/qedf/qedf.h | 11 ++++++++++- drivers/scsi/qedf/qedf_io.c | 16 ++++++++-------- drivers/scsi/qedf/qedf_main.c | 3 ++- include/scsi/libfc.h | 11 +++++++++++ 10 files changed, 63 insertions(+), 37 deletions(-)drivers/scsi/bnx2fc/bnx2fc.h +8
-2@@ -137,8 +137,6 @@#define BNX2FC_FW_TIMEOUT (3 * HZ)#define PORT_MAX 2 -#define CMD_SCSI_STATUS (Cmnd) ((Cmnd)->SCp.Status) -/* FC FCP Status */ #define FC_GOOD 0@@ -493,7 +491,15 @@ struct bnx2fc_unsol_els {struct work_struct unsol_els_work; }; +struct bnx2fc_priv { +struct libfc_cmd_priv libfc_data;/* must be the first member */ +struct bnx2fc_cmd *io_req; +}; +static inline struct bnx2fc_priv *bnx2fc_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +}struct bnx2fc_cmd *bnx2fc_cmd_alloc (struct bnx2fc_rport *tgt);struct bnx2fc_cmd *bnx2fc_elstm_alloc (struct bnx2fc_rport *tgt,int type);drivers/scsi/bnx2fc/bnx2fc_fcoe.c +1
-0@@ -2975,6 +2975,7 @@ static struct scsi_host_template bnx2fc_shost_template = { .track_queue_depth = 1, .slave_configure = bnx2fc_slave_configure, .shost_groups = bnx2fc_host_groups, + .cmd_size = sizeof(struct bnx2fc_priv), };static struct libfc_function_template bnx2fc_libfc_fcn_templ = {drivers/scsi/bnx2fc/bnx2fc_io.c +10
-10@@ -204,7 +204,7 @@ static void bnx2fc_scsi_done(struct bnx2fc_cmd *io_req, int err_code) sc_cmd,host_byte (sc_cmd->result), sc_cmd->retries, sc_cmd->allowed);scsi_set_resid (sc_cmd,scsi_bufflen (sc_cmd)); - sc_cmd->SCp.ptr =NULL ; +bnx2fc_priv (sc_cmd)->io_req =NULL ;scsi_done (sc_cmd); }@@ -765,7 +765,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) task = &(task_page[index]);bnx2fc_init_mp_task (io_req, task); - sc_cmd->SCp.ptr = (char *)io_req; +bnx2fc_priv (sc_cmd)->io_req = io_req;/* Obtain free SQ entry */ spin_lock_bh (&tgt->tgt_lock);@@ -1147,7 +1147,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)BNX2FC_TGT_DBG (tgt,"Entered bnx2fc_eh_abort\n" );spin_lock_bh (&tgt->tgt_lock); - io_req = (struct bnx2fc_cmd *)sc_cmd->SCp.ptr; + io_req =bnx2fc_priv (sc_cmd)->io_req;if (!io_req) {/* Command might have just completed */ printk(KERN_ERR PFX "eh_abort: io_req is NULL\n");@@ -1572,7 +1572,7 @@ void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req, printk(KERN_ERR PFX "tmf's fc_hdr r_ctl = 0x%x\n", fc_hdr->fh_r_ctl); } -if (!sc_cmd->SCp.ptr) { +if (!bnx2fc_priv (sc_cmd)->io_req) { printk(KERN_ERR PFX "tm_compl: SCp.ptr is NULL\n");return ; }@@ -1609,7 +1609,7 @@ void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req,return ; } - sc_cmd->SCp.ptr =NULL ; +bnx2fc_priv (sc_cmd)->io_req =NULL ;scsi_done (sc_cmd);kref_put (&io_req->refcount, bnx2fc_cmd_release);@@ -1773,8 +1773,8 @@ static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req, io_req->fcp_resid = fcp_rsp->fcp_resid; io_req->scsi_comp_flags = rsp_flags; -CMD_SCSI_STATUS (sc_cmd) = io_req->cdb_status = - fcp_rsp->scsi_status_code; +bnx2fc_priv (sc_cmd)->libfc_data.status = io_req->cdb_status = + fcp_rsp->scsi_status_code;/* Fetch fcp_rsp_info and fcp_sns_info if available */ if (num_rq) {@@ -1946,7 +1946,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,/* parse fcp_rsp and obtain sense data from RQ if available */ bnx2fc_parse_fcp_rsp (io_req, fcp_rsp, num_rq, rq_data); -if (!sc_cmd->SCp.ptr) { +if (!bnx2fc_priv (sc_cmd)->io_req) { printk(KERN_ERR PFX "SCp.ptr is NULL\n");return ; }@@ -2018,7 +2018,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, io_req->fcp_status);break ; } - sc_cmd->SCp.ptr =NULL ; +bnx2fc_priv (sc_cmd)->io_req =NULL ;scsi_done (sc_cmd);kref_put (&io_req->refcount, bnx2fc_cmd_release); }@@ -2044,7 +2044,7 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, io_req->port = port; io_req->tgt = tgt; io_req->data_xfer_len =scsi_bufflen (sc_cmd); - sc_cmd->SCp.ptr = (char *)io_req; +bnx2fc_priv (sc_cmd)->io_req = io_req; stats =per_cpu_ptr (lport->stats,get_cpu ());if (sc_cmd->sc_data_direction ==DMA_FROM_DEVICE ) {drivers/scsi/fcoe/fcoe.c +1
-0@@ -277,6 +277,7 @@ static struct scsi_host_template fcoe_shost_template = { .sg_tablesize = SG_ALL, .max_sectors = 0xffff, .track_queue_depth = 1, + .cmd_size = sizeof(struct libfc_cmd_priv), };/** drivers/scsi/fnic/fnic.h +1
-0@@ -93,6 +93,7 @@* These fields are locked by the hashed io_req_lock. */ struct fnic_cmd_priv { +struct libfc_cmd_priv libfc_data;/* must be the first member */ struct fnic_io_req *io_req;enum fnic_ioreq_state state;u32 flags;drivers/scsi/libfc/fc_fcp.c +11
-15@@ -45,14 +45,10 @@ static struct kmem_cache *scsi_pkt_cachep;#define FC_SRB_READ (1 << 1)#define FC_SRB_WRITE (1 << 0) -/* -* The SCp.ptr should be tested and set under the scsi_pkt_queue lock -*/ -#define CMD_SP (Cmnd) ((struct fc_fcp_pkt *)(Cmnd)->SCp.ptr) -#define CMD_ENTRY_STATUS (Cmnd) ((Cmnd)->SCp.have_data_in) -#define CMD_COMPL_STATUS (Cmnd) ((Cmnd)->SCp.this_residual) -#define CMD_SCSI_STATUS (Cmnd) ((Cmnd)->SCp.Status) -#define CMD_RESID_LEN (Cmnd) ((Cmnd)->SCp.buffers_residual) +static struct libfc_cmd_priv *libfc_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +}/** * struct fc_fcp_internal - FCP layer internal data @@ -1137,7 +1133,7 @@ static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp)unsigned long flags;int rc; - fsp->cmd->SCp.ptr = (char *)fsp; +libfc_priv (fsp->cmd)->fsp = fsp; fsp->cdb_cmd.fc_dl =htonl (fsp->data_len); fsp->cdb_cmd.fc_flags = fsp->req_flags & ~FCP_CFL_LEN_MASK ;@@ -1150,7 +1146,7 @@ static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp) rc = lport->tt.fcp_cmd_send (lport, fsp, fc_fcp_recv);if (unlikely (rc)) {spin_lock_irqsave (&si->scsi_queue_lock, flags); - fsp->cmd->SCp.ptr =NULL ; +libfc_priv (fsp->cmd)->fsp =NULL ;list_del (&fsp->list);spin_unlock_irqrestore (&si->scsi_queue_lock, flags); }@@ -1983,7 +1979,7 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)fc_fcp_can_queue_ramp_up (lport); sc_cmd = fsp->cmd; -CMD_SCSI_STATUS (sc_cmd) = fsp->cdb_status; +libfc_priv (sc_cmd)->status = fsp->cdb_status;switch (fsp->status_code) {case FC_COMPLETE :if (fsp->cdb_status ==0 ) {@@ -1992,7 +1988,7 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)*/ sc_cmd->result =DID_OK <<16 ;if (fsp->scsi_resid) -CMD_RESID_LEN (sc_cmd) = fsp->scsi_resid; +libfc_priv (sc_cmd)->resid_len = fsp->scsi_resid; }else {/* * transport level I/O was ok but scsi @@ -2025,7 +2021,7 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)*/ FC_FCP_DBG (fsp,"Returning DID_ERROR to scsi-ml " "due to FC_DATA_UNDRUN (scsi)\n" ); -CMD_RESID_LEN (sc_cmd) = fsp->scsi_resid; +libfc_priv (sc_cmd)->resid_len = fsp->scsi_resid; sc_cmd->result = (DID_ERROR <<16 ) | fsp->cdb_status; }break ;@@ -2085,7 +2081,7 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)spin_lock_irqsave (&si->scsi_queue_lock, flags);list_del (&fsp->list); - sc_cmd->SCp.ptr =NULL ; +libfc_priv (sc_cmd)->fsp =NULL ;spin_unlock_irqrestore (&si->scsi_queue_lock, flags);scsi_done (sc_cmd);@@ -2121,7 +2117,7 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd) si =fc_get_scsi_internal (lport);spin_lock_irqsave (&si->scsi_queue_lock, flags); - fsp =CMD_SP (sc_cmd); + fsp =libfc_priv (sc_cmd)->fsp;if (!fsp) {/* command completed while scsi eh was setting up */ spin_unlock_irqrestore (&si->scsi_queue_lock, flags);drivers/scsi/qedf/qedf.h +10
-1@@ -91,7 +91,6 @@ enum qedf_ioreq_event {#define FC_GOOD 0#define FCOE_FCP_RSP_FLAGS_FCP_RESID_OVER (0x1<<2)#define FCOE_FCP_RSP_FLAGS_FCP_RESID_UNDER (0x1<<3) -#define CMD_SCSI_STATUS (Cmnd) ((Cmnd)->SCp.Status)#define FCOE_FCP_RSP_FLAGS_FCP_RSP_LEN_VALID (0x1<<0)#define FCOE_FCP_RSP_FLAGS_FCP_SNS_LEN_VALID (0x1<<1)struct qedf_ioreq {@@ -189,6 +188,16 @@ struct qedf_ioreq {unsigned int alloc; }; +struct qedf_cmd_priv { +struct libfc_cmd_priv libfc_data;/* must be the first member */ +struct qedf_ioreq *io_req; +}; + +static inline struct qedf_cmd_priv *qedf_priv (struct scsi_cmnd *cmd) +{ +return scsi_cmd_priv (cmd); +} +extern struct workqueue_struct *qedf_io_wq;struct qedf_rport {drivers/scsi/qedf/qedf_io.c +8
-8@@ -857,7 +857,7 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req)/* Initialize rest of io_req fileds */ io_req->data_xfer_len =scsi_bufflen (sc_cmd); - sc_cmd->SCp.ptr = (char *)io_req; +qedf_priv (sc_cmd)->io_req = io_req; io_req->sge_type =QEDF_IOREQ_FAST_SGE ;/* Assume fast SGL by default */ /* Record which cpu this request is associated with */ @@ -1065,7 +1065,7 @@ static void qedf_parse_fcp_rsp(struct qedf_ioreq *io_req, io_req->fcp_resid = fcp_rsp->fcp_resid; io_req->scsi_comp_flags = rsp_flags; -CMD_SCSI_STATUS (sc_cmd) = io_req->cdb_status = +qedf_priv (sc_cmd)->libfc_data.status = io_req->cdb_status = fcp_rsp->scsi_status_code; if (rsp_flags &@@ -1150,7 +1150,7 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,return ; } -if (!sc_cmd->SCp.ptr) { +if (!qedf_priv (sc_cmd)->io_req) {QEDF_WARN (&(qedf->dbg_ctx),"SCp.ptr is NULL, returned in " "another context.\n" );return ;@@ -1312,7 +1312,7 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,clear_bit (QEDF_CMD_OUTSTANDING , &io_req->flags); io_req->sc_cmd =NULL ; - sc_cmd->SCp.ptr =NULL ; +qedf_priv (sc_cmd)->io_req =NULL ;scsi_done (sc_cmd);kref_put (&io_req->refcount, qedf_release_cmd); }@@ -1354,7 +1354,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req, goto bad_scsi_ptr; } -if (!sc_cmd->SCp.ptr) { +if (!qedf_priv (sc_cmd)->io_req) {QEDF_WARN (&(qedf->dbg_ctx),"SCp.ptr is NULL, returned in " "another context.\n" );return ;@@ -1409,7 +1409,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,qedf_trace_io (io_req->fcport, io_req,QEDF_IO_TRACE_RSP ); io_req->sc_cmd =NULL ; - sc_cmd->SCp.ptr =NULL ; +qedf_priv (sc_cmd)->io_req =NULL ;scsi_done (sc_cmd);kref_put (&io_req->refcount, qedf_release_cmd);return ;@@ -2433,8 +2433,8 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags) (tm_flags ==FCP_TMF_TGT_RESET ) ?"TARGET RESET" : "LUN RESET"); -if (sc_cmd->SCp.ptr) { - io_req = (struct qedf_ioreq *)sc_cmd->SCp.ptr; +if (qedf_priv (sc_cmd)->io_req) { + io_req =qedf_priv (sc_cmd)->io_req; ref_cnt =kref_read (&io_req->refcount); QEDF_ERR(NULL, "orig io_req = %p xid = 0x%x ref_cnt = %d.\n",drivers/scsi/qedf/qedf_main.c +2
-1@@ -740,7 +740,7 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd) } - io_req = (struct qedf_ioreq *)sc_cmd->SCp.ptr; + io_req =qedf_priv (sc_cmd)->io_req;if (!io_req) { QEDF_ERR(&qedf->dbg_ctx, "sc_cmd not queued with lld, sc_cmd=%p op=0x%02x, port_id=%06x\n",@@ -996,6 +996,7 @@ static struct scsi_host_template qedf_host_template = { .sg_tablesize = QEDF_MAX_BDS_PER_CMD, .can_queue = FCOE_PARAMS_NUM_TASKS, .change_queue_depth = scsi_change_queue_depth, + .cmd_size = sizeof(struct qedf_cmd_priv), };static int qedf_get_paged_crc_eof (struct sk_buff *skb,int tlen)include/scsi/libfc.h +9
-0@@ -351,6 +351,15 @@ struct fc_fcp_pkt {struct completion tm_done; }____cacheline_aligned_in_smp ; +/* +* @fsp should be tested and set under the scsi_pkt_queue lock +*/ +struct libfc_cmd_priv { +struct fc_fcp_pkt *fsp; +u32 resid_len; +u8 status; +}; +/* * Structure and function definitions for managing Fibre Channel Exchanges * and Sequences
include/scsi/libfc.h libfc_host_alloc(struct scsi_host_template *sht, int priv_size) · line 878
Quoted 8 lines
include/scsi/libfc.h +2
-0@@ -862,6 +871,8 @@ libfc_host_alloc(struct scsi_host_template *sht, int priv_size)struct fc_lport *lport;struct Scsi_Host *shost; +WARN_ON_ONCE (sht->cmd_size <sizeof (struct libfc_cmd_priv )); + shost =scsi_host_alloc (sht,sizeof (*lport) + priv_size);if (!shost)return NULL ;
--
Himanshu Madhani Oracle Linux Engineering
PATCH v2 25/44 mac53c94: Fix a set-but-not-used compiler warning
In reply to Bart Van AsscheFix the following compiler warning:
drivers/scsi/mac53c94.c: In function 'mac53c94_init':
drivers/scsi/mac53c94.c:128:13: warning: variable 'x' set but not used [-Wunused-but-set-variable]
128 | int x;
--- drivers/scsi/mac53c94.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/mac53c94.c +1 -2
@@ -125,7 +125,6 @@ static void mac53c94_init(struct fsc_state *state) {struct mac53c94_regs __iomem *regs = state->regs;struct dbdma_regs __iomem *dma = state->dma; -int x;writeb (state->host->this_id |CF1_PAR_ENABLE , ®s->config1);writeb (TIMO_VAL (250 ), ®s->sel_timeout);/* 250ms */
@@ -134,7 +133,7 @@ static void mac53c94_init(struct fsc_state *state)writeb (0 , ®s->config3);writeb (0 , ®s->sync_period);writeb (0 , ®s->sync_offset); - x =readb (®s->interrupt); + (void )readb (®s->interrupt);writel ((RUN |PAUSE |FLUSH |WAKE ) <<16 , &dma->control); }