profile/ivi/kernel-x86-ivi.git
15 years ago[SCSI] libfc: clean up point-to-point discovery code.
Joe Eykholt [Tue, 25 Aug 2009 21:02:49 +0000 (14:02 -0700)]
[SCSI] libfc: clean up point-to-point discovery code.

The discovery code had a special-case for the point-to-point mode,
which used a bunch of code that wasn't really needed.

Now that rport_create adds the rport to the discovery list,
completely skip discovery for the point-to-point case.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: discovery gpn_ft parse bug
Joe Eykholt [Tue, 25 Aug 2009 21:02:43 +0000 (14:02 -0700)]
[SCSI] libfc: discovery gpn_ft parse bug

In fc_disc_gpn_ft_parse(), after fc_disc_done() is called, the
disc state is changed by setting buf_len = 0.  This is wrong
since the discovery may have restarted.   Instead, return
after calling fc_disc_done.

Also, return an error on memory allocation failure.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: discovery retry should clear pending first.
Joe Eykholt [Tue, 25 Aug 2009 21:02:38 +0000 (14:02 -0700)]
[SCSI] libfc: discovery retry should clear pending first.

Currently fc_disc_timeout() restarts discovery only if it is not pending.
When the timer is scheduled, the discovery is left pending, so the
timeout never restarts it.

Fix by not checking for pending in the timeout handler.

If discovery is stopped and restarted in the meantime, the timeout will
be canceled.

Also, when a new discovery is started, the retry count wasn't cleared.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: fix: empty zone causes endless discovery retries.
Joe Eykholt [Tue, 25 Aug 2009 21:02:33 +0000 (14:02 -0700)]
[SCSI] libfc: fix: empty zone causes endless discovery retries.

On some switches, an empty zone causes GPN_FT to be rejected
with reason 9 (unable) explanation 7 (FC-4 types not registered),
which causes discovery to be retried endlessly.  Treat this as
just an empty response and consider discovery complete.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: handle discovery failure more correctly.
Joe Eykholt [Tue, 25 Aug 2009 21:02:27 +0000 (14:02 -0700)]
[SCSI] libfc: handle discovery failure more correctly.

Abhijeet Joglekar wrote: "In gpn_ft_resp, if the payload is short,
or unexpected response or out of sequence frame, then we just
return and do nothing. We should either enter fc_disc_done()
with DISC_EV_FAIL which will then restart any queued discovery
requests or call lport module which will reset local port,
or we should call fc_disc_error() so that the gpn_ft is retried.

The situation as is causes discovery to remain pending and never
get restarted, in these rare cases.  We saw this due to a coding
bug in fc_disc before.  The only ways it could happen would be
bugs, packet corruption or an FC fabric problem.

Change it to fail discovery.  The local port will restart
discovery, although it probably should just give up until
the next link flap.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: rearrange code in fc_disc_gpn_ft_resp()
Joe Eykholt [Tue, 25 Aug 2009 21:02:22 +0000 (14:02 -0700)]
[SCSI] libfc: rearrange code in fc_disc_gpn_ft_resp()

Code cleanup for fc_disc_gpn_ft_resp().

Some of the fc_disc.c code was poorly formatted. For example, some lines
in fc_disc.c were unnecessarily truncated and the buf variable could
be eliminated.

Also moved the increment of seq_count into fc_disc_gpn_ft_parse(), to
avoid doing it separately before each call.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: discovery restart sequence error fix
Joe Eykholt [Tue, 25 Aug 2009 21:02:17 +0000 (14:02 -0700)]
[SCSI] libfc: discovery restart sequence error fix

When an RSCN is received during fabric discovery, it restarts.
After the restart, disc->seq_count was incremented, so when
the first frame was received, it was considered "out of sequence".
That left the state disc->active, preventing further discoveries.

Change to advance the sequence count before parsing, so that it
won't be changed after a potential restart.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: do not log off rports before or after discovery
Joe Eykholt [Tue, 25 Aug 2009 21:02:11 +0000 (14:02 -0700)]
[SCSI] libfc: do not log off rports before or after discovery

When receiving an RSCN, do not log off all rports.  This is
extremely disruptive.  If, after the GPN_FT response, some
rports haven't been listed, delete them.

Add field disc_id to structs fc_rport_priv and fc_disc.
disc_id is an arbitrary serial number used to identify the
rports found by the latest discovery.  This eliminates the need
to go through the rport list when restarting discovery.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: move rport_lookup into fc_rport.c
Joe Eykholt [Tue, 25 Aug 2009 21:02:06 +0000 (14:02 -0700)]
[SCSI] libfc: move rport_lookup into fc_rport.c

Move the libfc remote port lookup function into fc_rport.c.
This seems like the best place for it.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: change to make remote port callback optional
Joe Eykholt [Tue, 25 Aug 2009 21:02:01 +0000 (14:02 -0700)]
[SCSI] libfc: change to make remote port callback optional

Since the rport list maintenance is now done in the rport module,
the callback (and ops) are usually not necessary.

Allow rdata->ops to be left NULL if nothing needs
to be done in an event callback.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: have rport_create do a lookup for pre-existing rports first
Joe Eykholt [Tue, 25 Aug 2009 21:01:55 +0000 (14:01 -0700)]
[SCSI] libfc: have rport_create do a lookup for pre-existing rports first

For future discovery patches, change rport_create to return a previously
created rport_priv that has the FC_ID as long as it isn't in deleted state.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: make rport module maintain the rport list
Joe Eykholt [Tue, 25 Aug 2009 21:01:50 +0000 (14:01 -0700)]
[SCSI] libfc: make rport module maintain the rport list

The list of remote ports (struct fc_rport_priv) has been
maintained by the discovery module.  In preparation for having
lport->tt.rport_create() do a lookup first, maintain the
rports list in the rport module.  It will still be protected
by the disc_mutex.

The DNS rport is an exception for until after further patches.
For now, do not add it to the list.

The point-to-point rport will be in the discovery list.
So at shutdown, it doesn't need to be separately logged out.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: simplify fc_lport_rport_callback
Joe Eykholt [Tue, 25 Aug 2009 21:01:44 +0000 (14:01 -0700)]
[SCSI] libfc: simplify fc_lport_rport_callback

The lport rport callback can only be called for the dNS rport,
since its the only rport who's ops point to that function.

