[PATCH] qla1280.c /proc/scsi/qla1280/x reads garbage

2005-02-04 Thread Takayoshi Kochi
Hi Jes,

This is a resent of the same patch I posted a month ago.

In 2.6.11-rc3, reading /proc/scsi/qla1280/0 sometimes spits garbage.
This is because in qla1280_proc_info() the returned pointer to
the buffer isn't what the upper layer expects.

This problem seems already fixed in 2.4 series (I checked 2.4.28).

Why the fix is missing in 2.6?  This can be lead to a security
problem (random kernel memory leaks to userspace).

Patch attached. (compiled and worked for me)

Signed-off-by: Takayoshi Kochi [EMAIL PROTECTED]

---
Takayoshi Kochi
--- linux-2.6.10.orig/drivers/scsi/qla1280.cSat Dec 25 06:35:40 2004
+++ linux-2.6.10/drivers/scsi/qla1280.c Tue Dec 28 16:53:33 2004
@@ -776,10 +776,11 @@ static int qla1280_proc_info(struct Scsi
qla1280_buffer_size = length = 0;
*start = NULL;
} else {
-   *start = qla1280_buffer[offset];   /* Start of wanted data 
*/
+   *start = buffer;
if (len - offset  length) {
length = len - offset;
}
+   memcpy(buffer, qla1280_buffer[offset], length);
}
return length;
 }


How to disconnect a SCSI device without crashing SLES8?

2005-02-04 Thread Eric Raskin
Hello all:

I apologize in advance if this is the wrong forum for this question.  Please
feel free to direct me to the correct newgroup.

I have a Dell 6650 running Suse Enterprise 8 (SLES8) with the 2.4.21-138-smp
kernel.  I have a Quantum M1500 tape library with 2 SDLT220 tape drives
connected to one of the internal Adaptec Controllers using the aic7
driver.  One of the tape drives has failed.  From experience, and from
Quantum tech support, I know that turning off the library while the system
is up will crash Linux.

In searching the web, I've found the remove-scsi-device and
add-scsi-device commands that can be sent to /proc/scsi/scsi.

Does anybody know if the system will stay up if I use these commands to
remove all my tape library devices before shutting it down?  Is this the
proper way to repair my library without having to shut the system off?

TIA

  Eric Raskin

PS.  Dell wants to charge me $199 to get an answer to speak with the
engineers who can answer this question.  It's easier to just turn off the
system! :-/


Eric H. Raskin  Voice: 914-765-0500
Professional Advertising Systems Inc.   Fax:   914-765-0503
200 Business Park Dr Suite 107  [EMAIL PROTECTED]
Armonk, NY 10504



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


PATCH [0/3] qla2xxx: new experimental changes...

2005-02-04 Thread Andrew Vasquez
All,

Here's a set of patches which begin to strip legacy features from the
qla2xxx driver.  These 'features' have been superceded in functionality
and simplicity by additions present (for some time) in the SCSI
mid-layer.

Here's the breakdown of patches being submitted:

 1. Remove internal command queuing.  This entails removal of the
driver's *_queue lists as well as modifications and removal of
routines which used them.  With the queuing removed -- the
driver will be unable to tolerate cable-pulls.  Thus we depend
on the next patch for support.
 2. Add initial support for FC remote port infrastructure.  This
patch is based off the proposal submitted by James Smart:
([Patch RFC ] Update FC transport for FC Remote Ports)
http://marc.theaimsgroup.com/?l=linux-scsim=110187926413504w=2
 3. Remove internal lun discovery routines and support structures.
The mid-layer has a more exhaustive and fully capable set of
functions for lun discovery.

Other patches in the queue:

 A. Complete fc_host attributes support.  This patch is mostly
complete, I'd just like to let the dust settle with the recent
transport_template changes.
 B. Additional dusting and scrubbing: /proc removal, unused
functions and structures left over from the cleanup.
 C. lock simplification and consolidation -- we're still reviewing
