All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] qla4xxx: Patches for scsi-misc
@ 2011-10-03 17:29 vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 01/13] qla4xxx: Add new FLT firmware region vikas.chaudhary
                   ` (12 more replies)
  0 siblings, 13 replies; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand

From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>

James,

Please apply the following patches to scsi-misc for inclusion in mainline.

Lalit Chandivade (4):
      qla4xxx: Fix bidirectional CHAP
      qla4xxx: Do not add duplicate CHAP entry in FLASH
      qla4xxx: Fix exporting boot targets to sysfs
      qla4xxx: Free Device Database (DDB) reserved by FW

Manish Rangankar (6):
      qla4xxx: Clear DDB map index on the basis of AEN.
      qla4xxx: Fixed session destroy issue on link up-down.
      qla4xxx: Fixed device blocked issue on link up-down.
      qla4xxx: Fixed active session re-open issue.
      qla4xxx: Fixed target discovery failed issue.
      qla4xxx: updated device id check for BFS.

Nilesh Javali (1):
      qla4xxx: Add new FLT firmware region

Vikas Chaudhary (2):
      qla4xxx: Update license
      qla4xxx: Update driver version to 5.02.00-k8

 Documentation/scsi/00-INDEX        |    2 +
 Documentation/scsi/LICENSE.qla4xxx |  310 ++++++++++++++++++++++++++++++++++++
 drivers/scsi/qla4xxx/ql4_def.h     |   13 ++-
 drivers/scsi/qla4xxx/ql4_fw.h      |    6 +
 drivers/scsi/qla4xxx/ql4_init.c    |   69 ++++++++-
 drivers/scsi/qla4xxx/ql4_iocb.c    |    2 +-
 drivers/scsi/qla4xxx/ql4_mbx.c     |  135 +++++++++++++----
 drivers/scsi/qla4xxx/ql4_nx.c      |    8 +
 drivers/scsi/qla4xxx/ql4_os.c      |  206 +++++++++++++++++++-----
 drivers/scsi/qla4xxx/ql4_version.h |    2 +-
 10 files changed, 682 insertions(+), 71 deletions(-)
 create mode 100644 Documentation/scsi/LICENSE.qla4xxx

Thanks,
Vikas.


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

* [PATCH 01/13] qla4xxx: Add new FLT firmware region
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 02/13] qla4xxx: Update license vikas.chaudhary
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand, Nilesh Javali

From: Nilesh Javali <nilesh.javali@qlogic.com>

Signed-off-by: Nilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_fw.h |    1 +
 drivers/scsi/qla4xxx/ql4_nx.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h
index 0e24c7a..597875f 100644
--- a/drivers/scsi/qla4xxx/ql4_fw.h
+++ b/drivers/scsi/qla4xxx/ql4_fw.h
@@ -306,6 +306,7 @@ struct qla_flt_header {
 #define FLT_REG_FLT		0x1c
 #define FLT_REG_BOOTLOAD_82	0x72
 #define FLT_REG_FW_82		0x74
+#define FLT_REG_FW_82_1		0x97
 #define FLT_REG_GOLD_FW_82	0x75
 #define FLT_REG_BOOT_CODE_82	0x78
 #define FLT_REG_ISCSI_PARAM	0x65
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index a539e17..84c254a 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -2015,6 +2015,7 @@ qla4_8xxx_get_flt_info(struct scsi_qla_host *ha, uint32_t flt_addr)
 			hw->flt_region_boot = start;
 			break;
 		case FLT_REG_FW_82:
+		case FLT_REG_FW_82_1:
 			hw->flt_region_fw = start;
 			break;
 		case FLT_REG_BOOTLOAD_82:
-- 
1.7.6



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

* [PATCH 02/13] qla4xxx: Update license
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 01/13] qla4xxx: Add new FLT firmware region vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 03/13] qla4xxx: Fix bidirectional CHAP vikas.chaudhary
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand

From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 Documentation/scsi/00-INDEX        |    2 +
 Documentation/scsi/LICENSE.qla4xxx |  310 ++++++++++++++++++++++++++++++++++++
 2 files changed, 312 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/scsi/LICENSE.qla4xxx

diff --git a/Documentation/scsi/00-INDEX b/Documentation/scsi/00-INDEX
index c2e18e1..b48ded5 100644
--- a/Documentation/scsi/00-INDEX
+++ b/Documentation/scsi/00-INDEX
@@ -28,6 +28,8 @@ LICENSE.FlashPoint
 	- Licence of the Flashpoint driver
 LICENSE.qla2xxx
 	- License for QLogic Linux Fibre Channel HBA Driver firmware.
+LICENSE.qla4xxx
+	- License for QLogic Linux iSCSI HBA Driver.
 Mylex.txt
 	- info on driver for Mylex adapters
 NinjaSCSI.txt
diff --git a/Documentation/scsi/LICENSE.qla4xxx b/Documentation/scsi/LICENSE.qla4xxx
new file mode 100644
index 0000000..494980e
--- /dev/null
+++ b/Documentation/scsi/LICENSE.qla4xxx
@@ -0,0 +1,310 @@
+Copyright (c) 2003-2011 QLogic Corporation
+QLogic Linux iSCSI HBA Driver
+
+This program includes a device driver for Linux 3.x.
+You may modify and redistribute the device driver code under the
+GNU General Public License (a copy of which is attached hereto as
+Exhibit A) published by the Free Software Foundation (version 2).
+
+REGARDLESS OF WHAT LICENSING MECHANISM IS USED OR APPLICABLE,
+THIS PROGRAM IS PROVIDED BY QLOGIC CORPORATION "AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+USER ACKNOWLEDGES AND AGREES THAT USE OF THIS PROGRAM WILL NOT
+CREATE OR GIVE GROUNDS FOR A LICENSE BY IMPLICATION, ESTOPPEL, OR
+OTHERWISE IN ANY INTELLECTUAL PROPERTY RIGHTS (PATENT, COPYRIGHT,
+TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT) EMBODIED IN
+ANY OTHER QLOGIC HARDWARE OR SOFTWARE EITHER SOLELY OR IN
+COMBINATION WITH THIS PROGRAM.
+
+
+EXHIBIT A
+
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
-- 
1.7.6



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

* [PATCH 03/13] qla4xxx: Fix bidirectional CHAP
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 01/13] qla4xxx: Add new FLT firmware region vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 02/13] qla4xxx: Update license vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 04/13] qla4xxx: Do not add duplicate CHAP entry in FLASH vikas.chaudhary
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand

From: Lalit Chandivade <lalit.chandivade@qlogic.com>

Driver was not setting the bidirectional CHAP bit correctly in
the DDB entry.

Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_def.h |    2 ++
 drivers/scsi/qla4xxx/ql4_mbx.c |    7 ++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index d2f7cd6..a80adfc 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -351,6 +351,8 @@ struct ipaddress_config {
 
 #define QL4_CHAP_MAX_NAME_LEN 256
 #define QL4_CHAP_MAX_SECRET_LEN 100
+#define LOCAL_CHAP	0
+#define BIDI_CHAP	1
 
 struct ql4_chap_format {
 	u8  intr_chap_name[QL4_CHAP_MAX_NAME_LEN];
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index de733a7..b60b903 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -872,7 +872,6 @@ void qla4xxx_get_conn_event_log(struct scsi_qla_host * ha)
 	uint32_t	max_event_log_entries;
 	uint8_t		i;
 
-
 	memset(&mbox_cmd, 0, sizeof(mbox_cmd));
 	memset(&mbox_sts, 0, sizeof(mbox_cmd));
 
@@ -1578,7 +1577,8 @@ int qla4xxx_set_param_ddbentry(struct scsi_qla_host *ha,
 			}
 
 			rval = qla4xxx_set_chap(ha, sess->username,
-						sess->password, idx, 0);
+						sess->password, idx,
+						LOCAL_CHAP);
 			if (rval)
 				goto exit_set_param;
 
@@ -1599,7 +1599,8 @@ int qla4xxx_set_param_ddbentry(struct scsi_qla_host *ha,
 				goto exit_set_param;
 			}
 			rval = qla4xxx_set_chap(ha, sess->username_in,
-						sess->password_in, idx, 0);
+						sess->password_in, idx,
+						BIDI_CHAP);
 			if (rval)
 				goto exit_set_param;
 		}
-- 
1.7.6



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

* [PATCH 04/13] qla4xxx: Do not add duplicate CHAP entry in FLASH
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
                   ` (2 preceding siblings ...)
  2011-10-03 17:29 ` [PATCH 03/13] qla4xxx: Fix bidirectional CHAP vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  2011-10-03 20:40   ` Mike Christie
  2011-10-03 17:29 ` [PATCH 05/13] qla4xxx: Fix exporting boot targets to sysfs vikas.chaudhary
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand

From: Lalit Chandivade <lalit.chandivade@qlogic.com>

QLogic applications store the CHAP information in FLASH. During login,
authentication information is provided using an index into the CHAP region.

In order to support QLogic applications along with iscsiadm, updated the
LLD to not add duplicate CHAP entries in the CHAP region and preserve the
existing CHAP info in the CHAP region in FLASH.
This allows QLogic applications to pre-write the CHAP entries in the CHAP
region.

With iscsiadm, when the CHAP authentication information is sent to the LLD, the
LLD searches for the entry in CHAP region in FLASH, if exists then do not add.
If CHAP entry does not exist then add the CHAP entry in the CHAP region.

JIRA Key: UPSISCSI-146

Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_def.h |   10 +++-
 drivers/scsi/qla4xxx/ql4_fw.h  |    5 ++
 drivers/scsi/qla4xxx/ql4_mbx.c |  135 +++++++++++++++++++++++++++++++---------
 drivers/scsi/qla4xxx/ql4_nx.c  |    7 ++
 drivers/scsi/qla4xxx/ql4_os.c  |   66 +++++++++++++++++++
 5 files changed, 193 insertions(+), 30 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index a80adfc..fcb1dff 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -279,7 +279,8 @@ struct ql82xx_hw_data {
 	uint32_t flt_region_fw;
 
 	uint32_t flt_iscsi_param;
-	uint32_t reserved;
+	uint32_t flt_region_chap;
+	uint32_t flt_chap_size;
 };
 
 struct qla4_8xxx_legacy_intr_set {
@@ -609,6 +610,8 @@ struct scsi_qla_host {
 #define	QLFLASH_READING		1
 #define	QLFLASH_WRITING		2
 	struct dma_pool *chap_dma_pool;
+	uint8_t *chap_list; /* CHAP table cache */
+	struct mutex  chap_sem;
 #define CHAP_DMA_BLOCK_SIZE    512
 	struct workqueue_struct *task_wq;
 	unsigned long ddb_idx_map[MAX_DDB_ENTRIES / BITS_PER_LONG];
@@ -671,6 +674,11 @@ static inline int is_qla4032(struct scsi_qla_host *ha)
 	return ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP4032;
 }
 
+static inline int is_qla40XX(struct scsi_qla_host *ha)
+{
+	return is_qla4032(ha) || is_qla4022(ha) || is_qla4010(ha);
+}
+
 static inline int is_qla8022(struct scsi_qla_host *ha)
 {
 	return ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8022;
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h
index 597875f..cbd5a20 100644
--- a/drivers/scsi/qla4xxx/ql4_fw.h
+++ b/drivers/scsi/qla4xxx/ql4_fw.h
@@ -251,6 +251,8 @@ union external_hw_config_reg {
 #define FA_BOOT_CODE_ADDR_82		0x20000
 #define FA_RISC_CODE_ADDR_82		0x40000
 #define FA_GOLD_RISC_CODE_ADDR_82	0x80000
+#define FA_FLASH_ISCSI_CHAP		0x540000
+#define FA_FLASH_CHAP_SIZE		0xC0000
 
 /* Flash Description Table */
 struct qla_fdt_layout {
@@ -310,6 +312,7 @@ struct qla_flt_header {
 #define FLT_REG_GOLD_FW_82	0x75
 #define FLT_REG_BOOT_CODE_82	0x78
 #define FLT_REG_ISCSI_PARAM	0x65
+#define FLT_REG_ISCSI_CHAP	0x63
 
 struct qla_flt_region {
 	uint32_t code;
@@ -681,6 +684,8 @@ struct addr_ctrl_blk_def {
 
 #define MAX_CHAP_ENTRIES_40XX	128
 #define MAX_CHAP_ENTRIES_82XX	1024
+#define MAX_RESRV_CHAP_IDX	3
+#define FLASH_CHAP_OFFSET	0x06000000
 
 struct ql4_chap_table {
 	uint16_t link;
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index b60b903..ba4eadf 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -1304,7 +1304,7 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha, char *username, char *password,
 {
 	int ret = 0;
 	int rval = QLA_ERROR;
-	uint32_t offset = 0;
+	uint32_t offset = 0, chap_size;
 	struct ql4_chap_table *chap_table;
 	dma_addr_t chap_dma;
 
@@ -1314,12 +1314,22 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha, char *username, char *password,
 		goto exit_get_chap;
 	}
 
-	memset(chap_table, 0, sizeof(struct ql4_chap_table));
-
-	offset = 0x06000000 | (idx * sizeof(struct ql4_chap_table));
+	chap_size = sizeof(struct ql4_chap_table);
+	memset(chap_table, 0, chap_size);
+
+	if (is_qla40XX(ha))
+		offset = FLASH_CHAP_OFFSET | (idx * chap_size);
+	else {
+		offset = FLASH_RAW_ACCESS_ADDR + (ha->hw.flt_region_chap << 2);
+		/* flt_chap_size is CHAP table size for both ports
+		 * so divide it by 2 to calculate the offset for second port
+		 */
+		if (ha->port_num == 1)
+			offset += (ha->hw.flt_chap_size / 2);
+		offset += (idx * chap_size);
+	}
 
-	rval = qla4xxx_get_flash(ha, chap_dma, offset,
-				 sizeof(struct ql4_chap_table));
+	rval = qla4xxx_get_flash(ha, chap_dma, offset, chap_size);
 	if (rval != QLA_SUCCESS) {
 		ret = -EINVAL;
 		goto exit_get_chap;
@@ -1366,10 +1376,16 @@ static int qla4xxx_set_chap(struct scsi_qla_host *ha, char *username,
 	strncpy(chap_table->secret, password, MAX_CHAP_SECRET_LEN);
 	strncpy(chap_table->name, username, MAX_CHAP_NAME_LEN);
 	chap_table->cookie = __constant_cpu_to_le16(CHAP_VALID_COOKIE);
-	offset = 0x06000000 | (idx * sizeof(struct ql4_chap_table));
+	offset = FLASH_CHAP_OFFSET | (idx * sizeof(struct ql4_chap_table));
 	rval = qla4xxx_set_flash(ha, chap_dma, offset,
 				sizeof(struct ql4_chap_table),
 				FLASH_OPT_RMW_COMMIT);
+
+	if (rval == QLA_SUCCESS && ha->chap_list) {
+		/* Update ha chap_list cache */
+		memcpy((struct ql4_chap_table *)ha->chap_list + idx,
+		       chap_table, sizeof(struct ql4_chap_table));
+	}
 	dma_pool_free(ha->chap_dma_pool, chap_table, chap_dma);
 	if (rval != QLA_SUCCESS)
 		ret =  -EINVAL;
@@ -1378,6 +1394,82 @@ exit_set_chap:
 	return ret;
 }
 
+/**
+ * qla4xxx_get_chap_index - Get chap index given user name and secret
+ * @ha: pointer to adapter structure
+ * @username
+ * @secret
+ * @bidi: Is this a BIDI CHAP
+ * @chap_index: CHAP index to be returned
+ *
+ * Match the username and secret in the chap_list, return the index if a match
+ * is found. If a match is not found then add the entry in FLASH and return the
+ * index at which entry is written in the FLASH.
+ **/
+static int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username,
+			    char *password, int bidi, uint16_t *chap_index)
+{
+	int i, rval;
+	int free_index = -1;
+	int found_index = 0;
+	int max_chap_entries = 0;
+	struct ql4_chap_table *chap_table;
+
+	if (is_qla8022(ha))
+		max_chap_entries = MAX_CHAP_ENTRIES_82XX;
+	else
+		max_chap_entries = MAX_CHAP_ENTRIES_40XX;
+
+	if (!ha->chap_list) {
+		ql4_printk(KERN_ERR, ha, "Do not have CHAP table cache\n");
+		return QLA_ERROR;
+	}
+
+	mutex_lock(&ha->chap_sem);
+	for (i = 0; i < max_chap_entries; i++) {
+		chap_table = (struct ql4_chap_table *)ha->chap_list + i;
+		if (chap_table->cookie !=
+		    __constant_cpu_to_le16(CHAP_VALID_COOKIE)) {
+			if (i > MAX_RESRV_CHAP_IDX && free_index == -1)
+				free_index = i;
+			continue;
+		}
+		if (bidi) {
+			if (chap_table->flags & BIT_7)
+				continue;
+		} else {
+			if (chap_table->flags & BIT_6)
+				continue;
+		}
+		if (!strncmp(chap_table->secret, password,
+			     MAX_CHAP_SECRET_LEN) &&
+		    !strncmp(chap_table->name, username,
+			     MAX_CHAP_NAME_LEN)) {
+			*chap_index = i;
+			found_index = 1;
+			break;
+		}
+	}
+
+	/* If chap entry is not present and a free index is available then
+	 * write the entry in flash
+	 */
+	if (!found_index && free_index != -1) {
+		rval = qla4xxx_set_chap(ha, username, password,
+					free_index, bidi);
+		if (!rval) {
+			*chap_index = free_index;
+			found_index = 1;
+		}
+	}
+
+	mutex_unlock(&ha->chap_sem);
+
+	if (found_index)
+		return QLA_SUCCESS;
+	return QLA_ERROR;
+}
+
 int qla4xxx_conn_close_sess_logout(struct scsi_qla_host *ha,
 				   uint16_t fw_ddb_index,
 				   uint16_t connection_id,
@@ -1567,18 +1659,10 @@ int qla4xxx_set_param_ddbentry(struct scsi_qla_host *ha,
 	if (sess->username != NULL && sess->password != NULL) {
 		if (strlen(sess->username) && strlen(sess->password)) {
 			iscsi_opts |= BIT_7;
-			idx = ddb_entry->fw_ddb_index * 2;
-			if (idx > max_chap_entries) {
-				ql4_printk(KERN_ERR, ha,
-					   "%s: Invalid ddb or chap index\n",
-					   __func__);
-				rval  = -EINVAL;
-				goto exit_set_param;
-			}
 
-			rval = qla4xxx_set_chap(ha, sess->username,
-						sess->password, idx,
-						LOCAL_CHAP);
+			rval = qla4xxx_get_chap_index(ha, sess->username,
+						sess->password,
+						LOCAL_CHAP, &idx);
 			if (rval)
 				goto exit_set_param;
 
@@ -1590,17 +1674,10 @@ int qla4xxx_set_param_ddbentry(struct scsi_qla_host *ha,
 		/* Check if BIDI CHAP */
 		if (strlen(sess->username_in) && strlen(sess->password_in)) {
 			iscsi_opts |= BIT_4;
-			idx = (ddb_entry->fw_ddb_index * 2) + 1;
-			if (idx > max_chap_entries) {
-				ql4_printk(KERN_ERR, ha,
-					   "%s: Invalid ddb or bidi chap "
-					   "index\n", __func__);
-				rval  = -EINVAL;
-				goto exit_set_param;
-			}
-			rval = qla4xxx_set_chap(ha, sess->username_in,
-						sess->password_in, idx,
-						BIDI_CHAP);
+
+			rval = qla4xxx_get_chap_index(ha, sess->username_in,
+						      sess->password_in,
+						      BIDI_CHAP, &idx);
 			if (rval)
 				goto exit_set_param;
 		}
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index 84c254a..f484ff4 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -2024,6 +2024,10 @@ qla4_8xxx_get_flt_info(struct scsi_qla_host *ha, uint32_t flt_addr)
 		case FLT_REG_ISCSI_PARAM:
 			hw->flt_iscsi_param =  start;
 			break;
+		case FLT_REG_ISCSI_CHAP:
+			hw->flt_region_chap =  start;
+			hw->flt_chap_size =  le32_to_cpu(region->size);
+			break;
 		}
 	}
 	goto done;
@@ -2036,6 +2040,9 @@ no_flash_data:
 	hw->flt_region_boot     = FA_BOOT_CODE_ADDR_82;
 	hw->flt_region_bootload = FA_BOOT_LOAD_ADDR_82;
 	hw->flt_region_fw       = FA_RISC_CODE_ADDR_82;
+	hw->flt_region_chap	= FA_FLASH_ISCSI_CHAP;
+	hw->flt_chap_size	= FA_FLASH_CHAP_SIZE;
+
 done:
 	DEBUG2(ql4_printk(KERN_INFO, ha, "FLT[%s]: flt=0x%x fdt=0x%x "
 	    "boot=0x%x bootload=0x%x fw=0x%x\n", loc, hw->flt_region_flt,
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index ce391d5..52877ca 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1605,6 +1605,10 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha)
 	if (ha->chap_dma_pool)
 		dma_pool_destroy(ha->chap_dma_pool);
 
+	if (ha->chap_list)
+		vfree(ha->chap_list);
+	ha->chap_list = NULL;
+
 	/* release io space registers  */
 	if (is_qla8022(ha)) {
 		if (ha->nx_pcibase)
@@ -3058,6 +3062,66 @@ kset_free:
 	return -ENOMEM;
 }
 
+
+/**
+ * qla4xxx_create chap_list - Create CHAP list from FLASH
+ * @ha: pointer to adapter structure
+ *
+ * Read flash and make a list of CHAP entries, during login when a CHAP entry
+ * is received, it will be checked in this list. If entry exist then the CHAP
+ * entry index is set in the DDB. If CHAP entry does not exist in this list
+ * then a new entry is added in FLASH in CHAP table and the index obtained is
+ * used in the DDB.
+ **/
+static void qla4xxx_create_chap_list(struct scsi_qla_host *ha)
+{
+	int rval = 0;
+	uint8_t *chap_flash_data = NULL;
+	uint32_t offset;
+	dma_addr_t chap_dma;
+	uint32_t chap_size = 0;
+
+	if (is_qla40XX(ha))
+		chap_size = MAX_CHAP_ENTRIES_40XX  *
+					sizeof(struct ql4_chap_table);
+	else	/* Single region contains CHAP info for both
+		 * ports which is divided into half for each port.
+		 */
+		chap_size = ha->hw.flt_chap_size / 2;
+
+	chap_flash_data = dma_alloc_coherent(&ha->pdev->dev, chap_size,
+					  &chap_dma, GFP_KERNEL);
+	if (!chap_flash_data) {
+		ql4_printk(KERN_ERR, ha, "No memory for chap_flash_data\n");
+		return;
+	}
+	if (is_qla40XX(ha))
+		offset = FLASH_CHAP_OFFSET;
+	else {
+		offset = FLASH_RAW_ACCESS_ADDR + (ha->hw.flt_region_chap << 2);
+		if (ha->port_num == 1)
+			offset += chap_size;
+	}
+
+	rval = qla4xxx_get_flash(ha, chap_dma, offset, chap_size);
+	if (rval != QLA_SUCCESS)
+		goto exit_chap_list;
+
+	if (ha->chap_list == NULL)
+		ha->chap_list = vmalloc(chap_size);
+	if (ha->chap_list == NULL) {
+		ql4_printk(KERN_ERR, ha, "No memory for ha->chap_list\n");
+		goto exit_chap_list;
+	}
+
+	memcpy(ha->chap_list, chap_flash_data, chap_size);
+
+exit_chap_list:
+	dma_free_coherent(&ha->pdev->dev, chap_size,
+			chap_flash_data, chap_dma);
+	return;
+}
+
 /**
  * qla4xxx_probe_adapter - callback function to probe HBA
  * @pdev: pointer to pci_dev structure
@@ -3135,6 +3199,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
 	INIT_LIST_HEAD(&ha->free_srb_q);
 
 	mutex_init(&ha->mbox_sem);
+	mutex_init(&ha->chap_sem);
 	init_completion(&ha->mbx_intr_comp);
 	init_completion(&ha->disable_acb_comp);
 
@@ -3271,6 +3336,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
 			   __func__);
 
 	qla4xxx_create_ifaces(ha);
+	qla4xxx_create_chap_list(ha);
 	return 0;
 
 remove_host:
-- 
1.7.6



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

* [PATCH 05/13] qla4xxx: Fix exporting boot targets to sysfs
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
                   ` (3 preceding siblings ...)
  2011-10-03 17:29 ` [PATCH 04/13] qla4xxx: Do not add duplicate CHAP entry in FLASH vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  2011-10-03 20:46   ` Mike Christie
  2011-10-03 17:29 ` [PATCH 06/13] qla4xxx: Free Device Database (DDB) reserved by FW vikas.chaudhary
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand

From: Lalit Chandivade <lalit.chandivade@qlogic.com>

The driver failed to export primary boot target if secondary target did not
exist in the FLASH. If boot targets are not valid then driver assumed 0 and
1 as default boot targets. Since these target did not exist in flash, the
driver failed exporting all the targets.
Also fixed,
- for 8022 calculate max chap entries based on the size of CHAP table in FLASH
- If a boot target has a BIDI CHAP enabled, then read the user/secret from
CHAP table. Do not assume BIDI chap at peer CHAP idx + 1

JIRA Key: UPSISCSI-148

Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_mbx.c |    3 +-
 drivers/scsi/qla4xxx/ql4_os.c  |  102 +++++++++++++++++++++++++++++++--------
 2 files changed, 83 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index ba4eadf..475676f 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -1416,7 +1416,8 @@ static int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username,
 	struct ql4_chap_table *chap_table;
 
 	if (is_qla8022(ha))
-		max_chap_entries = MAX_CHAP_ENTRIES_82XX;
+		max_chap_entries = (ha->hw.flt_chap_size / 2) /
+						sizeof(struct ql4_chap_table);
 	else
 		max_chap_entries = MAX_CHAP_ENTRIES_40XX;
 
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 52877ca..c621152 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -2812,15 +2812,11 @@ static int get_fw_boot_info(struct scsi_qla_host *ha, uint16_t ddb_index[])
 		val = rd_nvram_byte(ha, pri_addr);
 		if (val & BIT_7)
 			ddb_index[0] = (val & 0x7f);
-		else
-			ddb_index[0] = 0;
 
 		/* get secondary valid target index */
 		val = rd_nvram_byte(ha, sec_addr);
 		if (val & BIT_7)
 			ddb_index[1] = (val & 0x7f);
-		else
-			ddb_index[1] = 1;
 
 	} else if (is_qla8022(ha)) {
 		buf = dma_alloc_coherent(&ha->pdev->dev, size,
@@ -2862,15 +2858,10 @@ static int get_fw_boot_info(struct scsi_qla_host *ha, uint16_t ddb_index[])
 		/* get primary valid target index */
 		if (buf[2] & BIT_7)
 			ddb_index[0] = buf[2] & 0x7f;
-		else
-			ddb_index[0] = 0;
 
 		/* get secondary valid target index */
 		if (buf[11] & BIT_7)
 			ddb_index[1] = buf[11] & 0x7f;
-		else
-			ddb_index[1] = 1;
-
 	} else {
 		ret = QLA_ERROR;
 		goto exit_boot_info;
@@ -2886,6 +2877,60 @@ exit_boot_info:
 	return ret;
 }
 
+/**
+ * qla4xxx_get_bidi_chap - Get a BI-DI CHAP user and secret.
+ * @ha: pointer to adapter structure
+ * @username
+ * @password
+ *
+ * If a boot entry has BIDI CHAP enabled then we need to set the BIDI CHAP
+ * user and secret in the sysfs entry in /sys/firmware/iscsi_boot#/.
+ * So from the CHAP cache find the first BIDI CHAP entry and set it
+ * to the boot record in sysfs.
+ **/
+static int qla4xxx_get_bidi_chap(struct scsi_qla_host *ha, char *username,
+			    char *password)
+{
+	int i, ret = -EINVAL;
+	int max_chap_entries = 0;
+	struct ql4_chap_table *chap_table;
+
+	if (is_qla8022(ha))
+		max_chap_entries = (ha->hw.flt_chap_size / 2) /
+						sizeof(struct ql4_chap_table);
+	else
+		max_chap_entries = MAX_CHAP_ENTRIES_40XX;
+
+	if (!ha->chap_list) {
+		ql4_printk(KERN_ERR, ha, "Do not have CHAP table cache\n");
+		return ret;
+	}
+
+	mutex_lock(&ha->chap_sem);
+	for (i = 0; i < max_chap_entries; i++) {
+		chap_table = (struct ql4_chap_table *)ha->chap_list + i;
+		if (chap_table->cookie !=
+		    __constant_cpu_to_le16(CHAP_VALID_COOKIE)) {
+			continue;
+		}
+
+		if (chap_table->flags & BIT_7) /* local */
+			continue;
+
+		if (!(chap_table->flags & BIT_6)) /* Not BIDI */
+			continue;
+
+		strncpy(password, chap_table->secret, QL4_CHAP_MAX_SECRET_LEN);
+		strncpy(username, chap_table->name, QL4_CHAP_MAX_NAME_LEN);
+		ret = 0;
+		break;
+	}
+	mutex_unlock(&ha->chap_sem);
+
+	return ret;
+}
+
+
 static int qla4xxx_get_boot_target(struct scsi_qla_host *ha,
 				   struct ql4_boot_session_info *boot_sess,
 				   uint16_t ddb_index)
@@ -2957,10 +3002,10 @@ static int qla4xxx_get_boot_target(struct scsi_qla_host *ha,
 
 		DEBUG2(ql4_printk(KERN_INFO, ha, "Setting BIDI chap\n"));
 
-		ret = qla4xxx_get_chap(ha, (char *)&boot_conn->chap.
-				       intr_chap_name,
-				       (char *)&boot_conn->chap.intr_secret,
-				       (idx + 1));
+		ret = qla4xxx_get_bidi_chap(ha,
+				    (char *)&boot_conn->chap.intr_chap_name,
+				    (char *)&boot_conn->chap.intr_secret);
+
 		if (ret) {
 			ql4_printk(KERN_ERR, ha, "Failed to set BIDI chap\n");
 			ret = QLA_ERROR;
@@ -2980,9 +3025,12 @@ exit_boot_target:
 static int qla4xxx_get_boot_info(struct scsi_qla_host *ha)
 {
 	uint16_t ddb_index[2];
-	int ret = QLA_SUCCESS;
+	int ret = QLA_ERROR;
+	int rval;
 
 	memset(ddb_index, 0, sizeof(ddb_index));
+	ddb_index[0] = 0xffff;
+	ddb_index[1] = 0xffff;
 	ret = get_fw_boot_info(ha, ddb_index);
 	if (ret != QLA_SUCCESS) {
 		DEBUG2(ql4_printk(KERN_ERR, ha,
@@ -2990,19 +3038,30 @@ static int qla4xxx_get_boot_info(struct scsi_qla_host *ha)
 		return ret;
 	}
 
-	ret = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_pri_sess),
+	if (ddb_index[0] == 0xffff)
+		goto sec_target;
+
+	rval = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_pri_sess),
 				      ddb_index[0]);
-	if (ret != QLA_SUCCESS) {
+	if (rval != QLA_SUCCESS) {
 		DEBUG2(ql4_printk(KERN_ERR, ha, "%s: Failed to get "
 				  "primary target\n", __func__));
-	}
+	} else
+		ret = QLA_SUCCESS;
 
-	ret = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_sec_sess),
+sec_target:
+	if (ddb_index[1] == 0xffff)
+		goto exit_get_boot_info;
+
+	rval = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_sec_sess),
 				      ddb_index[1]);
-	if (ret != QLA_SUCCESS) {
+	if (rval != QLA_SUCCESS) {
 		DEBUG2(ql4_printk(KERN_ERR, ha, "%s: Failed to get "
 				  "secondary target\n", __func__));
-	}
+	} else
+		ret = QLA_SUCCESS;
+
+exit_get_boot_info:
 	return ret;
 }
 
@@ -3331,12 +3390,13 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
 	       ha->host_no, ha->firmware_version[0], ha->firmware_version[1],
 	       ha->patch_number, ha->build_number);
 
+	qla4xxx_create_chap_list(ha);
+
 	if (qla4xxx_setup_boot_info(ha))
 		ql4_printk(KERN_ERR, ha, "%s:ISCSI boot info setup failed\n",
 			   __func__);
 
 	qla4xxx_create_ifaces(ha);
-	qla4xxx_create_chap_list(ha);
 	return 0;
 
 remove_host:
-- 
1.7.6



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

* [PATCH 06/13] qla4xxx: Free Device Database (DDB) reserved by FW
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
                   ` (4 preceding siblings ...)
  2011-10-03 17:29 ` [PATCH 05/13] qla4xxx: Fix exporting boot targets to sysfs vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 07/13] qla4xxx: Clear DDB map index on the basis of AEN vikas.chaudhary
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand

From: Lalit Chandivade <lalit.chandivade@qlogic.com>

Firmware reserves DDBs if there are entries in the FLASH.
So there are no free DDBs left when a iSCSI login is initiated
by user space tool like iscsiadm.
Since now login is not controlled by firmware, LLD need to free
up the DDBs after firmware init. This will ensure free DDBs are
available for iSCSI logins using iscsiadm.

JIRA Key: UPSISCSI-151

Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_init.c |   40 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index b0bffe1..064a3a3 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -765,6 +765,44 @@ int qla4xxx_start_firmware(struct scsi_qla_host *ha)
 	}
 	return status;
 }
+/**
+ * qla4xxx_free_ddb_index - Free DDBs reserved by firmware
+ * @ha: pointer to adapter structure
+ *
+ * Since firmware is not running in autoconnect mode the DDB indices should
+ * be freed so that when login happens from user space there are free DDB
+ * indices available.
+ **/
+static void qla4xxx_free_ddb_index(struct scsi_qla_host *ha)
+{
+	int max_ddbs;
+	int ret;
+	uint32_t idx = 0, next_idx = 0;
+	uint32_t state = 0, conn_err = 0;
+
+	max_ddbs =  is_qla40XX(ha) ? MAX_PRST_DEV_DB_ENTRIES :
+				     MAX_DEV_DB_ENTRIES;
+
+	for (idx = 0; idx < max_ddbs; idx = next_idx) {
+		ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL,
+					      &next_idx, &state, &conn_err,
+						NULL, NULL);
+		if (ret == QLA_ERROR)
+			continue;
+		if (state == DDB_DS_NO_CONNECTION_ACTIVE ||
+		    state == DDB_DS_SESSION_FAILED) {
+			DEBUG2(ql4_printk(KERN_INFO, ha,
+					  "Freeing DDB index = 0x%x\n", idx));
+			ret = qla4xxx_clear_ddb_entry(ha, idx);
+			if (ret == QLA_ERROR)
+				ql4_printk(KERN_ERR, ha,
+					   "Unable to clear DDB index = "
+					   "0x%x\n", idx);
+		}
+		if (next_idx == 0)
+			break;
+	}
+}
 
 
 /**
@@ -802,6 +840,8 @@ int qla4xxx_initialize_adapter(struct scsi_qla_host *ha)
 	if (status == QLA_ERROR)
 		goto exit_init_hba;
 
+	qla4xxx_free_ddb_index(ha);
+
 	set_bit(AF_ONLINE, &ha->flags);
 exit_init_hba:
 	if (is_qla8022(ha) && (status == QLA_ERROR)) {
-- 
1.7.6



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

* [PATCH 07/13] qla4xxx: Clear DDB map index on the basis of AEN.
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
                   ` (5 preceding siblings ...)
  2011-10-03 17:29 ` [PATCH 06/13] qla4xxx: Free Device Database (DDB) reserved by FW vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 08/13] qla4xxx: Fixed session destroy issue on link up-down vikas.chaudhary
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
	Manish Rangankar

From: Manish Rangankar <manish.rangankar@qlogic.com>

Unable to login to session if login-logout issued consecutively for
multiple sessions. Solution is to clear idx in DDB map on the basis
of no-active connection asynchronous event (AEN).

JIRA Key: UPSISCSI-135

Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_init.c |   12 +++++++++++-
 drivers/scsi/qla4xxx/ql4_os.c   |   11 +++--------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 064a3a3..ca155bb 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -880,6 +880,10 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
 	if (ddb_entry == NULL) {
 		ql4_printk(KERN_ERR, ha, "%s: No ddb_entry at FW index [%d]\n",
 			   __func__, fw_ddb_index);
+
+		if (state == DDB_DS_NO_CONNECTION_ACTIVE)
+			clear_bit(fw_ddb_index, ha->ddb_idx_map);
+
 		goto exit_ddb_event;
 	}
 
@@ -910,7 +914,8 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
 		}
 		break;
 	case DDB_DS_SESSION_ACTIVE:
-		if (state == DDB_DS_SESSION_FAILED) {
+		switch (state) {
+		case DDB_DS_SESSION_FAILED:
 			/*
 			 * iscsi_session failure  will cause userspace to
 			 * stop the connection which in turn would block the
@@ -919,6 +924,11 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
 			iscsi_session_failure(ddb_entry->sess->dd_data,
 					      ISCSI_ERR_CONN_FAILED);
 			status = QLA_SUCCESS;
+			break;
+		case DDB_DS_NO_CONNECTION_ACTIVE:
+			clear_bit(fw_ddb_index, ha->ddb_idx_map);
+			status = QLA_SUCCESS;
+			break;
 		}
 		break;
 	default:
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index c621152..fc3ba29 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1004,6 +1004,7 @@ qla4xxx_session_create(struct iscsi_endpoint *ep,
 	qla_ep = ep->dd_data;
 	dst_addr = (struct sockaddr *)&qla_ep->dst_addr;
 	ha = to_qla_host(qla_ep->host);
+
 get_ddb_index:
 	ddb_index = find_first_zero_bit(ha->ddb_idx_map, MAX_DDB_ENTRIES);
 
@@ -1063,6 +1064,8 @@ static void qla4xxx_session_destroy(struct iscsi_cls_session *cls_sess)
 	ddb_entry = sess->dd_data;
 	ha = ddb_entry->ha;
 
+	qla4xxx_clear_ddb_entry(ha, ddb_entry->fw_ddb_index);
+
 	spin_lock_irqsave(&ha->hardware_lock, flags);
 	qla4xxx_free_ddb(ha, ddb_entry);
 	spin_unlock_irqrestore(&ha->hardware_lock, flags);
@@ -1183,14 +1186,6 @@ static void qla4xxx_conn_destroy(struct iscsi_cls_conn *cls_conn)
 	options = LOGOUT_OPTION_CLOSE_SESSION;
 	if (qla4xxx_session_logout_ddb(ha, ddb_entry, options) == QLA_ERROR)
 		ql4_printk(KERN_ERR, ha, "%s: Logout failed\n", __func__);
-	else
-		qla4xxx_clear_ddb_entry(ha, ddb_entry->fw_ddb_index);
-
-	/*
-	 * Clear the DDB bit so that next login can use the bit
-	 * if FW is not clearing the DDB entry then set DDB will fail anyways
-	 */
-	clear_bit(ddb_entry->fw_ddb_index, ha->ddb_idx_map);
 }
 
 static void qla4xxx_task_work(struct work_struct *wdata)
-- 
1.7.6



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

* [PATCH 08/13] qla4xxx: Fixed session destroy issue on link up-down.
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
                   ` (6 preceding siblings ...)
  2011-10-03 17:29 ` [PATCH 07/13] qla4xxx: Clear DDB map index on the basis of AEN vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 09/13] qla4xxx: Fixed device blocked " vikas.chaudhary
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
	Manish Rangankar

From: Manish Rangankar <manish.rangankar@qlogic.com>

During link down, iscsid tries to do re-login to failed session. In case of
link down-up-down, LLD was sending connection login failed event to iscsid,
which is destroying the session, instead we have to continue re-login by
sending connection err event.

JIRA Key: UPSISCSI-134

Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_init.c |   16 ++++++++++++++++
 drivers/scsi/qla4xxx/ql4_os.c   |    6 +++++-
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index ca155bb..cc10bac 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -931,6 +931,22 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
 			break;
 		}
 		break;
+	case DDB_DS_SESSION_FAILED:
+		switch (state) {
+		case DDB_DS_SESSION_ACTIVE:
+		case DDB_DS_DISCOVERY:
+			iscsi_conn_login_event(ddb_entry->conn,
+					       ISCSI_CONN_STATE_LOGGED_IN);
+			qla4xxx_update_session_conn_param(ha, ddb_entry);
+			status = QLA_SUCCESS;
+			break;
+		case DDB_DS_SESSION_FAILED:
+			iscsi_session_failure(ddb_entry->sess->dd_data,
+					      ISCSI_ERR_CONN_FAILED);
+			status = QLA_SUCCESS;
+			break;
+		}
+		break;
 	default:
 		DEBUG2(ql4_printk(KERN_INFO, ha, "%s: Unknown Event\n",
 				__func__));
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index fc3ba29..251358a 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1158,7 +1158,11 @@ static int qla4xxx_conn_start(struct iscsi_cls_conn *cls_conn)
 		goto exit_conn_start;
 	}
 
-	ddb_entry->fw_ddb_device_state = DDB_DS_LOGIN_IN_PROCESS;
+	if (ddb_entry->fw_ddb_device_state == DDB_DS_NO_CONNECTION_ACTIVE)
+		ddb_entry->fw_ddb_device_state = DDB_DS_LOGIN_IN_PROCESS;
+
+	DEBUG2(printk(KERN_INFO "%s: DDB state [%d]\n", __func__,
+		      ddb_entry->fw_ddb_device_state));
 
 exit_set_param:
 	iscsi_conn_start(cls_conn);
-- 
1.7.6



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

* [PATCH 09/13] qla4xxx: Fixed device blocked issue on link up-down.
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
                   ` (7 preceding siblings ...)
  2011-10-03 17:29 ` [PATCH 08/13] qla4xxx: Fixed session destroy issue on link up-down vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  2011-10-03 21:01   ` Mike Christie
  2011-10-03 17:29 ` [PATCH 10/13] qla4xxx: Fixed active session re-open issue vikas.chaudhary
                   ` (3 subsequent siblings)
  12 siblings, 1 reply; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
	Manish Rangankar

