public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* Making sym-2 do 160 MB/sec
@ 2003-02-19 20:06 Andrew Morton
  2003-02-19 23:12 ` Mike Anderson
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andrew Morton @ 2003-02-19 20:06 UTC (permalink / raw)
  To: linux-scsi


I have a machine here in which both the controller (53c1010) and the disk
(IBM IC35L036UCD210-0) can do FAST-80, but the sym2 driver only does FAST-40.

The below patch fixes it up, and has been fearsomely tested.

Can anyone tell me whether it is right, and what is generally going on in
there?


diff -puN drivers/scsi/sym53c8xx_2/sym_hipd.c~sym-do-160 drivers/scsi/sym53c8xx_2/sym_hipd.c
--- 25-power4/drivers/scsi/sym53c8xx_2/sym_hipd.c~sym-do-160	2003-02-19 01:04:59.000000000 -0800
+++ 25-power4-akpm/drivers/scsi/sym53c8xx_2/sym_hipd.c	2003-02-19 01:05:13.000000000 -0800
@@ -800,7 +800,8 @@ static int sym_prepare_setting(hcb_p np,
 	 * Btw, 'period' is in tenths of nanoseconds.
 	 */
 	period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz;
-	if	(period <= 250)		np->minsync = 10;
+	if	(period == 250)		np->minsync = 9;
+	else if	(period <= 250)		np->minsync = 10;
 	else if	(period <= 303)		np->minsync = 11;
 	else if	(period <= 500)		np->minsync = 12;
 	else				np->minsync = (period + 40 - 1) / 40;

_
  

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Making sym-2 do 160 MB/sec
  2003-02-19 20:06 Making sym-2 do 160 MB/sec Andrew Morton
@ 2003-02-19 23:12 ` Mike Anderson
  2003-02-19 23:22   ` Andrew Morton
  2003-02-20  7:43 ` Douglas Gilbert
  2003-03-02  9:35 ` Gérard Roudier
  2 siblings, 1 reply; 5+ messages in thread
From: Mike Anderson @ 2003-02-19 23:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-scsi

Andrew Morton [akpm@digeo.com] wrote:
> 
> I have a machine here in which both the controller (53c1010) and the disk
> (IBM IC35L036UCD210-0) can do FAST-80, but the sym2 driver only does FAST-40.
> 
> The below patch fixes it up, and has been fearsomely tested.
> 
> Can anyone tell me whether it is right, and what is generally going on in
> there?
> 
> 
> diff -puN drivers/scsi/sym53c8xx_2/sym_hipd.c~sym-do-160 drivers/scsi/sym53c8xx_2/sym_hipd.c
> --- 25-power4/drivers/scsi/sym53c8xx_2/sym_hipd.c~sym-do-160	2003-02-19 01:04:59.000000000 -0800
> +++ 25-power4-akpm/drivers/scsi/sym53c8xx_2/sym_hipd.c	2003-02-19 01:05:13.000000000 -0800
> @@ -800,7 +800,8 @@ static int sym_prepare_setting(hcb_p np,
>  	 * Btw, 'period' is in tenths of nanoseconds.
>  	 */
>  	period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz;
> -	if	(period <= 250)		np->minsync = 10;
> +	if	(period == 250)		np->minsync = 9;
> +	else if	(period <= 250)		np->minsync = 10;
>  	else if	(period <= 303)		np->minsync = 11;
>  	else if	(period <= 500)		np->minsync = 12;
>  	else				np->minsync = (period + 40 - 1) / 40;
> 

I do not have one of these cards (and my docs are for older 53C chips)
so I may be mis-reading something, but if the values are to match the
spec I would have thought 9 would be for Fast-80.

The SPI spec I have indicates that the transfer period factors should
be:
	FAST-160	Period: 6.25 ns	Value: 8
	FAST-80		Period: 12.5 ns	Value: 9
	FAST-40		Period: 25 ns	Value: 10
	FAST-40		Period: 30.3 ns	Value: 11
	FAST-20		Period: 50 ns	Value: 12


-andmike
--
Michael Anderson
andmike@us.ibm.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Making sym-2 do 160 MB/sec
  2003-02-19 23:12 ` Mike Anderson