the implications of removing the driver's 'hardware_lock' and
begin using the host-host_lock exclusively.
 D. additional hardware (ISP) support.
 E. firmware loading via request_firmware() infrastructure.


Regards,
Andrew Vasquez
QLogic Corporation
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


PATCH [2/3] qla2xxx: add FC remote port support.

2005-02-04 Thread Andrew Vasquez
  Add initial support for FC remote port infrastructure.  Depends
  on patches submitted by James Smart ([Patch RFC ] Update FC
  transport for FC Remote Ports)
  
 o Use fc_remote_port...() registration and block/unlock
   functions.
 o Consolidate 'attribute' (fc-remote/sysfs) helpers into
   new qla_attr.c file.

Signed-off-by: Andrew Vasquez [EMAIL PROTECTED]

 drivers/scsi/qla2xxx/Makefile   |2 
 drivers/scsi/qla2xxx/qla_attr.c |  321 
 drivers/scsi/qla2xxx/qla_def.h  |3 
 drivers/scsi/qla2xxx/qla_gbl.h  |   10 +
 drivers/scsi/qla2xxx/qla_init.c |   30 +++
 drivers/scsi/qla2xxx/qla_os.c   |  297 -
 6 files changed, 395 insertions(+), 268 deletions(-)

diff -Nru a/drivers/scsi/qla2xxx/Makefile b/drivers/scsi/qla2xxx/Makefile
--- a/drivers/scsi/qla2xxx/Makefile 2005-02-04 09:53:53 -08:00
+++ b/drivers/scsi/qla2xxx/Makefile 2005-02-04 09:53:53 -08:00
@@ -1,7 +1,7 @@
 EXTRA_CFLAGS += -DUNIQUE_FW_NAME
 
 qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
-   qla_dbg.o qla_sup.o qla_rscn.o
+   qla_dbg.o qla_sup.o qla_rscn.o qla_attr.o
 
 qla2100-y := ql2100.o ql2100_fw.o
 qla2200-y := ql2200.o ql2200_fw.o