Remove unnecessary checking and debug messages.
Put the locking outside the switch statement as a simplification.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: rport debug messages were printing pointer values
Joe Eykholt [Tue, 25 Aug 2009 21:01:39 +0000 (14:01 -0700)]
[SCSI] libfc: rport debug messages were printing pointer values

Don't print large negative decimal numbers for frame pointers in
the debug messages from fc_rport_error().  Just print 0 if its a
frame pointer, and print the error numbers as positive.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: remove unused disc->delay element
Joe Eykholt [Tue, 25 Aug 2009 21:01:34 +0000 (14:01 -0700)]
[SCSI] libfc: remove unused disc->delay element

Delete unused disc->delay element.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: eliminate disc->event
Joe Eykholt [Tue, 25 Aug 2009 21:01:29 +0000 (14:01 -0700)]
[SCSI] libfc: eliminate disc->event

There was no need to have the discovery status stored in struct fc_disc.

Change fc_disc_done() to take the discovery status as an argument
and just pass it on to the discovery callback.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: fix rport event race between READY and LOGO
Joe Eykholt [Tue, 25 Aug 2009 21:01:23 +0000 (14:01 -0700)]
[SCSI] libfc: fix rport event race between READY and LOGO

When a remote port becomes ready and a LOGO is received before
the READY event is in rport_work waiting on the mutex, the
event is changed to LOGO and the work queued, so both the
calls to rport_work see the LOGO event, and both try to do
the list_del(), causing a crash.

Don't change the event if it is already set.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: don't create dummy (rogue) remote ports
Joe Eykholt [Tue, 25 Aug 2009 21:01:18 +0000 (14:01 -0700)]
[SCSI] libfc: don't create dummy (rogue) remote ports

Don't create a "dummy" remote port to go with fc_rport_priv.

Make the rport truly optional by allocating fc_rport_priv separately
and not requiring a dummy rport to be there if we haven't yet done
fc_remote_port_add().

The fc_rport_libfc_priv remains as a structure attached to the
rport for I/O purposes.

Be sure to hold references on rdata when the lock is dropped in
fc_rport_work().

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: rename rport event CREATED to READY
Joe Eykholt [Tue, 25 Aug 2009 21:01:12 +0000 (14:01 -0700)]
[SCSI] libfc: rename rport event CREATED to READY

Remote ports will become READY more than once after
ADISC is implemented in a later patch.

The event callback that has been called "CREATED" will mean "READY".
Rename it now in preparation for those changes.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: rearrange code in fc_rport_work
Joe Eykholt [Tue, 25 Aug 2009 21:01:06 +0000 (14:01 -0700)]
[SCSI] libfc: rearrange code in fc_rport_work

This is a cleanup without semantic changes to use a switch
statement instead of a series of if-statements in fc_rport_work(),
and to move some declarations up to the top.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: make rport structure optional
Joe Eykholt [Tue, 25 Aug 2009 21:01:01 +0000 (14:01 -0700)]
[SCSI] libfc: make rport structure optional

Allow a struct fc_rport_priv to have no fc_rport associated with it.
This sets up to remove the need for "rogue" rports.

Add a few fields to fc_rport_priv that are needed before the fc_rport
is created.  These are the ids, maxframe_size, classes, and rport pointer.

Remove the macro PRIV_TO_RPORT().  Just use rdata->rport where appropriate.

To take the place of the get_device()/put_device ops that were used to
hold both the rport and rdata, add a reference count to rdata structures
using kref.  When kref_get decrements the refcount to zero, a new template
function releasing the rdata should be called.  This will take care of
freeing the rdata and releasing the hold on the rport (for now).  After
subsequent patches make the rport truly optional, this release function
will simply free the rdata.

Remove the simple inline function fc_rport_set_name(), which becomes
semanticly ambiguous otherwise.  The caller will set the port_name and
node_name in the rdata->Ids, which will later be copied to the rport
when it its created.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: change elsct to use FC_ID instead of rdata
Joe Eykholt [Tue, 25 Aug 2009 21:00:55 +0000 (14:00 -0700)]
[SCSI] libfc: change elsct to use FC_ID instead of rdata

tt.elsct_send is used by both FCP and by the rport state machine.
After further patches, these two modules will use different
structures for the remote port.

So, change elsct_send to use the FC_ID instead of the fc_rport_priv
as its argument.  It currently only uses the FC_ID anyway.

For CT requests the destination FC_ID is still implicitly 0xfffffc.
After further patches the did arg on CT requests will be used to
specify the FC_ID being inquired about for GPN_ID or other queries.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: make fc_rport_priv the primary rport interface.
Joe Eykholt [Tue, 25 Aug 2009 21:00:50 +0000 (14:00 -0700)]
[SCSI] libfc: make fc_rport_priv the primary rport interface.

The rport and discovery modules deal with remote ports
before fc_remote_port_add() can be done, because the
full set of rport identifiers is not known at early stages.

In preparation for splitting the fc_rport/fc_rport_priv allocation,
make fc_rport_priv the primary interface for the remote port and
discovery engines.

The FCP / SCSI layers still deal with fc_rport and
fc_rport_libfc_priv, however.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: fix RPORT_TO_PRIV and PRIV_TO_RPORT() macros.
Joe Eykholt [Tue, 25 Aug 2009 21:00:45 +0000 (14:00 -0700)]
[SCSI] libfc: fix RPORT_TO_PRIV and PRIV_TO_RPORT() macros.

These macros introduce extra undesirable semicolons that keep
them from being used in expressions, and they don't protect
against being passed an expression.

Add parens and remove the semicolons.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: change interface for rport_create
Joe Eykholt [Tue, 25 Aug 2009 21:00:39 +0000 (14:00 -0700)]
[SCSI] libfc: change interface for rport_create

The interface for lport->tt.rport_create() takes a fc_disc_port arg,
which is unnatural for most calls.   The only reason for this was
to avoid passing in the local port as an argument, but otherwise
added to complexity.

Simplify by just using lport and fc_rport_identifiers.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: prepare to split off struct fc_rport_priv from fc_rport_libfc_priv
Joe Eykholt [Tue, 25 Aug 2009 21:00:34 +0000 (14:00 -0700)]
[SCSI] libfc: prepare to split off struct fc_rport_priv from fc_rport_libfc_priv

While the I/O and LLD interfaces use fc_rport_libfc_priv, the
disc and rport interfaces will use fc_rport_priv, which will
be separately allocated.

Change the disc and rport usage of fc_rport_libfc_priv to fc_rport_priv.

Use #define temporarily to make both names equivalent until a
subsequent patch splits them.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: use rtnl mutex in place of hostlist lock
Chris Leech [Tue, 25 Aug 2009 21:00:28 +0000 (14:00 -0700)]
[SCSI] fcoe: use rtnl mutex in place of hostlist lock

This just cuts down on the number of locks we're dealing with, and
eliminates the need to take another lock in the netdev notifier.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: Fix module ref count bug by adding NETDEV UNREGISTER handling
Chris Leech [Tue, 25 Aug 2009 21:00:23 +0000 (14:00 -0700)]
[SCSI] fcoe: Fix module ref count bug by adding NETDEV UNREGISTER handling

Fixes reference counting on fcoe_instance and net_device, and adds
NETDEV_UNREGISTER notifier handling so that you can unload network drivers.
FCoE no longer increments the module use count for the network driver.

On an NETDEV_UNREGISTER event, destroying the FCoE instance is deferred to a
workqueue context to avoid RTNL deadlocks.

Based in part by an earlier patch from John Fastabend

John's patch description:
Currently, the netdev module ref count is not decremented with module_put()
when the module is unloaded while fcoe instances are present. To fix this
removed reference count on netdev module completely and added functionality to
netdev event handling for NETDEV_UNREGISTER events.

This allows fcoe to remove devices cleanly when the netdev module is unloaded
so we no longer need to hold a reference count for the netdev module.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: move the host-list add/remove to keep out VN_Ports
Chris Leech [Tue, 25 Aug 2009 21:00:18 +0000 (14:00 -0700)]
[SCSI] fcoe: move the host-list add/remove to keep out VN_Ports

We only want the FCoE create and destroy routines to deal with top level
N_Ports, the VN_Ports are tracked on the vport list (see scsi_transport_fc).

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: add mutex to protect create and destroy
Chris Leech [Tue, 25 Aug 2009 21:00:13 +0000 (14:00 -0700)]
[SCSI] fcoe: add mutex to protect create and destroy

Rather than rely on the hostlist_lock to be held while creating exchange
managers, serialize fcoe instance creation and destruction with a mutex.
This will allow the hostlist addition to be moved out of fcoe_if_create(),
which will simplify NPIV support.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: split out per interface setup
Chris Leech [Tue, 25 Aug 2009 21:00:07 +0000 (14:00 -0700)]
[SCSI] fcoe: split out per interface setup

fcoe_netdev_config() is called during initialization of a libfc instance.
Much of what was there only needs to be done once for each net_device.
The same goes for the corresponding cleanup.

The FIP controller initialization is moved to interface creation time.
Otherwise it will keep getting re-initialized for every VN_Port once NPIV is
enabled.

fcoe_if_destroy() has some reordering to deal with the changes.  Receives are
not stopped until after fcoe_interface_put() is called, but transmits must be
stopped before.  So there is some care to stop libfc transmits and the
transmit backlog timer, then call fcoe_interface_put which will stop receives
and cleanup the FIP controller, then the receive queues can be cleaned and the
port freed.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: fcoe_interface create, destroy and refcounting
Chris Leech [Tue, 25 Aug 2009 21:00:02 +0000 (14:00 -0700)]
[SCSI] fcoe: fcoe_interface create, destroy and refcounting

Up to this point the fcoe_instance structure was simply kzalloc/kfreed.  This
patch introduces create and destroy functions as well as kref based reference
counting.  The create function will grow as the initialization code is moved
there.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: remove fcoe_interface->priv pointer
Chris Leech [Tue, 25 Aug 2009 20:59:56 +0000 (13:59 -0700)]
[SCSI] fcoe: remove fcoe_interface->priv pointer

The priv pointer is no longer needed, and once NPIV is enabled
fcoe_interface:fc_lport becomes a one-to-many relationship.

Remove the single pointer.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: move offload exchange manager pointer from fcoe_port to fcoe_interface
Chris Leech [Tue, 25 Aug 2009 20:59:51 +0000 (13:59 -0700)]
[SCSI] fcoe: move offload exchange manager pointer from fcoe_port to fcoe_interface

The offload EM pointer is only used when setting up a new libfc instance, but
as it's designed to be shared among NPIV VN_Ports it should be tracked in
fcoe_interface.

With the host-list changed to track fcoe_interfaces as well, this is needed
before we can remove the priv pointer from that structure (which is only there
to help in the transition, and stops making sense once NPIV is enabled).

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: move FIP controller from fcoe_port to fcoe_interface
Chris Leech [Tue, 25 Aug 2009 20:59:46 +0000 (13:59 -0700)]
[SCSI] fcoe: move FIP controller from fcoe_port to fcoe_interface

There is only one FIP state per net_device, so the FIP controller needs to be
moved from the per-SCSI-host fcoe_port to the per-net_device fcoe_interface
structure.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: move packet handlers from fcoe_port to fcoe_interface
Chris Leech [Tue, 25 Aug 2009 20:59:41 +0000 (13:59 -0700)]
[SCSI] fcoe: move packet handlers from fcoe_port to fcoe_interface

The packet handlers need to be tracked in fcoe_interface so there is only one
set per net_device.  When NPIV is enabled there will be multiple SCSI hosts
and multiple fcoe_port structures on a single net_device.

The packet handlers match by ethertype and netdev.  If the same handler gets
registered on a single netdev multiple times, the receive function will be
called multiple times for each frame.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: move netdev to fcoe_interface
Chris Leech [Tue, 25 Aug 2009 20:59:35 +0000 (13:59 -0700)]
[SCSI] fcoe: move netdev to fcoe_interface

The network interface needs to be shared between all NPIV VN_Ports, therefor
it should be tracked in the fcoe_interface and not for each SCSI host in
fcoe_port.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: Introduce and allocate fcoe_interface structure, 1:1 with net_device
Chris Leech [Tue, 25 Aug 2009 20:59:30 +0000 (13:59 -0700)]
[SCSI] fcoe: Introduce and allocate fcoe_interface structure, 1:1 with net_device