@ 2003-02-19 23:22   ` Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2003-02-19 23:22 UTC (permalink / raw)
  To: Mike Anderson; +Cc: linux-scsi

Mike Anderson <andmike@us.ibm.com> wrote:
>
> >  	 * Btw, 'period' is in tenths of nanoseconds.
> >  	 */
> >  	period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz;
> > -	if	(period <= 250)		np->minsync = 10;
> > +	if	(period == 250)		np->minsync = 9;
> > +	else if	(period <= 250)		np->minsync = 10;
> >  	else if	(period <= 303)		np->minsync = 11;
> >  	else if	(period <= 500)		np->minsync = 12;
> >  	else				np->minsync = (period + 40 - 1) / 40;
> > 

On reflection, the above code is fairly weird.  But it works..

> I do not have one of these cards (and my docs are for older 53C chips)
> so I may be mis-reading something, but if the values are to match the
> spec I would have thought 9 would be for Fast-80.
> 
> The SPI spec I have indicates that the transfer period factors should
> be:
> 	FAST-160	Period: 6.25 ns	Value: 8
> 	FAST-80		Period: 12.5 ns	Value: 9
> 	FAST-40		Period: 25 ns	Value: 10
> 	FAST-40		Period: 30.3 ns	Value: 11
> 	FAST-20		Period: 50 ns	Value: 12

Yes, certainly the `9' is the magic which yields FAST-80.

But the thing is, at that point in the driver, `period' is 250.  I wonder
where that algorithm to go from `period' to `np->minsync' came from.

Judging by the comment "Btw, 'period' is in tenths of nanoseconds.", I need
to go further into the driver and work out why it has decided that the period
is 25 nSec.

But note that the current code is:

	if	(period <= 250)		np->minsync = 10;
	else if	(period <= 303)		np->minsync = 11;
	else if	(period <= 500)		np->minsync = 12;
	else				np->minsync = (period + 40 - 1) / 40;

So even if `period' was one nanosecond, we'll still be stuck at FAST-40.

So perhaps something has gone wrong here:

	if	(np->features & (FE_ULTRA3 | FE_ULTRA2))
		np->clock_khz = 160000;
	else if	(np->features & FE_ULTRA)
		np->clock_khz = 80000;
	else
		np->clock_khz = 40000;

and we need to add a "if (period <= 125)" clause there.

I'll poke at it some more, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Making sym-2 do 160 MB/sec
  2003-02-19 20:06 Making sym-2 do 160 MB/sec Andrew Morton
  2003-02-19 23:12 ` Mike Anderson
@ 2003-02-20  7:43 ` Douglas Gilbert
  2003-03-02  9:35 ` Gérard Roudier
  2 siblings, 0 replies; 5+ messages in thread
From: Douglas Gilbert @ 2003-02-20  7:43 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-scsi