diff -Nru a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/drivers/scsi/qla2xxx/qla_attr.c   2005-02-04 09:53:53 -08:00
@@ -0,0 +1,321 @@
+/*
+ *  QLOGIC LINUX SOFTWARE
+ *
+ * QLogic ISP2x00 device driver for Linux 2.6.x
+ * Copyright (C) 2003-2005 QLogic Corporation
+ * (www.qlogic.com)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+#include qla_def.h
+
+#include linux/version.h
+#include scsi/scsi_transport_fc.h
+
+/* SYSFS attributes - 
*/
+
+static ssize_t
+qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off,
+size_t count)
+{
+   struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+   struct device, kobj)));
+
+   if (ha-fw_dump_reading == 0)
+   return 0;
+   if (off  ha-fw_dump_buffer_len)
+   return 0;
+   if (off + count  ha-fw_dump_buffer_len)
+   count = ha-fw_dump_buffer_len - off;
+
+   memcpy(buf, ha-fw_dump_buffer[off], count);
+
+   return (count);
+}
+
+static ssize_t
+qla2x00_sysfs_write_fw_dump(struct kobject *kobj, char *buf, loff_t off,
+size_t count)
+{
+   struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+   struct device, kobj)));
+   int reading;
+   uint32_t dump_size;
+
+   if (off != 0)
+   return (0);
+
+   reading = simple_strtol(buf, NULL, 10);
+   switch (reading) {
+   case 0:
+   if (ha-fw_dump_reading == 1) {
+   qla_printk(KERN_INFO, ha,
+   Firmware dump cleared on (%ld).\n,
+   ha-host_no);
+
+   vfree(ha-fw_dump_buffer);
+   free_pages((unsigned long)ha-fw_dump,
+   ha-fw_dump_order);
+
+   ha-fw_dump_reading = 0;
+   ha-fw_dump_buffer = NULL;
+   ha-fw_dump = NULL;
+   }
+   break;
+   case 1:
+   if (ha-fw_dump != NULL  !ha-fw_dump_reading) {
+   ha-fw_dump_reading = 1;
+
+   dump_size = FW_DUMP_SIZE_1M;
+   if (ha-fw_memory_size  0x2) 
+   dump_size = FW_DUMP_SIZE_128K;
+   else if (ha-fw_memory_size  0x8) 
+   dump_size = FW_DUMP_SIZE_512K;
+   ha-fw_dump_buffer = (char *)vmalloc(dump_size);
+   if (ha-fw_dump_buffer == NULL) {
+   qla_printk(KERN_WARNING, ha,
+   Unable to allocate memory for firmware 
+   dump buffer (%d).\n, dump_size);
+
+   ha-fw_dump_reading = 0;
+   return (count);
+   }
+   qla_printk(KERN_INFO, ha,
+   Firmware dump ready for read on (%ld).\n,
+   ha-host_no);
+   memset(ha-fw_dump_buffer, 0, dump_size);
+   if 

Re: How to disconnect a SCSI device without crashing SLES8?

2005-02-04 Thread Christoph Hellwig
On Fri, Feb 04, 2005 at 02:12:13PM -0500, Eric Raskin wrote:
 In searching the web, I've found the remove-scsi-device and
 add-scsi-device commands that can be sent to /proc/scsi/scsi.
 
 Does anybody know if the system will stay up if I use these commands to
 remove all my tape library devices before shutting it down?  Is this the
 proper way to repair my library without having to shut the system off?

remove-scsi-device could work, but in Linux 2.4 it's racy.

If you want to remove and add devices at runtime safely you'll have to
update to Linux 2.6.

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


RE: How to disconnect a SCSI device without crashing SLES8?

2005-02-04 Thread Eric Raskin
Thanks, Christoph.  Would we use the same commands on 2.6?


Eric H. Raskin  Voice: 914-765-0500
Professional Advertising Systems Inc.   Fax:   914-765-0503
200 Business Park Dr Suite 107  [EMAIL PROTECTED]
Armonk, NY 10504


-Original Message-
From: Christoph Hellwig [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 04, 2005 3:25 PM
To: Eric Raskin
Cc: Linux-scsi@vger.kernel.org
Subject: Re: How to disconnect a SCSI device without crashing SLES8?

On Fri, Feb 04, 2005 at 02:12:13PM -0500, Eric Raskin wrote:
 In searching the web, I've found the remove-scsi-device and
 add-scsi-device commands that can be sent to /proc/scsi/scsi.
 
 Does anybody know if the system will stay up if I use these commands to
 remove all my tape library devices before shutting it down?  Is this the
 proper way to repair my library without having to shut the system off?

remove-scsi-device could work, but in Linux 2.4 it's racy.

If you want to remove and add devices at runtime safely you'll have to
update to Linux 2.6.


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


Re: PATCH [0/3] qla2xxx: new experimental changes...

2005-02-04 Thread Andrew Vasquez
On Fri, 2005-02-04 at 20:35 +, Christoph Hellwig wrote:
 patch3 seems to not have made it to the list.

I'll resend...

   From a quick view
 the first three patches look fine, except for backing out one msleep
 conversion and the superflous return at the end of qla2xxx_slave_destroy
 

I'll send an incremental patch which fixes this.

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


PATCH [3/3] qla2xxx: remove internal lun discovery...

2005-02-04 Thread Andrew Vasquez
Repost: seems as though first one didn't make it to the list.

  Remove internal lun discovery routines and support
  structures.

Signed-off-by: Andrew Vasquez [EMAIL PROTECTED]

 drivers/scsi/qla2xxx/qla_dbg.c|5 
 drivers/scsi/qla2xxx/qla_def.h|   69 
 drivers/scsi/qla2xxx/qla_gbl.h|6 
 drivers/scsi/qla2xxx/qla_init.c   |  584 --
 drivers/scsi/qla2xxx/qla_inline.h |   17 -
 drivers/scsi/qla2xxx/qla_iocb.c   |   13 
 drivers/scsi/qla2xxx/qla_isr.c|   36 --
 drivers/scsi/qla2xxx/qla_mbx.c|5 
 drivers/scsi/qla2xxx/qla_os.c |   98 --
 9 files changed, 21 insertions(+), 812 deletions(-)

diff -Nru a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
--- a/drivers/scsi/qla2xxx/qla_dbg.c2005-02-04 10:27:05 -08:00
+++ b/drivers/scsi/qla2xxx/qla_dbg.c2005-02-04 10:27:05 -08:00
@@ -1067,11 +1067,6 @@
printk(  sp flags=0x%x\n, sp-flags);
printk(  r_start=0x%lx, u_start=0x%lx, f_start=0x%lx, state=%d\n,
sp-r_start, sp-u_start, sp-f_start, sp-state);
-
-   printk( e_start= 0x%lx, ext_history=%d, fo retry=%d, loopid=%x, 
-   port path=%d\n, sp-e_start, sp-ext_history, sp-fo_retry_cnt,
-   sp-lun_queue-fclun-fcport-loop_id,
-   sp-lun_queue-fclun-fcport-cur_path);
 }
 
 #if defined(QL_DEBUG_ROUTINES)
diff -Nru a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
--- a/drivers/scsi/qla2xxx/qla_def.h2005-02-04 10:27:05 -08:00
+++ b/drivers/scsi/qla2xxx/qla_def.h2005-02-04 10:27:05 -08:00
@@ -253,8 +253,6 @@
 
/* Target/LUN queue pointers. */
struct os_tgt *tgt_queue;   /* ptr to visible ha's target */
-   struct os_lun *lun_queue;   /* ptr to visible ha's lun */
-   struct fc_lun *fclun;   /* FC LUN context pointer. */
 
/* Timing counts. */
unsigned long e_start;  /* Start of extend timeout */
@@ -1606,7 +1604,6 @@
  * SCSI Target Queue structure
  */
 typedef struct os_tgt {
-   struct os_lun *olun[MAX_LUNS]; /* LUN context pointer. */
struct fc_port *fcport;
unsigned long flags;
uint8_t port_down_retry_count;
@@ -1626,48 +1623,6 @@
 #define TQF_SUSPENDED  1
 #define TQF_RETRY_CMDS 2
 
-/*
- * SCSI LUN Queue structure
- */
-typedef struct os_lun {
-   struct fc_lun *fclun;   /* FC LUN context pointer. */
-   spinlock_t q_lock;  /* Lun Lock */
-
-   unsigned long q_flag;
-#define LUN_MPIO_RESET_CNTS1   /* Lun */
-#define LUN_MPIO_BUSY  2   /* Lun is changing paths  */
-#define LUN_EXEC_DELAYED   7   /* Lun execution is delayed */
-
-   u_long q_timeout;   /* total command timeouts */
-   atomic_t q_timer;   /* suspend timer */
-   uint32_t q_count;   /* current count */
-   uint32_t q_max; /* maxmum count lun can be suspended */
-   uint8_t q_state;/* lun State */
-#define LUN_STATE_READY1   /* lun is ready for i/o */
-#define LUN_STATE_RUN  2   /* lun has a timer running */
-#define LUN_STATE_WAIT 3   /* lun is suspended */
-#define LUN_STATE_TIMEOUT  4   /* lun has timed out */
-
-   u_long io_cnt;  /* total xfer count since boot */
-   u_long out_cnt; /* total outstanding IO count */
-   u_long w_cnt;   /* total writes */
-   u_long r_cnt;   /* total reads */
-   u_long avg_time;/*  */
-} os_lun_t;
-
-
-/* LUN BitMask structure definition, array of 32bit words,
- * 1 bit per lun.  When bit == 1, the lun is masked.
- * Most significant bit of mask[0] is lun 0, bit 24 is lun 7.
- */
-typedef struct lun_bit_mask {
-   /* Must allocate at least enough bits to accomodate all LUNs */
-#if ((MAX_FIBRE_LUNS  0x7) == 0)
-   uint8_t mask[MAX_FIBRE_LUNS  3];
-#else
-   uint8_t mask[(MAX_FIBRE_LUNS + 8)  3];
-#endif
-} lun_bit_mask_t;
 
 /*
  * Fibre channel port type.
@@ -1686,8 +1641,6 @@
  */
 typedef struct fc_port {
struct list_head list;
-   struct list_head fcluns;
-
struct scsi_qla_host *ha;
struct scsi_qla_host *vis_ha;   /* only used when suspending lun */
 
@@ -1717,7 +1670,6 @@
uint8_t mp_byte;/* multi-path byte (not used) */
uint8_t cur_path;   /* current path id */
 
-   lun_bit_mask_t lun_mask;
struct fc_rport *rport;
 } fc_port_t;
 
@@ -1765,25 +1717,6 @@
 #define FC_NO_LOOP_ID  0x1000
 
 /*
- * Fibre channel LUN structure.
- */
-typedef struct fc_lun {
-struct list_head list;
-
-   fc_port_t *fcport;
-   fc_port_t *o_fcport;
-   uint16_t lun;
-   atomic_t state;
-   uint8_t device_type;
-
-   uint8_t max_path_retries;
-   uint32_t flags;
-} fc_lun_t;
-
-#defineFLF_VISIBLE_LUN BIT_0

RE: How to disconnect a SCSI device without crashing SLES8?

2005-02-04 Thread Eric Raskin
Yes, that's true.  I went ahead and used the commands on 2.4.  They worked
just fine this time. :-)

The question about 2.6 was just for my own education -- for when I actually
get around to installing SLES9 on my production server.

Thanks to everyone for their help.


Eric H. Raskin  Voice: 914-765-0500
Professional Advertising Systems Inc.   Fax:   914-765-0503
200 Business Park Dr Suite 107  [EMAIL PROTECTED]
Armonk, NY 10504


-Original Message-
From: Rajat Jain, Noida [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 04, 2005 3:57 PM
To: [EMAIL PROTECTED]; Linux-scsi@vger.kernel.org
Subject: RE: How to disconnect a SCSI device without crashing SLES8?



Linux 2.6 ? Uhh  I thought you did not wanted to REBOOT the
system 


The command syntax is same. Devices can be removed using the following
command:

echo scsi remove-single-device h b t l  /proc/scsi/scsi

where the variables are host, bus (channel), target (scsi id) and lun. 

But the removal will fail if the device is busy (e.g. if a file system on
the device is mounted). 


Rajat Jain 
HCL Technologies, 
A-11, Sector 16, Noida-201301. 
Ph: +91-120-2510701/702/813 Extn.3019 
[EMAIL PROTECTED] 
http://www.hcltech.com/
...one of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination of their C
programs.
Robert Firth 




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Eric Raskin
Sent: Saturday, February 05, 2005 2:07 AM
To: Linux-scsi@vger.kernel.org
Subject: RE: How to disconnect a SCSI device without crashing SLES8?

Thanks, Christoph.  Would we use the same commands on 2.6?


Eric H. Raskin  Voice: 914-765-0500
Professional Advertising Systems Inc.   Fax:   914-765-0503
200 Business Park Dr Suite 107  [EMAIL PROTECTED]
Armonk, NY 10504


-Original Message-
From: Christoph Hellwig [mailto:[EMAIL PROTECTED]
Sent: Friday, February 04, 2005 3:25 PM
To: Eric Raskin
Cc: Linux-scsi@vger.kernel.org
Subject: Re: How to disconnect a SCSI device without crashing SLES8?

On Fri, Feb 04, 2005 at 02:12:13PM -0500, Eric Raskin wrote:
 In searching the web, I've found the remove-scsi-device and 
 add-scsi-device commands that can be sent to /proc/scsi/scsi.
 
 Does anybody know if the system will stay up if I use these commands 
 to remove all my tape library devices before shutting it down?  Is 
 this the proper way to repair my library without having to shut the system
off?

remove-scsi-device could work, but in Linux 2.4 it's racy.

If you want to remove and add devices at runtime safely you'll have to
update to Linux 2.6.


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


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


PATCH [3/3] qla2xxx: remove internal lun discovery...

2005-02-04 Thread Andrew Vasquez
  Remove internal lun discovery routines and support
  structures.

Signed-off-by: Andrew Vasquez [EMAIL PROTECTED]

 drivers/scsi/qla2xxx/qla_dbg.c|5 
 drivers/scsi/qla2xxx/qla_def.h|   69 
 drivers/scsi/qla2xxx/qla_gbl.h|6 
 drivers/scsi/qla2xxx/qla_init.c   |  584 --
 drivers/scsi/qla2xxx/qla_inline.h |   17 -
 drivers/scsi/qla2xxx/qla_iocb.c   |   13 
 drivers/scsi/qla2xxx/qla_isr.c|   36 --
 drivers/scsi/qla2xxx/qla_mbx.c|5 
 drivers/scsi/qla2xxx/qla_os.c |   98 --
 9 files changed, 21 insertions(+), 812 deletions(-)

diff -Nru a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
--- a/drivers/scsi/qla2xxx/qla_dbg.c2005-02-04 10:27:05 -08:00
+++ b/drivers/scsi/qla2xxx/qla_dbg.c2005-02-04 10:27:05 -08:00
@@ -1067,11 +1067,6 @@
printk(  sp flags=0x%x\n, sp-flags);
printk(  r_start=0x%lx, u_start=0x%lx, f_start=0x%lx, state=%d\n,
sp-r_start, sp-u_start, sp-f_start, sp-state);
-
-   printk( e_start= 0x%lx, ext_history=%d, fo retry=%d, loopid=%x, 
-   port path=%d\n, sp-e_start, sp-ext_history, sp-fo_retry_cnt,
-   sp-lun_queue-fclun-fcport-loop_id,
-   sp-lun_queue-fclun-fcport-cur_path);
 }
 
 #if defined(QL_DEBUG_ROUTINES)
diff -Nru a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
--- a/drivers/scsi/qla2xxx/qla_def.h2005-02-04 10:27:05 -08:00
+++ b/drivers/scsi/qla2xxx/qla_def.h2005-02-04 10:27:05 -08:00
@@ -253,8 +253,6 @@
 
/* Target/LUN queue pointers. */
struct os_tgt *tgt_queue;   /* ptr to visible ha's target */
-   struct os_lun *lun_queue;   /* ptr to visible ha's lun */
-   struct fc_lun *fclun;   /* FC LUN context pointer. */
 
/* Timing counts. */
unsigned long e_start;  /* Start of extend timeout */
@@ -1606,7 +1604,6 @@
  * SCSI Target Queue structure
  */
 typedef struct os_tgt {
-   struct os_lun *olun[MAX_LUNS]; /* LUN context pointer. */
struct fc_port *fcport;
unsigned long flags;
uint8_t port_down_retry_count;
@@ -1626,48 +1623,6 @@
 #define TQF_SUSPENDED  1
 #define TQF_RETRY_CMDS 2
 
-/*
- * SCSI LUN Queue structure
- */
-typedef struct os_lun {
-   struct fc_lun *fclun;   /* FC LUN context pointer. */
-   spinlock_t q_lock;  /* Lun Lock */
-
-   unsigned long q_flag;
-#define LUN_MPIO_RESET_CNTS1   /* Lun */
-#define LUN_MPIO_BUSY  2   /* Lun is changing paths  */
-#define LUN_EXEC_DELAYED   7   /* Lun execution is delayed */
-
-   u_long q_timeout;   /* total command timeouts */
-   atomic_t q_timer;   /* suspend timer */
-   uint32_t q_count;   /* current count */
-   uint32_t q_max; /* maxmum count lun can be suspended */
-   uint8_t q_state;/* lun State */
-#define LUN_STATE_READY1   /* lun is ready for i/o */
-#define LUN_STATE_RUN  2   /* lun has a timer running */
-#define LUN_STATE_WAIT 3   /* lun is suspended */
-#define LUN_STATE_TIMEOUT  4   /* lun has timed out */
-
-   u_long io_cnt;  /* total xfer count since boot */
-   u_long out_cnt; /* total outstanding IO count */
-   u_long w_cnt;   /* total writes */
-   u_long r_cnt;   /* total reads */
-   u_long avg_time;/*  */
-} os_lun_t;
-
-
-/* LUN BitMask structure definition, array of 32bit words,
- * 1 bit per lun.  When bit == 1, the lun is masked.
- * Most significant bit of mask[0] is lun 0, bit 24 is lun 7.
- */
-typedef struct lun_bit_mask {
-   /* Must allocate at least enough bits to accomodate all LUNs */
-#if ((MAX_FIBRE_LUNS  0x7) == 0)
-   uint8_t mask[MAX_FIBRE_LUNS  3];
-#else
-   uint8_t mask[(MAX_FIBRE_LUNS + 8)  3];
-#endif
-} lun_bit_mask_t;
 
 /*
  * Fibre channel port type.
@@ -1686,8 +1641,6 @@
  */
 typedef struct fc_port {
struct list_head list;
-   struct list_head fcluns;
-
struct scsi_qla_host *ha;
struct scsi_qla_host *vis_ha;   /* only used when suspending lun */
 
@@ -1717,7 +1670,6 @@
uint8_t mp_byte;/* multi-path byte (not used) */
uint8_t cur_path;   /* current path id */
 
-   lun_bit_mask_t lun_mask;
struct fc_rport *rport;
 } fc_port_t;
 
@@ -1765,25 +1717,6 @@
 #define FC_NO_LOOP_ID  0x1000
 
 /*
- * Fibre channel LUN structure.
- */
-typedef struct fc_lun {
-struct list_head list;
-
-   fc_port_t *fcport;
-   fc_port_t *o_fcport;
-   uint16_t lun;
-   atomic_t state;
-   uint8_t device_type;
-
-   uint8_t max_path_retries;
-   uint32_t flags;
-} fc_lun_t;
-
-#defineFLF_VISIBLE_LUN BIT_0
-#defineFLF_ACTIVE_LUN  BIT_1
-
-/*
  * FC-CT 

Re: [PATCH 3/3] MidLayer updates - extending scsi_target support

2005-02-04 Thread James Bottomley
On Sat, 2005-01-29 at 09:03 -0500, [EMAIL PROTECTED] wrote:
   This patch extends scsi_target support:
   - Allows for driver-specific data to be allocated along with the
 target structure and accessible via the starget-hostdata pointer.
   - Adds scsi target alloc/configure/destory callbacks to the
 scsi host template.
   - Rearranges the calling sequences for scsi targets so that the
 target and slave alloc/configure/destory callbacks are in
 order (target before slave on alloc/configure).


the idea behind this is fine, I just don't like the interface.

Really a target device is nothing more than a container to SCSI.  We
already do the transport add/remove calls for targets, I don't see we
need other calls duplicating this.  So, I think the implementation would
look a whole lot better if the fc transport class just exported an
interface to get the extra storage for the driver and tacked it on to
its allocation.  Then you can use the existing mid-layer transport
target triggers to do everything you want.

James


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


Re: PATCH [0/3] qla2xxx: new experimental changes...

2005-02-04 Thread Andrew Vasquez
On Fri, 2005-02-04 at 17:46 -0500, Jeff Garzik wrote:
 Andrew Vasquez wrote:
  On Fri, 2005-02-04 at 20:35 +, Christoph Hellwig wrote:
  
 patch3 seems to not have made it to the list.
  
  
  I'll resend...
 
 Is patch #3 rather large?  I still haven't gotten it.
 

No it's actually about a third the size of patch #1.  I've checked MARC
and it appears the repost seems to have made it:

http://marc.theaimsgroup.com/?l=linux-scsim=110755144431861w=2

 I also wonder if vger is censoring xxx...
 

Not sure why it didn't go through.  Let me know if still have problems
receiving the email -- I can just forward it to you directly.

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