In preparation for NPIV support, I'm splitting the fcoe instance structure
into two to remove the assumptions about it being 1:1 with the net_device.
There will now be two structures, one which is 1:1 with the underlying
net_device and one which is allocated per virtual SCSI/FC host.

fcoe_softc is renamed to fcoe_port for the per Scsi_Host FCoE private data.

Later patches with start moving shared stuff from fcoe_port to fcoe_interface

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: interface changes to fcoe_if_create and fcoe_if_destroy
Chris Leech [Tue, 25 Aug 2009 20:59:24 +0000 (13:59 -0700)]
[SCSI] fcoe: interface changes to fcoe_if_create and fcoe_if_destroy

By passing in the parent device instead of assuming the netdev is what
should be used, fcoe_if_create becomes usable for NPIV vports as well.
You still need a netdev, because that's how FCoE works.  Also removed some
duplicate checks from fcoe_if_create that are already in fcoe_create.

fcoe_if_destroy needs to take an lport as it's only argument, not a netdev.
That removes the 1:1 netdev:lport assumption from the destroy path.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: remove unnecessary list and lock initializations.
Joe Eykholt [Tue, 25 Aug 2009 20:59:19 +0000 (13:59 -0700)]
[SCSI] fcoe: remove unnecessary list and lock initializations.

The hostlist and the hostlist_lock were initialized both in
the delcaration and in fcoe_init().  Remove the unneeded code.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: fix missing error check in call to fcoe_if_init
Chris Leech [Tue, 25 Aug 2009 20:59:14 +0000 (13:59 -0700)]
[SCSI] fcoe: fix missing error check in call to fcoe_if_init

fcoe_if_init() can fail, but it's return value wasn't checked

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfcoe: fcoe_ctlr_destroy use cancel_work_sync instead of flush_work
Chris Leech [Tue, 25 Aug 2009 20:59:08 +0000 (13:59 -0700)]
[SCSI] libfcoe: fcoe_ctlr_destroy use cancel_work_sync instead of flush_work

Use cancel_work_sync() in place of flush_work(), so that
fcoe_ctlr_destroy() can be called from a workqueue.

Also, purge the receive queue after the recv_work has been cancled because
if recv_work isn't run it's not guaranteed to be empty now.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: Add sysfs parameter to fcoe for minimum DDP read I/O size
Yi Zou [Tue, 25 Aug 2009 20:59:03 +0000 (13:59 -0700)]
[SCSI] fcoe: Add sysfs parameter to fcoe for minimum DDP read I/O size

This adds fcoe_ddp_min as a module parameter for fcoe module to:
/sys/module/fcoe/parameters/ddp_min

It is observed that for some hardware, particularly Intel 82599, there is too
much overhead in setting up context for direct data placement (DDP) read when
the requested read I/O size is small. This is added as a module parameter for
performance tuning and is set as 0 by default and user can change this based
on their own hardware.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe, libfc: fully makes use of per cpu exch pool and then removes em_lock
Vasu Dev [Tue, 25 Aug 2009 20:58:53 +0000 (13:58 -0700)]
[SCSI] fcoe, libfc: fully makes use of per cpu exch pool and then removes em_lock

1. Updates fcoe_rcv() to queue incoming frames to the fcoe per
   cpu thread on which this frame's exch was originated and simply
   use current cpu for request exch not originated by initiator.
   It is redundant to add this code under CONFIG_SMP, so removes
   CONFIG_SMP uses around this code.

2. Updates fc_exch_em_alloc, fc_exch_delete, fc_exch_find to use
   per cpu exch pools, here fc_exch_delete is rename of older
   fc_exch_mgr_delete_ep since ep/exch are now deleted in pools
   of EM and so brief new name is sufficient and better name.

   Updates these functions to map exch id to their index into exch
   pool using fc_cpu_mask, fc_cpu_order and EM min_xid.
   This mapping is as per detailed explanation about this in
   last patch and basically this is just as lower fc_cpu_mask
   bits of exch id as cpu number and upper bit sum of EM min_xid
   and exch index in pool.

   Uses pool next_index to keep track of exch allocation from
   pool along with pool_max_index as upper bound of exches array
   in pool.

3. Adds exch pool ptr to fc_exch to free exch to its pool in
   fc_exch_delete.

4. Updates fc_exch_mgr_reset to reset all exch pools of an EM,
   this required adding fc_exch_pool_reset func to reset exches
   in pool and then have fc_exch_mgr_reset call fc_exch_pool_reset
   for each pool within each EM for a lport.

5. Removes no longer needed exches array, em_lock, next_xid, and
   total_exches from struct fc_exch_mgr, these are not needed after
   use of per cpu exch pool, also removes not used max_read,
   last_read from struct fc_exch_mgr.

6. Updates locking notes for exch pool lock with fc_exch lock and
   uses pool lock in exch allocation, lookup and reset.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe, libfc: adds per cpu exch pool within exchange manager(EM)
Vasu Dev [Tue, 25 Aug 2009 20:58:47 +0000 (13:58 -0700)]
[SCSI] fcoe, libfc: adds per cpu exch pool within exchange manager(EM)

Adds per cpu exch pool for these reasons:-

 1. Currently an EM instance is shared across all cpus to manage
    all exches for all cpus. This required em_lock across all
    cpus for an exch alloc, free, lookup and reset each frame
    and that made em_lock expensive, so instead having per cpu
    exch pool with their own per cpu pool lock will likely reduce
    locking contention in fast path for an exch alloc, free and
    lookup.

 2. Per cpu exch pool will likely improve cache hit ratio since
    all frames of an exch will be processed on the same cpu on
    which exch originated.

This patch is only prep work to help in keeping complexity of next
patch low, so this patch only sets up per cpu exch pool and related
helper funcs to be used by next patch. The next patch fully makes
use of per cpu exch pool in all code paths ie. tx, rx and reset.

Divides per EM exch id range equally across all cpus to setup per
cpu exch pool. This division is such that lower bits of exch id
carries cpu number info on which exch originated, later a simple
bitwise AND operation on exch id of incoming frame with fc_cpu_mask
retrieves cpu number info to direct all frames to same cpu on which
exch originated. This required a global fc_cpu_mask and fc_cpu_order
initialized to max possible cpus number nr_cpu_ids rounded up to 2's
power, this will be used in mapping exch id and exch ptr array
index in pool during exch allocation, find or reset code paths.

