RE: [Announce] Emulex lpfcdriver v8.0.20 available

2005-01-18 Thread James . Smart

 -Original Message-
 From: Christoph Hellwig [mailto:[EMAIL PROTECTED]
 Sent: Monday, January 17, 2005 5:23 PM
 To: Smart, James
 Cc: linux-scsi@vger.kernel.org
 Subject: Re: [Announce] Emulex lpfcdriver v8.0.20 available
 
 
 I started to look through it, here's some thing I found so far:
 
  o there's still a -proc_info method which we don't want for 
 new drivers

OK.

  o the host removal is still quite hackish and probably racy:
 - everything what's you're ding with FC_UNLOADING should 
 be done in
   the midlayer where we already have a state machine for the
   Scsi_Host

There's only 2 uses for this flag...

- In the node state machine, which prevents upcalls to the midlayer
  for port state changes and/or invoking scsi scan functions.

  As the driver must deal with FC nodes (remote ports) independently
  of whether the SCSI layer (via scsi_host) is active on the adapter,
  we need the functionality to block the scsi midlayer upcalls.
  I don't see how this belongs in the midlayer

- Stops new i/o issued via queuecommand.

  The check here can probably be removed as long as there's a guarantee
  that there will be no queuecommand calls after scsi_remove_host
  completes. I believe this to be true. The only question I had
  concerns any in-progress scans when scsi_remove_host is called. Does
  remove host cancel the scans (vs just depending on reference counts) ?

 - target removal shouldn't happen from your remove method but via
   scsi_remove_host

Ok. Originally, this was thought to be more graceful than
scsi_remove_host (less console messages). However, testing shows no
discernable difference so we can easily do this.

  o the driver would benefit a _lot_ from driver private data in
scsi_target, I think we should do that and basically get rid of
phba-device_queue_hash

Doable - although this now requires yet another midlayer patch to allow
host-private data to be allocated along with the target, and the 
addition of target alloc/destroy callback functions. Note that the
midlayer calling sequences for the scsi target, vs the scsi device,
are rather interesting right now (slave alloc called before a target
alloc would be called).

To be honest - I don't think the gain will be that large. There are
really only 5 elements that are target specific (e.g. lpfc_target),
3 of them stats counters. (Note: this has the assumption that nodes
are not combined with scsi targets).

device_queue_hash is used whenever we have to look up entries by
target id. In general, we used this mainly in the eh_xxx routines,
but I guess they can take a little longer to search for the node
associated to the target id.

  o what about lpfc_target-rport?  This should probably better be in
the fc_target structure, no?

Anything in lpfc_target would go into the scsi_target hostdata
(not fc_target).

  o lpfc_target vs lpfc_nodelist.  I'd see these merged into a single
structure.  In fact large parts of lpfc_nodelist should probably
move into the transport class.

?? lpfc_target would merge with scsi_target. lpfc_nodelist stays as is
(and independent from the scsi_target).

I disagree with moving the nodelist code (e.g. FC discovery state
machines) into the transport. My opinion is this where you cross into
an area that can be very hardware-dependent (some adapters do this
completely within the adapter). I know that in our case, almost 1/2 of
the states are induced by the way our driver must interact with our
hardware. At this point, I don't see any benefits to taking this step.

  o the memory allocation for non-I/O path stilled looked 
 total overkill
to me, but it seems you're doing an awfull lot from the 
 interrupt handler
still.  Wouldn't it be easier to do much of it from process context
via the kernel thread?

Yes - we're still looking at the memory allocations outside of the i/o
path and expected to resolve it while addressing new comments (such as
these :).  There's a couple of issues we're addressing relative to
calls made in the interrupt handler, so - yes, well move much of this
over to the kernel thread.

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


RE: [PATCH] drop some attibutes from the FC transport class

2005-01-19 Thread James . Smart
True. The only thing that made them FC-ish is that they were
mandated by HBAAPI.  The only other desire was to place all
hbaapi-related data in a single place so users/applications don't
have to trapse through the multiple directories in the class and
device trees.

I'll ping Greg on adding them to the common driver model code.

As for the copyright notices - I'll add them. Sorry, my lack of
procedure on kernel additions.  Just trying to be a good citizen.

-- James


 I think the hardware_version, firmware_version, rom_version and
 driver_version don't belong into the FC transport class, there's
 nothign specific to FC or even SCSI specific in them.
 
 If you want these attributes talk to Greg about fiding a place in
 the common driver model code for them.
 
 p.s. I was surprised to find no Emulex copyright notices in the FC
 transport implementation fields, I suspect you should add them.
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [Announce] Emulex lpfcdriver v8.0.20 available

2005-01-20 Thread James . Smart
 What console messages do you see?  Looks like we'd have to add another
 allowed state transition from BLOCKED?

At one point we were seeing 
   Synchronizing SCSI cache for disk sdc:
FAILED
  status = 0, message = 00, host = 1, driver = 00
  5
messages. However, at this point, the sequencing in the driver for unload,
scsi_host_removal, and datastructure teardown is such that we are avoiding
this condition and removals are clean.

No changes are needed.

 Yes, the allocation would need to be changed a little.  But 
 hey, I don't
 think we should block merging the driver on this one.  We'll probably
 introduce it soon and I'll sign you up for testing that patch on the
 lpfc drivewr when it's ready.

Reasonable.

o what about lpfc_target-rport?  This should probably 
 better be in
  the fc_target structure, no?
  
  Anything in lpfc_target would go into the scsi_target hostdata
  (not fc_target).
 
 I meant fc_target_attrs actually, which is scsi_target transport-data.
 
 The point here is that the rport is a transport-class transport object
 that every driver fully converted to fc_transport needs, so 
 it's better
 in transport data as well.

If I understand you - it's the recommendation that the remote port be
part of the fc_target transport data.  I disagree. If anything, it would
be the other way around. The port exists before any scsi target (thus it
can't be part of the target allocation). The port can also exist without
being a scsi target, so there's no scsi target structure at all.

 
 Now looking at lpfc_target given that the rport goes away we only
 have the I/O counters left and the nodlist pointer.  The I/O counters
 aren't really a driver thing and should probably move to the midlayer
 which only leaves the nodelist as private data in the scsi_device.
 
 Sounds like the way to go?

Nope. The counters are a scsi-thing (not fc-thing), so they make sense
to go into the scsi_target. If you want to make them more general for
all drivers, we can do this. Right now, I wouldn't bother.

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


RE: [Announce] Emulex lpfcdriver v8.0.20 available

2005-01-20 Thread James . Smart
 No, sorry for have been unclear.  I want a pointer to the remote port
 structure in the fc_target transport data.  Every driver needs the
 linkage of these two, and instead of everyone having it in their
 private data we'd better move it to the fc_transport data structure.

Ok. It's already there. What this boils down do is exactly your last
statement (and our driver doesn't do it - we'll fix it).

Note: there's a flipside here... with the remote port stuff, we had
removed almost all the reasons for a fc driver to reference a scsi_target.
The only place we really had to was in the case the older fc_transport/xxx
sysfs attributes (which all but one exist only for compatibility).

We could move this into the remote port structure (already set up for this)
which will always exist for a scsi_target. Even so, I think extending the
scsi target and fixing the calling sequence is the correct thing to do.

  What about dropping the 
 counters temporarily
 for submission and submit a patch later that adds them (and 
 their sysfs
 exposure) back at the midlayer?  In fact the actual 
 accounting is better
 done at the midlayer-level anyway.

OK.

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


RE: [Announce] Emulex lpfcdriver v8.0.20 available

2005-01-20 Thread James . Smart
 This sounds like a good idea, but I wonder if we have userland relying
 on those attributes already.  But given that the fc transport class
 was mostly a joke before you encehanced it it might be worth breaking
 it..

You and James would have to give the approval for this one. I already
encountered issues with these attributes when then went from scsi_device
to scsi_target. The most significant hiccup was to udev and the projects
depending on it... Also, given the potential amount of change may be
needed to move to rports, I wouldn't want to pull the rug out from under
the other drivers until they are ready...

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


[PATCH 0/3] MidLayer updates

2005-01-29 Thread James . Smart

The following 3 patches extend the scsi midlayer. Changes were prompted
by recent discussions with Christoph as part of the Emulex driver thread.

Patch 1: 
  Updates the recent transport container patch for :
  - allow device driver-specific attributes to be added to class objects
  - exposes classdev to transport via setup function

Patch 2: 
  Adds io statistics (requests, completions, error count) as generic
  attributes for scsi devices.

Patch 3: 
  This patch extends scsi_target support:
  - Allows for driver-specific data to be allocated along with the
target structure and accessible via the starget-hostdata pointer.
  - Adds scsi target alloc/configure/destory callbacks to the
scsi host template.
  - Rearranges the calling sequences for scsi targets so that the
target and slave alloc/configure/destory callbacks are in
order (target before slave on alloc/configure).

Although bad form, as there's so much churn in this area, the following
dependencies exist:
- Patches were created against scsi-rc-fixes-2.6 bitkeeper tree.
- Patch 1 depends on Mike Christies patch 
  http://marc.theaimsgroup.com/?l=linux-scsim=110678937715985w=2


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


[PATCH 1/3] MidLayer updates - extending transport/attribute container changes

2005-01-29 Thread James . Smart

Patch 1: 
  Updates the recent transport container patch for :
  - allow device driver-specific attributes to be added to class objects
  - exposes classdev to transport via setup function

-- James S


p1_xpt.patch
Description: p1_xpt.patch


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

2005-01-29 Thread James . Smart

Patch 3: 
  This patch extends scsi_target support:
  - Allows for driver-specific data to be allocated along with the
target structure and accessible via the starget-hostdata pointer.
  - Adds scsi target alloc/configure/destory callbacks to the
scsi host template.
  - Rearranges the calling sequences for scsi targets so that the
target and slave alloc/configure/destory callbacks are in
order (target before slave on alloc/configure).

-- James S


p3_hostdata.patch
Description: p3_hostdata.patch


RE: Mid-layer handling of NOT_READY conditions...

2005-01-31 Thread James . Smart
If the transport hits a problem, there's
  no harm done as long as the problem is resolved within the block
  timeout. If the timeout is hit - it's because the user dicated that
  it wanted to know of errors within this time and if the 
 device fails,
  it fails...
  
  In the multipath solution - the block time used by the 
 transport gets
  set to 0 (or 1 second), so the i/o fails quickly and the multipath
  function can kick in.
  
 
 A bit confused now, are you proposing that 
 cmd-timeout_per_command time
 be inclusive of potential transport failures resulting in a requested
 retry?  And thus not be refreshed (as it currently is) upon retry
 request.

Nope. I knew I probably said the wrong thing here...

Let the io timeout stays as is. If the block condition occurs - it's up
to the driver take the right action on whether the i/o was killed as a
result or not. If it kills it, the driver should error it right away,
then the block code will hold off the retry. If it isn't killed, it lets
the i/o timer fire normally, which may invoke the eh_abort handler
(which is not held off by the block). After the abort, the retry would
be held off by the blocked state.

You want the dev_loss timer low so that other i/o will get through, and
can fail, thus invoking the device state change (and subsequent aborts
of the pending i/o's).


 Perhaps there could be
 a combination of timing conditionals -- the 
 fc_starget_dev_loss_tmo() to
 time the overall pause in 'not-ready' plugging and a
 period-to-wakeup-and-ping-the-storage time within the window?

Agree. I assume the ping-the-storage function is something done as
part of the multipathing so that it has an accurate state of the path.

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


[PATCH] fix the fix for multiple HBA problem with transport classes

2005-02-02 Thread James . Smart
Testing was showing transport devices not being enumerated.

The reason was the wrong attribute container was being compared
against in the match functions.  This patch fixes it.

-- james s


diff -puN a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
--- a/drivers/scsi/scsi_transport_fc.c  2005-02-02 14:49:15.0 -0500
+++ b/drivers/scsi/scsi_transport_fc.c  2005-02-02 15:31:47.0 -0500
@@ -759,7 +759,7 @@ static int fc_target_match(struct attrib
 
i = to_fc_internal(shost-transportt);
 
-   return i-t.host_attrs == cont;
+   return i-t.target_attrs == cont;
 }
 
 
diff -puN a/drivers/scsi/scsi_transport_spi.c 
b/drivers/scsi/scsi_transport_spi.c
--- a/drivers/scsi/scsi_transport_spi.c 2005-02-02 14:58:01.0 -0500
+++ b/drivers/scsi/scsi_transport_spi.c 2005-02-02 15:32:52.0 -0500
@@ -148,7 +148,7 @@ static int spi_host_match(struct attribu
 
i = to_spi_internal(shost-transportt);
 
-   return i-t.target_attrs == cont;
+   return i-t.host_attrs == cont;
 }
 
 static int spi_device_configure(struct device *dev)
diff -puN a/drivers/scsi/scsi_transport_iscsi.c 
b/drivers/scsi/scsi_transport_iscsi.c
--- a/drivers/scsi/scsi_transport_iscsi.c   2005-02-02 15:30:56.0 
-0500
+++ b/drivers/scsi/scsi_transport_iscsi.c   2005-02-02 15:32:07.0 
-0500
@@ -289,7 +289,7 @@ static int iscsi_target_match(struct att
 
i = to_iscsi_internal(shost-transportt);
 
-   return i-t.host_attrs == cont;
+   return i-t.target_attrs == cont;
 }
 
 struct scsi_transport_template *
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2005-02-05 Thread James . Smart

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

This can certainly be transport-specific. However, I assumed the better
solution was to make it more generic as there's nothing about this
problem that's transport-centric. If a driver only tracks things by 
target (not lun), it makes a whole lotta sense to allow for per-target
data.

Please note however, that I recommend the changes for calling sequence
be taken in regardless. The issue is that the sdev transport setup and
slave alloc calls are made prior to the existence of the starget (thus
any starget transport setup call). The starget really needs to be in
place beforehand.

Let me know - I can revise the patch accordingly.

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


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

2005-02-06 Thread James . Smart
No - there was no discussion of adding scsi targets to linux (per your
definition or otherwise).

Since the Emulex driver tracks things by target (actually FC remote port)
rather than luns, having the ability to have driver data space in the
lun didn't help much. Yes, the driver data space could be in the
transport-specific FC remote port, but I thought a more generic solution
would have been prefered - thus the patch request.

At this point, it appears that consensus is against the need for this,
especially as it can be handled within the only area needed today - that of
the FC transport.

-- james s


 -Original Message-
 From: Vladislav Bolkhovitin [mailto:[EMAIL PROTECTED]
 Sent: Sunday, February 06, 2005 9:18 AM
 To: linux-scsi@vger.kernel.org
 Cc: Smart, James
 Subject: Re: [PATCH 3/3] MidLayer updates - extending scsi_target
 support
 
 
 Please, forgive me my ignorance, it looks like something was happened 
 behind the scene (linux-scsi list), and I missed it. Is support for 
 SCSI targets started to be added in Linux? I mean SCSI 
 targets as the 
 ability to export local devices on a SCSI bus. If so, please consider 
 proposed SCSI target mid-level (SCST) living on 
 http://scst.sourceforge.net. In the next few weeks we are 
 going to clean 
 it a bit and prepare the patch, so it could start being part of some 
 testing tree, probably -mm, although it is stable enough ever for 
 Linus one.
 
 BTW, are there any descriptions for current scsi_target 
 support and in 
 which direction it's moving?
 
 Vlad
 
 [EMAIL PROTECTED] wrote:
  Patch 3: 
This patch extends scsi_target support:
- Allows for driver-specific data to be allocated along with the
  target structure and accessible via the 
 starget-hostdata pointer.
- Adds scsi target alloc/configure/destory callbacks to the
  scsi host template.
- Rearranges the calling sequences for scsi targets so that the
  target and slave alloc/configure/destory callbacks are in
  order (target before slave on alloc/configure).
  
  -- James S
 
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH scsi-rc-fixes-2.6] Re-enable FC Transport Host Statistics

2005-02-08 Thread James . Smart


  With the conversion to the new attribute containers/transport work, the
  FC host statistics were lost. This patch re-enables them.

  This patch adds a statistics group to each attribute container and
  adds/removes them at the same time the base attributes are added/removed.


-- James S



tran_stats.patch
Description: tran_stats.patch


[Repost] [PATCH scsi-rc-fixes-2.6] Re-enable FC Transport Host Statistics

2005-02-09 Thread James . Smart
The patch contained in the original message had a mixed up diff line...

Here's the corrected patch.

-- James S


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Smart, James
 Sent: Tuesday, February 08, 2005 11:04 PM
 To: linux-scsi@vger.kernel.org
 Subject: [PATCH scsi-rc-fixes-2.6] Re-enable FC Transport Host
 Statistics
 
 
 
 
   With the conversion to the new attribute 
 containers/transport work, the
   FC host statistics were lost. This patch re-enables them.
 
   This patch adds a statistics group to each attribute container and
   adds/removes them at the same time the base attributes are 
 added/removed.
 
 
 -- James S
 
 



tran_stats.patch
Description: tran_stats.patch


RE: still BUG's for smp_processor_id() on interrupt

2005-02-09 Thread James . Smart
This looks suspiciously like the oops trace that I saw when
loading/unloading driver a couple of times. Make sure you have the
following patches.

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


-- James S



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Patrick 
 Mansfield
 Sent: Wednesday, February 09, 2005 12:22 PM
 To: Andrew Vasquez; linux-scsi@vger.kernel.org; Andrew Morton
 Subject: Re: still BUG's for smp_processor_id() on interrupt
 
 
 On Tue, Feb 08, 2005 at 10:44:35PM -0800, Andrew Vasquez wrote:
  On Tue, 08 Feb 2005, Patrick Mansfield wrote:
  
   I'm still getting lots of BUG's for the smp_processor_id, 
 but via the
   interrupt function.
   
  
  It's during the driver's init-time polling for interrupts...
 
  Argg -- that was careless...  Again, the smp_processor_id() is used
  only as a heuristic.  The attached patch should quash the noise.
 
 OK, that gets rid of the BUG stuff, but now I am hitting an oops.
 
 A bit odd that the smp_processor_id() debug code seemed to 
 prevent this.
 
 I am using an old compiler on a NUMAQ system. Attaching the .config.
 
 This is with 2.6 bk from yesterday + your patch.
 
 It looks like it is in the list_add_tail() at the end of
 attribute_container_add_device.
 
 [elm3b79 base]$ gcc -v
 Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
 gcc version 2.95.4 20011002 (Debian prerelease)
 
 Unable to handle kernel paging request at virtual address 42555300
  printing eip:
 c01dbebb
 *pde = 084bac0f
 Oops:  [#1]
 PREEMPT SMP
 Modules linked in: qla2300 qla2xxx scsi_transport_fc
 CPU:5
 EIP:0060:[c01dbebb]Not tainted VLI
 EFLAGS: 00010202   (2.6.11-rc3pm)
 EIP is at attribute_container_add_device+0x143/0x16c
 eax: 42555300   ebx: f46200e4   ecx:    edx: 42555300
 esi: c0357964   edi: f462   ebp: c0357964   esp: e0b92e50
 ds: 007b   es: 007b   ss: 0068
 Process modprobe (pid: 8582, threadinfo=e0b92000 task=f4880570)
 Stack: f46200e4 c0357964 f462 c0357964 f462013c 42555300 
 c01dc2c7 f46200e4
c01dc294 c0203658 f46200e4 f4620184 f462  
 f46200e4 c01fbf79
f462 f46201ec f462 f5a81444 036310e5 f88b79d7 
 f462 f5a81444
 Call Trace:
  [c01dc2c7] transport_setup_device+0xf/0x14
  [c01dc294] transport_setup_classdev+0x0/0x24
  [c0203658] scsi_sysfs_add_host+0xac/0xbc
  [c01fbf79] scsi_add_host+0xf1/0x124
  [f88b79d7] qla2x00_probe_one+0x75b/0x874 [qla2xxx]
  [f88d0012] gcc2_compiled.+0x12/0x18 [qla2300]
  [c01b2424] pci_device_probe_static+0x2c/0x40
  [c01b2457] __pci_device_probe+0x1f/0x34
  [c01b2488] pci_device_probe+0x1c/0x34
  [c01d918d] driver_probe_device+0x41/0x64
  [c01d9260] driver_attach+0x34/0x68
  [c01d96bb] bus_add_driver+0x8b/0xbc
  [c01d9c08] driver_register+0x50/0x54
  [c01b2686] pci_register_driver+0x86/0xa0
  [f00a] qla2300_init+0xa/0x10 [qla2300]
  [c012c479] sys_init_module+0x111/0x270
  [c0102443] syscall_call+0x7/0xb
 Code: 55 e8 4a 02 00 00 83 c4 04 8b 44 24 14 83 c0 08 8b 50 
 04 89 58 04 89 03 89 53 04 89 1a 8b 44 24 14 8b 00 89 44 24 
 14 8b 54 24 14 8b 02 0f 18 00 90 81 fa 80 91 46 c0 0f 85 e7 
 fe ff ff f0 ff 05
 
 -- Patrick Mansfield
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2/2 scsi-rc-fixes-2.6] FC Remote Port patch

2005-02-09 Thread James . Smart
 seems like sdev-shost is bogus when fc_remote_port_block() is
 called...

We haven't seen this in our testing

 lpfc_ext_debug -- residuals from some test code?

yep - thought I had everything, guess not. I'm rebacking to 
scsi-misc-2.6 and will repost. This will be taken care of.

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


RE: [RFC] adding per scsi-host workqueues for defered processing

2005-02-21 Thread James . Smart
  
  I'd like to propose the addition of a per-Scsi_Host work-queue to
  manage these scanning as well as any other (relevant)
  lower-level-driver differed requests.
 
 Why not use the per-host error handler thread for this?

brings a deadlock condition to mind - where the error thread is needed
in order to cancel/terminate an i/o issued via the scan.

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


RE: One question about SCSI device hotplug

2005-03-01 Thread James . Smart
 On Tue, Mar 01, 2005 at 05:06:55PM +0800, Zhao, Forrest wrote:
  If I surprisingly hot-remove a SCSI disk from HBA manually 
  without executing echo scsi remove-single-device
   h b t l  /proc/scsi/scsi, can the hotplug
  event be notified to SCSI mid-layer or user space?
  
  I briefly browse some code of LLDD, it seems that LLDD never
  report hotplug event to upper-level layer. Am I right?
 
 I don't think it *can* ... the SCSI protocols don't tell the 
 host hey,
 this device has disappeared.

All depends on what transport it is... In FC, we can detect when
a target is removed. In the most recent FC transport code (not
all integrated yet), it will indeed automagically invoke
scsi_remove_device() for all luns on the target.

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


RE: One question about SCSI device hotplug

2005-03-02 Thread James . Smart
 Thank you, Matt. Then I have another question:
 As we know SCSI mid-layer issue a command to LLDD by 
 host-hostt-queuecommand(cmd, scsi_done); and in the meantime a 
 timer is set. When the timer expires, SCSI mid-layer know the 
 execution of command has failed.
 My question is: when SCSI device is surprise-removed, if SCSI 
 mid-layer
 issue a command to this removed device, will mid-layer has to wait 
 a timeout before it can know the execution of command failed? Or is
 there
 any other mechanism that LLDD can notify mid-layer that execution of
 command failed without waiting for a timeout?

What we did in the FC transport - there's a transport level timeout at
the target level that controls how long we insulate the system from
the device's disappearance. When the device is first removed, the
transport has the midlayer suspend i/o (e.g block) the device, so no
i/o failures, other than timeouts on in-flight i/o's occur. As the
midlayer (for disk devices) typically retries i/o's, even the in-flight
errors don't result in an error to the application, as the retry get's
delayed due the blocked state of the device. If the device returns
within the insulation period, i/o resumes, and the system continues
happily along it's way. If the device does not return, the timeout
fires, and the device is restarted. The i/o then reaches the LLDD, who
is expected to fail the i/o immediately as the target doesn't exist.
The midlayer reacts accordingly and places the device into an offline
state.

If the device is readded, the LLDD sets the target to a good state, but
the midlayer keeps the devices in an offline state until steps are taken
to bring them back online. E.g. The admin takes whatever steps are
necessary to clean up the system for the previous failure of the device,
then brings the device online by writing the device state to running
and rescanning the device.

If multipath solutions are in place, they will want to set the
insulation timeout as low as possible so that access so that it's
alternate pathing can kick in as soon as possible.  The multipathing
solution, upon device re-addition, is required to take the steps to
bring the device back online.

-- james s 

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


RE: [RFC] adding per scsi-host workqueues for defered processing

2005-03-05 Thread James . Smart
Following discussions which resulted from the:

[RFC] target code updates to support scanned targets
http://marc.theaimsgroup.com/?l=linux-scsim=110850749515984w=2

thread, the overall consensus seems to be that transport-classes
should support a 'true-hotplug' mechanism of device discovery and
removal (this involves both registration and lun-scanning).  In order
to facilitate this ability and to not constrain the LLDD from the
typical restrictions of the storage scanning process:

* must be done from process context -- depending on transport type,
  discovery can occur from a non-process context
* potentially _long_ scan times -- even if discovery is done from a
  'sleeping' capable context, halting a LLDD for discovery purposes
  is typically undesirable.

I'd like to propose the addition of a per-Scsi_Host work-queue to
manage these scanning as well as any other (relevant)
lower-level-driver differed requests.

The thing I disliked about this patch was that it required the
LLDD to know that the transport needs a workq, thus set the host
template appropriately.

Instead, we should have the transport template, initialized by the
transport, indicate whether the workq needs to exist or not. This does
mean that the new interface is more restricted, as it essentially
excludes the LLDD from using it. It doesn't seem unreasonable as the
LLDD is always free to create it's own work queues.

I've attached a revised patch.

One other note:
   scsi_scan_target(rport-dev, rport-channel,
   rport-scsi_target_id, SCAN_WILD_CARD, 0);

The rescan flag should be 1, not 0. If 0, all kinds of bad things can
happen as of the 2nd scan request.

-- james s



diff -puN a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
--- a/drivers/scsi/hosts.c  2005-03-05 06:55:47.0 -0500
+++ b/drivers/scsi/hosts.c  2005-03-05 07:13:43.0 -0500
@@ -129,6 +129,15 @@ int scsi_add_host(struct Scsi_Host *shos
 GFP_KERNEL)) == NULL)
goto out_del_classdev;
 
+   if (shost-transportt-create_work_queue) {
+   snprintf(shost-work_q_name, KOBJ_NAME_LEN, scsi_wq_%d,
+   shost-host_no);
+   shost-work_q = create_singlethread_workqueue(
+   shost-work_q_name);
+   if (!shost-work_q)
+   goto out_free_shost_data;
+   }
+
error = scsi_sysfs_add_host(shost);
if (error)
goto out_destroy_host;
@@ -137,6 +146,10 @@ int scsi_add_host(struct Scsi_Host *shos
return error;
 
  out_destroy_host:
+   if (shost-work_q)
+   destroy_workqueue(shost-work_q);
+ out_free_shost_data:
+   kfree(shost-shost_data);
  out_del_classdev:
class_device_del(shost-shost_classdev);
  out_del_gendev:
@@ -160,6 +173,9 @@ static void scsi_host_dev_release(struct
shost-eh_notify = NULL;
}
 
+   if (shost-work_q)
+   destroy_workqueue(shost-work_q);
+
scsi_proc_hostdir_rm(shost-hostt);
scsi_destroy_command_freelist(shost);
kfree(shost-shost_data);
@@ -393,3 +409,27 @@ int scsi_is_host_device(const struct dev
return dev-release == scsi_host_dev_release;
 }
 EXPORT_SYMBOL(scsi_is_host_device);
+
+/**
+ * scsi_queue_work - Queue work to the Scsi_Host workqueue.
+ * @shost: Pointer to Scsi_Host.
+ * @work:  Work to queue for execution.
+ *
+ * Return value:
+ * 0 on success / != 0 for error
+ **/
+int scsi_queue_work(struct Scsi_Host *shost, struct work_struct *work)
+{
+   if (unlikely(!shost-work_q)) {
+   printk(KERN_ERR
+   ERROR: Scsi host '%s' attempted to queue scsi-work, 
+   when no workqueue created.\n, shost-hostt-name);
+   dump_stack();
+
+   return -EINVAL;
+   }
+
+   return queue_work(shost-work_q, work);
+}
+EXPORT_SYMBOL_GPL(scsi_queue_work);
+
diff -puN a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
--- a/include/scsi/scsi_host.h  2005-03-05 06:56:48.0 -0500
+++ b/include/scsi/scsi_host.h  2005-03-05 07:07:12.0 -0500
@@ -4,6 +4,7 @@
 #include linux/device.h
 #include linux/list.h
 #include linux/types.h
+#include linux/workqueue.h
 
 struct block_device;
 struct module;
@@ -508,6 +509,12 @@ struct Scsi_Host {
unsigned reverse_ordering:1;
 
/*
+* Optional work queue to be utilized by the transport
+*/
+   char work_q_name[KOBJ_NAME_LEN];
+   struct workqueue_struct *work_q;
+
+   /*
 * Host has rejected a command because it was busy.
 */
unsigned int host_blocked;
@@ -570,6 +577,8 @@ static inline struct Scsi_Host *dev_to_s
return container_of(dev, struct Scsi_Host, shost_gendev);
 }
 
+extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);
+
 extern struct Scsi_Host *scsi_host_alloc(struct 

RE: [RFC] adding per scsi-host workqueues for defered processing

2005-03-05 Thread James . Smart
In thinking this through a little further - if the workq is just
for the transport, the transport ought to simply create and use
the workq. There would be no need to modify the host structure.

If we're trying to avoid the potential for several workq's on a
per-host basis (one by the transport, another by the LLDD, another
for ?) - the idea of one in the host is worth while. However, it
should always be allocated and available. No create flag should
be needed.

Thoughts ?

-- james s


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Smart, James
 Sent: Saturday, March 05, 2005 8:08 AM
 To: [EMAIL PROTECTED]; linux-scsi@vger.kernel.org
 Subject: RE: [RFC] adding per scsi-host workqueues for defered
 processing
 
 
 Following discussions which resulted from the:
 
 [RFC] target code updates to support scanned targets
 http://marc.theaimsgroup.com/?l=linux-scsim=110850749515984w=2
 
 thread, the overall consensus seems to be that transport-classes
 should support a 'true-hotplug' mechanism of device discovery and
 removal (this involves both registration and lun-scanning).  In order
 to facilitate this ability and to not constrain the LLDD from the
 typical restrictions of the storage scanning process:
 
 * must be done from process context -- depending on transport type,
   discovery can occur from a non-process context
 * potentially _long_ scan times -- even if discovery is done from a
   'sleeping' capable context, halting a LLDD for discovery purposes
   is typically undesirable.
 
 I'd like to propose the addition of a per-Scsi_Host work-queue to
 manage these scanning as well as any other (relevant)
 lower-level-driver differed requests.
 
 The thing I disliked about this patch was that it required the
 LLDD to know that the transport needs a workq, thus set the host
 template appropriately.
 
 Instead, we should have the transport template, initialized by the
 transport, indicate whether the workq needs to exist or not. This does
 mean that the new interface is more restricted, as it essentially
 excludes the LLDD from using it. It doesn't seem unreasonable as the
 LLDD is always free to create it's own work queues.
 
 I've attached a revised patch.
 
 One other note:
  scsi_scan_target(rport-dev, rport-channel,
  rport-scsi_target_id, SCAN_WILD_CARD, 0);
 
 The rescan flag should be 1, not 0. If 0, all kinds of bad things can
 happen as of the 2nd scan request.
 
 -- james s
 
 
 
 diff -puN a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
 --- a/drivers/scsi/hosts.c2005-03-05 06:55:47.0 -0500
 +++ b/drivers/scsi/hosts.c2005-03-05 07:13:43.0 -0500
 @@ -129,6 +129,15 @@ int scsi_add_host(struct Scsi_Host *shos
GFP_KERNEL)) == NULL)
   goto out_del_classdev;
  
 + if (shost-transportt-create_work_queue) {
 + snprintf(shost-work_q_name, KOBJ_NAME_LEN, 
 scsi_wq_%d,
 + shost-host_no);
 + shost-work_q = create_singlethread_workqueue(
 + shost-work_q_name);
 + if (!shost-work_q)
 + goto out_free_shost_data;
 + }
 +
   error = scsi_sysfs_add_host(shost);
   if (error)
   goto out_destroy_host;
 @@ -137,6 +146,10 @@ int scsi_add_host(struct Scsi_Host *shos
   return error;
  
   out_destroy_host:
 + if (shost-work_q)
 + destroy_workqueue(shost-work_q);
 + out_free_shost_data:
 + kfree(shost-shost_data);
   out_del_classdev:
   class_device_del(shost-shost_classdev);
   out_del_gendev:
 @@ -160,6 +173,9 @@ static void scsi_host_dev_release(struct
   shost-eh_notify = NULL;
   }
  
 + if (shost-work_q)
 + destroy_workqueue(shost-work_q);
 +
   scsi_proc_hostdir_rm(shost-hostt);
   scsi_destroy_command_freelist(shost);
   kfree(shost-shost_data);
 @@ -393,3 +409,27 @@ int scsi_is_host_device(const struct dev
   return dev-release == scsi_host_dev_release;
  }
  EXPORT_SYMBOL(scsi_is_host_device);
 +
 +/**
 + * scsi_queue_work - Queue work to the Scsi_Host workqueue.
 + * @shost:   Pointer to Scsi_Host.
 + * @work:Work to queue for execution.
 + *
 + * Return value:
 + *   0 on success / != 0 for error
 + **/
 +int scsi_queue_work(struct Scsi_Host *shost, struct 
 work_struct *work)
 +{
 + if (unlikely(!shost-work_q)) {
 + printk(KERN_ERR
 + ERROR: Scsi host '%s' attempted to 
 queue scsi-work, 
 + when no workqueue created.\n, 
 shost-hostt-name);
 + dump_stack();
 +
 + return -EINVAL;
 + }
 +
 + return queue_work(shost-work_q, work);
 +}
 +EXPORT_SYMBOL_GPL(scsi_queue_work);
 +
 diff -puN a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
 --- a/include/scsi/scsi_host.h2005-03-05 
 06:56:48.0 -0500
 +++ b/include/scsi/scsi_host.h

RE: [RFC] adding per scsi-host workqueues for defered processing

2005-03-08 Thread James . Smart
So, is there a reason we aren't just starting the workq thread
upon the first call to queue something to it ?

-- james s

 -Original Message-
 From: Luben Tuikov [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 08, 2005 8:12 AM
 To: Andrew Vasquez
 Cc: Smart, James; linux-scsi@vger.kernel.org
 Subject: Re: [RFC] adding per scsi-host workqueues for defered
 processing
 
 
 On 03/08/05 02:00, Andrew Vasquez wrote:
  There were some background tasks I shelved until the remote-ports
  stuff settled down which I thought could use the deferred processing
  thread:
  
  * Initiate LIP -- several customers have asked for this ability as
several topological configurations isolate disruptive FC events.
  * Initiate LLDD rescan (i.e. ports (fibre channel), devices (iSCSI),
etc.)
  
  I had originally envisioned these functions residing in the 
 transport.
 
 Yes, I agree.  Domain (target, topology, etc) discovery should be
 part of the transport class.
 
 What I'm thinking of is that the LLDD would register a known
 trasport class with the SCSI Core at/after registering a host
 template and then would call something with a name like
 start_scsi which would do whatever necessary for the domain
 (SAS, FC, iSCSI, etc) before scanning for targets.  Of course
 for some domains no additional work is needed.
 
   Luben
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] scsi_mid_low_api doesn't mention scsi_scan_host

2005-03-21 Thread James . Smart
A nit on the use of must

In the following:

  /**
 - * scsi_add_host - perform sysfs registration and SCSI bus scan.
 + * scsi_add_host - perform sysfs registration and set up 
 transport class
   * @shost:   pointer to scsi host instance
   * @dev: pointer to struct device of type scsi class
   *
 @@ -453,7 +455,10 @@ struct scsi_device * scsi_add_device(str
   *  Might block: no
   *
   *  Notes: Only required in hotplug initialization 
 model after a
 - *  successful call to scsi_host_alloc().
 + *  successful call to scsi_host_alloc().  The LLD must call
 + *   scsi_scan_host() in order to scan the bus.  The LLD must set up
 + *   the transport template before calling this function and may only
 + *   access the transport class data after this function has 
 been called.
   *
   *  Defined in: drivers/scsi/hosts.c


It is not mandatory that the LLD call scsi_scan_host(). Although this used
to be the case, a few changes have been made in the midlayer recently as we
attempted to have the transports perform scanning on behalf of the LLD's.
The scsi_scan_target() function can now be used instead of scsi_scan_host().
(note: the symbol scsi_scan_single_target() was added briefly, then removed
as scsi_scan_target was exported).  In the case of the LLD's using the FC
transport, the need not call any scan function. The FC transport calls
scsi_scan_target() for them.

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


RE: [PATCH] scsi_mid_low_api doesn't mention scsi_scan_host

2005-03-21 Thread James . Smart
 Thanks for the correction.  How does this look?
 
  *  Notes: Only required in hotplug initialization model after a
  *  successful call to scsi_host_alloc().  This function does not
  *  scan the bus; this can be done by calling scsi_scan_host() or
  *  in some other transport-specific way.  The LLD must set up
  *  the transport template before calling this function 
 and may only
  *  access the transport class data after this function 
 has been called.

a work of art :)

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


[Announce] Emulex lpfcdriver v8.0.28 available

2005-04-14 Thread James . Smart
All,

I'd like to announce the availability of the Emulex lpfc driver
revision 8.0.28 on SourceForge:
http://prdownloads.sourceforge.net/lpfc/lpfcdriver-2.6-8.0.28.tar.gz?download

We are extremely pleased that the FC Remote Port support is now part
of the kernel for 2.6.12 (as of -rc1). We now have sufficient kernel
support for the integration of our driver.

We have been working with Christoph over the last few weeks to address
some last comments, and believe that this release is ready for
inclusion with the upstream kernel.

Thank You.

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


RE: Fibre Channel state of the union

2005-04-18 Thread James . Smart
Christoph,

FYI - Emulex is committed to completing the effort for creating a 
vendor-agnostic open-source hbaapi library for linux, including the thornier 
issues of performing CT passthru and RNID functionality.  As soon as the 
library exists, an open-source SMI-S provider would become available as well.

-- James


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of 
 Christoph Hellwig
 Sent: Monday, April 18, 2005 11:40 AM
 To: linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org
 Subject: Fibre Channel state of the union
 
 
 
 With the upcoming merge of the current SCSI development 
 branch (probably
 after the 2.6.12 release), Linux will have more advanced Fibre Channel
 support than any currently available operating system.
 
 The new Fibre Channel (FC) transport class offers two major advantages
 over traditional standalone drivers:
 
  (1) It provides an easy to use library to deal with most 
 aspects of FC
  remote port management and its integration into SAM and the Linux
  SCSI layer.
 
   - a remote port object that sits between the host and the target
   in the Linux SCSI layer object model
   - support for remote port based LUN scanning, including live
   rescanning on fabric topology changes and stable remove port to
   SCSI target id mappings
   - a queue freeze facility to handle temporary cable 
 unplugs without
   generating I/O errors
  
  (2) a common userspace interface to transport specific and management
  information in sysfs.  The information provided is based 
 on a sane
  subset of the SNIA HBA API specification.
  
 This reduces the burden of writing and maintaining an FC HBA driver
 substantially, for example the recent conversion of the 
 qla2xxx driver to
 use these facilities removes over 3000 lines of code (about 
 1/5 of the overall
 driver size) while adding new features and a userspace 
 management interface.
 The FC transport class thus allows hardware vendors to concentrate on
 interfacing with the hardware and support their unique 
 features, freeing
 them from the burden of reimplementing basic infrastructure 
 in every driver
 and designing ad hoc management interfaces.
 
 We now have two drivers supporting this infrastructure fully:
 
   - qla2xxx for Qlogic 2100/2200/23xx HBAs
   - lpfc for all Emulex SLI2 HBAs
 
 Two drivers for modern hardware don't fully use this 
 infrastructure yet,
 but we are working with the maintainers and expect the drivers to be
 updated to take advantage of the new FC transport class soon.
 
   - zfcp for the Fibre Channel attachment on the IBM zSeries 
 mainframes
   - mptfusion for the LSI Fusion 909/919(X)/929(X) HBAs
 
 Still missing is an Open Source tool application utilizing our APIs.
 The currently available proprietary applications are 
 inflexible, available
 only for very few of the architectures supported by Linux, and tied to
 specific HBAs. The common API and hardware independence 
 provide a great
 opportunity for the Hardware vendors to collaborate on a 
 single Open Source
 management application and leverage the cost savings of an 
 open development
 method.
 
 We are also looking forward to a bridge from the Linux
 management interfaces to the industry-standard SNIA HBA API,
 allowing various management applications to work out of the 
 box with our
 stack.
 
 To make these new features available to Enterprise users and 
 reduce the
 fragmentation in driver and management space we will be 
 working with the
 major players in the Storage Industry and the Linux 
 Distribution vendors
 to support and certify this stack in the near future.
 
 Special thanks go to Emulex and James Smart in particular for 
 implementing
 the majority of the new Fibre Channel transport class.  We 
 also want to
 thank Andrew Vasquez at Qlogic for providing valuable input on the
 transport class design and for updating the qla2xx driver to 
 use the new
 facilities quickly.
 
 The Linux SCSI community plans to provide a similar framework for
 Serial Attached SCSI (SAS) transports in the near future.
 
 
 Thanks to Arjan van de Ven, Peter Jones, Randy Dunlap, Rik van Riel,
 Nikita Danilov and James Bottomley for reviewing this document and
 suggesting various improvements.
 -
 To unsubscribe from this list: send the line unsubscribe 
 linux-scsi in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] add int_to_scsilun() function

2005-07-13 Thread James . Smart
One of the issues we had was reverting the midlayers lun value
into the 8byte lun value that we wanted to send to the device.
Historically, there's been some combination of byte swapping,
setting high/low, etc. There's also been no common thread between
how our driver did it and others.  I also got very confused as
to why byteswap routines were being used.

Anyway, this patch is a LLDD-callable function that reverts the
midlayer's lun value, stored in an int, to the 8-byte quantity
(note: this is not the real 8byte quantity, just the same amount
that scsilun_to_int() was able to convert and store originally).

This also solves the dilemma of the thread:
http://marc.theaimsgroup.com/?l=linux-kernelm=112116767118981w=2

A patch for the lpfc driver to use this function will be along
in a few days (batched with other patches).

-- james


diff -upNr scsi-misc-2.6-20050713.ORIG/drivers/scsi/scsi_scan.c 
scsi-misc-2.6-20050713/drivers/scsi/scsi_scan.c
--- scsi-misc-2.6-20050713.ORIG/drivers/scsi/scsi_scan.c2005-07-13 
20:52:25.0 -0400
+++ scsi-misc-2.6-20050713/drivers/scsi/scsi_scan.c 2005-07-13 
20:52:25.0 -0400
@@ -1000,6 +1000,38 @@ static int scsilun_to_int(struct scsi_lu
 }
 
 /**
+ * int_to_scsilun: reverts an int into a scsi_lun
+ * @int:integer to be reverted
+ * @scsilun:   struct scsi_lun to be set.
+ *
+ * Description:
+ * Reverts the functionality of the scsilun_to_int, which packed
+ * an 8-byte lun value into an int. This routine unpacks the int
+ * back into the lun value.
+ * Note: the scsilun_to_int() routine does not truly handle all
+ * 8bytes of the lun value. This functions restores only as much
+ * as was set by the routine.
+ *
+ * Notes:
+ * Given an integer : 0x0b030a04,  this function returns a
+ * scsi_lun of : struct scsi_lun of: 0a 04 0b 03 00 00 00 00
+ *
+ **/
+void int_to_scsilun(unsigned int lun, struct scsi_lun *scsilun)
+{
+   int i;
+
+   memset(scsilun-scsi_lun, 0, sizeof(scsilun-scsi_lun));
+
+   for (i = 0; i  sizeof(lun); i += 2) {
+   scsilun-scsi_lun[i] = (lun  8)  0xFF;
+   scsilun-scsi_lun[i+1] = lun  0xFF;
+   lun = lun  16;
+   }
+}
+EXPORT_SYMBOL(int_to_scsilun);
+
+/**
  * scsi_report_lun_scan - Scan using SCSI REPORT LUN results
  * @sdevscan:  scan the host, channel, and id of this Scsi_Device
  *
diff -upNr scsi-misc-2.6-20050713.ORIG/include/scsi/scsi_device.h 
scsi-misc-2.6-20050713/include/scsi/scsi_device.h
--- scsi-misc-2.6-20050713.ORIG/include/scsi/scsi_device.h  2005-07-13 
20:52:36.0 -0400
+++ scsi-misc-2.6-20050713/include/scsi/scsi_device.h   2005-07-13 
20:52:36.0 -0400
@@ -243,6 +243,7 @@ extern void scsi_target_reap(struct scsi
 extern void scsi_target_block(struct device *);
 extern void scsi_target_unblock(struct device *);
 extern void scsi_remove_target(struct device *);
+extern void int_to_scsilun(unsigned int, struct scsi_lun *);
 extern const char *scsi_device_state_name(enum scsi_device_state);
 extern int scsi_is_sdev_device(const struct device *);
 extern int scsi_is_target_device(const struct device *);
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -next] [SCSI] lpfc 8.3.36: fix potential NULL pointer dereference in lpfc_sli4_rq_put()

2013-03-18 Thread James Smart

James,

Can you please merge this fix into scsi git for merging into 3.9 ?

-- james s



On 12/6/2012 10:46 AM, James Smart wrote:

Acked-By: James Smart  james.sm...@emulex.com

Thanks

-- james s


On 12/2/2012 8:33 AM, Wei Yongjun wrote:

From: Wei Yongjun yongjun_...@trendmicro.com.cn

The dereference to 'put_index' should be moved below the NULL test.

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
---
  drivers/scsi/lpfc/lpfc_sli.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 624eab3..a9a7fd7 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -431,11 +431,12 @@ lpfc_sli4_rq_put(struct lpfc_queue *hq, struct 
lpfc_queue *dq,

  struct lpfc_rqe *temp_hrqe;
  struct lpfc_rqe *temp_drqe;
  struct lpfc_register doorbell;
-int put_index = hq-host_index;
+int put_index;
/* sanity check on queue memory */
  if (unlikely(!hq) || unlikely(!dq))
  return -ENOMEM;
+put_index = hq-host_index;
  temp_hrqe = hq-qe[hq-host_index].rqe;
  temp_drqe = dq-qe[dq-host_index].rqe;






--
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




--
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


error handler scheduling

2013-03-26 Thread James Smart
In looking through the error handler, if a command times out and is 
added to the eh_cmd_q for the shost, the error handler is only awakened 
once shost-host_busy (total number of i/os posted to the shost) is 
equal to shost-host_failed (number of i/o that have been failed and put 
on the eh_cmd_q).  Which means, any other i/o that was outstanding must 
either complete or have their timeout fire.  Additionally, as all 
further i/o is held off at the block layer as the shost is in recovery, 
new i/o cannot be submitted until the error handler runs and resolves 
the errored i/os.


Is this true ?

I take it is also true that the midlayer thus expects every i/o to have 
an i/o timeout.  True ?


The crux of this point is that when the recovery thread runs to aborts 
the timed out i/os, is at the mercy of the last command to complete or 
timeout. Additionally, as all further i/o is held off at the block layer 
as the shost is in recovery, new i/o cannot be submitted until the error 
handler runs and resolves the errored i/os. So all I/O on the host is 
stopped until that last i/o completes/times out.   The timeouts may be 
eons later.  Consider SCSI format commands or verify commands that can 
take hours to complete.


Specifically, I'm in a situation currently, where an application is 
using sg to send a command to a target. The app selected no-timeout - by 
setting timeout to MAX_INT. Effectively it's so large its infinite.   
This I/O was one of those lost on the storage fabric. There was 
another command that long ago timed out and is sitting on the error 
handlers queue. But nothing is happening - new i/o, or error handler to 
resolve the failed i/o, until that inifinite i/o completes.


I'm hoping I hear that I just misunderstand things.  If not,  is there a 
suggestion for how to resolve this predicament ?IMHO, I'm surprised 
we stop all i/o for error handling, and that it can be so long later...  
I would assume there's a minimum bound we would wait in the error 
handler (30s?) before we unconditionally run it and abort anything that 
was outstanding.


-- james s
--
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] scsi_transport_fc: Make 'port_state' writeable

2013-04-01 Thread James Smart

Hannes,

I'm finally going through this thread.  I'm a bit uncomfortable about 
making the rport state writeable.  The rport state is tightly tied to 
the driver's discovery engine, and I'm concerned about some of the 
callbacks firing, such as the rport_delete(), and the driver taking an 
action that isn't legit as the driver wasn't the one that called the 
fc_remote_port_delete() call.


I expect, at least in the lpfc driver, we would require a change to work 
with this. Although, we had to add an ugly internal reference counter 
mechanism so we didn't actually early-free structures, that may have 
saved your changing of this.


-- james  s


On 3/15/2013 7:55 AM, Hannes Reinecke wrote:

On 03/14/2013 07:09 PM, Steffen Maier wrote:

Just for my understanding:
So this is a bit like writing 0 into the failed attribute of a
zfcp_port in sysfs (zfcp_sysfs_port_failed_store()) which forces a
port reopen recovery including a sequence of fc_remote_port_delete
and fc_remote_port_add?

Sorta.
This patch simulates the result of an RSCN where this remote port is 
missing. So the fast_io_fail / dev_loss_tmo mechanism is triggered 
(until further notice).
It'll be reset with the next RSCN or by manually resetting the port 
state.



If so, it sounds good to have this functionality for any FC LLD in
common code.


That's why I posted this code :-)
Rationale for this patch is a weird test case with brocade switches;
there you can actually disable a _target_ port. So the port isn't
reachable anymore but no RSCN is send.
And the LLDD is forced into error recovery which'll take _ages_ as 
each and every command send during error recovery will time out.



(And I can think about deprecating parts of zfcp code, next we could
consider the same for zfcp's forced LUN and adapter recovery or
maybe this already exists as sdev's writable state attribute and the
adapter recovery can be performed manually by walking all fc_rports
writing their port_state.)

I don't think the sdev 'state' attribute is useable here; it doesn't 
trigger a rediscovery. You'd want to use 'rescan' here.

But yeah, that would be one of the goals.

Still waiting for some response to the patch, though.
Testing has been successful on our side, plus I've posted
a patchset for multipath-tools utilizing this patch.

So it would be good if it could be included.

James?

Cheers,

Hannes


--
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] scsi_transport_fc: Make 'port_state' writeable

2013-04-05 Thread James Smart
I understand your points. But you will need to contact the different LLD 
maintainers to ensure receiving a devloss_tmo_callbk() on an rport they 
had not called fc_remote_port_delete() for.  I know there's work on my 
side to validate it's ok.  First glance was ok, but..


-- james s


On 4/4/2013 2:26 AM, Hannes Reinecke wrote:

On 04/01/2013 11:06 PM, James Smart wrote:

I think lpfc survives your rport state change as : part of the lld
behavior on the callback, to clean up reference counts, is to abort
all i/o that is outstanding to the rport.   So the ref checking not
only protects lpfc from prematurely freeing a structure (my real
concern), but also just happens to abort all i/o.  We got lucky.

I still believe the I_T_nexus reset is the right way to solve this.


Yes, but this would be an even more intrusive patch.
And we would need to implement yet another callback into the LLDDs
which need to be implemented there, too.

But for this to make any sense we would need to revamp the scsi
error handler, as the current problem is that error recovery takes
too long. Adding yet another callback will make the escalation chain
even longer.

So yeah, in the long run I_T nexus reset is the correct way of doing
things, but in the short term I would opt to make port_state
writeable to simulate an I_T nexus reset.

Cheers,

Hannes


--
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 0/4] scsi: 64-bit LUN support

2013-04-05 Thread James Smart


On 4/4/2013 6:17 AM, Hannes Reinecke wrote:

On 03/31/2013 07:44 PM, Tomas Henzl wrote:

What we can do is to decode the LUN and compare it to max_lun provided by the 
driver,
I think that sg_luns is able to do that, so what is needed is just to follow 
the SAM.

I have seen reports of problem on three different drivers connected to various
external storage, all of them having the same basic reason - the driver sets a 
max_lun
and then LUN comes encoded with a newer addressing method and something like 
this is shown
'kernel: scsi: host 2 channel 0 id 2 lun16643 has a LUN larger than allowed by 
the host adapter'

Decoding the real LUN value would fix this problem, by decoding is only meant 
the use in
scsi_report_lun_scan. The LUN would be stored exactly the same way as it is now.
I know we can patch the certain drivers too, but when max_lun were  what the 
name says
- max LU number, it would fix my problem very easy.


Errm.

No. Decoding LUNs is _evil_. It has only a relevance on the target,
and even then it might choose to ignore it.
So we cannot try to out-guess the target here.

The error you're reporting is that lpfc is setting max_luns to
'255', which of course is less than 16643. Increasing max_luns on
lpfc to '0x' will fix your problem; nothing to do with 64-bit
LUNs ...



The reason lpfc set max_luns to 255 is due to the midlayer using 
max_luns as a (SCSI-2 device) max sequential scan loop top value, not 
necessarily as a max lun # as what's now in the report luns scan loop. 
When we were attached to jbods (loop, etc) - we saw 2 problems: our scan 
time dramatically increased (several minutes based on a 16k max_lun 
value); and as the jbod only decoded 8 bits - it happened to respond 
successfully to any lun value where the lower 8-bits were 0, meaning 
lots of midlayer ghost devices were created when in reality there was 
only 1 lun present.Changing the max_luns value is fine as long as 
you know what's attached.


-- james s

--
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

[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 b/drivers/scsi/lpfc

[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) {
+   phba

[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


Re: [PATCH 0/5] scsi: Allow fast io fail without waiting through timeout

2013-05-20 Thread James Smart

Ren,

Based on the discussion recently held at LSF 2013, we are reworking the 
error recovery path to address all the issues you are mentioning.   That 
work contradicts these patches. So for now, these should be held off.


-- james s



On 5/20/2013 3:14 AM, Ren Mingxin wrote:

When there is a scsi command timed-out or failed, the scsi eh
tries a thorugh recovery, which is necessary for non-redundant
systems. However, the thorugh recovery usually takes much time,
which is not acceptable for misson critical systems. To improve
this latency, if we are working on a redundant system, we should
avoid the scsi eh for its long time failing recovery, and quick
failover to another path.

This set of patches is trying to implement above.

NOTE: the userland tools need to eusure the environment
restriction, which will be implemented later.

Thanks,
Ren

Ren Mingxin (5):
   scsi: rename return code FAST_IO_FAIL to FAST_IO
   FC transport: Add interface to specify fast io level for timed-out cmds
   SAS transport: Add interface to specify fast io level for timed-out cmds
   lpfc: Allow fast timed-out io recovery
   mptfusion: Allow fast timed-out io recovery

  drivers/message/fusion/mptscsih.c   |   29 -
  drivers/scsi/lpfc/lpfc_scsi.c   |   34 ++
  drivers/scsi/scsi_error.c   |   18 ++---
  drivers/scsi/scsi_sas_internal.h|4 -
  drivers/scsi/scsi_transport_fc.c|  112 
++--
  drivers/scsi/scsi_transport_iscsi.c |6 -
  drivers/scsi/scsi_transport_sas.c   |  103 -
  include/scsi/scsi.h |2
  include/scsi/scsi_transport_fc.h|   11 +++
  include/scsi/scsi_transport_sas.h   |8 ++
  10 files changed, 303 insertions(+), 24 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


Re: [PATCH 0/5] scsi: Allow fast io fail without waiting through timeout

2013-05-22 Thread James Smart

yes - that was the session. Granted the posted notes were rather terse.

More of the ideas were presented in this recent email thread: 
http://marc.info/?l=linux-scsim=136819142000596w=2


In general - we're going to create a LLD library for error handling, 
using paradigms in libsas, that:
- no longer stops the whole host on the 1st error and doesn't start 
error handling till all outstanding io is finished/timedout
- sends per-io aborts immediately, and in parallel. LLD handlers will be 
asynchronous.

- no lun/target will be stopped until i/o aborts start to fail.
- do smart handling of lun resets, target resets, bus resets, etc and 
don't potentially do it for every i/o.


Several of these topics were touched on in the email thread.

the patches are being worked on now - hopefully to be posted as an RFC 
within the next couple of weeks.


-- james s



On 5/22/2013 3:12 AM, Ren Mingxin wrote:

Hi, James,

On 05/20/2013 11:53 PM, James Smart wrote:

Based on the discussion recently held at LSF 2013, we are
reworking the error recovery path to address all the issues
you are mentioning. That work contradicts these patches.
So for now, these should be held off.


Interesting. Can I have your general goal/idea briefly even
though via a reference? Will the URL below be one you will
refer to?
  http://lwn.net/Articles/548500

And, could I know your current progress/schedule? Especially
when can we see your patches?

Much appreciated!

Thanks,
Ren



On 5/20/2013 3:14 AM, Ren Mingxin wrote:

When there is a scsi command timed-out or failed, the scsi eh
tries a thorugh recovery, which is necessary for non-redundant
systems. However, the thorugh recovery usually takes much time,
which is not acceptable for misson critical systems. To improve
this latency, if we are working on a redundant system, we should
avoid the scsi eh for its long time failing recovery, and quick
failover to another path.

This set of patches is trying to implement above.

NOTE: the userland tools need to eusure the environment
restriction, which will be implemented later.

Thanks,
Ren

Ren Mingxin (5):
   scsi: rename return code FAST_IO_FAIL to FAST_IO
   FC transport: Add interface to specify fast io level for 
timed-out cmds
   SAS transport: Add interface to specify fast io level for 
timed-out cmds

   lpfc: Allow fast timed-out io recovery
   mptfusion: Allow fast timed-out io recovery

  drivers/message/fusion/mptscsih.c   |   29 -
  drivers/scsi/lpfc/lpfc_scsi.c   |   34 ++
  drivers/scsi/scsi_error.c   |   18 ++---
  drivers/scsi/scsi_sas_internal.h|4 -
  drivers/scsi/scsi_transport_fc.c|  112 
++--

  drivers/scsi/scsi_transport_iscsi.c |6 -
  drivers/scsi/scsi_transport_sas.c   |  103 
-

  include/scsi/scsi.h |2
  include/scsi/scsi_transport_fc.h|   11 +++
  include/scsi/scsi_transport_sas.h   |8 ++
  10 files changed, 303 insertions(+), 24 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



--
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: SCSI error handling -- one error blocks the whole SCSI host

2013-05-25 Thread James Smart

Roland,

I agree, and am already working around that limitation.

-- james s


On 5/23/2013 2:14 PM, Roland Dreier wrote:

At LSF this year, we had a discussion about error handling and in
particular the problem that SCSI midlayer error handling waits for the
entire SCSI host (HBA) to quiesce before it starts to abort commands
etc.

James made the suggestion that FC should handle things the way SAS
does, because SAS has a strategy handler that does things the right
way.  However, now that I finally sit down and look at the code, I
don't see how this is the case.  It seems inherent in the way that
scsi_eh_scmd_add() and the thread in scsi_error_handler() work (in
particular the strategy handler can't even be called until host_failed
== host_busy; we don't bump host_failed without SHOST_RECOVERY set,
which stops queueing commands to any devices attached to the whole
HBA).

James, am I understanding your suggestion properly?  If so can you
explain what you meant about the libsas code -- I see that it has its
own strategy handler but as I said before we've already stopped every
device attached to the HBA before we ever get there.

To recapitulate the problem here, we might have a whole fabric
attached to an HBA via SAS or FC, and be doing 500K IOPS happily to 50
devices.  Then a single LUN goes wonky and all the IO stops while we
try to recover that single device, which might take minutes.

I know this has been discussed before, but can we find a way forward
here?  Is there some way we can start with per-device error recovery
and avoid disrupting IO that we can see is working fine?

Thanks,
   Roland
--
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




--
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/17] lpfc 8.3.40: Fixed some logging message fields

2013-05-31 Thread James Smart
Fixed some logging message fields


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

 ---

 lpfc_sli.c |4 ++--
 1 file changed, 2 insertions(+), 2 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-05-31 10:58:19.924057676 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-05-31 10:58:20.537057690 -0400
@@ -8713,7 +8713,7 @@ lpfc_sli4_abts_err_handler(struct lpfc_h
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
3116 Port generated FCP XRI ABORT event on 
vpi %d rpi %d xri x%x status 0x%x parameter x%x\n,
-   ndlp-vport-vpi, ndlp-nlp_rpi,
+   ndlp-vport-vpi, phba-sli4_hba.rpi_ids[ndlp-nlp_rpi],
bf_get(lpfc_wcqe_xa_xri, axri),
bf_get(lpfc_wcqe_xa_status, axri),
axri-parameter);
@@ -9769,7 +9769,7 @@ lpfc_sli_abort_fcp_cmpl(struct lpfc_hba
struct lpfc_iocbq *rspiocb)
 {
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
-   3096 ABORT_XRI_CN completing on xri x%x 
+   3096 ABORT_XRI_CN completing on rpi x%x 
original iotag x%x, abort cmd iotag x%x 
status 0x%x, reason 0x%x\n,
cmdiocb-iocb.un.acxri.abortContextTag,



--
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 7/17] lpfc 8.3.40: Fixed list corruption when lpfc_drain_tx runs.

2013-05-31 Thread James Smart
Fixed list corruption when lpfc_drain_tx runs.


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

 ---

 lpfc_sli.c |   12 ++--
 1 file changed, 6 insertions(+), 6 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-05-31 10:58:16.738057604 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-05-31 10:58:19.924057676 -0400
@@ -16286,7 +16286,7 @@ lpfc_drain_txq(struct lpfc_hba *phba)
union lpfc_wqe wqe;
int txq_cnt = 0;
 
-   spin_lock_irqsave(phba-hbalock, iflags);
+   spin_lock_irqsave(pring-ring_lock, iflags);
list_for_each_entry(piocbq, pring-txq, list) {
txq_cnt++;
}
@@ -16294,14 +16294,14 @@ lpfc_drain_txq(struct lpfc_hba *phba)
if (txq_cnt  pring-txq_max)
pring-txq_max = txq_cnt;
 
-   spin_unlock_irqrestore(phba-hbalock, iflags);
+   spin_unlock_irqrestore(pring-ring_lock, iflags);
 
while (!list_empty(pring-txq)) {
-   spin_lock_irqsave(phba-hbalock, iflags);
+   spin_lock_irqsave(pring-ring_lock, iflags);
 
piocbq = lpfc_sli_ringtx_get(phba, pring);
if (!piocbq) {
-   spin_unlock_irqrestore(phba-hbalock, iflags);
+   spin_unlock_irqrestore(pring-ring_lock, iflags);
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
2823 txq empty and txq_cnt is %d\n ,
txq_cnt);
@@ -16310,7 +16310,7 @@ lpfc_drain_txq(struct lpfc_hba *phba)
sglq = __lpfc_sli_get_sglq(phba, piocbq);
if (!sglq) {
__lpfc_sli_ringtx_put(phba, pring, piocbq);
-   spin_unlock_irqrestore(phba-hbalock, iflags);
+   spin_unlock_irqrestore(pring-ring_lock, iflags);
break;
}
txq_cnt--;
@@ -16338,7 +16338,7 @@ lpfc_drain_txq(struct lpfc_hba *phba)
piocbq-iotag, piocbq-sli4_xritag);
list_add_tail(piocbq-list, completions);
}
-   spin_unlock_irqrestore(phba-hbalock, iflags);
+   spin_unlock_irqrestore(pring-ring_lock, iflags);
}
 
/* Cancel all the IOCBs that cannot be issued */



--
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/17] lpfc 8.3.40: Fix to allow OCM to report FEC status

2013-05-31 Thread James Smart
Fix to allow OCM to report FEC status


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

 ---

 lpfc_bsg.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
--- a/drivers/scsi/lpfc/lpfc_bsg.c  2013-05-03 09:24:34.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_bsg.c  2013-05-31 10:58:22.801057743 -0400
@@ -3392,6 +3392,7 @@ static int lpfc_bsg_check_cmd_access(str
case MBX_DOWN_LOAD:
case MBX_UPDATE_CFG:
case MBX_KILL_BOARD:
+   case MBX_READ_TOPOLOGY:
case MBX_LOAD_AREA:
case MBX_LOAD_EXP_ROM:
case MBX_BEACON:
@@ -3422,7 +3423,6 @@ static int lpfc_bsg_check_cmd_access(str
}
break;
case MBX_READ_SPARM64:
-   case MBX_READ_TOPOLOGY:
case MBX_REG_LOGIN:
case MBX_REG_LOGIN64:
case MBX_CONFIG_PORT:



--
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/17] lpfc 8.3.40: Fixed a race condition between SLI host and port failed FCF rediscovery

2013-05-31 Thread James Smart
Fixed a race condition between SLI host and port failed FCF rediscovery


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

 ---

 lpfc_init.c |   97 +---
 1 file changed, 35 insertions(+), 62 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-05-31 10:58:00.278057229 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-05-31 10:58:28.518057871 -0400
@@ -4050,52 +4050,6 @@ lpfc_sli4_perform_all_vport_cvl(struct l
 }
 
 /**
- * lpfc_sli4_perform_inuse_fcf_recovery - Perform inuse fcf recovery
- * @vport: pointer to lpfc hba data structure.
- *
- * This routine is to perform FCF recovery when the in-use FCF either dead or
- * got modified.
- **/
-static void
-lpfc_sli4_perform_inuse_fcf_recovery(struct lpfc_hba *phba,
-struct lpfc_acqe_fip *acqe_fip)
-{
-   int rc;
-
-   spin_lock_irq(phba-hbalock);
-   /* Mark the fast failover process in progress */
-   phba-fcf.fcf_flag |= FCF_DEAD_DISC;
-   spin_unlock_irq(phba-hbalock);
-
-   lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
-   2771 Start FCF fast failover process due to in-use 
-   FCF DEAD/MODIFIED event: evt_tag:x%x, index:x%x\n,
-   acqe_fip-event_tag, acqe_fip-index);
-   rc = lpfc_sli4_redisc_fcf_table(phba);
-   if (rc) {
-   lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY,
-   2772 Issue FCF rediscover mabilbox command 
-   failed, fail through to FCF dead event\n);
-   spin_lock_irq(phba-hbalock);
-   phba-fcf.fcf_flag = ~FCF_DEAD_DISC;
-   spin_unlock_irq(phba-hbalock);
-   /*
-* Last resort will fail over by treating this as a link
-* down to FCF registration.
-*/
-   lpfc_sli4_fcf_dead_failthrough(phba);
-   } else {
-   /* Reset FCF roundrobin bmask for new discovery */
-   lpfc_sli4_clear_fcf_rr_bmask(phba);
-   /*
-* Handling fast FCF failover to a DEAD FCF event is
-* considered equalivant to receiving CVL to all vports.
-*/
-   lpfc_sli4_perform_all_vport_cvl(phba);
-   }
-}
-
-/**
  * lpfc_sli4_async_fip_evt - Process the asynchronous FCoE FIP event
  * @phba: pointer to lpfc hba data structure.
  * @acqe_link: pointer to the async fcoe completion queue entry.
@@ -4160,22 +4114,9 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba
break;
}
 
-   /* If FCF has been in discovered state, perform rediscovery
-* only if the FCF with the same index of the in-use FCF got
-* modified during normal operation. Otherwise, do nothing.
-*/
-   if (phba-pport-port_state  LPFC_FLOGI) {
+   /* If the FCF has been in discovered state, do nothing. */
+   if (phba-fcf.fcf_flag  FCF_SCAN_DONE) {
spin_unlock_irq(phba-hbalock);
-   if (phba-fcf.current_rec.fcf_indx ==
-   acqe_fip-index) {
-   lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
-   3300 In-use FCF (%d) 
-   modified, perform FCF 
-   rediscovery\n,
-   acqe_fip-index);
-   lpfc_sli4_perform_inuse_fcf_recovery(phba,
-acqe_fip);
-   }
break;
}
spin_unlock_irq(phba-hbalock);
@@ -4228,7 +4169,39 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba
 * is no longer valid as we are not in the middle of FCF
 * failover process already.
 */
-   lpfc_sli4_perform_inuse_fcf_recovery(phba, acqe_fip);
+   spin_lock_irq(phba-hbalock);
+   /* Mark the fast failover process in progress */
+   phba-fcf.fcf_flag |= FCF_DEAD_DISC;
+   spin_unlock_irq(phba-hbalock);
+
+   lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
+   2771 Start FCF fast failover process due to 
+   FCF DEAD event: evt_tag:x%x, fcf_index:x%x 
+   \n, acqe_fip-event_tag, acqe_fip-index);
+   rc = lpfc_sli4_redisc_fcf_table(phba);
+   if (rc) {
+   lpfc_printf_log(phba, KERN_ERR, LOG_FIP |
+   LOG_DISCOVERY,
+   2772 Issue

[PATCH 4/17] lpfc 8.3.40: Fixed system panic during handling unsolicited receive buffer error condition

2013-05-31 Thread James Smart
Fixed system panic during handling unsolicited receive buffer error condition


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

 ---

 lpfc_sli.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-05-03 09:24:34.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-05-31 10:58:14.126057545 -0400
@@ -3279,7 +3279,7 @@ lpfc_sli_sp_handle_rspiocb(struct lpfc_h
if (free_saveq) {
list_for_each_entry_safe(rspiocbp, next_iocb,
 saveq-list, list) {
-   list_del(rspiocbp-list);
+   list_del_init(rspiocbp-list);
__lpfc_sli_release_iocbq(phba, rspiocbp);
}
__lpfc_sli_release_iocbq(phba, saveq);



--
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/17] lpfc 8.3.40: Fix starting reference tag when calculating BG error

2013-05-31 Thread James Smart
Fix starting reference tag when calculating BG error


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

 ---

 lpfc_scsi.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2013-05-31 10:58:12.310057503 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2013-05-31 10:58:17.946057631 -0400
@@ -3088,9 +3088,9 @@ lpfc_calc_bg_err(struct lpfc_hba *phba,
chk_guard = 1;
guard_type = scsi_host_get_guard(cmd-device-host);
 
+   src = (struct scsi_dif_tuple *)sg_virt(sgpe);
start_ref_tag = (uint32_t)scsi_get_lba(cmd); /* Truncate LBA */
start_app_tag = src-app_tag;
-   src = (struct scsi_dif_tuple *)sg_virt(sgpe);
len = sgpe-length;
while (src  protsegcnt) {
while (len) {



--
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/17] lpfc 8.3.40: Update lpfc version to driver version 8.3.40

2013-05-31 Thread James Smart
Update lpfc version to driver version 8.3.40


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-05-03 09:24:34.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_version.h  2013-05-31 10:58:29.636057897 -0400
@@ -18,7 +18,7 @@
  * included with this package. *
  ***/
 
-#define LPFC_DRIVER_VERSION 8.3.39
+#define LPFC_DRIVER_VERSION 8.3.40
 #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


[PATCH 5/17] lpfc 8.3.40: Fix inconsistent list removal causes crash.

2013-05-31 Thread James Smart
Fix inconsistent list removal causes crash.


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

 ---

 lpfc_sli.c |   18 --
 1 file changed, 18 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-05-31 10:58:14.126057545 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-05-31 10:58:16.738057604 -0400
@@ -1011,17 +1011,6 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_
else
sglq = __lpfc_clear_active_sglq(phba, iocbq-sli4_lxritag);
 
-   /*
-   ** This should have been removed from the txcmplq before calling
-   ** iocbq_release. The normal completion
-   ** path should have already done the list_del_init.
-   */
-   if (unlikely(!list_empty(iocbq-list))) {
-   if (iocbq-iocb_flag  LPFC_IO_ON_TXCMPLQ)
-   iocbq-iocb_flag = ~LPFC_IO_ON_TXCMPLQ;
-   list_del_init(iocbq-list);
-   }
-
 
if (sglq)  {
if ((iocbq-iocb_flag  LPFC_EXCHANGE_BUSY) 
@@ -1070,13 +1059,6 @@ __lpfc_sli_release_iocbq_s3(struct lpfc_
 {
size_t start_clean = offsetof(struct lpfc_iocbq, iocb);
 
-   /*
-   ** This should have been removed from the txcmplq before calling
-   ** iocbq_release. The normal completion
-   ** path should have already done the list_del_init.
-   */
-   if (unlikely(!list_empty(iocbq-list)))
-   list_del_init(iocbq-list);
 
/*
 * Clean all volatile data fields, preserve iotag and node struct.



--
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 13/17] lpfc 8.3.40: Fixed system panic due to unsafe walking and deleting linked list

2013-05-31 Thread James Smart
Fixed system panic due to unsafe walking and deleting linked list


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

 ---

 lpfc_scsi.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2013-05-31 10:58:17.946057631 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2013-05-31 10:58:26.205057820 -0400
@@ -1166,13 +1166,14 @@ lpfc_get_scsi_buf_s3(struct lpfc_hba *ph
 static struct lpfc_scsi_buf*
 lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
 {
-   struct lpfc_scsi_buf *lpfc_cmd ;
+   struct lpfc_scsi_buf *lpfc_cmd, *lpfc_cmd_next;
unsigned long gflag = 0;
unsigned long pflag = 0;
int found = 0;
 
spin_lock_irqsave(phba-scsi_buf_list_get_lock, gflag);
-   list_for_each_entry(lpfc_cmd, phba-lpfc_scsi_buf_list_get, list) {
+   list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next,
+phba-lpfc_scsi_buf_list_get, list) {
if (lpfc_test_rrq_active(phba, ndlp,
 lpfc_cmd-cur_iocbq.sli4_lxritag))
continue;
@@ -1186,8 +1187,8 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *ph
phba-lpfc_scsi_buf_list_get);
INIT_LIST_HEAD(phba-lpfc_scsi_buf_list_put);
spin_unlock_irqrestore(phba-scsi_buf_list_put_lock, pflag);
-   list_for_each_entry(lpfc_cmd, phba-lpfc_scsi_buf_list_get,
-   list) {
+   list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next,
+phba-lpfc_scsi_buf_list_get, list) {
if (lpfc_test_rrq_active(
phba, ndlp, lpfc_cmd-cur_iocbq.sli4_lxritag))
continue;



--
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/17] lpfc 8.3.40: Update Copyrights to 2013 for 8.3.38, 8.3.39, and 8.3.40 modifications

2013-05-31 Thread James Smart
Update Copyrights to 2013 for 8.3.38, 8.3.39, and 8.3.40 modifications


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

 ---

 lpfc.h   |2 +-
 lpfc_bsg.c   |2 +-
 lpfc_crtn.h  |2 +-
 lpfc_ct.c|2 +-
 lpfc_els.c   |2 +-
 lpfc_hbadisc.c   |2 +-
 lpfc_hw.h|2 +-
 lpfc_hw4.h   |2 +-
 lpfc_init.c  |2 +-
 lpfc_mbox.c  |2 +-
 lpfc_nportdisc.c |2 +-
 lpfc_scsi.c  |2 +-
 lpfc_scsi.h  |2 +-
 lpfc_sli.c   |2 +-
 lpfc_sli4.h  |2 +-
 lpfc_version.h   |4 ++--
 16 files changed, 17 insertions(+), 17 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-05-31 10:52:54.443050265 -0400
+++ b/drivers/scsi/lpfc/lpfc_bsg.c  2013-05-31 11:38:51.017113032 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2009-2012 Emulex.  All rights reserved.   *
+ * Copyright (C) 2009-2013 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * *
diff -upNr a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
--- a/drivers/scsi/lpfc/lpfc_crtn.h 2013-05-03 09:24:34.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_crtn.h 2013-05-31 11:41:46.407117025 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2011 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2013 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * *
diff -upNr a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
--- a/drivers/scsi/lpfc/lpfc_ct.c   2013-05-03 09:24:34.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_ct.c   2013-05-31 11:41:52.814117171 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2010 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2013 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * *
diff -upNr a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
--- a/drivers/scsi/lpfc/lpfc_els.c  2013-05-03 09:24:34.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_els.c  2013-05-31 11:41:59.258117318 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2012 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2013 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * Portions Copyright (C) 2004-2005 Christoph Hellwig  *
diff -upNr a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
--- a/drivers/scsi/lpfc/lpfc.h  2013-05-03 09:24:34.0 -0400
+++ b/drivers/scsi/lpfc/lpfc.h  2013-05-31 11:41:38.401116843 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2012 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2013 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * Portions Copyright (C) 2004-2005 Christoph Hellwig  *
diff -upNr a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c  2013-05-31 10:52:54.483050266 -0400
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c  2013-05-31 11:38:56.542113157 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver

[PATCH 11/17] lpfc 8.3.40: Clarified the behavior of the lpfc_max_luns module parameter

2013-05-31 Thread James Smart
Clarified the behavior of the lpfc_max_luns module parameter


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

 ---

 lpfc_attr.c |   23 ---
 1 file changed, 20 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-05-03 09:24:34.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-05-31 10:58:23.785057766 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2012 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2013 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * Portions Copyright (C) 2004-2005 Christoph Hellwig  *
@@ -4070,11 +4070,28 @@ LPFC_VPORT_ATTR(discovery_threads, 32, 1
 during discovery);
 
 /*
-# lpfc_max_luns: maximum allowed LUN.
+# lpfc_max_luns: maximum allowed LUN ID. This is the highest LUN ID that
+#will be scanned by the SCSI midlayer when sequential scanning is
+#used; and is also the highest LUN ID allowed when the SCSI midlayer
+#parses REPORT_LUN responses. The lpfc driver has no LUN count or
+#LUN ID limit, but the SCSI midlayer requires this field for the uses
+#above. The lpfc driver limits the default value to 255 for two reasons.
+#As it bounds the sequential scan loop, scanning for thousands of luns
+#on a target can take minutes of wall clock time.  Additionally,
+#there are FC targets, such as JBODs, that only recognize 8-bits of
+#LUN ID. When they receive a value greater than 8 bits, they chop off
+#the high order bits. In other words, they see LUN IDs 0, 256, 512,
+#and so on all as LUN ID 0. This causes the linux kernel, which sees
+#valid responses at each of the LUN IDs, to believe there are multiple
+#devices present, when in fact, there is only 1.
+#A customer that is aware of their target behaviors, and the results as
+#indicated above, is welcome to increase the lpfc_max_luns value.
+#As mentioned, this value is not used by the lpfc driver, only the
+#SCSI midlayer.
 # Value range is [0,65535]. Default value is 255.
 # NOTE: The SCSI layer might probe all allowed LUN on some old targets.
 */
-LPFC_VPORT_ATTR_R(max_luns, 255, 0, 65535, Maximum allowed LUN);
+LPFC_VPORT_ATTR_R(max_luns, 255, 0, 65535, Maximum allowed LUN ID);
 
 /*
 # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring.



--
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/17] lpfc 8.3.40: Fixed issue mailbox wait routine failed to issue dump memory mbox command

2013-05-31 Thread James Smart
Fixed issue mailbox wait routine failed to issue dump memory mbox command


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

 ---

 lpfc_sli.c |   11 ---
 1 file changed, 8 insertions(+), 3 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-05-31 10:58:21.732057717 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-05-31 10:58:27.353057845 -0400
@@ -10092,12 +10092,13 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba
 uint32_t timeout)
 {
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_q);
+   MAILBOX_t *mb = NULL;
int retval;
unsigned long flag;
 
-   /* The caller must leave context1 empty. */
+   /* The caller might set context1 for extended buffer */
if (pmboxq-context1)
-   return MBX_NOT_FINISHED;
+   mb = (MAILBOX_t *)pmboxq-context1;
 
pmboxq-mbox_flag = ~LPFC_MBX_WAKE;
/* setup wake call as IOCB callback */
@@ -10113,7 +10114,8 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba
msecs_to_jiffies(timeout * 1000));
 
spin_lock_irqsave(phba-hbalock, flag);
-   pmboxq-context1 = NULL;
+   /* restore the possible extended buffer for free resource */
+   pmboxq-context1 = (uint8_t *)mb;
/*
 * if LPFC_MBX_WAKE flag is set the mailbox is completed
 * else do not free the resources.
@@ -10126,6 +10128,9 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba
pmboxq-mbox_cmpl = lpfc_sli_def_mbox_cmpl;
}
spin_unlock_irqrestore(phba-hbalock, flag);
+   } else {
+   /* restore the possible extended buffer for free resource */
+   pmboxq-context1 = (uint8_t *)mb;
}
 
return retval;



--
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/17] lpfc 8.3.40: Fix lpfc_used_cpu to be more dynamic

2013-05-31 Thread James Smart
Fix lpfc_used_cpu to be more dynamic


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

 ---

 lpfc_init.c |   30 +++---
 lpfc_sli4.h |1 -
 2 files changed, 23 insertions(+), 8 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-05-20 09:31:12.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-05-31 10:58:00.278057229 -0400
@@ -60,7 +60,8 @@ unsigned long _dump_buf_dif_order;
 spinlock_t _dump_buf_lock;
 
 /* Used when mapping IRQ vectors in a driver centric manner */
-uint16_t lpfc_used_cpu[LPFC_MAX_CPU];
+uint16_t *lpfc_used_cpu;
+uint32_t lpfc_present_cpu;
 
 static void lpfc_get_hba_model_desc(struct lpfc_hba *, uint8_t *, uint8_t *);
 static int lpfc_post_rcv_buf(struct lpfc_hba *);
@@ -5213,6 +5214,21 @@ lpfc_sli4_driver_resource_setup(struct l
rc = -ENOMEM;
goto out_free_msix;
}
+   if (lpfc_used_cpu == NULL) {
+   lpfc_used_cpu = kzalloc((sizeof(uint16_t) * lpfc_present_cpu),
+GFP_KERNEL);
+   if (!lpfc_used_cpu) {
+   lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
+   3335 Failed allocate memory for msi-x 
+   interrupt vector mapping\n);
+   kfree(phba-sli4_hba.cpu_map);
+   rc = -ENOMEM;
+   goto out_free_msix;
+   }
+   for (i = 0; i  lpfc_present_cpu; i++)
+   lpfc_used_cpu[i] = LPFC_VECTOR_MAP_EMPTY;
+   }
+
/* Initialize io channels for round robin */
cpup = phba-sli4_hba.cpu_map;
rc = 0;
@@ -6824,8 +6840,6 @@ lpfc_sli4_queue_verify(struct lpfc_hba *
int cfg_fcp_io_channel;
uint32_t cpu;
uint32_t i = 0;
-   uint32_t j = 0;
-
 
/*
 * Sanity check for configured queue parameters against the run-time
@@ -6839,10 +6853,9 @@ lpfc_sli4_queue_verify(struct lpfc_hba *
for_each_present_cpu(cpu) {
if (cpu_online(cpu))
i++;
-   j++;
}
phba-sli4_hba.num_online_cpu = i;
-   phba-sli4_hba.num_present_cpu = j;
+   phba-sli4_hba.num_present_cpu = lpfc_present_cpu;
 
if (i  cfg_fcp_io_channel) {
lpfc_printf_log(phba,
@@ -10967,8 +10980,10 @@ lpfc_init(void)
}
 
/* Initialize in case vector mapping is needed */
-   for (cpu = 0; cpu  LPFC_MAX_CPU; cpu++)
-   lpfc_used_cpu[cpu] = LPFC_VECTOR_MAP_EMPTY;
+   lpfc_used_cpu = NULL;
+   lpfc_present_cpu = 0;
+   for_each_present_cpu(cpu)
+   lpfc_present_cpu++;
 
error = pci_register_driver(lpfc_driver);
if (error) {
@@ -11008,6 +11023,7 @@ lpfc_exit(void)
(1L  _dump_buf_dif_order), _dump_buf_dif);
free_pages((unsigned long)_dump_buf_dif, _dump_buf_dif_order);
}
+   kfree(lpfc_used_cpu);
 }
 
 module_init(lpfc_init);
diff -upNr a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
--- a/drivers/scsi/lpfc/lpfc_sli4.h 2013-05-03 09:24:34.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli4.h 2013-05-31 10:58:00.283057229 -0400
@@ -444,7 +444,6 @@ struct lpfc_vector_map_info {
struct cpumask  maskbits;
 };
 #define LPFC_VECTOR_MAP_EMPTY  0x
-#define LPFC_MAX_CPU   256
 
 /* SLI4 HBA data structure entries */
 struct lpfc_sli4_hba {



--
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/17] lpfc 8.3.40: Fixed a missing return code in a logging message

2013-05-31 Thread James Smart
Fixed a missing return code in a logging message


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

 ---

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


diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-05-31 10:58:20.537057690 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-05-31 10:58:21.732057717 -0400
@@ -4566,7 +4566,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba
} else {
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
2708 This device does not support 
-   Advanced Error Reporting (AER)\n);
+   Advanced Error Reporting (AER): %d\n,
+   rc);
phba-cfg_aer_support = 0;
}
}



--
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/17] lpfc 8.3.40: Update lpfc to revision 8.3.40

2013-05-31 Thread James Smart
This patch set updates the lpfc driver to revision 8.3.40

The patches for 8.3.40 contain:

- Fix lpfc_used_cpu to be more dynamic
- Fixed crash during FCoE failover testing.
- Fix BlockGuard error checking
- Fixed system panic during handling unsolicited receive buffer error condition
- Fix inconsistent list removal causes crash.
- Fix starting reference tag when calculating BG error
- Fixed list corruption when lpfc_drain_tx runs.
- Fixed some logging message fields
- Fixed a missing return code in a logging message
- Fix to allow OCM to report FEC status
- Clarified the behavior of the lpfc_max_luns module parameter
- Fixed FCoE connection list vlan identifier and add FCF list debug
- Fixed system panic due to unsafe walking and deleting linked list
- Fixed issue mailbox wait routine failed to issue dump memory mbox command
- Fixed a race condition between SLI host and port failed FCF rediscovery
- Update Copyrights to 2013 for 8.3.38, 8.3.39, and 8.3.40 modifications
- Update lpfc version to driver version 8.3.40


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 12/17] lpfc 8.3.40: Fixed FCoE connection list vlan identifier and add FCF list debug

2013-05-31 Thread James Smart
Fixed FCoE connection list vlan identifier and add FCF list debug


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

 ---

 lpfc_hbadisc.c |   36 ++--
 1 file changed, 34 insertions(+), 2 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-05-03 09:24:34.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c  2013-05-31 10:58:25.153057799 -0400
@@ -6158,12 +6158,44 @@ lpfc_read_fcf_conn_tbl(struct lpfc_hba *
memcpy(conn_entry-conn_rec, conn_rec[i],
sizeof(struct lpfc_fcf_conn_rec));
conn_entry-conn_rec.vlan_tag =
-   le16_to_cpu(conn_entry-conn_rec.vlan_tag)  0xFFF;
+   conn_entry-conn_rec.vlan_tag;
conn_entry-conn_rec.flags =
-   le16_to_cpu(conn_entry-conn_rec.flags);
+   conn_entry-conn_rec.flags;
list_add_tail(conn_entry-list,
phba-fcf_conn_rec_list);
}
+
+   if (!list_empty(phba-fcf_conn_rec_list)) {
+   i = 0;
+   list_for_each_entry(conn_entry, phba-fcf_conn_rec_list,
+   list) {
+   conn_rec = conn_entry-conn_rec;
+   lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
+   3345 FCF connection list rec[%02d]: 
+   flags:x%04x, vtag:x%04x, 
+   fabric_name:x%02x:%02x:%02x:%02x:
+   %02x:%02x:%02x:%02x, 
+   switch_name:x%02x:%02x:%02x:%02x:
+   %02x:%02x:%02x:%02x\n, i++,
+   conn_rec-flags, conn_rec-vlan_tag,
+   conn_rec-fabric_name[0],
+   conn_rec-fabric_name[1],
+   conn_rec-fabric_name[2],
+   conn_rec-fabric_name[3],
+   conn_rec-fabric_name[4],
+   conn_rec-fabric_name[5],
+   conn_rec-fabric_name[6],
+   conn_rec-fabric_name[7],
+   conn_rec-switch_name[0],
+   conn_rec-switch_name[1],
+   conn_rec-switch_name[2],
+   conn_rec-switch_name[3],
+   conn_rec-switch_name[4],
+   conn_rec-switch_name[5],
+   conn_rec-switch_name[6],
+   conn_rec-switch_name[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 2/17] lpfc 8.3.40: Fixed crash during FCoE failover testing.

2013-05-31 Thread James Smart
Fixed crash during FCoE failover testing.


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

 ---

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


diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2013-05-03 09:24:34.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2013-05-31 10:58:07.689057397 -0400
@@ -4074,7 +4074,8 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba
 cmd-device ? cmd-device-id : 0x,
 cmd-device ? cmd-device-lun : 0x,
 lpfc_cmd-status, lpfc_cmd-result,
-vport-fc_myDID, pnode-nlp_DID,
+vport-fc_myDID,
+(pnode) ? pnode-nlp_DID : 0,
 phba-sli_rev == LPFC_SLI_REV4 ?
 lpfc_cmd-cur_iocbq.sli4_xritag : 0x,
 pIocbOut-iocb.ulpContext,



--
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/17] lpfc 8.3.40: Fix BlockGuard error checking

2013-05-31 Thread James Smart
Fix BlockGuard error checking


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

 ---

 lpfc_scsi.c |  109 ++--
 1 file changed, 62 insertions(+), 47 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2013-05-31 10:58:07.689057397 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2013-05-31 10:58:12.310057503 -0400
@@ -68,14 +68,12 @@ 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
 lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb);
+static int
+lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc);
 
 static void
 lpfc_debug_save_data(struct lpfc_hba *phba, struct scsi_cmnd *cmnd)
@@ -134,6 +132,30 @@ lpfc_debug_save_dif(struct lpfc_hba *phb
}
 }
 
+static inline unsigned
+lpfc_cmd_blksize(struct scsi_cmnd *sc)
+{
+   return sc-device-sector_size;
+}
+
+#define LPFC_CHECK_PROTECT_GUARD   1
+#define LPFC_CHECK_PROTECT_REF 2
+static inline unsigned
+lpfc_cmd_protect(struct scsi_cmnd *sc, int flag)
+{
+   return 1;
+}
+
+static inline unsigned
+lpfc_cmd_guard_csum(struct scsi_cmnd *sc)
+{
+   if (lpfc_prot_group_type(NULL, sc) == LPFC_PG_TYPE_NO_DIF)
+   return 0;
+   if (scsi_host_get_guard(sc-device-host) == SHOST_DIX_GUARD_IP)
+   return 1;
+   return 0;
+}
+
 /**
  * lpfc_sli4_set_rsp_sgl_last - Set the last bit in the response sge.
  * @phba: Pointer to HBA object.
@@ -1409,12 +1431,6 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hb
return 0;
 }
 
-static inline unsigned
-lpfc_cmd_blksize(struct scsi_cmnd *sc)
-{
-   return sc-device-sector_size;
-}
-
 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
 
 /* Return if if error injection is detected by Initiator */
@@ -1847,10 +1863,9 @@ static int
 lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
uint8_t *txop, uint8_t *rxop)
 {
-   uint8_t guard_type = scsi_host_get_guard(sc-device-host);
uint8_t ret = 0;
 
-   if (guard_type == SHOST_DIX_GUARD_IP) {
+   if (lpfc_cmd_guard_csum(sc)) {
switch (scsi_get_prot_op(sc)) {
case SCSI_PROT_READ_INSERT:
case SCSI_PROT_WRITE_STRIP:
@@ -1928,10 +1943,9 @@ static int
 lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
uint8_t *txop, uint8_t *rxop)
 {
-   uint8_t guard_type = scsi_host_get_guard(sc-device-host);
uint8_t ret = 0;
 
-   if (guard_type == SHOST_DIX_GUARD_IP) {
+   if (lpfc_cmd_guard_csum(sc)) {
switch (scsi_get_prot_op(sc)) {
case SCSI_PROT_READ_INSERT:
case SCSI_PROT_WRITE_STRIP:
@@ -2078,12 +2092,12 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba,
 * protection data is automatically generated, not checked.
 */
if (datadir == DMA_FROM_DEVICE) {
-   if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK))
+   if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD))
bf_set(pde6_ce, pde6, checking);
else
bf_set(pde6_ce, pde6, 0);
 
-   if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK))
+   if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF))
bf_set(pde6_re, pde6, checking);
else
bf_set(pde6_re, pde6, 0);
@@ -2240,12 +2254,12 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *
bf_set(pde6_optx, pde6, txop);
bf_set(pde6_oprx, pde6, rxop);
 
-   if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK))
+   if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD))
bf_set(pde6_ce, pde6, checking);
else
bf_set(pde6_ce, pde6, 0);
 
-   if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK))
+   if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF))
bf_set(pde6_re, pde6, checking);
else
bf_set(pde6_re, pde6, 0);
@@ -2454,12 +2468,12 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba,
 * protection data is automatically generated, not checked.
 */
if (sc-sc_data_direction == DMA_FROM_DEVICE) {
-   if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK))
+   if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD))
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

[PATCH 0/13] lpfc 8.3.41: Update lpfc to revision 8.3.41

2013-07-15 Thread James Smart
This patch set updates the lpfc driver to revision 8.3.41

The patches for 8.3.41 contain:

- Fixed freeing of iocb when internal loopback times out
- Fix mailbox byteswap issue on PPC
- Fixed Receive Queue varied frame size handling 
- Fixed max value of lpfc_lun_queue_depth
- Ensure driver properly zeros unused fields in SLI4 mailbox commands
- Fixed support for 128 byte WQEs 
- Fixed SLI3 failing FCP write on check-condition no-sense with residual zero
- Fixed failure in setting SLI3 board mod
- Fixed not able to perform PCI function reset when board was not in online mode
- Add first burst support to driver
- Fixed the format of some log message fields
- Update copyrights for 8.3.41 modifications
- Update lpfc version to driver version 8.3.41 


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/13] lpfc 8.3.41: Fixed freeing of iocb when internal loopback times out

2013-07-15 Thread James Smart
Fixed freeing of iocb when internal loopback times out


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

 ---

 lpfc_bsg.c  |8 +---
 lpfc_scsi.c |2 +-
 lpfc_sli.c  |   51 +--
 lpfc_sli.h  |5 -
 4 files changed, 55 insertions(+), 11 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-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_bsg.c  2013-07-15 07:15:01.938055472 -0400