From: Manish Rangankar <manish.rangankar@qlogic.com>

Devices are getting blocked during continuous link up and down. Solution is,
during relogin unblock the session before sending connection logged in event.

JIRA Key: UPSISCSI-138

Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_init.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index cc10bac..e07d99b 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -900,6 +900,7 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
 		switch (state) {
 		case DDB_DS_SESSION_ACTIVE:
 		case DDB_DS_DISCOVERY:
+			iscsi_unblock_session(ddb_entry->sess);
 			iscsi_conn_login_event(ddb_entry->conn,
 					       ISCSI_CONN_STATE_LOGGED_IN);
 			qla4xxx_update_session_conn_param(ha, ddb_entry);
-- 
1.7.6



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

* [PATCH 10/13] qla4xxx: Fixed active session re-open issue.
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
                   ` (8 preceding siblings ...)
  2011-10-03 17:29 ` [PATCH 09/13] qla4xxx: Fixed device blocked " vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 11/13] qla4xxx: Fixed target discovery failed issue vikas.chaudhary
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
	Manish Rangankar

From: Manish Rangankar <manish.rangankar@qlogic.com>

When iscsid restarted for an existing active session, set DDB will
fail with status already logged in. In this case, we have to send
logged in event to iscsid.

JIRA Key: OPENISCSI-21

Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_os.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 251358a..47e4fcb 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1142,8 +1142,12 @@ static int qla4xxx_conn_start(struct iscsi_cls_conn *cls_conn)
 		*/
 		if (mbx_sts)
 			if (ddb_entry->fw_ddb_device_state ==
-							DDB_DS_SESSION_ACTIVE)
+						DDB_DS_SESSION_ACTIVE) {
+				iscsi_unblock_session(ddb_entry->sess);
+				iscsi_conn_login_event(ddb_entry->conn,
+						ISCSI_CONN_STATE_LOGGED_IN);
 				goto exit_set_param;
+			}
 
 		ql4_printk(KERN_ERR, ha, "%s: Failed set param for index[%d]\n",
 			   __func__, ddb_entry->fw_ddb_index);