Adds a check in fc_exch_mgr_alloc() to ensure specified min_xid
lower bits are zero since these bits are used to carry cpu info.

Adds and initializes struct fc_exch_pool with all required fields
to manage exches in pool.

Allocates per cpu struct fc_exch_pool with memory for exches array
for range of exches per pool. The exches array memory is followed
by struct fc_exch_pool.

Adds fc_exch_ptr_get/set() helper functions to get/set exch ptr in
pool exches array at specified array index.

Increases default FCOE_MAX_XID to 0x0FFF from 0x07EF, so that more
exches are available per cpu after above described exch id range
division across all cpus to each pool.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: libfcoe: extra semicolon in CHECK_LOGGING macros causes compile error
Joe Eykholt [Tue, 25 Aug 2009 20:58:42 +0000 (13:58 -0700)]
[SCSI] fcoe: libfcoe: extra semicolon in CHECK_LOGGING macros causes compile error

If using code like this:
if (foo)
FCOE_DBG("foo\n);
else
FCOE_DBG("bar\n");

one gets compile errors because FCOE_DBG expands with its own semicolon,
making one too many for the if-statement.

Remove the offending semicolon in fcoe.h and also a similar case
in libfcoe.c.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libfc: Fix misleading debug statement
Robert Love [Tue, 25 Aug 2009 20:58:37 +0000 (13:58 -0700)]
[SCSI] libfc: Fix misleading debug statement

The statement reads, "Exchange timed out, notifying the upper layer",
however, this statement is printed whenever the timer is armed. This
is confusing to someone debugging the code because every time an
exchange is initialized, there is an incorrect statement stating that
the timer has already timed out. This patch changes the statement to
read, "Exchange timer armed" which is more accurate.

This patch also adds a debug statement in the timeout handler to
properly indicate that the exchange has timed out.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] fcoe: Add format spacing to FCOE_NETDEV_DBG debug macro
Robert Love [Tue, 25 Aug 2009 20:58:31 +0000 (13:58 -0700)]
[SCSI] fcoe: Add format spacing to FCOE_NETDEV_DBG debug macro

There's currently no space between the interface name and the
user specified format/string. This patch adds a space and a colon
to the output to separate the interface name and the user
specified string.

So, instead of "ethXfoo" it will read "ethX: foo".

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libiscsi, iscsi_tcp: check suspend bit before each call to xmit_task
Mike Christie [Thu, 20 Aug 2009 20:11:03 +0000 (15:11 -0500)]
[SCSI] libiscsi, iscsi_tcp: check suspend bit before each call to xmit_task

If we had multiple tasks on the cmd or requeue  lists, and iscsi_tcp
returns a error, the write_space function can still run and queue
iscsi_data_xmit. If it was a legetimate problem and iscsi_conn_failure
was run but we raced and iscsi_data_xmit was run first it could miss
the suspend bit checks, and start trying to send data again and hit
another timeout. A similar problem is present when using cxgb3i.

This has libiscsi check the suspend bit before calling the xmit
task callout, so we at least do not try sending multiple tasks
(one could be sent).

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] iscsi_tcp: add new conn error to indicate tcp conn closed
Mike Christie [Thu, 20 Aug 2009 20:11:02 +0000 (15:11 -0500)]
[SCSI] iscsi_tcp: add new conn error to indicate tcp conn closed

If a target closed the connection, we will detect it in the
state_changed or data_ready callout. This adds a new conn
error value to use for this problem, so it is not confused
with when the initiator throws a conn error and drops
the connection.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] iscsi class: Add logging to scsi_transport_iscsi.c
Mike Christie [Thu, 20 Aug 2009 20:11:01 +0000 (15:11 -0500)]
[SCSI] iscsi class: Add logging to scsi_transport_iscsi.c

Logging for connections and sessions in the scsi_transport_iscsi module
is now controlled by module parameters.

Signed-off-by: Erez Zilber <erezzi.list@gmail.com>
[Mike Christie: newline fixups and modification of some dbg statements]
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] qla4xxx: Removed residual from overrun debug print
Mike Christie [Thu, 20 Aug 2009 20:11:00 +0000 (15:11 -0500)]
[SCSI] qla4xxx: Removed residual from overrun debug print

The residual variable is only valid for udnerrun so do
not print it out for the overrun case.

Signed-off-by: Karen Higgins <karen.higgins@qlogic.com>
[Mike Christie: Fix coding style issues in patch]
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libiscsi: handle immediate command rejections
Mike Christie [Thu, 20 Aug 2009 20:10:59 +0000 (15:10 -0500)]
[SCSI] libiscsi: handle immediate command rejections

If we sent multiple pdus as immediate the target could be
rejecting some and we have just been dropping the rejection
notification. This adds code to handle nop-out rejections,
so if a nop-out was sent as a ping and rejected we do not
mark the connection bad. Instead we just clean up the timers
since we have pdu making a rount trip we know the connection
is good.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] libiscsi: don't increment cmdsn if cmd is not sent
Mike Christie [Thu, 20 Aug 2009 20:10:58 +0000 (15:10 -0500)]
[SCSI] libiscsi: don't increment cmdsn if cmd is not sent

We increment session->cmdsn at the top of iscsi_prep_scsi_cmd_pdu, but
if the prep  ecb or prep bidi or init_task calls fails then we leave the
session->cmdsn incremented. This moves the cmdsn manipulation to the end
of the function when we know it has succeeded.

It also adds a session->cmdsn--; in queuecommand for if a driver like
bnx2i tries to send a a task from that context but it fails. We do not
have to do this in the xmit thread context because that code will retry
the same task if the initial call fails.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] iscsi_tcp: Evaluate socket state in data_ready()
Hannes Reinecke [Thu, 20 Aug 2009 20:10:57 +0000 (15:10 -0500)]
[SCSI] iscsi_tcp: Evaluate socket state in data_ready()

The network core will call the state_change() callback
prior to the data_ready() callback, which might cause
us to lose a connection state change.
So we have to evaluate the socket state at the end
of the data_ready() callback, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] qla2xxx: Add asynchronous-login support.
Andrew Vasquez [Thu, 20 Aug 2009 18:06:05 +0000 (11:06 -0700)]
[SCSI] qla2xxx: Add asynchronous-login support.