Andrew Morton wrote:
> I have a machine here in which both the controller (53c1010) and the disk
> (IBM IC35L036UCD210-0) can do FAST-80, but the sym2 driver only does FAST-40.
> 
> The below patch fixes it up, and has been fearsomely tested.
> 
> Can anyone tell me whether it is right, and what is generally going on in
> there?
> 
> 
> diff -puN drivers/scsi/sym53c8xx_2/sym_hipd.c~sym-do-160 drivers/scsi/sym53c8xx_2/sym_hipd.c
> --- 25-power4/drivers/scsi/sym53c8xx_2/sym_hipd.c~sym-do-160	2003-02-19 01:04:59.000000000 -0800
> +++ 25-power4-akpm/drivers/scsi/sym53c8xx_2/sym_hipd.c	2003-02-19 01:05:13.000000000 -0800
> @@ -800,7 +800,8 @@ static int sym_prepare_setting(hcb_p np,
>  	 * Btw, 'period' is in tenths of nanoseconds.
>  	 */
>  	period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz;
> -	if	(period <= 250)		np->minsync = 10;
> +	if	(period == 250)		np->minsync = 9;
> +	else if	(period <= 250)		np->minsync = 10;
>  	else if	(period <= 303)		np->minsync = 11;
>  	else if	(period <= 500)		np->minsync = 12;
>  	else				np->minsync = (period + 40 - 1) / 40;

Andrew,
My Tekram 390U3W card attains "FAST-80" with a Fujitsu
MAM3184MP disk. This is with the sym53c8xx_2 driver in
2.5.62 . I haven't noticed any speed problems with earlier
versions of the 2.5 series. lspci reports:

00:0c.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1010
      Ultra3 SCSI Adapter (rev 01)
00:0c.1 SCSI storage controller: LSI Logic / Symbios Logic 53c1010
      Ultra3 SCSI Adapter (rev 01)

Here is some data from the sym53c8xx_2 driver:

$ cat /proc/scsi/sym53c8xx/0
Chip sym53c1010-33, device id 0x20, revision id 0x1
On PCI bus 0, device 12, function 0, IRQ 11
Min. period factor 9, Wide SCSI BUS, DT capable
Max. started commands 510, max. commands per LUN 64

... and here is the relevant boot-up messages from
my /var/log/messages :

sym.0.12.1: setting PCI_COMMAND_PARITY...
sym0: <1010-33> rev 0x1 on pci bus 0 device 12 function 0 irq 11
sym0: using 64 bit DMA addressing
sym0: Symbios NVRAM, ID 7, Fast-80, LVD, parity checking
sym0: open drain IRQ line driver, using on-chip SRAM
sym0: using LOAD/STORE-based firmware.
sym0: handling phase mismatch from SCRIPTS.
sym0: SCSI BUS has been reset.
sym1: <1010-33> rev 0x1 on pci bus 0 device 12 function 1 irq 11
sym1: using 64 bit DMA addressing
sym1: Symbios NVRAM, ID 7, Fast-80, SE, parity checking
sym1: open drain IRQ line driver, using on-chip SRAM
sym1: using LOAD/STORE-based firmware.
sym1: handling phase mismatch from SCRIPTS.
sym1: SCSI BUS has been reset.
scsi0 : sym-2.1.16a
   Vendor: FUJITSU   Model: MAM3184MP         Rev: 0105
   Type:   Direct-Access                      ANSI SCSI revision: 03
sym0:1:0: tagged command queuing enabled, command queue depth 16.
sym0:1: FAST-80 WIDE SCSI 160.0 MB/s DT (12.5 ns, offset 62)
scsi1 : sym-2.1.16a
SCSI device sda: 35885344 512-byte hdwr sectors (18373 MB)
SCSI device sda: drive cache: write back
  sda: sda1 sda2 sda3 sda4 < sda5 >
Attached scsi disk sda at scsi0, channel 0, id 1, lun 0

Here is a snippet from my .config file:

CONFIG_SCSI_SYM53C8XX_2=y
CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set


Doug Gilbert






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Making sym-2 do 160 MB/sec
  2003-02-19 20:06 Making sym-2 do 160 MB/sec Andrew Morton
  2003-02-19 23:12 ` Mike Anderson
  2003-02-20  7:43 ` Douglas Gilbert
@ 2003-03-02  9:35 ` Gérard Roudier
  2 siblings, 0 replies; 5+ messages in thread
From: Gérard Roudier @ 2003-03-02  9:35 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-scsi



On Wed, 19 Feb 2003, Andrew Morton wrote:

>
> I have a machine here in which both the controller (53c1010) and the disk
> (IBM IC35L036UCD210-0) can do FAST-80, but the sym2 driver only does FAST-40.
>
> The below patch fixes it up, and has been fearsomely tested.
>
> Can anyone tell me whether it is right, and what is generally going on in
> there?
>
>
> diff -puN drivers/scsi/sym53c8xx_2/sym_hipd.c~sym-do-160 drivers/scsi/sym53c8xx_2/sym_hipd.c
> --- 25-power4/drivers/scsi/sym53c8xx_2/sym_hipd.c~sym-do-160	2003-02-19 01:04:59.000000000 -0800
> +++ 25-power4-akpm/drivers/scsi/sym53c8xx_2/sym_hipd.c	2003-02-19 01:05:13.000000000 -0800
> @@ -800,7 +800,8 @@ static int sym_prepare_setting(hcb_p np,
>  	 * Btw, 'period' is in tenths of nanoseconds.
>  	 */
>  	period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz;
> -	if	(period <= 250)		np->minsync = 10;
> +	if	(period == 250)		np->minsync = 9;
> +	else if	(period <= 250)		np->minsync = 10;
>  	else if	(period <= 303)		np->minsync = 11;
>  	else if	(period <= 500)		np->minsync = 12;
>  	else				np->minsync = (period + 40 - 1) / 40;


These calculations apply to ST (Single Transition) transfer mode.
In DT (Dual Transition) mode you get twice the data transfer rate of ST
for the same transition pattern/timing.

For Ultra-160 chips, the driver gets the synchronous capabilities of the
C1010 controller in a far more simple way:

	/*
	 * If chip is a C1010, guess the sync limits in DT mode.
	 */
	if ((np->features & (FE_C10|FE_ULTRA3)) == (FE_C10|FE_ULTRA3)) {
		if (np->clock_khz == 160000) {
			np->minsync_dt = 9;
			np->maxsync_dt = 50;
			np->maxoffs_dt = nvram->type ? 62 : 31;
		}
	}

May-be, it is your hard disk which negotiates FAST-40. The driver will not
renegotiate for FAST-80 if such happens. You should check that IMO.

Regards,
  Gérard.

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-03-02  9:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-19 20:06 Making sym-2 do 160 MB/sec Andrew Morton
2003-02-19 23:12 ` Mike Anderson
2003-02-19 23:22   ` Andrew Morton
2003-02-20  7:43 ` Douglas Gilbert
2003-03-02  9:35 ` Gérard Roudier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox