Skip to contentSkip to conversation

Drivers accessors latest version

PATCH In review Boaz Harrosh 2 participants 7 messages Oct 30, 2007 – Nov 5, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi

lots of drivers changed yet again do to latest SG API fixes. There is no use me sending all of them again. They are available on a public git tree.

you can pull them from:
git-pull git://bhalevy.com/open-osd accessors

They are based on todays scsi-misc tree. If you want that I preform any changes before you pull please just ask.

shortlog below

b6f2026... isd200.c: use one-element sg list in issuing commands 6b3727d... usb: transport - convert to accessors and !use_sg code path removal 3439a91... usb: protocol.c - convert to accessors and !use_sg code path removal 8739148... usb: shuttle_usbat.c - convert to accessors and !use_sg code path removal a5207db... usb: freecom.c & sddr09.c - convert to accessors and !use_sg cleanup 1390243... NCR5380 familly convert to accessors & !use_sg cleanup cdd77de... arm: scsi convert to accessors and !use_sg cleanup 9bc7373... nsp_cs.c convert to data accessors and !use_sg cleanup b82e0e9... eata_pio.c: convert to accessors and !use_sg cleanup 2761373... a2091.c: convert to accessors and !use_sg cleanup 7f8e3b0... a3000.c: convert to accessors and !use_sg cleanup 36f4896... aha1542.c: convert to accessors and !use_sg cleanup 707fe55... atp870u.c: convert to accessors and !use_sg cleanup 2fb56c0... fd_mcs.c: convert to accessors and !use_sg cleanup 80736b1... imm.c: convert to accessors and !use_sg cleanup
25a55f7... ppa.c: convert to accessors and !use_sg cleanup
f9fb2ad... wd33c93.c: convert to accessors and !use_sg cleanup ac0b49c... qlogicpti.c: convert to accessors and !use_sg cleanup 2f5cb3d... in2000.c: convert to accessors and !use_sg cleanup cb23b86... scsi_debug: convert to use the data buffer accessors f7e0b4d... wd7000.c - proper fix for boards without sg support 9cd3d65... Remove psi240i driver from kernel
4dcf751... Remove of seagate.c driver

there is also a scsi_data_buffer branch on the same tree. The last version I sent had a stupid but fatal bug which is now fixed.

Thanks
Boaz

#1 lore raw
Quoted 6 lines · Boaz Harrosh

Hi

lots of drivers changed yet again do to latest SG API fixes. There is no use me sending all of them again. They are available on a public git tree.

Quoted 6 lines

you can pull them from:
git-pull git://bhalevy.com/open-osd accessors

They are based on todays scsi-misc tree. If you want that I preform any changes before you pull please just ask.

There is also gitweb at:
http://www.bhalevy.com/git

Boaz

maintainer
#2 lore raw
In reply to Boaz Harrosh
Quoted 6 lines · Boaz Harrosh

Hi

lots of drivers changed yet again do to latest SG API fixes. There is no use me sending all of them again. They are available on a public git tree.

Quoted 7 lines

you can pull them from:
git-pull git://bhalevy.com/open-osd accessors

They are based on todays scsi-misc tree. If you want that I preform any changes before you pull please just ask.

shortlog below

I'm going through these now ... I'll cherry pick most into the relevant trees.

Quoted 6 lines

b6f2026... isd200.c: use one-element sg list in issuing commands 6b3727d... usb: transport - convert to accessors and !use_sg code path removal 3439a91... usb: protocol.c - convert to accessors and !use_sg code path removal 8739148... usb: shuttle_usbat.c - convert to accessors and !use_sg code path removal a5207db... usb: freecom.c & sddr09.c - convert to accessors and !use_sg cleanup 1390243... NCR5380 familly convert to accessors & !use_sg cleanup

This one has a clear merge bug:

index 2597209..bc63349 100644

drivers/scsi/NCR5380.c +8 -0
@@ -295,16 +295,24 @@ static __inline__ void initialize_SCp(Scsi_Cmnd * cmd)
         * various queues are valid.
         */
 
+<<<<<<< HEAD:drivers/scsi/NCR5380.c
        if (cmd->use_sg) {
                cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer;
                cmd->SCp.buffers_residual = cmd->use_sg - 1;
                cmd->SCp.ptr = sg_virt(cmd->SCp.buffer);
+=======
+       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;
+>>>>>>> d9ab658... NCR5380 familly convert to accessors & !use_sg cleanup:drive
 

So could you fix it up correctly, please (and just email the patch, I think it's the only problem commit).

Thanks,

James

#3 lore raw
Quoted 10 lines · James Bottomley

This one has a clear merge bug:

index 2597209..bc63349 100644

drivers/scsi/NCR5380.c +0 -0
<snip>

So could you fix it up correctly, please (and just email the patch, I think it's the only problem commit).

Quoted 4 lines

Thanks,

James

Sorry about that. I saw it and fixed it in git tree, (rebase), anticipating a branch pull. But since you had to cherry-pick them by number you fetched the older patches. There is also a fix needed for wd7000.c, the one you have will not compile.

I will send both patches as reply to this mail.

Again sorry
Boaz

#4 lore raw

PATCH 1/1 wd7000.c - proper fix for boards without sg support

- 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
index 03cd44f..b4304ae 100644
@@ -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)) + 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
#6 lore raw

PATCH 1/1 NCR5380 familly convert to accessors & !use_sg cleanup

In reply to Boaz Harrosh

- This patch depends on:
NCR5380: Use scsi_eh API for REQUEST_SENSE invocation
- 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
index 2597209..1e9f828 100644
@@ -295,16 +295,16 @@ 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 = sg_virt(cmd->SCp.buffer);
 		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;
 	}
 }
 
@@ -975,14 +975,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
index a9680b5..d2ca3fa 100644
@@ -511,9 +511,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 = sg_virt(cmd->SCp.buffer);
 		cmd->SCp.this_residual = cmd->SCp.buffer->length;
 		/* ++roman: Try to merge some scatter-buffers if they are at
@@ -523,8 +523,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;
 	}
 }
 
@@ -936,21 +936,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;
 		}
@@ -1352,21 +1352,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
index 2dcde37..264f14a 100644
@@ -515,9 +515,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;
 
@@ -528,8 +528,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;
     }
     
 }
@@ -935,7 +935,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])
 	{
@@ -943,14 +943,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;
 	}
@@ -1345,7 +1345,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])
 	{
@@ -1353,14 +1353,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
#5 lore raw

Re: [PATCH] wd7000.c - proper fix for boards without sg support

In reply to Boaz Harrosh

drivers/scsi/wd7000.c static int wd7000_queuecommand(struct scsi_cmnd *SCpnt,

Quoted 15 lines · 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 +0 -0
index 03cd44f..b4304ae 100644
@@ -1108,13 +1108,10 @@ static int wd7000_queuecommand(struct scsi_cmnd *SCpnt,

<snip>

I see it is already applied so you might want to use this one instead

---

Quoted 1 line

From f7df6bc1477777256b015636a2ba8b1c8677bc4e Mon Sep 17 00:00:00 2001

From: Boaz Harrosh <[email protected]>
Date: Mon, 5 Nov 2007 18:31:51 +0200
Subject: [PATCH] wd7000.c sg breakage do to last commit

Last merge of this driver reverted an SG fix.

---
 drivers/scsi/wd7000.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/scsi/wd7000.c +2 -1
index 4ae2e5c..77f5847 100644
@@ -1127,7 +1127,8 @@ static int wd7000_queuecommand(struct scsi_cmnd *SCpnt,
 		scb->op = 0;
 		if (nseg) {
 			struct scatterlist *sg = scsi_sglist(SCpnt);
-			any2scsi(scb->dataptr, isa_page_to_bus(sg->page) + sg->offset);
+			any2scsi(scb->dataptr,
+			         isa_page_to_bus(sg_page(sg)) + sg->offset);
 		}
 		any2scsi(scb->maxlen, scsi_bufflen(SCpnt));
 	}
Signature · 1 line
1.5.3.1