ISPs which support this feature include 23xx and above.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] qla2xxx: Generalize srb structure usage.
Andrew Vasquez [Thu, 20 Aug 2009 18:06:04 +0000 (11:06 -0700)]
[SCSI] qla2xxx: Generalize srb structure usage.

Lay groundwork for adding alternative asynchronous operations by
generalize and extending the SRB structure.  This allows for
follow-on patches to add support for:

- Asynchronous logins.
- ELS/CT passthru requests.
- Loopback requests.
- Non-blocking mailbox commands (ABTS, Task Management, etc).

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mpt2sas: Bump driver version 01.100.06.00
Kashyap, Desai [Thu, 20 Aug 2009 07:55:03 +0000 (13:25 +0530)]
[SCSI] mpt2sas: Bump driver version 01.100.06.00

Bump version to 01.100.06.00

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by:: Eric Moore <Eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mpt2sas: cleanup interrupt routine and config_request optimization
Kashyap, Desai [Thu, 20 Aug 2009 07:54:31 +0000 (13:24 +0530)]
[SCSI] mpt2sas: cleanup interrupt routine and config_request optimization

Cleaned up base_interrupt routine to be more effiecent.

Deleted about a third of the config page API by moving redundant code from all
the calling functions to _config_request.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <Eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mpt2sas: Raid 10 Volume is showing as Raid 1E in dmesg
Kashyap, Desai [Thu, 20 Aug 2009 07:53:49 +0000 (13:23 +0530)]
[SCSI] mpt2sas: Raid 10 Volume is showing as Raid 1E in dmesg

This patch modifies the slave_configure callback so the messages that get sent
to system log for RAID1E volumes contain the string "RAID10" instead of
"RAID1E". These messages contain information regarding what kind of scsi device
is being added. Certain OEMS can enable displaying the RAID10 string instead of
RAID1E via manufacturing page 10.   The driver will read this config page at
driver load time, then determine from the GenericFlags0 bits whether display
the RAID10 or RAID1E string, also even drive count is taken into consideration.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <Eric.moore@lsi.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mpt2sas: setting SDEV into RUNNING state from Interrupt context
Kashyap, Desai [Thu, 20 Aug 2009 07:53:19 +0000 (13:23 +0530)]
[SCSI] mpt2sas: setting SDEV into RUNNING state from Interrupt context

Changing SDEV Running state from interrupt context. Previously It was
handle in work queue thread. With this change It will not wait for work
queue thread to execute scsih_ublock_io_device to put SDEV into Running
state. This will reduce delay for Device becoming RUNNING.

Modified this patch considering James comment "Not to change SDEV state
using  scsi_device_set_state API, instead use scsi_internal_device_unblock
scsi_internal_device_block API"

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <Eric.moore@lsi.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mpt2sas: Removed wrapper funtions _scsih_link_change.
Kashyap, Desai [Thu, 20 Aug 2009 07:52:39 +0000 (13:22 +0530)]
[SCSI] mpt2sas: Removed wrapper funtions _scsih_link_change.

Deleted the wrapper function called _scsih_link_change. This function was
implemented for compatibility reasons only, between different kernel versions.
Currently this function is no longer needed.  The calling function are
converted to calling mpt2sas_transport_update_phy_link_change directly in the
transport layer.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <Eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mpt2sas: Prevent sending command to FW while Host Reset
Kashyap, Desai [Thu, 20 Aug 2009 07:52:00 +0000 (13:22 +0530)]
[SCSI] mpt2sas: Prevent sending command to FW while Host Reset

This patch renames the flag for indicating host reset from
ioc_reset_in_progress to shost_recovery. It also removes the spin locks
surrounding the setting of this flag, which are unnecessary.   Sanity checks on
the shost_recovery flag were added thru out the code so as to prevent sending
firmware commands during host reset.  Also, the setting of the shost state to
SHOST_RECOVERY was removed to prevent deadlocks, this is actually better
handled by the shost_recovery flag.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <Eric.moore@lsi.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mpt2sas : Rescan topology from Interrupt context instead of work thread
Kashyap, Desai [Thu, 20 Aug 2009 07:50:54 +0000 (13:20 +0530)]
[SCSI] mpt2sas : Rescan topology from Interrupt context instead of work thread

Following host reset its possible that the controller firmware could
assign new handles for devices, as well as adding or deleting devices. There is
code in the driver that will rescan the topology folowing host reset; updating
device handles, and remove devices that are no longer responding. This patch
will improve the responsivness by moving this rescaning from the delayed hotplug
worker thread to immediately following the host reset.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <Eric.moore@lsi.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] stex: Add reset code for st_yel (v2)
Ed Lin [Tue, 18 Aug 2009 19:15:14 +0000 (12:15 -0700)]
[SCSI] stex: Add reset code for st_yel (v2)

Add reset related code for st_yel.
1. Set the SS_H2I_INT_RESET bit.
2. Wait for the SS_MU_OPERATIONAL flag. This is also part of
   normal handshake process so move it to handshake routine.
3. Continue handshake with the firmware.

Signed-off-by: Ed Lin <ed.lin@promise.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: optimize zfcp_qdio_account
Heiko Carstens [Tue, 18 Aug 2009 13:43:32 +0000 (15:43 +0200)]
[SCSI] zfcp: optimize zfcp_qdio_account

Remove expensive ktime_get()/ktime_us_delta() functions from the hot
path and use get_clock_monotonic() instead. This elimates seven
function calls and avoids a lot of unnecessary calculations.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Remove duplicated code for debug timestamps
Christof Schmitt [Tue, 18 Aug 2009 13:43:31 +0000 (15:43 +0200)]
[SCSI] zfcp: Remove duplicated code for debug timestamps

The timestamp calculation used for s390dbf output is the same in a
private zfcp function and in debug.c. Replace both with a common
inline function.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Handle failures during device allocation correctly
Christof Schmitt [Tue, 18 Aug 2009 13:43:30 +0000 (15:43 +0200)]
[SCSI] zfcp: Handle failures during device allocation correctly

dev_set_name tries to allocate memory, so check the return value for
allocation failures. After dev_set_name succeeds, call device_register
as next step to be able to use put_device during error handling.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: proper use of device register
Sebastian Ott [Tue, 18 Aug 2009 13:43:29 +0000 (15:43 +0200)]
[SCSI] zfcp: proper use of device register