@@ -2498,7 +2498,7 @@ static int lpfcdiag_loop_get_xri(struct
struct lpfc_sli_ct_request *ctreq = NULL;
int ret_val = 0;
int time_left;
-   int iocb_stat = 0;
+   int iocb_stat = IOCB_SUCCESS;
unsigned long flags;
 
*txxri = 0;
@@ -2574,6 +2574,7 @@ static int lpfcdiag_loop_get_xri(struct
 
cmdiocbq-iocb_flag |= LPFC_IO_LIBDFC;
cmdiocbq-vport = phba-pport;
+   cmdiocbq-iocb_cmpl = NULL;
 
iocb_stat = lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq,
rspiocbq,
@@ -2963,7 +2964,7 @@ lpfc_bsg_diag_loopback_run(struct fc_bsg
uint8_t *ptr = NULL, *rx_databuf = NULL;
int rc = 0;
int time_left;
-   int iocb_stat;
+   int iocb_stat = IOCB_SUCCESS;
unsigned long flags;
void *dataout = NULL;
uint32_t total_mem;
@@ -3149,6 +3150,7 @@ lpfc_bsg_diag_loopback_run(struct fc_bsg
}
cmdiocbq-iocb_flag |= LPFC_IO_LIBDFC;
cmdiocbq-vport = phba-pport;
+   cmdiocbq-iocb_cmpl = NULL;
iocb_stat = lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq,
 rspiocbq, (phba-fc_ratov * 2) +
 LPFC_DRVR_TIMEOUT);
@@ -3209,7 +3211,7 @@ err_loopback_test_exit:
lpfc_bsg_event_unref(evt); /* delete */
spin_unlock_irqrestore(phba-ct_ev_lock, flags);
 
-   if (cmdiocbq != NULL)
+   if ((cmdiocbq != NULL)  (iocb_stat != IOCB_TIMEDOUT))
lpfc_sli_release_iocbq(phba, cmdiocbq);
 
if (rspiocbq != NULL)
diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2013-07-15 07:15:01.946055472 -0400
@@ -5022,6 +5022,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vp
lpfc_release_scsi_buf(phba, lpfc_cmd);
return FAILED;
}
+   iocbq-iocb_cmpl = lpfc_tskmgmt_def_cmpl;
 
lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
 0702 Issue %s to TGT %d LUN %d 
@@ -5034,7 +5035,6 @@ lpfc_send_taskmgmt(struct lpfc_vport *vp
  iocbq, iocbqrsp, lpfc_cmd-timeout);
if (status != IOCB_SUCCESS) {
if (status == IOCB_TIMEDOUT) {
-   iocbq-iocb_cmpl = lpfc_tskmgmt_def_cmpl;
ret = TIMEOUT_ERROR;
} else
ret = FAILED;
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:01.997055473 -0400
@@ -9889,6 +9889,24 @@ lpfc_sli_wake_iocb_wait(struct lpfc_hba
struct lpfc_scsi_buf *lpfc_cmd;
 
spin_lock_irqsave(phba-hbalock, iflags);
+   if (cmdiocbq-iocb_flag  LPFC_IO_WAKE_TMO) {
+
+   /*
+* A time out has occurred for the iocb.  If a time out
+* completion handler has been supplied, call it.  Otherwise,
+* just free the iocbq.
+*/
+
+   spin_unlock_irqrestore(phba-hbalock, iflags);
+   cmdiocbq-iocb_cmpl = cmdiocbq-wait_iocb_cmpl;
+   cmdiocbq-wait_iocb_cmpl = NULL;
+   if (cmdiocbq-iocb_cmpl)
+   (cmdiocbq-iocb_cmpl)(phba, cmdiocbq, NULL);
+   else
+   lpfc_sli_release_iocbq(phba, cmdiocbq);
+   return;
+   }
+
cmdiocbq-iocb_flag |= LPFC_IO_WAKE;
if (cmdiocbq-context2  rspiocbq)
memcpy(((struct lpfc_iocbq *)cmdiocbq-context2)-iocb,
@@ -9944,10 +9962,16 @@ lpfc_chk_iocb_flg(struct lpfc_hba *phba,
  * @timeout: Timeout in number of seconds.
  *
  * This function issues the iocb to firmware and waits for the
- * iocb to complete. If the iocb command is not
- * completed within timeout seconds, it returns IOCB_TIMEDOUT.
- * Caller should not free the iocb resources if this function
- * returns IOCB_TIMEDOUT.
+ * iocb to complete. The iocb_cmpl field of the shall be used
+ * to handle iocbs which time out. If the field is NULL, the
+ * function shall free the iocbq structure.  If more clean up is
+ * needed, the caller is expected to provide a completion function
+ * that will provide

[PATCH 2/13] lpfc 8.3.41: Fix mailbox byteswap issue on PPC

2013-07-15 Thread James Smart
Fix mailbox byteswap issue on PPC


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

 ---

 lpfc_sli.c |1 -
 1 file changed, 1 deletion(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:01.997055473 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:08.819055628 -0400
@@ -10161,7 +10161,6 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba
 */
if (pmboxq-mbox_flag  LPFC_MBX_WAKE) {
retval = MBX_SUCCESS;
-   lpfc_sli4_swap_str(phba, pmboxq);
} else {
retval = MBX_TIMEOUT;
pmboxq-mbox_cmpl = lpfc_sli_def_mbox_cmpl;




--
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/13] lpfc 8.3.41: Fixed Receive Queue varied frame size handling

2013-07-15 Thread James Smart
Fixed Receive Queue varied frame size handling 


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

 ---

 lpfc_sli.c |   36 
 1 file changed, 24 insertions(+), 12 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-07-15 07:15:08.819055628 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:14.692055763 -0400
@@ -14703,14 +14703,20 @@ lpfc_prep_seq(struct lpfc_vport *vport,
first_iocbq-iocb.unsli3.rcvsli3.vpi =
vport-phba-vpi_ids[vport-vpi];
/* put the first buffer into the first IOCBq */
+   tot_len = bf_get(lpfc_rcqe_length,
+  seq_dmabuf-cq_event.cqe.rcqe_cmpl);
+
first_iocbq-context2 = seq_dmabuf-dbuf;
first_iocbq-context3 = NULL;
first_iocbq-iocb.ulpBdeCount = 1;
-   first_iocbq-iocb.un.cont64[0].tus.f.bdeSize =
+   if (tot_len  LPFC_DATA_BUF_SIZE)
+   first_iocbq-iocb.un.cont64[0].tus.f.bdeSize =
LPFC_DATA_BUF_SIZE;
+   else
+   first_iocbq-iocb.un.cont64[0].tus.f.bdeSize = tot_len;
+
first_iocbq-iocb.un.rcvels.remoteID = sid;
-   tot_len = bf_get(lpfc_rcqe_length,
-  seq_dmabuf-cq_event.cqe.rcqe_cmpl);
+
first_iocbq-iocb.unsli3.rcvsli3.acc_len = tot_len;
}
iocbq = first_iocbq;
@@ -14726,14 +14732,17 @@ lpfc_prep_seq(struct lpfc_vport *vport,
if (!iocbq-context3) {
iocbq-context3 = d_buf;
iocbq-iocb.ulpBdeCount++;
-   pbde = (struct ulp_bde64 *)
-   iocbq-iocb.unsli3.sli3Words[4];
-   pbde-tus.f.bdeSize = LPFC_DATA_BUF_SIZE;
-
/* We need to get the size out of the right CQE */
hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
len = bf_get(lpfc_rcqe_length,
   hbq_buf-cq_event.cqe.rcqe_cmpl);
+   pbde = (struct ulp_bde64 *)
+   iocbq-iocb.unsli3.sli3Words[4];
+   if (len  LPFC_DATA_BUF_SIZE)
+   pbde-tus.f.bdeSize = LPFC_DATA_BUF_SIZE;
+   else
+   pbde-tus.f.bdeSize = len;
+
iocbq-iocb.unsli3.rcvsli3.acc_len += len;
tot_len += len;
} else {
@@ -14748,16 +14757,19 @@ lpfc_prep_seq(struct lpfc_vport *vport,
lpfc_in_buf_free(vport-phba, d_buf);
continue;
}
+   /* We need to get the size out of the right CQE */
+   hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
+   len = bf_get(lpfc_rcqe_length,
+  hbq_buf-cq_event.cqe.rcqe_cmpl);
iocbq-context2 = d_buf;
iocbq-context3 = NULL;
iocbq-iocb.ulpBdeCount = 1;
-   iocbq-iocb.un.cont64[0].tus.f.bdeSize =
+   if (len  LPFC_DATA_BUF_SIZE)
+   iocbq-iocb.un.cont64[0].tus.f.bdeSize =
LPFC_DATA_BUF_SIZE;
+   else
+   iocbq-iocb.un.cont64[0].tus.f.bdeSize = len;
 
-   /* We need to get the size out of the right CQE */
-   hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
-   len = bf_get(lpfc_rcqe_length,
-  hbq_buf-cq_event.cqe.rcqe_cmpl);
tot_len += len;
iocbq-iocb.unsli3.rcvsli3.acc_len = tot_len;
 




--
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/13] lpfc 8.3.41: Ensure driver properly zeros unused fields in SLI4 mailbox commands

2013-07-15 Thread James Smart
Ensure driver properly zeros unused fields in SLI4 mailbox commands


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

 ---

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


diff -upNr a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
--- a/drivers/scsi/lpfc/lpfc_mbox.c 2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_mbox.c 2013-07-15 07:15:19.437055870 -0400
@@ -178,7 +178,8 @@ lpfc_dump_wakeup_param(struct lpfc_hba *
mb-mbxOwner = OWN_HOST;
mb-un.varDmp.cv = 1;
mb-un.varDmp.type = DMP_NV_PARAMS;
-   mb-un.varDmp.entry_index = 0;
+   if (phba-sli_rev  LPFC_SLI_REV4)
+   mb-un.varDmp.entry_index = 0;
mb-un.varDmp.region_id = WAKE_UP_PARMS_REGION_ID;
mb-un.varDmp.word_cnt = WAKE_UP_PARMS_WORD_SIZE;
mb-un.varDmp.co = 0;
@@ -361,7 +362,7 @@ lpfc_config_link(struct lpfc_hba * phba,
/* NEW_FEATURE
 * SLI-2, Coalescing Response Feature.
 */
-   if (phba-cfg_cr_delay) {
+   if (phba-cfg_cr_delay  (phba-sli_rev  LPFC_SLI_REV4)) {
mb-un.varCfgLnk.cr = 1;
mb-un.varCfgLnk.ci = 1;
mb-un.varCfgLnk.cr_delay = phba-cfg_cr_delay;
@@ -377,7 +378,7 @@ lpfc_config_link(struct lpfc_hba * phba,
mb-un.varCfgLnk.crtov = phba-fc_crtov;
mb-un.varCfgLnk.citov = phba-fc_citov;
 
-   if (phba-cfg_ack0)
+   if (phba-cfg_ack0  (phba-sli_rev  LPFC_SLI_REV4))
mb-un.varCfgLnk.ack0_enable = 1;
 
mb-mbxCommand = MBX_CONFIG_LINK;




--
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/13] lpfc 8.3.41: Fixed support for 128 byte WQEs

2013-07-15 Thread James Smart
Fixed support for 128 byte WQEs 


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

 ---

 lpfc_hw4.h  |   13 +
 lpfc_init.c |1 +
 lpfc_sli.c  |   48 +---
 lpfc_sli4.h |6 ++
 4 files changed, 65 insertions(+), 3 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
--- a/drivers/scsi/lpfc/lpfc_hw4.h  2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_hw4.h  2013-07-15 07:15:22.047055930 -0400
@@ -234,6 +234,9 @@ struct ulp_bde64 {
uint32_t addrHigh;
 };
 
+/* Maximun size of immediate data that can fit into a 128 byte WQE */
+#define LPFC_MAX_BDE_IMM_SIZE  64
+
 struct lpfc_sli4_flags {
uint32_t word0;
 #define lpfc_idx_rsrc_rdy_SHIFT0
@@ -2585,6 +2588,9 @@ struct lpfc_sli4_parameters {
 #define cfg_mqv_WORD   word6
uint32_t word7;
uint32_t word8;
+#define cfg_wqsize_SHIFT   8
+#define cfg_wqsize_MASK0x000f
+#define cfg_wqsize_WORDword8
 #define cfg_wqv_SHIFT  14
 #define cfg_wqv_MASK   0x0003
 #define cfg_wqv_WORD   word8
@@ -3622,6 +3628,13 @@ union lpfc_wqe {
struct gen_req64_wqe gen_req;
 };
 
+union lpfc_wqe128 {
+   uint32_t words[32];
+   struct lpfc_wqe_generic generic;
+   struct xmit_seq64_wqe xmit_sequence;
+   struct gen_req64_wqe gen_req;
+};
+
 #define LPFC_GROUP_OJECT_MAGIC_NUM 0xfeaa0001
 #define LPFC_FILE_TYPE_GROUP   0xf7
 #define LPFC_FILE_ID_GROUP 0xa2
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2013-07-15 07:15:17.580055828 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-07-15 07:15:22.052055930 -0400
@@ -9168,6 +9168,7 @@ lpfc_get_sli4_parameters(struct lpfc_hba
sli4_params-mqv = bf_get(cfg_mqv, mbx_sli4_parameters);
sli4_params-wqv = bf_get(cfg_wqv, mbx_sli4_parameters);
sli4_params-rqv = bf_get(cfg_rqv, mbx_sli4_parameters);
+   sli4_params-wqsize = bf_get(cfg_wqsize, mbx_sli4_parameters);
sli4_params-sgl_pages_max = bf_get(cfg_sgl_page_cnt,
mbx_sli4_parameters);
sli4_params-sgl_pp_align = bf_get(cfg_sgl_pp_align,
diff -upNr a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
--- a/drivers/scsi/lpfc/lpfc_sli4.h 2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli4.h 2013-07-15 07:15:22.058055930 -0400
@@ -117,6 +117,7 @@ union sli4_qe {
struct lpfc_rcqe_complete *rcqe_complete;
struct lpfc_mqe *mqe;
union  lpfc_wqe *wqe;
+   union  lpfc_wqe128 *wqe128;
struct lpfc_rqe *rqe;
 };
 
@@ -325,12 +326,14 @@ struct lpfc_bmbx {
 #define LPFC_EQE_SIZE_16B  16
 #define LPFC_CQE_SIZE  16
 #define LPFC_WQE_SIZE  64
+#define LPFC_WQE128_SIZE   128
 #define LPFC_MQE_SIZE  256
 #define LPFC_RQE_SIZE  8
 
 #define LPFC_EQE_DEF_COUNT 1024
 #define LPFC_CQE_DEF_COUNT  1024
 #define LPFC_WQE_DEF_COUNT  256
+#define LPFC_WQE128_DEF_COUNT   128
 #define LPFC_MQE_DEF_COUNT  16
 #define LPFC_RQE_DEF_COUNT 512
 
@@ -416,6 +419,9 @@ struct lpfc_pc_sli4_params {
uint8_t mqv;
uint8_t wqv;
uint8_t rqv;
+   uint8_t wqsize;
+#define LPFC_WQ_SZ64_SUPPORT   1
+#define LPFC_WQ_SZ128_SUPPORT  2
 };
 
 struct lpfc_iov {
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:17.589055828 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:22.091055930 -0400
@@ -12869,10 +12869,44 @@ lpfc_wq_create(struct lpfc_hba *phba, st
wq-page_count);
bf_set(lpfc_mbx_wq_create_cq_id, wq_create-u.request,
cq-queue_id);
+
+   /* wqv is the earliest version supported, NOT the latest */
bf_set(lpfc_mbox_hdr_version, shdr-request,
   phba-sli4_hba.pc_sli4_params.wqv);
 
-   if (phba-sli4_hba.pc_sli4_params.wqv == LPFC_Q_CREATE_VERSION_1) {
+   switch (phba-sli4_hba.pc_sli4_params.wqv) {
+   case LPFC_Q_CREATE_VERSION_0:
+   switch (wq-entry_size) {
+   default:
+   case 64:
+   /* Nothing to do, version 0 ONLY supports 64 byte */
+   page = wq_create-u.request.page;
+   break;
+   case 128:
+   if (!(phba-sli4_hba.pc_sli4_params.wqsize 
+   LPFC_WQ_SZ128_SUPPORT)) {
+   status = -ERANGE;
+   goto out;
+   }
+   /* If we get here the HBA MUST also support V1

[PATCH 4/13] lpfc 8.3.41: Fixed max value of lpfc_lun_queue_depth

2013-07-15 Thread James Smart
Fixed max value of lpfc_lun_queue_depth


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

 ---

 lpfc_attr.c  |9 ++---
 lpfc_init.c  |   34 --
 lpfc_sli.c   |   11 +++
 lpfc_vport.c |3 +++
 4 files changed, 44 insertions(+), 13 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-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-07-15 07:15:17.540055827 -0400
@@ -2591,9 +2591,12 @@ LPFC_VPORT_ATTR_R(enable_da_id, 1, 0, 1,
 
 /*
 # lun_queue_depth:  This parameter is used to limit the number of outstanding
-# commands per FCP LUN. Value range is [1,128]. Default value is 30.
+# commands per FCP LUN. Value range is [1,512]. Default value is 30.
+# If this parameter value is greater than 1/8th the maximum number of exchanges
+# supported by the HBA port, then the lun queue depth will be reduced to
+# 1/8th the maximum number of exchanges.
 */
-LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 128,
+LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 512,
  Max number of FCP commands we can queue to a specific LUN);
 
 /*
@@ -2601,7 +2604,7 @@ LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1
 # commands per target port. Value range is [10,65535]. Default value is 65535.
 */
 LPFC_VPORT_ATTR_R(tgt_queue_depth, 65535, 10, 65535,
-   Max number of FCP commands we can queue to a specific target port);
+ Max number of FCP commands we can queue to a specific target 
port);
 
 /*
 # hba_queue_depth:  This parameter is used to limit the number of outstanding
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-07-15 07:15:17.580055828 -0400
@@ -472,10 +472,22 @@ lpfc_config_port_post(struct lpfc_hba *p
lpfc_sli_read_link_ste(phba);
 
/* Reset the DFT_HBA_Q_DEPTH to the max xri  */
-   if (phba-cfg_hba_queue_depth  (mb-un.varRdConfig.max_xri+1))
-   phba-cfg_hba_queue_depth =
-   (mb-un.varRdConfig.max_xri + 1) -
-   lpfc_sli4_get_els_iocb_cnt(phba);
+   i = (mb-un.varRdConfig.max_xri + 1);
+   if (phba-cfg_hba_queue_depth  i) {
+   lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
+   3359 HBA queue depth changed from %d to %d\n,
+   phba-cfg_hba_queue_depth, i);
+   phba-cfg_hba_queue_depth = i;
+   }
+
+   /* Reset the DFT_LUN_Q_DEPTH to (max xri  3)  */
+   i = (mb-un.varRdConfig.max_xri  3);
+   if (phba-pport-cfg_lun_queue_depth  i) {
+   lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
+   3360 LUN queue depth changed from %d to %d\n,
+   phba-pport-cfg_lun_queue_depth, i);
+   phba-pport-cfg_lun_queue_depth = i;
+   }
 
phba-lmt = mb-un.varRdConfig.lmt;
 
@@ -6664,12 +6676,14 @@ lpfc_sli4_read_config(struct lpfc_hba *p
goto read_cfg_out;
 
/* Reset the DFT_HBA_Q_DEPTH to the max xri  */
-   if (phba-cfg_hba_queue_depth 
-   (phba-sli4_hba.max_cfg_param.max_xri -
-   lpfc_sli4_get_els_iocb_cnt(phba)))
-   phba-cfg_hba_queue_depth =
-   phba-sli4_hba.max_cfg_param.max_xri -
-   lpfc_sli4_get_els_iocb_cnt(phba);
+   length = phba-sli4_hba.max_cfg_param.max_xri -
+   lpfc_sli4_get_els_iocb_cnt(phba);
+   if (phba-cfg_hba_queue_depth  length) {
+   lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
+   3361 HBA queue depth changed from %d to %d\n,
+   phba-cfg_hba_queue_depth, length);
+   phba-cfg_hba_queue_depth = length;
+   }
 
if (bf_get(lpfc_sli_intf_if_type, phba-sli4_hba.sli_intf) !=
LPFC_SLI_INTF_IF_TYPE_2)
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:14.692055763 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:17.589055828 -0400
@@ -6163,6 +6163,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phb
kfree(vpd);
goto out_free_mbox;
}
+
mqe = mboxq-u.mqe;
phba-sli_rev = bf_get(lpfc_mbx_rd_rev_sli_lvl, mqe-un.read_rev);
if (bf_get(lpfc_mbx_rd_rev_fcoe, mqe-un.read_rev))
@@ -6249,6 +6250,16 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phb
phba-vpd.rev.fcphHigh, phba-vpd.rev.fcphLow,
phba-vpd.rev.feaLevelHigh, phba-vpd.rev.feaLevelLow);
 
+   /* Reset the DFT_LUN_Q_DEPTH to (max xri  3)  */
+   rc = (phba-sli4_hba.max_cfg_param.max_xri  3);
+   if (phba-pport-cfg_lun_queue_depth

[PATCH 8/13] lpfc 8.3.41: Fixed failure in setting SLI3 board mode

2013-07-15 Thread James Smart
Fixed failure in setting SLI3 board mode


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

 ---

 lpfc_attr.c |3 ---
 1 file changed, 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-07-15 07:15:17.540055827 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-07-15 07:15:26.536056032 -0400
@@ -674,9 +674,6 @@ 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);





--
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 7/13] lpfc 8.3.41: Fixed SLI3 failing FCP write on check-condition no-sense with residual zero

2013-07-15 Thread James Smart
Fixed SLI3 failing FCP write on check-condition no-sense with residual zero


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

 ---

 lpfc_scsi.c |7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2013-07-15 07:15:01.946055472 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2013-07-15 07:15:23.877055972 -0400
@@ -4386,12 +4386,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *v
if (scsi_sg_count(scsi_cmnd)) {
if (datadir == DMA_TO_DEVICE) {
iocb_cmd-ulpCommand = CMD_FCP_IWRITE64_CR;
-   if (sli4)
-   iocb_cmd-ulpPU = PARM_READ_CHECK;
-   else {
-   iocb_cmd-un.fcpi.fcpi_parm = 0;
-   iocb_cmd-ulpPU = 0;
-   }
+   iocb_cmd-ulpPU = PARM_READ_CHECK;
fcp_cmnd-fcpCntl3 = WRITE_DATA;
phba-fc4OutputRequests++;
} else {




--
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/13] lpfc 8.3.41: Fixed not able to perform PCI function reset when board was not in online mode

2013-07-15 Thread James Smart
Fixed not able to perform PCI function reset when board was not in online mode


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

 ---

 lpfc_attr.c |   11 ++-
 1 file changed, 6 insertions(+), 5 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-07-15 07:15:26.536056032 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-07-15 07:15:28.343056073 -0400
@@ -741,14 +741,15 @@ lpfc_selective_reset(struct lpfc_hba *ph
int status = 0;
int rc;
 
-   if ((!phba-cfg_enable_hba_reset) ||
-   (phba-pport-fc_flag  FC_OFFLINE_MODE))
+   if (!phba-cfg_enable_hba_reset)
return -EACCES;
 
-   status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
+   if (!(phba-pport-fc_flag  FC_OFFLINE_MODE)) {
+   status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
 
-   if (status != 0)
-   return status;
+   if (status != 0)
+   return status;
+   }
 
init_completion(online_compl);
rc = lpfc_workq_post_event(phba, status, online_compl,




--
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/13] lpfc 8.3.41: Fixed the format of some log message fields

2013-07-15 Thread James Smart
Fixed the format of some log message fields


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

 ---

 lpfc_ct.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
--- a/drivers/scsi/lpfc/lpfc_ct.c   2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_ct.c   2013-07-15 07:15:32.810056175 -0400
@@ -895,7 +895,7 @@ lpfc_cmpl_ct(struct lpfc_hba *phba, stru
 
if (irsp-ulpStatus) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
-0268 NS cmd %x Error (%d %d)\n,
+0268 NS cmd x%x Error (x%x x%x)\n,
 cmdcode, irsp-ulpStatus, irsp-un.ulpWord[4]);
 
if ((irsp-ulpStatus == IOSTAT_LOCAL_REJECT) 




--
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/13] lpfc 8.3.41: Add first burst support to driver

2013-07-15 Thread James Smart
Add first burst support to driver


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

 ---

 lpfc.h   |1 +
 lpfc_attr.c  |   11 +++
 lpfc_disc.h  |1 +
 lpfc_els.c   |2 ++
 lpfc_nportdisc.c |   12 ++--
 lpfc_scsi.c  |5 +
 6 files changed, 30 insertions(+), 2 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-07-15 07:15:28.343056073 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-07-15 07:15:29.696056104 -0400
@@ -3950,6 +3950,14 @@ LPFC_VPORT_ATTR_RW(use_adisc, 0, 0, 1,
   Use ADISC on rediscovery to authenticate FCP devices);
 
 /*
+# lpfc_first_burst_size: First burst size to use on the NPorts
+# that support first burst.
+# Value range is [0,65536]. Default value is 0.
+*/
+LPFC_VPORT_ATTR_RW(first_burst_size, 0, 0, 65536,
+  First burst size for Targets that support first burst);
+
+/*
 # lpfc_max_scsicmpl_time: Use scsi command completion time to control I/O queue
 # depth. Default value is 0. When the value of this parameter is zero the
 # SCSI command completion time is not used for controlling I/O queue depth. 
When
@@ -4277,6 +4285,7 @@ struct device_attribute *lpfc_hba_attrs[
dev_attr_lpfc_devloss_tmo,
dev_attr_lpfc_fcp_class,
dev_attr_lpfc_use_adisc,
+   dev_attr_lpfc_first_burst_size,
dev_attr_lpfc_ack0,
dev_attr_lpfc_topology,
dev_attr_lpfc_scan_down,
@@ -4353,6 +4362,7 @@ struct device_attribute *lpfc_vport_attr
dev_attr_lpfc_restrict_login,
dev_attr_lpfc_fcp_class,
dev_attr_lpfc_use_adisc,
+   dev_attr_lpfc_first_burst_size,
dev_attr_lpfc_fdmi_on,
dev_attr_lpfc_max_luns,
dev_attr_nport_evt_cnt,
@@ -5332,6 +5342,7 @@ lpfc_get_vport_cfgparam(struct lpfc_vpor
lpfc_restrict_login_init(vport, lpfc_restrict_login);
lpfc_fcp_class_init(vport, lpfc_fcp_class);
lpfc_use_adisc_init(vport, lpfc_use_adisc);
+   lpfc_first_burst_size_init(vport, lpfc_first_burst_size);
lpfc_max_scsicmpl_time_init(vport, lpfc_max_scsicmpl_time);
lpfc_fdmi_on_init(vport, lpfc_fdmi_on);
lpfc_discovery_threads_init(vport, lpfc_discovery_threads);
diff -upNr a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h
--- a/drivers/scsi/lpfc/lpfc_disc.h 2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_disc.h 2013-07-15 07:15:29.696056104 -0400
@@ -154,6 +154,7 @@ struct lpfc_node_rrq {
 #define NLP_NODEV_REMOVE   0x0800  /* Defer removal till discovery ends */
 #define NLP_TARGET_REMOVE  0x1000   /* Target remove in process */
 #define NLP_SC_REQ 0x2000  /* Target requires authentication */
+#define NLP_FIRSTBURST 0x4000  /* Target supports FirstBurst */
 #define NLP_RPI_REGISTERED 0x8000  /* nlp_rpi is valid */
 
 /* ndlp usage management macros */
diff -upNr a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
--- a/drivers/scsi/lpfc/lpfc_els.c  2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_els.c  2013-07-15 07:15:29.702056105 -0400
@@ -2122,6 +2122,8 @@ lpfc_issue_els_prli(struct lpfc_vport *v
}
npr-estabImagePair = 1;
npr-readXferRdyDis = 1;
+if (vport-cfg_first_burst_size)
+   npr-writeXferRdyDis = 1;
 
/* For FCP support */
npr-prliType = PRLI_FCP_TYPE;
diff -upNr a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
--- a/drivers/scsi/lpfc/lpfc.h  2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc.h  2013-07-15 07:15:29.712056105 -0400
@@ -421,6 +421,7 @@ struct lpfc_vport {
uint32_t cfg_enable_da_id;
uint32_t cfg_max_scsicmpl_time;
uint32_t cfg_tgt_queue_depth;
+   uint32_t cfg_first_burst_size;
 
uint32_t dev_loss_tmo_changed;
 
diff -upNr a/drivers/scsi/lpfc/lpfc_nportdisc.c 
b/drivers/scsi/lpfc/lpfc_nportdisc.c
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c2013-07-15 06:56:23.0 
-0400
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c2013-07-15 07:15:29.715056106 
-0400
@@ -690,11 +690,15 @@ lpfc_rcv_prli(struct lpfc_vport *vport,
 
ndlp-nlp_type = ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);
ndlp-nlp_fcp_info = ~NLP_FCP_2_DEVICE;
+   ndlp-nlp_flag = ~NLP_FIRSTBURST;
if (npr-prliType == PRLI_FCP_TYPE) {
if (npr-initiatorFunc)
ndlp-nlp_type |= NLP_FCP_INITIATOR;
-   if (npr-targetFunc)
+   if (npr-targetFunc) {
ndlp-nlp_type |= NLP_FCP_TARGET;
+   if (npr-writeXferRdyDis)
+   ndlp-nlp_flag |= NLP_FIRSTBURST;
+   }
if (npr-Retry)
ndlp-nlp_fcp_info |= NLP_FCP_2_DEVICE;
}
@@ -1676,12 +1680,16 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vp
/* Check out PRLI rsp

[PATCH 13/13] lpfc 8.3.41: Update lpfc version to driver version 8.3.41

2013-07-15 Thread James Smart
Update lpfc version to driver version 8.3.41 


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-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_version.h  2013-07-15 07:15:34.546056215 -0400
@@ -18,7 +18,7 @@
  * included with this package. *
  ***/
 
-#define LPFC_DRIVER_VERSION 8.3.40
+#define LPFC_DRIVER_VERSION 8.3.41
 #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


[PATCH 12/13] lpfc 8.3.41: Update copyrights for 8.3.41 modifications

2013-07-15 Thread James Smart
Update copyrights for 8.3.41 modifications


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

 ---

 lpfc_disc.h  |2 +-
 lpfc_sli.h   |2 +-
 lpfc_vport.c |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h
--- a/drivers/scsi/lpfc/lpfc_disc.h 2013-07-15 09:25:43.278234018 -0400
+++ b/drivers/scsi/lpfc/lpfc_disc.h 2013-07-15 09:26:17.715234802 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2008 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2013 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * *
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h
--- a/drivers/scsi/lpfc/lpfc_sli.h  2013-07-15 09:25:42.970234010 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.h  2013-07-15 09:26:26.424235001 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2007 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2013 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * *
diff -upNr a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
--- a/drivers/scsi/lpfc/lpfc_vport.c2013-07-15 09:25:43.129234014 -0400
+++ b/drivers/scsi/lpfc/lpfc_vport.c2013-07-15 09:26:36.907235238 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2008 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2013 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * Portions Copyright (C) 2004-2005 Christoph Hellwig  *



--
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] lpfc: Removed obsolete fcp_eq_count and fcp_wq_count driver attributes

2013-08-02 Thread James Smart
Removed obsolete fcp_eq_count and fcp_wq_count driver attributes.

The patches were cut against scsi.git, branch misc, plus the lpfc 8.3.41 
patch set
posted a couple of weeks ago.

-- james


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

 ---

 lpfc.h  |2 --
 lpfc_attr.c |   23 ---
 lpfc_init.c |7 ---
 3 files changed, 32 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-08-02 14:14:38.269047324 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-08-02 15:08:03.112120297 -0400
@@ -4121,25 +4121,6 @@ LPFC_ATTR_R(use_msi, 2, 0, 2, Use Messa
MSI-X (2), if possible);
 
 /*
-# lpfc_fcp_wq_count: Set the number of fast-path FCP work queues
-# This parameter is ignored and will eventually be depricated
-#
-# Value range is [1,7]. Default value is 4.
-*/
-LPFC_ATTR_R(fcp_wq_count, LPFC_FCP_IO_CHAN_DEF, LPFC_FCP_IO_CHAN_MIN,
-   LPFC_FCP_IO_CHAN_MAX,
-   Set the number of fast-path FCP work queues, if possible);
-
-/*
-# lpfc_fcp_eq_count: Set the number of FCP EQ/CQ/WQ IO channels
-#
-# Value range is [1,7]. Default value is 4.
-*/
-LPFC_ATTR_R(fcp_eq_count, LPFC_FCP_IO_CHAN_DEF, LPFC_FCP_IO_CHAN_MIN,
-   LPFC_FCP_IO_CHAN_MAX,
-   Set the number of fast-path FCP event queues, if possible);
-
-/*
 # lpfc_fcp_io_channel: Set the number of FCP EQ/CQ/WQ IO channels
 #
 # Value range is [1,7]. Default value is 4.
@@ -4317,8 +4298,6 @@ struct device_attribute *lpfc_hba_attrs[
dev_attr_lpfc_use_msi,
dev_attr_lpfc_fcp_imax,
dev_attr_lpfc_fcp_cpu_map,
-   dev_attr_lpfc_fcp_wq_count,
-   dev_attr_lpfc_fcp_eq_count,
dev_attr_lpfc_fcp_io_channel,
dev_attr_lpfc_enable_bg,
dev_attr_lpfc_soft_wwnn,
@@ -5301,8 +5280,6 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
lpfc_use_msi_init(phba, lpfc_use_msi);
lpfc_fcp_imax_init(phba, lpfc_fcp_imax);
lpfc_fcp_cpu_map_init(phba, lpfc_fcp_cpu_map);
-   lpfc_fcp_wq_count_init(phba, lpfc_fcp_wq_count);
-   lpfc_fcp_eq_count_init(phba, lpfc_fcp_eq_count);
lpfc_fcp_io_channel_init(phba, lpfc_fcp_io_channel);
lpfc_enable_hba_reset_init(phba, lpfc_enable_hba_reset);
lpfc_enable_hba_heartbeat_init(phba, lpfc_enable_hba_heartbeat);
diff -upNr a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
--- a/drivers/scsi/lpfc/lpfc.h  2013-08-02 14:14:38.305047324 -0400
+++ b/drivers/scsi/lpfc/lpfc.h  2013-08-02 15:09:36.199122417 -0400
@@ -711,8 +711,6 @@ struct lpfc_hba {
uint32_t cfg_use_msi;
uint32_t cfg_fcp_imax;
uint32_t cfg_fcp_cpu_map;
-   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;
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2013-08-02 14:14:38.086047320 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-08-02 15:08:13.576120536 -0400
@@ -4913,9 +4913,6 @@ lpfc_sli4_driver_resource_setup(struct l
lpfc_get_cfgparam(phba);
phba-max_vpi = LPFC_MAX_VPI;
 
-   /* Eventually cfg_fcp_eq_count / cfg_fcp_wq_count will be depricated */
-   phba-cfg_fcp_io_channel = phba-cfg_fcp_eq_count;
-
/* This will be set to correct value after the read_config mbox */
phba-max_vports = 0;
 
@@ -6873,11 +6870,7 @@ lpfc_sli4_queue_verify(struct lpfc_hba *
cfg_fcp_io_channel = phba-sli4_hba.max_cfg_param.max_eq;
}
 
-   /* Eventually cfg_fcp_eq_count / cfg_fcp_wq_count will be depricated */
-
/* The actual number of FCP event queues adopted */
-   phba-cfg_fcp_eq_count = cfg_fcp_io_channel;
-   phba-cfg_fcp_wq_count = cfg_fcp_io_channel;
phba-cfg_fcp_io_channel = cfg_fcp_io_channel;
 
/* Get EQ depth from module parameter, fake the default for now */


--
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: [SCSI] lpfc: Don't force CONFIG_GENERIC_CSUM on

2013-08-08 Thread James Smart
I'm good with it. You folks understand the config dependencies better 
than I.


-- james

Acked-By:  James Smart  james.sm...@emulex.com


On 8/8/2013 3:47 AM, Anton Blanchard wrote:

Hi Randy,


I reported:

on i386:
# CONFIG_CRC_T10DIF is not set


drivers/built-in.o: In function `lpfc_bg_crc':
(.text+0x3cb3c9): undefined reference to `crc_t10dif'


and then James Bottomley provided the patch.
I don't know why he added GENERIC_CSUM to it.

Thanks for investigating this. How does this patch look?

Anton
--

[SCSI] lpfc: Don't force CONFIG_GENERIC_CSUM on

We want ppc64 to be able to select between optimised assembly
checksum routines in big endian and the generic lib/checksum.c
routines in little endian.

The lpfc driver is forcing CONFIG_GENERIC_CSUM on which means
we are unable to make the decision to enable it in the arch
Kconfig. If the option exists it is always forced on.

This got introduced in 3.10 via commit 6a7252fdb0c3 ([SCSI] lpfc:
fix up Kconfig dependencies). I spoke to Randy about it and
the original issue was with CRC_T10DIF not being defined.

As such, remove the select of CONFIG_GENERIC_CSUM.

Signed-off-by: Anton Blanchard an...@samba.org
Cc: sta...@vger.kernel.org # 3.10
---

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 48b2918..92ff027 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1353,7 +1353,6 @@ config SCSI_LPFC
tristate Emulex LightPulse Fibre Channel Support
depends on PCI  SCSI
select SCSI_FC_ATTRS
-   select GENERIC_CSUM
select CRC_T10DIF
help
This lpfc driver supports the Emulex LightPulse



--
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 net-next 2/2] random32: do not feed jiffies as seed from lpfc driver

2014-08-11 Thread James Smart

Acked-by:  James Smart  james.sm...@emulex.com

-- james  s



On 7/31/2014 4:08 PM, Daniel Borkmann wrote:

In prandom we have already reseeding mechanisms that trigger
periodically from a much better entropy source than just
feeding in jiffies through lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
[what a function name 8-)]. Therefore, just remove this.

Signed-off-by: Daniel Borkmann dbork...@redhat.com
Cc: James Bottomley jbottom...@parallels.com
Cc: James Smart james.sm...@emulex.com
---
  This can also go via James, how you prefer it.

  drivers/scsi/lpfc/lpfc_hbadisc.c | 4 
  1 file changed, 4 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 2a17e31..5072bb2 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -2146,7 +2146,6 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba 
*phba, LPFC_MBOXQ_t *mboxq)
uint16_t fcf_index, next_fcf_index;
struct lpfc_fcf_rec *fcf_rec = NULL;
uint16_t vlan_id;
-   uint32_t seed;
bool select_new_fcf;
int rc;
  
@@ -2383,9 +2382,6 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)

phba-fcf.fcf_flag |= FCF_AVAILABLE;
/* Setup initial running random FCF selection count */
phba-fcf.eligible_fcf_cnt = 1;
-   /* Seeding the random number generator for random selection */
-   seed = (uint32_t)(0x  jiffies);
-   prandom_seed(seed);
}
spin_unlock_irq(phba-hbalock);
goto read_next_fcf;


--
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 v2 RESEND 12/23] lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-11 Thread James Smart

Alexander,

I haven't looked too deeply, but it's clear it doesn't jive with what 
we've discussed in the past. Your original patches missed several other 
similar sections for revision. I had sent a revised set of patches.


I was also unclear as to the merge path the patches were taking, as it 
was mod'ing areas that have already changed in the scsi misc tree, but 
the misc tree didn' have the pci mods.  I take it this is heading to 
Christoph's tree ?  and that it has picked up the pci mods ?


-- james s



On 8/11/2014 4:01 AM, Alexander Gordeev wrote:

On Sat, Jul 26, 2014 at 09:22:27AM +0100, Alexander Gordeev wrote:

On Wed, Jul 16, 2014 at 08:05:16PM +0200, Alexander Gordeev wrote:

As result of deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two interfaces need to be updated to use the
new pci_enable_msi_range()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Hi James,

Could you please review this patch?

James?


Thanks!


Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: James Smart james.sm...@emulex.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
  drivers/scsi/lpfc/lpfc_init.c |   38 +-
  1 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index a5769a9..d9caed9 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8211,9 +8211,9 @@ lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba)
   * @phba: pointer to lpfc hba data structure.
   *
   * This routine is invoked to enable the MSI-X interrupt vectors to device
- * with SLI-3 interface specs. The kernel function pci_enable_msix() is
- * called to enable the MSI-X vectors. Note that pci_enable_msix(), once
- * invoked, enables either all or nothing, depending on the current
+ * with SLI-3 interface specs. The kernel function pci_enable_msix_exact()
+ * is called to enable the MSI-X vectors. Note that pci_enable_msix_exact(),
+ * once invoked, enables either all or nothing, depending on the current
   * availability of PCI vector resources. The device driver is responsible
   * for calling the individual request_irq() to register each MSI-X vector
   * with a interrupt handler, which is done in this function. Note that
@@ -8237,8 +8237,8 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba)
phba-msix_entries[i].entry = i;
  
  	/* Configure MSI-X capability structure */

-   rc = pci_enable_msix(phba-pcidev, phba-msix_entries,
-   ARRAY_SIZE(phba-msix_entries));
+   rc = pci_enable_msix_exact(phba-pcidev, phba-msix_entries,
+  ARRAY_SIZE(phba-msix_entries));
if (rc) {
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
0420 PCI enable MSI-X failed (%d)\n, rc);
@@ -8775,15 +8775,13 @@ out:
   * @phba: pointer to lpfc hba data structure.
   *
   * This routine is invoked to enable the MSI-X interrupt vectors to device
- * with SLI-4 interface spec. The kernel function pci_enable_msix() is called
- * to enable the MSI-X vectors. Note that pci_enable_msix(), once invoked,
- * enables either all or nothing, depending on the current availability of
- * PCI vector resources. The device driver is responsible for calling the
- * individual request_irq() to register each MSI-X vector with a interrupt
- * handler, which is done in this function. Note that later when device is
- * unloading, the driver should always call free_irq() on all MSI-X vectors
- * it has done request_irq() on before calling pci_disable_msix(). Failure
- * to do so results in a BUG_ON() and a device will be left with MSI-X
+ * with SLI-4 interface spec. The kernel function pci_enable_msix_range()
+ * is called to enable the MSI-X vectors. The device driver is responsible
+ * for calling the individual request_irq() to register each MSI-X vector
+ * with a interrupt handler, which is done in this function. Note that later
+ * when device is unloading, the driver should always call free_irq() on all
+ * MSI-X vectors it has done request_irq() on before calling pci_disable_msix()
+ * Failure to do so results in a BUG_ON() and a device will be left with MSI-X
   * enabled and leaks its vectors.
   *
   * Return codes
@@ -8805,18 +8803,16 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
phba-sli4_hba.msix_entries[index].entry = index;
vectors++;
}
-enable_msix_vectors:
-   rc = pci_enable_msix(phba-pcidev, phba-sli4_hba.msix_entries,
-vectors);
-   if (rc  1) {
-   vectors = rc;
-   goto enable_msix_vectors;
-   } else if (rc) {
+
+   rc = pci_enable_msix_range(phba-pcidev, phba-sli4_hba.msix_entries,
+  2, vectors);
+   if (rc  0

Re: [PATCH net-next 2/2] random32: do not feed jiffies as seed from lpfc driver

2014-08-11 Thread James Smart

yep. I'll do so.

-- james s


On 8/11/2014 2:18 PM, Christoph Hellwig wrote:

On Mon, Aug 11, 2014 at 01:07:15PM -0400, James Smart wrote:

Acked-by:  James Smart  james.sm...@emulex.com

Can you jsut queue this up (and the pci fix as well) together with
anything else you have pending for 3.18?

I'd really like to move towards a model where maintainers of driver
collect everything for their area to spread work a bit better.





--
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] lpfc: Avoid to disable pci_dev twice

2014-08-27 Thread James Smart

Mike,

Can you confirm - the nulls this patch correct are because the 
probe_one and error_detect threads are running concurrently, thus battling ?


If so - this fix looks insufficient and we should rework it.

Q: why are they allowed to run concurrently ?  I could see this solved 
at the platform level to let probe_one finish before error_detect is 
called (and therefore stating error_detect only makes sense to call if 
probe_one was successful). It's also a much driver-friendly solution. I 
could see other drivers have much the same issue with concurrency and 
data structure teardown - and if locks aren't allowed in the 
error-detect path... it's not good.


-- james s



On 7/31/2014 10:16 PM, Mike Qiu wrote:

On 07/17/2014 02:32 PM, Mike Qiu wrote:


Hi, all

How about this patch ?

Any idea ?


In IBM Power servers, when hardware error occurs during probe
state, EEH subsystem will call driver's error_detected interface,
which will call pci_disable_device(). But driver's probe function also
call pci_disable_device() in this situation.

So pci_dev will be disabled twice:

Device lpfc disabling already-disabled device
[ cut here ]
WARNING: at drivers/pci/pci.c:1407
CPU: 0 PID: 8744 Comm: kworker/0:0 Tainted: GW 
3.10.42-2002.pkvm2_1_1.6.ppc64 #1

Workqueue: events .work_for_cpu_fn
task: c0274e3f5400 ti: c027d3958000 task.ti: c027d3958000
NIP: c0471b8c LR: c0471b88 CTR: c043ebe0
REGS: c027d395b650 TRAP: 0700   Tainted: GW 
(3.10.42-2002.pkvm2_1_1.6.ppc64)
MSR: 900100029032 SF,HV,EE,ME,IR,DR,RI  CR: 28b52b44  XER: 
2000

CFAR: c0879ab8 SOFTE: 1
...
NIP .pci_disable_device+0xcc/0xe0
LR  .pci_disable_device+0xc8/0xe0
Call Trace:
.pci_disable_device+0xc8/0xe0 (unreliable)
.lpfc_disable_pci_dev+0x50/0x80 [lpfc]
.lpfc_pci_probe_one+0x870/0x21a0 [lpfc]
.local_pci_probe+0x68/0xb0
.work_for_cpu_fn+0x38/0x60
.process_one_work+0x1a4/0x4d0
.worker_thread+0x37c/0x490
.kthread+0xf0/0x100
.ret_from_kernel_thread+0x5c/0x80

Signed-off-by: Mike Qiu qiud...@linux.vnet.ibm.com
---
  drivers/scsi/lpfc/lpfc.h  |  1 +
  drivers/scsi/lpfc/lpfc_init.c | 59 
+++

  2 files changed, 55 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 434e903..0c7bad9 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -813,6 +813,7 @@ struct lpfc_hba {
  #define VPD_MASK0xf /* mask for any vpd data */

  uint8_t soft_wwn_enable;
+uint8_t probe_done;

  struct timer_list fcp_poll_timer;
  struct timer_list eratt_poll;
diff --git a/drivers/scsi/lpfc/lpfc_init.c 
b/drivers/scsi/lpfc/lpfc_init.c

index 06f9a5b..c2e67ae 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -9519,6 +9519,9 @@ lpfc_pci_probe_one_s3(struct pci_dev *pdev, 
const struct pci_device_id *pid)

  }
  }

+/* Set the probe flag */
+phba-probe_done = 1;
+
  /* Perform post initialization setup */
  lpfc_post_init_setup(phba);

@@ -9795,6 +9798,9 @@ lpfc_sli_prep_dev_for_recover(struct lpfc_hba 
*phba)

  static void
  lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba)
  {
+if (phba)
+return;
+
  lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
  2710 PCI channel disable preparing for reset\n);

@@ -9812,7 +9818,8 @@ lpfc_sli_prep_dev_for_reset(struct lpfc_hba *phba)

  /* Disable interrupt and pci device */
  lpfc_sli_disable_intr(phba);
-pci_disable_device(phba-pcidev);
+if (phba-probe_done  phba-pcidev)
+pci_disable_device(phba-pcidev);
  }

  /**
@@ -10282,6 +10289,9 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, 
const struct pci_device_id *pid)

  goto out_disable_intr;
  }

+/* Set probe_done flag */
+phba-probe_done = 1;
+
  /* Log the current active interrupt mode */
  phba-intr_mode = intr_mode;
  lpfc_log_intr_mode(phba, intr_mode);
@@ -10544,6 +10554,9 @@ lpfc_sli4_prep_dev_for_recover(struct 
lpfc_hba *phba)

  static void
  lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba)
  {
+if (!phba)
+return;
+
  lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
  2826 PCI channel disable preparing for reset\n);

@@ -10562,7 +10575,9 @@ lpfc_sli4_prep_dev_for_reset(struct lpfc_hba 
*phba)

  /* Disable interrupt and pci device */
  lpfc_sli4_disable_intr(phba);
  lpfc_sli4_queue_destroy(phba);
-pci_disable_device(phba-pcidev);
+
+if (phba-probe_done  phba-pcidev)
+pci_disable_device(phba-pcidev);
  }

  /**
@@ -10893,9 +10908,21 @@ static pci_ers_result_t
  lpfc_io_error_detected(struct pci_dev *pdev, pci_channel_state_t 
state)

  {
  struct Scsi_Host *shost = pci_get_drvdata(pdev);
-struct lpfc_hba *phba = ((struct lpfc_vport 
*)shost-hostdata)-phba;

+struct lpfc_hba *phba;
  pci_ers_result_t rc = PCI_ERS_RESULT_DISCONNECT;

+if 

[PATCH 0/19] lpfc 10.4.8000.0: Update lpfc version to driver version 10.4.8000.0

2014-09-03 Thread James Smart
Update lpfc version to driver version 10.4.8000.0

This patch set updates the lpfc driver to revision 10.4.8000.0

The patches for 10.4.8000.0 contain:
- Incorporate patches posted to linux-scsi
  - Mark functions as static in lpfc/lpfc_sli.c
  - Mark functions as static in lpfc/lpfc_hbadisc.c
  - Mark functions as static in lpfc/lpfc_init.c
  - Mark functions as static in lpfc/lpfc_scsi.c
  - Mark function as static in lpfc/lpfc_bsg.c
  - Use time_after()
  - Use dma_zalloc_coherent
  - random32: do not feed jiffies as seed from lpfc driver
  - Use pci_enable_msix_range() instead of pci_enable_msix()
- Fix discovery timeout during nameserver login
- Fix quarantined XRI recovery qualifier state in link bounce 
- Fix IP Reset processing - wait for RDY before proceeding
- Fix race between LOGO/PLOGI handling causing NULL pointer
- Fix locking issues with abort data paths
- Fixed crash from page fault caused by use after rport delete
- Fixed High priority issues from lpfc given by fortify source code scan.
- Fixed Low priority issues from lpfc given by fortify source code scan.
- Fix for handling unmapped ndlp in target reset handler
- Update lpfc version to driver version 10.4.8000.0


The patches were cut against Christoph's scsi-queue.git,
branch drivers-for-3.18.


-- james s


Signed-off-by: James Smart james.sm...@emulex.com
Signed-off-by: Dick Kennedy dick.kenn...@emulex.com

James Smart (19):

 drivers/scsi/lpfc/lpfc_attr.c  |   2 +-
 drivers/scsi/lpfc/lpfc_bsg.c   |  20 ++-
 drivers/scsi/lpfc/lpfc_crtn.h  |   1 -
 drivers/scsi/lpfc/lpfc_ct.c|  14 ++-
 drivers/scsi/lpfc/lpfc_debugfs.c   |   4 +-
 drivers/scsi/lpfc/lpfc_disc.h  |   6 +-
 drivers/scsi/lpfc/lpfc_els.c   |  33 +++--
 drivers/scsi/lpfc/lpfc_hbadisc.c   |  53 +---
 drivers/scsi/lpfc/lpfc_init.c  | 225 -
 drivers/scsi/lpfc/lpfc_mbox.c  |   6 +-
 drivers/scsi/lpfc/lpfc_nportdisc.c |   2 +
 drivers/scsi/lpfc/lpfc_scsi.c  |  34 +++--
 drivers/scsi/lpfc/lpfc_sli.c   | 247 ++---
 drivers/scsi/lpfc/lpfc_sli.h   |   1 +
 drivers/scsi/lpfc/lpfc_sli4.h  |  20 +--
 drivers/scsi/lpfc/lpfc_version.h   |   2 +-
 16 files changed, 351 insertions(+), 319 deletions(-)

-- 
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 1/19] lpfc 10.4.8000.0: Mark functions as static in lpfc/lpfc_sli.c

2014-09-03 Thread James Smart
Incorporating prior patch:
 http://marc.info/?l=linux-scsim=139611643606816w=2

  Rashika Kheria rashika.khe...@gmail.com
  [PATCH 22/55] scsi: Mark functions as static in lpfc/lpfc_sli.c

  Mark functions as static in lpfc/lpfc_sli.c because they are not used
  outside this file.

  This eliminates the following warnings in lpfc/lpfc_sli.c:
  drivers/scsi/lpfc/lpfc_sli.c:13867:1: warning: no previous prototype for 
‘lpfc_sli4_alloc_xri’ [-Wmissing-prototypes]
  drivers/scsi/lpfc/lpfc_sli.c:13897:1: warning: no previous prototype for 
‘__lpfc_sli4_free_xri’ [-Wmissing-prototypes]
  drivers/scsi/lpfc/lpfc_sli.c:14317:1: warning: no previous prototype for 
‘lpfc_update_rcv_time_stamp’ [-Wmissing-prototypes]
  drivers/scsi/lpfc/lpfc_sli.c:14786:1: warning: no previous prototype for 
‘lpfc_sli4_handle_unsol_abort’ [-Wmissing-prototypes]
  drivers/scsi/lpfc/lpfc_sli.c:15331:1: warning: no previous prototype for 
‘__lpfc_sli4_free_rpi’ [-Wmissing-prototypes]
  drivers/scsi/lpfc/lpfc_sli.c:15769:1: warning: no previous prototype for 
‘lpfc_check_next_fcf_pri_level’ [-Wmissing-prototypes]
  drivers/scsi/lpfc/lpfc_sli.c:16000:1: warning: no previous prototype for 
‘lpfc_mbx_cmpl_redisc_fcf_table’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria rashika.khe...@gmail.com
Reviewed-by: Josh Triplett j...@joshtriplett.org
Reviewed-by: James Smart james.sm...@emulex.com
---
 drivers/scsi/lpfc/lpfc_sli.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 32ada05..04a8b74 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -14270,7 +14270,7 @@ lpfc_sli4_post_sgl(struct lpfc_hba *phba,
  * A nonzero rpi defined as rpi_base = rpi  max_rpi if successful
  * LPFC_RPI_ALLOC_ERROR if no rpis are available.
  **/
-uint16_t
+static uint16_t
 lpfc_sli4_alloc_xri(struct lpfc_hba *phba)
 {
unsigned long xri;
@@ -14300,7 +14300,7 @@ lpfc_sli4_alloc_xri(struct lpfc_hba *phba)
  * This routine is invoked to release an xri to the pool of
  * available rpis maintained by the driver.
  **/
-void
+static void
 __lpfc_sli4_free_xri(struct lpfc_hba *phba, int xri)
 {
if (test_and_clear_bit(xri, phba-sli4_hba.xri_bmask)) {
@@ -14720,7 +14720,7 @@ lpfc_fc_frame_to_vport(struct lpfc_hba *phba, struct 
fc_frame_header *fc_hdr,
  * the driver uses this time stamp to indicate if any received sequences have
  * timed out.
  **/
-void
+static void
 lpfc_update_rcv_time_stamp(struct lpfc_vport *vport)
 {
struct lpfc_dmabuf *h_buf;
@@ -15189,7 +15189,7 @@ lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport,
  * unsolicited sequence has been aborted. After that, it will issue a basic
  * accept to accept the abort.
  **/
-void
+static void
 lpfc_sli4_handle_unsol_abort(struct lpfc_vport *vport,
 struct hbq_dmabuf *dmabuf)
 {
@@ -15734,7 +15734,7 @@ lpfc_sli4_alloc_rpi(struct lpfc_hba *phba)
  * This routine is invoked to release an rpi to the pool of
  * available rpis maintained by the driver.
  **/
-void
+static void
 __lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi)
 {
if (test_and_clear_bit(rpi, phba-sli4_hba.rpi_bmask)) {
@@ -16172,7 +16172,7 @@ fail_fcf_read:
  * returns:
  * 1=success 0=failure
  **/
-int
+static int
 lpfc_check_next_fcf_pri_level(struct lpfc_hba *phba)
 {
uint16_t next_fcf_pri;
@@ -16403,7 +16403,7 @@ lpfc_sli4_fcf_rr_index_clear(struct lpfc_hba *phba, 
uint16_t fcf_index)
  * command. If the mailbox command returned failure, it will try to stop the
  * FCF rediscover wait timer.
  **/
-void
+static void
 lpfc_mbx_cmpl_redisc_fcf_table(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
 {
struct lpfc_mbx_redisc_fcf_tbl *redisc_fcf;
-- 
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 6/19] lpfc 10.4.8000.0: Use time_after()

2014-09-03 Thread James Smart
Incorporating prior patch:
 http://marc.info/?l=linux-scsim=140053378307936w=2

  manuel.schoell...@gmx.de
  [PATCH] lpfc: Use time_after()

  To be future-proof and for better readability the time comparisons
  are modified to use time_after() instead of plain, error-prone math.

Signed-off-by: Manuel Schölling manuel.schoell...@gmx.de
Reviewed-by: James Smart james.sm...@emulex.com
---
 drivers/scsi/lpfc/lpfc_scsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 3c250e3..6094545 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -380,12 +380,14 @@ lpfc_rampdown_queue_depth(struct lpfc_hba *phba)
 {
unsigned long flags;
uint32_t evt_posted;
+   unsigned long expires;
 
spin_lock_irqsave(phba-hbalock, flags);
atomic_inc(phba-num_rsrc_err);
phba-last_rsrc_error_time = jiffies;
 
-   if ((phba-last_ramp_down_time + QUEUE_RAMP_DOWN_INTERVAL)  jiffies) {
+   expires = phba-last_ramp_down_time + QUEUE_RAMP_DOWN_INTERVAL;
+   if (time_after(expires, jiffies)) {
spin_unlock_irqrestore(phba-hbalock, flags);
return;
}
-- 
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 4/19] lpfc 10.4.8000.0: Mark functions as static in lpfc/lpfc_scsi.c

2014-09-03 Thread James Smart
Incorporating prior patch:
 http://marc.info/?l=linux-scsim=139611665406898w=2

  Rashika Kheria rashika.khe...@gmail.com
  [PATCH 25/55] scsi: Mark functions as static in lpfc/lpfc_scsi.c

  Mark functions as static in lpfc/lpfc_scsi.c because they are not used
  outside this file.

  This eliminates the following warnings in lpfc/lpfc_scsi.c:
  drivers/scsi/lpfc/lpfc_scsi.c:299:1: warning: no previous prototype for 
‘lpfc_change_queue_depth’ [-Wmissing-prototypes]
  drivers/scsi/lpfc/lpfc_scsi.c:795:1: warning: no previous prototype for 
‘lpfc_sli4_post_scsi_sgl_list’ [-Wmissing-prototypes]
  drivers/scsi/lpfc/lpfc_scsi.c:3019:1: warning: no previous prototype for 
‘lpfc_bg_crc’ [-Wmissing-prototypes]
  drivers/scsi/lpfc/lpfc_scsi.c:3035:1: warning: no previous prototype for 
‘lpfc_bg_csum’ [-Wmissing-prototypes]
  drivers/scsi/lpfc/lpfc_scsi.c:3048:1: warning: no previous prototype for 
‘lpfc_calc_bg_err’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria rashika.khe...@gmail.com
Reviewed-by: Josh Triplett j...@joshtriplett.org
Reviewed-by: James Smart james.sm...@emulex.com
---
 drivers/scsi/lpfc/lpfc_scsi.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 7862c55..3c250e3 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -306,7 +306,7 @@ lpfc_send_sdev_queuedepth_change_event(struct lpfc_hba 
*phba,
  * depth for a scsi device. This function sets the queue depth to the new
  * value and sends an event out to log the queue depth change.
  **/
-int
+static int
 lpfc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
 {
struct lpfc_vport *vport = (struct lpfc_vport *) sdev-host-hostdata;
@@ -741,7 +741,7 @@ lpfc_sli4_fcp_xri_aborted(struct lpfc_hba *phba,
  *
  * Returns: 0 = failure, non-zero number of successfully posted buffers.
  **/
-int
+static int
 lpfc_sli4_post_scsi_sgl_list(struct lpfc_hba *phba,
 struct list_head *post_sblist, int sb_count)
 {
@@ -2965,7 +2965,7 @@ err:
  * on the specified data using a CRC algorithmn
  * using crc_t10dif.
  */
-uint16_t
+static uint16_t
 lpfc_bg_crc(uint8_t *data, int count)
 {
uint16_t crc = 0;
@@ -2981,7 +2981,7 @@ lpfc_bg_crc(uint8_t *data, int count)
  * on the specified data using a CSUM algorithmn
  * using ip_compute_csum.
  */
-uint16_t
+static uint16_t
 lpfc_bg_csum(uint8_t *data, int count)
 {
uint16_t ret;
@@ -2994,7 +2994,7 @@ lpfc_bg_csum(uint8_t *data, int count)
  * This function examines the protection data to try to determine
  * what type of T10-DIF error occurred.
  */
-void
+static void
 lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
 {
struct scatterlist *sgpe; /* s/g prot entry */
-- 
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


  1   2   3   4   5   6   7   8   9   10   >