[patch] [SCSI] mvsas: fix a sparse annotation

2013-04-17 Thread Dan Carpenter
It doesn't make sense to label a 22 bit bitfield as __le32.  It just
causes a Sparse error.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

diff --git a/drivers/scsi/mvsas/mv_94xx.h b/drivers/scsi/mvsas/mv_94xx.h
index 487aa6f..b11f90d 100644
--- a/drivers/scsi/mvsas/mv_94xx.h
+++ b/drivers/scsi/mvsas/mv_94xx.h
@@ -220,7 +220,7 @@ union reg_phy_cfg {
 
 struct mvs_prd_imt {
 #ifndef __BIG_ENDIAN
-   __le32  len:22;
+   u32 len:22;
u8  _r_a:2;
u8  misc_ctl:4;
u8  inter_sel:4;
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch] [SCSI] libosd: remover duplicate __bitwise annotation

2013-04-17 Thread Dan Carpenter
__be32 is already a __bitwise type so we don't need the second __bitwise
here.  It causes a Sparse error:
include/scsi/osd_protocol.h:110:26: error: invalid modifier

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index a6026da..25ac628 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -107,7 +107,7 @@ enum osd_attributes_mode {
  * int exponent: 04;
  * }
  */
-typedef __be32 __bitwise osd_cdb_offset;
+typedef __be32 osd_cdb_offset;
 
 enum {
OSD_OFFSET_UNUSED = 0x,
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [osd-dev] [patch] [SCSI] libosd: remover duplicate __bitwise annotation

2013-04-17 Thread Benny Halevy
On 2013-04-17 10:19, Dan Carpenter wrote:
 __be32 is already a __bitwise type so we don't need the second __bitwise
 here.  It causes a Sparse error:
 include/scsi/osd_protocol.h:110:26: error: invalid modifier
 
 Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

ACK

 
 diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
 index a6026da..25ac628 100644
 --- a/include/scsi/osd_protocol.h
 +++ b/include/scsi/osd_protocol.h
 @@ -107,7 +107,7 @@ enum osd_attributes_mode {
   *   int exponent: 04;
   *   }
   */
 -typedef __be32 __bitwise osd_cdb_offset;
 +typedef __be32 osd_cdb_offset;
  
  enum {
   OSD_OFFSET_UNUSED = 0x,
 ___
 osd-dev mailing list
 osd-...@open-osd.org
 http://mailman.open-osd.org/mailman/listinfo/osd-dev
 
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] qla4xxx: Updates for scsi misc branch

2013-04-17 Thread vikas . chaudhary
From: Vikas Chaudhary vikas.chaudh...@qlogic.com

James,
 
Please apply the following patches to the scsi tree at your earliest
convenience. 

Adheer Chandravanshi (2):
  qla4xxx: Fix smatch warnings
  qla4xxx: Assign values using correct datatype

Vikas Chaudhary (3):
  qla4xxx: Silence gcc warning
  qla4xxx: Fix sparse warning for qla4xxx_sysfs_ddb_tgt_create
  qla4xxx: Update driver version to 5.03.00-k9

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


[PATCH 1/5] qla4xxx: Silence gcc warning

2013-04-17 Thread vikas . chaudhary
From: Vikas Chaudhary vikas.chaudh...@qlogic.com

Fix followig gcc warning:-
drivers/scsi/qla4xxx/ql4_os.c: In function ‘qla4xxx_sysfs_ddb_get_param’:
drivers/scsi/qla4xxx/ql4_os.c:6279:
warning: comparison is always true due to limited range of data type
drivers/scsi/qla4xxx/ql4_os.c:6290:
warning: comparison is always true due to limited range of data type
drivers/scsi/qla4xxx/ql4_os.c: In function ‘qla4xxx_sysfs_ddb_delete’:
drivers/scsi/qla4xxx/ql4_os.c:6593:
warning: ‘ddb_size’ may be used uninitialized in this function

Signed-off-by: Vikas Chaudhary vikas.chaudh...@qlogic.com
---
 drivers/scsi/qla4xxx/ql4_os.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index a47f999..5479cd3 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -6276,8 +6276,7 @@ qla4xxx_sysfs_ddb_get_param(struct 
iscsi_bus_flash_session *fnode_sess,
rc = sprintf(buf, \n);
break;
case ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX:
-   if ((fnode_sess-discovery_parent_idx) = 0  
-   (fnode_sess-discovery_parent_idx  MAX_DDB_ENTRIES))
+   if (fnode_sess-discovery_parent_idx  MAX_DDB_ENTRIES)
parent_index = fnode_sess-discovery_parent_idx;
 
rc = sprintf(buf, %u\n, parent_index);
@@ -6287,8 +6286,7 @@ qla4xxx_sysfs_ddb_get_param(struct 
iscsi_bus_flash_session *fnode_sess,
parent_type = ISCSI_DISC_PARENT_ISNS;
else if (fnode_sess-discovery_parent_type == DDB_NO_LINK)
parent_type = ISCSI_DISC_PARENT_UNKNOWN;
-   else if (fnode_sess-discovery_parent_type = 0  
-fnode_sess-discovery_parent_type  MAX_DDB_ENTRIES)
+   else if (fnode_sess-discovery_parent_type  MAX_DDB_ENTRIES)
parent_type = ISCSI_DISC_PARENT_SENDTGT;
else
parent_type = ISCSI_DISC_PARENT_UNKNOWN;
@@ -6590,7 +6588,7 @@ static int qla4xxx_sysfs_ddb_delete(struct 
iscsi_bus_flash_session *fnode_sess)
struct dev_db_entry *fw_ddb_entry = NULL;
dma_addr_t fw_ddb_entry_dma;
uint16_t *ddb_cookie = NULL;
-   size_t ddb_size;
+   size_t ddb_size = 0;
void *pddb = NULL;
int target_id;
int rc = 0;
-- 
1.8.2.GIT

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


[PATCH 3/5] qla4xxx: Fix smatch warnings

2013-04-17 Thread vikas . chaudhary
From: Adheer Chandravanshi adheer.chandravan...@qlogic.com

Fix following smatch warnings:-
drivers/scsi/qla4xxx/ql4_os.c:6573
qla4xxx_sysfs_ddb_set_param() warn: possible memory leak of 'fw_ddb_entry'
drivers/scsi/qla4xxx/ql4_os.c:6596
qla4xxx_sysfs_ddb_delete() warn: variable dereferenced before check 'fnode_sess'
(see line 6584)
drivers/scsi/qla4xxx/ql4_os.c:6632
qla4xxx_sysfs_ddb_delete() error: potential NULL dereference 'fw_ddb_entry'.

Signed-off-by: Adheer Chandravanshi adheer.chandravan...@qlogic.com
Signed-off-by: Vikas Chaudhary vikas.chaudh...@qlogic.com
---
 drivers/scsi/qla4xxx/ql4_os.c | 17 +
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 3682fbd..7f13caa 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -6366,20 +6366,11 @@ qla4xxx_sysfs_ddb_set_param(struct 
iscsi_bus_flash_session *fnode_sess,
 {
struct Scsi_Host *shost = iscsi_flash_session_to_shost(fnode_sess);
struct scsi_qla_host *ha = to_qla_host(shost);
-   struct dev_db_entry *fw_ddb_entry = NULL;
struct iscsi_flashnode_param_info *fnode_param;
struct nlattr *attr;
int rc = QLA_ERROR;
uint32_t rem = len;
 
-   fw_ddb_entry = kzalloc(sizeof(*fw_ddb_entry), GFP_KERNEL);
-   if (!fw_ddb_entry) {
-   DEBUG2(ql4_printk(KERN_ERR, ha,
- %s: Unable to allocate ddb buffer\n,
- __func__));
-   return -ENOMEM;
-   }
-
nla_for_each_attr(attr, data, len, rem) {
fnode_param = nla_data(attr);
 
@@ -6593,11 +6584,6 @@ static int qla4xxx_sysfs_ddb_delete(struct 
iscsi_bus_flash_session *fnode_sess)
int target_id;
int rc = 0;
 
-   if (!fnode_sess) {
-   rc = -EINVAL;
-   goto exit_ddb_del;
-   }
-
if (fnode_sess-is_boot_target) {
rc = -EPERM;
DEBUG2(ql4_printk(KERN_ERR, ha,
@@ -6629,8 +6615,7 @@ static int qla4xxx_sysfs_ddb_delete(struct 
iscsi_bus_flash_session *fnode_sess)
 
dev_db_start_offset += (fnode_sess-target_id *
   sizeof(*fw_ddb_entry));
-   dev_db_start_offset += (void *)(fw_ddb_entry-cookie) -
-  (void *)fw_ddb_entry;
+   dev_db_start_offset += offsetof(struct dev_db_entry, cookie);
 
ddb_size = sizeof(*ddb_cookie);
}
-- 
1.8.2.GIT

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


[PATCH 5/5] qla4xxx: Update driver version to 5.03.00-k9

2013-04-17 Thread vikas . chaudhary
From: Vikas Chaudhary vikas.chaudh...@qlogic.com

Signed-off-by: Vikas Chaudhary vikas.chaudh...@qlogic.com
---
 drivers/scsi/qla4xxx/ql4_version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla4xxx/ql4_version.h 
b/drivers/scsi/qla4xxx/ql4_version.h
index 83e0fec..fe873cf 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.03.00-k8
+#define QLA4XXX_DRIVER_VERSION 5.03.00-k9
-- 
1.8.2.GIT

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


[PATCH 4/5] qla4xxx: Assign values using correct datatype

2013-04-17 Thread vikas . chaudhary
From: Adheer Chandravanshi adheer.chandravan...@qlogic.com

Assign values using correct datatype in function qla4xxx_copy_to_fwddb_param()

Signed-off-by: Adheer Chandravanshi adheer.chandravan...@qlogic.com
Signed-off-by: Vikas Chaudhary vikas.chaudh...@qlogic.com
---
 drivers/scsi/qla4xxx/ql4_os.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 7f13caa..d777332 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -2216,14 +2216,14 @@ static int qla4xxx_copy_to_fwddb_param(struct 
iscsi_bus_flash_session *sess,
fw_ddb_entry-iscsi_def_time2retain = cpu_to_le16(sess-time2retain);
fw_ddb_entry-tgt_portal_grp = cpu_to_le16(sess-tpgt);
fw_ddb_entry-mss = cpu_to_le16(conn-max_segment_size);
-   fw_ddb_entry-tcp_xmt_wsf = cpu_to_le16(conn-tcp_xmit_wsf);
-   fw_ddb_entry-tcp_rcv_wsf = cpu_to_le16(conn-tcp_recv_wsf);
+   fw_ddb_entry-tcp_xmt_wsf = (uint8_t) cpu_to_le32(conn-tcp_xmit_wsf);
+   fw_ddb_entry-tcp_rcv_wsf = (uint8_t) cpu_to_le32(conn-tcp_recv_wsf);
fw_ddb_entry-ipv4_tos = conn-ipv4_tos;
fw_ddb_entry-ipv6_flow_lbl = cpu_to_le16(conn-ipv6_flow_label);
fw_ddb_entry-ka_timeout = cpu_to_le16(conn-keepalive_timeout);
fw_ddb_entry-lcl_port = cpu_to_le16(conn-local_port);
-   fw_ddb_entry-stat_sn = cpu_to_le16(conn-statsn);
-   fw_ddb_entry-exp_stat_sn = cpu_to_le16(conn-exp_statsn);
+   fw_ddb_entry-stat_sn = cpu_to_le32(conn-statsn);
+   fw_ddb_entry-exp_stat_sn = cpu_to_le32(conn-exp_statsn);
fw_ddb_entry-ddb_link = cpu_to_le16(sess-discovery_parent_type);
fw_ddb_entry-chap_tbl_idx = cpu_to_le16(sess-chap_out_idx);
fw_ddb_entry-tsid = cpu_to_le16(sess-tsid);
-- 
1.8.2.GIT

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


[PATCH 2/5] qla4xxx: Fix sparse warning for qla4xxx_sysfs_ddb_tgt_create

2013-04-17 Thread vikas . chaudhary
From: Vikas Chaudhary vikas.chaudh...@qlogic.com

Fix following warning:
drivers/scsi/qla4xxx/ql4_os.c:5507:5:
warning: symbol 'qla4xxx_sysfs_ddb_tgt_create' was not declared. Should it be
static?

Signed-off-by: Vikas Chaudhary vikas.chaudh...@qlogic.com
---
 drivers/scsi/qla4xxx/ql4_os.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 5479cd3..3682fbd 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -5504,9 +5504,9 @@ static int qla4xxx_sysfs_ddb_is_non_persistent(struct 
device *dev, void *data)
  * If this is invoked as a result of a userspace call then the entry is marked
  * as nonpersistent using flash_state field.
  **/
-int qla4xxx_sysfs_ddb_tgt_create(struct scsi_qla_host *ha,
-struct dev_db_entry *fw_ddb_entry,
-uint16_t *idx, int user)
+static int qla4xxx_sysfs_ddb_tgt_create(struct scsi_qla_host *ha,
+   struct dev_db_entry *fw_ddb_entry,
+   uint16_t *idx, int user)
 {
struct iscsi_bus_flash_session *fnode_sess = NULL;
struct iscsi_bus_flash_conn *fnode_conn = NULL;
-- 
1.8.2.GIT

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


PING^4 aka The Jon Corbet Effect Re: [PATCH v2 00/14] Corrections and customization of the SG_IO command whitelist (CVE-2012-4542)

2013-04-17 Thread Paolo Bonzini
And a fourth ping comes...

Jon, the next time I read it seems likely to be picked up fairly soon
(http://lwn.net/Articles/535075/), I'll picture the author of the patch
attempting open-heart surgery on a long-red-haired voodoo doll!

Paolo

Il 04/04/2013 20:18, Paolo Bonzini ha scritto:
 Il 22/03/2013 23:30, Paolo Bonzini ha scritto:
 Il 20/02/2013 17:12, Paolo Bonzini ha scritto:
 Il 06/02/2013 16:15, Paolo Bonzini ha scritto:
 This series regards the whitelist that is used for the SG_IO ioctl.  This
 whitelist has three problems:

 * the bitmap of allowed commands is designed for MMC devices (roughly,
   play/burn CDs without requiring root) but some opcodes overlap across 
 SCSI
   device classes and have different meanings for different classes.

 * also because the bitmap of allowed commands is designed for MMC devices
   only, some commands are missing even though they are generally useful and
   not insecure.  At least not more insecure than anything else you can
   do if you have access to /dev/sdX or /dev/stX nodes.

 * the whitelist can be disabled per-process but not per-disk.  In addition,
   the required capability (CAP_SYS_RAWIO) gives access to a range of other 
   resources, enough to make it insecure.

 The series corrects these problems.  Patches 1-4 solve the first problem,
 which also has an assigned CVE, by using different bitmaps for the various
 device classes.  Patches 5-11 solve the second by adding more commands
 to the bitmaps.  Patches 12 and 13 solve the third, and were already
 posted but ignored by the maintainers despite multiple pings.

 Note: checkpatch hates the formatting of the command table.  I know about 
 this,
 and ensured that there are no errors in the rest of the code.  The current
 formatting is IMHO quite handy, and roughly based on the files available
 from the SCSI standard body.

 Ok for the next merge window?

 Paolo

 v1-v2: remove 2 MMC commands and 6 SBC commands (see patches 6 and 9
 for details).  Added patch 14 and added a few more scanner
 commands based on SANE (scanners are not whitelisted by default,
 also were not in v1, but this makes it possible to opt into the
 whitelist out of paranoia).  Removed C++ comments.  Removed the
 large #if 0'd list of commands that the kernel does not pass
 though.  Marked blk_set_cmd_filter_defaults as __init.

 Ping...

 Jens/James, is anyone going to pick this up for 3.9?

 Another month has passed, Ping^2...
 
 Ping^3, any hope for 3.10?
 
 Paolo
 

 Paolo

 Paolo


 Paolo Bonzini (14):
   sg_io: pass request_queue to blk_verify_command
   sg_io: reorganize list of allowed commands
   sg_io: use different default filters for each device class
   sg_io: resolve conflicts between commands assigned to multiple
 classes (CVE-2012-4542)
   sg_io: whitelist a few more commands for rare  obsolete device types
   sg_io: whitelist another command for multimedia devices
   sg_io: whitelist a few more commands for media changers
   sg_io: whitelist a few more commands for tapes
   sg_io: whitelist a few more commands for disks
   sg_io: whitelist a few obsolete commands
   sg_io: mark blk_set_cmd_filter_defaults as __init
   sg_io: remove remnants of sysfs SG_IO filters
   sg_io: introduce unpriv_sgio queue flag
   sg_io: use unpriv_sgio to disable whitelisting for scanners

  Documentation/block/queue-sysfs.txt |8 +
  block/blk-sysfs.c   |   33 +++
  block/bsg.c |2 +-
  block/scsi_ioctl.c  |  369 
 ++-
  drivers/scsi/scsi_scan.c|   14 ++-
  drivers/scsi/sg.c   |6 +-
  include/linux/blkdev.h  |8 +-
  include/linux/genhd.h   |9 -
  include/scsi/scsi.h |3 +
  9 files changed, 344 insertions(+), 108 deletions(-)



 

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


[PATCH 1/1] ipr: Need to reset adapter after the 6th EEH error

2013-04-17 Thread wenxiong
Add reset adapter after the 6th EEH errors in ipr driver. This triggers
the adapter reset via the PCI config space even when the slot is frozen.

Signed-off-by: Wen Xiong wenxi...@linux.vnet.ibm.com
---
 drivers/scsi/ipr.c |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Index: b/drivers/scsi/ipr.c
===
--- a/drivers/scsi/ipr.c2013-04-15 13:43:29.0 -0500
+++ b/drivers/scsi/ipr.c2013-04-16 14:16:42.727859429 -0500
@@ -4777,7 +4777,7 @@ static int ipr_eh_host_reset(struct scsi
ioa_cfg = (struct ipr_ioa_cfg *) cmd-device-host-hostdata;
spin_lock_irqsave(ioa_cfg-host-host_lock, lock_flags);
 
-   if (!ioa_cfg-in_reset_reload) {
+   if (!ioa_cfg-in_reset_reload  
!ioa_cfg-hrrq[IPR_INIT_HRRQ].ioa_is_dead) {
ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_ABBREV);
dev_err(ioa_cfg-pdev-dev,
Adapter being reset as a result of error recovery.\n);
@@ -6739,6 +6739,7 @@ static int ipr_invalid_adapter(struct ip
 static int ipr_ioa_bringdown_done(struct ipr_cmnd *ipr_cmd)
 {
struct ipr_ioa_cfg *ioa_cfg = ipr_cmd-ioa_cfg;
+   int i;
 
ENTER;
if (!ioa_cfg-hrrq[IPR_INIT_HRRQ].removing_ioa) {
@@ -6750,6 +6751,13 @@ static int ipr_ioa_bringdown_done(struct
 
ioa_cfg-in_reset_reload = 0;
ioa_cfg-reset_retries = 0;
+   for (i = 0; i  ioa_cfg-hrrq_num; i++) {
+   spin_lock(ioa_cfg-hrrq[i]._lock);
+   ioa_cfg-hrrq[i].ioa_is_dead = 1;
+   spin_unlock(ioa_cfg-hrrq[i]._lock);
+   }
+   wmb();
+
list_add_tail(ipr_cmd-queue, ipr_cmd-hrrq-hrrq_free_q);
wake_up_all(ioa_cfg-reset_wait_q);
LEAVE;
@@ -8651,7 +8659,7 @@ static void ipr_pci_perm_failure(struct 
spin_lock_irqsave(ioa_cfg-host-host_lock, flags);
if (ioa_cfg-sdt_state == WAIT_FOR_DUMP)
ioa_cfg-sdt_state = ABORT_DUMP;
-   ioa_cfg-reset_retries = IPR_NUM_RESET_RELOAD_RETRIES;
+   ioa_cfg-reset_retries = IPR_NUM_RESET_RELOAD_RETRIES - 1;
ioa_cfg-in_ioa_bringdown = 1;
for (i = 0; i  ioa_cfg-hrrq_num; i++) {
spin_lock(ioa_cfg-hrrq[i]._lock);

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


[PATCH 0/1] ipr: Need to reset adapter after the 6th EEH error

2013-04-17 Thread wenxiong
After errinjct the 6th EEH error on adapter, disk configuration 
not restore. This patch fixes ths issue.

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


Re: [PATCH 1/1] ipr: Need to reset adapter after the 6th EEH error

2013-04-17 Thread Brian King
Acked-by: Brian King brk...@linux.vnet.ibm.com


-- 
Brian King
Power Linux I/O
IBM Linux Technology Center


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


Re: [PATCH 4/4] Simple correctness and speed test for CRCT10DIF hash

2013-04-17 Thread Jussi Kivilinna
On 16.04.2013 19:20, Tim Chen wrote:
 These are simple tests to do sanity check of CRC T10 DIF hash.  The
 correctness of the transform can be checked with the command
   modprobe tcrypt mode=47
 The speed of the transform can be evaluated with the command
   modprobe tcrypt mode=320
 
 Set the cpu frequency to constant and turn turbo off when running the
 speed test so the frequency governor will not tweak the frequency and
 affects the measurements.
 
 Signed-off-by: Tim Chen tim.c.c...@linux.intel.com
 Tested-by: Keith Busch keith.bu...@intel.com
snip
  
 +#define CRCT10DIF_TEST_VECTORS   2
 +static struct hash_testvec crct10dif_tv_template[] = {
 + {
 + .plaintext = abc,
 + .psize  = 3,
 +#ifdef __LITTLE_ENDIAN
 + .digest = \x3b\x44,
 +#else
 + .digest = \x44\x3b,
 +#endif
 + }, {
 + .plaintext =
 + abcd,
 + .psize  = 56,
 +#ifdef __LITTLE_ENDIAN
 + .digest = \xe3\x9c,
 +#else
 + .digest = \x9c\xe3,
 +#endif
 + .np = 2,
 + .tap= { 28, 28 }
 + }
 +};
 +

Are these large enough to test all code paths in the PCLMULQDQ implementation?

-Jussi

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


Re: [PATCH 4/4] Simple correctness and speed test for CRCT10DIF hash

2013-04-17 Thread Tim Chen
On Wed, 2013-04-17 at 20:58 +0300, Jussi Kivilinna wrote:
 On 16.04.2013 19:20, Tim Chen wrote:
  These are simple tests to do sanity check of CRC T10 DIF hash.  The
  correctness of the transform can be checked with the command
  modprobe tcrypt mode=47
  The speed of the transform can be evaluated with the command
  modprobe tcrypt mode=320
  
  Set the cpu frequency to constant and turn turbo off when running the
  speed test so the frequency governor will not tweak the frequency and
  affects the measurements.
  
  Signed-off-by: Tim Chen tim.c.c...@linux.intel.com
  Tested-by: Keith Busch keith.bu...@intel.com
 snip
   
  +#define CRCT10DIF_TEST_VECTORS 2
  +static struct hash_testvec crct10dif_tv_template[] = {
  +   {
  +   .plaintext = abc,
  +   .psize  = 3,
  +#ifdef __LITTLE_ENDIAN
  +   .digest = \x3b\x44,
  +#else
  +   .digest = \x44\x3b,
  +#endif
  +   }, {
  +   .plaintext =
  +   abcd,
  +   .psize  = 56,
  +#ifdef __LITTLE_ENDIAN
  +   .digest = \xe3\x9c,
  +#else
  +   .digest = \x9c\xe3,
  +#endif
  +   .np = 2,
  +   .tap= { 28, 28 }
  +   }
  +};
  +
 
 Are these large enough to test all code paths in the PCLMULQDQ implementation?

We have tested the implementation exhaustively for large number of code paths.
The tcrypt tests here are only meant for sanity check, and not for
exhaustive tests.

Tim


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


Re: [PATCH 2/4] Accelerated CRC T10 DIF computation with PCLMULQDQ instruction

2013-04-17 Thread Tim Chen
On Wed, 2013-04-17 at 20:58 +0300, Jussi Kivilinna wrote:
 On 16.04.2013 19:20, Tim Chen wrote:
  This is the x86_64 CRC T10 DIF transform accelerated with the PCLMULQDQ
  instructions.  Details discussing the implementation can be found in the
  paper:
  
  Fast CRC Computation for Generic Polynomials Using PCLMULQDQ Instruction
  URL: http://download.intel.com/design/intarch/papers/323102.pdf
 
 URL does not work.

Thanks for catching this. Will update.

 
  
  Signed-off-by: Tim Chen tim.c.c...@linux.intel.com
  Tested-by: Keith Busch keith.bu...@intel.com
  ---
   arch/x86/crypto/crct10dif-pcl-asm_64.S | 659 
  +
   1 file changed, 659 insertions(+)
   create mode 100644 arch/x86/crypto/crct10dif-pcl-asm_64.S
 snip
  +
  +   # Allocate Stack Space
  +   mov %rsp, %rcx
  +   sub $16*10, %rsp
  +   and $~(0x20 - 1), %rsp
  +
  +   # push the xmm registers into the stack to maintain
  +   movdqa %xmm10, 16*2(%rsp)
  +   movdqa %xmm11, 16*3(%rsp)
  +   movdqa %xmm8 , 16*4(%rsp)
  +   movdqa %xmm12, 16*5(%rsp)
  +   movdqa %xmm13, 16*6(%rsp)
  +   movdqa %xmm6,  16*7(%rsp)
  +   movdqa %xmm7,  16*8(%rsp)
  +   movdqa %xmm9,  16*9(%rsp)
 
 You don't need to store (and restore) these, as 'crc_t10dif_pcl' is called 
 between kernel_fpu_begin/_end.

That's true.  Will skip the xmm save/restore in update to the patch.

 
  +
  +
  +   # check if smaller than 256
  +   cmp $256, arg3
  +
 snip
  +_cleanup:
  +   # scale the result back to 16 bits
  +   shr $16, %eax
  +   movdqa  16*2(%rsp), %xmm10
  +   movdqa  16*3(%rsp), %xmm11
  +   movdqa  16*4(%rsp), %xmm8
  +   movdqa  16*5(%rsp), %xmm12
  +   movdqa  16*6(%rsp), %xmm13
  +   movdqa  16*7(%rsp), %xmm6
  +   movdqa  16*8(%rsp), %xmm7
  +   movdqa  16*9(%rsp), %xmm9
 
 Registers are overwritten by kernel_fpu_end.
 
  +   mov %rcx, %rsp
  +   ret
  +ENDPROC(crc_t10dif_pcl)
  +
 
 You should move ENDPROC at end of the full function.
 
  +
  +
  +.align 16
  +_less_than_128:
  +
  +   # check if there is enough buffer to be able to fold 16B at a time
  +   cmp $32, arg3
 snip
  +   movdqa  (%rsp), %xmm7
  +   pshufb  %xmm11, %xmm7
  +   pxor%xmm0 , %xmm7   # xor the initial crc value
  +
  +   psrldq  $7, %xmm7
  +
  +   jmp _barrett
 
 Move ENDPROC here.
 

Will do.

Tim



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


Re: [Patch 1/1] cciss: bug fix, prevent cciss from loading in kdump kernel

2013-04-17 Thread Andrew Morton
On Mon, 15 Apr 2013 12:59:06 -0500 Mike Miller mike.mil...@hp.com wrote:

 Patch 1/1
 
 If hpsa is selected as the Smart Array driver cciss may try to load in the
 kdump kernel. When this happens kdump fails and a core file cannot be created.
 This patch prevents cciss from trying to load in this scenario. This effects
 primarily older Smart Array controllers.
 
 ...

 --- a/drivers/block/cciss.c
 +++ b/drivers/block/cciss.c
 @@ -4960,6 +4960,12 @@ static int cciss_init_one(struct pci_dev *pdev, const 
 struct pci_device_id *ent)
   ctlr_info_t *h;
   unsigned long flags;
  
 + /*
 +  * if this is the kdump kernel and the user has set the flags to
 +  * use hpsa rather than cciss just bail
 +  */
 + if ((reset_devices)  (cciss_allow_hpsa == 1))
 + return -ENODEV;

OK, wazzup.  That's the only occurrence of the symbol
cciss_allow_hpsa in Linux and needless to say, the compiler laughed
at me.

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


[PATCH v2 0/4] Patchset to use PCLMULQDQ to accelerate CRC-T10DIF checksum computation

2013-04-17 Thread Tim Chen
Currently the CRC-T10DIF checksum is computed using a generic table lookup
algorithm.  By switching the checksum to PCLMULQDQ based computation,
we can speedup the computation by 8x for checksumming 512 bytes and
even more for larger buffer size.  This will improve performance of SCSI
drivers turning on the CRC-T10IDF checksum.  In our SSD based experiments,
we have seen increase disk throughput by 3.5x with T10DIF for 512 byte
block size.

This patch set provides the x86_64 routine using PCLMULQDQ instruction
and switches the crc_t10dif library function to use the faster PCLMULQDQ
based routine when available.

Tim

v1-v2
1. Get rid of unnecessary xmm registers save and restore and fix ENDPROC
position in PCLMULQDQ version of crc t10dif computation.
2. Fix URL to paper reference of CRC computation with PCLMULQDQ. 
3. Add one additional tcrypt test case to exercise more code paths through 
crc t10dif computation.
4. Fix config dependencies of CRYPTO_CRCT10DIF.

Thanks to Matthew and Jussi who reviewed the patches and Keith
for testing version 1 of the patch set.  

Tim Chen (4):
  Wrap crc_t10dif function all to use crypto transform framework
  Accelerated CRC T10 DIF computation with PCLMULQDQ instruction
  Glue code to cast accelerated CRCT10DIF assembly as a crypto
transform
  Simple correctness and speed test for CRCT10DIF hash

 arch/x86/crypto/Makefile|   2 +
 arch/x86/crypto/crct10dif-pcl-asm_64.S  | 643 
 arch/x86/crypto/crct10dif-pclmul_glue.c | 153 
 crypto/Kconfig  |  21 ++
 crypto/tcrypt.c |   8 +
 crypto/testmgr.c|  10 +
 crypto/testmgr.h|  33 ++
 include/linux/crc-t10dif.h  |  10 +
 lib/crc-t10dif.c|  96 +
 9 files changed, 976 insertions(+)
 create mode 100644 arch/x86/crypto/crct10dif-pcl-asm_64.S
 create mode 100644 arch/x86/crypto/crct10dif-pclmul_glue.c

-- 
1.7.11.7

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


[PATCH v2 1/4] Wrap crc_t10dif function all to use crypto transform framework

2013-04-17 Thread Tim Chen
When CRC T10 DIF is calculated using the crypto transform framework, we
wrap the crc_t10dif function call to utilize it.  This allows us to
take advantage of any accelerated CRC T10 DIF transform that is
plugged into the crypto framework.

Signed-off-by: Tim Chen tim.c.c...@linux.intel.com
---
 include/linux/crc-t10dif.h | 10 +
 lib/crc-t10dif.c   | 96 ++
 2 files changed, 106 insertions(+)

diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h
index a9c96d8..f0eb4d5 100644
--- a/include/linux/crc-t10dif.h
+++ b/include/linux/crc-t10dif.h
@@ -3,6 +3,16 @@
 
 #include linux/types.h
 
+#ifdef CONFIG_CRYPTO_CRCT10DIF
+
+#define CRC_T10DIF_DIGEST_SIZE 2
+#define CRC_T10DIF_BLOCK_SIZE 1
+
+__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len);
+void crc_t10dif_update_lib(void);
+
+#endif /* CONFIG_CRYPTO_CRCT10DIF */
+
 __u16 crc_t10dif(unsigned char const *, size_t);
 
 #endif
diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c
index fbbd66e..41f469a 100644
--- a/lib/crc-t10dif.c
+++ b/lib/crc-t10dif.c
@@ -11,6 +11,9 @@
 #include linux/types.h
 #include linux/module.h
 #include linux/crc-t10dif.h
+#include linux/err.h
+#include linux/init.h
+#include crypto/hash.h
 
 /* Table generated using the following polynomium:
  * x^16 + x^15 + x^11 + x^9 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1
@@ -51,6 +54,98 @@ static const __u16 t10_dif_crc_table[256] = {
0xF0D8, 0x7B6F, 0x6C01, 0xE7B6, 0x42DD, 0xC96A, 0xDE04, 0x55B3
 };
 
+#ifdef CONFIG_CRYPTO_CRCT10DIF
+
+static struct crypto_shash *crct10dif_tfm;
+
+/* flag to indicate update to new algorithm in progress*/
+static bool crc_t10dif_newalg;
+
+__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len)
+{
+   unsigned int i;
+
+   for (i = 0 ; i  len ; i++)
+   crc = (crc  8) ^ t10_dif_crc_table[((crc  8) ^ buffer[i])  
0xff];
+
+   return crc;
+}
+EXPORT_SYMBOL(crc_t10dif_generic);
+
+/*
+ * If we have defined crypto transform for CRC-T10DIF, use that instead.
+ * This allows us to plug in fast version of CRC-T10DIF when available.
+ */
+
+void crc_t10dif_update_lib()
+{
+   struct crypto_shash *old_tfm, *new_tfm;
+
+   old_tfm = crct10dif_tfm;
+   crc_t10dif_newalg = true;
+   /* make sure new alg flag is turned on before starting to switch tfm */
+   mb();
+
+   new_tfm = crypto_alloc_shash(crct10dif, 0, 0);
+   if (IS_ERR(new_tfm))
+   goto done;
+
+   if (old_tfm)
+   if (crypto_tfm_alg_priority(old_tfm-base) =
+   crypto_tfm_alg_priority(new_tfm-base)) {
+   crypto_free_shash(new_tfm);
+   goto done;
+   }
+   crct10dif_tfm = new_tfm;
+   /* make sure update to tfm pointer is completed */
+   mb();
+   crypto_free_shash(old_tfm);
+
+done:
+   crc_t10dif_newalg = false;
+}
+EXPORT_SYMBOL(crc_t10dif_update_lib);
+
+__u16 crc_t10dif(const unsigned char *buffer, size_t len)
+{
+   struct {
+   struct shash_desc shash;
+   char ctx[2];
+   } desc;
+   int err;
+
+   /* plugging in new alg or not using a tfm? */
+   if (unlikely(crc_t10dif_newalg) || (!crct10dif_tfm))
+   return crc_t10dif_generic(0, buffer, len);
+
+   desc.shash.tfm = crct10dif_tfm;
+   desc.shash.flags = 0;
+   *(__u16 *)desc.ctx = 0;
+
+   err = crypto_shash_update(desc.shash, buffer, len);
+   BUG_ON(err);
+
+   return *(__u16 *)desc.ctx;
+}
+EXPORT_SYMBOL(crc_t10dif);
+
+static int __init crc_t10dif_mod_init(void)
+{
+   crct10dif_tfm = NULL;
+   crc_t10dif_newalg = false;
+   return 0;
+}
+
+static void __exit crc_t10dif_mod_fini(void)
+{
+   if (crct10dif_tfm)
+   crypto_free_shash(crct10dif_tfm);
+}
+
+module_init(crc_t10dif_mod_init);
+module_exit(crc_t10dif_mod_fini);
+
+#else
 __u16 crc_t10dif(const unsigned char *buffer, size_t len)
 {
__u16 crc = 0;
@@ -62,6 +157,7 @@ __u16 crc_t10dif(const unsigned char *buffer, size_t len)
return crc;
 }
 EXPORT_SYMBOL(crc_t10dif);
+#endif
 
 MODULE_DESCRIPTION(T10 DIF CRC calculation);
 MODULE_LICENSE(GPL);
-- 
1.7.11.7

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


[PATCH v2 3/4] Glue code to cast accelerated CRCT10DIF assembly as a crypto transform

2013-04-17 Thread Tim Chen
Glue code that plugs the PCLMULQDQ accelerated CRC T10 DIF hash into the
crypto framework.  The config CRYPTO_CRCT10DIF_PCLMUL should be turned
on to enable the feature.  The crc_t10dif crypto library function will
use this faster algorithm when crct10dif_pclmul module is loaded.

Signed-off-by: Tim Chen tim.c.c...@linux.intel.com
---
 arch/x86/crypto/Makefile|   2 +
 arch/x86/crypto/crct10dif-pclmul_glue.c | 153 
 crypto/Kconfig  |  21 +
 3 files changed, 176 insertions(+)
 create mode 100644 arch/x86/crypto/crct10dif-pclmul_glue.c

diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index 03cd731..d544a66 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o
 obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o
 obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o
 obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o
+obj-$(CONFIG_CRYPTO_CRCT10DIF_PCLMUL) += crct10dif-pclmul.o
 
 # These modules require assembler to support AVX.
 ifeq ($(avx_supported),yes)
@@ -70,3 +71,4 @@ crc32c-intel-$(CONFIG_64BIT) += crc32c-pcl-intel-asm_64.o
 crc32-pclmul-y := crc32-pclmul_asm.o crc32-pclmul_glue.o
 sha256-ssse3-y := sha256-ssse3-asm.o sha256-avx-asm.o sha256-avx2-asm.o 
sha256_ssse3_glue.o
 sha512-ssse3-y := sha512-ssse3-asm.o sha512-avx-asm.o sha512-avx2-asm.o 
sha512_ssse3_glue.o
+crct10dif-pclmul-y := crct10dif-pcl-asm_64.o crct10dif-pclmul_glue.o
diff --git a/arch/x86/crypto/crct10dif-pclmul_glue.c 
b/arch/x86/crypto/crct10dif-pclmul_glue.c
new file mode 100644
index 000..e87f8d8
--- /dev/null
+++ b/arch/x86/crypto/crct10dif-pclmul_glue.c
@@ -0,0 +1,153 @@
+/*
+ * Cryptographic API.
+ *
+ * T10 Data Integrity Field CRC16 Crypto Xform using PCLMULQDQ Instructions
+ *
+ * Copyright (C) 2013 Intel Corporation
+ * Author: Tim Chen tim.c.c...@linux.intel.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 of the License, or (at your option)
+ * any later version.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#include linux/types.h
+#include linux/module.h
+#include linux/crc-t10dif.h
+#include crypto/internal/hash.h
+#include linux/init.h
+#include linux/string.h
+#include linux/kernel.h
+#include asm/i387.h
+#include asm/cpufeature.h
+
+asmlinkage __u16 crc_t10dif_pcl(__u16 crc, const unsigned char *buf,
+   size_t len);
+
+struct chksum_desc_ctx {
+   __u16 crc;
+};
+
+/*
+ * Steps through buffer one byte at at time, calculates reflected
+ * crc using table.
+ */
+
+static int chksum_init(struct shash_desc *desc)
+{
+   struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
+
+   ctx-crc = 0;
+
+   return 0;
+}
+
+static int chksum_update(struct shash_desc *desc, const u8 *data,
+unsigned int length)
+{
+   struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
+
+   if (irq_fpu_usable()) {
+   kernel_fpu_begin();
+   ctx-crc = crc_t10dif_pcl(ctx-crc, data, length);
+   kernel_fpu_end();
+   } else
+   ctx-crc = crc_t10dif_generic(ctx-crc, data, length);
+   return 0;
+}
+
+static int chksum_final(struct shash_desc *desc, u8 *out)
+{
+   struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
+
+   *(__u16 *)out = ctx-crc;
+   return 0;
+}
+
+static int __chksum_finup(__u16 *crcp, const u8 *data, unsigned int len,
+   u8 *out)
+{
+   if (irq_fpu_usable()) {
+   kernel_fpu_begin();
+   *(__u16 *)out = crc_t10dif_pcl(*crcp, data, len);
+   kernel_fpu_end();
+   } else
+   *(__u16 *)out = crc_t10dif_generic(*crcp, data, len);
+   return 0;
+}
+
+static int chksum_finup(struct shash_desc *desc, const u8 *data,
+   unsigned int len, u8 *out)
+{
+   struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
+
+   return __chksum_finup(ctx-crc, data, len, out);
+}
+
+static int chksum_digest(struct shash_desc *desc, const u8 *data,
+unsigned int length, u8 *out)
+{
+   struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
+
+   return __chksum_finup(ctx-crc, data, length, out);
+}
+
+static struct shash_alg alg = {
+   .digestsize =   CRC_T10DIF_DIGEST_SIZE,
+   

[PATCH v2 2/4] Accelerated CRC T10 DIF computation with PCLMULQDQ instruction

2013-04-17 Thread Tim Chen
This is the x86_64 CRC T10 DIF transform accelerated with the PCLMULQDQ
instructions.  Details discussing the implementation can be found in the
paper:

Fast CRC Computation for Generic Polynomials Using PCLMULQDQ Instruction
http://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf

Signed-off-by: Tim Chen tim.c.c...@linux.intel.com
---
 arch/x86/crypto/crct10dif-pcl-asm_64.S | 643 +
 1 file changed, 643 insertions(+)
 create mode 100644 arch/x86/crypto/crct10dif-pcl-asm_64.S

diff --git a/arch/x86/crypto/crct10dif-pcl-asm_64.S 
b/arch/x86/crypto/crct10dif-pcl-asm_64.S
new file mode 100644
index 000..35e9756
--- /dev/null
+++ b/arch/x86/crypto/crct10dif-pcl-asm_64.S
@@ -0,0 +1,643 @@
+
+# Implement fast CRC-T10DIF computation with SSE and PCLMULQDQ instructions
+#
+# Copyright (c) 2013, Intel Corporation
+#
+# Authors:
+# Erdinc Ozturk erdinc.ozt...@intel.com
+# Vinodh Gopal vinodh.go...@intel.com
+# James Guilford james.guilf...@intel.com
+# Tim Chen tim.c.c...@linux.intel.com
+#
+# This software is available to you under a choice of one of two
+# licenses.  You may choose to be licensed under the terms of the GNU
+# General Public License (GPL) Version 2, available from the file
+# COPYING in the main directory of this source tree, or the
+# OpenIB.org BSD license below:
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the
+#   distribution.
+#
+# * Neither the name of the Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived from
+#   this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY INTEL 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 INTEL CORPORATION OR
+# CONTRIBUTORS 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.
+
+#   Function API:
+#   UINT16 crc_t10dif_pcl(
+#   UINT16 init_crc, //initial CRC value, 16 bits
+#   const unsigned char *buf, //buffer pointer to calculate CRC on
+#   UINT64 len //buffer length in bytes (64-bit data)
+#   );
+#
+#   Reference paper titled Fast CRC Computation for Generic
+#  Polynomials Using PCLMULQDQ Instruction
+#   URL: http://www.intel.com/content/dam/www/public/us/en/documents
+#  /white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf
+#
+#
+
+#include linux/linkage.h
+
+.text
+
+#definearg1 %rdi
+#definearg2 %rsi
+#definearg3 %rdx
+
+#definearg1_low32 %edi
+
+ENTRY(crc_t10dif_pcl)
+.align 16
+
+   # adjust the 16-bit initial_crc value, scale it to 32 bits
+   shl $16, arg1_low32
+
+   # Allocate Stack Space
+   mov %rsp, %rcx
+   sub $16*2, %rsp
+   # align stack to 16 byte boundary
+   and $~(0x10 - 1), %rsp
+
+   # check if smaller than 256
+   cmp $256, arg3
+
+   # for sizes less than 128, we can't fold 64B at a time...
+   jl  _less_than_128
+
+
+   # load the initial crc value
+   movdarg1_low32, %xmm10  # initial crc
+
+   # crc value does not need to be byte-reflected, but it needs
+   # to be moved to the high part of the register.
+   # because data will be byte-reflected and will align with
+   # initial crc at correct place.
+   pslldq  $12, %xmm10
+
+   movdqa  SHUF_MASK(%rip), %xmm11
+   # receive the initial 64B data, xor the initial crc value
+   movdqu  16*0(arg2), %xmm0
+   movdqu  16*1(arg2), %xmm1
+   movdqu  16*2(arg2), %xmm2
+   movdqu  16*3(arg2), %xmm3
+   movdqu  16*4(arg2), %xmm4
+   movdqu  16*5(arg2), %xmm5
+   movdqu  16*6(arg2), %xmm6
+   movdqu  16*7(arg2), %xmm7
+
+   pshufb  %xmm11, 

[PATCH v2 4/4] Simple correctness and speed test for CRCT10DIF hash

2013-04-17 Thread Tim Chen
These are simple tests to do sanity check of CRC T10 DIF hash.  The
correctness of the transform can be checked with the command
modprobe tcrypt mode=47
The speed of the transform can be evaluated with the command
modprobe tcrypt mode=320

Set the cpu frequency to constant and turn turbo off when running the
speed test so the frequency governor will not tweak the frequency and
affects the measurements.

Signed-off-by: Tim Chen tim.c.c...@linux.intel.com
---
 crypto/tcrypt.c  |  8 
 crypto/testmgr.c | 10 ++
 crypto/testmgr.h | 33 +
 3 files changed, 51 insertions(+)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 24ea7df..5e95722 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -1174,6 +1174,10 @@ static int do_test(int m)
ret += tcrypt_test(ghash);
break;
 
+   case 47:
+   ret += tcrypt_test(crct10dif);
+   break;
+
case 100:
ret += tcrypt_test(hmac(md5));
break;
@@ -1498,6 +1502,10 @@ static int do_test(int m)
test_hash_speed(crc32c, sec, generic_hash_speed_template);
if (mode  300  mode  400) break;
 
+   case 320:
+   test_hash_speed(crct10dif, sec, generic_hash_speed_template);
+   if (mode  300  mode  400) break;
+
case 399:
break;
 
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 3807084..b165316 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1944,6 +1944,16 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = crct10dif,
+   .test = alg_test_hash,
+   .fips_allowed = 1,
+   .suite = {
+   .hash = {
+   .vecs = crct10dif_tv_template,
+   .count = CRCT10DIF_TEST_VECTORS
+   }
+   }
+   }, {
.alg = cryptd(__driver-cbc-aes-aesni),
.test = alg_test_null,
.fips_allowed = 1,
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index d503660..56916d0 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -450,6 +450,39 @@ static struct hash_testvec rmd320_tv_template[] = {
}
 };
 
+#define CRCT10DIF_TEST_VECTORS 3
+static struct hash_testvec crct10dif_tv_template[] = {
+   {
+   .plaintext = abc,
+   .psize  = 3,
+#ifdef __LITTLE_ENDIAN
+   .digest = \x3b\x44,
+#else
+   .digest = \x44\x3b,
+#endif
+   }, {
+   .plaintext = 1234567890123456789012345678901234567890
+123456789012345678901234567890123456789,
+   .psize  = 79,
+#ifdef __LITTLE_ENDIAN
+   .digest = \x70\x4b,
+#else
+   .digest = \x4b\x70,
+#endif
+   }, {
+   .plaintext =
+   abcd,
+   .psize  = 56,
+#ifdef __LITTLE_ENDIAN
+   .digest = \xe3\x9c,
+#else
+   .digest = \x9c\xe3,
+#endif
+   .np = 2,
+   .tap= { 28, 28 }
+   }
+};
+
 /*
  * SHA1 test vectors  from from FIPS PUB 180-1
  * Long vector from CAVS 5.0
-- 
1.7.11.7

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


[PATCH] [SCSI] mvumi: fix error return code in mvumi_io_attach()

2013-04-17 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn

Fix to return a negative error code from the error handling
case instead of 0, as returned elsewhere in this function.

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
---
 drivers/scsi/mvumi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 4594cca..c347374 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -2480,6 +2480,7 @@ static int mvumi_io_attach(struct mvumi_hba *mhba)
dev_err(mhba-pdev-dev,
failed to create device scan thread\n);
mutex_unlock(mhba-sas_discovery_mutex);
+   ret = PTR_ERR(mhba-dm_thread);
goto fail_create_thread;
}
atomic_set(mhba-pnp_count, 1);

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


[PATCH 0/22] lpfc 8.3.39: Update lpfc to revision 8.3.39

2013-04-17 Thread James Smart
This patch set updates the lpfc driver to revision 8.3.39

The patches for 8.3.39 contain:

- 
- Fixed VPI allocation issues after firmware dump is performed
- Fixed BlockGuard error reporting
- Remove driver dependency on HZ
- Fixed pt2pt and loop discovery problems on topology changes.
- Fix driver issues with large lpfc_sg_seg_cnt values
- Fix driver issues with large s/g lists for BlockGuard
- Doorbell formation information logged in dual-chute mode WQ and RQ setup
- Fix driver issues with SCSI Host reset
- Fix lpfc_fcp_look_ahead module parameter
- Fixed crash when processing bsg's sg list with high memory pages
- Reduced spinlock contention on SCSI buffer list
- Fixed BlockGuard to take advantage of rdprotect/wrprotect info when available
- Fixed deadlock between hbalock and nlp_lock use.
- Fixed bad book keeping in posting els sgls to port
- Fixed not returning FAILED status when SCSI invoking host reset handler
  failed
- Fixed system panic during EEH recovery due to midlayer acting on
  outstanding I/O
- Fixed iocb flags not being reset for scsi commands.
- Fixed driver vector mapping to CPU affinity
- Add log message when completes with clean address bit set to zero
- Reduced tmo value set to FLOGI WQE for quick recovery from FLOGI sequence
  timeout
- Fixed driver handling of CLEAR_LA with NPIV enabled causing SID=0 frames out
- Update lpfc version for 8.3.39 driver release


The patches were cut against scsi.git, branch misc.

-- james s


Signed-off-by: James Smart james.sm...@emulex.com





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


[PATCH 1/22] lpfc 8.3.39: Fixed VPI allocation issues after firmware dump is performed

2013-04-17 Thread James Smart
Fixed VPI allocation issues after firmware dump is performed


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_hbadisc.c |   14 +-
 lpfc_init.c|   12 +++-
 lpfc_sli.c |2 ++
 lpfc_vport.c   |   25 -
 lpfc_vport.h   |1 +
 5 files changed, 51 insertions(+), 3 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c  2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c  2013-04-15 18:26:14.814040614 -0400
@@ -2796,7 +2796,19 @@ void
 lpfc_issue_init_vpi(struct lpfc_vport *vport)
 {
LPFC_MBOXQ_t *mboxq;
-   int rc;
+   int rc, vpi;
+
+   if ((vport-port_type != LPFC_PHYSICAL_PORT)  (!vport-vpi)) {
+   vpi = lpfc_alloc_vpi(vport-phba);
+   if (!vpi) {
+   lpfc_printf_vlog(vport, KERN_ERR,
+LOG_MBOX,
+3303 Failed to obtain vport vpi\n);
+   lpfc_vport_set_state(vport, FC_VPORT_FAILED);
+   return;
+   }
+   vport-vpi = vpi;
+   }
 
mboxq = mempool_alloc(vport-phba-mbox_mem_pool, GFP_KERNEL);
if (!mboxq) {
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:26:14.875040617 -0400
@@ -2633,6 +2633,7 @@ lpfc_online(struct lpfc_hba *phba)
struct lpfc_vport *vport;
struct lpfc_vport **vports;
int i;
+   bool vpis_cleared = false;
 
if (!phba)
return 0;
@@ -2656,6 +2657,10 @@ lpfc_online(struct lpfc_hba *phba)
lpfc_unblock_mgmt_io(phba);
return 1;
}
+   spin_lock_irq(phba-hbalock);
+   if (!phba-sli4_hba.max_cfg_param.vpi_used)
+   vpis_cleared = true;
+   spin_unlock_irq(phba-hbalock);
} else {
if (lpfc_sli_hba_setup(phba)) { /* Initialize SLI2/SLI3 HBA */
lpfc_unblock_mgmt_io(phba);
@@ -2672,8 +2677,13 @@ lpfc_online(struct lpfc_hba *phba)
vports[i]-fc_flag = ~FC_OFFLINE_MODE;
if (phba-sli3_options  LPFC_SLI3_NPIV_ENABLED)
vports[i]-fc_flag |= FC_VPORT_NEEDS_REG_VPI;
-   if (phba-sli_rev == LPFC_SLI_REV4)
+   if (phba-sli_rev == LPFC_SLI_REV4) {
vports[i]-fc_flag |= FC_VPORT_NEEDS_INIT_VPI;
+   if ((vpis_cleared) 
+   (vports[i]-port_type !=
+   LPFC_PHYSICAL_PORT))
+   vports[i]-vpi = 0;
+   }
spin_unlock_irq(shost-host_lock);
}
lpfc_destroy_vport_work_array(phba, vports);
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-04-15 18:26:14.915040617 -0400
@@ -5510,6 +5510,7 @@ lpfc_sli4_dealloc_extent(struct lpfc_hba
list_del_init(rsrc_blk-list);
kfree(rsrc_blk);
}
+   phba-sli4_hba.max_cfg_param.vpi_used = 0;
break;
case LPFC_RSC_TYPE_FCOE_XRI:
kfree(phba-sli4_hba.xri_bmask);
@@ -5810,6 +5811,7 @@ lpfc_sli4_dealloc_resource_identifiers(s
lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_VFI);
} else {
kfree(phba-vpi_bmask);
+   phba-sli4_hba.max_cfg_param.vpi_used = 0;
kfree(phba-vpi_ids);
bf_set(lpfc_vpi_rsrc_rdy, phba-sli4_hba.sli4_flags, 0);
kfree(phba-sli4_hba.xri_bmask);
diff -upNr a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
--- a/drivers/scsi/lpfc/lpfc_vport.c2013-04-10 16:30:14.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_vport.c2013-04-15 18:26:14.955040617 -0400
@@ -80,7 +80,7 @@ inline void lpfc_vport_set_state(struct
}
 }
 
-static int
+int
 lpfc_alloc_vpi(struct lpfc_hba *phba)
 {
unsigned long vpi;
@@ -568,6 +568,7 @@ lpfc_vport_delete(struct fc_vport *fc_vp
struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport-dd_data;
struct lpfc_hba   *phba = vport-phba;
long timeout;
+   bool ns_ndlp_referenced = false;
 
if (vport-port_type == LPFC_PHYSICAL_PORT) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
@@ -628,6 +629,18 @@ lpfc_vport_delete(struct fc_vport *fc_vp
 
lpfc_debugfs_terminate(vport);
 
+   /*
+* The call to 

[PATCH 2/22] lpfc 8.3.39: Fixed BlockGuard error reporting

2013-04-17 Thread James Smart
Fixed BlockGuard error reporting


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_logmsg.h |1 
 lpfc_scsi.c   |  279 --
 2 files changed, 255 insertions(+), 25 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_logmsg.h b/drivers/scsi/lpfc/lpfc_logmsg.h
--- a/drivers/scsi/lpfc/lpfc_logmsg.h   2013-04-10 16:30:14.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_logmsg.h   2013-04-15 18:26:21.112040758 -0400
@@ -37,6 +37,7 @@
 #define LOG_EVENT  0x0001  /* CT,TEMP,DUMP, logging */
 #define LOG_FIP0x0002  /* FIP events */
 #define LOG_FCP_UNDER  0x0004  /* FCP underruns errors */
+#define LOG_SCSI_CMD   0x0008  /* ALL SCSI commands */
 #define LOG_ALL_MSG0x  /* LOG all messages */
 
 #define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \
diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2013-04-15 18:26:21.124040758 -0400
@@ -24,6 +24,8 @@
 #include linux/export.h
 #include linux/delay.h
 #include asm/unaligned.h
+#include linux/crc-t10dif.h
+#include net/checksum.h
 
 #include scsi/scsi.h
 #include scsi/scsi_device.h
@@ -48,7 +50,7 @@
 #define LPFC_RESET_WAIT  2
 #define LPFC_ABORT_WAIT  2
 
-int _dump_buf_done;
+int _dump_buf_done = 1;
 
 static char *dif_op_str[] = {
PROT_NORMAL,
@@ -2820,6 +2822,214 @@ err:
 }
 
 /*
+ * This function calcuates the T10 DIF guard tag
+ * on the specified data using a CRC algorithmn
+ * using crc_t10dif.
+ */
+uint16_t
+lpfc_bg_crc(uint8_t *data, int count)
+{
+   uint16_t crc = 0;
+   uint16_t x;
+
+   crc = crc_t10dif(data, count);
+   x = cpu_to_be16(crc);
+   return x;
+}
+
+/*
+ * This function calcuates the T10 DIF guard tag
+ * on the specified data using a CSUM algorithmn
+ * using ip_compute_csum.
+ */
+uint16_t
+lpfc_bg_csum(uint8_t *data, int count)
+{
+   uint16_t ret;
+
+   ret = ip_compute_csum(data, count);
+   return ret;
+}
+
+/*
+ * This function examines the protection data to try to determine
+ * what type of T10-DIF error occurred.
+ */
+void
+lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
+{
+   struct scatterlist *sgpe; /* s/g prot entry */
+   struct scatterlist *sgde; /* s/g data entry */
+   struct scsi_cmnd *cmd = lpfc_cmd-pCmd;
+   struct scsi_dif_tuple *src = NULL;
+   uint8_t *data_src = NULL;
+   uint16_t guard_tag, guard_type;
+   uint16_t start_app_tag, app_tag;
+   uint32_t start_ref_tag, ref_tag;
+   int prot, protsegcnt;
+   int err_type, len, data_len;
+   int chk_ref, chk_app, chk_guard;
+   uint16_t sum;
+   unsigned blksize;
+
+   err_type = BGS_GUARD_ERR_MASK;
+   sum = 0;
+   guard_tag = 0;
+
+   /* First check to see if there is protection data to examine */
+   prot = scsi_get_prot_op(cmd);
+   if ((prot == SCSI_PROT_READ_STRIP) ||
+   (prot == SCSI_PROT_WRITE_INSERT) ||
+   (prot == SCSI_PROT_NORMAL))
+   goto out;
+
+   /* Currently the driver just supports ref_tag and guard_tag checking */
+   chk_ref = 1;
+   chk_app = 0;
+   chk_guard = 0;
+
+   /* Setup a ptr to the protection data provided by the SCSI host */
+   sgpe = scsi_prot_sglist(cmd);
+   protsegcnt = lpfc_cmd-prot_seg_cnt;
+
+   if (sgpe  protsegcnt) {
+
+   /*
+* We will only try to verify guard tag if the segment
+* data length is a multiple of the blksize.
+*/
+   sgde = scsi_sglist(cmd);
+   blksize = lpfc_cmd_blksize(cmd);
+   data_src = (uint8_t *)sg_virt(sgde);
+   data_len = sgde-length;
+   if ((data_len  (blksize - 1)) == 0)
+   chk_guard = 1;
+   guard_type = scsi_host_get_guard(cmd-device-host);
+
+   start_ref_tag = scsi_get_lba(cmd);
+   start_app_tag = src-app_tag;
+   src = (struct scsi_dif_tuple *)sg_virt(sgpe);
+   len = sgpe-length;
+   while (src  protsegcnt) {
+   while (len) {
+
+   /*
+* First check to see if a protection data
+* check is valid
+*/
+   if ((src-ref_tag == 0x) ||
+   (src-app_tag == 0x)) {
+   start_ref_tag++;
+   goto skipit;
+   }
+
+   /* App Tag checking */
+   app_tag = src-app_tag;
+   if (chk_app  (app_tag != start_app_tag)) {
+   

[PATCH 3/22] lpfc 8.3.39: Remove driver dependency on HZ

2013-04-17 Thread James Smart
Remove driver dependency on HZ


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc.h   |6 --
 lpfc_bsg.c   |6 --
 lpfc_ct.c|3 ++-
 lpfc_els.c   |   10 ++
 lpfc_hbadisc.c   |5 +++--
 lpfc_init.c  |   45 +
 lpfc_nportdisc.c |   19 ---
 lpfc_scsi.c  |2 +-
 lpfc_sli.c   |   33 +++--
 9 files changed, 80 insertions(+), 49 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
--- a/drivers/scsi/lpfc/lpfc_bsg.c  2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_bsg.c  2013-04-15 18:26:24.122040826 -0400
@@ -2576,7 +2576,8 @@ static int lpfcdiag_loop_get_xri(struct
evt-wait_time_stamp = jiffies;
time_left = wait_event_interruptible_timeout(
evt-wq, !list_empty(evt-events_to_see),
-   ((phba-fc_ratov * 2) + LPFC_DRVR_TIMEOUT) * HZ);
+   msecs_to_jiffies(1000 *
+   ((phba-fc_ratov * 2) + LPFC_DRVR_TIMEOUT)));
if (list_empty(evt-events_to_see))
ret_val = (time_left) ? -EINTR : -ETIMEDOUT;
else {
@@ -3151,7 +3152,8 @@ lpfc_bsg_diag_loopback_run(struct fc_bsg
evt-waiting = 1;
time_left = wait_event_interruptible_timeout(
evt-wq, !list_empty(evt-events_to_see),
-   ((phba-fc_ratov * 2) + LPFC_DRVR_TIMEOUT) * HZ);
+   msecs_to_jiffies(1000 *
+   ((phba-fc_ratov * 2) + LPFC_DRVR_TIMEOUT)));
evt-waiting = 0;
if (list_empty(evt-events_to_see)) {
rc = (time_left) ? -EINTR : -ETIMEDOUT;
diff -upNr a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
--- a/drivers/scsi/lpfc/lpfc_ct.c   2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_ct.c   2013-04-15 18:26:24.128040826 -0400
@@ -1811,7 +1811,8 @@ lpfc_fdmi_timeout_handler(struct lpfc_vp
if (init_utsname()-nodename[0] != '\0')
lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA);
else
-   mod_timer(vport-fc_fdmitmo, jiffies + HZ * 60);
+   mod_timer(vport-fc_fdmitmo, jiffies +
+ msecs_to_jiffies(1000 * 60));
}
return;
 }
diff -upNr a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
--- a/drivers/scsi/lpfc/lpfc_els.c  2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_els.c  2013-04-15 18:26:24.178040827 -0400
@@ -6241,7 +6241,8 @@ lpfc_els_timeout_handler(struct lpfc_vpo
}
 
if (!list_empty(phba-sli.ring[LPFC_ELS_RING].txcmplq))
-   mod_timer(vport-els_tmofunc, jiffies + HZ * timeout);
+   mod_timer(vport-els_tmofunc,
+ jiffies + msecs_to_jiffies(1000 * timeout));
 }
 
 /**
@@ -7003,7 +7004,7 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *ph
if (vport-fc_flag  FC_DISC_DELAYED) {
spin_unlock_irq(shost-host_lock);
mod_timer(vport-delayed_disc_tmo,
-   jiffies + HZ * phba-fc_ratov);
+   jiffies + msecs_to_jiffies(1000 * phba-fc_ratov));
return;
}
spin_unlock_irq(shost-host_lock);
@@ -7287,7 +7288,7 @@ lpfc_retry_pport_discovery(struct lpfc_h
return;
 
shost = lpfc_shost_from_vport(phba-pport);
-   mod_timer(ndlp-nlp_delayfunc, jiffies + HZ);
+   mod_timer(ndlp-nlp_delayfunc, jiffies + msecs_to_jiffies(1000));
spin_lock_irq(shost-host_lock);
ndlp-nlp_flag |= NLP_DELAY_TMO;
spin_unlock_irq(shost-host_lock);
@@ -7791,7 +7792,8 @@ lpfc_block_fabric_iocbs(struct lpfc_hba
blocked = test_and_set_bit(FABRIC_COMANDS_BLOCKED, phba-bit_flags);
/* Start a timer to unblock fabric iocbs after 100ms */
if (!blocked)
-   mod_timer(phba-fabric_block_timer, jiffies + HZ/10 );
+   mod_timer(phba-fabric_block_timer,
+ jiffies + msecs_to_jiffies(100));
 
return;
 }
diff -upNr a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
--- a/drivers/scsi/lpfc/lpfc.h  2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc.h  2013-04-15 18:26:24.180040827 -0400
@@ -66,8 +66,10 @@ struct lpfc_sli2_slim;
  * queue depths when there are driver resource error or Firmware
  * resource error.
  */
-#define QUEUE_RAMP_DOWN_INTERVAL   (1 * HZ)   /* 1 Second */
-#define QUEUE_RAMP_UP_INTERVAL (300 * HZ) /* 5 minutes */
+/* 1 Second */
+#define QUEUE_RAMP_DOWN_INTERVAL   (msecs_to_jiffies(1000 * 1))
+/* 5 minutes */
+#define QUEUE_RAMP_UP_INTERVAL (msecs_to_jiffies(1000 * 300))
 
 /* Number of exchanges reserved for discovery to complete */
 #define LPFC_DISC_IOCB_BUFF_COUNT 20
diff -upNr a/drivers/scsi/lpfc/lpfc_hbadisc.c 

[PATCH 4/22] lpfc 8.3.39: Fixed pt2pt and loop discovery problems on topology changes.

2013-04-17 Thread James Smart
Fixed pt2pt and loop discovery problems on topology changes.


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc.h   |1 
 lpfc_attr.c  |2 +
 lpfc_els.c   |   93 +++
 lpfc_hbadisc.c   |   55 
 lpfc_mbox.c  |9 +++--
 lpfc_nportdisc.c |6 ++-
 lpfc_sli.c   |8 +++-
 7 files changed, 149 insertions(+), 25 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
--- a/drivers/scsi/lpfc/lpfc_attr.c 2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-04-15 18:26:26.892040889 -0400
@@ -2801,6 +2801,8 @@ lpfc_topology_store(struct device *dev,
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
3054 lpfc_topology changed from %d to %d\n,
prev_val, val);
+   if (prev_val != val  phba-sli_rev == LPFC_SLI_REV4)
+   phba-fc_topology_changed = 1;
err = lpfc_issue_lip(lpfc_shost_from_vport(phba-pport));
if (err) {
phba-cfg_topology = prev_val;
diff -upNr a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
--- a/drivers/scsi/lpfc/lpfc_els.c  2013-04-15 18:26:24.178040827 -0400
+++ b/drivers/scsi/lpfc/lpfc_els.c  2013-04-15 18:26:26.898040889 -0400
@@ -29,6 +29,7 @@
 #include scsi/scsi_host.h
 #include scsi/scsi_transport_fc.h
 
+
 #include lpfc_hw4.h
 #include lpfc_hw.h
 #include lpfc_sli.h
@@ -308,16 +309,20 @@ lpfc_prep_els_iocb(struct lpfc_vport *vp
/* Xmit ELS command elsCmd to remote NPORT did */
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
 0116 Xmit ELS command x%x to remote 
-NPORT x%x I/O tag: x%x, port state: x%x\n,
+NPORT x%x I/O tag: x%x, port state:x%x
+ fc_flag:x%x\n,
 elscmd, did, elsiocb-iotag,
-vport-port_state);
+vport-port_state,
+vport-fc_flag);
} else {
/* Xmit ELS response elsCmd to remote NPORT did */
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
 0117 Xmit ELS response x%x to remote 
-NPORT x%x I/O tag: x%x, size: x%x\n,
+NPORT x%x I/O tag: x%x, size: x%x 
+port_state x%x fc_flag x%x\n,
 elscmd, ndlp-nlp_DID, elsiocb-iotag,
-cmdSize);
+cmdSize, vport-port_state,
+vport-fc_flag);
}
return elsiocb;
 
@@ -909,6 +914,23 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vp
spin_lock_irq(shost-host_lock);
vport-fc_flag |= FC_PT2PT;
spin_unlock_irq(shost-host_lock);
+   /* If physical FC port changed, unreg VFI and ALL VPIs / RPIs */
+   if ((phba-sli_rev == LPFC_SLI_REV4)  phba-fc_topology_changed) {
+   lpfc_unregister_fcf_prep(phba);
+
+   /* The FC_VFI_REGISTERED flag will get clear in the cmpl
+* handler for unreg_vfi, but if we don't force the
+* FC_VFI_REGISTERED flag then the reg_vfi mailbox could be
+* built with the update bit set instead of just the vp bit to
+* change the Nport ID.  We need to have the vp set and the
+* Upd cleared on topology changes.
+*/
+   spin_lock_irq(shost-host_lock);
+   vport-fc_flag = ~FC_VFI_REGISTERED;
+   spin_unlock_irq(shost-host_lock);
+   phba-fc_topology_changed = 0;
+   lpfc_issue_reg_vfi(vport);
+   }
 
/* Start discovery - this should just do CLEAR_LA */
lpfc_disc_start(vport);
@@ -1030,9 +1052,19 @@ stop_rr_fcf_flogi:
vport-cfg_discovery_threads = LPFC_MAX_DISC_THREADS;
if ((phba-sli_rev == LPFC_SLI_REV4) 
(!(vport-fc_flag  FC_VFI_REGISTERED) ||
-(vport-fc_prevDID != vport-fc_myDID))) {
-   if (vport-fc_flag  FC_VFI_REGISTERED)
-   lpfc_sli4_unreg_all_rpis(vport);
+(vport-fc_prevDID != vport-fc_myDID) ||
+   phba-fc_topology_changed)) {
+   if (vport-fc_flag  FC_VFI_REGISTERED) {
+   if (phba-fc_topology_changed) {
+   lpfc_unregister_fcf_prep(phba);
+   spin_lock_irq(shost-host_lock);
+   vport-fc_flag = ~FC_VFI_REGISTERED;
+   

[PATCH 5/22] lpfc 8.3.39: Fix driver issues with large lpfc_sg_seg_cnt values

2013-04-17 Thread James Smart
Fix driver issues with large lpfc_sg_seg_cnt values


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc.h  |3 +++
 lpfc_init.c |   31 +--
 2 files changed, 16 insertions(+), 18 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
--- a/drivers/scsi/lpfc/lpfc.h  2013-04-15 18:26:26.904040890 -0400
+++ b/drivers/scsi/lpfc/lpfc.h  2013-04-15 18:26:31.051040984 -0400
@@ -48,6 +48,9 @@ struct lpfc_sli2_slim;
downloads using bsg */
 #define LPFC_DEFAULT_PROT_SG_SEG_CNT 4096 /* sg protection elements count */
 #define LPFC_MAX_SG_SEG_CNT4096/* sg element count per scsi cmnd */
+#define LPFC_MAX_SGL_SEG_CNT   512 /* SGL element count per scsi cmnd */
+#define LPFC_MAX_BPL_SEG_CNT   4096/* BPL element count per scsi cmnd */
+
 #define LPFC_MAX_SGE_SIZE   0x8000 /* Maximum data allowed in a SGE */
 #define LPFC_MAX_PROT_SG_SEG_CNT 4096  /* prot sg element count per scsi cmd*/
 #define LPFC_IOCB_LIST_CNT 2250/* list of IOCBs for fast-path usage. */
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:26:24.220040829 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:26:31.068040984 -0400
@@ -4739,7 +4739,7 @@ lpfc_sli_driver_resource_setup(struct lp
((phba-cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64));
 
if (phba-cfg_enable_bg) {
-   phba-cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT;
+   phba-cfg_sg_seg_cnt = LPFC_MAX_BPL_SEG_CNT;
phba-cfg_sg_dma_buf_size +=
phba-cfg_prot_sg_seg_cnt * sizeof(struct ulp_bde64);
}
@@ -4817,7 +4817,7 @@ lpfc_sli4_driver_resource_setup(struct l
int rc, i, hbq_count, buf_size, dma_buf_size, max_buf_size;
uint8_t pn_page[LPFC_MAX_SUPPORTED_PAGES] = {0};
struct lpfc_mqe *mqe;
-   int longs, sli_family;
+   int longs;
int sges_per_segment;
 
/* Before proceed, wait for POST done and device ready */
@@ -4901,6 +4901,17 @@ lpfc_sli4_driver_resource_setup(struct l
sizeof(struct lpfc_sli_ring), GFP_KERNEL);
if (!phba-sli.ring)
return -ENOMEM;
+
+   /*
+* It doesn't matter what family our adapter is in, we are
+* limited to 2 Pages, 512 SGEs, for our SGL.
+* There are going to be 2 reserved SGEs: 1 FCP cmnd + 1 FCP rsp
+*/
+   max_buf_size = (2 * SLI4_PAGE_SIZE);
+   if (phba-cfg_sg_seg_cnt  LPFC_MAX_SGL_SEG_CNT - 2)
+   phba-cfg_sg_seg_cnt = LPFC_MAX_SGL_SEG_CNT - 2;
+   max_buf_size += (sizeof(struct fcp_cmnd) + sizeof(struct fcp_rsp));
+
/*
 * Since the sg_tablesize is module parameter, the sg_dma_buf_size
 * used to create the sg_dma_buf_pool must be dynamically calculated.
@@ -4912,22 +4923,6 @@ lpfc_sli4_driver_resource_setup(struct l
(((phba-cfg_sg_seg_cnt * sges_per_segment) + 2) *
sizeof(struct sli4_sge)));
 
-   sli_family = bf_get(lpfc_sli_intf_sli_family, phba-sli4_hba.sli_intf);
-   max_buf_size = LPFC_SLI4_MAX_BUF_SIZE;
-   switch (sli_family) {
-   case LPFC_SLI_INTF_FAMILY_BE2:
-   case LPFC_SLI_INTF_FAMILY_BE3:
-   /* There is a single hint for BE - 2 pages per BPL. */
-   if (bf_get(lpfc_sli_intf_sli_hint1, phba-sli4_hba.sli_intf) ==
-   LPFC_SLI_INTF_SLI_HINT1_1)
-   max_buf_size = LPFC_SLI4_FL1_MAX_BUF_SIZE;
-   break;
-   case LPFC_SLI_INTF_FAMILY_LNCR_A0:
-   case LPFC_SLI_INTF_FAMILY_LNCR_B0:
-   default:
-   break;
-   }
-
for (dma_buf_size = LPFC_SLI4_MIN_BUF_SIZE;
 dma_buf_size  max_buf_size  buf_size  dma_buf_size;
 dma_buf_size = dma_buf_size  1)



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


[PATCH 6/22] lpfc 8.3.39: Fix driver issues with large s/g lists for BlockGuard

2013-04-17 Thread James Smart
Fix driver issues with large s/g lists for BlockGuard


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc.h  |7 +
 lpfc_attr.c |   15 ++-
 lpfc_init.c |  132 --
 lpfc_mem.c  |   14 ++-
 lpfc_scsi.c |  229 +---
 lpfc_sli4.h |5 -
 6 files changed, 265 insertions(+), 137 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
--- a/drivers/scsi/lpfc/lpfc_attr.c 2013-04-15 18:26:26.892040889 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-04-15 18:26:32.478041017 -0400
@@ -4073,16 +4073,23 @@ MODULE_PARM_DESC(lpfc_delay_discovery,
 
 /*
  * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
- * This value can be set to values between 64 and 256. The default value is
+ * This value can be set to values between 64 and 4096. The default value is
  * 64, but may be increased to allow for larger Max I/O sizes. The scsi layer
  * will be allowed to request I/Os of sizes up to (MAX_SEG_COUNT * SEG_SIZE).
+ * Because of the additional overhead involved in setting up T10-DIF,
+ * this parameter will be limited to 128 if BlockGuard is enabled under SLI4
+ * and will be limited to 512 if BlockGuard is enabled under SLI3.
  */
 LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT,
LPFC_MAX_SG_SEG_CNT, Max Scatter Gather Segment Count);
 
-LPFC_ATTR_R(prot_sg_seg_cnt, LPFC_DEFAULT_PROT_SG_SEG_CNT,
-   LPFC_DEFAULT_PROT_SG_SEG_CNT, LPFC_MAX_PROT_SG_SEG_CNT,
-   Max Protection Scatter Gather Segment Count);
+/*
+ * This parameter will be depricated, the driver cannot limit the
+ * protection data s/g list.
+ */
+LPFC_ATTR_R(prot_sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT,
+   LPFC_DEFAULT_SG_SEG_CNT, LPFC_MAX_SG_SEG_CNT,
+   Max Protection Scatter Gather Segment Count);
 
 struct device_attribute *lpfc_hba_attrs[] = {
dev_attr_bg_info,
diff -upNr a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
--- a/drivers/scsi/lpfc/lpfc.h  2013-04-15 18:26:31.051040984 -0400
+++ b/drivers/scsi/lpfc/lpfc.h  2013-04-15 18:26:32.479041017 -0400
@@ -46,13 +46,15 @@ struct lpfc_sli2_slim;
 #define LPFC_DEFAULT_MENLO_SG_SEG_CNT 128  /* sg element count per scsi
cmnd for menlo needs nearly twice as for firmware
downloads using bsg */
-#define LPFC_DEFAULT_PROT_SG_SEG_CNT 4096 /* sg protection elements count */
+
+#define LPFC_MIN_SG_SLI4_BUF_SZ0x800   /* based on 
LPFC_DEFAULT_SG_SEG_CNT */
+#define LPFC_MAX_SG_SLI4_SEG_CNT_DIF 128 /* sg element count per scsi cmnd */
+#define LPFC_MAX_SG_SEG_CNT_DIF 512/* sg element count per scsi cmnd  */
 #define LPFC_MAX_SG_SEG_CNT4096/* sg element count per scsi cmnd */
 #define LPFC_MAX_SGL_SEG_CNT   512 /* SGL element count per scsi cmnd */
 #define LPFC_MAX_BPL_SEG_CNT   4096/* BPL element count per scsi cmnd */
 
 #define LPFC_MAX_SGE_SIZE   0x8000 /* Maximum data allowed in a SGE */
-#define LPFC_MAX_PROT_SG_SEG_CNT 4096  /* prot sg element count per scsi cmd*/
 #define LPFC_IOCB_LIST_CNT 2250/* list of IOCBs for fast-path usage. */
 #define LPFC_Q_RAMP_UP_INTERVAL 120 /* lun q_depth ramp up interval */
 #define LPFC_VNAME_LEN 100 /* vport symbolic name length */
@@ -710,6 +712,7 @@ struct lpfc_hba {
uint32_t cfg_fcp_wq_count;
uint32_t cfg_fcp_eq_count;
uint32_t cfg_fcp_io_channel;
+   uint32_t cfg_total_seg_cnt;
uint32_t cfg_sg_seg_cnt;
uint32_t cfg_prot_sg_seg_cnt;
uint32_t cfg_sg_dma_buf_size;
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:26:31.068040984 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:26:32.483041017 -0400
@@ -4730,23 +4730,52 @@ lpfc_sli_driver_resource_setup(struct lp
return -ENOMEM;
 
/*
-* Since the sg_tablesize is module parameter, the sg_dma_buf_size
+* Since lpfc_sg_seg_cnt is module parameter, the sg_dma_buf_size
 * used to create the sg_dma_buf_pool must be dynamically calculated.
-* 2 segments are added since the IOCB needs a command and response bde.
 */
-   phba-cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) +
-   sizeof(struct fcp_rsp) +
-   ((phba-cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64));
 
+   /* Initialize the host templates the configured values. */
+   lpfc_vport_template.sg_tablesize = phba-cfg_sg_seg_cnt;
+   lpfc_template.sg_tablesize = phba-cfg_sg_seg_cnt;
+
+   /* There are going to be 2 reserved BDEs: 1 FCP cmnd + 1 FCP rsp */
if (phba-cfg_enable_bg) {
-   phba-cfg_sg_seg_cnt = LPFC_MAX_BPL_SEG_CNT;
-   phba-cfg_sg_dma_buf_size +=
-   phba-cfg_prot_sg_seg_cnt * sizeof(struct ulp_bde64);
+   /*
+   

[PATCH 7/22] lpfc 8.3.39: Doorbell formation information logged in dual-chute mode WQ and RQ setup

2013-04-17 Thread James Smart
Doorbell formation information logged in dual-chute mode WQ and RQ setup


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_sli.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-04-15 18:26:26.986040891 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-04-15 18:26:35.021041074 -0400
@@ -12909,8 +12909,9 @@ lpfc_wq_create(struct lpfc_hba *phba, st
}
wq-db_regaddr = bar_memmap_p + db_offset;
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-   3264 WQ[%d]: barset:x%x, offset:x%x\n,
-   wq-queue_id, pci_barset, db_offset);
+   3264 WQ[%d]: barset:x%x, offset:x%x, 
+   format:x%x\n, wq-queue_id, pci_barset,
+   db_offset, wq-db_format);
} else {
wq-db_format = LPFC_DB_LIST_FORMAT;
wq-db_regaddr = phba-sli4_hba.WQDBregaddr;
@@ -13130,8 +13131,9 @@ lpfc_rq_create(struct lpfc_hba *phba, st
}
hrq-db_regaddr = bar_memmap_p + db_offset;
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-   3266 RQ[qid:%d]: barset:x%x, offset:x%x\n,
-   hrq-queue_id, pci_barset, db_offset);
+   3266 RQ[qid:%d]: barset:x%x, offset:x%x, 
+   format:x%x\n, hrq-queue_id, pci_barset,
+   db_offset, hrq-db_format);
} else {
hrq-db_format = LPFC_DB_RING_FORMAT;
hrq-db_regaddr = phba-sli4_hba.RQDBregaddr;



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


[PATCH 8/22] lpfc 8.3.39: Fix driver issues with SCSI Host reset

2013-04-17 Thread James Smart
Fix driver issues with SCSI Host reset


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_attr.c |7 ++-
 lpfc_hw4.h  |2 +-
 lpfc_init.c |7 ++-
 3 files changed, 13 insertions(+), 3 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
--- a/drivers/scsi/lpfc/lpfc_attr.c 2013-04-15 18:26:32.478041017 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-04-15 18:26:36.982041119 -0400
@@ -674,6 +674,9 @@ lpfc_do_offline(struct lpfc_hba *phba, u
int i;
int rc;
 
+   if (phba-pport-fc_flag  FC_OFFLINE_MODE)
+   return 0;
+
init_completion(online_compl);
rc = lpfc_workq_post_event(phba, status, online_compl,
  LPFC_EVT_OFFLINE_PREP);
@@ -741,7 +744,8 @@ lpfc_selective_reset(struct lpfc_hba *ph
int status = 0;
int rc;
 
-   if (!phba-cfg_enable_hba_reset)
+   if ((!phba-cfg_enable_hba_reset) ||
+   (phba-pport-fc_flag  FC_OFFLINE_MODE))
return -EACCES;
 
status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
@@ -895,6 +899,7 @@ lpfc_sli4_pdev_reg_request(struct lpfc_h
pci_disable_sriov(pdev);
phba-cfg_sriov_nr_virtfn = 0;
}
+
status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
 
if (status != 0)
diff -upNr a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
--- a/drivers/scsi/lpfc/lpfc_hw4.h  2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_hw4.h  2013-04-15 18:26:36.984041120 -0400
@@ -621,7 +621,7 @@ struct lpfc_register {
 #define lpfc_sliport_status_rdy_SHIFT  23
 #define lpfc_sliport_status_rdy_MASK   0x1
 #define lpfc_sliport_status_rdy_WORD   word0
-#define MAX_IF_TYPE_2_RESETS   1000
+#define MAX_IF_TYPE_2_RESETS   6
 
 #define LPFC_CTL_PORT_CTL_OFFSET   0x408
 #define lpfc_sliport_ctrl_end_SHIFT30
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:26:32.483041017 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:26:36.988041120 -0400
@@ -7817,8 +7817,13 @@ lpfc_pci_function_reset(struct lpfc_hba
 
 out:
/* Catch the not-ready port failure after a port reset. */
-   if (num_resets = MAX_IF_TYPE_2_RESETS)
+   if (num_resets = MAX_IF_TYPE_2_RESETS) {
+   lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
+   3317 HBA not functional: IP Reset Failed 
+   after (%d) retries, try: 
+   echo fw_reset  board_mode\n, num_resets);
rc = -ENODEV;
+   }
 
return rc;
 }



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


[PATCH 9/22] lpfc 8.3.39: Fix lpfc_fcp_look_ahead module parameter

2013-04-17 Thread James Smart
Fix lpfc_fcp_look_ahead module parameter


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_attr.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
--- a/drivers/scsi/lpfc/lpfc_attr.c 2013-04-15 18:26:36.982041119 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-04-15 18:26:38.186041147 -0400
@@ -4016,12 +4016,11 @@ LPFC_ATTR_R(enable_bg, 0, 0, 1, Enable
 #   0  = disabled (default)
 #   1  = enabled
 # Value range is [0,1]. Default value is 0.
+#
+# This feature in under investigation and may be supported in the future.
 */
 unsigned int lpfc_fcp_look_ahead = LPFC_LOOK_AHEAD_OFF;
 
-module_param(lpfc_fcp_look_ahead, uint, S_IRUGO);
-MODULE_PARM_DESC(lpfc_fcp_look_ahead, Look ahead for completions);
-
 /*
 # lpfc_prot_mask: i
 #  - Bit mask of host protection capabilities used to register with the



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


[PATCH 10/22] lpfc 8.3.39: Fixed crash when processing bsg's sg list with high memory pages

2013-04-17 Thread James Smart
Fixed crash when processing bsg's sg list with high memory pages


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_bsg.c |   33 +++--
 lpfc_sli.c |3 +--
 2 files changed, 24 insertions(+), 12 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
--- a/drivers/scsi/lpfc/lpfc_bsg.c  2013-04-15 18:26:24.122040826 -0400
+++ b/drivers/scsi/lpfc/lpfc_bsg.c  2013-04-15 18:26:39.363041173 -0400
@@ -219,26 +219,35 @@ lpfc_bsg_copy_data(struct lpfc_dmabuf *d
unsigned int transfer_bytes, bytes_copied = 0;
unsigned int sg_offset, dma_offset;
unsigned char *dma_address, *sg_address;
-   struct scatterlist *sgel;
LIST_HEAD(temp_list);
-
+   struct sg_mapping_iter miter;
+   unsigned long flags;
+   unsigned int sg_flags = SG_MITER_ATOMIC;
+   bool sg_valid;
 
list_splice_init(dma_buffers-list, temp_list);
list_add(dma_buffers-list, temp_list);
sg_offset = 0;
-   sgel = bsg_buffers-sg_list;
+   if (to_buffers)
+   sg_flags |= SG_MITER_FROM_SG;
+   else
+   sg_flags |= SG_MITER_TO_SG;
+   sg_miter_start(miter, bsg_buffers-sg_list, bsg_buffers-sg_cnt,
+  sg_flags);
+   local_irq_save(flags);
+   sg_valid = sg_miter_next(miter);
list_for_each_entry(mp, temp_list, list) {
dma_offset = 0;
-   while (bytes_to_transfer  sgel 
+   while (bytes_to_transfer  sg_valid 
   (dma_offset  LPFC_BPL_SIZE)) {
dma_address = mp-virt + dma_offset;
if (sg_offset) {
/* Continue previous partial transfer of sg */
-   sg_address = sg_virt(sgel) + sg_offset;
-   transfer_bytes = sgel-length - sg_offset;
+   sg_address = miter.addr + sg_offset;
+   transfer_bytes = miter.length - sg_offset;
} else {
-   sg_address = sg_virt(sgel);
-   transfer_bytes = sgel-length;
+   sg_address = miter.addr;
+   transfer_bytes = miter.length;
}
if (bytes_to_transfer  transfer_bytes)
transfer_bytes = bytes_to_transfer;
@@ -252,12 +261,14 @@ lpfc_bsg_copy_data(struct lpfc_dmabuf *d
sg_offset += transfer_bytes;
bytes_to_transfer -= transfer_bytes;
bytes_copied += transfer_bytes;
-   if (sg_offset = sgel-length) {
+   if (sg_offset = miter.length) {
sg_offset = 0;
-   sgel = sg_next(sgel);
+   sg_valid = sg_miter_next(miter);
}
}
}
+   sg_miter_stop(miter);
+   local_irq_restore(flags);
list_del_init(dma_buffers-list);
list_splice(temp_list, dma_buffers-list);
return bytes_copied;
@@ -471,6 +482,7 @@ lpfc_bsg_send_mgmt_cmd(struct fc_bsg_job
cmdiocbq-context1 = dd_data;
cmdiocbq-context2 = cmp;
cmdiocbq-context3 = bmp;
+   cmdiocbq-context_un.ndlp = ndlp;
dd_data-type = TYPE_IOCB;
dd_data-set_job = job;
dd_data-context_un.iocb.cmdiocbq = cmdiocbq;
@@ -1508,6 +1520,7 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba,
ctiocb-context1 = dd_data;
ctiocb-context2 = cmp;
ctiocb-context3 = bmp;
+   ctiocb-context_un.ndlp = ndlp;
ctiocb-iocb_cmpl = lpfc_issue_ct_rsp_cmp;
 
dd_data-type = TYPE_IOCB;
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-04-15 18:26:35.021041074 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-04-15 18:26:39.379041174 -0400
@@ -926,8 +926,7 @@ __lpfc_sli_get_sglq(struct lpfc_hba *phb
} else  if ((piocbq-iocb.ulpCommand == CMD_GEN_REQUEST64_CR) 
!(piocbq-iocb_flag  LPFC_IO_LIBDFC))
ndlp = piocbq-context_un.ndlp;
-   else  if ((piocbq-iocb.ulpCommand == CMD_ELS_REQUEST64_CR) 
-   (piocbq-iocb_flag  LPFC_IO_LIBDFC))
+   else  if (piocbq-iocb_flag  LPFC_IO_LIBDFC)
ndlp = piocbq-context_un.ndlp;
else
ndlp = piocbq-context1;



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


[PATCH 11/22] lpfc 8.3.39: Reduced spinlock contention on SCSI buffer list

2013-04-17 Thread James Smart
Reduced spinlock contention on SCSI buffer list


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc.h  |6 ++-
 lpfc_init.c |   54 --
 lpfc_scsi.c |   93 ++--
 3 files changed, 102 insertions(+), 51 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
--- a/drivers/scsi/lpfc/lpfc.h  2013-04-15 18:26:32.479041017 -0400
+++ b/drivers/scsi/lpfc/lpfc.h  2013-04-15 18:26:40.561041201 -0400
@@ -813,8 +813,10 @@ struct lpfc_hba {
uint64_t bg_reftag_err_cnt;
 
/* fastpath list. */
-   spinlock_t scsi_buf_list_lock;
-   struct list_head lpfc_scsi_buf_list;
+   spinlock_t scsi_buf_list_get_lock;  /* SCSI buf alloc list lock */
+   spinlock_t scsi_buf_list_put_lock;  /* SCSI buf free list lock */
+   struct list_head lpfc_scsi_buf_list_get;
+   struct list_head lpfc_scsi_buf_list_put;
uint32_t total_scsi_bufs;
struct list_head lpfc_iocb_list;
uint32_t total_iocbq_bufs;
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:26:36.988041120 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:26:40.579041201 -0400
@@ -911,9 +911,9 @@ lpfc_hba_down_post_s4(struct lpfc_hba *p
psb-pCmd = NULL;
psb-status = IOSTAT_SUCCESS;
}
-   spin_lock_irqsave(phba-scsi_buf_list_lock, iflag);
-   list_splice(aborts, phba-lpfc_scsi_buf_list);
-   spin_unlock_irqrestore(phba-scsi_buf_list_lock, iflag);
+   spin_lock_irqsave(phba-scsi_buf_list_put_lock, iflag);
+   list_splice(aborts, phba-lpfc_scsi_buf_list_put);
+   spin_unlock_irqrestore(phba-scsi_buf_list_put_lock, iflag);
return 0;
 }
 
@@ -2854,16 +2854,30 @@ lpfc_scsi_free(struct lpfc_hba *phba)
struct lpfc_iocbq *io, *io_next;
 
spin_lock_irq(phba-hbalock);
+
/* Release all the lpfc_scsi_bufs maintained by this host. */
-   spin_lock(phba-scsi_buf_list_lock);
-   list_for_each_entry_safe(sb, sb_next, phba-lpfc_scsi_buf_list, list) {
+
+   spin_lock(phba-scsi_buf_list_put_lock);
+   list_for_each_entry_safe(sb, sb_next, phba-lpfc_scsi_buf_list_put,
+list) {
+   list_del(sb-list);
+   pci_pool_free(phba-lpfc_scsi_dma_buf_pool, sb-data,
+ sb-dma_handle);
+   kfree(sb);
+   phba-total_scsi_bufs--;
+   }
+   spin_unlock(phba-scsi_buf_list_put_lock);
+
+   spin_lock(phba-scsi_buf_list_get_lock);
+   list_for_each_entry_safe(sb, sb_next, phba-lpfc_scsi_buf_list_get,
+list) {
list_del(sb-list);
pci_pool_free(phba-lpfc_scsi_dma_buf_pool, sb-data,
  sb-dma_handle);
kfree(sb);
phba-total_scsi_bufs--;
}
-   spin_unlock(phba-scsi_buf_list_lock);
+   spin_unlock(phba-scsi_buf_list_get_lock);
 
/* Release all the lpfc_iocbq entries maintained by this host. */
list_for_each_entry_safe(io, io_next, phba-lpfc_iocb_list, list) {
@@ -2999,9 +3013,12 @@ lpfc_sli4_xri_sgl_update(struct lpfc_hba
phba-sli4_hba.scsi_xri_cnt,
phba-sli4_hba.scsi_xri_max);
 
-   spin_lock_irq(phba-scsi_buf_list_lock);
-   list_splice_init(phba-lpfc_scsi_buf_list, scsi_sgl_list);
-   spin_unlock_irq(phba-scsi_buf_list_lock);
+   spin_lock_irq(phba-scsi_buf_list_get_lock);
+   spin_lock_irq(phba-scsi_buf_list_put_lock);
+   list_splice_init(phba-lpfc_scsi_buf_list_get, scsi_sgl_list);
+   list_splice(phba-lpfc_scsi_buf_list_put, scsi_sgl_list);
+   spin_unlock_irq(phba-scsi_buf_list_put_lock);
+   spin_unlock_irq(phba-scsi_buf_list_get_lock);
 
if (phba-sli4_hba.scsi_xri_cnt  phba-sli4_hba.scsi_xri_max) {
/* max scsi xri shrinked below the allocated scsi buffers */
@@ -3015,9 +3032,9 @@ lpfc_sli4_xri_sgl_update(struct lpfc_hba
  psb-dma_handle);
kfree(psb);
}
-   spin_lock_irq(phba-scsi_buf_list_lock);
+   spin_lock_irq(phba-scsi_buf_list_get_lock);
phba-sli4_hba.scsi_xri_cnt -= scsi_xri_cnt;
-   spin_unlock_irq(phba-scsi_buf_list_lock);
+   spin_unlock_irq(phba-scsi_buf_list_get_lock);
}
 
/* update xris associated to remaining allocated scsi buffers */
@@ -3035,9 +3052,12 @@ lpfc_sli4_xri_sgl_update(struct lpfc_hba
psb-cur_iocbq.sli4_lxritag = lxri;
psb-cur_iocbq.sli4_xritag = phba-sli4_hba.xri_ids[lxri];
}
-   spin_lock_irq(phba-scsi_buf_list_lock);
-   list_splice_init(scsi_sgl_list, phba-lpfc_scsi_buf_list);
-   spin_unlock_irq(phba-scsi_buf_list_lock);

[PATCH 12/22] lpfc 8.3.39: Fixed BlockGuard to take advantage of rdprotect/wrprotect info when available

2013-04-17 Thread James Smart
Fixed BlockGuard to take advantage of rdprotect/wrprotect info when available


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_hw.h   |1 
 lpfc_scsi.c |  181 ++--
 2 files changed, 116 insertions(+), 66 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
--- a/drivers/scsi/lpfc/lpfc_hw.h   2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_hw.h   2013-04-15 18:26:43.651041272 -0400
@@ -1667,6 +1667,7 @@ enum lpfc_protgrp_type {
 #defineBG_OP_IN_CSUM_OUT_CSUM  0x5
 #defineBG_OP_IN_CRC_OUT_CSUM   0x6
 #defineBG_OP_IN_CSUM_OUT_CRC   0x7
+#defineBG_OP_RAW_MODE  0x8
 
 struct lpfc_pde5 {
uint32_t word0;
diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2013-04-15 18:26:40.587041201 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2013-04-15 18:26:43.653041272 -0400
@@ -68,6 +68,10 @@ struct scsi_dif_tuple {
__be32 ref_tag; /* Target LBA or indirect LBA */
 };
 
+#if !defined(SCSI_PROT_GUARD_CHECK) || !defined(SCSI_PROT_REF_CHECK)
+#define scsi_prot_flagged(sc, flg) sc
+#endif
+
 static void
 lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb);
 static void
@@ -2066,9 +2070,21 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba,
bf_set(pde6_type, pde6, LPFC_PDE6_DESCRIPTOR);
bf_set(pde6_optx, pde6, txop);
bf_set(pde6_oprx, pde6, rxop);
+
+   /*
+* We only need to check the data on READs, for WRITEs
+* protection data is automatically generated, not checked.
+*/
if (datadir == DMA_FROM_DEVICE) {
-   bf_set(pde6_ce, pde6, checking);
-   bf_set(pde6_re, pde6, checking);
+   if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK))
+   bf_set(pde6_ce, pde6, checking);
+   else
+   bf_set(pde6_ce, pde6, 0);
+
+   if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK))
+   bf_set(pde6_re, pde6, checking);
+   else
+   bf_set(pde6_re, pde6, 0);
}
bf_set(pde6_ai, pde6, 1);
bf_set(pde6_ae, pde6, 0);
@@ -2221,8 +2237,17 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *
bf_set(pde6_type, pde6, LPFC_PDE6_DESCRIPTOR);
bf_set(pde6_optx, pde6, txop);
bf_set(pde6_oprx, pde6, rxop);
-   bf_set(pde6_ce, pde6, checking);
-   bf_set(pde6_re, pde6, checking);
+
+   if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK))
+   bf_set(pde6_ce, pde6, checking);
+   else
+   bf_set(pde6_ce, pde6, 0);
+
+   if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK))
+   bf_set(pde6_re, pde6, checking);
+   else
+   bf_set(pde6_re, pde6, 0);
+
bf_set(pde6_ai, pde6, 1);
bf_set(pde6_ae, pde6, 0);
bf_set(pde6_apptagval, pde6, 0);
@@ -2385,7 +2410,6 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba,
struct sli4_sge_diseed *diseed = NULL;
dma_addr_t physaddr;
int i = 0, num_sge = 0, status;
-   int datadir = sc-sc_data_direction;
uint32_t reftag;
unsigned blksize;
uint8_t txop, rxop;
@@ -2423,13 +2447,26 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba,
diseed-ref_tag = cpu_to_le32(reftag);
diseed-ref_tag_tran = diseed-ref_tag;
 
+   /*
+* We only need to check the data on READs, for WRITEs
+* protection data is automatically generated, not checked.
+*/
+   if (sc-sc_data_direction == DMA_FROM_DEVICE) {
+   if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK))
+   bf_set(lpfc_sli4_sge_dif_ce, diseed, checking);
+   else
+   bf_set(lpfc_sli4_sge_dif_ce, diseed, 0);
+
+   if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK))
+   bf_set(lpfc_sli4_sge_dif_re, diseed, checking);
+   else
+   bf_set(lpfc_sli4_sge_dif_re, diseed, 0);
+   }
+
/* setup DISEED with the rest of the info */
bf_set(lpfc_sli4_sge_dif_optx, diseed, txop);
bf_set(lpfc_sli4_sge_dif_oprx, diseed, rxop);
-   if (datadir == DMA_FROM_DEVICE) {
-   bf_set(lpfc_sli4_sge_dif_ce, diseed, checking);
-   bf_set(lpfc_sli4_sge_dif_re, diseed, checking);
-   }
+
bf_set(lpfc_sli4_sge_dif_ai, diseed, 1);
bf_set(lpfc_sli4_sge_dif_me, diseed, 0);
 
@@ -2571,11 +2608,34 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *
diseed-ref_tag = cpu_to_le32(reftag);
diseed-ref_tag_tran = diseed-ref_tag;
 
+   if (scsi_prot_flagged(sc, 

[PATCH 13/22] lpfc 8.3.39: Fixed deadlock between hbalock and nlp_lock use

2013-04-17 Thread James Smart
Fixed deadlock between hbalock and nlp_lock use.


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_hbadisc.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c  2013-04-15 18:26:26.937040890 -0400
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c  2013-04-15 18:26:44.695041295 -0400
@@ -160,11 +160,12 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport
if (!list_empty(evtp-evt_listp))
return;
 
+   evtp-evt_arg1  = lpfc_nlp_get(ndlp);
+
spin_lock_irq(phba-hbalock);
/* We need to hold the node by incrementing the reference
 * count until this queued work is done
 */
-   evtp-evt_arg1  = lpfc_nlp_get(ndlp);
if (evtp-evt_arg1) {
evtp-evt = LPFC_EVT_DEV_LOSS;
list_add_tail(evtp-evt_listp, phba-work_list);



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


[PATCH 14/22] lpfc 8.3.39: Fixed bad book keeping in posting els sgls to port

2013-04-17 Thread James Smart
Fixed bad book keeping in posting els sgls to port


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_sli.c |   13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-04-15 18:26:39.379041174 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-04-15 18:26:45.706041318 -0400
@@ -5999,7 +5999,7 @@ lpfc_sli4_repost_els_sgl_list(struct lpf
struct lpfc_sglq *sglq_entry = NULL;
struct lpfc_sglq *sglq_entry_next = NULL;
struct lpfc_sglq *sglq_entry_first = NULL;
-   int status, post_cnt = 0, num_posted = 0, block_cnt = 0;
+   int status, total_cnt, post_cnt = 0, num_posted = 0, block_cnt = 0;
int last_xritag = NO_XRI;
LIST_HEAD(prep_sgl_list);
LIST_HEAD(blck_sgl_list);
@@ -6011,6 +6011,7 @@ lpfc_sli4_repost_els_sgl_list(struct lpf
list_splice_init(phba-sli4_hba.lpfc_sgl_list, allc_sgl_list);
spin_unlock_irq(phba-hbalock);
 
+   total_cnt = phba-sli4_hba.els_xri_cnt;
list_for_each_entry_safe(sglq_entry, sglq_entry_next,
 allc_sgl_list, list) {
list_del_init(sglq_entry-list);
@@ -6062,9 +6063,7 @@ lpfc_sli4_repost_els_sgl_list(struct lpf
sglq_entry-sli4_xritag);
list_add_tail(sglq_entry-list,
  free_sgl_list);
-   spin_lock_irq(phba-hbalock);
-   phba-sli4_hba.els_xri_cnt--;
-   spin_unlock_irq(phba-hbalock);
+   total_cnt--;
}
}
}
@@ -6092,9 +6091,7 @@ lpfc_sli4_repost_els_sgl_list(struct lpf
(sglq_entry_first-sli4_xritag +
 post_cnt - 1));
list_splice_init(blck_sgl_list, free_sgl_list);
-   spin_lock_irq(phba-hbalock);
-   phba-sli4_hba.els_xri_cnt -= post_cnt;
-   spin_unlock_irq(phba-hbalock);
+   total_cnt -= post_cnt;
}
 
/* don't reset xirtag due to hole in xri block */
@@ -6104,6 +6101,8 @@ lpfc_sli4_repost_els_sgl_list(struct lpf
/* reset els sgl post count for next round of posting */
post_cnt = 0;
}
+   /* update the number of XRIs posted for ELS */
+   phba-sli4_hba.els_xri_cnt = total_cnt;
 
/* free the els sgls failed to post */
lpfc_free_sgl_list(phba, free_sgl_list);



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


[PATCH 15/22] lpfc 8.3.39: Fixed not returning FAILED status when SCSI invoking host reset handler failed

2013-04-17 Thread James Smart
Fixed not returning FAILED status when SCSI invoking host reset handler failed


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_crtn.h |1 +
 lpfc_init.c |2 +-
 lpfc_scsi.c |   14 +++---
 3 files changed, 13 insertions(+), 4 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
--- a/drivers/scsi/lpfc/lpfc_crtn.h 2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_crtn.h 2013-04-15 18:26:46.908041345 -0400
@@ -470,3 +470,4 @@ int lpfc_sli4_xri_sgl_update(struct lpfc
 void lpfc_free_sgl_list(struct lpfc_hba *, struct list_head *);
 uint32_t lpfc_sli_port_speed_get(struct lpfc_hba *);
 int lpfc_sli4_request_firmware_update(struct lpfc_hba *, uint8_t);
+void lpfc_sli4_offline_eratt(struct lpfc_hba *);
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:26:40.579041201 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:26:46.925041345 -0400
@@ -1202,7 +1202,7 @@ lpfc_offline_eratt(struct lpfc_hba *phba
  * This routine is called to bring a SLI4 HBA offline when HBA hardware error
  * other than Port Error 6 has been detected.
  **/
-static void
+void
 lpfc_sli4_offline_eratt(struct lpfc_hba *phba)
 {
lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT);
diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2013-04-15 18:26:43.653041272 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2013-04-15 18:26:46.934041346 -0400
@@ -5376,16 +5376,24 @@ lpfc_host_reset_handler(struct scsi_cmnd
struct lpfc_hba *phba = vport-phba;
int rc, ret = SUCCESS;
 
+   lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
+3172 SCSI layer issued Host Reset Data:\n);
+
lpfc_offline_prep(phba, LPFC_MBX_WAIT);
lpfc_offline(phba);
rc = lpfc_sli_brdrestart(phba);
if (rc)
ret = FAILED;
-   lpfc_online(phba);
+   rc = lpfc_online(phba);
+   if (rc)
+   ret = FAILED;
lpfc_unblock_mgmt_io(phba);
 
-   lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
-   3172 SCSI layer issued Host Reset Data: x%x\n, ret);
+   if (ret == FAILED) {
+   lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
+3323 Failed host reset, bring it offline\n);
+   lpfc_sli4_offline_eratt(phba);
+   }
return ret;
 }
 



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


[PATCH 16/22] lpfc 8.3.39: Fixed system panic during EEH recovery due to midlayer acting on outstanding I/O

2013-04-17 Thread James Smart
Fixed system panic during EEH recovery due to midlayer acting on outstanding I/O


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_init.c |   12 ++--
 lpfc_sli.c  |4 
 2 files changed, 10 insertions(+), 6 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:51:49.209075552 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-04-15 18:52:05.751075929 -0400
@@ -9314,15 +9314,15 @@ lpfc_sli_prep_dev_for_reset(struct lpfc_
/* Block all SCSI devices' I/Os on the host */
lpfc_scsi_dev_block(phba);
 
+   /* Flush all driver's outstanding SCSI I/Os as we are to reset */
+   lpfc_sli_flush_fcp_rings(phba);
+
/* stop all timers */
lpfc_stop_hba_timers(phba);
 
/* Disable interrupt and pci device */
lpfc_sli_disable_intr(phba);
pci_disable_device(phba-pcidev);
-
-   /* Flush all driver's outstanding SCSI I/Os as we are to reset */
-   lpfc_sli_flush_fcp_rings(phba);
 }
 
 /**
@@ -10067,6 +10067,9 @@ lpfc_sli4_prep_dev_for_reset(struct lpfc
/* Block all SCSI devices' I/Os on the host */
lpfc_scsi_dev_block(phba);
 
+   /* Flush all driver's outstanding SCSI I/Os as we are to reset */
+   lpfc_sli_flush_fcp_rings(phba);
+
/* stop all timers */
lpfc_stop_hba_timers(phba);
 
@@ -10074,9 +10077,6 @@ lpfc_sli4_prep_dev_for_reset(struct lpfc
lpfc_sli4_disable_intr(phba);
lpfc_sli4_queue_destroy(phba);
pci_disable_device(phba-pcidev);
-
-   /* Flush all driver's outstanding SCSI I/Os as we are to reset */
-   lpfc_sli_flush_fcp_rings(phba);
 }
 
 /**
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-04-15 18:51:49.194075552 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-04-15 18:52:09.844076022 -0400
@@ -8452,10 +8452,14 @@ __lpfc_sli_issue_iocb_s4(struct lpfc_hba
 
if ((piocb-iocb_flag  LPFC_IO_FCP) ||
(piocb-iocb_flag  LPFC_USE_FCPWQIDX)) {
+   if (unlikely(!phba-sli4_hba.fcp_wq))
+   return IOCB_ERROR;
if (lpfc_sli4_wq_put(phba-sli4_hba.fcp_wq[piocb-fcp_wqidx],
 wqe))
return IOCB_ERROR;
} else {
+   if (unlikely(!phba-sli4_hba.els_wq))
+   return IOCB_ERROR;
if (lpfc_sli4_wq_put(phba-sli4_hba.els_wq, wqe))
return IOCB_ERROR;
}



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


[PATCH 17/22] lpfc 8.3.39: Fixed iocb flags not being reset for scsi commands

2013-04-17 Thread James Smart
Fixed iocb flags not being reset for scsi commands.


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_scsi.c |2 ++
 1 file changed, 2 insertions(+)


diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2013-04-15 18:26:46.934041346 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2013-04-15 18:26:51.610041452 -0400
@@ -1215,6 +1215,7 @@ lpfc_release_scsi_buf_s3(struct lpfc_hba
 
spin_lock_irqsave(phba-scsi_buf_list_put_lock, iflag);
psb-pCmd = NULL;
+   psb-cur_iocbq.iocb_flag = LPFC_IO_FCP;
list_add_tail(psb-list, phba-lpfc_scsi_buf_list_put);
spin_unlock_irqrestore(phba-scsi_buf_list_put_lock, iflag);
 }
@@ -1248,6 +1249,7 @@ lpfc_release_scsi_buf_s4(struct lpfc_hba
iflag);
} else {
psb-pCmd = NULL;
+   psb-cur_iocbq.iocb_flag = LPFC_IO_FCP;
spin_lock_irqsave(phba-scsi_buf_list_put_lock, iflag);
list_add_tail(psb-list, phba-lpfc_scsi_buf_list_put);
spin_unlock_irqrestore(phba-scsi_buf_list_put_lock, iflag);



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


[PATCH 18/22] lpfc 8.3.39: Fixed driver vector mapping to CPU affinity

2013-04-17 Thread James Smart
Fixed driver vector mapping to CPU affinity


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc.h  |1 
 lpfc_attr.c |  137 +
 lpfc_hw4.h  |5 
 lpfc_init.c |  322 ++--
 lpfc_sli.c  |   22 ++--
 lpfc_sli4.h |   16 ++
 6 files changed, 488 insertions(+), 15 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
--- a/drivers/scsi/lpfc/lpfc_attr.c 2013-04-15 18:26:38.186041147 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-04-15 18:26:52.668041476 -0400
@@ -3799,6 +3799,141 @@ lpfc_fcp_imax_init(struct lpfc_hba *phba
 static DEVICE_ATTR(lpfc_fcp_imax, S_IRUGO | S_IWUSR,
   lpfc_fcp_imax_show, lpfc_fcp_imax_store);
 
+/**
+ * lpfc_state_show - Display current driver CPU affinity
+ * @dev: class converted to a Scsi_host structure.
+ * @attr: device attribute, not used.
+ * @buf: on return contains text describing the state of the link.
+ *
+ * Returns: size of formatted string.
+ **/
+static ssize_t
+lpfc_fcp_cpu_map_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+   struct Scsi_Host  *shost = class_to_shost(dev);
+   struct lpfc_vport *vport = (struct lpfc_vport *)shost-hostdata;
+   struct lpfc_hba   *phba = vport-phba;
+   struct lpfc_vector_map_info *cpup;
+   int  idx, len = 0;
+
+   if ((phba-sli_rev != LPFC_SLI_REV4) ||
+   (phba-intr_type != MSIX))
+   return len;
+
+   switch (phba-cfg_fcp_cpu_map) {
+   case 0:
+   len += snprintf(buf + len, PAGE_SIZE-len,
+   fcp_cpu_map: No mapping (%d)\n,
+   phba-cfg_fcp_cpu_map);
+   return len;
+   case 1:
+   len += snprintf(buf + len, PAGE_SIZE-len,
+   fcp_cpu_map: HBA centric mapping (%d): 
+   %d online CPUs\n,
+   phba-cfg_fcp_cpu_map,
+   phba-sli4_hba.num_online_cpu);
+   break;
+   case 2:
+   len += snprintf(buf + len, PAGE_SIZE-len,
+   fcp_cpu_map: Driver centric mapping (%d): 
+   %d online CPUs\n,
+   phba-cfg_fcp_cpu_map,
+   phba-sli4_hba.num_online_cpu);
+   break;
+   }
+
+   cpup = phba-sli4_hba.cpu_map;
+   for (idx = 0; idx  phba-sli4_hba.num_present_cpu; idx++) {
+   if (cpup-irq == LPFC_VECTOR_MAP_EMPTY)
+   len += snprintf(buf + len, PAGE_SIZE-len,
+   CPU %02d io_chan %02d 
+   physid %d coreid %d\n,
+   idx, cpup-channel_id, cpup-phys_id,
+   cpup-core_id);
+   else
+   len += snprintf(buf + len, PAGE_SIZE-len,
+   CPU %02d io_chan %02d 
+   physid %d coreid %d IRQ %d\n,
+   idx, cpup-channel_id, cpup-phys_id,
+   cpup-core_id, cpup-irq);
+
+   cpup++;
+   }
+   return len;
+}
+
+/**
+ * lpfc_fcp_cpu_map_store - Change CPU affinity of driver vectors
+ * @dev: class device that is converted into a Scsi_host.
+ * @attr: device attribute, not used.
+ * @buf: one or more lpfc_polling_flags values.
+ * @count: not used.
+ *
+ * Returns:
+ * -EINVAL  - Not implemented yet.
+ **/
+static ssize_t
+lpfc_fcp_cpu_map_store(struct device *dev, struct device_attribute *attr,
+  const char *buf, size_t count)
+{
+   int status = -EINVAL;
+   return status;
+}
+
+/*
+# lpfc_fcp_cpu_map: Defines how to map CPUs to IRQ vectors
+# for the HBA.
+#
+# Value range is [0 to 2]. Default value is LPFC_DRIVER_CPU_MAP (2).
+#  0 - Do not affinitze IRQ vectors
+#  1 - Affintize HBA vectors with respect to each HBA
+#  (start with CPU0 for each HBA)
+#  2 - Affintize HBA vectors with respect to the entire driver
+#  (round robin thru all CPUs across all HBAs)
+*/
+static int lpfc_fcp_cpu_map = LPFC_DRIVER_CPU_MAP;
+module_param(lpfc_fcp_cpu_map, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(lpfc_fcp_cpu_map,
+Defines how to map CPUs to IRQ vectors per HBA);
+
+/**
+ * lpfc_fcp_cpu_map_init - Set the initial sr-iov virtual function enable
+ * @phba: lpfc_hba pointer.
+ * @val: link speed value.
+ *
+ * Description:
+ * If val is in a valid range [0-2], then affinitze the adapter's
+ * MSIX vectors.
+ *
+ * Returns:
+ * zero if val saved.
+ * -EINVAL val out of range
+ **/
+static int
+lpfc_fcp_cpu_map_init(struct lpfc_hba *phba, int val)
+{
+   if (phba-sli_rev != LPFC_SLI_REV4) {
+   

[PATCH 19/22] lpfc 8.3.39: Add log message when completes with clean address bit set to zero

2013-04-17 Thread James Smart
Add log message when completes with clean address bit set to zero


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_els.c |3 +++
 1 file changed, 3 insertions(+)


diff -upNr a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
--- a/drivers/scsi/lpfc/lpfc_els.c  2013-04-15 18:26:26.898040889 -0400
+++ b/drivers/scsi/lpfc/lpfc_els.c  2013-04-15 18:26:54.238041512 -0400
@@ -7072,6 +7072,9 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *ph
spin_lock_irq(shost-host_lock);
if (vport-fc_flag  FC_DISC_DELAYED) {
spin_unlock_irq(shost-host_lock);
+   lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
+   3334 Delay fc port discovery for %d seconds\n,
+   phba-fc_ratov);
mod_timer(vport-delayed_disc_tmo,
jiffies + msecs_to_jiffies(1000 * phba-fc_ratov));
return;



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


[PATCH 20/22] lpfc 8.3.39: Reduced tmo value set to FLOGI WQE for quick recovery from FLOGI sequence timeout

2013-04-17 Thread James Smart
Reduced tmo value set to FLOGI WQE for quick recovery from FLOGI sequence 
timeout


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_els.c |9 ++---
 lpfc_hbadisc.c |7 +--
 lpfc_sli.c |   11 ++-
 3 files changed, 17 insertions(+), 10 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
--- a/drivers/scsi/lpfc/lpfc_els.c  2013-04-15 18:26:54.238041512 -0400
+++ b/drivers/scsi/lpfc/lpfc_els.c  2013-04-15 18:26:55.598041544 -0400
@@ -239,7 +239,10 @@ lpfc_prep_els_iocb(struct lpfc_vport *vp
 
icmd-un.elsreq64.remoteID = did;   /* DID */
icmd-ulpCommand = CMD_ELS_REQUEST64_CR;
-   icmd-ulpTimeout = phba-fc_ratov * 2;
+   if (elscmd == ELS_CMD_FLOGI)
+   icmd-ulpTimeout = FF_DEF_RATOV * 2;
+   else
+   icmd-ulpTimeout = phba-fc_ratov * 2;
} else {
icmd-un.xseq64.bdl.addrHigh = putPaddrHigh(pbuflist-phys);
icmd-un.xseq64.bdl.addrLow = putPaddrLow(pbuflist-phys);
@@ -1086,8 +1089,8 @@ stop_rr_fcf_flogi:
 
/* FLOGI completes successfully */
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
-0101 FLOGI completes successfully 
-Data: x%x x%x x%x x%x x%x x%x\n,
+0101 FLOGI completes successfully, I/O tag:x%x, 
+Data: x%x x%x x%x x%x x%x x%x\n, cmdiocb-iotag,
 irsp-un.ulpWord[4], sp-cmn.e_d_tov,
 sp-cmn.w2.r_a_tov, sp-cmn.edtovResolution,
 vport-port_state, vport-fc_flag);
diff -upNr a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c  2013-04-15 18:26:44.695041295 -0400
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c  2013-04-15 18:26:55.603041543 -0400
@@ -2272,8 +2272,11 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(stru
spin_unlock_irq(phba-hbalock);
lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
2836 New FCF matches in-use 
-   FCF (x%x)\n,
-   phba-fcf.current_rec.fcf_indx);
+   FCF (x%x), port_state:x%x, 
+   fc_flag:x%x\n,
+   phba-fcf.current_rec.fcf_indx,
+   phba-pport-port_state,
+   phba-pport-fc_flag);
goto out;
} else
lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-04-15 18:26:52.730041478 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-04-15 18:26:55.615041544 -0400
@@ -13991,13 +13991,14 @@ lpfc_fc_frame_check(struct lpfc_hba *phb
}
 
lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-   2538 Received frame rctl:%s type:%s 
-   Frame Data:%08x %08x %08x %08x %08x %08x\n,
-   rctl_names[fc_hdr-fh_r_ctl],
-   type_names[fc_hdr-fh_type],
+   2538 Received frame rctl:%s (x%x), type:%s (x%x), 
+   frame Data:%08x %08x %08x %08x %08x %08x %08x\n,
+   rctl_names[fc_hdr-fh_r_ctl], fc_hdr-fh_r_ctl,
+   type_names[fc_hdr-fh_type], fc_hdr-fh_type,
be32_to_cpu(header[0]), be32_to_cpu(header[1]),
be32_to_cpu(header[2]), be32_to_cpu(header[3]),
-   be32_to_cpu(header[4]), be32_to_cpu(header[5]));
+   be32_to_cpu(header[4]), be32_to_cpu(header[5]),
+   be32_to_cpu(header[6]));
return 0;
 drop:
lpfc_printf_log(phba, KERN_WARNING, LOG_ELS,



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


[PATCH 21/22] lpfc 8.3.39: Fixed driver handling of CLEAR_LA with NPIV enabled causing SID=0 frames out

2013-04-17 Thread James Smart
Fixed driver handling of CLEAR_LA with NPIV enabled causing SID=0 frames out


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_hbadisc.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c  2013-04-15 18:26:55.603041543 -0400
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c  2013-04-15 18:26:56.995041575 -0400
@@ -1009,9 +1009,6 @@ lpfc_linkup(struct lpfc_hba *phba)
for (i = 0; i = phba-max_vports  vports[i] != NULL; i++)
lpfc_linkup_port(vports[i]);
lpfc_destroy_vport_work_array(phba, vports);
-   if ((phba-sli3_options  LPFC_SLI3_NPIV_ENABLED) 
-   (phba-sli_rev  LPFC_SLI_REV4))
-   lpfc_issue_clear_la(phba, phba-pport);
 
return 0;
 }
@@ -5028,11 +5025,13 @@ lpfc_disc_start(struct lpfc_vport *vport
if (num_sent)
return;
 
-   /* Register the VPI for SLI3, NON-NPIV only. */
+   /* Register the VPI for SLI3, NPIV only. */
if ((phba-sli3_options  LPFC_SLI3_NPIV_ENABLED) 
!(vport-fc_flag  FC_PT2PT) 
!(vport-fc_flag  FC_RSCN_MODE) 
(phba-sli_rev  LPFC_SLI_REV4)) {
+   if (vport-port_type == LPFC_PHYSICAL_PORT)
+   lpfc_issue_clear_la(phba, vport);
lpfc_issue_reg_vpi(phba, vport);
return;
}



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


[PATCH 22/22] lpfc 8.3.39: Update lpfc version for 8.3.39 driver release

2013-04-17 Thread James Smart
Update lpfc version for 8.3.39 driver release


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_version.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
--- a/drivers/scsi/lpfc/lpfc_version.h  2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_version.h  2013-04-15 18:26:58.178041602 -0400
@@ -18,7 +18,7 @@
  * included with this package. *
  ***/
 
-#define LPFC_DRIVER_VERSION 8.3.38
+#define LPFC_DRIVER_VERSION 8.3.39
 #define LPFC_DRIVER_NAME   lpfc
 
 /* Used for SLI 2/3 */



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