Don't use kfree directly after device registration started.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Replace config semaphore with mutex
Christof Schmitt [Tue, 18 Aug 2009 13:43:28 +0000 (15:43 +0200)]
[SCSI] zfcp: Replace config semaphore with mutex

The config semaphore is only used as a mutex, so replace it with a
simple mutex.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Defer resource allocation to first ccw_set_online call
Christof Schmitt [Tue, 18 Aug 2009 13:43:27 +0000 (15:43 +0200)]
[SCSI] zfcp: Defer resource allocation to first ccw_set_online call

So far, zfcp allocated all resources required for FCP
adapters/subchannels when the device was discovered in the ccw_probe
callback. If there are lots of unused FCP subchannels attached to a
system, this is a waste of resources. To alleviate this, defer the
resource allocation to the first call to ccw_set_online. To avoid
disruptions during possible following calls to ccw_set_offline and
then ccw_set_online, keep the adapter resources until the device is
finally being removed via ccw_remove. While doing this, also manage
the zfcp erp thread together with all other adapter resources in
zfcp_adapter_enqueue/dequeue.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Simplify and update ct/gs and els timeout handling
Christof Schmitt [Tue, 18 Aug 2009 13:43:26 +0000 (15:43 +0200)]
[SCSI] zfcp: Simplify and update ct/gs and els timeout handling

The recommendation for a timeout of 2 * R_A_TOV is the same for ct/gs
and els requests, so set it in the common function used for
initializing both request types. Besides, the timer inside zfcp should
only run longer than the timeout set for the channel, so 10 seconds
more should be enough (instead of 60 seconds).

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Use kthread API for zfcp erp thread
Christof Schmitt [Tue, 18 Aug 2009 13:43:25 +0000 (15:43 +0200)]
[SCSI] zfcp: Use kthread API for zfcp erp thread

Switch the creation of the zfcp erp thread from the deprecated
kernel_thread API to the kthread API. This allows also the removal of
some flags in zfcp since the kthread API handles thread creation and
shutdown internally. To allow the usage of the kthread_stop function,
replace the erp ready semaphore with a waitqueue for waiting until erp
actions arrive on the ready queue.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: resolve false usage of dd_data in fc_rport
Swen Schillig [Tue, 18 Aug 2009 13:43:24 +0000 (15:43 +0200)]
[SCSI] zfcp: resolve false usage of dd_data in fc_rport

The fc_rport structure reserves a reference where a LLD can put
information required in a situation where the fc transport class is
triggering LLD callbacks. The zfcp driver was using this variable
directly which is discouraged. This patch solves this issue by making
this reference unnecessary.  In addition the dev_loss_tmo callback is
removed, it is not required: zfcp does not access the fc_rport after
calling fc_remote_port_delete.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Apply common naming conventions to zfcp_fc
Swen Schillig [Tue, 18 Aug 2009 13:43:23 +0000 (15:43 +0200)]
[SCSI] zfcp: Apply common naming conventions to zfcp_fc

Update the Fibre Channel related code to use the zfcp_fc prefix.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: introduce _setup, _destroy for qdio and FC
Swen Schillig [Tue, 18 Aug 2009 13:43:22 +0000 (15:43 +0200)]
[SCSI] zfcp: introduce _setup, _destroy for qdio and FC

Extract independent data structures and introduce common _setup and
_destroy routines for QDIO and Fibre Channel related data structures

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Update dbf calls
Swen Schillig [Tue, 18 Aug 2009 13:43:21 +0000 (15:43 +0200)]
[SCSI] zfcp: Update dbf calls

Change the dbf data and functions to use the zfcp_dbf prefix
throughout the code. Also change the calls to dbf to use zfcp_dbf
instead of zfcp_adapter.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Decouple gid_pn requests from erp
Christof Schmitt [Tue, 18 Aug 2009 13:43:20 +0000 (15:43 +0200)]
[SCSI] zfcp: Decouple gid_pn requests from erp

Don't let the erp wait for gid_pn requests to complete. Instead, queue
the gid_pn work, exit erp and let the finished gid_pn work trigger a
new port reopen.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Move qdio related data out of zfcp_adapter
Swen Schillig [Tue, 18 Aug 2009 13:43:19 +0000 (15:43 +0200)]
[SCSI] zfcp: Move qdio related data out of zfcp_adapter

The zfcp_adapter structure was growing over time to a size of almost
one memory page. To reduce the size of the data structure and to
seperate different layers, put all qdio related data in the new
zfcp_qdio data structure.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Separate qdio attributes from zfcp_fsf_req
Swen Schillig [Tue, 18 Aug 2009 13:43:18 +0000 (15:43 +0200)]
[SCSI] zfcp: Separate qdio attributes from zfcp_fsf_req

Split all qdio related attributes out of zfcp_fsf_req and put it in
new structure.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Move workqueue to adapter struct
Swen Schillig [Tue, 18 Aug 2009 13:43:17 +0000 (15:43 +0200)]
[SCSI] zfcp: Move workqueue to adapter struct

Remove the global driver work queue and replace it with a workqueue
local to the adapter. The usage of this workqueue makes this the
correct place for the structure. In addition multiple adapters won't
block each other due to the serialization of the queued work.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Remove the useless ZFCP_REQ_AUTO_CLEANUP flag
Swen Schillig [Tue, 18 Aug 2009 13:43:16 +0000 (15:43 +0200)]
[SCSI] zfcp: Remove the useless ZFCP_REQ_AUTO_CLEANUP flag

The flag ZFCP_REQ_AUTO_CLEANUP was useless as the
ZFCP_STATUS_FSFREQ_CLEANUP flag is there for exactly the same purpose.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Improve request allocation through mempools
Swen Schillig [Tue, 18 Aug 2009 13:43:15 +0000 (15:43 +0200)]
[SCSI] zfcp: Improve request allocation through mempools

Remove the special case for NO_QTCB requests and optimize the
mempool and cache processing for fsfreqs. Especially use seperate
mempools for the zfcp_fsf_req and zfcp_qtcb structs.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Replace fsf_req wait_queue with completion
Swen Schillig [Tue, 18 Aug 2009 13:43:14 +0000 (15:43 +0200)]
[SCSI] zfcp: Replace fsf_req wait_queue with completion

