scsi_data_buffer for after the last driver is converted
Subsystems (8)
cover scsi_data_buffer for after the last driver is converted
This is a resend of all the remaining drivers rebased to latest code. And once the entire tree is converted, move to scsi_data_buffer in scsi_cmnd.
The work is on top of Jens's for-linus branch which is effectively sglist-arch (+ last minute fixes) This is because sglist-arch was already rebased to latest scsi-misc through linus tree, merged with the extra work done there on scsi-ml (and the drivers) (Thanks Jens)
summery of patches:
left over from scsi_eh last change
[PATCH 01/32] arm: fas216 Use scsi_eh API for REQUEST_SENSE invocation
lots and lots of drivers left:
[PATCH 02/32] isd200.c: use one-element sg list in issuing commands [PATCH 03/32] usb: transport - convert to accessors and !use_sg code path removal [PATCH 04/32] usb: protocol.c - convert to accessors and !use_sg code path removal [PATCH 05/32] usb: shuttle_usbat.c - convert to accessors and !use_sg code path removal [PATCH 06/32] usb: freecom.c & sddr09.c - convert to accessors and !use_sg cleanup [PATCH 07/32] NCR5380 familly convert to accessors & !use_sg cleanup [PATCH 08/32] arm: scsi convert to accessors and !use_sg cleanup
[PATCH 09/32] nsp_cs.c convert to data accessors and !use_sg cleanup [PATCH 10/32] eata_pio.c: convert to accessors and !use_sg cleanup
[PATCH 11/32] a2091.c: convert to accessors and !use_sg cleanup
[PATCH 12/32] a3000.c: convert to accessors and !use_sg cleanup
[PATCH 13/32] aha1542.c: convert to accessors and !use_sg cleanup
[PATCH 14/32] atp870u.c: convert to accessors and !use_sg cleanup
[PATCH 15/32] fd_mcs.c: convert to accessors and !use_sg cleanup
[PATCH 16/32] imm.c: convert to accessors and !use_sg cleanup
[PATCH 17/32] ppa.c: convert to accessors and !use_sg cleanup
[PATCH 18/32] wd32c93.c: convert to accessors and !use_sg cleanup
[PATCH 19/32] qlogicpti.c: convert to accessors and !use_sg cleanup [PATCH 20/32] in2000.c: convert to accessors and !use_sg cleanup
[PATCH 21/32] scsi_debug: convert to use the data buffer accessors
Tomo's patch cleaned up:
[PATCH 22/32] qla1280: convert to use the data buffer accessors [PATCH 23/32] qla1280: Indentation fix
I separated the indentation from the real change make the patch humanly readable.
A small fix:
[PATCH 24/32] wd7000.c - proper fix for boards without sg support
Remove broken drivers:
[PATCH 25/32] Remove psi240i driver from kernel [PATCH 26/32] Remove of seagate.c driver (pluto/fc was removed by Matthew.)
Move to scsi_data_buffer:
[PATCH 27/32] scsi_data_buffer
[PATCH 28/32] scsi_data_buffer - scsi_error.c
[PATCH 29/32] scsi_data_buffer - sd.c and sr.c
[PATCH 30/32] tgt: convert to use scsi_data_buffer
[PATCH 31/32] tgt: convert ibmvstgt and libsrp to use scsi_data_buffer [PATCH 32/32] isd200.c - use of scsi_data_buffer
It used to be that the tgt was broken between scsi_data_buffer patch and the patch to tgt, because of the API change to scsi_alloc/free_sgtable(). I have added a shim in scsi_tgt_lib.c so it can compile and run. The shim is later removed in the tgt patch.
Did I miss any maintainers in the To: fields?
Boaz
PATCH 1/32 arm: fas216 Use scsi_eh API for REQUEST_SENSE invocation
- Use new scsi_eh_prep/restor_cmnd() for synchronous REQUEST_SENSE invocation.
--- drivers/scsi/arm/fas216.c | 16 +++------------- drivers/scsi/arm/fas216.h | 3 +++ 2 files changed, 6 insertions(+), 13 deletions(-)
drivers/scsi/arm/fas216.c +3 -13
@@ -2018,6 +2018,7 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt,* the upper layers to process. This would have been set * correctly by fas216_std_done. */ +scsi_eh_restore_cmnd (SCpnt, &info->ses); SCpnt->scsi_done (SCpnt); }
@@ -2103,23 +2104,12 @@ request_sense:if (SCpnt->cmnd[0 ] ==REQUEST_SENSE ) goto done; +scsi_eh_prep_cmnd (SCpnt, &info->ses,NULL ,0 , ~0 );fas216_log_target (info,LOG_CONNECT , SCpnt->device->id,"requesting sense" ); -memset (SCpnt->cmnd,0 ,sizeof (SCpnt->cmnd)); - SCpnt->cmnd[0 ] =REQUEST_SENSE ; - SCpnt->cmnd[1 ] = SCpnt->device->lun <<5 ; - SCpnt->cmnd[4 ] =sizeof (SCpnt->sense_buffer); - SCpnt->cmd_len =COMMAND_SIZE (SCpnt->cmnd[0 ]); - SCpnt->SCp.buffer =NULL ; - SCpnt->SCp.buffers_residual =0 ; - SCpnt->SCp.ptr = (char *)SCpnt->sense_buffer; - SCpnt->SCp.this_residual =sizeof (SCpnt->sense_buffer); - SCpnt->SCp.phase =sizeof (SCpnt->sense_buffer); +init_SCp (SCpnt); SCpnt->SCp.Message =0 ; SCpnt->SCp.Status =0 ; - SCpnt->request_bufflen =sizeof (SCpnt->sense_buffer); - SCpnt->sc_data_direction =DMA_FROM_DEVICE ; - SCpnt->use_sg =0 ; SCpnt->tag =0 ; SCpnt->host_scribble = (void *)fas216_rq_sns_done;
drivers/scsi/arm/fas216.h +3 -0
@@ -16,6 +16,8 @@#define NO_IRQ 255#endif +#include <scsi/scsi_eh.h> +#include "queue.h" #include "msgqueue.h"
@@ -311,6 +313,7 @@ typedef struct {/* miscellaneous */ int internal_done;/* flag to indicate request done */ +struct scsi_eh_save *ses;/* holds request sense restore info */ unsigned long magic_end; } FAS216_Info;
Signature · 1 line
1.5.3.1
PATCH 2/32 isd200.c: use one-element sg list in issuing commands
In reply to Boaz Harrosh - This patch should be commited before:
usb: transport - convert to accessors and !use_sg code path removal
- isd200_action() was still using direct liniar pointers in issuing commands to the USB transport level. This is no longer supported, use one-element scatterlist instead.
- Adjustment of command's length in the case of scsi-to-ata translation is now restored before return to queuecommand, since other wise it can leak BIOs.
- isd200_action() return Error on unknown requests. Used to print an error but still try to send garbage cdb.
- convert few places to scsi data accessors.
- Todo: This file will need to be changed when scsi_cmnd changes to scsi_data_buffer or any other solution.
--- drivers/usb/storage/isd200.c | 66 +++++++++++++++++++++++++++++------------ 1 files changed, 46 insertions(+), 20 deletions(-)
drivers/usb/storage/isd200.c +46 -20
@@ -49,6 +49,7 @@#include <linux/slab.h> #include <linux/hdreg.h> #include <linux/ide.h> +#include <linux/scatterlist.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h>
@@ -287,6 +288,7 @@ struct isd200_info {/* maximum number of LUNs supported */ unsigned char MaxLUNs;struct scsi_cmnd srb; +struct scatterlist sg; };
@@ -398,6 +400,31 @@ static void isd200_build_sense(struct us_data *us, struct scsi_cmnd *srb)* Transport routines ***********************************************************************/ +/************************************************************************** +* isd200_set_srb(), isd200_srb_set_bufflen() +* +* Two helpers to facilitate in initialization of scsi_cmnd structure +* Will need to change when struct scsi_cmnd changes +*/ +static void isd200_set_srb (struct isd200_info *info, +enum dma_data_direction dir,void * buff,unsigned bufflen) +{ +struct scsi_cmnd *srb = &info->srb; + +if (buff) +sg_init_one (&info->sg, buff, bufflen); + + srb->sc_data_direction = dir; + srb->request_buffer = buff ? &info->sg :NULL ; + srb->request_bufflen = bufflen; + srb->use_sg = buff ?1 :0 ; +} + +static void isd200_srb_set_bufflen (struct scsi_cmnd *srb,unsigned bufflen) +{ + srb->request_bufflen = bufflen; +} +/************************************************************************** * isd200_action
@@ -432,9 +459,7 @@ static int isd200_action( struct us_data *us, int action, ata.generic.RegisterSelect =REG_CYLINDER_LOW |REG_CYLINDER_HIGH |REG_STATUS |REG_ERROR ; - srb->sc_data_direction =DMA_FROM_DEVICE ; - srb->request_buffer = pointer; - srb->request_bufflen = value; +isd200_set_srb (info,DMA_FROM_DEVICE , pointer, value);break ;case ACTION_ENUM :
@@ -444,7 +469,7 @@ static int isd200_action( struct us_data *us, int action,ACTION_SELECT_5 ; ata.generic.RegisterSelect =REG_DEVICE_HEAD ; ata.write.DeviceHeadByte = value; - srb->sc_data_direction =DMA_NONE ; +isd200_set_srb (info,DMA_NONE ,NULL ,0 );break ;case ACTION_RESET :
@@ -453,7 +478,7 @@ static int isd200_action( struct us_data *us, int action,ACTION_SELECT_3 |ACTION_SELECT_4 ; ata.generic.RegisterSelect =REG_DEVICE_CONTROL ; ata.write.DeviceControlByte =ATA_DC_RESET_CONTROLLER ; - srb->sc_data_direction =DMA_NONE ; +isd200_set_srb (info,DMA_NONE ,NULL ,0 );break ;case ACTION_REENABLE :
@@ -462,7 +487,7 @@ static int isd200_action( struct us_data *us, int action,ACTION_SELECT_3 |ACTION_SELECT_4 ; ata.generic.RegisterSelect =REG_DEVICE_CONTROL ; ata.write.DeviceControlByte =ATA_DC_REENABLE_CONTROLLER ; - srb->sc_data_direction =DMA_NONE ; +isd200_set_srb (info,DMA_NONE ,NULL ,0 );break ;case ACTION_SOFT_RESET :
@@ -471,21 +496,20 @@ static int isd200_action( struct us_data *us, int action, ata.generic.RegisterSelect =REG_DEVICE_HEAD |REG_COMMAND ; ata.write.DeviceHeadByte = info->DeviceHead; ata.write.CommandByte =WIN_SRST ; - srb->sc_data_direction =DMA_NONE ; +isd200_set_srb (info,DMA_NONE ,NULL ,0 );break ;case ACTION_IDENTIFY :US_DEBUGP (" isd200_action(IDENTIFY)\n" ); ata.generic.RegisterSelect =REG_COMMAND ; ata.write.CommandByte =WIN_IDENTIFY ; - srb->sc_data_direction =DMA_FROM_DEVICE ; - srb->request_buffer = (void *) info->id; - srb->request_bufflen =sizeof (struct hd_driveid ); +isd200_set_srb (info,DMA_FROM_DEVICE , info->id, +sizeof (struct hd_driveid ));break ;default :US_DEBUGP ("Error: Undefined action %d\n" ,action); -break ; +return ISD200_ERROR ; }memcpy (srb->cmnd, &ata,sizeof (ata.generic));
@@ -590,7 +614,7 @@ static void isd200_invoke_transport( struct us_data *us,return ; } - if ((srb->resid > 0) && + if ((scsi_get_resid(srb) > 0) && !((srb->cmnd[0] == REQUEST_SENSE) || (srb->cmnd[0] == INQUIRY) || (srb->cmnd[0] == MODE_SENSE) ||
@@ -1114,7 +1138,6 @@ static int isd200_get_inquiry_data( struct us_data *us )return (retStatus); } -/************************************************************************** * isd200_scsi_to_ata *
@@ -1163,7 +1186,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us, ataCdb->generic.TransferBlockSize =1 ; ataCdb->generic.RegisterSelect =REG_COMMAND ; ataCdb->write.CommandByte =ATA_COMMAND_GET_MEDIA_STATUS ; - srb->request_bufflen =0 ; +isd200_srb_set_bufflen (srb,0 ); }else {US_DEBUGP (" Media Status not supported, just report okay\n" ); srb->result =SAM_STAT_GOOD ;
@@ -1181,7 +1204,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us, ataCdb->generic.TransferBlockSize =1 ; ataCdb->generic.RegisterSelect =REG_COMMAND ; ataCdb->write.CommandByte =ATA_COMMAND_GET_MEDIA_STATUS ; - srb->request_bufflen =0 ; +isd200_srb_set_bufflen (srb,0 ); }else {US_DEBUGP (" Media Status not supported, just report okay\n" ); srb->result =SAM_STAT_GOOD ;
@@ -1287,7 +1310,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us, ataCdb->generic.RegisterSelect =REG_COMMAND ; ataCdb->write.CommandByte = (srb->cmnd[4 ] &0x1 ) ?WIN_DOORLOCK :WIN_DOORUNLOCK ; - srb->request_bufflen =0 ; +isd200_srb_set_bufflen (srb,0 ); }else {US_DEBUGP (" Not removeable media, just report okay\n" ); srb->result =SAM_STAT_GOOD ;
@@ -1313,7 +1336,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us, ataCdb->generic.TransferBlockSize =1 ; ataCdb->generic.RegisterSelect =REG_COMMAND ; ataCdb->write.CommandByte =ATA_COMMAND_GET_MEDIA_STATUS ; - srb->request_bufflen =0 ; +isd200_srb_set_bufflen (srb,0 ); }else {US_DEBUGP (" Nothing to do, just report okay\n" ); srb->result =SAM_STAT_GOOD ;
@@ -1422,7 +1445,7 @@ int isd200_Initialization(struct us_data *us)void isd200_ata_command (struct scsi_cmnd *srb,struct us_data *us) { -int sendToTransport =1 ; +int sendToTransport =1 , orig_bufflen;union ata_cdb ataCdb;/* Make sure driver was initialized */
@@ -1430,11 +1453,14 @@ void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us)if (us->extra ==NULL )US_DEBUGP ("ERROR Driver not initialized\n" ); -/* Convert command */ - srb->resid =0 ; +scsi_set_resid (srb,0 ); +/* scsi_bufflen might change in protocol translation to ata */ + orig_bufflen =scsi_bufflen (srb); sendToTransport =isd200_scsi_to_ata (srb, us, &ataCdb);/* send the command to the transport layer */ if (sendToTransport)isd200_invoke_transport (us, srb, &ataCdb); + +isd200_srb_set_bufflen (srb, orig_bufflen); }
Signature · 1 line
1.5.3.1
PATCH 3/32 usb: transport - convert to accessors and !use_sg code path removal
In reply to Boaz Harrosh - Use scsi data accessors and remove of !use_sg code path.
- New usb_stor_bulk_srb() for use by drivers
--- drivers/usb/storage/transport.c | 44 +++++++++++++++++++++++--------------- drivers/usb/storage/transport.h | 2 + 2 files changed, 29 insertions(+), 17 deletions(-)
drivers/usb/storage/transport.c +27 -17
@@ -459,6 +459,21 @@ static int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe, }/* +* Common used function. Transfer a complete command +* via usb_stor_bulk_transfer_sglist() above. Set cmnd resid +*/ +int usb_stor_bulk_srb (struct us_data * us,unsigned int pipe, +struct scsi_cmnd * srb) +{ +int resid =scsi_get_resid (srb); +int result =usb_stor_bulk_transfer_sglist (us, pipe,scsi_sglist (srb), +scsi_sg_count (srb),scsi_bufflen (srb), + &resid); +scsi_set_resid (srb, resid); +return result; +} + +/* * Transfer an entire SCSI command's worth of data payload over the bulk * pipe. *
@@ -508,7 +523,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)int result;/* send the command to the transport layer */ - srb->resid =0 ; +scsi_set_resid (srb,0 ); result = us->transport (srb, us);/* if the command gets aborted by the higher layers, we need to
@@ -568,7 +583,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)* A short transfer on a command where we don't expect it * is unusual, but it doesn't mean we need to auto-sense. */ - if ((srb->resid > 0) && + if ((scsi_get_resid(srb) > 0) && !((srb->cmnd[0] == REQUEST_SENSE) || (srb->cmnd[0] == INQUIRY) || (srb->cmnd[0] == MODE_SENSE) ||
@@ -593,7 +608,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) srb->cmd_len =12 ;/* issue the auto-sense command */ - srb->resid =0 ; +scsi_set_resid (srb,0 ); temp_result = us->transport (us->srb, us);/* let's clean up right away */
@@ -649,7 +664,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)/* Did we transfer less than the minimum amount required? */ if (srb->result ==SAM_STAT_GOOD && - srb->request_bufflen - srb->resid < srb->underflow) +scsi_bufflen (srb) -scsi_get_resid (srb) < srb->underflow) srb->result = (DID_ERROR <<16 ) | (SUGGEST_RETRY <<24 );return ;
@@ -708,7 +723,7 @@ void usb_stor_stop_transport(struct us_data *us)int usb_stor_CBI_transport (struct scsi_cmnd *srb,struct us_data *us) { -unsigned int transfer_length = srb->request_bufflen; +unsigned int transfer_length =scsi_bufflen (srb);unsigned int pipe =0 ;int result;
@@ -737,9 +752,7 @@ int usb_stor_CBI_transport(struct scsi_cmnd *srb, struct us_data *us)if (transfer_length) { pipe = srb->sc_data_direction ==DMA_FROM_DEVICE ? us->recv_bulk_pipe : us->send_bulk_pipe; - result =usb_stor_bulk_transfer_sg (us, pipe, - srb->request_buffer, transfer_length, - srb->use_sg, &srb->resid); + result =usb_stor_bulk_srb (us, pipe, srb);US_DEBUGP ("CBI data stage result is 0x%x\n" , result);/* if we stalled the data transfer it means command failed */
@@ -808,7 +821,7 @@ int usb_stor_CBI_transport(struct scsi_cmnd *srb, struct us_data *us)*/ int usb_stor_CB_transport (struct scsi_cmnd *srb,struct us_data *us) { -unsigned int transfer_length = srb->request_bufflen; +unsigned int transfer_length =scsi_bufflen (srb);int result;/* COMMAND STAGE */
@@ -836,9 +849,7 @@ int usb_stor_CB_transport(struct scsi_cmnd *srb, struct us_data *us)if (transfer_length) {unsigned int pipe = srb->sc_data_direction ==DMA_FROM_DEVICE ? us->recv_bulk_pipe : us->send_bulk_pipe; - result =usb_stor_bulk_transfer_sg (us, pipe, - srb->request_buffer, transfer_length, - srb->use_sg, &srb->resid); + result =usb_stor_bulk_srb (us, pipe, srb);US_DEBUGP ("CB data stage result is 0x%x\n" , result);/* if we stalled the data transfer it means command failed */
@@ -904,7 +915,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) {struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) us->iobuf; -unsigned int transfer_length = srb->request_bufflen; +unsigned int transfer_length =scsi_bufflen (srb);unsigned int residue;int result;int fake_sense =0 ;
@@ -955,9 +966,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)if (transfer_length) {unsigned int pipe = srb->sc_data_direction ==DMA_FROM_DEVICE ? us->recv_bulk_pipe : us->send_bulk_pipe; - result =usb_stor_bulk_transfer_sg (us, pipe, - srb->request_buffer, transfer_length, - srb->use_sg, &srb->resid); + result =usb_stor_bulk_srb (us, pipe, srb);US_DEBUGP ("Bulk data transfer result 0x%x\n" , result);if (result ==USB_STOR_XFER_ERROR )return USB_STOR_TRANSPORT_ERROR ;
@@ -1036,7 +1045,8 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)if (residue) {if (!(us->flags &US_FL_IGNORE_RESIDUE )) { residue =min (residue, transfer_length); - srb->resid =max (srb->resid, (int ) residue); +scsi_set_resid (srb,max (scsi_get_resid (srb), + (int ) residue)); } }
drivers/usb/storage/transport.h +2 -0
@@ -139,6 +139,8 @@ extern int usb_stor_bulk_transfer_buf(struct us_data *us, unsigned int pipe, void *buf, unsigned int length, unsigned int *act_len);extern int usb_stor_bulk_transfer_sg (struct us_data *us,unsigned int pipe,void *buf,unsigned int length,int use_sg,int *residual); +extern int usb_stor_bulk_srb (struct us_data * us,unsigned int pipe, +struct scsi_cmnd * srb);extern int usb_stor_port_reset (struct us_data *us);#endif
Signature · 1 line
1.5.3.1
PATCH 4/32 usb: protocol.c - convert to accessors and !use_sg code path removal
In reply to Boaz Harrosh- Use scsi data accessors and remove of !use_sg code path
--- drivers/usb/storage/protocol.c | 126 +++++++++++++++++----------------------- 1 files changed, 53 insertions(+), 73 deletions(-)
drivers/usb/storage/protocol.c +53 -73
@@ -149,11 +149,7 @@ void usb_stor_transparent_scsi_command(struct scsi_cmnd *srb,***********************************************************************/ /* Copy a buffer of length buflen to/from the srb's transfer buffer. -* (Note: for scatter-gather transfers (srb->use_sg > 0), srb->request_buffer -* points to a list of s-g entries and we ignore srb->request_bufflen. -* For non-scatter-gather transfers, srb->request_buffer points to the -* transfer buffer itself and srb->request_bufflen is the buffer's length.) -* Update the *index and *offset variables so that the next copy will +* Update the **sgptr and *offset variables so that the next copy will * pick up from where this one left off. */ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
@@ -162,80 +158,64 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer, {unsigned int cnt; -/* If not using scatter-gather, just transfer the data directly. -* Make certain it will fit in the available buffer space. */ -if (srb->use_sg ==0 ) { -if (*offset >= srb->request_bufflen) -return 0 ; - cnt =min (buflen, srb->request_bufflen - *offset); -if (dir ==TO_XFER_BUF ) -memcpy ((unsigned char *) srb->request_buffer + *offset, - buffer, cnt); -else -memcpy (buffer, (unsigned char *) srb->request_buffer + - *offset, cnt); - *offset += cnt; - -/* Using scatter-gather. We have to go through the list one entry +/* We have to go through the list one entry * at a time. Each s-g entry contains some number of pages, and * each page has to be kmap()'ed separately. If the page is already * in kernel-addressable memory then kmap() will return its address. * If the page is not directly accessible -- such as a user buffer * located in high memory -- then kmap() will map it to a temporary * position in the kernel's virtual address space. */ - }else { -struct scatterlist *sg = *sgptr; - -if (!sg) - sg = (struct scatterlist *) srb->request_buffer; - -/* This loop handles a single s-g list entry, which may -* include multiple pages. Find the initial page structure -* and the starting offset within the page, and update -* the *offset and *index values for the next loop. */ - cnt =0 ; -while (cnt < buflen) { -struct page *page = sg->page + - ((sg->offset + *offset) >>PAGE_SHIFT ); -unsigned int poff = - (sg->offset + *offset) & (PAGE_SIZE -1 ); -unsigned int sglen = sg->length - *offset; - -if (sglen > buflen - cnt) { - -/* Transfer ends within this s-g entry */ - sglen = buflen - cnt; - *offset += sglen; - }else { - -/* Transfer continues to next s-g entry */ - *offset =0 ; - sg =sg_next (sg); - } - -/* Transfer the data for all the pages in this -* s-g entry. For each page: call kmap(), do the -* transfer, and call kunmap() immediately after. */ -while (sglen >0 ) { -unsigned int plen =min (sglen, (unsigned int ) -PAGE_SIZE - poff); -unsigned char *ptr =kmap (page); - -if (dir ==TO_XFER_BUF ) -memcpy (ptr + poff, buffer + cnt, plen); -else -memcpy (buffer + cnt, ptr + poff, plen); -kunmap (page); - -/* Start at the beginning of the next page */ - poff =0 ; - ++page; - cnt += plen; - sglen -= plen; - } +struct scatterlist *sg = *sgptr; + +if (!sg) + sg =scsi_sglist (srb); + +/* This loop handles a single s-g list entry, which may +* include multiple pages. Find the initial page structure +* and the starting offset within the page, and update +* the *offset and **sgptr values for the next loop. */ + cnt =0 ; +while (cnt < buflen) { +struct page *page = sg->page + + ((sg->offset + *offset) >>PAGE_SHIFT ); +unsigned int poff = + (sg->offset + *offset) & (PAGE_SIZE -1 ); +unsigned int sglen = sg->length - *offset; + +if (sglen > buflen - cnt) { + +/* Transfer ends within this s-g entry */ + sglen = buflen - cnt; + *offset += sglen; + }else { + +/* Transfer continues to next s-g entry */ + *offset =0 ; + sg =sg_next (sg); + } + +/* Transfer the data for all the pages in this +* s-g entry. For each page: call kmap(), do the +* transfer, and call kunmap() immediately after. */ +while (sglen >0 ) { +unsigned int plen =min (sglen, (unsigned int ) +PAGE_SIZE - poff); +unsigned char *ptr =kmap (page); + +if (dir ==TO_XFER_BUF ) +memcpy (ptr + poff, buffer + cnt, plen); +else +memcpy (buffer + cnt, ptr + poff, plen); +kunmap (page); + +/* Start at the beginning of the next page */ + poff =0 ; + ++page; + cnt += plen; + sglen -= plen; } - *sgptr = sg; } + *sgptr = sg;/* Return the amount actually transferred */ return cnt;
@@ -251,6 +231,6 @@ void usb_stor_set_xfer_buf(unsigned char *buffer,usb_stor_access_xfer_buf (buffer, buflen, srb, &sg, &offset,TO_XFER_BUF ); -if (buflen < srb->request_bufflen) - srb->resid = srb->request_bufflen - buflen; +if (buflen <scsi_bufflen (srb)) +scsi_set_resid (srb,scsi_bufflen (srb) - buflen); }
Signature · 1 line
1.5.3.1
PATCH 5/32 usb: shuttle_usbat.c - convert to accessors and !use_sg code path removal
In reply to Boaz Harrosh - functions that received char* but where passed scatterlist* mostly were changed to receive void*
- Use scsi data accessors and remove of !use_sg code path
--- drivers/usb/storage/shuttle_usbat.c | 68 +++++++++++++--------------------- 1 files changed, 26 insertions(+), 42 deletions(-)
drivers/usb/storage/shuttle_usbat.c +26 -42
@@ -130,7 +130,7 @@ static int usbat_write(struct us_data *us,* Convenience function to perform a bulk read */ static int usbat_bulk_read (struct us_data *us, -unsigned char *data, +void * buf,unsigned int len,int use_sg) {
@@ -138,14 +138,14 @@ static int usbat_bulk_read(struct us_data *us,return USB_STOR_XFER_GOOD ;US_DEBUGP ("usbat_bulk_read: len = %d\n" , len); -return usb_stor_bulk_transfer_sg (us, us->recv_bulk_pipe, data, len, use_sg,NULL ); +return usb_stor_bulk_transfer_sg (us, us->recv_bulk_pipe, buf, len, use_sg,NULL ); }/* * Convenience function to perform a bulk write */ static int usbat_bulk_write (struct us_data *us, -unsigned char *data, +void * buf,unsigned int len,int use_sg) {
@@ -153,7 +153,7 @@ static int usbat_bulk_write(struct us_data *us,return USB_STOR_XFER_GOOD ;US_DEBUGP ("usbat_bulk_write: len = %d\n" , len); -return usb_stor_bulk_transfer_sg (us, us->send_bulk_pipe, data, len, use_sg,NULL ); +return usb_stor_bulk_transfer_sg (us, us->send_bulk_pipe, buf, len, use_sg,NULL ); }/*
@@ -314,7 +314,7 @@ static int usbat_wait_not_busy(struct us_data *us, int minutes)* Read block data from the data register */ static int usbat_read_block (struct us_data *us, -unsigned char *content, +void * buf,unsigned short len,int use_sg) {
@@ -337,7 +337,7 @@ static int usbat_read_block(struct us_data *us,if (result !=USB_STOR_XFER_GOOD )return USB_STOR_TRANSPORT_ERROR ; - result =usbat_bulk_read (us, content, len, use_sg); + result =usbat_bulk_read (us, buf, len, use_sg);return (result ==USB_STOR_XFER_GOOD ?USB_STOR_TRANSPORT_GOOD :USB_STOR_TRANSPORT_ERROR ); }
@@ -347,7 +347,7 @@ static int usbat_read_block(struct us_data *us,*/ static int usbat_write_block (struct us_data *us,unsigned char access, -unsigned char *content, +void * buf,unsigned short len,int minutes,int use_sg)
@@ -372,7 +372,7 @@ static int usbat_write_block(struct us_data *us,if (result !=USB_STOR_XFER_GOOD )return USB_STOR_TRANSPORT_ERROR ; - result =usbat_bulk_write (us, content, len, use_sg); + result =usbat_bulk_write (us, buf, len, use_sg);if (result !=USB_STOR_XFER_GOOD )return USB_STOR_TRANSPORT_ERROR ;
@@ -392,7 +392,7 @@ static int usbat_hp8200e_rw_block_test(struct us_data *us,unsigned char timeout, unsigned char qualifier, int direction, - unsigned char *content, + void *buf, unsigned short len, int use_sg, int minutes)
@@ -472,7 +472,7 @@ static int usbat_hp8200e_rw_block_test(struct us_data *us, } result =usb_stor_bulk_transfer_sg (us, - pipe, content, len, use_sg,NULL ); + pipe, buf, len, use_sg,NULL );/* * If we get a stall on the bulk download, we'll retry
@@ -606,7 +606,7 @@ static int usbat_multiple_write(struct us_data *us,* other related details) are defined beforehand with _set_shuttle_features(). */ static int usbat_read_blocks (struct us_data *us, -unsigned char *buffer, +void * buffer,int len,int use_sg) {
@@ -648,7 +648,7 @@ static int usbat_read_blocks(struct us_data *us,* other related details) are defined beforehand with _set_shuttle_features(). */ static int usbat_write_blocks (struct us_data *us, -unsigned char *buffer, +void * buffer,int len,int use_sg) {
@@ -1170,15 +1170,15 @@ static int usbat_hp8200e_handle_read10(struct us_data *us,US_DEBUGP ("handle_read10: transfersize %d\n" , srb->transfersize); -if (srb->request_bufflen <0x10000 ) { +if (scsi_bufflen (srb) <0x10000 ) { result =usbat_hp8200e_rw_block_test (us,USBAT_ATA , registers, data,19 ,USBAT_ATA_DATA ,USBAT_ATA_STATUS ,0xFD , (USBAT_QUAL_FCQ |USBAT_QUAL_ALQ ),DMA_FROM_DEVICE , - srb->request_buffer, - srb->request_bufflen, srb->use_sg,1 ); +scsi_sglist (srb), +scsi_bufflen (srb),scsi_sg_count (srb),1 );return result; }
@@ -1196,7 +1196,7 @@ static int usbat_hp8200e_handle_read10(struct us_data *us, len <<=16 ; len |= data[7 +7 ];US_DEBUGP ("handle_read10: GPCMD_READ_CD: len %d\n" , len); - srb->transfersize = srb->request_bufflen/len; + srb->transfersize =scsi_bufflen (srb)/len; }if (!srb->transfersize) {
@@ -1213,7 +1213,7 @@ static int usbat_hp8200e_handle_read10(struct us_data *us, len = (65535 /srb->transfersize) * srb->transfersize;US_DEBUGP ("Max read is %d bytes\n" , len); - len =min (len, srb->request_bufflen); + len =min (len,scsi_bufflen (srb)); buffer =kmalloc (len,GFP_NOIO );if (buffer ==NULL )/* bloody hell! */ return USB_STOR_TRANSPORT_FAILED ;
@@ -1222,10 +1222,10 @@ static int usbat_hp8200e_handle_read10(struct us_data *us, sector |=short_pack (data[7 +5 ], data[7 +4 ]); transferred =0 ; -while (transferred != srb->request_bufflen) { +while (transferred !=scsi_bufflen (srb)) { -if (len > srb->request_bufflen - transferred) - len = srb->request_bufflen - transferred; +if (len >scsi_bufflen (srb) - transferred) + len =scsi_bufflen (srb) - transferred; data[3 ] = len&0xFF ;/* (cylL) = expected length (L) */ data[4 ] = (len>>8 )&0xFF ;/* (cylH) = expected length (H) */
@@ -1261,7 +1261,7 @@ static int usbat_hp8200e_handle_read10(struct us_data *us, transferred += len; sector += len / srb->transfersize; - }/* while transferred != srb->request_bufflen */ + }/* while transferred != scsi_bufflen(srb) */ kfree (buffer);return result;
@@ -1429,9 +1429,8 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)unsigned char data[32 ];unsigned int len;int i; -char string[64 ]; - len = srb->request_bufflen; + len =scsi_bufflen (srb);/* Send A0 (ATA PACKET COMMAND). Note: I guess we're never going to get any of the ATA
@@ -1472,8 +1471,8 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)USBAT_ATA_DATA ,USBAT_ATA_STATUS ,0xFD , (USBAT_QUAL_FCQ |USBAT_QUAL_ALQ ),DMA_TO_DEVICE , - srb->request_buffer, - len, srb->use_sg, 10); +scsi_sglist (srb), + len, scsi_sg_count(srb), 10);if (result ==USB_STOR_TRANSPORT_GOOD ) { transferred += len;
@@ -1540,23 +1539,8 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us) len = *status; - result =usbat_read_block (us, srb->request_buffer, len, srb->use_sg); - -/* Debug-print the first 32 bytes of the transfer */ - -if (!srb->use_sg) { - string[0 ] =0 ; -for (i=0 ; i<len && i<32 ; i++) { -sprintf (string+strlen (string),"%02X " , - ((unsigned char *)srb->request_buffer)[i]); -if ((i%16 )==15 ) { -US_DEBUGP ("%s\n" , string); - string[0 ] =0 ; - } - } -if (string[0 ]!=0 ) -US_DEBUGP ("%s\n" , string); - } + result =usbat_read_block (us,scsi_sglist (srb), len, +scsi_sg_count (srb)); }return result;
Signature · 1 line
1.5.3.1
PATCH 6/32 usb: freecom.c & sddr09.c - convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh - Use scsi data accessors and remove of !use_sg code path
- This patch is dependent on cleanup patch to usb transport.c/h
--- drivers/usb/storage/freecom.c | 14 ++++++-------- drivers/usb/storage/sddr09.c | 9 +++------ 2 files changed, 9 insertions(+), 14 deletions(-)
drivers/usb/storage/freecom.c +6 -8
@@ -132,8 +132,7 @@ freecom_readdata (struct scsi_cmnd *srb, struct us_data *us,/* Now transfer all of our blocks. */ US_DEBUGP ("Start of read\n" ); - result =usb_stor_bulk_transfer_sg (us, ipipe, srb->request_buffer, - count, srb->use_sg, &srb->resid); + result =usb_stor_bulk_srb (us, ipipe, srb);US_DEBUGP ("freecom_readdata done!\n" );if (result >USB_STOR_XFER_SHORT )
@@ -166,8 +165,7 @@ freecom_writedata (struct scsi_cmnd *srb, struct us_data *us,/* Now transfer all of our blocks. */ US_DEBUGP ("Start of write\n" ); - result =usb_stor_bulk_transfer_sg (us, opipe, srb->request_buffer, - count, srb->use_sg, &srb->resid); + result =usb_stor_bulk_srb (us, opipe, srb);US_DEBUGP ("freecom_writedata done!\n" );if (result >USB_STOR_XFER_SHORT )
@@ -281,7 +279,7 @@ int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)* and such will hang. */ US_DEBUGP ("Device indicates that it has %d bytes available\n" ,le16_to_cpu (fst->Count)); -US_DEBUGP ("SCSI requested %d\n" , srb->request_bufflen); +US_DEBUGP ("SCSI requested %d\n" ,scsi_bufflen (srb));/* Find the length we desire to read. */ switch (srb->cmnd[0 ]) {
@@ -292,12 +290,12 @@ int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) length =le16_to_cpu (fst->Count);break ;default : - length = srb->request_bufflen; + length =scsi_bufflen (srb); }/* verify that this amount is legal */ -if (length > srb->request_bufflen) { - length = srb->request_bufflen; +if (length >scsi_bufflen (srb)) { + length =scsi_bufflen (srb);US_DEBUGP ("Truncating request to match buffer length: %d\n" , length); }
drivers/usb/storage/sddr09.c +3 -6
@@ -1623,7 +1623,7 @@ int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)return USB_STOR_TRANSPORT_ERROR ; } -if (srb->request_bufflen ==0 ) +if (scsi_bufflen (srb) ==0 )return USB_STOR_TRANSPORT_GOOD ; if (srb->sc_data_direction == DMA_TO_DEVICE ||
@@ -1634,12 +1634,9 @@ int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)US_DEBUGP ("SDDR09: %s %d bytes\n" , (srb->sc_data_direction ==DMA_TO_DEVICE ) ?"sending" :"receiving" , - srb->request_bufflen); +scsi_bufflen (srb)); - result =usb_stor_bulk_transfer_sg (us, pipe, - srb->request_buffer, - srb->request_bufflen, - srb->use_sg, &srb->resid); + result =usb_stor_bulk_srb (us, pipe, srb);return (result ==USB_STOR_XFER_GOOD ?USB_STOR_TRANSPORT_GOOD :USB_STOR_TRANSPORT_ERROR );
Signature · 1 line
1.5.3.1
PATCH 7/32 NCR5380 familly convert to accessors & !use_sg cleanup
In reply to Boaz Harrosh - convert to accessors and !use_sg cleanup
- FIXME: Not sg-chain ready look for ++cmd->SCp.buffer
--- drivers/scsi/NCR5380.c | 14 +++++++------- drivers/scsi/atari_NCR5380.c | 22 +++++++++++----------- drivers/scsi/sun3_NCR5380.c | 22 +++++++++++----------- 3 files changed, 29 insertions(+), 29 deletions(-)
drivers/scsi/NCR5380.c +7 -7
@@ -295,17 +295,17 @@ static __inline__ void initialize_SCp(Scsi_Cmnd * cmd)* various queues are valid. */ -if (cmd->use_sg) { - cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; - cmd->SCp.buffers_residual = cmd->use_sg -1 ; +if (scsi_bufflen (cmd)) { + cmd->SCp.buffer =scsi_sglist (cmd); + cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; cmd->SCp.ptr =page_address (cmd->SCp.buffer->page)+ cmd->SCp.buffer->offset; cmd->SCp.this_residual = cmd->SCp.buffer->length; }else { cmd->SCp.buffer =NULL ; cmd->SCp.buffers_residual =0 ; - cmd->SCp.ptr = (char *) cmd->request_buffer; - cmd->SCp.this_residual = cmd->request_bufflen; + cmd->SCp.ptr =NULL ; + cmd->SCp.this_residual =0 ; } }
@@ -976,14 +976,14 @@ static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))case WRITE_6 :case WRITE_10 : hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); - hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen; + hostdata->bytes_write[cmd->device->id] +=scsi_bufflen (cmd); hostdata->pendingw++;break ;case READ :case READ_6 :case READ_10 : hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); - hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen; + hostdata->bytes_read[cmd->device->id] +=scsi_bufflen (cmd); hostdata->pendingr++;break ; }
drivers/scsi/atari_NCR5380.c +11 -11
@@ -512,9 +512,9 @@ static inline void initialize_SCp(Scsi_Cmnd *cmd)* various queues are valid. */ -if (cmd->use_sg) { - cmd->SCp.buffer = (struct scatterlist *)cmd->request_buffer; - cmd->SCp.buffers_residual = cmd->use_sg -1 ; +if (scsi_bufflen (cmd)) { + cmd->SCp.buffer =scsi_sglist (cmd); + cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; cmd->SCp.ptr = (char *)page_address (cmd->SCp.buffer->page) + cmd->SCp.buffer->offset; cmd->SCp.this_residual = cmd->SCp.buffer->length;
@@ -525,8 +525,8 @@ static inline void initialize_SCp(Scsi_Cmnd *cmd) }else { cmd->SCp.buffer =NULL ; cmd->SCp.buffers_residual =0 ; - cmd->SCp.ptr = (char *)cmd->request_buffer; - cmd->SCp.this_residual = cmd->request_bufflen; + cmd->SCp.ptr =NULL ; + cmd->SCp.this_residual =0 ; } }
@@ -938,21 +938,21 @@ static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) }# endif # ifdef NCR5380_STAT_LIMIT - if (cmd->request_bufflen > NCR5380_STAT_LIMIT) + if (scsi_bufflen(cmd) > NCR5380_STAT_LIMIT)# endif switch (cmd->cmnd[0 ]) {case WRITE :case WRITE_6 :case WRITE_10 : hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); - hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen; + hostdata->bytes_write[cmd->device->id] +=scsi_bufflen (cmd); hostdata->pendingw++;break ;case READ :case READ_6 :case READ_10 : hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); - hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen; + hostdata->bytes_read[cmd->device->id] +=scsi_bufflen (cmd); hostdata->pendingr++;break ; }
@@ -1354,21 +1354,21 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id)static void collect_stats (struct NCR5380_hostdata * hostdata,Scsi_Cmnd *cmd) {# ifdef NCR5380_STAT_LIMIT - if (cmd->request_bufflen > NCR5380_STAT_LIMIT) + if (scsi_bufflen(cmd) > NCR5380_STAT_LIMIT)# endif switch (cmd->cmnd[0 ]) {case WRITE :case WRITE_6 :case WRITE_10 : hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase); -/*hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;*/ +/*hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd);*/ hostdata->pendingw--;break ;case READ :case READ_6 :case READ_10 : hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase); -/*hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;*/ +/*hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd);*/ hostdata->pendingr--;break ; }
drivers/scsi/sun3_NCR5380.c +11 -11
@@ -516,9 +516,9 @@ static __inline__ void initialize_SCp(struct scsi_cmnd *cmd)* various queues are valid. */ -if (cmd->use_sg) { - cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; - cmd->SCp.buffers_residual = cmd->use_sg -1 ; +if (scsi_bufflen (cmd)) { + cmd->SCp.buffer =scsi_sglist (cmd); + cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; cmd->SCp.ptr = (char *)SGADDR (cmd->SCp.buffer); cmd->SCp.this_residual = cmd->SCp.buffer->length;
@@ -529,8 +529,8 @@ static __inline__ void initialize_SCp(struct scsi_cmnd *cmd) }else { cmd->SCp.buffer =NULL ; cmd->SCp.buffers_residual =0 ; - cmd->SCp.ptr = (char *) cmd->request_buffer; - cmd->SCp.this_residual = cmd->request_bufflen; + cmd->SCp.ptr =NULL ; + cmd->SCp.this_residual =0 ; } }
@@ -936,7 +936,7 @@ static int NCR5380_queue_command(struct scsi_cmnd *cmd, }# endif # ifdef NCR5380_STAT_LIMIT - if (cmd->request_bufflen > NCR5380_STAT_LIMIT) + if (scsi_bufflen(cmd) > NCR5380_STAT_LIMIT)# endif switch (cmd->cmnd[0 ]) {
@@ -944,14 +944,14 @@ static int NCR5380_queue_command(struct scsi_cmnd *cmd,case WRITE_6 :case WRITE_10 : hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); - hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen; + hostdata->bytes_write[cmd->device->id] +=scsi_bufflen (cmd); hostdata->pendingw++;break ;case READ :case READ_6 :case READ_10 : hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); - hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen; + hostdata->bytes_read[cmd->device->id] +=scsi_bufflen (cmd); hostdata->pendingr++;break ; }
@@ -1346,7 +1346,7 @@ static void collect_stats(struct NCR5380_hostdata *hostdata, struct scsi_cmnd *cmd) {# ifdef NCR5380_STAT_LIMIT - if (cmd->request_bufflen > NCR5380_STAT_LIMIT) + if (scsi_bufflen(cmd) > NCR5380_STAT_LIMIT)# endif switch (cmd->cmnd[0 ]) {
@@ -1354,14 +1354,14 @@ static void collect_stats(struct NCR5380_hostdata *hostdata,case WRITE_6 :case WRITE_10 : hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase); -/*hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;*/ +/*hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd);*/ hostdata->pendingw--;break ;case READ :case READ_6 :case READ_10 : hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase); -/*hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;*/ +/*hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd);*/ hostdata->pendingr--;break ; }
Signature · 1 line
1.5.3.1
PATCH 8/32 arm: scsi convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh- convert to accessors and !use_sg cleanup
--- drivers/scsi/arm/acornscsi.c | 14 +++++++------- drivers/scsi/arm/scsi.h | 34 +++++++++++----------------------- 2 files changed, 18 insertions(+), 30 deletions(-)
drivers/scsi/arm/acornscsi.c +7 -7
@@ -1790,7 +1790,7 @@ int acornscsi_starttransfer(AS_Host *host)return 0 ; } - residual = host->SCpnt->request_bufflen - host->scsi.SCp.scsi_xferred; + residual =scsi_bufflen (host->SCpnt) - host->scsi.SCp.scsi_xferred;sbic_arm_write (host->scsi.io_port,SBIC_SYNCHTRANSFER , host->device[host->SCpnt->device->id].sync_xfer);sbic_arm_writenext (host->scsi.io_port, residual >>16 );
@@ -2270,7 +2270,7 @@ intr_ret_t acornscsi_sbicintr(AS_Host *host, int in_irq)case 0x4b :/* -> PHASE_STATUSIN */ case 0x8b :/* -> PHASE_STATUSIN */ /* DATA IN -> STATUS */ - host->scsi.SCp.scsi_xferred = host->SCpnt->request_bufflen - + host->scsi.SCp.scsi_xferred =scsi_bufflen (host->SCpnt) -acornscsi_sbic_xfcount (host);acornscsi_dma_stop (host);acornscsi_readstatusbyte (host);
@@ -2281,7 +2281,7 @@ intr_ret_t acornscsi_sbicintr(AS_Host *host, int in_irq)case 0x4e :/* -> PHASE_MSGOUT */ case 0x8e :/* -> PHASE_MSGOUT */ /* DATA IN -> MESSAGE OUT */ - host->scsi.SCp.scsi_xferred = host->SCpnt->request_bufflen - + host->scsi.SCp.scsi_xferred =scsi_bufflen (host->SCpnt) -acornscsi_sbic_xfcount (host);acornscsi_dma_stop (host);acornscsi_sendmessage (host);
@@ -2291,7 +2291,7 @@ intr_ret_t acornscsi_sbicintr(AS_Host *host, int in_irq)case 0x4f :/* message in */ case 0x8f :/* message in */ /* DATA IN -> MESSAGE IN */ - host->scsi.SCp.scsi_xferred = host->SCpnt->request_bufflen - + host->scsi.SCp.scsi_xferred =scsi_bufflen (host->SCpnt) -acornscsi_sbic_xfcount (host);acornscsi_dma_stop (host);acornscsi_message (host);/* -> PHASE_MSGIN, PHASE_DISCONNECT */
@@ -2319,7 +2319,7 @@ intr_ret_t acornscsi_sbicintr(AS_Host *host, int in_irq)case 0x4b :/* -> PHASE_STATUSIN */ case 0x8b :/* -> PHASE_STATUSIN */ /* DATA OUT -> STATUS */ - host->scsi.SCp.scsi_xferred = host->SCpnt->request_bufflen - + host->scsi.SCp.scsi_xferred =scsi_bufflen (host->SCpnt) -acornscsi_sbic_xfcount (host);acornscsi_dma_stop (host);acornscsi_dma_adjust (host);
@@ -2331,7 +2331,7 @@ intr_ret_t acornscsi_sbicintr(AS_Host *host, int in_irq)case 0x4e :/* -> PHASE_MSGOUT */ case 0x8e :/* -> PHASE_MSGOUT */ /* DATA OUT -> MESSAGE OUT */ - host->scsi.SCp.scsi_xferred = host->SCpnt->request_bufflen - + host->scsi.SCp.scsi_xferred =scsi_bufflen (host->SCpnt) -acornscsi_sbic_xfcount (host);acornscsi_dma_stop (host);acornscsi_dma_adjust (host);
@@ -2342,7 +2342,7 @@ intr_ret_t acornscsi_sbicintr(AS_Host *host, int in_irq)case 0x4f :/* message in */ case 0x8f :/* message in */ /* DATA OUT -> MESSAGE IN */ - host->scsi.SCp.scsi_xferred = host->SCpnt->request_bufflen - + host->scsi.SCp.scsi_xferred =scsi_bufflen (host->SCpnt) -acornscsi_sbic_xfcount (host);acornscsi_dma_stop (host);acornscsi_dma_adjust (host);
drivers/scsi/arm/scsi.h +11 -23
@@ -70,48 +70,36 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt) {memset (&SCpnt->SCp,0 ,sizeof (struct scsi_pointer )); -if (SCpnt->use_sg) { +if (scsi_bufflen (SCpnt)) {unsigned long len =0 ;int buf; - SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; - SCpnt->SCp.buffers_residual = SCpnt->use_sg -1 ; + SCpnt->SCp.buffer =scsi_sglist (SCpnt); + SCpnt->SCp.buffers_residual =scsi_sg_count (SCpnt) -1 ; SCpnt->SCp.ptr = (char *) (page_address (SCpnt->SCp.buffer->page) + SCpnt->SCp.buffer->offset); SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; - SCpnt->SCp.phase = SCpnt->request_bufflen; + SCpnt->SCp.phase =scsi_bufflen (SCpnt);#ifdef BELT_AND_BRACES /* * Calculate correct buffer length. Some commands -* come in with the wrong request_bufflen. +* come in with the wrong scsi_bufflen. */ for (buf =0 ; buf <= SCpnt->SCp.buffers_residual; buf++) len += SCpnt->SCp.buffer[buf].length; -if (SCpnt->request_bufflen != len) +if (scsi_bufflen (SCpnt) != len) { +WARN_ON (1 );printk (KERN_WARNING "scsi%d.%c: bad request buffer " "length %d, should be %ld\n" , SCpnt->device->host->host_no, -'0' + SCpnt->device->id, SCpnt->request_bufflen, len); - SCpnt->request_bufflen = len; +'0' + SCpnt->device->id,scsi_bufflen (SCpnt), len); + }#endif }else { - SCpnt->SCp.ptr = (unsigned char *)SCpnt->request_buffer; - SCpnt->SCp.this_residual = SCpnt->request_bufflen; - SCpnt->SCp.phase = SCpnt->request_bufflen; - } - -/* -* If the upper SCSI layers pass a buffer, but zero length, -* we aren't interested in the buffer pointer. -*/ -if (SCpnt->SCp.this_residual ==0 && SCpnt->SCp.ptr) { -#if 0 //def BELT_AND_BRACES -printk (KERN_WARNING "scsi%d.%c: zero length buffer passed for " -"command " , SCpnt->host->host_no,'0' + SCpnt->target); -__scsi_print_command (SCpnt->cmnd); -#endif SCpnt->SCp.ptr =NULL ; + SCpnt->SCp.this_residual =0 ; + SCpnt->SCp.phase =0 ; } }
Signature · 1 line
1.5.3.1
PATCH 9/32 nsp_cs.c convert to data accessors and !use_sg cleanup
In reply to Boaz Harrosh[PATCH 9/32] nsp_cs.c convert to data accessors and !use_sg cleanup
- use scsi data accessors
- cleanup !use_sg code paths
- TODO: use next_sg() for Jens's sglist branch. Look for 2 places with "SCp.buffer++"
--- drivers/scsi/pcmcia/nsp_cs.c | 54 ++++++++++++++++++++++++++--------------- 1 files changed, 34 insertions(+), 20 deletions(-)
drivers/scsi/pcmcia/nsp_cs.c +34 -20
@@ -135,6 +135,11 @@ static nsp_hw_data nsp_data_base; /* attach <-> detect glue */#define NSP_DEBUG_BUF_LEN 150 +static inline void nsp_inc_resid (struct scsi_cmnd *SCpnt,int residInc) +{ +scsi_set_resid (SCpnt,scsi_get_resid (SCpnt) + residInc); +} +static void nsp_cs_message (const char *func,int line,char *type,char *fmt, ...) {va_list args;
@@ -192,8 +197,10 @@ static int nsp_queuecommand(struct scsi_cmnd *SCpnt,#endif nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; -nsp_dbg (NSP_DEBUG_QUEUECOMMAND ,"SCpnt=0x%p target=%d lun=%d buff=0x%p bufflen=%d use_sg=%d" , - SCpnt, target, SCpnt->device->lun, SCpnt->request_buffer, SCpnt->request_bufflen, SCpnt->use_sg); +nsp_dbg (NSP_DEBUG_QUEUECOMMAND , +"SCpnt=0x%p target=%d lun=%d sglist=0x%p bufflen=%d sg_count=%d" , + SCpnt, target, SCpnt->device->lun,scsi_sglist (SCpnt), +scsi_bufflen (SCpnt),scsi_sg_count (SCpnt));//nsp_dbg(NSP_DEBUG_QUEUECOMMAND, "before CurrentSC=0x%p", data->CurrentSC); SCpnt->scsi_done = done;
@@ -225,7 +232,7 @@ static int nsp_queuecommand(struct scsi_cmnd *SCpnt, SCpnt->SCp.have_data_in =IO_UNKNOWN ; SCpnt->SCp.sent_command =0 ; SCpnt->SCp.phase =PH_UNDETERMINED ; - SCpnt->resid = SCpnt->request_bufflen; +scsi_set_resid (SCpnt,scsi_bufflen (SCpnt));/* setup scratch area SCp.ptr : buffer pointer
@@ -233,14 +240,14 @@ static int nsp_queuecommand(struct scsi_cmnd *SCpnt,SCp.buffer : next buffer SCp.buffers_residual : left buffers in list SCp.phase : current state of the command */ -if (SCpnt->use_sg) { - SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; +if (scsi_bufflen (SCpnt)) { + SCpnt->SCp.buffer =scsi_sglist (SCpnt); SCpnt->SCp.ptr =BUFFER_ADDR ; SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; - SCpnt->SCp.buffers_residual = SCpnt->use_sg -1 ; + SCpnt->SCp.buffers_residual =scsi_sg_count (SCpnt) -1 ; }else { - SCpnt->SCp.ptr = (char *) SCpnt->request_buffer; - SCpnt->SCp.this_residual = SCpnt->request_bufflen; + SCpnt->SCp.ptr =NULL ; + SCpnt->SCp.this_residual =0 ; SCpnt->SCp.buffer =NULL ; SCpnt->SCp.buffers_residual =0 ; }
@@ -721,7 +728,9 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt) ocount = data->FifoCount;nsp_dbg (NSP_DEBUG_DATA_IO ,"in SCpnt=0x%p resid=%d ocount=%d ptr=0x%p this_residual=%d buffers=0x%p nbuf=%d" , - SCpnt, SCpnt->resid, ocount, SCpnt->SCp.ptr, SCpnt->SCp.this_residual, SCpnt->SCp.buffer, SCpnt->SCp.buffers_residual); + SCpnt,scsi_get_resid (SCpnt), ocount, SCpnt->SCp.ptr, + SCpnt->SCp.this_residual, SCpnt->SCp.buffer, + SCpnt->SCp.buffers_residual); time_out =1000 ;
@@ -771,7 +780,7 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)return ; } - SCpnt->resid -= res; +nsp_inc_resid (SCpnt, -res); SCpnt->SCp.ptr += res; SCpnt->SCp.this_residual -= res; ocount += res;
@@ -795,10 +804,12 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)if (time_out ==0 ) {nsp_msg (KERN_DEBUG ,"pio read timeout resid=%d this_residual=%d buffers_residual=%d" , - SCpnt->resid, SCpnt->SCp.this_residual, SCpnt->SCp.buffers_residual); +scsi_get_resid (SCpnt), SCpnt->SCp.this_residual, + SCpnt->SCp.buffers_residual); }nsp_dbg (NSP_DEBUG_DATA_IO ,"read ocount=0x%x" , ocount); -nsp_dbg (NSP_DEBUG_DATA_IO ,"r cmd=%d resid=0x%x\n" , data->CmdId, SCpnt->resid); +nsp_dbg (NSP_DEBUG_DATA_IO ,"r cmd=%d resid=0x%x\n" , data->CmdId, +scsi_get_resid (SCpnt)); }/*
@@ -816,7 +827,9 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt) ocount = data->FifoCount;nsp_dbg (NSP_DEBUG_DATA_IO ,"in fifocount=%d ptr=0x%p this_residual=%d buffers=0x%p nbuf=%d resid=0x%x" , - data->FifoCount, SCpnt->SCp.ptr, SCpnt->SCp.this_residual, SCpnt->SCp.buffer, SCpnt->SCp.buffers_residual, SCpnt->resid); + data->FifoCount, SCpnt->SCp.ptr, SCpnt->SCp.this_residual, + SCpnt->SCp.buffer, SCpnt->SCp.buffers_residual, +scsi_get_resid (SCpnt)); time_out =1000 ;
@@ -830,7 +843,7 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt)nsp_dbg (NSP_DEBUG_DATA_IO ,"phase changed stat=0x%x, res=%d\n" , stat, res);/* Put back pointer */ - SCpnt->resid += res; +nsp_inc_resid (SCpnt, res); SCpnt->SCp.ptr -= res; SCpnt->SCp.this_residual += res; ocount -= res;
@@ -866,7 +879,7 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt)break ; } - SCpnt->resid -= res; +nsp_inc_resid (SCpnt, -res); SCpnt->SCp.ptr += res; SCpnt->SCp.this_residual -= res; ocount += res;
@@ -886,10 +899,12 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt) data->FifoCount = ocount;if (time_out ==0 ) { -nsp_msg (KERN_DEBUG ,"pio write timeout resid=0x%x" , SCpnt->resid); +nsp_msg (KERN_DEBUG ,"pio write timeout resid=0x%x" , +scsi_get_resid (SCpnt)); }nsp_dbg (NSP_DEBUG_DATA_IO ,"write ocount=0x%x" , ocount); -nsp_dbg (NSP_DEBUG_DATA_IO ,"w cmd=%d resid=0x%x\n" , data->CmdId, SCpnt->resid); +nsp_dbg (NSP_DEBUG_DATA_IO ,"w cmd=%d resid=0x%x\n" , data->CmdId, +scsi_get_resid (SCpnt)); }#undef RFIFO_CRIT#undef WFIFO_CRIT
@@ -911,9 +926,8 @@ static int nsp_nexus(struct scsi_cmnd *SCpnt)nsp_index_write (base,SYNCREG , sync->SyncRegister);nsp_index_write (base,ACKWIDTH , sync->AckWidth); -if (SCpnt->use_sg ==0 || - SCpnt->resid %4 !=0 || - SCpnt->resid <=PAGE_SIZE ) { +if (scsi_get_resid (SCpnt) %4 !=0 || +scsi_get_resid (SCpnt) <=PAGE_SIZE ) { data->TransferMode =MODE_IO8 ; }else if (nsp_burst_mode ==BURST_MEM32 ) { data->TransferMode =MODE_MEM32 ;
Signature · 1 line
1.5.3.1
PATCH 10/32 eata_pio.c: convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh- convert to accessors and !use_sg cleanup
--- drivers/scsi/eata_pio.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/eata_pio.c +6 -6
@@ -385,7 +385,7 @@ static int eata_pio_queue(struct scsi_cmnd *cmd, cp->DataIn =0 ;/* Input mode */ cp->Interpret = (cmd->device->id == hd->hostid); - cp->cp_datalen =cpu_to_be32 (cmd->request_bufflen); + cp->cp_datalen =cpu_to_be32 (scsi_bufflen (cmd)); cp->Auto_Req_Sen =0 ; cp->cp_reqDMA =0 ; cp->reqlen =0 ;
@@ -402,14 +402,14 @@ static int eata_pio_queue(struct scsi_cmnd *cmd, cp->cmd = cmd; cmd->host_scribble = (char *) &hd->ccb[y]; -if (cmd->use_sg ==0 ) { +if (!scsi_bufflen (cmd)) { cmd->SCp.buffers_residual =1 ; - cmd->SCp.ptr = cmd->request_buffer; - cmd->SCp.this_residual = cmd->request_bufflen; + cmd->SCp.ptr =NULL ; + cmd->SCp.this_residual =0 ; cmd->SCp.buffer =NULL ; }else { - cmd->SCp.buffer = cmd->request_buffer; - cmd->SCp.buffers_residual = cmd->use_sg; + cmd->SCp.buffer =scsi_sglist (cmd); + cmd->SCp.buffers_residual =scsi_sg_count (cmd); cmd->SCp.ptr =page_address (cmd->SCp.buffer->page) + cmd->SCp.buffer->offset; cmd->SCp.this_residual = cmd->SCp.buffer->length; }
Signature · 1 line
1.5.3.1
PATCH 11/32 a2091.c: convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh- convert to accessors and !use_sg cleanup
--- drivers/scsi/a2091.c | 36 +++++------------------------------- 1 files changed, 5 insertions(+), 31 deletions(-)
drivers/scsi/a2091.c +5 -31
@@ -73,18 +73,9 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) }if (!dir_in) { -/* copy to bounce buffer for a write */ - if (cmd->use_sg) -#if 0 -panic ("scsi%ddma: incomplete s/g support" , - instance->host_no); -#else +/* copy to bounce buffer for a write */ memcpy (HDATA (instance)->dma_bounce_buffer, cmd->SCp.ptr, cmd->SCp.this_residual); -#endif - else - memcpy (HDATA(instance)->dma_bounce_buffer, - cmd->request_buffer, cmd->request_bufflen); } }
@@ -144,30 +135,13 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,/* copy from a bounce buffer, if necessary */ if (status &&HDATA (instance)->dma_bounce_buffer) { -if (SCpnt && SCpnt->use_sg) { -#if 0 -panic ("scsi%d: incomplete s/g support" , - instance->host_no); -#else -if (HDATA (instance)->dma_dir ) +if (HDATA (instance)->dma_dir )memcpy (SCpnt->SCp.ptr,HDATA (instance)->dma_bounce_buffer, SCpnt->SCp.this_residual); -kfree (HDATA (instance)->dma_bounce_buffer); -HDATA (instance)->dma_bounce_buffer =NULL ; -HDATA (instance)->dma_bounce_len =0 ; - -#endif - }else { -if (HDATA (instance)->dma_dir && SCpnt) -memcpy (SCpnt->request_buffer, -HDATA (instance)->dma_bounce_buffer, - SCpnt->request_bufflen); - -kfree (HDATA (instance)->dma_bounce_buffer); -HDATA (instance)->dma_bounce_buffer =NULL ; -HDATA (instance)->dma_bounce_len =0 ; - } +kfree (HDATA (instance)->dma_bounce_buffer); +HDATA (instance)->dma_bounce_buffer =NULL ; +HDATA (instance)->dma_bounce_len =0 ; } }
Signature · 1 line
1.5.3.1
PATCH 12/32 a3000.c: convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh- convert to accessors and !use_sg cleanup
--- drivers/scsi/a3000.c | 15 +++------------ 1 files changed, 3 insertions(+), 12 deletions(-)
drivers/scsi/a3000.c +3 -12
@@ -70,12 +70,8 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)if (!dir_in) {/* copy to bounce buffer for a write */ -if (cmd->use_sg) { -memcpy (HDATA (a3000_host)->dma_bounce_buffer, - cmd->SCp.ptr, cmd->SCp.this_residual); - }else -memcpy (HDATA (a3000_host)->dma_bounce_buffer, - cmd->request_buffer, cmd->request_bufflen); +memcpy (HDATA (a3000_host)->dma_bounce_buffer, + cmd->SCp.ptr, cmd->SCp.this_residual); } addr =virt_to_bus (HDATA (a3000_host)->dma_bounce_buffer);
@@ -146,7 +142,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,/* copy from a bounce buffer, if necessary */ if (status &&HDATA (instance)->dma_bounce_buffer) { -if (SCpnt && SCpnt->use_sg) { +if (SCpnt) {if (HDATA (instance)->dma_dir && SCpnt) memcpy (SCpnt->SCp.ptr, HDATA(instance)->dma_bounce_buffer,
@@ -155,11 +151,6 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,HDATA (instance)->dma_bounce_buffer =NULL ;HDATA (instance)->dma_bounce_len =0 ; }else { -if (HDATA (instance)->dma_dir && SCpnt) -memcpy (SCpnt->request_buffer, -HDATA (instance)->dma_bounce_buffer, - SCpnt->request_bufflen); -kfree (HDATA (instance)->dma_bounce_buffer);HDATA (instance)->dma_bounce_buffer =NULL ;HDATA (instance)->dma_bounce_len =0 ;
Signature · 1 line
1.5.3.1
PATCH 13/32 aha1542.c: convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh- convert to accessors and !use_sg cleanup
--- drivers/scsi/aha1542.c | 46 ++++++++++------------------------------------ 1 files changed, 10 insertions(+), 36 deletions(-)
drivers/scsi/aha1542.c +10 -36
@@ -51,15 +51,6 @@#define SCSI_BUF_PA (address) isa_virt_to_bus(address)#define SCSI_SG_PA (sgent) (isa_page_to_bus((sgent)->page) + (sgent)->offset) -static void BAD_DMA (void *address,unsigned int length) -{ -printk (KERN_CRIT "buf vaddress %p paddress 0x%lx length %d\n" , - address, -SCSI_BUF_PA (address), - length); -panic ("Buffer at physical address > 16Mb used for aha1542" ); -} - static void BAD_SG_DMA(Scsi_Cmnd * SCpnt, struct scatterlist *sgp, int nseg,
@@ -598,8 +589,7 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))unchar target = SCpnt->device->id;unchar lun = SCpnt->device->lun;unsigned long flags; -void *buff = SCpnt->request_buffer; -int bufflen = SCpnt->request_bufflen; +int bufflen =scsi_bufflen (SCpnt);int mbo;struct mailbox *mb;struct ccb *ccb;
@@ -690,43 +680,29 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))memcpy (ccb[mbo].cdb, cmd, ccb[mbo].cdblen); -if (SCpnt->use_sg) { +if (bufflen) {struct scatterlist *sg;struct chain *cptr;#ifdef DEBUG unsigned char *ptr;#endif -int i; +int i, sg_count =scsi_sg_count (SCpnt); ccb[mbo].op =2 ;/* SCSI Initiator Command w/scatter-gather */ - SCpnt->host_scribble =kmalloc (512 ,GFP_KERNEL |GFP_DMA ); + SCpnt->host_scribble =kmalloc (sizeof (*cptr)*sg_count, +GFP_KERNEL |GFP_DMA ); cptr = (struct chain *) SCpnt->host_scribble;if (cptr ==NULL ) {/* free the claimed mailbox slot */ HOSTDATA (SCpnt->device->host)->SCint[mbo] =NULL ;return SCSI_MLQUEUE_HOST_BUSY ; } -scsi_for_each_sg (SCpnt, sg, SCpnt->use_sg, i) { -if (sg->length ==0 || SCpnt->use_sg >16 || - (((int ) sg->offset) &1 ) || (sg->length &1 )) { -unsigned char *ptr; -printk (KERN_CRIT "Bad segment list supplied to aha1542.c (%d, %d)\n" , SCpnt->use_sg, i); -scsi_for_each_sg (SCpnt, sg, SCpnt->use_sg, i) { -printk (KERN_CRIT "%d: %p %d\n" , i, - (page_address (sg->page) + - sg->offset), sg->length); - }; -printk (KERN_CRIT "cptr %x: " , (unsigned int ) cptr); - ptr = (unsigned char *) &cptr[i]; -for (i =0 ; i <18 ; i++) -printk ("%02x " , ptr[i]); -panic ("Foooooooood fight!" ); - }; +scsi_for_each_sg (SCpnt, sg, sg_count, i) {any2scsi (cptr[i].dataptr,SCSI_SG_PA (sg));if (SCSI_SG_PA (sg) + sg->length -1 >ISA_DMA_THRESHOLD ) -BAD_SG_DMA (SCpnt, sg, SCpnt->use_sg, i); +BAD_SG_DMA (SCpnt,scsi_sglist (SCpnt), sg_count, i);any2scsi (cptr[i].datalen, sg->length); }; -any2scsi (ccb[mbo].datalen, SCpnt->use_sg *sizeof (struct chain )); +any2scsi (ccb[mbo].datalen, sg_count *sizeof (struct chain ));any2scsi (ccb[mbo].dataptr,SCSI_BUF_PA (cptr));#ifdef DEBUG printk ("cptr %x: " , cptr);
@@ -737,10 +713,8 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) }else { ccb[mbo].op =0 ;/* SCSI Initiator Command */ SCpnt->host_scribble =NULL ; -any2scsi (ccb[mbo].datalen, bufflen); -if (buff &&SCSI_BUF_PA (buff + bufflen -1 ) >ISA_DMA_THRESHOLD ) -BAD_DMA (buff, bufflen); -any2scsi (ccb[mbo].dataptr,SCSI_BUF_PA (buff)); +any2scsi (ccb[mbo].datalen,0 ); +any2scsi (ccb[mbo].dataptr,0 ); }; ccb[mbo].idlun = (target &7 ) <<5 | direction | (lun &7 );/*SCSI Target Id */ ccb[mbo].rsalen =16 ;
Signature · 1 line
1.5.3.1
Re: [PATCH 13/32] aha1542.c: convert to accessors and !use_sg cleanup
Quoted 5 lines · On Wed, 17 Oct 2007 19:53:11 +0200 Boaz Harrosh wrote:
- convert to accessors and !use_sg cleanup
Signed-off-by Boaz Harrosh <[email protected]>---
Quoted 2 lines
drivers/scsi/aha1542.c | 46 ++++++++++------------------------------------ 1 files changed, 10 insertions(+), 36 deletions(-)
---
~Randy
Re: [PATCH 13/32] aha1542.c: convert to accessors and !use_sg cleanup
Quoted 9 lines · On Fri, 9 Nov 2007 18:30:48 -0800 Randy Dunlap wrote:
Quoted 5 lines · On Wed, 17 Oct 2007 19:53:11 +0200 Boaz Harrosh wrote:
- convert to accessors and !use_sg cleanup
Signed-off-by Boaz Harrosh <[email protected]>---
Negative. Different driver. Sorry about that.
Quoted 2 lines
Quoted 2 lines
drivers/scsi/aha1542.c | 46 ++++++++++------------------------------------ 1 files changed, 10 insertions(+), 36 deletions(-)
---
~Randy
PATCH 14/32 atp870u.c: convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh - convert to accessors and !use_sg cleanup
- Probably not ready for sg-chaining
--- drivers/scsi/atp870u.c | 102 ++++++++---------------------------------------- 1 files changed, 17 insertions(+), 85 deletions(-)
drivers/scsi/atp870u.c +17 -85
@@ -471,18 +471,8 @@ go_42:/* * Complete the command */ -if (workreq->use_sg) { -pci_unmap_sg (dev->pdev, - (struct scatterlist *)workreq->request_buffer, - workreq->use_sg, - workreq->sc_data_direction); - }else if (workreq->request_bufflen && - workreq->sc_data_direction !=DMA_NONE ) { -pci_unmap_single (dev->pdev, - workreq->SCp.dma_handle, - workreq->request_bufflen, - workreq->sc_data_direction); - } +scsi_dma_unmap (workreq); +spin_lock_irqsave (dev->host->host_lock, flags); (*workreq->scsi_done) (workreq);#ifdef ED_DBGP
@@ -624,7 +614,7 @@ static int atp870u_queuecommand(struct scsi_cmnd * req_p, c =scmd_channel (req_p); req_p->sense_buffer[0 ]=0 ; - req_p->resid =0 ; +scsi_set_resid (req_p,0 );if (scmd_channel (req_p) >1 ) { req_p->result =0x00040000 ;done (req_p);
@@ -722,7 +712,6 @@ static void send_s870(struct atp_unit *dev,unsigned char c)unsigned short int tmpcip, w;unsigned long l, bttl =0 ;unsigned int workport; -struct scatterlist *sgpnt;unsigned long sg_count;if (dev->in_snd[c] !=0 ) {
@@ -793,6 +782,8 @@ oktosend: }printk ("\n" );#endif + l = scsi_bufflen(workreq); +if (dev->dev_id ==ATP885_DEVID ) { j =inb (dev->baseport +0x29 ) &0xfe ;outb (j, dev->baseport +0x29 );
@@ -800,12 +791,11 @@ oktosend: }if (workreq->cmnd[0 ] ==READ_CAPACITY ) { -if (workreq->request_bufflen >8 ) { - workreq->request_bufflen =0x08 ; - } +if (l >8 ) + l =8 ; }if (workreq->cmnd[0 ] ==0x00 ) { - workreq->request_bufflen =0 ; + l =0 ; } tmport = workport +0x1b ;
@@ -852,40 +842,8 @@ oktosend:#ifdef ED_DBGP printk ("dev->id[%d][%d].devsp = %2x\n" ,c,target_id,dev->id[c][target_id].devsp);#endif -/* -* Figure out the transfer size -*/ -if (workreq->use_sg) { -#ifdef ED_DBGP -printk ("Using SGL\n" ); -#endif - l =0 ; - - sgpnt = (struct scatterlist *) workreq->request_buffer; - sg_count =pci_map_sg (dev->pdev, sgpnt, workreq->use_sg, - workreq->sc_data_direction); - -for (i =0 ; i < workreq->use_sg; i++) { -if (sgpnt[i].length ==0 || workreq->use_sg >ATP870U_SCATTER ) { -panic ("Foooooooood fight!" ); - } - l += sgpnt[i].length; - } -#ifdef ED_DBGP -printk ("send_s870: workreq->use_sg %d, sg_count %d l %8ld\n" , workreq->use_sg, sg_count, l); -#endif - }else if (workreq->request_bufflen && workreq->sc_data_direction !=PCI_DMA_NONE ) { -#ifdef ED_DBGP -printk ("Not using SGL\n" ); -#endif - workreq->SCp.dma_handle =pci_map_single (dev->pdev, workreq->request_buffer, - workreq->request_bufflen, - workreq->sc_data_direction); - l = workreq->request_bufflen; -#ifdef ED_DBGP -printk ("send_s870: workreq->use_sg %d, l %8ld\n" , workreq->use_sg, l); -#endif - }else l =0 ; + + sg_count =scsi_dma_map (workreq);/* * Write transfer size */
@@ -938,16 +896,16 @@ oktosend:* a linear chain. */ -if (workreq->use_sg) { - sgpnt = (struct scatterlist *) workreq->request_buffer; +if (l) { +struct scatterlist *sgpnt; i =0 ; -for (j =0 ; j < workreq->use_sg; j++) { - bttl =sg_dma_address (&sgpnt[j]); - l=sg_dma_len (&sgpnt[j]); +scsi_for_each_sg (workreq, sgpnt, sg_count, j) { + bttl =sg_dma_address (sgpnt); + l=sg_dma_len (sgpnt);#ifdef ED_DBGP -printk ("1. bttl %x, l %x\n" ,bttl, l); +printk ("1. bttl %x, l %x\n" ,bttl, l);#endif -while (l >0x10000 ) { +while (l >0x10000 ) { (((u16 *) (prd))[i +3 ]) =0x0000 ; (((u16 *) (prd))[i +2 ]) =0x0000 ; (((u32 *) (prd))[i >>1 ]) =cpu_to_le32 (bttl);
@@ -965,32 +923,6 @@ oktosend:printk ("prd %4x %4x %4x %4x\n" ,(((unsigned short int *)prd)[0 ]),(((unsigned short int *)prd)[1 ]),(((unsigned short int *)prd)[2 ]),(((unsigned short int *)prd)[3 ]));printk ("2. bttl %x, l %x\n" ,bttl, l);#endif - }else { -/* -* For a linear request write a chain of blocks -*/ - bttl = workreq->SCp.dma_handle; - l = workreq->request_bufflen; - i =0 ; -#ifdef ED_DBGP -printk ("3. bttl %x, l %x\n" ,bttl, l); -#endif -while (l >0x10000 ) { - (((u16 *) (prd))[i +3 ]) =0x0000 ; - (((u16 *) (prd))[i +2 ]) =0x0000 ; - (((u32 *) (prd))[i >>1 ]) =cpu_to_le32 (bttl); - l -=0x10000 ; - bttl +=0x10000 ; - i +=0x04 ; - } - (((u16 *) (prd))[i +3 ]) =cpu_to_le16 (0x8000 ); - (((u16 *) (prd))[i +2 ]) =cpu_to_le16 (l); - (((u32 *) (prd))[i >>1 ]) =cpu_to_le32 (bttl); -#ifdef ED_DBGP -printk ("prd %4x %4x %4x %4x\n" ,(((unsigned short int *)prd)[0 ]),(((unsigned short int *)prd)[1 ]),(((unsigned short int *)prd)[2 ]),(((unsigned short int *)prd)[3 ])); -printk ("4. bttl %x, l %x\n" ,bttl, l); -#endif - } tmpcip +=4 ;#ifdef ED_DBGP
Signature · 1 line
1.5.3.1
PATCH 15/32 fd_mcs.c: convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh - convert to accessors and !use_sg cleanup
- Not ready for sg-chaining
--- drivers/scsi/fd_mcs.c | 36 +++++++++++------------------------- 1 files changed, 11 insertions(+), 25 deletions(-)
drivers/scsi/fd_mcs.c +11 -25
@@ -1017,24 +1017,6 @@ static irqreturn_t fd_mcs_intr(int irq, void *dev_id)printk (" ** IN DONE %d ** " , current_SC->SCp.have_data_in);#endif -#if ERRORS_ONLY -if (current_SC->cmnd[0 ] ==REQUEST_SENSE && !current_SC->SCp.Status) { -if ((unsigned char ) (*((char *) current_SC->request_buffer +2 )) &0x0f ) { -unsigned char key; -unsigned char code; -unsigned char qualifier; - - key = (unsigned char ) (*((char *) current_SC->request_buffer +2 )) &0x0f ; - code = (unsigned char ) (*((char *) current_SC->request_buffer +12 )); - qualifier = (unsigned char ) (*((char *) current_SC->request_buffer +13 )); - -if (key !=UNIT_ATTENTION && !(key ==NOT_READY && code ==0x04 && (!qualifier || qualifier ==0x02 || qualifier ==0x01 )) - && !(key ==ILLEGAL_REQUEST && (code ==0x25 || code ==0x24 || !code))) - -printk ("fd_mcs: REQUEST SENSE " "Key = %x, Code = %x, Qualifier = %x\n" , key, code, qualifier); - } - } -#endif #if EVERY_ACCESS printk ("BEFORE MY_DONE. . ." );#endif
@@ -1097,7 +1079,9 @@ static int fd_mcs_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))panic ("fd_mcs: fd_mcs_queue() NOT REENTRANT!\n" ); }#if EVERY_ACCESS -printk ("queue: target = %d cmnd = 0x%02x pieces = %d size = %u\n" , SCpnt->target, *(unsigned char *) SCpnt->cmnd, SCpnt->use_sg, SCpnt->request_bufflen); +printk ("queue: target = %d cmnd = 0x%02x pieces = %d size = %u\n" , + SCpnt->target, *(unsigned char *) SCpnt->cmnd, +scsi_sg_count (SCpnt),scsi_bufflen (SCpnt));#endif fd_mcs_make_bus_idle (shpnt);
@@ -1107,14 +1091,14 @@ static int fd_mcs_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))/* Initialize static data */ -if (current_SC->use_sg) { - current_SC->SCp.buffer = (struct scatterlist *) current_SC->request_buffer; +if (scsi_bufflen (current_SC)) { + current_SC->SCp.buffer =scsi_sglist (current_SC); current_SC->SCp.ptr =page_address (current_SC->SCp.buffer->page) + current_SC->SCp.buffer->offset; current_SC->SCp.this_residual = current_SC->SCp.buffer->length; - current_SC->SCp.buffers_residual = current_SC->use_sg -1 ; + current_SC->SCp.buffers_residual =scsi_sg_count (current_SC) -1 ; }else { - current_SC->SCp.ptr = (char *) current_SC->request_buffer; - current_SC->SCp.this_residual = current_SC->request_bufflen; + current_SC->SCp.ptr =NULL ; + current_SC->SCp.this_residual =0 ; current_SC->SCp.buffer =NULL ; current_SC->SCp.buffers_residual =0 ; }
@@ -1166,7 +1150,9 @@ static void fd_mcs_print_info(Scsi_Cmnd * SCpnt)break ; } -printk ("(%d), target = %d cmnd = 0x%02x pieces = %d size = %u\n" , SCpnt->SCp.phase, SCpnt->device->id, *(unsigned char *) SCpnt->cmnd, SCpnt->use_sg, SCpnt->request_bufflen); +printk ("(%d), target = %d cmnd = 0x%02x pieces = %d size = %u\n" , + SCpnt->SCp.phase, SCpnt->device->id, *(unsigned char *) SCpnt->cmnd, +scsi_sg_count (SCpnt),scsi_bufflen (SCpnt));printk ("sent_command = %d, have_data_in = %d, timeout = %d\n" , SCpnt->SCp.sent_command, SCpnt->SCp.have_data_in, SCpnt->timeout);#if DEBUG_RACE printk ("in_interrupt_flag = %d\n" , in_interrupt_flag);
Signature · 1 line
1.5.3.1
PATCH 16/32 imm.c: convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh - convert to accessors and !use_sg cleanup
- Not ready for sg-chaining
--- drivers/scsi/imm.c | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-)
drivers/scsi/imm.c +5 -8
@@ -839,21 +839,18 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)/* Phase 4 - Setup scatter/gather buffers */ case 4 : -if (cmd->use_sg) { -/* if many buffers are available, start filling the first */ - cmd->SCp.buffer = - (struct scatterlist *) cmd->request_buffer; +if (scsi_bufflen (cmd)) { + cmd->SCp.buffer =scsi_sglist (cmd); cmd->SCp.this_residual = cmd->SCp.buffer->length; cmd->SCp.ptr =page_address (cmd->SCp.buffer->page) + cmd->SCp.buffer->offset; }else { -/* else fill the only available buffer */ cmd->SCp.buffer =NULL ; - cmd->SCp.this_residual = cmd->request_bufflen; - cmd->SCp.ptr = cmd->request_buffer; + cmd->SCp.this_residual =0 ; + cmd->SCp.ptr =NULL ; } - cmd->SCp.buffers_residual = cmd->use_sg -1 ; + cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; cmd->SCp.phase++;if (cmd->SCp.this_residual &0x01 ) cmd->SCp.this_residual++;
Signature · 1 line
1.5.3.1
PATCH 17/32 ppa.c: convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh[PATCH 17/32] ppa.c: convert to accessors and !use_sg cleanup
- convert to accessors and !use_sg cleanup
--- drivers/scsi/ppa.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
drivers/scsi/ppa.c +5 -7
@@ -752,19 +752,17 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd) cmd->SCp.phase++;case 4 :/* Phase 4 - Setup scatter/gather buffers */ -if (cmd->use_sg) { -/* if many buffers are available, start filling the first */ - cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; +if (scsi_bufflen (cmd)) { + cmd->SCp.buffer =scsi_sglist (cmd); cmd->SCp.this_residual = cmd->SCp.buffer->length; cmd->SCp.ptr =page_address (cmd->SCp.buffer->page) + cmd->SCp.buffer->offset; }else { -/* else fill the only available buffer */ cmd->SCp.buffer =NULL ; - cmd->SCp.this_residual = cmd->request_bufflen; - cmd->SCp.ptr = cmd->request_buffer; + cmd->SCp.this_residual =0 ; + cmd->SCp.ptr =NULL ; } - cmd->SCp.buffers_residual = cmd->use_sg -1 ; + cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; cmd->SCp.phase++;case 5 :/* Phase 5 - Data transfer stage */
Signature · 1 line
1.5.3.1
PATCH 18/32 wd33c93.c: convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh- convert to accessors and !use_sg cleanup
--- drivers/scsi/wd33c93.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/scsi/wd33c93.c +5 -5
@@ -407,17 +407,17 @@ wd33c93_queuecommand(struct scsi_cmnd *cmd,* - SCp.phase records this command's SRCID_ER bit setting */ -if (cmd->use_sg) { - cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; - cmd->SCp.buffers_residual = cmd->use_sg -1 ; +if (scsi_bufflen (cmd)) { + cmd->SCp.buffer =scsi_sglist (cmd); + cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; cmd->SCp.ptr =page_address (cmd->SCp.buffer->page) + cmd->SCp.buffer->offset; cmd->SCp.this_residual = cmd->SCp.buffer->length; }else { cmd->SCp.buffer =NULL ; cmd->SCp.buffers_residual =0 ; - cmd->SCp.ptr = (char *) cmd->request_buffer; - cmd->SCp.this_residual = cmd->request_bufflen; + cmd->SCp.ptr =NULL ; + cmd->SCp.this_residual =0 ; }/* WD docs state that at the conclusion of a "LEVEL2" command, the
Signature · 1 line
1.5.3.1
PATCH 19/32 qlogicpti.c: convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh- convert to accessors and !use_sg cleanup
--- drivers/scsi/qlogicpti.c | 29 +++++++---------------------- 1 files changed, 7 insertions(+), 22 deletions(-)
drivers/scsi/qlogicpti.c +7 -22
@@ -871,11 +871,12 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,struct scatterlist *sg, *s;int i, n; -if (Cmnd->use_sg) { +if (scsi_bufflen (Cmnd)) {int sg_count; - sg = (struct scatterlist *) Cmnd->request_buffer; - sg_count =sbus_map_sg (qpti->sdev, sg, Cmnd->use_sg, Cmnd->sc_data_direction); + sg =scsi_sglist (Cmnd); + sg_count =sbus_map_sg (qpti->sdev, sg,scsi_sg_count (Cmnd), + Cmnd->sc_data_direction); ds = cmd->dataseg; cmd->segment_cnt = sg_count;
@@ -914,16 +915,6 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd, } sg_count -= n; } - }else if (Cmnd->request_bufflen) { - Cmnd->SCp.ptr = (char *)(unsigned long ) -sbus_map_single (qpti->sdev, - Cmnd->request_buffer, - Cmnd->request_bufflen, - Cmnd->sc_data_direction); - - cmd->dataseg[0 ].d_base = (u32) ((unsigned long )Cmnd->SCp.ptr); - cmd->dataseg[0 ].d_count = Cmnd->request_bufflen; - cmd->segment_cnt =1 ; }else { cmd->dataseg[0 ].d_base =0 ; cmd->dataseg[0 ].d_count =0 ;
@@ -1159,17 +1150,11 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti)else Cmnd->result =DID_ERROR <<16 ; -if (Cmnd->use_sg) { +if (scsi_bufflen (Cmnd))sbus_unmap_sg (qpti->sdev, - (struct scatterlist *)Cmnd->request_buffer, - Cmnd->use_sg, +scsi_sglist (Cmnd),scsi_sg_count (Cmnd), Cmnd->sc_data_direction); - }else if (Cmnd->request_bufflen) { -sbus_unmap_single (qpti->sdev, - (__u32)((unsigned long )Cmnd->SCp.ptr), - Cmnd->request_bufflen, - Cmnd->sc_data_direction); - } + qpti->cmd_count[Cmnd->device->id]--;sbus_writew (out_ptr, qpti->qregs +MBOX5 ); Cmnd->host_scribble = (unsigned char *) done_queue;
Signature · 1 line
1.5.3.1
PATCH 20/32 in2000.c: convert to accessors and !use_sg cleanup
In reply to Boaz Harrosh- convert to accessors and !use_sg cleanup
--- drivers/scsi/in2000.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/scsi/in2000.c +5 -5
@@ -369,16 +369,16 @@ static int in2000_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))* - SCp.phase records this command's SRCID_ER bit setting */ -if (cmd->use_sg) { - cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; - cmd->SCp.buffers_residual = cmd->use_sg -1 ; +if (scsi_bufflen (cmd)) { + cmd->SCp.buffer =scsi_sglist (cmd); + cmd->SCp.buffers_residual =scsi_sg_count (cmd) -1 ; cmd->SCp.ptr = (char *)page_address (cmd->SCp.buffer->page) + cmd->SCp.buffer->offset; cmd->SCp.this_residual = cmd->SCp.buffer->length; }else { cmd->SCp.buffer =NULL ; cmd->SCp.buffers_residual =0 ; - cmd->SCp.ptr = (char *) cmd->request_buffer; - cmd->SCp.this_residual = cmd->request_bufflen; + cmd->SCp.ptr =NULL ; + cmd->SCp.this_residual =0 ; } cmd->SCp.have_data_in =0 ;
Signature · 1 line
1.5.3.1
PATCH 21/32 qla1280: convert to use the data buffer accessors
In reply to Boaz HarroshFrom: FUJITA Tomonori <[email protected]>
- remove the unnecessary map_single path.
- convert to use the new accessors for the sg lists and the parameters.
- NOTE: Indentation fix is in next patch. Otherwise this patch becomes totally impossible to read (and easily breakable)
--- drivers/scsi/qla1280.c | 101 +++++++++--------------------------------------- 1 files changed, 19 insertions(+), 82 deletions(-)
drivers/scsi/qla1280.c +19 -82
@@ -1310,14 +1310,7 @@ qla1280_done(struct scsi_qla_host *ha) }/* Release memory used for this I/O */ -if (cmd->use_sg) { -pci_unmap_sg (ha->pdev, cmd->request_buffer, - cmd->use_sg, cmd->sc_data_direction); - }else if (cmd->request_bufflen) { -pci_unmap_single (ha->pdev, sp->saved_dma_handle, - cmd->request_bufflen, - cmd->sc_data_direction); - } +scsi_dma_unmap (cmd);/* Call the mid-level driver interrupt handler */ CMD_HANDLE (sp->cmd) = (unsigned char *)INVALID_HANDLE ;
@@ -1406,14 +1399,14 @@ qla1280_return_status(struct response * sts, struct scsi_cmnd *cp)break ;case CS_DATA_UNDERRUN : -if ((cp->request_bufflen - residual_length) < +if ((scsi_bufflen (cp) - residual_length) < cp->underflow) {printk (KERN_WARNING "scsi: Underflow detected - retrying " "command.\n" ); host_status =DID_ERROR ; }else { - cp->resid = residual_length; +scsi_set_resid (cp, residual_length); host_status =DID_OK ; }break ;
@@ -2781,27 +2774,23 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)int status =0 ;int cnt;int req_cnt; -u16 seg_cnt; +int seg_cnt;u8 dir;ENTER ("qla1280_64bit_start_scsi:" );/* Calculate number of entries and segments required. */ req_cnt =1 ; -if (cmd->use_sg) { - sg = (struct scatterlist *) cmd->request_buffer; - seg_cnt =pci_map_sg (ha->pdev, sg, cmd->use_sg, - cmd->sc_data_direction); - + seg_cnt =scsi_dma_map (cmd); +if (seg_cnt >0 ) {if (seg_cnt >2 ) { req_cnt += (seg_cnt -2 ) /5 ;if ((seg_cnt -2 ) %5 ) req_cnt++; } - }else if (cmd->request_bufflen) {/* If data transfer. */ - seg_cnt =1 ; - }else { - seg_cnt =0 ; + }else if (seg_cnt <0 ) { + status =1 ; + goto out; }if ((req_cnt +2 ) >= ha->req_q_cnt) {
@@ -2893,7 +2882,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)/* Setup packet address segment pointer. */ dword_ptr = (u32 *)&pkt->dseg_0_address; -if (cmd->use_sg) {/* If scatter gather */ + {/* FIXME:Indentation in next patch */ /* Load command entry data segments. */ for_each_sg (sg, s, seg_cnt, cnt) {if (cnt ==2 )
@@ -2986,29 +2975,6 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)qla1280_dump_buffer (5 , (char *)pkt,REQUEST_ENTRY_SIZE ); } - }else {/* No scatter gather data transfer */ - dma_handle =pci_map_single (ha->pdev, - cmd->request_buffer, - cmd->request_bufflen, - cmd->sc_data_direction); - - sp->saved_dma_handle = dma_handle; -#if defined(CONFIG_IA64_GENERIC ) || defined(CONFIG_IA64_SGI_SN2 ) -if (ha->flags.use_pci_vchannel) -sn_pci_set_vchan (ha->pdev, - (unsigned long *)&dma_handle, -SCSI_BUS_32 (cmd)); -#endif - *dword_ptr++ =cpu_to_le32 (pci_dma_lo32 (dma_handle)); - *dword_ptr++ =cpu_to_le32 (pci_dma_hi32 (dma_handle)); - *dword_ptr =cpu_to_le32 (cmd->request_bufflen); - -dprintk (5 ,"qla1280_64bit_start_scsi: No scatter/" -"gather command packet data - b %i, t %i, " -"l %i \n" ,SCSI_BUS_32 (cmd),SCSI_TCN_32 (cmd), -SCSI_LUN_32 (cmd)); -qla1280_dump_buffer (5 , (char *)pkt, -REQUEST_ENTRY_SIZE ); } }else {/* No data transfer */ dprintk(5, "qla1280_64bit_start_scsi: No data, command "
@@ -3073,7 +3039,7 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)int status =0 ;int cnt;int req_cnt; -uint16_t seg_cnt; +int seg_cnt;dma_addr_t dma_handle;u8 dir;
@@ -3084,17 +3050,8 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)/* Calculate number of entries and segments required. */ req_cnt =1 ; -if (cmd->use_sg) { -/* -* We must build an SG list in adapter format, as the kernel's -* SG list cannot be used directly because of data field size -* (__alpha__) differences and the kernel SG list uses virtual -* addresses where we need physical addresses. -*/ - sg = (struct scatterlist *) cmd->request_buffer; - seg_cnt =pci_map_sg (ha->pdev, sg, cmd->use_sg, - cmd->sc_data_direction); - + seg_cnt =scsi_dma_map (cmd); +if (seg_cnt >0 ) {/* * if greater than four sg entries then we need to allocate * continuation entries
@@ -3106,14 +3063,9 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) }dprintk (3 ,"S/G Transfer cmd=%p seg_cnt=0x%x, req_cnt=%x\n" , cmd, seg_cnt, req_cnt); - }else if (cmd->request_bufflen) {/* If data transfer. */ -dprintk (3 ,"No S/G transfer t=%x cmd=%p len=%x CDB=%x\n" , -SCSI_TCN_32 (cmd), cmd, cmd->request_bufflen, - cmd->cmnd[0 ]); - seg_cnt =1 ; - }else { -/* dprintk(1, "No data transfer \n"); */ - seg_cnt =0 ; + }else if (seg_cnt <0 ) { + status =1 ; + goto out; }if ((req_cnt +2 ) >= ha->req_q_cnt) {
@@ -3198,7 +3150,7 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)/* Setup packet address segment pointer. */ dword_ptr = &pkt->dseg_0_address; -if (cmd->use_sg) {/* If scatter gather */ + {/* FIXME:Indentation in next patch */ dprintk (3 ,"Building S/G data segments..\n" );qla1280_dump_buffer (1 , (char *)sg,4 *16 );
@@ -3270,15 +3222,6 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)qla1280_dump_buffer (5 , (char *)pkt,REQUEST_ENTRY_SIZE ); } - }else {/* No S/G data transfer */ - dma_handle =pci_map_single (ha->pdev, - cmd->request_buffer, - cmd->request_bufflen, - cmd->sc_data_direction); - sp->saved_dma_handle = dma_handle; - - *dword_ptr++ =cpu_to_le32 (pci_dma_lo32 (dma_handle)); - *dword_ptr =cpu_to_le32 (cmd->request_bufflen); } }else {/* No data transfer at all */ dprintk(5, "qla1280_32bit_start_scsi: No data, command "
@@ -4086,15 +4029,9 @@ __qla1280_print_scsi_cmd(struct scsi_cmnd *cmd)for (i =0 ; i < cmd->cmd_len; i++) {printk ("0x%02x " , cmd->cmnd[i]); } -printk (" seg_cnt =%d\n" , cmd->use_sg); +printk (" seg_cnt =%d\n" ,scsi_sg_count (cmd));printk (" request buffer=0x%p, request buffer len=0x%x\n" , - cmd->request_buffer, cmd->request_bufflen); -/* if (cmd->use_sg) -{ -sg = (struct scatterlist *) cmd->request_buffer; -printk(" SG buffer: \n"); -qla1280_dump_buffer(1, (char *)sg, (cmd->use_sg*sizeof(struct scatterlist))); -} */ +scsi_sglist (cmd),scsi_bufflen (cmd));printk (" tag=%d, transfersize=0x%x \n" , cmd->tag, cmd->transfersize);printk (" Pid=%li, SP=0x%p\n" , cmd->serial_number,CMD_SP (cmd));
Signature · 1 line
1.5.3.1
PATCH 22/32 qla1280: Indentation fix
In reply to Boaz Harrosh- Indentation fix of last patch. Don't be fooled by diff, all I did was back-indent from open-bracket to close-bracket, and remove the brackets.
--- drivers/scsi/qla1280.c | 290 ++++++++++++++++++++++++------------------------ 1 files changed, 143 insertions(+), 147 deletions(-)
drivers/scsi/qla1280.c +143 -147
@@ -2882,99 +2882,97 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)/* Setup packet address segment pointer. */ dword_ptr = (u32 *)&pkt->dseg_0_address; - {/* FIXME:Indentation in next patch */ -/* Load command entry data segments. */ -for_each_sg (sg, s, seg_cnt, cnt) { -if (cnt ==2 ) +/* Load command entry data segments. */ +for_each_sg (sg, s, seg_cnt, cnt) { +if (cnt ==2 ) +break ; + dma_handle =sg_dma_address (s); +#if defined(CONFIG_IA64_GENERIC ) || defined(CONFIG_IA64_SGI_SN2 ) +if (ha->flags.use_pci_vchannel) +sn_pci_set_vchan (ha->pdev, + (unsigned long *)&dma_handle, +SCSI_BUS_32 (cmd)); +#endif + *dword_ptr++ = +cpu_to_le32 (pci_dma_lo32 (dma_handle)); + *dword_ptr++ = +cpu_to_le32 (pci_dma_hi32 (dma_handle)); + *dword_ptr++ =cpu_to_le32 (sg_dma_len (s)); +dprintk (3 ,"S/G Segment phys_addr=%x %x, len=0x%x\n" , +cpu_to_le32 (pci_dma_hi32 (dma_handle)), +cpu_to_le32 (pci_dma_lo32 (dma_handle)), +cpu_to_le32 (sg_dma_len (sg_next (s)))); + remseg--; + } +dprintk (5 ,"qla1280_64bit_start_scsi: Scatter/gather " +"command packet data - b %i, t %i, l %i \n" , +SCSI_BUS_32 (cmd),SCSI_TCN_32 (cmd), +SCSI_LUN_32 (cmd)); +qla1280_dump_buffer (5 , (char *)pkt, +REQUEST_ENTRY_SIZE ); + +/* +* Build continuation packets. +*/ +dprintk (3 ,"S/G Building Continuation...seg_cnt=0x%x " +"remains\n" , seg_cnt); + +while (remseg >0 ) { +/* Update sg start */ + sg = s; +/* Adjust ring index. */ + ha->req_ring_index++; +if (ha->req_ring_index ==REQUEST_ENTRY_CNT ) { + ha->req_ring_index =0 ; + ha->request_ring_ptr = + ha->request_ring; + }else + ha->request_ring_ptr++; + + pkt = (cmd_a64_entry_t *)ha->request_ring_ptr; + +/* Zero out packet. */ +memset (pkt,0 ,REQUEST_ENTRY_SIZE ); + +/* Load packet defaults. */ + ((struct cont_a64_entry *) pkt)->entry_type = +CONTINUE_A64_TYPE ; + ((struct cont_a64_entry *) pkt)->entry_count =1 ; + ((struct cont_a64_entry *) pkt)->sys_define = + (uint8_t )ha->req_ring_index; +/* Setup packet address segment pointer. */ + dword_ptr = + (u32 *)&((struct cont_a64_entry *) pkt)->dseg_0_address; + +/* Load continuation entry data segments. */ +for_each_sg (sg, s, remseg, cnt) { +if (cnt ==5 )break ; dma_handle =sg_dma_address (s);#if defined(CONFIG_IA64_GENERIC ) || defined(CONFIG_IA64_SGI_SN2 ) -if (ha->flags.use_pci_vchannel) -sn_pci_set_vchan (ha->pdev, - (unsigned long *)&dma_handle, -SCSI_BUS_32 (cmd)); +if (ha->flags.use_pci_vchannel) +sn_pci_set_vchan (ha->pdev, + (unsigned long *)&dma_handle, +SCSI_BUS_32 (cmd));#endif *dword_ptr++ =cpu_to_le32 (pci_dma_lo32 (dma_handle)); *dword_ptr++ =cpu_to_le32 (pci_dma_hi32 (dma_handle)); - *dword_ptr++ =cpu_to_le32 (sg_dma_len (s)); -dprintk (3 ,"S/G Segment phys_addr=%x %x, len=0x%x\n" , + *dword_ptr++ = +cpu_to_le32 (sg_dma_len (s)); +dprintk (3 ,"S/G Segment Cont. phys_addr=%x %x, len=0x%x\n" ,cpu_to_le32 (pci_dma_hi32 (dma_handle)),cpu_to_le32 (pci_dma_lo32 (dma_handle)), -cpu_to_le32 (sg_dma_len (sg_next (s)))); - remseg--; +cpu_to_le32 (sg_dma_len (s))); } -dprintk (5 ,"qla1280_64bit_start_scsi: Scatter/gather " -"command packet data - b %i, t %i, l %i \n" , -SCSI_BUS_32 (cmd),SCSI_TCN_32 (cmd), -SCSI_LUN_32 (cmd)); + remseg -= cnt; +dprintk (5 ,"qla1280_64bit_start_scsi: " +"continuation packet data - b %i, t " +"%i, l %i \n" ,SCSI_BUS_32 (cmd), +SCSI_TCN_32 (cmd),SCSI_LUN_32 (cmd));qla1280_dump_buffer (5 , (char *)pkt,REQUEST_ENTRY_SIZE ); - -/* -* Build continuation packets. -*/ -dprintk (3 ,"S/G Building Continuation...seg_cnt=0x%x " -"remains\n" , seg_cnt); - -while (remseg >0 ) { -/* Update sg start */ - sg = s; -/* Adjust ring index. */ - ha->req_ring_index++; -if (ha->req_ring_index ==REQUEST_ENTRY_CNT ) { - ha->req_ring_index =0 ; - ha->request_ring_ptr = - ha->request_ring; - }else - ha->request_ring_ptr++; - - pkt = (cmd_a64_entry_t *)ha->request_ring_ptr; - -/* Zero out packet. */ -memset (pkt,0 ,REQUEST_ENTRY_SIZE ); - -/* Load packet defaults. */ - ((struct cont_a64_entry *) pkt)->entry_type = -CONTINUE_A64_TYPE ; - ((struct cont_a64_entry *) pkt)->entry_count =1 ; - ((struct cont_a64_entry *) pkt)->sys_define = - (uint8_t )ha->req_ring_index; -/* Setup packet address segment pointer. */ - dword_ptr = - (u32 *)&((struct cont_a64_entry *) pkt)->dseg_0_address; - -/* Load continuation entry data segments. */ -for_each_sg (sg, s, remseg, cnt) { -if (cnt ==5 ) -break ; - dma_handle =sg_dma_address (s); -#if defined(CONFIG_IA64_GENERIC ) || defined(CONFIG_IA64_SGI_SN2 ) -if (ha->flags.use_pci_vchannel) -sn_pci_set_vchan (ha->pdev, - (unsigned long *)&dma_handle, -SCSI_BUS_32 (cmd)); -#endif - *dword_ptr++ = -cpu_to_le32 (pci_dma_lo32 (dma_handle)); - *dword_ptr++ = -cpu_to_le32 (pci_dma_hi32 (dma_handle)); - *dword_ptr++ = -cpu_to_le32 (sg_dma_len (s)); -dprintk (3 ,"S/G Segment Cont. phys_addr=%x %x, len=0x%x\n" , -cpu_to_le32 (pci_dma_hi32 (dma_handle)), -cpu_to_le32 (pci_dma_lo32 (dma_handle)), -cpu_to_le32 (sg_dma_len (s))); - } - remseg -= cnt; -dprintk (5 ,"qla1280_64bit_start_scsi: " -"continuation packet data - b %i, t " -"%i, l %i \n" ,SCSI_BUS_32 (cmd), -SCSI_TCN_32 (cmd),SCSI_LUN_32 (cmd)); -qla1280_dump_buffer (5 , (char *)pkt, -REQUEST_ENTRY_SIZE ); - } } }else {/* No data transfer */ dprintk(5, "qla1280_64bit_start_scsi: No data, command "
@@ -3150,78 +3148,76 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)/* Setup packet address segment pointer. */ dword_ptr = &pkt->dseg_0_address; - {/* FIXME:Indentation in next patch */ -dprintk (3 ,"Building S/G data segments..\n" ); -qla1280_dump_buffer (1 , (char *)sg,4 *16 ); +dprintk (3 ,"Building S/G data segments..\n" ); +qla1280_dump_buffer (1 , (char *)sg,4 *16 ); -/* Load command entry data segments. */ -for_each_sg (sg, s, seg_cnt, cnt) { -if (cnt ==4 ) +/* Load command entry data segments. */ +for_each_sg (sg, s, seg_cnt, cnt) { +if (cnt ==4 ) +break ; + *dword_ptr++ = +cpu_to_le32 (pci_dma_lo32 (sg_dma_address (s))); + *dword_ptr++ =cpu_to_le32 (sg_dma_len (s)); +dprintk (3 ,"S/G Segment phys_addr=0x%lx, len=0x%x\n" , + (pci_dma_lo32 (sg_dma_address (s))), + (sg_dma_len (s))); + remseg--; + } +/* +* Build continuation packets. +*/ +dprintk (3 ,"S/G Building Continuation" +"...seg_cnt=0x%x remains\n" , seg_cnt); +while (remseg >0 ) { +/* Continue from end point */ + sg = s; +/* Adjust ring index. */ + ha->req_ring_index++; +if (ha->req_ring_index ==REQUEST_ENTRY_CNT ) { + ha->req_ring_index =0 ; + ha->request_ring_ptr = + ha->request_ring; + }else + ha->request_ring_ptr++; + + pkt = (struct cmd_entry *)ha->request_ring_ptr; + +/* Zero out packet. */ +memset (pkt,0 ,REQUEST_ENTRY_SIZE ); + +/* Load packet defaults. */ + ((struct cont_entry *) pkt)-> + entry_type =CONTINUE_TYPE ; + ((struct cont_entry *) pkt)->entry_count =1 ; + + ((struct cont_entry *) pkt)->sys_define = + (uint8_t ) ha->req_ring_index; + +/* Setup packet address segment pointer. */ + dword_ptr = + &((struct cont_entry *) pkt)->dseg_0_address; + +/* Load continuation entry data segments. */ +for_each_sg (sg, s, remseg, cnt) { +if (cnt ==7 )break ; *dword_ptr++ =cpu_to_le32 (pci_dma_lo32 (sg_dma_address (s))); - *dword_ptr++ =cpu_to_le32 (sg_dma_len (s)); -dprintk (3 ,"S/G Segment phys_addr=0x%lx, len=0x%x\n" , - (pci_dma_lo32 (sg_dma_address (s))), - (sg_dma_len (s))); - remseg--; - } -/* -* Build continuation packets. -*/ -dprintk (3 ,"S/G Building Continuation" -"...seg_cnt=0x%x remains\n" , seg_cnt); -while (remseg >0 ) { -/* Continue from end point */ - sg = s; -/* Adjust ring index. */ - ha->req_ring_index++; -if (ha->req_ring_index ==REQUEST_ENTRY_CNT ) { - ha->req_ring_index =0 ; - ha->request_ring_ptr = - ha->request_ring; - }else - ha->request_ring_ptr++; - - pkt = (struct cmd_entry *)ha->request_ring_ptr; - -/* Zero out packet. */ -memset (pkt,0 ,REQUEST_ENTRY_SIZE ); - -/* Load packet defaults. */ - ((struct cont_entry *) pkt)-> - entry_type =CONTINUE_TYPE ; - ((struct cont_entry *) pkt)->entry_count =1 ; - - ((struct cont_entry *) pkt)->sys_define = - (uint8_t ) ha->req_ring_index; - -/* Setup packet address segment pointer. */ - dword_ptr = - &((struct cont_entry *) pkt)->dseg_0_address; - -/* Load continuation entry data segments. */ -for_each_sg (sg, s, remseg, cnt) { -if (cnt ==7 ) -break ; - *dword_ptr++ = -cpu_to_le32 (pci_dma_lo32 (sg_dma_address (s))); - *dword_ptr++ = -cpu_to_le32 (sg_dma_len (s)); -dprintk (1 , -"S/G Segment Cont. phys_addr=0x%x, " -"len=0x%x\n" , -cpu_to_le32 (pci_dma_lo32 (sg_dma_address (s))), -cpu_to_le32 (sg_dma_len (s))); - } - remseg -= cnt; -dprintk (5 ,"qla1280_32bit_start_scsi: " -"continuation packet data - " -"scsi(%i:%i:%i)\n" ,SCSI_BUS_32 (cmd), -SCSI_TCN_32 (cmd),SCSI_LUN_32 (cmd)); -qla1280_dump_buffer (5 , (char *)pkt, -REQUEST_ENTRY_SIZE ); + *dword_ptr++ = +cpu_to_le32 (sg_dma_len (s)); +dprintk (1 , +"S/G Segment Cont. phys_addr=0x%x, " +"len=0x%x\n" , +cpu_to_le32 (pci_dma_lo32 (sg_dma_address (s))), +cpu_to_le32 (sg_dma_len (s))); } + remseg -= cnt; +dprintk (5 ,"qla1280_32bit_start_scsi: " +"continuation packet data - " +"scsi(%i:%i:%i)\n" ,SCSI_BUS_32 (cmd), +SCSI_TCN_32 (cmd),SCSI_LUN_32 (cmd)); +qla1280_dump_buffer (5 , (char *)pkt, +REQUEST_ENTRY_SIZE ); } }else {/* No data transfer at all */ dprintk(5, "qla1280_32bit_start_scsi: No data, command "
Signature · 1 line
1.5.3.1
Re: [PATCH 22/32] qla1280: Indentation fix
Quoted 4 lines · Boaz Harrosh
- Indentation fix of last patch. Don't be fooled by diff, all I did was back-indent from open-bracket to close-bracket, and remove the brackets.
Applying 'qla1280: Indentation fix'
Adds trailing whitespace.
.dotest/patch:90: sn_pci_set_vchan(ha->pdev,
warning: 1 line adds trailing whitespaces.
Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Re: [PATCH 22/32 ver2] qla1280: Indentation fix
In reply to Boaz Harrosh- Indentation fix of last patch. Don't be fooled by diff, all I did was back-indent from open-bracket to close-bracket, and remove the brackets.
--- drivers/scsi/qla1280.c | 290 ++++++++++++++++++++++++------------------------ 1 files changed, 143 insertions(+), 147 deletions(-)
drivers/scsi/qla1280.c +143 -147
@@ -2882,99 +2882,97 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)/* Setup packet address segment pointer. */ dword_ptr = (u32 *)&pkt->dseg_0_address; - {/* FIXME:Indentation in next patch */ -/* Load command entry data segments. */ -for_each_sg (sg, s, seg_cnt, cnt) { -if (cnt ==2 ) +/* Load command entry data segments. */ +for_each_sg (sg, s, seg_cnt, cnt) { +if (cnt ==2 ) +break ; + dma_handle =sg_dma_address (s); +#if defined(CONFIG_IA64_GENERIC ) || defined(CONFIG_IA64_SGI_SN2 ) +if (ha->flags.use_pci_vchannel) +sn_pci_set_vchan (ha->pdev, + (unsigned long *)&dma_handle, +SCSI_BUS_32 (cmd)); +#endif + *dword_ptr++ = +cpu_to_le32 (pci_dma_lo32 (dma_handle)); + *dword_ptr++ = +cpu_to_le32 (pci_dma_hi32 (dma_handle)); + *dword_ptr++ =cpu_to_le32 (sg_dma_len (s)); +dprintk (3 ,"S/G Segment phys_addr=%x %x, len=0x%x\n" , +cpu_to_le32 (pci_dma_hi32 (dma_handle)), +cpu_to_le32 (pci_dma_lo32 (dma_handle)), +cpu_to_le32 (sg_dma_len (sg_next (s)))); + remseg--; + } +dprintk (5 ,"qla1280_64bit_start_scsi: Scatter/gather " +"command packet data - b %i, t %i, l %i \n" , +SCSI_BUS_32 (cmd),SCSI_TCN_32 (cmd), +SCSI_LUN_32 (cmd)); +qla1280_dump_buffer (5 , (char *)pkt, +REQUEST_ENTRY_SIZE ); + +/* +* Build continuation packets. +*/ +dprintk (3 ,"S/G Building Continuation...seg_cnt=0x%x " +"remains\n" , seg_cnt); + +while (remseg >0 ) { +/* Update sg start */ + sg = s; +/* Adjust ring index. */ + ha->req_ring_index++; +if (ha->req_ring_index ==REQUEST_ENTRY_CNT ) { + ha->req_ring_index =0 ; + ha->request_ring_ptr = + ha->request_ring; + }else + ha->request_ring_ptr++; + + pkt = (cmd_a64_entry_t *)ha->request_ring_ptr; + +/* Zero out packet. */ +memset (pkt,0 ,REQUEST_ENTRY_SIZE ); + +/* Load packet defaults. */ + ((struct cont_a64_entry *) pkt)->entry_type = +CONTINUE_A64_TYPE ; + ((struct cont_a64_entry *) pkt)->entry_count =1 ; + ((struct cont_a64_entry *) pkt)->sys_define = + (uint8_t )ha->req_ring_index; +/* Setup packet address segment pointer. */ + dword_ptr = + (u32 *)&((struct cont_a64_entry *) pkt)->dseg_0_address; + +/* Load continuation entry data segments. */ +for_each_sg (sg, s, remseg, cnt) { +if (cnt ==5 )break ; dma_handle =sg_dma_address (s);#if defined(CONFIG_IA64_GENERIC ) || defined(CONFIG_IA64_SGI_SN2 ) -if (ha->flags.use_pci_vchannel) -sn_pci_set_vchan (ha->pdev, - (unsigned long *)&dma_handle, -SCSI_BUS_32 (cmd)); +if (ha->flags.use_pci_vchannel) +sn_pci_set_vchan (ha->pdev, + (unsigned long *)&dma_handle, +SCSI_BUS_32 (cmd));#endif *dword_ptr++ =cpu_to_le32 (pci_dma_lo32 (dma_handle)); *dword_ptr++ =cpu_to_le32 (pci_dma_hi32 (dma_handle)); - *dword_ptr++ =cpu_to_le32 (sg_dma_len (s)); -dprintk (3 ,"S/G Segment phys_addr=%x %x, len=0x%x\n" , + *dword_ptr++ = +cpu_to_le32 (sg_dma_len (s)); +dprintk (3 ,"S/G Segment Cont. phys_addr=%x %x, len=0x%x\n" ,cpu_to_le32 (pci_dma_hi32 (dma_handle)),cpu_to_le32 (pci_dma_lo32 (dma_handle)), -cpu_to_le32 (sg_dma_len (sg_next (s)))); - remseg--; +cpu_to_le32 (sg_dma_len (s))); } -dprintk (5 ,"qla1280_64bit_start_scsi: Scatter/gather " -"command packet data - b %i, t %i, l %i \n" , -SCSI_BUS_32 (cmd),SCSI_TCN_32 (cmd), -SCSI_LUN_32 (cmd)); + remseg -= cnt; +dprintk (5 ,"qla1280_64bit_start_scsi: " +"continuation packet data - b %i, t " +"%i, l %i \n" ,SCSI_BUS_32 (cmd), +SCSI_TCN_32 (cmd),SCSI_LUN_32 (cmd));qla1280_dump_buffer (5 , (char *)pkt,REQUEST_ENTRY_SIZE ); - -/* -* Build continuation packets. -*/ -dprintk (3 ,"S/G Building Continuation...seg_cnt=0x%x " -"remains\n" , seg_cnt); - -while (remseg >0 ) { -/* Update sg start */ - sg = s; -/* Adjust ring index. */ - ha->req_ring_index++; -if (ha->req_ring_index ==REQUEST_ENTRY_CNT ) { - ha->req_ring_index =0 ; - ha->request_ring_ptr = - ha->request_ring; - }else - ha->request_ring_ptr++; - - pkt = (cmd_a64_entry_t *)ha->request_ring_ptr; - -/* Zero out packet. */ -memset (pkt,0 ,REQUEST_ENTRY_SIZE ); - -/* Load packet defaults. */ - ((struct cont_a64_entry *) pkt)->entry_type = -CONTINUE_A64_TYPE ; - ((struct cont_a64_entry *) pkt)->entry_count =1 ; - ((struct cont_a64_entry *) pkt)->sys_define = - (uint8_t )ha->req_ring_index; -/* Setup packet address segment pointer. */ - dword_ptr = - (u32 *)&((struct cont_a64_entry *) pkt)->dseg_0_address; - -/* Load continuation entry data segments. */ -for_each_sg (sg, s, remseg, cnt) { -if (cnt ==5 ) -break ; - dma_handle =sg_dma_address (s); -#if defined(CONFIG_IA64_GENERIC ) || defined(CONFIG_IA64_SGI_SN2 ) -if (ha->flags.use_pci_vchannel) -sn_pci_set_vchan (ha->pdev, - (unsigned long *)&dma_handle, -SCSI_BUS_32 (cmd)); -#endif - *dword_ptr++ = -cpu_to_le32 (pci_dma_lo32 (dma_handle)); - *dword_ptr++ = -cpu_to_le32 (pci_dma_hi32 (dma_handle)); - *dword_ptr++ = -cpu_to_le32 (sg_dma_len (s)); -dprintk (3 ,"S/G Segment Cont. phys_addr=%x %x, len=0x%x\n" , -cpu_to_le32 (pci_dma_hi32 (dma_handle)), -cpu_to_le32 (pci_dma_lo32 (dma_handle)), -cpu_to_le32 (sg_dma_len (s))); - } - remseg -= cnt; -dprintk (5 ,"qla1280_64bit_start_scsi: " -"continuation packet data - b %i, t " -"%i, l %i \n" ,SCSI_BUS_32 (cmd), -SCSI_TCN_32 (cmd),SCSI_LUN_32 (cmd)); -qla1280_dump_buffer (5 , (char *)pkt, -REQUEST_ENTRY_SIZE ); - } } }else {/* No data transfer */ dprintk(5, "qla1280_64bit_start_scsi: No data, command "
@@ -3150,78 +3148,76 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)/* Setup packet address segment pointer. */ dword_ptr = &pkt->dseg_0_address; - {/* FIXME:Indentation in next patch */ -dprintk (3 ,"Building S/G data segments..\n" ); -qla1280_dump_buffer (1 , (char *)sg,4 *16 ); +dprintk (3 ,"Building S/G data segments..\n" ); +qla1280_dump_buffer (1 , (char *)sg,4 *16 ); -/* Load command entry data segments. */ -for_each_sg (sg, s, seg_cnt, cnt) { -if (cnt ==4 ) +/* Load command entry data segments. */ +for_each_sg (sg, s, seg_cnt, cnt) { +if (cnt ==4 ) +break ; + *dword_ptr++ = +cpu_to_le32 (pci_dma_lo32 (sg_dma_address (s))); + *dword_ptr++ =cpu_to_le32 (sg_dma_len (s)); +dprintk (3 ,"S/G Segment phys_addr=0x%lx, len=0x%x\n" , + (pci_dma_lo32 (sg_dma_address (s))), + (sg_dma_len (s))); + remseg--; + } +/* +* Build continuation packets. +*/ +dprintk (3 ,"S/G Building Continuation" +"...seg_cnt=0x%x remains\n" , seg_cnt); +while (remseg >0 ) { +/* Continue from end point */ + sg = s; +/* Adjust ring index. */ + ha->req_ring_index++; +if (ha->req_ring_index ==REQUEST_ENTRY_CNT ) { + ha->req_ring_index =0 ; + ha->request_ring_ptr = + ha->request_ring; + }else + ha->request_ring_ptr++; + + pkt = (struct cmd_entry *)ha->request_ring_ptr; + +/* Zero out packet. */ +memset (pkt,0 ,REQUEST_ENTRY_SIZE ); + +/* Load packet defaults. */ + ((struct cont_entry *) pkt)-> + entry_type =CONTINUE_TYPE ; + ((struct cont_entry *) pkt)->entry_count =1 ; + + ((struct cont_entry *) pkt)->sys_define = + (uint8_t ) ha->req_ring_index; + +/* Setup packet address segment pointer. */ + dword_ptr = + &((struct cont_entry *) pkt)->dseg_0_address; + +/* Load continuation entry data segments. */ +for_each_sg (sg, s, remseg, cnt) { +if (cnt ==7 )break ; *dword_ptr++ =cpu_to_le32 (pci_dma_lo32 (sg_dma_address (s))); - *dword_ptr++ =cpu_to_le32 (sg_dma_len (s)); -dprintk (3 ,"S/G Segment phys_addr=0x%lx, len=0x%x\n" , - (pci_dma_lo32 (sg_dma_address (s))), - (sg_dma_len (s))); - remseg--; - } -/* -* Build continuation packets. -*/ -dprintk (3 ,"S/G Building Continuation" -"...seg_cnt=0x%x remains\n" , seg_cnt); -while (remseg >0 ) { -/* Continue from end point */ - sg = s; -/* Adjust ring index. */ - ha->req_ring_index++; -if (ha->req_ring_index ==REQUEST_ENTRY_CNT ) { - ha->req_ring_index =0 ; - ha->request_ring_ptr = - ha->request_ring; - }else - ha->request_ring_ptr++; - - pkt = (struct cmd_entry *)ha->request_ring_ptr; - -/* Zero out packet. */ -memset (pkt,0 ,REQUEST_ENTRY_SIZE ); - -/* Load packet defaults. */ - ((struct cont_entry *) pkt)-> - entry_type =CONTINUE_TYPE ; - ((struct cont_entry *) pkt)->entry_count =1 ; - - ((struct cont_entry *) pkt)->sys_define = - (uint8_t ) ha->req_ring_index; - -/* Setup packet address segment pointer. */ - dword_ptr = - &((struct cont_entry *) pkt)->dseg_0_address; - -/* Load continuation entry data segments. */ -for_each_sg (sg, s, remseg, cnt) { -if (cnt ==7 ) -break ; - *dword_ptr++ = -cpu_to_le32 (pci_dma_lo32 (sg_dma_address (s))); - *dword_ptr++ = -cpu_to_le32 (sg_dma_len (s)); -dprintk (1 , -"S/G Segment Cont. phys_addr=0x%x, " -"len=0x%x\n" , -cpu_to_le32 (pci_dma_lo32 (sg_dma_address (s))), -cpu_to_le32 (sg_dma_len (s))); - } - remseg -= cnt; -dprintk (5 ,"qla1280_32bit_start_scsi: " -"continuation packet data - " -"scsi(%i:%i:%i)\n" ,SCSI_BUS_32 (cmd), -SCSI_TCN_32 (cmd),SCSI_LUN_32 (cmd)); -qla1280_dump_buffer (5 , (char *)pkt, -REQUEST_ENTRY_SIZE ); + *dword_ptr++ = +cpu_to_le32 (sg_dma_len (s)); +dprintk (1 , +"S/G Segment Cont. phys_addr=0x%x, " +"len=0x%x\n" , +cpu_to_le32 (pci_dma_lo32 (sg_dma_address (s))), +cpu_to_le32 (sg_dma_len (s))); } + remseg -= cnt; +dprintk (5 ,"qla1280_32bit_start_scsi: " +"continuation packet data - " +"scsi(%i:%i:%i)\n" ,SCSI_BUS_32 (cmd), +SCSI_TCN_32 (cmd),SCSI_LUN_32 (cmd)); +qla1280_dump_buffer (5 , (char *)pkt, +REQUEST_ENTRY_SIZE ); } }else {/* No data transfer at all */ dprintk(5, "qla1280_32bit_start_scsi: No data, command "
Signature · 1 line
1.5.3.1
PATCH 23/32 scsi_debug: convert to use the data buffer accessors
In reply to Boaz Harrosh - remove the unnecessary map_single path.
- convert to use the new accessors for the sg lists and the parameters.
--- drivers/scsi/scsi_debug.c | 36 ++++++++++-------------------------- 1 files changed, 10 insertions(+), 26 deletions(-)
drivers/scsi/scsi_debug.c +10 -26
@@ -329,7 +329,7 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done)if (done ==NULL )return 0 ;/* assume mid level reprocessing command */ - SCpnt->resid =0 ; +scsi_set_resid (SCpnt,0 );if ((SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) && cmd) {printk (KERN_INFO "scsi_debug: cmd " );for (k =0 , len = SCpnt->cmd_len; k < len; ++k)
@@ -603,26 +603,16 @@ static int fill_from_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr,void * kaddr_off;struct scatterlist * sg; -if (0 == scp->request_bufflen) +if (0 ==scsi_bufflen (scp))return 0 ; -if (NULL == scp->request_buffer) +if (NULL ==scsi_sglist (scp))return (DID_ERROR <<16 );if (! ((scp->sc_data_direction ==DMA_BIDIRECTIONAL ) || (scp->sc_data_direction ==DMA_FROM_DEVICE )))return (DID_ERROR <<16 ); -if (0 == scp->use_sg) { - req_len = scp->request_bufflen; - act_len = (req_len < arr_len) ? req_len : arr_len; -memcpy (scp->request_buffer, arr, act_len); -if (scp->resid) - scp->resid -= act_len; -else - scp->resid = req_len - act_len; -return 0 ; - } active =1 ; req_len = act_len =0 ; -scsi_for_each_sg (scp, sg, scp->use_sg, k) { +scsi_for_each_sg (scp, sg,scsi_sg_count (scp), k) {if (active) { kaddr = (unsigned char *)kmap_atomic (sg->page,KM_USER0 );
@@ -640,10 +630,10 @@ static int fill_from_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr, } req_len += sg->length; } -if (scp->resid) - scp->resid -= act_len; +if (scsi_get_resid (scp)) +scsi_set_resid (scp,scsi_get_resid (scp) - act_len);else - scp->resid = req_len - act_len; +scsi_set_resid (scp, req_len - act_len);return 0 ; }
@@ -656,22 +646,16 @@ static int fetch_to_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr,void * kaddr_off;struct scatterlist * sg; -if (0 == scp->request_bufflen) +if (0 ==scsi_bufflen (scp))return 0 ; -if (NULL == scp->request_buffer) +if (NULL ==scsi_sglist (scp))return -1 ;if (! ((scp->sc_data_direction ==DMA_BIDIRECTIONAL ) || (scp->sc_data_direction ==DMA_TO_DEVICE )))return -1 ; -if (0 == scp->use_sg) { - req_len = scp->request_bufflen; - len = (req_len < max_arr_len) ? req_len : max_arr_len; -memcpy (arr, scp->request_buffer, len); -return len; - } sg =scsi_sglist (scp); req_len = fin =0 ; -for (k =0 ; k < scp->use_sg; ++k, sg =sg_next (sg)) { +for (k =0 ; k <scsi_sg_count (scp); ++k, sg =sg_next (sg)) { kaddr = (unsigned char *)kmap_atomic (sg->page,KM_USER0 );if (NULL == kaddr)return -1 ;
Signature · 1 line
1.5.3.1
PATCH 24/32 wd7000.c - proper fix for boards without sg support
In reply to Boaz Harrosh - code used to set sg_tablesize to zero for board revision less than 6. This is no longer supported, therefore I use sg_tablesize=1 and open code the sg handling for that case.
- Get rid of use of SG_NONE which will be removed soon.
--- drivers/scsi/wd7000.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/wd7000.c +6 -6
@@ -1108,13 +1108,10 @@ static int wd7000_queuecommand(struct scsi_cmnd *SCpnt, scb->host = host; nseg =scsi_sg_count (SCpnt); -if (nseg) { +if (nseg >1 ) {struct scatterlist *sg;unsigned i; -if (SCpnt->device->host->sg_tablesize ==SG_NONE ) { -panic ("wd7000_queuecommand: scatter/gather not supported.\n" ); - }dprintk ("Using scatter/gather with %d elements.\n" , nseg); sgb = scb->sgb;
@@ -1128,7 +1125,10 @@ static int wd7000_queuecommand(struct scsi_cmnd *SCpnt, } }else { scb->op =0 ; -any2scsi (scb->dataptr,isa_virt_to_bus (scsi_sglist (SCpnt))); +if (nseg) { +struct scatterlist *sg =scsi_sglist (SCpnt); +any2scsi (scb->dataptr,isa_page_to_bus (sg->page) + sg->offset); + }any2scsi (scb->maxlen,scsi_bufflen (SCpnt)); }
@@ -1524,7 +1524,7 @@ static __init int wd7000_detect(struct scsi_host_template *tpnt)* For boards before rev 6.0, scatter/gather isn't supported. */ if (host->rev1 <6 ) - sh->sg_tablesize =SG_NONE ; + sh->sg_tablesize =1 ; present++;/* count it */
Signature · 1 line
1.5.3.1
PATCH 25/32 Remove psi240i driver from kernel
In reply to Boaz Harrosh The psi240i driver is still written for cmnd->request_buffer as a char pointer to actual data. There was never any attempt to use the scatterlist option.
- remove all source files (3) from drivers/scsi
- Remove from Makefile and Kconfig
--- drivers/scsi/Kconfig | 11 - drivers/scsi/Makefile | 1 - drivers/scsi/psi240i.c | 689 ----------------------------------------------- drivers/scsi/psi240i.h | 315 --------------------- drivers/scsi/psi_chip.h | 195 ------------- 5 files changed, 0 insertions(+), 1211 deletions(-) delete mode 100644 drivers/scsi/psi240i.c delete mode 100644 drivers/scsi/psi240i.h delete mode 100644 drivers/scsi/psi_chip.h
drivers/scsi/Kconfig +0 -11
@@ -1288,17 +1288,6 @@ config SCSI_PAS16 To compile this driver as a module, choose M here: the module will be called pas16. -config SCSI_PSI240I - tristate "PSI240i support" - depends on ISA && SCSI - help - This is support for the PSI240i EIDE interface card which acts as a - SCSI host adapter. Please read the SCSI-HOWTO, available from - <http://www.tldp.org/docs.html#howto>. - - To compile this driver as a module, choose M here: the - module will be called psi240i. - config SCSI_QLOGIC_FAS tristate "Qlogic FAS SCSI support" depends on ISA && SCSI
drivers/scsi/Makefile +0 -1
@@ -59,7 +59,6 @@ obj-$(CONFIG_MVME16x_SCSI) += 53c700.o mvme16x_scsi.o obj-$(CONFIG_BVME6000_SCSI) += 53c700.o bvme6000_scsi.o obj-$(CONFIG_SCSI_SIM710) += 53c700.o sim710.o obj-$(CONFIG_SCSI_ADVANSYS) += advansys.o -obj-$(CONFIG_SCSI_PSI240I) += psi240i.o obj-$(CONFIG_SCSI_BUSLOGIC) += BusLogic.o obj-$(CONFIG_SCSI_DPT_I2O) += dpt_i2o.o obj-$(CONFIG_SCSI_U14_34F) += u14-34f.o
drivers/scsi/psi240i.c deleted +0 -689
689 lines not on this page · raw message
drivers/scsi/psi240i.h deleted +0 -315
315 lines not on this page · raw message
drivers/scsi/psi_chip.h deleted +0 -195
195 lines not on this page · raw message
Signature · 1 line
1.5.3.1
PATCH 26/32 Remove of seagate.c driver
In reply to Boaz Harrosh- Apparently no one wonts this driver, and no one is willing to fix it for future changes to SCSI. So remove it, and if someone wants it in the future He can revive it with the needed fixes.
--- drivers/scsi/Kconfig | 15 - drivers/scsi/Makefile | 2 - drivers/scsi/seagate.c | 1667 ------------------------------------------------ 3 files changed, 0 insertions(+), 1684 deletions(-) delete mode 100644 drivers/scsi/seagate.c
drivers/scsi/Kconfig +0 -15
@@ -1348,21 +1348,6 @@ config SCSI_LPFC This lpfc driver supports the Emulex LightPulse Family of Fibre Channel PCI host adapters. -config SCSI_SEAGATE - tristate "Seagate ST-02 and Future Domain TMC-8xx SCSI support" - depends on X86 && ISA && SCSI - select CHECK_SIGNATURE - ---help--- - These are 8-bit SCSI controllers; the ST-01 is also supported by - this driver. It is explained in section 3.9 of the SCSI-HOWTO, - available from <http://www.tldp.org/docs.html#howto>. If it - doesn't work out of the box, you may have to change some macros at - compiletime, which are described in <file:drivers/scsi/seagate.c>. - - To compile this driver as a module, choose M here: the - module will be called seagate. - -# definitely looks not 64bit safe: config SCSI_SIM710 tristate "Simple 53c710 SCSI support (Compaq, NCR machines)" depends on (EISA || MCA) && SCSI
drivers/scsi/Makefile +0 -2
@@ -16,7 +16,6 @@ CFLAGS_aha152x.o = -DAHA152X_STAT -DAUTOCONF CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ -DGDTH_STATISTICS -CFLAGS_seagate.o = -DARBITRATE -DPARITY -DSEAGATE_USE_ASM subdir-$(CONFIG_PCMCIA) += pcmcia
@@ -89,7 +88,6 @@ obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx/ obj-$(CONFIG_SCSI_QLA_ISCSI) += qla4xxx/ obj-$(CONFIG_SCSI_LPFC) += lpfc/ obj-$(CONFIG_SCSI_PAS16) += pas16.o -obj-$(CONFIG_SCSI_SEAGATE) += seagate.o obj-$(CONFIG_SCSI_T128) += t128.o obj-$(CONFIG_SCSI_DMX3191D) += dmx3191d.o obj-$(CONFIG_SCSI_DTC3280) += dtc.o
drivers/scsi/seagate.c deleted +0 -1667
1,667 lines not on this page · raw message
Signature · 1 line
1.5.3.1
PATCH 27/32 scsi_data_buffer
In reply to Boaz Harrosh In preparation for bidi we abstract all IO members of scsi_cmnd, that will need to duplicate, into a substructure.
- Group all IO members of scsi_cmnd into a scsi_data_buffer structure.
- Adjust accessors to new members.
- scsi_{alloc,free}_sgtable receive a scsi_data_buffer instead of scsi_cmnd. And work on it.
- Adjust scsi_init_io() and scsi_release_buffers() for above change.
- Fix other parts of scsi_lib/scsi.c to members migration. Use accessors where appropriate.
- Old I/O members are kept for backward compatibility, since not all of scsi-ml/ul is converted yet. Once done they will be removed in a closing patch. (Other wise the patchset will not be bisectable)
- fix Documentation about scsi_cmnd in scsi_host.h
- Small API shim in scsi_tgt_lib (to be removed in tgt patch)
--- drivers/scsi/scsi.c | 2 +- drivers/scsi/scsi_lib.c | 80 ++++++++++++++++--------------------------- drivers/scsi/scsi_tgt_lib.c | 18 ++++++++++ include/scsi/scsi_cmnd.h | 57 ++++++++++++++++++++++-------- include/scsi/scsi_host.h | 4 +- 5 files changed, 92 insertions(+), 69 deletions(-)
drivers/scsi/scsi.c +1 -1
@@ -698,7 +698,7 @@ void scsi_finish_command(struct scsi_cmnd *cmd)"Notifying upper driver of completion " "(result %x)\n", cmd->result)); - good_bytes = cmd->request_bufflen; + good_bytes =scsi_bufflen (cmd);if (cmd->request->cmd_type !=REQ_TYPE_BLOCK_PC ) { drv =scsi_cmd_to_driver (cmd);if (drv->done)
drivers/scsi/scsi_lib.c +30 -50
197 lines not on this page · raw message
drivers/scsi/scsi_tgt_lib.c +18 -0
@@ -60,6 +60,24 @@ struct scsi_tgt_queuedata {spinlock_t cmd_hash_lock; }; +/* FIXME Begin: Shim API until tgt is converted to use sdb */ +static struct scatterlist *tgt_scsi_alloc_sgtable (struct scsi_cmnd *cmd,gfp_t flags) +{ +if (scsi_alloc_sgtable (&cmd->sdb, cmd->use_sg, flags)) +return NULL ; +return cmd->sdb.sglist; +} + +static void tgt_scsi_free_sgtable (struct scsi_cmnd *cmd) +{ +scsi_free_sgtable (&cmd->sdb); +} +#define scsi_alloc_sgtable tgt_scsi_alloc_sgtable +#define scsi_free_sgtable tgt_scsi_free_sgtable + +/* FIXME End: Shim API until tgt is converted to use sdb */ + +/* * Function: scsi_host_get_command() *
include/scsi/scsi_cmnd.h +41 -16
102 lines not on this page · raw message
include/scsi/scsi_host.h +2 -2
@@ -136,9 +136,9 @@ struct scsi_host_template {* the done callback is invoked. * * This is called to inform the LLD to transfer -* cmd->request_bufflen bytes. The cmd->use_sg speciefies the +* scsi_bufflen(cmd) bytes. scsi_sg_count(cmd) speciefies the * number of scatterlist entried in the command and -* cmd->request_buffer contains the scatterlist. +* scsi_sglist(cmd) returns the scatterlist. * * return values: see queuecommand *
Signature · 1 line
1.5.3.1
Re: [PATCH 27/32] scsi_data_buffer
Quoted 18 lines · On Wed, 17 Oct 2007 20:21:15 +0200 Boaz Harrosh <[email protected]> wrote:
In preparation for bidi we abstract all IO members of
scsi_cmnd, that will need to duplicate, into a substructure.- Group all IO members of
scsi_cmndinto ascsi_data_bufferstructure.
- Adjust accessors to new members.
- scsi_{alloc,free}_sgtable receive ascsi_data_bufferinstead ofscsi_cmnd. And work on it.
- Adjustscsi_init_io()andscsi_release_buffers()for above change.
- Fix other parts ofscsi_lib/scsi.cto members migration. Use accessors where appropriate.- Old I/O members are kept for backward compatibility, since not all of scsi-ml/ul is converted yet. Once done they will be removed in a closing patch. (Other wise the patchset will not be bisectable)
(snip)
Quoted 11 lines
include/scsi/scsi_cmnd.h +7
-0@@ -114,6 +112,22 @@ struct scsi_cmnd {int result;/* Status code from lower level driver */ unsigned char tag;/* SCSI-II queued command tag */ + +union { +struct scsi_data_buffer sdb; +/* +* FIXME: Here for compatibility with unconverted drivers. +* Must be kept in sync with exact type and order +* of struct scsi_data_buffer members.
include/scsi/scsi_cmnd.h struct scsi_cmnd { · line 131
Quoted 10 lines
include/scsi/scsi_cmnd.h +9
-0+*/ +struct { +unsigned __deprecated request_bufflen; +int __deprecated resid; +unsigned short __deprecated use_sg; +unsigned short __deprecated place_holder_sg_alloc; +void __deprecated *request_buffer; + }; + }; };
If we add something like this, why couldn't we merge the scsi_data_buffer patchset when I submitted last month?
I thought that I wait you to fix all the old LLDs, then will send a clean scsi_data_buffer patchset.
Re: [PATCH 27/32] scsi_data_buffer
Quoted 48 lines · FUJITA Tomonori
Quoted 17 lines · On Wed, 17 Oct 2007 20:21:15 +0200 Boaz Harrosh <[email protected]> wrote:
In preparation for bidi we abstract all IO members of
scsi_cmnd, that will need to duplicate, into a substructure.- Group all IO members of
scsi_cmndinto ascsi_data_bufferstructure.
- Adjust accessors to new members.
- scsi_{alloc,free}_sgtable receive ascsi_data_bufferinstead ofscsi_cmnd. And work on it.
- Adjustscsi_init_io()andscsi_release_buffers()for above change.
- Fix other parts ofscsi_lib/scsi.cto members migration. Use accessors where appropriate.- Old I/O members are kept for backward compatibility, since not all of scsi-ml/ul is converted yet. Once done they will be removed in a closing patch. (Other wise the patchset will not be bisectable)
(snip)
Quoted 11 lines
include/scsi/scsi_cmnd.h +7
-0@@ -114,6 +112,22 @@ struct scsi_cmnd {int result;/* Status code from lower level driver */ unsigned char tag;/* SCSI-II queued command tag */ + +union { +struct scsi_data_buffer sdb; +/* +* FIXME: Here for compatibility with unconverted drivers. +* Must be kept in sync with exact type and order +* of struct scsi_data_buffer members. include/scsi/scsi_cmnd.h struct scsi_cmnd { · line 131
Quoted 10 lines
include/scsi/scsi_cmnd.h +9
-0+*/ +struct { +unsigned __deprecated request_bufflen; +int __deprecated resid; +unsigned short __deprecated use_sg; +unsigned short __deprecated place_holder_sg_alloc; +void __deprecated *request_buffer; + }; + }; };If we add something like this, why couldn't we merge the
scsi_data_bufferpatchset when I submitted last month?
Quoted 2 lines
I thought that I wait you to fix all the old LLDs, then will send a clean
scsi_data_bufferpatchset.
We do have all the old LLDs fixed. After this patchset the entire tree is clean. I have just forgot to send the last [33/33] patch that removes this. I have just sent it now, sorry.
(The change log above explains exactly why this is done here)
Boaz
Re: [PATCH 27/32] scsi_data_buffer
Quoted 49 lines · On Thu, 18 Oct 2007 09:51:10 +0200 Boaz Harrosh <[email protected]> wrote:
Quoted 48 lines · FUJITA Tomonori
Quoted 17 lines · On Wed, 17 Oct 2007 20:21:15 +0200 Boaz Harrosh <[email protected]> wrote:
In preparation for bidi we abstract all IO members of
scsi_cmnd, that will need to duplicate, into a substructure.- Group all IO members of
scsi_cmndinto ascsi_data_bufferstructure.
- Adjust accessors to new members.
- scsi_{alloc,free}_sgtable receive ascsi_data_bufferinstead ofscsi_cmnd. And work on it.
- Adjustscsi_init_io()andscsi_release_buffers()for above change.
- Fix other parts ofscsi_lib/scsi.cto members migration. Use accessors where appropriate.- Old I/O members are kept for backward compatibility, since not all of scsi-ml/ul is converted yet. Once done they will be removed in a closing patch. (Other wise the patchset will not be bisectable)
(snip)
Quoted 11 lines
include/scsi/scsi_cmnd.h +7
-0@@ -114,6 +112,22 @@ struct scsi_cmnd {int result;/* Status code from lower level driver */ unsigned char tag;/* SCSI-II queued command tag */ + +union { +struct scsi_data_buffer sdb; +/* +* FIXME: Here for compatibility with unconverted drivers. +* Must be kept in sync with exact type and order +* of struct scsi_data_buffer members. include/scsi/scsi_cmnd.h struct scsi_cmnd { · line 131
Quoted 10 lines
include/scsi/scsi_cmnd.h +9
-0+*/ +struct { +unsigned __deprecated request_bufflen; +int __deprecated resid; +unsigned short __deprecated use_sg; +unsigned short __deprecated place_holder_sg_alloc; +void __deprecated *request_buffer; + }; + }; };If we add something like this, why couldn't we merge the
scsi_data_bufferpatchset when I submitted last month?
Quoted 7 lines
Quoted 2 lines
I thought that I wait you to fix all the old LLDs, then will send a clean
scsi_data_bufferpatchset.We do have all the old LLDs fixed. After this patchset the entire tree is clean. I have just forgot to send the last [33/33] patch that removes this. I have just sent it now, sorry.
(The change log above explains exactly why this is done here)
As I said, I can't see why we need this compatibility hack in the first place.
We need to wait patches 1-26 to be merged. After that, we can merge clean scsi_data_buffer patchset (without the compatibility hack).
Re: [PATCH 27/32] scsi_data_buffer
Quoted 57 lines · FUJITA Tomonori
Quoted 47 lines · On Thu, 18 Oct 2007 09:51:10 +0200 Boaz Harrosh <[email protected]> wrote:
Quoted 46 lines · FUJITA Tomonori
Quoted 17 lines · On Wed, 17 Oct 2007 20:21:15 +0200 Boaz Harrosh <[email protected]> wrote:
In preparation for bidi we abstract all IO members of
scsi_cmnd, that will need to duplicate, into a substructure.- Group all IO members of
scsi_cmndinto ascsi_data_bufferstructure.
- Adjust accessors to new members.
- scsi_{alloc,free}_sgtable receive ascsi_data_bufferinstead ofscsi_cmnd. And work on it.
- Adjustscsi_init_io()andscsi_release_buffers()for above change.
- Fix other parts ofscsi_lib/scsi.cto members migration. Use accessors where appropriate.- Old I/O members are kept for backward compatibility, since not all of scsi-ml/ul is converted yet. Once done they will be removed in a closing patch. (Other wise the patchset will not be bisectable)
(snip)
Quoted 11 lines
include/scsi/scsi_cmnd.h +7
-0@@ -114,6 +112,22 @@ struct scsi_cmnd {int result;/* Status code from lower level driver */ unsigned char tag;/* SCSI-II queued command tag */ + +union { +struct scsi_data_buffer sdb; +/* +* FIXME: Here for compatibility with unconverted drivers. +* Must be kept in sync with exact type and order +* of struct scsi_data_buffer members. include/scsi/scsi_cmnd.h struct scsi_cmnd { · line 131
Quoted 10 lines
include/scsi/scsi_cmnd.h +9
-0+*/ +struct { +unsigned __deprecated request_bufflen; +int __deprecated resid; +unsigned short __deprecated use_sg; +unsigned short __deprecated place_holder_sg_alloc; +void __deprecated *request_buffer; + }; + }; };If we add something like this, why couldn't we merge the
scsi_data_bufferpatchset when I submitted last month?Quoted 6 lines
Quoted 2 lines
I thought that I wait you to fix all the old LLDs, then will send a clean
scsi_data_bufferpatchset.We do have all the old LLDs fixed. After this patchset the entire tree is clean. I have just forgot to send the last [33/33] patch that removes this. I have just sent it now, sorry.
(The change log above explains exactly why this is done here)
Quoted 6 lines
As I said, I can't see why we need this compatibility hack in the first place.
We need to wait patches 1-26 to be merged. After that, we can merge clean
scsi_data_bufferpatchset (without the compatibility hack).
No.
It is here so we can separate the patches 27 to 32 and still be bisect-able and running at each patch. Other wise all 27-32 patches must be a single patch. This is the only reason why this is done. At patch [33/33] this is removed and be done with.
James and Linus have stated lots of times that they want every stage of the tree compiling running and complete. I took it to hart, and I don't mind the extra effort.
Boaz
Re: [PATCH 27/32] scsi_data_buffer
Quoted 61 lines · On Thu, 18 Oct 2007 10:27:34 +0200 Boaz Harrosh <[email protected]> wrote:
Quoted 60 lines · FUJITA Tomonori
Quoted 47 lines · On Thu, 18 Oct 2007 09:51:10 +0200 Boaz Harrosh <[email protected]> wrote:
Quoted 46 lines · FUJITA Tomonori
Quoted 17 lines · On Wed, 17 Oct 2007 20:21:15 +0200 Boaz Harrosh <[email protected]> wrote:
In preparation for bidi we abstract all IO members of
scsi_cmnd, that will need to duplicate, into a substructure.- Group all IO members of
scsi_cmndinto ascsi_data_bufferstructure.
- Adjust accessors to new members.
- scsi_{alloc,free}_sgtable receive ascsi_data_bufferinstead ofscsi_cmnd. And work on it.
- Adjustscsi_init_io()andscsi_release_buffers()for above change.
- Fix other parts ofscsi_lib/scsi.cto members migration. Use accessors where appropriate.- Old I/O members are kept for backward compatibility, since not all of scsi-ml/ul is converted yet. Once done they will be removed in a closing patch. (Other wise the patchset will not be bisectable)
(snip)
Quoted 11 lines
include/scsi/scsi_cmnd.h +7
-0@@ -114,6 +112,22 @@ struct scsi_cmnd {int result;/* Status code from lower level driver */ unsigned char tag;/* SCSI-II queued command tag */ + +union { +struct scsi_data_buffer sdb; +/* +* FIXME: Here for compatibility with unconverted drivers. +* Must be kept in sync with exact type and order +* of struct scsi_data_buffer members. include/scsi/scsi_cmnd.h struct scsi_cmnd { · line 131
Quoted 10 lines
include/scsi/scsi_cmnd.h +9
-0+*/ +struct { +unsigned __deprecated request_bufflen; +int __deprecated resid; +unsigned short __deprecated use_sg; +unsigned short __deprecated place_holder_sg_alloc; +void __deprecated *request_buffer; + }; + }; };If we add something like this, why couldn't we merge the
scsi_data_bufferpatchset when I submitted last month?Quoted 6 lines
Quoted 2 lines
I thought that I wait you to fix all the old LLDs, then will send a clean
scsi_data_bufferpatchset.We do have all the old LLDs fixed. After this patchset the entire tree is clean. I have just forgot to send the last [33/33] patch that removes this. I have just sent it now, sorry.
(The change log above explains exactly why this is done here)As I said, I can't see why we need this compatibility hack in the first place.
Quoted 7 lines
Quoted 3 lines
We need to wait patches 1-26 to be merged. After that, we can merge clean
scsi_data_bufferpatchset (without the compatibility hack).No.
It is here so we can separate the patches 27 to 32 and still be bisect-able and running at each patch. Other wise all 27-32 patches must be a single patch.
So why can they be a single patch?
Re: [PATCH 27/32] scsi_data_buffer
Quoted 67 lines · On Thu, 18 Oct 2007 17:45:21 +0900 FUJITA Tomonori…
Quoted 64 lines · On Thu, 18 Oct 2007 10:27:34 +0200 Boaz Harrosh <[email protected]> wrote:
Quoted 63 lines · FUJITA Tomonori
Quoted 47 lines · On Thu, 18 Oct 2007 09:51:10 +0200 Boaz Harrosh <[email protected]> wrote:
Quoted 46 lines · FUJITA Tomonori
Quoted 17 lines · On Wed, 17 Oct 2007 20:21:15 +0200 Boaz Harrosh <[email protected]> wrote:
In preparation for bidi we abstract all IO members of
scsi_cmnd, that will need to duplicate, into a substructure.- Group all IO members of
scsi_cmndinto ascsi_data_bufferstructure.
- Adjust accessors to new members.
- scsi_{alloc,free}_sgtable receive ascsi_data_bufferinstead ofscsi_cmnd. And work on it.
- Adjustscsi_init_io()andscsi_release_buffers()for above change.
- Fix other parts ofscsi_lib/scsi.cto members migration. Use accessors where appropriate.- Old I/O members are kept for backward compatibility, since not all of scsi-ml/ul is converted yet. Once done they will be removed in a closing patch. (Other wise the patchset will not be bisectable)
(snip)
Quoted 11 lines
include/scsi/scsi_cmnd.h +7
-0@@ -114,6 +112,22 @@ struct scsi_cmnd {int result;/* Status code from lower level driver */ unsigned char tag;/* SCSI-II queued command tag */ + +union { +struct scsi_data_buffer sdb; +/* +* FIXME: Here for compatibility with unconverted drivers. +* Must be kept in sync with exact type and order +* of struct scsi_data_buffer members. include/scsi/scsi_cmnd.h struct scsi_cmnd { · line 131
Quoted 10 lines
include/scsi/scsi_cmnd.h +9
-0+*/ +struct { +unsigned __deprecated request_bufflen; +int __deprecated resid; +unsigned short __deprecated use_sg; +unsigned short __deprecated place_holder_sg_alloc; +void __deprecated *request_buffer; + }; + }; };If we add something like this, why couldn't we merge the
scsi_data_bufferpatchset when I submitted last month?Quoted 6 lines
Quoted 2 lines
I thought that I wait you to fix all the old LLDs, then will send a clean
scsi_data_bufferpatchset.We do have all the old LLDs fixed. After this patchset the entire tree is clean. I have just forgot to send the last [33/33] patch that removes this. I have just sent it now, sorry.
(The change log above explains exactly why this is done here)As I said, I can't see why we need this compatibility hack in the first place.
We need to wait patches 1-26 to be merged. After that, we can merge clean
scsi_data_bufferpatchset (without the compatibility hack).
Quoted 6 lines
Quoted 4 lines
No.
It is here so we can separate the patches 27 to 32 and still be bisect-able and running at each patch. Other wise all 27-32 patches must be a single patch.So why can they be a single patch?
Oops, why can't they be a single patch?
They are logically one change. So I think that it would be better to have one logical change (even though a bit large) rather than adding the compatibility hack (and tgt's shim hack) and then removing them.
Re: [PATCH 27/32] scsi_data_buffer
In reply to Boaz HarroshReview
Quoted 10 lines · Boaz Harrosh
- Group all IO members of
scsi_cmndinto ascsi_data_bufferstructure.(quoted diff) +7
-0+struct scsi_data_buffer { + unsigned length; + int resid; + unsigned short sg_count; + unsigned short alloc_sg_count; + struct scatterlist* sglist; +};
This has exactly the problems I thought it would have. Due to alignment rules, it grows the scsi_cmnd from 368 to 376 bytes on x86-64. It remains at 272 bytes on i386 though, which is some consolation. By porting the patch I had for shrinking the scsi_cmnd, I can get it down to 352 bytes, but not as far as the 344 bytes I had it at before.
The problem is the padding at the *end* of scsi_data_buffer (er, after I rearrange it in the patch below). There's nothing we can realistically put in it, given that we don't want to expand scsi_data_buffer's size on 32-bit machines. I have a fix ... but I don't think you'll like it. I certainly don't. But it does get us back down to 344 bytes.
Updated patch below. I'm fully expecting the 'result' shenanigan to get it NACKed, but I'd like to see if it inspires anyone else to a more creative way of saving this space.
---
Thanks to acme's pahole utility, I found some places where we can save a lot of bytes in scsi_cmnd, just by rearranging struct elements and reducing the size of some elements. We go from 272 to 260 bytes on x86 and from 368 to 344 bytes on x86-64.
- eh_eflags had a 4-byte hole after it on 64-bit. In fact, this has value 0 or 1, so reduce it to an unsigned char, and put it with the other chars in scsi_cmnd. Saves 8 bytes on 64-bit.
- sc_data_direction has a value from 0-3, so make it an unsigned char rather than an enum. Saves at least 4 bytes.
- Putting 'tag' with the other char elements saves another 4 bytes
- Moving 'result' into the union with the deprecated members saves 8 bytes on 64-bit.
include/scsi/scsi_cmnd.h +8 -11
@@ -13,22 +13,21 @@ struct Scsi_Host;struct scsi_device ;struct scsi_data_buffer { +struct scatterlist * sglist;unsigned length;int resid;unsigned short sg_count;unsigned short alloc_sg_count; -struct scatterlist * sglist; };/* embedded in scsi_cmnd */ struct scsi_pointer {char *ptr;/* data pointer */ -int this_residual;/* left in this buffer */ struct scatterlist *buffer;/* which buffer */ +dma_addr_t dma_handle; +int this_residual;/* left in this buffer */ int buffers_residual;/* how many buffers left */ -dma_addr_t dma_handle; -volatile int Status;volatile int Message;volatile int have_data_in;
@@ -40,7 +39,6 @@ struct scsi_cmnd {struct scsi_device *device;struct list_head list;/* scsi_cmnd participates in queue lists */ struct list_head eh_entry;/* entry for the host eh_cmd_q */ -int eh_eflags;/* Used by error handlr */ /* * A SCSI Command is assigned a nonzero serial_number before passed
@@ -64,7 +62,9 @@ struct scsi_cmnd {int timeout_per_command;unsigned char cmd_len; -enum dma_data_direction sc_data_direction; +unsigned char eh_eflags;/* Used by error handler */ +unsigned char sc_data_direction;/* enum dma_data_direction */ +unsigned char tag;/* SCSI-II queued command tag */ /* These elements define the operation we are about to perform */ #define MAX_COMMAND_SIZE 16
@@ -109,10 +109,6 @@ struct scsi_cmnd {* obtained by scsi_malloc is guaranteed * to be at an address < 16Mb). */ -int result;/* Status code from lower level driver */ - -unsigned char tag;/* SCSI-II queued command tag */ -union {struct scsi_data_buffer sdb;/*
@@ -121,11 +117,12 @@ struct scsi_cmnd {* of struct scsi_data_buffer members. */ struct { +void __deprecated *request_buffer;unsigned __deprecated request_bufflen;int __deprecated resid;unsigned short __deprecated use_sg;unsigned short __deprecated place_holder_sg_alloc; -void __deprecated *request_buffer; +int result;/* Status code from lower level driver */ }; }; };
Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Re: [PATCH 27/32] scsi_data_buffer
Quoted 24 lines · Matthew Wilcox
Review
Quoted 10 lines · Boaz Harrosh
- Group all IO members of
scsi_cmndinto ascsi_data_bufferstructure.(quoted diff) +7
-0+struct scsi_data_buffer { + unsigned length; + int resid; + unsigned short sg_count; + unsigned short alloc_sg_count; + struct scatterlist* sglist; +};This has exactly the problems I thought it would have. Due to alignment rules, it grows the
scsi_cmndfrom 368 to 376 bytes on x86-64. It remains at 272 bytes on i386 though, which is some consolation. By porting the patch I had for shrinking thescsi_cmnd, I can get it down to 352 bytes, but not as far as the 344 bytes I had it at before.The problem is the padding at the *end* of
scsi_data_buffer(er, after I rearrange it in the patch below). There's nothing we can realistically put in it, given that we don't want to expand scsi_data_buffer's size on 32-bit machines. I have a fix ... but I don't think you'll like it. I certainly don't. But it does get us back down to 344 bytes.
Quoted 3 lines
Updated patch below. I'm fully expecting the 'result' shenanigan to get it NACKed, but I'd like to see if it inspires anyone else to a more creative way of saving this space.
yeah. The sglist pointer shuffle makes sense and so are the field type changes and coalescing, but the union holding the deprecated fields of scsi_data_buff is going away.
#pragma pack(4) before struct scsi_cmnd
(followed by #pragma pack()) should do the trick
by saving member padding bytes. As a general rule I don't like pragma's but this one works, is easy to understand, and is pretty standard.
Quoted 92 lines
---
Thanks to acme's pahole utility, I found some places where we can save a lot of bytes in
scsi_cmnd, just by rearranging struct elements and reducing the size of some elements. We go from 272 to 260 bytes on x86 and from 368 to 344 bytes on x86-64.-
eh_eflagshad a 4-byte hole after it on 64-bit. In fact, this has value 0 or 1, so reduce it to an unsigned char, and put it with the other chars inscsi_cmnd. Saves 8 bytes on 64-bit.
-sc_data_directionhas a value from 0-3, so make it an unsigned char rather than an enum. Saves at least 4 bytes.
- Putting 'tag' with the other char elements saves another 4 bytes
- Moving 'result' into the union with the deprecated members saves 8 bytes on 64-bit.include/scsi/scsi_cmnd.h +8
-11@@ -13,22 +13,21 @@ struct Scsi_Host;struct scsi_device ;struct scsi_data_buffer { +struct scatterlist * sglist;unsigned length;int resid;unsigned short sg_count;unsigned short alloc_sg_count; -struct scatterlist * sglist; };/* embedded in scsi_cmnd */ struct scsi_pointer {char *ptr;/* data pointer */ -int this_residual;/* left in this buffer */ struct scatterlist *buffer;/* which buffer */ +dma_addr_t dma_handle; +int this_residual;/* left in this buffer */ int buffers_residual;/* how many buffers left */ -dma_addr_t dma_handle; -volatile int Status;volatile int Message;volatile int have_data_in;@@ -40,7 +39,6 @@ struct scsi_cmnd {struct scsi_device *device;struct list_head list;/* scsi_cmnd participates in queue lists */ struct list_head eh_entry;/* entry for the host eh_cmd_q */ -int eh_eflags;/* Used by error handlr */ /* * A SCSI Command is assigned a nonzero serial_number before passed @@ -64,7 +62,9 @@ struct scsi_cmnd {int timeout_per_command;unsigned char cmd_len; -enum dma_data_direction sc_data_direction; +unsigned char eh_eflags;/* Used by error handler */ +unsigned char sc_data_direction;/* enum dma_data_direction */ +unsigned char tag;/* SCSI-II queued command tag */ /* These elements define the operation we are about to perform */ #define MAX_COMMAND_SIZE 16@@ -109,10 +109,6 @@ struct scsi_cmnd {* obtained by scsi_malloc is guaranteed * to be at an address < 16Mb). */ -int result;/* Status code from lower level driver */ - -unsigned char tag;/* SCSI-II queued command tag */ -union {struct scsi_data_buffer sdb;/* @@ -121,11 +117,12 @@ struct scsi_cmnd {* of struct scsi_data_buffer members. */ struct { +void __deprecated *request_buffer;unsigned __deprecated request_bufflen;int __deprecated resid;unsigned short __deprecated use_sg;unsigned short __deprecated place_holder_sg_alloc; -void __deprecated *request_buffer; +int result;/* Status code from lower level driver */ }; }; };
Re: [PATCH 27/32] scsi_data_buffer
Quoted 3 lines · Benny Halevy
yeah. The sglist pointer shuffle makes sense and so are the field type changes and coalescing, but the union holding the deprecated fields of
scsi_data_buffis going away.
Indeed. We could always do ...
union {
struct scsi_data_pointer;
struct {
char _padding_[sizeof(struct scsi_data_pointer)];
int result;
}
}But that might set a new record of depths of obfuscation.
Quoted 4 lines
#pragma pack(4) before struct
scsi_cmnd
(followed by #pragmapack()) should do the trick
by saving member padding bytes. As a general rule I don't like pragma's but this one works, is easy to understand, and is pretty standard.
But it might well have the effect of pessimising accesses to the struct, and accesses to scsi_cmnd are pretty hot. I've seen gcc revert to byte loads and stores to packed structs in the past. Maybe it's got better now.
Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Re: [PATCH 27/32] scsi_data_buffer
Quoted 15 lines · Matthew Wilcox
Quoted 3 lines · Benny Halevy
yeah. The sglist pointer shuffle makes sense and so are the field type changes and coalescing, but the union holding the deprecated fields of
scsi_data_buffis going away.Indeed. We could always do ...
union { struct scsi_data_pointer; struct { char _padding_[sizeof(struct scsi_data_pointer)]; int result; } }
Quoted 1 line
But that might set a new record of depths of obfuscation.
agreed :)
Quoted 11 lines
Quoted 5 lines
#pragma pack(4) before struct
scsi_cmnd
(followed by #pragmapack()) should do the trick
by saving member padding bytes. As a general rule I don't like pragma's but this one works, is easy to understand, and is pretty standard.But it might well have the effect of pessimising accesses to the struct, and accesses to
scsi_cmndare pretty hot. I've seen gcc revert to byte loads and stores to packed structs in the past. Maybe it's got better now.
that's why I suggested pack(4) and not pack(1), assuming 4-byte alignment is still as efficient as 8-byte alignment on most common 64 bit architectures.
Re: [PATCH 27/32] scsi_data_buffer
In reply to Benny HalevyQuoted 6 lines · Benny Halevy
Quoted 4 lines
Updated patch below. I'm fully expecting the 'result' shenanigan to get it NACKed, but I'd like to see if it inspires anyone else to a more creative way of saving this space.
Quoted 11 lines
yeah. The sglist pointer shuffle makes sense and so are the field type changes and coalescing, but the union holding the deprecated fields of
scsi_data_buffis going away.#pragma pack(4) before struct
scsi_cmnd
(followed by #pragmapack()) should do the trick
by saving member padding bytes. As a general rule I don't like pragma's but this one works, is easy to understand, and is pretty standard.Quoted 2 lines
---
Sorry Matthew, my mistake I forgot to send the last [33/33] patch this here should be done on top of that last one.
I will grab your tool and play with it. The sglist pointer shuffle is good, and also I know that if you put the scsi_data_buffer at the beginning of scsi_cmnd, than you can fill the holes with small types following the sub-structure. I'll give it a try.
Boaz
Re: [PATCH 27/32] scsi_data_buffer
Quoted 2 lines · Boaz Harrosh
Sorry Matthew, my mistake I forgot to send the last [33/33] patch this here should be done on top of that last one.
Yeah. I'll rebase the series of 4 patches I just sent on top of it when I wake up in the morning.
Quoted 4 lines
I will grab your tool and play with it. The sglist pointer shuffle is good, and also I know that if you put the
scsi_data_bufferat the beginning ofscsi_cmnd, than you can fill the holes with small types following the sub-structure. I'll give it a try.
No, that doesn't work ;-(
I think a macro to hide the ugliness of my earlier suggestion might fly. Something like ...
#define STRUCT_PACK(a, b, c, d) \
union { a; struct { \
char _packed_ ## __stringify(a) [sizeof(a) - sizeof(c) + sizeof(d)]; \
b; \
}; }then we use it like:
struct scsi_cmnd {
...
STRUCT_PACK(struct scsi_data_buffer sdb, int result,
sizeof(long), sizeof(int));
}Even that's still pretty foul (and i have my grave doubts about using stringify in that manner). It's definitely past my bedtime now ... but a hack like that could save us another 8 bytes on x86-64.
Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Re: [PATCH 27/32] scsi_data_buffer
Quoted 31 lines · Matthew Wilcox
Quoted 2 lines · Boaz Harrosh
Sorry Matthew, my mistake I forgot to send the last [33/33] patch this here should be done on top of that last one.
Yeah. I'll rebase the series of 4 patches I just sent on top of it when I wake up in the morning.
Quoted 4 lines
I will grab your tool and play with it. The sglist pointer shuffle is good, and also I know that if you put the
scsi_data_bufferat the beginning ofscsi_cmnd, than you can fill the holes with small types following the sub-structure. I'll give it a try.No, that doesn't work ;-(
I think a macro to hide the ugliness of my earlier suggestion might fly. Something like ...
#define STRUCT_PACK(a, b, c, d) \ union { a; struct { \ char _packed_ ## __stringify(a) [sizeof(a) - sizeof(c) + sizeof(d)]; \ b; \ }; }then we use it like:
struct scsi_cmnd { ... STRUCT_PACK(struct scsi_data_buffer sdb, int result, sizeof(long), sizeof(int)); }
Quoted 4 lines
Even that's still pretty foul (and i have my grave doubts about using stringify in that manner). It's definitely past my bedtime now ... but a hack like that could save us another 8 bytes on x86-64.
You lost me.
What union, please look at patch [33/33]
Boaz
Alan Stern
maintainerRe: [PATCH 27/32] scsi_data_buffer
In reply to Matthew WilcoxQuoted 24 lines · Matthew Wilcox
Quoted 4 lines
I will grab your tool and play with it. The sglist pointer shuffle is good, and also I know that if you put the
scsi_data_bufferat the beginning ofscsi_cmnd, than you can fill the holes with small types following the sub-structure. I'll give it a try.No, that doesn't work ;-(
I think a macro to hide the ugliness of my earlier suggestion might fly. Something like ...
#define STRUCT_PACK(a, b, c, d) \ union { a; struct { \ char _packed_ ## __stringify(a) [sizeof(a) - sizeof(c) + sizeof(d)]; \ b; \ }; }then we use it like:
struct scsi_cmnd { ... STRUCT_PACK(struct scsi_data_buffer sdb, int result, sizeof(long), sizeof(int)); }
Quoted 3 lines
Even that's still pretty foul (and i have my grave doubts about using stringify in that manner). It's definitely past my bedtime now ... but a hack like that could save us another 8 bytes on x86-64.
This may seem heretical, but I doubt there's much point to saving a few bytes if it's going to incur this much work and confusion. Rearranging the order of structure members is fine, it's easy, it won't bother anybody. But this sort of thing is just beyond the bounds of reason.
Alan Stern
Re: [PATCH 27/32] scsi_data_buffer
Quoted 8 lines · Alan Stern
Quoted 3 lines
Even that's still pretty foul (and i have my grave doubts about using stringify in that manner). It's definitely past my bedtime now ... but a hack like that could save us another 8 bytes on x86-64.
This may seem heretical, but I doubt there's much point to saving a few bytes if it's going to incur this much work and confusion. Rearranging the order of structure members is fine, it's easy, it won't bother anybody. But this sort of thing is just beyond the bounds of reason.
That's a valid point of view. But we're just 24 bytes shy of going down from 6 cachelines to 5. I don't have performance numbers yet, but the memory savings are significant; we switch from 10 cmds per 4k slab page to 12 cmds per 4k slab page. By the way, after my patch 4/4 getting rid of transfersize, we're down to 256 bytes on i386. That's 16 cmds per 4k slab page, so we alloc 25% fewer pages to scsi_cmnds. That's a *huge* win.
Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
PATCH 28/32 scsi_data_buffer - scsi_error.c
In reply to Boaz Harrosh - Changed needed members of struct scsi_eh_save.
- Careful considerations in scsi_eh_prep/restore_cmnd.
--- drivers/scsi/scsi_error.c | 28 ++++++++++------------------ include/scsi/scsi_eh.h | 6 +----- 2 files changed, 11 insertions(+), 23 deletions(-)
drivers/scsi/scsi_error.c +10 -18
@@ -618,29 +618,25 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, ses->cmd_len = scmd->cmd_len;memcpy (ses->cmnd, scmd->cmnd,sizeof (scmd->cmnd)); ses->data_direction = scmd->sc_data_direction; - ses->bufflen = scmd->request_bufflen; - ses->buffer = scmd->request_buffer; - ses->use_sg = scmd->use_sg; - ses->resid = scmd->resid; + ses->sdb = scmd->sdb; ses->result = scmd->result; +memset (&scmd->sdb,0 ,sizeof (scmd->sdb)); +if (sense_bytes) { - scmd->request_bufflen =min_t (unsigned, + scmd->sdb.length =min_t (unsigned,sizeof (scmd->sense_buffer), sense_bytes);sg_init_one (&ses->sense_sgl, scmd->sense_buffer, - scmd->request_bufflen); - scmd->request_buffer = &ses->sense_sgl; + scmd->sdb.length); + scmd->sdb.sglist = &ses->sense_sgl; scmd->sc_data_direction =DMA_FROM_DEVICE ; - scmd->use_sg =1 ; + scmd->sdb.sg_count =1 ;memset (scmd->cmnd,0 ,sizeof (scmd->cmnd)); scmd->cmnd[0 ] =REQUEST_SENSE ; - scmd->cmnd[4 ] = scmd->request_bufflen; + scmd->cmnd[4 ] = scmd->sdb.length; scmd->cmd_len =COMMAND_SIZE (scmd->cmnd[0 ]); }else { - scmd->request_buffer =NULL ; - scmd->request_bufflen =0 ; scmd->sc_data_direction =DMA_NONE ; - scmd->use_sg =0 ;if (cmnd) {memset (scmd->cmnd,0 ,sizeof (scmd->cmnd));memcpy (scmd->cmnd, cmnd, cmnd_size);
@@ -677,10 +673,7 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses) scmd->cmd_len = ses->cmd_len;memcpy (scmd->cmnd, ses->cmnd,sizeof (scmd->cmnd)); scmd->sc_data_direction = ses->data_direction; - scmd->request_bufflen = ses->bufflen; - scmd->request_buffer = ses->buffer; - scmd->use_sg = ses->use_sg; - scmd->resid = ses->resid; + scmd->sdb = ses->sdb; scmd->result = ses->result; }EXPORT_SYMBOL (scsi_eh_restore_cmnd);
@@ -1700,8 +1693,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag)memset (&scmd->cmnd,'\0' ,sizeof (scmd->cmnd)); scmd->scsi_done = scsi_reset_provider_done_command; - scmd->request_buffer =NULL ; - scmd->request_bufflen =0 ; +memset (&scmd->sdb,0 ,sizeof (scmd->sdb)); scmd->cmd_len =0 ;
include/scsi/scsi_eh.h +1 -5
@@ -71,11 +71,7 @@ struct scsi_eh_save {unsigned char cmd_len;unsigned char cmnd[MAX_COMMAND_SIZE ]; -void *buffer; -unsigned bufflen; -unsigned short use_sg; -int resid; - +struct scsi_data_buffer sdb;struct scatterlist sense_sgl; };
Signature · 1 line
1.5.3.1
PATCH 29/32 scsi_data_buffer - sd.c and sr.c
In reply to Boaz Harrosh - sd and sr would adjust IO size to align on device's block size so code needs to change once we move to scsi_data_buff implementation.
- Convert code to use scsi_for_each_sg
- Use data accessors where appropriate.
- Remove dead code (req_data_dir() != READ && != WRITE)
--- drivers/scsi/sd.c | 7 ++----- drivers/scsi/sr.c | 28 +++++++++++++--------------- 2 files changed, 15 insertions(+), 20 deletions(-)
drivers/scsi/sd.c +2 -5
@@ -448,9 +448,6 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) }else if (rq_data_dir (rq) ==READ ) { SCpnt->cmnd[0 ] =READ_6 ; SCpnt->sc_data_direction =DMA_FROM_DEVICE ; - }else { -scmd_printk (KERN_ERR , SCpnt,"Unknown command %x\n" , rq->cmd_flags); - goto out; } SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
@@ -510,7 +507,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) SCpnt->cmnd[4 ] = (unsigned char ) this_count; SCpnt->cmnd[5 ] =0 ; } - SCpnt->request_bufflen = this_count * sdp->sector_size; + SCpnt->sdb.length = this_count * sdp->sector_size;/* * We shouldn't disconnect in the middle of a sector, so with a dumb
@@ -904,7 +901,7 @@ static struct block_device_operations sd_fops = {static int sd_done (struct scsi_cmnd *SCpnt) {int result = SCpnt->result; -unsigned int xfer_size = SCpnt->request_bufflen; +unsigned int xfer_size =scsi_bufflen (SCpnt);unsigned int good_bytes = result ?0 : xfer_size;u64 start_lba = SCpnt->request->sector;u64 bad_lba;
drivers/scsi/sr.c +13 -15
@@ -218,7 +218,7 @@ static int sr_media_change(struct cdrom_device_info *cdi, int slot)static int sr_done (struct scsi_cmnd *SCpnt) {int result = SCpnt->result; -int this_count = SCpnt->request_bufflen; +int this_count =scsi_bufflen (SCpnt);int good_bytes = (result ==0 ? this_count :0 );int block_sectors =0 ;long error_sector;
@@ -360,23 +360,21 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq) }else if (rq_data_dir (rq) ==READ ) { SCpnt->cmnd[0 ] =READ_10 ; SCpnt->sc_data_direction =DMA_FROM_DEVICE ; - }else { -blk_dump_rq_flags (rq,"Unknown sr command" ); - goto out; } { -struct scatterlist *sg = SCpnt->request_buffer; -int i, size =0 ; -for (i =0 ; i < SCpnt->use_sg; i++) - size += sg[i].length; +struct scatterlist *sg; +int i, size =0 , sg_count =scsi_sg_count (SCpnt); + +scsi_for_each_sg (SCpnt, sg, sg_count, i) + size += sg->length; -if (size != SCpnt->request_bufflen && SCpnt->use_sg) { +if (size !=scsi_bufflen (SCpnt)) {scmd_printk (KERN_ERR , SCpnt,"mismatch count %d, bytes %d\n" , - size, SCpnt->request_bufflen); -if (SCpnt->request_bufflen > size) - SCpnt->request_bufflen = size; + size,scsi_bufflen (SCpnt)); +if (scsi_bufflen (SCpnt) > size) + SCpnt->sdb.length = size; } }
@@ -384,12 +382,12 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq)* request doesn't start on hw block boundary, add scatter pads */ if (((unsigned int )rq->sector % (s_size >>9 )) || - (SCpnt->request_bufflen % s_size)) { + (scsi_bufflen (SCpnt) % s_size)) {scmd_printk (KERN_NOTICE , SCpnt,"unaligned transfer\n" ); goto out; } - this_count = (SCpnt->request_bufflen >>9 ) / (s_size >>9 ); + this_count = (scsi_bufflen (SCpnt) >>9 ) / (s_size >>9 ); SCSI_LOG_HLQUEUE(2, printk("%s : %s %d/%ld 512 byte blocks.\n",
@@ -403,7 +401,7 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq)if (this_count >0xffff ) { this_count =0xffff ; - SCpnt->request_bufflen = this_count * s_size; + SCpnt->sdb.length = this_count * s_size; } SCpnt->cmnd[2 ] = (unsigned char ) (block >>24 ) &0xff ;
Signature · 1 line
1.5.3.1
PATCH 30/32 tgt: convert to use scsi_data_buffer
In reply to Boaz HarroshFrom: FUJITA Tomonori <[email protected]>
--- drivers/scsi/scsi_tgt_if.c | 2 +- drivers/scsi/scsi_tgt_lib.c | 43 ++++++++++++------------------------------- 2 files changed, 13 insertions(+), 32 deletions(-)
drivers/scsi/scsi_tgt_if.c +1 -1
@@ -112,7 +112,7 @@ int scsi_tgt_uspace_send_cmd(struct scsi_cmnd *cmd, u64 itn_id,memset (&ev,0 ,sizeof (ev)); ev.p.cmd_req.host_no = shost->host_no; ev.p.cmd_req.itn_id = itn_id; - ev.p.cmd_req.data_len = cmd->request_bufflen; + ev.p.cmd_req.data_len =scsi_bufflen (cmd);memcpy (ev.p.cmd_req.scb, cmd->cmnd,sizeof (ev.p.cmd_req.scb));memcpy (ev.p.cmd_req.lun, lun,sizeof (ev.p.cmd_req.lun)); ev.p.cmd_req.attribute = cmd->tag;
drivers/scsi/scsi_tgt_lib.c +12 -31
75 lines not on this page · raw message
Signature · 1 line
1.5.3.1
PATCH 31/32 tgt: convert ibmvstgt and libsrp to use scsi_data_buffer
In reply to Boaz HarroshFrom: FUJITA Tomonori <[email protected]>
--- drivers/scsi/ibmvscsi/ibmvstgt.c | 2 +- drivers/scsi/libsrp.c | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-)
drivers/scsi/ibmvscsi/ibmvstgt.c +1 -1
@@ -292,7 +292,7 @@ static int ibmvstgt_cmd_done(struct scsi_cmnd *sc,dprintk ("%p %p %x %u\n" , iue, target,vio_iu (iue)->srp.cmd.cdb[0 ], cmd->usg_sg); -if (sc->use_sg) +if (scsi_sg_count (sc)) err =srp_transfer_data (sc, &vio_iu (iue)->srp.cmd, ibmvstgt_rdma,1 ,1 );spin_lock_irqsave (&target->lock, flags);
drivers/scsi/libsrp.c +14 -13
@@ -192,18 +192,18 @@ static int srp_direct_data(struct scsi_cmnd *sc, struct srp_direct_buf *md,if (dma_map) { iue = (struct iu_entry *) sc->SCp.ptr; - sg = sc->request_buffer; + sg =scsi_sglist (sc); -dprintk ("%p %u %u %d\n" , iue, sc->request_bufflen, - md->len, sc->use_sg); +dprintk ("%p %u %u %d\n" , iue,scsi_bufflen (sc), + md->len,scsi_sg_count (sc)); - nsg =dma_map_sg (iue->target->dev, sg, sc->use_sg, + nsg =dma_map_sg (iue->target->dev, sg,scsi_sg_count (sc),DMA_BIDIRECTIONAL );if (!nsg) { -printk ("fail to map %p %d\n" , iue, sc->use_sg); +printk ("fail to map %p %d\n" , iue,scsi_sg_count (sc));return 0 ; } - len =min (sc->request_bufflen, md->len); + len =min (scsi_bufflen (sc), md->len); }else len = md->len;
@@ -229,10 +229,10 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd,if (dma_map || ext_desc) { iue = (struct iu_entry *) sc->SCp.ptr; - sg = sc->request_buffer; + sg =scsi_sglist (sc);dprintk ("%p %u %u %d %d\n" , - iue, sc->request_bufflen, id->len, + iue,scsi_bufflen (sc), id->len, cmd->data_in_desc_cnt, cmd->data_out_desc_cnt); }
@@ -268,13 +268,14 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd, rdma:if (dma_map) { - nsg =dma_map_sg (iue->target->dev, sg, sc->use_sg,DMA_BIDIRECTIONAL ); + nsg =dma_map_sg (iue->target->dev, sg,scsi_sg_count (sc), +DMA_BIDIRECTIONAL );if (!nsg) { -eprintk ("fail to map %p %d\n" , iue, sc->use_sg); +eprintk ("fail to map %p %d\n" , iue,scsi_sg_count (sc)); err = -EIO ; goto free_mem; } - len =min (sc->request_bufflen, id->len); + len =min (scsi_bufflen (sc), id->len); }else len = id->len;
@@ -425,8 +426,8 @@ int srp_cmd_queue(struct Scsi_Host *shost, struct srp_cmd *cmd, void *info, sc->SCp.ptr = info;memcpy (sc->cmnd, cmd->cdb,MAX_COMMAND_SIZE ); - sc->request_bufflen = len; - sc->request_buffer = (void *) (unsigned long ) addr; + sc->sdb.length = len; + sc->sdb.sglist = (void *) (unsigned long ) addr; sc->tag = tag; err =scsi_tgt_queue_command (sc, itn_id, (struct scsi_lun *)&cmd->lun, cmd->tag);
Signature · 1 line
1.5.3.1
PATCH 32/32 isd200.c - use of scsi_data_buffer
In reply to Boaz Harrosh - This driver still bags on scsi_cmnd IO members, so need changing
--- drivers/usb/storage/isd200.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/usb/storage/isd200.c +4 -4
@@ -415,14 +415,14 @@ static void isd200_set_srb(struct isd200_info *info,sg_init_one (&info->sg, buff, bufflen); srb->sc_data_direction = dir; - srb->request_buffer = buff ? &info->sg :NULL ; - srb->request_bufflen = bufflen; - srb->use_sg = buff ?1 :0 ; + srb->sdb.sglist = buff ? &info->sg :NULL ; + srb->sdb.length = bufflen; + srb->sdb.sg_count = buff ?1 :0 ; }static void isd200_srb_set_bufflen (struct scsi_cmnd *srb,unsigned bufflen) { - srb->request_bufflen = bufflen; + srb->sdb.length = bufflen; }
Signature · 1 line
1.5.3.1
Quoted 38 lines · On Wed, 17 Oct 2007 19:14:46 +0200 Boaz Harrosh <[email protected]> wrote:
This is a resend of all the remaining drivers rebased to latest code. And once the entire tree is converted, move to
scsi_data_bufferinscsi_cmnd.The work is on top of Jens's for-linus branch which is effectively sglist-arch (+ last minute fixes) This is because sglist-arch was already rebased to latest scsi-misc through linus tree, merged with the extra work done there on scsi-ml (and the drivers) (Thanks Jens)
summery of patches:
left over from
scsi_ehlast change
[PATCH 01/32] arm: fas216 Usescsi_ehAPI forREQUEST_SENSEinvocationlots and lots of drivers left:
[PATCH 02/32]isd200.c: use one-element sg list in issuing commands [PATCH 03/32] usb: transport - convert to accessors and !use_sg code path removal [PATCH 04/32] usb:protocol.c- convert to accessors and !use_sg code path removal [PATCH 05/32] usb:shuttle_usbat.c- convert to accessors and !use_sg code path removal [PATCH 06/32] usb:freecom.c&sddr09.c- convert to accessors and !use_sg cleanup [PATCH 07/32] NCR5380 familly convert to accessors & !use_sg cleanup [PATCH 08/32] arm: scsi convert to accessors and !use_sg cleanup
[PATCH 09/32]nsp_cs.cconvert to data accessors and !use_sg cleanup [PATCH 10/32]eata_pio.c: convert to accessors and !use_sg cleanup
[PATCH 11/32]a2091.c: convert to accessors and !use_sg cleanup
[PATCH 12/32]a3000.c: convert to accessors and !use_sg cleanup
[PATCH 13/32]aha1542.c: convert to accessors and !use_sg cleanup
[PATCH 14/32]atp870u.c: convert to accessors and !use_sg cleanup
[PATCH 15/32]fd_mcs.c: convert to accessors and !use_sg cleanup
[PATCH 16/32]imm.c: convert to accessors and !use_sg cleanup
[PATCH 17/32]ppa.c: convert to accessors and !use_sg cleanup
[PATCH 18/32]wd32c93.c: convert to accessors and !use_sg cleanup
[PATCH 19/32]qlogicpti.c: convert to accessors and !use_sg cleanup [PATCH 20/32]in2000.c: convert to accessors and !use_sg cleanup
[PATCH 21/32]scsi_debug: convert to use the data buffer accessors
Quoted 6 lines
Tomo's patch cleaned up:
[PATCH 22/32] qla1280: convert to use the data buffer accessors [PATCH 23/32] qla1280: Indentation fixI separated the indentation from the real change make the patch humanly readable.
It doesn't hurt but I'm not sure how useful the separation is.
PATCH 33/33 Remove Compatibility mode hack from scsi_cmnd
In reply to Boaz Harrosh - So we can separate the move to scsi_data_buffer into several patches, we have introduced a compatibility hack in the very first patch, that let the patchset be completely bisectable. Now that the entire tree is converted We can finally remove OLD I/O members from scsi_cmnd.
--- include/scsi/scsi_cmnd.h | 16 +--------------- 1 files changed, 1 insertions(+), 15 deletions(-)
include/scsi/scsi_cmnd.h +1 -15
@@ -113,21 +113,7 @@ struct scsi_cmnd {unsigned char tag;/* SCSI-II queued command tag */ -union { -struct scsi_data_buffer sdb; -/* -* FIXME: Here for compatibility with unconverted drivers. -* Must be kept in sync with exact type and order -* of struct scsi_data_buffer members. -*/ -struct { -unsigned __deprecated request_bufflen; -int __deprecated resid; -unsigned short __deprecated use_sg; -unsigned short __deprecated place_holder_sg_alloc; -void __deprecated *request_buffer; - }; - }; +struct scsi_data_buffer sdb; };extern struct scsi_cmnd *scsi_get_command (struct scsi_device *,gfp_t );
Signature · 1 line
1.5.3.1