-- 
1.7.6



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

* [PATCH 11/13] qla4xxx: Fixed target discovery failed issue.
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
                   ` (9 preceding siblings ...)
  2011-10-03 17:29 ` [PATCH 10/13] qla4xxx: Fixed active session re-open issue vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 12/13] qla4xxx: updated device id check for BFS vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 13/13] qla4xxx: Update driver version to 5.02.00-k8 vikas.chaudhary
  12 siblings, 0 replies; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
	Manish Rangankar

From: Manish Rangankar <manish.rangankar@qlogic.com>

When sendtargets response is grater then max receive data segment length,
the passthrough IOCB failed with data overrun status. Solution is to
allocate space for iSCSI header in the IOCB response buffer.

JIRA Key: UPSISCSI-147

Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_def.h  |    1 +
 drivers/scsi/qla4xxx/ql4_iocb.c |    2 +-
 drivers/scsi/qla4xxx/ql4_os.c   |    9 +++++----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index fcb1dff..ace637b 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -631,6 +631,7 @@ struct ql4_task_data {
 	dma_addr_t data_dma;
 	void *req_buffer;
 	dma_addr_t req_dma;
+	uint32_t req_len;
 	void *resp_buffer;
 	dma_addr_t resp_dma;
 	uint32_t resp_len;
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index ad40a61..4106693 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -407,7 +407,7 @@ int qla4xxx_send_passthru0(struct iscsi_task *task)
 	passthru_iocb->timeout = cpu_to_le16(PT_DEFAULT_TIMEOUT);
 
 	/* Setup the out & in DSDs */
-	if (task->data_count) {
+	if (task_data->req_len) {
 		memcpy((uint8_t *)task_data->req_buffer +
 		       sizeof(struct iscsi_hdr), task->data, task->data_count);
 		ctrl_flags |= PT_FLAG_SEND_BUFFER;
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 47e4fcb..34388b6 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1273,7 +1273,7 @@ static int qla4xxx_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
 	DEBUG2(ql4_printk(KERN_INFO, ha, "%s: MaxRecvLen %u, iscsi hrd %d\n",
 		      __func__, task->conn->max_recv_dlength, hdr_len));
 
-	task_data->resp_len = task->conn->max_recv_dlength;
+	task_data->resp_len = task->conn->max_recv_dlength + hdr_len;
 	task_data->resp_buffer = dma_alloc_coherent(&ha->pdev->dev,
 						    task_data->resp_len,
 						    &task_data->resp_dma,
@@ -1281,8 +1281,9 @@ static int qla4xxx_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
 	if (!task_data->resp_buffer)
 		goto exit_alloc_pdu;
 
+	task_data->req_len = task->data_count + hdr_len;
 	task_data->req_buffer = dma_alloc_coherent(&ha->pdev->dev,
-						   task->data_count + hdr_len,
+						   task_data->req_len,
 						   &task_data->req_dma,
 						   GFP_ATOMIC);
 	if (!task_data->req_buffer)
@@ -1300,7 +1301,7 @@ exit_alloc_pdu:
 				  task_data->resp_buffer, task_data->resp_dma);
 
 	if (task_data->req_buffer)
-		dma_free_coherent(&ha->pdev->dev, task->data_count + hdr_len,
+		dma_free_coherent(&ha->pdev->dev, task_data->req_len,
 				  task_data->req_buffer, task_data->req_dma);
 	return -ENOMEM;
 }
@@ -1329,7 +1330,7 @@ static void qla4xxx_task_cleanup(struct iscsi_task *task)
 
 	dma_free_coherent(&ha->pdev->dev, task_data->resp_len,
 			  task_data->resp_buffer, task_data->resp_dma);
-	dma_free_coherent(&ha->pdev->dev, task->data_count + hdr_len,
+	dma_free_coherent(&ha->pdev->dev, task_data->req_len,
 			  task_data->req_buffer, task_data->req_dma);
 	return;
 }
-- 
1.7.6



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

* [PATCH 12/13] qla4xxx: updated device id check for BFS.
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
                   ` (10 preceding siblings ...)
  2011-10-03 17:29 ` [PATCH 11/13] qla4xxx: Fixed target discovery failed issue vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  2011-10-03 17:29 ` [PATCH 13/13] qla4xxx: Update driver version to 5.02.00-k8 vikas.chaudhary
  12 siblings, 0 replies; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand,
	Manish Rangankar

From: Manish Rangankar <manish.rangankar@qlogic.com>

JIRA Key: UPSISCSI-75

Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_os.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 34388b6..67faae7 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -2783,12 +2783,10 @@ static int get_fw_boot_info(struct scsi_qla_host *ha, uint16_t ddb_index[])
 
 	func_num = PCI_FUNC(ha->pdev->devfn);
 
-	DEBUG2(ql4_printk(KERN_INFO, ha,
-			  "%s: Get FW  boot info for 0x%x func %d\n", __func__,
-			  (is_qla4032(ha) ? PCI_DEVICE_ID_QLOGIC_ISP4032 :
-			   PCI_DEVICE_ID_QLOGIC_ISP8022), func_num));
+	ql4_printk(KERN_INFO, ha, "%s: Get FW boot info for 0x%x func %d\n",
+		   __func__, ha->pdev->device, func_num);
 
-	if (is_qla4032(ha)) {
+	if (is_qla40XX(ha)) {
 		if (func_num == 1) {
 			addr = NVRAM_PORT0_BOOT_MODE;
 			pri_addr = NVRAM_PORT0_BOOT_PRI_TGT;
-- 
1.7.6



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

* [PATCH 13/13] qla4xxx: Update driver version to 5.02.00-k8
  2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
                   ` (11 preceding siblings ...)
  2011-10-03 17:29 ` [PATCH 12/13] qla4xxx: updated device id check for BFS vikas.chaudhary
@ 2011-10-03 17:29 ` vikas.chaudhary
  12 siblings, 0 replies; 22+ messages in thread
From: vikas.chaudhary @ 2011-10-03 17:29 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade, ravi.anand

From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_version.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_version.h b/drivers/scsi/qla4xxx/ql4_version.h
index 6104928..c15347d 100644
--- a/drivers/scsi/qla4xxx/ql4_version.h
+++ b/drivers/scsi/qla4xxx/ql4_version.h
@@ -5,4 +5,4 @@
  * See LICENSE.qla4xxx for copyright and licensing details.
  */
 
-#define QLA4XXX_DRIVER_VERSION	"5.02.00-k7"
+#define QLA4XXX_DRIVER_VERSION	"5.02.00-k8"
-- 
1.7.6



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

* Re: [PATCH 04/13] qla4xxx: Do not add duplicate CHAP entry in FLASH
  2011-10-03 17:29 ` [PATCH 04/13] qla4xxx: Do not add duplicate CHAP entry in FLASH vikas.chaudhary
@ 2011-10-03 20:40   ` Mike Christie
  2011-10-03 20:41     ` Mike Christie
  0 siblings, 1 reply; 22+ messages in thread
From: Mike Christie @ 2011-10-03 20:40 UTC (permalink / raw)
  To: vikas.chaudhary; +Cc: jbottomley, linux-scsi, lalit.chandivade, ravi.anand

On 10/03/2011 12:29 PM, vikas.chaudhary@qlogic.com wrote:
> From: Lalit Chandivade <lalit.chandivade@qlogic.com>
> 
> QLogic applications store the CHAP information in FLASH. During login,
> authentication information is provided using an index into the CHAP region.
> 
> In order to support QLogic applications along with iscsiadm, updated the
> LLD to not add duplicate CHAP entries in the CHAP region and preserve the
> existing CHAP info in the CHAP region in FLASH.
> This allows QLogic applications to pre-write the CHAP entries in the CHAP
> region.
> 
> With iscsiadm, when the CHAP authentication information is sent to the LLD, the
> LLD searches for the entry in CHAP region in FLASH, if exists then do not add.
> If CHAP entry does not exist then add the CHAP entry in the CHAP region.
> 

Does the qlogic app use the bsg flash commands to send down everything
then or how does one app work differently and use the same driver for
everything else?


> +/**
> + * qla4xxx_get_chap_index - Get chap index given user name and secret
> + * @ha: pointer to adapter structure
> + * @username
> + * @secret

You forgot to write some info on those arguments.

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

* Re: [PATCH 04/13] qla4xxx: Do not add duplicate CHAP entry in FLASH
  2011-10-03 20:40   ` Mike Christie
@ 2011-10-03 20:41     ` Mike Christie
  2011-10-04 17:13       ` Vikas Chaudhary
  0 siblings, 1 reply; 22+ messages in thread
From: Mike Christie @ 2011-10-03 20:41 UTC (permalink / raw)
  To: vikas.chaudhary; +Cc: jbottomley, linux-scsi, lalit.chandivade, ravi.anand

On 10/03/2011 03:40 PM, Mike Christie wrote:
> On 10/03/2011 12:29 PM, vikas.chaudhary@qlogic.com wrote:
>> From: Lalit Chandivade <lalit.chandivade@qlogic.com>
>>
>> QLogic applications store the CHAP information in FLASH. During login,
>> authentication information is provided using an index into the CHAP region.
>>
>> In order to support QLogic applications along with iscsiadm, updated the
>> LLD to not add duplicate CHAP entries in the CHAP region and preserve the
>> existing CHAP info in the CHAP region in FLASH.
>> This allows QLogic applications to pre-write the CHAP entries in the CHAP
>> region.
>>
>> With iscsiadm, when the CHAP authentication information is sent to the LLD, the
>> LLD searches for the entry in CHAP region in FLASH, if exists then do not add.
>> If CHAP entry does not exist then add the CHAP entry in the CHAP region.
>>
> 
> Does the qlogic app use the bsg flash commands to send down everything
> then or how does one app work differently and use the same driver for
> everything else?
> 

Or does the the qlogic app store the targets in flash too or just the
chap info?

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

* Re: [PATCH 05/13] qla4xxx: Fix exporting boot targets to sysfs
  2011-10-03 20:46   ` Mike Christie
@ 2011-10-03 20:44     ` James Bottomley
  0 siblings, 0 replies; 22+ messages in thread
From: James Bottomley @ 2011-10-03 20:44 UTC (permalink / raw)
  To: Mike Christie; +Cc: vikas.chaudhary, linux-scsi, lalit.chandivade, ravi.anand

On Mon, 2011-10-03 at 15:46 -0500, Mike Christie wrote:
> You can probably just ask James if it would be ok to send a patch to
> fix
> them all up over this patchset so you do not have to resend patches.

As long as it's tracked correctly (as in is a reply to the original
patch) and doesn't get too complex for my tiny mind, I can track
incremental update patches: that means a couple of update patches,
yes ... after that I'd like a clean resend just to make sure nothing
gets missed.

James



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

* Re: [PATCH 05/13] qla4xxx: Fix exporting boot targets to sysfs
  2011-10-03 17:29 ` [PATCH 05/13] qla4xxx: Fix exporting boot targets to sysfs vikas.chaudhary
@ 2011-10-03 20:46   ` Mike Christie
  2011-10-03 20:44     ` James Bottomley
  0 siblings, 1 reply; 22+ messages in thread
From: Mike Christie @ 2011-10-03 20:46 UTC (permalink / raw)
  To: vikas.chaudhary; +Cc: jbottomley, linux-scsi, lalit.chandivade, ravi.anand

On 10/03/2011 12:29 PM, vikas.chaudhary@qlogic.com wrote:
> From: Lalit Chandivade <lalit.chandivade@qlogic.com>
> 
> The driver failed to export primary boot target if secondary target did not
> exist in the FLASH. If boot targets are not valid then driver assumed 0 and
> 1 as default boot targets. Since these target did not exist in flash, the
> driver failed exporting all the targets.
> Also fixed,
> - for 8022 calculate max chap entries based on the size of CHAP table in FLASH
> - If a boot target has a BIDI CHAP enabled, then read the user/secret from
> CHAP table. Do not assume BIDI chap at peer CHAP idx + 1

You would normally want to send that in another patch.


> +/**
> + * qla4xxx_get_bidi_chap - Get a BI-DI CHAP user and secret.
> + * @ha: pointer to adapter structure
> + * @username
> + * @password
> + *

Forgot to add a description again.

You can probably just ask James if it would be ok to send a patch to fix
them all up over this patchset so you do not have to resend patches.

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

* Re: [PATCH 09/13] qla4xxx: Fixed device blocked issue on link up-down.
  2011-10-03 17:29 ` [PATCH 09/13] qla4xxx: Fixed device blocked " vikas.chaudhary
@ 2011-10-03 21:01   ` Mike Christie
  2011-10-03 21:16     ` Mike Christie
  0 siblings, 1 reply; 22+ messages in thread
From: Mike Christie @ 2011-10-03 21:01 UTC (permalink / raw)
  To: vikas.chaudhary
  Cc: jbottomley, linux-scsi, lalit.chandivade, ravi.anand, Manish Rangankar

On 10/03/2011 12:29 PM, vikas.chaudhary@qlogic.com wrote:
> From: Manish Rangankar <manish.rangankar@qlogic.com>
> 
> Devices are getting blocked during continuous link up and down. Solution is,
> during relogin unblock the session before sending connection logged in event.
> 
> JIRA Key: UPSISCSI-138
> 
> Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
> ---
>  drivers/scsi/qla4xxx/ql4_init.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
> index cc10bac..e07d99b 100644
> --- a/drivers/scsi/qla4xxx/ql4_init.c
> +++ b/drivers/scsi/qla4xxx/ql4_init.c
> @@ -900,6 +900,7 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
>  		switch (state) {
>  		case DDB_DS_SESSION_ACTIVE:
>  		case DDB_DS_DISCOVERY:
> +			iscsi_unblock_session(ddb_entry->sess);

Shouldn't this alreadu get done when start_conn callback is called?

Is the problem that start_conn is getting called when login is started
and not when we are actually logged in (when we get the logged in event
below)?

The start_conn callback use looks wrong right now for qla4xxx.
user/initiator.c:setup_offload_login_phase() will call it when we are
only in_login. It should only be called when we are logged_in, because
it will unlbock the devices, update the iscsi session state and could
start IO before the driver is ready.


>  			iscsi_conn_login_event(ddb_entry->conn,
>  					       ISCSI_CONN_STATE_LOGGED_IN);
>  			qla4xxx_update_session_conn_param(ha, ddb_entry);


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

* Re: [PATCH 09/13] qla4xxx: Fixed device blocked issue on link up-down.
  2011-10-03 21:01   ` Mike Christie
@ 2011-10-03 21:16     ` Mike Christie
  2011-10-04 17:07       ` Vikas Chaudhary
  0 siblings, 1 reply; 22+ messages in thread
From: Mike Christie @ 2011-10-03 21:16 UTC (permalink / raw)
  To: vikas.chaudhary
  Cc: jbottomley, linux-scsi, lalit.chandivade, ravi.anand, Manish Rangankar

[-- Attachment #1: Type: text/plain, Size: 1832 bytes --]

On 10/03/2011 04:01 PM, Mike Christie wrote:
> On 10/03/2011 12:29 PM, vikas.chaudhary@qlogic.com wrote:
>> From: Manish Rangankar <manish.rangankar@qlogic.com>
>>
>> Devices are getting blocked during continuous link up and down. Solution is,
>> during relogin unblock the session before sending connection logged in event.
>>
>> JIRA Key: UPSISCSI-138
>>
>> Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
>> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
>> ---
>>  drivers/scsi/qla4xxx/ql4_init.c |    1 +
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
>> index cc10bac..e07d99b 100644
>> --- a/drivers/scsi/qla4xxx/ql4_init.c
>> +++ b/drivers/scsi/qla4xxx/ql4_init.c
>> @@ -900,6 +900,7 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
>>  		switch (state) {
>>  		case DDB_DS_SESSION_ACTIVE:
>>  		case DDB_DS_DISCOVERY:
>> +			iscsi_unblock_session(ddb_entry->sess);
> 
> Shouldn't this alreadu get done when start_conn callback is called?
> 
> Is the problem that start_conn is getting called when login is started
> and not when we are actually logged in (when we get the logged in event
> below)?
> 
> The start_conn callback use looks wrong right now for qla4xxx.
> user/initiator.c:setup_offload_login_phase() will call it when we are
> only in_login. It should only be called when we are logged_in, because
> it will unlbock the devices, update the iscsi session state and could
> start IO before the driver is ready.
> 

One clarification. Qla4xxx needs to do its setup in there but it should
not call iscsi_conn_start until it is actually logged in.

I think we want to do like the attached (patch not even compile tested).
It is built over this patch and 10/13.


[-- Attachment #2: qla4xxx-start-conn.patch --]
[-- Type: text/plain, Size: 1695 bytes --]

diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index e07d99b..3075fba 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -900,7 +900,7 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
 		switch (state) {
 		case DDB_DS_SESSION_ACTIVE:
 		case DDB_DS_DISCOVERY:
-			iscsi_unblock_session(ddb_entry->sess);
+			iscsi_conn_start(ddb_entry->conn);
 			iscsi_conn_login_event(ddb_entry->conn,
 					       ISCSI_CONN_STATE_LOGGED_IN);
 			qla4xxx_update_session_conn_param(ha, ddb_entry);
@@ -936,6 +936,7 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
 		switch (state) {
 		case DDB_DS_SESSION_ACTIVE:
 		case DDB_DS_DISCOVERY:
+			iscsi_conn_start(ddb_entry->conn);
 			iscsi_conn_login_event(ddb_entry->conn,
 					       ISCSI_CONN_STATE_LOGGED_IN);
 			qla4xxx_update_session_conn_param(ha, ddb_entry);
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index f84ddd2..676aedc 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1136,7 +1136,7 @@ static int qla4xxx_conn_start(struct iscsi_cls_conn *cls_conn)
 		if (mbx_sts)
 			if (ddb_entry->fw_ddb_device_state ==
 						DDB_DS_SESSION_ACTIVE) {
-				iscsi_unblock_session(ddb_entry->sess);
+				iscsi_conn_start(ddb_entry->conn);
 				iscsi_conn_login_event(ddb_entry->conn,
 						ISCSI_CONN_STATE_LOGGED_IN);
 				goto exit_set_param;
@@ -1162,7 +1162,6 @@ static int qla4xxx_conn_start(struct iscsi_cls_conn *cls_conn)
 		      ddb_entry->fw_ddb_device_state));
 
 exit_set_param:
-	iscsi_conn_start(cls_conn);
 	ret = 0;
 
 exit_conn_start:

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

* Re: [PATCH 09/13] qla4xxx: Fixed device blocked issue on link up-down.
  2011-10-03 21:16     ` Mike Christie
@ 2011-10-04 17:07       ` Vikas Chaudhary
  0 siblings, 0 replies; 22+ messages in thread
From: Vikas Chaudhary @ 2011-10-04 17:07 UTC (permalink / raw)
  To: Mike Christie
  Cc: jbottomley, scsi, Lalit Chandivade, Ravi Anand, Manish Rangankar


On 03/10/11 2:16 PM, "Mike Christie" <michaelc@cs.wisc.edu> wrote:

>On 10/03/2011 04:01 PM, Mike Christie wrote:
>> On 10/03/2011 12:29 PM, vikas.chaudhary@qlogic.com wrote:
>>> From: Manish Rangankar <manish.rangankar@qlogic.com>
>>>
>>> Devices are getting blocked during continuous link up and down.
>>>Solution is,
>>> during relogin unblock the session before sending connection logged in
>>>event.
>>>
>>> JIRA Key: UPSISCSI-138
>>>
>>> Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
>>> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
>>> ---
>>>  drivers/scsi/qla4xxx/ql4_init.c |    1 +
>>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/scsi/qla4xxx/ql4_init.c
>>>b/drivers/scsi/qla4xxx/ql4_init.c
>>> index cc10bac..e07d99b 100644
>>> --- a/drivers/scsi/qla4xxx/ql4_init.c
>>> +++ b/drivers/scsi/qla4xxx/ql4_init.c
>>> @@ -900,6 +900,7 @@ int qla4xxx_process_ddb_changed(struct
>>>scsi_qla_host *ha, uint32_t fw_ddb_index,
>>>          switch (state) {
>>>          case DDB_DS_SESSION_ACTIVE:
>>>          case DDB_DS_DISCOVERY:
>>> +            iscsi_unblock_session(ddb_entry->sess);
>>
>> Shouldn't this alreadu get done when start_conn callback is called?
>>
>> Is the problem that start_conn is getting called when login is started
>> and not when we are actually logged in (when we get the logged in event
>> below)?
>>
>> The start_conn callback use looks wrong right now for qla4xxx.
>> user/initiator.c:setup_offload_login_phase() will call it when we are
>> only in_login. It should only be called when we are logged_in, because
>> it will unlbock the devices, update the iscsi session state and could
>> start IO before the driver is ready.
>>
>
>One clarification. Qla4xxx needs to do its setup in there but it should
>not call iscsi_conn_start until it is actually logged in.
>
>I think we want to do like the attached (patch not even compile tested).
>It is built over this patch and 10/13.
>

We are testing this patch we will update you once we are done with testing.


This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.


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

* Re: [PATCH 04/13] qla4xxx: Do not add duplicate CHAP entry in FLASH
  2011-10-03 20:41     ` Mike Christie
@ 2011-10-04 17:13       ` Vikas Chaudhary
  0 siblings, 0 replies; 22+ messages in thread
From: Vikas Chaudhary @ 2011-10-04 17:13 UTC (permalink / raw)
  To: Mike Christie; +Cc: jbottomley, scsi, Lalit Chandivade, Ravi Anand



On 03/10/11 1:41 PM, "Mike Christie" <michaelc@cs.wisc.edu> wrote:

>On 10/03/2011 03:40 PM, Mike Christie wrote:
>> On 10/03/2011 12:29 PM, vikas.chaudhary@qlogic.com wrote:
>>> From: Lalit Chandivade <lalit.chandivade@qlogic.com>
>>>
>>> QLogic applications store the CHAP information in FLASH. During login,
>>> authentication information is provided using an index into the CHAP
>>>region.
>>>
>>> In order to support QLogic applications along with iscsiadm, updated
>>>the
>>> LLD to not add duplicate CHAP entries in the CHAP region and preserve
>>>the
>>> existing CHAP info in the CHAP region in FLASH.
>>> This allows QLogic applications to pre-write the CHAP entries in the
>>>CHAP
>>> region.
>>>
>>> With iscsiadm, when the CHAP authentication information is sent to the
>>>LLD, the
>>> LLD searches for the entry in CHAP region in FLASH, if exists then do
>>>not add.
>>> If CHAP entry does not exist then add the CHAP entry in the CHAP
>>>region.
>>>
>>
>> Does the qlogic app use the bsg flash commands to send down everything
>> then or how does one app work differently and use the same driver for
>> everything else?

Yes, QLogic app will use BSG flash to write to the CHAP table in FLASH.
For isciadm, LLD would check if CHAP entry is present in the FLASH and
if not then add it to the FLASH. The difference between QLogic app and
iscsiadm would be the delete part. Going forward we would need
A way to delete the CHAP entries from FLASH using iscsiadm.


>>
>
>Or does the the qlogic app store the targets in flash too or just the
>chap info?

Target info for boot target only is stored in the FLASH. All other
targets are not stored in FLASH.
And also CHAP table is stored in FLASH since firmware while doing
CHAP authentication uses the index into CHAP table to find the
user/secret information.



This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.


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

end of thread, other threads:[~2011-10-04 17:13 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-03 17:29 [PATCH 00/13] qla4xxx: Patches for scsi-misc vikas.chaudhary
2011-10-03 17:29 ` [PATCH 01/13] qla4xxx: Add new FLT firmware region vikas.chaudhary
2011-10-03 17:29 ` [PATCH 02/13] qla4xxx: Update license vikas.chaudhary
2011-10-03 17:29 ` [PATCH 03/13] qla4xxx: Fix bidirectional CHAP vikas.chaudhary
2011-10-03 17:29 ` [PATCH 04/13] qla4xxx: Do not add duplicate CHAP entry in FLASH vikas.chaudhary
2011-10-03 20:40   ` Mike Christie
2011-10-03 20:41     ` Mike Christie
2011-10-04 17:13       ` Vikas Chaudhary
2011-10-03 17:29 ` [PATCH 05/13] qla4xxx: Fix exporting boot targets to sysfs vikas.chaudhary
2011-10-03 20:46   ` Mike Christie
2011-10-03 20:44     ` James Bottomley
2011-10-03 17:29 ` [PATCH 06/13] qla4xxx: Free Device Database (DDB) reserved by FW vikas.chaudhary
2011-10-03 17:29 ` [PATCH 07/13] qla4xxx: Clear DDB map index on the basis of AEN vikas.chaudhary
2011-10-03 17:29 ` [PATCH 08/13] qla4xxx: Fixed session destroy issue on link up-down vikas.chaudhary
2011-10-03 17:29 ` [PATCH 09/13] qla4xxx: Fixed device blocked " vikas.chaudhary
2011-10-03 21:01   ` Mike Christie
2011-10-03 21:16     ` Mike Christie
2011-10-04 17:07       ` Vikas Chaudhary
2011-10-03 17:29 ` [PATCH 10/13] qla4xxx: Fixed active session re-open issue vikas.chaudhary
2011-10-03 17:29 ` [PATCH 11/13] qla4xxx: Fixed target discovery failed issue vikas.chaudhary
2011-10-03 17:29 ` [PATCH 12/13] qla4xxx: updated device id check for BFS vikas.chaudhary
2011-10-03 17:29 ` [PATCH 13/13] qla4xxx: Update driver version to 5.02.00-k8 vikas.chaudhary

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.