The combination wait_queue/wakeup in conjunction with the flag
ZFCP_STATUS_FSFREQ_COMPLETED to signal the completion of an fsfreq
was not race-safe and can be better solved by a completion.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: fix layering oddities between zfcp_fsf and zfcp_qdio
Swen Schillig [Tue, 18 Aug 2009 13:43:13 +0000 (15:43 +0200)]
[SCSI] zfcp: fix layering oddities between zfcp_fsf and zfcp_qdio

There is no need for the QDIO layer to have knowledge or do things
wich are done better by the FSF layer and vice versa.  Straighten a
few things to improve vividness.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Implicitly close all wka ports
Christof Schmitt [Tue, 18 Aug 2009 13:43:12 +0000 (15:43 +0200)]
[SCSI] zfcp: Implicitly close all wka ports

An adapter shutdown implicitly closes all open ports. Make sure to
mark all WKA ports as offline, not only the directory server. Also
make sure that no pending wka port work is running when the adapter is
being removed.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Only issue one test link command per port
Christof Schmitt [Tue, 18 Aug 2009 13:43:11 +0000 (15:43 +0200)]
[SCSI] zfcp: Only issue one test link command per port

When the FCP channel returns a series of commands with the error
status "test link", zfcp will send a series of ELS ADISC commands.
This is technically no problem, but it is enough to only issue one
test command per remote port. So, track whether a ELS ADISC command is
already pending, and do not send a new one if there is already a
pending command.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Remove useless assignment
Christof Schmitt [Tue, 18 Aug 2009 13:43:10 +0000 (15:43 +0200)]
[SCSI] zfcp: Remove useless assignment

Using a bitwise OR to not set anything at all is pointless so remove
the useless statement.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Only collect FSF/HBA debug data for matching trace levels
Christof Schmitt [Tue, 18 Aug 2009 13:43:09 +0000 (15:43 +0200)]
[SCSI] zfcp: Only collect FSF/HBA debug data for matching trace levels

The default trace level is to only trace failed FSF commands. Thus it
is not necessary to collect trace data for most FSF commands, since
it will be thrown away later. Restructure the FSF/HBA trace
infrastructure to first check the trace level in a inline function and
only do the expensive data collection for matching trace levels.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Only collect SCSI debug data for matching trace levels
Christof Schmitt [Tue, 18 Aug 2009 13:43:08 +0000 (15:43 +0200)]
[SCSI] zfcp: Only collect SCSI debug data for matching trace levels

The default trace level is to only trace failed SCSI commands. Thus it
is not necessary to collect trace data for most SCSI commands since it
will be thrown away later. Restructure the SCSI trace infrastructure
to first check the trace level in a inline function and only do the
expensive data collection for matching trace levels.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: Move debug data from zfcp_data to own data structure
Christof Schmitt [Tue, 18 Aug 2009 13:43:07 +0000 (15:43 +0200)]
[SCSI] zfcp: Move debug data from zfcp_data to own data structure

The struct zfcp_adapter includes everything related to the debug
traces. This introduces dependences between the definitions in
zfcp_def.h and zfcp_dbf.h. Move all debug related data structures to a
new data structure to break those dependencies and manage the debug
data in zfcp_dbf.[hc].

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] zfcp: invalid usage after free of port resources
Swen Schillig [Tue, 18 Aug 2009 13:43:06 +0000 (15:43 +0200)]
[SCSI] zfcp: invalid usage after free of port resources

In certain error scenarios ports, rports are getting attached,
validated and removed from the systems environment. Depending on the
layer this occurs asynchronously. This patch fixes the few races
which existed and ensures all references and cross references are
cleared at the time they're invalid. In addition fc transports
actions are only scheduled when required.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] scsi_dh_rdac: add support for next generation of Dell PV array
Yanqing_Liu@Dell.com [Mon, 17 Aug 2009 19:31:42 +0000 (14:31 -0500)]
[SCSI] scsi_dh_rdac: add support for next generation of Dell PV array

This patch is to add DM support for next generation of Dell PowerVault
storage array.

Signed-off-by: Yanqing Liu <Yanqing_Liu@Dell.com>
Acked-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] update MAINTAINERS with new email
James Bottomley [Thu, 13 Aug 2009 19:23:12 +0000 (19:23 +0000)]
[SCSI] update MAINTAINERS with new email

Novell is now funding SCSI work, so the MAINTAINERS file should reflect
this.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mptsas : Bump version to 3.04.11
Kashyap, Desai [Wed, 5 Aug 2009 07:24:32 +0000 (12:54 +0530)]
[SCSI] mptsas : Bump version to 3.04.11

Bump version to 3.04.11

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mptsas : Code cleanup of host page alloc and diag reset.
Kashyap, Desai [Wed, 5 Aug 2009 07:23:51 +0000 (12:53 +0530)]
[SCSI] mptsas : Code cleanup of host page alloc and diag reset.

Code cleanup of host page alloc and diag reset.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mptsas : set max_id to infinite value.
Kashyap, Desai [Wed, 5 Aug 2009 07:22:58 +0000 (12:52 +0530)]
[SCSI] mptsas : set max_id to infinite value.

Do not set max_id value received from FW. Once SAS transport layer is
introduced max_id value is missleading to SCSI mid layer. Use max_id to
infinite value.

logic of can queue of scsi host is changed.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mptsas : Change config request timeout value to 30 seconds.
Kashyap, Desai [Wed, 5 Aug 2009 07:22:03 +0000 (12:52 +0530)]
[SCSI] mptsas : Change config request timeout value to 30 seconds.

Change config request timeout value to 30 seconds.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mptsas : Handle INSUFFICIENT resources status as similar to IOC BUSY status
Kashyap, Desai [Wed, 5 Aug 2009 07:21:25 +0000 (12:51 +0530)]
[SCSI] mptsas : Handle INSUFFICIENT resources status as similar to IOC BUSY status

Handle insufficient resources status as similar to busy status.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 years ago[SCSI] mptsas : Removed mptscsih_timer_expired.
Kashyap, Desai [Wed, 5 Aug 2009 07:20:02 +0000 (12:50 +0530)]
[SCSI] mptsas : Removed mptscsih_timer_expired.

Removed mptscsih_timer_expired. This timer is no more use.

Signed-off-by: James Bottomley <James.Bottomley@suse.de>